/* ============================================================================
   jobgauge — design system  ·  "crisp modern dashboard"
   ----------------------------------------------------------------------------
   Cool paper-white + graphite hairlines, one sharp teal accent.
   Display: Space Grotesk · UI/body: Hanken Grotesk · Data: IBM Plex Mono.
   Light "paper" (default) + dark "terminal". color-scheme stays "light dark"
   on :root and is never narrowed (keeps browser force-dark from inverting us).

   NAVIGATION
     [TOKENS]      design tokens, light + dark
     [BASE]        resets, type primitives, focus
     [SHELL]       topbar, search trigger, freshness, rail
     [BUTTONS]     .btn variants, .iconbtn, segmented, toggles
     [OVERVIEW]    hero, preset chips, headline cards
     [WORKSPACE]   chart card, controls, chart frame, brush, metastrip
     [SIDE]        compare tray, combine panel, source panel
     [EXPLORE]     filter toolbar, dense result rows, badges/tags
     [PALETTE]     ⌘K command palette
     [MODAL]       share/export sheet
     [MISC]        toast, skeleton, responsive
   ========================================================================== */

/* ============================== [TOKENS] ================================== */
:root {
  --font-sans:    "Hanken Grotesk", system-ui, -apple-system, sans-serif;
  --font-display: "Space Grotesk", "Hanken Grotesk", system-ui, sans-serif;
  --font-mono:    "IBM Plex Mono", "SF Mono", ui-monospace, monospace;

  --r-sm: 6px;  --r-md: 8px;  --r-lg: 11px;  --r-xl: 15px;
  --rail-w: 212px;
  --maxw: 1400px;
  --ease: cubic-bezier(.4, 0, .2, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);

  color-scheme: light dark;     /* declared ONCE, never narrowed per theme */
}

/* -------- PAPER (light, default) — cool paper-white, graphite ink -------- */
:root,
[data-theme="paper"] {
  --paper:      #F5F6F8;   /* app background, cool off-white       */
  --paper-2:    #ECEEF1;   /* recessed wells, kbd, subtle fills    */
  --surface:    #FFFFFF;   /* cards, panels                        */
  --surface-2:  #FAFBFC;   /* striped/inset surfaces, control bars */
  --ink:        #0E1216;   /* primary text, near-black cool        */
  --ink-2:      #475059;   /* secondary text                       */
  --ink-3:      #8A929C;   /* muted text, meta                     */
  --line:       #E6E9ED;   /* hairline separators                  */
  --line-2:     #D8DCE2;   /* borders                              */
  --line-3:     #C2C8D0;   /* hover borders                        */
  --brand:      #0C766C;   /* THE accent — refined cool teal       */
  --brand-2:    #095A52;   /* deeper teal for text on light        */
  --brand-soft: #DCEEEB;   /* teal wash for active states          */
  --brand-ring: #9FD7CF;   /* focus ring tint                      */
  --accent:     #9A6212;   /* reserved: warn/unit-mismatch only    */
  --accent-soft:#F4ECDC;
  --pos:        #0B7C53;   /* up/positive                          */
  --neg:        #C23B30;   /* down/negative                        */
  --pos-soft:   #DCEFE6;
  --neg-soft:   #F6E3E1;
  --recession:  rgba(14,18,22,.045);
  --grid:       #EEF0F3;   /* chart gridlines                      */
  --shadow-sm:  0 1px 2px rgba(14,18,22,.05);
  --shadow-md:  0 4px 16px -6px rgba(14,18,22,.16), 0 1px 3px rgba(14,18,22,.07);
  --shadow-lg:  0 24px 56px -20px rgba(14,18,22,.30), 0 8px 20px -12px rgba(14,18,22,.18);
}

/* -------- TERMINAL (dark) — cool charcoal, brighter teal -------- */
[data-theme="terminal"] {
  --paper:      #0E1116;
  --paper-2:    #161B22;
  --surface:    #161B22;
  --surface-2:  #1C222B;
  --ink:        #E8EDF3;
  --ink-2:      #A2ADBB;
  --ink-3:      #69727E;
  --line:       #232A33;
  --line-2:     #2E3741;
  --line-3:     #3C4653;
  --brand:      #3FD6C4;
  --brand-2:    #7FE9DC;
  --brand-soft: #103A34;
  --brand-ring: #1C5A52;
  --accent:     #E0A858;
  --accent-soft:#2A2316;
  --pos:        #4FD392;
  --neg:        #F08374;
  --pos-soft:   #13352A;
  --neg-soft:   #34211E;
  --recession:  rgba(150,170,200,.07);
  --grid:       #20262E;
  --shadow-sm:  0 1px 2px rgba(0,0,0,.5);
  --shadow-md:  0 8px 26px -10px rgba(0,0,0,.66);
  --shadow-lg:  0 28px 66px -22px rgba(0,0,0,.82);
}

/* Dark via OS preference unless the user explicitly picked light.
   :root keeps color-scheme:light dark so scheme-aware browsers let THESE
   tokens drive dark mode instead of force-inverting our colors. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="paper"]) {
    --paper:#0E1116; --paper-2:#161B22; --surface:#161B22; --surface-2:#1C222B;
    --ink:#E8EDF3; --ink-2:#A2ADBB; --ink-3:#69727E;
    --line:#232A33; --line-2:#2E3741; --line-3:#3C4653;
    --brand:#3FD6C4; --brand-2:#7FE9DC; --brand-soft:#103A34; --brand-ring:#1C5A52;
    --accent:#E0A858; --accent-soft:#2A2316;
    --pos:#4FD392; --neg:#F08374; --pos-soft:#13352A; --neg-soft:#34211E;
    --recession:rgba(150,170,200,.07); --grid:#20262E;
    --shadow-sm:0 1px 2px rgba(0,0,0,.5);
    --shadow-md:0 8px 26px -10px rgba(0,0,0,.66);
    --shadow-lg:0 28px 66px -22px rgba(0,0,0,.82);
  }
}

/* ============================== [BASE] =================================== */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--paper);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background .35s var(--ease), color .35s var(--ease);
}
.num, .mono { font-family: var(--font-mono); font-feature-settings: "tnum" 1, "zero" 1; }
:where(table) { font-variant-numeric: tabular-nums; }
::selection { background: var(--brand-soft); color: var(--brand-2); }

button { font-family: inherit; cursor: pointer; color: inherit; }
a { color: inherit; text-decoration: none; }
input { font-family: inherit; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 4px; }

.eyebrow { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); font-weight: 600; }
.section-rule { height: 1px; background: var(--line); margin: 22px 0; border: 0; }

