/* Suburban Water Billing: "clean & bright" look.
   The content security policy allows no inline styles, so everything visual lives here. */

:root {
  --canvas: #f6f8fb;
  --surface: #ffffff;
  --surface-2: #fafbfd;
  --hover: #f5f7fa;
  --line: #e6eaf0;
  --line-soft: #eef1f5;
  --line-strong: #d3dae4;
  --text: #0f172a;
  --text-2: #334155;
  --muted: #64748b;
  --faint: #94a3b8;
  --accent: #0b6fd6;
  --accent-strong: #0a5cb3;
  --accent-soft: #e8f1fd;
  --accent-ring: rgba(11, 111, 214, 0.25);
  --green: #15803d;
  --green-soft: #dcfce7;
  --green-line: #bbf7d0;
  --red: #b91c1c;
  --red-soft: #fee2e2;
  --red-line: #fecaca;
  --amber: #a16207;
  --amber-soft: #fef3c7;
  --amber-line: #fde68a;
  --blue: #0369a1;
  --blue-soft: #e0f2fe;
  --gray-soft: #f1f5f9;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 4px 14px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 16px 40px rgba(15, 23, 42, 0.16), 0 2px 6px rgba(15, 23, 42, 0.06);
  /* charts: categorical slots 1-2, the ordinal blue ramp and chart furniture (checked with the palette validator) */
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --ramp-250: #86b6ef;
  --ramp-350: #5598e7;
  --ramp-450: #2a78d6;
  --ramp-550: #1c5cab;
  --ramp-650: #104281;
  --grid: #e9edf2;
  --axis: #cbd3de;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, Roboto, 'Helvetica Neue', Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--canvas); color: var(--text); font: 14px/1.5 var(--font); -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-strong); text-decoration: underline; text-underline-offset: 2px; }
h1 { font-size: 24px; font-weight: 700; letter-spacing: -0.015em; margin: 0; line-height: 1.25; }
h2 { font-size: 16px; font-weight: 650; margin: 24px 0 10px; letter-spacing: -0.005em; }
h3 { font-size: 14px; font-weight: 650; margin: 14px 0 6px; }
.card > h2:first-child, section > h2:first-child, fieldset > h2:first-child { margin-top: 0; }
p { margin: 0 0 10px; }
strong { font-weight: 650; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
svg.i { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; vertical-align: middle; }
.skip-link { position: absolute; left: 12px; top: -48px; z-index: 100; background: var(--text); color: #fff; padding: 8px 14px; border-radius: var(--radius); }
.skip-link:focus { top: 12px; color: #fff; }

/* ---- frame: sidebar + top bar ---- */
.frame { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--surface); border-right: 1px solid var(--line); padding: 18px 12px; display: flex; flex-direction: column; gap: 22px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 2px 8px; color: var(--text); }
.brand:hover { text-decoration: none; color: var(--text); }
.brand-mark { width: 30px; height: 30px; flex: none; color: var(--accent); }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.brand-text strong { font-size: 14.5px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-text span { font-size: 12px; color: var(--muted); }
.sidenav { display: flex; flex-direction: column; gap: 18px; }
.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-title { font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--faint); padding: 0 10px 6px; }
.sidenav a { display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: var(--radius); color: #475569; font-weight: 500; white-space: nowrap; }
.sidenav a svg.i { color: #7b8aa0; }
.sidenav a:hover { background: var(--hover); color: var(--text); text-decoration: none; }
.sidenav a.active { background: var(--accent-soft); color: var(--accent-strong); font-weight: 600; }
.sidenav a.active svg.i { color: var(--accent); }
.main-col { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 16px; height: 64px; padding: 0 28px; background: rgba(255, 255, 255, 0.94); border-bottom: 1px solid var(--line); -webkit-backdrop-filter: saturate(180%) blur(8px); backdrop-filter: saturate(180%) blur(8px); }
.content { padding: 28px 32px 72px; width: 100%; max-width: 1400px; }
.content:focus { outline: none; }

/* search as you type */
.search { position: relative; flex: 1; max-width: 560px; }
.search input { width: 100%; height: 40px; padding: 0 40px 0 40px; border: 1px solid transparent; border-radius: 10px; background: #f1f4f8; font-size: 14px; }
.search input::-webkit-search-cancel-button { display: none; }
.search input:hover { background: #edf1f6; }
.search input:focus { background: #fff; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); outline: none; }
.search-icon { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; color: var(--muted); pointer-events: none; }
.kbd { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); min-width: 22px; height: 22px; display: grid; place-items: center; border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 6px; background: #fff; color: var(--muted); font: 600 12px/1 var(--font); pointer-events: none; }
.search input:focus ~ .kbd, .search input:not(:placeholder-shown) ~ .kbd { display: none; }
.search-results { position: absolute; top: calc(100% + 8px); left: 0; right: 0; z-index: 50; margin: 0; padding: 6px; list-style: none; background: #fff; border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); max-height: min(460px, 70vh); overflow-y: auto; }
.search-results[hidden] { display: none; }
.search-results li { border-radius: var(--radius); cursor: pointer; }
.search-results li a { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; align-items: center; column-gap: 12px; padding: 8px 10px; color: var(--text); text-decoration: none; }
.search-results li[aria-selected='true'], .search-results li:hover { background: var(--accent-soft); }
.sr-av { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: #e7eef8; color: #31507a; font-size: 12px; font-weight: 700; }
.sr-name { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sr-meta { display: block; font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sr-bal { font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; }
.sr-bal small { display: block; font-weight: 500; font-size: 11.5px; color: var(--muted); }
.search-results .sr-all a { display: flex; gap: 8px; align-items: center; color: var(--accent-strong); font-weight: 500; }
.search-results .sr-all { border-top: 1px solid var(--line-soft); margin-top: 4px; border-radius: 0 0 var(--radius) var(--radius); }
.search-results .sr-empty { padding: 12px 10px; color: var(--muted); cursor: default; }
.search-results .sr-empty:hover { background: none; }

/* signed-in user */
.user { margin-left: auto; display: flex; align-items: center; gap: 16px; white-space: nowrap; }
.today { color: var(--muted); font-size: 13px; }
.user-menu { position: relative; }
.user-menu summary { list-style: none; display: flex; align-items: center; gap: 8px; padding: 4px 8px 4px 4px; border-radius: 999px; cursor: pointer; color: var(--text-2); font-weight: 500; }
.user-menu summary::-webkit-details-marker { display: none; }
.user-menu summary:hover, .user-menu[open] summary { background: var(--hover); }
.av { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: #e2e8f0; color: #334155; font-size: 12px; font-weight: 700; }
.chev { width: 16px; height: 16px; color: var(--muted); }
.menu { position: absolute; right: 0; top: calc(100% + 8px); z-index: 50; min-width: 220px; padding: 6px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); }
.menu-head { display: flex; flex-direction: column; padding: 8px 10px 10px; border-bottom: 1px solid var(--line-soft); margin-bottom: 6px; }
.menu-head span { color: var(--muted); font-size: 12.5px; }
.menu a, .menu button { display: flex; width: 100%; align-items: center; gap: 10px; padding: 8px 10px; border: 0; border-radius: var(--radius); background: none; color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.menu a:hover, .menu button:hover { background: var(--hover); text-decoration: none; color: var(--text); }
.menu form { margin: 0; }
.menu svg.i { color: var(--muted); }

/* ---- page parts ---- */
.page-header { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-header h1 { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.subtitle { color: var(--muted); margin-top: 6px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 20px 22px; margin-bottom: 20px; box-shadow: var(--shadow-sm); }
.card.narrow { max-width: 620px; }
.card.flush { padding: 0; overflow: hidden; }
.card.flush > .card-head { padding: 16px 22px; margin: 0; border-bottom: 1px solid var(--line-soft); }
.card.flush > .table { border: 0; border-radius: 0; margin: 0; box-shadow: none; }
.card-pad { padding: 16px 22px; margin: 0; }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 16px; }
.card-head h2 { margin: 0; font-size: 15px; }
.card-sub { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.card-head > a { font-size: 13px; font-weight: 500; white-space: nowrap; }
.card-figure { text-align: right; line-height: 1.3; }
.card-figure strong { display: block; font-size: 17px; font-weight: 700; }
.card-figure span { color: var(--muted); font-size: 12.5px; }
details.card > summary { cursor: pointer; }
details.card[open] > summary { margin-bottom: 12px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: start; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; align-items: start; }
.grid-2 > .card, .grid-3 > .card { margin-bottom: 0; }
.grid-2:has(> .card), .grid-3:has(> .card) { margin-bottom: 20px; }
.dash-grid { align-items: stretch; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.empty { padding: 32px 24px; text-align: center; color: var(--muted); background: var(--surface); border: 1px dashed var(--line-strong); border-radius: var(--radius-lg); margin-bottom: 20px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.hint { color: var(--muted); font-size: 12.5px; }
.warn { color: var(--amber); }
code { font-family: var(--mono); font-size: 12px; background: var(--gray-soft); padding: 1px 5px; border-radius: 5px; word-break: break-all; }
details > summary { cursor: pointer; }
ul.plain { list-style: none; padding: 0; margin: 0; }
ul.plain li { padding: 4px 0; }
ul.notes { list-style: none; padding: 0; margin: 0; }
ul.notes li { padding: 10px 0; border-bottom: 1px solid var(--line-soft); }
ul.notes li:last-child { border-bottom: 0; }
.note-body { white-space: pre-wrap; }
.facts { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 8px 14px; margin: 0 0 14px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }
.inline-icon { width: 15px; height: 15px; vertical-align: -3px; margin-right: 3px; }

/* ---- stat tiles ---- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 22px; }
.stat { position: relative; display: block; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 16px 18px; color: inherit; box-shadow: var(--shadow-sm); transition: border-color 0.15s, box-shadow 0.15s; }
a.stat:hover { border-color: #c5d7ef; box-shadow: var(--shadow-md); text-decoration: none; color: inherit; }
.stat-label { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 13px; font-weight: 500; }
.stat-icon { width: 17px; height: 17px; }
.stat-value { font-size: 24px; font-weight: 700; letter-spacing: -0.015em; margin-top: 4px; line-height: 1.25; }
.stat-value .money.credit { color: var(--green); }
.stat-note { color: var(--muted); font-size: 12.5px; margin-top: 3px; }
.stat-amber { border-color: var(--amber-line); background: linear-gradient(#fff, #fffcf2); }
.stat-amber .stat-icon, .stat-amber .stat-note { color: var(--amber); }
.stat-red { border-color: var(--red-line); background: linear-gradient(#fff, #fff7f7); }
.stat-red .stat-icon, .stat-red .stat-note { color: #dc2626; }
.stat-red .stat-note { font-weight: 600; }
.stat-green .stat-icon { color: #16a34a; }

/* ---- tables ---- */
.table { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); margin-bottom: 20px; box-shadow: var(--shadow-sm); }
.table th { text-align: left; font-size: 12.5px; color: var(--muted); font-weight: 500; background: var(--surface-2); border-bottom: 1px solid var(--line-soft); padding: 10px 14px; white-space: nowrap; }
.table th:first-child { border-top-left-radius: var(--radius-lg); }
.table th:last-child { border-top-right-radius: var(--radius-lg); }
.table td { padding: 10px 14px; border-bottom: 1px solid #f1f4f8; vertical-align: top; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:last-child td:first-child { border-bottom-left-radius: var(--radius-lg); }
.table tbody tr:last-child td:last-child { border-bottom-right-radius: var(--radius-lg); }
.table tbody tr:hover td { background: #fafcfe; }
.table.compact td, .table.compact th { padding: 6px 10px; }
.table.auto { width: auto; min-width: 380px; }
.table tr.total td { font-weight: 650; border-top: 1px solid var(--line-strong); background: var(--surface-2); }
.card .table { border: 0; box-shadow: none; border-radius: 0; margin-bottom: 0; }
.card .table th:first-child, .card .table th:last-child, .card .table tbody tr:last-child td { border-radius: 0; }
.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.money.credit { color: var(--green); }
tr.reversed td { color: var(--muted); }
tr.muted td { color: var(--muted); }
.row-warn td { background: #fffbeb; }
.row-missing td { background: #f8fafc; }
.row-flag td { background: #fef6f5; }

/* ---- badges ---- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 1px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600; line-height: 1.6; white-space: nowrap; vertical-align: middle; }
.badge.status::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: 0.85; }
.badge-green { background: var(--green-soft); color: var(--green); }
.badge-red { background: var(--red-soft); color: var(--red); }
.badge-amber { background: var(--amber-soft); color: var(--amber); }
.badge-blue { background: var(--blue-soft); color: var(--blue); }
.badge-gray { background: var(--gray-soft); color: #475569; }
h1 .badge { font-size: 12px; }

/* ---- forms ---- */
input, select, textarea { font: inherit; color: var(--text); height: 38px; padding: 0 11px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: #fff; transition: border-color 0.15s, box-shadow 0.15s; }
textarea { height: auto; padding: 9px 11px; line-height: 1.45; }
input[type='checkbox'], input[type='radio'] { width: 16px; height: 16px; padding: 0; accent-color: var(--accent); }
input[type='file'] { height: auto; padding: 6px; }
select { -webkit-appearance: none; appearance: none; padding-right: 32px; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 10px center / 16px; }
input:hover, select:hover, textarea:hover { border-color: #b8c3d2; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
input[readonly] { background: var(--surface-2); }
::placeholder { color: var(--faint); }
.field { display: flex; flex-direction: column; gap: 5px; }
.field.wide { grid-column: 1 / -1; }
.field .label { font-weight: 600; font-size: 13px; color: var(--text-2); }
.field input, .field select, .field textarea { width: 100%; }
.req { color: #dc2626; }
.check { display: flex; gap: 9px; align-items: center; }
.check input { width: 16px; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 14px 18px; margin: 0; }
legend { font-weight: 650; padding: 0 6px; }
fieldset.card { padding-top: 12px; }
fieldset.card legend { font-size: 15px; }
fieldset .check { margin: 5px 0; }
.filters { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.filters input[type='search'] { min-width: 340px; }
.big-search { display: flex; gap: 10px; align-items: center; }
.big-search label { font-weight: 600; white-space: nowrap; }
.big-search input { flex: 1; font-size: 16px; height: 44px; }
.inline-form { display: inline-flex; gap: 6px; align-items: center; margin: 0; flex-wrap: wrap; }
.num-input { width: 110px; text-align: right; font-variant-numeric: tabular-nums; }
.desc-input { min-width: 280px; font-weight: 600; }
.setting-input { width: 100%; min-width: 240px; }
.table input, .table select { height: 32px; }

/* ---- buttons ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 38px; padding: 0 15px; border-radius: var(--radius); border: 1px solid #dde3eb; background: #fff; color: var(--text); font: inherit; font-weight: 550; cursor: pointer; text-decoration: none; white-space: nowrap; box-shadow: 0 1px 1px rgba(15, 23, 42, 0.04); transition: background 0.15s, border-color 0.15s, box-shadow 0.15s; }
.btn:hover { background: var(--hover); border-color: #cbd3de; text-decoration: none; color: var(--text); }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--accent-ring); }
.btn svg.i { width: 17px; height: 17px; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 1px 2px rgba(11, 111, 214, 0.35); }
.btn-primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); color: #fff; }
.btn-danger { border-color: var(--red-line); color: var(--red); }
.btn-danger:hover { background: #fef2f2; border-color: #fca5a5; color: var(--red); }
.btn-danger-solid { background: #dc2626; border-color: #dc2626; color: #fff; box-shadow: 0 1px 2px rgba(220, 38, 38, 0.35); }
.btn-danger-solid:hover { background: #b91c1c; border-color: #b91c1c; color: #fff; }
.btn-link { height: auto; background: none; border: none; box-shadow: none; padding: 0; color: var(--accent); cursor: pointer; font: inherit; }
.btn-link:hover { background: none; text-decoration: underline; color: var(--accent-strong); }
.btn-small { height: 30px; padding: 0 10px; font-size: 12.5px; }
.btn-block { width: 100%; height: 42px; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }
form[aria-busy='true'] .btn { cursor: progress; }

/* ---- messages on the page ---- */
.flash { padding: 12px 14px; border-radius: 10px; margin-bottom: 16px; border: 1px solid; }
.flash:has(> .flash-icon) { display: flex; gap: 10px; align-items: flex-start; }
.flash-icon { width: 19px; height: 19px; margin-top: 1px; }
.flash-ok { background: #f0fdf4; border-color: var(--green-line); color: #14532d; }
.flash-err { background: #fef2f2; border-color: var(--red-line); color: #7f1d1d; }
.flash-info { background: #fffbeb; border-color: var(--amber-line); color: #713f12; }
.flash-ok .flash-icon { color: #16a34a; }
.flash-err .flash-icon { color: #dc2626; }
.flash-info .flash-icon { color: #d97706; }

/* ---- pop-up messages ---- */
.toasts { position: fixed; top: 76px; right: 24px; z-index: 60; display: flex; flex-direction: column; gap: 10px; width: min(420px, calc(100vw - 32px)); pointer-events: none; }
.toast { pointer-events: auto; display: flex; gap: 12px; align-items: flex-start; padding: 14px 12px 14px 16px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); animation: toast-in 0.28s cubic-bezier(0.2, 0.9, 0.3, 1.2); }
.toast-icon { width: 21px; height: 21px; }
.toast-ok .toast-icon { color: #16a34a; }
.toast-info .toast-icon { color: var(--accent); }
.toast-err { border-color: var(--red-line); }
.toast-err .toast-icon { color: #dc2626; }
.toast-text { flex: 1; min-width: 0; padding-top: 1px; overflow-wrap: anywhere; }
.toast-close { flex: none; display: grid; place-items: center; width: 28px; height: 28px; margin: -3px 0; border: 0; border-radius: 6px; background: none; color: var(--muted); cursor: pointer; }
.toast-close:hover { background: var(--hover); color: var(--text); }
.toast-close svg.i { width: 16px; height: 16px; }
.toast.leaving { animation: toast-out 0.2s ease-in forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-10px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateX(16px); } }

/* ---- confirmation box ---- */
.dialog { width: min(460px, calc(100vw - 32px)); padding: 0; border: 0; border-radius: 16px; background: #fff; color: var(--text); box-shadow: 0 24px 64px rgba(15, 23, 42, 0.3); }
.dialog::backdrop { background: rgba(15, 23, 42, 0.45); }
.dialog[open] { animation: dialog-in 0.18s ease-out; }
.dialog-body { display: flex; gap: 16px; padding: 24px 24px 6px; }
.dialog-icon { flex: none; width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.dialog-icon svg.i { width: 22px; height: 22px; }
.dialog.danger .dialog-icon { background: var(--red-soft); color: #dc2626; }
.dialog h2 { margin: 8px 0 6px; font-size: 16.5px; }
.dialog p { margin: 0; color: var(--text-2); overflow-wrap: anywhere; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; padding: 20px 24px 22px; }
@keyframes dialog-in { from { opacity: 0; transform: translateY(8px) scale(0.98); } to { opacity: 1; transform: none; } }

/* ---- account ---- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 20px 0 22px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { padding: 10px 12px; color: var(--muted); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.active { color: var(--accent-strong); border-color: var(--accent); font-weight: 600; }
.tabs .count { margin-left: 6px; padding: 0 7px; border-radius: 999px; background: var(--gray-soft); color: var(--muted); font-size: 11.5px; }
.account-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px 24px; flex-wrap: wrap; margin-bottom: 20px; }
.who { display: flex; gap: 16px; align-items: flex-start; min-width: 0; }
.who-text { min-width: 0; }
.avatar { flex: none; width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; background: linear-gradient(135deg, #3b82f6, #06b6d4); color: #fff; font-size: 17px; font-weight: 700; letter-spacing: 0.02em; box-shadow: 0 4px 12px rgba(59, 130, 246, 0.25); }
.acct-no { color: var(--muted); font-weight: 600; font-size: 13px; margin-bottom: 3px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; font-variant-numeric: tabular-nums; }
.account-head h1 { margin-bottom: 4px; }
.stats.balances { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-bottom: 18px; }
.action-bar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; justify-content: flex-end; }

/* ---- bill runs ---- */
.stepper { list-style: none; margin: 0 0 20px; padding: 18px 22px; display: flex; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.stepper li { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; position: relative; text-align: center; color: var(--muted); font-size: 13px; font-weight: 500; }
.stepper li::before { content: ''; position: absolute; top: 15px; left: calc(-50% + 22px); right: calc(50% + 22px); height: 2px; border-radius: 2px; background: var(--line); }
.stepper li:first-child::before { display: none; }
.stepper li.done::before, .stepper li.current::before { background: var(--accent); }
.stepper-dot { position: relative; z-index: 1; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: #fff; border: 2px solid var(--line-strong); color: var(--muted); font-weight: 700; font-size: 13px; }
.stepper-dot svg.i { width: 17px; height: 17px; stroke-width: 2.4; }
.stepper li.done .stepper-dot { background: var(--accent); border-color: var(--accent); color: #fff; }
.stepper li.current { color: var(--text); font-weight: 650; }
.stepper li.current .stepper-dot { border-color: var(--accent); color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.steps { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.step { display: flex; gap: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 18px; box-shadow: var(--shadow-sm); }
.step.current { border-color: #9fc3ef; box-shadow: 0 0 0 3px var(--accent-soft), var(--shadow-sm); }
.step-no { width: 30px; height: 30px; border-radius: 50%; background: var(--gray-soft); color: var(--muted); display: grid; place-items: center; font-weight: 700; flex: none; }
.step-no svg.i { width: 16px; height: 16px; stroke-width: 2.4; }
.step.done .step-no { background: var(--green-soft); color: var(--green); }
.step.current .step-no { background: var(--accent); color: #fff; }
.step-body { min-width: 0; }
.step h3 { margin: 4px 0 6px; font-size: 14.5px; }
.step p { margin: 0 0 12px; color: var(--text-2); }
.step .btn { margin: 0 6px 6px 0; }
.read-toolbar { display: flex; gap: 12px; align-items: center; margin: 8px 0 14px; flex-wrap: wrap; }
.read-table th, .read-table td { padding-left: 10px; padding-right: 10px; }
.read-table .read-input { width: 110px; text-align: right; font-variant-numeric: tabular-nums; }
.read-table .trouble-input { width: 130px; }
.read-input.changed, .trouble-input.changed { background: #fffbeb; border-color: #f59e0b; }
.exception { margin-top: 6px; }
.exception-actions { display: flex; gap: 4px; margin-top: 4px; flex-wrap: wrap; }
.reads-cell { min-width: 170px; }
.reads-cell .small { display: block; margin-top: 3px; color: var(--muted); }
.reads-cell .warn { color: var(--amber); }
.device-alert { margin-top: 4px; }
.device-alert .badge { white-space: normal; }

/* radio reads (bill run page) */
.radio-card { margin-top: 20px; }
.radio-steps { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px; }
.radio-steps h3 { margin: 0 0 6px; font-size: 14px; }
.radio-steps p { margin: 0 0 12px; color: var(--text-2); }
.radio-missing { margin-top: 12px; }
.radio-missing summary { cursor: pointer; color: var(--text-2); }
.radio-missing .table { margin-top: 10px; }
.upload-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 0 0 8px; }
.upload-form input[type='file'] { max-width: 100%; font: inherit; }
.radio-files { margin-top: 20px; }

/* e-bills: bill run step 5, the outbox, the bill page */
.ebill-step { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.ebill-step h4 { display: flex; align-items: center; gap: 6px; margin: 0 0 6px; font-size: 13.5px; }
.ebill-step h4 svg.i { width: 16px; height: 16px; color: var(--accent); }
.ebill-step .hint { margin: 4px 0 0; }
.ebill-missing { margin: 0 0 10px; }
.ebill-missing summary { cursor: pointer; color: var(--amber); }
.ebill-missing summary svg.i { width: 15px; height: 15px; vertical-align: -3px; }
.ebill-missing ul { margin: 8px 0 0; padding-left: 18px; max-height: 220px; overflow: auto; }
.actions-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.actions-row .inline-form, .actions-row .btn { margin: 0; }
.mail-preview { margin-bottom: 16px; }
.mail-head { display: grid; grid-template-columns: 90px minmax(0, 1fr); gap: 6px 12px; margin: 0 0 12px; }
.mail-head dt { color: var(--muted); }
.mail-head dd { margin: 0; overflow-wrap: anywhere; }
.mail-head svg.i { width: 15px; height: 15px; vertical-align: -3px; }
.mail-body { margin: 0; padding: 14px; background: var(--gray-soft); border-radius: var(--radius); white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; }
.delivery-line { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin: 0 0 12px; color: var(--text-2); }
.delivery-line svg.i { width: 16px; height: 16px; }

/* meter (bill run progress) */
progress.meter { -webkit-appearance: none; appearance: none; display: block; width: 100%; max-width: 220px; height: 8px; border: 0; border-radius: 4px; background: #cde2fb; overflow: hidden; }
progress.meter::-webkit-progress-bar { background: #cde2fb; border-radius: 4px; }
progress.meter::-webkit-progress-value { background: var(--series-1); border-radius: 4px; }
progress.meter::-moz-progress-bar { background: var(--series-1); border-radius: 4px; }

/* ---- dashboard ---- */
.todo { list-style: none; margin: -6px 0 0; padding: 0; }
.todo li + li { border-top: 1px solid var(--line-soft); }
.todo-item { display: flex; align-items: center; gap: 12px; padding: 10px 6px; margin: 0 -6px; border-radius: var(--radius); color: var(--text-2); }
.todo-item:hover { background: var(--hover); text-decoration: none; color: var(--text); }
.todo-icon { flex: none; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--gray-soft); color: #7b8aa0; }
.todo-icon svg.i { width: 18px; height: 18px; }
.todo-item.due .todo-icon { background: var(--amber-soft); color: var(--amber); }
.todo-item.due { color: var(--text); font-weight: 550; }
.todo-label { flex: 1; min-width: 0; }
.todo-count { min-width: 28px; padding: 1px 9px; border-radius: 999px; background: var(--amber-soft); color: var(--amber); font-weight: 700; font-size: 13px; text-align: center; }
.todo-clear { display: inline-flex; align-items: center; gap: 4px; color: var(--faint); font-size: 12.5px; }
.todo-clear svg.i { width: 15px; height: 15px; color: #16a34a; }

/* ---- charts ---- */
.chart { margin: 0; }
.chart-body { display: grid; grid-template-columns: 52px minmax(0, 1fr); padding-top: 8px; }
.chart-axis, .chart-plot { display: block; overflow: visible; font-size: 11.5px; }
.chart-axis text, .chart-plot .xlab { fill: var(--muted); font-variant-numeric: tabular-nums; }
.chart-plot .grid { stroke: var(--grid); stroke-width: 1; }
.chart-plot .baseline { stroke: var(--axis); stroke-width: 1; }
.chart-plot .bar { transition: opacity 0.12s; }
.chart-plot .hit { fill: transparent; pointer-events: all; cursor: default; outline: none; }
.chart-plot .col:hover .bar, .chart-plot .col:focus-within .bar { opacity: 0.78; }
.chart-plot .hit:focus-visible { fill: rgba(11, 111, 214, 0.06); stroke: var(--accent); stroke-width: 1.5; }
.m-s1 { fill: var(--series-1); }
.m-s2 { fill: var(--series-2); }
.m-est { fill: var(--ramp-250); }
.m-r250 { fill: var(--ramp-250); }
.m-r350 { fill: var(--ramp-350); }
.m-r450 { fill: var(--ramp-450); }
.m-r550 { fill: var(--ramp-550); }
.m-r650 { fill: var(--ramp-650); }
.stackbar { display: block; overflow: visible; margin: 4px 0 18px; }
.stackbar .seg { outline: none; transition: opacity 0.12s; }
.stackbar .seg:hover, .stackbar .seg:focus-visible { opacity: 0.8; }
.stackbar .gap { stroke: var(--surface); stroke-width: 2; pointer-events: none; }
.legend { list-style: none; margin: 0 0 6px; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 18px; color: var(--text-2); font-size: 12.5px; }
.legend li { display: inline-flex; align-items: center; gap: 7px; }
.sw { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.sw-s1 { background: var(--series-1); }
.sw-s2 { background: var(--series-2); }
.sw-est, .sw-r250 { background: var(--ramp-250); }
.sw-r350 { background: var(--ramp-350); }
.sw-r450 { background: var(--ramp-450); }
.sw-r550 { background: var(--ramp-550); }
.sw-r650 { background: var(--ramp-650); }
.legend-values { display: grid; grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); gap: 12px 16px; margin: 0; }
.legend-values li { display: grid; grid-template-columns: 10px minmax(0, 1fr); column-gap: 8px; align-items: center; }
.legend-values .legend-name { color: var(--muted); }
.legend-values .legend-value { grid-column: 2; font-size: 15px; font-weight: 650; color: var(--text); }
.legend-values .legend-share { grid-column: 2; color: var(--muted); font-size: 12px; }
.chart-empty { display: grid; place-items: center; min-height: 140px; padding: 16px; color: var(--muted); background: var(--surface-2); border: 1px dashed var(--line-strong); border-radius: var(--radius); text-align: center; }
.table-view { margin-top: 10px; }
.table-view > summary { display: inline-block; color: var(--muted); font-size: 12.5px; font-weight: 500; padding: 2px 0; }
.table-view > summary:hover { color: var(--accent-strong); }
.table-view[open] > summary { margin-bottom: 8px; }
.table-view .table { border: 1px solid var(--line-soft); border-radius: var(--radius); }
.usage-chart { width: 100%; height: auto; max-width: 760px; display: block; }
.usage-chart .bar { fill: #86b6ef; }
.usage-chart .bar.last { fill: var(--series-1); }
.usage-chart .bar.est { fill: #cde2fb; }
.usage-chart .grid { stroke: #e5e9f0; }
.usage-chart .axis { font-size: 10px; fill: var(--muted); }

/* chart tooltip (public/app.js) */
.tip { position: fixed; z-index: 70; min-width: 140px; max-width: 280px; padding: 9px 12px; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-lg); pointer-events: none; font-size: 12.5px; }
.tip[hidden] { display: none; }
.tip-title { color: var(--muted); font-weight: 500; margin-bottom: 4px; }
.tip-row { display: flex; align-items: center; gap: 8px; }
.tip-row + .tip-row { margin-top: 3px; }
.tip-key { width: 12px; height: 3px; border-radius: 2px; flex: none; }
.tip-row strong { font-size: 14px; font-variant-numeric: tabular-nums; color: var(--text); }
.tip-row span { color: var(--muted); }
.k-s1 { background: var(--series-1); }
.k-s2 { background: var(--series-2); }
.k-est, .k-r250 { background: var(--ramp-250); }
.k-r350 { background: var(--ramp-350); }
.k-r450 { background: var(--ramp-450); }
.k-r550 { background: var(--ramp-550); }
.k-r650 { background: var(--ramp-650); }

/* ---- misc ---- */
.trace { white-space: pre-wrap; font-family: var(--mono); font-size: 12.5px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; overflow-x: auto; margin: 10px 0 0; }
.report-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.report-card { display: flex; flex-direction: column; gap: 4px; color: inherit; margin-bottom: 0; transition: border-color 0.15s, box-shadow 0.15s; }
.report-card:hover { border-color: #c5d7ef; box-shadow: var(--shadow-md); text-decoration: none; color: inherit; }
.pager { display: flex; gap: 16px; }

/* ---- sign-in ---- */
body.bare { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: radial-gradient(1200px 600px at 50% -10%, #dbeafe 0%, rgba(219, 234, 254, 0) 60%), var(--canvas); }
.bare-wrap { width: min(420px, 100%); }
.bare-brand { display: flex; gap: 12px; align-items: center; justify-content: center; margin-bottom: 22px; }
.bare-brand strong { display: block; font-size: 17px; }
.bare-brand span { display: block; color: var(--muted); font-size: 13px; }
.bare-mark { width: 40px; height: 40px; color: var(--accent); }
.bare-card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 30px 30px 28px; box-shadow: 0 10px 40px rgba(15, 23, 42, 0.08), 0 1px 3px rgba(15, 23, 42, 0.05); }
.bare-card h1 { margin-bottom: 6px; }
.bare-card > p.muted:first-of-type { margin-bottom: 20px; }
.bare-card .stack { margin-top: 18px; }
.bare-card .btn-block { margin-top: 6px; }
.bare-foot { margin: 18px 0 0; text-align: center; color: var(--muted); font-size: 12.5px; }

/* ---- the bill (screen copy of the printed bill) ---- */
.bill-screen { background: #eef2f7; padding: 20px; border-radius: var(--radius-lg); margin-bottom: 20px; overflow-x: auto; }
.bill-doc { background: #fff; color: #111; max-width: 7.5in; margin: 0 auto; padding: 0.45in 0.5in; box-shadow: 0 2px 12px rgba(15, 23, 42, 0.1); font-size: 12px; line-height: 1.35; }
.bill-top { display: flex; justify-content: space-between; gap: 20px; }
.bill-utility-name { font-size: 16px; font-weight: 700; }
.bill-box { border: 2px solid #111; border-radius: 6px; padding: 8px 12px; min-width: 240px; }
.bill-box-title { font-weight: 700; letter-spacing: 0.08em; margin-bottom: 4px; }
.bill-box dl { display: grid; grid-template-columns: auto auto; gap: 2px 14px; margin: 0; }
.bill-box dt { color: #444; }
.bill-box dd { margin: 0; text-align: right; }
.bill-box .total { font-weight: 700; font-size: 14px; color: #111; }
.bill-credit { font-weight: 700; margin-top: 4px; }
.bill-addresses { display: flex; justify-content: space-between; margin: 18px 0 10px; gap: 20px; }
.bill-table { width: 100%; border-collapse: collapse; margin: 6px 0 10px; }
.bill-table th, .bill-table td { padding: 3px 4px; border-bottom: 1px solid #ddd; text-align: left; vertical-align: top; }
.bill-table .num { text-align: right; }
.bill-table tr.svc th { background: #f2f4f7; font-weight: 700; }
.bill-table tr.total td { font-weight: 700; border-top: 1.5px solid #111; }
.bill-doc .money.credit { color: #111; }
.bill-body { display: grid; grid-template-columns: 1.2fr 1fr; gap: 20px; }
.bill-body h3 { margin: 10px 0 4px; font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; }
.bill-message { border-left: 3px solid #999; padding-left: 8px; margin-top: 8px; }
.stub-cut { border-top: 1.5px dashed #555; margin: 18px 0 8px; padding-top: 4px; text-align: center; font-size: 10px; color: #555; }
.stub { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.stub dl { display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; margin: 0; }
.stub dd { margin: 0; text-align: right; }
.stub .blank { border-bottom: 1px solid #111; min-height: 1.2em; text-align: left; }
.scanline { grid-column: 1 / -1; font-family: 'OCR A Std', 'OCR-A', Consolas, monospace; font-size: 14px; letter-spacing: 0.12em; text-align: right; margin-top: 8px; }
.receipt { max-width: 400px; }
.print-body { background: #eef2f7; padding: 16px; }
.print-body .receipt { background: #fff; margin: 0 auto; padding: 24px; border-radius: var(--radius); }
.print-toolbar { display: flex; gap: 8px; justify-content: center; margin-bottom: 14px; }
.page-break { margin-bottom: 24px; }

@media print {
  @page { size: letter; margin: 0.4in; }
  body, .print-body { background: #fff; padding: 0; }
  .no-print, .side, .topbar, .toasts, .print-toolbar, .dialog { display: none !important; }
  .frame { display: block; }
  .content { padding: 0; }
  .bill-doc { box-shadow: none; max-width: none; padding: 0; }
  .page-break { break-after: page; margin: 0; }
  .page-break:last-child { break-after: auto; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

@media (max-width: 1100px) {
  .steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .today { display: none; }
}

@media (max-width: 900px) {
  .frame { display: block; }
  .side { position: static; height: auto; flex-direction: row; align-items: center; gap: 12px; padding: 10px 16px; border-right: 0; border-bottom: 1px solid var(--line); overflow: visible; }
  .brand { padding: 0; }
  .brand-text span { display: none; }
  .sidenav { flex-direction: row; gap: 2px; overflow-x: auto; scrollbar-width: none; min-width: 0; flex: 1; }
  .sidenav::-webkit-scrollbar { display: none; }
  .nav-group { flex-direction: row; gap: 2px; }
  .nav-title { display: none; }
  .sidenav a { padding: 7px 10px; }
  .topbar { height: 60px; padding: 0 16px; gap: 10px; }
  .user-menu .nm, .user-menu .chev { display: none; }
  .user-menu summary { padding: 2px; }
  .content { padding: 20px 16px 56px; }
  .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .grid-2 > .card + .card { margin-top: 0; }
  .page-header { align-items: flex-start; }
  .account-head { flex-direction: column; }
  .action-bar { justify-content: flex-start; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stats.balances { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
  .balances .stat { padding: 12px; }
  .balances .stat-value { font-size: 18px; }
  .stat-value { font-size: 20px; }
  .steps { grid-template-columns: minmax(0, 1fr); }
  .radio-steps { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .stepper { padding: 14px 8px; }
  .stepper-label { font-size: 11.5px; }
  .big-search { flex-wrap: wrap; }
  .big-search input { min-width: 0; flex: 1 1 180px; }
  .bill-body, .stub, .bill-top, .bill-addresses { grid-template-columns: minmax(0, 1fr); flex-direction: column; }
  .table { display: block; overflow-x: auto; }
  .filters input[type='search'] { min-width: 0; flex: 1; }
  .toasts { top: auto; bottom: 16px; right: 16px; left: 16px; width: auto; }
  .chart-plot .xlab.minor { display: none; }
  .facts { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .facts dd { margin-bottom: 8px; }
}

@media (max-width: 560px) {
  .brand-text { display: none; }
  .stats.balances { grid-template-columns: minmax(0, 1fr); }
  .stat { padding: 12px 14px; }
  .stepper-label { display: none; }
  .stepper li.current .stepper-label { display: block; position: absolute; top: 40px; white-space: nowrap; }
  .stepper { padding-bottom: 34px; }
}
