/* Sales analytics: a dark drawing-sheet layout inside the black/brass admin shell.
   Archivo is the only family; its width axis separates display figures (125) from body text (100)
   and dense table text (87.5). */

*,
*::before,
*::after { box-sizing: border-box; }

:root {
  color-scheme: dark;
  --plane: #000000;
  --sheet: #121211;
  --sheet-raised: #1a1a18;
  --rule: rgba(255, 255, 255, 0.08);
  --rule-strong: rgba(255, 255, 255, 0.16);
  --ink: #f3f1ec;
  --ink-2: #bdb9ae;
  --ink-3: #8a877f;
  --grid: #252523;
  --axis: #3a3a37;
  --brass: #c9a668;
  --brass-deep: #a3854e;
  --brass-wash: rgba(201, 166, 104, 0.12);
  --brass-ink: #e2c88f;
  --ghost: #6f6c64;
  --up: #3fbf55;
  --down: #f07a7a;
  --good: #0ca30c;
  --warning: #fab219;
  --serious: #ec835a;
  --critical: #d03b3b;
  --c1: #3987e5;
  --c2: #d95926;
  --c3: #199e70;
  --c4: #c98500;
  --c5: #d55181;
  --c6: #008300;
  --c7: #9085e9;
  --c-other: #77756e;
  --seq-0: #1d1b16;
  --seq-1: #3a3020;
  --seq-2: #5a4a2c;
  --seq-3: #7f6839;
  --seq-4: #a3854e;
  --seq-5: #c9a668;
  --seq-6: #ecd6a6;
  --radius: 14px;
  --radius-sm: 8px;
  --gutter: clamp(16px, 3vw, 36px);
  --font: 'Archivo', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

html { scroll-behavior: smooth; scroll-padding-top: 64px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--plane);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  font-variation-settings: 'wdth' 100;
  -webkit-font-smoothing: antialiased;
}

button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--brass); outline-offset: 2px; border-radius: 4px; }

[hidden] { display: none !important; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

.page {
  max-width: 1440px;
  margin: 0 auto;
  padding: 28px var(--gutter) 80px;
}
.page[aria-busy="true"] .section { opacity: 0.55; transition: opacity 0.2s; }

/* Masthead */
.masthead {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px 24px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--rule);
}
.masthead h1 {
  margin: 0;
  font-size: clamp(30px, 4.2vw, 48px);
  line-height: 1;
  font-weight: 650;
  letter-spacing: -0.02em;
  font-variation-settings: 'wdth' 125;
}
.masthead-period {
  margin: 10px 0 0;
  color: var(--ink-2);
  font-size: 15px;
}
.masthead-period strong { color: var(--ink); font-weight: 600; }
.masthead-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.stamp { color: var(--ink-3); font-size: 13px; margin-right: 6px; }

