/* Utility Workbench (Analyst+Co) - visual system matched to Depreciation Workbench:
   Inter, navy app chrome, teal accent, warm-gray canvas, white cards with
   header strips and uppercase section titles. */

:root {
  color-scheme: light;
  /* brand (Depreciation Workbench tokens) */
  --teal: #1D9E75;
  --teal-dark: #0F6E56;
  --teal-light: #5DCAA5;
  --teal-rgb: 29, 158, 117;
  --navy: #1a2332;

  /* surfaces & text - names kept stable; app.js reads several of these */
  --bg: #f0efeb;            /* page canvas */
  --panel: #ffffff;         /* cards */
  --panel-head: #f5f5f3;    /* card header strips */
  --panel-2: #f8f9fa;       /* hover rows, tiles */
  --ink: #212529;
  --ink-strong: #2c3e50;
  --ink-soft: #495057;
  --ink-muted: #6c757d;
  --neg: #c0392b;
  --rule: #e9ecef;
  --rule-strong: #dee2e6;
  --grid: rgba(0, 0, 0, 0.06);
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.12);
  --input-bg: #ffffff;

  /* chart series - validated categorical order (light); --single is brand teal */
  --single: #1D9E75;
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100;
  --s5: #e87ba4; --s6: #008300; --s7: #4a3aa7; --s8: #e34948;
  --context: #c3c7cc;

  --text: "Inter", -apple-system, "Segoe UI", system-ui, sans-serif;
  --display: var(--text);
  --mono: var(--text);
  --radius: 8px;
  --appbar-h: 60px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #111822; --panel: #1b2433; --panel-head: #202b3c; --panel-2: #222d3f;
    --ink: #e9ecef; --ink-strong: #ffffff; --ink-soft: #c5ccd6; --ink-muted: #8d97a5;
    --neg: #ef8a80;
    --rule: rgba(255, 255, 255, 0.08); --rule-strong: rgba(255, 255, 255, 0.14);
    --grid: rgba(255, 255, 255, 0.07);
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.4); --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.5);
    --input-bg: #151d2a;
    --single: #1D9E75;
    --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500;
    --s5: #d55181; --s6: #008300; --s7: #9085e9; --s8: #e66767;
    --context: #3d4a5c;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111822; --panel: #1b2433; --panel-head: #202b3c; --panel-2: #222d3f;
  --ink: #e9ecef; --ink-strong: #ffffff; --ink-soft: #c5ccd6; --ink-muted: #8d97a5;
  --neg: #ef8a80;
  --rule: rgba(255, 255, 255, 0.08); --rule-strong: rgba(255, 255, 255, 0.14);
  --grid: rgba(255, 255, 255, 0.07);
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.4); --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.5);
  --input-bg: #151d2a;
  --single: #1D9E75;
  --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500;
  --s5: #d55181; --s6: #008300; --s7: #9085e9; --s8: #e66767;
  --context: #3d4a5c;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.5 var(--text);
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
h1, h2, h3 { margin: 0; font-weight: 700; letter-spacing: -0.01em; color: var(--ink-strong); }
h1 { font-size: 2rem; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1rem; margin-bottom: 0.75rem; }
a { color: var(--teal); }
a:hover { color: var(--teal-dark); }
.muted { color: var(--ink-muted); }
.small { font-size: 0.8rem; }

/* Controls */
input, select, button { font: inherit; color: inherit; }
input, select {
  background: var(--input-bg);
  border: 1px solid var(--rule-strong);
  border-radius: 6px;
  padding: 0.4rem 0.65rem;
  min-height: 36px;
  max-width: 100%;
  font-size: 0.875rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
input:focus, select:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 0.2rem rgba(var(--teal-rgb), 0.2); }
button:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }
label { display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.72rem; color: var(--ink-muted); font-weight: 600; }
label.check { flex-direction: row; align-items: center; gap: 0.45rem; font-size: 0.85rem; font-weight: 500; color: var(--ink-soft); min-height: 36px; }
label.check input { min-height: 0; accent-color: var(--teal); }

