@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+Thai:wght@400;500;600&display=swap');
@import 'tailwindcss';


/* Sales follow-up */
.summary-icon.red { color: var(--red); background: var(--red-soft); }
.summary-icon.violet { color: var(--violet); background: var(--violet-soft); }

.sales-summary-card em {
    display: block;
    color: var(--muted-soft);
    font-size: 11px;
    font-style: normal;
}

.sales-summary-card.overdue strong { color: var(--red); }
.sales-summary-card.interested strong { color: var(--green); }
.sales-summary-card.deciding strong { color: var(--violet); }
.sales-toolbar .search-field { min-width: 280px; }
.sales-table { min-width: 1100px; }
.sales-table .entity-cell { min-width: 200px; }

.sales-row-overdue td { background: rgba(239, 71, 111, .035); }
.sales-row-overdue td:first-child { box-shadow: inset 3px 0 0 var(--red); }
.sales-row-today td { background: rgba(242, 138, 34, .045); }
.sales-row-today td:first-child { box-shadow: inset 3px 0 0 var(--amber); }
.sales-row-overdue:hover td { background: rgba(239, 71, 111, .065); }
.sales-row-today:hover td { background: rgba(242, 138, 34, .075); }

.sales-status,
.sales-priority {
    display: inline-flex;
    align-items: center;
    min-height: 25px;
    padding: 2px 9px;
    border-radius: 999px;
    color: var(--muted);
    background: #f1f4f8;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

.sales-status-interested,
.sales-status-won { color: var(--green); background: var(--green-soft); }
.sales-status-deciding { color: #6847d8; background: var(--violet-soft); }
.sales-status-unreachable,
.sales-status-not_interested { color: var(--red); background: var(--red-soft); }
.sales-status-contacted { color: var(--blue); background: var(--blue-soft); }
.sales-priority-high { color: var(--red); background: var(--red-soft); }
.sales-priority-low { color: var(--muted); background: var(--surface-soft); }

.sales-follow-date {
    display: grid;
    gap: 1px;
}

.sales-follow-date strong { font-size: 12px; font-weight: 600; }
.sales-follow-date small { color: var(--muted); font-size: 10px; }
.sales-row-overdue .sales-follow-date small { color: var(--red); }
.sales-row-today .sales-follow-date small { color: #ad6113; }

.sales-modal { max-width: 1080px; }
.sales-modal-scroll {
    max-height: calc(100vh - 180px);
    overflow-y: auto;
    padding: 22px 26px;
}

.sales-opportunity-form,
.sales-activity-form { margin: 0; }

.sales-form-section {
    display: grid;
    gap: 18px;
}

.sales-form-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.sales-form-heading h3,
.sales-form-heading p {
    margin: 0;
}

.sales-form-heading h3 {
    font-size: 16px;
    font-weight: 600;
}

.sales-form-heading p {
    margin-top: 2px;
    color: var(--muted);
    font-size: 12px;
}

.sales-services {
    margin: 0;
    padding: 0;
    border: 0;
}

.sales-services legend {
    margin-bottom: 9px;
    color: #526178;
    font-weight: 500;
}

.sales-services > div {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
}

.sales-services label {
    display: flex;
    align-items: center;
    gap: 9px;
    min-height: 42px;
    padding: 0 12px;
    border: 1px solid #dfe6ee;
    border-radius: 8px;
    background: var(--surface);
    cursor: pointer;
}

.sales-services input,
.customer-select-cell input {
    width: 17px;
    height: 17px;
    margin: 0;
    accent-color: var(--green);
}

.sales-inline-actions {
    display: flex;
    justify-content: flex-end;
}

.sales-workspace {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(340px, .95fr);
    gap: 26px;
    margin-top: 26px;
    padding-top: 24px;
    border-top: 1px solid var(--line);
}

.sales-quick-dates {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}

.sales-quick-dates > span {
    margin-right: 3px;
    color: var(--muted);
    font-size: 12px;
}

.sales-quick-dates button {
    min-height: 28px;
    padding: 0 9px;
    border: 1px solid #dfe6ee;
    border-radius: 7px;
    color: #526178;
    background: var(--surface);
    font-size: 11px;
}

.sales-quick-dates button:hover {
    color: var(--green);
    border-color: #bce8d5;
    background: var(--green-soft);
}

.sales-timeline-section { min-width: 0; }
.sales-timeline {
    display: grid;
    gap: 0;
    margin: 16px 0 0;
    padding: 0;
    list-style: none;
}

.sales-timeline li {
    position: relative;
    display: grid;
    grid-template-columns: 18px minmax(0, 1fr);
    gap: 10px;
    padding-bottom: 18px;
}

.sales-timeline li:not(:last-child)::before {
    content: '';
    position: absolute;
    top: 13px;
    bottom: -1px;
    left: 5px;
    width: 1px;
    background: #dfe6ee;
}

.sales-timeline-marker {
    position: relative;
    z-index: 1;
    width: 11px;
    height: 11px;
    margin-top: 4px;
    border: 3px solid #c8f1df;
    border-radius: 999px;
    background: var(--green);
}

.sales-timeline header {
    display: flex;
    justify-content: space-between;
    gap: 10px;
}

.sales-timeline header strong { font-size: 12px; font-weight: 600; }
.sales-timeline time,
.sales-timeline small { color: var(--muted-soft); font-size: 10px; }
.sales-timeline p { margin: 4px 0; color: #526178; font-size: 12px; white-space: pre-line; }
.sales-timeline-empty { grid-template-columns: 1fr !important; padding: 14px !important; border-radius: 8px; background: var(--surface-soft); }
.sales-timeline-empty p { margin-bottom: 0; }

.customer-select-col { width: 46px; }
.customer-select-cell { width: 46px; padding-right: 4px !important; text-align: center; }
.customer-sales-bulk { margin-left: auto; }
.icon-btn.sales { color: var(--violet); background: var(--violet-soft); }
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@media (max-width: 980px) {
    .sales-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .sales-workspace { grid-template-columns: 1fr; }
    .sales-services > div { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
    .sales-summary { grid-template-columns: 1fr; }
    .sales-services > div { grid-template-columns: 1fr; }
    .sales-modal-scroll { padding: 18px; }
    .customer-sales-bulk { width: 100%; margin-left: 0; }
}

@source '../../vendor/laravel/framework/src/Illuminate/Pagination/resources/views/*.blade.php';
@source '../../storage/framework/views/*.php';

@theme {
    --font-sans: 'Noto Sans Thai', ui-sans-serif, system-ui, sans-serif;
}

:root {
    --bg: #f5f5f7;
    --surface: #ffffff;
    --surface-soft: #f9fafc;
    --line: #e8edf3;
    --text: #111827;
    --muted: #66748a;
    --muted-soft: #9aa8bc;
    --green: #0f9b69;
    --green-soft: #e6f8ef;
    --red: #ef476f;
    --red-soft: #ffe8ee;
    --amber: #f28a22;
    --amber-soft: #fff3dc;
    --blue: #3478f6;
    --blue-soft: #edf4ff;
    --violet: #7a5af8;
    --violet-soft: #f0edff;
    --shadow: 0 10px 28px rgba(17, 24, 39, .06);
    --shadow-sm: 0 4px 14px rgba(17, 24, 39, .05);
}

* {
    box-sizing: border-box;
}

html,
body {
    min-height: 100%;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: 'Noto Sans Thai', ui-sans-serif, system-ui, sans-serif;
    font-size: 14px;
    line-height: 1.5;
}

button,
input,
select,
textarea {
    font: inherit;
}

button {
    cursor: pointer;
}

svg {
    width: 18px;
    height: 18px;
}

.app-shell {
    display: grid;
    grid-template-columns: 252px minmax(0, 1fr);
    min-height: 100vh;
}

.sidebar {
    position: sticky;
    top: 0;
    display: flex;
    flex-direction: column;
    height: 100vh;
    background: var(--surface);
    border-right: 1px solid var(--line);
    padding: 18px 16px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 22px;
    color: inherit;
    text-decoration: none;
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 8px;
    color: #fff;
    background: var(--green);
    box-shadow: 0 10px 22px rgba(15, 155, 105, .22);
}

.brand strong,
.sidebar-user strong,
.entity-cell strong {
    display: block;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0;
}

.brand small,
.sidebar-user small,
.entity-cell small {
    display: block;
    color: var(--muted-soft);
    font-size: 12px;
}

.side-nav {
    display: grid;
    gap: 6px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
}

.side-link {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 42px;
    padding: 0 12px;
    border-radius: 8px;
    color: #49576b;
    text-decoration: none;
    font-size: 14px;
}

.side-link.active {
    color: #153b2d;
    background: var(--green-soft);
}

.side-icon {
    display: grid;
    place-items: center;
    width: 22px;
    height: 22px;
    flex: 0 0 22px;
    border-radius: 7px;
    color: var(--green);
    background: transparent;
    font-size: 20px;
}

.side-icon svg { width: 20px; height: 20px; }

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: auto;
    padding-top: 16px;
    border-top: 1px solid var(--line);
}

.sidebar-user-copy {
    min-width: 0;
    flex: 1;
}

.sidebar-user-copy strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-logout {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 7px;
    color: var(--muted);
    background: var(--surface);
}

.sidebar-logout:hover {
    color: var(--red);
    border-color: #ffd0dc;
    background: var(--red-soft);
}

.sidebar-logout:focus-visible {
    outline: 2px solid var(--green);
    outline-offset: 2px;
}

.avatar,
.entity-icon {
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    border-radius: 999px;
    background: #c8f8df;
    color: #0d8057;
    font-weight: 600;
}

.avatar {
    width: 38px;
    height: 38px;
}

.main-panel {
    min-width: 0;
}

.auth-page {
    display: grid;
    place-items: center;
    min-height: 100vh;
    padding: 24px;
    background: #f5f7f9;
}

.auth-panel {
    width: min(420px, 100%);
    padding: 32px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.auth-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--line);
}

.auth-brand strong,
.auth-brand small {
    display: block;
}

.auth-brand strong {
    font-size: 15px;
    font-weight: 600;
}

.auth-brand small {
    color: var(--muted-soft);
    font-size: 12px;
}

.auth-heading {
    margin: 26px 0 22px;
}

.auth-heading h1 {
    margin: 0 0 4px;
    font-size: 24px;
    font-weight: 600;
}

.auth-heading p {
    margin: 0;
    color: var(--muted);
}

.auth-form,
.auth-field {
    display: grid;
}

.auth-form {
    gap: 18px;
}

.auth-field {
    gap: 7px;
}

.auth-field > span {
    color: #526178;
    font-weight: 500;
}

.auth-field input {
    width: 100%;
    min-height: 44px;
    padding: 9px 12px;
    border: 1px solid #d9e1eb;
    border-radius: 7px;
    color: var(--text);
    background: var(--surface);
}

.auth-field input:focus {
    border-color: var(--green);
    outline: 3px solid rgba(15, 155, 105, .12);
}

.auth-remember {
    display: flex;
    align-items: center;
    gap: 9px;
    color: var(--muted);
    cursor: pointer;
}

.auth-remember input {
    width: 17px;
    height: 17px;
    margin: 0;
    accent-color: var(--green);
}

.auth-error {
    margin: -6px 0 0;
    padding: 9px 11px;
    border-radius: 7px;
    color: #bd2f53;
    background: var(--red-soft);
    font-size: 13px;
}

.auth-submit {
    min-height: 44px;
    border: 1px solid var(--green);
    border-radius: 7px;
    color: #fff;
    background: var(--green);
    font-weight: 500;
}

.auth-submit:hover {
    background: #0b895c;
}

.auth-submit:focus-visible {
    outline: 3px solid rgba(15, 155, 105, .22);
    outline-offset: 2px;
}

.page {
    padding: 28px 32px 44px;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    min-height: 72px;
    margin: -28px -32px 28px;
    padding: 18px 32px;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
}

.topbar h1 {
    margin: 0;
    font-size: 24px;
    font-weight: 600;
    letter-spacing: 0;
}

.topbar p {
    margin: 2px 0 0;
    color: var(--muted);
    font-size: 14px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 36px;
    padding: 0 14px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn-primary {
    border-color: var(--green);
    background: var(--green);
    color: #fff;
    box-shadow: 0 12px 24px rgba(15, 155, 105, .2);
}

.btn-outline {
    border-color: #d9e1eb;
    background: var(--surface);
    color: #27364a;
}

.btn-danger {
    border-color: var(--red);
    background: var(--red);
    color: #fff;
}

.btn.compact {
    min-height: 32px;
    padding: 0 10px;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 22px;
}

.project-summary {
    grid-template-columns: repeat(6, minmax(0, 1fr));
}

.project-summary .summary-action {
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr);
    gap: 4px 8px;
    min-width: 0;
    padding: 14px;
    border: 1px solid transparent;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.project-summary .summary-action > span:last-child { display: contents; }
.project-summary .summary-action .summary-icon { width: 28px; height: 28px; grid-row: 1; }
.project-summary .summary-action small { min-width: 0; align-self: center; overflow-wrap: anywhere; }
.project-summary .summary-action strong { grid-column: 1 / -1; min-width: 0; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.project-summary .summary-action:hover,
.project-summary .summary-action[aria-pressed="true"] { border-color: var(--green); }
.project-summary .summary-action:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }

.summary-action { min-width: 0; border: 1px solid transparent; background: var(--surface); color: inherit; font: inherit; text-align: left; }
.summary-action[aria-pressed="true"] { border-color: var(--green); box-shadow: inset 0 0 0 1px var(--green); }
.summary-action:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
.summary-action:disabled { cursor: wait; }
.summary-result-total { margin: 0 0 12px; color: var(--muted); }
.summary-result-total strong { margin-left: 8px; color: var(--red); }
.project-overdue-installments { display: grid; gap: 6px; min-width: 0; max-width: 100%; margin: 8px 0 0; padding: 0; list-style: none; }
.project-overdue-installments li { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px; min-width: 0; font-size: 12px; }
.project-overdue-installments span,
.project-overdue-installments strong { min-width: 0; white-space: normal; overflow-wrap: anywhere; }
.project-overdue-installments strong { color: var(--red); font-weight: 500; }

.project-status-control { display: block; }
.project-table .project-status-select {
    width: 100%;
    min-width: 0;
    min-height: 32px;
    border: 1px solid transparent;
    padding-left: 10px;
    cursor: pointer;
}
.project-table .project-status-select:focus-visible {
    outline: 2px solid var(--green);
    outline-offset: 2px;
}

.summary-card,
.toolbar-card,
.table-card {
    background: var(--surface);
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
}

.summary-card {
    display: flex;
    align-items: center;
    gap: 14px;
    min-height: 94px;
    padding: 18px 20px;
}

.summary-card small {
    display: block;
    color: var(--muted);
    font-size: 13px;
}

.summary-card strong {
    display: block;
    margin-top: 2px;
    font-size: 24px;
    font-weight: 600;
}

.summary-icon {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 8px;
}

.summary-icon.green {
    background: var(--green-soft);
    color: var(--green);
}

.summary-icon.blue {
    background: var(--blue-soft);
    color: var(--blue);
}

.summary-icon.amber {
    background: var(--amber-soft);
    color: var(--amber);
}

.toolbar-card {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 18px;
    padding: 14px;
}

.search-field {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-height: 42px;
    padding: 0 14px;
    border: 1px solid #dfe6ee;
    border-radius: 8px;
    background: #fff;
    box-shadow: inset 0 1px 2px rgba(17, 24, 39, .03);
}

.search-field svg {
    color: var(--muted);
    width: 18px;
    height: 18px;
    flex: 0 0 18px;
}

.search-field input,
.filter-select {
    min-width: 0;
    border: 0;
    outline: 0;
    color: var(--text);
    font-size: 14px;
    background: transparent;
}

.project-toolbar {
    flex-wrap: wrap;
}

.project-toolbar .search-field {
    min-width: 190px;
}

.project-toolbar .filter-select {
    width: 180px;
    flex: 0 0 180px;
}

.project-toolbar .project-filter-status,
.project-toolbar .project-filter-visibility {
    width: 145px;
    flex-basis: 145px;
}

.customer-import-panel {
    width: min(620px, calc(100vw - 32px));
    text-align: left;
}

.customer-import-panel > header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
}

.customer-import-panel > header p {
    margin-top: 4px;
}

.customer-import-file {
    margin-top: 20px;
}

.customer-import-file input[type="file"] {
    height: auto;
    min-height: 48px;
    padding: 10px 12px;
}

.customer-import-result {
    margin-top: 16px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-soft);
}

.customer-import-result strong {
    color: var(--green);
}

.customer-import-result ul {
    max-height: 180px;
    margin: 10px 0 0;
    padding-left: 20px;
    overflow-y: auto;
    color: var(--muted);
    font-size: 13px;
}

.search-field input {
    width: 100%;
}

.filter-select {
    width: 210px;
    min-height: 42px;
    padding: 0 12px;
    border: 1px solid #dfe6ee;
    border-radius: 8px;
    background: #fff;
}

.table-card {
    overflow-x: auto;
    overflow-y: hidden;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.project-table {
    table-layout: fixed;
    min-width: 1120px;
}

.project-drag-col {
    width: 44px;
}

.project-name-col {
    width: 25%;
}

.project-customer-col {
    width: 20%;
}

.project-date-col {
    width: 250px;
}

.project-value-col {
    width: 104px;
}

.project-payment-col {
    width: 104px;
}

.project-status-col {
    width: 180px;
}

.project-action-col {
    width: 58px;
}

.data-table th {
    height: 52px;
    padding: 8px 18px;
    background: var(--surface-soft);
    color: var(--muted);
    font-size: 13px;
    font-weight: 500;
    text-align: left;
    white-space: nowrap;
}

.data-table td {
    min-height: 72px;
    padding: 8px 18px;
    border-top: 1px solid var(--line);
    color: #2d3a4d;
    font-size: 13px;
    font-weight: 400;
    vertical-align: middle;
}

.project-table th,
.project-table td {
    padding-right: 12px;
    padding-left: 12px;
}

.project-table td {
    padding-top: 8px;
    padding-bottom: 8px;
}

.customer-table td {
    padding-top: 8px;
    padding-bottom: 8px;
}

.project-table .drag-col {
    padding-right: 8px;
    padding-left: 14px;
}

.clickable-row {
    cursor: pointer;
}

.clickable-row:hover td {
    background: #fbfcfd;
}

.project-attention-row td {
    background: rgba(122, 90, 248, .055);
}

.project-attention-row td:first-child {
    box-shadow: inset 3px 0 0 var(--violet);
}

.project-attention-row:hover td {
    background: rgba(122, 90, 248, .085);
}

.project-attention-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 5px;
}

.project-attention-badge {
    display: inline-flex;
    align-items: center;
    min-height: 20px;
    padding: 1px 7px;
    border-radius: 999px;
    background: var(--violet-soft);
    color: #6847d8;
    font-size: 10px;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
}

.project-attention-badge.is-billing {
    border: 1px solid rgba(122, 90, 248, .22);
    background: rgba(255, 255, 255, .8);
}

.drag-handle {
    display: grid;
    place-items: center;
    width: 24px;
    height: 34px;
    color: #b4bfcc;
    cursor: grab;
}

.drag-handle svg {
    width: 18px;
    height: 18px;
}

.draggable-row:active .drag-handle {
    cursor: grabbing;
}

.date-range-text {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.duration-badge {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 0 8px;
    border-radius: 999px;
    background: #eef8f4;
    color: var(--green);
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.form-duration-badge {
    justify-self: start;
    min-height: 26px;
    margin-top: 1px;
}

.entity-cell {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 230px;
}

.project-table .entity-cell {
    min-width: 0;
}

.project-table .entity-cell > span {
    min-width: 0;
}

.project-table .entity-cell strong,
.project-table .entity-cell small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.project-table .entity-cell strong {
    font-weight: 500;
}

.customer-table .entity-cell strong {
    font-weight: 500;
}

.project-table td.project-customer-cell {
    overflow-wrap: anywhere;
}

.section-table-header {
    padding: 18px 18px 14px;
    border-bottom: 1px solid var(--line);
}

.section-table-header h2 {
    margin: 0;
    color: var(--text);
    font-size: 18px;
    font-weight: 600;
}

.section-table-header p {
    margin: 3px 0 0;
    color: var(--muted);
    font-size: 13px;
}

.completed-projects-section {
    margin-top: 22px;
}

.completed-projects-table {
    min-width: 1076px;
}

.compact-entity-cell {
    min-width: 0;
}

.entity-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
}

.muted {
    color: var(--muted-soft);
    font-weight: 400;
}

.soft-badge,
.tag {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 0 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 400;
    white-space: nowrap;
}

.soft-badge {
    background: #eef3f8;
    color: #5f7188;
}

.tag-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.tag.blue {
    background: var(--blue-soft);
    color: var(--blue);
}

.tag.green {
    background: var(--green-soft);
    color: var(--green);
}

.tag.amber {
    background: var(--amber-soft);
    color: #b96710;
}

.tag.violet {
    background: var(--violet-soft);
    color: var(--violet);
}

.actions-col {
    width: 1%;
}

.row-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}

.project-table .row-actions {
    justify-content: center;
}

.icon-btn {
    display: inline-grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border: 1px solid #dfe6ee;
    border-radius: 8px;
    background: #fff;
    color: #536277;
    box-shadow: 0 4px 10px rgba(17, 24, 39, .04);
}

.icon-btn.danger {
    color: var(--red);
}

.favorite-btn {
    position: relative;
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border: 1px solid #e6edf4;
    border-radius: 8px;
    background: #fff;
    color: #c6d0dd;
    box-shadow: 0 4px 10px rgba(17, 24, 39, .04);
}

.favorite-btn.active {
    border-color: var(--green);
    background: var(--green);
    color: #fff;
}

.favorite-btn input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.modal-favorite-btn {
    flex: 0 0 auto;
    cursor: pointer;
    width: 28px;
    height: 28px;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

.modal-favorite-btn svg {
    width: 22px;
    height: 22px;
}

.modal-favorite-btn.active {
    border-color: transparent;
    background: transparent;
    color: var(--green);
}

.payment-progress {
    display: grid;
    gap: 6px;
    min-width: 170px;
}

.project-table .payment-progress {
    min-width: 0;
}

.payment-progress span {
    color: #59677a;
    font-size: 13px;
    font-weight: 400;
    white-space: nowrap;
}

.payment-progress div {
    overflow: hidden;
    width: 128px;
    height: 7px;
    border-radius: 999px;
    background: #e2e7ee;
}

.project-table .payment-progress div {
    width: 86px;
}

.payment-progress i {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--green), #18c28a);
}

.status-badge {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 0 11px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 400;
    white-space: nowrap;
}

.status-new {
    background: #eef3f8;
    color: var(--muted);
}

.status-designing {
    background: var(--blue-soft);
    color: var(--blue);
}

.status-waiting_for_feedback {
    background: #fff0f5;
    color: #b54770;
}

.status-on_hold {
    background: #f2f0ff;
    color: #6654c7;
}

.status-in_progress {
    background: var(--amber-soft);
    color: #b96710;
}

.status-completed {
    background: var(--green-soft);
    color: var(--green);
}

.status-awaiting_payment {
    background: #fff1d8;
    color: #b96710;
}

.status-closed {
    background: #e8f5f9;
    color: #38758c;
}

.status-waiting_for_information {
    background: var(--violet-soft);
    color: var(--violet);
}

.status-cancelled {
    background: var(--red-soft);
    color: var(--red);
}

.table-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    min-height: 58px;
    padding: 12px 18px;
    border-top: 1px solid var(--line);
    color: var(--muted);
}

.register-page-sizes { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; font-size: 13px; }
.register-page-size { min-width: 38px; min-height: 32px; padding: 4px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--muted); font: inherit; cursor: pointer; }
.register-page-size[aria-pressed="true"] { border-color: var(--green); background: var(--green-soft); color: var(--green); font-weight: 600; }
.register-page-size:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }

.crm-pagination {
    display: flex;
    align-items: center;
    gap: 5px;
}

.crm-pagination button,
.crm-pagination-gap {
    display: grid;
    place-items: center;
    min-width: 34px;
    height: 34px;
    padding: 0 8px;
    border: 1px solid transparent;
    border-radius: 7px;
    background: transparent;
    color: var(--muted);
    font-size: 13px;
}

.crm-pagination button:hover:not(:disabled) {
    border-color: var(--line);
    background: var(--surface-soft);
    color: var(--text);
}

.crm-pagination button.is-active {
    border-color: #ccebdc;
    background: var(--green-soft);
    color: var(--green);
    font-weight: 600;
}

.crm-pagination button:disabled {
    cursor: default;
    opacity: .35;
}

.crm-pagination button svg {
    width: 16px;
    height: 16px;
}

.empty-state {
    display: grid;
    place-items: center;
    min-height: 180px;
    color: var(--muted);
    text-align: center;
}

.empty-state strong {
    color: var(--text);
    font-size: 16px;
    font-weight: 600;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: grid;
    place-items: center;
    padding: 24px;
    background: rgba(17, 24, 39, .34);
}

.modal-panel,
.confirm-panel {
    width: min(920px, 100%);
    max-height: min(780px, calc(100vh - 48px));
    overflow: auto;
    border-radius: 12px;
    background: var(--surface);
    box-shadow: 0 30px 90px rgba(17, 24, 39, .25);
}

