/* ============================================================================
   site.css — the project's single design system.
   Source: static/site.css → copied to dist/_assets/site.css by build_site.py.

   Before 2026-08-01 this lived as six independently-drifting inline <style>
   blocks (index / index-v2 / _detail-shell / metodologie / surse / index-v1)
   plus a seventh hardcoded palette inside _search_overlay. Editing a colour
   meant editing six files and hoping. It is external rather than inlined so a
   restyle propagates to the ~5,400 pre-rendered pages without rebuilding them.

   index-v1.html.j2 / index-v2.html.j2 are deliberately NOT wired to this file
   — they are frozen earlier variants and keep their own copies.
   ========================================================================= */

/* The landing page hides whole panels, tab bars, acts and nav links by setting
   .hidden when a județ/UAT scope has no data for them. Any author rule that
   sets `display` (.panel-tabs is flex, .dash-grid is grid) beats the UA
   stylesheet's [hidden] rule, so state it once here with enough weight to
   win — otherwise "hidden" silently does nothing on exactly the elements
   that needed it. */
[hidden] { display: none !important; }

/* ────────────────────────────────────────────────────────────────────────
   1. TOKENS
   ──────────────────────────────────────────────────────────────────────── */
:root {
  /* Surfaces */
  --bg: #FFFFFF;
  --surface-1: #F7F9FC;
  --surface-2: #ECF1F8;
  --surface-blue: #DEE8F4;
  --warn-1: #FFF7CC;
  --warn-2: #FBE486;
  --ink-band: #0B1118;

  /* Ink + rules */
  --ink: #0B1118;
  --ink-2: #2A313B;
  --muted: #5A6573;
  --muted-2: #8B95A2;
  --rule: #E2E6EC;
  --rule-strong: #BFC7D2;
  --hairline: #EEF1F5;
  --on-dark: #FFFFFF;
  --on-dark-2: rgba(255, 255, 255, .72);
  --on-dark-3: rgba(255, 255, 255, .50);

  /* Brand accents. The plaque blue is the Romanian street sign — it is the
     single strongest identity cue on the site and is never used as a chart
     colour, so a chart hue can never be mistaken for a street name. */
  --plaque: #0E4D92;
  --plaque-deep: #08366D;
  --accent: #C04F35;
  --accent-dark: #8E3320;
  --gold: #E8AE00;
  --gold-soft: #F7D777;
  --olive: #5F7A4E;
  --teal: #2F6B6B;

  /* Categorical chart palette — the ONE source of truth for theme colours.
     Until 2026-08-01 there were two conflicting sets: a Jinja `theme_palette`
     driving the statbar minibar and a JS `THEME_COLORS` driving the donut,
     with different values, so "natură" was terracotta in one and olive in the
     other. Slot ORDER here is the colourblind-safety mechanism (see the
     dataviz skill's six checks) and must not be reshuffled for taste.
     Validated on #FFFFFF, adjacent pairs: lightness band PASS, chroma floor
     PASS, CVD separation ΔE 12.8 (deutan, target ≥8), normal-vision floor
     ΔE 26.3 (floor 15), contrast all ≥3:1.
     Categories are direct-labelled everywhere they appear, so identity never
     rests on colour alone. */
  --cat-1: #4E8B3C;   /* natură            */
  --cat-2: #8250B0;   /* persoană          */
  --cat-3: #B98600;   /* concept / abstract*/
  --cat-4: #2A6FC4;   /* ideologic         */
  --cat-5: #C0442A;   /* dată / sărbătoare */
  --cat-6: #00908A;   /* religios          */
  --cat-other: #9AA3AF; /* "altele" — a deliberate neutral, not a slot */

  /* Fonts */
  --sans: 'IBM Plex Sans', system-ui, -apple-system, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, Menlo, monospace;
  --street: 'Barlow Semi Condensed', 'IBM Plex Sans', sans-serif;

  /* Type scale. Replaces 23 ad-hoc px values. The display steps clamp so the
     dashboard's big numbers stop overflowing narrow viewports. */
  --fs-1: 10px;      /* micro caps: eyebrows, group labels        */
  --fs-2: 11px;      /* meta, counts, breadcrumb                  */
  --fs-3: 12px;      /* secondary body, captions                  */
  --fs-4: 13px;      /* body base                                 */
  --fs-5: 15px;      /* emphasis, list leaders                    */
  --fs-6: clamp(17px, 0.9vw + 13px, 22px);   /* panel sub-display */
  --fs-7: clamp(24px, 2.0vw + 14px, 34px);   /* statbar figure    */
  --fs-8: clamp(28px, 3.0vw + 16px, 44px);   /* hero display      */

  /* Spacing */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 24px;
  --sp-6: 32px;

  /* Radius, rules, elevation */
  --radius-1: 2px;
  --radius-2: 3px;
  --radius-3: 6px;
  --shadow-1: 0 2px 3px rgba(0, 0, 0, .26);
  --shadow-2: 0 24px 60px rgba(0, 0, 0, .32);

  /* Plaque relief, shared by .rank-name / .street-tag / .ctok .plaque / h1 */
  --plaque-text-shadow: 0 -0.5px 0 rgba(0, 0, 0, .30), 0 1px 1.5px rgba(0, 0, 0, .50);
  --plaque-box-shadow: inset 0 1px 0 rgba(255, 255, 255, .14), var(--shadow-1);

  /* Sticky chrome height — anchors offset by this so headings clear the nav */
  --nav-h: 46px;
}

/* ────────────────────────────────────────────────────────────────────────
   2. RESET + BASE
   ──────────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: var(--fs-4);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-variant-ligatures: common-ligatures contextual;
}

a { color: var(--plaque); text-decoration: none; }
a:hover { text-decoration: underline; }

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

/* Every in-page anchor target clears the sticky nav. */
[id] { scroll-margin-top: calc(var(--nav-h) + var(--sp-3)); }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

/* ────────────────────────────────────────────────────────────────────────
   3. ICONS · EMOJI · PORTRAIT
   ──────────────────────────────────────────────────────────────────────── */
.icon {
  width: 14px; height: 14px; flex-shrink: 0; vertical-align: middle;
  stroke: currentColor; stroke-width: 1.75; fill: none;
  stroke-linecap: round; stroke-linejoin: round;
}
.icon.sm { width: 11px; height: 11px; stroke-width: 1.9; }
.icon.md { width: 12px; height: 12px; }
.icon.lg { width: 18px; height: 18px; }
.icon.xl { width: 22px; height: 22px; stroke-width: 1.6; }

/* Emoji fallback. Being retired in favour of the Lucide sprite — keep until
   the last <span class="emo"> is gone. */
.emo {
  font-family: 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', sans-serif;
  font-style: normal; font-weight: 400;
  display: inline-block; line-height: 1;
  font-variant-emoji: emoji;
}
.emo.sm  { font-size: var(--fs-1); }
.emo.md  { font-size: var(--fs-3); }
.emo.lg  { font-size: 14px; }
.emo.xl  { font-size: 18px; }
.emo.xxl { font-size: 22px; }

