/* ============================================================
   Saeimas balsojumu statistika — redesign prototype
   Direction: shadcn/ui (Vercel/Tailwind modern, neutral zinc)
   Single shared stylesheet — ports to portal/static/style.css.
   Token NAMES kept stable so existing markup keeps working;
   only values + component styling changed to the shadcn system.
   ============================================================ */

/* Self-hosted Geist (variable) — replaces the render-blocking Google Fonts <link>; the latin-ext
   subset carries the Latvian glyphs. WhiteNoise hashes these url()s; the latin/latin-ext primaries
   are <link rel=preload>ed in <head> so they're ready before first paint (avoids the font-swap CLS). */
@font-face { font-family: "Geist"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("fonts/geist-latin-ext.4841e590e2a9.woff2") format("woff2");
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: "Geist"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("fonts/geist-latin.a147f99cd533.woff2") format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "Geist Mono"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("fonts/geist-mono-latin-ext.3b2fb755bc03.woff2") format("woff2");
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: "Geist Mono"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("fonts/geist-mono-latin.86c701a325b5.woff2") format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }

:root {
  /* surfaces (zinc) */
  --paper:        #fafafa;   /* page bg  (zinc-50) */
  --surface:      #ffffff;   /* card bg */
  --surface-2:    #f4f4f5;   /* muted    (zinc-100) */
  --ink:          #09090b;   /* foreground (zinc-950) */
  --ink-2:        #3f3f46;   /* zinc-700 */
  --ink-3:        #5e5e66;   /* muted-foreground — darkened to clear WCAG AA (4.5:1) */
  --border:       #e4e4e7;   /* zinc-200 */
  --border-2:     #d4d4d8;   /* zinc-300 */

  /* near-black primary (shadcn buttons) */
  --primary:      #18181b;   /* zinc-900 */
  --primary-fg:   #fafafa;

  /* interactive accent (links / active / focus) */
  --accent:       #2563eb;   /* blue-600 */
  --accent-ink:   #1d4ed8;   /* blue-700 */
  --accent-wash:  #eff6ff;   /* blue-50 */
  --ring:         color-mix(in srgb, var(--accent) 35%, transparent);

  /* signature signal (inactivity) */
  --claret:       #e11d48;   /* rose-600 */
  --claret-wash:  #fff1f2;   /* rose-50 */

  /* semantic vote outcomes (Tailwind) */
  --for:          #059669; --for-wash:     #ecfdf5;
  --against:      #dc2626; --against-wash: #fef2f2;
  --abstain:      #d97706; --abstain-wash: #fffbeb;
  --absent:       #a1a1aa; --absent-wash:  #f4f4f5;

  /* type — sans everywhere (shadcn). --serif aliases sans so old markup is sans now. */
  --sans:  "Geist", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, system-ui, sans-serif;
  --mono:  "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --serif: var(--sans);

  /* radius + shadow (shadcn) */
  --r-lg: 12px;   /* cards */
  --r:    8px;    /* buttons, inputs */
  --r-sm: 6px;    /* badges */
  --shadow:     0 1px 2px 0 rgb(9 9 11 / .05);
  --shadow-pop: 0 4px 12px rgb(9 9 11 / .10), 0 2px 4px rgb(9 9 11 / .06);

  --wrap: 1220px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  background: var(--paper);
  color: var(--ink);
  font: 15px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: "cv11", "ss01";
}
img, svg { display: block; max-width: 100%; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-ink); }
/* WCAG: links inside prose / captions need a non-colour cue, so underline them */
figcaption a, .fine a, .legal a, .legal-table a { text-decoration: underline; }
::selection { background: #2563eb22; }

/* ---------- typography ---------- */
.serif { font-family: var(--sans); }
.mono  { font-family: var(--mono); }
h1,h2,h3,h4 { font-family: var(--sans); font-weight: 600; line-height: 1.15; letter-spacing: -.018em; color: var(--ink); }
h1 { font-size: clamp(28px, 3.2vw, 38px); letter-spacing: -.025em; line-height: 1.1; }
h2 { font-size: clamp(22px, 2.4vw, 28px); letter-spacing: -.02em; }
h3 { font-size: 18px; }
p  { text-wrap: pretty; }

.kicker {
  font: 600 12px/1 var(--mono);
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.kicker.claret { color: var(--claret); }
.lead { font-size: clamp(15px, 1.4vw, 18px); color: var(--ink-3); max-width: 62ch; line-height: 1.6; }
.muted { color: var(--ink-3); }
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* ---------- layout ---------- */
.wrap { width: 100%; max-width: var(--wrap); margin-inline: auto; padding-inline: 24px; }
.section { padding-block: clamp(20px, 3vw, 36px); }
.section-tight { padding-block: clamp(12px, 1.6vw, 20px); }
.rule { height: 1px; background: var(--border); border: 0; }
.rule-ink { height: 1px; background: var(--border-2); border: 0; }
.stack > * + * { margin-top: 16px; }
.grid { display: grid; gap: 16px; }
.sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 20px; }
.sec-head .kicker { margin-bottom: 8px; }

/* ---------- masthead ---------- */
.masthead { background: color-mix(in srgb, var(--surface) 80%, transparent); backdrop-filter: saturate(180%) blur(8px); -webkit-backdrop-filter: saturate(180%) blur(8px); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 60; }
.masthead-top { display: flex; align-items: center; gap: 16px; padding-block: 12px; }
.brand { display: flex; align-items: center; gap: 9px; flex: 1; min-width: 0; }
.brand .logo { width: 24px; height: 24px; stroke: var(--accent); fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.brand .mark { font: 600 16px/1 var(--sans); letter-spacing: -.02em; color: var(--ink); white-space: nowrap; }
/* full country logo (inline SVG partial from templates/logos/) */
svg.logo-full { height: 34px; width: auto; display: block; flex: none; }
.brand-lg svg.logo-full { height: 56px; margin-inline: auto; }
.brand-md { display: inline-block; }
.brand-md svg.logo-full { height: 40px; margin-inline: auto; }
.brand:hover { text-decoration: none; }
.brand .region { font: 500 11.5px/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); border: 1px solid var(--border); padding: 4px 7px; border-radius: var(--r-sm); }
.lang { display: inline-flex; border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; font: 600 13px/1 var(--sans); background: var(--surface); }
.lang a { padding: 6px 11px; color: var(--ink-3); }
.lang a.on { background: var(--primary); color: var(--primary-fg); }
.lang a:hover { text-decoration: none; color: var(--ink); }
.lang a.on:hover { color: var(--primary-fg); }

/* -12px cancels the first/last link's own padding so nav text aligns with page content */
.mainnav { display: flex; align-items: center; gap: 2px; border-top: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; margin-inline: -12px; }
.mainnav::-webkit-scrollbar { display: none; }
.mainnav a {
  white-space: nowrap; padding: 11px 12px; color: var(--ink-3);
  font: 500 13.5px/1 var(--sans); letter-spacing: -.005em; position: relative; border-radius: 0;
}
.mainnav a:hover { color: var(--ink); text-decoration: none; }
.mainnav a.active { color: var(--ink); font-weight: 600; }
.mainnav a.active::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: -1px; height: 2px; background: var(--ink); border-radius: 2px; }
.mainnav a.flag { color: var(--claret); font-weight: 500; }
.mainnav a.flag.active::after { background: var(--claret); }
/* work-in-progress nav item (dev only — hidden in prod): bold red flag to finish it */
.wip { color: var(--claret) !important; font-weight: 700 !important; }
.mainnav a.wip::before { content: "⚠ "; }
.nav-toggle { display: none; }