.btn {
  border: 1px solid var(--rule-strong);
  background: transparent;
  border-radius: 999px;
  padding: 8px 16px;
  font-weight: 550;
  font-size: 13px;
  transition: background 0.15s, border-color 0.15s;
}
.btn:hover:not(:disabled) { background: var(--sheet-raised); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-primary { background: var(--brass); border-color: var(--brass); color: #16130c; }
.btn-primary:hover:not(:disabled) { background: var(--brass-ink); }
.btn.is-busy { opacity: 0.7; }

/* Controls */
.controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 12px;
  padding: 16px 0;
}
.control-group {
  display: inline-flex;
  flex-wrap: wrap;
  background: var(--sheet);
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 3px;
  gap: 2px;
}
.control-group button {
  border: 0;
  background: transparent;
  color: var(--ink-2);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
}
.control-group button:hover { color: var(--ink); background: rgba(255, 255, 255, 0.04); }
.control-group button[aria-checked="true"] { background: var(--ink); color: #111; font-weight: 600; }
.control-spacer { flex: 1 1 0; }
.custom-range { display: inline-flex; gap: 8px; align-items: center; color: var(--ink-2); font-size: 13px; }
.custom-range label { display: inline-flex; gap: 6px; align-items: center; }
input[type="date"],
input[type="search"],
select {
  background: var(--sheet);
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: 13px;
  min-height: 34px;
}
.control-select { display: inline-flex; align-items: center; gap: 8px; color: var(--ink-3); font-size: 13px; }
.control-select select { color: var(--ink); }

.popover-anchor { position: relative; }
.control-button {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  min-height: 34px;
  background: var(--sheet);
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  font-size: 13px;
  color: var(--ink-3);
}
.control-button strong { color: var(--ink); font-weight: 600; }
.popover {
  position: absolute;
  z-index: 40;
  top: calc(100% + 6px);
  right: 0;
  width: 280px;
  background: var(--sheet-raised);
  border: 1px solid var(--rule-strong);
  border-radius: 12px;
  padding: 10px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.55);
}
.popover-head { display: flex; justify-content: space-between; align-items: center; padding: 2px 4px 8px; color: var(--ink-3); font-size: 12px; }
.popover-options { display: grid; gap: 2px; }
.popover-option {
  display: grid;
  grid-template-columns: 16px 10px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 7px 6px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
}
.popover-option:hover { background: rgba(255, 255, 255, 0.05); }
.popover-option input { margin: 0; accent-color: var(--brass); }
.popover-option .count { color: var(--ink-3); font-variant-numeric: tabular-nums; font-size: 12px; }
.link-button { background: none; border: 0; color: var(--brass-ink); font-size: 12px; padding: 2px 4px; }

.notice {
  margin: 4px 0 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(250, 178, 25, 0.35);
  background: rgba(250, 178, 25, 0.08);
  color: #f6d48a;
  font-size: 13px;
}
.notice.is-error { border-color: rgba(208, 59, 59, 0.5); background: rgba(208, 59, 59, 0.1); color: #f3a3a3; }

/* Section nav */
.section-nav {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
  margin: 0 calc(var(--gutter) * -1);
  padding: 10px var(--gutter);
  background: rgba(0, 0, 0, 0.86);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--rule);
}
.section-nav::-webkit-scrollbar { display: none; }
.section-nav a {
  color: var(--ink-3);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  padding: 6px 10px;
  border-radius: 6px;
  white-space: nowrap;
}
.section-nav a:hover { color: var(--ink); }
.section-nav a[aria-current="true"] { color: var(--ink); background: var(--sheet-raised); }

/* Sections */
.section { padding-top: 36px; }
.section-head { margin-bottom: 14px; }
.section-head h2 {
  margin: 0;
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.01em;
  font-variation-settings: 'wdth' 125;
}
.section-head p { margin: 6px 0 0; color: var(--ink-2); max-width: 68ch; }

/* Sheets: panels butt against each other, separated by hairlines rather than gaps. */
.sheet {
  display: grid;
  gap: 1px;
  background: var(--rule);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  overflow: hidden;
}
.sheet + .sheet { margin-top: 12px; }
.sheet-split { grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); }
.sheet-split-wide { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); margin-top: 12px; }
.sheet-thirds { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 1080px) {
  .sheet-split, .sheet-split-wide, .sheet-thirds { grid-template-columns: minmax(0, 1fr); }
}

.panel { background: var(--sheet); padding: 18px 20px 20px; min-width: 0; }
.panel-flush { padding: 0; }
.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}
.panel-head h3 { margin: 0; font-size: 15px; font-weight: 600; }
.panel-sub { margin: 3px 0 0; color: var(--ink-3); font-size: 13px; }
.view-toggle {
  flex: none;
  background: none;
  border: 1px solid var(--rule);
  color: var(--ink-3);
  border-radius: 999px;
  font-size: 12px;
  padding: 4px 10px;
}
.view-toggle:hover { color: var(--ink); border-color: var(--rule-strong); }
.view-toggle[aria-pressed="true"] { color: var(--ink); background: var(--sheet-raised); }

