/**
 * Kairos Policy — design system.
 *
 * The Kairos system, shared with Kairos Research (the markets product): light
 * paper with blue-tinted neutrals, ONE accent, green and red only for up and
 * down, Schibsted Grotesk for everything and Literata for what reads like news.
 * Sections are separated by hairlines, not cards; a page gets one grey "band"
 * for its featured block. Tokens mirror kairos/web/src/styles.css — keep the
 * two in step. The old variable NAMES (--bg-*, --text-*, --accent-*) are kept
 * so the hundreds of call sites follow the new palette without edits.
 */

/* ========================================================================== */
/* CSS CUSTOM PROPERTIES (Design Tokens)                                      */
/* ========================================================================== */

:root {
    /* Typography. --font-primary (Schibsted Grotesk) is the whole UI: page and
       section titles, body, metadata and figures. --font-headline (Literata) is
       ONLY for what reads like news: story and dossier headlines. --font-display
       and --font-mono are kept as aliases so existing call sites stay on-brand. */
    /* "Kairos Puntuacion" (defined under RESET) supplies only the comma and the
       full stop: Schibsted's TABULAR figures widen both to a digit's width, which
       opened a gap in every "2.8 %" and "33,5" set in a figure column. */
    --font-primary: "Kairos Puntuacion", 'Schibsted Grotesk', 'Helvetica Neue', Arial, sans-serif;
    --font-headline: 'Literata', Georgia, 'Times New Roman', serif;
    --font-display: var(--font-primary);
    --font-mono: var(--font-primary);

    /* Font sizes — the Kairos scale: 12 labels/meta · 13 secondary · 15 body ·
       18 section · 22 headline · 28 page. Nothing under 12px. */
    --text-xs: 0.75rem;      /* 12px */
    --text-sm: 0.8125rem;    /* 13px */
    --text-base: 0.875rem;   /* 14px */
    --text-md: 0.9375rem;    /* 15px */
    --text-lg: 1.125rem;     /* 18px */
    --text-xl: 1.375rem;     /* 22px */
    --text-2xl: 1.75rem;     /* 28px */

    /* Spacing */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;

    /* Border radius — Kairos uses two: 4 (chips, codes) and 8 (controls, band). */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 8px;
    --radius-xl: 8px;

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 200ms ease;
    --transition-slow: 300ms ease;

    /* Page frame */
    --navbar-height: 64px;
    --page-max: 1376px;
    --page-gutter: 32px;

    /* Political families — data, never decoration. */
    --color-center-right: #2f62d6;
    --color-center-left: #b9382f;
    --color-liberal: #e3be55;
    --color-green: #3f9a4d;
    --color-far-right: #14234f;
    --color-far-left: #7a1f1f;

    /* Media line (left↔right): the political convention — left RED, right BLUE. */
    --bias-left: #c23b32;
    --bias-center: #bec5cd;
    --bias-right: #2f62d6;
    --bias-left-ink: #b0322a;     /* the same red, dark enough for text on the band */
    --bias-right-ink: #2f62d6;

    /* Stability colors */
    --color-stable: #2f8f55;
    --color-fragile: #8a5a00;
    --color-volatile: #be2323;
    --status-stable: var(--color-stable);
    --status-fragile: var(--color-fragile);
    --status-volatile: var(--color-volatile);

    /* Names older components reach for; kept as aliases of the real tokens. */
    --accent-color: var(--accent);
    --accent-primary: var(--accent);
    --border-primary: var(--border-color);
    --border-secondary: var(--border-color);
    --border-radius-lg: var(--radius-lg);
    --text-color: var(--text-primary);
}

/* Light — the Kairos palette, and the DEFAULT (an unset or unknown data-theme
   gets it too). Scoped to :root on purpose: `data-theme` is also used as a plain
   data payload (the light/dark buttons in the settings panel), and an unscoped
   selector made those buttons repaint themselves. Never unscope it. */
:root,
:root[data-theme="light"] {
    color-scheme: light;

    --skeleton-bar: #e9edf2;
    --skeleton-sheen: rgba(255, 255, 255, 0.75);
    --bg-primary: #fbfcfd;      /* papel */
    --bg-secondary: #fbfcfd;    /* surfaces sit ON the paper — no cards */
    --bg-tertiary: #f2f5f8;     /* banda */
    --bg-elevated: #ffffff;     /* menus, popovers */
    --bg-hover: #e9edf2;        /* banda 2 */

    --border-color: #dbe0e6;        /* línea */
    --border-color-light: #e9edf2;
    --control-border: #bec5cd;      /* línea 2: inputs, secondary buttons */

    --text-primary: #141c27;    /* tinta */
    --text-secondary: #3f4955;  /* tinta 2 */
    --text-tertiary: #5b6470;   /* tinta 3 */
    --text-muted: #5b6470;

    --accent: #1f57d3;
    --accent-soft: #e4efff;
    --on-accent: #ffffff;
    --accent-blue: #1f57d3;
    --accent-blue-dim: #1a49b0;
    --accent-green: #05773b;
    --accent-green-soft: #dcf7e2;
    --accent-red: #be2323;
    --accent-red-soft: #ffe7e4;
    --accent-yellow: #8a5a00;
    --accent-yellow-soft: #fbf0dc;
    --accent-purple: #4b3a8c;
    --accent-cyan: #0b6670;
    --accent-orange: #b4540a;

    --logo-ink: #14234f;
    --logo-sub: #3f4955;
    --logo-rule: #bec5cd;

    --scrim: rgba(13, 18, 24, 0.45);
    --scrollbar-track: #f2f5f8;
    --scrollbar-thumb: #bec5cd;
    --scrollbar-thumb-hover: #8a929c;

    --shadow-sm: 0 1px 2px rgba(13, 18, 24, 0.06);
    --shadow-md: 0 2px 6px rgba(13, 18, 24, 0.08);
    --shadow-lg: 0 12px 32px rgba(13, 18, 24, 0.14), 0 2px 6px rgba(13, 18, 24, 0.06);
    --shadow-xl: 0 12px 32px rgba(13, 18, 24, 0.14), 0 2px 6px rgba(13, 18, 24, 0.06);

    /* Hairline around a flag: keeps a white band (JP, FI, PL…) from dissolving. */
    --flag-hairline: rgba(20, 28, 39, 0.16);
}

/* Dark — the same system at night: blue-tinted neutrals (hue ~255) and a
   lighter accent so it keeps 4.5:1 on the band. Kairos Research ships light
   only; Policy keeps this as an opt-in from /settings. */
:root[data-theme="dark"] {
    color-scheme: dark;

    --skeleton-bar: #1e2834;
    --skeleton-sheen: rgba(255, 255, 255, 0.05);
    --bg-primary: #0d1218;
    --bg-secondary: #0d1218;
    --bg-tertiary: #151c25;
    --bg-elevated: #1a222d;
    --bg-hover: #1e2834;

    --border-color: #273241;
    --border-color-light: #1e2834;
    --control-border: #3a4657;

    --text-primary: #e7ecf2;
    --text-secondary: #b4bfcc;
    --text-tertiary: #8d99a8;
    --text-muted: #8d99a8;

    --accent: #7ea6ff;
    --accent-soft: #1b2a4a;
    --on-accent: #0d1218;
    --accent-blue: #7ea6ff;
    --accent-blue-dim: #a3c0ff;
    --accent-green: #4cc47f;
    --accent-green-soft: #12301f;
    --accent-red: #ff7a72;
    --accent-red-soft: #3a1714;
    --accent-yellow: #e0b25a;
    --accent-yellow-soft: #33270f;
    --accent-purple: #b3a4f2;
    --accent-cyan: #5cc6d0;
    --accent-orange: #f0a060;

    --bias-left-ink: #ff8a80;
    --bias-right-ink: #8fb0ff;

    --logo-ink: #ffffff;
    --logo-sub: #c3cadc;
    --logo-rule: #5d6c95;

    --scrim: rgba(0, 0, 0, 0.55);
    --scrollbar-track: #0d1218;
    --scrollbar-thumb: #3a4657;
    --scrollbar-thumb-hover: #55637a;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 2px 6px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.5);
    --shadow-xl: 0 12px 32px rgba(0, 0, 0, 0.5);

    --flag-hairline: rgba(255, 255, 255, 0.18);
}

