/* ==========================================================================
   Design system — Pulse
   Warm-neutral "stone" surfaces, one accent (deep teal), semantic status
   colours, and an earthy, low-saturation chart palette. Light first; dark
   mirrors every token.
   ========================================================================== */
:root {
  /* surfaces */
  --bg: #fafaf9; --surface: #ffffff; --surface-2: #f5f5f4; --surface-3: #efeeec;
  --border: #e7e5e4; --border-strong: #d6d3d1;
  /* text */
  --text: #1c1917; --text-2: #57534e; --text-3: #a8a29e;
  /* accent */
  --accent: #0f766e; --accent-hover: #115e59; --accent-soft: #e6f4f1; --accent-text: #0f766e;
  /* status */
  --ok: #15803d; --ok-soft: #e9f6ee;
  --warn: #b45309; --warn-soft: #fcf1e4;
  --bad: #be123c; --bad-soft: #fcebef;
  --neutral: #78716c; --neutral-soft: #f0efed;
  /* charts */
  --c1: #0f766e; --c2: #4f6d8f; --c3: #b7791f; --c4: #8b5a83; --c5: #6b8e5a; --c6: #b5654a; --c7: #57534e; --c8: #9a8c7a; --c-other: #d6d3d1;
  --grid: #efedeb;
  /* type */
  --font: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, "SFMono-Regular", Consolas, monospace;
  --fs-xs: 11px; --fs-sm: 12px; --fs-md: 13px; --fs-base: 14px; --fs-lg: 16px; --fs-xl: 20px; --fs-2xl: 28px; --fs-3xl: 40px;
  /* spacing (4px grid) */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 20px; --s6: 24px; --s8: 32px; --s10: 40px;
  /* radii, shadows, motion */
  --r-sm: 6px; --r-md: 8px; --r-lg: 12px; --r-full: 999px;
  --shadow-sm: 0 1px 2px rgba(28, 25, 23, .04);
  --shadow-md: 0 1px 2px rgba(28, 25, 23, .04), 0 4px 12px rgba(28, 25, 23, .05);
  --shadow-lg: 0 12px 40px rgba(28, 25, 23, .12), 0 2px 6px rgba(28, 25, 23, .06);
  --ease: cubic-bezier(.2, .8, .2, 1); --t-fast: 120ms; --t-med: 200ms;
  --sidebar-w: 248px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0c0a09; --surface: #141211; --surface-2: #1c1917; --surface-3: #24201e;
    --border: #262220; --border-strong: #3a3532;
    --text: #f5f5f4; --text-2: #a8a29e; --text-3: #6f6964;
    --accent: #2bb3a3; --accent-hover: #3fc6b6; --accent-soft: #10302c; --accent-text: #5fd3c4;
    --ok: #4ade80; --ok-soft: #10251a; --warn: #f5a83b; --warn-soft: #2a1d0c; --bad: #fb7185; --bad-soft: #2c1219; --neutral: #a8a29e; --neutral-soft: #1f1c1a;
    --c1: #2bb3a3; --c2: #7b9cc4; --c3: #d6a04a; --c4: #b88ab0; --c5: #93b882; --c6: #d58a6f; --c7: #a8a29e; --c8: #7a7067; --c-other: #3a3532;
    --grid: #221f1d;
    --shadow-sm: none; --shadow-md: 0 0 0 1px rgba(255,255,255,.02); --shadow-lg: 0 16px 48px rgba(0,0,0,.5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0c0a09; --surface: #141211; --surface-2: #1c1917; --surface-3: #24201e;
  --border: #262220; --border-strong: #3a3532;
  --text: #f5f5f4; --text-2: #a8a29e; --text-3: #6f6964;
  --accent: #2bb3a3; --accent-hover: #3fc6b6; --accent-soft: #10302c; --accent-text: #5fd3c4;
  --ok: #4ade80; --ok-soft: #10251a; --warn: #f5a83b; --warn-soft: #2a1d0c; --bad: #fb7185; --bad-soft: #2c1219; --neutral: #a8a29e; --neutral-soft: #1f1c1a;
  --c1: #2bb3a3; --c2: #7b9cc4; --c3: #d6a04a; --c4: #b88ab0; --c5: #93b882; --c6: #d58a6f; --c7: #a8a29e; --c8: #7a7067; --c-other: #3a3532;
  --grid: #221f1d;
  --shadow-sm: none; --shadow-md: 0 0 0 1px rgba(255,255,255,.02); --shadow-lg: 0 16px 48px rgba(0,0,0,.5);
  color-scheme: dark;
}

/* ---------------------------------------------------------------- base */
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: var(--fs-base)/1.5 var(--font); -webkit-font-smoothing: antialiased; font-feature-settings: "cv11", "ss01"; }
a { color: inherit; text-decoration: none; }
code, .mono { font-family: var(--mono); font-size: 12px; }
::selection { background: var(--accent-soft); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--r-sm); }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--text-2); } .faint { color: var(--text-3); }
.sm { font-size: var(--fs-sm); } .xs { font-size: var(--fs-xs); }
.up { color: var(--bad); } .down { color: var(--ok); }
svg.i { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

/* ---------------------------------------------------------------- shell */
.shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--surface-2); border-right: 1px solid var(--border); padding: var(--s4) var(--s3); display: flex; flex-direction: column; gap: var(--s5); }
.brand { display: flex; align-items: center; gap: 10px; padding: 2px var(--s2) 0; font-weight: 600; font-size: var(--fs-base); letter-spacing: -.01em; }
.brand .mark { width: 26px; height: 26px; border-radius: 7px; background: var(--text); color: var(--bg); display: grid; place-items: center; }
.brand .mark svg { width: 15px; height: 15px; stroke-width: 2; }
.brand small { display: block; font-weight: 400; font-size: var(--fs-xs); color: var(--text-3); margin-top: -2px; }
.nav-group { display: flex; flex-direction: column; gap: 1px; }
.nav-label { font-size: var(--fs-xs); font-weight: 500; color: var(--text-3); text-transform: uppercase; letter-spacing: .06em; padding: 0 var(--s2) var(--s1); display: flex; justify-content: space-between; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 6px var(--s2); border-radius: var(--r-sm); color: var(--text-2); font-size: var(--fs-md); transition: background var(--t-fast), color var(--t-fast); }
.nav-item:hover { background: var(--surface-3); color: var(--text); }
.nav-item.on { background: var(--surface); color: var(--text); font-weight: 500; box-shadow: var(--shadow-sm), 0 0 0 1px var(--border); }
.nav-item .count { margin-left: auto; font-size: var(--fs-xs); color: var(--text-3); font-variant-numeric: tabular-nums; }
.nav-item .dot { width: 6px; height: 6px; border-radius: 50%; margin-left: 6px; flex: none; }
.cat { margin-top: var(--s1); }
.cat-head { display: flex; align-items: center; gap: 8px; padding: 5px var(--s2); color: var(--text-2); font-size: var(--fs-md); border-radius: var(--r-sm); cursor: pointer; user-select: none; width: 100%; background: none; border: 0; font: inherit; text-align: left; }
.cat-head:hover { background: var(--surface-3); color: var(--text); }
.cat-head .chev { margin-left: auto; transition: transform var(--t-fast); color: var(--text-3); width: 14px; height: 14px; }
.cat.closed .chev { transform: rotate(-90deg); }
.cat.closed .cat-items { display: none; }
.cat-items { display: flex; flex-direction: column; gap: 1px; padding-left: 18px; margin-left: 9px; border-left: 1px solid var(--border); }
.cat-items .nav-item { font-size: var(--fs-md); padding: 4px var(--s2); }
.sidebar-foot { margin-top: auto; padding: var(--s2); font-size: var(--fs-xs); color: var(--text-3); line-height: 1.6; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; height: 56px; display: flex; align-items: center; gap: var(--s3); padding: 0 var(--s8); background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--border); }
.crumbs { display: flex; align-items: center; gap: 6px; font-size: var(--fs-md); color: var(--text-2); min-width: 0; white-space: nowrap; overflow: hidden; }
.crumbs a:hover { color: var(--text); }
.crumbs .sep { color: var(--text-3); }
.crumbs b { color: var(--text); font-weight: 500; overflow: hidden; text-overflow: ellipsis; }
.topbar .spacer { flex: 1; }
.btn.menu-btn { display: none; }
.content { padding: var(--s6) var(--s8) var(--s10); max-width: 1480px; width: 100%; margin: 0 auto; }