/* ============================== [SHELL] ================================== */
.app { position: relative; min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 40;
  display: grid; grid-template-columns: var(--rail-w) 1fr auto; align-items: center; gap: 18px;
  height: 58px; padding: 0 20px 0 22px;
  background: color-mix(in srgb, var(--paper) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(16px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 9px; color: var(--ink); white-space: nowrap; min-width: 0; }
.brand__mark {
  display: grid; place-items: center; width: 28px; height: 28px; flex: none;
  color: #fff; background: var(--brand); border-radius: 7px;
  box-shadow: 0 2px 8px -3px color-mix(in srgb, var(--brand) 70%, transparent);
}
[data-theme="terminal"] .brand__mark { color: #06120F; }
.brand__word { font-family: var(--font-display); font-weight: 600; font-size: 19px; letter-spacing: -.02em; }
.brand__tag { font-size: 9.5px; letter-spacing: .15em; text-transform: uppercase; color: var(--ink-3); font-weight: 600; margin-left: 1px; }

/* centered command-search trigger */
.searchbar {
  display: flex; align-items: center; gap: 10px; width: 100%; max-width: 540px; margin: 0 auto; min-width: 0;
  height: 36px; padding: 0 8px 0 13px;
  background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r-md);
  color: var(--ink-3); transition: border-color .18s, box-shadow .18s, background .18s;
}
.searchbar:hover { border-color: var(--line-3); box-shadow: var(--shadow-sm); }
.searchbar__icon { color: var(--ink-3); flex: none; }
.searchbar__hint { flex: 1; text-align: left; font-size: 13px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.searchbar__kbd, kbd {
  font-family: var(--font-mono); font-size: 10.5px; color: var(--ink-2);
  background: var(--paper-2); border: 1px solid var(--line-2); border-radius: 5px;
  padding: 2px 5px; line-height: 1; display: inline-flex; gap: 1px; box-shadow: inset 0 -1px 0 var(--line-2);
}
.cmdkey { font-size: 11px; }

.topbar__right { display: flex; align-items: center; gap: 9px; flex: none; }
.freshness {
  display: flex; align-items: center; gap: 7px; height: 32px; padding: 0 12px; flex: none;
  background: var(--surface); border: 1px solid var(--line-2); border-radius: 99px;
  font-size: 12px; color: var(--ink-2); white-space: nowrap;
}
.freshness__dot { width: 7px; height: 7px; border-radius: 50%; background: var(--pos); box-shadow: 0 0 0 3px color-mix(in srgb, var(--pos) 24%, transparent); }
.freshness__profile { font-weight: 600; color: var(--ink); text-transform: capitalize; }
.freshness__sep { color: var(--line-3); }
.freshness__when { font-family: var(--font-mono); font-size: 11px; }

/* nav rail */
.rail {
  position: sticky; top: 58px; align-self: start; height: calc(100vh - 58px);
  display: flex; flex-direction: column; gap: 2px; padding: 16px 14px;
  border-right: 1px solid var(--line); background: var(--paper);
}
.rail__sec { font-size: 10px; letter-spacing: .13em; text-transform: uppercase; color: var(--ink-3); font-weight: 700; padding: 4px 10px 8px; }
.rail__item {
  display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: var(--r-md);
  color: var(--ink-2); font-weight: 500; font-size: 13.5px;
  transition: background .14s, color .14s; position: relative;
}
.rail__item svg { color: var(--ink-3); transition: color .14s; flex: none; }
.rail__item:hover { background: var(--paper-2); color: var(--ink); }
.rail__item:hover svg { color: var(--ink-2); }
.rail__item.is-active { background: var(--brand-soft); color: var(--brand-2); font-weight: 600; }
.rail__item.is-active svg { color: var(--brand); }
.rail__item.is-active::before { content: ""; position: absolute; left: -14px; top: 7px; bottom: 7px; width: 3px; border-radius: 0 3px 3px 0; background: var(--brand); }
.rail__kbd { margin-left: auto; font-size: 10px; }
.rail__foot { margin-top: auto; padding: 14px 10px 4px; border-top: 1px solid var(--line); display: grid; gap: 7px; }
.rail__stat { display: flex; align-items: baseline; gap: 6px; font-size: 12px; color: var(--ink-3); }
.rail__stat b { font-family: var(--font-mono); font-weight: 600; font-size: 13px; color: var(--ink); }
.rail__stat--live b { color: var(--pos); }

/* main canvas */
.shell { display: grid; grid-template-columns: var(--rail-w) 1fr; flex: 1; min-height: 0; }
.main { min-width: 0; padding: 28px 32px 72px; }
.view { max-width: var(--maxw); margin: 0 auto; }
.view[hidden] { display: none; }

/* Entrance: transform-only slide. Base state is fully visible (opacity 1) so a
   throttled/background iframe that freezes the animation never holds content
   hidden — it just rests a few px lower, which is imperceptible. */
@keyframes riseIn { from { transform: translateY(10px); } to { transform: none; } }
.stagger > * { animation: riseIn .5s var(--ease-out) both; }
.stagger > *:nth-child(1){animation-delay:.02s}.stagger > *:nth-child(2){animation-delay:.06s}
.stagger > *:nth-child(3){animation-delay:.10s}.stagger > *:nth-child(4){animation-delay:.14s}
.stagger > *:nth-child(5){animation-delay:.18s}.stagger > *:nth-child(6){animation-delay:.22s}

/* ============================== [BUTTONS] =============================== */
.btn {
  display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 13px;
  border-radius: var(--r-md); border: 1px solid var(--line-2); background: var(--surface); color: var(--ink);
  font-size: 13px; font-weight: 500; transition: all .16s var(--ease); white-space: nowrap;
}
.btn:hover { border-color: var(--line-3); box-shadow: var(--shadow-sm); }
.btn:active { transform: translateY(.5px); }
.btn--accent { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }
[data-theme="terminal"] .btn--accent { color: #06120F; }
.btn--accent:hover { background: color-mix(in srgb, var(--brand) 88%, #000); box-shadow: 0 4px 14px -5px color-mix(in srgb, var(--brand) 64%, transparent); }
.btn--ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn--ghost:hover { background: var(--paper-2); color: var(--ink); box-shadow: none; }
.btn--sm { height: 28px; padding: 0 9px; font-size: 12px; border-radius: var(--r-sm); }
.btn--xs { height: 24px; padding: 0 8px; font-size: 11.5px; border-radius: var(--r-sm); }

.iconbtn {
  display: grid; place-items: center; width: 34px; height: 34px;
  background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r-md); color: var(--ink-2);
  transition: border-color .16s, color .16s, background .16s;
}
.iconbtn:hover { color: var(--ink); border-color: var(--line-3); }
.ico-moon { display: none; }
[data-theme="terminal"] .ico-sun { display: none; }
[data-theme="terminal"] .ico-moon { display: block; }

/* segmented control */
.segmented { display: inline-flex; background: var(--paper-2); border: 1px solid var(--line-2); border-radius: var(--r-md); padding: 2px; gap: 1px; }
.seg {
  appearance: none; border: none; background: transparent; color: var(--ink-2);
  font-size: 12px; font-weight: 500; padding: 4px 10px; border-radius: 5px; transition: all .14s; white-space: nowrap;
}
.seg:hover:not(:disabled):not(.is-active) { color: var(--ink); }
.seg.is-active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); font-weight: 600; }
.seg:disabled { opacity: .35; cursor: not-allowed; }
.seg:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* switch toggle */
.toggle { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--ink-2); user-select: none; cursor: pointer; }
/* Visually hidden but still focusable/operable by keyboard — display:none would drop it from
   the tab order. The track + knob below are the visible control; focus ring shown on the track. */
.toggle input { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0; clip: rect(0 0 0 0); clip-path: inset(50%); overflow: hidden; white-space: nowrap; }
.toggle input:focus-visible + .toggle__sw { outline: 2px solid var(--brand); outline-offset: 2px; }
.toggle__sw { width: 30px; height: 17px; border-radius: 99px; background: var(--line-3); position: relative; transition: background .2s; flex: none; }
.toggle__sw::after { content: ""; position: absolute; top: 2px; left: 2px; width: 13px; height: 13px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: transform .2s var(--ease-out); }
.toggle input:checked + .toggle__sw { background: var(--brand); }
.toggle input:checked + .toggle__sw::after { transform: translateX(13px); }
.toggle:hover .toggle__sw { filter: brightness(.97); }

/* ============================== [OVERVIEW] ============================== */
.hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 22px; }
.hero__lead { min-width: 0; }
.hero__title { font-family: var(--font-display); font-weight: 600; font-size: 30px; letter-spacing: -.025em; margin: 6px 0 0; line-height: 1.05; }
.hero__sub { color: var(--ink-2); font-size: 14px; margin: 9px 0 0; max-width: 60ch; }
.hero__aside { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex: none; text-align: right; }
.hero__askv { font-family: var(--font-mono); font-size: 13px; color: var(--ink-2); }
.hero__askv b { color: var(--ink); }

/* preset chips */
.chips { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 0 0 24px; }
.chip {
  display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 12px;
  border-radius: 99px; border: 1px solid var(--line-2); background: var(--surface);
  font-size: 12.5px; font-weight: 500; color: var(--ink-2); transition: all .15s var(--ease);
}
.chip:hover { border-color: var(--line-3); color: var(--ink); }
.chip.is-active { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.chip__dot { width: 6px; height: 6px; border-radius: 50%; background: var(--brand); }
.chip.is-active .chip__dot { background: var(--brand); box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand) 40%, transparent); }