/* ---------- breadcrumb ---------- */
.crumbs { font: 500 13.5px/1 var(--sans); color: var(--ink-3); padding-block: 16px 4px; display: flex; gap: 8px; flex-wrap: wrap; }
.crumbs a { color: var(--ink-3); }
.crumbs a:hover { color: var(--ink); }
.crumbs .sep { color: var(--border-2); }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; gap: 7px; font: 500 14px/1 var(--sans); height: 38px; padding: 0 16px; border-radius: var(--r); border: 1px solid transparent; cursor: pointer; transition: .14s; white-space: nowrap; }
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--primary); color: var(--primary-fg); }
.btn-primary:hover { background: #27272a; color: var(--primary-fg); }
.btn-ghost { background: var(--surface); color: var(--ink); border-color: var(--border); box-shadow: var(--shadow); }
.btn-ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn .ic { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.8; }

/* ---------- hero ---------- */
.hero { padding-top: clamp(32px, 4vw, 52px); }
/* the claim runs the full content width — a bigger, tighter headline that fills the space */
.hero h1 { font-size: clamp(34px, 4.8vw, 60px); line-height: 1.02; letter-spacing: -.035em; }
.hero .lead { max-width: 60ch; }
.searchbar { display: flex; gap: 8px; max-width: 620px; margin-top: 22px; }
.searchbar .field { flex: 1; position: relative; }
.searchbar input {
  width: 100%; font: 15px/1 var(--sans); height: 44px; padding: 0 16px 0 42px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r);
  color: var(--ink); box-shadow: var(--shadow);
}
.searchbar input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring); }
.searchbar .btn { height: 44px; }  /* match the 44px search input */
.searchbar .field svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; stroke: var(--ink-3); fill: none; stroke-width: 1.8; }