.confirm-panel {
    width: min(440px, 100%);
    padding: 24px;
}

.confirm-panel h2,
.modal-header h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
}

.confirm-panel p,
.modal-header p {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 13px;
}

.modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    padding: 22px 24px;
    border-bottom: 1px solid var(--line);
}

.record-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    padding: 28px 34px 26px;
    border-bottom: 1px solid var(--line);
}

.record-identity {
    display: flex;
    align-items: center;
    gap: 18px;
}

.record-avatar {
    display: grid;
    place-items: center;
    width: 72px;
    height: 72px;
    border-radius: 999px;
    background: #dff4e5;
    color: #087650;
    font-size: 28px;
    font-weight: 600;
}

.record-header h2 {
    margin: 8px 0 0;
    font-size: 26px;
    font-weight: 600;
}


.row-number-col { width: 64px; }
.data-table th.row-number-col,
.data-table td.row-number-cell,
.backup-table th.row-number-col,
.backup-table td.row-number-cell {
    width: 64px;
    padding-left: 8px;
    padding-right: 8px;
    text-align: center;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}
.row-number-cell { color: var(--muted); }
.modal-favorite-btn:focus-within { outline: 2px solid var(--green); outline-offset: 2px; border-radius: 4px; }
.modal-header .record-title-row h2 { margin-top: 0; }

.record-title-row {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.record-title-row h2 {
    margin-top: 8px;
    min-width: 0;
    overflow-wrap: anywhere;
}

.record-header p {
    margin: 2px 0 0;
    color: var(--muted);
    font-size: 14px;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 0 12px;
    border-radius: 999px;
    background: #e8f5f9;
    color: #38758c;
    font-size: 13px;
    font-weight: 400;
}

.record-tabs {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 0 34px;
    border-bottom: 1px solid var(--line);
}

.record-tabs button {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 58px;
    border: 0;
    background: transparent;
    color: var(--muted);
    font-size: 14px;
    font-weight: 500;
}

.record-tabs button.active {
    color: var(--text);
}

.record-tabs button.active::after {
    position: absolute;
    right: 0;
    bottom: -1px;
    left: 0;
    height: 3px;
    border-radius: 999px;
    background: var(--green);
    content: "";
}

.record-tabs span {
    display: grid;
    place-items: center;
    min-width: 28px;
    height: 28px;
    border-radius: 999px;
    background: #eef3f8;
    color: var(--muted);
    font-size: 12px;
}

.modal-body {
    display: grid;
    gap: 18px;
    padding: 22px 24px 24px;
}

.record-body {
    padding: 28px 34px 24px;
}

.record-panel {
    display: grid;
    gap: 18px;
}

.form-grid {
    display: grid;
    gap: 16px;
}

.form-grid.two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.full {
    grid-column: 1 / -1;
}

.field {
    display: grid;
    align-content: start;
    gap: 7px;
}

.field span {
    color: #59677a;
    font-size: 13px;
    font-weight: 500;
}

.field input,
.field select,
.field textarea {
    width: 100%;
    border: 1px solid #dce4ee;
    border-radius: 8px;
    background: #fff;
    color: var(--text);
    font-size: 14px;
    outline: 0;
    transition: border .12s ease, box-shadow .12s ease;
    font-weight: 400;
}

.field input::placeholder,
.field textarea::placeholder {
    font-weight: 400;
}

.field input,
.field select {
    min-height: 42px;
    padding: 0 12px;
}

.field textarea {
    resize: vertical;
    padding: 12px;
}

.field-hint {
    color: var(--muted);
    font-size: 12px;
    font-weight: 400;
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.filter-select:focus,
.search-field:focus-within {
    border-color: var(--green);
    box-shadow: 0 0 0 3px rgba(15, 155, 105, .12);
}

.date-entry-control {
    position: relative;
}

.date-entry-control > input[type="text"] {
    padding-right: 46px;
}

.date-picker-button {
    position: absolute;
    top: 4px;
    right: 4px;
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--muted);
}

.date-picker-button:hover {
    background: var(--surface-soft);
    color: var(--green);
}

.date-picker-button:disabled {
    cursor: default;
    opacity: .5;
}

.date-entry-control .date-entry-picker {
    position: absolute;
    right: 4px;
    bottom: 4px;
    width: 1px;
    min-height: 1px;
    height: 1px;
    padding: 0;
    border: 0;
    opacity: 0;
    pointer-events: none;
}

.inline-field-action {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
}

.inline-field-action .btn {
    white-space: nowrap;
}

.customer-picker-dropdown {
    position: relative;
}

.customer-picker-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    min-height: 42px;
    padding: 0 12px;
    border: 1px solid #dce4ee;
    border-radius: 8px;
    background: #fff;
    color: var(--text);
    font-size: 14px;
    text-align: left;
    outline: 0;
}

.customer-picker-trigger span {
    overflow: hidden;
    color: inherit;
    font-size: inherit;
    font-weight: 400;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.customer-picker-trigger svg {
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
    color: var(--muted);
}

.customer-picker-trigger:focus,
.customer-picker-trigger[aria-expanded="true"] {
    border-color: var(--green);
    box-shadow: 0 0 0 3px rgba(15, 155, 105, .12);
}

.customer-picker-menu {
    position: absolute;
    z-index: 20;
    top: calc(100% + 8px);
    right: 0;
    left: 0;
    overflow: hidden;
    border: 1px solid #dfe6ee;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 18px 42px rgba(17, 24, 39, .16);
}

.customer-picker-search {
    padding: 10px;
    border-bottom: 1px solid #edf2f7;
}

.customer-picker-search input {
    width: 100%;
    min-height: 38px;
    padding: 0 11px;
    border: 1px solid #dce4ee;
    border-radius: 7px;
    background: #fff;
    color: var(--text);
    font-size: 14px;
    outline: 0;
}

.customer-picker-search input:focus {
    border-color: var(--green);
    box-shadow: 0 0 0 3px rgba(15, 155, 105, .12);
}

.customer-picker-list {
    overflow-y: auto;
    max-height: 286px;
    background: #fff;
}

.customer-option,
.customer-option-empty {
    width: 100%;
    min-height: 44px;
    padding: 9px 12px;
    border: 0;
    border-bottom: 1px solid #edf2f7;
    background: transparent;
    color: var(--text);
    text-align: left;
    font-size: 14px;
    font-weight: 400;
}

.customer-option {
    display: grid;
    gap: 2px;
}

.customer-option:last-child,
.customer-option-empty:last-child {
    border-bottom: 0;
}

.customer-option:hover,
.customer-option.selected {
    background: #eef8f4;
    color: var(--green);
}

.customer-option small {
    color: var(--muted);
    font-size: 12px;
}

.customer-option-empty {
    display: block;
    color: var(--muted);
}

.customer-picker-add {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    min-height: 46px;
    padding: 0 12px;
    border: 0;
    border-top: 1px solid #edf2f7;
    background: #fff;
    color: var(--green);
    font-size: 14px;
    font-weight: 600;
    text-align: left;
}

.customer-picker-add:hover {
    background: #eef8f4;
}

.customer-picker-add svg {
    width: 18px;
    height: 18px;
}

.quick-create-card {
    display: grid;
    gap: 16px;
    padding: 18px 20px;
    border-radius: 8px;
    background: #f8faf8;
}

.quick-create-card header,
.quick-create-card footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.quick-create-card h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.quick-create-card p {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 13px;
}

.nested-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 70;
    display: grid;
    place-items: center;
    padding: 24px;
    background: rgba(17, 24, 39, .46);
}

.quick-customer-modal {
    width: min(720px, 100%);
    max-height: min(720px, calc(100vh - 48px));
    overflow: auto;
    border-radius: 12px;
    background: var(--surface);
    box-shadow: 0 30px 90px rgba(17, 24, 39, .3);
}

.quick-customer-modal-body {
    padding: 24px;
}

.quick-customer-modal-actions {
    margin-top: 0;
    padding: 18px 24px;
    border-top: 1px solid var(--line);
}

.service-options {
    display: flex;
    flex-wrap: wrap;
    gap: 18px;
    margin: 0;
    padding: 18px 20px;
    border: 0;
    border-radius: 8px;
    background: #f7faf7;
}

.service-options legend {
    margin-bottom: 10px;
    color: #59677a;
    font-size: 13px;
    font-weight: 500;
}

.service-options label {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    color: #1f2937;
    font-size: 14px;
    font-weight: 500;
}

.service-options input,
.follow-toggle input {
    width: 24px;
    height: 24px;
    accent-color: var(--green);
}

.work-type-options {
    display: grid;
    gap: 10px;
    margin: 0;
    padding: 0;
    border: 0;
}

.work-type-options legend {
    margin-bottom: 8px;
    color: #59677a;
    font-size: 13px;
    font-weight: 500;
}

.work-type-options > div {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.work-type-options label {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    min-height: 56px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    cursor: pointer;
    transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
}

.work-type-options label:hover,
.work-type-options label.selected,
.work-type-options label:has(input:focus-visible) {
    border-color: var(--green);
    background: #f5fbf8;
    box-shadow: 0 0 0 2px rgba(15, 155, 105, .08);
}

.work-type-options input {
    width: 20px;
    height: 20px;
    flex: 0 0 auto;
    margin: 0;
    accent-color: var(--green);
}

.work-type-options label > span {
    min-width: 0;
}

.work-type-options strong,
.work-type-options small {
    display: block;
}

.work-type-options strong {
    color: #1f2937;
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
}

.work-type-options small {
    margin-top: 4px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 400;
}

.project-work-type {
    margin-top: 3px;
    color: var(--green) !important;
}

.project-work-type.is-unspecified {
    color: var(--muted-soft) !important;
}

.follow-box {
    display: grid;
    gap: 16px;
    padding: 18px 20px;
    border-radius: 8px;
    background: #f8faf8;
}

.follow-toggle {
    display: flex;
    align-items: flex-start;
    gap: 14px;
}

.follow-toggle strong,
.follow-toggle small {
    display: block;
}

.follow-toggle strong {
    font-size: 15px;
    font-weight: 600;
}

.follow-toggle small {
    color: var(--muted);
    font-size: 13px;
}

.follow-fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.follow-fields.disabled {
    opacity: .48;
}

.follow-history {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.follow-history-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 18px;
    border-bottom: 1px solid var(--line);
}

.follow-history-header h3,
.follow-history-header p {
    margin: 0;
}

.follow-history-header h3 {
    font-size: 15px;
    font-weight: 600;
}

.follow-history-header p {
    margin-top: 2px;
    color: var(--muted);
    font-size: 12px;
}

.follow-history-summary {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--muted);
    font-size: 12px;
    white-space: nowrap;
}

.follow-history-summary button {
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--green);
    font-weight: 600;
}

.follow-history-list {
    display: grid;
}

.follow-history-item {
    display: grid;
    grid-template-columns: 10px minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    min-height: 70px;
    padding: 12px 18px;
    border-top: 1px solid var(--line);
}

.follow-history-item:first-child {
    border-top: 0;
}

.follow-history-marker {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: var(--amber);
    box-shadow: 0 0 0 4px var(--amber-soft);
}

