/* =========================================================================
   Synaptor Transit · Back Office stylesheet
   Single source of truth. Components reference variables, not raw values.

   Section order:
     1. Design tokens
     2. Reset + base
     3. Page chrome (header, nav, main, footer)
     4. Buttons
     5. Forms
     6. Panels
     7. Tables (compare)
     8. Toolbar + filter chips
     9. Badges + pills
    10. Metric tiles
    11. Banners + status
    12. Empty state
    13. Decision dots
    14. Route catalog + timetable
    15. Stop dossier + enrichment
    16. Comfort weights
    17. Route regression page
    18. Login screen
    19. Responsive
   ========================================================================= */

/* =========================================================================
   1. Design tokens
   ========================================================================= */

:root {
    /* -- Synaptor Color · paleta (handoff-v2/DESIGN-SYSTEM.md §1) --------
       Syrové hodnoty značky. Komponenty sem NESAHAJÍ — berou sémantickou
       vrstvu nebo aliasy níž. Barva se nikdy nepíše hexem. */
    --color-synapse-ink-25:  #F8FBFB;
    --color-synapse-ink-50:  #EDF3F5;
    --color-synapse-ink-100: #E8EFF2;
    --color-synapse-ink-200: #DDE7EC;
    --color-synapse-ink-300: #D6E2E7;
    --color-synapse-ink-400: #B9C6D0;
    --color-synapse-ink-500: #98A7B4;
    --color-synapse-ink-600: #768593;
    --color-synapse-ink-700: #586373;
    --color-synapse-ink-800: #373945;
    --color-synapse-ink-900: #2C303A;
    --color-synapse-ink-950: #242733;

    --color-signal-yellow-50:  #FFF7DB;
    --color-signal-yellow-100: #FFEFB2;
    --color-signal-yellow-200: #FFE683;
    --color-signal-yellow-300: #FFDD53;
    --color-signal-yellow-400: #FFD526;
    --color-signal-yellow-500: #FFC801;
    --color-signal-yellow-600: #C39A00;
    --color-signal-yellow-700: #9E7D00;
    --color-signal-yellow-800: #735B00;
    --color-signal-yellow-900: #4A3B00;
    --color-signal-yellow-950: #261E00;

    --color-brand-synapse-ink:   var(--color-synapse-ink-800);
    --color-brand-signal-yellow: var(--color-signal-yellow-500);
    --color-brand-frost:         var(--color-synapse-ink-25);

    /* -- Synaptor Theme · sémantická vrstva, mode Light ------------------ */
    --surface-canvas:  var(--color-synapse-ink-50);
    --surface-shell:   var(--color-brand-frost);
    --surface-card:    var(--color-brand-frost);
    --surface-subtle:  var(--color-synapse-ink-100);
    /* Manuál dává surface/input Yellow/50. Ten je navržený na jedno ukázkové pole,
       ne na TenantEdit s dvaceti řádky: souvislá žlutá plocha čte jako „všechno je
       zvýrazněné" a měla stejný hex jako --warn-50, takže input nešel odlišit od
       varovného proužku. Klidový stav je proto Ink/50 (zapuštěné pole na Frost kartě,
       hierarchii dělá výplň) a značková žlutá se utratí tam, kde něco znamená — na
       poli, ve kterém se zrovna píše. */
    --surface-input:   var(--color-synapse-ink-50);
    --surface-input-focus: var(--color-signal-yellow-50);
    --surface-inverse: var(--color-synapse-ink-800);
    --text-primary:    var(--color-synapse-ink-800);
    --text-secondary:  var(--color-synapse-ink-700);
    --text-inverse:    var(--color-synapse-ink-25);
    --text-on-accent:  var(--color-synapse-ink-800);
    --accent-default:  var(--color-brand-signal-yellow);
    --accent-hover:    var(--color-signal-yellow-400);
    --accent-soft:     var(--color-signal-yellow-100);
    --accent-contrast: var(--color-signal-yellow-700);
    --border-default:  var(--color-synapse-ink-200);
    /* Manuálový border/strong (Ink/800) je pod vlastním jménem: --border-strong už
       v tomhle stylopisu znamená „o stupeň výraznější vlas" a visí na něm 28 míst,
       kde by plná Ink byla rána kladivem. Ink obrys se sází jen tam, kde ho manuál
       opravdu chce — sekundární tlačítko. */
    --border-ink:      var(--color-brand-synapse-ink);
    --focus-ring:      var(--color-synapse-ink-300);

    /* -- Aliasy pro stávající kód ---------------------------------------
       Zbytek stylopisu mluví starým názvoslovím (--brand, --surface, …).
       Místo přepsání 3400 řádků se staré názvy váží na brand tokeny. */
    --brand:       var(--color-brand-synapse-ink);
    --brand-700:   var(--color-synapse-ink-900);
    --brand-600:   var(--color-synapse-ink-700);
    --brand-500:   var(--color-synapse-ink-600);
    --brand-50:    var(--color-synapse-ink-100);

    --accent:      var(--accent-default);
    --accent-50:   var(--color-signal-yellow-50);

    --line-bus:    var(--color-synapse-ink-700);
    --line-trol:   var(--color-signal-yellow-700);

    /* Surfaces — bílá se nepoužívá, světlá plocha je Frost (pravidlo 1). */
    --bg:          var(--surface-canvas);
    --surface:     var(--surface-card);
    --surface-2:   var(--color-synapse-ink-50);
    --surface-3:   var(--surface-subtle);
    --border:      var(--border-default);
    --border-strong: var(--color-synapse-ink-400);

    /* Text — Ink/500 a Ink/600 na světlém neprojdou AA (pravidlo 7). */
    --text:        var(--text-primary);
    --text-2:      var(--text-secondary);
    --muted:       var(--text-secondary);
    --muted-2:     var(--color-synapse-ink-600);

    /* Status — jediná povolená barva mimo paletu je sémantická červená. */
    --error:       #C12A2A;
    --error-50:    #FFE0E0;
    --error-border: color-mix(in srgb, var(--error) 28%, var(--error-50));
    /* Paleta nemá zelenou. Kladný stav = akcent: Ink text na Yellow/100 (8.9 : 1),
       zároveň použitelný jako plná výplň s Frost textem. Varování zůstává zlaté
       (Yellow/700 na Yellow/50), destruktivní červené — tři odlišitelné stavy. */
    --success:     var(--text-primary);
    --success-50:  var(--accent-soft);
    /* accent/contrast je „žlutá tam, kde musí být čitelná jako OBRYS" — ne jako text.
       Yellow/700 má na Frostu 3,75 : 1 a na Yellow/50 dokonce 3,63 : 1, takže jako text
       padá; pravidlo 3 manuálu (žlutá na světlém není text) platí i na tenhle odstín.
       Text varování je proto Ink/800 na zlaté výplni (10,68 : 1) a žlutá zůstává na
       linkách, kde stačí 3 : 1 pro negrafický prvek. */
    --warn:        var(--text-primary);
    --warn-line:   var(--accent-contrast);
    --warn-50:     var(--color-signal-yellow-50);

    /* Spacing — Synaptor Layout */
    --space-4: 4px;   --space-8: 8px;   --space-10: 10px; --space-12: 12px;
    --space-16: 16px; --space-20: 20px; --space-24: 24px; --space-32: 32px;
    --space-40: 40px; --space-64: 64px;

    --sp-1: var(--space-4);
    --sp-2: var(--space-8);
    --sp-3: var(--space-12);
    --sp-4: var(--space-16);
    --sp-5: var(--space-20);
    --sp-6: var(--space-24);
    --sp-8: var(--space-32);
    --sp-10: var(--space-40);
    --sp-12: 48px;
    --sp-16: var(--space-64);

    /* Radii — „pill všude", výjimka je checkbox (radius/sm, je to ikona). */
    --radius-sm: 5px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-pill: 999px;

    --r-1: var(--radius-sm);
    --r-2: var(--radius-md);
    --r-3: var(--radius-lg);
    --r-pill: var(--radius-pill);

    /* Type — Quicksand jen nadpisy, Inter všechno ostatní, Plex Mono kód. */
    --font-display: "Quicksand", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
    --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Monaco, monospace;

    /* Škála srovnaná na type ramp manuálu. Ten nemá NIC pod 14 px (Body/Caption) a za
       velikost UI textu, popisků a tabulek považuje 16 px (Body/Small). Admin měl základ
       15 px a čtyřicet deklarací mezi 9 a 12 px — na projektoru u zákazníka to nikdo
       nepřečte a občasný správce v tom nenajde, co hledá. 14 px je teď podlaha. */
    --text-xs:   14px;   /* Body/Caption — meta, poznámky, nejmenší povolený text */
    --text-sm:   15px;
    --text-base: 16px;   /* Body/Small — základní UI text */
    --text-md:   18px;
    --text-lg:   20px;   /* Body */
    --text-xl:   22px;   /* Heading/H4 */
    --text-2xl:  28px;   /* Heading/H3 */
    --text-3xl:  35px;   /* Heading/H2 */

    /* Shadows — manuál elevation nemá, hierarchii dělá výplň (§8).
       Zbylé stíny jsou proto na hraně viditelnosti, jen k oddělení vrstev. */
    --shadow-sm: 0 1px 2px rgba(36, 39, 51, .04);
    --shadow-md: 0 4px 12px rgba(36, 39, 51, .07);
    /* Manuál chce prstenec focus/ring na 35 %; na Frostu je sám o sobě
       neviditelný, tak pod něj jde 1px Ink obrys, aby focus šel vidět. */
    --shadow-focus: 0 0 0 3px rgba(214, 226, 231, .35), 0 0 0 1px var(--color-brand-synapse-ink);

    /* Motion */
    --t-fast: 120ms cubic-bezier(.4, 0, .2, 1);
    --t-med:  220ms cubic-bezier(.4, 0, .2, 1);

    /* Layout */
    --sidebar-w: 232px;
    --topbar-h:  52px;
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0ms !important;
        transition-duration: 0ms !important;
    }
}

/* =========================================================================
   2. Reset + base
   ========================================================================= */

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

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

body {
    margin: 0;
    font-family: var(--font-sans);
    font-size: var(--text-base);
    line-height: 1.55;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

/* Nadpisy sází Quicksand (max váha Bold 700), prostrkání 0, řádkování 130 %.
   H5 zůstává v Interu — je to popiskový štítek, ne nadpis z type rampy. */
h1, h2, h3, h4 {
    font-family: var(--font-display);
    color: var(--text);
    line-height: 1.3;
    margin: 0;
    letter-spacing: 0;
}
h1 { font-size: var(--text-2xl); font-weight: 700; }
h2 { font-size: var(--text-xl); font-weight: 700; }
h3 { font-size: var(--text-md); font-weight: 600; }
h4 { font-size: var(--text-md); font-weight: 600; }
h5 { margin: 0; line-height: 1.3; font-size: var(--text-sm); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }

p { margin: 0 0 var(--sp-3); }
p:last-child { margin-bottom: 0; }

a { color: var(--brand-600); text-decoration: none; transition: color var(--t-fast); }
a:hover { color: var(--brand); text-decoration: underline; text-underline-offset: 2px; }

code {
    font-family: var(--font-mono);
    font-size: 0.92em;
    background: var(--surface-3);
    color: var(--text);
    padding: 1px 5px;
    border-radius: var(--r-1);
}

pre {
    background: var(--surface-3);
    padding: var(--sp-3) var(--sp-4);
    border-radius: var(--r-2);
    overflow-x: auto;
    font-size: var(--text-xs);
    line-height: 1.5;
    margin: var(--sp-2) 0;
    border: 1px solid var(--border);
}

pre code { background: transparent; padding: 0; }

kbd {
    font-family: var(--font-mono);
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-bottom-width: 2px;
    border-radius: var(--r-1);
    padding: 1px 5px;
    font-size: var(--text-xs);
}

small { font-size: var(--text-xs); }

.dim   { color: var(--muted); }
.muted { color: var(--muted); }
.mono  { font-family: var(--font-mono); }

/* Focus jde přes outline, ne box-shadow: stín ořízne každý předek s overflow: hidden
   (panely, tabulky, zásuvka), takže prstenec na kraji kontejneru mizel. Manuál chce
   3 px focus/ring na 35 %; pod ním 1px Ink obrys, aby byl focus na Frostu vidět. */
:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--focus-ring) 35%, transparent);
    outline-offset: 1px;
    box-shadow: 0 0 0 1px var(--border-ink);
    border-radius: var(--r-1);
}

::selection { background: var(--accent); color: var(--brand); }

/* Zaškrtávátko podle manuálu: 24 × 24, radius/sm, 2px Ink obrys, po zaškrtnutí žlutá
   výplň s Ink fajfkou. Nativní prvek je ~13 px a systémově modrý — kromě značky se tím
   řeší i cíl dotyku (WCAG 2.2 vyžaduje 24 px). Radio zůstává kulaté, jinak stejné. */
input[type="checkbox"],
input[type="radio"] {
    appearance: none;
    -webkit-appearance: none;
    width: 24px;
    height: 24px;
    margin: 0;
    flex: 0 0 auto;
    display: inline-grid;
    place-content: center;
    border: 2px solid var(--border-ink);
    border-radius: var(--radius-sm);
    background: var(--surface-card);
    cursor: pointer;
    transition: background var(--t-fast), border-color var(--t-fast);
}
input[type="radio"] { border-radius: 50%; }

input[type="checkbox"]:checked,
input[type="radio"]:checked {
    background: var(--accent-default);
    border-color: var(--accent-default);
}

input[type="checkbox"]:checked::after {
    content: "";
    width: 11px;
    height: 6px;
    margin-top: -3px;
    border-left: 2.5px solid var(--text-on-accent);
    border-bottom: 2.5px solid var(--text-on-accent);
    transform: rotate(-45deg);
}