.btn {
  border: 1px solid var(--rule-strong);
  background: var(--panel);
  color: var(--ink-soft);
  border-radius: 6px;
  padding: 0.4rem 0.9rem;
  min-height: 36px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.85rem;
  transition: all 0.15s ease;
}
.btn:hover { border-color: var(--teal); color: var(--teal); }
.btn.primary { background: var(--teal); border-color: var(--teal); color: #fff; }
.btn.primary:hover { background: var(--teal-dark); border-color: var(--teal-dark); color: #fff; box-shadow: 0 4px 12px rgba(var(--teal-rgb), 0.35); }
.btn.block { width: 100%; }
.btn.small { min-height: 28px; padding: 0.15rem 0.6rem; font-size: 0.75rem; }
.link { background: none; border: 0; color: var(--teal); cursor: pointer; padding: 0; font-weight: 600; }
.link:hover { text-decoration: underline; }

.form-error { color: var(--neg); margin: 0; min-height: 1.2em; font-size: 0.85rem; }
.notice { background: rgba(var(--teal-rgb), 0.08); border: 1px solid rgba(var(--teal-rgb), 0.25); border-radius: 6px; padding: 0.6rem 0.8rem; font-size: 0.875rem; }
.notice code { font-family: ui-monospace, Menlo, monospace; }
.stack { display: flex; flex-direction: column; gap: 0.9rem; }
.row-end { display: flex; justify-content: flex-end; gap: 0.5rem; }

/* App icon - teal squircle, the Depreciation Workbench mark treatment */
.app-icon {
  width: 36px; height: 36px; border-radius: 10px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--teal) 0%, var(--teal-dark) 100%);
  color: #fff; font-weight: 800; font-size: 0.8rem; letter-spacing: 0.02em;
  box-shadow: 0 2px 6px rgba(var(--teal-rgb), 0.35);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.brand:hover .app-icon { transform: scale(1.08) rotate(-3deg); }
.app-icon.lg { width: 64px; height: 64px; border-radius: 16px; font-size: 1.35rem; }

/* Analyst+Co wordmark, inline */
.aco { font-weight: 700; letter-spacing: -0.02em; }
.aco b { color: var(--teal); font-weight: 600; }

/* ------------------------------------------------------------------ Sign in */
.auth {
  min-height: 100vh; display: flex;
  background:
    radial-gradient(1200px 600px at 15% 20%, rgba(var(--teal-rgb), 0.18), transparent 60%),
    linear-gradient(160deg, #1a2332 0%, #0f141c 100%);
  color: #f8f9fa;
}
.auth-brand { flex: 6; display: flex; flex-direction: column; justify-content: center; padding: 48px 8%; }
.lockup { display: flex; align-items: center; gap: 16px; margin-bottom: 2.5rem; }
.lockup-text { font-size: 1.6rem; font-weight: 800; line-height: 1.05; letter-spacing: -0.02em; color: #fff; }
.auth-brand h1 { color: #fff; font-size: clamp(1.8rem, 3.2vw, 2.8rem); font-weight: 700; line-height: 1.15; max-width: 16em; letter-spacing: -0.02em; }
.auth-brand > p { color: rgba(255, 255, 255, 0.65); font-size: 1.05rem; font-weight: 300; max-width: 32em; margin: 1rem 0 0; }
.auth-brand .auth-foot { margin-top: 3rem; font-size: 0.8rem; color: rgba(255, 255, 255, 0.45); font-weight: 400; }
.auth-brand .auth-foot .aco { color: #fff; }
.auth-brand a { color: var(--teal-light); }
.auth-panel {
  flex: 4; background: #111418; display: flex; align-items: center; justify-content: center;
  padding: 48px; border-left: 1px solid rgba(255, 255, 255, 0.05); box-shadow: -15px 0 30px rgba(0, 0, 0, 0.5);
}
.auth-form { width: 100%; max-width: 380px; }
.auth-form h2 { color: #fff; font-size: 1.6rem; }
.auth-sub { color: rgba(255, 255, 255, 0.5); margin: 0.35rem 0 1.75rem; }
.auth-form label { color: rgba(255, 255, 255, 0.7); font-size: 0.78rem; }
.auth-form input {
  background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.1);
  color: #fff; padding: 12px 14px; border-radius: 10px; min-height: 46px; font-size: 0.95rem;
}
.auth-form input:focus { background: rgba(255, 255, 255, 0.08); border-color: var(--teal); }
.auth-form .btn.primary { padding: 12px; border-radius: 10px; min-height: 48px; font-size: 0.95rem; margin-top: 0.25rem; }
.auth-form .form-error { color: #ff9a8f; }
.auth-switch { margin: 1rem 0 0; }
.auth-switch .link { color: var(--teal-light); }
.auth-note { color: rgba(255, 255, 255, 0.4); font-size: 0.8rem; margin: 1.5rem 0 0; }
.auth-note a { color: var(--teal-light); }

/* ------------------------------------------------------------------ App bar */
.topbar {
  display: flex; align-items: center; gap: 1.75rem; flex-wrap: wrap;
  min-height: var(--appbar-h);
  padding: 0 clamp(16px, 2.5vw, 28px);
  background: var(--navy);
  color: #fff;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
  position: sticky; top: 0; z-index: 10;
}
.brand { display: flex; align-items: center; gap: 0.7rem; }
.brand-name { font-weight: 700; font-size: 1.05rem; letter-spacing: -0.01em; }
.brand-scope {
  font-size: 0.65rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.5); border-left: 1px solid rgba(255, 255, 255, 0.15); padding-left: 0.7rem;
}
.tabs { display: flex; gap: 0.2rem; flex-wrap: wrap; align-self: stretch; }
.tab {
  background: none; border: 0; padding: 0 0.95rem; cursor: pointer;
  color: rgba(255, 255, 255, 0.72); font-weight: 500; font-size: 0.875rem;
  border-bottom: 3px solid transparent; border-top: 3px solid transparent;
  transition: color 0.2s ease, background-color 0.2s ease;
}
.tab:hover { color: #fff; background: rgba(255, 255, 255, 0.08); }
.tab[aria-current="page"] { color: var(--teal-light); font-weight: 700; border-bottom-color: var(--teal); background: rgba(var(--teal-rgb), 0.18); }
.account { margin-left: auto; display: flex; gap: 0.5rem; align-items: center; }
.icon-btn {
  background: none; border: 1px solid rgba(255, 255, 255, 0.15); color: rgba(255, 255, 255, 0.75);
  border-radius: 8px; width: 34px; height: 34px; cursor: pointer;
}
.icon-btn:hover { color: #fff; background: rgba(255, 255, 255, 0.08); }
.menu { position: relative; }
.menu summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; gap: 0.5rem;
  padding: 4px 10px 4px 4px; border-radius: 8px; font-size: 0.85rem; font-weight: 600; color: #fff;
}
.menu summary:hover { background: rgba(255, 255, 255, 0.08); }
.menu summary::-webkit-details-marker { display: none; }
.avatar {
  width: 28px; height: 28px; border-radius: 50%; background: var(--teal); color: #fff;
  display: inline-flex; align-items: center; justify-content: center; font-size: 0.68rem; font-weight: 700;
}
.menu-panel {
  position: absolute; right: 0; top: calc(100% + 6px); background: var(--panel); color: var(--ink);
  border: 1px solid var(--rule-strong); border-radius: 8px; box-shadow: var(--shadow-md);
  display: flex; flex-direction: column; min-width: 190px; padding: 0.3rem; z-index: 20;
}
.menu-panel button { background: none; border: 0; text-align: left; padding: 0.5rem 0.7rem; cursor: pointer; border-radius: 6px; font-size: 0.85rem; }
.menu-panel button:hover { background: var(--panel-2); color: var(--teal); }

/* ------------------------------------------------------------------ Layout */
.content { max-width: 1400px; margin: 0 auto; padding: 1.5rem clamp(16px, 2.5vw, 28px) 3rem; }
.view { display: flex; flex-direction: column; gap: 1.25rem; }
.view-head h2 { margin-bottom: 0.2rem; }
.view-head p { margin: 0; color: var(--ink-muted); }
.filters {
  display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: flex-end;
  background: var(--panel); border: 1px solid var(--rule); border-radius: var(--radius);
  padding: 0.75rem 1rem; box-shadow: var(--shadow);
}
.filters .grow { flex: 1 1 260px; }
.filters .spacer { flex: 1; }

/* Cards: white body, light header strip, uppercase title with teal marker */
.panel {
  background: var(--panel); border: 1px solid var(--rule); border-radius: var(--radius);
  padding: 1rem 1.1rem; box-shadow: var(--shadow); min-width: 0;
}
.panel > h3:first-child, .panel > .picker-head:first-child {
  margin: -1rem -1.1rem 1rem; padding: 0.7rem 1.1rem;
  background: var(--panel-head); border-bottom: 1px solid var(--rule);
  border-radius: var(--radius) var(--radius) 0 0;
}
.panel > h3:first-child, .picker-head h3 {
  font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--ink-muted); display: flex; align-items: center; gap: 6px;
}
.panel > h3:first-child::before, .picker-head h3::before {
  content: ""; width: 3px; height: 11px; border-radius: 2px; background: var(--teal); flex: none;
}
.panel > h3 .muted { text-transform: none; letter-spacing: 0; font-weight: 400; }
.picker-head h3 { margin: 0; }

/* Stat tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(165px, 1fr)); gap: 0.75rem; }
.tile {
  background: var(--panel); border: 1px solid var(--rule); border-radius: var(--radius);
  padding: 0.8rem 0.95rem; box-shadow: var(--shadow); position: relative; overflow: hidden;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.tile::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--teal); opacity: 0.85; }
.tile:hover { transform: translateY(-2px); border-color: var(--teal); box-shadow: 0 4px 10px rgba(0, 0, 0, 0.06); }
.tile .label { font-size: 0.7rem; font-weight: 600; color: var(--ink-muted); }
.tile .value { font-size: 1.45rem; font-weight: 700; color: var(--ink-strong); margin: 0.1rem 0; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.tile .delta { font-size: 0.75rem; font-weight: 500; color: var(--ink-muted); font-variant-numeric: tabular-nums; }
.tile .delta.up::before { content: "▲ "; font-size: 0.7em; color: var(--teal); }
.tile .delta.down::before { content: "▼ "; font-size: 0.7em; color: var(--neg); }

/* Charts */
.chart-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 0.75rem; }
.chart-box { position: relative; height: 240px; }
.chart-box.tall { height: 340px; }

/* Tables */
.table-wrap { overflow-x: auto; }
table.ledger { border-collapse: collapse; width: 100%; font-size: 0.82rem; font-variant-numeric: tabular-nums; }
.ledger th, .ledger td { padding: 0.45rem 0.65rem; border-bottom: 1px solid var(--rule); text-align: right; white-space: nowrap; }
.ledger th:first-child, .ledger td:first-child { text-align: left; position: sticky; left: 0; background: var(--panel); }
.ledger thead th {
  font-size: 0.7rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--ink-muted); border-bottom: 1px solid var(--rule-strong); background: var(--panel);
}
.ledger th.text { text-align: left; }
.ledger td { color: var(--ink); }
.ledger td:first-child, .ledger td.text { text-align: left; }
.ledger td:first-child { font-weight: 500; }
.ledger td.neg { color: var(--neg); }
.ledger tr.group td {
  background: var(--panel-head); color: var(--ink-strong); font-weight: 700; font-size: 0.75rem;
  text-transform: uppercase; letter-spacing: 0.04em; padding-top: 0.55rem;
}
.ledger tr.subtotal td { font-weight: 700; color: var(--ink-strong); }
.ledger tbody tr:hover td { background: rgba(var(--teal-rgb), 0.05); }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 0.45rem; vertical-align: baseline; }

/* Compare */
.compare-layout { display: grid; grid-template-columns: 290px minmax(0, 1fr); gap: 1rem; align-items: start; }
.compare-main { display: flex; flex-direction: column; gap: 1rem; min-width: 0; }
.picker { position: sticky; top: calc(var(--appbar-h) + 16px); max-height: calc(100vh - var(--appbar-h) - 32px); display: flex; flex-direction: column; }
.picker-head { display: flex; justify-content: space-between; align-items: center; }
.chips { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-bottom: 0.4rem; }
.chip {
  border: 1px solid var(--rule-strong); background: var(--panel); color: var(--ink-soft);
  border-radius: 999px; padding: 0.2rem 0.7rem; font-size: 0.75rem; font-weight: 600; cursor: pointer;
}
.chip:hover { border-color: var(--teal); color: var(--teal); background: rgba(var(--teal-rgb), 0.06); }
.picker-list { overflow-y: auto; margin: 0.25rem -0.3rem 0; }
.picker-list .state {
  font-size: 0.68rem; font-weight: 700; color: var(--ink-muted); text-transform: uppercase;
  letter-spacing: 0.06em; padding: 0.7rem 0.3rem 0.2rem;
}
.picker-list label.check { min-height: 30px; padding: 0 0.3rem; border-radius: 6px; color: var(--ink); font-weight: 400; }
.picker-list label.check:hover { background: rgba(var(--teal-rgb), 0.06); }
.picker-list .dot { width: 10px; height: 10px; border-radius: 3px; margin-left: auto; flex: none; }

.source { margin-top: 2rem; font-size: 0.75rem; color: var(--ink-muted); border-top: 1px solid var(--rule-strong); padding-top: 0.9rem; }
.source p { margin: 0 0 0.3rem; }
.inline-form { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: flex-end; }

dialog {
  border: 1px solid var(--rule-strong); border-radius: 12px; background: var(--panel); color: var(--ink);
  width: min(400px, calc(100vw - 32px)); padding: 1.5rem; box-shadow: var(--shadow-md);
}
dialog h3 { font-size: 1.1rem; }
dialog::backdrop { background: rgba(10, 14, 20, 0.6); backdrop-filter: blur(2px); }

/* ------------------------------------------------------------ Drill-down */
.drillable { cursor: pointer; }
.tile.drillable:focus-visible, td.drillable:focus-visible, tr.drillable:focus-visible,
.term.drillable:focus-visible { outline: 2px solid var(--teal); outline-offset: -2px; }
.tile.drillable .label::after { content: " ›"; color: var(--teal); opacity: 0; transition: opacity 0.15s ease; }
.tile.drillable:hover .label::after { opacity: 1; }
.ledger td.drillable:hover { color: var(--teal); text-decoration: underline; text-underline-offset: 3px; }
.ledger td.drill-label.drillable:hover { color: var(--teal); }

body.drill-open { overflow: hidden; }
.drill { position: fixed; inset: 0; z-index: 50; }
.drill-backdrop { position: absolute; inset: 0; background: rgba(10, 14, 20, 0.45); backdrop-filter: blur(1px); }
.drill-panel {
  position: absolute; top: 0; right: 0; bottom: 0; width: min(820px, 100vw);
  background: var(--bg); box-shadow: -12px 0 32px rgba(0, 0, 0, 0.25);
  display: flex; flex-direction: column; outline: none;
  animation: drill-in 0.2s ease-out;
}
@keyframes drill-in { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .drill-panel { animation: none; } }
.drill-head {
  display: flex; align-items: center; gap: 0.75rem; min-height: var(--appbar-h);
  padding: 0 1rem 0 1.25rem; background: var(--navy); color: #fff; flex: none;
}
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 0.2rem; flex: 1; min-width: 0; font-size: 0.8rem; }
.crumb {
  background: none; border: 0; color: rgba(255, 255, 255, 0.65); cursor: pointer;
  padding: 0.2rem 0.35rem; border-radius: 4px; font-weight: 500;
}
.crumb:hover { color: #fff; background: rgba(255, 255, 255, 0.08); }
.crumb + .crumb::before, .crumb + .crumb.current::before { content: "›"; margin-right: 0.45rem; color: rgba(255, 255, 255, 0.35); }
.crumb.current { color: var(--teal-light); font-weight: 700; cursor: default; }
.drill-close {
  background: none; border: 1px solid rgba(255, 255, 255, 0.15); color: rgba(255, 255, 255, 0.8);
  width: 34px; height: 34px; border-radius: 8px; font-size: 1.3rem; line-height: 1; cursor: pointer; flex: none;
}
.drill-close:hover { color: #fff; background: rgba(255, 255, 255, 0.1); }
.drill-body { flex: 1; overflow-y: auto; padding: 1.25rem; display: flex; flex-direction: column; gap: 1rem; }
.drill-loading, .drill-empty { color: var(--ink-muted); }
.drill-empty { background: var(--panel); border: 1px solid var(--rule); border-radius: var(--radius); padding: 1rem; }
.drill-title { background: var(--panel); border: 1px solid var(--rule); border-radius: var(--radius); padding: 1rem 1.1rem; box-shadow: var(--shadow); }
.drill-eyebrow { margin: 0 0 0.2rem; font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-muted); }
.drill-figure { display: flex; align-items: baseline; flex-wrap: wrap; gap: 0.3rem 0.9rem; margin: 0.35rem 0 0.25rem; }
.drill-value { font-size: 1.9rem; font-weight: 700; color: var(--ink-strong); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.drill-delta { font-size: 0.85rem; color: var(--ink-muted); font-variant-numeric: tabular-nums; }
.drill-source { margin: 0; font-size: 0.8rem; color: var(--ink-muted); }
.drill-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.75rem; }
.drill-section { background: var(--panel); border: 1px solid var(--rule); border-radius: var(--radius); padding: 1rem 1.1rem; box-shadow: var(--shadow); min-width: 0; }
.drill-section > h3:first-child {
  margin: -1rem -1.1rem 1rem; padding: 0.7rem 1.1rem; background: var(--panel-head);
  border-bottom: 1px solid var(--rule); border-radius: var(--radius) var(--radius) 0 0;
  font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--ink-muted); display: flex; align-items: center; gap: 6px;
}
.drill-section > h3:first-child::before { content: ""; width: 3px; height: 11px; border-radius: 2px; background: var(--teal); flex: none; }
.tie-out { margin-left: auto; text-transform: none; letter-spacing: 0; font-weight: 600; color: var(--teal); }
.drill-hint { margin: 0.6rem 0 0; font-size: 0.78rem; color: var(--ink-muted); }
.formula { margin: 0 0 0.9rem; font-weight: 600; color: var(--ink-strong); }
.terms { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 0.6rem; }
.term { border: 1px solid var(--rule-strong); border-radius: var(--radius); padding: 0.7rem 0.85rem; background: var(--panel-2); }
.term.drillable:hover { border-color: var(--teal); background: rgba(var(--teal-rgb), 0.06); }
.term .label { font-size: 0.72rem; font-weight: 600; color: var(--ink-muted); }
.term.drillable .label::after { content: " ›"; color: var(--teal); }
.term .value { font-size: 1.2rem; font-weight: 700; color: var(--ink-strong); font-variant-numeric: tabular-nums; }
.term .delta { font-size: 0.75rem; color: var(--ink-muted); }
.drill-table td:first-child { white-space: normal; min-width: 170px; }
.drill-table td.acct { color: var(--ink-muted); font-size: 0.78rem; }
.drill-table tr.drill-row td:first-child { color: var(--teal-dark); font-weight: 600; }
:root[data-theme="dark"] .drill-table tr.drill-row td:first-child { color: var(--teal-light); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .drill-table tr.drill-row td:first-child { color: var(--teal-light); } }
.drill-table .chev { margin-left: 0.35rem; color: var(--teal); font-weight: 700; }
.drill-table td.chg { color: var(--ink-muted); }
.drill-table th.share-h { width: 124px; }
.drill-table td.share { white-space: nowrap; }
.drill-table td.share .track {
  display: inline-block; width: 64px; height: 6px; margin-right: 0.5rem; vertical-align: middle;
  background: var(--panel-2); border-radius: 3px; overflow: hidden;
}
.drill-table td.share .bar { display: block; height: 100%; max-width: 100%; background: var(--teal); opacity: 0.55; border-radius: 3px; }
.drill-table td.share .pct { display: inline-block; min-width: 3.2em; font-size: 0.75rem; color: var(--ink-muted); }
.drill-table tfoot td { border-bottom: 0; }
.drill-table tfoot tr.gap td { color: var(--ink-muted); font-style: italic; border-top: 1px dashed var(--rule-strong); }
.drill-table tfoot tr.total td { font-weight: 700; color: var(--ink-strong); border-top: 2px solid var(--rule-strong); background: var(--panel-head); }

@media (max-width: 991px) {
  .auth { flex-direction: column; }
  .auth-brand { flex: none; padding: 40px 20px 24px; text-align: center; align-items: center; }
  .auth-brand .lockup { margin-bottom: 1.25rem; }
  .auth-brand h1 { font-size: 1.5rem; }
  .auth-brand .auth-foot { margin-top: 1.25rem; }
  .auth-panel { flex: 1; padding: 32px 20px 48px; box-shadow: none; border-left: 0; border-top: 1px solid rgba(255, 255, 255, 0.05); align-items: flex-start; }
}
@media (max-width: 600px) {
  .drill-body { padding: 0.75rem; }
  .drill-table td:first-child { min-width: 130px; }
  .drill-value { font-size: 1.6rem; }
}
@media (max-width: 860px) {
  .compare-layout { grid-template-columns: 1fr; }
  .picker { position: static; max-height: 360px; }
  .brand-scope { display: none; }
  .topbar { position: static; gap: 0.5rem; padding-top: 0.5rem; padding-bottom: 0.5rem; }
  .tabs { order: 3; width: 100%; }
  .tab { padding: 0.55rem 0.75rem; }
  #account-name { display: none; }
  .filters > label:not(.check) { flex: 1 1 100%; min-width: 0; }
  .filters select, .filters input:not([type="checkbox"]) { width: 100%; }
}