/* ---------------------------------------------------------------- controls */
.btn { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: var(--r-md); border: 1px solid var(--border); background: var(--surface); color: var(--text); font: 500 var(--fs-md) var(--font); cursor: pointer; transition: background var(--t-fast), border-color var(--t-fast), transform var(--t-fast); box-shadow: var(--shadow-sm); white-space: nowrap; }
.btn:hover { background: var(--surface-2); border-color: var(--border-strong); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--text); color: var(--bg); border-color: var(--text); }
.btn.primary:hover { opacity: .88; }
.btn.ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-3); color: var(--text); }
.btn.icon { width: 32px; padding: 0; justify-content: center; }
.btn.busy svg { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.seg { display: inline-flex; padding: 2px; background: var(--surface-3); border-radius: var(--r-md); gap: 2px; }
.seg button { height: 26px; padding: 0 10px; border: 0; background: transparent; color: var(--text-2); font: 500 var(--fs-sm) var(--font); border-radius: 6px; cursor: pointer; transition: background var(--t-fast), color var(--t-fast); white-space: nowrap; }
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm), 0 0 0 1px var(--border); }
.seg button .n { color: var(--text-3); margin-left: 4px; font-variant-numeric: tabular-nums; }
.input, .select { height: 32px; border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: var(--r-md); font: var(--fs-md) var(--font); padding: 0 10px; transition: border-color var(--t-fast), box-shadow var(--t-fast); }
.input:hover, .select:hover { border-color: var(--border-strong); }
.input:focus, .select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.select { appearance: none; padding-right: 30px; cursor: pointer; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23a8a29e' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; }
.search { position: relative; display: flex; align-items: center; }
.search > svg { position: absolute; left: 10px; color: var(--text-3); pointer-events: none; }
.search .input { padding-left: 32px; width: 260px; }
.search kbd { position: absolute; right: 8px; font: 500 10px var(--mono); color: var(--text-3); border: 1px solid var(--border); border-radius: 4px; padding: 1px 5px; background: var(--surface-2); pointer-events: none; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: var(--fs-md); color: var(--text-2); cursor: pointer; user-select: none; }
.check input { appearance: none; width: 28px; height: 16px; border-radius: 999px; background: var(--border-strong); position: relative; cursor: pointer; transition: background var(--t-fast); margin: 0; }
.check input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 12px; height: 12px; border-radius: 50%; background: #fff; transition: transform var(--t-med) var(--ease); box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.check input:checked { background: var(--accent); }
.check input:checked::after { transform: translateX(12px); }

/* global search */
.gsearch { position: relative; }
.gsearch .results { position: absolute; top: 38px; right: 0; width: 320px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); padding: 6px; display: none; z-index: 40; max-height: 360px; overflow: auto; }
.gsearch.open .results { display: block; animation: pop var(--t-med) var(--ease); }
.gsearch .results a { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: var(--r-sm); font-size: var(--fs-md); }
.gsearch .results a.sel, .gsearch .results a:hover { background: var(--surface-2); }
.gsearch .results .meta { margin-left: auto; color: var(--text-3); font-size: var(--fs-xs); }
@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(.98); } }