/* KPI strip */
.kpis {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 1px;
  background: var(--rule);
  border: 1px solid var(--rule);
  border-radius: var(--radius) var(--radius) 0 0;
  overflow: hidden;
}
@media (max-width: 1240px) { .kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 720px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.kpi {
  position: relative;
  display: grid;
  gap: 6px;
  align-content: start;
  text-align: left;
  border: 0;
  background: var(--sheet);
  padding: 14px 16px 12px;
  min-height: 132px;
  transition: background 0.15s;
}
.kpi:hover { background: var(--sheet-raised); }
.kpi::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 2px;
  background: transparent;
}
.kpi[aria-selected="true"] { background: var(--sheet-raised); }
.kpi[aria-selected="true"]::before { background: var(--brass); }
.kpi-label { color: var(--ink-2); font-size: 13px; font-weight: 500; }
.kpi-value {
  font-size: 23px;
  font-weight: 600;
  letter-spacing: -0.01em;
  font-variation-settings: 'wdth' 112;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.kpi-foot { display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; margin-top: auto; }
.kpi-spark { width: 72px; height: 24px; flex: none; }

.delta { display: inline-flex; align-items: center; gap: 3px; font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.delta svg { width: 9px; height: 9px; fill: currentColor; }
.delta.is-up { color: var(--up); }
.delta.is-down { color: var(--down); }
.delta.is-flat { color: var(--ink-3); }
.delta-note { color: var(--ink-3); font-weight: 400; }

/* Hero */
.hero {
  background: var(--sheet);
  border: 1px solid var(--rule);
  border-top: 0;
  border-radius: 0 0 var(--radius) var(--radius);
  padding: 24px 24px 16px;
}
.hero-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 18px 40px; margin-bottom: 8px; }
.hero-label { margin: 0; color: var(--ink-2); font-size: 14px; }
.hero-value {
  margin: 6px 0 0;
  font-size: clamp(44px, 6vw, 76px);
  line-height: 0.95;
  font-weight: 650;
  letter-spacing: -0.035em;
  font-variation-settings: 'wdth' 125;
}
.hero-sub { margin: 10px 0 0; color: var(--ink-2); font-size: 14px; display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; }
.hero-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(130px, auto));
  gap: 14px 32px;
  margin: 0;
  align-self: end;
}
.hero-facts div { min-width: 0; }
.hero-facts dt { color: var(--ink-3); font-size: 12px; }
.hero-facts dd { margin: 2px 0 0; font-size: 15px; font-weight: 600; font-variation-settings: 'wdth' 110; }
.hero-facts dd small { display: block; color: var(--ink-3); font-weight: 400; font-size: 12px; font-variation-settings: 'wdth' 100; }

.chart-frame { position: relative; }

/* Charts */
.chart { position: relative; width: 100%; min-height: 40px; }
.chart svg { display: block; width: 100%; overflow: visible; }
.chart-hero svg { height: 320px; }
.chart text { fill: var(--ink-3); font-size: 11px; font-family: var(--font); font-variant-numeric: tabular-nums; }
.chart .label-strong { fill: var(--ink); font-weight: 600; font-size: 12px; }
.chart .label-soft { fill: var(--ink-2); font-size: 11px; }
.chart .gridline { stroke: var(--grid); stroke-width: 1; shape-rendering: crispEdges; }
.chart .baseline { stroke: var(--axis); stroke-width: 1; shape-rendering: crispEdges; }
.chart .crosshair { stroke: var(--ink-3); stroke-width: 1; pointer-events: none; shape-rendering: crispEdges; }
.chart .hit { fill: transparent; }
.chart .mark { transition: opacity 0.12s; }
.chart .is-dim .mark:not(.is-hot) { opacity: 0.35; }
.chart .cell { stroke: var(--sheet); stroke-width: 2; }
.chart .cell:hover, .chart .cell.is-hot { stroke: var(--ink); stroke-width: 1.5; }
.chart-empty.chart-empty-hero { min-height: 320px; }
.chart-empty-hero p { margin: 0 0 14px; color: var(--ink-2); font-size: 14px; }
.chart-empty {
  display: grid;
  place-items: center;
  min-height: 160px;
  color: var(--ink-3);
  font-size: 13px;
  text-align: center;
  padding: 20px;
}