/* ========================================================================== */
/* GLYPHS: FLAGS & ICONS                                                      */
/* ========================================================================== */

/*
 * Two systems replace what used to be emoji.
 *
 * `.flag` is an <img> of a real SVG flag, emitted only by window.flagHtml()
 * (static/js/flags.js) — never hand-written, so the alias map and the ISO-code
 * fallback apply everywhere. The 3:2 box matches the vendored assets, and the
 * intrinsic width/height on the tag reserves the space so a list does not
 * reflow as flags stream in.
 *
 * `.icon` is a stroke SVG from window.icon() (static/js/icons.js). It paints in
 * `currentColor`, so it inherits its slot's colour — including the severity
 * colours on alert cards — in both themes, which is exactly what a full-colour
 * emoji could never do.
 */

.flag {
    display: inline-block;
    flex-shrink: 0;
    border-radius: 2px;
    border: 1px solid var(--flag-hairline);
    background-color: var(--bg-tertiary);
    object-fit: cover;
    vertical-align: -0.15em;
}

/* Sizes mirror the tokens in flags.js; the tag also carries width/height, these
   keep the box right when a flag sits in a flex row that would otherwise stretch it. */
.flag--xs { width: 12px; height: 8px; }
.flag--sm { width: 18px; height: 12px; }
.flag--md { width: 21px; height: 14px; }
.flag--lg { width: 27px; height: 18px; }
.flag--xl { width: 48px; height: 32px; border-radius: 3px; }

/* No asset for this code — show the ISO code rather than an empty column. */
.flag--fallback {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 8px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: 0.03em;
    color: var(--text-tertiary);
    background-color: var(--bg-tertiary);
    font-variant-numeric: tabular-nums;
}

.flag--xl.flag--fallback { font-size: 15px; }
.flag--lg.flag--fallback { font-size: 10px; }

.icon {
    display: inline-block;
    flex-shrink: 0;
    vertical-align: -0.15em;
}

/* ========================================================================== */
/* RESET & BASE STYLES                                                        */
/* ========================================================================== */

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

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-primary);
    font-size: var(--text-md);
    line-height: 1.5;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Figures line up in columns — but NOT on the body: Schibsted Grotesk's tabular
   figures also widen the comma and the full stop to a digit's width, which put
   a visible gap before every "." and "," of running text ("Gobierno ."). Tables
   and figure slots get them, with those two signs taken from a system face that
   does not widen them (the same fix Kairos Research ships). */
@font-face {
    font-family: "Kairos Puntuacion";
    src: local("Helvetica Neue"), local("HelveticaNeue"), local("Arial"), local("ArialMT"), local("Roboto"), local("Roboto-Regular");
    font-weight: 100 500;
    unicode-range: U+002C, U+002E;
}
@font-face {
    font-family: "Kairos Puntuacion";
    src: local("Helvetica Neue Bold"), local("HelveticaNeue-Bold"), local("Arial Bold"), local("Arial-BoldMT"), local("Roboto Bold"), local("Roboto-Bold");
    font-weight: 600 900;
    unicode-range: U+002C, U+002E;
}

table, .num, .metric-num {
    font-variant-numeric: tabular-nums;
}

/* Brand defaults — page and section titles are Schibsted Grotesk at 700 (the
   Kairos rule: Literata is reserved for what reads like NEWS, via .headline). */
h1, h2 {
    font-family: var(--font-primary);
    font-weight: 700;
    letter-spacing: -0.01em;
}

/* A news-like headline: a story, a dossier, an article title. */
.headline {
    font-family: var(--font-headline);
    font-weight: 600;
    letter-spacing: -0.005em;
    text-wrap: pretty;
}

/* Metadata line above a title ("España · Encuesta · hace 1 h"). Kairos sets it
   in sentence case at 12/600 — never an uppercase, letter-spaced eyebrow. */
.kicker {
    font-family: var(--font-primary);
    font-weight: 600;
    font-size: var(--text-xs);
    color: var(--text-tertiary);
}

/* Metric / big number — Schibsted bold, tabular, the Kairos figure. */
.metric-num {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.01em;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--scrollbar-track);
}

::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--scrollbar-thumb-hover);
}

/* ========================================================================== */
/* ACCESSIBILITY — visible keyboard focus                                     */
/* ========================================================================== */

/* Global keyboard focus ring. :focus-visible keeps it OFF for plain mouse
   clicks (no change to the existing look) but guarantees every interactive
   control shows a clear indicator when reached with the keyboard. Uses the
   theme accent (--accent-blue) so it reads in both light and dark. */
a:focus-visible,
button:focus-visible,
[role="button"]:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
    outline: 2px solid var(--accent-blue);
    outline-offset: 2px;
}

/* ========================================================================== */
/* NAVBAR — the Kairos top bar                                                */
/* ========================================================================== */
/* 64px on the paper, one hairline under it. Lockup · sections (the active one
   carries a 2px accent rule that sits ON the hairline) · search · language ·
   account. Below 1200px the sections fold into the drawer (_sidebar.html) and
   the menu button appears; below 768px the search goes behind a button too. */

.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--navbar-height);
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 0 var(--page-gutter);
    z-index: 1000;
}

.brand {
    display: inline-flex;
    align-items: center;
    flex: none;
    text-decoration: none;
}

/* The lockup is outlined paths (templates/_brand_logo.html); its height is the
   one knob. The viewBox is 32 units for "Kairos" set at 36, so 20px here is
   Kairos at ~22px — the mockup's header size. */
.brand-logo {
    display: block;
    height: 20px;
    width: auto;
}

.topnav {
    display: flex;
    align-self: stretch;
    min-width: 0;
}

.topnav-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0 10px;
    margin-bottom: -1px;
    border-bottom: 2px solid transparent;
    font-size: var(--text-md);
    font-weight: 600;
    color: var(--text-secondary);
    text-decoration: none;
    white-space: nowrap;
    transition: color var(--transition-fast);
}

.topnav-link:hover { color: var(--text-primary); }

.topnav-link.active {
    color: var(--text-primary);
    border-bottom-color: var(--accent);
}

.topnav-badge {
    display: inline-grid;
    place-items: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: var(--accent);
    color: var(--on-accent);
    font-size: var(--text-xs);
    font-weight: 700;
    line-height: 1;
}

.topnav-badge[hidden] { display: none; }

.navbar-center {
    flex: 0 1 300px;
    min-width: 0;
    margin-left: auto;
}

.search-container {
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 12px;
    width: 16px;
    height: 16px;
    color: var(--text-tertiary);
    pointer-events: none;
}

.search-input {
    width: 100%;
    height: 40px;
    padding: 0 36px 0 38px;
    background: var(--bg-primary);
    border: 1px solid var(--control-border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: var(--text-base);
    font-family: inherit;
    transition: border-color var(--transition-fast);
    -webkit-appearance: none;
    appearance: none;
}

.search-input::-webkit-search-cancel-button { display: none; }

.search-input::placeholder {
    color: var(--text-tertiary);
}

.search-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.search-shortcut {
    position: absolute;
    right: 10px;
    padding: 0 6px;
    border: 1px solid var(--control-border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: var(--text-xs);
    font-weight: 600;
    line-height: 18px;
    color: var(--text-tertiary);
    pointer-events: none;
}

.search-input:focus ~ .search-shortcut { display: none; }

.navbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: none;
}

/* Square icon buttons the bar shows only when it is narrow: the drawer's menu
   button, the search opener and its closer. 44px is a finger target. */
.nav-icon-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    padding: 0;
    background: transparent;
    border: 0;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    cursor: pointer;
}

.nav-icon-btn:hover { background: var(--bg-tertiary); color: var(--text-primary); }
.nav-icon-btn svg { width: 22px; height: 22px; }

/* Results under the global search (navbar.js toggles `display`). */
.search-results-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    min-width: 320px;
    margin-top: 6px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    max-height: 360px;
    overflow-y: auto;
    overscroll-behavior: contain;
    z-index: 1000;
}

/* Language + account: a button that opens a small menu (navbar.js). */
.nav-menu-wrap { position: relative; }