/* ---------------------------------------------------------------- page header */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s4); margin-bottom: var(--s6); flex-wrap: wrap; }
.page-head h1 { font-size: var(--fs-xl); font-weight: 600; letter-spacing: -.02em; margin: 0; }
.page-head p { margin: 4px 0 0; color: var(--text-2); font-size: var(--fs-md); }
.page-id { display: flex; align-items: center; gap: var(--s3); }
.tile { width: 32px; height: 32px; border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--border); color: var(--text); display: grid; place-items: center; flex: none; }
.tile.lg { width: 44px; height: 44px; border-radius: 10px; }
.tile.lg svg.i { width: 22px; height: 22px; stroke-width: 1.5; }
.tile.sm { width: 26px; height: 26px; border-radius: 6px; }
.tile.sm svg.i { width: 14px; height: 14px; }

/* ---------------------------------------------------------------- cards */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); min-width: 0; }
.card + .card, .grid + .card, .card + .grid, .grid + .grid, .strip + .card, .strip + .grid, .hero + .strip, .callout + .card, .callout + .strip { margin-top: var(--s4); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); padding: var(--s4) var(--s5) 0; flex-wrap: wrap; }
.card-head h2 { font-size: var(--fs-base); font-weight: 600; margin: 0; letter-spacing: -.01em; }
.card-head .sub { font-size: var(--fs-sm); color: var(--text-3); margin-top: 2px; }
.card-body { padding: var(--s4) var(--s5) var(--s5); }
.card-body.flush { padding: var(--s3) 0 0; }
.toolbar { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; padding: var(--s4) var(--s5) var(--s3); }
.toolbar .grow { flex: 1; }
.grid { display: grid; gap: var(--s4); }
.g2 { grid-template-columns: 1fr 1fr; } .g3 { grid-template-columns: 3fr 2fr; } .g32 { grid-template-columns: 2fr 1fr; }

