/* QueryBits on MinusOneDB — cold-paper ledger.
   Colour carries query semantics: glacier blue = include, fox rust = omit. */

:root {
  --paper: #EBEEF2;
  --card: #FFFFFF;
  --ink: #171B20;
  --ink-2: #4A525A;
  --ink-3: #616A73;  /* muted ink — darkened to pass WCAG AA 4.5:1 on --paper (was #7E8890, 3.1:1) */
  --line: #D8DEE3;
  --line-soft: #E7EBEE;
  --add: #2F6DB3;
  --add-soft: #E3EDF7;
  --omit: #C4501B;
  --omit-soft: #F7E8E0;

  /* Instrument panel — the dark control surface the count lives on */
  --panel: #10151A;
  --panel-2: #171D24;
  --panel-line: #262E37;
  --panel-ink: #EEF2F6;
  --panel-ink-2: #9AA6B2;
  --panel-ink-3: #7C8A98;  /* darkened→lightened to pass AA 4.5:1 on the dark panel (was #67727E, 3.74:1) */
  --add-lit: #4E9BE6;   /* include, tuned to glow on the panel */
  --omit-lit: #E27A45;  /* omit, on the panel */
  --live: #5AD1D8;      /* live-count signal */

  --display: 'Archivo', system-ui, sans-serif;
  --body: 'IBM Plex Sans', system-ui, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, monospace;

  /* QB2 additions — sequential ramp (magnitude: map choropleth + single-series
     bars), motion, radii. Sequential blue is monotonic light→dark. */
  --seq-0: #EAF2FA; --seq-1: #CFE0F1; --seq-2: #A8C8E6; --seq-3: #79A9D6;
  --seq-4: #4E8AC6; --seq-5: #2F6DB3; --seq-6: #1F5091; --seq-7: #143A6C;
  --deck-glow: rgba(78,155,230,0.14);   /* radial mesh accent on the deck */
  --ease: cubic-bezier(0.32, 0.72, 0, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --r-lg: 20px; --r-md: 13px; --r-sm: 9px;
  --shadow-float: 0 1px 2px rgba(20,24,29,0.04), 0 8px 24px rgba(20,24,29,0.06);
  --shadow-deck: 0 1px 0 rgba(255,255,255,0.03) inset, 0 24px 60px rgba(0,0,0,0.4);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 14px;
  line-height: 1.45;
}
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}
:focus-visible { outline: 2px solid var(--add); outline-offset: 2px; }