.portrait {
  width: 26px; height: 26px;
  border-radius: 999px;
  background: var(--surface-2) linear-gradient(135deg, var(--surface-2), var(--surface-blue));
  border: 1px solid var(--rule-strong);
  flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--muted-2);
  font-family: var(--sans); font-size: var(--fs-1); font-weight: 700;
  letter-spacing: .02em;
  overflow: hidden;
  vertical-align: middle;
}
.portrait.md { width: 36px; height: 36px; font-size: var(--fs-3); }
.portrait.lg { width: 52px; height: 52px; font-size: 14px; }
.portrait.xl { width: 80px; height: 80px; font-size: 20px; }
.portrait img { width: 100%; height: 100%; object-fit: cover; }

/* ────────────────────────────────────────────────────────────────────────
   4. SITE NAV + SCOPE BAR
   The nav used to be `display:none` below 640px, which also hid the județ/UAT
   selects nested inside it — mobile had no interaction at all. It now scrolls
   horizontally instead, and the selects live in their own .scope-bar.
   ──────────────────────────────────────────────────────────────────────── */
.site-nav {
  position: sticky; top: 0; z-index: 100;
  background: var(--bg);
  border-bottom: 1px solid var(--ink);
  padding: var(--sp-2) var(--sp-5);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--sp-4);
  font-family: var(--sans);
  font-size: 11.5px;
  letter-spacing: .06em;
  min-height: var(--nav-h);
}
.site-nav .brand {
  font-weight: 700;
  color: var(--ink);
  letter-spacing: .14em;
  text-transform: uppercase;
  text-decoration: none;
  font-size: 12.5px;
  white-space: nowrap;
  flex-shrink: 0;
  display: inline-flex; align-items: center; gap: var(--sp-2);
}
.site-nav .brand:hover { text-decoration: none; }
.site-nav .brand::before {
  content: '◆';
  color: var(--gold);
  font-size: var(--fs-1);
  line-height: 1;
}
.site-nav nav {
  display: flex; align-items: center; gap: 20px;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding-bottom: 1px;
}
.site-nav nav::-webkit-scrollbar { display: none; }
.site-nav nav a {
  color: var(--muted); text-decoration: none;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .1em;
  font-size: 10.5px;
  white-space: nowrap;
  padding-bottom: 2px;
  border-bottom: 2px solid transparent;
  transition: color .12s ease, border-color .12s ease;
}
.site-nav nav a:hover { color: var(--ink); border-bottom-color: var(--gold); text-decoration: none; }
.site-nav nav a.active { color: var(--ink); border-bottom-color: var(--gold); }
.site-nav .nav-sep {
  display: inline-block; width: 1px; height: 16px;
  background: var(--rule); margin: 0 var(--sp-1); align-self: center;
  flex-shrink: 0;
}
/* In-page act anchors — landing only, tracked by the scrollspy. Distinguished
   from the route links so "which act am I in" never reads as "which page". */
.site-nav nav a.act-link { color: var(--ink-2); font-weight: 700; }
.site-nav nav a.act-link.active { border-bottom-color: var(--accent); }

/* Touch-reachable entry to the ⌘K overlay, which is otherwise keyboard-only. */
.nav-search {
  display: inline-flex; align-items: center; gap: 6px;
  flex-shrink: 0;
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius-2);
  background: var(--bg);
  color: var(--muted);
  padding: 4px var(--sp-2);
  font-family: var(--sans); font-size: 10.5px; font-weight: 600;
  letter-spacing: .08em; text-transform: uppercase;
  cursor: pointer;
}
.nav-search:hover { border-color: var(--ink); color: var(--ink); }
.nav-search kbd {
  font-family: var(--mono); font-size: 9.5px; font-weight: 700;
  color: var(--muted-2); letter-spacing: 0;
}
@media (max-width: 640px) { .nav-search kbd { display: none; } }

/* Scope bar — the landing page's județ/UAT selects, always visible. */
.scope-bar {
  position: sticky; top: var(--nav-h); z-index: 99;
  background: var(--surface-1);
  border-bottom: 1px solid var(--rule);
  padding: var(--sp-2) var(--sp-5);
  display: flex; align-items: center; gap: var(--sp-2);
  flex-wrap: wrap;
}
.scope-bar .scope-label {
  font-size: var(--fs-1); font-weight: 700; letter-spacing: .18em;
  text-transform: uppercase; color: var(--muted);
  margin-right: var(--sp-1);
}
.scope-bar .scope-reset {
  font-size: 10.5px; font-weight: 600; color: var(--muted);
  background: none; border: 0; cursor: pointer;
  text-decoration: underline; text-underline-offset: 2px;
}
.scope-bar .scope-reset:hover { color: var(--accent); }

select.field {
  background: transparent;
  border: 1px solid var(--rule-strong);
  color: var(--ink);
  font-family: var(--sans); font-size: var(--fs-2); font-weight: 600;
  padding: 2px 22px 2px var(--sp-2);
  border-radius: var(--radius-2); height: 28px; cursor: pointer;
  -webkit-appearance: none; -moz-appearance: none; appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 9px) 54%, calc(100% - 5px) 54%;
  background-size: 4px 4px, 4px 4px; background-repeat: no-repeat;
  max-width: 200px;
}
select.field:focus { outline: none; border-color: var(--gold); }

/* ────────────────────────────────────────────────────────────────────────
   5. STATBAR — the dashboard masthead ticker
   ──────────────────────────────────────────────────────────────────────── */
.statbar {
  background: var(--surface-1);
  color: var(--ink);
  border-bottom: 3px solid var(--gold);
  padding: 22px 28px 24px;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1.45fr;
  gap: 0;
  align-items: stretch;
  position: relative;
}
.statbar::before {
  content: ''; position: absolute; left: 0; right: 0; top: 0;
  height: 1px; background: var(--hairline);
}
.statbar .group {
  display: flex; flex-direction: column; gap: var(--sp-3);
  padding: 0 26px 0 0;
  min-width: 0;
  border-right: 1px solid var(--rule);
}
.statbar .group + .group { padding-left: 26px; }
.statbar .group:last-child { border-right: none; padding-right: 0; }

.statbar .group-label {
  font-family: var(--sans);
  font-size: var(--fs-1);
  text-transform: uppercase;
  letter-spacing: .22em;
  color: var(--muted);
  font-weight: 700;
  display: inline-flex; align-items: center; gap: 7px;
}
.statbar .v {
  font-family: var(--sans);
  font-weight: 700;
  font-size: var(--fs-7);
  color: var(--ink);
  line-height: 1;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.025em;
}
.statbar .v .u {
  font-size: 14px;
  color: var(--muted);
  margin-left: var(--sp-1);
  font-weight: 600;
  letter-spacing: 0;
}
.statbar .l {
  font-family: var(--sans);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .14em;
  color: var(--muted);
  margin-top: var(--sp-1);
  font-weight: 500;
}
.statbar .accent { color: var(--accent); }