/* hero: the headline number + its chart */
.hero { display: grid; grid-template-columns: minmax(280px, 1fr) 2fr; }
.hero-main { padding: var(--s6); border-right: 1px solid var(--border); display: flex; flex-direction: column; gap: var(--s4); }
.eyebrow { font-size: var(--fs-sm); color: var(--text-2); display: flex; align-items: center; gap: 8px; }
.big { font-size: var(--fs-3xl); font-weight: 600; letter-spacing: -.035em; line-height: 1.05; font-variant-numeric: tabular-nums; }
.big .cents { color: var(--text-3); font-size: .6em; letter-spacing: -.01em; }
.hero-chart { padding: var(--s5) var(--s5) var(--s3); display: flex; flex-direction: column; min-width: 0; }
.legend { display: flex; gap: var(--s4); font-size: var(--fs-sm); color: var(--text-2); flex-wrap: wrap; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 2px; border-radius: 2px; display: inline-block; }
.legend i.dash { background: repeating-linear-gradient(90deg, var(--text-3) 0 3px, transparent 3px 5px) !important; }
.progress { position: relative; height: 6px; border-radius: 999px; background: var(--surface-3); overflow: visible; }
.progress > .fill { position: absolute; inset: 0 auto 0 0; border-radius: 999px; background: var(--accent); transition: width var(--t-med) var(--ease); }
.progress > .mark { position: absolute; top: -3px; width: 2px; height: 12px; background: var(--text); border-radius: 2px; }
.forecast-row { display: flex; justify-content: space-between; font-size: var(--fs-sm); color: var(--text-2); margin-top: 8px; }

/* stat strip: one card, divided cells (not a row of separate boxes) */
.strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.stat { padding: var(--s4) var(--s5); border-right: 1px solid var(--border); min-width: 0; }
.stat:last-child { border-right: 0; }
.stat .label { font-size: var(--fs-sm); color: var(--text-2); display: flex; align-items: center; gap: 6px; }
.stat .value { font-size: var(--fs-2xl); font-weight: 600; letter-spacing: -.03em; margin-top: 4px; font-variant-numeric: tabular-nums; line-height: 1.15; }
.stat .value.md { font-size: var(--fs-xl); }
.stat .foot { font-size: var(--fs-sm); color: var(--text-3); margin-top: 4px; }
.stat .foot a { color: var(--accent-text); }
.mini-bar { display: flex; height: 4px; border-radius: 4px; overflow: hidden; margin-top: 10px; background: var(--surface-3); gap: 2px; }
.mini-bar i { display: block; height: 100%; }