input[type="radio"]:checked::after {
    content: "";
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--text-on-accent);
}

input[type="checkbox"]:disabled,
input[type="radio"]:disabled { opacity: .5; cursor: not-allowed; }

input[type="range"] { accent-color: var(--accent-default); }

/* =========================================================================
   3. Page chrome — topbar, main, footer
   Restraint over ornament. Single 52px row, dark teal, never wraps at desktop widths.
   ========================================================================= */

.page {
    min-height: 100dvh;
    display: grid;
    grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
}

/* Right-hand column: topbar + main + footer stacked, content centered inside main. */
.page-col {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 100dvh;
}

/* Skip-link: schovaný, dokud na něj uživatel klávesnice nedojde tabem. */
.skip-link {
    position: absolute;
    left: var(--sp-3);
    top: -100px;
    z-index: 200;
    padding: var(--space-10) var(--space-20);
    background: var(--accent-default);
    color: var(--text-on-accent);
    border-radius: var(--r-pill);
    font-weight: 700;
    text-decoration: none;
    transition: top var(--t-fast);
}
.skip-link:focus-visible { top: var(--sp-3); text-decoration: none; }
.page-main:focus { outline: 0; }

/* Blazor po navigaci programově zaostří <h1> kvůli odečítačům. Není to prvek dosažitelný
   tabulátorem, takže prstenec kolem nadpisu jen mate — indikace patří skutečným zastávkám. */
h1:focus-visible, h2:focus-visible, h3:focus-visible { outline: 0; box-shadow: none; }

/* --- Příručka (/admin/prirucka) ---------------------------------------
   Souvislý text, ne dashboard: jeden sloupec, měřítko řádku pod 70 znaků,
   nadpisy Quicksand jako všude jinde. */
.topbar-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 30px;
    padding: 0 var(--sp-3);
    color: rgba(248, 251, 251, .88);
    font-size: var(--text-sm);
    border-radius: var(--r-pill);
    white-space: nowrap;
}
.topbar-link:hover { color: var(--text-inverse); background: rgba(248, 251, 251, .1); text-decoration: none; }

.handbook-group { margin-bottom: var(--sp-6); }
.handbook-group > h2 { margin: 0 0 var(--sp-3); font-size: var(--text-xl); }

.handbook-list { display: flex; flex-direction: column; gap: 1px; }

.handbook-card {
    display: block;
    padding: var(--sp-3) var(--sp-4);
    background: var(--surface-card);
    color: var(--text-primary);
    border-radius: var(--r-2);
}
.handbook-card:hover { background: var(--surface-subtle); text-decoration: none; }
.handbook-card-title { display: block; font-weight: 600; }
.handbook-card-perex { display: block; margin-top: 2px; color: var(--text-secondary); font-size: var(--text-sm); }

.handbook-body {
    max-width: 68ch;
    padding: var(--sp-5) var(--sp-6);
    background: var(--surface-card);
    border-radius: var(--r-3);
}
.handbook-body h1 { margin: 0 0 var(--sp-2); font-size: var(--text-3xl); }
.handbook-body h2 {
    margin: var(--sp-6) 0 var(--sp-2);
    padding-top: var(--sp-4);
    border-top: 1px solid var(--border-default);
    font-size: var(--text-xl);
}
.handbook-body h3 { margin: var(--sp-4) 0 var(--sp-1); font-size: var(--text-md); }
.handbook-body p, .handbook-body li { line-height: 1.65; }
.handbook-body ul, .handbook-body ol { padding-left: 1.3em; }
.handbook-body li + li { margin-top: 4px; }
.handbook-body blockquote {
    margin: var(--sp-3) 0;
    padding: var(--sp-3) var(--sp-4);
    background: var(--surface-subtle);
    border-radius: var(--r-2);
}
.handbook-body blockquote p:last-child { margin-bottom: 0; }
.handbook-body table { width: 100%; margin: var(--sp-3) 0; border-collapse: collapse; }
.handbook-body th, .handbook-body td {
    padding: 6px var(--sp-2);
    text-align: left;
    border-bottom: 1px solid var(--border-default);
}
.handbook-body code { font-size: .92em; }

/* --- Piktogramy a stavové tečky ---------------------------------------
   Ikona dědí barvu textu a sedí na účaří vedle něj. Žádné emoji: ta si
   prohlížeč vykreslí z barevné emoji sady a v CI2 rozhraní jsou cizí. */
.icon {
    display: inline-block;
    vertical-align: -.16em;
    flex: 0 0 auto;
}
:is(.btn, summary, h1, h2, h3, strong, label) > .icon { vertical-align: -.14em; }

.status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--muted-2);
    vertical-align: .05em;
}
.status-dot--ok   { background: var(--accent-default); box-shadow: 0 0 0 1px var(--accent-contrast); }
.status-dot--down { background: var(--error); }

/* --- Sidebar: primary navigation (dark, grouped, full-height, sticky) --- */
.sidebar {
    position: sticky;
    top: 0;
    align-self: start;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    gap: var(--sp-3);
    padding: var(--sp-3) var(--sp-3) var(--sp-4);
    background: var(--color-synapse-ink-900);
    color: var(--text-inverse);
    overflow-y: auto;
    z-index: 50;
}

.sidebar-brand {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-2);
    height: 40px;
    padding: 0 var(--sp-2);
    color: var(--text-inverse);
    text-decoration: none;
    flex-shrink: 0;
}
.sidebar-brand:hover { text-decoration: none; color: var(--text-inverse); }

/* Logo je dodaný asset — nesází se, nepřekresluje, jen se škáluje.
   Na tmavém shellu jde negativ (Frost křivky). Výška je skutečná výška
   kresby: v SVG je oříznuté prázdno safe zóny, tu tady drží gap a padding. */
.sidebar-brand .brand-logo {
    display: block;
    height: 27px;
    width: auto;
    flex-shrink: 0;
}

.sidebar-brand .brand-mode {
    display: inline-flex;
    align-items: center;
    height: 18px;
    padding: 0 6px;
    margin-left: 2px;
    font-size: var(--text-xs);
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: rgba(248, 251, 251, .7);
    background: rgba(248, 251, 251, .08);
    border-radius: var(--r-pill);
}

/* Grouped nav */
.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: var(--sp-2);
    margin-top: var(--sp-2);
}

.nav-group { display: flex; flex-direction: column; gap: 1px; }

/* Skupina není odkaz — nesmí splývat s položkami. Rozlišuje ji vlas nad skupinou,
   menší a širší sazba a nižší jas; položky jsou naopak větší a světlejší. */
.nav-group + .nav-group {
    margin-top: var(--sp-3);
    padding-top: var(--sp-3);
    border-top: 1px solid rgba(248, 251, 251, .12);
}

.nav-group-label {
    padding: 0 var(--sp-3);
    margin-bottom: var(--sp-1);
    font-size: var(--text-xs);
    font-weight: 600;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: rgba(248, 251, 251, .62);
}

.nav-item {
    display: flex;
    align-items: center;
    height: 34px;
    padding: 0 var(--sp-3);
    color: rgba(248, 251, 251, .88);
    font-size: var(--text-base);
    font-weight: 500;
    border-radius: var(--r-2);
    white-space: nowrap;
    transition: background var(--t-fast), color var(--t-fast);
}
.nav-item:hover {
    color: var(--text-inverse);
    background: rgba(248, 251, 251, .08);
    text-decoration: none;
}

/* Stav volitelné domény, která je zapojená, ale vypnutá. Slovo, ne tečka: tečku by si každý vyložil
   po svém (zakázáno? rozbité? nové?). Drží podlahu 14 px, jen ztlumené — je to údaj, ne varování,
   takže sem nepatří ani žlutá, ani červená. */
.nav-flag {
    margin-left: auto;
    padding-left: var(--sp-2);
    font-size: var(--text-xs);
    font-weight: 500;
    color: rgba(248, 251, 251, .55);
}
.nav-item:hover .nav-flag,
.nav-item.active .nav-flag { color: rgba(248, 251, 251, .75); }
.nav-item.active {
    color: var(--text-inverse);
    background: rgba(248, 251, 251, .13);
    font-weight: 600;
    box-shadow: inset 3px 0 0 var(--accent);
}

/* --- Topbar: slim utility bar above the content column --- */
.topbar {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    height: var(--topbar-h);
    padding: 0 var(--sp-5);
    background: var(--color-synapse-ink-950);
    color: var(--text-inverse);
    position: sticky;
    top: 0;
    z-index: 40;
    box-shadow: 0 1px 0 rgba(0, 0, 0, .12);
}

.topbar-spacer { flex: 1 1 auto; min-width: 0; }

/* Hamburger — drawer toggle, shown only on narrow screens */
.nav-burger {
    display: none;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    color: var(--text-inverse);
    cursor: pointer;
    border: 1px solid rgba(248, 251, 251, .14);
    background: rgba(248, 251, 251, .06);
    border-radius: var(--r-2);
    transition: background var(--t-fast);
}
.nav-burger:hover { background: rgba(248, 251, 251, .12); }

/* Drawer mechanism — visually-hidden checkbox; inert on desktop, activated by the media query below */
.nav-toggle-cb {
    position: absolute;
    width: 1px; height: 1px;
    margin: -1px; padding: 0; border: 0;
    clip: rect(0 0 0 0);
    overflow: hidden;
}
.sidebar-scrim { display: none; }

/* --- Right cluster (tenant switcher + user + sign-out) --- */
.topbar-right {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    flex-shrink: 0;
}

/* Tenant switcher styled as a flat button with native select underneath */
.tenant-switch {
    position: relative;
    display: inline-flex;
    align-items: center;
    height: 32px;
    padding: 0 28px 0 30px;
    background: rgba(248, 251, 251, .08);
    border: 1px solid rgba(248, 251, 251, .12);
    border-radius: var(--r-2);
    color: var(--text-inverse);
    font-size: var(--text-xs);
    cursor: pointer;
    max-width: 220px;
    transition: background var(--t-fast), border-color var(--t-fast);
}

.tenant-switch:hover {
    background: rgba(248, 251, 251, .12);
    border-color: rgba(248, 251, 251, .2);
}

.tenant-switch-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(248, 251, 251, .65);
    pointer-events: none;
}

.tenant-switch-chevron {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(248, 251, 251, .65);
    pointer-events: none;
}

.tenant-switch select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background: transparent;
    border: 0;
    color: var(--text-inverse);
    font: inherit;
    font-size: var(--text-xs);
    font-weight: 500;
    padding: 0;
    cursor: pointer;
    outline: none;
    width: 100%;
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
}

.tenant-switch select:focus-visible {
    outline: 2px solid var(--brand-500);
    outline-offset: 2px;
}

.tenant-switch select option { color: var(--text); background: var(--surface); }

/* Divider between tenant switcher and user cluster */
.topbar-divider {
    width: 1px;
    height: 24px;
    background: rgba(248, 251, 251, .14);
    margin: 0 var(--sp-1);
}

/* User cluster */
.topbar-user {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-2);
    padding: 0 var(--sp-1) 0 0;
    cursor: default;
}

.user-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: var(--accent-default);
    color: var(--text-on-accent);
    border-radius: 50%;
    font-size: var(--text-xs);
    font-weight: 600;
    text-transform: uppercase;
    flex-shrink: 0;
}

.user-email {
    color: rgba(248, 251, 251, .85);
    font-size: var(--text-xs);
    font-weight: 500;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Sign out as icon button — minimal, grouped near user */
.sign-out-form { display: inline-flex; }

.sign-out-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: transparent;
    color: rgba(248, 251, 251, .55);
    border: 1px solid transparent;
    border-radius: var(--r-2);
    cursor: pointer;
    font-family: inherit;
    transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast);
    padding: 0;
}

.sign-out-btn:hover {
    background: rgba(248, 251, 251, .08);
    color: var(--text-inverse);
    border-color: rgba(248, 251, 251, .12);
}

.sign-out-btn svg { display: block; }

/* --- Main + footer --- */
.page-main {
    flex: 1;
    padding: var(--sp-8) var(--sp-6);
    max-width: 1240px;
    width: 100%;
    margin: 0 auto;
}

.page-footer {
    padding: var(--sp-4) var(--sp-6);
    background: var(--color-synapse-ink-950);
    color: rgba(248, 251, 251, .6);
    font-size: var(--text-xs);
    text-align: center;
}

.page-footer a { color: rgba(248, 251, 251, .8); }
.page-footer a:hover { color: var(--text-inverse); }

/* Page intro */
.page-intro {
    display: flex;
    flex-direction: column;
    gap: var(--sp-3);
    margin-bottom: var(--sp-6);
}

.page-intro h1 { margin: 0; }

/* Perex je jedna věta o tom, k čemu stránka je. Delší výklad patří do <HelpBox>,
   ne do hlavičky — hlavička se čte pokaždé, nápověda jen když je potřeba. */
.page-intro .intro-lead {
    margin: 0;
    color: var(--text-secondary);
    font-size: var(--text-md);
    max-width: 72ch;
    line-height: 1.5;
}

.page-intro .help-box { margin: 0; }

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--muted);
    font-size: var(--text-xs);
    font-weight: 500;
}

.back-link:hover { color: var(--brand); text-decoration: none; }

/* =========================================================================
   4. Buttons — unified .btn family
   ========================================================================= */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px var(--space-24);
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border-strong);
    border-radius: var(--r-pill);
    cursor: pointer;
    font-family: inherit;
    font-size: var(--text-base);
    font-weight: 700;
    line-height: 1.3;
    transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast), transform var(--t-fast);
    text-decoration: none;
    min-height: 41px;
}

.btn:hover:not(:disabled) {
    background: var(--surface-3);
    border-color: var(--muted-2);
    text-decoration: none;
}