.statbar .scale-stack { display: flex; flex-direction: column; gap: var(--sp-3); }
.statbar .scale-stack .item { display: flex; align-items: baseline; gap: var(--sp-3); }
.statbar .scale-stack .item .v { font-size: clamp(21px, 1.6vw + 12px, 28px); }
.statbar .scale-stack .item .l { margin-top: 0; }
.statbar .scale-note { margin-top: var(--sp-3); font-size: var(--fs-2); color: var(--muted); }
.statbar .scale-note a {
  color: var(--muted); text-decoration: underline;
  text-decoration-color: var(--rule); text-underline-offset: 2px;
}
.statbar .scale-note a:hover { color: var(--accent); text-decoration-color: var(--accent); }

.statbar .tema-row, .statbar .gen-row { display: flex; align-items: baseline; gap: var(--sp-2); }
.statbar .gen-row .frac {
  font-size: var(--fs-5);
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  font-weight: 500;
}

.statbar .minibar {
  display: flex; height: 8px; overflow: hidden;
  background: var(--rule); margin-top: var(--sp-1);
}
/* 2px surface gap between stacked segments — dataviz mark spec. */
.statbar .minibar > * + * { box-shadow: -2px 0 0 var(--surface-1); }

.statbar .top-pair { display: flex; flex-direction: column; gap: 9px; }
.statbar .top-pair .row { display: flex; align-items: baseline; gap: var(--sp-3); }
.statbar .top-pair .prefix {
  font-size: var(--fs-1);
  text-transform: uppercase;
  letter-spacing: .18em;
  color: var(--muted);
  font-weight: 700;
  min-width: 28px;
}
.statbar .top-pair .name {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -.005em;
  min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.statbar .top-pair .cnt {
  font-weight: 700;
  font-size: var(--fs-5);
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  margin-left: auto;
  letter-spacing: -.01em;
  white-space: nowrap;
}
.statbar .top-pair .cnt .u {
  font-size: 10.5px; color: var(--muted); margin-left: 3px; font-weight: 600;
}

/* ────────────────────────────────────────────────────────────────────────
   6. ACTS · PANEL GRID
   ──────────────────────────────────────────────────────────────────────── */
.act { border-bottom: 1px solid var(--rule-strong); }
.act-header {
  max-width: 1640px; margin: 0 auto;
  padding: var(--sp-5) var(--sp-5) var(--sp-3);
  display: flex; align-items: baseline; gap: var(--sp-3); flex-wrap: wrap;
}
.act-header .act-num {
  font-family: var(--mono); font-size: var(--fs-2); font-weight: 700;
  color: var(--gold); letter-spacing: .1em;
}
.act-header h2 {
  font-size: var(--fs-6);
  font-weight: 700; letter-spacing: -.01em; color: var(--ink);
}
.act-header .act-sub {
  font-size: var(--fs-3); color: var(--muted); margin-left: auto;
  max-width: 46ch; text-align: right;
}

.dash-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 1px;
  background: var(--rule-strong);
  max-width: 1640px;
  margin: 0 auto;
  border-top: 1px solid var(--rule-strong);
}
.panel {
  background: var(--bg);
  padding: var(--sp-4) var(--sp-4) var(--sp-3);
  grid-column: span 6;
  min-width: 0;
}
.panel.s4  { grid-column: span 4; }
.panel.s6  { grid-column: span 6; }
.panel.s8  { grid-column: span 8; }
.panel.s12 { grid-column: span 12; }

.panel-header {
  display: flex; justify-content: space-between; align-items: center;
  margin: 0 0 var(--sp-3);
  padding: 0 0 var(--sp-2);
  border-bottom: 2px solid var(--ink);
  gap: var(--sp-3); flex-wrap: wrap;
  position: relative;
}
.panel-label {
  font-size: 11.5px;
  letter-spacing: .14em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--ink);
  display: inline-flex; align-items: center; gap: 7px;
}
.panel-meta {
  font-size: var(--fs-2);
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  letter-spacing: .04em;
}
.panel-caption {
  font-size: var(--fs-3);
  color: var(--muted);
  margin-top: var(--sp-2);
  line-height: 1.5;
}

.kicker {
  font-size: var(--fs-1);
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--ink);
  font-weight: 700;
  margin-bottom: var(--sp-2);
  display: inline-flex; align-items: center; gap: 6px;
}
.kicker.muted { color: var(--muted); font-weight: 600; }

/* Tabs inside a panel (Profilul persoanei onorate, Biografii, Ecart de gen) */
.panel-tabs {
  display: flex; gap: 2px; flex-wrap: wrap;
  margin: 0 0 var(--sp-3);
  border-bottom: 1px solid var(--rule);
}
.panel-tab {
  font-family: var(--sans); font-size: 10.5px; font-weight: 700;
  letter-spacing: .12em; text-transform: uppercase;
  color: var(--muted);
  background: none; border: 0;
  padding: var(--sp-1) var(--sp-2) 6px;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  cursor: pointer;
}
.panel-tab:hover { color: var(--ink); }
.panel-tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--gold); }
.tabpanel[hidden] { display: none; }
/* The absorbed panel's own .panel-meta, demoted to a line inside its tab. */
.tab-meta {
  font-size: var(--fs-2); color: var(--muted);
  font-variant-numeric: tabular-nums; letter-spacing: .04em;
  margin-bottom: var(--sp-2);
}

/* While the deferred index-data.json is in flight after a scope change. */
body.scope-loading .dash-grid { opacity: .55; transition: opacity .15s ease; }
body.scope-loading .scope-bar { cursor: progress; }

/* ────────────────────────────────────────────────────────────────────────
   7. RANK LISTS · PLAQUES
   ──────────────────────────────────────────────────────────────────────── */
.rank-list { display: flex; flex-direction: column; }
.rank-row {
  display: grid;
  align-items: center;
  gap: var(--sp-3);
  padding: 5px var(--sp-1);
  min-height: 30px;
  border-bottom: 1px solid var(--hairline);
  break-inside: avoid;
  transition: background .1s ease;
  position: relative;
}
.rank-row:hover { background: var(--surface-1); }
.rank-row:last-child { border-bottom: none; }

/* Gold inset on the leader row of every list */
.rank-list > .rank-row:first-child {
  background: linear-gradient(to right, var(--warn-1) 0%, rgba(255, 247, 204, .35) 60%, transparent 100%);
  box-shadow: inset 3px 0 0 var(--gold);
  padding-left: 7px;
}

.rank-num {
  font-size: var(--fs-2);
  font-weight: 600;
  color: var(--muted);
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.rank-list > .rank-row:first-child .rank-num { color: var(--ink); font-weight: 700; }

/* Street names rendered as RO street-sign plaques (white-on-blue). */
.rank-name, .street-tag {
  font-family: var(--street);
  font-weight: 700;
  font-size: 13.5px;
  letter-spacing: .045em;
  display: inline-block;
  padding: 2.5px 10px;
  background: var(--plaque);
  color: var(--on-dark);
  border: none;
  border-radius: var(--radius-1);
  text-shadow: var(--plaque-text-shadow);
  box-shadow: var(--plaque-box-shadow);
  line-height: 1.25;
  vertical-align: middle;
  width: max-content;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  justify-self: start;
}
.street-tag.sm, .street-tag.small { font-size: var(--fs-3); padding: 1.5px var(--sp-2); }
.street-tag.lg { font-size: 16px; padding: var(--sp-1) 14px; }

/* Person names: clean bold sans, no plaque */
.rank-name.person {
  display: inline;
  padding: 0; border: none; background: transparent; border-radius: 0;
  font-family: var(--sans);
  font-weight: 600;
  font-size: var(--fs-4);
  letter-spacing: -.005em;
  color: var(--ink);
  text-shadow: none;
  box-shadow: none;
  max-width: none; overflow: visible;
  width: auto;
  justify-self: auto;
}
.rank-count {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink);
  text-align: right;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.005em;
}