.nav-lang-btn {
    display: inline-grid;
    place-items: center;
    min-width: 36px;
    height: 36px;
    padding: 0 6px;
    background: none;
    border: 0;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: var(--text-sm);
    font-weight: 700;
    letter-spacing: 0.04em;
    color: var(--text-secondary);
    cursor: pointer;
}

.nav-lang-btn:hover,
.nav-lang-btn[aria-expanded="true"] { background: var(--bg-tertiary); color: var(--text-primary); }

.nav-account-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 40px;
    padding: 0 10px 0 4px;
    background: var(--bg-primary);
    border: 1px solid var(--control-border);
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: var(--text-base);
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
}

.nav-account-btn:hover,
.nav-account-btn[aria-expanded="true"] { border-color: var(--text-tertiary); }

.nav-avatar {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: 6px;
    background: var(--bg-hover);
    font-size: var(--text-sm);
    font-weight: 700;
}

.nav-account-name {
    max-width: 12ch;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nav-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    min-width: 200px;
    padding: 6px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 1001;
}

.nav-menu[hidden] { display: none; }
.nav-menu-right { left: auto; right: 0; min-width: 240px; }

.nav-menu-head {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 8px 10px 10px;
    margin-bottom: 4px;
    border-bottom: 1px solid var(--border-color);
    font-size: var(--text-sm);
    color: var(--text-tertiary);
    overflow-wrap: anywhere;
}

.nav-menu-head b { font-size: var(--text-md); color: var(--text-primary); }

.nav-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 40px;
    padding: 0 10px;
    background: none;
    border: 0;
    border-radius: 6px;
    font-family: inherit;
    font-size: var(--text-base);
    font-weight: 600;
    color: var(--text-secondary);
    text-align: left;
    text-decoration: none;
    cursor: pointer;
}

.nav-menu-item:hover { background: var(--bg-tertiary); color: var(--text-primary); }
.nav-menu-item[aria-current="true"] { color: var(--text-primary); }
.nav-menu-item[aria-current="true"]::after {
    content: '';
    margin-left: auto;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
}

.nav-menu-code {
    display: inline-flex;
    align-items: center;
    height: 20px;
    padding: 0 6px;
    border-radius: var(--radius-sm);
    background: var(--bg-hover);
    font-size: var(--text-xs);
    font-weight: 700;
    color: var(--text-primary);
}

.nav-menu-form { margin: 0; border-top: 1px solid var(--border-color); margin-top: 4px; padding-top: 4px; }

.nav-signin {
    display: inline-flex;
    align-items: center;
    height: 40px;
    padding: 0 16px;
    border-radius: var(--radius-md);
    background: var(--accent);
    color: var(--on-accent);
    font-size: var(--text-base);
    font-weight: 600;
    text-decoration: none;
}

/* The sections stop fitting: they move into the drawer. */
@media (max-width: 1199px) {
    .topnav { display: none; }
    .nav-menu-btn { display: inline-flex; margin-left: -10px; }
    .navbar { gap: 12px; }
}

/* Keeps a name that is long from pushing the search off the bar. */
@media (max-width: 1360px) {
    .nav-account-name { display: none; }
    .nav-account-btn { padding-right: 4px; }
}

/* ========================================================================== */
/* DASHBOARD LAYOUT                                                           */
/* ========================================================================== */

.dashboard {
    padding-top: var(--navbar-height);
    min-height: 100vh;
}

/* A standalone module page (/overview, /calendar, /alerts, /settings, /profile,
   /admin/accounts): the frame under the fixed navbar. These pages are also
   `.dashboard`, and each used to restate the frame as a bare `padding: 28px …`
   in its own <style> — which, coming later, overrode the navbar offset above and
   left every page's breadcrumb hidden UNDER the bar. The offset now lives in
   the frame itself; pages keep only their own max-width. */
.module-page {
    max-width: var(--page-max);
    margin: 0 auto;
    padding: calc(var(--navbar-height) + 28px) var(--page-gutter) 56px;
}

@media (max-width: 767px) {
    .module-page {
        padding: calc(var(--navbar-height) + 20px) 16px 32px;
    }
}

/* ========================================================================== */
/* GRID TOOLBAR + CUSTOMIZE (GridStack) MODE                                  */
/* ========================================================================== */
/* Shared by every customizable page — /dashboard and /country/* (the class names
   keep the `dash-`/`dashboard-` prefix because they are what layout-grid.js and
   _navbar.html key on; the mechanism is page-agnostic). */

/* Only the edit hint lives on the page now — the buttons are in the navbar. So
   this row is COLLAPSED outside edit mode (display:none, no padding), which is
   what gives the dashboard back the full toolbar strip it used to spend on a
   single "Customize" button. */
.dash-toolbar {
    max-width: 2000px;
    margin: 0 auto;
    padding: var(--space-4) var(--space-4) 0;
    display: none;
    align-items: center;
    gap: var(--space-3);
}

body.dashboard-editing .dash-toolbar { display: flex; }

@media (min-width: 1200px) {
    .dash-toolbar { padding: var(--space-5) var(--space-5) 0; }
}

.dash-toolbar-hint {
    font-size: var(--text-sm);
    color: var(--text-tertiary);
}