.btn:active:not(:disabled) { transform: scale(0.98); }

.btn:disabled {
    opacity: .55;
    cursor: not-allowed;
}

/* Primary = žlutá výplň + Ink text (manuál §5). Hover jde na accent/hover. */
.btn.btn-primary {
    background: var(--accent-default);
    color: var(--text-on-accent);
    border-color: var(--accent-default);
}

.btn.btn-primary:hover:not(:disabled) {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
    color: var(--text-on-accent);
}

/* Secondary = bez výplně, Ink obrys; hover se vyplní žlutou. */
.btn.btn-secondary {
    background: transparent;
    color: var(--text-primary);
    border-color: var(--border-ink);
}

.btn.btn-secondary:hover:not(:disabled) {
    background: var(--accent-default);
    border-color: var(--accent-default);
    color: var(--text-on-accent);
}

/* Solid = obrácená plocha (Ink) + Frost text; hover taky na žlutou. */
.btn.btn-solid {
    background: var(--surface-inverse);
    color: var(--text-inverse);
    border-color: var(--surface-inverse);
}

.btn.btn-solid:hover:not(:disabled) {
    background: var(--accent-default);
    border-color: var(--accent-default);
    color: var(--text-on-accent);
}

.btn.btn-ghost {
    background: transparent;
    color: var(--muted);
    border-color: transparent;
}

.btn.btn-ghost:hover:not(:disabled) {
    background: var(--surface-3);
    color: var(--text);
}

.btn.btn-danger {
    background: var(--error);
    color: var(--text-inverse);
    border-color: var(--error);
}

.btn.btn-danger:hover:not(:disabled) {
    background: #9E2222;
    border-color: #9E2222;
    color: var(--text-inverse);
}

/* Ztlumené „smazat" pro řádek tabulky. Plná červená je pro potvrzení nevratného kroku, ne pro
   nabídku u každého řádku — pět takových tlačítek pod sebou přebije obsah, kvůli kterému tam
   uživatel je. Barva se ohlásí až na hoveru; potvrzovací „Ano" zůstává plné. */
.btn.btn-danger.btn-quiet {
    background: transparent;
    color: var(--error);
    border-color: transparent;
}

.btn.btn-danger.btn-quiet:hover:not(:disabled) {
    background: var(--error-50);
    border-color: var(--error-border);
    color: var(--error);
}

.btn.btn-sm {
    padding: 6px var(--space-16);
    font-size: var(--text-sm);
    min-height: 34px;
}

/* =========================================================================
   5. Forms
   ========================================================================= */

.form-row { margin-bottom: var(--sp-4); }

.form-row label {
    display: block;
    font-weight: 600;
    margin-bottom: var(--sp-1);
    font-size: var(--text-xs);
    color: var(--text-2);
    text-transform: uppercase;
    letter-spacing: .04em;
}

/* Ne výčet typů: <input> bez atributu type (výchozí text) do něj nespadal a zůstával
   nenastylovaný — vyjmenují se tedy jen prvky, které se stylovat NEMAJÍ. */
.form-row input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="range"]),
.form-row textarea,
.form-row select {
    width: 100%;
    padding: 8px var(--sp-3);
    border: 1px solid var(--border-default);
    border-radius: var(--r-pill);
    font-size: var(--text-base);
    font-family: inherit;
    background: var(--surface-input);
    color: var(--text);
    transition: border-color var(--t-fast), box-shadow var(--t-fast);
}

/* Textarea není pill — víceřádkové pole s poloměrem 999px se nedá číst. */
.form-row textarea { border-radius: var(--r-2); }

.form-row input:focus,
.form-row textarea:focus,
.form-row select:focus {
    outline: 0;
    border-color: var(--border-ink);
    background: var(--surface-input-focus);
    box-shadow: var(--shadow-focus);
}

.form-row input:disabled,
.form-row textarea:disabled {
    background: var(--surface-3);
    color: var(--muted);
    cursor: not-allowed;
}

.form-row textarea {
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    line-height: 1.5;
    resize: vertical;
}

/* Hodnota, která se nevybírá — modul tenanta (uploader, real-time adaptér). Vypadá jako údaj,
   ne jako vypnuté pole: vypnutý input by sliboval, že jde někde zapnout. Podklad ani obrys
   nepotřebuje, hierarchii nese label nad ním. */
.form-row .module-value {
    margin: 0;
    padding: 8px 0;
    font-size: var(--text-base);
    color: var(--text);
}

.form-row small.dim,
.form-row .form-hint {
    display: block;
    margin-top: var(--sp-1);
    font-size: var(--text-xs);
    color: var(--muted);
    text-transform: none;
    font-weight: 400;
    letter-spacing: 0;
}

.form-row.two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--sp-4);
}

@media (max-width: 640px) {
    .form-row.two-col { grid-template-columns: 1fr; }
}

.form-row.inline-check label {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    text-transform: none;
    letter-spacing: 0;
    font-size: var(--text-sm);
    color: var(--text);
    font-weight: 400;
}

.form-actions {
    display: flex;
    gap: var(--sp-2);
    margin-top: var(--sp-6);
    padding-top: var(--sp-4);
    border-top: 1px solid var(--border);
}

/* Section divider inside a long form (e.g. TenantEdit "Rate limits" group). */
.form-section-head {
    margin: var(--sp-6) 0 var(--sp-1);
    padding-top: var(--sp-4);
    border-top: 1px solid var(--border);
    font-size: var(--text-md);
    font-weight: 600;
    color: var(--text);
}

.form-section-sub {
    margin: 0 0 var(--sp-4);
    color: var(--muted);
    font-size: var(--text-xs);
    line-height: 1.55;
}

/* Narrow column for long settings forms — full-width inputs across 1240px read badly. */
.settings-col { max-width: 820px; }

/* --- HelpBox: collapsible per-section documentation (Components/HelpBox.razor).
       Closed = one quiet pill line; open = bordered callout. --- */
.help-box { margin: 0 0 var(--sp-4); }

.help-box > summary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    list-style: none;
    cursor: pointer;
    user-select: none;
    font-size: var(--text-xs);
    font-weight: 500;
    color: var(--muted);
    padding: 3px 10px;
    border-radius: var(--r-pill);
    border: 1px solid var(--border);
    background: var(--surface);
    transition: color var(--t-fast), background var(--t-fast), border-color var(--t-fast);
}

.help-box > summary::-webkit-details-marker { display: none; }

.help-box > summary:hover {
    color: var(--brand-600);
    background: var(--surface-2);
    border-color: var(--border-strong);
}

.help-box[open] > summary {
    color: var(--brand-600);
    border-color: var(--brand-500);
}

.help-box > summary svg { flex: 0 0 auto; }

.help-box-body {
    margin-top: var(--sp-2);
    padding: var(--sp-3) var(--sp-4);
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-left: 3px solid var(--brand-500);
    border-radius: var(--r-2);
    font-size: var(--text-sm);
    color: var(--text-2);
    line-height: 1.6;
}

.help-box-body p { margin: 0 0 var(--sp-2); }
.help-box-body p:last-child { margin-bottom: 0; }

/* Term list — the scannable "what does this field mean" format. */
.help-box-body dl {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: var(--sp-1) var(--sp-3);
    margin: var(--sp-2) 0 0;
}

.help-box-body dt { font-weight: 600; color: var(--text); }
.help-box-body dd { margin: 0; }

@media (max-width: 640px) {
    .help-box-body dl { grid-template-columns: 1fr; gap: 0; }
    .help-box-body dd { margin-bottom: var(--sp-2); }
}

/* --- Sticky save bar for multi-panel forms: actions + result banner travel with the user. --- */
.form-actions-sticky {
    position: sticky;
    bottom: var(--sp-3);
    z-index: 20;
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    padding: var(--sp-3) var(--sp-4);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-3);
    box-shadow: var(--shadow-md);
    margin-bottom: var(--sp-5);
}

.form-actions-sticky .status-banner {
    flex: 1;
    margin: 0;
    padding: 6px var(--sp-3);
}

/* =========================================================================
   6. Panels
   ========================================================================= */

.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-3);
    margin-bottom: var(--sp-5);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.panel-header,
.panel-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-3);
    padding: var(--sp-3) var(--sp-5);
    border-bottom: 1px solid var(--border);
    background: var(--surface);
}

.panel-header h2,
.panel-head h2 {
    margin: 0;
    font-size: var(--text-md);
    font-weight: 600;
}

.panel-header .panel-sub,
.panel-head .dim {
    color: var(--muted);
    font-size: var(--text-xs);
    margin-top: 2px;
}

.panel-body {
    padding: var(--sp-5);
}

/* Collapsible panel (<details class="panel panel-collapse">) — for rarely-touched sections. */
details.panel-collapse > summary { cursor: pointer; user-select: none; list-style: none; }
details.panel-collapse > summary::-webkit-details-marker { display: none; }

details.panel-collapse > summary::after {
    content: "▸";
    color: var(--muted);
    font-size: var(--text-lg);
    line-height: 1;
    margin-left: auto;
    transition: transform var(--t-fast);
}

details.panel-collapse[open] > summary::after { transform: rotate(90deg); }
details.panel-collapse:not([open]) > summary { border-bottom: none; }
details.panel-collapse > summary:hover h2 { color: var(--brand-600); }

.panel-body.flush { padding: 0; }

.panel-footer {
    padding: var(--sp-3) var(--sp-5);
    border-top: 1px solid var(--border);
    background: var(--surface-2);
    font-size: var(--text-xs);
    color: var(--muted);
}

.panel-body ul {
    margin: var(--sp-2) 0;
    padding-left: var(--sp-5);
}

.panel-body ul li { margin: var(--sp-1) 0; }

/* =========================================================================
   7. Tables (compare)
   ========================================================================= */

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

.panel-body.flush table.compare { border: 0; border-radius: 0; }

.table-scroll {
    max-height: 70vh;
    overflow: auto;
}

.table-scroll table.compare {
    border: 0;
    border-radius: 0;
}

.table-scroll table.compare thead th {
    position: sticky;
    top: 0;
    background: var(--surface-2);
    z-index: 1;
    box-shadow: inset 0 -1px 0 var(--border);
}

table.compare th,
table.compare td {
    padding: var(--sp-3) var(--sp-4);
    text-align: left;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}

table.compare tr:last-child th,
table.compare tr:last-child td { border-bottom: 0; }

table.compare th {
    background: var(--surface-2);
    color: var(--brand);
    font-weight: 600;
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: .04em;
}

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

table.compare tbody tr:hover { background: var(--brand-50); }

table.compare td.numeric,
table.compare th.numeric {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

table.compare td.mono,
table.compare th.mono {
    font-family: var(--font-mono);
    font-size: var(--text-xs);
}

table.compare td a { color: var(--text); }
table.compare td a:hover { color: var(--brand-600); }

table.compare td.dim { color: var(--muted); }

table.compare .ok  { color: var(--success); font-weight: 600; }
table.compare .bad { color: var(--error);   font-weight: 600; }

/* =========================================================================
   8. Toolbar + filter chips
   ========================================================================= */

.toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--sp-3);
    padding: var(--sp-3) var(--sp-5);
    border-bottom: 1px solid var(--border);
    background: var(--surface-2);
}

.toolbar .toolbar-search {
    flex: 1 1 220px;
    max-width: 320px;
}

.toolbar .toolbar-search input {
    width: 100%;
    padding: 7px var(--sp-3);
    font-size: var(--text-sm);
    border: 1px solid var(--border-strong);
    border-radius: var(--r-2);
    background: var(--surface-card);
    color: var(--text);
    font-family: inherit;
}

.toolbar .toolbar-search input:focus {
    outline: 0;
    border-color: var(--brand-500);
    box-shadow: var(--shadow-focus);
}

.filter-group {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 2px;
    background: var(--surface-card);
    border: 1px solid var(--border-strong);
    border-radius: var(--r-pill);
}

.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 26px;
    padding: var(--space-4) var(--space-12);
    font-size: var(--text-xs);
    font-weight: 500;
    color: var(--text-2);
    background: transparent;
    border: 0;
    border-radius: var(--r-pill);
    cursor: pointer;
    font-family: inherit;
    transition: background var(--t-fast), color var(--t-fast);
}

.filter-chip:hover { background: var(--surface-2); }

.filter-chip.active {
    background: var(--surface-inverse);
    color: var(--text-inverse);
}

.filter-chip .count {
    font-variant-numeric: tabular-nums;
    opacity: .75;
    font-size: var(--text-xs);
}

.filter-chip.active .count { opacity: .9; }

.toolbar-meta {
    color: var(--muted);
    font-size: var(--text-xs);
    margin-left: auto;
}

/* =========================================================================
   9. Badges + pills
   ========================================================================= */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    min-height: 22px;
    padding: 2px var(--space-10);
    border-radius: var(--r-pill);
    font-size: var(--text-xs);
    font-weight: 500;
    line-height: 1.4;
    background: var(--surface-3);
    color: var(--text-2);
    border: 1px solid transparent;
    white-space: nowrap;
}

.badge.subtle           { background: var(--surface-3); color: var(--text-2); }
/* Badge/Accent z manuálu: žlutý obrys, ale text zůstává Ink — žlutý text na světlém
   neprojde. Používá se na VÝJIMKU, ne na běžný stav: když je zvýrazněný každý řádek,
   zvýraznění nenese informaci. */
.badge.attention        { background: transparent; color: var(--text); border-color: var(--accent-contrast); }
.badge.quality-good     { background: var(--success-50); color: var(--success); }
.badge.confidence-high  { background: var(--success-50); color: var(--success); }
.badge.confidence-low   { background: var(--error-50); color: var(--error); }
.badge.confidence-medium-low { background: var(--warn-50); color: var(--warn); }