/* headline metric cards — dense, crisp */
.cards { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; margin-bottom: 26px; }
.card {
  position: relative; display: flex; flex-direction: column; padding: 13px 14px 0; min-height: 132px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-sm);
  transition: border-color .16s, box-shadow .16s, transform .16s var(--ease-out); cursor: pointer; overflow: hidden; text-align: left;
}
.card:hover { border-color: var(--line-3); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.card.is-selected { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand), var(--shadow-sm); }
.card__top { display: flex; align-items: flex-start; justify-content: space-between; gap: 6px; }
.card__label { font-size: 11.5px; font-weight: 600; color: var(--ink-2); line-height: 1.25; letter-spacing: .005em; }
.card__mirror { font-size: 8.5px; letter-spacing: .07em; font-weight: 700; text-transform: uppercase; color: var(--ink-3); background: var(--paper-2); border: 1px solid var(--line-2); border-radius: 4px; padding: 2px 4px; white-space: nowrap; flex: none; }
.card__value { font-family: var(--font-display); font-size: 27px; font-weight: 600; letter-spacing: -.02em; margin: 10px 0 0; line-height: 1; font-feature-settings: "tnum" 1; }
.card__unit { font-size: 11px; color: var(--ink-3); font-family: var(--font-sans); margin-left: 3px; font-weight: 500; letter-spacing: 0; }
.card__delta { display: inline-flex; align-items: center; gap: 4px; font-family: var(--font-mono); font-size: 11.5px; font-weight: 600; margin-top: 8px; }
.delta-up { color: var(--pos); } .delta-down { color: var(--neg); } .delta-flat { color: var(--ink-3); }
.card__deltalbl { color: var(--ink-3); font-family: var(--font-sans); font-weight: 500; font-size: 10.5px; margin-left: 2px; }
.card__spark { margin: auto -1px 0; height: 38px; }
.card__date { font-family: var(--font-mono); font-size: 9.5px; color: var(--ink-3); padding: 7px 0 11px; letter-spacing: .02em; }

/* ============================== [WORKSPACE] ============================ */
.workspace { display: grid; grid-template-columns: minmax(0,1fr) 296px; gap: 16px; align-items: start; }
.chartcard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); overflow: hidden; }
.chartcard__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; padding: 15px 18px 13px; border-bottom: 1px solid var(--line); }
.chartcard__titlewrap { min-width: 0; }
.chartcard__kicker { font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--brand); font-weight: 700; }
.chartcard__title { font-family: var(--font-display); font-size: 20px; font-weight: 600; letter-spacing: -.02em; margin: 4px 0 0; line-height: 1.12; }
.chartcard__desc { font-size: 12.5px; color: var(--ink-2); margin: 5px 0 0; max-width: 72ch; line-height: 1.5; }
.chartcard__actions { display: flex; gap: 7px; flex: none; }

/* controls bar */
.controls { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; padding: 10px 18px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.ctrl-group { display: flex; align-items: center; gap: 8px; }
.ctrl-label { font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); font-weight: 700; }
.ctrl-sep { width: 1px; align-self: stretch; background: var(--line); margin: 2px 0; }
.ctrl-toggles { display: flex; align-items: center; gap: 16px; margin-left: auto; }

/* chart frame — placeholder container; app wires ECharts here */
.chart { position: relative; width: 100%; height: 432px; padding: 8px 14px 0; }
.chart--tall { height: 600px; }
/* state-map header: title + metric picker */
.mapview-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; flex-wrap: wrap; }
.mapview-controls { display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap; }
.map-src { display: block; margin-top: 6px; font-family: var(--font-mono); font-size: 11px; color: var(--ink-3); letter-spacing: .01em; }
.mapsel-wrap { display: flex; flex-direction: column; gap: 5px; font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); font-weight: 700; flex: none; }
.mapsel { font-family: var(--font-ui, var(--font-display)); font-size: 13.5px; font-weight: 500; letter-spacing: 0; text-transform: none; color: var(--ink); background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r-sm, 8px); padding: 9px 32px 9px 12px; min-width: 280px; cursor: pointer; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2 4l4 4 4-4' stroke='%23889' stroke-width='1.6' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 11px center; transition: border-color .14s, box-shadow .14s; }
.mapsel:hover { border-color: var(--line-3, var(--brand)); }
.mapsel:focus-visible { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-ring, color-mix(in srgb, var(--brand) 22%, transparent)); }
.chart__yunit { position: absolute; top: 12px; left: 18px; font-size: 10.5px; color: var(--ink-3); font-family: var(--font-mono); letter-spacing: .02em; }
.chart svg { display: block; width: 100%; height: 100%; }