/* Row cell containing the plaque + optional tag */
.name-cell {
  display: flex; align-items: center; gap: 6px;
  min-width: 0;
  overflow: hidden;
}
.name-cell .rank-name { flex: 0 1 auto; min-width: 0; }
.name-cell .tag { flex: 0 0 auto; }

/* Contest row — fixed 140px name column overflowed a 320px viewport. */
.contest-row {
  display: grid;
  grid-template-columns: 14px minmax(0, 140px) minmax(40px, 1fr) 36px;
  gap: var(--sp-2);
  align-items: center;
  padding: var(--sp-1) 0;
}
.contest-row + .contest-row { border-top: 1px solid var(--hairline); }
.contest-row .contest-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.contest-row .rank-num-mini {
  font-size: var(--fs-1);
  font-weight: 600;
  color: var(--muted);
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.contest-row:first-child .rank-num-mini { color: var(--ink); font-weight: 700; }
.contest-row .rank-count-mini {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--ink);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* ────────────────────────────────────────────────────────────────────────
   8. TAGS · CHIPS · BARS · FIGURES
   ──────────────────────────────────────────────────────────────────────── */
.tag {
  font-size: var(--fs-1);
  color: var(--ink-2);
  background: var(--surface-2);
  padding: 2px 7px;
  border-radius: var(--radius-1);
  vertical-align: middle;
  letter-spacing: .04em;
  font-weight: 600;
  text-transform: lowercase;
}
.rank-row .tag, .name-cell .tag { margin-left: 6px; }
.tag.person { background: #F8DAD0; color: var(--accent-dark); }
.tag.ideo   { background: #FFF1C6; color: #7A5400; }
.tag.nature { background: #E1ECDA; color: #3D5A2A; }

.chip {
  font-family: var(--sans);
  font-size: var(--fs-2);
  font-weight: 600;
  color: var(--ink);
  padding: 4.5px 11px;
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius-1);
  background: var(--bg);
  cursor: pointer;
  letter-spacing: .02em;
  transition: background .12s ease, color .12s ease, border-color .12s ease;
}
.chip:hover { background: var(--surface-2); border-color: var(--ink); }
.chip.active { color: var(--on-dark); background: var(--ink); border-color: var(--ink); }

.bar-wrap {
  height: 5px;
  background: var(--surface-2);
  position: relative;
}
.bar {
  position: absolute; left: 0; top: 0;
  height: 100%;
  /* 4px rounded data-end anchored to the baseline — dataviz mark spec */
  border-radius: 0 var(--radius-1) var(--radius-1) 0;
  background: var(--ink);
  opacity: .82;
}
.bar.accent { background: var(--accent); opacity: 1; }
.bar.female { background: var(--accent); opacity: .72; }
.bar.gold   { background: var(--gold);   opacity: .95; }
.bar.olive  { background: var(--olive);  opacity: .9;  }

.display-num {
  font-family: var(--sans);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.025em;
  line-height: 1;
  font-size: var(--fs-8);
}
.display-num.sm { font-size: var(--fs-6); }

/* Gender panel: a 130px waffle next to a 64px figure needs ~430px, so at 375px
   it was the one element making the whole page scroll sideways. Wrap instead,
   and let the figure shrink with the viewport. */
.gender-split {
  display: flex; gap: var(--sp-4); align-items: flex-start; flex-wrap: wrap;
}
.gender-figure { font-size: clamp(38px, 11vw, 64px); }

.subgrid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 1px;
  background: var(--rule);
  border: 1px solid var(--rule);
}

/* ────────────────────────────────────────────────────────────────────────
   9. CLUSTER CLOUD (top-row token panels)
   ──────────────────────────────────────────────────────────────────────── */
.cluster-panel .panel-header { margin-bottom: 6px; }
.cluster-band { padding: var(--sp-3) 0 14px; border-top: 1px solid var(--hairline); }
.cluster-band:first-of-type { border-top: 0; padding-top: 6px; }
.cluster-band.tail { opacity: .82; }
.cluster-band.highlighted {
  padding-left: 11px;
  border-left: 2px solid var(--cluster-color, var(--ink));
  margin-left: -13px;
}
.cluster-eyebrow, .sub-eyebrow {
  display: flex; align-items: baseline; gap: var(--sp-2);
  font-size: 10.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .18em;
  color: var(--ink);
  margin-bottom: 9px;
}
.cluster-eyebrow .dot, .sub-eyebrow .dot {
  width: 7px; height: 7px; border-radius: 999px;
  background: var(--cluster-color, var(--ink));
  display: inline-block;
}
.cluster-eyebrow .lbl-meta, .sub-eyebrow .meta {
  color: var(--muted-2);
  font-weight: 600; letter-spacing: .12em;
  font-family: var(--mono); font-size: var(--fs-1);
  margin-left: auto;
}
.cluster-band.tail .cluster-eyebrow { color: var(--muted); }
.sub-section + .sub-section { margin-top: 14px; }

.flat-tokens, .cluster-tokens {
  display: flex; flex-wrap: wrap;
  align-items: baseline;
  gap: 11px var(--sp-3);
  line-height: 1.55;
}
.flat-tokens { padding: 6px 0 var(--sp-1); }
.flat-tokens .ctok, .cluster-tokens .ctok {
  display: inline-block;
  position: relative;
  white-space: nowrap;
}
.ctok.person, .ctok.street { display: inline-flex; align-items: center; vertical-align: middle; }
.ctok.person .portrait, .ctok.street .portrait {
  width: 46px; height: 46px;
  font-size: 14px;
  margin-right: -18px;
  z-index: 2;
  position: relative;
  box-shadow: 0 0 0 3px var(--bg);
}
.ctok.person.has-portrait .chip,
.ctok.street.has-portrait .plaque { padding-left: var(--sp-5); }

.ctok.street .plaque {
  display: inline-block;
  background: var(--plaque);
  color: var(--on-dark);
  font-family: var(--street);
  font-weight: 600;
  letter-spacing: .01em;
  padding: var(--sp-1) 11px;
  border-radius: var(--radius-2);
  text-shadow: var(--plaque-text-shadow);
}
.ctok.person .chip {
  display: inline-block;
  background: var(--surface-1);
  color: var(--ink);
  font-family: var(--sans);
  font-weight: 600;
  letter-spacing: .005em;
  padding: var(--sp-1) var(--sp-3);
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius-1);
  cursor: default;
}
.ctok .cnt-badge {
  position: absolute;
  top: -6px; right: -8px;
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
  background: var(--ink-band);
  color: var(--gold-soft);
  padding: 1px 5px;
  border-radius: 7px;
  letter-spacing: .02em;
  line-height: 1.4;
  vertical-align: baseline;
  pointer-events: none;
}
.ctok.person .cnt-badge { background: var(--ink-2); color: var(--on-dark); }
.ctok.leader .plaque, .ctok.leader .chip { box-shadow: 0 0 0 2px var(--gold); }
.cluster-panel .panel-meta-tail {
  font-size: 10.5px; color: var(--muted); padding: var(--sp-3) 0 0;
}

/* ────────────────────────────────────────────────────────────────────────
   10. DETAIL PAGES
   ──────────────────────────────────────────────────────────────────────── */
.detail-page { max-width: 1200px; margin: 0 auto; padding: 0 var(--sp-5) 60px; }

.breadcrumb {
  font-size: var(--fs-2); color: var(--muted); letter-spacing: .04em;
  padding: 14px 0 0;
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
}
.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--ink); text-decoration: none; }
.breadcrumb .sep { color: var(--rule-strong); }