/* =========================================================================
   10. Metric tiles
   ========================================================================= */

.metric-tiles {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: var(--sp-3);
    margin-top: var(--sp-2);
    margin-bottom: var(--sp-5); /* separate the dashboard strip from the panel below (matches .panel rhythm) */
}

/* In-panel stat strips (validation/test results) stay compact — they're followed by more content, not a new panel. */
.diff-block .metric-tiles { margin-bottom: var(--sp-3); }

.metric-tile {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-2);
    padding: var(--sp-3) var(--sp-4);
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.metric-tile .metric-label {
    font-size: var(--text-xs);
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .05em;
    font-weight: 600;
}

.metric-tile .metric-value {
    font-size: var(--text-xl);
    font-weight: 600;
    color: var(--text);
    line-height: 1.2;
    font-variant-numeric: tabular-nums;
}

.metric-tile .metric-sub {
    font-size: var(--text-xs);
    color: var(--muted);
    margin-top: 2px;
}

.metric-tile.accent  { border-left-color: var(--brand-500); }
.metric-tile.success { border-left-color: var(--success); }
.metric-tile.warn    { border-left-color: var(--warn-line); }
.metric-tile.error   { border-left-color: var(--error); }

/* =========================================================================
   11. Banners + status
   ========================================================================= */

.info-banner,
.error-banner,
.status-banner {
    display: flex;
    align-items: flex-start;
    gap: var(--sp-3);
    padding: var(--sp-3) var(--sp-4);
    border-radius: var(--r-2);
    border: 1px solid transparent;
    margin-bottom: var(--sp-4);
    font-size: var(--text-sm);
    line-height: 1.5;
}

.info-banner {
    background: var(--brand-50);
    color: var(--brand-700);
    border-color: var(--border-default);
}

.info-banner code {
    background: var(--surface-card);
    color: var(--brand);
    border: 1px solid var(--border-default);
}

.error-banner {
    background: var(--error-50);
    color: var(--error);
    border-color: var(--error-border);
    white-space: pre-wrap;
}

.status-banner.status-info    { background: var(--brand-50); color: var(--brand-700); border-color: var(--border-default); }
.status-banner.status-success { background: var(--success-50); color: var(--success); border-color: var(--border-default); }
.status-banner.status-error   { background: var(--error-50); color: var(--error); border-color: var(--error-border); }
.status-banner.status-warn    { background: var(--warn-50); color: var(--warn); border-color: var(--color-signal-yellow-300); }

.note-box {
    background: var(--accent-50);
    border-left: 3px solid var(--accent);
    padding: var(--sp-3) var(--sp-4);
    border-radius: 0 var(--r-2) var(--r-2) 0;
    margin-top: var(--sp-3);
    font-size: var(--text-sm);
    line-height: 1.55;
}

.note-box code { background: var(--surface-card); }

/* =========================================================================
   12. Empty state
   ========================================================================= */

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: var(--sp-2);
    padding: var(--sp-12) var(--sp-6);
    color: var(--muted);
}

.empty-state .empty-title {
    color: var(--text);
    font-weight: 600;
    font-size: var(--text-md);
}

.empty-state .empty-sub {
    font-size: var(--text-sm);
    max-width: 44ch;
    line-height: 1.55;
}

/* =========================================================================
   13. Decision dots
   ========================================================================= */

.decision-dots {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-variant-numeric: tabular-nums;
    font-size: var(--text-xs);
    color: var(--muted);
}

.decision-dots .dot {
    display: inline-flex;
    align-items: baseline;
    gap: 3px;
    color: var(--text-2);
}

.decision-dots .dot::before {
    content: "";
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
    flex-shrink: 0;
    transform: translateY(-1px);
}

.decision-dots .dot.zero    { color: var(--muted-2); }
.decision-dots .dot.confirm { color: var(--success); }
.decision-dots .dot.fill    { color: var(--brand-500); }
.decision-dots .dot.flag    { color: var(--warn-line); }
.decision-dots .dot.abstain { color: var(--muted-2); }

/* =========================================================================
   14. Route catalog + timetable
   ========================================================================= */

.route-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 26px;
    padding: 0 var(--sp-2);
    background: var(--line-bus);
    color: var(--text-inverse);
    border-radius: var(--r-2);
    font-weight: 700;
    font-size: var(--text-sm);
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.01em;
}

.route-pill.trol { background: var(--line-trol); }
.route-pill.tram { background: var(--color-synapse-ink-500); }

/* Timetable editions (provenance) */
.edition-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: var(--sp-2);
}

.edition-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--sp-2);
}

.edition-meta {
    font-size: var(--text-sm);
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}

.edition-validity {
    margin-left: auto;
    font-size: var(--text-sm);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

/* Route detail header */
.route-head {
    display: flex;
    align-items: center;
    gap: var(--sp-4);
    margin-top: var(--sp-2);
}

.route-head .route-pill {
    min-width: 64px;
    height: 56px;
    font-size: var(--text-2xl);
    border-radius: var(--r-3);
    box-shadow: var(--shadow-sm);
}

.route-head-meta { display: flex; flex-direction: column; gap: var(--sp-1); min-width: 0; }
.route-head-meta h1 { font-size: var(--text-xl); margin: 0; }
.route-head-meta .route-subtitle {
    margin: 0;
    color: var(--muted);
    font-size: var(--text-sm);
}
.route-head-meta .route-subtitle strong {
    font-variant-numeric: tabular-nums;
    color: var(--text-2);
}

/* Stops in sequence */
.stop-sequence {
    list-style: none;
    margin: 0;
    padding: 0;
    position: relative;
}

.stop-step {
    position: relative;
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    padding: var(--sp-2) 0 var(--sp-2) var(--sp-5);
}

.stop-step::before {
    content: "";
    position: absolute;
    left: 11px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border-strong);
}

.stop-step.first::before { top: 50%; }
.stop-step.last::before  { bottom: 50%; }

.stop-dot {
    position: absolute;
    left: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--surface);
    border: 2px solid var(--brand-500);
    z-index: 1;
}

.stop-step.first .stop-dot,
.stop-step.last .stop-dot {
    background: var(--brand);
    border-color: var(--brand);
    width: 14px;
    height: 14px;
    left: 5px;
}

.stop-link {
    display: inline-flex;
    align-items: baseline;
    gap: var(--sp-2);
    color: var(--text);
    font-weight: 500;
    transition: color var(--t-fast);
}

.stop-link:hover {
    color: var(--brand-600);
    text-decoration: none;
}

.stop-link .stop-name { font-size: var(--text-sm); }

.stop-link .stop-city {
    font-size: var(--text-xs);
    color: var(--muted);
    background: var(--surface-3);
    padding: 1px 6px;
    border-radius: var(--r-1);
    font-family: var(--font-mono);
}

/* Day-of-week chips on timetable header */
.day-chips {
    display: inline-flex;
    gap: 4px;
}

.day-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 26px;
    height: 22px;
    padding: 0 6px;
    font-size: var(--text-xs);
    font-weight: 600;
    border-radius: var(--r-1);
    text-transform: uppercase;
    letter-spacing: .02em;
}

.day-chip.on  { background: var(--surface-inverse); color: var(--text-inverse); }
.day-chip.off { background: var(--surface-3); color: var(--muted); }

/* Timetable table — stops as rows, trips as columns */
table.timetable {
    border-collapse: collapse;
    width: 100%;
    font-size: var(--text-sm);
}

table.timetable th,
table.timetable td {
    padding: 6px var(--sp-3);
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

table.timetable thead th {
    background: var(--surface-2);
    color: var(--brand);
    font-weight: 600;
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: .04em;
    position: sticky;
    top: 0;
    z-index: 1;
    box-shadow: inset 0 -1px 0 var(--border);
}

table.timetable .stop-col {
    text-align: left;
    min-width: 200px;
    position: sticky;
    left: 0;
    background: var(--surface);
    z-index: 2;
    border-right: 1px solid var(--border);
}

table.timetable thead .stop-col {
    background: var(--surface-2);
    z-index: 3;
}

table.timetable tbody tr:hover .stop-col { background: var(--brand-50); }
table.timetable tbody tr:hover td        { background: var(--brand-50); }

table.timetable .stop-row-name { font-weight: 500; color: var(--text); }

table.timetable .time-col {
    text-align: center;
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    font-size: var(--text-xs);
    color: var(--text-2);
    min-width: 52px;
}

table.timetable .time-col.empty {
    color: var(--muted);
    font-style: normal;
}

table.timetable .time-col.pass {
    color: var(--muted);
    font-style: italic;
}

table.timetable .time-col.origin   { color: var(--success); font-weight: 600; }
table.timetable .time-col.terminus { color: var(--brand); font-weight: 600; }

/* =========================================================================
   14b. Search debug page (/admin/search)
   ========================================================================= */

/* Form panel */
.search-form-panel .panel-body { padding: var(--sp-4) var(--sp-5) var(--sp-3); }

/* The stop typeahead opens an absolute overlay (StopAutocomplete Overlay=true); let it escape the panel,
   which is otherwise overflow:hidden. Safe here — the form paints nothing into the panel's rounded corners. */
.search-form-panel { overflow: visible; }

.search-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 200px auto;
    gap: var(--sp-3);
    align-items: end;
}

.search-form-grid .form-row { margin-bottom: 0; }
.search-form-grid .search-actions .btn { width: 100%; min-height: 40px; }

.search-form-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--sp-4);
    padding-top: var(--sp-3);
    margin-top: var(--sp-3);
    border-top: 1px solid var(--border);
}

.quick-times {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
}

.quick-times .quick-label {
    font-size: var(--text-xs);
    color: var(--muted);
    margin-right: 4px;
}

.examples { margin-left: auto; }
.examples > summary {
    cursor: pointer;
    list-style: none;
    color: var(--brand-600);
    font-size: var(--text-xs);
    user-select: none;
    padding: 4px var(--sp-2);
    border-radius: var(--r-1);
}
.examples > summary::-webkit-details-marker { display: none; }
.examples > summary:hover { background: var(--surface-2); }

.example-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: var(--sp-2);
    padding: var(--sp-2) var(--sp-3);
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--r-2);
}

.example-chip {
    background: var(--brand-50);
    color: var(--brand-700);
    padding: 4px var(--sp-2);
    border-radius: var(--r-pill);
    border: 0;
    cursor: pointer;
    font-size: var(--text-xs);
    font-family: inherit;
    font-weight: 500;
    transition: background var(--t-fast);
}

.example-chip:hover { background: var(--accent-default); color: var(--text-on-accent); border-color: var(--accent-default); }

/* Result banner — sits above the itinerary card */
.result-banner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--sp-4);
    padding: var(--sp-4) var(--sp-5);
    margin-bottom: var(--sp-4);
    background: linear-gradient(135deg, var(--brand-50) 0%, var(--surface-card) 100%);
    border: 1px solid var(--border-default);
    border-radius: var(--r-3);
}

.result-banner-main {
    display: flex;
    align-items: baseline;
    gap: var(--sp-3);
    flex-wrap: wrap;
}

.result-banner-time {
    font-family: var(--font-mono);
    font-size: var(--text-2xl);
    font-variant-numeric: tabular-nums;
    color: var(--brand);
    letter-spacing: -0.02em;
}

.result-banner-time .arrow { color: var(--muted); margin: 0 4px; font-weight: 400; }

.result-banner-dur {
    background: var(--brand);
    color: var(--text-inverse);
    padding: 4px var(--sp-3);
    border-radius: var(--r-pill);
    font-size: var(--text-sm);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.result-banner-meta {
    color: var(--text-2);
    font-size: var(--text-sm);
}

.result-banner-divergence {
    margin-left: auto;
    font-size: var(--text-xs);
}

.result-banner-date {
    margin-left: auto;
    color: var(--muted);
    font-size: var(--text-xs);
    text-transform: capitalize;
}

/* Itinerary timeline */
.itinerary-timeline {
    display: flex;
    flex-direction: column;
    gap: 0;
    position: relative;
}

/* Stop marker rows */
.ti-stop {
    display: grid;
    grid-template-columns: 56px 24px 1fr;
    align-items: center;
    column-gap: var(--sp-3);
    padding: var(--sp-2) 0;
    position: relative;
}

.ti-time {
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text);
    text-align: right;
}

.ti-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--surface);
    border: 2px solid var(--brand-500);
    justify-self: center;
    position: relative;
    z-index: 1;
}

.ti-dot.dot-origin {
    background: var(--brand);
    border-color: var(--brand);
    width: 16px;
    height: 16px;
}

.ti-dot.dot-terminus {
    background: var(--success);
    border-color: var(--success);
    width: 16px;
    height: 16px;
}

.ti-dot.dot-stop { background: var(--surface); border-color: var(--brand-500); }

.ti-stop-body {
    display: inline-flex;
    align-items: baseline;
    gap: var(--sp-2);
    flex-wrap: wrap;
}

.ti-stop-body strong {
    font-size: var(--text-sm);
    color: var(--text);
    font-weight: 600;
}

.ti-stop-tag {
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: .06em;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: var(--r-1);
    background: var(--surface-3);
    color: var(--muted);
}

.ti-stop-tag.terminus { background: var(--success-50); color: var(--success); }
.ti-stop-tag.transfer { background: var(--accent-soft); color: var(--accent-contrast); }

/* Leg row (between stop markers) */
.ti-leg,
.ti-transfer-panel {
    display: grid;
    grid-template-columns: 56px 24px minmax(0, 1fr);
    column-gap: var(--sp-3);
    align-items: stretch;
}

.ti-leg-rail {
    grid-column: 2;
    width: 2px;
    background: var(--border-strong);
    justify-self: center;
    min-height: 24px;
}