/* dedicated State-map view: choropleth beside the ranked list (same data) */
.statemap { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(280px, 1fr); gap: 16px; align-items: start; margin-top: 14px; }
.statemap__main { display: flex; flex-direction: column; min-width: 0; }
.chart--map { height: 480px; }
.statemap__rankhead { font-size: 11px; letter-spacing: .04em; color: var(--ink-3); padding: 11px 14px; border-bottom: 1px solid var(--line); font-family: var(--font-mono); }
.statemap__rankhead b { color: var(--ink); font-weight: 600; }
/* time scrubber: native range = click-anywhere + drag, with a play/pause control */
.maptime { display: flex; align-items: flex-start; gap: 12px; padding: 13px 6px 2px; }
.maptime__play { width: 34px; height: 34px; flex: none; margin-top: 1px; border-radius: 50%; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink-2); font-size: 10.5px; line-height: 1; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: border-color .14s, color .14s; }
.maptime__play:hover, .maptime__play.is-playing { border-color: var(--brand); color: var(--brand); }
.maptime__track { flex: 1; min-width: 0; display: flex; flex-direction: column; padding-top: 8px; }
.maptime__range { width: 100%; height: 6px; cursor: pointer; accent-color: var(--brand); margin: 0; }
.maptime__ticks { position: relative; height: 15px; margin: 8px 9px 0; }
.maptime__ticks span { position: absolute; top: 0; transform: translateX(-50%); white-space: nowrap; font-family: var(--font-mono); font-size: 10px; color: var(--ink-3); }
.maptime__ticks span:first-child { transform: none; }
.maptime__ticks span:last-child { transform: translateX(-100%); }
.maptime__label { font-family: var(--font-mono); font-size: 12.5px; font-weight: 600; color: var(--ink); min-width: 78px; text-align: right; flex: none; margin-top: 9px; }
@media (max-width: 1080px) { .statemap { grid-template-columns: 1fr; } .chart--tall { height: 460px; } .chart--map { height: 420px; } }
.brush { height: 56px; padding: 6px 14px 12px; border-top: 1px solid var(--line); position: relative; }
.brush svg { display: block; width: 100%; height: 100%; }
.brush__window { position: absolute; top: 6px; bottom: 12px; border: 1px solid var(--line-3); border-radius: 4px; background: color-mix(in srgb, var(--brand) 7%, transparent); pointer-events: none; }
.brush__handle { position: absolute; top: 50%; width: 6px; height: 26px; transform: translateY(-50%); border-radius: 3px; background: var(--surface); border: 1px solid var(--line-3); box-shadow: var(--shadow-sm); }

/* transform note */
.transform-note { display: none; align-items: center; gap: 8px; padding: 9px 18px; font-size: 12px; color: var(--accent); background: var(--accent-soft); border-top: 1px solid var(--line); }
.transform-note.show { display: flex; }
.transform-note svg { flex: none; }

/* horizontal metadata strip */
.metastrip { display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1px solid var(--line); }
.metastrip__item { padding: 10px 16px; border-right: 1px solid var(--line); border-top: 1px solid var(--line); }
.metastrip__item:nth-child(-n+4) { border-top: 0; }
.metastrip__item:nth-child(4n) { border-right: 0; }
.metastrip__k { font-size: 9.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); font-weight: 700; }
.metastrip__v { font-family: var(--font-mono); font-size: 12px; color: var(--ink); margin-top: 3px; word-break: break-word; }

/* ============================== [SIDE] ================================= */
.side { display: flex; flex-direction: column; gap: 14px; position: sticky; top: 74px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); overflow: hidden; }
.panel__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 11px 14px; border-bottom: 1px solid var(--line); }
.panel__title { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-2); font-weight: 700; }
.panel__count { font-family: var(--font-mono); font-size: 11px; color: var(--ink-2); background: var(--paper-2); border-radius: 5px; padding: 1px 6px; }
.panel__body { padding: 12px 14px; }