/* The customize controls as they sit in the navbar (see _navbar.html). */
.dash-nav-actions {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.dash-edit-actions {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

/* The author `display` rules below would otherwise beat the `hidden` attribute
   (a UA style), so toggling `hidden` in JS wouldn't hide these. Restore it. */
.dash-btn[hidden],
.dash-nav-actions[hidden],
.dash-edit-actions[hidden],
.dash-add-menu[hidden],
.dash-toolbar-hint[hidden] { display: none; }

.dash-add-wrap { position: relative; }

.dash-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 32px;
    padding: 0 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: var(--text-sm);
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.dash-btn svg { width: 15px; height: 15px; }
.dash-btn:hover { background: var(--bg-tertiary); color: var(--text-primary); border-color: var(--accent-blue); }
.dash-btn-primary { background: var(--accent-blue); border-color: var(--accent-blue); color: #fff; }
.dash-btn-primary:hover { color: #fff; filter: brightness(1.08); }

/* "Add module" dropdown */
.dash-add-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 230px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    padding: 6px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.dash-add-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 10px;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: var(--text-sm);
    text-align: left;
    cursor: pointer;
}

.dash-add-item svg { width: 15px; height: 15px; color: var(--accent-blue); flex-shrink: 0; }
.dash-add-item:hover { background: var(--bg-tertiary); }
.dash-add-empty { padding: 12px; color: var(--text-muted); font-size: var(--text-sm); text-align: center; }

/* ========================================================================== */
/* GRID SKELETON (first paint → GridStack.init)                               */
/* ========================================================================== */
/*
   Why this exists: gridstack.min.css is a render-blocking CDN stylesheet, but
   gridstack-all.js is deferred. In between, .grid-stack-item is position:absolute
   with NO left/top/width — GridStack.init() is what writes those — so all six
   widgets collapse onto the container origin in a heap. That heap is what users
   saw on a slow load.

   The fix lays the grid out in plain CSS from the geometry the server already
   knows (--gs-area, stamped per item in index.html) and paints skeleton cards over
   it, so the first paint is already the right shape. index.html adds the class
   before the first paint; layout-grid.js drops it once GridStack has positioned
   everything for real.

   These selectors lead with :root.dashboard-loading purely for specificity — they
   have to outrank gridstack.min.css, which is linked AFTER our stylesheet. */

:root.dashboard-loading .grid-stack {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    grid-auto-rows: 76px;           /* == the cellHeight layout-grid.js uses */
    gap: 0;                         /* the 8px gutter is the content inset below */
}

:root.dashboard-loading .grid-stack > .grid-stack-item {
    position: relative;
    inset: auto;
    width: auto;
    height: auto;
    transform: none;
    grid-area: var(--gs-area);
}

/* Same 8px inset GridStack applies via its margin option, so nothing shifts when
   the real grid takes over. */
:root.dashboard-loading .grid-stack > .grid-stack-item > .grid-stack-item-content {
    position: absolute;
    inset: 8px;
    overflow: hidden;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
}

/* The real widget is kept in flow (so MapLibre still measures a real box) and
   just faded out; it fades back in when the class goes. */
.grid-stack-item-content > .widget { transition: opacity 0.18s ease; }
:root.dashboard-loading .grid-stack-item-content > .widget { opacity: 0; }

/* Placeholder furniture — title bar, subtitle bar, body block — drawn as three
   background layers so the skeleton needs no extra DOM. */
:root.dashboard-loading .grid-stack-item-content::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(var(--skeleton-bar) 0 0),
        linear-gradient(var(--skeleton-bar) 0 0),
        linear-gradient(var(--skeleton-bar) 0 0);
    background-repeat: no-repeat;
    background-size: 38% 13px, 56% 9px, calc(100% - 44px) calc(100% - 96px);
    background-position: 22px 24px, 22px 47px, 22px 76px;
    opacity: 0.85;
}

/* Sweep, so the card reads as "loading" rather than "broken". */
:root.dashboard-loading .grid-stack-item-content::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(100deg, transparent 20%, var(--skeleton-sheen) 50%, transparent 80%);
    transform: translateX(-100%);
    animation: skeleton-sweep 1.4s ease-in-out infinite;
}

@keyframes skeleton-sweep {
    to { transform: translateX(100%); }
}

@media (prefers-reduced-motion: reduce) {
    :root.dashboard-loading .grid-stack-item-content::after { animation: none; opacity: 0.5; transform: none; }
}

/* layout-grid.js folds to one column when the GRID gets less than 768px — the
   viewport minus the module rail: nothing on a phone (the rail is a drawer),
   64px collapsed, 248px expanded — so the skeleton folds at the same widths.
   Otherwise a 6-wide card would overflow, or a tablet would load in twelve
   columns and jump to one. The rail's state is on <body> before first paint. */
@media (max-width: 831px) {
    :root.dashboard-loading .grid-stack { grid-template-columns: 1fr; }
    :root.dashboard-loading .grid-stack > .grid-stack-item { grid-area: auto / 1 / span 5 / -1; }
}

@media (max-width: 1015px) {
    :root.dashboard-loading body.side-expanded .grid-stack { grid-template-columns: 1fr; }
    :root.dashboard-loading body.side-expanded .grid-stack > .grid-stack-item { grid-area: auto / 1 / span 5 / -1; }
}

/* GridStack container — centered, same gutters as the old grid */
.grid-stack {
    max-width: 2000px;
    margin: 0 auto;
    padding: var(--space-4) calc(var(--space-4) - 8px);
}

@media (min-width: 1200px) {
    .grid-stack { padding: var(--space-5) calc(var(--space-5) - 8px); }
}

/* Each widget fills its grid cell — override the standalone-page min/max heights,
   scoped to .grid-stack so the dedicated /overview, /calendar… pages keep theirs. */
.grid-stack-item-content {
    display: flex;
    overflow: hidden;
    border-radius: var(--radius-lg);
}

.grid-stack .widget {
    flex: 1 1 auto;
    width: 100%;
    min-height: 0;
    max-height: none;
    animation: none;   /* GridStack positions absolutely; skip the fade-in transform */
}

/* ---- Customize (edit) mode ---- */
body.dashboard-editing .grid-stack-item-content { box-shadow: 0 0 0 1px var(--accent-blue) inset; }

/* A veil over each widget during editing: it is the drag handle and it makes the
   underlying map/links/selects inert so a drag never accidentally clicks them. */
.dash-edit-veil {
    position: absolute;
    inset: 0;
    z-index: 20;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 10px;
    background: color-mix(in srgb, var(--bg-secondary) 55%, transparent);
    border: 1.5px dashed var(--accent-blue);
    border-radius: var(--radius-lg);
    cursor: move;
}

.dash-veil-grip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 4px 8px;
    background: var(--bg-elevated);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: var(--text-sm);
    font-weight: 700;
    pointer-events: none;
}

.dash-veil-grip svg { width: 16px; height: 16px; color: var(--accent-blue); }

.dash-veil-remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: var(--bg-elevated);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
    pointer-events: auto;
    transition: all var(--transition-fast);
}

.dash-veil-remove:hover { background: var(--accent-red); color: #fff; border-color: transparent; }
.dash-veil-remove svg { width: 15px; height: 15px; }

/* Keep GridStack's resize handle grabbable above the veil */
body.dashboard-editing .grid-stack-item > .ui-resizable-handle,
body.dashboard-editing .grid-stack-item > .gs-resize-handle { z-index: 30; }

/* Customizing a drag grid on a phone is poor UX — hide the entry below the bp.
   (layout-grid.js also forces 1-column + leaves edit mode there.) */
@media (max-width: 767px) {
    .dash-nav-actions { display: none; }
    .dash-toolbar { padding-bottom: 0; }
}

/* Same convention as .nav-btn: below the wide breakpoint the navbar buttons drop
   their labels and stay icon-only (each keeps a title=), so the search field is
   not squeezed out while editing. */
@media (max-width: 1023px) {
    .dash-nav-actions .dash-btn span { display: none; }
    .dash-nav-actions .dash-btn { padding: 0 9px; }
}

/* Fallback when the GridStack CDN fails: gridstack.css positions items absolutely,
   which would overlap them. Force a plain vertical flow instead so the dashboard
   stays usable (just not customizable). */
body.no-gridstack .grid-stack { display: flex; flex-direction: column; gap: var(--space-4); }
body.no-gridstack .dash-toolbar,
body.no-gridstack .dash-nav-actions { display: none; }
body.no-gridstack .grid-stack-item,
body.no-gridstack .grid-stack-item-content {
    position: static !important;
    inset: auto !important;
    width: 100% !important;
    height: auto !important;
    transform: none !important;
}
body.no-gridstack .grid-stack .widget { min-height: 420px; }

/* ========================================================================== */
/* WIDGET BASE STYLES                                                         */
/* ========================================================================== */

/* Kairos has no cards: a module is a SECTION on the paper, its header a
   section title with its tools beside it, separated from the next by space and
   hairlines. The class names stay — /alerts, /calendar, the profile tabs and
   several JS renderers emit them. */
.widget {
    background: transparent;
    border: 0;
    border-radius: 0;
    overflow: visible;
    display: flex;
    flex-direction: column;
}

.widget-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px 16px;
    padding: 0 0 14px;
    border-bottom: 0;
    flex-shrink: 0;
}

.widget-title-group {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.widget-title {
    font-size: var(--text-lg);
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: 0;
}

.widget-subtitle {
    font-size: var(--text-sm);
    color: var(--text-tertiary);
}

.widget-actions {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.widget-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    color: var(--text-tertiary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.widget-btn svg {
    width: 14px;
    height: 14px;
}

.widget-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-color: var(--border-color);
}

/* The head every module page opens with: breadcrumb, title, one line of lede. */
.module-head { margin-bottom: 28px; }
.module-head .breadcrumb { margin-bottom: 10px; font-size: var(--text-sm); color: var(--text-tertiary); }
.module-head .breadcrumb a { color: var(--text-secondary); text-decoration: none; font-weight: 600; }
.module-head .breadcrumb a:hover { color: var(--accent); }
.module-head h1 { margin: 0 0 6px; font-size: var(--text-2xl); line-height: 1.15; letter-spacing: -0.015em; }
.module-head p { margin: 0; font-size: var(--text-md); color: var(--text-secondary); max-width: 70ch; }

/* Two modules on one page: a hairline and air between them. */
.module-page .widget + .widget { margin-top: 40px; padding-top: 28px; border-top: 1px solid var(--border-color); }

.widget-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* ========================================================================== */
/* EUROPE OVERVIEW WIDGET                                                     */
/* ========================================================================== */

.europe-overview-content {
    display: flex;
    flex-direction: column;
    padding: var(--space-4);
    gap: var(--space-4);
    overflow: hidden;
}

@media (min-width: 1200px) {
    .europe-overview-content {
        flex-direction: row;
    }
}

.europe-map-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    min-height: 200px;
}

.europe-map {
    flex: 1;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    position: relative;
    overflow: hidden;
    min-height: 300px;
    width: 100%;
}

.map-legend {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3);
    padding: var(--space-2);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-xs);
    color: var(--text-secondary);
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: var(--radius-sm);
}