.detail-hero {
  padding: 18px 0 20px;
  border-bottom: 3px solid var(--gold);
  margin-bottom: 28px;
}
.detail-hero .kicker {
  font-size: var(--fs-1); letter-spacing: .22em; text-transform: uppercase;
  font-weight: 700; color: var(--muted); margin-bottom: var(--sp-2);
  display: flex; align-items: center; gap: var(--sp-2);
}
.detail-hero h1 {
  font-family: var(--street);
  font-weight: 700; font-size: clamp(24px, 3.4vw + 12px, 36px);
  letter-spacing: .03em;
  color: var(--ink); line-height: 1.1;
}
.detail-hero h1.plaque {
  display: inline-block;
  background: var(--plaque); color: var(--on-dark);
  padding: var(--sp-1) 18px 6px;
  border-radius: var(--radius-2);
  text-shadow: var(--plaque-text-shadow);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .14), 0 3px 5px rgba(0, 0, 0, .28);
}
.detail-hero .meta-row {
  margin-top: var(--sp-3);
  display: flex; align-items: center; gap: var(--sp-4); flex-wrap: wrap;
  font-size: var(--fs-3); color: var(--muted);
}
.detail-hero .meta-row strong { color: var(--ink); font-weight: 700; }

.detail-section { margin: 28px 0 0; }
.detail-section-header {
  font-size: 10.5px; letter-spacing: .2em; text-transform: uppercase;
  font-weight: 700; color: var(--muted);
  border-bottom: 1px solid var(--rule); padding-bottom: var(--sp-2);
  margin-bottom: 14px;
}

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; }

.delta { font-size: var(--fs-2); font-weight: 700; font-variant-numeric: tabular-nums; }
.delta.pos { color: var(--accent); }
.delta.neg { color: var(--olive); }

.uat-cluster { display: flex; flex-wrap: wrap; gap: 6px; }
.uat-pill {
  font-size: 11.5px; font-weight: 600;
  padding: 3px 10px;
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius-1);
  background: var(--surface-1);
  color: var(--ink);
  text-decoration: none;
  transition: background .1s ease, border-color .1s ease;
}
.uat-pill:hover { background: var(--surface-blue); border-color: var(--plaque); text-decoration: none; }
.uat-pill.is-capital {
  background: var(--bg);
  border-color: var(--gold);
  box-shadow: inset 3px 0 0 var(--gold);
  padding-left: var(--sp-3);
}
.uat-pill.is-capital::before {
  content: '◆'; color: var(--gold); font-size: 9px;
  margin-right: var(--sp-1); line-height: 1; vertical-align: 1px;
}
.uat-pill-plain {
  color: var(--muted-2);
  border-color: var(--rule);
  background: var(--bg);
  cursor: default;
}
.uat-pill-plain:hover { background: var(--bg); border-color: var(--rule); }

.judet-section { margin-bottom: var(--sp-3); }
.judet-label {
  font-size: var(--fs-1); letter-spacing: .18em; text-transform: uppercase;
  font-weight: 700; color: var(--muted);
  margin-bottom: 6px; padding-top: var(--sp-3);
  border-top: 1px solid var(--rule);
}
.judet-section:first-child .judet-label { border-top: none; padding-top: 0; }

/* ────────────────────────────────────────────────────────────────────────
   11. FOOTER — one dark band on every page
   ──────────────────────────────────────────────────────────────────────── */
.site-footer {
  background: var(--ink-band);
  color: var(--on-dark);
  padding: var(--sp-5) 28px;
}
.site-footer .footer-grid {
  max-width: 1640px; margin: 0 auto;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-6);
}
.site-footer .footer-label {
  font-size: var(--fs-1); letter-spacing: .22em; text-transform: uppercase;
  font-weight: 700; color: var(--gold); margin-bottom: var(--sp-2);
  display: inline-flex; align-items: center; gap: 7px;
  text-decoration: none;
}
.site-footer .footer-label:hover { text-decoration: none; color: var(--gold-soft); }
.site-footer p { font-size: 12.5px; line-height: 1.6; color: var(--on-dark-2); }
.site-footer p a { color: var(--gold-soft); text-decoration: underline; text-underline-offset: 2px; }
.site-footer .footer-rule {
  max-width: 1640px; margin: 18px auto 0;
  border-top: 1px solid rgba(255, 255, 255, .10);
  padding-top: var(--sp-3);
  font-size: var(--fs-2); color: var(--on-dark-3); letter-spacing: .04em;
}

/* ────────────────────────────────────────────────────────────────────────
   12. GLOBAL SEARCH OVERLAY
   Was carrying a hardcoded warm-paper palette (#FAF8F3 / #D8D5CB / #C8A85A)
   left over from the v1 design, on every page of the current design.
   ──────────────────────────────────────────────────────────────────────── */