/* compare tray */
.tray { display: flex; flex-direction: column; gap: 7px; }
.serieschip { display: flex; align-items: center; gap: 9px; padding: 8px 9px; border-radius: var(--r-md); border: 1px solid var(--line); background: var(--surface-2); transition: border-color .14s, background .14s; }
.serieschip:hover { border-color: var(--line-3); }
.serieschip__var { width: 17px; height: 17px; flex: none; display: grid; place-items: center; border-radius: 5px; background: var(--brand-soft); border: 1px solid transparent; font-family: var(--font-mono); font-size: 10.5px; font-weight: 700; color: var(--brand-2); }
.serieschip__sw { width: 9px; height: 9px; border-radius: 3px; flex: none; }
/* derived (formula) series: dashed chip, italic ƒ badge, dashed swatch */
.serieschip--derived { border-style: dashed; border-color: var(--line-3); }
.serieschip__var--fx { background: transparent; border-color: var(--line-3); color: var(--ink-2); font-style: italic; font-weight: 600; }
.serieschip__sw--dashed { border-radius: 50%; box-shadow: inset 0 0 0 2px var(--surface-2); }
.serieschip__main { min-width: 0; flex: 1; }
.serieschip__name { font-size: 12.5px; font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.serieschip__meta { font-size: 10.5px; color: var(--ink-3); font-family: var(--font-mono); margin-top: 1px; }
.axistog { display: inline-flex; flex: none; border: 1px solid var(--line-2); border-radius: 6px; overflow: hidden; }
.axisbtn { width: 21px; height: 21px; border: none; background: var(--surface); color: var(--ink-3); font-family: var(--font-mono); font-size: 10px; font-weight: 700; transition: background .14s, color .14s; }
.axisbtn + .axisbtn { border-left: 1px solid var(--line-2); }
.axisbtn:hover { color: var(--ink); }
.axisbtn:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
.axisbtn.is-on { background: var(--brand-soft); color: var(--brand-2); }
.serieschip__rm { color: var(--ink-3); width: 21px; height: 21px; flex: none; border-radius: 5px; border: none; background: transparent; display: grid; place-items: center; transition: background .14s, color .14s; }
.serieschip__rm:hover { background: var(--neg-soft); color: var(--neg); }
.unitbadge { font-size: 9.5px; font-family: var(--font-mono); color: var(--ink-2); background: var(--paper-2); border: 1px solid var(--line-2); border-radius: 5px; padding: 1px 5px; white-space: nowrap; flex: none; }
.addmore { width: 100%; justify-content: center; margin-top: 9px; border-style: dashed; color: var(--ink-2); background: transparent; }
.addmore:hover { color: var(--brand-2); border-color: var(--brand); background: var(--brand-soft); }

/* combine-into-one-line panel */
.combine-vars { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 11.5px; color: var(--ink-2); margin-bottom: 11px; }
.combine-vars span { display: inline-flex; align-items: center; gap: 6px; }
.combine-vars b { display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 4px; background: var(--brand-soft); color: var(--brand-2); font-family: var(--font-mono); font-size: 10px; font-weight: 700; }
.combine-ops { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-bottom: 11px; }
.cmb-op { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; padding: 7px 9px; border: 1px solid var(--line-2); border-radius: var(--r-md); background: var(--surface-2); color: var(--ink); font-size: 12.5px; font-weight: 600; transition: all .14s; }
.cmb-op:hover { border-color: var(--line-3); }
.cmb-op small { font-family: var(--font-mono); font-size: 10px; font-weight: 500; color: var(--ink-3); }
.cmb-op.is-on { background: var(--brand-soft); border-color: var(--brand); color: var(--brand-2); }
.cmb-op.is-on small { color: var(--brand-2); }
.combine-field { margin-top: 9px; }
.cmb-lbl { display: block; font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); margin-bottom: 4px; }
.combine-formula { display: flex; align-items: center; gap: 7px; }
.cmb-eq { font-family: var(--font-mono); font-size: 15px; color: var(--ink-3); }
.cmb-input { flex: 1; min-width: 0; width: 100%; height: 32px; padding: 0 10px; font-family: var(--font-mono); font-size: 13px; background: var(--paper-2); border: 1px solid var(--line-2); border-radius: var(--r-sm); color: var(--ink); }
.cmb-input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.cmb-name { font-family: inherit; font-size: 12.5px; }
.cmb-apply { width: 100%; margin-top: 12px; justify-content: center; }

/* source note */
.sourcenote { font-size: 12.5px; color: var(--ink-2); line-height: 1.55; }
.sourcenote b { color: var(--ink); font-weight: 600; }
.sourcenote a { color: var(--brand-2); text-decoration: underline; text-underline-offset: 2px; text-decoration-thickness: 1px; }
.sourcerow { display: flex; align-items: center; gap: 8px; margin-top: 9px; padding-top: 9px; border-top: 1px solid var(--line); font-size: 11px; color: var(--ink-3); font-family: var(--font-mono); }

/* callouts */
.callout { display: flex; gap: 9px; padding: 10px 13px; border-radius: var(--r-md); font-size: 12px; line-height: 1.5; }
.callout--warn { background: var(--accent-soft); color: var(--accent); }
.callout svg { flex: none; margin-top: 1px; }

/* ============================== [EXPLORE] ============================== */
.explore-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 16px; }
.explore-head__title { font-family: var(--font-display); font-weight: 600; font-size: 24px; letter-spacing: -.02em; margin: 5px 0 0; }
.explore-head__sub { color: var(--ink-2); font-size: 13px; margin-top: 5px; }

/* sticky filter toolbar — full-width results below */
.toolbar { position: sticky; top: 58px; z-index: 20; background: color-mix(in srgb, var(--paper) 88%, transparent); backdrop-filter: blur(10px); padding: 12px 0; margin-bottom: 4px; border-bottom: 1px solid var(--line); }
.toolbar__row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ex-search { display: flex; align-items: center; gap: 9px; flex: 1; min-width: 240px; height: 38px; padding: 0 13px; background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r-md); transition: border-color .16s, box-shadow .16s; }
.ex-search:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.ex-search svg { color: var(--ink-3); flex: none; }
.ex-search input { flex: 1; min-width: 0; border: none; background: transparent; outline: none; font-size: 13.5px; color: var(--ink); }
.ex-search input::placeholder { color: var(--ink-3); }
.facetbar { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; margin-top: 10px; }
.facet-group { display: inline-flex; align-items: center; gap: 6px; }
.facet-group__label { font-size: 10px; letter-spacing: .09em; text-transform: uppercase; color: var(--ink-3); font-weight: 700; margin-right: 1px; white-space: nowrap; flex: none; }
.facet { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 11px; border-radius: 99px; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink-2); font-size: 12px; font-weight: 500; white-space: nowrap; transition: all .14s; }
.facet:hover { border-color: var(--line-3); color: var(--ink); }
.facet.is-on { background: var(--brand-soft); border-color: var(--brand); color: var(--brand-2); font-weight: 600; }
.facet.is-on::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--brand); }
.facet-div { width: 1px; height: 18px; background: var(--line-2); margin: 0 3px; }
.facet-clear { font-size: 11.5px; color: var(--ink-3); background: transparent; border: none; padding: 4px 6px; border-radius: 5px; }
.facet-clear:hover { color: var(--neg); background: var(--neg-soft); }

/* results meta row */
.results-bar { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 14px 2px 6px; white-space: nowrap; }
.results-bar__l { font-size: 12px; color: var(--ink-3); }
.results-bar__l b { font-family: var(--font-mono); color: var(--ink); }
.results-sort { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-3); }
.results-sort b { color: var(--ink-2); font-weight: 600; }

/* dense result rows — hairline separated, full width, aligned value column */
.results { border-top: 1px solid var(--line); }
.result {
  display: grid; grid-template-columns: 62px minmax(0,1fr) minmax(124px,200px); align-items: center; gap: 16px;
  padding: 11px 14px; border-bottom: 1px solid var(--line); position: relative;
  transition: background .12s;
}
.result:hover { background: var(--surface-2); }
.result--catalog { opacity: .82; }
.result--catalog:hover { opacity: 1; }

.result__avail { display: flex; justify-content: flex-start; }
.avail { font-size: 9px; letter-spacing: .06em; font-weight: 700; text-transform: uppercase; padding: 3px 7px; border-radius: 5px; white-space: nowrap; display: inline-flex; align-items: center; gap: 5px; }
.avail--live { color: var(--pos); background: var(--pos-soft); }
.avail--live::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--pos); box-shadow: 0 0 0 2px color-mix(in srgb, var(--pos) 22%, transparent); }
.avail--cat { color: var(--ink-3); background: var(--paper-2); border: 1px solid var(--line-2); }