.ti-leg.ride .ti-leg-rail { background: var(--brand-500); }
.ti-leg.walk .ti-leg-rail { background: repeating-linear-gradient(to bottom, var(--muted-2) 0 4px, transparent 4px 8px); }

.ti-leg-body {
    grid-column: 3;
    padding: var(--sp-2) var(--sp-3);
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-left: 3px solid var(--brand-500);
    border-radius: var(--r-2);
    margin: var(--sp-1) 0;
}

.ti-leg.walk .ti-leg-body {
    background: var(--surface-3);
    border-left-color: var(--muted-2);
    border-style: dashed;
}

.ti-leg-headline {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--sp-2);
    font-size: var(--text-sm);
}

.ti-leg-dir { color: var(--text); }
.ti-leg-dir strong { font-weight: 600; }

.ti-leg-meta {
    display: flex;
    flex-wrap: wrap;
    gap: var(--sp-3);
    margin-top: 4px;
    font-size: var(--text-xs);
    color: var(--muted);
}

.ti-leg-meta code { background: var(--surface); }

.walk-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--surface-3);
    color: var(--text-2);
    padding: 2px var(--sp-2);
    border-radius: var(--r-pill);
    font-size: var(--text-xs);
    font-weight: 600;
}

/* Transfer reasoning panel */
.ti-transfer-panel { margin: 2px 0; }
.ti-transfer-panel .ti-leg-rail {
    grid-column: 2;
    background: var(--accent);
    width: 4px;
}

.ti-transfer-body {
    grid-column: 3;
    min-width: 0;
    padding: var(--sp-2) var(--sp-3);
    background: var(--accent-50);
    border: 1px solid var(--color-signal-yellow-200);
    border-radius: var(--r-2);
    margin: var(--sp-1) 0;
}

.ti-transfer-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--sp-2);
    font-size: var(--text-sm);
    color: var(--text);
}

.ti-transfer-comfort {
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    color: var(--warn);
    font-weight: 600;
    font-size: var(--text-xs);
}

.ti-transfer-reason-inline {
    color: var(--text-2);
    font-size: var(--text-xs);
    flex: 1 1 100%;
    line-height: 1.5;
    margin-top: 2px;
}

.ti-transfer-alts {
    min-width: 0;
    margin-top: var(--sp-2);
    padding-top: var(--sp-2);
    border-top: 1px dashed var(--color-signal-yellow-200);
}

.ti-transfer-alts > summary {
    cursor: pointer;
    list-style: none;
    color: var(--brand-700);
    font-size: var(--text-xs);
    font-weight: 600;
    padding: 2px 0;
    user-select: none;
}
.ti-transfer-alts > summary::-webkit-details-marker { display: none; }
.ti-transfer-alts > summary::before {
    content: "▸ ";
    color: var(--muted);
    font-size: var(--text-xs);
    margin-right: 2px;
    transition: transform 0.1s;
    display: inline-block;
}
.ti-transfer-alts[open] > summary::before {
    transform: rotate(90deg);
    transform-origin: 4px 50%;
}

.alts-table-scroll {
    width: 100%;
    min-width: 0;
    margin-top: var(--sp-2);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-inline: contain;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-1);
}

.alts-table-scroll:focus-visible {
    outline: 2px solid var(--brand-500);
    outline-offset: 2px;
}

.alts-table {
    width: 100%;
    min-width: 480px;
    border-collapse: collapse;
    font-size: var(--text-xs);
    background: var(--surface);
}

.alts-table th, .alts-table td {
    padding: 6px var(--sp-2);
    border-bottom: 1px solid var(--border);
    text-align: left;
}

.alts-table tr:last-child td { border-bottom: 0; }

.alts-table th {
    background: var(--surface-2);
    color: var(--brand);
    font-weight: 600;
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: .04em;
}

.alts-table tr.chosen { background: var(--success-50); }
.alts-table td.numeric, .alts-table th.numeric { text-align: right; font-variant-numeric: tabular-nums; }

/* Alternative-connections list (next-N) */
.alts-list .route-line-chain {
    display: inline-block;
    font-family: var(--font-mono);
    color: var(--brand);
    background: var(--brand-50);
    padding: 2px 6px;
    border-radius: var(--r-1);
    font-size: var(--text-xs);
    font-weight: 600;
}

/* =========================================================================
   15. Stop dossier + enrichment
   ========================================================================= */

.enrichment-grid {
    display: grid;
    grid-template-columns: minmax(280px, 1fr) 1.4fr;
    gap: var(--sp-5);
}

.enrichment-images {
    display: flex;
    flex-direction: column;
    gap: var(--sp-3);
}

.enrichment-images figure {
    margin: 0;
    border: 1px solid var(--border);
    border-radius: var(--r-2);
    overflow: hidden;
    background: var(--surface-3);
}

.enrichment-images img {
    display: block;
    width: 100%;
    height: auto;
}

.enrichment-images figcaption {
    padding: var(--sp-2) var(--sp-3);
    font-size: var(--text-xs);
    color: var(--muted);
    background: var(--surface);
    border-top: 1px solid var(--border);
}

.enrichment-images .ortho-figure { grid-column: 1 / -1; }

.pano-missing {
    padding: var(--sp-8) var(--sp-3);
    text-align: center;
    color: var(--muted);
    font-size: var(--text-xs);
    background: repeating-linear-gradient(
        45deg,
        var(--surface-3),
        var(--surface-3) 8px,
        var(--color-synapse-ink-200) 8px,
        var(--color-synapse-ink-200) 16px
    );
}

.platform-section {
    border: 1px solid var(--border);
    border-radius: var(--r-2);
    padding: var(--sp-4) var(--sp-5);
    margin-bottom: var(--sp-5);
    background: var(--surface-2);
}

.platform-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-3);
    padding-bottom: var(--sp-3);
    margin-bottom: var(--sp-4);
    border-bottom: 1px solid var(--border);
}

.platform-header h4 {
    margin: 0;
    font-size: var(--text-md);
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--sp-2);
}

.badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.verdict-title {
    margin: 0 0 var(--sp-3);
    font-size: var(--text-md);
    color: var(--text-2);
}

.attribute-table {
    border: 1px solid var(--border);
    font-size: var(--text-xs);
}

.attribute-table th,
.attribute-table td {
    padding: var(--sp-2) var(--sp-3);
}

.abstain-reason {
    display: block;
    color: var(--muted);
    margin-top: 2px;
    font-size: var(--text-xs);
}

.evidence-row {
    margin-bottom: var(--sp-1);
    font-size: var(--text-xs);
    line-height: 1.4;
}

.evidence-row code {
    color: var(--brand-700);
    margin-right: 4px;
}

.evidence-row em { color: var(--text-2); }

/* =========================================================================
   16. Comfort weights
   ========================================================================= */

.weights-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--sp-4);
}

.subtitle { font-weight: 500; font-size: var(--text-md); }

.weight-slider {
    display: grid;
    gap: var(--sp-1);
    padding: var(--sp-2) 0;
    border-bottom: 1px dashed var(--border);
}

.weight-slider:last-of-type { border-bottom: none; }

.weight-label {
    font-size: var(--text-sm);
    color: var(--text);
    font-weight: 500;
}

.weight-controls {
    display: flex;
    gap: var(--sp-2);
    align-items: center;
}

.weight-controls input[type=range] { flex: 1; accent-color: var(--accent-default); }

.weight-number {
    width: 72px;
    text-align: right;
    font-family: var(--font-mono);
    padding: 4px var(--sp-2);
    border: 1px solid var(--border-strong);
    border-radius: var(--r-1);
}

.weights-actions {
    display: flex;
    gap: var(--sp-2);
    flex-wrap: wrap;
    margin-top: var(--sp-4);
    padding-top: var(--sp-4);
    border-top: 1px solid var(--border);
}

.preview-row {
    display: grid;
    grid-template-columns: 1fr 200px 60px;
    gap: var(--sp-3);
    align-items: center;
    padding: 6px 0;
    border-bottom: 1px dashed var(--border);
}

.preview-row:last-of-type { border-bottom: none; }

.preview-label { font-size: var(--text-sm); color: var(--text); }

.preview-bar {
    height: 12px;
    background: var(--surface-3);
    border-radius: 6px;
    overflow: hidden;
}

.preview-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--brand-500), var(--brand));
    transition: width 0.15s;
}

.preview-value {
    font-family: var(--font-mono);
    text-align: right;
    font-weight: 600;
    color: var(--brand);
}

.preview-meta {
    margin-top: var(--sp-3);
    padding-top: var(--sp-3);
    border-top: 1px solid var(--border);
    font-size: var(--text-sm);
    color: var(--muted);
}

/* =========================================================================
   17. Route regression page
   ========================================================================= */

.cmp-controls {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    flex-wrap: wrap;
}

.cmp-summary {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-3);
    padding: var(--sp-5);
    margin-bottom: var(--sp-6);
    box-shadow: var(--shadow-sm);
}

.cmp-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--sp-4);
    margin-bottom: var(--sp-5);
}

.cmp-summary .metric-tile {
    background: var(--surface-2);
    border: 0;
    border-left: 4px solid var(--border-strong);
    padding: var(--sp-4);
    border-radius: var(--r-3);
}

.cmp-summary .metric-tile.metric-good    { border-left-color: var(--success); background: var(--success-50); }
.cmp-summary .metric-tile.metric-bad     { border-left-color: var(--error); background: var(--error-50); }
.cmp-summary .metric-tile.metric-neutral { border-left-color: var(--muted-2); }

.cmp-summary .metric-tile-head {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    font-size: var(--text-sm);
    color: var(--text-2);
    margin-bottom: var(--sp-1);
}

.cmp-summary .metric-tile-icon  { display: inline-flex; }
.cmp-summary .metric-tile-label { font-weight: 500; }

.cmp-summary .metric-tile-value {
    font-size: var(--text-2xl);
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1.1;
    margin: 2px 0;
}

.cmp-summary .metric-tile-hint {
    font-size: var(--text-xs);
    color: var(--text-2);
}

.cmp-verdict-strip {
    display: flex;
    flex-wrap: wrap;
    gap: var(--sp-2);
    margin-bottom: var(--sp-4);
    padding-bottom: var(--sp-4);
    border-bottom: 1px solid var(--border);
}

.verdict-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: var(--r-pill);
    font-size: var(--text-xs);
    font-weight: 500;
    background: var(--surface-3);
    color: var(--text-2);
    border: 1px solid transparent;
}

.verdict-pill-icon  { font-size: var(--text-xs); }
.verdict-pill-count { font-weight: 700; font-variant-numeric: tabular-nums; }
.verdict-pill-pct   { color: var(--text-2); font-size: var(--text-xs); font-variant-numeric: tabular-nums; }

.verdict-exact         { background: var(--success-50); color: var(--success); }
.verdict-better        { background: var(--accent-soft); color: var(--text-primary); }
.verdict-tradeoff-bad  { background: var(--warn-50); color: var(--warn); }
.verdict-tradeoff-good { background: var(--surface-subtle); color: var(--text-secondary); }
.verdict-alternate     { background: var(--color-synapse-ink-200); color: var(--text-secondary); }
.verdict-worse         { background: var(--error-50); color: var(--error); }
.verdict-missing       { background: var(--surface-3); color: var(--muted); border: 1px dashed var(--border-strong); }
.verdict-neutral       { background: var(--surface-3); }

.cmp-reasons h4 {
    margin: 0 0 var(--sp-2);
    font-size: var(--text-sm);
    color: var(--text-2);
    font-weight: 500;
}

.cmp-reason-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: var(--sp-2);
}

.cmp-reason-list li {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: var(--surface-2);
    border-radius: var(--r-2);
    font-size: var(--text-xs);
}

.cmp-reason-count {
    font-weight: 700;
    color: var(--brand);
    font-variant-numeric: tabular-nums;
}

.cmp-filterbar {
    display: flex;
    gap: var(--sp-4);
    flex-wrap: wrap;
    padding: var(--sp-3) var(--sp-4);
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--r-2);
    margin-bottom: var(--sp-4);
    align-items: center;
}

.cmp-filter {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: var(--text-sm);
    cursor: pointer;
}

.cmp-filter select {
    padding: 3px var(--sp-2);
    border-radius: var(--r-1);
    border: 1px solid var(--border-strong);
    font-family: inherit;
}

.fixture-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-3);
    margin-bottom: var(--sp-4);
    overflow: hidden;
}

.fixture-card-head {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    width: 100%;
    padding: var(--sp-3) var(--sp-4);
    background: var(--surface-2);
    border: none;
    cursor: pointer;
    text-align: left;
    font: inherit;
    color: inherit;
    transition: background var(--t-fast);
}

.fixture-card-head:hover { background: var(--surface-3); }
.fixture-card-chevron { color: var(--text-2); width: 14px; font-size: var(--text-xs); }
.fixture-card-title { flex: 1; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.fixture-card-mini-verdicts { display: flex; gap: 4px; }

.mini-verdict {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 2px 6px;
    border-radius: var(--r-1);
    font-size: var(--text-xs);
    font-variant-numeric: tabular-nums;
    background: var(--surface-3);
}

.mini-verdict-exact         { background: var(--success-50); color: var(--success); }
.mini-verdict-better        { background: var(--accent-soft); color: var(--text-primary); }
.mini-verdict-tradeoff-bad  { background: var(--warn-50); color: var(--warn); }
.mini-verdict-tradeoff-good { background: var(--surface-subtle); color: var(--text-secondary); }
.mini-verdict-alternate     { background: var(--color-synapse-ink-200); color: var(--text-secondary); }
.mini-verdict-worse         { background: var(--error-50); color: var(--error); }
.mini-verdict-missing       { background: var(--surface-3); color: var(--muted); }

.fixture-card-count { font-size: var(--text-xs); color: var(--text-2); }
.fixture-card-body  { padding: var(--sp-3); }

.fixture-card-mini-section {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 4px var(--sp-2);
    border-left: 2px solid var(--border);
}

.fixture-card-mini-label {
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-2);
    font-weight: 600;
}