/* badges, chips, status */
.badge { display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 7px; border-radius: var(--r-full); font-size: var(--fs-xs); font-weight: 500; background: var(--neutral-soft); color: var(--text-2); white-space: nowrap; font-variant-numeric: tabular-nums; }
.badge.billed { background: var(--accent-soft); color: var(--accent-text); }
.badge.est { background: var(--warn-soft); color: var(--warn); }
.badge.outline { background: transparent; box-shadow: inset 0 0 0 1px var(--border); }
.badge.up { background: var(--bad-soft); color: var(--bad); } .badge.down { background: var(--ok-soft); color: var(--ok); }
.status { display: inline-flex; align-items: center; gap: 7px; font-size: var(--fs-md); color: var(--text); white-space: nowrap; }
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--neutral); box-shadow: 0 0 0 3px var(--neutral-soft); }
.status.active::before { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.status.idle::before { background: var(--bad); box-shadow: 0 0 0 3px var(--bad-soft); }
.status.underutilized::before { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-soft); }
.status.unknown, .status.na { color: var(--text-2); }
.kind { font: 600 9.5px var(--font); letter-spacing: .05em; padding: 1px 5px; border-radius: 4px; margin-left: 6px; vertical-align: 1px; }
.kind.billed { color: var(--accent-text); background: var(--accent-soft); }
.kind.est { color: var(--warn); background: var(--warn-soft); }

