/* Billing reference: 02-switchboard-billing.png. Keep the ledger compact and the
   invoice's actions, amount, account and event history together in one inspector. */
.billing-workbench { min-width:0; }
.billing-workbench .workspace-page-intro { margin-bottom:26px; }
.billing-workbench-grid { display:grid; grid-template-columns:minmax(0,1fr); align-items:start; gap:24px; }
.billing-workbench-grid.has-detail { grid-template-columns:minmax(0,1fr) 430px; }
.billing-ledger-column { min-width:0; }
.billing-view-tabs { display:flex; gap:24px; border-bottom:1px solid var(--border); margin-bottom:18px; min-height:48px; }
.billing-view-tabs a { padding:12px 10px; text-decoration:none; color:var(--foreground-muted); white-space:nowrap; font-size:13px; }
.billing-view-tabs .active { color:var(--brand); box-shadow:inset 0 -2px var(--brand); }
.billing-filter-bar { display:flex; align-items:center; gap:10px; margin-bottom:20px; }
.billing-filter-bar label { margin:0; min-width:0; flex:1 1 120px; }
.billing-filter-bar .form-input { width:100%; padding:8px 10px; font-size:12px; min-height:38px; }
.billing-search { position:relative; flex:1.25 1 130px; min-width:0; }
.billing-search input { padding-right:32px!important; }
.billing-search button { position:absolute; right:0; top:0; height:100%; width:32px; background:none; border:0; color:var(--foreground-muted); cursor:pointer; }
.billing-stat-strip { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); border:1px solid var(--border); border-radius:4px; margin-bottom:18px; background:linear-gradient(130deg,var(--surface),transparent); }
.billing-stat-strip button { background:none; border:0; border-right:1px solid var(--border); padding:16px 18px; text-align:left; color:var(--foreground); cursor:pointer; min-width:0; }
.billing-stat-strip button:last-child { border-right:0; }
.billing-stat-strip button:hover { background:var(--primary-subtle); }
.billing-stat-strip span,.billing-stat-strip small { display:block; font-size:12px; color:var(--foreground-muted); }
.billing-stat-strip small { font-size:10px; margin-top:3px; }
.billing-stat-strip strong { display:block; font:600 26px/1.4 ui-monospace,SFMono-Regular,Consolas,monospace; letter-spacing:-1px; white-space:nowrap; }
.billing-amber { color:#ffc35c!important; }
.billing-green { color:#88daa7!important; }
.billing-table-frame { border:1px solid var(--border); border-radius:4px; overflow:hidden; }
.billing-invoice-table { width:100%; table-layout:fixed; border-collapse:collapse; font-size:13px; }
.billing-invoice-table th { padding:12px 12px; text-align:left; color:var(--foreground-muted); font-weight:400; border-bottom:1px solid var(--border-strong); }
.billing-invoice-table th:nth-child(1) { width:22%; }
.billing-invoice-table th:nth-child(2) { width:21%; }
.billing-invoice-table th:nth-child(3) { width:13%; }
.billing-invoice-table th:nth-child(4) { width:17%; }
.billing-invoice-table th:nth-child(5) { width:13%; }
.billing-invoice-table th:nth-child(6) { width:14%; }
.billing-invoice-table th button { font:inherit; background:none; border:0; color:inherit; padding:0; cursor:pointer; }
.billing-invoice-table td { padding:11px 12px; height:45px; border-bottom:1px solid var(--border); vertical-align:middle; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.billing-invoice-table tr:last-child td { border-bottom:0; }
.billing-invoice-table tbody tr:not(.empty-row) { cursor:pointer; }
.billing-invoice-table tbody tr:hover { background:rgba(153,191,185,.07); }
.billing-invoice-table .workspace-row-selected { background:rgba(153,191,185,.14); box-shadow:inset 3px 0 var(--brand); }
.billing-invoice-table .workspace-row-selected td { border-bottom-color:var(--border-strong); }
.billing-invoice-table .num { text-align:right; font-variant-numeric:tabular-nums; }
.billing-row-open { display:block; max-width:100%; border:0; padding:0; font:inherit; color:var(--foreground); background:none; white-space:nowrap; text-align:left; overflow:hidden; text-overflow:ellipsis; cursor:pointer; }
.billing-row-open:hover { color:var(--brand); }
.billing-cell-ellipsis { display:block; overflow:hidden; text-overflow:ellipsis; }
.billing-invoice-table abbr { text-decoration:none; font-size:9px; color:var(--foreground-subtle); margin-left:3px; vertical-align:super; }
.billing-date { color:var(--foreground-muted); font-size:12px; }
.billing-status { display:inline-flex; align-items:center; padding:3px 7px; font-size:11px; line-height:1.35; font-weight:450; border:1px solid; border-radius:4px; white-space:nowrap; }
.billing-status.warning { color:#ffc35c; border-color:#896023; background:rgba(197,122,15,.13); box-shadow:inset 0 0 5px rgba(221,147,36,.08); }
.billing-status.danger { color:#ff9d9d; border-color:#945353; background:rgba(220,80,80,.12); }
.billing-status.success { color:#93d7a3; border-color:#376749; background:rgba(70,158,91,.1); }
.billing-status.info { color:#9ecffc; border-color:#3a6382; background:rgba(60,133,194,.12); }
.billing-status.neutral { color:#bdc9d2; border-color:#55616c; background:rgba(145,163,176,.1); }
.billing-pager { display:flex; justify-content:space-between; align-items:center; gap:12px; padding:18px 0; color:var(--foreground-muted); font-size:12px; }
.billing-pager > div { display:flex; align-items:center; gap:7px; }
.billing-pager .pager-btn { min-width:34px; min-height:36px; border:1px solid var(--border); border-radius:4px; }
.billing-pager .pager-btn.active { color:var(--brand); border-color:#35574c; background:var(--primary-subtle); }
.billing-pager .form-input { margin-left:6px; width:auto; font-size:12px; }
.billing-coverage { border-top:1px solid var(--border); font-size:11px; color:var(--foreground-muted); }
.billing-coverage summary { cursor:pointer; padding:13px 0; display:flex; align-items:center; gap:7px; list-style:none; }
.billing-coverage summary::-webkit-details-marker { display:none; }
.billing-coverage summary > span:last-child { margin-left:auto; display:flex; gap:10px; }
.billing-connection-dot { width:6px; height:6px; border-radius:50%; background:var(--brand); }
.billing-coverage-content { padding:0 4px 12px; }
.billing-coverage-content > div { display:grid; grid-template-columns:1fr 1.5fr; gap:4px 12px; border-bottom:1px solid var(--border); padding:8px 0; }
.billing-coverage-content small { grid-column:1/-1; color:var(--foreground-subtle); }
.billing-coverage-content p { line-height:1.7; }
.billing-mode { color:var(--foreground-subtle); font-size:11px; margin:0; }
.billing-mode i { color:var(--brand); margin-right:5px; }
.billing-detail-panel { position:sticky; top:80px; border:1px solid var(--border); padding:22px; min-width:0; background:linear-gradient(140deg,var(--surface),var(--background)); }
.billing-detail-panel:focus { outline:none; }
.billing-detail-panel:focus-visible { outline:2px solid var(--brand); outline-offset:3px; }
.billing-detail-heading { display:flex; justify-content:space-between; align-items:start; gap:10px; margin-bottom:8px; }
.billing-detail-heading h2 { margin:0; font-size:22px; font-weight:550; line-height:1.4; overflow-wrap:anywhere; letter-spacing:-.3px; }
.billing-icon-button { border:0; background:none; color:var(--foreground-muted); padding:4px 0 4px 8px; cursor:pointer; }
.billing-detail-subtitle { display:flex; align-items:center; gap:12px; color:var(--foreground-muted); font-size:12px; margin-bottom:18px; }
.billing-detail-subtitle > span:last-child { border-left:1px solid var(--border-strong); padding-left:12px; }
.billing-detail-actions { display:flex; gap:8px; align-items:stretch; flex-wrap:wrap; margin-bottom:14px; }
.switchboard-layout .billing-detail-actions .btn { min-height:36px; padding:8px 10px; font-size:12px; white-space:nowrap; }
.billing-detail-actions .btn:disabled { opacity:.5; cursor:not-allowed; }
.billing-more { position:relative; margin-left:auto; }
.billing-more > button { cursor:pointer; display:flex; gap:8px; align-items:center; }
.billing-more > div { position:absolute; right:0; z-index:3; min-width:195px; background:var(--surface); border:1px solid var(--border-strong); border-radius:4px; box-shadow:0 8px 30px #0005; padding:5px; }
.billing-more a,.billing-more > div button { display:block; text-decoration:none; font:inherit; font-size:12px; width:100%; text-align:left; background:none; border:0; color:var(--foreground); padding:9px; cursor:pointer; }
.billing-more a:hover,.billing-more > div button:hover { background:var(--primary-subtle); }
.billing-action-note { margin:-4px 0 12px; font-size:10px; line-height:1.6; color:var(--foreground-subtle); }
.billing-detail-money { display:grid; grid-template-columns:1fr 1.1fr; gap:16px; border-block:1px solid var(--border); padding:20px 0; margin-bottom:18px; }
.billing-detail-money > div { min-width:0; }
.billing-detail-money span { font-size:12px; color:var(--foreground-muted); display:block; }
.billing-detail-money strong { display:block; margin:4px 0; font:550 30px/1.3 ui-monospace,SFMono-Regular,Consolas,monospace; letter-spacing:-1px; overflow-wrap:anywhere; }
.billing-detail-money small { color:var(--foreground-subtle); font-size:10px; }
.billing-detail-money dl { display:grid; grid-template-columns:auto 1fr; align-content:start; gap:6px 10px; margin:0; padding-left:16px; border-left:1px solid var(--border); font-size:11px; }
.billing-detail-money dt { color:var(--foreground-muted); }
.billing-detail-money dd { margin:0; text-align:right; overflow-wrap:anywhere; font-variant-numeric:tabular-nums; }
.billing-detail-entities { display:grid; gap:20px; padding-bottom:20px; border-bottom:1px solid var(--border); }
.billing-detail-entities > div { display:flex; align-items:start; gap:14px; }
.billing-detail-entities > div > i { font-size:18px; color:var(--foreground-muted); line-height:1.3; }
.billing-detail-entities > div > div { min-width:0; flex:1; }
.billing-detail-entities span,.billing-detail-entities small { display:block; font-size:11px; color:var(--foreground-muted); }
.billing-detail-entities strong { display:block; font-size:14px; font-weight:450; overflow-wrap:anywhere; margin:2px 0; }
.billing-detail-entities small { overflow-wrap:anywhere; line-height:1.6; }
.billing-detail-entities a { color:var(--brand); font-size:10px; text-decoration:none; white-space:nowrap; margin-top:3px; }
.billing-detail-entities a.billing-customer-site { font-size:14px; white-space:normal; }
.billing-inspector-tabs { display:flex; gap:18px; border-bottom:1px solid var(--border); margin-top:5px; }
.billing-inspector-tabs button { padding:12px 0 10px; border:0; background:none; color:var(--foreground-muted); font-size:12px; cursor:pointer; }
.billing-inspector-tabs button.active { color:var(--brand); box-shadow:inset 0 -2px var(--brand); }
.billing-inspector-tab-content { min-height:150px; }
.billing-timeline { padding:18px 0 0; margin:0; list-style:none; }
.billing-timeline li { position:relative; display:grid; grid-template-columns:112px minmax(0,1fr); gap:12px; padding:0 0 20px 19px; }
.billing-timeline li::before { content:""; position:absolute; width:9px; height:9px; border-radius:50%; left:0; top:5px; background:#a1b0c0; z-index:1; border:2px solid var(--surface); box-sizing:content-box; }
.billing-timeline li::after { content:""; position:absolute; top:14px; bottom:-6px; left:6px; width:1px; background:#65747d; }
.billing-timeline li:last-child::after { display:none; }
.billing-timeline time { font:10px/1.8 ui-monospace,SFMono-Regular,Consolas,monospace; color:var(--foreground-muted); white-space:pre-line; }
.billing-timeline strong { font-size:12px; font-weight:450; display:block; line-height:1.7; }
.billing-timeline small { display:block; margin-top:2px; font-size:10px; color:var(--foreground-subtle); line-height:1.6; overflow-wrap:anywhere; }
.billing-timeline .warning::before { background:#ffc35c; }
.billing-timeline .warning strong,.billing-timeline .warning time { color:#ffc35c; }
.billing-timeline .success::before { background:#91d8a8; }
.billing-timeline .success strong { color:#91d8a8; }
.billing-timeline .info::before { background:#8dc4f4; }
.billing-timeline .danger::before { background:#ff9696; }
.billing-timeline .danger strong { color:#ff9696; }
.billing-history-note { font-size:11px; color:var(--foreground-subtle); line-height:1.7; margin:14px 0 0; }
.billing-breakdown,.billing-item-list > div { display:flex; justify-content:space-between; gap:12px; padding:14px 0; border-bottom:1px solid var(--border); font-size:12px; }
.billing-breakdown strong,.billing-item-list strong { font-weight:500; }
.billing-item-list small { display:block; margin-top:4px; color:var(--foreground-muted); }
.billing-item-list > div > span { min-width:0; overflow-wrap:anywhere; }
.billing-item-list > div > strong { white-space:nowrap; }
.billing-payment-entry { display:grid; grid-template-columns:1fr auto; gap:5px; margin-top:18px; font-size:12px; }
.billing-payment-entry small { grid-column:1/-1; color:var(--foreground-muted); }
.billing-payment-entry strong { min-width:0; overflow-wrap:anywhere; }
.billing-memo { border-bottom:1px solid var(--border); padding:14px 0; font-size:12px; }
.billing-memo span { font-size:11px; color:var(--foreground-muted); }
.billing-memo p { white-space:pre-wrap; overflow-wrap:anywhere; }
.billing-inline-payment { padding:16px 0; }
.billing-inline-payment .action-row,.billing-inline-payment .action-controls { display:flex; flex-direction:column; align-items:stretch; }
.billing-detail-error { font-size:12px; color:#ffadad; }
.billing-note-composer { padding:18px 0; }
.billing-note-composer > label { display:block; font-size:12px; margin-bottom:8px; }
.billing-note-composer textarea { width:100%; resize:vertical; min-height:90px; font:inherit; font-size:12px; }
.billing-note-composer > div { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-top:10px; }
.billing-note-composer span { color:var(--foreground-subtle); font-size:10px; line-height:1.6; }
.billing-note-composer .btn { white-space:nowrap; font-size:12px; }
.switchboard-layout .billing-note-composer .btn.btn-brand:disabled { background:var(--brand); color:var(--brand-ink); opacity:.4; }
.billing-staff-note { padding:14px 0; border-top:1px solid var(--border); }
.billing-staff-note header { display:flex; flex-wrap:wrap; justify-content:space-between; gap:4px 10px; font-size:10px; color:var(--foreground-muted); }
.billing-staff-note header strong { font-weight:500; }
.billing-staff-note p { white-space:pre-wrap; overflow-wrap:anywhere; font-size:12px; line-height:1.7; margin:10px 0 0; }
.billing-note-saved { color:var(--brand); font-size:12px; }
.billing-note-count { display:inline-block; border-radius:3px; background:var(--primary-subtle); color:var(--brand); font-size:10px; padding:0 4px; margin-left:2px; }
@media(min-width:1700px) { .billing-workbench-grid.has-detail { grid-template-columns:minmax(0,1fr) 440px; } .billing-invoice-table { font-size:13px; } }
@media(max-width:1450px) and (min-width:1101px) {
    .billing-workbench-grid.has-detail { grid-template-columns:minmax(0,1fr) 360px; gap:18px; }
    .billing-detail-panel { padding:16px; }
    .billing-filter-bar { flex-wrap:wrap; }
    .billing-search { flex-basis:100%; }
    .billing-stat-strip button { padding:14px 10px; }
    .billing-stat-strip strong { font-size:22px; }
    .billing-invoice-table th,.billing-invoice-table td { padding:11px 8px; font-size:11px; }
    .billing-detail-money { gap:10px; } .billing-detail-money strong { font-size:26px; }
    .billing-detail-money dl { padding-left:10px; gap:6px; font-size:10px; }
}
@media(max-width:1100px) {
    .billing-workbench-grid.has-detail { grid-template-columns:minmax(0,1fr); }
    .billing-detail-panel { position:fixed; top:72px; right:18px; bottom:18px; width:min(440px,calc(100vw - 36px)); z-index:110; overflow-y:auto; box-shadow:0 10px 50px #0009; background:var(--surface); }
    .billing-workbench-grid.default-invoice-selection .billing-detail-panel { display:none; }
}
@media(max-width:1450px) {
    .switchboard-layout .billing-detail-actions .btn { padding:7px 8px; font-size:11px; }
    .billing-more > button { gap:6px; }
}
@media(max-width:600px) {
    .billing-workbench .workspace-page-intro { margin-bottom:14px; gap:12px; }
    .billing-workbench .workspace-page-intro h2 { font-size:26px; }
    .billing-workbench .workspace-page-intro p { font-size:14px; }
    .billing-workbench .header-actions { gap:6px; }
    .switchboard-layout .billing-workbench .header-actions .btn { padding:8px 10px; font-size:11px; }
    .billing-view-tabs { gap:12px; overflow:auto; margin-bottom:14px; }
    .billing-view-tabs a { padding:12px 2px; font-size:12px; }
    .billing-filter-bar { flex-wrap:wrap; gap:8px; margin-bottom:14px; }
    .billing-filter-bar label { flex-basis:28%; }
    .billing-filter-bar .form-input { font-size:11px; padding:8px 6px; }
    .billing-search { flex-basis:100%; }
    .billing-stat-strip button { padding:12px 8px; }
    .billing-stat-strip strong { font-size:18px; letter-spacing:-.6px; }
    .billing-stat-strip span { font-size:10px; }
    .billing-stat-strip small { font-size:9px; }
    .billing-table-frame { border:0; overflow:visible; }
    .billing-invoice-table,.billing-invoice-table tbody { display:block; width:100%; }
    .billing-invoice-table thead { display:none; }
    .billing-invoice-table tbody tr { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:8px 14px; padding:14px; border:1px solid var(--border); border-radius:5px; margin-bottom:10px; background:var(--surface); }
    .billing-invoice-table td { display:block; padding:0; border:0; height:auto; font-size:12px; }
    .billing-invoice-table td:nth-child(1) { grid-column:1; grid-row:1; font-size:13px; }
    .billing-invoice-table td:nth-child(2) { grid-column:1/-1; grid-row:2; color:var(--foreground-muted); }
    .billing-invoice-table td:nth-child(3) { grid-column:1; grid-row:3; color:var(--foreground-muted); }
    .billing-invoice-table td:nth-child(4) { grid-column:2; grid-row:3; text-align:right; }
    .billing-invoice-table td:nth-child(5) { grid-column:1/-1; grid-row:4; }
    .billing-invoice-table td:nth-child(6) { grid-column:2; grid-row:1; }
    .billing-invoice-table .empty-row td { grid-column:1/-1; }
    .billing-pager { flex-wrap:wrap; padding-top:8px; }
    .billing-pager > div { width:100%; justify-content:space-between; }
    .billing-detail-panel { top:70px; left:10px; right:10px; bottom:10px; width:auto; padding:18px; }
    .billing-detail-heading h2 { font-size:19px; }
    .billing-detail-money { grid-template-columns:1fr 1.1fr; gap:10px; }
    .billing-detail-money strong { font-size:26px; }
    .billing-detail-money dl { padding-left:10px; font-size:10px; gap:6px; }
    .billing-timeline li { grid-template-columns:100px minmax(0,1fr); gap:10px; }
}
html[data-theme="light"] .billing-status.warning { color:#865500; background:#fff1d4; }
html[data-theme="light"] .billing-status.success { color:#24623b; background:#e6f6eb; }
html[data-theme="light"] .billing-status.info { color:#215e8f; background:#e6f3ff; }
html[data-theme="light"] .billing-status.neutral { color:#4a5a67; background:#eef1f3; }
html[data-theme="light"] .billing-amber,html[data-theme="light"] .billing-timeline .warning strong,html[data-theme="light"] .billing-timeline .warning time { color:#8a5800!important; }
html[data-theme="light"] .billing-green,html[data-theme="light"] .billing-timeline .success strong { color:#216a3b!important; }


.billing-invoice-purpose { display:block; white-space:normal; overflow-wrap:anywhere; line-height:1.45; margin-top:5px; color:var(--foreground-muted); }