.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 0 0 10px; font-size: 12px; color: var(--ink-2); }
.legend:empty { display: none; }
.legend-item { display: inline-flex; align-items: center; gap: 7px; }
.legend-swatch { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.legend-line { width: 16px; height: 0; border-top: 2px solid; flex: none; }
.legend-line.is-ghost { border-top-style: solid; opacity: 0.9; }

/* Bar lists (HTML bars for ranked categories) */
.barlist { display: grid; gap: 10px; }
.barlist-row { display: grid; gap: 5px; }
.barlist-top { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; }
.barlist-name { display: inline-flex; align-items: center; gap: 8px; min-width: 0; color: var(--ink); }
.barlist-name span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.barlist-value { color: var(--ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.barlist-value strong { color: var(--ink); font-weight: 600; }
.barlist-track { height: 8px; border-radius: 0 4px 4px 0; background: rgba(255, 255, 255, 0.04); overflow: hidden; }
.barlist-fill { height: 100%; border-radius: 0 4px 4px 0; min-width: 2px; }
.barlist-stack { display: flex; gap: 2px; height: 12px; }
.barlist-stack span { height: 100%; min-width: 2px; }
.barlist-stack span:last-child { border-radius: 0 4px 4px 0; }
.barlist-note { color: var(--ink-3); font-size: 12px; }

/* Tables */
.table-scroll { overflow-x: auto; }
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  font-variation-settings: 'wdth' 92;
}
table.data th,
table.data td {
  padding: 9px 12px;
  text-align: left;
  border-bottom: 1px solid var(--rule);
  vertical-align: middle;
  white-space: nowrap;
}
table.data th {
  color: var(--ink-3);
  font-weight: 500;
  font-size: 12px;
  position: sticky;
  top: 0;
  background: var(--sheet);
}
table.data th.num, table.data td.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data td.wrap { white-space: normal; min-width: 220px; max-width: 420px; }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data tbody tr.is-clickable { cursor: pointer; }
table.data tbody tr.is-clickable:hover td { background: rgba(255, 255, 255, 0.025); }
table.data tfoot td { color: var(--ink); font-weight: 600; border-top: 1px solid var(--rule-strong); border-bottom: 0; }
table.data .muted { color: var(--ink-3); }
table.data .sub { display: block; color: var(--ink-3); font-size: 12px; margin-top: 1px; }
th button.sort {
  background: none;
  border: 0;
  padding: 0;
  color: inherit;
  font-weight: inherit;
  display: inline-flex;
  gap: 4px;
  align-items: center;
}
th button.sort[aria-sort] { color: var(--ink); }
th.num button.sort { flex-direction: row-reverse; }
.panel:not(.panel-flush) > .table-scroll,
.panel:not(.panel-flush) > div > .table-scroll { margin: 0 -20px -20px; }
.panel:not(.panel-flush) table.data th:first-child,
.panel:not(.panel-flush) table.data td:first-child { padding-left: 20px; }
.panel:not(.panel-flush) table.data th:last-child,
.panel:not(.panel-flush) table.data td:last-child { padding-right: 20px; }
.panel-flush table.data th:first-child, .panel-flush table.data td:first-child { padding-left: 20px; }
.panel-flush table.data th:last-child, .panel-flush table.data td:last-child { padding-right: 20px; }

.share { display: inline-grid; grid-template-columns: 64px 48px; align-items: center; gap: 8px; }
.share > span:last-child { text-align: right; }
.share-track { height: 6px; background: rgba(255, 255, 255, 0.05); border-radius: 0 3px 3px 0; overflow: hidden; }
.share-fill { height: 100%; background: var(--brass); border-radius: 0 3px 3px 0; }
.swatch { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 8px; vertical-align: 0; }
.name-button {
  background: none;
  border: 0;
  padding: 0;
  color: var(--ink);
  font-weight: 550;
  text-align: left;
  text-decoration: underline;
  text-decoration-color: var(--rule-strong);
  text-underline-offset: 3px;
}
.name-button:hover { text-decoration-color: var(--brass); }
.cell-spark { width: 96px; height: 22px; display: block; }

.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 550;
  color: var(--ink-2);
}
.status svg { width: 12px; height: 12px; flex: none; }
.status.paid svg { color: var(--good); }
.status.pending svg { color: var(--warning); }
.status.expired svg { color: var(--serious); }
.status.cancelled svg { color: var(--critical); }

.pill {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  border: 1px solid var(--rule-strong);
  color: var(--ink-2);
  font-size: 11px;
  font-weight: 550;
}

/* Facts row (payment health) */
.facts-row {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 1px;
  background: var(--rule);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 12px;
}
@media (max-width: 1080px) { .facts-row { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.fact { background: var(--sheet); padding: 14px 18px; }
.fact-label { color: var(--ink-2); font-size: 13px; }
.fact-value { margin-top: 4px; font-size: 22px; font-weight: 600; font-variation-settings: 'wdth' 112; }
.fact-note { margin-top: 2px; color: var(--ink-3); font-size: 12px; }

/* Ledger */
.ledger-controls { display: flex; flex-wrap: wrap; gap: 10px 12px; align-items: center; margin-bottom: 12px; }
.search {
  position: relative;
  flex: 1 1 320px;
  max-width: 460px;
}
.search svg {
  position: absolute;
  left: 11px;
  top: 50%;
  width: 16px;
  height: 16px;
  transform: translateY(-50%);
  fill: none;
  stroke: var(--ink-3);
  stroke-width: 1.6;
  stroke-linecap: round;
}
.search input { width: 100%; padding-left: 34px; }
.ledger-count { margin-left: auto; color: var(--ink-3); font-size: 13px; }
.pager {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  border-top: 1px solid var(--rule);
  color: var(--ink-3);
  font-size: 13px;
}
.pager:empty { display: none; }
.pager-buttons { display: inline-flex; gap: 6px; }
.pager button {
  background: var(--sheet-raised);
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 5px 12px;
  font-size: 12px;
}
.pager button:disabled { opacity: 0.35; cursor: not-allowed; }

/* About */
.about {
  margin-top: 40px;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--sheet);
}
.about summary { cursor: pointer; padding: 14px 20px; font-weight: 550; }
.about-body { padding: 0 20px 18px; color: var(--ink-2); max-width: 80ch; }
.about-body p, .about-body li { margin: 0 0 8px; }
.about-body ul { padding-left: 18px; margin: 0 0 8px; }
.about-body strong { color: var(--ink); }

/* Drawer */
.drawer { position: fixed; inset: 0; z-index: 80; }
.drawer[hidden] { display: none; }
.drawer-scrim { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.6); }
.drawer-panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(560px, 100%);
  background: var(--sheet);
  border-left: 1px solid var(--rule-strong);
  display: flex;
  flex-direction: column;
  animation: drawer-in 0.22s cubic-bezier(0.2, 0.7, 0.2, 1);
}
@keyframes drawer-in { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .drawer-panel { animation: none; } }
.drawer-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 24px 16px;
  border-bottom: 1px solid var(--rule);
}
.drawer-kicker { margin: 0 0 4px; color: var(--ink-3); font-size: 13px; }
.drawer-head h2 { margin: 0; font-size: 22px; line-height: 1.2; font-weight: 600; font-variation-settings: 'wdth' 115; overflow-wrap: anywhere; }
.drawer-body { overflow-y: auto; padding: 18px 24px 32px; }
.icon-button {
  flex: none;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--rule-strong);
  background: transparent;
}
.icon-button svg { width: 16px; height: 16px; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; fill: none; }
.detail-list { display: grid; grid-template-columns: 140px 1fr; gap: 9px 16px; margin: 0 0 22px; font-size: 13px; }
.detail-list dt { color: var(--ink-3); }
.detail-list dd { margin: 0; overflow-wrap: anywhere; }
.drawer-section-title { margin: 22px 0 10px; font-size: 14px; font-weight: 600; }
.drawer-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--rule); border: 1px solid var(--rule); border-radius: 10px; overflow: hidden; margin-bottom: 16px; }
.drawer-stats div { background: var(--sheet-raised); padding: 10px 12px; }
.drawer-stats dt { color: var(--ink-3); font-size: 12px; }
.drawer-stats dd { margin: 2px 0 0; font-weight: 600; font-variation-settings: 'wdth' 110; }
.drawer table.data th, .drawer table.data td { padding: 8px 8px; }
.drawer table.data td.wrap { min-width: 0; max-width: none; }
.drawer .table-scroll { margin: 0 -8px; }
.copy-button { margin-left: 8px; background: none; border: 1px solid var(--rule); border-radius: 6px; color: var(--ink-3); font-size: 11px; padding: 1px 7px; }