.result__body { min-width: 0; }
.result__title { font-size: 14px; font-weight: 600; color: var(--ink); display: flex; align-items: center; gap: 8px; line-height: 1.25; }
.result__name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.result__meta { font-size: 11.5px; color: var(--ink-3); margin-top: 3px; display: flex; align-items: center; flex-wrap: wrap; gap: 0; font-family: var(--font-mono); }
.result__meta span { white-space: nowrap; }
.result__meta span:not(:last-child)::after { content: "·"; margin: 0 7px; color: var(--line-3); }
.tag-fred { font-size: 9px; font-family: var(--font-sans); letter-spacing: .04em; font-weight: 700; text-transform: uppercase; color: var(--ink-2); background: var(--paper-2); border: 1px solid var(--line-2); border-radius: 4px; padding: 2px 5px; white-space: nowrap; flex: none; }

.result__tags { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.tag { font-size: 10.5px; font-family: var(--font-mono); color: var(--ink-2); background: var(--paper-2); border: 1px solid var(--line-2); border-radius: 5px; padding: 1px 6px; white-space: nowrap; }
.tag--src { color: var(--brand-2); background: var(--brand-soft); border-color: transparent; font-family: var(--font-sans); font-weight: 600; letter-spacing: .02em; }
.tag--id { color: var(--ink-3); }

/* right: value + date, swaps to actions on hover */
.result__num { text-align: right; white-space: nowrap; transition: opacity .14s; }
.result__val { font-family: var(--font-mono); font-size: 16px; font-weight: 600; color: var(--ink); letter-spacing: -.01em; }
.result__val--muted { color: var(--ink-3); font-size: 13px; font-weight: 500; }
.result__valunit { font-size: 10.5px; color: var(--ink-3); font-weight: 500; margin-left: 2px; }
.result__date { font-family: var(--font-mono); font-size: 10.5px; color: var(--ink-3); margin-top: 3px; }
/* actions overlay the value column on hover (no permanent gutter, no overflow) */
.result__actions {
  position: absolute; right: 14px; top: 0; bottom: 0;
  display: flex; align-items: center; justify-content: flex-end; gap: 6px;
  padding-left: 30px; background: linear-gradient(90deg, transparent, var(--surface-2) 26%);
  opacity: 0; pointer-events: none; transition: opacity .14s;
}
.result:hover .result__actions { opacity: 1; pointer-events: auto; }
.result:hover .result__num { opacity: 0; }
@media (hover: none) {
  .result { grid-template-columns: 62px minmax(0,1fr) auto auto; }
  .result__num { opacity: 1 !important; }
  .result__actions { position: static; opacity: 1; pointer-events: auto; background: none; padding-left: 0; }
}
.actbtn { font-size: 11.5px; font-weight: 500; height: 26px; padding: 0 8px; border-radius: var(--r-sm); border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); display: inline-flex; align-items: center; gap: 4px; transition: all .13s; }
.actbtn:hover { border-color: var(--brand); color: var(--brand-2); background: var(--brand-soft); }
.actbtn--icon { width: 26px; padding: 0; justify-content: center; color: var(--ink-3); }
.actbtn--icon:hover { color: var(--brand-2); }
.actbtn--primary { background: var(--brand); border-color: var(--brand); color: #fff; }
[data-theme="terminal"] .actbtn--primary { color: #06120F; }
.actbtn--primary:hover { background: color-mix(in srgb, var(--brand) 88%, #000); color: #fff; }
[data-theme="terminal"] .actbtn--primary:hover { color: #06120F; }

/* bucket section header inside list */
.bucket { display: flex; align-items: center; gap: 10px; padding: 18px 2px 8px; font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); font-weight: 700; }
.bucket .ln { flex: 1; height: 1px; background: var(--line); }
.bucket .cnt { font-family: var(--font-mono); color: var(--ink-2); background: var(--paper-2); border-radius: 4px; padding: 0 5px; font-size: 10px; }

/* ============================== [PALETTE] ============================== */
.palette { position: fixed; inset: 0; z-index: 90; display: grid; place-items: start center; padding-top: 11vh; }
.palette[hidden] { display: none; }
.palette__scrim { position: absolute; inset: 0; background: color-mix(in srgb, var(--ink) 34%, transparent); backdrop-filter: blur(4px); animation: fade .2s; }
@keyframes fade { from { opacity: 0; } }
.palette__box {
  position: relative; width: min(680px, 92vw); max-height: 72vh; display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r-xl); box-shadow: var(--shadow-lg);
  overflow: hidden; animation: paletteIn .24s var(--ease-out);
}
@keyframes paletteIn { from { opacity: 0; transform: translateY(-12px) scale(.99); } }
.palette__head { display: flex; align-items: center; gap: 12px; padding: 15px 18px; border-bottom: 1px solid var(--line); }
.palette__icon { color: var(--ink-3); flex: none; }
.palette__input { flex: 1; border: none; background: transparent; font-family: var(--font-sans); font-size: 16px; color: var(--ink); outline: none; }
.palette__input::placeholder { color: var(--ink-3); }
.palette__results { overflow-y: auto; padding: 7px; flex: 1; }
.palette__group { font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); font-weight: 700; padding: 12px 11px 6px; display: flex; align-items: center; gap: 8px; }
.palette__group .cnt { font-family: var(--font-mono); color: var(--ink-2); background: var(--paper-2); border-radius: 4px; padding: 0 5px; font-size: 10px; }
.presult { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; padding: 9px 11px; border-radius: var(--r-md); cursor: pointer; }
.presult.is-active { background: var(--brand-soft); }
.presult__ico { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: var(--paper-2); color: var(--ink-2); flex: none; font-size: 14px; }
.presult.is-active .presult__ico { background: var(--surface); color: var(--brand); }
.presult__ico--action { background: var(--brand-soft); color: var(--brand); }
.presult__main { min-width: 0; }
.presult__title { font-size: 13.5px; font-weight: 600; color: var(--ink); display: flex; align-items: center; gap: 7px; }
.presult__sub { font-size: 11.5px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.presult__right { text-align: right; flex: none; }
.presult__val { font-family: var(--font-mono); font-size: 13px; font-weight: 600; color: var(--ink); }
.presult__avail { font-size: 9.5px; color: var(--ink-3); font-family: var(--font-mono); margin-top: 1px; }
.presult__acts { display: none; gap: 5px; justify-content: flex-end; }
.presult.is-active .presult__acts { display: flex; }
.presult.is-active .presult__valwrap { display: none; }
.hl { color: var(--brand-2); font-weight: 700; background: color-mix(in srgb, var(--brand) 13%, transparent); border-radius: 2px; padding: 0 1px; }
.palette__foot { display: flex; align-items: center; gap: 16px; padding: 9px 16px; border-top: 1px solid var(--line); font-size: 11px; color: var(--ink-3); background: var(--surface-2); }
.palette__foot kbd { font-size: 10px; padding: 1px 5px; margin-right: 2px; }
.palette__foot-spacer { flex: 1; }

/* ============================== [MODAL] ================================ */
.sheet { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 20px; }
.sheet[hidden] { display: none; }
.sheet__scrim { position: absolute; inset: 0; background: color-mix(in srgb, var(--ink) 32%, transparent); backdrop-filter: blur(4px); animation: fade .2s; }
.sheet__box { position: relative; width: min(540px, 94vw); max-height: 86vh; overflow: auto; background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r-xl); box-shadow: var(--shadow-lg); animation: paletteIn .24s var(--ease-out); }
.sheet__head { display: flex; align-items: center; justify-content: space-between; padding: 17px 20px; border-bottom: 1px solid var(--line); }
.sheet__head h2 { font-family: var(--font-display); font-size: 18px; font-weight: 600; letter-spacing: -.01em; margin: 0; }
.sheet__body { padding: 16px 20px 20px; }
.export-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.export-opt { display: flex; align-items: center; gap: 11px; text-align: left; padding: 12px 13px; border-radius: var(--r-md); border: 1px solid var(--line); background: var(--surface-2); transition: border-color .15s, transform .12s; }
.export-opt:hover { border-color: var(--brand); transform: translateY(-1px); }
.export-opt__ico { width: 34px; height: 34px; border-radius: 8px; background: var(--paper-2); color: var(--brand); display: grid; place-items: center; flex: none; font-family: var(--font-mono); font-size: 11px; font-weight: 700; }
.export-opt__t { display: block; font-size: 13px; font-weight: 600; color: var(--ink); }
.export-opt__d { display: block; font-size: 11px; color: var(--ink-3); margin-top: 2px; }
.linkrow { display: flex; gap: 8px; margin-top: 14px; }
.linkrow input { flex: 1; height: 38px; padding: 0 12px; font-family: var(--font-mono); font-size: 11.5px; background: var(--paper-2); border: 1px solid var(--line-2); border-radius: var(--r-md); color: var(--ink-2); }

/* ===================== [SMALL MULTIPLES] ===================== */
.smgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; padding: 6px 0 2px; }
.smgrid--big { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; padding: 0; }
.smcell {
  display: flex; flex-direction: column; text-align: left; padding: 10px 11px 6px;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-md);
  transition: border-color .14s, box-shadow .14s, transform .14s var(--ease-out);
}
.smcell:hover { border-color: var(--line-3); box-shadow: var(--shadow-sm); transform: translateY(-2px); }
.smcell__head { display: flex; align-items: center; gap: 7px; min-width: 0; }
.smcell__sw { width: 8px; height: 8px; border-radius: 2px; flex: none; }
.smcell__name { font-size: 12px; font-weight: 600; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.smcell__val { font-family: var(--font-mono); font-size: 16px; font-weight: 600; color: var(--ink); margin: 4px 0 2px; }
.smcell__delta { font-size: 10.5px; font-weight: 500; color: var(--ink-3); margin-left: 4px; }
.smcell__chart { height: 78px; width: 100%; }
.smgrid--big .smcell__chart { height: 120px; }

/* ===================== [FOCUS / FULLSCREEN] ===================== */
.focus { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; padding: 3.2vh 2.4vw; }
.focus[hidden] { display: none; }
.focus__scrim { position: absolute; inset: 0; background: color-mix(in srgb, var(--ink) 38%, transparent); backdrop-filter: blur(8px) saturate(1.1); animation: fade .2s; }
.focus__box {
  position: relative; width: min(1280px, 96vw); height: min(94vh, 940px); display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg); overflow: hidden; animation: paletteIn .26s var(--ease-out);
}
.focus__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; padding: 15px 18px 13px; border-bottom: 1px solid var(--line); }
.focus__titlewrap { min-width: 0; }
.focus__kicker { font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--brand); font-weight: 700; }
.focus__title { font-family: var(--font-display); font-size: 22px; font-weight: 600; letter-spacing: -.02em; margin: 4px 0 0; line-height: 1.1; }
.focus__actions { display: flex; align-items: center; gap: 8px; flex: none; }
.focus__controls:empty { display: none; }
.focus__chart { flex: 1; min-height: 0; width: 100%; padding: 6px 12px; overflow: auto; }
.focus__foot { padding: 11px 18px; border-top: 1px solid var(--line); font-size: 11.5px; color: var(--ink-3); font-family: var(--font-mono); }
.focus__foot b { color: var(--ink-2); font-weight: 600; }
@media (max-width: 760px) { .focus { padding: 0; } .focus__box { width: 100vw; height: 100vh; border-radius: 0; } }