.gso-backdrop {
  position: fixed; inset: 0; background: rgba(11, 17, 24, .55);
  display: none; z-index: 9999; align-items: flex-start; justify-content: center;
  padding: 12vh var(--sp-4) var(--sp-4);
}
.gso-backdrop.open { display: flex; }
.gso-modal {
  width: 100%; max-width: 640px; background: var(--bg);
  border: 1px solid var(--rule-strong); border-radius: var(--radius-3);
  box-shadow: var(--shadow-2);
  font-family: var(--sans);
  display: flex; flex-direction: column; max-height: 76vh; overflow: hidden;
}
.gso-search-row {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4); border-bottom: 1px solid var(--rule);
}
.gso-search-row .icon-glyph { font-size: 14px; color: var(--muted); line-height: 1; }
.gso-search-row input {
  flex: 1; border: 0; outline: 0; background: transparent;
  font: 500 16px/1.2 inherit; color: var(--ink);
}
.gso-search-row .hint {
  font: 600 var(--fs-1)/1 var(--mono);
  color: var(--muted-2); padding: var(--sp-1) 6px;
  border: 1px solid var(--rule-strong); border-radius: var(--radius-1);
  letter-spacing: .05em;
}
.gso-results { overflow-y: auto; flex: 1; padding: 6px 0; }
.gso-empty, .gso-loading {
  padding: var(--sp-4); color: var(--muted); font-size: var(--fs-4); text-align: center;
}
.gso-group-eyebrow {
  font: 600 var(--fs-1)/1 inherit; letter-spacing: .18em; text-transform: uppercase;
  color: var(--muted-2); padding: var(--sp-3) var(--sp-4) 6px;
}
.gso-row {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: var(--sp-3); padding: var(--sp-2) var(--sp-4); text-decoration: none; color: inherit;
  font-size: 13.5px; line-height: 1.3;
  border-left: 2px solid transparent;
}
.gso-row:hover { text-decoration: none; }
.gso-row.active { background: var(--warn-1); border-left-color: var(--gold); }
.gso-row .name { font-weight: 500; color: var(--ink); }
.gso-row .sub { color: var(--muted); font-size: 11.5px; margin-left: 6px; }
.gso-row .cnt { font: 600 var(--fs-3)/1 var(--mono); color: var(--muted); white-space: nowrap; }
.gso-row.disabled { opacity: .55; cursor: default; }
.gso-row .nopage {
  display: inline-block; font-size: 9.5px; padding: 1px 5px;
  border: 1px solid var(--rule-strong); border-radius: var(--radius-1); color: var(--muted-2);
  margin-left: 6px; vertical-align: 2px; text-transform: uppercase;
  letter-spacing: .04em;
}
.gso-footer {
  display: flex; gap: var(--sp-4); padding: var(--sp-2) var(--sp-4);
  border-top: 1px solid var(--rule); background: var(--surface-1);
  font: 500 var(--fs-2)/1 inherit; color: var(--muted);
}
.gso-footer kbd {
  font: 600 var(--fs-1)/1 var(--mono); padding: 2px 5px;
  border: 1px solid var(--rule-strong); border-radius: var(--radius-1);
  margin-right: var(--sp-1); color: var(--muted);
}

/* ────────────────────────────────────────────────────────────────────────
   13. BROWSER (/browser) — the full-viewport explorer shell
   ──────────────────────────────────────────────────────────────────────── */
body.browser-shell {
  height: 100vh; overflow: hidden;
  display: flex; flex-direction: column;
}
/* An app shell, not a document: the three-column footer would eat a third of
   the viewport. Every route stays reachable through the nav and ⌘K. */
body.browser-shell .site-footer { display: none; }
body.browser-shell .site-nav { flex-shrink: 0; }

.browser-page { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-height: 0; }

/* ── Filter bar ───────────────────────────────────────────────────────── */
.filter-bar {
  background: var(--ink); padding: var(--sp-2) 14px;
  display: flex; gap: 5px; align-items: center;
  flex-shrink: 0; position: relative; z-index: 150;
  flex-wrap: wrap;
}
.fdd-slot { display: contents; }
.fsearch {
  background: rgba(255, 255, 255, .12);
  border: 1px solid rgba(255, 255, 255, .2);
  border-radius: var(--radius-2);
  color: var(--on-dark);
  font-family: var(--sans); font-size: var(--fs-2);
  padding: var(--sp-1) 9px;
  width: 150px; flex-shrink: 0; outline: none;
  transition: background .1s;
}
.fsearch:focus { background: rgba(255, 255, 255, .18); }
.fsearch::placeholder { color: var(--on-dark-3); }
.fsep { width: 1px; height: 16px; background: rgba(255, 255, 255, .13); flex-shrink: 0; margin: 0 2px; }

.more-btn, .sort-wrap select, .vt-btn {
  font-family: var(--sans); font-size: 10.5px; font-weight: 600;
  background: rgba(255, 255, 255, .09);
  border: 1px solid rgba(255, 255, 255, .16);
  color: var(--on-dark-2);
  border-radius: var(--radius-2);
  padding: var(--sp-1) var(--sp-2);
  cursor: pointer; white-space: nowrap;
}
.more-btn:hover, .sort-wrap select:hover { background: rgba(255, 255, 255, .16); color: var(--on-dark); }
.more-btn[aria-expanded="true"] { background: rgba(255, 255, 255, .2); color: var(--on-dark); }
.more-count {
  display: inline-block; margin-left: 5px; padding: 0 5px;
  background: var(--gold); color: var(--ink);
  border-radius: 8px; font-size: 9.5px; font-weight: 700;
}
.sort-wrap { display: inline-flex; align-items: center; gap: 5px; }
.sort-wrap .sort-lbl {
  font-size: 9px; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: var(--on-dark-3);
}
.sort-wrap select { -webkit-appearance: none; appearance: none; padding-right: var(--sp-3); }

.view-toggle {
  margin-left: auto; display: flex;
  background: rgba(255, 255, 255, .10);
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: var(--radius-2); overflow: hidden; flex-shrink: 0;
}
.vt-btn {
  border: 0; border-radius: 0;
  padding: 3.5px 11px; font-size: var(--fs-1); font-weight: 700;
  letter-spacing: .06em; text-transform: uppercase;
  color: var(--on-dark-3); background: transparent;
}
.vt-btn + .vt-btn { border-left: 1px solid rgba(255, 255, 255, .14); }
.vt-btn:hover { color: var(--on-dark-2); background: rgba(255, 255, 255, .08); }
.vt-btn.on { background: rgba(255, 255, 255, .18); color: var(--on-dark); }

/* ── Dropdowns ────────────────────────────────────────────────────────── */
.fdd { position: relative; flex-shrink: 0; }
.fdd-btn {
  background: rgba(255, 255, 255, .09);
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: var(--radius-2);
  color: var(--on-dark-2);
  font-family: var(--sans); font-size: 10.5px; font-weight: 600;
  padding: var(--sp-1) var(--sp-2) var(--sp-1) 9px;
  cursor: pointer; white-space: nowrap; user-select: none;
  display: inline-flex; align-items: center; gap: var(--sp-1);
  transition: background .1s;
}
.fdd-btn:hover { background: rgba(255, 255, 255, .16); color: var(--on-dark); }
.fdd-btn.has-val { background: var(--accent); border-color: var(--accent); color: var(--on-dark); }
/* Exclude-only is a different state from include, and has to read as one. */
.fdd-btn.has-exc { background: var(--ink-2); border-color: var(--accent); color: var(--on-dark); }
.fdd-btn .lbl { max-width: 130px; overflow: hidden; text-overflow: ellipsis; }
.fdd-btn .arr { font-size: 7px; opacity: .55; transition: transform .15s; flex-shrink: 0; }
.fdd.open .fdd-btn .arr { transform: rotate(180deg); opacity: 1; }