/* ---------------------------------------------------------------- tables */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: separate; border-spacing: 0; font-size: var(--fs-md); }
.t th { position: sticky; top: 0; z-index: 1; background: var(--surface); text-align: left; font-weight: 500; font-size: var(--fs-sm); color: var(--text-3); padding: 8px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; user-select: none; }
.t th:first-child, .t td:first-child { padding-left: var(--s5); }
.t th:last-child, .t td:last-child { padding-right: var(--s5); }
.t th.sortable { cursor: pointer; transition: color var(--t-fast); }
.t th.sortable:hover { color: var(--text); }
.t th .arr { display: inline-block; width: 10px; margin-left: 3px; color: var(--text); }
.t th.r, .t td.r { text-align: right; }
.t td { padding: 11px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; color: var(--text); white-space: nowrap; }
.t td.wrap-cell { white-space: normal; min-width: 200px; }
.t tbody tr:last-child td { border-bottom: 0; }
.t tbody tr { transition: background var(--t-fast); }
.t tbody tr.click { cursor: pointer; }
.t tbody tr.click:hover { background: var(--surface-2); }
.t td.r { font-variant-numeric: tabular-nums; }
.t .name { display: flex; align-items: center; gap: 10px; min-width: 0; }
.t .name b { font-weight: 500; }
.t .name .id { display: block; font: 11px var(--mono); color: var(--text-3); margin-top: 1px; max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.t .sub { color: var(--text-3); font-size: var(--fs-sm); }
.t .nowrap { white-space: nowrap; }
.t .wrap-cell { max-width: 320px; color: var(--text-2); font-size: var(--fs-sm); }
.table-foot { display: flex; justify-content: space-between; padding: 10px var(--s5); border-top: 1px solid var(--border); font-size: var(--fs-sm); color: var(--text-3); }

/* bar lists (breakdowns) */
.bars { display: flex; flex-direction: column; gap: 12px; }
.bars.cols2 { display: grid; grid-template-columns: 1fr 1fr; column-gap: var(--s10); }
@media (max-width: 860px) { .bars.cols2 { grid-template-columns: 1fr; } }
.bars .row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; align-items: baseline; font-size: var(--fs-md); }
.bars .row.click { cursor: pointer; border-radius: var(--r-sm); }
.bars .row.click:hover .lbl { color: var(--accent-text); }
.bars .lbl { display: flex; align-items: center; gap: 8px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; transition: color var(--t-fast); }
.bars .val { font-variant-numeric: tabular-nums; font-weight: 500; }
.bars .val small { color: var(--text-3); font-weight: 400; margin-left: 6px; }
.bars .track { grid-column: 1 / -1; height: 6px; background: var(--surface-3); border-radius: 999px; overflow: hidden; }
.bars .track i { display: block; height: 100%; border-radius: 999px; background: var(--c1); transition: width var(--t-med) var(--ease); }
.diverge { display: flex; flex-direction: column; gap: 10px; }
.diverge .row { display: grid; grid-template-columns: 130px 1fr 1fr 84px; align-items: center; gap: 8px; font-size: var(--fs-md); }
.diverge .neg, .diverge .pos { height: 8px; display: flex; }
.diverge .neg { justify-content: flex-end; border-right: 1px solid var(--border-strong); padding-right: 0; }
.diverge .neg i { background: var(--ok); border-radius: 4px 0 0 4px; }
.diverge .pos i { background: var(--bad); border-radius: 0 4px 4px 0; opacity: .85; }
.diverge .lbl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* attention list */
.list { display: flex; flex-direction: column; }
.list a, .list .li { display: flex; align-items: center; gap: 12px; padding: 10px var(--s5); border-top: 1px solid var(--border); font-size: var(--fs-md); transition: background var(--t-fast); }
.list a:first-child, .list .li:first-child { border-top: 0; }
.list a:hover { background: var(--surface-2); }
.list .grow { flex: 1; min-width: 0; }
.list .grow b { font-weight: 500; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list .grow span { color: var(--text-3); font-size: var(--fs-sm); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* callouts */
.callout { display: flex; gap: 10px; padding: 12px 14px; border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--border); font-size: var(--fs-md); color: var(--text-2); margin-bottom: var(--s4); }
.callout svg { margin-top: 2px; color: var(--text-3); }
.callout.err { background: var(--bad-soft); border-color: transparent; color: var(--bad); }
.callout.err svg { color: var(--bad); }
.callout.tip { background: var(--accent-soft); border-color: transparent; color: var(--text); }
.callout.tip svg { color: var(--accent-text); }

/* charts */
.chart { position: relative; height: 240px; }
.chart.tall { height: 300px; }
.chart.short { height: 170px; }

/* empty + skeleton */
.empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 40px 20px; color: var(--text-3); text-align: center; font-size: var(--fs-md); }
.empty .tile { color: var(--text-3); margin-bottom: 4px; }
.empty b { color: var(--text); font-weight: 500; }
.sk { background: linear-gradient(90deg, var(--surface-3) 25%, var(--surface-2) 37%, var(--surface-3) 63%); background-size: 400% 100%; animation: shimmer 1.4s ease infinite; border-radius: var(--r-sm); }
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
.sk-line { height: 12px; margin: 8px 0; } .sk-big { height: 40px; width: 60%; margin: 6px 0 14px; } .sk-block { height: 220px; border-radius: var(--r-md); }

/* page transitions */
.fade { animation: fade var(--t-med) var(--ease); }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } }
.dim { opacity: .55; pointer-events: none; transition: opacity var(--t-med); }