/* ============================== [MISC] ================================= */
.toast { position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%) translateY(20px); z-index: 100; background: var(--ink); color: var(--paper); padding: 10px 17px; border-radius: 99px; font-size: 13px; font-weight: 500; box-shadow: var(--shadow-lg); opacity: 0; transition: all .3s var(--ease-out); pointer-events: none; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

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

/* ===================== [PORTED] app-specific components ====================
   Classes the app's render functions emit that the design-system base doesn't
   cover. Themed with the new tokens (teal brand, cool neutrals). */

/* section headers (Themes / About / fallbacks) */
.h-title { font-family: var(--font-display); font-weight: 600; font-size: 28px; letter-spacing: -.022em; margin: 4px 0 0; line-height: 1.08; }
.h-sub { color: var(--ink-2); font-size: 14px; margin: 8px 0 0; max-width: 64ch; }

/* boot + loading */
.bootscreen { display: grid; place-items: center; gap: 16px; padding: 16vh 0; color: var(--ink-3); }
.bootscreen__mark { color: var(--brand); animation: pulse 1.6s var(--ease) infinite; }
@keyframes pulse { 0%,100% { opacity: .4; transform: scale(.96); } 50% { opacity: 1; transform: scale(1); } }
.bootscreen__txt { font-family: var(--font-mono); font-size: 12.5px; letter-spacing: .03em; }
[data-booting="true"] .topbar, [data-booting="true"] .rail { opacity: .5; pointer-events: none; }
.skel { background: linear-gradient(90deg, var(--paper-2) 25%, var(--surface-2) 50%, var(--paper-2) 75%); background-size: 200% 100%; animation: shimmer 1.3s infinite; border-radius: var(--r-sm); }
@keyframes shimmer { to { background-position: -200% 0; } }

/* empty states */
.empty { display: grid; place-items: center; gap: 10px; padding: 70px 20px; text-align: center; color: var(--ink-3); }
.empty__big { font-family: var(--font-display); font-weight: 600; font-size: 19px; color: var(--ink-2); letter-spacing: -.01em; }