/* ---------- party logo box: one consistent frame for the mixed svg/png logo set ---------- */
/* flexbox centering (not grid, which collapses a contained <img> to 0); padding is set
   inline in px by the macro — percentage padding resolves against the containing block. */
.logo-box { margin: 0; flex: none; background: #fff; border: 1px solid var(--border); border-radius: var(--r); display: flex; align-items: center; justify-content: center; box-sizing: border-box; overflow: hidden; }
.logo-box img { max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; }
.logo-box--fallback { font: 600 12px/1 var(--sans); color: var(--ink-3); }

/* ---------- KPI cards (separate shadcn cards) ---------- */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.kpi { padding: 18px 18px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow); }
.kpi .v { font: 600 clamp(26px, 2.6vw, 32px)/1 var(--mono); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kpi .l { font: 400 14px/1.4 var(--sans); color: var(--ink-3); margin-top: 7px; }
.kpi .t { font: 600 12px/1 var(--mono); letter-spacing: .07em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 12px; display: block; }

/* ---------- cards ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 20px; box-shadow: var(--shadow); }
.card.pad-lg { padding: 26px; }
.cards-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.cards-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.term-card { display: block; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 16px; transition: .14s; box-shadow: var(--shadow); }
.term-card:hover { border-color: var(--border-2); text-decoration: none; transform: translateY(-2px); box-shadow: var(--shadow-pop); }
.term-card .n { font: 600 16px/1 var(--sans); letter-spacing: -.01em; color: var(--ink); }
.term-card .d { font: 13px/1.4 var(--sans); color: var(--ink-3); margin-top: 7px; }
.term-card .c { font: 600 13px/1 var(--mono); color: var(--accent); margin-top: 10px; }

/* ---------- data table ---------- */
.table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow); }
/* horizontal-scroll affordance (Lea Verou scrolling-shadows): edge shadow
   shows only when the table overflows, fades out at the ends. Pure CSS, no JS. */