/* drawer */
.scrim { position: fixed; inset: 0; background: rgba(12, 10, 9, .28); z-index: 50; opacity: 0; pointer-events: none; transition: opacity var(--t-med); }
.scrim.open { opacity: 1; pointer-events: auto; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100vw); background: var(--surface); border-left: 1px solid var(--border); box-shadow: var(--shadow-lg); z-index: 51; transform: translateX(100%); transition: transform 260ms var(--ease); display: flex; flex-direction: column; }
.drawer.open { transform: none; }
.drawer-head { padding: var(--s5); border-bottom: 1px solid var(--border); display: flex; gap: var(--s3); align-items: flex-start; }
.drawer-head h3 { margin: 0; font-size: var(--fs-lg); font-weight: 600; letter-spacing: -.01em; word-break: break-all; }
.drawer-head .id { font: 11px var(--mono); color: var(--text-3); word-break: break-all; margin-top: 2px; }
.drawer-body { padding: var(--s5); overflow-y: auto; display: flex; flex-direction: column; gap: var(--s5); }
.section-title { font-size: var(--fs-xs); font-weight: 500; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); margin: 0 0 var(--s2); }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 0; font-size: var(--fs-md); }
.kv > div { padding: 7px 0; border-bottom: 1px solid var(--border); min-width: 0; overflow-wrap: anywhere; }
.kv > div:nth-child(odd) { color: var(--text-2); }
.kv > div:nth-last-child(-n+2) { border-bottom: 0; }
.facts { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--border); border-radius: var(--r-md); }
.facts > div { padding: 10px 12px; border-right: 1px solid var(--border); }
.facts > div:last-child { border-right: 0; }
.facts .l { font-size: var(--fs-xs); color: var(--text-3); }
.facts .v { font-size: var(--fs-lg); font-weight: 600; margin-top: 2px; font-variant-numeric: tabular-nums; }

/* data sources */
.src { display: grid; grid-template-columns: 28px 1fr auto; gap: 12px; padding: 14px var(--s5); border-top: 1px solid var(--border); align-items: start; }
.src:first-child { border-top: 0; }
.src .ic { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; margin-top: 1px; }
.src .ic.ok { background: var(--ok-soft); color: var(--ok); } .src .ic.no { background: var(--warn-soft); color: var(--warn); }
.src .ic svg { width: 13px; height: 13px; stroke-width: 2.2; }
.src b { font-weight: 500; } .src p { margin: 2px 0 0; color: var(--text-2); font-size: var(--fs-md); }

.foot-fresh { display: flex; gap: var(--s4); flex-wrap: wrap; color: var(--text-3); font-size: var(--fs-sm); margin-top: var(--s5); }
.foot-fresh span { display: inline-flex; align-items: center; gap: 6px; }

/* ---------------------------------------------------------------- responsive */
@media (max-width: 1100px) { .hero { grid-template-columns: 1fr; } .hero-main { border-right: 0; border-bottom: 1px solid var(--border); } .g3, .g32 { grid-template-columns: 1fr; } }
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 60; left: 0; top: 0; width: var(--sidebar-w); transform: translateX(-100%); transition: transform 240ms var(--ease); box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: none; }
  .btn.menu-btn { display: inline-flex; }
  .topbar { padding: 0 var(--s4); }
  .content { padding: var(--s4) var(--s4) var(--s8); }
  .g2 { grid-template-columns: 1fr; }
  .search .input { width: 100%; }
  .gsearch .input { width: 160px; }
  .stat { border-right: 0; border-bottom: 1px solid var(--border); }
  .diverge .row { grid-template-columns: 100px 1fr 1fr 70px; }
}
@media (max-width: 600px) { .gsearch { display: none; } .topbar { gap: var(--s2); } #refresh span { display: none; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ---------------------------------------------------------------- date range picker */
.range { position: relative; }
.range-pop { position: absolute; top: 40px; right: 0; z-index: 45; display: none; grid-template-columns: 250px 290px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); overflow: hidden; }
.range.open .range-pop { display: grid; animation: pop var(--t-med) var(--ease); }
.range-presets { padding: 8px; border-right: 1px solid var(--border); background: var(--surface-2); display: flex; flex-direction: column; gap: 1px; }
.range-presets button { display: flex; justify-content: space-between; align-items: center; gap: 8px; text-align: left; border: 0; background: transparent; color: var(--text-2); font: var(--fs-md) var(--font); padding: 7px 10px; border-radius: var(--r-sm); cursor: pointer; transition: background var(--t-fast), color var(--t-fast); }
.range-presets button:hover { background: var(--surface-3); color: var(--text); }
.range-presets button.on { background: var(--surface); color: var(--text); font-weight: 500; box-shadow: var(--shadow-sm), 0 0 0 1px var(--border); }
.range-presets button span { white-space: nowrap; }
.range-presets button small { color: var(--text-3); font-size: var(--fs-xs); white-space: nowrap; }
.range-custom { padding: 14px 16px 16px; }
.range-dates { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 10px; }
.range-dates label { display: flex; flex-direction: column; gap: 4px; font-size: var(--fs-xs); color: var(--text-2); }
.range-dates .input { width: 100%; padding: 0 8px; font-size: var(--fs-sm); }
.range-err { color: var(--bad); font-size: var(--fs-xs); min-height: 0; margin-bottom: 6px; }
.range-err:empty { display: none; }
.range-sep { height: 1px; background: var(--border); margin: 16px -16px 14px; }
#range-btn .lbl { max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
#range-btn .chev { width: 14px; height: 14px; color: var(--text-3); }
.range-chip { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px; border-radius: var(--r-full); background: var(--surface-3); color: var(--text-2); font-size: var(--fs-xs); font-weight: 500; }
@media (max-width: 600px) {
  .range-pop { position: fixed; top: 64px; left: 12px; right: 12px; grid-template-columns: 1fr; }
  .range-presets { border-right: 0; border-bottom: 1px solid var(--border); display: grid; grid-template-columns: 1fr 1fr; }
  #range-btn .lbl { max-width: 110px; }
}