/* user-preset chips */
.chips__div { width: 1px; align-self: stretch; background: var(--line-2); margin: 4px 2px; }
.chips__lbl { display: inline-flex; align-items: center; font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); font-weight: 700; }
.chip--user .chip__dot { background: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.chip__rm { display: inline-grid; place-items: center; width: 16px; height: 16px; margin: 0 -5px 0 1px; border-radius: 50%; color: var(--ink-3); font-size: 9px; }
.chip__rm:hover { background: color-mix(in srgb, var(--neg) 18%, transparent); color: var(--neg); }
.chip.is-active .chip__rm { color: var(--paper); }

/* combined-line static control + clear + tray-empty + plot button */
.ctrl-static { font-size: 12.5px; font-weight: 600; color: var(--ink); padding: 4px 0; }
.cmb-off { font-size: 11px; font-weight: 600; color: var(--ink-3); background: transparent; border: none; padding: 2px 4px; border-radius: 5px; }
.cmb-off:hover { color: var(--neg); background: var(--neg-soft); }
.cmb-apply { flex: none; }
.tray-empty { font-size: 12.5px; color: var(--ink-3); text-align: center; padding: 16px 8px; line-height: 1.5; }

/* info callout (brand-tinted) */
.callout--info { background: var(--brand-soft); color: var(--brand-2); }

/* extra availability / preset badges */
.avail--mirror { color: var(--ink-2); background: var(--paper-2); border: 1px solid var(--line-2); }
.avail--preset { color: var(--brand-2); background: var(--brand-soft); }

/* preset rows + "more" note inside the explore list */
.result__desc2 { font-size: 12px; color: var(--ink-2); margin-top: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.result__open { font-family: var(--font-mono); font-size: 11.5px; color: var(--ink-3); }
.result:hover .result__open { color: var(--brand-2); }
.more-note { padding: 10px 14px; font-size: 12px; color: var(--ink-3); border-bottom: 1px solid var(--line); }

/* command palette empty */
.palette__empty { padding: 40px 20px; text-align: center; color: var(--ink-3); font-size: 13px; line-height: 1.5; }

/* share / export sheet field label + provenance footer */
.sheet__label { font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); font-weight: 700; margin-bottom: 8px; }
.provenance { margin-top: 16px; padding: 13px; background: var(--paper-2); border-radius: var(--r-md); font-size: 11px; color: var(--ink-3); line-height: 1.55; }
.provenance b { color: var(--ink-2); }

/* Themes gallery */
.themegrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.themecard { padding: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); transition: border-color .16s, box-shadow .16s, transform .16s var(--ease-out); }
.themecard:hover { border-color: var(--line-3); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.themecard__h { font-family: var(--font-display); font-size: 17px; font-weight: 600; letter-spacing: -.01em; margin: 0 0 3px; }
.themecard__d { font-size: 12.5px; color: var(--ink-2); margin: 0 0 14px; line-height: 1.5; }
.preset-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line); }
.preset-row:hover .preset-row__name { color: var(--brand-2); }
.preset-row__name { font-size: 13px; font-weight: 500; }
.preset-row__go { font-family: var(--font-mono); font-size: 11px; color: var(--ink-3); white-space: nowrap; }

/* About prose + source table */
.prose { max-width: 760px; }
.prose h3 { font-family: var(--font-display); font-size: 18px; font-weight: 600; letter-spacing: -.01em; margin: 28px 0 8px; }
.prose p { color: var(--ink-2); margin: 0 0 12px; line-height: 1.6; }
.srctable { width: 100%; border-collapse: collapse; margin: 10px 0 4px; font-size: 12.5px; }
.srctable th { text-align: left; font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); font-weight: 700; padding: 8px 10px; border-bottom: 1.5px solid var(--line-2); }
.srctable td { padding: 10px; border-bottom: 1px solid var(--line); color: var(--ink-2); vertical-align: top; }
.srctable td b { color: var(--ink); font-weight: 600; }

/* ranked state table */
.ranktable { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.ranktable th { text-align: left; font-size: 10px; letter-spacing: .07em; text-transform: uppercase; color: var(--ink-3); font-weight: 700; padding: 8px 12px; border-bottom: 1.5px solid var(--line-2); position: sticky; top: 0; background: var(--surface); }
.ranktable th.r, .ranktable td.r { text-align: right; font-family: var(--font-mono); }
.ranktable td { padding: 8px 12px; border-bottom: 1px solid var(--line); }
.ranktable tr:hover td { background: var(--surface-2); }
.rankbar { height: 6px; border-radius: 3px; background: var(--brand); opacity: .85; }
.rank-i { color: var(--ink-3); font-family: var(--font-mono); width: 28px; }

@media (max-width: 1120px) { .themegrid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 760px)  { .themegrid { grid-template-columns: 1fr; } }

/* responsive */
@media (max-width: 1280px) { .cards { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 1120px) {
  .workspace { grid-template-columns: 1fr; }
  .side { position: static; flex-direction: row; flex-wrap: wrap; }
  .side .panel { flex: 1; min-width: 270px; }
  .result { grid-template-columns: 58px minmax(0,1fr) minmax(110px,160px); }
}
@media (max-width: 920px) {
  .freshness__profile, .freshness__sep { display: none; }
  .metastrip { grid-template-columns: repeat(2, 1fr); }
  .metastrip__item:nth-child(-n+4) { border-top: 1px solid var(--line); }
  .metastrip__item:nth-child(2n) { border-right: 0; }
  .metastrip__item:nth-child(-n+2) { border-top: 0; }
}
@media (max-width: 760px) {
  :root { --rail-w: 0px; }
  .shell { grid-template-columns: 1fr; }
  .topbar { grid-template-columns: auto 1fr auto; }
  .rail { position: fixed; bottom: 0; top: auto; left: 0; right: 0; height: auto; width: 100%; flex-direction: row; z-index: 50; border-right: 0; border-top: 1px solid var(--line); padding: 6px; justify-content: space-around; background: color-mix(in srgb, var(--paper) 94%, transparent); backdrop-filter: blur(12px); }
  .rail__item span, .rail__sec, .rail__kbd, .rail__foot { display: none; }
  .rail__item.is-active::before { display: none; }
  .main { padding: 18px 14px 90px; }
  .cards { grid-template-columns: repeat(2, 1fr); }
  .result { grid-template-columns: 54px minmax(0,1fr); }
  .result__num, .result__tags { display: none; }
  .result__actions { position: static; opacity: 1; pointer-events: auto; background: none; padding-left: 0; grid-column: 1 / -1; justify-content: flex-start; margin-top: 6px; }
  .hero { flex-direction: column; align-items: flex-start; }
  .hero__aside { align-items: flex-start; text-align: left; }
}