.conn-row {
    display: grid;
    grid-template-columns: 70px 1fr 1fr 280px;
    gap: var(--sp-3);
    padding: var(--sp-3);
    border-radius: var(--r-2);
    margin-bottom: var(--sp-2);
    background: var(--surface-2);
    border-left: 4px solid var(--border-strong);
    align-items: start;
}

.conn-exact         { border-left-color: var(--success); }
.conn-better        { border-left-color: var(--accent-default); }
.conn-tradeoff-bad  { border-left-color: var(--warn-line); }
.conn-tradeoff-good { border-left-color: var(--color-synapse-ink-500); }
.conn-alternate     { border-left-color: var(--color-synapse-ink-400); }
.conn-worse         { border-left-color: var(--error); }
.conn-missing       { border-left-color: var(--muted-2); background: var(--surface-3); }

.conn-row-rank { display: flex; flex-direction: column; gap: 2px; }
.conn-rank { font-weight: 700; color: var(--brand); }
.conn-date { font-size: var(--text-xs); }

.conn-partial {
    font-size: var(--text-xs);
    color: var(--warn);
    background: var(--warn-50);
    padding: 1px 6px;
    border-radius: var(--r-1);
    margin-top: 2px;
}

.conn-side-head {
    font-size: var(--text-xs);
    color: var(--text-2);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 4px;
}

.conn-side-time {
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    margin-bottom: var(--sp-2);
    display: flex;
    gap: 6px;
    align-items: baseline;
    flex-wrap: wrap;
}

.conn-side-empty { color: var(--text-2); font-style: italic; padding: var(--sp-2); }
.conn-legs { display: flex; flex-direction: column; gap: 4px; }

.leg-pill {
    display: grid;
    grid-template-columns: auto auto 1fr auto;
    gap: 6px;
    align-items: baseline;
    padding: 4px var(--sp-2);
    border-radius: var(--r-2);
    font-size: var(--text-xs);
    background: var(--surface-card);
    border: 1px solid var(--border);
}

.leg-walk {
    grid-template-columns: 1fr;
    background: var(--surface-3);
    color: var(--text-2);
    border-style: dashed;
    font-style: italic;
    padding: 2px var(--sp-2);
}

.leg-bus, .leg-ride { border-left: 3px solid var(--brand-600); }
.leg-trolleybus     { border-left: 3px solid var(--success); }

.leg-line {
    font-weight: 700;
    background: var(--brand-50);
    color: var(--brand);
    padding: 1px 6px;
    border-radius: var(--r-1);
    font-family: var(--font-mono);
}

.leg-trolleybus .leg-line { background: var(--success-50); color: var(--success); }

.leg-times   { font-family: var(--font-mono); color: var(--text-2); }
.leg-stops   { color: var(--text); font-size: var(--text-xs); }
.leg-plat    { color: var(--text-2); font-size: var(--text-xs); }
/* Boarding post (označník) number, compact green badge next to the stop name. */
.leg-stand   { color: var(--success); font-weight: 600; font-size: var(--text-xs); margin-left: 2px; }
/* Same idea on the route-detail timeline: a small green pill beside the stop name. */
.ti-stand    { display: inline-block; min-width: 18px; text-align: center; padding: 0 5px;
               border-radius: 6px; background: var(--success-50); color: var(--success);
               font-weight: 700; font-size: var(--text-xs); margin-left: 6px; vertical-align: middle; }
.leg-comfort { font-size: var(--text-xs); color: var(--accent-contrast); }

.conn-verdict { display: flex; flex-direction: column; gap: var(--sp-2); }

.conn-deltas {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.delta-badge {
    display: inline-flex;
    gap: 4px;
    align-items: baseline;
    padding: 2px 6px;
    border-radius: var(--r-1);
    font-size: var(--text-xs);
    background: var(--surface-3);
    color: var(--text-2);
    font-variant-numeric: tabular-nums;
}

.delta-good    { background: var(--success-50); color: var(--success); }
.delta-bad     { background: var(--error-50); color: var(--error); }
.delta-neutral { background: var(--surface-3); }
.delta-label   { opacity: 0.7; }
.delta-value   { font-weight: 600; }

.hub-same { font-size: var(--text-xs); color: var(--success); padding: 2px 6px; background: var(--success-50); border-radius: var(--r-1); }
.hub-diff { font-size: var(--text-xs); color: var(--warn); padding: 2px 6px; background: var(--warn-50); border-radius: var(--r-1); }

.conn-explanation {
    font-size: var(--text-xs);
    color: var(--text);
    line-height: 1.4;
    padding: 6px var(--sp-2);
    background: var(--surface-card);
    border-radius: var(--r-1);
    border-left: 2px solid var(--border-strong);
}

/* Per-attribute boarding breakdown in LegPill (Slice A) */
.leg-pill.leg-ride { display: block; padding: 4px var(--sp-2); }

.leg-pill-row {
    display: grid;
    grid-template-columns: auto auto 1fr auto;
    gap: 6px;
    align-items: baseline;
}

.leg-attrs { grid-column: 1 / -1; margin-top: 4px; }

.leg-attrs > summary {
    cursor: pointer;
    list-style: none;
    display: inline-flex;
    gap: 6px;
    align-items: center;
    font-size: var(--text-xs);
    color: var(--text-2);
    user-select: none;
}

.leg-attrs > summary::-webkit-details-marker { display: none; }
.leg-attrs > summary::before {
    content: '▸';
    font-size: var(--text-xs);
    color: var(--text-2);
    transition: transform 0.1s;
}

.leg-attrs[open] > summary::before { transform: rotate(90deg); }

.leg-attrs-summary { display: inline-flex; align-items: center; gap: 5px; }

/* Stav atributu nese barva chipu, ne přeškrtnutý emoji. */
.leg-attr-chip { display: inline-flex; }
.leg-attr-chip.leg-attr-yes      { color: var(--text-primary); }
.leg-attr-chip.leg-attr-no       { color: var(--muted-2); opacity: .5; }
.leg-attr-chip.leg-attr-unknown  { color: var(--muted-2); opacity: .5; }
.leg-attr-chip.leg-attr-mismatch { color: var(--error); }

.leg-comfort-mini {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: var(--text-xs);
    color: var(--text-secondary);
}

.leg-attrs-grid {
    display: grid;
    grid-template-columns: 16px 1fr auto auto;
    gap: 2px var(--sp-2);
    margin-top: 4px;
    padding: 6px var(--sp-2);
    background: var(--surface-2);
    border-radius: var(--r-1);
    font-size: var(--text-xs);
}

.leg-attr-row { display: contents; }

.leg-attr-icon { text-align: center; font-weight: 700; }

.leg-attr-yes      .leg-attr-icon { color: var(--success); }
.leg-attr-no       .leg-attr-icon { color: var(--error); }
.leg-attr-unknown  .leg-attr-icon { color: var(--muted-2); }
.leg-attr-mismatch .leg-attr-icon { color: var(--warn-line); }

.leg-attr-name { color: var(--text); }

.leg-attr-value {
    font-family: var(--font-mono);
    color: var(--text-2);
}

.leg-attr-unknown .leg-attr-value { font-style: italic; opacity: 0.6; }

.leg-attr-meta {
    color: var(--text-2);
    font-size: var(--text-xs);
    font-variant-numeric: tabular-nums;
}

/* Dual-mode (Classic vs Comfort) layout */
.cmp-hero {
    padding: var(--sp-4) var(--sp-5);
    background: linear-gradient(135deg, var(--brand-50) 0%, var(--surface-card) 100%);
    border-radius: var(--r-3);
    margin-bottom: var(--sp-5);
    text-align: center;
}

.cmp-hero-label {
    font-size: var(--text-sm);
    color: var(--text-2);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 4px;
}

.cmp-hero-value {
    font-size: 56px;
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1;
    margin: 4px 0 6px;
    font-variant-numeric: tabular-nums;
}

.cmp-hero-value.hero-good    { color: var(--success); }
.cmp-hero-value.hero-neutral { color: var(--warn); }
.cmp-hero-value.hero-bad     { color: var(--error); }

.cmp-hero-hint { font-size: var(--text-sm); color: var(--text-2); max-width: 600px; margin: 0 auto; }

.cmp-hero-secondary {
    margin-top: var(--sp-3);
    font-size: var(--text-sm);
    color: var(--text-2);
}

.cmp-modes {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--sp-4);
}

.cmp-mode {
    background: var(--surface-2);
    border-radius: var(--r-2);
    padding: var(--sp-4);
    border-top: 4px solid var(--border-strong);
}

.cmp-mode-primary { border-top-color: var(--brand); }
.cmp-mode-optin   { border-top-color: var(--accent); background: var(--color-signal-yellow-50); }

.cmp-mode-head {
    display: flex;
    align-items: baseline;
    gap: var(--sp-2);
    margin-bottom: var(--sp-3);
    flex-wrap: wrap;
}

.cmp-mode-head h2 { margin: 0; font-size: var(--text-lg); }

.cmp-mode-badge {
    background: var(--brand);
    color: var(--text-inverse);
    padding: 2px var(--sp-2);
    border-radius: var(--r-1);
    font-size: var(--text-xs);
    letter-spacing: 0.08em;
    font-weight: 700;
}

.cmp-mode-badge-optin { background: var(--accent); color: var(--brand); }
.cmp-mode-tag { color: var(--text-2); font-size: var(--text-xs); margin-left: auto; }

.mode-metrics { display: flex; flex-direction: column; gap: var(--sp-3); }

.mode-tiles {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: var(--sp-2);
}

/* Dual connection row */
.dual-conn-row {
    display: grid;
    grid-template-columns: 80px 1fr;
    gap: var(--sp-3);
    padding: var(--sp-3);
    background: var(--surface-2);
    border-radius: var(--r-2);
    margin-bottom: var(--sp-2);
    border-left: 4px solid var(--border-strong);
    align-items: start;
}

.dual-row-merged.conn-classic-exact     { border-left-color: var(--success); }
.dual-row-merged.conn-classic-better    { border-left-color: var(--accent-default); }
.dual-row-merged.conn-classic-alternate { border-left-color: var(--color-synapse-ink-400); }
.dual-row-merged.conn-classic-worse     { border-left-color: var(--error); }
.dual-row-merged.conn-classic-missing   { border-left-color: var(--muted-2); }
.dual-row-split  { border-left-color: var(--accent); }

.dual-conn-meta { display: flex; flex-direction: column; gap: 2px; }

.dual-conn-grid { display: grid; gap: var(--sp-3); }
.dual-conn-grid-3 { grid-template-columns: 1fr 1fr 260px; }
.dual-conn-grid-4 { grid-template-columns: 1fr 1fr 1fr 0; }

.dual-col {
    background: var(--surface-card);
    border-radius: var(--r-2);
    padding: var(--sp-2);
    border: 1px solid var(--border);
}

.dual-col-head {
    display: flex;
    align-items: baseline;
    gap: var(--sp-2);
    margin-bottom: 4px;
}

.dual-col-tag {
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 700;
    color: var(--text-2);
}

.dual-col-tag-classic { color: var(--brand); }
.dual-col-tag-comfort { color: var(--accent-contrast); }
.dual-col-sub { font-size: var(--text-xs); color: var(--text-2); }

.dual-col-changed {
    margin-left: auto;
    font-size: var(--text-xs);
    padding: 1px 6px;
    background: var(--accent-50);
    color: var(--warn);
    border-radius: var(--r-1);
    font-weight: 600;
}

.dual-col-reference { background: var(--surface-2); border-color: var(--border-strong); }
.dual-col-classic { border-left: 3px solid var(--brand); }
.dual-col-comfort { border-left: 3px solid var(--accent); }