.country-table-container {
    flex: 1;
    overflow: auto;
}

/* Below the 1200px row layout the map and the table share ONE column, and the
   map's 300/350px floor let it overflow its own flex box: the table, laid out
   after the shrunken box, was painted straight over the map (the dashboard at
   tablet widths, /overview below 1200px, every phone). In a card of fixed height
   the two now split the height it has and neither may claim more than its share;
   MapLibre follows its container through a ResizeObserver. */
@media (max-width: 1199px) {
    .europe-map-container {
        flex: 1 1 55%;
        min-height: 0;
    }

    .europe-map {
        min-height: 0;
    }

    .country-table-container {
        flex: 1 1 45%;
        min-height: 0;
    }
}

/* In the dashboard's one-column flow (`mobile: "fit"` in the registry — phones,
   and tablets once the rail leaves the grid too little room) and on a phone's
   /overview, the card takes its content's height, so nothing is left to split:
   the map gets a height of its own and the table a capped, scrollable box under
   it. Without one, the map's flex share of an auto-height column is zero. */
.grid-stack.gs-1 .europe-map-container,
.grid-stack.gs-1 .country-table-container {
    flex: none;
}

.grid-stack.gs-1 .europe-map {
    flex: none;
    height: clamp(260px, 50vw, 400px);
}

.grid-stack.gs-1 .country-table-container {
    max-height: 340px;
    overscroll-behavior-x: contain;
}

/* Phones also pin the country column while the other four scroll sideways, so
   a row never loses its name. */
@media (max-width: 767px) {
    .europe-map-container,
    .country-table-container {
        flex: none;
    }

    .europe-map {
        flex: none;
        height: 260px;
    }

    .country-table-container {
        max-height: 340px;
        overscroll-behavior-x: contain;
    }

    .country-table th:first-child,
    .country-table td:first-child {
        position: sticky;
        left: 0;
        z-index: 1;
        background: var(--bg-secondary);
    }

    .country-table th:first-child {
        z-index: 2;
        background: var(--bg-tertiary);
    }

    .country-table tbody tr:hover td:first-child {
        background: var(--bg-tertiary);
    }
}

.country-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--text-sm);
}

.country-table th {
    text-align: left;
    padding: var(--space-2) var(--space-3);
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-weight: 500;
    font-size: var(--text-xs);
    position: sticky;
    top: 0;
    z-index: 1;
}

.country-table td {
    padding: var(--space-2) var(--space-3);
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    vertical-align: middle;
}

.country-table tbody tr {
    transition: background var(--transition-fast);
}

.country-table tbody tr:hover {
    background: var(--bg-tertiary);
}

/* Flag + name on one line, with a long name wrapping under itself instead of
   pushing the flag onto its own line. The flex lives on an inner wrapper, NOT on
   the <td>: a display:flex cell stops being a table cell, so its border-bottom
   is drawn at content height and no longer meets the next column's rule. */
.country-table .country-cell {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.country-name {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-weight: 500;
}

.majority-positive {
    color: var(--accent-green);
}

.majority-negative {
    color: var(--accent-red);
}

.stability-badge {
    display: inline-flex;
    align-items: center;
    padding: var(--space-1) var(--space-2);
    border-radius: var(--radius-sm);
    font-size: var(--text-xs);
    font-weight: 500;
    }

.stability-stable {
    background: rgba(34, 197, 94, 0.15);
    color: var(--color-stable);
}

.stability-fragile {
    background: rgba(245, 158, 11, 0.15);
    color: var(--color-fragile);
}

.stability-volatile {
    background: rgba(239, 68, 68, 0.15);
    color: var(--color-volatile);
}

/* Country Tooltip */
.country-tooltip {
    position: fixed;
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: var(--space-4);
    box-shadow: var(--shadow-lg);
    z-index: 9999;
    pointer-events: none;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity var(--transition-fast), transform var(--transition-fast);
    min-width: 250px;
    max-width: 320px;
}

.country-tooltip.visible {
    opacity: 1;
    transform: translateY(0);
}

.tooltip-header {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: var(--space-3);
    padding-bottom: var(--space-3);
    border-bottom: 1px solid var(--border-color);
}

.tooltip-flag {
    font-size: var(--text-xl);
}

.tooltip-name {
    font-weight: 600;
    font-size: var(--text-md);
}

.tooltip-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-1) 0;
    font-size: var(--text-sm);
}

.tooltip-label {
    color: var(--text-tertiary);
}

.tooltip-value {
    color: var(--text-primary);
    font-weight: 500;
}

/* ============================================================================
   HOVER TOOLTIP (window.hoverTip, static/js/tooltip.js)

   ONE card for every chart/graphic hover: the polling tracker, the parliament
   semicircle, the seat-composition bars and the voting-record bars. They used to
   be three different things — a themed card, Chart.js's built-in tooltip and the
   browser's native `title=` — the last two a hardcoded dark box that ignored the
   light theme completely. Every value here is a token, so the card is white and
   clean in light and dark alike.
   ============================================================================ */

.hover-tip {
    position: fixed;
    z-index: 1000;
    pointer-events: none;   /* never eat a click meant for the graphic beneath */
    min-width: 150px;
    max-width: 280px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    padding: 9px 11px;
    font-size: 12px;
}

.hover-tip[hidden] {
    display: none;
}

.hover-tip .ht-title {
    color: var(--text-tertiary);
    font-size: 10.5px;
    margin-bottom: 6px;
}

.hover-tip .ht-row {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 1.5px 0;
}

.hover-tip .ht-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex: 0 0 auto;
}

.hover-tip .ht-name {
    flex: 1;
    color: var(--text-primary);
}

.hover-tip .ht-val {
    font-family: var(--font-mono);
    color: var(--text-primary);
    white-space: nowrap;
}

/* ========================================================================== */
/* POLITICAL TICKER WIDGET                                                    */
/* ========================================================================== */

.live-indicator {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--accent-red);
    }

.live-dot {
    width: 8px;
    height: 8px;
    background: var(--accent-red);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.5;
        transform: scale(0.8);
    }
}

.ticker-content {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.ticker-bar-container {
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
    overflow: hidden;
    flex-shrink: 0;
}

.ticker-bar {
    display: flex;
    animation: ticker-scroll 60s linear infinite;
    padding: var(--space-3) 0;
    white-space: nowrap;
}

@keyframes ticker-scroll {
    0% {
        transform: translateX(0);
    }

    100% {
        transform: translateX(-50%);
    }
}

.ticker-bar:hover {
    animation-play-state: paused;
}

.ticker-item {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: 0 var(--space-6);
    font-size: var(--text-sm);
    color: var(--text-primary);
}

.ticker-item::after {
    content: '•';
    color: var(--text-tertiary);
    margin-left: var(--space-6);
}

.ticker-country {
    color: var(--accent-blue);
    font-weight: 600;
}

.events-list {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-2);
}

.event-item {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    padding: var(--space-3);
    border-radius: var(--radius-md);
    transition: background var(--transition-fast);
}

.event-item:hover {
    background: var(--bg-tertiary);
}

.event-time {
    flex-shrink: 0;
    font-size: var(--text-xs);
    font-family: var(--font-mono);
    color: var(--text-tertiary);
    min-width: 50px;
}

.event-country {
    flex-shrink: 0;
    font-size: var(--text-md);
}

.event-content {
    flex: 1;
    min-width: 0;
}

.event-badge {
    display: inline-flex;
    align-items: center;
    padding: var(--space-1) var(--space-2);
    border-radius: var(--radius-sm);
    font-size: var(--text-xs);
    font-weight: 500;
    margin-bottom: var(--space-1);
}

.badge-poll {
    background: rgba(74, 158, 255, 0.15);
    color: var(--accent-blue);
}

.badge-government {
    background: rgba(167, 139, 250, 0.15);
    color: var(--accent-purple);
}

.badge-model {
    background: rgba(34, 211, 238, 0.15);
    color: var(--accent-cyan);
}

.badge-legislative {
    background: rgba(251, 191, 36, 0.15);
    color: var(--accent-yellow);
}