.table-scroll {
  overflow-x: auto;
  background-color: var(--surface);
  background-image:
    linear-gradient(to right, var(--surface), rgba(255,255,255,0)),
    linear-gradient(to left, var(--surface), rgba(255,255,255,0)),
    radial-gradient(farthest-side at 0 50%, rgba(9,9,11,.10), transparent),
    radial-gradient(farthest-side at 100% 50%, rgba(9,9,11,.10), transparent);
  background-position: 0 0, 100% 0, 0 0, 100% 0;
  background-size: 32px 100%, 32px 100%, 13px 100%, 13px 100%;
  background-repeat: no-repeat;
  background-attachment: local, local, scroll, scroll;
}
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data thead th {
  text-align: left; font: 500 13.5px/1.2 var(--sans); letter-spacing: -.005em;
  color: var(--ink-3); padding: 12px 16px; border-bottom: 1px solid var(--border); white-space: nowrap;
  background: var(--surface); position: sticky; top: 0;
}
table.data thead th.sortable { cursor: pointer; user-select: none; }
table.data thead th.sortable:hover { color: var(--ink); }
table.data thead th .sort-ind { display: inline-block; width: 12px; margin-left: 4px; color: var(--border-2); }
table.data thead th[data-dir="asc"] .sort-ind,
table.data thead th[data-dir="desc"] .sort-ind { color: var(--accent); }
/* body cells: td + th (name cells are th scope="row" for a11y — reset th's bold/center) */
table.data tbody td, table.data tbody th { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.data tbody th { text-align: left; font-weight: inherit; }
table.data tbody tr:last-child td, table.data tbody tr:last-child th { border-bottom: 0; }
table.data tbody tr:hover { background: var(--surface-2); }
table.data .rank { font: 500 13px/1 var(--mono); color: var(--ink-3); width: 38px; }
table.data .name { font-weight: 500; }
/* stacked seat-share bar (terms page) */
.seatbar { display: flex; width: 100%; max-width: 260px; height: 12px; border-radius: 6px; overflow: hidden; background: var(--surface-2); }
.seatbar span { display: block; height: 100%; min-width: 2px; }
table.data .name a { color: var(--ink); }
table.data .name a:hover { color: var(--accent); }
table.data .num { text-align: right; }
.col-num { text-align: right; }
table.data tr.is-hidden { display: none; }

/* meter inside table */
.meter { display: flex; align-items: center; gap: 10px; justify-content: flex-end; }
.meter .track { width: 104px; height: 6px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.meter .fill { display: block; height: 100%; border-radius: 999px; background: var(--claret); }
.meter.good .fill { background: var(--for); }
.meter.warn .fill { background: var(--abstain); }
.meter .pct { font: 600 13px/1 var(--mono); font-variant-numeric: tabular-nums; min-width: 52px; text-align: right; color: var(--ink); }

/* ---------- badges / tags (shadcn) ---------- */
.pill { display: inline-flex; align-items: center; gap: 6px; font: 500 13px/1 var(--sans); letter-spacing: -.005em; padding: 4px 10px; border-radius: var(--r-sm); border: 1px solid var(--border); color: var(--ink-2); background: var(--surface); white-space: nowrap; }
/* semantic pill TEXT uses 700-level shades for AA contrast on tinted washes;
   the brighter --for/--against/--abstain/--claret tokens stay for chart fills */
.pill.for { color: #047857; background: var(--for-wash); border-color: transparent; }
.pill.against { color: #b91c1c; background: var(--against-wash); border-color: transparent; }
.pill.abstain { color: #b45309; background: var(--abstain-wash); border-color: transparent; }
.pill.absent { color: var(--ink-2); background: var(--absent-wash); border-color: transparent; }
.pill.claret { color: #be123c; background: var(--claret-wash); border-color: transparent; }
.pill.accent { color: var(--accent-ink); background: var(--accent-wash); border-color: transparent; }
.party-dot { width: 9px; height: 9px; border-radius: 3px; display: inline-block; flex: none; }
.term-chip { font: 500 13px/1 var(--mono); color: var(--ink-2); background: var(--surface-2); border: 1px solid var(--border); padding: 4px 7px; border-radius: var(--r-sm); }

/* ============================================================
   FILTER BAR — shadcn inputs, select trigger, popover, chips
   ============================================================ */
.filterbar { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 14px; margin-bottom: 16px; box-shadow: var(--shadow); }
.filter-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.filter-field { display: flex; flex-direction: column; gap: 6px; }
.filter-field > label { font: 500 13px/1 var(--sans); color: var(--ink-3); padding-left: 2px; }
.filter-field.grow { flex: 1; min-width: 200px; }

.input, .select-btn {
  font: 14px/1 var(--sans); height: 38px; padding: 0 12px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--r); color: var(--ink);
  display: inline-flex; align-items: center; gap: 8px;
}
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring); }
.input-search { position: relative; }
.input-search input { width: 100%; padding-left: 30px; }
.input-search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; stroke: var(--ink-3); fill: none; stroke-width: 1.8; }
.input-num { width: 92px; }

/* custom multi-select (shadcn select trigger + popover) */
.ms { position: relative; }
.select-btn { cursor: pointer; min-width: 160px; justify-content: space-between; user-select: none; box-shadow: var(--shadow); }
.select-btn:hover { background: var(--surface-2); }
.select-btn[aria-expanded="true"] { border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring); }
.select-btn .cnt { font: 600 11px/1 var(--mono); background: var(--primary); color: var(--primary-fg); border-radius: 999px; padding: 3px 7px; }
.select-btn .chev { width: 15px; height: 15px; stroke: var(--ink-3); fill: none; stroke-width: 2; transition: transform .15s; }
.select-btn[aria-expanded="true"] .chev { transform: rotate(180deg); }
.ms-pop {
  position: absolute; z-index: 40; top: calc(100% + 6px); left: 0; min-width: 250px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); box-shadow: var(--shadow-pop);
  padding: 6px; display: none; max-height: 320px; overflow: auto;
}
.ms.open .ms-pop { display: block; }
.ms-search { width: 100%; height: 34px; padding: 0 10px; margin-bottom: 6px; border: 1px solid var(--border); border-radius: var(--r-sm); font: 13px/1 var(--sans); }
.ms-search:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring); }
.ms-opt { display: flex; align-items: center; gap: 10px; padding: 8px 9px; border-radius: var(--r-sm); cursor: pointer; font-size: 14px; }
.ms-opt:hover { background: var(--surface-2); }
.ms-opt input { accent-color: var(--accent); width: 15px; height: 15px; }
.ms-opt .tag { margin-left: auto; font: 500 12px/1 var(--mono); color: var(--ink-3); }
.sel-pop .ms-opt.sel { color: var(--accent); font-weight: 600; }

