/* ==========================================================================
   Clean SaaS theme — loaded after style.css / dynamic.css.
   Pure restyle: colours, type, spacing, cards, tables, controls. No layout or
   behaviour changes. Delete the <link> to theme.css in index.html to revert.
   Light tokens only apply in light mode; the existing dark theme is untouched.
   ========================================================================== */

/* ---- Light tokens -------------------------------------------------------- */
:root[data-theme="light"] {
  --page-bg:      #f6f7f9;
  --surface:      #ffffff;
  --surface-2:    #f9fafb;
  --border:       #e5e7eb;
  --border-strong:#d1d5db;
  --text:         #111827;
  --text-dim:     #4b5563;
  --text-muted:   #6b7280;
  --grid:         #eef0f3;
  --baseline:     #d1d5db;

  --primary:      #2563eb;  --primary-wash:  #eff6ff;
  --good:         #059669;  --good-wash:     #ecfdf5;
  --warning:      #d97706;  --warning-wash:  #fffbeb;
  --critical:     #dc2626;  --critical-wash: #fef2f2;
  --violet:       #7c3aed;  --violet-wash:   #f5f3ff;
  --teal:         #0891b2;  --teal-wash:     #ecfeff;

  --radius: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(17,24,39,.05);
  --shadow-md: 0 4px 12px -2px rgba(17,24,39,.08);
  --shadow-lg: 0 10px 24px -6px rgba(17,24,39,.12);
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
  --page-bg:      #f6f7f9;
  --surface:      #ffffff;
  --surface-2:    #f9fafb;
  --border:       #e5e7eb;
  --border-strong:#d1d5db;
  --text:         #111827;
  --text-dim:     #4b5563;
  --text-muted:   #6b7280;
  --grid:         #eef0f3;
  --baseline:     #d1d5db;

  --primary:      #2563eb;  --primary-wash:  #eff6ff;
  --good:         #059669;  --good-wash:     #ecfdf5;
  --warning:      #d97706;  --warning-wash:  #fffbeb;
  --critical:     #dc2626;  --critical-wash: #fef2f2;
  --violet:       #7c3aed;  --violet-wash:   #f5f3ff;
  --teal:         #0891b2;  --teal-wash:     #ecfeff;

  --radius: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(17,24,39,.05);
  --shadow-md: 0 4px 12px -2px rgba(17,24,39,.08);
  --shadow-lg: 0 10px 24px -6px rgba(17,24,39,.12);
  }
}
}

/* ---- Base type ----------------------------------------------------------- */
html { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px; line-height: 1.5; letter-spacing: -0.003em; background: var(--page-bg);
  font-feature-settings: 'cv11', 'ss01';
}
h1, h2, h3, h4 { letter-spacing: -0.015em; }

/* ---- Header -------------------------------------------------------------- */
.topbar { background: var(--surface); border-bottom: 1px solid var(--border); box-shadow: none; padding-top: 12px; padding-bottom: 12px; }
.brand-mark, .dyn-mark { background: var(--primary); box-shadow: none; border-radius: 10px; width: 36px; height: 36px; }
.brand h1 { font-size: 15.5px; font-weight: 650; }
.file-meta { font-size: 12px; color: var(--text-muted); }
.btn { border-radius: 8px; font-weight: 550; font-size: 13px; height: 36px; padding: 0 14px; box-shadow: var(--shadow-sm); }
.btn:hover { transform: none; box-shadow: var(--shadow-sm); background: var(--surface-2); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: var(--shadow-sm); }
.btn-primary:hover { filter: none; background: color-mix(in srgb, var(--primary) 88%, #000); box-shadow: var(--shadow-sm); }
.btn-ghost { box-shadow: none; }

/* ---- Tabs: segmented pills ---------------------------------------------- */
.tabs { background: var(--surface); border-bottom: 1px solid var(--border); padding: 8px 20px; gap: 4px; }
.tab { border-radius: 8px; padding: 7px 14px; font-size: 13px; font-weight: 550; color: var(--text-muted); transition: background .15s, color .15s; }
.tab:hover { background: var(--surface-2); color: var(--text); }
.tab.active { background: var(--primary-wash); color: var(--primary); font-weight: 650; }
.tab-indicator { display: none; }

/* ---- Filters & inputs ---------------------------------------------------- */
.filterbar { border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.filter-group > label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); }
input[type=date], select, input[type=text], input[type=search], .ms-trigger {
  border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface);
  font-size: 13px; box-shadow: var(--shadow-sm);
}
input:focus, select:focus, .ms-trigger:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent);
}

/* ---- Cards --------------------------------------------------------------- */
.kpi-card, .chart-card, .flash-card, .detail-kpi {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.kpi-card::before, .chart-card::before, .flash-card::before { display: none; }
.kpi-card:hover, .chart-card:hover, .flash-card:hover { transform: none; box-shadow: var(--shadow-md); border-color: var(--border-strong); }
.kpi-label { font-size: 11.5px; font-weight: 600; letter-spacing: .04em; color: var(--text-muted); }
.kpi-label::before { width: 7px; height: 7px; box-shadow: none; }
.kpi-value { font-size: 28px; font-weight: 700; letter-spacing: -0.03em; color: var(--text); }
.kpi-sub { font-size: 12.5px; color: var(--text-muted); }
.chart-card h3 { font-size: 15px; font-weight: 650; color: var(--text); }
.detail-kpi { padding: 14px 16px; }

/* ---- View toggles (By Insurance / Location …) --------------------------- */
.ar-view-btn { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); }
.ar-view-btn::before { display: none; }
.ar-view-btn:hover { transform: none; box-shadow: var(--shadow-md); border-color: var(--border-strong); }
.ar-view-btn.active { border-color: var(--accent, var(--primary)); background: color-mix(in srgb, var(--accent, var(--primary)) 6%, var(--surface)); box-shadow: 0 0 0 1px var(--accent, var(--primary)) inset; }
.ar-view-title { font-weight: 650; }
.ar-view-sub { color: var(--text-muted); }

/* ---- Tables: light header, quiet rows ------------------------------------ */
.table-wrap { border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: none; background: var(--surface); }
table { background: var(--surface); }
thead th {
  background: var(--surface-2); color: var(--text-muted); border-color: var(--border);
  font-size: 11.5px; font-weight: 650; text-transform: uppercase; letter-spacing: .05em;
  border-bottom: 1px solid var(--border-strong);
}
tbody td { border-color: var(--border); color: var(--text); font-size: 13.5px; }
tbody tr:nth-child(even) td { background: transparent; }
tbody tr:hover td { background: var(--surface-2); }
tfoot .summary-total-row td { background: var(--surface-2); font-weight: 650; border-top: 1px solid var(--border-strong); }
.table-count { font-weight: 600; color: var(--text-muted); font-size: 12.5px; }

/* ---- Badges -------------------------------------------------------------- */
.badge { border-radius: 999px; padding: 3px 10px; font-size: 11.5px; font-weight: 600; letter-spacing: 0; border: 0; }

/* ---- Misc polish --------------------------------------------------------- */
.tab-panel:not(.hidden) { animation-duration: .2s; }
::selection { background: color-mix(in srgb, var(--primary) 22%, transparent); }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 8px; border: 2px solid var(--page-bg); }
*::-webkit-scrollbar-track { background: transparent; }

/* ==========================================================================
   Payment tab
   ========================================================================== */
#tab-payment { padding-bottom: 24px; }
.pay-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin: 4px 24px 16px; }
.pay-title { margin: 0; font-size: 22px; font-weight: 700; letter-spacing: -0.02em; color: var(--text); }
.pay-sub { margin: 2px 0 0; font-size: 13px; color: var(--text-muted); }

/* segmented control (replaces the three big cards) */
.pay-seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; }
.pay-seg .ar-view-btn { all: unset; box-sizing: border-box; cursor: pointer; padding: 7px 16px; border-radius: 8px; font-size: 13px; font-weight: 550; color: var(--text-muted); transition: background .15s, color .15s, box-shadow .15s; }
.pay-seg .ar-view-btn:hover { color: var(--text); }
.pay-seg .ar-view-btn.active { background: var(--surface); color: var(--text); font-weight: 650; box-shadow: 0 1px 2px rgba(17,24,39,.10), 0 0 0 1px var(--border); }
.pay-seg .ar-view-btn::before { display: none; }
.pay-seg .ar-view-title { color: inherit !important; font-size: inherit; font-weight: inherit; }
.pay-seg .ar-view-btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }

/* KPI strip */
#tab-payment .detail-kpis { margin: 0 24px 16px; display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
#tab-payment .detail-kpi { border-left: 1px solid var(--border) !important; padding: 14px 16px; position: relative; }
#tab-payment .detail-kpi::before { content: ""; position: absolute; left: 16px; top: 0; bottom: auto; width: 28px; height: 3px; border-radius: 0 0 3px 3px; background: var(--c, var(--primary)); }
#tab-payment .detail-kpi .dk-label { font-size: 11.5px; font-weight: 600; letter-spacing: .04em; color: var(--text-muted); text-transform: uppercase; }
#tab-payment .detail-kpi .dk-val { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; color: var(--text); font-variant-numeric: tabular-nums; }
#payTestKpis { margin: 0 0 18px !important; }
#payTestKpis .detail-kpi { background: var(--surface-2); box-shadow: none; }

/* cards */
#tab-payment .chart-card { padding: 20px 22px; }
#tab-payment .chart-card > h3 { margin: 0 0 12px; }
.pay-card-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.pay-card-head h3 { margin: 0; font-size: 16px; font-weight: 650; }
.pay-caption { margin: 3px 0 0; font-size: 12.5px; color: var(--text-muted); }
.pay-tools { display: flex; align-items: center; gap: 12px; }
.pay-tools input { width: 260px; height: 36px; padding: 0 12px 0 34px; background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-3.5-3.5'/%3E%3C/svg%3E") 11px center no-repeat; }

/* table */
.pay-table { border-collapse: separate; border-spacing: 0; width: 100%; }
.pay-table thead th { position: sticky; top: 0; z-index: 1; text-align: right !important; padding: 11px 14px; white-space: nowrap; }
.pay-table thead th:first-child { text-align: left !important; }
.pay-table td { padding: 11px 14px; text-align: right !important; font-variant-numeric: tabular-nums; white-space: nowrap; border-bottom: 1px solid var(--border); }
.pay-table td:first-child { text-align: left !important; white-space: normal; min-width: 240px; }
.pay-table tr.pay-group { cursor: pointer; }
.pay-table tr.pay-group td:first-child { font-weight: 650; color: var(--text); }
.pay-table tr.pay-group.is-open td { background: var(--primary-wash); }
.pay-table tr.pay-group:hover td { background: var(--surface-2); }
.pay-table tr.pay-group.is-open:hover td { background: var(--primary-wash); }
.pay-caret { display: inline-block; width: 18px; color: var(--text-muted); font-size: 13px; }
.pay-table tr.pay-test td { background: var(--surface-2); color: var(--text-dim); font-size: 13px; }
.pay-table tr.pay-test:hover td { background: color-mix(in srgb, var(--surface-2) 70%, var(--border)); }
.pay-table tr.pay-subhead td { background: var(--surface-2); text-align: left !important; padding: 7px 14px 7px 36px; font-size: 11px; font-weight: 650; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); }
.pay-child { display: inline-block; color: var(--text-dim); }
.pay-table td.pay-total { font-weight: 650; color: var(--text); }
.pay-table tfoot td { font-weight: 650; border-top: 1px solid var(--border-strong); background: var(--surface-2); }
.pay-share { display: inline-flex; align-items: center; gap: 8px; justify-content: flex-end; }
.pay-share-bar { width: 64px; height: 6px; border-radius: 3px; background: var(--grid); overflow: hidden; display: inline-block; }
.pay-share-bar i { display: block; height: 100%; background: var(--primary); border-radius: 3px; }
.pay-share b { min-width: 34px; font-weight: 600; color: var(--text-dim); font-size: 12.5px; }

/* test analysis controls */
#payTestPickBar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 0 0 14px !important; margin-bottom: 14px; border-bottom: 1px solid var(--border); }
#payTestChips button { font-size: 12.5px !important; padding: 5px 12px !important; }
#paySeriesChips button { font-size: 12.5px !important; padding: 5px 12px !important; }
#payTopN { height: 34px; }
.pay-rank .pr-row:first-of-type { border-top: 0; }
.pay-rank .pr-row:hover { background: var(--surface-2); border-radius: 8px; }

/* Location leaderboard + table tools */
.pay-leaders { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 12px; }
.pay-leader { border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; background: var(--surface); transition: box-shadow .15s, border-color .15s; }
.pay-leader:hover { box-shadow: var(--shadow-md); border-color: var(--border-strong); }
.pl-top { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; min-width: 0; }
.pl-rank { flex: none; width: 24px; height: 24px; border-radius: 7px; background: var(--primary-wash); color: var(--primary); font-size: 12px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.pl-name { font-size: 13.5px; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pl-total { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; color: var(--text); font-variant-numeric: tabular-nums; }
.pl-total span { display: block; font-size: 12px; font-weight: 500; color: var(--text-muted); letter-spacing: 0; margin-top: 1px; }
.pl-split { display: flex; height: 8px; border-radius: 4px; overflow: hidden; background: var(--grid); margin: 12px 0 6px; }
.pl-split i { display: block; height: 100%; }
.pl-meta { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-dim); font-variant-numeric: tabular-nums; }
.pl-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); font-size: 12px; color: var(--text-muted); }
.pl-foot b { color: var(--text); font-weight: 650; font-size: 13px; }
.pay-tools select { height: 36px; }
.pay-tools .btn { height: 36px; }

/* Payer mix strip */
.pay-mix { margin: 0 0 18px; }
.pm-bar { display: flex; height: 14px; border-radius: 7px; overflow: hidden; background: var(--grid); gap: 2px; }
.pm-bar i { display: block; height: 100%; min-width: 3px; transition: opacity .15s; }
.pm-bar i:hover { opacity: .8; }
.pm-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 10px; font-size: 12.5px; color: var(--text-dim); }
.pm-legend span { display: inline-flex; align-items: center; gap: 6px; }
.pm-legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.pm-legend b { color: var(--text); font-weight: 650; }

/* ==========================================================================
   AR tab
   ========================================================================== */
#tab-ar { padding-bottom: 24px; }

/* Total AR / Aging: segmented control in the page header */
#arModeToggle { display: inline-flex; padding: 3px; gap: 2px; margin: 0; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; width: auto; }
#arModeToggle .ar-mode-btn { all: unset; box-sizing: border-box; cursor: pointer; padding: 7px 18px; border-radius: 8px; font-size: 13px; font-weight: 550; color: var(--text-muted); transition: background .15s, color .15s; }
#arModeToggle .ar-mode-btn:hover { color: var(--text); }
#arModeToggle .ar-mode-btn.active { background: var(--surface); color: var(--text); font-weight: 650; box-shadow: 0 1px 2px rgba(17,24,39,.10), 0 0 0 1px var(--border); }
#arModeToggle .ar-mode-btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
#arModeToggle .ar-mode-icon, #arModeToggle .ar-mode-sub, #arModeToggle .ar-mode-btn::before { display: none !important; }
#arModeToggle .ar-mode-title { color: inherit !important; font-size: inherit; font-weight: inherit; }

/* Summary / By Test / Location / Payer: underline tabs */
#arViewToggle { display: flex; gap: 4px; margin: 0 24px 18px; padding: 0; border-bottom: 1px solid var(--border); background: none; overflow: visible; flex-wrap: wrap; grid-template-columns: none; }
#arViewToggle .ar-view-btn { all: unset; box-sizing: border-box; cursor: pointer; position: relative; padding: 10px 16px; font-size: 13.5px; font-weight: 550; color: var(--text-muted); white-space: nowrap; border-radius: 8px 8px 0 0; transition: color .15s, background .15s; }
#arViewToggle .ar-view-btn:hover { color: var(--text); background: var(--surface-2); }
#arViewToggle .ar-view-btn.active { color: var(--primary); font-weight: 650; background: none; box-shadow: none; }
#arViewToggle .ar-view-btn.active::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2px; border-radius: 2px; background: var(--primary); }
#arViewToggle .ar-view-btn::before { display: none !important; }
#arViewToggle .ar-view-btn:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
#arViewToggle .ar-view-icon, #arViewToggle .ar-view-sub { display: none !important; }
#arViewToggle .ar-view-title { color: inherit !important; font-size: inherit; font-weight: inherit; }

/* KPI cards (shared look with Payment) */
#tab-ar .detail-kpis { margin: 0 24px 16px; display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
#tab-ar .detail-kpi { border-left: 1px solid var(--border) !important; padding: 14px 16px; position: relative; }
#tab-ar .detail-kpi::before { content: ""; position: absolute; left: 16px; top: 0; bottom: auto; width: 28px; height: 3px; border-radius: 0 0 3px 3px; background: var(--c, var(--primary)); }
#tab-ar .detail-kpi .dk-label { font-size: 11.5px; font-weight: 600; letter-spacing: .04em; color: var(--text-muted); text-transform: uppercase; }
#tab-ar .detail-kpi .dk-val { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; color: var(--text); font-variant-numeric: tabular-nums; }
#tab-ar .detail-kpi small, #tab-ar .detail-kpi .dk-sub { color: var(--text-muted); font-size: 12px; }