.follow-history-item.is-overdue {
    background: rgba(239, 71, 111, .035);
}

.follow-history-item.is-overdue .follow-history-marker {
    background: var(--red);
    box-shadow: 0 0 0 4px var(--red-soft);
}

.follow-history-item.is-completed .follow-history-marker {
    background: var(--green);
    box-shadow: 0 0 0 4px var(--green-soft);
}

.follow-history-item.is-cancelled .follow-history-marker {
    background: var(--muted-soft);
    box-shadow: 0 0 0 4px #eef2f6;
}

.follow-history-title {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.follow-history-title strong {
    color: var(--text);
    font-size: 13px;
    font-weight: 600;
}

.follow-history-status {
    display: inline-flex;
    align-items: center;
    min-height: 20px;
    padding: 1px 7px;
    border-radius: 999px;
    background: var(--amber-soft);
    color: #b96813;
    font-size: 10px;
    font-weight: 600;
}

.is-overdue .follow-history-status {
    background: var(--red-soft);
    color: var(--red);
}

.is-completed .follow-history-status {
    background: var(--green-soft);
    color: var(--green);
}

.is-cancelled .follow-history-status {
    background: #eef2f6;
    color: var(--muted);
}

.follow-history-content p,
.follow-history-content small {
    display: block;
    margin: 2px 0 0;
    color: var(--muted);
    font-size: 12px;
}

.follow-history-action {
    min-height: 30px;
    padding: 3px 10px;
    border: 1px solid #bce6d5;
    border-radius: 7px;
    background: #fff;
    color: var(--green);
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.follow-history-action:hover {
    background: var(--green-soft);
}

.follow-history-empty {
    display: grid;
    gap: 3px;
    padding: 22px 18px;
    color: var(--muted);
    font-size: 12px;
    text-align: center;
}

.follow-history-empty strong {
    color: #2d3a4d;
    font-size: 13px;
    font-weight: 600;
}

.check-card {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px 18px;
    border-radius: 8px;
    background: #f8faf8;
}

.check-card input {
    width: 24px;
    height: 24px;
    accent-color: var(--green);
}

.check-card strong,
.check-card small {
    display: block;
}

.check-card strong {
    font-weight: 600;
}

.check-card small {
    color: var(--muted);
    font-size: 13px;
}

.repeater-card {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.repeater-card > header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 18px 20px;
    border-bottom: 1px solid var(--line);
}

.repeater-card h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.repeater-card p {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 13px;
}

.installment-table {
    --installment-columns: 28px minmax(150px, 1.2fr) 100px minmax(150px, 1fr) 150px minmax(110px, .7fr) 46px;
    display: grid;
}

.installment-head,
.installment-row {
    display: grid;
    grid-template-columns: var(--installment-columns);
    gap: 14px;
    align-items: start;
    padding: 14px 20px;
}

.installment-head {
    align-items: center;
    background: var(--surface-soft);
    color: var(--muted);
    font-size: 13px;
    font-weight: 500;
}

.installment-row {
    border-top: 1px solid var(--line);
}

.installment-state-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    align-self: center;
    color: #cbd5e1;
}

.installment-state-icon.is-paid {
    color: var(--green);
}

.installment-state-icon svg {
    width: 22px;
    height: 22px;
}

.compact-field {
    gap: 4px;
}

.installment-amount {
    align-self: center;
    color: var(--text);
    font-size: 15px;
    font-weight: 600;
    text-align: right;
    white-space: nowrap;
}

.installment-summary {
    display: grid;
    grid-template-columns: var(--installment-columns);
    gap: 14px;
    align-items: center;
    padding: 16px 20px;
    border-top: 1px solid var(--line);
    background: var(--surface-soft);
}

.installment-summary-percentage {
    grid-column: 5;
    color: var(--muted);
    text-align: right;
}

.installment-summary-amount {
    grid-column: 6;
    font-size: 16px;
    font-weight: 600;
    text-align: right;
    white-space: nowrap;
}

.employment-summary {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.employment-summary article {
    display: grid;
    gap: 2px;
    padding: 16px;
    border-radius: 8px;
    background: var(--surface-soft);
}

.employment-summary small,
.employment-summary span {
    color: var(--muted);
    font-size: 12px;
}

.employment-summary strong {
    font-size: 22px;
    font-weight: 600;
}

.employment-history {
    overflow: hidden;
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.employment-header,
.employment-entry {
    display: grid;
    grid-template-columns: 120px 110px minmax(180px, 1fr) 210px 120px;
    gap: 16px;
    align-items: center;
    min-height: 58px;
    padding: 0 18px;
}

.employment-header {
    background: var(--surface-soft);
    color: var(--muted);
    font-size: 13px;
    font-weight: 500;
}

.employment-entry {
    border-top: 1px solid var(--line);
    color: #2d3a4d;
}

.employment-entry strong,
.employment-entry em {
    font-weight: 600;
    font-style: normal;
}

.history-work-type {
    display: inline-flex;
    justify-self: start;
    align-items: center;
    min-height: 28px;
    padding: 0 10px;
    border-radius: 999px;
    color: #176b4d;
    background: #e9f7f0;
    font-size: 12px;
    font-weight: 500;
}

.history-work-type-revision {
    color: #9a5b00;
    background: #fff3dc;
}

.history-work-type-redesign {
    color: #335ea8;
    background: #eaf1ff;
}

.history-work-type-unspecified {
    color: var(--muted);
    background: var(--surface-soft);
}

.employment-empty {
    display: grid;
    gap: 4px;
    padding: 28px 18px;
    color: var(--muted);
    text-align: center;
}

.employment-empty strong {
    color: #2d3a4d;
    font-weight: 600;
}

.record-activity {
    display: grid;
    gap: 12px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.record-activity li {
    display: flex;
    gap: 12px;
    padding: 14px;
    border-radius: 8px;
    background: var(--surface-soft);
}

.record-activity li > span {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 999px;
    background: #dff4e5;
    color: #087650;
    font-weight: 600;
}

.record-activity p {
    margin: 0;
}

.record-activity strong,
.record-activity small {
    display: block;
}

.record-activity strong {
    font-weight: 600;
}

.record-activity small {
    color: var(--muted);
    font-size: 13px;
}

.error {
    color: var(--red);
    font-size: 12px;
}

.hint {
    color: var(--muted);
    font-size: 13px;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding-top: 4px;
}

nav[role="navigation"] {
    display: flex;
    align-items: center;
    gap: 10px;
}

nav[role="navigation"] p {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
}

nav[role="navigation"] a,
nav[role="navigation"] span {
    border-radius: 7px !important;
}

.mobile-appbar,
.mobile-drawer-close,
.mobile-nav-backdrop { display: none; }

@media (max-width: 980px) {
    .app-shell {
        grid-template-columns: 1fr;
        grid-template-rows: 56px minmax(0, 1fr);
    }

    .sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        z-index: 82;
        width: min(320px, calc(100vw - 48px));
        height: 100vh;
        height: 100dvh;
        overflow-y: auto;
        visibility: hidden;
        transform: translateX(-100%);
        transition: transform .2s ease, visibility .2s;
        pointer-events: none;
        box-shadow: 16px 0 36px rgba(17, 24, 39, .12);
    }

    .side-nav {
        grid-template-columns: 1fr;
    }

    .app-shell.menu-open .sidebar { visibility: visible; transform: translateX(0); pointer-events: auto; }
    .mobile-appbar { display: flex; }
    .mobile-drawer-close { display: grid; }
    .app-shell.menu-open .mobile-nav-backdrop { display: block; }
    .main-panel { min-width: 0; }

    .topbar,
    .toolbar-card,
    .table-footer {
        align-items: stretch;
        flex-direction: column;
    }

    .project-toolbar {
        flex-wrap: wrap;
    }

    .summary-grid,
    .form-grid.two,
    .inline-field-action,
    .follow-fields,
    .employment-summary {
        grid-template-columns: 1fr;
    }

    .follow-history-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .follow-history-item {
        grid-template-columns: 10px minmax(0, 1fr);
    }

    .follow-history-action {
        grid-column: 2;
        justify-self: start;
    }

    .record-header,
    .record-identity,
    .record-tabs {
        align-items: flex-start;
        flex-direction: column;
    }

    .employment-header,
    .employment-entry {
        grid-template-columns: 1fr;
        padding: 14px;
    }

    .installment-head {
        display: none;
    }

    .installment-row {
        grid-template-columns: 28px minmax(0, 1fr);
        padding: 14px;
    }

    .installment-row > :not(.installment-state-icon) {
        grid-column: 2;
    }

    .installment-summary {
        display: flex;
        justify-content: flex-end;
        gap: 28px;
        padding: 16px 14px;
    }

    .installment-summary-percentage,
    .installment-summary-amount {
        grid-column: auto;
    }

    .repeater-card > header {
        align-items: stretch;
        flex-direction: column;
    }

    .nested-modal-backdrop {
        align-items: end;
        padding: 12px;
    }

    .quick-customer-modal {
        max-height: calc(100vh - 24px);
    }

    .filter-select { width: 100%; }

    .table-card { overflow-x: auto; }
}

@media (max-width: 980px) {
    .mobile-appbar {
        position: sticky;
        top: 0;
        z-index: 20;
        align-items: center;
        gap: 10px;
        height: 56px;
        padding: 0 16px;
        border-bottom: 1px solid var(--line);
        background: var(--surface);
    }
    .mobile-appbar-title { font-size: 16px; font-weight: 600; }
    .mobile-menu-button,
    .mobile-drawer-close {
        display: grid;
        place-items: center;
        width: 44px;
        height: 44px;
        padding: 0;
        border: 0;
        border-radius: 8px;
        background: transparent;
        color: var(--text);
    }
    .mobile-menu-button svg,
    .mobile-drawer-close svg { width: 22px; height: 22px; }
    .mobile-drawer-close { position: absolute; top: 14px; right: 12px; }
    .sidebar .brand { padding-right: 44px; }
    .sidebar .side-link { min-height: 48px; }
    .sidebar .sidebar-logout { width: 44px; height: 44px; }
    .mobile-nav-backdrop {
        position: fixed;
        inset: 0;
        z-index: 81;
        width: 100%;
        padding: 0;
        border: 0;
        background: rgba(17, 24, 39, .38);
        touch-action: none;
    }
    .mobile-menu-button:focus-visible,
    .mobile-drawer-close:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
}

@media (max-width: 720px) {
    .page { padding: 16px 16px 32px; }
    .topbar {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        gap: 10px;
        min-height: 0;
        margin: -16px -16px 16px;
        padding: 12px 16px;
    }
    .topbar > div:first-child { min-width: 0; flex: 1 1 155px; }
    .topbar h1 { font-size: 20px; overflow-wrap: anywhere; }
    .topbar p { display: none; }
    .topbar > .btn,
    .topbar .page-actions .btn { min-height: 44px; }
    .topbar .page-actions { margin-left: auto; }
    .summary-grid,
    .register-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .summary-card { min-width: 0; min-height: 82px; padding: 12px; gap: 8px; }
    .summary-card strong { font-size: 20px; overflow-wrap: anywhere; }
    .summary-icon { width: 36px; height: 36px; flex: 0 0 36px; }
    .toolbar-card { padding: 12px; }
    .search-field { min-width: 0; }
    .modal-backdrop { padding: 0; place-items: stretch; }
    .nested-modal-backdrop { padding: 0; place-items: stretch; }
    .modal-panel {
        display: flex;
        flex-direction: column;
        width: 100%;
        max-width: none;
        height: 100vh;
        height: 100dvh;
        max-height: none;
        border-radius: 0;
        overflow: hidden;
    }
    .modal-panel > form { display: flex; flex-direction: column; flex: 1; min-height: 0; }
    .modal-panel > form > .modal-body,
    .modal-panel > form > .register-form-grid,
    .modal-panel > form.record-body,
    .sales-modal-scroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
    .modal-panel > .modal-header,
    .modal-panel > .record-header,
    .modal-panel > form > .modal-header { flex-shrink: 0; padding: 14px 16px; }
    .modal-panel .record-header h2 { font-size: 20px; }
    .modal-panel .record-avatar { display: none; }
    .modal-panel .record-identity { min-width: 0; }
    .modal-panel .modal-body,
    .modal-panel .record-body,
    .modal-panel .register-form-grid,
    .sales-modal-scroll { padding: 16px; }
    .modal-panel .modal-actions,
    .monthly-modal-card .modal-actions,
    .register-modal .modal-actions,
    .sales-modal .modal-actions {
        flex-shrink: 0;
        padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
        border-top: 1px solid var(--line);
        background: var(--surface);
    }
    .modal-panel > form.record-body > .modal-actions { position: sticky; bottom: -16px; z-index: 1; }
    .modal-panel .icon-btn { flex-shrink: 0; min-width: 44px; min-height: 44px; }
    .confirm-panel { width: min(440px, calc(100vw - 32px)); margin: auto; }
}

/* Dashboard */
.dashboard-page {
    display: grid;
    gap: 20px;
}

.dashboard-page a {
    color: inherit;
    text-decoration: none;
}

.dashboard-page .topbar {
    margin-bottom: 0;
}

.dashboard-updated {
    color: var(--muted);
    font-size: 12px;
}

.dashboard-followups {
    overflow: hidden;
    border: 1px solid #ded7ff;
    border-left: 3px solid var(--violet);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.dashboard-followups-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 16px 18px;
    border-bottom: 1px solid var(--line);
    background: rgba(122, 90, 248, .035);
}

.dashboard-followups-header h2,
.dashboard-followups-header p {
    margin: 0;
}

.dashboard-followups-header h2 {
    font-size: 16px;
    font-weight: 600;
}

.dashboard-followups-header p {
    margin-top: 2px;
    color: var(--muted);
    font-size: 12px;
}

.dashboard-followups-kicker {
    display: block;
    margin-bottom: 2px;
    color: var(--violet);
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 0;
}

.dashboard-followups-counts {
    display: flex;
    align-items: center;
    gap: 8px;
}

.dashboard-followups-counts > span {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-height: 28px;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 11px;
    white-space: nowrap;
}

.dashboard-followups-counts strong {
    font-size: 12px;
}

.dashboard-followups-counts .overdue { color: var(--red); background: var(--red-soft); }
.dashboard-followups-counts .today { color: #ad6113; background: var(--amber-soft); }
.dashboard-followups-counts .upcoming { color: #6847d8; background: var(--violet-soft); }

.dashboard-followups-list {
    display: grid;
}

.dashboard-followup-item {
    display: grid;
    grid-template-columns: 54px minmax(0, 1fr) auto;
    align-items: center;
    gap: 14px;
    min-height: 72px;
    padding: 10px 18px;
    border-top: 1px solid var(--line);
}

.dashboard-followup-item:first-child {
    border-top: 0;
}

.dashboard-followup-item.is-overdue {
    background: rgba(239, 71, 111, .035);
}

.dashboard-followup-item.is-today {
    background: rgba(242, 138, 34, .035);
}

.dashboard-followup-date {
    display: grid;
    place-items: center;
    align-content: center;
    width: 48px;
    min-height: 48px;
    border-radius: 7px;
    background: var(--violet-soft);
    color: #6847d8;
    line-height: 1.15;
}

.is-overdue .dashboard-followup-date { color: var(--red); background: var(--red-soft); }
.is-today .dashboard-followup-date { color: #ad6113; background: var(--amber-soft); }
.dashboard-followup-date strong { font-size: 18px; }
.dashboard-followup-date span { font-size: 9px; }

.dashboard-followup-copy {
    min-width: 0;
}

.dashboard-followup-copy > div {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.dashboard-followup-copy strong {
    overflow: hidden;
    color: var(--text);
    font-size: 13px;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dashboard-followup-copy p {
    margin: 3px 0 0;
    overflow: hidden;
    color: var(--muted);
    font-size: 11px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dashboard-followup-status {
    display: inline-flex;
    min-height: 20px;
    align-items: center;
    padding: 1px 7px;
    border-radius: 999px;
    background: var(--violet-soft);
    color: #6847d8;
    font-size: 10px;
    font-weight: 600;
    white-space: nowrap;
}

.is-overdue .dashboard-followup-status { color: var(--red); background: var(--red-soft); }
.is-today .dashboard-followup-status { color: #ad6113; background: var(--amber-soft); }

.dashboard-followup-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.dashboard-followup-actions a,
.dashboard-followup-actions button {
    min-height: 30px;
    padding: 4px 10px;
    border-radius: 7px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

.dashboard-followup-actions a {
    display: inline-flex;
    align-items: center;
    border: 1px solid #d9e1eb;
    background: #fff;
    color: var(--muted);
}

.dashboard-followup-actions button {
    border: 1px solid #bce6d5;
    background: #fff;
    color: var(--green);
}

.dashboard-followup-actions a:hover { color: var(--text); background: var(--surface-soft); }
.dashboard-followup-actions button:hover { background: var(--green-soft); }
.dashboard-followup-actions button:disabled { cursor: wait; opacity: .55; }

.dashboard-followups-empty {
    display: grid;
    gap: 3px;
    padding: 24px 18px;
    color: var(--muted);
    font-size: 12px;
    text-align: center;
}

.dashboard-followups-empty strong {
    color: var(--green);
    font-size: 13px;
    font-weight: 600;
}

.dashboard-followups-footer {
    padding: 9px 18px;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 10px;
    text-align: right;
}

.dashboard-kpis {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.dashboard-kpi-section {
    display: grid;
    gap: 10px;
}

.dashboard-kpi-section > header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.dashboard-kpi-section > header h2 {
    font-size: 15px;
    font-weight: 600;
}

.dashboard-kpi-section > header a {
    color: var(--green);
    font-size: 12px;
    font-weight: 500;
}

.dashboard-kpi {
    position: relative;
    display: grid;
    grid-template-columns: 38px 1fr;
    column-gap: 12px;
    min-width: 0;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    transition: border-color .15s ease, transform .15s ease;
}

.dashboard-kpi:hover {
    border-color: #b7dcca;
    transform: translateY(-1px);
}

.dashboard-kpi-icon {
    grid-row: 1 / span 3;
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 8px;
}

.dashboard-kpi-icon svg { width: 20px; height: 20px; }
.dashboard-kpi-icon.revenue { color: #2868d7; background: var(--blue-soft); }
.dashboard-kpi-icon.collected { color: var(--green); background: var(--green-soft); }
.dashboard-kpi-icon.overdue { color: var(--red); background: var(--red-soft); }
.dashboard-kpi-icon.projects { color: #6847d8; background: var(--violet-soft); }
.dashboard-kpi-icon.contracts { color: #38758c; background: #e8f5f9; }
.dashboard-kpi-icon.project-value { color: #2868d7; background: var(--blue-soft); }
.dashboard-kpi-icon.remaining { color: #b96710; background: var(--amber-soft); }

.dashboard-kpi small,
.dashboard-kpi span:last-child { color: var(--muted); }
.dashboard-kpi small { font-size: 12px; font-weight: 500; }
.dashboard-kpi strong { margin: 2px 0; font-size: 22px; line-height: 1.25; }
.dashboard-kpi span:last-child { font-size: 11px; }
.dashboard-kpi.alert strong { color: var(--red); }

.dashboard-main-grid,
.dashboard-lower-grid { display: grid; gap: 16px; }
.dashboard-main-grid { grid-template-columns: minmax(0, 1.65fr) minmax(300px, .85fr); }
.dashboard-lower-grid { grid-template-columns: minmax(230px, .7fr) minmax(280px, 1fr) minmax(320px, 1.3fr); }

.dashboard-panel {
    min-width: 0;
    padding: 20px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.dashboard-panel-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
}

.dashboard-panel-header h2 { font-size: 16px; font-weight: 600; }
.dashboard-panel-header p { margin-top: 2px; color: var(--muted); font-size: 12px; }
.dashboard-panel-header > a { color: var(--green); white-space: nowrap; font-size: 12px; font-weight: 500; }

.chart-legend {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--muted);
    white-space: nowrap;
    font-size: 11px;
}

.chart-legend i { width: 8px; height: 8px; border-radius: 2px; }
.chart-legend i.billed { background: #cbd8e8; }
.chart-legend i.collected { margin-left: 5px; background: var(--green); }

.revenue-chart {
    display: grid;
    grid-template-columns: repeat(12, minmax(54px, 1fr));
    gap: 8px;
    min-height: 220px;
    overflow-x: auto;
}

.revenue-chart-column {
    position: relative;
    display: grid;
    grid-template-rows: 24px 160px 22px;
    gap: 4px;
    min-width: 54px;
    text-align: center;
    padding: 6px 2px 4px;
}

.revenue-chart-column::before {
    position: absolute;
    z-index: 0;
    inset: 0;
    border: 1px solid transparent;
    border-radius: 6px;
    content: '';
    pointer-events: none;
}

.revenue-chart-column.active::before {
    border-color: #b7e5d2;
    background: #f0faf6;
}

.revenue-chart-column > * {
    position: relative;
    z-index: 1;
}

.revenue-chart-column.active .revenue-chart-value,
.revenue-chart-column.active small {
    color: var(--green);
    font-weight: 600;
}

.revenue-chart-value { color: var(--muted); font-size: 10px; }
.revenue-chart-bars {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 5px;
    border-bottom: 1px solid var(--line);
    background: repeating-linear-gradient(to top, transparent 0, transparent 39px, #edf1f6 40px);
}

.revenue-chart-bars span { width: min(20px, 32%); min-height: 0; border-radius: 4px 4px 0 0; }
.revenue-chart-bars .billed { background: #cbd8e8; }
.revenue-chart-bars .collected { background: var(--green); }
.revenue-chart-column small { color: var(--muted); font-size: 11px; }

.revenue-chart-bars [data-chart-tooltip]:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
.chart-tooltip { position: fixed; z-index: 100; width: min(240px, calc(100vw - 16px)); padding: 8px 12px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); font-size: 12px; pointer-events: none; }

.service-revenue-list,
.project-status-list,
.dashboard-action-list { display: grid; gap: 14px; }

.service-revenue-item > div {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 7px;
}

.service-revenue-item strong { font-size: 13px; }
.service-revenue-track,
.project-status-track {
    display: block;
    overflow: hidden;
    height: 7px;
    border-radius: 4px;
    background: #edf1f6;
}

.service-revenue-track i,
.project-status-track i { display: block; min-width: 2px; height: 100%; border-radius: inherit; }
.service-revenue-track .service-ma { background: var(--green); }
.service-revenue-track .service-seo { background: #4f83df; }
.service-revenue-track .service-ads { background: #e6a23c; }

.project-status-row {
    display: grid;
    grid-template-columns: minmax(120px, .9fr) minmax(100px, 1fr) 24px;
    align-items: center;
    gap: 10px;
    font-size: 12px;
}

.project-status-row strong { text-align: right; }
.dashboard-action-list { gap: 0; }

.dashboard-action-list > a {
    display: grid;
    grid-template-columns: 72px minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    min-height: 58px;
    border-bottom: 1px solid var(--line);
}

.dashboard-action-list > a:last-child { border-bottom: 0; }
.dashboard-action-list > a:hover strong { color: var(--green); }
.dashboard-action-list a > span:nth-child(2) { min-width: 0; }
.dashboard-action-list strong,
.dashboard-action-list small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dashboard-action-list strong,
.dashboard-action-list b { font-size: 12px; font-weight: 600; }
.dashboard-action-list small { margin-top: 2px; color: var(--muted); font-size: 10px; }

.action-status {
    justify-self: start;
    border-radius: 999px;
    padding: 3px 7px;
    font-size: 10px;
    font-weight: 600;
}

.action-status.overdue { color: var(--red); background: var(--red-soft); }
.action-status.due { color: #b76512; background: var(--amber-soft); }
.dashboard-empty { padding: 24px 0; color: var(--muted); text-align: center; font-size: 12px; }

@media (max-width: 1100px) {
    .dashboard-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .dashboard-main-grid,
    .dashboard-lower-grid { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
    .dashboard-kpis { grid-template-columns: 1fr; }
    .dashboard-header { align-items: flex-start; }
    .dashboard-panel { padding: 16px; }
    .dashboard-panel-header { flex-direction: column; margin-bottom: 16px; }
    .revenue-chart { grid-template-columns: repeat(12, 62px); }
    .dashboard-action-list > a { grid-template-columns: 68px minmax(0, 1fr); padding: 8px 0; }
    .dashboard-action-list b { grid-column: 2; }
    .dashboard-followups-header { align-items: flex-start; flex-direction: column; }
    .dashboard-followups-counts { flex-wrap: wrap; }
    .dashboard-followup-item { grid-template-columns: 48px minmax(0, 1fr); padding: 12px; }
    .dashboard-followup-actions { grid-column: 2; flex-wrap: wrap; }
}

/* Database backup */
.backup-page {
    display: grid;
    gap: 18px;
}

.backup-page .topbar {
    margin-bottom: 0;
}

.backup-message {
    padding: 12px 14px;
    border: 1px solid;
    border-radius: 8px;
    font-size: 13px;
}

.backup-message.success {
    border-color: #b7e5d2;
    background: var(--green-soft);
    color: #087650;
}

.backup-message.error {
    border-color: #ffc7d5;
    background: var(--red-soft);
    color: #b42348;
}

.backup-panel {
    display: grid;
    grid-template-columns: 46px minmax(190px, .65fr) minmax(340px, 1.35fr);
    align-items: center;
    gap: 16px;
    padding: 22px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.backup-panel-icon {
    display: grid;
    place-items: center;
    width: 46px;
    height: 46px;
    border-radius: 8px;
    background: var(--green-soft);
    color: var(--green);
}

.backup-panel-icon svg {
    width: 24px;
    height: 24px;
}

.backup-panel-copy h2,
.backup-history-header h2 {
    font-size: 16px;
    font-weight: 600;
}

.backup-panel-copy > p,
.backup-history-header p,
.backup-security-note {
    color: var(--muted);
    font-size: 12px;
}

.backup-panel-copy > p,
.backup-history-header p {
    margin-top: 2px;
}

.backup-create-form {
    display: grid;
    gap: 6px;
}

.backup-create-form label {
    color: var(--muted);
    font-size: 12px;
    font-weight: 500;
}

.backup-create-row {
    display: grid;
    grid-template-columns: minmax(180px, 1fr) auto;
    gap: 8px;
}

.backup-create-row input {
    min-width: 0;
    min-height: 40px;
    padding: 0 12px;
    border: 1px solid #d9e1eb;
    border-radius: 8px;
    outline: 0;
    background: var(--surface);
    color: var(--text);
}

.backup-create-row input:focus {
    border-color: var(--green);
    box-shadow: 0 0 0 3px rgba(15, 155, 105, .1);
}

.backup-create-button {
    min-height: 40px;
}

.backup-import-panel {
    display: grid;
    grid-template-columns: minmax(250px, .8fr) minmax(380px, 1.2fr);
    align-items: center;
    gap: 24px;
    padding: 20px 22px;
    border: 1px solid #f3d7a4;
    border-radius: 8px;
    background: #fffaf0;
}

.backup-import-panel > header {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.backup-import-panel h2 {
    font-size: 15px;
    font-weight: 600;
}

.backup-import-panel header p {
    margin-top: 2px;
    color: var(--muted);
    font-size: 12px;
}

.backup-local-badge {
    display: inline-flex;
    min-height: 22px;
    align-items: center;
    padding: 0 7px;
    border-radius: 5px;
    background: var(--amber-soft);
    color: #a65a0a;
    font-size: 9px;
    font-weight: 600;
    white-space: nowrap;
}

.backup-import-panel form {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) auto;
    align-items: end;
    gap: 8px 12px;
}

.backup-file-field {
    display: grid;
    gap: 6px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 500;
}

.backup-file-field input {
    min-width: 0;
    min-height: 40px;
    padding: 7px 9px;
    border: 1px solid #e8c987;
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
}

.backup-import-confirm {
    display: flex;
    grid-column: 1 / -1;
    align-items: center;
    gap: 8px;
    color: #7c531a;
    font-size: 11px;
}

.backup-import-confirm input {
    width: 16px;
    height: 16px;
    accent-color: var(--amber);
}

.backup-import-button {
    min-height: 40px;
    border-color: #e8c987;
    color: #8b5712;
}

.backup-history {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.backup-history-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 20px;
    border-bottom: 1px solid var(--line);
}

.backup-history-header > span {
    color: var(--muted-soft);
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 11px;
}

.backup-table-wrap {
    overflow-x: auto;
}

.backup-table {
    width: 100%;
    min-width: 920px;
    border-collapse: collapse;
    font-size: 13px;
}

.backup-table th {
    padding: 8px 16px;
    background: var(--surface-soft);
    color: var(--muted);
    text-align: left;
    font-size: 11px;
    font-weight: 500;
}

.backup-table td {
    padding: 8px 16px;
    border-top: 1px solid var(--line);
    vertical-align: middle;
}

.backup-table tbody tr:first-child td {
    border-top: 0;
}

.backup-table td.backup-name-cell {
    max-width: 300px;
}

.backup-table td.backup-name-cell strong,
.backup-table td.backup-name-cell small,
.backup-deleted-meta {
    display: block;
}

.backup-table td.backup-name-cell strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 600;
}

.backup-table td.backup-name-cell small,
.backup-deleted-meta {
    margin-top: 2px;
    color: var(--muted-soft);
    font-size: 10px;
}

.backup-status {
    display: inline-flex;
    min-height: 24px;
    align-items: center;
    padding: 0 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
}

.backup-status.available {
    color: #087650;
    background: var(--green-soft);
}

.backup-status.deleted {
    color: var(--muted);
    background: #eef2f7;
}

.backup-status.failed {
    color: #b42348;
    background: var(--red-soft);
}

.backup-status.processing {
    color: #a65a0a;
    background: var(--amber-soft);
}

.backup-row-actions {
    display: flex;
    justify-content: flex-end;
    gap: 6px;
}

.backup-icon-button {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 1px solid #d9e1eb;
    border-radius: 7px;
    background: var(--surface);
}

.backup-icon-button.download {
    color: var(--green);
}

.backup-icon-button.delete {
    color: var(--red);
}

.backup-icon-button:hover {
    background: var(--surface-soft);
}

.backup-failure {
    display: block;
    max-width: 220px;
    overflow: hidden;
    color: var(--red);
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 11px;
}

.backup-empty {
    padding: 40px 16px !important;
    color: var(--muted);
    text-align: center;
}

.backup-security-note {
    margin: 0;
}

@media (max-width: 900px) {
    .backup-panel {
        grid-template-columns: 46px minmax(0, 1fr);
        align-items: start;
    }

    .backup-create-form {
        grid-column: 1 / -1;
    }

    .backup-import-panel {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 720px) {
    .backup-create-row {
        grid-template-columns: 1fr;
    }

    .backup-create-button {
        width: 100%;
    }

    .backup-import-panel form {
        grid-template-columns: 1fr;
    }

    .backup-import-button,
    .backup-import-confirm {
        grid-column: 1;
    }

    .backup-history-header {
        align-items: flex-start;
        flex-direction: column;
    }
}

/* Monthly customers */
.billing-period-card,
.cycle-context-card,
.monthly-summary-card {
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.billing-period-card {
    margin-bottom: 20px;
    padding: 20px;
    border-radius: 10px;
}

.billing-period-card > header {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}

.billing-year-field {
    display: flex;
    flex-direction: row;
    align-items: center;
    flex-wrap: nowrap;
    gap: 12px;
    color: var(--muted);
    font-weight: 500;
}

.billing-period-title {
    color: var(--text);
    font-weight: 600;
    white-space: nowrap;
}

.billing-year-field select {
    flex: 0 0 132px;
    width: 132px;
    min-width: 132px;
    min-height: 40px;
    padding: 0 12px;
    border: 1px solid #d9e1eb;
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
}

.cycle-error {
    display: block;
    margin: -8px 0 12px;
}

.month-tabs {
    display: grid;
    grid-template-columns: repeat(12, minmax(76px, 1fr));
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 2px;
}

.month-tabs button {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 38px;
    padding: 0 10px;
    border: 0;
    border-radius: 8px;
    background: var(--surface-soft);
    color: var(--muted);
    font-weight: 500;
    white-space: nowrap;
}

.month-alert {
    display: inline-grid;
    place-items: center;
    width: 17px;
    height: 17px;
    border-radius: 50%;
    background: var(--red);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    line-height: 1;
}

.month-tabs button.active .month-alert {
    background: #fff;
    color: var(--red);
}

.month-tabs button:hover {
    color: var(--green);
    background: var(--green-soft);
}

.month-tabs button.active {
    background: var(--green);
    color: #fff;
    box-shadow: 0 8px 18px rgba(15, 155, 105, .18);
}

.monthly-summary-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.monthly-summary-card {
    display: grid;
    min-height: 124px;
    padding: 18px;
    border-radius: 10px;
}

.monthly-summary-card small {
    color: var(--muted);
    font-size: 13px;
}

.monthly-summary-card strong {
    align-self: center;
    font-size: 24px;
    font-weight: 600;
}

.monthly-summary-card span {
    align-self: end;
    color: var(--muted-soft);
    font-size: 12px;
}

.monthly-summary-card.paid strong {
    color: var(--green);
}

.monthly-summary-card.overdue strong {
    color: var(--red);
}

.monthly-summary-card.pending strong,
.monthly-summary-card.invoice strong {
    color: var(--amber);
}

.cycle-context-card {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    padding: 14px 16px;
    border-radius: 10px;
}

.cycle-context-icon {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: var(--green-soft);
    color: var(--green);
    font-weight: 600;
}

.cycle-context-card strong,
.cycle-context-card small {
    display: block;
}

.cycle-context-card strong {
    font-weight: 600;
}

.cycle-context-card small {
    margin-top: 2px;
    color: var(--muted);
}

.monthly-toolbar {
    grid-template-columns: minmax(240px, 1.5fr) repeat(3, minmax(150px, .7fr));
}

.monthly-table-wrap {
    overflow-x: auto;
}

.monthly-table-wrap:focus-visible {
    outline: 2px solid var(--green);
    outline-offset: -2px;
}

.monthly-table {
    min-width: 1040px;
}

.monthly-table th,
.monthly-table td {
    padding-top: 8px;
    padding-bottom: 8px;
}

.monthly-table th:nth-child(1) { width: 64px; }
.monthly-table th:nth-child(2) { width: 27%; }
.monthly-table th:nth-child(3) { width: 12%; }
.monthly-table th:nth-child(4) { width: 14%; }
.monthly-table th:nth-child(5) { width: 14%; }
.monthly-table th:nth-child(6) { width: 14%; }
.monthly-table th:nth-child(7) { width: 12%; }
.monthly-table th:nth-child(8) { width: 7%; }

.website-with-billing {
    display: flex;
    align-items: center;
    gap: 8px;
}

.website-with-billing strong {
    font-weight: 500;
}

.monthly-website-stack {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.monthly-website-stack strong {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.payment-cycle-badge {
    display: inline-flex;
    align-items: center;
    flex: 0 0 auto;
    width: fit-content;
    min-height: 22px;
    padding: 0 9px;
    border-radius: 999px;
    background: #eef3f8;
    color: var(--muted);
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
}

.payment-cycle-badge.recurring {
    background: #fff5df;
    color: #b76512;
}

.billing-toggle {
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    width: 30px;
    height: 30px;
    padding: 0;
    border: 1px solid #d9e1eb;
    border-radius: 7px;
    background: var(--surface);
    color: var(--muted-soft);
}

.billing-toggle.active {
    border-color: #b7ead5;
    background: var(--green-soft);
    color: var(--green);
}

.money-cell {
    font-weight: 500;
    white-space: nowrap;
}

.money-cell small,
.money-cell span {
    display: block;
    margin-top: 2px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 400;
}

.collection-date {
    font-weight: 500;
}

.collection-date.is-due-soon {
    color: var(--amber);
}

.collection-date.is-overdue {
    color: var(--red);
}

.payment-date {
    color: var(--muted-soft);
    font-weight: 400;
    white-space: nowrap;
}

.payment-date.is-paid {
    color: var(--green);
    font-weight: 500;
}

.monthly-services {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.service-tag {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 0 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
}

.service-ma {
    background: var(--green-soft);
    color: #08764f;
}

.service-seo {
    background: var(--blue-soft);
    color: #2868d7;
}

.service-ads {
    background: var(--amber-soft);
    color: #b76512;
}

.monthly-status {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 0 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
}

.monthly-status.status-pending {
    background: #eef2f7;
    color: #5e6d82;
}

.monthly-status.status-needs_billing {
    background: var(--amber-soft);
    color: #b76512;
}

.monthly-status.status-billed {
    background: var(--violet-soft);
    color: #6847d8;
}

.monthly-status.status-paid {
    background: var(--green-soft);
    color: #08764f;
}

.monthly-status.status-overdue {
    background: var(--red-soft);
    color: #c9385c;
}

.monthly-status-select {
    width: 100%;
    min-width: 118px;
    min-height: 28px;
    padding: 0 30px 0 10px;
    border: 1px solid transparent;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 400;
    cursor: pointer;
}

.monthly-status-select:focus-visible {
    border-color: var(--green);
    outline: 2px solid rgba(15, 155, 105, .15);
    outline-offset: 1px;
}

.monthly-status-select.status-pending {
    background-color: #eef2f7;
    color: #5e6d82;
}

.monthly-status-select.status-needs_billing {
    background-color: var(--amber-soft);
    color: #b76512;
}

.monthly-status-select.status-billed {
    background-color: var(--violet-soft);
    color: #6847d8;
}

.monthly-status-select.status-paid {
    background-color: var(--green-soft);
    color: #08764f;
}

.monthly-status-select.status-overdue {
    background-color: var(--red-soft);
    color: #c9385c;
}

.monthly-status-select:disabled {
    cursor: not-allowed;
    opacity: .65;
}

.monthly-note {
    max-width: 180px;
    overflow: hidden;
    color: var(--muted);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.monthly-row-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    white-space: nowrap;
}

.quick-paid {
    color: var(--green);
    font-size: 12px;
    min-height: 28px;
    padding-right: 8px;
    padding-left: 8px;
}

.paid-confirmation {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 500;
}

.paid-confirmation svg {
    width: 16px;
    height: 16px;
}

.payment-confirm-panel {
    width: min(460px, calc(100vw - 32px));
}

.payment-confirm-panel .field {
    margin-top: 20px;
    text-align: left;
}

.monthly-modal-card {
    width: min(900px, calc(100vw - 32px));
}

.monthly-modal-body {
    display: grid;
    gap: 20px;
}

.monthly-modal-card .modal-actions {
    padding: 8px 24px 24px;
}

.monthly-service-options {
    margin: 0;
    padding: 0;
    border: 0;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.monthly-service-options legend {
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text);
}

.monthly-service-row {
    display: grid;
    grid-template-columns: minmax(98px, .8fr) minmax(110px, 1.2fr);
    align-items: center;
    gap: 12px;
    min-width: 0;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    transition: border-color .15s ease, background .15s ease;
}

.monthly-service-row.selected {
    border-color: #b7e5d2;
    background: #f5fcf8;
}

.monthly-service-row label,
.monthly-service-price {
    display: flex;
    align-items: center;
    gap: 8px;
}

.monthly-service-row label {
    min-width: 0;
    cursor: pointer;
}

.monthly-service-row input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--green);
}

.monthly-service-price {
    position: relative;
    flex: 1;
    max-width: none;
    gap: 0;
}

.monthly-service-price > span {
    position: absolute;
    z-index: 1;
    left: 12px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 500;
    pointer-events: none;
}

.monthly-service-price input {
    appearance: textfield;
    width: 100%;
    min-width: 0;
    min-height: 40px;
    padding: 0 12px 0 30px;
    border: 1px solid #dce4ee;
    border-radius: 8px;
    outline: 0;
    background: var(--surface);
    color: var(--text);
    font-size: 14px;
    text-align: right;
    transition: border-color .12s ease, box-shadow .12s ease, background .12s ease;
}

.monthly-service-price input::-webkit-inner-spin-button,
.monthly-service-price input::-webkit-outer-spin-button {
    margin: 0;
    -webkit-appearance: none;
}

.monthly-service-price input:focus {
    border-color: var(--green);
    box-shadow: 0 0 0 3px rgba(15, 155, 105, .12);
}

.monthly-service-price input:disabled {
    border-color: #e7ebf0;
    background: #f7f9fb;
    color: var(--muted-soft);
    cursor: not-allowed;
    opacity: 1;
}

.monthly-service-row:not(.selected) .monthly-service-price > span {
    color: var(--muted-soft);
}

.monthly-fee-total strong {
    display: flex;
    align-items: center;
    min-height: 42px;
    font-size: 18px;
}

.monthly-billing-option {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
    border-radius: 8px;
    background: var(--surface-soft);
    cursor: pointer;
}

.monthly-billing-option input {
    width: 18px;
    height: 18px;
    margin: 2px 0 0;
    accent-color: var(--green);
}

.monthly-billing-option strong,
.monthly-billing-option small {
    display: block;
}

.monthly-billing-option strong {
    font-weight: 600;
}

.monthly-billing-option small {
    margin-top: 2px;
    color: var(--muted);
}

@media (max-width: 1280px) {
    .monthly-summary-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .monthly-toolbar {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 720px) {
    .monthly-service-options {
        grid-template-columns: 1fr;
    }

    .monthly-service-row {
        grid-template-columns: minmax(110px, .8fr) minmax(130px, 1.2fr);
    }
}

@media (max-width: 720px) {
    .auth-page {
        padding: 16px;
    }

    .auth-panel {
        padding: 24px 20px;
    }

    .work-type-options > div {
        grid-template-columns: 1fr;
    }

    .billing-period-card > header {
        align-items: stretch;
        flex-direction: column;
    }

    .month-tabs {
        grid-template-columns: repeat(12, 88px);
    }

    .monthly-summary-grid,
    .monthly-toolbar {
        grid-template-columns: 1fr;
    }

    .monthly-summary-card {
        min-height: 108px;
    }

    .cycle-context-card {
        align-items: flex-start;
    }
}

/* Service registers */
.page-actions, .register-toolbar, .register-summary { display: flex; gap: 12px; }
.register-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 24px 0; }
.register-summary .summary-action { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 18px 20px; display: grid; gap: 4px; }
.register-summary .summary-action[aria-pressed="true"] { border-color: var(--green); }
.register-summary small, .register-summary span, .register-table td small { color: var(--muted); font-size: 13px; }
.register-summary strong { font-size: 24px; }
.register-toolbar { align-items: center; margin-bottom: 16px; }
.register-toolbar .search-field { flex: 1; }
.register-toolbar select {
    width: 210px;
    min-width: 170px;
    min-height: 42px;
    border: 1px solid #dfe6ee;
    border-radius: 8px;
    padding: 0 38px 0 14px;
    background: #fff;
    color: var(--text);
    font-size: 14px;
    outline: 0;
    appearance: none;
    box-shadow: inset 0 1px 2px rgba(17, 24, 39, .03);
}
.register-toolbar select:focus {
    border-color: var(--green);
    box-shadow: 0 0 0 3px rgba(15, 155, 105, .12);
}
.register-table td { font-size: 13px; }
.register-table td strong, .register-table td small { display: block; }
.domain-hosting-table { min-width: 1120px; }
.domain-hosting-table td { white-space: nowrap; }
.domain-hosting-website { max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
.service-expiry { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.register-provider-tag { display: inline-flex; align-items: center; max-width: 132px; }
.register-provider-tag > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.payment-receive { width: 44px; height: 44px; flex: 0 0 44px; border-color: transparent; background: transparent; color: var(--green); box-shadow: none; }
.payment-receive svg { width: 20px; height: 20px; }
.payment-receive.is-partial { color: #b76512; }
.payment-receive.is-paid { color: var(--muted); }
button.payment-receive:hover { background: var(--green-soft); }
button.payment-receive.is-paid:hover { background: var(--surface-soft); }
.payment-receive:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
.service-payment-modal { max-width: 520px; }
.service-payment-modal .modal-header > div { min-width: 0; overflow-wrap: anywhere; }
.service-payment-modal .modal-actions { padding: 8px 24px 24px; }
.service-payment-body { align-content: start; }
.service-payment-options { display: grid; min-width: 0; margin: 0; padding: 0; border: 0; }
.service-payment-options legend { margin-bottom: 6px; font-size: 13px; font-weight: 500; }
.service-payment-option { display: grid; grid-template-columns: 18px minmax(0, 1fr) auto; align-items: center; gap: 10px; min-height: 44px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; cursor: pointer; }
.service-payment-option input { width: 16px; height: 16px; margin: 0; accent-color: var(--green); }
.service-payment-option strong { font-size: 14px; font-weight: 500; white-space: nowrap; }
.service-payment-periods { display: grid; gap: 6px; margin: 0; color: var(--muted); font-size: 12px; }
.service-payment-periods > div { display: flex; flex-wrap: wrap; gap: 4px 8px; }
.service-payment-periods dd { margin: 0; }
.service-payment-years { min-width: 0; margin: 0; padding: 0; border: 0; }
.service-payment-years legend { margin-bottom: 8px; font-size: 13px; font-weight: 500; }
.service-payment-year-options { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; }
.service-payment-year { flex: 1 0 45px; min-height: 36px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--muted); font: inherit; font-size: 13px; cursor: pointer; white-space: nowrap; }
.service-payment-year[aria-pressed="true"] { border-color: var(--green); background: var(--green-soft); color: var(--green); font-weight: 600; }
.service-payment-year:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
.service-payment-total { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 14px; }
.service-payment-total strong { font-size: 20px; font-weight: 600; }
@media (max-width: 720px) {
    .service-payment-modal { max-width: none; }
    .service-payment-modal .modal-actions { padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); }
}
.register-table tr.is-expiring td { background: #fffaf0; }
.register-table tr.is-expired td { background: #fff5f6; }
.register-type, .register-status { display: inline-flex; padding: 4px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.service-expiry-status { flex: 0 0 auto; font-size: 11px; padding: 3px 7px; }
.register-type-domain { background: #eef4ff; color: #2864ce; }
.register-type-hosting { background: #f0ecff; color: #6745d6; }
.status-active { background: #e7f8ef; color: #087e57; }
.status-expiring { background: #fff1d8; color: #b4620c; }
.status-expired, .status-cancelled { background: #ffe7eb; color: #cb3654; }
.row-actions { white-space: nowrap; }
.register-modal { max-width: 880px; }
.register-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; padding: 24px; }
.register-modal .modal-actions { padding: 8px 24px 24px; }
.register-form-grid em { color: var(--red); font-size: 12px; font-style: normal; }
.collection-amount { font-size: 15px; white-space: nowrap; color: var(--ink); }
@media (max-width: 900px) {
    .register-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .register-toolbar { align-items: stretch; flex-direction: column; }
    .register-toolbar select { width: 100%; }
    .register-form-grid { grid-template-columns: 1fr; }
    .register-form-grid label.full { grid-column: auto; }
    .page-actions { flex-wrap: wrap; }
}
@media (max-width: 560px) { .register-summary { grid-template-columns: 1fr; } }

/* Shared controls keep filter and modal affordances aligned. */
.field select,
.ui-select,
.filter-select,
.register-toolbar .ui-select,
.billing-year-field select {
    appearance: none;
    padding-right: 42px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6' fill='none' stroke='%2364758b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-position: right 12px center;
    background-size: 18px 18px;
    background-repeat: no-repeat;
}

.table-sort-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 32px;
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
}
.table-sort-icon { width: 14px; height: 14px; flex: 0 0 14px; color: var(--muted); }
.table-sort-icon.is-sorted { color: var(--green); }
.table-sort-button:focus-visible,
.input-suggestion:focus-visible { outline: 2px solid var(--green); outline-offset: 3px; }

.input-suggestions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.input-suggestions-single-row { flex-wrap: nowrap; gap: 4px; max-width: 100%; overflow-x: auto; }
.input-suggestions-single-row .input-suggestion { flex: 0 0 auto; white-space: nowrap; padding: 4px 6px; }
.input-suggestion {
    min-height: 28px;
    padding: 4px 8px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--surface);
    color: var(--muted);
    font-size: 12px;
    font-weight: 400;
    cursor: pointer;
}
.input-suggestion[aria-pressed="true"] { color: var(--green); border-color: var(--green); background: var(--green-soft); }

.dashboard-period-controls { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.dashboard-period-controls .filter-select { width: 150px; }
.dashboard-period-controls .dashboard-year-select { width: 110px; }
.dashboard-period-controls .dashboard-updated { white-space: nowrap; }

.sales-modal { display: flex; flex-direction: column; overflow: hidden; }
.sales-modal .record-header { flex-shrink: 0; padding: 22px 24px; }
.sales-modal .record-identity { min-width: 0; }
.sales-modal .record-avatar,
.sales-modal .icon-btn { flex-shrink: 0; }
.sales-modal-scroll { flex: 1; min-height: 0; max-height: none; }
.sales-modal .modal-actions { flex-shrink: 0; flex-wrap: wrap; padding: 16px 24px; border-top: 1px solid var(--line); }
.sales-workspace-history-only { grid-template-columns: minmax(0, 1fr); }
.discard-confirmation-backdrop { z-index: 90; }
.discard-confirmation-backdrop .modal-actions { padding-top: 20px; flex-wrap: wrap; }

@media (max-width: 900px) {
    .project-toolbar .filter-select { width: 100%; flex: 0 0 auto; }
    .project-toolbar .search-field { min-width: 0; }
    .sales-modal .record-header { flex-direction: row; }
    .sales-modal .record-identity { gap: 10px; }
    .sales-modal .record-avatar { display: none; }
    .sales-modal .record-header h2 { font-size: 20px; overflow-wrap: anywhere; }
    .dashboard-period-controls { justify-content: flex-start; }
}

.monthly-filter-fields,
.project-filter-fields { display: contents; }
.mobile-filter-toggle,
.mobile-add-short { display: none; }

@media (max-width: 720px) {
    .monthly-page .topbar > .btn { flex: 0 0 auto; padding-inline: 12px; font-size: 13px; }
    .monthly-modal-card { width: 100%; }
    .billing-period-card { margin-bottom: 12px; padding: 12px; }
    .billing-period-card > header { flex-flow: row wrap; align-items: center; gap: 10px; margin-bottom: 12px; }
    .billing-year-field { gap: 8px; }
    .billing-year-field select { flex-basis: 100px; width: 100px; min-width: 100px; min-height: 44px; }
    .billing-period-card > header > .btn { flex: 1 0 100%; min-height: 44px; }
    .month-tabs { grid-template-columns: repeat(12, 88px); scroll-snap-type: x proximity; }
    .month-tabs button { min-height: 44px; scroll-snap-align: center; }
    .monthly-summary-grid,
    .register-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-bottom: 12px; }
    .monthly-summary-card { min-width: 0; min-height: 86px; padding: 12px; }
    .monthly-summary-card strong { font-size: 20px; overflow-wrap: anywhere; }
    .monthly-summary-card:last-child { grid-column: 1 / -1; }
    .monthly-toolbar { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
    .monthly-toolbar .search-field { min-width: 0; width: 100%; }
    .mobile-filter-toggle { display: inline-flex; min-height: 44px; padding-inline: 10px; }
    .project-toolbar { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
    .project-toolbar .search-field { width: 100%; min-width: 0; }
    .project-filter-fields { display: none; grid-column: 1 / -1; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
    .project-filter-fields.is-open { display: grid; }
    .project-filter-fields .filter-select { min-width: 0; width: 100%; min-height: 44px; text-overflow: ellipsis; }
    .monthly-filter-fields { display: none; grid-column: 1 / -1; grid-template-columns: minmax(0, 1fr); gap: 8px; }
    .monthly-filter-fields.is-open { display: grid; }
    .monthly-filter-fields .filter-select { width: 100%; min-width: 0; }

    .monthly-table .billing-toggle { min-width: 44px; width: 44px; min-height: 44px; }
    .monthly-table .monthly-status-select { width: 100%; min-height: 44px; }
    .monthly-table .monthly-row-actions { justify-content: flex-end; }
    .monthly-table .monthly-row-actions .btn,
    .monthly-table .monthly-row-actions .icon-btn { min-width: 44px; min-height: 44px; }

    .modal-panel .modal-actions,
    .monthly-modal-card .modal-actions,
    .register-modal .modal-actions,
    .sales-modal .modal-actions { padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); }
    .register-modal .register-form-grid { padding: 16px; }
    .register-modal .modal-actions { margin-top: auto; }
}

@media (max-width: 390px) {
    .mobile-add-long { display: none; }
    .mobile-add-short { display: inline; }
    .monthly-page .topbar > .btn { min-width: 44px; }
}

.record-statement-scroll { max-width: 100%; overflow-x: auto; }
.record-statement-table { width: 100%; min-width: 620px; border-collapse: collapse; font-size: 13px; text-align: left; }
.record-statement-table th,
.record-statement-table td { padding: 8px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.record-statement-table th { background: var(--surface-soft); color: var(--muted); font-weight: 600; white-space: nowrap; }
.record-statement-table td { color: var(--text); }
.record-statement-table td small { display: block; color: var(--muted); font-size: 12px; white-space: normal; overflow-wrap: anywhere; }
.record-statement-table td:not(:nth-child(2)) { white-space: nowrap; }
.record-statement-empty { color: var(--muted) !important; text-align: center; }
.statement-status.is-paid { color: var(--green); font-weight: 600; }
.statement-status.is-overdue { color: var(--red); font-weight: 600; }

.statement-tabs { flex-direction: row; align-items: center; gap: 24px; padding: 0 24px; overflow-x: auto; }
.statement-tabs button { flex: none; min-height: 48px; cursor: pointer; }
.statement-panel { min-width: 0; padding: 20px 24px 24px; }

@media (max-width: 720px) {
    .statement-tabs { padding: 0 16px; }
    .statement-panel { padding: 16px; }
}

/* Finance */
.finance-tabs { display: flex; gap: 24px; overflow-x: auto; border-bottom: 1px solid var(--line); }
.finance-tabs button { flex: 0 0 auto; min-height: 44px; padding: 8px 4px; border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--muted); }
.finance-tabs button.active { border-bottom-color: var(--green); color: var(--green); }
.finance-tabs button:focus-visible { outline: 2px solid var(--green); outline-offset: -4px; }
.finance-flow { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin: 20px 0; }
.finance-flow > div { min-width: 0; }
.finance-flow dt { color: var(--muted); font-size: 12px; }
.finance-flow dd { margin: 4px 0 0; font-size: 16px; font-weight: 600; overflow-wrap: anywhere; }
.finance-summary .summary-action { min-width: 0; text-align: left; }
.finance-summary strong { font-size: 20px; overflow-wrap: anywhere; }
.finance-toolbar { display: flex; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 12px; }
.finance-toolbar .search-field { flex: 1 1 240px; min-width: 0; }
.finance-filter-fields { display: contents; }
.finance-toolbar .filter-select { flex: 0 1 156px; width: auto; min-width: 120px; }
.finance-table-wrap { max-width: 100%; overflow-x: auto; }
.finance-table { min-width: 920px; }
.finance-ot-table { min-width: 1120px; }
.finance-title { min-width: 160px; max-width: 300px; overflow-wrap: anywhere; white-space: normal; }
.finance-amount { font-variant-numeric: tabular-nums; white-space: nowrap; }
.finance-status { display: inline-flex; align-items: center; min-height: 26px; padding: 2px 8px; border-radius: 999px; font-size: 12px; white-space: nowrap; }
.finance-status.is-paid { color: var(--green); background: var(--green-soft); }
.finance-status.is-pending { color: var(--red); background: var(--red-soft); }
.finance-checkbox-control { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; cursor: pointer; }
.finance-receipt-check { width: 18px; height: 18px; accent-color: var(--green); }
.finance-evidence-count { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: 12px; }
.finance-evidence-count svg { width: 14px; height: 14px; }
.finance-notice { color: var(--green); }
.finance-error { color: var(--red); overflow-wrap: anywhere; }
.finance-footer { flex-wrap: wrap; gap: 12px; }
.finance-page-sizes { display: flex; flex-wrap: wrap; gap: 4px; }
.finance-page-sizes button { min-width: 44px; min-height: 40px; padding: 4px 8px; border: 1px solid var(--line); border-radius: 4px; background: var(--surface); color: var(--muted); }
.finance-page-sizes button.active { background: var(--green-soft); border-color: var(--green); color: var(--green); }
.finance-modal .full { grid-column: 1 / -1; }
.finance-modal .field { min-width: 0; }
.finance-modal .inline-field-action { grid-template-columns: minmax(0, 1fr) 44px; }
.finance-receipt-flags { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; }
.finance-receipt-flags label { display: flex; align-items: center; gap: 8px; min-height: 44px; }
.finance-receipt-flags input, .finance-attachment input { width: 18px; height: 18px; accent-color: var(--green); }
.finance-ot-totals { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 0; padding-block: 12px; border-block: 1px solid var(--line); }
.finance-ot-totals dt { color: var(--muted); font-size: 13px; }
.finance-ot-totals dd { margin: 4px 0 0; font-size: 16px; font-weight: 600; overflow-wrap: anywhere; }
.finance-upload-row, .finance-attachment { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; min-width: 0; padding-block: 8px; border-bottom: 1px solid var(--line); }
.finance-upload-row > span { min-width: 0; overflow-wrap: anywhere; flex: 1; }
.finance-attachment a { display: flex; align-items: center; gap: 12px; min-width: 0; max-width: 100%; color: var(--text); text-decoration: none; }
.finance-attachment a span { overflow-wrap: anywhere; min-width: 0; }
.finance-attachment img { width: 96px; height: 72px; flex: 0 0 96px; aspect-ratio: 4 / 3; object-fit: contain; border: 1px solid var(--line); border-radius: 4px; }
.finance-attachment label { display: flex; align-items: center; gap: 8px; min-height: 44px; color: var(--muted); font-size: 12px; }

@media (max-width: 720px) {
    .finance-flow { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
    .finance-flow > div:last-child { grid-column: 1 / -1; }
    .finance-page .finance-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .finance-summary .summary-action { padding: 12px; }
    .finance-summary strong { font-size: 16px; }
    .finance-toolbar { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
    .finance-filter-fields { display: none; grid-column: 1 / -1; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
    .finance-filter-fields.is-open { display: grid; }
    .finance-toolbar .filter-select { width: 100%; min-width: 0; min-height: 44px; }
    .finance-table .icon-btn { width: 44px; height: 44px; }
    .finance-page-sizes button { min-height: 44px; }
}

.renewal-period-bar { display: flex; align-items: center; justify-content: flex-end; gap: 16px; flex-wrap: wrap; margin-top: 20px; }
.service-register-page .lifecycle-summary { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-top: 12px; }
@media (max-width: 1280px) {
    .service-register-page .lifecycle-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.renewal-period-bar .field { display: flex; flex-direction: row; align-items: center; gap: 12px; min-width: 0; max-width: 100%; }
.renewal-period-bar > div { min-width: 0; max-width: 100%; }
.renewal-period-bar input { width: 188px; min-width: 0; max-width: 100%; }
/* Shared summary amount colors: received/paid green, due soon/pending amber, overdue/expired red. */
.summary-received strong, .service-register-page .received-amount { color: var(--green); }
.summary-warning strong { color: var(--amber); }
.summary-danger strong { color: var(--red); }
.service-register-page .renewal-money-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 12px; }
.renewal-money-cards .summary-action { min-width: 0; overflow-wrap: anywhere; }
.renewal-money-cards strong { font-size: 22px; }
.service-expiry-alert { display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px; margin-left: 4px; border-radius: 50%; background: #cb3654; color: #fff; font-weight: 600; }
.status-not_renewing { background: var(--red-soft); color: var(--red); }
.service-quote-total { display: flex; flex-direction: row; justify-content: space-between; align-items: baseline; gap: 16px; border-top: 1px solid var(--line); padding: 16px 0 8px; }
.service-quote-total strong { font-size: 20px; border-bottom: 3px double currentColor; overflow-wrap: anywhere; min-width: 0; }
.field textarea.service-shared-notes { min-height: 0; height: auto; }
@media (max-width: 560px) {
    .renewal-period-bar { gap: 8px; }
    .renewal-money-cards .summary-action { padding: 12px; }
    .renewal-money-cards strong { font-size: 18px; }
}
