:root{--ink:#273142;--muted:#747d8d;--green:#1976ed;--bg:#eff1f4;--border:#e6e9ee;--red:#ee333b}body{font-size:13px;background:var(--bg)}.topbar{margin:0;padding:15px 22px;background:linear-gradient(110deg,#1977ed,#12449c);color:#fff;min-height:66px;gap:20px;box-shadow:0 2px 5px #152c4b22}.top-brand{font-size:20px;font-weight:750;white-space:nowrap}.top-actions{display:flex;align-items:center;justify-content:flex-end;gap:10px;flex-wrap:wrap;font-size:11px}.topbar button{font-size:12px}.topbar #logout{background:#ffffff20;border-color:#ffffff40;color:#fff}.success{background:#06914e;color:#fff;border-color:#06914e}#nav{display:flex;gap:0;overflow-x:auto;background:#fff;border-bottom:1px solid var(--border);padding:0 8px}#nav button{padding:14px 16px;border-radius:0;border-bottom:3px solid transparent;color:var(--muted);font-size:12px;font-weight:650;white-space:nowrap}#nav button.active{color:#1976ed;background:#fff;border-bottom-color:#1976ed}#nav .nav-icon{width:20px}.count-badge{background:#ed3039;color:#fff;border-radius:12px;padding:1px 6px;font-size:10px;margin-left:6px}main{margin:0;padding:20px 18px;max-width:none;min-width:0}.page-title{font-size:16px;max-width:1260px;margin:0 auto 12px;letter-spacing:0}.summary-width{width:100%;max-width:1260px;margin:0 auto}.report-actions{display:flex;justify-content:flex-end;gap:8px;margin-bottom:12px}#toolbar{display:block;margin-bottom:20px}#toolbar input,#toolbar select{max-width:none;width:100%}.report-filters{display:flex;flex-wrap:wrap;gap:12px;align-items:flex-end}.report-filters label{flex:1 1 140px;max-width:220px;font-size:11px;color:var(--muted)}.report-filters input,.report-filters select{height:35px;padding:6px 9px;font-size:12px}.report-filters button{height:35px;padding:6px 12px;font-size:12px}.kpi-grid{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:14px;margin:16px 0 22px}.kpi-grid:has(>.kpi-card:nth-child(4):last-child){grid-template-columns:repeat(4,minmax(0,1fr))}.kpi-card{background:#fff;border:1px solid #e9ecf0;box-shadow:0 2px 2px #16253b06;border-radius:12px;padding:20px 17px;display:flex;align-items:center;gap:14px;min-width:0}.kpi-card strong{display:block;font-size:clamp(19px,1.8vw,27px);font-weight:800;line-height:1.25;letter-spacing:-.6px;font-variant-numeric:tabular-nums}.kpi-card small{display:block;font-size:11px;line-height:1.5;color:var(--muted)}.kpi-icon{width:44px;height:44px;border-radius:12px;display:grid;place-items:center;font-size:23px;font-weight:bold;flex-shrink:0}.kpi-icon.blue{background:#e7f0ff;color:#1976ed}.kpi-icon.green{background:#e4f4eb;color:#079b56}.kpi-icon.purple{background:#f2e8ff;color:#873cf8}.kpi-icon.orange{background:#fff3e3;color:#f59b00}.kpi-icon.red{background:#fde8e8;color:#ed3039}.section-label{margin:26px 0 10px}.report-panel{background:#fff;border:1px solid var(--border);border-radius:12px;margin-bottom:18px;overflow:hidden;min-width:0;box-shadow:0 2px 2px #16253b05}.report-heading{padding:15px 18px;display:flex;align-items:center;justify-content:space-between;gap:16px;border-bottom:1px solid var(--border);flex-wrap:wrap}.report-heading h3{font-size:14px}.report-heading label{font-size:11px;display:flex;align-items:center;gap:8px}.report-heading select{width:auto;padding:5px 9px}.report-body{padding:18px}.full-panel .report-body{padding:12px 18px}.two-panels{display:grid;grid-template-columns:1fr 1fr;gap:18px}.two-panels .report-panel{height:100%}.company-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:16px;margin:18px 0 24px}.company-card{background:#fff;border:1px solid var(--border);border-radius:10px;padding:16px}.company-card h4{font-size:12px;margin:0 0 12px;overflow-wrap:anywhere}.stat-line{display:flex;justify-content:space-between;gap:8px;border-bottom:1px solid #f0f2f5;padding:7px 0;font-size:11px}.stat-line:last-child{border:0}.stat-line strong{white-space:nowrap;font-variant-numeric:tabular-nums}.period-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:14px}.period-grid .kpi-card{padding:18px}.period-grid .kpi-card strong{font-size:23px}.table-card{border:0;border-radius:0}.table-wrap{max-width:100%;overflow:auto}table{font-size:11px}th{font-size:11px;font-weight:650;background:#f7f8fa;position:sticky;top:0;z-index:1}th,td{padding:9px 10px;border-bottom:1px solid #e9ecf1}td{white-space:nowrap}td .customer-name{display:block;max-width:310px;overflow:hidden;text-overflow:ellipsis}td input[type=checkbox]{width:15px;height:15px}.num{text-align:right;font-variant-numeric:tabular-nums;white-space:nowrap}td:has(>.num){text-align:right}.badge{padding:2px 7px;border-radius:10px;font-size:10px}.badge.good{background:#e4f4ea;color:#129552}.badge.bad{background:#fde7e7;color:#ed353c}.badge.warn{background:#fff3de;color:#d88c00}.compact{font-size:10px;padding:3px 7px;border-radius:5px;margin:2px}.mini-actions{display:flex;gap:2px}.pager{font-size:11px;padding:12px 0}.pager button{padding:5px 10px}.report-hint{font-size:11px;color:var(--muted);margin-top:10px;margin-bottom:14px}.bulk-actions{display:flex;flex-wrap:wrap;gap:8px;margin:16px 0}.bulk-actions button{font-size:11px;padding:7px 10px}.select-all{display:flex;gap:6px;align-items:center}.select-all input{width:16px}.level{font-size:10px;font-weight:700}.expired,.critical,.red-text{color:#ed3039}.warning{color:#e99800}.soon{color:#1976ed}tr:has(.level.expired),tr:has(.level.critical){background:#ffe5e5}tr:has(.level.warning){background:#fff3dd}.chart-row{display:grid;grid-template-columns:minmax(70px,1fr) 2fr 105px;gap:10px;align-items:center;margin:13px 0;font-size:11px}.chart-track{height:10px;background:#f0f3f7;border-radius:5px;overflow:hidden}.chart-track>div{height:100%;border-radius:5px}.chart-row strong{text-align:right;font-size:11px}.chart-track .blue{background:#287fee}.chart-track .green{background:#12a362}.month-chart{display:flex;gap:3px;height:225px;align-items:flex-end}.month-column{flex:1;min-width:0;display:flex;flex-direction:column;align-items:stretch;justify-content:flex-end;gap:10px;height:100%}.month-column span{text-align:center;font-size:10px;color:var(--muted)}.month-bar{border-radius:3px 3px 0 0}.month-bar.purple{background:linear-gradient(#ac83fc,#7b36f1)}.month-bar.blue{background:linear-gradient(#75b2fa,#1877ed)}.balance-bar{position:relative;margin:10px 0 18px;display:flex;justify-content:space-between;gap:12px;flex-wrap:wrap;font-size:12px}.balance-bar>div{height:17px;border-radius:4px;flex-shrink:0}.balance-bar .red{background:#ed333c}.balance-bar .orange{background:#f6ad09}.tabs{display:flex;gap:8px;flex-wrap:wrap;margin:10px 0}.tabs button{font-size:12px;padding:7px 14px}.tabs .active{background:#e8f1ff;border-color:#1976ed;color:#1976ed}.debt-group{margin:10px 0;border:1px solid var(--border);border-radius:6px}.debt-group summary{padding:11px 12px;cursor:pointer;display:flex;align-items:center;gap:12px;font-size:11px;background:#fff2f3}.debt-group.ap summary{background:#fff7e8}.debt-group summary strong{max-width:65%;overflow-wrap:anywhere}.debt-group summary span{color:var(--muted)}.debt-group summary b{margin-left:auto;color:#ed333c;white-space:nowrap}.debt-group summary b:after{content:'⌄';margin-left:12px;color:#8590a0}.debt-detail{padding:12px}.note{background:#edf4ff;border-color:#d5e5fb}.primary{background:#1976ed;border-color:#1976ed}.link-button{color:#1976ed}input:focus,select:focus,textarea:focus{outline-color:#83b7ff}footer{color:#7e8794}.report-panel .empty{padding:35px 15px}@media(min-width:1800px){.full-panel{margin-left:-8px;margin-right:-8px}}@media(max-width:1100px){.topbar{align-items:flex-start}.top-brand{font-size:17px}.kpi-grid{grid-template-columns:repeat(3,minmax(0,1fr))}.kpi-grid:has(>.kpi-card:nth-child(4):last-child){grid-template-columns:repeat(2,minmax(0,1fr))}.company-grid{grid-template-columns:repeat(3,minmax(0,1fr))}.kpi-card{padding:17px 12px;gap:10px}.kpi-card strong{font-size:22px}.kpi-icon{width:36px;height:36px}.top-actions #workspace-date{display:none}}@media(max-width:720px){main{padding:16px 10px}.topbar{padding:12px;flex-direction:column;gap:10px}.top-actions{justify-content:flex-start}.top-actions button{padding:6px 9px}.top-actions #user-name{display:none}#nav button{padding:11px 12px}.report-actions button{font-size:11px;padding:6px 9px}.report-filters label{flex-basis:calc(50% - 12px);max-width:none}.kpi-grid,.kpi-grid:has(>.kpi-card:nth-child(4):last-child){grid-template-columns:repeat(2,minmax(0,1fr));gap:9px}.kpi-card{padding:14px 10px;gap:8px}.kpi-card strong{font-size:18px;letter-spacing:-.3px}.kpi-card small{font-size:10px}.kpi-icon{width:30px;height:34px;font-size:19px}.two-panels,.period-grid{grid-template-columns:1fr}.company-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:9px}.company-card{padding:12px 9px}.stat-line{font-size:10px}.report-body,.full-panel .report-body{padding:10px}.report-heading{padding:12px}.debt-group summary{flex-wrap:wrap;gap:6px}.debt-group summary strong{max-width:100%}.chart-row{grid-template-columns:80px 1fr 95px;gap:5px}.balance-bar{font-size:11px}.form-grid,.detail-grid{grid-template-columns:1fr}.report-heading h3{font-size:13px}}
.kpi-card>div{min-width:0}.kpi-card strong{font-size:23px}.kpi-card:has(strong.long-value){gap:10px}.kpi-card strong.long-value{font-size:21px;letter-spacing:-.7px}.group-name{display:block;max-width:280px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.two-panels table{table-layout:fixed}.two-panels th:first-child{width:55%}.two-panels th:nth-child(2){width:20%}.two-panels th:nth-child(3){width:25%}.two-panels td:nth-child(2){text-align:center}.two-panels .group-name{max-width:100%}.cash-heading{display:flex;justify-content:space-between;align-items:center;gap:15px;margin:25px 0 8px}.cash-heading label{display:flex;align-items:center;gap:10px;font-size:11px}.cash-heading select{width:180px;padding:7px}.two-panels .num{font-weight:650}.two-panels .report-panel:first-child .num{color:#ed3039}.two-panels .report-panel:nth-child(2) .num{color:#ee9900}@media(max-width:720px){.kpi-card strong,.kpi-card strong.long-value{font-size:17px}.kpi-card:has(strong.long-value){gap:6px}.cash-heading select{width:130px}.group-name{max-width:160px}.two-panels table{font-size:10px}.two-panels th,.two-panels td{padding:8px 5px}.two-panels th:first-child{width:45%}.two-panels th:nth-child(3){width:35%}}
.badge.pending{background:#e5eeff;color:#1976ed}
[data-view=commission] .company-card .stat-line:nth-of-type(3) strong{color:#0a9956}[data-view=commission] .company-card .stat-line:nth-of-type(4) strong{color:#f39a00}[data-view=commission] .company-card .stat-line:nth-of-type(5) strong{color:#893bf9}[data-view=new] tbody tr:has(.badge.bad){background:#fff4e1}[data-view=new] tbody tr:has(.badge.good){background:#e7f5ec}[data-view=renewals] td .customer-name{max-width:230px}[data-view=renewals] .bulk-actions button:nth-child(-n+2){background:#853cf5;color:#fff;border-color:#853cf5}[data-view=renewals] .bulk-actions button:nth-child(3){background:#079b56;color:#fff;border-color:#079b56}

.document-actions{display:flex;flex-wrap:wrap;gap:5px;min-width:210px}.document-actions button{white-space:nowrap}
.legacy-bill-reference {display:flex;justify-content:space-between;gap:8px;font-size:11px;margin-top:6px;align-items:baseline}
.legacy-bill-reference button {padding:0;border:0;background:none;text-align:left;font-size:11px;color:inherit}

/* Reserve the same space before, during and after inline workflow saves. */
.expiry-status-control{width:150px;display:grid;gap:6px}
.expiry-renewal-buttons{display:flex;gap:4px;justify-content:center}
.expiry-renewal-buttons button{padding:4px 8px;background:#e5e7eb;color:#374151;border:0;border-radius:5px;font-size:.72rem;font-weight:400;white-space:nowrap}
.expiry-renewal-buttons [data-renewal-action="renewed"][aria-pressed="true"]{background:#059669;color:#fff;font-weight:700}
.expiry-renewal-buttons [data-renewal-action="declined"][aria-pressed="true"]{background:#dc2626;color:#fff;font-weight:700}
.expiry-renewal-date{height:14px;font-size:.65rem;line-height:14px;color:#64748b;text-align:center}
tr:has(.expiry-overdue){background:#fee2e2!important}
tr:has(.expiry-overdue):hover{background:#fecaca!important}
.expiry-overdue strong,.expiry-overdue>span,.expiry-overdue .expiry-meta{color:#b91c1c}
tr:has(.expiry-overdue)>td:first-child{box-shadow:inset 3px 0 #dc2626}
.expiry-save-state{display:block;height:18px;line-height:18px;font-size:11px;color:#64748b;white-space:nowrap}
.expiry-notification{width:170px;min-height:60px;display:flex;flex-direction:column;align-items:flex-start;justify-content:center;gap:6px}
.expiry-notification .compact,.expiry-action-placeholder{box-sizing:border-box;height:30px;line-height:20px;white-space:nowrap}
.expiry-notification .compact{width:170px;padding:4px 8px}
.expiry-action-placeholder{padding:5px 0;font-size:11px;color:#94a3b8}

.expiry-cell{display:flex;flex-direction:column;gap:5px;white-space:normal;min-width:120px}
.expiry-meta{font-size:11px;line-height:1.4;color:#64748b;font-weight:400}
.expiry-date{width:125px}.expiry-date strong{font-size:14px}
.expiry-vehicle{width:140px}.expiry-customer{width:220px;overflow-wrap:anywhere}
.expiry-notification{min-height:80px}

/* Summary tables must scroll instead of squeezing fixed columns over each other. */
.two-panels{grid-template-columns:repeat(2,minmax(0,1fr))}
.two-panels table{table-layout:auto;min-width:420px}
.two-panels th:first-child,.two-panels th:nth-child(2),.two-panels th:nth-child(3){width:auto}
.two-panels td:first-child{white-space:normal;overflow-wrap:anywhere}
.two-panels .group-name{white-space:normal;overflow-wrap:anywhere}
@media(max-width:720px){.two-panels{grid-template-columns:1fr}}

.expiry-filter-panel{background:#fff;border:1px solid #e1e7ef;border-radius:14px;overflow:hidden;box-shadow:0 2px 4px #16253b04}
.expiry-filter-heading{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:20px 22px 16px}
.expiry-filter-heading h2{font-size:17px;color:#23354e;letter-spacing:0}.expiry-filter-heading p{font-size:12px;color:#758197;margin-top:3px}
.expiry-filter-heading button{font-size:12px;padding:8px 12px;white-space:nowrap}
.expiry-filter-controls{display:flex;align-items:flex-end;flex-wrap:wrap;gap:18px 24px;padding:0 22px 20px}
.expiry-period-control{flex:1 1 420px}.expiry-filter-label,.expiry-filter-controls label{font-size:12px;color:#52627a;font-weight:600}
.expiry-presets{display:flex;flex-wrap:wrap;gap:6px;margin-top:8px}.expiry-presets button{font-size:12px;padding:8px 14px;border-radius:8px;min-height:38px;color:#52627a}
.expiry-presets button[aria-pressed=true]{background:#eaf2ff;border-color:#1976ed;color:#1262cc;box-shadow:inset 0 0 0 1px #1976ed;font-weight:700}
.expiry-custom-days{flex:0 1 160px}.expiry-sort-field{flex:0 1 200px}
.expiry-number-field{display:flex;align-items:center;min-width:0;height:44px;border:1px solid #cbd5e1;border-radius:10px;background:#f8fafc;transition:border-color .15s,box-shadow .15s,background .15s}
.expiry-number-field:hover{border-color:#94a3b8}.expiry-number-field:focus-within{border-color:#1976ed;background:#fff;box-shadow:0 0 0 3px #1976ed20}
.expiry-number-field span{flex:none;align-self:stretch;display:flex;align-items:center;padding:0 13px;border-left:1px solid #e2e8f0;color:#64748b;font-size:12px;font-weight:500}
#toolbar .expiry-number-field input{min-width:0;flex:1;width:0;border:0;border-radius:10px 0 0 10px;background:transparent;padding:10px 12px;height:42px;font-size:15px;font-weight:600;font-variant-numeric:tabular-nums;box-shadow:none;outline:none}
#toolbar .expiry-sort-field select{height:44px;padding:10px 36px 10px 12px;font-size:13px;font-weight:500;border:1px solid #cbd5e1;border-radius:10px;background-color:#f8fafc;cursor:pointer;transition:border-color .15s,box-shadow .15s}
#toolbar .expiry-sort-field select:hover{border-color:#94a3b8}#toolbar .expiry-sort-field select:focus{outline:none;border-color:#1976ed;background-color:#fff;box-shadow:0 0 0 3px #1976ed20}
.expiry-filter-controls label{gap:8px}.expiry-presets button{min-height:44px}
.expiry-filter-footer{display:flex;align-items:center;justify-content:space-between;gap:10px;flex-wrap:wrap;background:#f7f9fc;border-top:1px solid #e9eef5;padding:12px 22px;font-size:12px;color:#52627a}
.expiry-color-key{display:flex;align-items:center;gap:7px;white-space:nowrap;color:#7b8797;font-size:11px}.expiry-color-key i{width:9px;height:9px;border-radius:3px;background:#fecaca;border:1px solid #f87171}
@media(max-width:720px){.expiry-filter-heading{padding:16px;align-items:flex-start}.expiry-filter-controls{padding:0 16px 16px;gap:14px}.expiry-period-control{flex-basis:100%}.expiry-custom-days,.expiry-sort-field{flex:1 1 130px}.expiry-filter-footer{padding:12px 16px}.expiry-filter-heading p{max-width:240px}}

/* Customizable native select keeps keyboard and screen-reader behavior. */
#toolbar .expiry-sort-field select{color:#263b55;min-width:190px}
#toolbar .expiry-sort-field option{padding:12px 14px;color:#334155;background:#fff;font-size:13px;line-height:1.6}
@supports (appearance:base-select){
 #toolbar .expiry-sort-field select,#toolbar .expiry-sort-field select::picker(select){appearance:base-select}
 #toolbar .expiry-sort-field select{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:10px 14px}
 #toolbar .expiry-sort-field select::picker-icon{color:#64748b;transition:transform .15s}
 #toolbar .expiry-sort-field select:open::picker-icon{transform:rotate(180deg)}
 #toolbar .expiry-sort-field select:open{border-color:#1976ed;background:#fff;box-shadow:0 0 0 3px #1976ed20}
 #toolbar .expiry-sort-field select::picker(select){margin-top:7px;padding:6px;border:1px solid #dce4ee;border-radius:12px;background:#fff;box-shadow:0 10px 28px #19355224;min-width:anchor-size(width)}
 #toolbar .expiry-sort-field option{display:flex;align-items:center;gap:12px;min-height:44px;border-radius:7px;cursor:pointer}
 #toolbar .expiry-sort-field option:hover,#toolbar .expiry-sort-field option:focus{background:#f1f5fb;outline:none}
 #toolbar .expiry-sort-field option:checked{background:#eaf2ff;color:#1262cc;font-weight:600}
 #toolbar .expiry-sort-field option::checkmark{color:#1976ed;margin-inline-start:auto;order:1}
}

/* Notification takes visual priority over the overdue highlight. */
tr:has(.expiry-already-notified){background:#f1f3f5!important;color:#718096}
tr:has(.expiry-already-notified):hover{background:#e9edf2!important}
tr:has(.expiry-already-notified)>td:first-child{box-shadow:inset 3px 0 #a4afbd}
tr:has(.expiry-already-notified) .expiry-cell strong,tr:has(.expiry-already-notified) .expiry-cell>span,tr:has(.expiry-already-notified) .expiry-meta{color:#718096}
tr:has(.expiry-already-notified) .badge.good{background:#e2e7ed;color:#52627a}

/* Compact controls stay attached to the column they affect. */
[data-view=renewals] th{z-index:4;vertical-align:top;background:#f5f8fc;border-bottom:2px solid #dce5f0}
.expiry-column-head{display:flex;align-items:center;justify-content:space-between;gap:6px;min-width:115px;position:relative}
.expiry-column-sort{display:flex;align-items:center;gap:10px;flex:1;text-align:left;white-space:nowrap;border:0;background:transparent;padding:7px 0;font-size:11px;font-weight:650;color:#52627a}
.expiry-column-sort span{color:#94a3b8}.expiry-column-sort.selected,.expiry-column-sort.selected span{color:#1764bf}
.expiry-column-filter summary{display:grid;place-items:center;width:28px;height:28px;cursor:pointer;list-style:none;border-radius:7px;border:1px solid #e2e8f0;background:#fff;color:#64748b;font-size:16px;position:relative}.expiry-column-filter summary::-webkit-details-marker{display:none}
.expiry-column-filter[open] summary,.expiry-column-filter.is-active summary{background:#eaf2ff;border-color:#91b9f2;color:#1764bf}.expiry-column-filter i{width:5px;height:5px;position:absolute;right:3px;top:3px;background:#1976ed;border-radius:50%}
.expiry-column-popover{position:absolute;top:38px;left:0;z-index:8;width:230px;padding:14px;border:1px solid #d6e1ef;border-radius:12px;background:#fff;box-shadow:0 12px 32px #19355226;display:grid;gap:10px;white-space:normal;color:#52627a}
.expiry-column-popover strong{font-size:12px;color:#263b55}.expiry-column-popover label{font-size:11px;gap:4px}
.expiry-column-popover input,.expiry-column-popover select{width:100%;min-width:0;padding:8px;font-size:12px;height:36px;background:#f8fafc;border-radius:7px}.expiry-column-popover button{font-size:11px;padding:6px;color:#1764bf}
[data-view=renewals] th:has(.expiry-column-filter[open]){z-index:6}
.expiry-table-tools{display:flex;align-items:center;gap:12px;font-size:11px;color:#758197}.expiry-table-tools button{font-size:11px;padding:6px 10px}
.expiry-column-sort:focus-visible,.expiry-column-filter summary:focus-visible{outline:2px solid #1976ed;outline-offset:2px}