/* Tooltip */
.tooltip {
  position: fixed;
  z-index: 100;
  pointer-events: none;
  min-width: 170px;
  max-width: 300px;
  background: #24231f;
  border: 1px solid var(--rule-strong);
  border-radius: 10px;
  padding: 10px 12px;
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.5);
  font-size: 12px;
}
.tooltip[hidden] { display: none; }
.tooltip-title { color: var(--ink-2); margin-bottom: 6px; }
.tooltip-row { display: grid; grid-template-columns: 14px 1fr; gap: 2px 8px; align-items: center; margin-top: 4px; }
.tooltip-row .key { height: 0; border-top: 2px solid; width: 14px; }
.tooltip-row .key.is-box { height: 8px; border: 0; border-radius: 2px; }
.tooltip-value { color: var(--ink); font-weight: 650; font-size: 13px; font-variant-numeric: tabular-nums; }
.tooltip-name { grid-column: 2; color: var(--ink-3); }
.tooltip-foot { margin-top: 8px; padding-top: 6px; border-top: 1px solid var(--rule); color: var(--ink-2); }

@media (max-width: 720px) {
  .masthead { align-items: flex-start; }
  .control-spacer { display: none; }
  .hero { padding: 18px 16px 12px; }
  .chart-hero svg { height: 240px; }
  .hero-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .panel { padding: 16px; }
  .detail-list { grid-template-columns: 1fr; gap: 2px; }
  .detail-list dd { margin-bottom: 8px; }
}

@media (forced-colors: active) {
  .kpi[aria-selected="true"]::before { background: Highlight; }
  .barlist-fill, .share-fill { background: CanvasText; }
}