.event-text {
    font-size: var(--text-sm);
    color: var(--text-primary);
    line-height: 1.4;
}

.event-source {
    font-size: var(--text-xs);
    color: var(--text-tertiary);
    margin-top: var(--space-1);
}

/* ========================================================================== */
/* CALENDAR WIDGET                                                            */
/* ========================================================================== */

.calendar-content {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Tabs, Kairos style: text tabs on a hairline, the active one carrying the
   2px accent rule — the same as the top bar and the profile section strips. */
.calendar-tabs {
    display: flex;
    gap: 4px;
    padding: 0;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
    overflow-x: auto;
    scrollbar-width: none;
}

.tab-btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    height: 44px;
    padding: 0 10px;
    margin-bottom: -1px;
    background: none;
    border: 0;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    color: var(--text-secondary);
    font-size: var(--text-md);
    font-family: inherit;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
}

.tab-btn svg {
    width: 15px;
    height: 15px;
}

.tab-btn:hover { color: var(--text-primary); }

.tab-btn.active {
    background: none;
    color: var(--text-primary);
    border-bottom-color: var(--accent);
}

.calendar-filters {
    display: flex;
    gap: var(--space-2);
    padding: 12px 0;
    border-bottom: 0;
    flex-shrink: 0;
}

.filter-select {
    flex: 1;
    height: 36px;
    padding: 0 var(--space-3);
    background: var(--bg-primary);
    border: 1px solid var(--control-border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: var(--text-sm);
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.filter-select:focus {
    outline: none;
    border-color: var(--accent-blue);
}

/* .filter-select:focus only swaps a 1px border color — too subtle for keyboard
   focus — and its higher specificity (class+:focus) suppresses the new global
   outline. Restore a clear ring for keyboard/AT users via box-shadow; mouse
   clicks (plain :focus, no :focus-visible) stay ring-free as before. Matches
   the .search-input:focus ring. */
.filter-select:focus-visible {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(74, 158, 255, 0.15);
}

.calendar-list {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-2);
}

.calendar-item {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    padding: var(--space-3);
    border-radius: var(--radius-md);
    transition: background var(--transition-fast);
}

.calendar-item:hover {
    background: var(--bg-tertiary);
}

.calendar-date {
    flex-shrink: 0;
    width: 48px;
    text-align: center;
    padding: var(--space-2);
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
}

.calendar-month {
    font-size: var(--text-xs);
    color: var(--accent-blue);
    font-weight: 600;
    }

.calendar-day {
    font-size: var(--text-lg);
    font-weight: 700;
    color: var(--text-primary);
}

.calendar-info {
    flex: 1;
    min-width: 0;
}

.calendar-type {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: var(--space-1) var(--space-2);
    border-radius: var(--radius-sm);
    font-size: var(--text-xs);
    font-weight: 500;
    margin-bottom: var(--space-1);
}

.type-national {
    background: rgba(74, 158, 255, 0.15);
    color: var(--accent-blue);
}

.type-regional {
    background: rgba(167, 139, 250, 0.15);
    color: var(--accent-purple);
}

.type-european {
    background: rgba(251, 191, 36, 0.15);
    color: var(--accent-yellow);
}

.type-presidential {
    background: rgba(34, 211, 238, 0.15);
    color: var(--accent-cyan);
}

.type-committee {
    background: rgba(167, 139, 250, 0.15);
    color: var(--accent-purple);
}

.type-council {
    background: rgba(251, 191, 36, 0.15);
    color: var(--accent-yellow);
}

.type-plenary {
    background: rgba(74, 158, 255, 0.15);
    color: var(--accent-blue);
}

.type-publication {
    background: rgba(34, 197, 94, 0.15);
    color: var(--accent-green);
}

.type-trilogues {
    background: rgba(248, 113, 113, 0.15);
    color: var(--accent-red);
}

.calendar-title {
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: var(--space-1);
}

.calendar-meta {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    font-size: var(--text-xs);
    color: var(--text-tertiary);
}

.calendar-country {
    display: flex;
    align-items: center;
    gap: var(--space-1);
}

.calendar-status {
    display: inline-flex;
    align-items: center;
    padding: var(--space-1) var(--space-2);
    border-radius: var(--radius-sm);
    font-size: var(--text-xs);
    font-weight: 500;
}

.status-uncertainty {
    background: rgba(248, 113, 113, 0.15);
    color: var(--accent-red);
}

.status-competitive {
    background: rgba(251, 191, 36, 0.15);
    color: var(--accent-yellow);
}

.status-favored {
    background: rgba(34, 197, 94, 0.15);
    color: var(--accent-green);
}

.status-advance {
    background: rgba(152, 152, 168, 0.15);
    color: var(--text-secondary);
}

/* --- Elections already held ------------------------------------------------
   Kept in the list behind a toggle rather than dropped: a past date is itself
   information (the country voted and the record has not been curated yet).
   They read as archive — dimmed, with a neutral "held" chip, since the real
   status chip would still say "Scheduled". */

.status-past {
    background: rgba(152, 152, 168, 0.12);
    color: var(--text-tertiary);
}

.calendar-item[data-href] {
    cursor: pointer;
}

.calendar-item.is-past {
    opacity: 0.55;
}

.calendar-item.is-past:hover {
    opacity: 1;
}

.calendar-past-toggle {
    display: block;
    width: 100%;
    margin: var(--space-2) 0;
    padding: var(--space-2) var(--space-3);
    background: transparent;
    border: 1px dashed var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-tertiary);
    font-family: inherit;
    font-size: var(--text-xs);
    cursor: pointer;
    transition: background var(--transition-fast), color var(--transition-fast);
}

.calendar-past-toggle:hover {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

.calendar-past-heading {
    padding: var(--space-2) var(--space-3) var(--space-1);
    color: var(--text-tertiary);
    font-size: var(--text-xs);
    }

/* ========================================================================== */
/* CRITICAL ALERTS WIDGET                                                     */
/* ========================================================================== */

.alerts-content {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.alerts-filters {
    display: flex;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.alerts-list {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-2);
}

.alert-card {
    position: relative;
    padding: var(--space-4);
    padding-left: var(--space-5);
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-2);
    transition: all var(--transition-fast);
}

.alert-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    border-radius: var(--radius-md) 0 0 var(--radius-md);
}

.alert-card.severity-high::before {
    background: var(--accent-red);
}

.alert-card.severity-medium::before {
    background: var(--accent-yellow);
}

.alert-card:hover {
    background: var(--bg-hover);
}

.alert-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-2);
    margin-bottom: var(--space-2);
}

.alert-type {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.alert-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    font-size: var(--text-sm);
}

.alert-icon.high {
    background: rgba(248, 113, 113, 0.15);
    color: var(--accent-red);
}

.alert-icon.medium {
    background: rgba(251, 191, 36, 0.15);
    color: var(--accent-yellow);
}

.alert-type-label {
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--text-secondary);
}

.alert-severity {
    padding: var(--space-1) var(--space-2);
    border-radius: var(--radius-sm);
    font-size: var(--text-xs);
    font-weight: 600;
    }

.alert-severity.high {
    background: rgba(248, 113, 113, 0.15);
    color: var(--accent-red);
}

.alert-severity.medium {
    background: rgba(251, 191, 36, 0.15);
    color: var(--accent-yellow);
}

.alert-title {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-2);
}

.alert-description {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: var(--space-3);
}

.alert-meta {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    font-size: var(--text-xs);
    color: var(--text-tertiary);
}

.alert-meta-item {
    display: flex;
    align-items: center;
    gap: var(--space-1);
}

.alert-meta svg {
    width: 12px;
    height: 12px;
}

/* ========================================================================== */
/* UTILITY CLASSES                                                            */
/* ========================================================================== */

.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;
}

.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ========================================================================== */
/* PHONES (≤767px)                                                            */
/* ========================================================================== */
/*
   ONE breakpoint for the whole shell: the same 768px at which the module rail
   turns into a drawer (_sidebar.html). A width that showed half of one layout
   and half of the other is how the search field used to vanish at 768 while the
   rail was still a desktop column. (The customizable grids fold to one column
   on their OWN width — see "the grid as a column" — which on a phone is always
   below it.)
*/

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