/* ---------------------------------------------------------------- usage vs billed split */
.kind.usage { color: var(--text); background: var(--surface-3); }
.split { display: flex; align-items: flex-end; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.split .op { color: var(--text-3); font-size: var(--fs-md); padding-bottom: 5px; }
.split-cell { display: flex; flex-direction: column; gap: 1px; padding: 4px 8px; border-radius: var(--r-sm); }
.split-cell small { font-size: var(--fs-xs); color: var(--text-3); }
.split-cell b { font-weight: 500; font-size: var(--fs-md); color: var(--text-2); }
.split-cell.on { background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--border); }
.split-cell.on b { color: var(--text); font-weight: 600; }
.split.lg { margin-top: 0; gap: 14px; }
.split.lg .split-cell { padding: 6px 12px; }
.split.lg .split-cell b { font-size: var(--fs-lg); }
.split-card + .callout, .split-card + .card { margin-top: var(--s4); }
.brand .mark svg { stroke-width: 2.2; }
@media (max-width: 1100px) { #basis { display: none; } }

/* ---------------------------------------------------------------- signed-in user (sidebar foot) */
.user { display: flex; align-items: center; gap: 10px; padding: 10px 4px; margin-bottom: 8px; border-top: 1px solid var(--border); }
.user .avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--surface-3); color: var(--text); display: grid; place-items: center; font-size: 11px; font-weight: 600; flex: none; }
.user .who { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.user .who b { font-size: var(--fs-md); font-weight: 500; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user .who small { font-size: var(--fs-xs); color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------------------------------------------------------------- sidebar: fixed top and bottom, only services scroll */
.sidebar { overflow: hidden; gap: var(--s4); padding-bottom: 0; }
.sidebar .brand, #nav-primary, .sidebar-foot { flex: none; }
#nav-services { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; margin: 0 calc(-1 * var(--s3)); padding: 0 var(--s3) var(--s3);
                scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
#nav-services .nav-label { position: sticky; top: 0; z-index: 1; background: var(--surface-2); padding-top: var(--s1); padding-bottom: var(--s2); }
.sidebar-foot { margin-top: 0; padding: 0 var(--s2) var(--s3); background: var(--surface-2); border-top: 1px solid var(--border); }
.sidebar-foot .user { border-top: 0; margin-bottom: 4px; }