.dual-col-verdict {
    margin-top: var(--sp-2);
    padding-top: var(--sp-2);
    border-top: 1px dashed var(--border);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* =========================================================================
   18. Login screen
   ========================================================================= */

/* Tmavé plátno se značkovým patternem, na něm Frost karta.
   Pattern je dodaný asset (žlutá kresba), tlumený krytím — nepřebarvuje se. */
.login-shell {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100dvh;
    background: var(--color-synapse-ink-950);
    padding: var(--sp-5);
    position: relative;
    overflow: hidden;
}

.login-shell::before {
    content: "";
    position: absolute;
    inset: 0;
    background: url("brand/pattern.svg") center / 420px repeat;
    opacity: .07;
    pointer-events: none;
}

.login-card {
    position: relative;
    background: var(--surface-card);
    padding: var(--sp-8) var(--sp-8);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 380px;
}

.login-card .login-logo {
    display: block;
    height: 36px;
    width: auto;
    margin: 0 0 var(--sp-3);
}

.login-card .login-sub {
    margin: 0 0 var(--sp-6);
    color: var(--muted);
    font-size: var(--text-sm);
}

.login-card form label {
    display: block;
    margin-bottom: var(--sp-3);
}

.login-card form label > span {
    display: block;
    font-size: var(--text-xs);
    color: var(--text-2);
    margin-bottom: 4px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.login-card form input[type="email"],
.login-card form input[type="password"] {
    width: 100%;
    padding: 9px var(--sp-3);
    border: 1px solid var(--border-default);
    border-radius: var(--r-pill);
    font-size: var(--text-base);
    font-family: inherit;
    box-sizing: border-box;
    background: var(--surface-input);
    color: var(--text);
    transition: border-color var(--t-fast), box-shadow var(--t-fast);
}

.login-card form input:focus {
    outline: 0;
    border-color: var(--border-ink);
    background: var(--surface-input-focus);
    box-shadow: var(--shadow-focus);
}

.login-card form label.checkbox {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    margin: var(--sp-4) 0 var(--sp-2);
}

.login-card form label.checkbox > span {
    margin: 0;
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
    font-size: var(--text-sm);
    color: var(--text);
}

.login-btn {
    width: 100%;
    padding: 10px;
    background: var(--accent-default);
    color: var(--text-on-accent);
    border: none;
    border-radius: var(--r-pill);
    cursor: pointer;
    font-size: var(--text-md);
    font-family: inherit;
    font-weight: 700;
    transition: background var(--t-fast);
}

.login-btn:hover { background: var(--accent-hover); }

.login-error {
    background: var(--error-50);
    color: var(--error);
    padding: var(--sp-2) var(--sp-3);
    border-radius: var(--r-1);
    margin-bottom: var(--sp-4);
    font-size: var(--text-sm);
    border: 1px solid var(--error-border);
}

.login-hint {
    margin-top: var(--sp-5);
    font-size: var(--text-xs);
    color: var(--muted);
    line-height: 1.5;
}

/* =========================================================================
   19. Responsive
   ========================================================================= */

@media (max-width: 1100px) {
    .conn-row { grid-template-columns: 60px 1fr 1fr; }
    .conn-verdict { grid-column: 1 / -1; }
}

@media (max-width: 1000px) {
    .weights-grid { grid-template-columns: 1fr; }
    .cmp-modes    { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
    .page-main { padding: var(--sp-5) var(--sp-4); }
    .enrichment-grid { grid-template-columns: 1fr; }
    .form-row.two-col { grid-template-columns: 1fr; }
    .route-head { flex-direction: column; align-items: flex-start; }
    .route-head .route-pill { height: 48px; min-width: 56px; font-size: var(--text-xl); }
}

/* Email collapses on mid widths so the topbar utilities never crowd. */
@media (max-width: 1200px) {
    .user-email { display: none; }
    .tenant-switch { max-width: 200px; }
}

/* Below 960px the sidebar becomes an off-canvas drawer toggled by the hamburger. */
@media (max-width: 960px) {
    .page { grid-template-columns: 1fr; }

    .sidebar {
        position: fixed;
        top: 0; left: 0; bottom: 0;
        width: 256px;
        height: 100dvh;
        transform: translateX(-100%);
        transition: transform var(--t-med);
        box-shadow: var(--shadow-md);
        z-index: 60;
    }
    .nav-toggle-cb:checked ~ .sidebar { transform: none; }

    .nav-toggle-cb:checked ~ .sidebar-scrim {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(8, 20, 26, .5);
        z-index: 55;
    }

    .nav-burger { display: inline-flex; }
    .conn-row { grid-template-columns: 1fr; }
}

/* =========================================================================
   Real-time "depart now" overlay (ADR-0023)
   ========================================================================= */

.rt-status {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    margin: calc(var(--sp-2) * -1) 0 var(--sp-3);
    padding: var(--sp-2) var(--sp-3);
    border-radius: var(--r-2);
    font-size: var(--text-sm);
    border: 1px solid var(--border);
    background: var(--surface-2);
}
.rt-status.live     { background: var(--success-50); border-color: var(--color-signal-yellow-300); }
.rt-status.idle     { background: var(--surface-3); }
.rt-status.schedule { background: var(--surface-2); }
.rt-status-label    { font-weight: 700; text-transform: uppercase; letter-spacing: .04em; font-size: var(--text-xs); color: var(--text-2); }
.rt-status.live .rt-status-label { color: var(--success); }
.rt-status-meta     { color: var(--muted); }

/* Pulsing live dot */
.rt-live-dot {
    width: 9px; height: 9px; border-radius: 50%;
    background: var(--success);
    animation: rt-pulse 1.8s infinite;
    flex: 0 0 auto;
}
.rt-live-dot.small { width: 7px; height: 7px; }
.rt-live-dot.idle  { background: var(--muted-2); animation: none; }
.rt-live-dot.off   { background: var(--border-strong); animation: none; }
@keyframes rt-pulse {
    0%   { box-shadow: 0 0 0 0 rgba(42, 122, 42, .50); }
    70%  { box-shadow: 0 0 0 7px rgba(42, 122, 42, 0); }
    100% { box-shadow: 0 0 0 0 rgba(42, 122, 42, 0); }
}

/* Per-leg live delay badge */
.rt-leg-badge {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 2px var(--sp-2);
    border-radius: var(--r-1);
    font-size: var(--text-xs); font-weight: 700;
    border: 1px solid transparent;
    white-space: nowrap;
}
.rt-leg-badge.rt-late    { background: var(--error-50);   color: var(--error); }
.rt-leg-badge.rt-early   { background: var(--success-50); color: var(--success); }
.rt-leg-badge.rt-ontime  { background: var(--success-50); color: var(--success); }
.rt-leg-badge.rt-tracked { background: var(--surface-3);  color: var(--text-2); }
.rt-leg-badge .rt-live-dot { background: currentColor; animation: rt-blink 1.8s infinite; }
@keyframes rt-blink { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }

.rt-leg-pos {
    display: inline-flex; align-items: center; gap: 4px;
    color: var(--text-2); font-size: var(--text-xs); font-weight: 600;
}

/* ---------- Pareto trade-off menu (RAPTOR multi-criteria) ---------- */
.pareto-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: var(--sp-3);
}
.pareto-card {
    display: flex;
    flex-direction: column;
    gap: var(--sp-1);
    text-align: left;
    padding: var(--sp-3);
    border: 1px solid var(--border);
    border-radius: var(--r-3);
    background: var(--surface-2);
    cursor: pointer;
    transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.pareto-card:hover { border-color: var(--brand-500); }
.pareto-card.shown {
    border-color: var(--brand-600);
    box-shadow: var(--shadow-focus);
    background: var(--surface);
}
.pareto-label {
    align-self: flex-start;
    font-size: var(--text-xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .03em;
    padding: 2px var(--sp-2);
    border-radius: var(--r-pill);
    color: var(--text-inverse);
}
.pareto-label.fastest    { background: var(--brand-600); }
.pareto-label.fewest     { background: var(--success); }
.pareto-label.compromise { background: var(--muted); }
.pareto-time    { font-size: var(--text-lg); color: var(--text); }
.pareto-metrics { font-weight: 700; color: var(--text-2); }
.pareto-lines   { font-size: var(--text-sm); color: var(--text-2); }
.pareto-why     { font-size: var(--text-xs); color: var(--muted); }

/* ============================================================
   Feed-refresh + edition admin (/admin/feeds) & realtime (/admin/realtime)
   ============================================================ */

/* -- Verdikt: první a často jediná věc, kterou na /admin/feeds někdo přečte ---------
   Nahradil čtyři stejné dlaždice („Vydání celkem", „Linek", …), které se sčítaly hezky,
   ale na otázku „platí to, co má?" neodpovídaly. Věta odpovídá; seznam pod ní říká,
   co s tím. Když není co řešit, zůstane jen věta — klid je taky informace. */
.verdict {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--sp-4) var(--sp-5);
    margin-bottom: var(--sp-4);
}

.verdict-alert { border-color: var(--error-border); }

.verdict-line {
    margin: 0;
    font-size: var(--text-lg);
    line-height: 1.45;
    color: var(--text);
    max-width: 68ch;
}

.verdict-line strong { font-weight: 700; }

.verdict-sub {
    margin: var(--sp-2) 0 0;
    color: var(--text-2);
    font-size: var(--text-sm);
}

.verdict-issues {
    list-style: none;
    margin: var(--sp-3) 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: var(--sp-2);
}

.verdict-issues li {
    display: flex;
    gap: var(--sp-2);
    align-items: flex-start;
    padding: var(--sp-2) var(--sp-3);
    border-radius: var(--radius-md);
    line-height: 1.45;
    max-width: 90ch;
}

.verdict-issues li .icon { margin-top: .18em; }
.verdict-issues li.issue-error { background: var(--error-50); color: var(--error); }
.verdict-issues li.issue-error strong { color: var(--error); }
.verdict-issues li.issue-warn  { background: var(--warn-50);  color: var(--text); }

/* -- Zdroj dat jako štítek ----------------------------------------------------------
   Dřív tu stál sloupec „Prio" s čísly 0 / 100 / 200. Číslo je vnitřní pořadí, ne sdělení;
   obsluha potřebuje vědět, čí data to jsou. Přednost teď nese pořadí skupin a to, že
   poražený zdroj sedí ve sloupci „Pod tím". */
.src-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px var(--sp-2);
    border-radius: 999px;
    font-size: var(--text-xs);
    font-weight: 600;
    white-space: nowrap;
}

.src-tag + .src-tag { margin-left: var(--sp-1); }

.src-exception { background: var(--accent-default); color: var(--text-on-accent); }
.src-own       { background: var(--accent-soft);    color: var(--text); }
.src-cis       { background: var(--surface-3);      color: var(--text-2); }
.src-under     { background: transparent; color: var(--muted); border: 1px solid var(--border); font-weight: 500; }
.src-none      { background: var(--error-50); color: var(--error); }

.ends-soon { font-weight: 600; }
.ends-bad  { color: var(--error); font-weight: 600; }

/* Skupina zdrojů — CIS je pro dopravce s vlastními daty mrtvý balast, takže se sbalí
   pod jednu větu s verdiktem. Nesmaže se: je to audit stopa a záloha, kdyby upload zmizel. */
.src-group { border-top: 1px solid var(--border); padding: var(--sp-3) 0; }
.src-group:first-of-type { border-top: 0; padding-top: 0; }
.src-group[open] > .src-group-head { margin-bottom: var(--sp-3); }

.src-group-head {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: var(--sp-2);
    cursor: pointer;
    list-style: none;
}

.src-group-head::-webkit-details-marker { display: none; }
.src-group-head::after {
    content: "";
    width: 6px; height: 6px;
    border-right: 1.5px solid var(--muted);
    border-bottom: 1.5px solid var(--muted);
    transform: rotate(-45deg);
    transition: transform 120ms ease-out;
}
.src-group[open] > .src-group-head::after { transform: rotate(45deg); }

.src-group-verdict { color: var(--text-2); font-size: var(--text-sm); }
.src-group-verdict strong { color: var(--text); }

/* Výčet linek pod štítkem dávky — jediné, čím se od sebe stejně pojmenované dávky liší. */
.ed-lines { color: var(--text-2); font-size: var(--text-sm); margin-top: 2px; }

/* Table row states */
.compare tr.row-muted td   { opacity: .55; }
.compare tr.row-gap        { background: var(--error-50); }
.compare tr.row-gap:hover  { background: var(--error-50); }
.compare tr.row-added      { background: var(--success-50); }
.compare tr.row-removed    { background: var(--error-50); }
.compare tr.row-changed    { background: var(--warn-50); }

/* Key/value grid (binding + poller status) */
.kv-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: var(--sp-3);
}
.kv {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: var(--sp-3);
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--r-1);
}
.kv-k { font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.kv-v { font-size: .95rem; color: var(--text); }
.kv-v code { font-size: .8rem; }

/* Diff block + chips */
.diff-block { margin-top: var(--sp-4); }
.diff-summary { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.diff-chip {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: .8rem;
    font-weight: 600;
    border: 1px solid transparent;
}
.diff-chip.added   { background: var(--success-50); color: var(--success); }
.diff-chip.removed { background: var(--error-50);   color: var(--error); }
.diff-chip.changed { background: var(--warn-50);    color: var(--warn); }
.diff-chip.same    { background: var(--surface-3);  color: var(--muted); }

.promote-box {
    margin-top: var(--sp-4);
    padding: var(--sp-4);
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--r-1);
}
.promote-box .inline-check { display: block; margin: var(--sp-2) 0; }

/* Upload jízdního řádu */
.upload-row {
    display: flex;
    flex-wrap: wrap;
    gap: var(--sp-4);
    align-items: flex-start;
}
.upload-drop {
    flex: 1 1 320px;
    display: flex;
    flex-direction: column;
    gap: var(--sp-2);
    justify-content: center;
    min-height: 84px;
    padding: var(--sp-4);
    border: 1.5px dashed var(--border-strong);
    border-radius: var(--r-2);
    background: var(--surface-2);
    cursor: pointer;
    transition: border-color var(--t-fast), background var(--t-fast);
}
.upload-drop:hover { border-color: var(--brand-500); background: var(--brand-50); }
.upload-drop.disabled { opacity: .55; pointer-events: none; }
.upload-drop .upload-drop-text { font-size: var(--text-sm); color: var(--text-2); }
.upload-drop input[type=file] { font-size: var(--text-sm); }

.what-happens {
    margin-top: var(--sp-3);
    padding: var(--sp-3) var(--sp-4);
    background: var(--brand-50);
    border: 1px solid var(--border-default);
    border-radius: var(--r-2);
    font-size: var(--text-sm);
}
.what-happens ul { margin: var(--sp-2) 0 0; padding-left: var(--sp-5); }
.what-happens li { margin: 2px 0; }

/* Advanced server-disk feeds — collapsible panel */
.adv-feeds > summary { display: block; }
.adv-feeds > summary::-webkit-details-marker { display: none; }
.adv-feeds[open] > summary { border-bottom: 1px solid var(--border); }

.btn-small { height: 28px; padding: 0 var(--sp-3); font-size: var(--text-xs); }

/* Feed candidate cards */
.feed-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: var(--sp-3);
}
.feed-card {
    display: flex;
    flex-direction: column;
    gap: var(--sp-1);
    padding: var(--sp-4);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-1);
    transition: border-color .12s ease, box-shadow .12s ease;
}
.feed-card.selected { border-color: var(--brand-500); box-shadow: 0 0 0 2px var(--brand-50); }
.feed-card-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); }
.feed-name { font-weight: 700; color: var(--text); }
.feed-meta { display: flex; flex-wrap: wrap; gap: var(--sp-2); font-size: .82rem; color: var(--muted); }
.feed-stats { display: flex; flex-wrap: wrap; gap: var(--sp-3); font-size: .85rem; color: var(--text-2); margin: var(--sp-1) 0; }
.feed-card-actions { margin-top: var(--sp-2); }