/* --- masthead (top of the instrument panel) ------------------------------ */
.masthead {
  display: flex; align-items: center; gap: 28px;
  background: var(--panel); color: var(--panel-ink);
  padding: 0 24px; height: 56px;
}
.brand { display: flex; align-items: baseline; gap: 11px; }
.fox { width: 22px; height: 22px; align-self: center; fill: var(--panel-ink); }
.fox .fox-face { fill: var(--panel); }
.fox-lg { width: 44px; height: 44px; fill: var(--ink); }
.fox-lg .fox-face { fill: var(--paper); }
.brand-name {
  font-family: var(--display); font-weight: 800; font-size: 19px;
  letter-spacing: 0.05em; text-transform: uppercase;
}
.brand-tag { font-size: 12px; color: var(--panel-ink-3); letter-spacing: 0.01em; }
.nav { display: flex; gap: 4px; margin-left: 12px; }
.nav-tab {
  color: var(--panel-ink-2); text-decoration: none; padding: 6px 14px;
  border-radius: 999px; font-weight: 500; font-size: 13px; transition: color 120ms;
}
.nav-tab:hover { color: #fff; }
.nav-tab.is-active { background: var(--panel-2); color: #fff; box-shadow: inset 0 0 0 1px var(--panel-line); }
.session { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.session-user { font-size: 12px; color: var(--panel-ink-3); }

/* --- buttons & inputs ---------------------------------------------------- */
.btn {
  font: 500 13px var(--body); color: var(--ink);
  background: var(--card); border: 1px solid var(--line); border-radius: 8px;
  padding: 7px 14px; cursor: pointer;
}
.btn:hover { border-color: var(--ink-3); }
.btn-primary { background: var(--add); border-color: var(--add); color: #fff; }
.btn-primary:hover { background: #285D99; }
.btn-quiet { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn-quiet:hover { color: var(--ink); border-color: var(--line); }
.btn-danger:hover { color: var(--omit); border-color: var(--omit); }
.btn-wide { width: 100%; padding: 10px; font-size: 14px; }
.input {
  font: 400 14px var(--body); color: var(--ink);
  background: var(--card); border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 10px; width: 100%;
}
.input:focus { border-color: var(--add); outline: none; }
/* Keep a clearly-visible focus indicator for keyboard users (the border-colour
   shift alone is too subtle and was the only cue). */
.input:focus-visible { box-shadow: 0 0 0 3px var(--add-soft); }
.input-num { width: 72px; }
.input-area { resize: vertical; font-family: var(--mono); font-size: 13px; }
.field-label {
  display: block; font-size: 11px; font-weight: 600; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--ink-3); margin: 14px 0 4px;
}
.hint { font-size: 12px; color: var(--ink-3); margin-top: 4px; }

/* --- login ---------------------------------------------------------------- */
.login-wrap {
  min-height: 100vh; display: grid; place-items: center;
  background: radial-gradient(130% 120% at 50% -10%, var(--panel-2) 0%, var(--panel) 55%, #0A0E12 100%);
}
.login {
  width: 348px; background: var(--card); border: 1px solid var(--line);
  border-radius: 16px; padding: 38px; text-align: center;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
}
.login .fox-lg { fill: var(--ink); }
.login .fox-lg .fox-face { fill: #fff; }
.login-title {
  font-family: var(--display); font-weight: 800; font-size: 27px;
  letter-spacing: 0.05em; text-transform: uppercase; margin: 14px 0 2px;
}
.login-sub { color: var(--ink-3); font-size: 12px; margin: 0 0 12px; font-family: var(--mono); }
.login .field-label { text-align: left; }
.login .btn-wide { margin-top: 20px; }
.login-error { color: var(--omit); font-size: 13px; min-height: 18px; }

/* --- the counting ledger (signature element: the living count) ------------ */
.ledger {
  background:
    radial-gradient(120% 140% at 12% 0%, var(--panel-2) 0%, var(--panel) 60%);
  border-bottom: 1px solid #000;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.03);
  padding: 22px 24px 18px;
  color: var(--panel-ink);
}
.ledger-counts { display: flex; align-items: flex-end; gap: 48px; flex-wrap: wrap; }
.counter { display: flex; flex-direction: column; }
.counter-label {
  font-size: 11px; font-weight: 600; letter-spacing: 0.11em;
  text-transform: uppercase; color: var(--panel-ink-3);
  display: flex; align-items: center; gap: 8px;
}
.counter-label abbr { text-decoration: none; cursor: help; }
.counter-value {
  font-family: var(--display); font-weight: 800; font-size: 54px; line-height: 1.0;
  letter-spacing: -0.015em; color: #fff; font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1; margin-top: 2px;
}
.counter-secondary .counter-value {
  font-size: 26px; font-weight: 700; color: var(--panel-ink); letter-spacing: -0.01em;
}
.counter-sub { font-size: 12px; color: var(--panel-ink-3); margin-top: 4px; font-family: var(--mono); }

/* live pulse — the count is answering in real time */
.live-dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--live);
  box-shadow: 0 0 0 0 rgba(90,209,216,0.55); animation: pulse 2.2s ease-out infinite;
}
.live-word { color: var(--live); font-size: 10px; letter-spacing: 0.14em; }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(90,209,216,0.5); }
  70% { box-shadow: 0 0 0 7px rgba(90,209,216,0); }
  100% { box-shadow: 0 0 0 0 rgba(90,209,216,0); }
}
.counter-value.is-ticking { color: var(--live); transition: color 0s; }

.ledger-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.ledger-actions .btn {
  background: transparent; border-color: var(--panel-line); color: var(--panel-ink);
}
.ledger-actions .btn:hover { border-color: var(--panel-ink-3); background: var(--panel-2); }

.waterfall { margin-top: 18px; display: grid; gap: 4px; max-width: 780px; }
.wf-hint { font-size: 12px; color: var(--panel-ink-3); }
.wf-row {
  display: grid; grid-template-columns: 150px 1fr 104px 96px;
  align-items: center; gap: 14px;
}
.wf-label {
  font-size: 12px; color: var(--panel-ink-2); white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.wf-track { background: rgba(255,255,255,0.06); border-radius: 3px; height: 8px; overflow: hidden; }
.wf-bar {
  display: block; height: 100%; background: linear-gradient(90deg, var(--add), var(--add-lit));
  border-radius: 0 3px 3px 0; transition: width 400ms cubic-bezier(0.2, 0.7, 0.3, 1);
}
.wf-bar-omit { background: linear-gradient(90deg, var(--omit), var(--omit-lit)); }
.wf-count { font-size: 12px; text-align: right; color: var(--panel-ink); font-family: var(--mono); }
.wf-delta { font-family: var(--mono); font-size: 11px; color: var(--omit-lit); }

/* --- workbench ------------------------------------------------------------ */
.workbench {
  display: grid; grid-template-columns: 300px 1fr; gap: 20px;
  padding: 20px 24px; align-items: start; max-width: 1400px;
}
.rail {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 16px; position: sticky; top: 16px;
}
.rail-title {
  font-family: var(--display); font-size: 13px; font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase; margin: 0 0 10px;
}
.rail-chips { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.rail-empty { color: var(--ink-3); font-size: 13px; }
.rail-note { font-size: 12px; color: var(--add); min-height: 16px; }
#save-inline { display: flex; gap: 6px; margin-top: 10px; }

.chip {
  display: flex; align-items: center; gap: 8px;
  border: 1px solid var(--add); background: var(--add-soft);
  border-radius: 8px; padding: 6px 8px; font-size: 12.5px;
}
.chip-exclude { border-color: var(--omit); background: var(--omit-soft); }
.chip-kind {
  font-weight: 600; font-size: 10.5px; letter-spacing: 0.05em;
  text-transform: uppercase; color: var(--add); white-space: nowrap;
}
.chip-exclude .chip-kind { color: var(--omit); }
.chip-what { flex: 1; min-width: 0; }
.chip-x {
  border: 0; background: none; font-size: 15px; line-height: 1;
  color: var(--ink-3); cursor: pointer; padding: 2px 4px;
}
.chip-x:hover { color: var(--ink); }

/* --- pickers --------------------------------------------------------------- */
.pickers { display: flex; flex-direction: column; gap: 12px; }
.picker-section {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  overflow: hidden;
}
.section-head {
  width: 100%; display: flex; justify-content: space-between; align-items: center;
  background: none; border: 0; cursor: pointer; padding: 13px 16px;
  font: 700 13px var(--display); letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--ink);
}
.section-caret { border: solid var(--ink-3); border-width: 0 2px 2px 0; padding: 3px; transform: rotate(45deg); transition: transform 150ms; }
.is-open .section-caret { transform: rotate(-135deg); }
.section-body { display: none; padding: 4px 16px 16px; }
.is-open .section-body { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }

.fieldbox { border: 1px solid var(--line-soft); border-radius: 10px; padding: 10px 12px; }
.fieldbox-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.fieldbox-label { font-weight: 600; font-size: 13px; }
.mode-toggle {
  font: 600 10.5px var(--body); letter-spacing: 0.05em; text-transform: uppercase;
  color: var(--add); background: var(--add-soft); border: 0; border-radius: 999px;
  padding: 3px 10px; cursor: pointer;
}
.mode-toggle.is-omit { color: #fff; background: var(--omit); }
.fieldbox-body { max-height: 300px; overflow-y: auto; }
.grid-compact { display: grid; grid-template-columns: 1fr 1fr; }

.val {
  display: flex; align-items: center; gap: 8px; padding: 3px 2px;
  cursor: pointer; border-radius: 6px;
}
.val:hover { background: var(--paper); }
.val input { accent-color: var(--add); margin: 0; }
.val-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.val-count { font-size: 11.5px; color: var(--ink-3); }
.val-seg { padding-left: 26px; }
.val-compact .val-name { font-size: 12.5px; }

.mosaic-group { display: grid; grid-template-columns: 1fr auto; align-items: center; }
.mosaic-expand {
  font: 500 11px var(--body); color: var(--add); background: none; border: 0;
  cursor: pointer; padding: 2px 6px;
}
.mosaic-expand:hover { text-decoration: underline; }
.mosaic-segments { grid-column: 1 / -1; }

.age-row { display: flex; align-items: center; gap: 8px; }
.age-dash { color: var(--ink-3); font-size: 12px; }

/* --- report ----------------------------------------------------------------- */
.report-head {
  display: flex; justify-content: space-between; align-items: flex-end; gap: 24px;
  padding: 24px 24px 0; max-width: 1100px; flex-wrap: wrap;
}
.view-title {
  font-family: var(--display); font-weight: 800; font-size: 24px;
  letter-spacing: 0.02em; text-transform: uppercase; margin: 0;
}
.view-sub { color: var(--ink-2); font-size: 13px; margin: 6px 0 0; max-width: 640px; }
.report-controls { display: flex; gap: 10px; align-items: flex-end; }
.report-controls .field-label { margin: 0 0 4px; }
.report-controls .input { width: 220px; }
.report-body { padding: 12px 24px 40px; max-width: 1100px; }
.report-meta { font-size: 12px; color: var(--ink-3); margin: 10px 0; }

.report-table {
  width: 100%; border-collapse: collapse; background: var(--card);
  border: 1px solid var(--line); border-radius: 12px; overflow: hidden;
}
.report-table th, .report-table td {
  text-align: left; padding: 9px 14px; border-top: 1px solid var(--line-soft);
  font-weight: 400; font-size: 13.5px;
}
.report-table thead th {
  border-top: 0; font-size: 11px; font-weight: 600; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--ink-3); background: var(--paper);
}
.report-table tbody th { font-weight: 500; }
.num { text-align: right !important; }
.bar-col { width: 34%; }
.row-bar {
  display: block; height: 10px; background: var(--add);
  border-radius: 0 4px 4px 0; min-width: 2px;
}
.row-missing th, .row-missing td { color: var(--ink-3); }
.row-missing .row-bar { background: var(--ink-3); }

.saved-table { max-width: 1100px; margin: 16px 24px; width: auto; min-width: 720px; }
.actions-col { white-space: nowrap; }
#view > .view-title, #view > .view-sub { padding-left: 24px; padding-right: 24px; }
#view > h1.view-title { margin-top: 24px; }

/* --- group tabs (on the instrument panel) --------------------------------- */
.gtabs { display: flex; gap: 6px; margin-top: 16px; flex-wrap: wrap; }
.gtab {
  display: inline-flex; align-items: center; gap: 8px;
  font: 500 12.5px var(--body); color: var(--panel-ink-2);
  background: rgba(255,255,255,0.04); border: 1px solid var(--panel-line);
  border-radius: 999px; padding: 5px 13px; cursor: pointer; transition: all 120ms;
}
.gtab:hover { border-color: var(--panel-ink-3); color: var(--panel-ink); }
.gtab.is-sel { background: #fff; color: var(--ink); border-color: #fff; }
.gtab-key { font-size: 10.5px; color: var(--add-lit); }
.gtab.is-sel .gtab-key { color: var(--add); }
.gtab-count { font-size: 11px; color: var(--panel-ink-3); font-family: var(--mono); }
.gtab.is-sel .gtab-count { color: var(--ink-3); }
.gtab-add { font-weight: 700; padding: 5px 12px; color: var(--panel-ink-2); }

.rail-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.rail-head .rail-title { margin: 0; }
.rail-foot { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 8px; }
.input-inline { width: auto; min-width: 0; }
.rail-head .input-inline { width: 110px; font-size: 12px; padding: 5px 8px; }
#rename-inline, #save-inline { display: flex; gap: 6px; margin-top: 10px; }
#rename-inline[hidden], #save-inline[hidden] { display: none; }

/* --- dynamic sub-pickers ---------------------------------------------------- */
.sub-row { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; flex-wrap: wrap; }
.sub-list { max-height: 220px; overflow-y: auto; }
.input-zip { width: 84px; }
.ring-row { display: flex; align-items: center; gap: 10px; padding: 4px 2px; font-size: 13px; }
.filelink { color: var(--add); cursor: pointer; }
.filelink:hover { text-decoration: underline; }
.mode-toggle.is-fixed { cursor: default; }
.mode-toggle:disabled { opacity: 0.45; cursor: default; }

/* --- order wizard ------------------------------------------------------------ */
.pad { padding: 24px; max-width: 1100px; }
.order-wrap .view-sub a { color: var(--add); }
.order-step {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 18px 20px; margin-top: 16px;
}
.step-title {
  font-family: var(--display); font-weight: 700; font-size: 14px;
  letter-spacing: 0.06em; text-transform: uppercase; margin: 0 0 12px;
}
.layout-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.layout-cols { list-style: none; counter-reset: col; margin: 4px 0 0; padding: 0; }
.layout-col {
  display: flex; justify-content: space-between; align-items: center;
  counter-increment: col; border-top: 1px solid var(--line-soft); padding: 5px 2px;
  font-size: 13.5px;
}
.layout-col::before {
  content: counter(col, decimal-leading-zero);
  font-family: var(--mono); font-size: 11px; color: var(--ink-3); margin-right: 10px;
}
.layout-col span:first-of-type { flex: 1; }
.col-actions { display: flex; gap: 2px; }
.col-actions .btn { padding: 2px 7px; }
.radio-row { display: flex; gap: 16px; align-items: center; margin: 8px 0; flex-wrap: wrap; }
.radio { display: inline-flex; gap: 6px; align-items: center; font-size: 13.5px; cursor: pointer; }
.radio input { accent-color: var(--add); }
.settings-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; max-width: 720px; }
.qty-table { margin-top: 8px; }
.input-qty { width: 120px; text-align: right; font-family: var(--mono); }

/* --- pivot & summary ---------------------------------------------------------- */
.pivot-scroll { overflow-x: auto; }
.pivot-table th[scope=row], .pivot-table thead th:first-child { position: sticky; left: 0; background: var(--card); }
.pivot-table thead th:first-child { background: var(--paper); }
.summary-sheet { max-width: 820px; }
.summary-actions { display: flex; gap: 8px; margin-bottom: 12px; }
.summary-counters { display: flex; gap: 40px; margin: 16px 0 8px; }
.summary-group { margin-top: 20px; }
.summary-criteria { margin: 6px 0; padding-left: 20px; }
.summary-criteria li { margin: 3px 0; font-size: 13.5px; }

@media print {
  .masthead, .no-print { display: none !important; }
  body { background: #fff; }
  .summary-sheet { max-width: none; padding: 0; }
}

/* --- responsive & motion ------------------------------------------------------ */
@media (max-width: 900px) {
  .workbench { grid-template-columns: 1fr; }
  .rail { position: static; }
  .wf-row { grid-template-columns: 110px 1fr 90px 70px; }
  .counter-value { font-size: 32px; }
  .masthead { gap: 12px; padding: 0 12px; }
  .brand-tag { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .wf-bar, .section-caret { transition: none; }
}

/* ==========================================================================
   QB2 — Audience intelligence surface (map + profile lenses)
   The Count view is the dark instrument deck; Audience is its daylight
   counterpart — floating "machined" panels on cold paper, sequential-blue
   data. Double-bezel enclosures give the panels physical depth without a
   single harsh border or drop shadow.
   ========================================================================== */

/* --- Audience view scaffold ------------------------------------------------ */
.aud { padding: 40px 32px 64px; max-width: 1320px; margin: 0 auto; }
.aud-head { margin-bottom: 32px; max-width: 720px; }
.aud-eyebrow {
  display: inline-block; font-size: 10.5px; font-weight: 600;
  letter-spacing: 0.22em; text-transform: uppercase; color: var(--add);
  background: var(--add-soft); border-radius: 999px; padding: 5px 12px;
}
.aud-title {
  font-family: var(--display); font-weight: 800; font-size: clamp(26px, 3.4vw, 40px);
  line-height: 1.05; letter-spacing: -0.015em; color: var(--ink);
  margin: 16px 0 0; text-wrap: balance;
}
.aud-sub { color: var(--ink-2); font-size: 15px; margin: 12px 0 0; }
.aud-link { color: var(--add); text-decoration: none; border-bottom: 1px solid var(--add-soft); }
.aud-link:hover { border-bottom-color: var(--add); }

/* Bento: map is the hero (wider), profile the companion. Collapses < 980px. */
.aud-grid {
  display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: 24px; align-items: start;
}
@media (max-width: 980px) { .aud-grid { grid-template-columns: 1fr; } }

/* Double-bezel panel: outer tray + inner core with an inset top highlight. */
.aud-panel {
  background: linear-gradient(180deg, #F4F6F9, #EDF0F4);
  border-radius: var(--r-lg); padding: 8px;
  box-shadow: var(--shadow-float);
  animation: audRise 700ms var(--ease-out) both;
}
.aud-panel-profile { animation-delay: 90ms; }
.aud-panel-eyebrow {
  font-size: 10px; font-weight: 600; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--ink-3); padding: 8px 12px 10px; display: block;
}
.aud-mount {
  background: var(--card); border-radius: calc(var(--r-lg) - 6px);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.8), 0 0 0 1px var(--line-soft);
  padding: 18px; overflow: hidden;
}
@keyframes audRise { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }

/* --- Map lens -------------------------------------------------------------- */
.map-wrap { display: block; }
.map-head { margin-bottom: 8px; }
.map-title.view-title { font-size: 18px; text-transform: none; letter-spacing: -0.01em; margin: 0; }
.map-caption { font-size: 12.5px; color: var(--ink-3); margin: 4px 0 0; }
.map-svg-holder { position: relative; }
.map-svg { width: 100%; height: auto; display: block; overflow: visible; }
.map-nation { fill: none; stroke: var(--line); stroke-width: 0.75; }
.map-state {
  stroke: var(--card); stroke-width: 0.75; stroke-linejoin: round;
  cursor: pointer; transition: fill 480ms var(--ease), opacity 480ms var(--ease),
    filter 160ms var(--ease-out);
}
.map-state.is-empty { cursor: pointer; }
.map-state:hover, .map-state.is-hot {
  filter: brightness(1.06) saturate(1.05);
  stroke: var(--ink); stroke-width: 1.1;
}
.map-state:focus-visible {
  outline: none; stroke: var(--add); stroke-width: 2.5; paint-order: stroke;
}
.map-state.is-sel { stroke: var(--add); stroke-width: 2; paint-order: stroke; }
.map-state.is-omit { stroke: var(--omit); stroke-width: 2; paint-order: stroke; }
/* First-paint entrance: fade fills up from the neutral base. */
.map-firstpaint .map-state { opacity: 0.15; }

.map-tip {
  position: absolute; z-index: 5; pointer-events: none;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r-sm); box-shadow: var(--shadow-float);
  padding: 8px 11px; min-width: 120px; transform: translate(-50%, calc(-100% - 12px));
  display: flex; flex-direction: column; gap: 2px;
}
.map-tip[hidden] { display: none; }
.map-tip-name { font-size: 12.5px; font-weight: 600; color: var(--ink); }
.map-tip-fig { font-size: 12px; color: var(--ink-2); font-variant-numeric: tabular-nums; }

.map-legend { display: flex; align-items: center; gap: 8px; margin-top: 14px; }
.map-legend-ramp { display: flex; border-radius: 4px; overflow: hidden; box-shadow: 0 0 0 1px var(--line-soft); }
.map-swatch { width: 22px; height: 9px; display: block; }
.map-legend-lab { font-size: 11px; color: var(--ink-3); }

/* --- Profile lens ---------------------------------------------------------- */
.prof { display: flex; flex-direction: column; gap: 22px; }
.prof-empty {
  color: var(--ink-3); font-size: 13.5px; text-align: center;
  padding: 40px 12px; border: 1px dashed var(--line); border-radius: var(--r-md);
}
.prof-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.prof-stat {
  background: var(--paper); border-radius: var(--r-md); padding: 14px 15px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.7);
}
.prof-stat-num {
  font-family: var(--display); font-weight: 800; font-size: 25px; line-height: 1;
  letter-spacing: -0.01em; color: var(--ink); font-variant-numeric: tabular-nums;
}
.prof-stat-label {
  font-size: 10px; font-weight: 600; letter-spacing: 0.13em; text-transform: uppercase;
  color: var(--ink-2); margin-top: 8px;
}
.prof-stat-sub { font-size: 10.5px; color: var(--ink-3); margin-top: 3px; }

.prof-charts { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 560px) { .prof-charts, .prof-stats { grid-template-columns: 1fr; } }
.prof-card {
  background: var(--card); border-radius: var(--r-md); padding: 14px 15px 12px;
  box-shadow: 0 0 0 1px var(--line-soft);
}
.prof-eyebrow {
  font-size: 10.5px; font-weight: 600; letter-spacing: 0.11em; text-transform: uppercase;
  color: var(--ink-2);
}
.prof-context { font-size: 11px; color: var(--ink-3); margin: 3px 0 10px; }
.prof-svg { width: 100%; height: auto; display: block; overflow: visible; }
.prof-track { color: var(--line-soft); }
.prof-tick, .prof-datalabel { fill: var(--ink-3); }
.prof-catlabel { fill: var(--ink-2); }
.prof-bar { transition: opacity 300ms var(--ease); }

/* Chart entrance keyframes referenced by profile.js (CSS-var-guarded there). */
@keyframes profGrowY { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@keyframes profGrowX { from { transform: scaleX(0); } to { transform: scaleX(1); } }

@media (prefers-reduced-motion: reduce) {
  .aud-panel { animation: none; }
  .map-firstpaint .map-state { opacity: 1; }
}

/* A chart/panel whose data request failed (distinct from a genuinely-empty
   result): same footprint, muted, with a faint warning edge. */
.prof-unavailable { border-color: var(--omit-soft); color: var(--omit); }