.filter-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.result-count { font: 13px/1 var(--sans); color: var(--ink-3); }
.result-count b { color: var(--ink); font-family: var(--mono); }

/* active filter chips (shadcn secondary badge) */
.active-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.active-chips:empty { display: none; }
.chip { display: inline-flex; align-items: center; gap: 6px; font: 500 13px/1 var(--sans); background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 5px 5px 5px 10px; }
.chip button { border: 0; background: transparent; color: var(--ink-3); width: 18px; height: 18px; border-radius: var(--r-sm); cursor: pointer; font-size: 14px; line-height: 1; display: grid; place-items: center; }
.chip button:hover { background: var(--border); color: var(--ink); }
.chip.clear-all { background: transparent; color: var(--ink-3); padding: 5px 6px; cursor: pointer; border: 0; font-family: var(--sans); }
.chip.clear-all:hover { color: var(--claret); }

/* share row */
.share-row { display: flex; align-items: center; gap: 10px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); font-size: 13px; color: var(--ink-3); }
.copied { color: var(--for); font-weight: 600; opacity: 0; transition: .2s; }
.copied.show { opacity: 1; }

/* ---------- profile header ---------- */
.profile { display: grid; grid-template-columns: 1fr; gap: 24px; }
.phead { display: flex; gap: 20px; align-items: flex-start; flex-wrap: wrap; }
.avatar { width: 84px; height: 84px; border-radius: var(--r-lg); background: var(--surface-2); border: 1px solid var(--border); display: grid; place-items: center; font: 600 30px/1 var(--sans); letter-spacing: -.02em; color: var(--ink-3); flex: none; }
.phead .meta { flex: 1; min-width: 240px; }
.phead h1 { font-size: clamp(26px, 3vw, 36px); }
.phead .sub { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 12px; }