.fdd-menu {
  display: none; position: absolute; top: calc(100% + 5px); left: 0;
  background: var(--bg);
  border: 1.5px solid var(--ink);
  border-radius: 5px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, .22);
  min-width: 230px; max-height: 320px; overflow-y: auto;
  z-index: 300; padding: var(--sp-1) 0;
}
.fdd.open .fdd-menu { display: block; }
.fdd-menu-title {
  font-size: 9px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .1em; color: var(--muted-2);
  padding: 6px var(--sp-3) 3px;
  display: flex; justify-content: space-between; align-items: baseline; gap: var(--sp-2);
}
.fdd-menu-title .hint-x { font-weight: 600; letter-spacing: 0; text-transform: none; font-size: 9.5px; }
.fdd-item {
  padding: 5px var(--sp-3); cursor: pointer; color: var(--ink-2);
  display: flex; align-items: center; gap: var(--sp-2);
  transition: background .07s; font-size: 11.5px;
}
.fdd-item:hover { background: var(--surface-1); }
.fdd-item.sel { color: var(--plaque); font-weight: 600; background: var(--surface-blue); }
.fdd-item.exc { color: var(--accent-dark); background: #FBEDE9; text-decoration: line-through; }
.fdd-item .dot {
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--plaque); flex-shrink: 0; opacity: 0;
}
.fdd-item.sel .dot { opacity: 1; }
.fdd-item.exc .dot { opacity: 1; background: var(--accent); border-radius: 1px; }
.fdd-item.toate { color: var(--muted); font-style: italic; }
.fdd-item.toate.sel { color: var(--ink-2); font-style: normal; background: transparent; font-weight: 400; }
.fdd-item.toate.sel .dot { opacity: 0; }
.fdd-item .fdd-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.fdd-item .fdd-count {
  font-size: var(--fs-1); color: var(--muted-2);
  font-variant-numeric: tabular-nums; flex-shrink: 0;
}
.fdd-item.sel .fdd-count { color: var(--plaque); }
.fdd-item.empty { opacity: .4; }
/* The exclude hit-target: a second, narrower action on the same row. */
.fdd-item .fdd-exc {
  flex-shrink: 0; width: 18px; text-align: center;
  font-size: var(--fs-3); font-weight: 700; line-height: 1;
  color: var(--rule-strong); border-radius: var(--radius-1);
}
.fdd-item:hover .fdd-exc { color: var(--muted); }
.fdd-item .fdd-exc:hover { background: var(--accent); color: var(--on-dark); }
.fdd-item.exc .fdd-exc { color: var(--accent); }
.fdd-divider { height: 1px; background: var(--hairline); margin: 3px 0; }

/* ── Drawer ───────────────────────────────────────────────────────────── */
.filter-drawer {
  background: var(--surface-1);
  border-bottom: 1px solid var(--rule-strong);
  padding: var(--sp-3) 14px;
  flex-shrink: 0; max-height: 42vh; overflow-y: auto;
  display: flex; flex-direction: column; gap: var(--sp-3);
}
.drawer-groups { display: flex; flex-wrap: wrap; gap: var(--sp-4) var(--sp-5); }
.drawer-group { display: flex; flex-direction: column; gap: 6px; }
.drawer-group-label {
  font-size: 9px; font-weight: 700; letter-spacing: .14em;
  text-transform: uppercase; color: var(--muted);
}
.drawer-row { display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-4); align-items: center; }
.drawer-group .fdd-btn {
  background: var(--bg); border-color: var(--rule-strong); color: var(--ink-2);
}
.drawer-group .fdd-btn:hover { border-color: var(--ink); color: var(--ink); }
.drawer-group .fdd-btn.has-val { background: var(--accent); border-color: var(--accent); color: var(--on-dark); }
.drawer-group .fdd-btn.has-exc { background: var(--ink-2); border-color: var(--accent); color: var(--on-dark); }
.tgl, .rng {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11.5px; color: var(--ink-2); cursor: pointer;
}
.rng input[type="range"] { width: 130px; }
.rng output { font-family: var(--mono); font-weight: 700; color: var(--ink); }