/* cards & tables */
#tab-ar .chart-card { padding: 20px 22px; }
#tab-ar .chart-card > h3 { margin: 0 0 12px; font-size: 16px; font-weight: 650; }
#tab-ar .table-wrap table thead th { position: sticky; top: 0; z-index: 1; padding: 11px 14px; white-space: nowrap; }
#tab-ar table td { padding: 11px 14px; font-variant-numeric: tabular-nums; }
#tab-ar table th.num, #tab-ar table td.num { text-align: right !important; }
#tab-ar table th:first-child, #tab-ar table td:first-child { text-align: left !important; }
#tab-ar table tbody tr:hover td { background: var(--surface-2); }
#tab-ar .table-toolbar { gap: 12px; }
#tab-ar .table-toolbar input[type=text] { height: 36px; width: 280px; }
#tab-ar .ar-aging-sub { color: var(--text-muted); font-size: 12.5px; margin: -6px 0 12px; }
#tab-ar .flow-strip { border-radius: 8px; }


/* ==========================================================================
   Exceptions tab (same pattern as AR)
   ========================================================================== */
#tab-exceptions { padding-bottom: 24px; }
/* Summary / By Test / Location / Payer: underline tabs */
#excViewToggle { display: flex; gap: 4px; margin: 0 24px 18px; padding: 0; border-bottom: 1px solid var(--border); background: none; overflow: visible; flex-wrap: wrap; grid-template-columns: none; }
#excViewToggle .ar-view-btn { all: unset; box-sizing: border-box; cursor: pointer; position: relative; padding: 10px 16px; font-size: 13.5px; font-weight: 550; color: var(--text-muted); white-space: nowrap; border-radius: 8px 8px 0 0; transition: color .15s, background .15s; }
#excViewToggle .ar-view-btn:hover { color: var(--text); background: var(--surface-2); }
#excViewToggle .ar-view-btn.active { color: var(--primary); font-weight: 650; background: none; box-shadow: none; }
#excViewToggle .ar-view-btn.active::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2px; border-radius: 2px; background: var(--primary); }
#excViewToggle .ar-view-btn::before { display: none !important; }
#excViewToggle .ar-view-btn:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
#excViewToggle .ar-view-icon, #excViewToggle .ar-view-sub { display: none !important; }
#excViewToggle .ar-view-title { color: inherit !important; font-size: inherit; font-weight: inherit; }

/* KPI cards (shared look with Payment) */
#tab-exceptions .detail-kpis { margin: 0 24px 16px; display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
#tab-exceptions .detail-kpi { border-left: 1px solid var(--border) !important; padding: 14px 16px; position: relative; }
#tab-exceptions .detail-kpi::before { content: ""; position: absolute; left: 16px; top: 0; bottom: auto; width: 28px; height: 3px; border-radius: 0 0 3px 3px; background: var(--c, var(--primary)); }
#tab-exceptions .detail-kpi .dk-label { font-size: 11.5px; font-weight: 600; letter-spacing: .04em; color: var(--text-muted); text-transform: uppercase; }
#tab-exceptions .detail-kpi .dk-val { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; color: var(--text); font-variant-numeric: tabular-nums; }
#tab-exceptions .detail-kpi small, #tab-exceptions .detail-kpi .dk-sub { color: var(--text-muted); font-size: 12px; }

/* cards & tables */
#tab-exceptions .chart-card { padding: 20px 22px; }
#tab-exceptions .chart-card > h3 { margin: 0 0 12px; font-size: 16px; font-weight: 650; }
#tab-exceptions .table-wrap table thead th { position: sticky; top: 0; z-index: 1; padding: 11px 14px; white-space: nowrap; }
#tab-exceptions table td { padding: 11px 14px; font-variant-numeric: tabular-nums; }
#tab-exceptions table th.num, #tab-exceptions table td.num { text-align: right !important; }
#tab-exceptions table th:first-child, #tab-exceptions table td:first-child { text-align: left !important; }
#tab-exceptions table tbody tr:hover td { background: var(--surface-2); }
#tab-exceptions .table-toolbar { gap: 12px; }
#tab-exceptions .table-toolbar input[type=text] { height: 36px; width: 280px; }

/* Exception worklist: a record list reads best left-aligned, with long text wrapping */
#excTable th, #excTable td { text-align: left !important; }
#excTable th:last-child, #excTable td:last-child { text-align: right !important; }
#excTable td { vertical-align: top; white-space: normal; line-height: 1.4; }
#excTable td:nth-child(1), #excTable td:nth-child(2), #excTable td:nth-child(3) { white-space: nowrap; }
#excTable td:nth-child(7) { min-width: 260px; color: var(--text-dim); }
#excTable td:nth-child(4) { font-weight: 550; min-width: 150px; }
#excTable td:nth-child(5) { min-width: 200px; }


/* ==========================================================================
   Denied tab (same pattern as AR / Exceptions)
   ========================================================================== */
#tab-denied { padding-bottom: 24px; }
/* Summary / By Test / Location / Payer: underline tabs */
#deniedViewToggle { display: flex; gap: 4px; margin: 0 24px 18px; padding: 0; border-bottom: 1px solid var(--border); background: none; overflow: visible; flex-wrap: wrap; grid-template-columns: none; }
#deniedViewToggle .ar-view-btn { all: unset; box-sizing: border-box; cursor: pointer; position: relative; padding: 10px 16px; font-size: 13.5px; font-weight: 550; color: var(--text-muted); white-space: nowrap; border-radius: 8px 8px 0 0; transition: color .15s, background .15s; }
#deniedViewToggle .ar-view-btn:hover { color: var(--text); background: var(--surface-2); }
#deniedViewToggle .ar-view-btn.active { color: var(--primary); font-weight: 650; background: none; box-shadow: none; }
#deniedViewToggle .ar-view-btn.active::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2px; border-radius: 2px; background: var(--primary); }
#deniedViewToggle .ar-view-btn::before { display: none !important; }
#deniedViewToggle .ar-view-btn:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
#deniedViewToggle .ar-view-icon, #deniedViewToggle .ar-view-sub { display: none !important; }
#deniedViewToggle .ar-view-title { color: inherit !important; font-size: inherit; font-weight: inherit; }

/* KPI cards (shared look with Payment) */
#tab-denied .detail-kpis { margin: 0 24px 16px; display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
#tab-denied .detail-kpi { border-left: 1px solid var(--border) !important; padding: 14px 16px; position: relative; }
#tab-denied .detail-kpi::before { content: ""; position: absolute; left: 16px; top: 0; bottom: auto; width: 28px; height: 3px; border-radius: 0 0 3px 3px; background: var(--c, var(--primary)); }
#tab-denied .detail-kpi .dk-label { font-size: 11.5px; font-weight: 600; letter-spacing: .04em; color: var(--text-muted); text-transform: uppercase; }
#tab-denied .detail-kpi .dk-val { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; color: var(--text); font-variant-numeric: tabular-nums; }
#tab-denied .detail-kpi small, #tab-denied .detail-kpi .dk-sub { color: var(--text-muted); font-size: 12px; }

/* cards & tables */
#tab-denied .chart-card { padding: 20px 22px; }
#tab-denied .chart-card > h3 { margin: 0 0 12px; font-size: 16px; font-weight: 650; }
#tab-denied .table-wrap table thead th { position: sticky; top: 0; z-index: 1; padding: 11px 14px; white-space: nowrap; }
#tab-denied table td { padding: 11px 14px; font-variant-numeric: tabular-nums; }
#tab-denied table th.num, #tab-denied table td.num { text-align: right !important; }
#tab-denied table th:first-child, #tab-denied table td:first-child { text-align: left !important; }
#tab-denied table tbody tr:hover td { background: var(--surface-2); }
#tab-denied .table-toolbar { gap: 12px; }
#tab-denied .table-toolbar input[type=text] { height: 36px; width: 280px; }




#deniedTable th, #deniedTable td { text-align: left !important; }
#deniedTable th:last-child, #deniedTable td:last-child { text-align: right !important; }
#deniedTable td { vertical-align: top; white-space: normal; line-height: 1.4; }
#deniedTable td:nth-child(1), #deniedTable td:nth-child(2), #deniedTable td:nth-child(3) { white-space: nowrap; }
#deniedTable td:nth-child(4) { font-weight: 550; min-width: 150px; }
#deniedTable td:nth-child(5) { min-width: 200px; }
#deniedTable td:nth-child(7) { min-width: 260px; color: var(--text-dim); }


/* ==========================================================================
   Charts tab
   ========================================================================== */
#tab-charts { padding-bottom: 24px; }
/* Summary / By Test / Location / Payer: underline tabs */
#chartCatToggle { display: flex; gap: 4px; margin: 0 24px 18px; padding: 0; border-bottom: 1px solid var(--border); background: none; overflow: visible; flex-wrap: wrap; grid-template-columns: none; }
#chartCatToggle .ar-view-btn { all: unset; box-sizing: border-box; cursor: pointer; position: relative; padding: 10px 16px; font-size: 13.5px; font-weight: 550; color: var(--text-muted); white-space: nowrap; border-radius: 8px 8px 0 0; transition: color .15s, background .15s; }
#chartCatToggle .ar-view-btn:hover { color: var(--text); background: var(--surface-2); }
#chartCatToggle .ar-view-btn.active { color: var(--primary); font-weight: 650; background: none; box-shadow: none; }
#chartCatToggle .ar-view-btn.active::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2px; border-radius: 2px; background: var(--primary); }
#chartCatToggle .ar-view-btn::before { display: none !important; }
#chartCatToggle .ar-view-btn:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
#chartCatToggle .ar-view-icon, #chartCatToggle .ar-view-sub { display: none !important; }
#chartCatToggle .ar-view-title { color: inherit !important; font-size: inherit; font-weight: inherit; }

/* KPI cards (shared look with Payment) */
#tab-charts .detail-kpis { margin: 0 24px 16px; display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
#tab-charts .detail-kpi { border-left: 1px solid var(--border) !important; padding: 14px 16px; position: relative; }
#tab-charts .detail-kpi::before { content: ""; position: absolute; left: 16px; top: 0; bottom: auto; width: 28px; height: 3px; border-radius: 0 0 3px 3px; background: var(--c, var(--primary)); }
#tab-charts .detail-kpi .dk-label { font-size: 11.5px; font-weight: 600; letter-spacing: .04em; color: var(--text-muted); text-transform: uppercase; }
#tab-charts .detail-kpi .dk-val { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; color: var(--text); font-variant-numeric: tabular-nums; }
#tab-charts .detail-kpi small, #tab-charts .detail-kpi .dk-sub { color: var(--text-muted); font-size: 12px; }

/* cards & tables */
#tab-charts .chart-card { padding: 20px 22px; }
#tab-charts .chart-card > h3 { margin: 0 0 12px; font-size: 16px; font-weight: 650; }
#tab-charts .table-wrap table thead th { position: sticky; top: 0; z-index: 1; padding: 11px 14px; white-space: nowrap; }
#tab-charts table td { padding: 11px 14px; font-variant-numeric: tabular-nums; }
#tab-charts table th.num, #tab-charts table td.num { text-align: right !important; }
#tab-charts table th:first-child, #tab-charts table td:first-child { text-align: left !important; }
#tab-charts table tbody tr:hover td { background: var(--surface-2); }
#tab-charts .table-toolbar { gap: 12px; }
#tab-charts .table-toolbar input[type=text] { height: 36px; width: 280px; }



#tab-charts .chart-grid { gap: 16px; }
#tab-charts .chart-grid .chart-card { padding: 18px 20px; }
#tab-charts .chart-card > h3 { margin: 0 0 14px; }

/* ==========================================================================
   One card + grid system for the By Test Type / By Location / By Payer Group
   views in AR, Exceptions, Denied and Payment.
   reason-card (test / payer), flash-card (location) and pay-leader (Payment)
   now share the same shell, heading, big number, footer and grid.
   ========================================================================== */
.reason-grid, .flash-grid, .pay-leaders {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px;
}
.reason-card, .flash-card, .pay-leader {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 16px 18px; box-shadow: var(--shadow-sm); gap: 12px;
  transition: box-shadow .15s, border-color .15s; transform: none;
}
.flash-card::before { display: none; }
.reason-card:hover, .flash-card:hover, .pay-leader:hover {
  transform: none; box-shadow: var(--shadow-md); border-color: var(--border-strong);
}
.flash-card.has-exceptions { border-color: var(--border); }

/* heading + big number */
.rc-head, .flash-head { align-items: flex-start; gap: 12px; }
.rc-name, .flash-name { font-size: 14px; font-weight: 650; color: var(--text); letter-spacing: -0.01em; line-height: 1.35; }
.rc-total b, .flash-total { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; color: var(--text); line-height: 1.05; }
.rc-total small, .flash-total small { font-size: 10.5px; font-weight: 600; letter-spacing: .05em; color: var(--text-muted); text-transform: uppercase; margin-top: 3px; }

/* inner captions / labels */
.rc-cap { font-size: 10.5px; font-weight: 650; letter-spacing: .06em; color: var(--text-muted); }
.rc-row { font-size: 12.5px; }
.rc-bar { height: 5px; border-radius: 3px; background: var(--grid); }
.rc-bar i { border-radius: 3px; }
.rc-pct { font-size: 11.5px; }

/* location-card stat tiles: neutral tile, only the number carries colour */
.flash-stat { background: var(--surface-2) !important; border: 1px solid var(--border) !important; border-radius: 10px; padding: 9px 6px; }
.fs-val { font-size: 17px; font-weight: 700; }
.fs-label { font-size: 10px; font-weight: 600; letter-spacing: .04em; }
.flash-stat.is-zero .fs-val { color: var(--text-muted); }

/* footer line */
.rc-foot, .flash-foot, .pl-foot {
  display: flex; justify-content: space-between; gap: 8px; margin-top: auto; padding-top: 10px;
  border-top: 1px solid var(--border); font-size: 12px; color: var(--text-muted);
}
.flash-foot b, .rc-foot b { color: var(--text); font-weight: 650; }

/* group header above location cards ("Blood only" etc.) */
.flash-group-head { padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.fg-title { font-size: 14px; font-weight: 650; }
.fg-meta { background: var(--surface-2); border: 1px solid var(--border); font-weight: 600; }
.flash-groups { gap: 22px; }

/* same toolbar everywhere */
.chart-card .table-toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 0 0 14px !important; }
.chart-card .table-toolbar input[type=text] { flex: 1 1 260px; max-width: 360px; height: 36px; }
.chart-card .table-toolbar .table-count { margin-left: auto; background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; padding: 3px 12px; font-size: 12px; }
.pay-tools .table-count { margin-left: 0; }

/* every view heading the same size */
.ar-view-panel > .chart-card > h3, .exc-view-panel > .chart-card > h3, .denied-view-panel > .chart-card > h3 { font-size: 16px; font-weight: 650; margin: 0 0 12px; }

/* ==========================================================================
   Overview tab
   ========================================================================== */
#tab-overview { padding-bottom: 24px; }
#tab-overview .kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin: 0 24px 16px; padding: 0; }
#tab-overview .kpi-card { padding: 16px 18px; position: relative; overflow: hidden; }
#tab-overview .kpi-card::before { display: block; content: ""; position: absolute; left: 18px; top: 0; width: 30px; height: 3px; border-radius: 0 0 3px 3px; background: var(--accent, var(--primary)); opacity: 1; }
#tab-overview .kpi-value { font-size: 30px; margin-top: 8px; }
#tab-overview .kpi-sub { margin-top: 4px; }

/* Payment summary card */
#overviewPayment { padding: 20px 22px; }
#overviewPayment .detail-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin: 0 0 16px; }
#overviewPayment .detail-kpi { border-left: 1px solid var(--border) !important; padding: 14px 16px; position: relative; }
#overviewPayment .detail-kpi::before { content: ""; position: absolute; left: 16px; top: 0; bottom: auto; width: 28px; height: 3px; border-radius: 0 0 3px 3px; background: var(--c, var(--primary)); }
#overviewPayment .detail-kpi .dk-label { font-size: 11.5px; font-weight: 600; letter-spacing: .04em; color: var(--text-muted); text-transform: uppercase; }
#overviewPayment .detail-kpi .dk-val { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; color: var(--text); font-variant-numeric: tabular-nums; }
#ovPayTable th, #ovPayTable td { text-align: right !important; padding: 11px 14px; font-variant-numeric: tabular-nums; }
#ovPayTable th:first-child, #ovPayTable td:first-child { text-align: left !important; }
#ovPayTable tbody tr:hover td { background: var(--surface-2); }
#ovPayTable tfoot td { font-weight: 650; background: var(--surface-2); border-top: 1px solid var(--border-strong); }

/* Explore summaries picker */
#tab-overview .overview-summary-picker { padding: 20px 22px; }
.summary-picker-head h3 { font-size: 16px; font-weight: 650; }
.summary-picker-head p { font-size: 12.5px; color: var(--text-muted); }
.summary-picker-hint { display: none; }
.overview-flash-grid { gap: 14px; }
.overview-flash-grid .flash-card { min-height: 0; }
.overview-flash-grid .flash-card.active { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary) inset, var(--shadow-sm); background: color-mix(in srgb, var(--primary) 4%, var(--surface)); }
.flash-foot span:last-child { color: var(--primary); font-weight: 600; }