/* stat strip (single card, dividers) */
.statstrip { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0; border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; background: var(--surface); box-shadow: var(--shadow); }
.statstrip .s { padding: 16px 18px; border-right: 1px solid var(--border); }
.statstrip .s:last-child { border-right: 0; }
.statstrip .s .v { font: 600 24px/1 var(--mono); font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.statstrip .s .v.claret { color: var(--claret); }
.statstrip .s .l { font: 13px/1.3 var(--sans); color: var(--ink-3); margin-top: 6px; }

/* ---------- charts ---------- */
.chart-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 20px; box-shadow: var(--shadow); }
.chart-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 16px; }
.chart-head h2 { font-size: 16px; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font: 500 13px/1 var(--sans); color: var(--ink-2); margin-top: 14px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.bars { display: flex; flex-direction: column; gap: 12px; }
.barrow { display: grid; grid-template-columns: 130px 1fr 56px; gap: 12px; align-items: center; }
.barrow .lab { font: 13px/1.2 var(--sans); color: var(--ink-2); }
.barrow .bt { height: 8px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.barrow .bf { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.barrow .val { font: 600 13px/1 var(--mono); text-align: right; }

/* home "Top 5 · inactivity" — bigger, clickable leaderboard rows */
.rankbars { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.rankbars > li + li { border-top: 1px solid var(--border); }
.rankrow {
  display: grid; grid-template-columns: 22px 1fr auto; gap: 16px; align-items: center;
  padding: 14px 12px; margin: 0 -12px; border-radius: var(--r-sm);
  color: inherit; transition: background .12s ease;
}
.rankrow:hover { background: var(--surface); box-shadow: var(--shadow); }
.rankrow .rk { font: 500 14px/1 var(--mono); color: var(--ink-3); text-align: center; font-variant-numeric: tabular-nums; }
.rankrow .who { min-width: 0; }
.rankrow .nm { display: block; font: 500 15.5px/1.25 var(--sans); color: var(--ink); margin-bottom: 9px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rankrow:hover .nm { color: var(--claret); }
.rankrow .bt { display: block; height: 9px; background: var(--border); border-radius: 999px; overflow: hidden; }
.rankrow .bf { display: block; height: 100%; background: var(--claret); border-radius: 999px; }
.rankrow .pc { font: 600 26px/1 var(--mono); color: var(--claret); letter-spacing: -.02em; font-variant-numeric: tabular-nums; text-align: right; }
.rankrow .pc .u { font-size: 15px; margin-left: 1px; opacity: .65; }

/* stacked party-line bar */
.stack-bar { display: flex; height: 28px; border-radius: var(--r); overflow: hidden; }
.stack-bar > span { display: block; }
.seg-for { background: var(--for); }
.seg-against { background: var(--against); }
.seg-abstain { background: var(--abstain); }
.seg-absent { background: var(--absent); }

/* ---------- editorial/feature block ---------- */
.feature { display: grid; grid-template-columns: 1.1fr .9fr; gap: 0; border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; background: var(--surface); box-shadow: var(--shadow); }
.feature .txt { padding: clamp(22px, 2.6vw, 32px); border-right: 1px solid var(--border); }
.feature .viz { padding: clamp(22px, 2.6vw, 32px); background: var(--surface-2); }
.feature h2 { margin: 10px 0 12px; max-width: 18ch; }

/* ---------- footer ---------- */
.foot { border-top: 1px solid var(--border); background: var(--surface); margin-top: 32px; }
.foot .wrap { padding-block: 22px; }
.foot .cols { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 30px; }
.foot .foot-country { display: block; color: var(--ink-2); font-size: 14px; padding: 4px 0; }
.foot .foot-country--current { color: var(--ink-3); font-weight: 600; cursor: default; }
.foot h2 { font: 600 12px/1 var(--mono); letter-spacing: .07em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 14px; }
.foot a { display: block; color: var(--ink-2); font-size: 14px; padding: 4px 0; }
.foot a:hover { color: var(--accent); }
.foot .fine { color: var(--ink-3); font-size: 13px; line-height: 1.6; }
.foot .botline { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--ink-3); }
.foot .botline a { display: inline; font-size: inherit; padding: 0; }

/* prototype ribbon (subtle) */
.proto { background: var(--surface-2); color: var(--ink-3); border-bottom: 1px solid var(--border); font: 500 13px/1 var(--sans); text-align: center; padding: 9px; }
.proto a { color: var(--accent); }

/* ---------- utilities ---------- */
.flex { display: flex; }
.between { justify-content: space-between; }
.items-center { align-items: center; }
.gap-8 { gap: 8px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; }
.wrap-w { flex-wrap: wrap; }
.mt-8{margin-top:8px}.mt-16{margin-top:16px}.mt-24{margin-top:24px}.mt-32{margin-top:32px}
.center { text-align: center; }
.hide { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---------- a11y + interaction states (polish) ---------- */
.skip-link { position: fixed; left: 12px; top: -56px; z-index: 200; background: var(--primary); color: var(--primary-fg); padding: 10px 14px; border-radius: var(--r); font: 500 14px/1 var(--sans); box-shadow: var(--shadow-pop); transition: top .15s ease; }
.skip-link:focus { top: 12px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn:active { transform: translateY(1px); }
table.data tbody tr[role="link"]:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

/* empty state for filtered tables */
.empty-row td { padding: 46px 16px !important; text-align: center; }
.empty-row .es-title { font: 600 15px/1.4 var(--sans); color: var(--ink); margin-bottom: 6px; }
.empty-row .es-sub { font-size: 13.5px; color: var(--ink-3); margin-bottom: 16px; }

/* ---------- motion (restrained; killed by the reduced-motion block below) ---------- */
@keyframes msPop { from { opacity: 0; transform: translateY(-4px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.ms-pop { transform-origin: top left; }
.ms.open .ms-pop { animation: msPop .15s cubic-bezier(.2,0,0,1); }
.empty-row { animation: fadeUp .22s cubic-bezier(.2,0,0,1); }
table.data tbody tr { transition: background-color .12s ease; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
  .term-card:hover { transform: none; }
}

/* ---------- responsive ---------- */
@media (max-width: 960px) {
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .cards-3, .cards-4 { grid-template-columns: repeat(2, 1fr); }
  .feature { grid-template-columns: 1fr; }
  .feature .txt { border-right: 0; border-bottom: 1px solid var(--border); }
  .foot .cols { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 720px) {
  /* backdrop-filter on the sticky .masthead creates a containing block that traps the
     position:fixed drawer inside the ~62px header box (it rendered as a clipped corner box —
     only the × and "Home" showed). Drop the filter on mobile so the drawer positions against
     the viewport and slides in full-height. */
  /* raise the header (and the drawer it contains) above the scrim, so the open drawer is a solid
     panel and only the BACKGROUND is dimmed — not the drawer itself (it lives in the masthead's
     z-index:60 stacking context, so its own z-index:70 can't beat the body-level scrim otherwise). */
  .masthead { backdrop-filter: none; -webkit-backdrop-filter: none; background: var(--surface); z-index: 71; }
  .wrap { padding-inline: 16px; }   /* tighter horizontal gutter on phones */
  .nav-toggle { display: inline-flex; }
  .mainnav { position: fixed; inset: 0 0 0 auto; width: min(82vw, 320px); flex-direction: column; align-items: stretch; background: var(--surface); border-left: 1px solid var(--border); padding: 66px 12px 20px; margin-inline: 0; transform: translateX(100%); transition: transform .22s; z-index: 70; box-shadow: var(--shadow-pop); overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
  .mainnav.open { transform: none; }
  .mainnav a { padding: 13px; border-radius: var(--r); }
  .mainnav a.active::after { display: none; }
  .mainnav a.active { background: var(--surface-2); }
  .nav-scrim { display: none; position: fixed; inset: 0; background: rgb(9 9 11 / .4); z-index: 65; }
  .nav-scrim.show { display: block; }
  .filter-actions { margin-left: 0; width: 100%; justify-content: space-between; }
  .barrow { grid-template-columns: 100px 1fr 48px; }
  .cards-3, .cards-4, .kpis { grid-template-columns: 1fr; }
  .statstrip { grid-template-columns: 1fr 1fr; }
}

/* nav toggle button */
.nav-toggle { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); width: 38px; height: 38px; cursor: pointer; align-items: center; justify-content: center; box-shadow: var(--shadow); }
.nav-toggle svg { width: 20px; height: 20px; stroke: var(--ink); fill: none; stroke-width: 1.8; }
.nav-close { display: none; }
@media (max-width: 720px) { .nav-close { display: grid; place-items: center; position: absolute; top: 14px; right: 14px; width: 36px; height: 36px; background: transparent; border: 0; cursor: pointer; font-size: 22px; color: var(--ink); } }

/* ============================================================
   Moderation / app UI (DTL pages on base_app.html)
   ============================================================ */
.messages { list-style: none; display: flex; flex-direction: column; gap: 8px; margin: 16px 0; }
.msg { padding: 10px 14px; border-radius: var(--r); border: 1px solid var(--border); background: var(--surface-2); font-size: 14px; }
.msg.success { background: var(--for-wash); color: #047857; border-color: transparent; }
.msg.error { background: var(--against-wash); color: #b91c1c; border-color: transparent; }
.msg.warning { background: var(--abstain-wash); color: #b45309; border-color: transparent; }
table.grid { width: 100%; border-collapse: collapse; font-size: 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow); }
table.grid th, table.grid td { padding: 10px 14px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
table.grid tbody tr:last-child td { border-bottom: 0; }
table.grid thead th { color: var(--ink-3); font-weight: 500; }
.badge { display: inline-flex; padding: 4px 10px; border-radius: var(--r-sm); font: 500 13px/1 var(--sans); background: var(--surface-2); color: var(--ink-2); }
.badge.v-published, .badge.v-approved { background: var(--for-wash); color: #047857; }
.badge.v-pending, .badge.v-draft { background: var(--abstain-wash); color: #b45309; }
.badge.v-rejected { background: var(--against-wash); color: #b91c1c; }
table.form th { text-align: right; padding: 10px 12px; color: var(--ink-3); font-weight: 500; vertical-align: top; white-space: nowrap; }
table.form td { padding: 8px 0; }
table.form input, table.form textarea, table.form select,
.form input, .form textarea, .form select {
  font: 14px/1.4 var(--sans); padding: 9px 12px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--r); color: var(--ink); min-width: 300px;
}
table.form textarea, .form textarea { width: 100%; max-width: 620px; }
table.form input:focus, table.form textarea:focus, .form input:focus, .form textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring);
}

/* ---------------- cookie / GDPR consent banner ---------------- */
.cookie-banner {
  position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 80;
  width: min(680px, calc(100vw - 24px)); display: flex; gap: 14px; align-items: center;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r);
  box-shadow: var(--shadow-pop); padding: 14px 16px;
}
.cookie-banner p { margin: 0; font-size: 13px; line-height: 1.45; color: var(--muted); }
.cookie-banner .btn { flex: none; white-space: nowrap; }
.cookie-banner[hidden] { display: none; }
@media (max-width: 560px) { .cookie-banner { flex-direction: column; align-items: stretch; text-align: left; } }
.cookie-banner a { color: var(--accent); white-space: nowrap; }
.cookie-banner .cookie-actions { display: flex; gap: 8px; flex: none; }
@media (max-width: 560px) { .cookie-banner .cookie-actions { justify-content: flex-end; } }

/* ---------------- legal / prose pages (privacy, cookies) ---------------- */
.legal { max-width: 760px; margin: 0 auto; padding-block: 8px 40px; }
.legal h1 { margin: 10px 0 6px; }
.legal h2 { font-size: 18px; margin: 26px 0 8px; }
.legal p { line-height: 1.6; margin: 10px 0; }
.legal .lede { font-size: 16px; }
.legal-table { width: 100%; border-collapse: collapse; margin: 16px 0; font-size: 14px; }
.legal-table th, .legal-table td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
.legal-table th { font: 600 12px/1 var(--mono); text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); }

/* ---------------- tabs (progressive: all panels in DOM; JS shows one) ---------------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin: 6px 0 22px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { flex: none; appearance: none; background: none; border: 0; border-bottom: 2px solid transparent; padding: 11px 14px; font: 500 14px/1 var(--sans); color: var(--ink-3); cursor: pointer; white-space: nowrap; margin-bottom: -1px; }
.tab:hover { color: var(--ink); }
.tab.is-active { color: var(--ink); font-weight: 600; border-bottom-color: var(--ink); }
.tab .cnt { color: var(--ink-3); font-weight: 400; margin-left: 5px; font-size: 12px; }
.tab-panel { display: none; }
.tab-panel.is-active { display: block; }

/* ---------------- deputy head: circular avatar + quick stats + vote donut ---------------- */
.dhead { display: flex; gap: 20px 32px; align-items: flex-start; flex-wrap: wrap; }
.dhead .meta { flex: 1; min-width: 240px; }
/* bio rides the header's empty right side; wraps below the meta on narrow screens */
.dhead-bio { flex: 1 1 380px; min-width: 280px; max-width: 620px; margin: 4px 0 0; font-size: 13.5px; line-height: 1.6; color: var(--ink-2); }
.avatar-round { width: 104px; height: 104px; object-fit: cover; border-radius: 50%; border: 2px solid var(--surface); box-shadow: var(--shadow); cursor: zoom-in; flex: none; background: var(--surface-2); }
.quickstats { display: flex; gap: 22px 26px; align-items: center; flex-wrap: wrap; margin-top: 16px; }
.qs { line-height: 1.05; }
.qs .v { font: 700 22px/1 var(--mono); }
.qs .v.claret { color: var(--claret); }
.qs .l { font-size: 11px; color: var(--ink-3); text-transform: uppercase; letter-spacing: .04em; margin-top: 4px; }
.votedonut { display: flex; gap: 12px; align-items: center; }
.votedonut-legend { display: grid; gap: 3px; font-size: 12px; color: var(--ink-2); }
.votedonut-legend span { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.votedonut-legend i { width: 9px; height: 9px; border-radius: 2px; flex: none; }
.lightbox { position: fixed; inset: 0; background: rgb(9 9 11 / .85); display: none; place-items: center; z-index: 95; cursor: zoom-out; padding: 20px; }
.lightbox.show { display: grid; }
.lightbox img { max-width: 92vw; max-height: 88vh; border-radius: 12px; box-shadow: var(--shadow-pop); }