/* ============================================================
   Phase 2 multi-criteria — Pareto card criteria + active/N-A legend (/admin/search)
   ============================================================ */
.criteria-legend {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-top: var(--sp-2);
    font-size: .76rem;
}
.criteria-legend .legend-tag { color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.criteria-legend span:not(.legend-tag) {
    padding: 1px 7px;
    border-radius: 999px;
    border: 1px solid transparent;
}
.criteria-legend .legend-on  { background: var(--brand-50); color: var(--brand-700); }
.criteria-legend .legend-off { background: var(--surface-3); color: var(--muted); }

.pareto-criteria {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 2px;
}
.pareto-criteria .crit {
    font-size: .76rem;
    padding: 1px 7px;
    border-radius: var(--r-1);
    background: var(--surface-3);
    color: var(--text-2);
    white-space: nowrap;
}
.pareto-criteria .crit-good { background: var(--success-50); color: var(--success); }
.pareto-criteria .crit-bad  { background: var(--error-50);   color: var(--error); }

/* Phase 2 — per-tenant criteria toggles (tenant editor) */
.criteria-toggles { display: flex; flex-direction: column; gap: 6px; margin: 4px 0; }
.criteria-toggles .inline-check { display: flex; align-items: baseline; gap: 7px; font-weight: 500; }
.criteria-toggles .inline-check input { margin: 0; }

/* Next-available rollover banner (/admin/search) — result is a later day, not the requested time */
.rollover-banner {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-bottom: var(--sp-3, 12px);
    padding: 10px 14px;
    border-radius: var(--r-2, 8px);
    background: var(--accent-soft);
    border: 1px solid var(--color-signal-yellow-300);
    color: var(--accent-contrast);
    font-size: .9rem;
}
.rollover-banner .rollover-icon { display: inline-flex; line-height: 1; }

/* =========================================================================
   20. Search Lab (/admin/lab) — post-import sanity board
   Status is encoded in glyph AND colour (not colour alone): ● pass / ▲ warn
   / ✕ fail / ○ idle, so the board reads for colour-blind operators too.
   ========================================================================= */

/* --- Command cockpit: run-all + summary strip --- */
.lab-command {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--sp-5);
    padding: var(--sp-4) var(--sp-5);
    margin-bottom: var(--sp-5);
    background: linear-gradient(135deg, var(--brand-50) 0%, var(--surface-card) 100%);
    border: 1px solid var(--border-default);
    border-radius: var(--r-3);
    box-shadow: var(--shadow-sm);
}

.lab-command-run { display: flex; gap: var(--sp-2); flex-wrap: wrap; }

.btn.lab-run-all {
    min-height: 44px;
    padding: 0 var(--sp-6);
    font-size: var(--text-base);
    font-weight: 600;
}

.lab-spin {
    width: 14px; height: 14px;
    border: 2px solid rgba(248, 251, 251, .4);
    border-top-color: var(--text-inverse);
    border-radius: 50%;
    display: inline-block;
    animation: lab-spin 0.7s linear infinite;
}
@keyframes lab-spin { to { transform: rotate(360deg); } }

.lab-summary {
    display: flex;
    align-items: stretch;
    gap: var(--sp-3);
    margin-left: auto;
    flex-wrap: wrap;
}

.lab-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 74px;
    padding: var(--sp-2) var(--sp-3);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-2);
    border-top: 3px solid var(--border-strong);
}

.lab-tile-value { font-size: var(--text-2xl); font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.lab-tile-label { font-size: var(--text-xs); text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-top: 3px; font-weight: 600; }

.lab-tile.pass { border-top-color: var(--success); } .lab-tile.pass .lab-tile-value { color: var(--success); }
.lab-tile.warn { border-top-color: var(--warn); }    .lab-tile.warn .lab-tile-value { color: var(--warn); }
.lab-tile.fail { border-top-color: var(--error); }   .lab-tile.fail .lab-tile-value { color: var(--error); }
.lab-tile.idle { border-top-color: var(--muted-2); } .lab-tile.idle .lab-tile-value { color: var(--muted); }

.lab-fingerprint {
    display: flex;
    align-items: center;
    gap: 6px;
    align-self: center;
    font-size: var(--text-xs);
    color: var(--muted);
}
.lab-fp-label { text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
.lab-fingerprint code { background: var(--surface); border: 1px solid var(--border); color: var(--text-2); }
.lab-fp-when { color: var(--muted); }

/* --- Status light (glyph + colour) --- */
.lab-light {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px; height: 22px;
    border-radius: 50%;
    font-size: var(--text-xs);
    font-weight: 700;
    line-height: 1;
}
.lab-light.pass { background: var(--success-50); color: var(--success); }
.lab-light.warn { background: var(--warn-50);    color: var(--warn); }
.lab-light.fail { background: var(--error-50);   color: var(--error); }
.lab-light.idle { background: var(--surface-3);  color: var(--muted); }

/* --- Catalog table --- */
.lab-table td { vertical-align: middle; }
.lab-row { cursor: pointer; }
.lab-row.selected { background: var(--brand-50); box-shadow: inset 3px 0 0 var(--brand-500); }
.lab-col-status { width: 44px; text-align: center; }
.lab-col-actions { width: 1%; white-space: nowrap; text-align: right; }
.lab-col-actions .btn { padding: 3px 8px; min-height: 26px; }
.lab-del:hover { color: var(--error) !important; }

.lab-name { font-weight: 600; color: var(--text); }
.lab-archetype { font-size: var(--text-xs); color: var(--muted); margin-top: 1px; }

.lab-od { font-size: var(--text-sm); color: var(--text-2); }
.lab-arrow, .lab-journey-time .arrow { color: var(--muted); margin: 0 6px; }

.lab-when { font-size: var(--text-xs); }
.lab-anchor { display: block; font-weight: 600; color: var(--text-2); }
.lab-resolved { display: block; color: var(--muted); font-variant-numeric: tabular-nums; }

.lab-result { white-space: nowrap; }
.lab-dur { font-weight: 600; font-variant-numeric: tabular-nums; }
.lab-transfers { display: block; font-size: var(--text-xs); color: var(--muted); }
.lab-noconn { color: var(--error); font-weight: 600; font-size: var(--text-sm); }

.lab-delta {
    display: inline-block;
    margin-top: 2px;
    font-size: var(--text-xs);
    font-weight: 600;
    padding: 1px 6px;
    border-radius: var(--r-pill);
    font-variant-numeric: tabular-nums;
}
.lab-delta.up   { background: var(--success-50); color: var(--success); }
.lab-delta.down { background: var(--error-50);   color: var(--error); }

/* --- Smell chips --- */
.lab-smells { max-width: 320px; }
.smell-chip {
    display: inline-block;
    margin: 1px 3px 1px 0;
    padding: 2px 8px;
    border-radius: var(--r-pill);
    font-size: var(--text-xs);
    font-weight: 600;
    border: 1px solid transparent;
    white-space: nowrap;
}
.smell-chip.sev-critical { background: var(--error-50);   color: var(--error);   border-color: var(--error-border); }
.smell-chip.sev-warning  { background: var(--warn-50);    color: var(--warn);    border-color: var(--color-signal-yellow-300); }
.smell-chip.sev-info     { background: var(--surface-3);  color: var(--text-2); }
.smell-clean { font-size: var(--text-xs); color: var(--success); font-weight: 600; }

/* --- Detail --- */
.lab-detail-actions { display: flex; gap: var(--sp-2); }
.lab-detail .panel-header h2 { display: inline-flex; align-items: center; gap: var(--sp-2); }

.lab-detail-stack {
    display: flex;
    flex-direction: column;
    gap: var(--sp-4);
    margin-top: var(--sp-3);
}

.lab-journey-head {
    display: flex;
    align-items: baseline;
    gap: var(--sp-3);
    flex-wrap: wrap;
    margin-bottom: var(--sp-3);
}
.lab-journey-time { font-family: var(--font-mono); font-size: var(--text-xl); font-variant-numeric: tabular-nums; color: var(--brand); letter-spacing: -0.02em; }
.lab-journey-dur { background: var(--brand); color: var(--text-inverse); padding: 3px var(--sp-3); border-radius: var(--r-pill); font-size: var(--text-sm); font-weight: 600; }
.lab-journey-tr { color: var(--text-2); font-size: var(--text-sm); }

.lab-legs { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--sp-1); }
.lab-leg { display: grid; grid-template-columns: 48px 16px 1fr; align-items: center; column-gap: var(--sp-2); }
.lab-leg-time { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: var(--text-xs); color: var(--text-2); text-align: right; }
.lab-leg-glyph { width: 10px; height: 10px; border-radius: 50%; justify-self: center; background: var(--brand-500); }
.lab-leg.walk .lab-leg-glyph { background: var(--muted-2); }
.lab-leg-body { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; padding: var(--sp-1) 0; }
.lab-leg-text { font-size: var(--text-sm); color: var(--text-2); }

.lab-pareto { margin-top: var(--sp-4); padding-top: var(--sp-3); border-top: 1px solid var(--border); display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.lab-pareto-label { font-size: var(--text-xs); color: var(--muted); text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.lab-pareto-opt { font-size: var(--text-xs); padding: 3px var(--sp-2); border-radius: var(--r-pill); background: var(--surface-3); color: var(--text-2); }
.lab-pareto-opt.chosen { background: var(--surface-inverse); color: var(--text-inverse); }

.lab-map-wrap { display: flex; flex-direction: column; gap: var(--sp-2); min-width: 0; width: 100%; }
.lab-map { flex: 0 0 auto; width: 100%; height: 520px; min-height: 520px; border-radius: var(--r-2); border: 1px solid var(--border); overflow: hidden; z-index: 0; }
.lab-map-legend { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-3); font-size: var(--text-xs); color: var(--muted); }
.lab-map-hint { color: var(--muted); }
.lab-map-legend i { display: inline-block; width: 14px; height: 3px; vertical-align: middle; margin-right: 4px; border-radius: 2px; }
.lab-map-legend .lg-ride { background: var(--brand); }
.lab-map-legend .lg-walk { background: var(--muted-2); height: 0; border-top: 3px dashed var(--muted-2); }
.lab-map-legend .lg-origin { width: 10px; height: 10px; border-radius: 50%; background: var(--brand); }
.lab-map-legend .lg-dest { width: 10px; height: 10px; border-radius: 50%; background: var(--success); }
.lab-map-hint { margin: 0; font-size: var(--text-xs); color: var(--muted); line-height: 1.5; }

.lab-fail-list { margin: var(--sp-1) 0 0; padding-left: var(--sp-5); }
.lab-fail-list li { margin: 2px 0; }

.lab-smell-list { display: flex; flex-direction: column; gap: var(--sp-2); margin-bottom: var(--sp-4); }
.lab-smell { display: flex; align-items: flex-start; gap: var(--sp-3); padding: var(--sp-2) var(--sp-3); border-radius: var(--r-2); background: var(--surface-2); border: 1px solid var(--border); border-left: 3px solid var(--border-strong); }
.lab-smell.sev-critical { border-left-color: var(--error); }
.lab-smell.sev-warning  { border-left-color: var(--warn); }
.lab-smell.sev-info     { border-left-color: var(--muted-2); }
.lab-smell-body { display: flex; flex-direction: column; gap: 1px; font-size: var(--text-sm); }
.lab-smell-body span { color: var(--text-2); }

/* --- Editor modal --- */
.lab-modal-backdrop {
    position: fixed; inset: 0; z-index: 100;
    background: rgba(15, 23, 42, .45);
    display: flex; align-items: center; justify-content: center;
    padding: var(--sp-4);
}
.lab-modal {
    background: var(--surface);
    border-radius: var(--r-3);
    box-shadow: var(--shadow-md);
    width: 100%; max-width: 640px;
    max-height: 90vh;
    display: flex; flex-direction: column;
    overflow: hidden;
}
.lab-modal-head { display: flex; align-items: center; justify-content: space-between; padding: var(--sp-4) var(--sp-5); border-bottom: 1px solid var(--border); }
.lab-modal-head h2 { margin: 0; }
.lab-modal-x { background: transparent; border: 0; font-size: var(--text-md); color: var(--muted); cursor: pointer; padding: 4px 8px; border-radius: var(--r-1); }
.lab-modal-x:hover { background: var(--surface-3); color: var(--text); }
.lab-modal-body { padding: var(--sp-5); overflow-y: auto; }
.lab-modal-body .form-row.two-col { margin-bottom: 0; }
.lab-modal-foot { display: flex; align-items: center; justify-content: flex-end; gap: var(--sp-2); padding: var(--sp-3) var(--sp-5); border-top: 1px solid var(--border); background: var(--surface-2); }
.lab-editor-error { margin-right: auto; color: var(--error); font-size: var(--text-sm); }

.lab-anchor-presets { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: var(--sp-2); }
.lab-anchor-input { max-width: 260px; }

.lab-checks { display: flex; flex-wrap: wrap; gap: var(--sp-3); }
.lab-check { display: inline-flex; align-items: center; gap: 6px; font-size: var(--text-sm); color: var(--text-2); text-transform: none; letter-spacing: 0; font-weight: 400; }
.lab-check input { width: auto; }

@media (max-width: 900px) {
    .lab-detail-grid { grid-template-columns: 1fr; }
    .lab-summary { margin-left: 0; width: 100%; }
}