@media (max-width: 767px) {
    :root { --page-gutter: 16px; }

    .navbar {
        padding: 0 8px 0 var(--page-gutter);
        gap: 4px;
    }

    .nav-menu-btn { margin-left: -8px; }

    .brand { margin-right: auto; }
    .brand-logo { height: 18px; }

    .nav-search-btn {
        display: inline-flex;
    }

    .navbar-center,
    .search-shortcut {
        display: none;
    }

    /* The search opens OVER the whole bar (navbar.js adds .search-open), with
       its closer beside the field. */
    .navbar.search-open .navbar-center {
        display: flex;
        align-items: center;
        position: absolute;
        inset: 0;
        z-index: 2;
        max-width: none;
        margin: 0;
        padding: 0 8px 0 var(--page-gutter);
        background: var(--bg-primary);
    }

    .navbar.search-open .search-container {
        flex: 1;
        gap: 4px;
    }

    .navbar.search-open .search-close {
        display: inline-flex;
    }

    .search-input {
        height: 44px;
        padding-right: 12px;
        text-overflow: ellipsis;
    }

    .search-results-dropdown {
        min-width: 0;
        max-height: calc(100vh - var(--navbar-height) - var(--space-4));
        max-height: calc(100dvh - var(--navbar-height) - var(--space-4));
    }

    /* iOS Safari zooms the whole page into any field whose text is under 16px
       the moment it is focused, and does not zoom back out — so on a phone no
       field is smaller. !important because pages size their own fields inline. */
    input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
    select,
    textarea {
        font-size: 16px !important;
    }

    .grid-stack {
        padding: var(--space-3) calc(var(--space-3) - 8px);
    }

    .widget {
        min-height: 350px;
    }

    /* A header holding a title AND controls (the map's layer picker, a time
       range) wraps the controls under the title instead of squeezing the title
       into a one-word-per-line column beside them. */
    .widget-header {
        padding: var(--space-3) var(--space-4);
        flex-wrap: wrap;
        gap: var(--space-2);
    }

    .widget-title-group {
        flex: 1 1 12rem;
        min-width: 0;
    }

    .widget-actions {
        flex-wrap: wrap;
    }

    .calendar-tabs,
    .calendar-filters,
    .alerts-filters {
        flex-wrap: wrap;
    }

    .calendar-filters .filter-select,
    .alerts-filters .filter-select {
        flex: 1 1 9rem;
        min-width: 0;
    }

    /* Finger-sized hit areas for the small chrome buttons. */
    .widget-btn {
        width: 36px;
        height: 36px;
    }

    .filter-select {
        height: 40px;
    }
}

/* ---- The grid as a column (phones, tablets in portrait) ------------------- */
/* When the grid gets less than 768px — every phone, and a tablet in portrait
   once the rail has taken its share — layout-grid.js puts GridStack in its
   1-column mode, which tags the grid `.gs-1`. Nothing can be dragged there, so
   absolute cells buy nothing and cost a lot: every fixed-height module scrolls
   inside itself, and a page built of them traps the thumb in one card after
   another. So in that mode the column is a plain flow:
     - modules registered `mobile: "fit"` (services/dashboard_layout.py) — the
       profile blocks one reads top to bottom — take their content's height and
       scroll with the page;
     - the rest (feeds, long lists, the map) keep the cell height the layout gave
       them, capped below the screen height, so no card is a wall the page
       cannot be scrolled past.
   Reading order is GridStack's own 1-column reflow, which layout-grid.js copies
   into `order`. Keyed on the class rather than a media query on purpose: it
   follows whatever column count GridStack is actually in. */
.grid-stack.gs-1 {
    display: flex;
    flex-direction: column;
    height: auto !important;            /* GridStack writes the stacked height inline */
}

.grid-stack.gs-1 > .grid-stack-item {
    position: relative;
    top: auto !important;               /* inline calc(row * cell) from GridStack */
    left: 0;
    /* GridStack animates left/top/width/height (.grid-stack-animate): folding to
       one column on load would slide every card in from its desktop column —
       and while it slid, the page was wider than the phone. */
    transition: none;
    flex-shrink: 0;
    max-height: calc(100vh - var(--navbar-height) - 24px);
    max-height: calc(100svh - var(--navbar-height) - 24px);
}

.grid-stack.gs-1 > .grid-stack-item[data-mobile="fit"] {
    height: auto !important;            /* inline calc(h * cell) from GridStack */
    max-height: none;
}

.grid-stack.gs-1 > .grid-stack-item[data-mobile="fit"] > .grid-stack-item-content {
    position: relative;
    inset: auto;
    margin: var(--gs-item-margin-top) var(--gs-item-margin-right) var(--gs-item-margin-bottom) var(--gs-item-margin-left);
}

/* ========================================================================== */
/* ANIMATIONS                                                                 */
/* ========================================================================== */

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.widget {
    animation: fadeIn 0.3s ease forwards;
}

.widget:nth-child(1) {
    animation-delay: 0.05s;
}

.widget:nth-child(2) {
    animation-delay: 0.1s;
}

.widget:nth-child(3) {
    animation-delay: 0.15s;
}

.widget:nth-child(4) {
    animation-delay: 0.2s;
}

/* =============================================
   MapLibre Map Styles
   ============================================= */

.maplibregl-popup {
    z-index: 100;
}

.maplibregl-popup-content {
    background: var(--bg-elevated) !important;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0;
    box-shadow: var(--shadow-lg);
}

.maplibregl-popup-tip {
    border-top-color: var(--bg-elevated) !important;
}

.map-tooltip {
    padding: 12px 14px;
    min-width: 180px;
}

.map-tooltip .tooltip-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
}

.map-tooltip .tooltip-flag {
    font-size: 1.4rem;
}

.map-tooltip .tooltip-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.map-tooltip .tooltip-row {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 3px 0;
    font-size: 0.8rem;
}

.map-tooltip .tooltip-label {
    color: var(--text-tertiary);
}

.map-tooltip .tooltip-value {
    color: var(--text-secondary);
    font-weight: 500;
    text-align: right;
}

.map-tooltip .stability-sustainable,
.map-tooltip .stability-stable {
    color: var(--status-stable);
}

.map-tooltip .stability-fragile {
    color: var(--status-fragile);
}

.map-tooltip .stability-volatile {
    color: var(--status-volatile);
}

/* Only in the side-by-side layout: below 1200px the map shares a column with the
   table and takes its share of the card (see the EUROPE OVERVIEW block). */
@media (min-width: 1200px) {
    #europeMap {
        min-height: 350px;
    }
}

#maplibre-map {
    border-radius: var(--radius-md);
}

.maplibregl-ctrl-group {
    background: var(--bg-elevated) !important;
    border: 1px solid var(--border-color) !important;
}

.maplibregl-ctrl-group button {
    background-color: transparent !important;
}

.maplibregl-ctrl-group button+button {
    border-top: 1px solid var(--border-color) !important;
}

.maplibregl-ctrl-group button:hover {
    background-color: var(--bg-tertiary) !important;
}

.maplibregl-ctrl button.maplibregl-ctrl-zoom-in .maplibregl-ctrl-icon,
.maplibregl-ctrl button.maplibregl-ctrl-zoom-out .maplibregl-ctrl-icon {
    filter: invert(1);
}

/* ========================================================================== */
/* REDUCED MOTION (accessibility — WCAG 2.2.2 / 2.3.3)                        */
/* Honor the OS "reduce motion" setting: near-instant animations/transitions  */
/* everywhere, and stop the infinite decorative loops (news ticker, live dot) */
/* outright so they render static.                                            */
/* ========================================================================== */

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

    .ticker-bar,
    .live-dot {
        animation: none !important;
    }
}
/* ========================================================================== */
/* KAIROS COMPONENTS — the shared pieces every page is built from             */
/* ========================================================================== */
/* The same pieces as Kairos Research (see the "Sistema compartido" board):
   page and section titles with their link, the band (the ONE box a page gets),
   hairline lists, the segmented switch, codes, tags and buttons. Pages compose
   these instead of restating sizes and colours inline. */