/* Summary tables (test / location / payer group) */
#tab-overview .overview-summary-panel { padding: 20px 22px; }
#tab-overview .overview-summary-panel > h3 { font-size: 16px; font-weight: 650; margin: 0 0 12px; }
#tab-overview .table-wrap thead th { position: sticky; top: 0; z-index: 1; padding: 11px 14px; white-space: nowrap; }
#tab-overview table td { padding: 11px 14px; font-variant-numeric: tabular-nums; }
#tab-overview table th.num, #tab-overview table td.num { text-align: right !important; }
#tab-overview table th:first-child, #tab-overview table td:first-child { text-align: left !important; }
#tab-overview table tbody tr:hover td { background: var(--surface-2); }

/* ==========================================================================
   Date Wise tab
   ========================================================================== */
#tab-dataed { padding-bottom: 24px; }
#tab-dataed .dataed-card { padding: 18px 22px; }
#tab-dataed .dataed-bar { display: flex; align-items: flex-end; flex-wrap: wrap; gap: 12px; }
#tab-dataed .dataed-field { display: flex; flex-direction: column; gap: 5px; }
#tab-dataed .dataed-field > label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); }
#tab-dataed .dataed-bar input[type=date], #tab-dataed .dataed-bar select { height: 38px; min-width: 170px; }
#tab-dataed .dataed-bar .btn { height: 38px; }
#tab-dataed #dataEdCount { margin-left: auto; background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; padding: 4px 12px; font-size: 12.5px; align-self: center; }
#tab-dataed .dataed-note { margin: 0 0 12px; padding: 10px 14px; border-radius: 8px; background: var(--warning-wash); color: var(--text); font-size: 13px; border: 1px solid color-mix(in srgb, var(--warning) 25%, transparent); }

#tab-dataed .detail-kpis { margin: 0 24px 16px; display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
#tab-dataed .detail-kpi { border-left: 1px solid var(--border) !important; padding: 14px 16px; position: relative; }
#tab-dataed .detail-kpi::before { content: ""; position: absolute; left: 16px; top: 0; bottom: auto; width: 28px; height: 3px; border-radius: 0 0 3px 3px; background: var(--c, var(--primary)); }
#tab-dataed .detail-kpi .dk-label { font-size: 11.5px; font-weight: 600; letter-spacing: .04em; color: var(--text-muted); text-transform: uppercase; }
#tab-dataed .detail-kpi .dk-val { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; color: var(--text); font-variant-numeric: tabular-nums; }

#tab-dataed .chart-card { padding: 20px 22px; }
#tab-dataed .chart-card > h3 { font-size: 16px; font-weight: 650; margin: 0 0 12px; }
#tab-dataed .table-wrap thead th { position: sticky; top: 0; z-index: 1; padding: 11px 14px; white-space: nowrap; }
#tab-dataed table td { padding: 11px 14px; font-variant-numeric: tabular-nums; }
#dataEdTable th, #dataEdTable td { text-align: left !important; }
#dataEdTable th:last-child, #dataEdTable td:last-child { text-align: right !important; }
#dataEdTable td { vertical-align: top; white-space: normal; line-height: 1.4; }
#dataEdTable td:nth-child(-n+3), #dataEdTable td:nth-child(4) { white-space: nowrap; }
#dataEdTable td:nth-child(5) { font-weight: 550; min-width: 150px; }
#dataEdTable td:nth-child(6) { min-width: 200px; }
#dataEdTable tbody tr:hover td { background: var(--surface-2); }

/* ==========================================================================
   All Records tab
   ========================================================================== */
#tab-records { padding-bottom: 24px; }
.rec-card { padding: 18px 22px; }
.rec-card .table-toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 0 0 14px !important; margin: 0 !important; }
.rec-card .table-toolbar input[type=text] { flex: 1 1 320px; max-width: 420px; height: 38px; }
.rec-card .table-toolbar .table-count { margin-left: auto; background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; padding: 4px 12px; font-size: 12.5px; }
.rec-card .table-wrap { margin: 0 !important; }
#recTable thead th { position: sticky; top: 0; z-index: 1; padding: 11px 14px; white-space: nowrap; text-align: left !important; }
#recTable td { padding: 11px 14px; text-align: left !important; vertical-align: top; white-space: normal; line-height: 1.4; font-variant-numeric: tabular-nums; }
#recTable td:nth-child(1), #recTable td:nth-child(2) { white-space: nowrap; }
#recTable td:nth-child(5) { font-weight: 550; min-width: 150px; }
#recTable td:nth-child(6) { min-width: 200px; }
#recTable th:nth-child(8), #recTable td:nth-child(8) { text-align: right !important; }
#recTable tbody tr:hover td { background: var(--surface-2); }
.rec-card .pagination { margin-top: 14px; }

/* Overview: four summary choices, one panel shown at a time */
.overview-flash-grid { grid-template-columns: repeat(4, minmax(0, 1fr)) !important; }
@media (max-width: 1000px) { .overview-flash-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; } }
@media (max-width: 560px) { .overview-flash-grid { grid-template-columns: 1fr !important; } }

/* ==========================================================================
   Filter bar
   ========================================================================== */
.filterbar {
  width: auto; max-width: none; margin: 16px 24px; padding: 14px 18px; gap: 14px 20px; align-items: flex-end;
  border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-sm); background: var(--surface);
}
.filterbar .filter-group { gap: 5px; }
.filterbar .filter-group > label { font-size: 11px; font-weight: 600; letter-spacing: .05em; color: var(--text-muted); text-transform: uppercase; }
.filterbar .filter-row { gap: 8px; }
.filterbar .filter-row > span { font-size: 12.5px; color: var(--text-muted); }

/* one control height */
.filterbar input[type=date], .filterbar .ms-trigger, .filterbar .btn { height: 38px; }
.filterbar .ms-trigger { display: inline-flex; align-items: center; border-radius: 8px; padding: 0 30px 0 12px; font-size: 13px; background: var(--surface); box-shadow: var(--shadow-sm); }
.filterbar .ms-trigger.active { background: var(--primary-wash); border-color: var(--primary); color: var(--primary); font-weight: 600; }
.filterbar .date-input-group { border-radius: 8px; background: var(--surface); box-shadow: var(--shadow-sm); height: 38px; }
.filterbar .date-input-group input[type=date] { height: 36px; background: transparent; box-shadow: none; }
.filterbar .cal-btn { height: 36px; padding: 0 11px; }
.filterbar .cal-btn:hover { transform: none; }

/* date presets: same segmented style as the rest of the app */
.filterbar .presets { padding: 3px; gap: 2px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; height: 38px; box-sizing: border-box; }
.filterbar .presets button { padding: 0 12px; height: 30px; border-radius: 8px; font-size: 12.5px; font-weight: 550; color: var(--text-muted); }
.filterbar .presets button:hover { color: var(--text); }
.filterbar .presets button.active { color: var(--text); font-weight: 650; }
.filterbar .preset-indicator { border-radius: 8px; top: 3px; bottom: 3px; box-shadow: 0 1px 2px rgba(17,24,39,.10), 0 0 0 1px var(--border); }

/* actions pinned to the right */
.filterbar #btnApplyFilters { margin-left: auto; padding: 0 18px; }
.filterbar #btnClearFilters { padding: 0 12px; color: var(--text-muted); }

/* dropdown panel */
.ms-panel { width: 270px; border-radius: 12px; padding: 10px; box-shadow: var(--shadow-lg); border: 1px solid var(--border); }
.ms-search { height: 34px; border-radius: 8px; }
.ms-actions button { font-weight: 600; }
.ms-option { padding: 8px; border-radius: 8px; font-size: 13px; }
.ms-option:hover { background: var(--surface-2); }
.filterbar .presets button, .filterbar .btn, .filterbar .ms-trigger { white-space: nowrap; flex: none; }
.filterbar .filter-group > label { white-space: nowrap; }
.filterbar #btnApplyFilters, .filterbar #btnClearFilters { flex: none; }

/* Wide screens: one row. Date + presets keep their size, the three dropdowns share what is left. */
@media (min-width: 1440px) {
  .filterbar { flex-wrap: nowrap; gap: 12px; }
  .filterbar > .filter-group:has(.multiselect) { flex: 1 1 0; min-width: 104px; }
  .filterbar .presets button { padding: 0 9px; font-size: 12px; }
  .filterbar input[type=date] { padding: 0 6px; font-size: 12.5px; }
  .filterbar #btnClearFilters { padding: 0 8px; }
}
@media (max-width: 1439px) {
  .filterbar { flex-wrap: wrap; }
  .filterbar .ms-trigger { min-width: 150px; max-width: 220px; width: auto; }
  .filterbar > .filter-group:has(.multiselect) { flex: 0 0 auto; }
  .filterbar #btnApplyFilters { margin-left: auto; }
}

/* ==========================================================================
   Top bar
   ========================================================================== */