/* ── Active-filter chips ──────────────────────────────────────────────── */
.chip-bar {
  background: var(--bg); border-bottom: 1px solid var(--rule);
  padding: 6px 14px; flex-shrink: 0;
  display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap;
}
.chip-bar .chips { display: flex; gap: 5px; flex-wrap: wrap; flex: 1; min-width: 0; }
.fchip {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 10.5px; font-weight: 600;
  padding: 2px 5px 2px 8px;
  border-radius: var(--radius-2);
  background: var(--surface-blue); color: var(--plaque);
  border: 1px solid transparent;
}
.fchip.exc { background: #FBEDE9; color: var(--accent-dark); border-color: #EFCFC7; }
.fchip .fchip-dim { opacity: .7; font-weight: 500; }
.fchip button {
  border: 0; background: none; cursor: pointer;
  color: inherit; font-size: var(--fs-3); line-height: 1;
  padding: 0 2px; opacity: .6;
}
.fchip button:hover { opacity: 1; }
.chip-reset {
  border: 0; background: none; cursor: pointer; flex-shrink: 0;
  font-size: 10.5px; font-weight: 600; color: var(--muted);
  text-decoration: underline; text-underline-offset: 2px;
}
.chip-reset:hover { color: var(--accent); }

/* ── Result / stats bars ──────────────────────────────────────────────── */
.result-bar {
  background: var(--surface-1); border-bottom: 1px solid var(--rule);
  padding: var(--sp-1) 14px;
  font-size: 10.5px; color: var(--muted);
  display: flex; align-items: center; gap: 10px;
  flex-shrink: 0; min-height: 26px;
}
.result-bar strong { color: var(--ink); }
.result-bar .corpus-note { margin-left: auto; color: var(--muted-2); font-style: italic; }
.result-bar .spinner {
  width: 12px; height: 12px;
  border: 1.5px solid var(--rule); border-top-color: var(--plaque);
  border-radius: 50%; animation: spin .7s linear infinite; display: none;
}
.result-bar.loading .spinner { display: inline-block; }
.result-bar.loading .count-text { opacity: .4; }
@keyframes spin { to { transform: rotate(360deg); } }

.stats-bar {
  background: var(--surface-1); border-bottom: 1px solid var(--rule);
  padding: 3px 14px; font-size: var(--fs-1); color: var(--muted);
  display: flex; align-items: center; gap: 10px;
  flex-shrink: 0; flex-wrap: wrap; min-height: 24px;
}
.stats-bar[hidden] { display: none; }
.stats-bar .sb-group { display: flex; align-items: center; gap: 5px; }
.stats-bar .sb-label {
  color: var(--muted-2); text-transform: uppercase;
  letter-spacing: .06em; font-size: 9px; font-weight: 700;
}
.stats-bar strong { color: var(--ink-2); }
.stats-bar .sb-sep { color: var(--rule-strong); margin: 0 2px; }

/* ── Panes ────────────────────────────────────────────────────────────── */
.pane { display: none; flex: 1; min-height: 0; flex-direction: column; overflow: hidden; }
.pane.active { display: flex; }

.table-scroll { flex: 1; overflow: auto; }
.dtable { width: 100%; border-collapse: collapse; }
.dtable thead th {
  position: sticky; top: 0; z-index: 2;
  background: var(--surface-1);
  color: var(--muted); font-size: 9px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .07em;
  padding: 5px var(--sp-2) var(--sp-1);
  border-bottom: 1.5px solid var(--rule-strong);
  text-align: left; white-space: nowrap; user-select: none;
}
.dtable thead th.sorted { color: var(--plaque); }
.dtable tbody tr { border-bottom: 1px solid var(--hairline); cursor: pointer; }
.dtable tbody tr:hover td { background: var(--surface-1); }
.dtable tbody tr.sel-row td { background: var(--surface-blue); }
.dtable td {
  padding: 3px var(--sp-2); font-size: var(--fs-2);
  vertical-align: middle; color: var(--ink-2); white-space: nowrap;
}
.dtable td:first-child { padding-left: 14px; }
.dtable td:last-child { padding-right: 14px; }

.tp {
  font-family: var(--street); font-weight: 700; font-size: 11.5px;
  letter-spacing: .04em; display: inline-block;
  padding: 1.5px 6px; background: var(--plaque); color: var(--on-dark);
  border-radius: var(--radius-1);
  text-shadow: var(--plaque-text-shadow);
  box-shadow: var(--plaque-box-shadow);
}
.tp a { color: inherit; text-decoration: none; }
.tp a:hover { text-decoration: none; }

.badge {
  display: inline-block; font-size: 8.5px; font-weight: 700;
  padding: 1.5px var(--sp-1); border-radius: var(--radius-1);
  text-transform: uppercase; letter-spacing: .04em; white-space: nowrap;
}
.bm { background: #E8EEF8; color: #1A3C7A; }
.bf { background: #FDE8E8; color: #9B2020; }
.bn { background: #E1ECDA; color: #3D5A2A; }
.bl { background: #F0E8D4; color: #7A5A1A; }
.bc { background: #EEE8F8; color: #5A2A8E; }
.bs { background: #FFF4E0; color: #8A6000; }

.td-m { color: var(--muted-2); }
.td-n { font-family: var(--mono); font-size: 10.5px; color: var(--ink); text-align: right; }
.td-link { color: var(--plaque); font-size: var(--fs-1); }
.port-xs {
  width: 18px; height: 18px; border-radius: 50%; object-fit: cover;
  vertical-align: middle; margin-right: var(--sp-1);
  border: 1px solid var(--rule); background: var(--surface-2); display: inline-block;
}

.load-more-bar, .show-more-bar {
  padding: 10px 14px; border-top: 1px solid var(--rule);
  background: var(--surface-1);
  display: flex; align-items: center; gap: 10px; flex-shrink: 0;
}
.load-more-bar[hidden], .show-more-bar[hidden] { display: none; }
.show-more-bar { border-top: 0; background: none; padding: var(--sp-4) 0 0; }
.load-more-btn {
  font-family: var(--sans); font-size: var(--fs-2); font-weight: 600;
  color: var(--plaque); border: 1px solid var(--plaque);
  background: transparent; border-radius: var(--radius-2);
  padding: var(--sp-1) var(--sp-3); cursor: pointer; transition: all .1s;
}
.load-more-btn:hover { background: var(--plaque); color: var(--on-dark); }
.load-more-btn:disabled { opacity: .4; cursor: default; }
.load-more-info { font-size: 10.5px; color: var(--muted); }

/* ── Compact (plăcuțe) view ───────────────────────────────────────────── */
.placute-scroll { flex: 1; overflow-y: auto; padding: var(--sp-4) 18px var(--sp-3); }
.browser-page .flat-tokens {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: 11px var(--sp-3); line-height: 1.55;
}

.info-footer {
  border-top: 2px solid var(--plaque);
  background: var(--surface-1);
  padding: 9px var(--sp-4);
  display: flex; align-items: center; gap: var(--sp-3);
  min-height: 66px; flex-shrink: 0;
}
.info-footer .hint { font-size: var(--fs-2); color: var(--muted-2); font-style: italic; margin: auto; }
.info-port {
  width: 46px; height: 46px; border-radius: var(--radius-2);
  border: 1px solid var(--rule); background: var(--surface-2);
  flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  font-size: var(--fs-3); color: var(--muted-2); overflow: hidden;
}
.info-port img { width: 100%; height: 100%; object-fit: cover; }
.info-name {
  font-family: var(--street); font-size: var(--fs-5); font-weight: 700;
  color: var(--plaque); margin-bottom: 3px; line-height: 1;
}
.info-fields { display: flex; flex-wrap: wrap; gap: 3px 14px; }
.ifield { display: flex; flex-direction: column; }
.ilabel {
  font-size: 8.5px; font-weight: 700; color: var(--muted-2);
  text-transform: uppercase; letter-spacing: .08em;
}
.ival { font-size: var(--fs-2); color: var(--ink-2); }
.info-cnt { margin-left: auto; text-align: right; flex-shrink: 0; }
.info-cnt-n { font-family: var(--mono); font-size: 20px; font-weight: 700; color: var(--ink); line-height: 1; }
.info-cnt-l {
  font-size: 9px; color: var(--muted); text-transform: uppercase;
  letter-spacing: .06em; margin-top: 1px;
}
.info-link { color: var(--plaque); font-size: 10.5px; text-decoration: none; }
.info-link:hover { text-decoration: underline; }

@media (max-width: 700px) {
  .filter-bar { gap: var(--sp-1); }
  .fsearch { width: 100%; order: -1; }
  .view-toggle { margin-left: 0; }
  .sort-wrap .sort-lbl { display: none; }
  .info-footer { flex-wrap: wrap; }
  .dtable td, .dtable thead th { font-size: 10.5px; }
}

/* ────────────────────────────────────────────────────────────────────────
   14. RESPONSIVE
   ──────────────────────────────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .statbar { grid-template-columns: 1fr 1fr; row-gap: var(--sp-5); padding: 20px 22px 22px; }
  .statbar .group:nth-child(2) { border-right: none; padding-right: 0; }
  .statbar .group:nth-child(3) { padding-left: 0; }

  .panel.s4, .panel.s6, .panel.s8 { grid-column: span 6; }
  .panel.s12 { grid-column: span 12; }
  .subgrid-3 { grid-template-columns: 1fr 1fr; }
  .act-header .act-sub { margin-left: 0; text-align: left; }
}

@media (max-width: 700px) {
  .grid-2 { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .site-nav nav { gap: var(--sp-3); }
}

@media (max-width: 640px) {
  .statbar { grid-template-columns: 1fr; row-gap: 22px; padding: 18px 18px 20px; }
  .statbar .group {
    border-right: none !important;
    padding: 0 0 18px 0 !important;
    border-bottom: 1px solid var(--rule);
  }
  .statbar .group:last-child { border-bottom: none; padding-bottom: 0 !important; }

  .site-nav { padding: var(--sp-2) var(--sp-3); gap: var(--sp-2); }
  .scope-bar { padding: var(--sp-2) var(--sp-3); }
  .act-header { padding: var(--sp-4) var(--sp-3) var(--sp-2); }
  .detail-page { padding: 0 var(--sp-3) 40px; }

  /* Panels go single-column but KEEP the hairline grid — dropping to gap:0
     erased the rules that separate them. */
  .panel { grid-column: span 12 !important; padding: var(--sp-3) 14px var(--sp-3); }
  .dash-grid { max-width: 100%; }
  .subgrid-3 { grid-template-columns: 1fr; }

  .site-footer { padding: var(--sp-4) var(--sp-3); }
  .site-footer .footer-grid { grid-template-columns: 1fr; gap: var(--sp-4); }
}

@media (max-width: 480px) {
  .gso-backdrop { padding: 4vh var(--sp-2) var(--sp-2); }
  .grid-3 { grid-template-columns: 1fr; }
}