.page {
    max-width: var(--page-max);
    margin: 0 auto;
    padding: calc(var(--navbar-height) + 28px) var(--page-gutter) 56px;
}

.page-title {
    font-size: var(--text-2xl);
    line-height: 1.15;
    font-weight: 700;
    letter-spacing: -0.015em;
    color: var(--text-primary);
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: var(--text-base);
    font-weight: 600;
    color: var(--text-secondary);
    text-decoration: none;
}

.back-link:hover { color: var(--accent); }

/* A wide table scrolls inside its own box, never the page. */
.table-scroll { overflow-x: auto; }

.page-lede {
    margin-top: 6px;
    font-size: var(--text-md);
    line-height: 1.45;
    color: var(--text-secondary);
    max-width: 70ch;
}

.band {
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    padding: 22px 20px;
}

.band-tight { padding: 4px 16px 16px; }

.section { margin-top: 48px; }

.section-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 6px 16px;
    margin-bottom: 14px;
}

.section-title {
    font-size: var(--text-lg);
    line-height: 1.3;
    font-weight: 700;
    letter-spacing: 0;
    color: var(--text-primary);
}

.section-tools {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px 16px;
}

.section-link {
    font-size: var(--text-base);
    font-weight: 600;
    color: var(--accent);
    text-decoration: none;
    white-space: nowrap;
}

.section-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.section-link-block { display: inline-flex; margin-top: 10px; }

.section-sub {
    margin: -8px 0 10px;
    font-size: var(--text-sm);
    color: var(--text-tertiary);
}

.section-aside {
    font-size: var(--text-sm);
    color: var(--text-tertiary);
}

.segmented {
    display: inline-flex;
    gap: 2px;
    max-width: 100%;
    padding: 2px;
    border-radius: var(--radius-md);
    background: var(--bg-hover);
    overflow-x: auto;
    scrollbar-width: none;
}

.segmented button {
    display: inline-flex;
    align-items: center;
    height: 32px;
    padding: 0 12px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    font-family: inherit;
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
    cursor: pointer;
}

.segmented button:hover { color: var(--text-primary); }

.segmented button[aria-pressed="true"],
.segmented button.active {
    background: var(--bg-primary);
    color: var(--text-primary);
    box-shadow: 0 0 0 1px var(--border-color);
}

.legend {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 16px;
    list-style: none;
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

.legend li { display: inline-flex; align-items: center; gap: 6px; }

.swatch {
    flex: none;
    width: 12px;
    height: 12px;
    border-radius: 3px;
}

.dot {
    flex: none;
    display: inline-block;
    width: 9px;
    height: 9px;
    border-radius: 50%;
}

.note {
    font-size: var(--text-sm);
    line-height: 1.5;
    color: var(--text-tertiary);
}

.meta {
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--text-tertiary);
}

.rule-list { list-style: none; }
.rule-list > li { padding: 12px 0; border-top: 1px solid var(--border-color); }

.code {
    display: inline-flex;
    align-items: center;
    flex: none;
    height: 20px;
    padding: 0 6px;
    border-radius: var(--radius-sm);
    background: var(--bg-hover);
    font-size: var(--text-xs);
    font-weight: 700;
    letter-spacing: 0.02em;
    color: var(--text-primary);
    white-space: nowrap;
}

.code-lg { height: 22px; }

.tag {
    display: inline-flex;
    align-items: center;
    flex: none;
    height: 22px;
    padding: 0 8px;
    border-radius: var(--radius-sm);
    font-size: var(--text-xs);
    font-weight: 700;
    color: var(--text-secondary);
    background: var(--bg-hover);
    white-space: nowrap;
}

.tag-up { color: var(--accent-green); background: var(--accent-green-soft); }
.tag-down { color: var(--accent-red); background: var(--accent-red-soft); }
.tag-warn { color: var(--accent-yellow); background: var(--accent-yellow-soft); }
.tag-accent { color: var(--accent); background: var(--accent-soft); }

.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 28px;
    padding: 0 10px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text-primary);
    text-decoration: none;
}

.chip:hover { border-color: var(--control-border); color: var(--accent); }
.chip .code { margin-left: -6px; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 40px;
    padding: 0 16px;
    border: 1px solid var(--control-border);
    border-radius: var(--radius-md);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: inherit;
    font-size: var(--text-base);
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
}

.btn:hover { border-color: var(--text-tertiary); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-blue-dim); border-color: var(--accent-blue-dim); }
.btn-block { display: flex; width: 100%; }

.up { color: var(--accent-green); }
.down { color: var(--accent-red); }
.flat { color: var(--text-tertiary); }
.num { font-variant-numeric: tabular-nums; }

.dl-rows > div {
    display: grid;
    grid-template-columns: 92px minmax(0, 1fr);
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
    font-size: var(--text-base);
}

.dl-rows dt { color: var(--text-tertiary); }
.dl-rows dd { margin: 0; min-width: 0; }
.dl-rows .sub { display: block; font-size: var(--text-sm); line-height: 1.4; color: var(--text-tertiary); }

.bias-bar {
    display: flex;
    gap: 2px;
    height: 10px;
    border-radius: 3px;
    overflow: hidden;
}

.bias-bar-sm { height: 6px; gap: 1px; border-radius: 2px; }
.bias-bar .l { background: var(--bias-left); }
.bias-bar .c { background: var(--bias-center); }
.bias-bar .r { background: var(--bias-right); }

.empty {
    padding: 12px 0;
    font-size: var(--text-base);
    color: var(--text-tertiary);
}

.page-foot {
    margin-top: 56px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
    font-size: var(--text-sm);
    line-height: 1.5;
    color: var(--text-tertiary);
    max-width: 110ch;
}

/* Headline links read as text until hovered. */
a.headline { color: var(--text-primary); text-decoration: none; }
a.headline:hover { color: var(--accent); }

/* A chamber as a half-ring of seat dots (static/js/hemicycle.js): the European
   Parliament on /eu and every national parliament on a country profile. */
.hemicycle { display: flex; justify-content: center; padding: 4px 0 8px; }
.hemicycle-svg { width: 100%; max-width: 360px; height: auto; overflow: visible; }
.hemicycle-svg circle { transition: opacity var(--transition-fast); }
.hemicycle-svg:hover circle { opacity: 0.45; }
.hemicycle-svg circle:hover { opacity: 1; }
.hemicycle-total { font-family: var(--font-primary); font-size: 20px; font-weight: 700; fill: var(--text-primary); font-variant-numeric: tabular-nums; }
.hemicycle-sub { font-family: var(--font-primary); font-size: 8px; fill: var(--text-tertiary); }

@media (prefers-reduced-motion: reduce) {
    .hemicycle-svg circle { transition: none; }
}

/* A data table, Kairos style: hairline rows, small grey headings (sortable
   when they hold a button), figures right-aligned in tabular digits. */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--text-base);
}

.data-table th,
.data-table td {
    padding: 11px 12px;
    text-align: left;
    vertical-align: top;
    border-bottom: 1px solid var(--border-color);
}

.data-table th:first-child,
.data-table td:first-child { padding-left: 0; }

.data-table th {
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--text-tertiary);
    white-space: nowrap;
    vertical-align: bottom;
}

.data-table th button {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 0;
    background: none;
    border: 0;
    font: inherit;
    color: inherit;
    cursor: pointer;
}

.data-table th button:hover { color: var(--text-primary); }
.data-table th[aria-sort] button { color: var(--text-primary); }
.data-table th[aria-sort="ascending"] button::after { content: '↑'; }
.data-table th[aria-sort="descending"] button::after { content: '↓'; }
.data-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.data-table tbody tr:hover { background: var(--bg-tertiary); }
.data-table .sub { display: block; font-size: var(--text-sm); color: var(--text-tertiary); }
.data-table a { color: var(--text-primary); text-decoration: none; font-weight: 600; }
.data-table a:hover { color: var(--accent); }

.ov-filter input {
    width: 260px;
    max-width: 100%;
    height: 40px;
    padding: 0 12px;
    border: 1px solid var(--control-border);
    border-radius: var(--radius-md);
    background: var(--bg-primary);
    color: var(--text-primary);
    font: inherit;
    font-size: var(--text-base);
}

.ov-filter input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