.topbar {
  padding: 12px 24px; gap: 12px 20px; background: var(--surface);
  -webkit-backdrop-filter: none; backdrop-filter: none;
  border-bottom: 1px solid var(--border); box-shadow: 0 1px 2px rgba(17,24,39,.04);
}
.brand { gap: 12px; min-width: 0; }
.brand-mark { width: 38px; height: 38px; border-radius: 10px; background: linear-gradient(135deg, var(--primary), color-mix(in srgb, var(--primary) 70%, #1e3a8a)); box-shadow: 0 1px 2px rgba(17,24,39,.15), inset 0 1px 0 rgba(255,255,255,.2); }
.brand:hover .brand-mark { transform: none; }
.brand-glyph { width: 20px; height: 20px; color: #fff; }
.brand h1 { font-size: 16px; font-weight: 700; letter-spacing: -0.015em; color: var(--text); line-height: 1.2; }
.file-meta { display: flex; align-items: center; gap: 7px; margin-top: 3px; font-size: 12px; color: var(--text-muted); max-width: 46vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-meta::before { content: ""; flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--baseline); }
body:has(#app:not(.hidden)) .file-meta::before { background: var(--good); box-shadow: 0 0 0 3px color-mix(in srgb, var(--good) 18%, transparent); }

.topbar-actions { gap: 8px; align-items: center; }
.topbar-actions .btn { height: 36px; padding: 0 13px; display: inline-flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 550; border-radius: 8px; box-shadow: var(--shadow-sm); }
.topbar-actions .btn-primary { font-weight: 600; background: var(--primary); box-shadow: 0 1px 2px rgba(17,24,39,.15); }
.topbar-actions .btn-primary:hover { background: color-mix(in srgb, var(--primary) 88%, #000); }
.topbar-actions .btn:not(.btn-primary) .btn-icon { color: var(--text-muted); }
.topbar-actions .btn .btn-icon { width: 16px; height: 16px; flex: none; }
/* divider between data actions and tools */
.topbar-actions #btnReports { margin-left: 10px; position: relative; }
.topbar-actions #btnReports::before { content: ""; position: absolute; left: -11px; top: 8px; bottom: 8px; width: 1px; background: var(--border-strong); }
.topbar-actions .btn-ghost { box-shadow: none; padding: 0 10px; }
@media (max-width: 900px) { .topbar-actions #btnReports { margin-left: 0; } .topbar-actions #btnReports::before { display: none; } }

/* tab bar sits flush under it */
.tabs { padding: 6px 24px; }

/* ==========================================================================
   PIN login
   ========================================================================== */
.pin-gate {
  background:
    radial-gradient(1200px 600px at 50% -10%, color-mix(in srgb, var(--primary) 10%, transparent), transparent 60%),
    var(--page-bg);
}
.pin-gate::before, .pin-gate::after { display: none; }
.pin-card {
  width: min(400px, 100%); padding: 36px 36px 26px; text-align: left; border-radius: 16px;
  background: var(--surface); border: 1px solid var(--border); backdrop-filter: none;
  box-shadow: 0 1px 2px rgba(17,24,39,.04), 0 12px 32px -8px rgba(17,24,39,.12);
}
.pin-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 26px; }
.pin-mark { width: 36px; height: 36px; margin: 0; border-radius: 10px; background: var(--primary); box-shadow: 0 1px 2px rgba(17,24,39,.15), inset 0 1px 0 rgba(255,255,255,.2); display: grid; place-items: center; }
.pin-glyph { width: 20px; height: 20px; }
.pin-brand-name { font-size: 15px; font-weight: 650; letter-spacing: -0.01em; color: var(--text); }
.pin-card h2 { margin: 0 0 6px; font-size: 24px; font-weight: 700; letter-spacing: -0.02em; color: var(--text); }
.pin-card p { margin: 0 0 24px; font-size: 14px; color: var(--text-muted); }
.pin-card form { gap: 8px; }
.pin-label { font-size: 12px; font-weight: 600; color: var(--text-dim); }
.pin-card input { height: 46px; padding: 0 14px; border-radius: 10px; background: var(--surface); border: 1px solid var(--border-strong); font-size: 20px; letter-spacing: 6px; text-align: left; box-shadow: var(--shadow-sm); }
.pin-card input::placeholder { color: var(--baseline); letter-spacing: 6px; }
.pin-card input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent); }
.pin-card .btn { min-height: 44px; height: 44px; margin-top: 8px; border-radius: 10px; font-size: 14px; font-weight: 600; background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: 0 1px 2px rgba(17,24,39,.15); }
.pin-card .btn:hover { background: color-mix(in srgb, var(--primary) 88%, #000); transform: none; box-shadow: 0 1px 2px rgba(17,24,39,.15); }
.pin-error { min-height: 20px; margin-top: 12px; font-size: 13px; color: var(--critical); }
.pin-error:not(:empty) { padding: 9px 12px; border-radius: 8px; background: var(--critical-wash); border: 1px solid color-mix(in srgb, var(--critical) 25%, transparent); }
.pin-foot { display: flex; align-items: center; justify-content: center; gap: 7px; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border); font-size: 12px; color: var(--text-muted); }
.pin-foot svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
@media (max-width: 480px) { .pin-card { padding: 28px 22px 22px; } }

/* ==========================================================================
   Loading overlay + empty state
   ========================================================================== */
.loading-overlay {
  position: fixed; inset: 0; z-index: 9000; display: grid; place-items: center; padding: 20px;
  background: color-mix(in srgb, var(--page-bg) 72%, transparent);
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
}
.loading-overlay.hidden { display: none !important; }
.loading-card {
  width: min(360px, 100%); padding: 30px 30px 26px; text-align: center;
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  box-shadow: 0 1px 2px rgba(17,24,39,.04), 0 16px 40px -10px rgba(17,24,39,.18);
}
.loading-spinner {
  width: 40px; height: 40px; margin: 0 auto 16px; border-radius: 50%;
  border: 3px solid var(--grid); border-top-color: var(--primary);
  animation: loadSpin .8s linear infinite;
}
.loading-card h3 { margin: 0 0 4px; font-size: 16px; font-weight: 650; color: var(--text); }
.loading-card p { margin: 0 0 18px; font-size: 13px; color: var(--text-muted); min-height: 18px; }
.loading-bar { height: 4px; border-radius: 2px; background: var(--grid); overflow: hidden; position: relative; }
.loading-bar i { position: absolute; top: 0; bottom: 0; width: 40%; border-radius: 2px; background: var(--primary); animation: loadSlide 1.3s ease-in-out infinite; }
@keyframes loadSpin { to { transform: rotate(360deg); } }
@keyframes loadSlide { 0% { left: -40%; } 100% { left: 100%; } }
@media (prefers-reduced-motion: reduce) { .loading-spinner { animation-duration: 2s; } .loading-bar i { animation-duration: 2.6s; } }

/* empty state */
.empty-state { padding: 72px 24px; }
.empty-card {
  max-width: 520px; padding: 36px 36px 30px; text-align: center; background: var(--surface);
  border: 1px dashed var(--border-strong); border-radius: 16px; box-shadow: var(--shadow-sm);
}
.empty-icon { width: 56px; height: 56px; margin: 0 auto 16px; border-radius: 14px; display: grid; place-items: center; background: var(--primary-wash); }
.empty-glyph { width: 26px; height: 26px; fill: none; stroke: var(--primary); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.empty-card h2 { font-size: 20px; font-weight: 700; letter-spacing: -0.02em; margin: 0 0 8px; color: var(--text); }
.empty-card p { color: var(--text-muted); font-size: 13.5px; line-height: 1.6; margin: 0 0 18px; }
.empty-steps { list-style: none; margin: 0; padding: 18px 0 0; border-top: 1px solid var(--border); text-align: left; display: flex; flex-direction: column; gap: 10px; }
.empty-steps li { display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--text-dim); }
.empty-steps li span { flex: none; width: 22px; height: 22px; border-radius: 50%; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-dim); font-size: 11.5px; font-weight: 650; display: inline-grid; place-items: center; }

/* ==========================================================================
   Reports modal (screen only — print output keeps its own stylesheet)
   ========================================================================== */
@media screen {
  #reportModal { padding: 24px; }
  #reportModal .report-modal { max-width: 1040px; width: 100%; height: min(90vh, 900px); max-height: none; border-radius: 16px; overflow: hidden; box-shadow: 0 24px 64px -12px rgba(17,24,39,.35); }

  #reportModal .modal-header { align-items: flex-start; padding: 20px 24px 14px; border-bottom: 0; }
  #reportModal .rm-title h2 { font-size: 20px; font-weight: 700; letter-spacing: -0.02em; margin: 0; }
  #reportModal .rm-title p { margin: 4px 0 0; font-size: 12.5px; color: var(--text-muted); max-width: 760px; }
  #reportModal .rm-close { width: 36px; height: 36px; padding: 0; display: inline-grid; place-items: center; border-radius: 8px; color: var(--text-muted); }
  #reportModal .rm-close:hover { background: var(--surface-2); color: var(--text); }

  /* category tabs: underline style, same as the app's view tabs */
  #reportModal .report-cats { justify-content: flex-start; gap: 2px; padding: 0 24px; margin: 0; border-bottom: 1px solid var(--border); overflow-x: auto; flex-wrap: nowrap; scrollbar-width: thin; }
  #reportModal .report-cat { min-height: 0; padding: 10px 14px; border: 0; border-radius: 0; background: none; color: var(--text-muted); font-size: 13px; font-weight: 550; position: relative; flex: none; }
  #reportModal .report-cat:hover { color: var(--text); background: none; }
  #reportModal .report-cat.active { color: var(--primary); font-weight: 650; background: none; }
  #reportModal .report-cat.active::after { content: ""; position: absolute; left: 8px; right: 8px; bottom: -1px; height: 2px; border-radius: 2px; background: var(--primary); }

  /* the document */
  #reportModal .report-content { flex: 1 1 auto; min-height: 0; padding: 24px 28px 28px; background: var(--page-bg); }
  #reportModal .report-content > * { max-width: 920px; margin-left: auto; margin-right: auto; }
  #reportModal .report-head { padding: 20px 24px 16px; margin: 0 auto 16px; background: var(--surface); border: 1px solid var(--border); border-bottom: 3px solid var(--primary); border-radius: 12px 12px 0 0; }
  #reportModal .report-doc-title { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; margin: 0 0 8px; text-transform: none; color: var(--text); }
  #reportModal .report-meta { gap: 4px 20px; font-size: 12px; }
  #reportModal .report-stats { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
  #reportModal .report-stat { background: var(--surface); border: 1px solid var(--border); border-left: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; position: relative; box-shadow: var(--shadow-sm); }
  #reportModal .report-stat::before { content: ""; position: absolute; left: 16px; top: 0; width: 28px; height: 3px; border-radius: 0 0 3px 3px; background: var(--c, var(--primary)); }
  #reportModal .rs-label { font-size: 11px; letter-spacing: .05em; font-weight: 600; }
  #reportModal .rs-val { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; margin-top: 4px; }
  #reportModal .rs-sub { font-size: 11.5px; }

  #reportModal .report-section { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 18px 20px 16px; margin-bottom: 16px; box-shadow: var(--shadow-sm); }
  #reportModal .report-section h4 { font-size: 14px; font-weight: 650; letter-spacing: -0.01em; text-transform: none; color: var(--text); border-bottom: 0; padding-bottom: 0; margin: 0 0 12px; }
  #reportModal .report-note { font-size: 12px; color: var(--text-muted); margin: -6px 0 10px; }
  #reportModal .report-table { border: 1px solid var(--border); border-radius: 8px; border-collapse: separate; border-spacing: 0; overflow: hidden; font-size: 13px; }
  #reportModal .report-table th { padding: 10px 12px; font-size: 11px; letter-spacing: .05em; color: var(--text-muted); background: var(--surface-2); border-bottom: 1px solid var(--border-strong); position: sticky; top: -24px; z-index: 1; }
  #reportModal .report-table td { padding: 10px 12px; font-variant-numeric: tabular-nums; border-bottom: 1px solid var(--border); }
  #reportModal .report-table td.num, #reportModal .report-table th.num { text-align: right; }
  #reportModal .report-table tbody tr:hover td { background: var(--surface-2); }
  #reportModal .report-table tbody tr:last-child td { border-bottom: 0; }
  #reportModal .report-table tfoot td { font-weight: 650; background: var(--surface-2); border-top: 1px solid var(--border-strong); }
  #reportModal .report-empty { padding: 18px; text-align: center; border: 1px dashed var(--border-strong); border-radius: 8px; font-style: normal; }

  /* action bar */
  #reportModal .modal-actions { align-items: center; justify-content: space-between; padding: 14px 24px; gap: 12px; background: var(--surface); border-top: 1px solid var(--border); }
  #reportModal .rm-hint { font-size: 12px; color: var(--text-muted); }
  #reportModal .rm-buttons { display: flex; gap: 8px; flex-wrap: wrap; }
  #reportModal .modal-actions .btn { flex: none; height: 38px; padding: 0 14px; display: inline-flex; align-items: center; gap: 7px; border-radius: 8px; font-size: 13px; font-weight: 550; }
  #reportModal .modal-actions .btn-primary { font-weight: 600; background: var(--primary); }
  #reportModal .modal-actions .btn .btn-icon { width: 16px; height: 16px; }
}
@media screen and (max-width: 640px) {
  #reportModal { padding: 0; }
  #reportModal .report-modal { height: 100vh; border-radius: 0; }
  #reportModal .report-content { padding: 16px; }
  #reportModal .rm-hint { display: none; }
  #reportModal .rm-buttons { width: 100%; }
  #reportModal .rm-buttons .btn { flex: 1 1 auto; justify-content: center; }
}
@media screen {
  #reportModal .modal-header, #reportModal .report-cats, #reportModal .modal-actions { flex: none; }
  #reportModal .report-table th, #reportModal .report-table td { text-align: right !important; }
  #reportModal .report-table th:first-child, #reportModal .report-table td:first-child { text-align: left !important; }
}

/* ---- Payment report ---- */
@media screen {
  #reportModal .pay-hero { max-width: 920px; margin: 0 auto 16px; display: grid; grid-template-columns: minmax(220px, 1fr) minmax(260px, 1.4fr); gap: 28px; align-items: center; padding: 22px 26px; border-radius: 12px; color: #fff; background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 60%, #0ea5e9 100%); box-shadow: var(--shadow-sm); }
  #reportModal .pay-hero-main { display: flex; flex-direction: column; gap: 4px; }
  #reportModal .ph-label { font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; opacity: .8; }
  #reportModal .ph-val { font-size: 38px; font-weight: 750; letter-spacing: -0.03em; line-height: 1.1; font-variant-numeric: tabular-nums; }
  #reportModal .ph-sub { font-size: 12.5px; opacity: .85; }
  #reportModal .ph-bar { display: flex; height: 12px; border-radius: 99px; overflow: hidden; background: rgba(255,255,255,.2); }
  #reportModal .ph-bar i { display: block; height: 100%; }
  #reportModal .ph-bar i.ins { background: #fff; }
  #reportModal .ph-bar i.pt { background: #fbbf24; }
  #reportModal .ph-legend { display: flex; flex-wrap: wrap; gap: 6px 22px; margin-top: 12px; font-size: 12.5px; }
  #reportModal .ph-legend b { font-weight: 650; font-variant-numeric: tabular-nums; }
  #reportModal .ph-legend em { font-style: normal; opacity: .75; }
  #reportModal .ph-legend .dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; }
  #reportModal .ph-legend .dot.ins { background: #fff; }
  #reportModal .ph-legend .dot.pt { background: #fbbf24; }
  #reportModal .pay-insights { max-width: 920px; margin: 0 auto 16px; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
  #reportModal .pay-insight { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; display: flex; flex-direction: column; gap: 3px; box-shadow: var(--shadow-sm); }
  #reportModal .pi-label { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); }
  #reportModal .pi-name { font-size: 14px; font-weight: 650; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  #reportModal .pi-val { font-size: 13px; font-weight: 600; color: #059669; font-variant-numeric: tabular-nums; }
  #reportModal .pi-val em { font-style: normal; font-weight: 500; color: var(--text-muted); margin-left: 4px; }
  #reportModal .report-table td.pr-name { font-weight: 600; color: var(--text); }
  #reportModal .report-table td.pr-total { font-weight: 650; color: var(--text); }
  #reportModal .report-table td.pr-sharecell { width: 150px; }
  #reportModal .pr-share { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
  #reportModal .pr-bar { flex: 1; max-width: 70px; height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; border: 1px solid var(--border); }
  #reportModal .pr-bar i { display: block; height: 100%; background: var(--primary); border-radius: 99px; }
  #reportModal .pr-share b { font-weight: 600; min-width: 38px; text-align: right; }
}
@media screen and (max-width: 720px) {
  #reportModal .pay-hero { grid-template-columns: 1fr; gap: 16px; padding: 18px; }
  #reportModal .ph-val { font-size: 30px; }
}

/* ---- AR report ---- */
@media screen {
  #reportModal .ar-hero { background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 55%, #4338ca 100%); }
  #reportModal .ar-hero .ph-val small { font-size: 15px; font-weight: 500; opacity: .8; letter-spacing: 0; }
  #reportModal .ar-hero .ph-bar { height: 14px; gap: 2px; background: rgba(255,255,255,.12); }
  #reportModal .ar-hero .ph-legend .dot { box-shadow: 0 0 0 1.5px rgba(255,255,255,.55); }
  #reportModal .report-table tr.rt-sub td { background: var(--surface-2); font-weight: 650; }
}

/* ---- Payment tab: average view ---- */
#tab-payment .avg-up { color: #059669; font-weight: 600; }
#tab-payment .avg-down { color: #dc2626; font-weight: 600; }
#tab-payment #payAvgPayer th:not(:first-child), #tab-payment #payAvgPayer td:not(:first-child),
#tab-payment #payAvgTest th:not(:first-child), #tab-payment #payAvgTest td:not(:first-child) { text-align: right; }

/* ---- Denied report ---- */
@media screen {
  #reportModal .den-hero { background: linear-gradient(135deg, #7f1d1d 0%, #b91c1c 55%, #ea580c 100%); }
  #reportModal .den-hero .ph-val small { font-size: 14px; font-weight: 500; opacity: .85; letter-spacing: 0; }
  #reportModal .pi-val.den { color: #dc2626; }
}

/* ---- Payment tab: average view, comprehensive table ---- */
#tab-payment .avg-insights { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin: 0 0 16px; }
#tab-payment .avg-insight { display: flex; flex-direction: column; gap: 2px; padding: 14px 16px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); border-left: 3px solid var(--primary); }
#tab-payment .avg-insight.good { border-left-color: #059669; }
#tab-payment .avg-insight.bad { border-left-color: #dc2626; }
#tab-payment .ai-label { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); }
#tab-payment .ai-name { font-size: 13.5px; font-weight: 650; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#tab-payment .ai-val { font-size: 22px; font-weight: 750; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; color: var(--text); }
#tab-payment .ai-sub { font-size: 12px; color: var(--text-muted); }
#tab-payment .avg-table th.avg-sortable { cursor: pointer; user-select: none; white-space: nowrap; }
#tab-payment .avg-table th.avg-sortable:hover { color: var(--primary); }
#tab-payment .avg-table th.sorted { color: var(--primary); }
#tab-payment .avg-arrow { font-size: 9px; margin-left: 4px; }
#tab-payment .avg-table td, #tab-payment .avg-table th { white-space: nowrap; }
#tab-payment .avg-table td:first-child, #tab-payment .avg-table th:first-child { width: 34px; padding-right: 0; }
#tab-payment .avg-table td:nth-child(2), #tab-payment .avg-table th:nth-child(2) { text-align: left; }
#tab-payment .avg-rank { color: var(--text-muted); font-size: 12px; text-align: center !important; }
#tab-payment .avg-dim { color: var(--text-muted); }
#tab-payment .avg-main { font-weight: 700; color: var(--text); }
#tab-payment .pay-share-bar i.rate { background: #0ea5e9; }
#tab-payment .avg-chip { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 12px; font-weight: 650; font-variant-numeric: tabular-nums; }
#tab-payment .avg-chip.up { background: #dcfce7; color: #166534; }
#tab-payment .avg-chip.down { background: #fee2e2; color: #991b1b; }
#tab-payment .avg-chip.flat { background: var(--surface-2); color: var(--text-muted); }
#tab-payment .avg-low { margin-left: 8px; padding: 1px 7px; border-radius: 99px; font-size: 10.5px; font-weight: 600; letter-spacing: .02em; background: #fef3c7; color: #92400e; }
#tab-payment .avg-filter { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-muted); }
#tab-payment .avg-note { margin: 10px 2px 0; font-size: 12px; color: var(--text-muted); }
#tab-payment .avg-note:empty { display: none; }
#tab-payment .avg-table { table-layout: auto; width: 100%; }
#tab-payment .avg-table th:first-child, #tab-payment .avg-table td:first-child { width: 1%; min-width: 36px; max-width: 44px; padding-left: 12px; padding-right: 4px; text-align: center !important; }
#tab-payment .avg-table th:nth-child(2), #tab-payment .avg-table td:nth-child(2) { text-align: left !important; min-width: 230px; }
#tab-payment .avg-table td:nth-child(2) .pay-child { display: inline-block; }

/* ---- Exception report ---- */
@media screen {
  #reportModal .exc-hero { background: linear-gradient(135deg, #7c2d12 0%, #c2410c 55%, #f59e0b 100%); }
  #reportModal .exc-hero .ph-val small { font-size: 15px; font-weight: 500; opacity: .85; letter-spacing: 0; }
  #reportModal .exc-hero .ph-bar { height: 14px; gap: 2px; background: rgba(255,255,255,.18); }
  #reportModal .exc-hero .ph-legend .dot { box-shadow: 0 0 0 1.5px rgba(255,255,255,.55); }
}
@media screen { #reportModal .exc-hero ~ .pay-insights { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media screen and (max-width: 720px) { #reportModal .exc-hero ~ .pay-insights { grid-template-columns: 1fr 1fr; } }

/* Location report */
@media screen {
  #reportModal .loc-hero { background: linear-gradient(135deg, #134e4a 0%, #0f766e 55%, #0891b2 100%); }
  #reportModal .loc-hero .ph-val small { font-size: 15px; font-weight: 500; opacity: .85; letter-spacing: 0; }
  #reportModal .loc-hero .ph-bar { height: 14px; gap: 2px; background: rgba(255,255,255,.18); }
  #reportModal .loc-hero .ph-legend .dot { box-shadow: 0 0 0 1.5px rgba(255,255,255,.55); }
  #reportModal .loc-hero ~ .pay-insights { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  #reportModal .loc-hero ~ .report-section .report-table td.rt-bad { color: #b91c1c; font-weight: 700; }
  #reportModal .loc-hero ~ .report-section .report-table td { white-space: nowrap; }
  #reportModal .loc-hero ~ .report-section .report-table td:nth-child(2), #reportModal .loc-hero ~ .report-section .report-table th:nth-child(2) { text-align: left !important; white-space: normal; min-width: 170px; }
  #reportModal .loc-hero ~ .report-section .report-table td:nth-child(4) { min-width: 110px; }
  #reportModal .loc-hero ~ .report-section .report-table td.rt-mix { white-space: normal; min-width: 150px; text-align: left; }
}
@media screen and (max-width: 720px) { #reportModal .loc-hero ~ .pay-insights { grid-template-columns: 1fr 1fr; } }

/* Southern Billing tab */
.sb-cards { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 12px; margin: 0 24px 16px; }
.sb-card { text-align: left; background: var(--surface, #fff); border: 1px solid var(--border, #e5e7eb); border-top: 3px solid var(--c); border-radius: 12px; padding: 12px 14px; cursor: pointer; display: flex; flex-direction: column; gap: 2px; font: inherit; color: inherit; transition: box-shadow .15s, transform .15s; }
.sb-card:hover { box-shadow: 0 4px 14px rgba(15,23,42,.08); transform: translateY(-1px); }
.sb-card.active { box-shadow: 0 0 0 2px var(--c); }
.sb-card-n { font-size: 24px; font-weight: 700; color: var(--c); line-height: 1.1; }
.sb-card-l { font-size: 12.5px; font-weight: 600; }
.sb-card-p { font-size: 11px; color: var(--text-dim, #64748b); }
.sb-tools { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 0 24px 16px; }
.sb-tools input[type=text] { flex: 1 1 260px; min-width: 200px; padding: 9px 12px; border: 1px solid var(--border, #e5e7eb); border-radius: 10px; font: inherit; background: var(--surface, #fff); color: inherit; }
.sb-sel { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-dim, #64748b); }
.sb-sel select { padding: 8px 10px; border: 1px solid var(--border, #e5e7eb); border-radius: 10px; font: inherit; background: var(--surface, #fff); color: inherit; }
.sb-table td, .sb-table th { white-space: nowrap; }
.sb-table td.sb-name { text-align: left; font-weight: 600; white-space: normal; min-width: 150px; }
.sb-table th:first-child { text-align: left; }
.sb-table td.sb-wrap, .sb-table td.sb-reason { white-space: normal; text-align: left; max-width: 340px; }
.sb-table td.sb-reason { font-size: 11.5px; color: var(--text-dim, #64748b); min-width: 160px; }
.sb-table .sb-zero { color: var(--text-dim, #94a3b8); opacity: .6; }
.sb-table .sb-bad { color: #b91c1c; font-weight: 700; }
.sb-table .sb-warn { color: #b45309; font-weight: 700; }
.sb-table .sb-viol { color: #6d28d9; font-weight: 700; }
.sb-table .sb-none { text-align: center; color: var(--text-dim, #64748b); padding: 22px; }
.sb-table .sb-sortable { cursor: pointer; }
.sb-table .sb-sortable.sorted { color: var(--primary); }
.sb-chip { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11px; font-weight: 600; color: var(--c); background: color-mix(in srgb, var(--c) 12%, transparent); border: 1px solid color-mix(in srgb, var(--c) 35%, transparent); }
.sb-pager { display: flex; gap: 12px; align-items: center; justify-content: flex-end; padding: 12px 0 2px; font-size: 12.5px; color: var(--text-dim, #64748b); }
.sb-empty { padding: 40px 20px; text-align: center; color: var(--text-dim, #64748b); }
.sb-empty h3 { color: inherit; margin: 0 0 6px; }
@media (max-width: 1100px) { .sb-cards { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 640px) { .sb-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 0 16px 16px; } .sb-tools { margin: 0 16px 16px; } }
.sb-table td.sb-wrap, .sb-table td.sb-name, .sb-table td.sb-reason, .sb-table th:first-child { text-align: left !important; }
.sb-table td.sb-wrap { max-width: 520px; }

/* Southern Billing — professional layout */
.sb-hero { margin: 0 24px 18px; display: grid; grid-template-columns: minmax(260px, 1fr) minmax(300px, 1.4fr); gap: 32px; align-items: center; padding: 26px 30px; border-radius: 16px; color: #fff; background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 55%, #0891b2 100%); box-shadow: 0 10px 30px rgba(30,58,138,.22); }
.sb-hero-main { display: flex; flex-direction: column; gap: 5px; }
.sb-hl { font-size: 11px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; opacity: .75; }
.sb-hv { font-size: 44px; font-weight: 750; letter-spacing: -0.03em; line-height: 1.05; font-variant-numeric: tabular-nums; }
.sb-hv small { font-size: 16px; font-weight: 500; opacity: .8; letter-spacing: 0; }
.sb-hs { font-size: 13px; opacity: .85; }
.sb-hero-stats { display: flex; gap: 26px; margin-top: 14px; padding-top: 14px; border-top: 1px solid rgba(255,255,255,.18); }
.sb-hero-stats div { display: flex; flex-direction: column; }
.sb-hero-stats b { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.sb-hero-stats span { font-size: 11px; opacity: .75; }
.sb-hbar { display: flex; gap: 2px; height: 16px; border-radius: 99px; overflow: hidden; background: rgba(255,255,255,.15); }
.sb-hbar i { display: block; height: 100%; min-width: 3px; }
.sb-hleg { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 22px; margin-top: 16px; font-size: 12.5px; }
.sb-hleg b { font-weight: 650; font-variant-numeric: tabular-nums; }
.sb-hleg em { font-style: normal; opacity: .65; margin-left: 2px; }
.sb-hleg .dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 7px; box-shadow: 0 0 0 1.5px rgba(255,255,255,.5); }
.sb-sec { margin: 4px 24px 10px; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-muted, #64748b); }
.sb-sec small { font-weight: 500; letter-spacing: 0; text-transform: none; margin-left: 8px; opacity: .8; }
.sb-insights { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 0 24px 16px; }
.sb-ins { background: var(--surface, #fff); border: 1px solid var(--border, #e5e7eb); border-radius: 12px; padding: 14px 16px; display: flex; flex-direction: column; gap: 3px; box-shadow: var(--shadow-sm, none); min-width: 0; }
.sb-il { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted, #64748b); }
.sb-in { font-size: 14px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-iv { font-size: 13px; font-weight: 600; color: #0f766e; font-variant-numeric: tabular-nums; }
.sb-iv em { font-style: normal; font-weight: 500; color: var(--text-muted, #64748b); margin-left: 4px; }
.sb-kpis { margin-bottom: 18px; }
.sb-active { display: inline-flex; align-items: center; gap: 8px; align-self: center; padding: 6px 8px 6px 12px; border-radius: 99px; font-size: 12px; font-weight: 600; background: var(--primary-soft, #e0e7ff); color: var(--primary, #4338ca); }
.sb-active button { border: 0; background: rgba(0,0,0,.08); border-radius: 50%; width: 20px; height: 20px; cursor: pointer; font-size: 11px; line-height: 1; color: inherit; }
.sb-more { align-self: center; font-size: 11.5px; color: var(--text-muted, #64748b); }
.sb-mix { display: flex; gap: 1px; width: 120px; height: 8px; border-radius: 99px; overflow: hidden; background: var(--surface-2, #f1f5f9); }
.sb-mix i { display: block; height: 100%; }
.sb-table .pr-share { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.sb-table .pr-bar { flex: 1; max-width: 70px; height: 6px; border-radius: 99px; background: var(--surface-2, #f1f5f9); overflow: hidden; border: 1px solid var(--border, #e5e7eb); }
.sb-table .pr-bar i { display: block; height: 100%; border-radius: 99px; }
.sb-table .pr-share b { font-weight: 600; min-width: 36px; text-align: right; }
.sb-table td:nth-child(4) .sb-mix { margin-left: auto; }
.sb-table tfoot td { font-weight: 700; border-top: 2px solid var(--border, #e5e7eb); }
.sb-card-wrap .pay-card-head { display: flex; justify-content: space-between; gap: 12px; }
@media (max-width: 1100px) { .sb-insights { grid-template-columns: 1fr 1fr; } }
@media (max-width: 860px) { .sb-hero { grid-template-columns: 1fr; gap: 20px; padding: 20px; } .sb-hv { font-size: 34px; } }
@media (max-width: 640px) { .sb-hero, .sb-insights, .sb-sec { margin-left: 16px; margin-right: 16px; } .sb-hleg { grid-template-columns: 1fr; } }

/* Denied tab — professional layout */
.dn-hero { background: linear-gradient(135deg, #7f1d1d 0%, #b91c1c 55%, #f97316 100%); box-shadow: 0 10px 30px rgba(185,28,28,.22); }
#tab-denied .sb-insights { margin-bottom: 18px; }
#tab-denied #deniedHero .sb-hero { margin-top: 4px; }
#tab-denied .dn-reason { text-align: left !important; white-space: normal; max-width: 520px; min-width: 220px; line-height: 1.4; }
#tab-denied #deniedReasonTable th:first-child { text-align: left; }
#tab-denied .pr-share { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
#tab-denied .pr-bar { flex: 1; max-width: 80px; height: 6px; border-radius: 99px; background: var(--surface-2, #f1f5f9); overflow: hidden; border: 1px solid var(--border, #e5e7eb); }
#tab-denied .pr-bar i { display: block; height: 100%; border-radius: 99px; }
#tab-denied .pr-share b { font-weight: 600; min-width: 36px; text-align: right; }
#tab-denied .denied-reason-row { cursor: pointer; }
#tab-denied .denied-reason-row:hover { background: color-mix(in srgb, var(--critical) 6%, transparent); }
#tab-denied .denied-reason-row.active { background: color-mix(in srgb, var(--critical) 12%, transparent); }

/* Southern Billing — Location report */
.sb-loc-spots { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 4px 0 16px; }
.sb-loc-spot { border: 1px solid var(--border, #e5e7eb); border-left: 4px solid var(--c); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; min-width: 0; background: var(--surface, #fff); }
.sb-sv { font-size: 22px; font-weight: 700; color: var(--c); letter-spacing: -0.02em; line-height: 1.15; font-variant-numeric: tabular-nums; }
.sb-ss { font-size: 12px; color: var(--text-muted, #64748b); }
.sb-pills { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 12px; color: var(--text-muted, #64748b); }
.sb-pill { border: 1px solid var(--border, #e5e7eb); background: var(--surface, #fff); color: inherit; border-radius: 99px; padding: 5px 12px; font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; }
.sb-pill:hover { border-color: var(--teal, #0d9488); }
.sb-pill.on { background: var(--teal, #0d9488); border-color: var(--teal, #0d9488); color: #fff; }
.sb-loc td.sb-rank, .sb-loc th:first-child { text-align: center !important; width: 36px; color: var(--text-muted, #64748b); font-weight: 600; }
.sb-loc th:nth-child(2) { text-align: left !important; }
.sb-loc td.sb-name b { display: block; font-weight: 650; }
.sb-sub { display: block; font-size: 11px; font-weight: 500; color: var(--text-muted, #64748b); white-space: normal; line-height: 1.35; }
.sb-loc td.sb-tests { text-align: left !important; white-space: normal; min-width: 150px; font-size: 12px; }
.sb-rate { display: inline-block; min-width: 44px; text-align: center; padding: 2px 8px; border-radius: 99px; font-size: 12px; font-weight: 700; }
.sb-rate.good { background: #dcfce7; color: #166534; }
.sb-rate.warn { background: #fef3c7; color: #92400e; }
.sb-rate.bad { background: #fee2e2; color: #991b1b; }
@media (max-width: 1100px) { .sb-loc-spots { grid-template-columns: 1fr 1fr; } }
@media (max-width: 640px) { .sb-loc-spots { grid-template-columns: 1fr; } }
.sb-loc th:first-child, .sb-loc td.sb-rank { width: 1% !important; min-width: 0 !important; padding-left: 10px !important; padding-right: 6px !important; }
.sb-loc td.sb-name { min-width: 240px !important; }
.sb-loc td:nth-child(5) .sb-mix { width: 96px; }

/* Southern Billing — navigation, worklist, detail panel */
.sb-nav { display: flex; gap: 4px; flex-wrap: wrap; margin: 0 24px 14px; padding: 4px; background: var(--surface-2, #f1f5f9); border: 1px solid var(--border, #e5e7eb); border-radius: 12px; width: fit-content; max-width: calc(100% - 48px); }
.sb-navbtn { border: 0; background: transparent; color: var(--text-muted, #64748b); font: inherit; font-size: 13px; font-weight: 600; padding: 8px 14px; border-radius: 9px; cursor: pointer; display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.sb-navbtn:hover { color: var(--text, #0f172a); background: rgba(255,255,255,.6); }
.sb-navbtn.on { background: var(--surface, #fff); color: var(--primary, #4338ca); box-shadow: 0 1px 3px rgba(15,23,42,.12); }
.sb-navbtn em { font-style: normal; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 99px; background: rgba(100,116,139,.15); color: var(--text-muted, #64748b); }
.sb-navbtn.on em { background: var(--primary, #4338ca); color: #fff; }
.sb-click { cursor: pointer; }
.sb-click:hover td { background: color-mix(in srgb, var(--primary, #4338ca) 5%, transparent); }
.sb-table td.sb-action { text-align: left !important; white-space: normal; min-width: 200px; font-weight: 600; font-size: 12.5px; color: #0f766e; }
.sb-help { margin: 0 24px 16px; border: 1px solid var(--border, #e5e7eb); border-radius: 12px; background: var(--surface, #fff); padding: 12px 16px; }
.sb-help summary { cursor: pointer; font-weight: 650; font-size: 13.5px; }
.sb-help-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px 20px; margin-top: 12px; }
.sb-help-grid p { margin: 5px 0 0; font-size: 12px; color: var(--text-muted, #64748b); }
.sb-help-note { margin: 12px 0 0; font-size: 12px; color: var(--text-muted, #64748b); }
#sbDrawer { position: fixed; inset: 0; z-index: 3000; pointer-events: none; }
#sbDrawer.open { pointer-events: auto; }
.sb-dr-back { position: absolute; inset: 0; background: rgba(15,23,42,.38); opacity: 0; transition: opacity .2s; }
#sbDrawer.open .sb-dr-back { opacity: 1; }
.sb-dr { position: absolute; top: 0; right: 0; bottom: 0; width: min(440px, 100vw); background: var(--surface, #fff); color: var(--text, #0f172a); box-shadow: -12px 0 40px rgba(15,23,42,.2); overflow-y: auto; padding: 22px 24px 30px; transform: translateX(100%); transition: transform .22s ease; }
#sbDrawer.open .sb-dr { transform: none; }
.sb-dr header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.sb-dr header h3 { margin: 2px 0 8px; font-size: 20px; }
.sb-dr .sb-hl { color: var(--text-muted, #64748b); }
.sb-dr-x { border: 1px solid var(--border, #e5e7eb); background: var(--surface, #fff); border-radius: 50%; width: 30px; height: 30px; cursor: pointer; color: inherit; }
.sb-dr-note { background: #fef2f2; border: 1px solid #fecaca; border-radius: 10px; padding: 10px 14px; margin-bottom: 8px; font-size: 13px; color: #7f1d1d; }
.sb-dr-note p { margin: 4px 0 0; word-break: break-word; }
.sb-dr-sec { margin: 18px 0 6px; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-muted, #64748b); }
.sb-dr-row { display: flex; justify-content: space-between; gap: 16px; padding: 7px 0; border-bottom: 1px solid var(--border, #e5e7eb); font-size: 13px; }
.sb-dr-row span { color: var(--text-muted, #64748b); flex: none; }
.sb-dr-row b { font-weight: 600; text-align: right; word-break: break-word; }
@media (max-width: 640px) { .sb-nav { margin: 0 16px 14px; max-width: calc(100% - 32px); overflow-x: auto; flex-wrap: nowrap; } .sb-help { margin: 0 16px 16px; } }

.sb-attn td, .sb-attn th { text-align: left !important; }
.sb-attn td.sb-name b { display: block; font-weight: 650; }
.sb-attn td.sb-reason { max-width: 300px; }

.sb-head-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.sb-head-actions .sb-active, .sb-head-actions .btn { align-self: center; margin: 0; height: 36px; box-sizing: border-box; }
.sb-head-actions .sb-active { padding-top: 0; padding-bottom: 0; }

.sb-tools .sb-active { height: 36px; box-sizing: border-box; padding-top: 0; padding-bottom: 0; }

/* Southern Billing — AR status cards: as many as the sheet has values */
.sb-cards { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)) !important; }

/* Southern Billing — banner */
.sb-banner { margin: 0 24px 18px; padding: 26px 30px 22px; border-radius: 18px; color: #fff; position: relative; overflow: hidden;
  background: radial-gradient(900px 300px at 100% 0%, rgba(34,211,238,.28), transparent 60%), radial-gradient(700px 260px at 0% 100%, rgba(99,102,241,.35), transparent 60%), linear-gradient(135deg, #0b1226 0%, #14235a 60%, #0f4c75 100%);
  box-shadow: 0 14px 36px rgba(15,23,42,.28); border: 1px solid rgba(255,255,255,.08); }
.sb-banner::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: linear-gradient(90deg, #34d399, #60a5fa, #a78bfa, #fbbf24, #f87171); }
.sbb-top { display: grid; grid-template-columns: minmax(240px, 1fr) minmax(280px, 1.15fr); gap: 36px; align-items: center; }
.sbb-eyebrow { font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: rgba(255,255,255,.65); }
.sbb-count { display: flex; align-items: baseline; gap: 10px; margin: 4px 0 4px; }
.sbb-count b { font-size: 54px; font-weight: 800; letter-spacing: -0.04em; line-height: 1; font-variant-numeric: tabular-nums; }
.sbb-count span { font-size: 17px; font-weight: 500; color: rgba(255,255,255,.8); }
.sbb-count em, .sbb-prow em { font-style: normal; opacity: .65; font-weight: 500; }
.sbb-range { font-size: 12.5px; color: rgba(255,255,255,.62); }
.sbb-progress { display: flex; flex-direction: column; gap: 6px; }
.sbb-prow { display: flex; justify-content: space-between; align-items: baseline; font-size: 12.5px; color: rgba(255,255,255,.75); margin-top: 4px; }
.sbb-prow b { font-weight: 650; color: #fff; font-variant-numeric: tabular-nums; }
.sbb-meter { display: block; height: 5px; border-radius: 99px; background: rgba(255,255,255,.16); overflow: hidden; }
.sbb-meter.big { height: 9px; }
.sbb-meter i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, #60a5fa, #93c5fd); }
.sbb-meter.green i { background: linear-gradient(90deg, #10b981, #6ee7b7); }
.sbb-tiles { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-top: 22px; }
.sbb-tile { display: flex; flex-direction: column; gap: 3px; padding: 14px 16px; border-radius: 12px; background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.1); border-top: 3px solid var(--c); backdrop-filter: blur(4px); min-width: 0; }
.sbb-tl { font-size: 10.5px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: rgba(255,255,255,.62); }
.sbb-tv { font-size: 24px; font-weight: 750; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; line-height: 1.15; }
.sbb-ts { font-size: 11.5px; color: rgba(255,255,255,.6); line-height: 1.35; }
.sbb-tile .sbb-meter { margin-top: 6px; }
.sbb-tile .sbb-meter i { background: var(--c); }
.sbb-dist { margin-top: 20px; }
.sb-banner .sb-hbar { height: 12px; }
.sbb-leg { display: flex; flex-wrap: wrap; gap: 6px 22px; margin-top: 12px; font-size: 12.5px; color: rgba(255,255,255,.85); }
.sbb-leg .dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 7px; }
.sbb-leg b { margin-left: 6px; font-weight: 700; font-variant-numeric: tabular-nums; }
.sbb-leg em { font-style: normal; opacity: .6; margin-left: 5px; }
@media (max-width: 1100px) { .sbb-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 860px) { .sbb-top { grid-template-columns: 1fr; gap: 20px; } .sb-banner { padding: 20px; } .sbb-count b { font-size: 42px; } }
@media (max-width: 640px) { .sb-banner { margin-left: 16px; margin-right: 16px; } .sbb-tiles { grid-template-columns: 1fr 1fr; } }

/* Southern Billing — professional cards */
.sb-group-label { margin: 0 24px 8px; font-size: 12.5px; font-weight: 650; color: var(--text, #0f172a); display: flex; align-items: baseline; gap: 8px; }
.sb-group-label small { font-weight: 500; font-size: 11.5px; color: var(--text-muted, #64748b); }
.sb-cards { grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)) !important; gap: 14px !important; margin-bottom: 18px !important; }
.sb-card { gap: 0 !important; padding: 14px 16px 12px !important; border: 1px solid var(--border, #e5e7eb) !important; border-top: 1px solid var(--border, #e5e7eb) !important; border-left: 4px solid var(--c) !important; border-radius: 14px !important; box-shadow: 0 1px 2px rgba(15,23,42,.05); background: var(--surface, #fff); }
.sb-card:hover { box-shadow: 0 8px 22px rgba(15,23,42,.1) !important; transform: translateY(-2px); }
.sb-card.active { box-shadow: 0 0 0 2px var(--c), 0 8px 22px rgba(15,23,42,.1) !important; background: color-mix(in srgb, var(--c) 6%, var(--surface, #fff)); }
.sb-card-top { display: flex; align-items: center; gap: 9px; margin-bottom: 10px; min-width: 0; }
.sb-card-ico { flex: none; width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; font-size: 13px; font-weight: 800; color: var(--c); background: color-mix(in srgb, var(--c) 14%, transparent); }
.sb-card-l { font-size: 12.5px !important; font-weight: 650 !important; color: var(--text, #0f172a); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-card-row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.sb-card-n { font-size: 28px !important; font-weight: 750 !important; letter-spacing: -0.03em; color: var(--text, #0f172a) !important; font-variant-numeric: tabular-nums; line-height: 1.1; }
.sb-card-p { font-size: 12px !important; font-weight: 700; color: var(--c) !important; background: color-mix(in srgb, var(--c) 12%, transparent); padding: 2px 8px; border-radius: 99px; }
.sb-card-meter { display: block; height: 5px; border-radius: 99px; background: var(--surface-2, #eef2f7); margin: 10px 0 8px; overflow: hidden; }
.sb-card-meter i { display: block; height: 100%; border-radius: 99px; background: var(--c); }
.sb-card-foot { font-size: 11.5px; color: var(--text-muted, #64748b); font-variant-numeric: tabular-nums; }
/* insight + money cards: same family */
.sb-ins { border-radius: 14px !important; border-left: 4px solid var(--teal, #0d9488) !important; box-shadow: 0 1px 2px rgba(15,23,42,.05); }
.sb-ins:nth-child(2) { border-left-color: var(--good, #059669) !important; }
.sb-ins:nth-child(3) { border-left-color: var(--critical, #dc2626) !important; }
.sb-ins:nth-child(4) { border-left-color: var(--primary, #4338ca) !important; }
.sb-kpis .detail-kpi { border-radius: 14px !important; box-shadow: 0 1px 2px rgba(15,23,42,.05); }
@media (max-width: 640px) { .sb-group-label { margin-left: 16px; margin-right: 16px; } }

/* Southern Billing — calmer spacing */
.sb-banner { margin-bottom: 14px; }
.sb-nav { margin-bottom: 12px; }
.sb-sec { margin-top: 8px; }
.sb-group-label:not(:first-of-type) { margin-top: 4px; }

.sb-cards6 { grid-template-columns: repeat(6, minmax(0, 1fr)) !important; }
@media (max-width: 1100px) { .sb-cards6 { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; } }
@media (max-width: 640px) { .sb-cards6 { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; } }

/* Southern Billing — filter panel */
.sb-filters { margin: 0 24px 16px; background: var(--surface, #fff); border: 1px solid var(--border, #e5e7eb); border-radius: 14px; padding: 14px 16px; box-shadow: 0 1px 2px rgba(15,23,42,.05); }
.sb-frow { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.sb-search { flex: 1 1 280px; min-width: 220px; position: relative; display: block; }
.sb-search svg { position: absolute; left: 13px; top: 50%; width: 17px; height: 17px; transform: translateY(-50%); fill: none; stroke: var(--text-muted, #64748b); stroke-width: 2; stroke-linecap: round; pointer-events: none; }
.sb-search input { width: 100%; height: 42px; box-sizing: border-box; padding: 0 14px 0 40px; border: 1px solid var(--border, #e5e7eb); border-radius: 10px; font: inherit; font-size: 13.5px; background: var(--surface-2, #f8fafc); color: inherit; transition: border-color .15s, box-shadow .15s, background .15s; }
.sb-search input:focus { outline: none; background: var(--surface, #fff); border-color: var(--primary, #4f46e5); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary, #4f46e5) 16%, transparent); }
.sb-fsel { display: flex; flex-direction: column; gap: 4px; min-width: 150px; }
.sb-fsel span { font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-muted, #64748b); }
.sb-fsel select { height: 42px; box-sizing: border-box; padding: 0 12px; border: 1px solid var(--border, #e5e7eb); border-radius: 10px; font: inherit; font-size: 13.5px; background: var(--surface-2, #f8fafc); color: inherit; cursor: pointer; }
.sb-fsel select:focus { outline: none; border-color: var(--primary, #4f46e5); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary, #4f46e5) 16%, transparent); }
.sb-factions { display: flex; align-items: center; gap: 14px; margin-left: auto; height: 42px; }
.sb-fcount { font-size: 12.5px; color: var(--text-muted, #64748b); white-space: nowrap; }
.sb-fcount b { color: var(--text, #0f172a); font-size: 14px; }
.sb-fbtn { height: 38px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--primary, #4f46e5); background: transparent; color: var(--primary, #4f46e5); font: inherit; font-size: 13px; font-weight: 650; cursor: pointer; white-space: nowrap; transition: background .15s, color .15s; }
.sb-fbtn:hover { background: var(--primary, #4f46e5); color: #fff; }
.sb-fchips { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--border, #e5e7eb); }
.sb-fl { font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-muted, #64748b); margin-right: 2px; }
.sb-fchip { display: inline-flex; align-items: center; gap: 7px; padding: 4px 6px 4px 11px; border-radius: 99px; font-size: 12.5px; font-weight: 600; background: color-mix(in srgb, var(--primary, #4f46e5) 10%, transparent); color: var(--primary, #4f46e5); border: 1px solid color-mix(in srgb, var(--primary, #4f46e5) 25%, transparent); }
.sb-fchip em { font-style: normal; font-weight: 500; opacity: .7; }
.sb-fchip button { border: 0; width: 18px; height: 18px; border-radius: 50%; cursor: pointer; font-size: 10px; line-height: 1; background: rgba(0,0,0,.1); color: inherit; }
.sb-fchip button:hover { background: rgba(0,0,0,.2); }
.sb-flink { border: 0; background: none; color: var(--text-muted, #64748b); font: inherit; font-size: 12.5px; font-weight: 600; text-decoration: underline; cursor: pointer; padding: 4px 6px; }
.sb-flink:hover { color: var(--text, #0f172a); }
@media (max-width: 760px) { .sb-filters { margin: 0 16px 16px; } .sb-factions { margin-left: 0; width: 100%; justify-content: space-between; } .sb-fsel { flex: 1 1 140px; } }

/* AR-status cards: Total billed + one per status */
.sb-cards6 { grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)) !important; }
.sb-card-total { cursor: default; background: color-mix(in srgb, var(--c) 7%, var(--surface, #fff)) !important; }
.sb-card-total:hover { transform: none; }

/* Compact AR-status cards */
.sb-cards, .sb-cards6 { grid-template-columns: repeat(auto-fill, minmax(138px, 1fr)) !important; gap: 10px !important; margin-bottom: 14px !important; }
.sb-card { padding: 9px 11px 8px !important; border-radius: 10px !important; border-left-width: 3px !important; box-shadow: none !important; }
.sb-card-top { gap: 6px !important; margin-bottom: 4px !important; }
.sb-card-ico { width: 18px !important; height: 18px !important; border-radius: 6px !important; font-size: 9px !important; }
.sb-card-l { font-size: 11.5px !important; font-weight: 600 !important; color: var(--text-muted, #64748b) !important; }
.sb-card-n { font-size: 20px !important; font-weight: 700 !important; }
.sb-card-p { font-size: 10.5px !important; padding: 1px 6px !important; }
.sb-card-meter { height: 3px !important; margin: 6px 0 5px !important; }
.sb-card-foot { font-size: 10.5px !important; }
.sb-card:hover { transform: none !important; box-shadow: 0 2px 8px rgba(15,23,42,.08) !important; }

/* Comprehensive filter grid */
.sb-fgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border, #e5e7eb); }
.sb-fgrid .sb-fsel { min-width: 0; }
.sb-fsel input[type=date] { height: 42px; box-sizing: border-box; padding: 0 10px; border: 1px solid var(--border, #e5e7eb); border-radius: 10px; font: inherit; font-size: 13.5px; background: var(--surface-2, #f8fafc); color: inherit; }
.sb-fsel input[type=date]:focus { outline: none; border-color: var(--primary, #4f46e5); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary, #4f46e5) 16%, transparent); }
.sb-fsel select { width: 100%; }
.sb-search { flex: 1 1 320px; }

/* Filter panel v3: header, grouped fields */
.sb-filters { padding: 0 !important; overflow: hidden; }
.sbf-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 12px 18px; background: var(--surface-2, #f8fafc); border-bottom: 1px solid var(--border, #e5e7eb); }
.sbf-title { display: flex; align-items: center; gap: 9px; font-size: 14px; }
.sbf-title svg { width: 16px; height: 16px; fill: none; stroke: var(--primary, #4f46e5); stroke-width: 2; stroke-linejoin: round; }
.sbf-badge { font-size: 11px; font-weight: 700; padding: 2px 9px; border-radius: 99px; background: var(--primary, #4f46e5); color: #fff; }
.sbf-actions { display: flex; align-items: center; gap: 14px; }
.sbf-actions .sb-fbtn { height: 34px; padding: 0 14px; }
.sb-filters > .sb-search { display: block; margin: 14px 18px 0; flex: none; }
.sbf-groups { display: grid; grid-template-columns: 1.25fr 1fr 1fr; gap: 0; margin-top: 14px; border-top: 1px solid var(--border, #e5e7eb); }
.sbf-group { padding: 14px 18px 16px; }
.sbf-group + .sbf-group { border-left: 1px solid var(--border, #e5e7eb); }
.sbf-group h4 { margin: 0 0 10px; font-size: 11px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--text-muted, #64748b); }
.sbf-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }
.sbf-group .sb-fsel span { font-size: 11px; letter-spacing: 0; text-transform: none; font-weight: 600; color: var(--text, #0f172a); }
.sbf-group .sb-fsel select, .sbf-group .sb-fsel input[type=date] { height: 36px; font-size: 13px; border-radius: 8px; }
.sbf-group .sb-fsel select { appearance: none; -webkit-appearance: none; padding-right: 28px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' fill='none' stroke='%2364748b' stroke-width='1.8'%3E%3Cpath d='m1 1 4 4 4-4'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; text-overflow: ellipsis; }
.sb-filters .sb-fchips { margin: 0; padding: 10px 18px 12px; border-top: 1px solid var(--border, #e5e7eb); background: var(--surface-2, #f8fafc); }
@media (max-width: 1000px) { .sbf-groups { grid-template-columns: 1fr; } .sbf-group + .sbf-group { border-left: 0; border-top: 1px solid var(--border, #e5e7eb); } }
.sbf-group:first-child .sbf-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.sbf-group .sb-fsel { min-width: 0; }
.sbf-group .sb-fsel input[type=date] { width: 100%; }

/* Claims table v2 */
.sbt-total { font-size: 12.5px; color: var(--text-muted, #64748b); white-space: nowrap; align-self: center; }
.sbt-total b { color: var(--text, #0f172a); font-size: 14px; }
.sbt-wrap { max-height: 640px; overflow: auto; border: 1px solid var(--border, #e5e7eb); border-radius: 12px; margin: 0 !important; }
table.sbt { width: 100%; border-collapse: separate; border-spacing: 0; }
.sbt thead th { position: sticky; top: 0; z-index: 2; background: var(--surface-2, #f8fafc); font-size: 11px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--text-muted, #64748b); padding: 11px 14px; border-bottom: 1px solid var(--border, #e5e7eb); text-align: left; }
.sbt thead th:nth-child(n+6):nth-child(-n+8) { text-align: right !important; }
.sbt td.sbt-date { white-space: nowrap; font-variant-numeric: tabular-nums; color: var(--text, #0f172a); font-weight: 550; font-size: 12.5px; width: 1%; }
.sbt tbody td { padding: 11px 14px; border-bottom: 1px solid var(--border, #eef2f7); vertical-align: middle; }
.sbt tbody tr:nth-child(even) td { background: color-mix(in srgb, var(--surface-2, #f8fafc) 55%, transparent); }
.sbt tbody tr:last-child td { border-bottom: 0; }
.sbt td b { display: block; font-weight: 650; color: var(--text, #0f172a); }
.sbt .sb-sub { display: block; font-size: 11.5px; font-weight: 500; color: var(--text-muted, #64748b); margin-top: 2px; white-space: nowrap; }
.sbt td.sbt-st { white-space: nowrap; }
.sbt td.sbt-st .sb-sub { margin-top: 4px; }
.sbt td.sbt-date { font-variant-numeric: tabular-nums; color: var(--text-muted, #64748b); font-size: 12.5px; }
.sbt td.sbt-num { text-align: right !important; font-variant-numeric: tabular-nums; font-weight: 600; }
.sbt td.sbt-pay { color: #047857; }
.sbt td.sb-reason { max-width: 280px; font-size: 12px; line-height: 1.4; }
.sbt tr.sb-click:hover td { background: color-mix(in srgb, var(--primary, #4f46e5) 7%, transparent); }
.sbt th.sorted { color: var(--primary, #4f46e5); }
.sb-claims .sb-pager { display: flex; justify-content: space-between; align-items: center; padding: 12px 4px 0; }
.sbt-range { font-size: 12.5px; color: var(--text-muted, #64748b); }
.sbt-pg { display: flex; align-items: center; gap: 12px; font-size: 12.5px; }
.sbt thead th, .sbt tbody td { text-align: left !important; }
.sbt thead th:nth-child(5), .sbt thead th:nth-child(6), .sbt thead th:nth-child(7), .sbt td.sbt-num { text-align: right !important; }

/* Summary: break-down switch (replaces separate Locations/Payers/Billers tabs) */
.sb-by { display: flex; align-items: center; gap: 12px; margin: 4px 24px 12px; flex-wrap: wrap; }
.sb-by-l { font-size: 11px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--text-muted, #64748b); }
.sb-by-seg { display: inline-flex; gap: 3px; padding: 3px; background: var(--surface-2, #f1f5f9); border: 1px solid var(--border, #e5e7eb); border-radius: 10px; }
.sb-by-seg button { border: 0; background: transparent; font: inherit; font-size: 12.5px; font-weight: 600; color: var(--text-muted, #64748b); padding: 6px 13px; border-radius: 8px; cursor: pointer; }
.sb-by-seg button:hover { color: var(--text, #0f172a); }
.sb-by-seg button.on { background: var(--surface, #fff); color: var(--primary, #4338ca); box-shadow: 0 1px 3px rgba(15,23,42,.12); }

/* Slim bar replaces the filter panel */
.sb-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 0 24px 14px; }
.sb-bar .sb-search { flex: 1 1 280px; max-width: 460px; margin: 0; }
.sb-bar .sb-fchips { margin: 0; padding: 0; border: 0; background: none; flex: 1 1 auto; }
.sb-bar .sbf-actions { margin-left: auto; }

/* One toolbar: tabs · break-down · count + export */
.sb-toolbar { display: flex; align-items: center; gap: 14px 22px; flex-wrap: wrap; margin: 0 24px 14px; }
.sb-toolbar .sb-nav { margin: 0 !important; }
.sb-toolbar .sb-by { margin: 0; }
.sb-toolbar .sbf-actions { margin-left: auto; }
.sb-bar { margin-top: -2px; }
@media (max-width: 640px) { .sb-toolbar { margin: 0 16px 14px; } }

.sb-cardhead { display: flex; align-items: center; justify-content: space-between; gap: 10px 20px; flex-wrap: wrap; margin: 0 24px 8px; }
.sb-cardhead .sb-group-label { margin: 0 !important; }
.sb-cardhead .sb-by { margin: 0; }

.sb-click.sb-sel td { background: color-mix(in srgb, var(--primary, #4f46e5) 10%, transparent) !important; }
.sb-click.sb-sel td:first-child { box-shadow: inset 3px 0 0 var(--primary, #4f46e5); }

/* Overview > Location Summary: outcome & payer details */
.loc-insights { margin-top: 22px; padding-top: 20px; border-top: 1px solid var(--border, #e5e7eb); }
.li-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; }
.li-head h4 { margin: 0; font-size: 16px; font-weight: 700; }
.li-head p { margin: 3px 0 0; font-size: 12.5px; color: var(--text-muted, #64748b); }
.li-pick { display: flex; flex-direction: column; gap: 4px; min-width: 240px; }
.li-pick span { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-muted, #64748b); }
.li-pick select { height: 38px; padding: 0 12px; border: 1px solid var(--border, #e5e7eb); border-radius: 9px; font: inherit; font-size: 13px; background: var(--surface-2, #f8fafc); color: inherit; }
.li-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-bottom: 14px; }
.li-k { background: var(--surface, #fff); border: 1px solid var(--border, #e5e7eb); border-left: 4px solid var(--primary, #4f46e5); border-radius: 12px; padding: 12px 15px; display: flex; flex-direction: column; gap: 2px; }
.li-k span { font-size: 11.5px; font-weight: 650; color: var(--text-muted, #64748b); }
.li-k b { font-size: 26px; font-weight: 750; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.li-k em { font-style: normal; font-size: 12px; color: var(--text-muted, #64748b); }
.li-k-good { border-left-color: var(--good, #059669); } .li-k-bad { border-left-color: var(--critical, #dc2626); } .li-k-warn { border-left-color: var(--warning, #d97706); }
.li-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 12px; margin-bottom: 12px; }
.li-card { background: var(--surface, #fff); border: 1px solid var(--border, #e5e7eb); border-radius: 12px; padding: 14px 16px; }
.li-card h5 { margin: 0 0 12px; font-size: 11px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--text-muted, #64748b); }
.li-reason { display: grid; grid-template-columns: minmax(120px, 1.6fr) minmax(60px, 1fr) 34px 44px; gap: 10px; align-items: center; padding: 5px 0; font-size: 12.5px; }
.li-rl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.li-rbar { height: 6px; border-radius: 99px; background: var(--surface-2, #eef2f7); overflow: hidden; }
.li-rbar i { display: block; height: 100%; background: var(--warning, #d97706); border-radius: 99px; }
.li-reason b { text-align: right; font-variant-numeric: tabular-nums; } .li-reason em { font-style: normal; color: var(--text-muted, #64748b); text-align: right; font-size: 11.5px; }
.li-none { color: var(--text-muted, #64748b); font-size: 13px; padding: 10px 0; }
.li-calls { display: grid; gap: 10px; }
.li-call { display: flex; flex-direction: column; gap: 2px; padding: 10px 13px; border-radius: 10px; border: 1px solid var(--border, #e5e7eb); }
.li-call span { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted, #64748b); }
.li-call b { font-size: 15px; } .li-call em { font-style: normal; font-size: 12px; color: var(--text-muted, #64748b); }
.li-call-good { background: color-mix(in srgb, var(--good, #059669) 8%, transparent); } .li-call-bad { background: color-mix(in srgb, var(--critical, #dc2626) 8%, transparent); }
.li-wide { margin-top: 0; }
.li-table td.li-name, .li-table th:first-child { text-align: left !important; font-weight: 600; }
.li-table td { font-variant-numeric: tabular-nums; }
.li-good { color: #047857; font-weight: 700; } .li-bad { color: #b91c1c; font-weight: 700; } .li-warn { color: #b45309; font-weight: 700; } .li-zero { color: var(--text-dim, #94a3b8); }
@media (max-width: 900px) { .li-grid { grid-template-columns: 1fr; } }

/* Location summary v2 */
#overviewLocationPanel { padding: 0 !important; overflow: hidden; }
#overviewLocationPanel .gs-head { display: flex; align-items: center; gap: 14px; padding: 18px 22px 4px; }
#overviewLocationPanel .gs-ico { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; font-size: 18px; background: color-mix(in srgb, var(--teal, #0d9488) 14%, transparent); }
#overviewLocationPanel .gs-head h3 { margin: 0; font-size: 17px; font-weight: 700; }
#overviewLocationPanel .gs-head p { margin: 2px 0 0; font-size: 12.5px; color: var(--text-muted, #64748b); }
#overviewLocationPanel .table-toolbar { padding: 14px 22px 12px !important; }
#overviewLocationPanel .table-wrap { margin: 0 22px !important; max-height: 520px; overflow: auto; border: 1px solid var(--border, #e5e7eb); border-radius: 12px; }
#locTable { border-collapse: separate; border-spacing: 0; width: 100%; }
#locTable thead th { position: sticky; top: 0; z-index: 3; background: var(--surface-2, #f8fafc); font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted, #64748b); padding: 11px 12px; border-bottom: 1px solid var(--border, #e5e7eb); white-space: nowrap; }
#locTable thead th:first-child, #locTable tbody td:first-child { position: sticky; left: 0; z-index: 2; text-align: left !important; min-width: 220px; max-width: 260px; }
#locTable thead th:first-child { z-index: 4; }
#locTable tbody td { padding: 10px 12px; border-bottom: 1px solid var(--border, #eef2f7); font-variant-numeric: tabular-nums; background: var(--surface, #fff); white-space: nowrap; }
#locTable tbody tr:nth-child(even) td { background: color-mix(in srgb, var(--surface-2, #f8fafc) 70%, var(--surface, #fff)); }
#locTable tbody tr:last-child td { border-bottom: 0; }
#locTable td.gs-name { font-weight: 650; overflow: hidden; text-overflow: ellipsis; box-shadow: 1px 0 0 var(--border, #e5e7eb); }
#locTable td.gs-zero { color: var(--text-dim, #cbd5e1); }
#locTable td.gs-total { font-weight: 700; }
#locTable td.gs-strong { font-weight: 700; color: #047857; }
#locTable tbody tr { cursor: pointer; }
#locTable tbody tr:hover td { background: color-mix(in srgb, var(--primary, #4f46e5) 7%, var(--surface, #fff)); }
#locTable tbody tr.gs-sel td { background: color-mix(in srgb, var(--primary, #4f46e5) 12%, var(--surface, #fff)); }
#locTable tbody tr.gs-sel td:first-child { box-shadow: inset 3px 0 0 var(--primary, #4f46e5), 1px 0 0 var(--border, #e5e7eb); }
#overviewLocationPanel .loc-insights { margin: 22px 0 0; padding: 20px 22px 22px; border-top: 1px solid var(--border, #e5e7eb); background: var(--surface-2, #f8fafc); }
.loc-insights .li-card, .loc-insights .li-k { box-shadow: 0 1px 2px rgba(15,23,42,.04); }
.loc-insights .li-table thead th { background: var(--surface-2, #f8fafc); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted, #64748b); }
.loc-insights .li-table tbody tr:hover td { background: color-mix(in srgb, var(--primary, #4f46e5) 5%, transparent); }

/* Payer group summary: same treatment as the location summary */
#overviewInsurancePanel { padding: 0 !important; overflow: hidden; }
#overviewInsurancePanel .gs-head { display: flex; align-items: center; gap: 14px; padding: 18px 22px 4px; }
#overviewInsurancePanel .gs-ico { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; font-size: 18px; background: color-mix(in srgb, var(--violet, #7c3aed) 14%, transparent); }
#overviewInsurancePanel .gs-head h3 { margin: 0; font-size: 17px; font-weight: 700; }
#overviewInsurancePanel .gs-head p { margin: 2px 0 0; font-size: 12.5px; color: var(--text-muted, #64748b); }
#overviewInsurancePanel .table-toolbar { padding: 14px 22px 12px !important; }
#overviewInsurancePanel .table-wrap { margin: 0 22px 22px !important; max-height: 520px; overflow: auto; border: 1px solid var(--border, #e5e7eb); border-radius: 12px; }
#insTable { border-collapse: separate; border-spacing: 0; width: 100%; }
#insTable thead th { position: sticky; top: 0; z-index: 3; background: var(--surface-2, #f8fafc); font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted, #64748b); padding: 11px 12px; border-bottom: 1px solid var(--border, #e5e7eb); white-space: nowrap; }
#insTable thead th:first-child, #insTable tbody td:first-child { position: sticky; left: 0; z-index: 2; text-align: left !important; min-width: 200px; max-width: 260px; }
#insTable thead th:first-child { z-index: 4; }
#insTable tbody td { padding: 10px 12px; border-bottom: 1px solid var(--border, #eef2f7); font-variant-numeric: tabular-nums; background: var(--surface, #fff); white-space: nowrap; }
#insTable tbody tr:nth-child(even) td { background: color-mix(in srgb, var(--surface-2, #f8fafc) 70%, var(--surface, #fff)); }
#insTable tbody tr:last-child td { border-bottom: 0; }
#insTable td.gs-name { font-weight: 650; overflow: hidden; text-overflow: ellipsis; box-shadow: 1px 0 0 var(--border, #e5e7eb); }
#insTable td.gs-zero { color: var(--text-dim, #cbd5e1); }
#insTable td.gs-total { font-weight: 700; }
#insTable td.gs-strong { font-weight: 700; color: #047857; }
#insTable tbody tr:hover td { background: color-mix(in srgb, var(--violet, #7c3aed) 7%, var(--surface, #fff)); }

.li-k-info { border-left-color: var(--teal, #0d9488); }
.li-info { color: #0f766e; font-weight: 700; }
.li-table .li-sub { display: block; font-size: 11px; font-weight: 500; color: var(--text-muted, #64748b); margin-top: 2px; }
.li-table tr.li-plan td { background: color-mix(in srgb, var(--violet, #7c3aed) 4%, transparent); font-size: 12.5px; }
.li-table tr.li-plan td.li-name { padding-left: 30px; font-weight: 500; position: relative; }
.li-table tr.li-plan td.li-name::before { content: '↳'; position: absolute; left: 14px; color: var(--text-dim, #94a3b8); }

/* Overview dashboard */
.ov-dash { margin: 0 24px 16px; display: flex; flex-direction: column; gap: 14px; }
.ov-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.ov-kpi { text-align: left; font: inherit; color: inherit; background: var(--surface, #fff); border: 1px solid var(--border, #e5e7eb); border-top: 3px solid var(--c); border-radius: 14px; padding: 14px 16px 13px; display: flex; flex-direction: column; gap: 3px; box-shadow: 0 1px 2px rgba(15,23,42,.05); }
.ov-kpi-link { cursor: pointer; transition: box-shadow .15s, transform .15s; }
.ov-kpi-link:hover { box-shadow: 0 8px 22px rgba(15,23,42,.1); transform: translateY(-2px); }
.ov-kl { font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted, #64748b); }
.ov-kv { font-size: 30px; font-weight: 750; letter-spacing: -.03em; font-variant-numeric: tabular-nums; line-height: 1.15; }
.ov-ks { font-size: 12px; color: var(--text-muted, #64748b); min-height: 30px; line-height: 1.35; }
.ov-km { display: block; height: 4px; border-radius: 99px; background: var(--surface-2, #eef2f7); overflow: hidden; margin-top: 4px; }
.ov-km i { display: block; height: 100%; background: var(--c); border-radius: 99px; }
.ov-card { background: var(--surface, #fff); border: 1px solid var(--border, #e5e7eb); border-radius: 14px; padding: 16px 18px; box-shadow: 0 1px 2px rgba(15,23,42,.05); min-width: 0; }
.ov-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.ov-card-head h3 { margin: 0; font-size: 14px; font-weight: 700; }
.ov-card-head span { font-size: 12px; color: var(--text-muted, #64748b); }
.ov-link { border: 0; background: none; font: inherit; font-size: 12.5px; font-weight: 650; color: var(--primary, #4f46e5); cursor: pointer; padding: 0; }
.ov-link:hover { text-decoration: underline; }
.ov-stack { display: flex; height: 16px; border-radius: 99px; overflow: hidden; background: var(--surface-2, #eef2f7); gap: 2px; }
.ov-stack i { display: block; height: 100%; }
.ov-legend { display: flex; flex-wrap: wrap; gap: 8px 22px; margin-top: 14px; font-size: 12.5px; }
.ov-legend span { display: inline-flex; align-items: center; gap: 7px; color: var(--text-muted, #64748b); }
.ov-legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.ov-legend b { color: var(--text, #0f172a); font-variant-numeric: tabular-nums; } .ov-legend em { font-style: normal; font-size: 11.5px; }
.ov-cols { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.ov-rank { padding: 7px 0; border-bottom: 1px solid var(--border, #eef2f7); }
.ov-rank:last-child { border-bottom: 0; }
.ov-rtop { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; }
.ov-rname { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ov-rtop b { font-variant-numeric: tabular-nums; }
.ov-rbar { display: block; height: 5px; border-radius: 99px; background: var(--surface-2, #eef2f7); margin: 6px 0 4px; overflow: hidden; }
.ov-rbar i { display: block; height: 100%; border-radius: 99px; }
.ov-rsub { font-size: 11.5px; color: var(--text-muted, #64748b); }
.ov-good { color: #047857; font-weight: 600; } .ov-bad { color: #b91c1c; font-weight: 600; } .ov-warn { color: #b45309; font-weight: 600; }
.ov-none { color: var(--text-muted, #64748b); font-size: 13px; padding: 8px 0; }
@media (max-width: 1000px) { .ov-cols { grid-template-columns: 1fr; } }
@media (max-width: 640px) { .ov-dash { margin: 0 16px 16px; } }
/* segmented breakdown picker */
.ov-seg { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; background: var(--surface-2, #f1f5f9); border: 1px solid var(--border, #e5e7eb); border-radius: 12px; margin-top: 12px; }
.ov-seg .flash-card { all: unset; box-sizing: border-box; cursor: pointer; display: inline-flex; align-items: center; gap: 9px; padding: 8px 14px; border-radius: 9px; font-size: 13px; font-weight: 600; color: var(--text-muted, #64748b); }
.ov-seg .flash-card:hover { color: var(--text, #0f172a); background: rgba(255,255,255,.6); }
.ov-seg .flash-card.active { background: var(--surface, #fff); color: var(--primary, #4338ca); box-shadow: 0 1px 3px rgba(15,23,42,.12); }
.ovs-count { font-size: 11.5px; font-weight: 700; padding: 1px 8px; border-radius: 99px; background: rgba(100,116,139,.15); color: var(--text-muted, #64748b); }
.flash-card.active .ovs-count { background: var(--primary, #4338ca); color: #fff; }
.overview-summary-picker .summary-picker-head { align-items: flex-start; }

/* Overview: attractive pass */
#tab-overview > .pay-head { display: none; }
#tab-overview > .kpi-grid { display: none !important; }
.ov-dash .ov-hero { margin: 0; }
.ov-kpi { background: linear-gradient(180deg, color-mix(in srgb, var(--c) 7%, var(--surface, #fff)), var(--surface, #fff) 60%); border-top-width: 1px; border-left: 4px solid var(--c); }
.ov-kt { display: flex; align-items: center; gap: 9px; margin-bottom: 4px; }
.ov-ki { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; font-size: 13px; font-weight: 800; color: var(--c); background: color-mix(in srgb, var(--c) 15%, transparent); }
.ov-kv { color: var(--text, #0f172a); }
.ov-card { border-radius: 16px; }
.ov-card-head { padding-bottom: 12px; border-bottom: 1px solid var(--border, #eef2f7); }
.ov-donutwrap { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 32px; align-items: center; }
.ov-donut { width: 170px; height: 170px; border-radius: 50%; display: grid; place-items: center; box-shadow: 0 6px 18px rgba(15,23,42,.1); }
.ov-donut-in { width: 112px; height: 112px; border-radius: 50%; background: var(--surface, #fff); display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ov-donut-in b { font-size: 26px; font-weight: 800; letter-spacing: -.02em; } .ov-donut-in span { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-muted, #64748b); }
.ov-legend { display: flex; flex-direction: column; gap: 9px; margin: 0; }
.ov-lrow { display: grid; grid-template-columns: 12px minmax(120px, 170px) minmax(60px, 1fr) 54px 42px; align-items: center; gap: 12px; font-size: 13px; }
.ov-lrow > i { width: 10px; height: 10px; border-radius: 3px; }
.ov-lrow > span { color: var(--text, #0f172a); font-weight: 600; }
.ov-lbar { height: 7px; border-radius: 99px; background: var(--surface-2, #eef2f7); overflow: hidden; }
.ov-lbar u { display: block; height: 100%; border-radius: 99px; }
.ov-lrow b { text-align: right; font-variant-numeric: tabular-nums; } .ov-lrow em { font-style: normal; color: var(--text-muted, #64748b); font-size: 12px; text-align: right; }
.ov-rtop { align-items: center; }
.ov-rn { width: 20px; height: 20px; border-radius: 6px; display: grid; place-items: center; font-size: 11px; font-weight: 700; background: var(--surface-2, #eef2f7); color: var(--text-muted, #64748b); flex: none; }
.ov-rtop .ov-rname { flex: 1; margin-left: 10px; }
.ov-rbar { margin-left: 30px; } .ov-rsub { margin-left: 30px; display: block; }
@media (max-width: 720px) { .ov-donutwrap { grid-template-columns: 1fr; justify-items: center; } .ov-lrow { grid-template-columns: 12px 1fr 54px 42px; } .ov-lbar { display: none; } }

/* Overview look carried to the other tabs */
.tab-hero { margin: 0 24px 16px; }
.tab-hero .sb-banner { margin: 0; }
.tab-hero .sbb-count b { font-size: 48px; }
.tab-hero .sbb-tv { font-size: 21px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tab-hero .sbb-ts { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#tab-exceptions > .pay-head, #tab-denied > .pay-head, #tab-charts > .pay-head, #tab-dataed > .pay-head, #tab-records > .pay-head { display: none; }
#tab-ar > .pay-head > div:first-child, #tab-payment > .pay-head > div:first-child { display: none; }
#tab-ar > .pay-head, #tab-payment > .pay-head { justify-content: flex-end; }
#deniedHero { display: none; }
/* KPI cards everywhere: same colour-edge look as the Overview */
.detail-kpi { background: linear-gradient(180deg, color-mix(in srgb, var(--c, var(--primary)) 7%, var(--surface, #fff)), var(--surface, #fff) 65%) !important; border: 1px solid var(--border, #e5e7eb) !important; border-left: 4px solid var(--c, var(--primary)) !important; border-radius: 14px !important; box-shadow: 0 1px 2px rgba(15,23,42,.05); }
.detail-kpi .dk-label { font-weight: 700; letter-spacing: .06em; text-transform: uppercase; font-size: 11px; color: var(--text-muted, #64748b); }
.chart-card, .pay-card { border-radius: 16px; }
.ar-view-btn.active { box-shadow: 0 1px 3px rgba(15,23,42,.12); }

/* ---- Southern Billing → Reports ---- */
.rp-top{display:flex;justify-content:space-between;align-items:center;gap:12px;flex-wrap:wrap;margin-bottom:14px}
.rp-nav{display:inline-flex;gap:4px;padding:4px;background:var(--surface-2,rgba(127,127,127,.1));border-radius:12px}
.rp-navbtn{border:0;background:transparent;padding:7px 16px;border-radius:9px;font-weight:600;font-size:13px;color:var(--text-dim);cursor:pointer}
.rp-navbtn.on{background:var(--primary);color:#fff}
.rp-acts{display:flex;gap:8px}
.rp-btn{border:1px solid var(--primary);background:var(--primary);color:#fff;padding:7px 14px;border-radius:9px;font-size:12.5px;font-weight:600;cursor:pointer}
.rp-btn.ghost{background:transparent;color:var(--text);border-color:var(--border,rgba(127,127,127,.3))}
.rp-btn:disabled{opacity:.4;cursor:default}
.rp-period{display:flex;align-items:flex-end;gap:10px;flex-wrap:wrap;margin-bottom:14px}
.rp-period>b{font-size:15px;align-self:center}
.rp-f{display:flex;flex-direction:column;gap:3px;font-size:11px;color:var(--text-dim);text-transform:uppercase;letter-spacing:.04em}
.rp-f select,.rp-f input{padding:6px 8px;border-radius:8px;border:1px solid var(--border,rgba(127,127,127,.3));background:var(--surface,transparent);color:var(--text);font-size:13px;text-transform:none}
.rp-kpis{display:grid;grid-template-columns:repeat(auto-fill,minmax(170px,1fr));gap:10px;margin-bottom:16px}
.rp-kpi{padding:12px 14px;border-radius:12px;border:1px solid var(--border,rgba(127,127,127,.2));border-left:4px solid var(--primary);background:var(--surface,transparent)}
.rp-kpi.bad{border-left-color:var(--critical)}.rp-kpi.mute{border-left-color:var(--text-dim)}
.rp-kpi span{display:block;font-size:11.5px;color:var(--text-dim);text-transform:uppercase;letter-spacing:.04em}
.rp-kpi b{display:block;font-size:21px;margin:3px 0}
.rp-kpi em{font-style:normal;font-size:11.5px;color:var(--text-dim)}
.rp-sec{margin-bottom:20px}.rp-sec h3{font-size:14px;margin:0 0 8px}
.rp-var.up{color:var(--good)}.rp-var.dn{color:var(--critical)}
.rp-table td.num,.rp-table th.num{text-align:right;font-variant-numeric:tabular-nums}
.rp-table tfoot td{font-weight:700;border-top:2px solid var(--border,rgba(127,127,127,.3))}
.rp-empty,.rp-note{padding:12px 14px;border-radius:10px;background:var(--surface-2,rgba(127,127,127,.08));color:var(--text-dim);font-size:13px;margin-bottom:12px}
.rp-foot{font-size:11.5px;color:var(--text-dim)}
.rp-printhead{display:none}
@media print{
  body.rp-printing > *:not(.app-shell):not(main){}
  body.rp-printing .sidebar,body.rp-printing header,body.rp-printing nav,body.rp-printing .tabs,body.rp-printing .sb-banner,body.rp-printing .sb-toolbar,body.rp-printing .pay-head,body.rp-printing .rp-top,body.rp-printing .rp-period,body.rp-printing .sb-cardhead,body.rp-printing #tabs{display:none!important}
  body.rp-printing .rp-printhead{display:block;margin-bottom:12px}
  body.rp-printing{background:#fff!important;color:#000!important}
}

/* ---- Southern Billing → Payments ---- */
.spy{padding:0 24px 24px;display:flex;flex-direction:column;gap:16px}
.spy-hero{display:flex;gap:28px;align-items:center;justify-content:space-between;flex-wrap:wrap;padding:22px 26px;border-radius:18px;color:#fff;background:linear-gradient(135deg,#0f172a,#1e3a8a 60%,#0e7490)}
.spy-eye{display:block;font-size:11.5px;letter-spacing:.12em;text-transform:uppercase;opacity:.7}
.spy-big{display:block;font-size:38px;line-height:1.1;margin:4px 0;font-variant-numeric:tabular-nums}
.spy-lbl{font-size:13px;opacity:.8}
.spy-split{flex:1;min-width:260px;max-width:460px}
.spy-bar{display:flex;height:12px;border-radius:99px;overflow:hidden;background:rgba(255,255,255,.15)}
.spy-bar i,.spy-leg i{display:inline-block}.spy-bar i.ins,.spy-leg i.ins,.spy-col i.ins{background:#34d399}.spy-bar i.pt,.spy-leg i.pt,.spy-col i.pt{background:#fbbf24}
.spy-leg{display:flex;gap:18px;flex-wrap:wrap;margin-top:10px;font-size:12.5px}
.spy-leg i{width:9px;height:9px;border-radius:50%;margin-right:6px}.spy-leg em{font-style:normal;opacity:.7}
.spy-kpis{display:grid;grid-template-columns:repeat(auto-fit,minmax(170px,1fr));gap:12px}
.spy-k{padding:14px 16px;border-radius:14px;background:var(--surface,#fff);border:1px solid var(--border,#e5e7eb);border-top:3px solid var(--c,var(--primary))}
.spy-k.g{--c:var(--good)}.spy-k.a{--c:var(--warning)}.spy-k.t{--c:var(--teal)}.spy-k.p{--c:var(--violet)}.spy-k.r{--c:var(--critical)}
.spy-k span{display:block;font-size:11px;font-weight:700;letter-spacing:.07em;text-transform:uppercase;color:var(--text-muted,#64748b)}
.spy-k b{display:block;font-size:24px;margin:4px 0 2px;font-variant-numeric:tabular-nums}.spy-k em{font-style:normal;font-size:12px;color:var(--text-muted,#64748b)}
.spy-card{padding:16px 18px;border-radius:16px;background:var(--surface,#fff);border:1px solid var(--border,#e5e7eb)}
.spy-card h4{margin:0 0 12px;font-size:14.5px}.spy-card h4 small{font-weight:500;font-size:12px;color:var(--text-muted,#64748b);margin-left:8px}
.spy-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(460px,1fr));gap:16px}
.spy-t{width:100%;border-collapse:collapse;font-size:13px}
.spy-t th{font-size:10.5px;letter-spacing:.07em;text-transform:uppercase;color:var(--text-muted,#64748b);text-align:left;padding:8px 10px;border-bottom:1px solid var(--border,#e5e7eb)}
.spy-t td{padding:9px 10px;border-bottom:1px solid var(--border,#eef2f7);vertical-align:middle}
.spy-t tr:last-child td{border-bottom:0}.spy-t .num{text-align:right;font-variant-numeric:tabular-nums}.spy-t td.nw{white-space:nowrap}
.spy-t tbody tr:hover td{background:color-mix(in srgb,var(--primary) 6%,transparent)}
.spy-share{display:flex;align-items:center;gap:8px;min-width:110px}.spy-share span{flex:1;height:7px;border-radius:9px;background:var(--surface-2,#eef2f7);overflow:hidden}
.spy-share i{display:block;height:100%;background:var(--good);border-radius:9px}.spy-share em{font-style:normal;font-size:11.5px;width:34px;text-align:right;color:var(--text-muted,#64748b)}
.spy-cols{display:flex;gap:10px;align-items:flex-end;overflow-x:auto;padding-bottom:4px}
.spy-col{flex:1;min-width:58px;display:flex;flex-direction:column;align-items:center;gap:6px;font-size:11px;color:var(--text-muted,#64748b)}
.spy-col b{font-size:11.5px;color:var(--text,#0f172a)}.spy-col>div{height:120px;width:100%;max-width:46px;display:flex;flex-direction:column-reverse;border-radius:6px;overflow:hidden;background:var(--surface-2,#eef2f7)}
.spy-col>div i{display:block;width:100%}

/* ---- Southern Billing → Summary polish ---- */
.sb-cardhead { margin: 0 24px 12px !important; padding-top: 4px; }
.sb-group-label { font-size: 15px !important; font-weight: 700 !important; letter-spacing: -.01em; }
.sb-group-label small { font-weight: 500; }
.sb-cards { gap: 14px !important; }
.sb-card { border: 1px solid var(--border, #e5e7eb) !important; border-top: 0 !important; border-radius: 14px !important; padding: 14px 16px 13px !important; position: relative; overflow: hidden; box-shadow: 0 1px 2px rgba(15,23,42,.04); background: linear-gradient(180deg, color-mix(in srgb, var(--c) 7%, var(--surface, #fff)), var(--surface, #fff) 70%) !important; }
.sb-card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--c); }
.sb-card:hover { box-shadow: 0 8px 22px rgba(15,23,42,.10) !important; transform: translateY(-2px); }
.sb-card.active { box-shadow: 0 0 0 2px var(--c), 0 8px 22px rgba(15,23,42,.10) !important; }
.sb-card-top { display: flex; align-items: center; gap: 8px; }
.sb-card-ico { width: 22px; height: 22px; border-radius: 7px; display: grid; place-items: center; font-size: 11px; color: var(--c); background: color-mix(in srgb, var(--c) 14%, transparent); }
.sb-card-l { font-size: 11.5px !important; text-transform: uppercase; letter-spacing: .07em; color: var(--text-muted, #64748b); font-weight: 700 !important; }
.sb-card-n { font-size: 28px !important; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.sb-card-foot { font-size: 12px; color: var(--text-muted, #64748b); font-variant-numeric: tabular-nums; }
.sb-card-meter { height: 5px; border-radius: 99px; background: var(--surface-2, #eef2f7); overflow: hidden; display: block; margin: 6px 0 4px; }
.sb-card-meter i { display: block; height: 100%; background: var(--c); border-radius: 99px; }
.sbs-panel { margin: 0 24px 16px; padding: 16px 20px; border-radius: 16px; background: var(--surface, #fff); border: 1px solid var(--border, #e5e7eb); box-shadow: 0 1px 2px rgba(15,23,42,.04); }
.sbs-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.sbs-head h4 { margin: 0; font-size: 15px; font-weight: 700; }
.sbs-head span { font-size: 12px; color: var(--text-muted, #64748b); }
.sbs-bar { display: flex; height: 14px; border-radius: 99px; overflow: hidden; background: var(--surface-2, #eef2f7); gap: 2px; }
.sbs-bar i { display: block; height: 100%; min-width: 4px; }
.sbs-leg { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; margin-top: 14px; }
.sbs-li { display: grid; grid-template-columns: 10px 1fr auto auto; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--border, #e5e7eb); background: transparent; font: inherit; color: inherit; cursor: pointer; text-align: left; transition: background .12s; }
.sbs-li:hover { background: var(--surface-2, #f1f5f9); }
.sbs-li.on { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 8%, transparent); }
.sbs-li i { width: 10px; height: 10px; border-radius: 50%; }
.sbs-li span { font-size: 12.5px; font-weight: 600; }
.sbs-li b { font-variant-numeric: tabular-nums; font-size: 13px; }
.sbs-li em { font-style: normal; font-size: 11.5px; color: var(--text-muted, #64748b); min-width: 34px; text-align: right; }
/* breakdown cards & tables */
.sb-card-wrap { border-radius: 16px !important; border: 1px solid var(--border, #e5e7eb) !important; box-shadow: 0 1px 2px rgba(15,23,42,.04) !important; padding: 18px 20px !important; }
.sb-card-wrap .pay-card-head h3 { font-size: 15px; letter-spacing: -.01em; }
.sb-card-wrap .sb-table thead th { font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-muted, #64748b); font-weight: 700; padding: 10px 12px; border-bottom: 1px solid var(--border, #e5e7eb); background: var(--surface-2, #f8fafc); }
.sb-card-wrap .sb-table tbody td { padding: 12px; border-bottom: 1px solid var(--border, #eef2f7); font-variant-numeric: tabular-nums; }
.sb-card-wrap .sb-table tbody tr:last-child td { border-bottom: 0; }
.sb-card-wrap .sb-table tbody tr.sb-click:hover td { background: color-mix(in srgb, var(--primary) 6%, transparent); }
.sb-card-wrap .sb-table tfoot td { background: var(--surface-2, #f8fafc); padding: 12px; }
.sb-loc-spot, .sb-ins { border-radius: 14px !important; box-shadow: 0 1px 2px rgba(15,23,42,.04); }
.sb-help { margin: 0 24px 24px; }

/* ---- Southern Billing → Needs Attention ---- */
.sba { padding: 0 24px 24px; display: flex; flex-direction: column; gap: 16px; }
.sba-hero { display: flex; justify-content: space-between; align-items: center; gap: 24px; flex-wrap: wrap; padding: 20px 26px; border-radius: 18px; color: #fff; background: linear-gradient(135deg, #1f1235, #7f1d1d 70%, #b45309); }
.sba-eye { display: block; font-size: 11.5px; letter-spacing: .12em; text-transform: uppercase; opacity: .7; }
.sba-hero b { display: block; font-size: 42px; line-height: 1.1; margin: 4px 0; font-variant-numeric: tabular-nums; }
.sba-sub { font-size: 13px; opacity: .82; }
.sba-note { max-width: 360px; font-size: 12.5px; line-height: 1.5; opacity: .8; }
.sba-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.sba-card { position: relative; text-align: left; padding: 14px 16px 14px 20px; border-radius: 14px; border: 1px solid var(--border, #e5e7eb); background: linear-gradient(180deg, color-mix(in srgb, var(--c) 7%, var(--surface, #fff)), var(--surface, #fff) 70%); font: inherit; color: inherit; cursor: pointer; display: flex; flex-direction: column; gap: 2px; overflow: hidden; transition: box-shadow .15s, transform .15s; }
.sba-card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--c); }
.sba-card:hover { transform: translateY(-2px); box-shadow: 0 8px 22px rgba(15,23,42,.10); }
.sba-card.on { box-shadow: 0 0 0 2px var(--c); }
.sba-pri { font-size: 10.5px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--c); }
.sba-l { font-size: 13px; font-weight: 650; }
.sba-card b { font-size: 30px; letter-spacing: -.03em; line-height: 1.15; font-variant-numeric: tabular-nums; }
.sba-card em { font-style: normal; font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.sba-card small { font-size: 11.5px; color: var(--text-muted, #64748b); }
.sba-panel { border-radius: 16px; border: 1px solid var(--border, #e5e7eb); background: var(--surface, #fff); box-shadow: 0 1px 2px rgba(15,23,42,.04); overflow: hidden; }
.sba-ph { padding: 16px 20px 12px; }
.sba-ph h4 { margin: 0; font-size: 15px; font-weight: 700; }
.sba-ph small { font-weight: 500; font-size: 12px; color: var(--text-muted, #64748b); margin-left: 8px; }
.sba-wrap { margin: 0 !important; max-height: 640px; overflow: auto; }
.sba-t { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.sba-t thead th { position: sticky; top: 0; z-index: 2; background: var(--surface-2, #f8fafc); text-align: left; font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-muted, #64748b); padding: 10px 14px; border-top: 1px solid var(--border, #e5e7eb); border-bottom: 1px solid var(--border, #e5e7eb); }
.sba-t td { padding: 12px 14px; border-bottom: 1px solid var(--border, #eef2f7); vertical-align: middle; text-align: left; }
.sba-t th.num, .sba-t td.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.sba-t td b { display: block; font-weight: 650; }
.sba-t .sb-sub { display: block; font-size: 11.5px; color: var(--text-muted, #64748b); margin-top: 2px; }
.sba-t tbody tr td:first-child { box-shadow: inset 4px 0 0 var(--c); }
.sba-t tbody tr:hover td { background: color-mix(in srgb, var(--c) 6%, transparent); }
.sba-badge { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 10.5px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--c); background: color-mix(in srgb, var(--c) 13%, transparent); }
.sba-pc { white-space: nowrap; }
.sba-why { color: var(--text-muted, #475569); font-size: 12.5px; max-width: 320px; }
.sba-act { display: inline-block; padding: 4px 10px; border-radius: 8px; font-size: 12px; font-weight: 600; color: #0f766e; background: color-mix(in srgb, #14b8a6 12%, transparent); }

/* Southern Billing → multi-select Location filter */
.sb-ms { position: relative; }
.sb-ms > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 14px; border: 1px solid var(--border, #e5e7eb); border-radius: 10px; background: var(--surface, #fff); font-size: 13px; }
.sb-ms > summary::-webkit-details-marker { display: none; }
.sb-ms > summary span { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted, #64748b); }
.sb-ms > summary::after { content: '▾'; color: var(--text-muted, #64748b); font-size: 11px; }
.sb-ms[open] > summary { border-color: var(--primary, #4f46e5); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary, #4f46e5) 16%, transparent); }
.sb-ms-panel { position: absolute; z-index: 30; top: calc(100% + 6px); left: 0; min-width: 260px; max-height: 340px; overflow: auto; padding: 8px; background: var(--surface, #fff); border: 1px solid var(--border, #e5e7eb); border-radius: 12px; box-shadow: 0 12px 32px rgba(15, 23, 42, .16); }
.sb-ms-act { display: flex; justify-content: space-between; padding: 2px 4px 8px; border-bottom: 1px solid var(--border, #e5e7eb); margin-bottom: 4px; }
.sb-ms-act button { border: 0; background: none; color: var(--primary, #4f46e5); font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; }
.sb-ms-opt { display: flex; align-items: center; gap: 9px; padding: 7px 8px; border-radius: 8px; font-size: 13px; cursor: pointer; }
.sb-ms-opt:hover { background: var(--surface-2, #f1f5f9); }
.sb-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
