/* ═══════════════════════════════════════════════════════════════
   PROPAMON 2.0 — Intelligence Monitoring Dashboard
   Brand-anchored light theme: propamon orange accent
   ═══════════════════════════════════════════════════════════════ */

/* ── Design Tokens ────────────────────────────────────────────── */
:root {
    /* Surfaces — light mode */
    --pm-bg:            #f5f6f8;
    --pm-surface:       #ffffff;
    --pm-surface-alt:   #f0f1f4;
    --pm-surface-hover: #e8eaef;
    --pm-border:        rgba(0, 0, 0, 0.08);
    --pm-border-strong: rgba(0, 0, 0, 0.16);

    /* Text — dark on light */
    --pm-text:          #1a1a2e;
    --pm-text-muted:    #6c757d;
    --pm-text-dim:      #adb5bd;

    /* Accent — propamon orange */
    --pm-accent:        #ff6700;
    --pm-accent-light:  #ff8533;
    --pm-accent-dim:    rgba(255, 103, 0, 0.10);
    --pm-accent-glow:   rgba(255, 103, 0, 0.30);
    --pm-accent-text:   #ffffff;

    /* Priority / semantic */
    --pm-critical:      #ef4444;
    --pm-high:          #f59e0b;
    --pm-normal:        #3b82f6;
    --pm-low:           #64748b;
    --pm-success:       #22c55e;

    /* Narrative cell colors */
    --pm-cell-sec-thr:  #f59e0b;
    --pm-cell-sec-wek:  #ef6c35;
    --pm-cell-sec-vic:  #fbbf24;
    --pm-cell-soc-thr:  #22c55e;
    --pm-cell-soc-wek:  #06b6d4;
    --pm-cell-soc-vic:  #3b82f6;
    --pm-cell-eco-thr:  #8b5cf6;
    --pm-cell-eco-wek:  #ec4899;
    --pm-cell-eco-vic:  #a78bfa;
    --pm-cell-history:  #e07653;
    --pm-cell-sov:      #d4a853;
    --pm-cell-none:     #64748b;

    /* Radii */
    --pm-radius:        8px;
    --pm-radius-lg:     14px;
    --pm-radius-xl:     20px;

    /* Transitions */
    --pm-transition:    180ms cubic-bezier(0.4, 0, 0.2, 1);
    --pm-transition-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1);

    /* Shadows */
    --pm-shadow-sm:     0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --pm-shadow-md:     0 4px 16px rgba(0,0,0,0.08), 0 2px 6px rgba(0,0,0,0.04);
    --pm-shadow-lg:     0 8px 32px rgba(0,0,0,0.1), 0 4px 12px rgba(0,0,0,0.06);
    --pm-shadow-glow:   0 0 20px rgba(255, 103, 0, 0.1), 0 0 60px rgba(255, 103, 0, 0.03);
}


/* ── Base Overrides ───────────────────────────────────────────── */
[data-bs-theme="light"] {
    --bs-body-bg: var(--pm-bg);
    --bs-body-color: var(--pm-text);
    --bs-border-color: var(--pm-border);
    --bs-card-bg: var(--pm-surface);
    --bs-card-border-color: var(--pm-border);
    --bs-table-bg: transparent;
    --bs-table-border-color: var(--pm-border);
    --bs-table-striped-bg: rgba(0, 0, 0, 0.02);
    --bs-table-hover-bg: var(--pm-surface-hover);
    --bs-secondary-bg: var(--pm-surface-alt);
    --bs-tertiary-bg: var(--pm-surface);
    --bs-emphasis-color: var(--pm-text);
    --bs-secondary-color: var(--pm-text-muted);
    --bs-link-color: var(--pm-accent);
    --bs-link-hover-color: var(--pm-accent);
    --bs-primary: var(--pm-accent);
    --bs-primary-rgb: 255, 103, 0;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    background: var(--pm-surface); /* flush white, matches uidemos/current — overridden by .adm-shell on admin pages */
    color: var(--pm-text);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
}


/* ── Skip Link (WCAG 2.4.1) ────────────────────────────────────
   Lives here (not a page-specific stylesheet) because the skip-link markup
   itself is in base_public.html, rendered by every page extending that
   base — a page that doesn't happen to load home.css must not get an
   unstyled skip link. `z-index` is a stacking order, not a design value —
   this codebase has no z-index scale, so it stays a literal; it has to
   clear Bootstrap's `.sticky-top` (1020), which `_nav.html` carries and
   which would otherwise paint its opaque bar over the focused link at
   top:0/left:0. */
.skip-link {
    position: absolute; left: -9999px; top: 0;
    background: var(--pm-surface); color: var(--navy);
    z-index: 1030;
    font-weight: 600;
    text-decoration: none;
}
.skip-link:focus { left: 0; outline: 2px solid var(--navy); }

/* ── Animated Accent Strip ───────────────────────────────────── */
/* accent strip removed — navbar is the brand bar */

@keyframes accentShimmer {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}


/* ── Navbar ─────────────────────────────────────────────────────
   Light chrome (ISSUE #269 — matches uidemos/current/Overview.html):
   pm-surface background, navy link text, orange underline accent on the
   active tab only. The bar spans the viewport for its background/border
   while `.pm-navbar-in` constrains the row to the shared content column
   (same full-bleed-outer / contained-inner pattern as .pm-alert-banner).
   Token-only (KB-0020/AC-4). NAVBAR-CSS-START */
.pm-navbar {
    background: var(--pm-surface) !important;
    border-bottom: 1px solid var(--div) !important;
    box-shadow: none;
}

.pm-navbar-in {
    max-width: var(--content-max);
    min-height: var(--navbar-h);
}

.pm-brand {
    color: var(--navy) !important;
    gap: var(--sp-xs);
    margin-right: var(--sp-5xl);
}

/* The <picture> is the flex item, not `display: contents`: its <source>
   computes to display: block, so unwrapping the picture made the source an
   empty flex item and shifted the mark by one flex gap. */
.pm-brand > picture,
.adm-rail-logo > picture,
.login-brand > picture {
    display: block;
    flex-shrink: 0;
}

.pm-brand > picture > img,
.adm-rail-logo > picture > img,
.login-brand > picture > img {
    display: block;
}

.pm-brand-mark {
    display: block;
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
}

.pm-brand-text {
    color: var(--navy);
}

.pm-brand-text span {
    color: var(--orange);
}

/* `font-weight` stays bespoke: .fw-medium is !important and would defeat the
   .active rule's 600 below. */
.pm-navbar .nav-link {
    height: var(--navbar-h);
    color: var(--text2) !important;
    font-size: var(--fs-sm);
    font-weight: 500;
    border-bottom: 2px solid transparent;
    transition: color var(--pm-transition), border-color var(--pm-transition);
}

.pm-navbar .nav-link:hover {
    color: var(--navy) !important;
    background: transparent;
}

.pm-navbar .nav-link.active {
    color: var(--navy) !important;
    background: transparent;
    font-weight: 600;
    border-bottom-color: var(--orange);
}

.pm-navbar .nav-link:focus-visible {
    outline: 2px solid var(--navy);
    outline-offset: 2px;
}

/* ISSUE #578 — the unconditional "Teavita propagandast" action button, the
   one exception to the 3-links-only nav (KB-0249 amends KB-0125). No
   `display` declaration: the `hidden` attribute relies on Bootstrap's
   `[hidden]{display:none!important}`. */
.pm-report-btn {
    margin-left: auto;
    flex-shrink: 0;
    padding: var(--sp-7px) var(--sp-16px);
    font-size: var(--fs-xs);
    font-weight: 600;
    color: var(--orange-700);            /* 4.88:1 on white, KB-0019 (design's --orange is 3.04:1) */
    background: var(--pm-surface);
    border: 1.5px solid var(--orange-700);
    border-radius: var(--radius-sm);
    white-space: nowrap;
    cursor: pointer;
    transition: background var(--pm-transition), color var(--pm-transition);
}
.pm-report-btn:hover { background: var(--orange-700); color: var(--pm-surface); }
.pm-report-btn:focus-visible { outline: 2px solid var(--navy); outline-offset: 2px; }

/* <768px: `navbar-expand` (no breakpoint suffix, on the <nav> itself) keeps
   this row a single nowrap flex line at every width, so a long label or a
   200%-text setting would push the row past the viewport instead of moving
   to a second line. Letting the row wrap is the safety net — three links
   often fit on one line at 320px, so this is insurance, not the observed
   layout — and the rest of this block keeps the wrapped header short.

   The block-start padding is what lifts the brand line off the sticky bar's
   top edge — `min-height` cannot, because that height is shared out across
   both wrapped lines. It is `padding-top`, never the `padding` shorthand,
   because the markup owns the inline sides via Bootstrap's `px-4` (itself
   `!important`) and the shorthand would zero them.

   `!important` on `.nav-link` is load-bearing, for the same reason it
   already is on the `.active`/`:hover` rules above: the markup's own
   `.px-3`/`.py-0` Bootstrap utilities are themselves `!important`, which
   higher specificity alone cannot beat. The padding it sets keeps every
   link's touch height above WCAG 2.5.8's 24px floor while costing far less
   than the unconditional 62px (no `line-height` override — that property is
   banned outright in this stylesheet).

   >=768px is untouched: every declaration lives inside this media query. */
@media (max-width: 767.98px) {
    .pm-navbar-in {
        flex-wrap: wrap;
        padding-top: var(--sp-md);
    }

    .pm-brand { margin-right: 0; }

    .navbar-nav {
        flex-basis: 100%;
        flex-wrap: wrap;
        margin-top: var(--sp-2xs);
        gap: var(--sp-3xs);
    }

    .pm-navbar .nav-link {
        height: auto !important;
        padding: var(--sp-3xs) var(--sp-2xs) !important;
    }

    /* ISSUE #578 — no `order` on `.navbar-nav`: DOM order (brand, links,
       button) must equal focus order, so the links stay on their own
       full-width line ahead of the button rather than being reordered
       above it. `.navbar-nav`'s `flex-basis: 100%` already forces the
       button onto its own row after the links; the unconditional
       `margin-left: auto` then right-aligns it there, so no narrow-only
       override is needed. */
}
/* NAVBAR-CSS-END */


/* ── Public Footer ──────────────────────────────────────────────
   base_public.html chrome (_public_footer.html) — lives here, not in
   home.css, because the footer renders on every page extending the public
   base while home.css is loaded only by `/`. PUBLIC-FOOTER-CSS-START */
.home-footer {
    border-top: 1px solid var(--div);
    background: var(--pm-surface);
    color: var(--text2); /* A11Y: was --text3 (#9CA3AF fails AA); --text2 = #5A6478, 5.95:1 */
    font-size: var(--fs-xs);
}

.home-footer a {
    color: var(--text2); /* A11Y: was --text3 (#9CA3AF fails AA); --text2 = #5A6478, 5.95:1 */
}

.home-footer a:hover {
    color: var(--navy);
}
/* PUBLIC-FOOTER-CSS-END */

/* ── Public report dialog ─── base_public.html chrome (_report_dialog.html), rendered after the
   buffered body, so it cannot use use_css (KB-0094) and lives here. PUBLIC-REPORT-CSS-START */
.pm-report { width: 500px; max-width: calc(100% - 2 * var(--sp-16px)); padding: 0;
    border: 1px solid var(--div); border-radius: var(--radius-sm);
    background: var(--pm-surface); color: var(--text); }
/* ::backdrop inherits custom properties only in 2024+ engines; the fallback keeps older ones dimmed */
.pm-report::backdrop { background: var(--shadow-navy-28, rgba(15, 36, 64, 0.28)); }
.pm-report-in { padding: var(--sp-2xl); }
.pm-report-head { gap: var(--sp-md); margin-bottom: var(--sp-lg); }
.pm-report-title { color: var(--navy); }
.pm-report-close { min-width: 32px; min-height: 32px; padding: 0; border: 0; background: transparent; color: var(--text2); cursor: pointer; }
.pm-report-close:hover { color: var(--navy); }
.pm-report-close:focus-visible, .pm-report-submit:focus-visible { outline: 2px solid var(--navy); outline-offset: 2px; }
.pm-report-message { resize: vertical; }
.pm-report-message:focus { border-color: var(--navy); box-shadow: none; outline: 2px solid var(--navy); outline-offset: 1px; }
.pm-report-hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.pm-report-status { margin: var(--sp-md) 0 0; font-size: var(--fs-sm); color: var(--text); }
.pm-report-foot { margin-top: var(--sp-lg); }
.pm-report-submit { padding: var(--sp-7px) var(--sp-16px); font-size: var(--fs-sm); font-weight: 600;
    color: var(--pm-surface); background: var(--orange-700); border: 1.5px solid var(--orange-700);
    border-radius: var(--radius-sm); cursor: pointer; }
.pm-report-submit:hover { background: var(--navy); border-color: var(--navy); }
.pm-report-submit[aria-disabled="true"] { cursor: progress; }
/* PUBLIC-REPORT-CSS-END */

/* `/` and `/channels` are the two pages that extend base_public.html and mark
   their <main> `id="main-content" class="pm-page …"` (ISSUE #285 DD-6) —
   the id in the selector keeps this from also matching the unrelated
   `<div class="pm-page">` wrapper used by discoveries.html/article.html
   (styled below, 1400px, standalone pages predating this token). */
#main-content.pm-page { max-width: var(--content-max); }

/* ── Page Layout ──────────────────────────────────────────────── */
.pm-page {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.5rem 2rem 3rem;
}

.pm-page-header {
    font-size: 1.61rem;
    font-weight: 700;
    margin-bottom: 1.25rem;
    color: var(--pm-text);
    display: flex;
    align-items: center;
    gap: 0.6rem;
    letter-spacing: -0.01em;
}

.pm-page-header small {
    font-size: 1.01rem;
    font-weight: 400;
    color: var(--pm-text-muted);
}


/* ── Glass Card ──────────────────────────────────────────────── */
.card {
    background: var(--pm-surface);
    border: 1px solid var(--pm-border);
    border-radius: var(--pm-radius-lg);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-shadow: var(--pm-shadow-sm);
    transition: all var(--pm-transition);
}

.card:hover {
    border-color: var(--pm-border-strong);
    box-shadow: var(--pm-shadow-md);
}

.card-header {
    background: rgba(0, 0, 0, 0.02);
    border-bottom: 1px solid var(--pm-border);
    font-weight: 600;
    font-size: 1.06rem;
    padding: 0.75rem 1.1rem;
    color: var(--pm-text-muted);
    letter-spacing: 0.02em;
}


/* ── Stat Cards — Elevated with Accent Border ───────────────── */
.pm-stat {
    position: relative;
    background: var(--pm-surface);
    border: 1px solid var(--pm-border);
    border-radius: var(--pm-radius-lg);
    padding: 1rem 0.6rem;
    text-align: center;
    backdrop-filter: blur(8px);
    box-shadow: var(--pm-shadow-sm);
    overflow: hidden;
    transition: all var(--pm-transition);
}

.pm-stat::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--pm-border-strong), transparent);
    transition: background var(--pm-transition-slow);
}

.pm-stat:hover {
    border-color: var(--pm-border-strong);
    box-shadow: var(--pm-shadow-md);
    transform: translateY(-2px);
}

.pm-stat:hover::before {
    background: linear-gradient(90deg, transparent, var(--pm-accent), transparent);
}

.pm-stat-value {
    font-size: 2.42rem;
    font-weight: 700;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
}

.pm-stat-label {
    font-size: 0.9rem;
    color: var(--pm-text-muted);
    margin-top: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
}

.pm-stat-accent .pm-stat-value { color: var(--pm-accent); }
.pm-stat-accent::before { background: linear-gradient(90deg, transparent, var(--pm-accent), transparent) !important; }
.pm-stat-critical .pm-stat-value { color: var(--pm-critical); }
.pm-stat-critical::before { background: linear-gradient(90deg, transparent, var(--pm-critical), transparent) !important; }
.pm-stat-high .pm-stat-value { color: var(--pm-high); }
.pm-stat-high::before { background: linear-gradient(90deg, transparent, var(--pm-high), transparent) !important; }
.pm-stat-normal .pm-stat-value { color: var(--pm-normal); }
.pm-stat-normal::before { background: linear-gradient(90deg, transparent, var(--pm-normal), transparent) !important; }


/* ── Tables — Refined with Depth ─────────────────────────────── */
.pm-table {
    --bs-table-bg: transparent;
    --bs-table-striped-bg: rgba(0, 0, 0, 0.01);
    --bs-table-hover-bg: rgba(0, 0, 0, 0.02);
    font-size: 1.09rem;
    margin-bottom: 0;
}

.pm-table thead th {
    font-size: 0.9rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--pm-text-muted);
    border-bottom: 2px solid var(--pm-border-strong);
    padding: 0.7rem 0.8rem;
    white-space: nowrap;
    background: rgba(0, 0, 0, 0.015);
}

.pm-table tbody td {
    padding: 0.65rem 0.8rem;
    border-bottom: 1px solid var(--pm-border);
    vertical-align: middle;
}

.pm-table tbody tr {
    transition: all var(--pm-transition);
}

.pm-table-clickable tbody tr {
    cursor: pointer;
}

.pm-table-clickable tbody tr:hover {
    background: rgba(255, 103, 0, 0.03) !important;
    box-shadow: inset 0 0 0 1px rgba(255, 103, 0, 0.06);
}


/* ── Priority Row Indicators — Glowing Left Accent ──────────── */
.row-critical td:first-child { box-shadow: inset 3px 0 0 var(--pm-critical); }
.row-high td:first-child { box-shadow: inset 3px 0 0 var(--pm-high); }
.row-normal td:first-child { box-shadow: inset 3px 0 0 var(--pm-normal); }

.text-priority-critical { color: var(--pm-critical) !important; }
.text-priority-high { color: var(--pm-high) !important; }
.text-priority-normal { color: var(--pm-normal) !important; }
.text-priority-low { color: var(--pm-low) !important; }

.bg-priority-critical { background-color: var(--pm-critical) !important; }
.bg-priority-high { background-color: var(--pm-high) !important; }
.bg-priority-normal { background-color: var(--pm-normal) !important; }


/* ── Badges — Refined Pills ──────────────────────────────────── */
.badge {
    font-weight: 600;
    letter-spacing: 0.03em;
    border-radius: 6px;
    padding: 0.3em 0.6em;
}

.pm-badge-narrative {
    font-size: 0.87rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    padding: 0.3em 0.6em;
    text-decoration: none !important;
    border-radius: 6px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
    transition: all var(--pm-transition);
}

.pm-badge-narrative:hover {
    filter: brightness(1.15);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    transform: translateY(-1px);
}

/* The badge above was designed for a saturated block. On the soft_bg tint (~86% white)
   brightness(1.15) clips it to near-white and the pill vanishes on hover; the heavy
   shadow reads as a floating card. The class itself must stay — static/js/dashboard.js
   hooks it to stop the row-click from swallowing the filter link. */
.pm-badge-narrative.nar-label-soft:hover {
    filter: none;
    box-shadow: 0 1px 3px rgba(15, 23, 42, .12);
}

/* The soft tint is 1.03-1.19:1 against the white table ground, so the fill can no
   longer be what identifies this as a control (WCAG 1.4.11). This pill is the only
   operable one of the four — an <a> that also shares its cell with the row's own
   click target — so it carries a permanent underline instead. Overrides the
   text-decoration:none !important above with equal !important weight. */
.pm-badge-narrative.nar-label-soft {
    text-decoration: underline !important;
    text-underline-offset: 2px;
}


/* ── Buttons — Gradient Hover ────────────────────────────────── */
.btn {
    border-radius: var(--pm-radius);
    font-weight: 500;
    font-size: 1.06rem;
    transition: all var(--pm-transition);
}

.btn-sm {
    padding: 0.35rem 0.85rem;
    font-size: 1.01rem;
    border-radius: 6px;
}

.btn-group-sm .btn {
    font-size: 0.98rem;
    padding: 0.32rem 0.75rem;
}

.btn-primary {
    background: linear-gradient(135deg, #ff6700, #ff8533);
    border: none;
    color: #fff;
    box-shadow: 0 2px 8px rgba(255, 103, 0, 0.2);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #ff8533, #ffa366);
    color: #fff;
    box-shadow: 0 4px 16px rgba(255, 103, 0, 0.3);
    transform: translateY(-1px);
}

.btn-success {
    background: linear-gradient(135deg, #22c55e, #34d399);
    border: none;
    color: #fff;
}

.btn-success:hover {
    background: linear-gradient(135deg, #34d399, #4ade80);
    color: #fff;
    transform: translateY(-1px);
}

.btn-outline-secondary {
    border-color: var(--pm-border-strong);
    color: var(--pm-text-muted);
    background: transparent;
}

.btn-outline-secondary:hover,
.btn-outline-secondary.active {
    background: rgba(0, 0, 0, 0.04);
    border-color: var(--pm-accent);
    color: var(--pm-text);
}

.btn-group .btn-outline-secondary.active {
    background: var(--pm-accent-dim);
    border-color: var(--pm-accent);
    color: var(--pm-accent);
}

.btn-outline-danger {
    border-color: rgba(239, 68, 68, 0.25);
    color: var(--pm-text-muted);
}

.btn-outline-danger:hover,
.btn-outline-danger.active {
    background: rgba(239, 68, 68, 0.10);
    border-color: var(--pm-critical);
    color: var(--pm-critical);
}

.btn-outline-warning {
    border-color: rgba(245, 158, 11, 0.25);
    color: var(--pm-text-muted);
}

.btn-outline-warning:hover,
.btn-outline-warning.active {
    background: rgba(245, 158, 11, 0.10);
    border-color: var(--pm-high);
    color: var(--pm-high);
}

.btn-outline-primary {
    border-color: rgba(59, 130, 246, 0.25);
    color: var(--pm-text-muted);
}

.btn-outline-primary:hover,
.btn-outline-primary.active {
    background: rgba(59, 130, 246, 0.10);
    border-color: var(--pm-normal);
    color: var(--pm-normal);
}


/* ── Filter Bar ──────────────────────────────────────────────── */
.pm-filter-info {
    font-size: 1.01rem;
    color: var(--pm-text-muted);
    margin-left: auto;
}


/* ── Forms — Frosted Inputs ──────────────────────────────────── */
.form-control,
.form-select {
    background: var(--pm-surface);
    border: 1px solid var(--pm-border-strong);
    border-radius: var(--pm-radius);
    color: var(--pm-text);
    font-size: 1.06rem;
    backdrop-filter: blur(4px);
    transition: all var(--pm-transition);
}

.form-control:focus,
.form-select:focus {
    background: var(--pm-surface);
    border-color: var(--pm-accent);
    box-shadow: 0 0 0 3px var(--pm-accent-dim), 0 0 12px rgba(255, 103, 0, 0.1);
    color: var(--pm-text);
}

.form-control-sm,
.form-select-sm {
    font-size: 1.01rem;
    padding: 0.32rem 0.6rem;
}


/* ── Alerts ──────────────────────────────────────────────────── */
.alert {
    border-radius: var(--pm-radius-lg);
    font-size: 1.06rem;
    border: 1px solid;
    backdrop-filter: blur(4px);
}


/* ── Pagination — Rounded Style ──────────────────────────────── */
.pagination .page-link {
    background: var(--pm-surface);
    border-color: var(--pm-border);
    color: var(--pm-text-muted);
    font-size: 1.01rem;
    font-weight: 500;
    border-radius: 6px !important;
    margin: 0 2px;
    transition: all var(--pm-transition);
}

.pagination .page-link:hover {
    background: rgba(0, 0, 0, 0.04);
    color: var(--pm-text);
    border-color: var(--pm-border-strong);
}

.pagination .page-item.active .page-link {
    background: linear-gradient(135deg, #ff6700, #ff8533);
    border-color: transparent;
    color: #fff;
    box-shadow: 0 2px 8px rgba(255, 103, 0, 0.25);
}


/* ── Tabs ─────────────────────────────────────────────────────── */
.nav-tabs {
    border-bottom: 1px solid var(--pm-border);
}

.nav-tabs .nav-link {
    color: var(--pm-text-muted);
    font-size: 1.06rem;
    font-weight: 500;
    border: none;
    border-bottom: 2px solid transparent;
    padding: 0.55rem 1.1rem;
    transition: all var(--pm-transition);
}

.nav-tabs .nav-link:hover {
    color: var(--pm-text);
    border-color: var(--pm-border-strong);
}

.nav-tabs .nav-link.active {
    color: var(--pm-accent);
    border-bottom-color: var(--pm-accent);
    background: transparent;
}


/* ── Progress / Heuristic Bars ───────────────────────────────── */
.progress {
    background: rgba(0, 0, 0, 0.03);
    border-radius: 4px;
    overflow: hidden;
}

.heuristic-bar {
    height: 6px;
    border-radius: 4px;
}

.heuristic-bar .progress-bar {
    border-radius: 4px;
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Gradient progress bar variants */
.heuristic-bar .progress-bar.bg-danger {
    background: linear-gradient(90deg, #ef4444, #f87171) !important;
}

.heuristic-bar .progress-bar.bg-warning {
    background: linear-gradient(90deg, #f59e0b, #fbbf24) !important;
}

.heuristic-bar .progress-bar.bg-info {
    background: linear-gradient(90deg, #ff6700, #ff8533) !important;
}


/* ── Article Detail ──────────────────────────────────────────── */
.text-block {
    white-space: pre-wrap;
    line-height: 1.8;
    font-size: 1.15rem;
}

.glossary-ru { color: #dc2626; font-weight: 600; }
.glossary-et { color: #2563eb; }

.heur-info {
    cursor: pointer;
    opacity: 0.5;
    transition: opacity var(--pm-transition);
}
.heur-info:hover { opacity: 1; }


/* ── Title Subtitle ──────────────────────────────────────────── */
.title-et {
    display: block;
    font-size: 0.98em;
    opacity: 0.5;
    font-style: italic;
    margin-top: 0.15em;
}


/* ── Feed Status Indicators ──────────────────────────────────── */
.status-ok { color: var(--pm-success); }
.status-error { color: var(--pm-critical); }
.status-403 { color: #f97316; }
.status-404 { color: #a855f7; }
.status-timeout { color: var(--pm-high); }
.status-pending { color: var(--pm-low); }
.status-archive { color: var(--pm-text-dim); }


/* ── Entity Badges ───────────────────────────────────────────── */
.entity-loc { color: #60a5fa; }
.entity-per { color: #c084fc; }
.entity-org { color: #34d399; }


/* ── Term Borders ────────────────────────────────────────────── */
.term-negative { border-left: 3px solid var(--pm-critical) !important; }
.term-comparative { border-left: 3px solid var(--pm-high) !important; }
.term-glossary { border-left: 3px solid #a855f7 !important; }
.term-entity { border-left: 3px solid #06b6d4 !important; }


/* ── Heatmap Cells ───────────────────────────────────────────── */
.heatmap-cell {
    transition: all var(--pm-transition);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}


/* ── Narrative Matrix Cards ──────────────────────────────────── */
.pm-matrix-card {
    background: var(--pm-surface);
    border: 1px solid var(--pm-border);
    border-radius: var(--pm-radius-lg);
    backdrop-filter: blur(8px);
    box-shadow: var(--pm-shadow-sm);
    transition: all var(--pm-transition);
}

.pm-matrix-card:hover {
    border-color: var(--pm-accent);
    box-shadow: var(--pm-shadow-md), 0 0 0 1px var(--pm-accent-dim);
}


/* ── Modal ────────────────────────────────────────────────────── */
.modal-content {
    background: var(--pm-surface);
    border: 1px solid var(--pm-border-strong);
    border-radius: var(--pm-radius-lg);
    backdrop-filter: blur(20px);
    box-shadow: var(--pm-shadow-lg);
}

.modal-header {
    border-bottom: 1px solid var(--pm-border);
}

.modal-footer {
    border-top: 1px solid var(--pm-border);
}


/* ── Popover ─────────────────────────────────────────────────── */
.popover {
    --bs-popover-bg: var(--pm-surface-alt);
    --bs-popover-border-color: var(--pm-border-strong);
    border-radius: var(--pm-radius-lg);
    font-size: 1.04rem;
    max-width: 360px;
    box-shadow: var(--pm-shadow-lg);
}


/* ── Custom Scrollbar ────────────────────────────────────────── */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.08);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.12);
}


/* ── Canvas ──────────────────────────────────────────────────── */
canvas {
    border-radius: var(--pm-radius);
}


/* ── Selection ───────────────────────────────────────────────── */
::selection {
    background: rgba(255, 103, 0, 0.25);
    color: var(--pm-text);
}


/* ── KPI Cards (Analytics) ───────────────────────────────────── */
.pm-kpi {
    position: relative;
    background: var(--pm-surface);
    border: 1px solid var(--pm-border);
    border-radius: var(--pm-radius-lg);
    padding: 1.1rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    backdrop-filter: blur(8px);
    box-shadow: var(--pm-shadow-sm);
    overflow: hidden;
    transition: all var(--pm-transition);
}

.pm-kpi:hover {
    border-color: var(--pm-border-strong);
    box-shadow: var(--pm-shadow-md);
    transform: translateY(-1px);
}

.pm-kpi-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.pm-kpi-value {
    font-size: 2.07rem;
    font-weight: 700;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
}

.pm-kpi-label {
    font-size: 0.92rem;
    color: var(--pm-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
    margin-top: 0.1rem;
}


/* ── Heatmap (CSS Grid) ─────────────────────────────────────── */
.pm-heatmap {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 5px;
}

.pm-heatmap-cell {
    background: var(--pm-surface-alt);
    border: 1px solid var(--pm-border);
    border-radius: var(--pm-radius);
    padding: 0.6rem 0.5rem;
    text-align: center;
    cursor: pointer;
    transition: all var(--pm-transition);
}

.pm-heatmap-cell-label {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--pm-text-muted);
    margin-bottom: 0.15rem;
}

.pm-heatmap-cell-count {
    font-weight: 700;
    font-size: 1.35rem;
    font-variant-numeric: tabular-nums;
}

.pm-heatmap-cell:hover {
    border-color: var(--pm-accent);
    transform: scale(1.04);
    box-shadow: 0 0 12px rgba(255, 103, 0, 0.15);
}

.pm-heatmap-cell[data-intensity="0"] {
    background: var(--pm-surface-alt);
    cursor: default;
}
.pm-heatmap-cell[data-intensity="0"] .pm-heatmap-cell-count {
    color: var(--pm-text-dim);
}
.pm-heatmap-cell[data-intensity="0"]:hover {
    border-color: var(--pm-border);
    transform: none;
    box-shadow: none;
}
.pm-heatmap-cell[data-intensity="1"] {
    background: rgba(255, 103, 0, 0.08);
}
.pm-heatmap-cell[data-intensity="1"] .pm-heatmap-cell-count {
    color: var(--pm-accent);
}
.pm-heatmap-cell[data-intensity="2"] {
    background: rgba(239, 68, 68, 0.12);
}
.pm-heatmap-cell[data-intensity="2"] .pm-heatmap-cell-count {
    color: #ef4444;
}
.pm-heatmap-cell[data-intensity="3"] {
    background: rgba(239, 68, 68, 0.20);
    box-shadow: inset 0 0 12px rgba(239, 68, 68, 0.1);
}
.pm-heatmap-cell[data-intensity="3"] .pm-heatmap-cell-count {
    color: var(--pm-critical);
}



/* ── Section Headers (Analytics) ─────────────────────────────── */
.pm-section-header {
    font-size: 0.94rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--pm-text-muted);
    padding-bottom: 0.55rem;
    margin-bottom: 1rem;
    margin-top: 1.75rem;
    border-bottom: 1px solid var(--pm-border);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.pm-section-header::before {
    content: '';
    width: 3px;
    height: 14px;
    background: var(--pm-accent);
    border-radius: 2px;
    flex-shrink: 0;
}


/* ── Chart Cards (Analytics) ─────────────────────────────────── */
.pm-chart-card {
    background: var(--pm-surface);
    border: 1px solid var(--pm-border);
    border-radius: var(--pm-radius-lg);
    padding: 1.5rem;
    backdrop-filter: blur(8px);
    box-shadow: var(--pm-shadow-sm);
    transition: all var(--pm-transition);
}

.pm-chart-card:hover {
    box-shadow: var(--pm-shadow-md);
}

.pm-chart-card h6 {
    font-size: 1.09rem;
    font-weight: 600;
    color: var(--pm-text);
    margin-bottom: 1.1rem;
    letter-spacing: 0.01em;
}


/* ── Entity Type Tabs ────────────────────────────────────────── */
.pm-entity-tabs {
    display: flex;
    gap: 0.35rem;
}
/* Non-color active tab indicator — border-bottom is shape-based, not color-only */
.pm-entity-tabs .btn.active {
    font-weight: 600;
    border-bottom: 3px solid currentColor;
}

/* ── Entity Filter Chip ──────────────────────────────────────── */
.pm-entity-chip {
    font-size: 0.85rem;
}
/* Minimum 24×24 CSS px touch/click target (WCAG 2.2: 2.5.8) */
.pm-entity-chip a {
    text-decoration: none;
    opacity: 0.8;
    padding: 0.25rem 0.4rem;
    display: inline-flex;
    align-items: center;
}
.pm-entity-chip a:hover {
    opacity: 1;
}




/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 768px) {
    .pm-page {
        padding: 1rem 1rem 2rem;
    }

    .pm-stat-value {
        font-size: 1.84rem;
    }
}


/* ═══════════════════════════════════════════════════════════════
   ADMIN DESIGN TOKENS
   Origin: Propamon-20-UI demo (uidemos/) — assets/shared.css + admin.css
   Token mapping (coexistence, not unification — ISSUE #94 OD-5):
     --orange        vs  --pm-accent  (#F26522 vs #ff6700 — kept separate)
     --adm-surface   vs  --pm-surface (#fff — same value, different token)
     --navy          vs  --pm-text    (different palette)
   Scoped: .adm-shell background set here, NOT on body (R-6).
   ═══════════════════════════════════════════════════════════════ */

:root {
    /* Brand tokens (demo origin, coexist with --pm-* above) */
    --orange:      #F26522;
    --orange-soft: #FFF3EA;
    --orange-700:  #C24B0E;
    --navy:        #1B3A5C;
    --navy-900:    #0F2440;
    --navy-50:     #F4F7FB;

    /* Text */
    --text:  #1A2340;
    --text2: #5A6478;
    --text4: #C4C9D4;

    /* Dim text on a --navy-900 ground — today only #pm-chart-tip .pm-tip-pct
       (chart_card.css), whose fill is --navy-900 and whose primary text is
       --pm-surface at 15.59:1. Measured per KB-0019/KB-0020:
         --text-on-navy-dim  #9CA3AF  6.14:1 on #0F2440 (AA text, and visibly
                             de-emphasised against the 15.59:1 primary)
       The ground is in the name because this value is 2.54:1 on #ffffff and
       2.35:1 on --pm-bg: it must never colour text or a UI boundary on a light
       surface. The admin rail's equivalent (--adm-rail-text, 7.51:1 on the same ground)
       stays a separate token — the two palettes coexist, not unified
       (KB-0011), the same call this :root already records for --surface-alt vs
       --pm-surface-alt. */
    --text-on-navy-dim: #9CA3AF;

    /* Lines */
    --div:   #E8EAED;
    --div-2: #F1F3F5;

    /* Status palette */
    --green:       #22A04B;
    --green-700:   #15803D;
    --green-soft:  #E7F5EC;
    --red:         #DC2626;
    --red-700:     #B91C1C;
    --red-soft:    #FEF2F2;
    --yellow:      #D97706;
    --yellow-700:  #B45309;
    --yellow-soft: #FFFBEB;

    /* Alert banner gradient (home page, ISSUE #269) */
    --alert-bg-1:  #FFFAF5;
    --alert-bg-2:  #FFFCF9;

    /* Narrative taxonomy page (ISSUE #305, OQ-8) — cream/parchment panel +
       highlight tokens. Contrast measured against --navy / --text2 (AA text)
       and --orange-700 (AA bold), per KB-0019/KB-0020:
         --parchment     #FBF7F1  navy 10.89 / text2 5.58 / orange-700 4.57
         --parchment-line #ECE0CC (non-text hairline, 1.22 vs --parchment —
                                    not required to clear 3:1)
         --parchment-hi  #FFFCF7  navy 11.36 / text2 5.81 / orange-700 4.77
         --axis-hl       #F9DCC4  navy 8.89 / text2 4.5518 (tightest pair on
                                    the page — do not darken without recomputing)
       The demo's hovered-cell colour (#FFE8D3, --orange-700 = 4.12:1, fails
       AA) is deliberately NOT ported — see taxonomy.css. --parchment-hi is
       the single hover tint used everywhere the demo used #FFE8D3. */
    --parchment:      #FBF7F1;
    --parchment-line: #ECE0CC;
    --parchment-hi:   #FFFCF7;
    --axis-hl:        #F9DCC4;

    /* Article detail page (ISSUE #329, OQ-1) — highlight-legend and NER-chip
       category colours. The four chromatic tokens carry MEANING (they are what
       distinguishes one manipulation signal, or one entity type, from another),
       so substituting --navy for --purple/--blue was rejected: --purple vs
       --navy is 1.24:1 in luminance and adjacent in hue, which would make two
       legend categories indistinguishable (WCAG 1.4.1). Measured per
       KB-0019/KB-0020:
         --purple  #6A1B9A  9.39 on --surface / 9.06 on --surface-alt and
                            --yellow-soft (mark border + legend swatch; needs 3:1)
         --teal    #006064  7.35 / 7.09 on the same three grounds
         --blue    #1D4ED8  6.16 as TEXT on --blue-soft (needs 4.5) / 6.70 on white
         --blue-soft #EFF6FF  LOC chip ground, 1.09 on white (non-text)
         --surface-alt #FAFBFC  callout + legend panel ground, 1.04 on white;
                            text on it: --navy 11.22, --text2 5.74,
                            --orange-700 4.71 (--orange is 3.04 and is NOT used
                            for text on this ground — see article_detail.css)
       --surface-alt coexists with --pm-surface-alt (#f0f1f4) by the same
       "coexistence, not unification" rule this block already records at :1100 —
       different palette family, visibly different value.

       ISSUE #336 adds the fourth legend category (neg_proximity, is-neg):
         --red-700 #B91C1C (declared at :1156, KB-0155 — not the demo's raw
                            --red) 6.47 on --surface / 6.24 on --surface-alt /
                            6.24 on --yellow-soft (mark hover ground); all
                            clear the non-text 3:1 floor. Non-hue channel is
                            border-bottom-style: double at 3px, not a fifth
                            hue — see article_detail.css. */
    --purple:      #6A1B9A;
    --teal:        #006064;
    --blue:        #1D4ED8;
    --blue-soft:   #EFF6FF;
    --surface-alt: #FAFBFC;

    /* Chart series palette (home page trend chart, ISSUE #269) */
    --pm-series-1: #F26522;
    --pm-series-2: #1B3A5C;
    --pm-series-3: #E53E3E;
    --pm-series-4: #805AD5;
    --pm-series-5: #3182CE;
    --pm-series-6: #D69E2E;
    /* Global source ranking on /console/narrative/{code} (ISSUE #495, KB-0237) */
    --pm-series-7: #2F855A;
    --pm-series-8: #319795;
    --pm-series-9: #D53F8C;
    --pm-series-10: #6B8E23;
    --pm-series-11: #4C51BF;
    --pm-series-12: #9B2C2C;
    --pm-series-none: #64748B;

    /* Type stacks */
    --ff-sans:  'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --ff-serif: 'Source Serif 4', 'Source Serif Pro', Georgia, serif;
    --ff-mono:  'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

    /* Type scale (home page, ISSUE #269) — only the three sub-16px sizes,
       because Bootstrap's .fs-1….fs-6 utilities bottom out at 16px. Anything
       at or above that resolves through .fs-N on the markup instead. */
    --fs-2xs: 11px;
    --fs-xs:  12px;
    --fs-sm:  14px;

    /* Spacing scale (home page, ISSUE #269) — gaps, margins and inset offsets.
       Bootstrap's spacer steps (4/8/16/24/48px) express none of these values
       except 4px: 6px and 12px sit exactly midway between two steps and the
       sidebar's list gaps (11/12/14px) compound across rows, so snapping them
       would shift the whole column's rhythm. Padding, which the demo rounds
       more coarsely, stays on the Bootstrap utilities (retry 19). */
    --sp-5xs:  2px;
    --sp-4xs:  3px;
    --sp-3xs:  5px;
    --sp-2xs:  6px;
    --sp-xs:  10px;
    --sp-sm:  11px;
    --sp-md:  12px;
    --sp-lg:  14px;
    --sp-xl:  18px;
    --sp-2xl: 20px;
    --sp-3xl: 22px;
    --sp-4xl: 30px;
    --sp-5xl: 36px;

    /* Radius. The demo squares everything off at 2px; Bootstrap's smallest
       step (.rounded-1 = 4px) doubles it and would round the 8px channel dot
       into a circle. */
    --radius-sm: 2px;

    /* Transition durations — duration only, unlike --pm-transition above,
       which bundles an easing curve. Two steps cover the demo's hand-tuned
       .1/.12/.15/.2s: the first three are one perceptual step apart. */
    --dur-fast: .12s;
    --dur-base: .2s;

    /* Shared layout contracts (each value is a pact between selectors, which
       is why these are tokens where one-off element dimensions are not) */
    --content-max: 1240px;  /* navbar row, alert banner, status strip, .pm-page */
    --navbar-h:      62px;  /* bar height == nav-link height */
    --bar-h:          3px;  /* channel share bar */
    --bar-h-sm:       2px;  /* narrative share bar, deliberately thinner */
    --ring-w:         4px;  /* threat-dot glow ring spread */

    /* Admin surface tokens */
    --adm-bg:               #F4F5F7;
    --adm-rail:             #0F2440;
    --adm-rail-hover:       #1B3A5C;
    --adm-rail-active:      #F26522;
    --adm-rail-text:        #A8B5C8;
    --adm-rail-text-active: #fff;
    --adm-surface:          #fff;
    --adm-border:           #E5E7EB;
    --adm-border-2:         #EEF0F3;
    --adm-thead-bg:         #F9FAFB;
    --adm-row-hover:        #FAFAFA;

    /* Overlay scrim + elevation for admin drawers/dialogs/toasts. One navy
       scrim (navy-900 #0F2440) is the single dimming layer behind every admin
       drawer, so the overlay reads identically on every admin page. The shadow
       family shares the same navy. */
    --adm-scrim:            rgba(15, 36, 64, 0.38);
    --shadow-navy-18:       rgba(15, 36, 64, 0.18);
    --shadow-navy-24:       rgba(15, 36, 64, 0.24);
    --shadow-navy-28:       rgba(15, 36, 64, 0.28);

    /* /console/discoveries (ISSUE #499) — the candidate-card type/mechanism
       chips need four distinguishable soft backgrounds the existing palette
       doesn't carry; tokenised at the prototype's literal values (§ Stiilid). */
    --dsc-type-neg-bg:  #FCE4E4;
    --dsc-type-neg-fg:  #B02A25;
    --dsc-type-pat-bg:  #EDE9FE;
    --dsc-type-pat-fg:  #5B3FC4;
    --dsc-type-glo-bg:  #E0F2FE;
    --dsc-type-glo-fg:  #0C6291;
    --dsc-type-ner-bg:  #FFF4E5;
    --dsc-type-ner-fg:  #9C5200;  /* 5.34:1 on --dsc-type-ner-bg, was #B4690E at 3.89:1 (WCAG 1.4.3) */
    --dsc-mark-bg:      #FFE9C7;
    --dsc-mark-fg:      #7A4A05;
    --dsc-src-auto-bg:  #EEF2FF;
    --dsc-src-auto-fg:  #3E4FAE;
    --dsc-bulkbar-link: rgba(255, 255, 255, 0.65);
    --radius-1px:       1px;
    --radius-3xs:       3px;
    --radius-md:        4px;
    --sp-4px:           4px;
    --sp-7px:           7px;
    --sp-8px:           8px;
    --sp-9px:           9px;
    --sp-16px:          16px;
}


/* Bootstrap modal backdrops (delete-confirms on Sihtmärgid, Allikad, Kasutajad)
   share the same navy scrim as the admin drawers, so every admin overlay reads
   identically. Only admin pages mount a Bootstrap modal, so this has no
   public-page effect. --adm-scrim is #0F2440 at .38, matched here as an opaque
   bg + Bootstrap's own opacity. */
.modal-backdrop {
    --bs-backdrop-bg: #0F2440;
    --bs-backdrop-opacity: .38;
}


/* ── ADMIN SHELL — background scoped here, not on body (R-6) ── */
.adm-shell {
    background: var(--adm-bg);
    display: grid;
    grid-template-columns: 240px 1fr;
    min-height: 100vh;
}


/* ── LEFT RAIL ───────────────────────────────────────────────── */
.adm-rail {
    background: var(--adm-rail);
    color: var(--adm-rail-text);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
}

.adm-rail-top {
    padding: 18px 20px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, .06);
}

.adm-rail-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #fff;
    text-decoration: none;
}

.adm-rail-mark {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
    background: var(--adm-rail-active);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-family: var(--ff-serif);
    font-weight: 700;
    font-size: 15px;
    object-fit: contain;
}

.adm-rail-name {
    font-family: var(--ff-sans);
    font-weight: 700;
    font-size: 18px;
    line-height: 1;
}

.adm-rail-name span {
    color: var(--adm-rail-active);
}

.adm-rail-tag {
    font-size: 9.5px;
    letter-spacing: 1.4px;
    text-transform: uppercase;
    color: rgba(255, 255, 255, .55); /* .55 — readable on dark navy rail */
    margin-top: 6px;
    font-weight: 600;
}

.adm-rail-section {
    padding: 18px 14px 6px;
    font-size: 9.5px;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    color: rgba(255, 255, 255, .50); /* ~4.89:1 on navy rail — WCAG AA (normal text) */
    font-weight: 700;
}

.adm-rail-nav {
    display: flex;
    flex-direction: column;
    gap: 1px;
    padding: 0 10px;
}

.adm-rail-link {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 9px 12px;
    border-radius: 4px;
    color: var(--adm-rail-text);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    transition: background .12s, color .12s;
}

.adm-rail-link:hover {
    background: var(--adm-rail-hover);
    color: #fff;
}

.adm-rail-link.on {
    background: var(--adm-rail-hover);
    color: #fff;
    box-shadow: inset 3px 0 0 var(--adm-rail-active);
}

.adm-rail-link.disabled {
    opacity: .45;
    cursor: default;
    pointer-events: none;
}

.adm-rail-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    opacity: .85;
}

.adm-rail-link.on .adm-rail-icon {
    opacity: 1;
}

.adm-rail-link span.label {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.adm-rail-bottom {
    margin-top: auto;
    padding: 14px;
    border-top: 1px solid rgba(255, 255, 255, .06);
}

.adm-rail-actions {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.adm-rail-action {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 7px 8px;
    border-radius: 3px;
    font-size: 11.5px;
    color: rgba(255, 255, 255, .6);
    text-decoration: none;
    cursor: pointer;
    background: none;
    border: 0;
    width: 100%;
    text-align: left;
    font-family: inherit;
}

.adm-rail-action:hover {
    background: var(--adm-rail-hover);
    color: #fff;
}


/* ── MAIN AREA ───────────────────────────────────────────────── */
.adm-main {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.adm-topbar {
    background: var(--adm-surface);
    border-bottom: 1px solid var(--adm-border);
    height: 56px;
    padding: 0 28px;
    display: flex;
    align-items: center;
    gap: 18px;
    position: sticky;
    top: 0;
    z-index: 20;
}

.adm-crumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text2);
}

.adm-crumb b {
    color: var(--navy);
    font-weight: 600;
}

.adm-crumb .sep {
    color: var(--text2); /* A11Y: 1.4.3 — was --text3 (2.54:1 on the topbar's --adm-surface); --text2 = 5.95:1, which is the rule KB-0019 already states for admin text */
}

.adm-content {
    padding: 28px 32px 60px;
    flex: 1;
}

.adm-page-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 22px;
}

.adm-h1 {
    font-family: var(--ff-serif);
    font-size: 28px;
    font-weight: 600;
    color: var(--navy);
    letter-spacing: -.6px;
    line-height: 1.1;
}

.adm-h1-sub {
    font-size: 13px;
    color: var(--text2);
    margin-top: 5px;
    line-height: 1.5;
}


/* ── BUTTONS ────────────────────────────────────────────────── */
.adm-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 3px;
    border: 1px solid var(--adm-border);
    background: #fff;
    color: var(--text);
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    transition: all .12s;
    font-family: inherit;
    text-decoration: none;
}

.adm-btn:hover {
    border-color: var(--navy);
    color: var(--navy);
}

.adm-btn:focus-visible {
    outline: 2px solid var(--navy);
    outline-offset: 2px;
}

/* --orange-700 for WCAG AA contrast (≥4.5:1) with white */
.adm-btn.primary {
    background: var(--orange-700);
    border-color: var(--orange-700);
    color: #fff;
}

.adm-btn.primary:hover {
    background: var(--orange-700); /* #C24B0E: 4.88:1 with #fff (WCAG AA) */
    border-color: var(--orange-700);
    color: #fff;
    box-shadow: 0 0 0 2px rgba(194, 75, 14, 0.25); /* subtle hover cue */
}

.adm-btn.ghost {
    background: transparent;
    border-color: transparent;
}

.adm-btn.ghost:hover {
    background: var(--adm-bg);
    border-color: var(--adm-border);
}

.adm-btn.danger {
    color: var(--red-700);
    border-color: var(--red-soft);
}

.adm-btn.danger:hover {
    background: var(--red-700);
    color: #fff;
    border-color: var(--red-700);
}

.adm-btn.sm {
    padding: 5px 9px;
    font-size: 11.5px;
    gap: 4px;
}

.adm-btn-icon {
    padding: 6px;
    width: 30px;
    height: 30px;
    justify-content: center;
}


/* ── CARDS / SURFACES ───────────────────────────────────────── */
.adm-card {
    background: var(--adm-surface);
    border: 1px solid var(--adm-border);
    border-radius: 4px;
}

.adm-card-head {
    padding: 14px 18px;
    border-bottom: 1px solid var(--adm-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.adm-card-title {
    margin: 0;
    font-size: 13px;
    font-weight: 700;
    line-height: inherit;
    color: var(--navy);
    letter-spacing: .1px;
}

.adm-card-body {
    padding: 18px;
}

/* flush modifier: zero body padding */
.adm-card-body--flush {
    padding: 0;
}

.adm-card-foot {
    padding: 12px 18px;
    border-top: 1px solid var(--adm-border);
    background: var(--adm-thead-bg);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11.5px;
    color: var(--text2); /* #5A6478 — WCAG AA ≥4.5:1 on white */
}


/* ── TOOLBAR / CHIPS ─────────────────────────────────────────── */
.adm-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

.adm-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 11px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text2);
    background: #fff;
    border: 1px solid var(--adm-border);
    border-radius: 3px;
    cursor: pointer;
    transition: all .12s;
    text-decoration: none;
}

.adm-chip:hover {
    border-color: var(--navy);
    color: var(--navy);
}

.adm-chip.on {
    background: var(--orange-soft);
    border-color: var(--orange);
    color: #B8430C; /* 4.75:1 on --orange-soft #FFF3EA (WCAG AA) */
}

.adm-chip:focus-visible {
    outline: 2px solid var(--orange);
    outline-offset: 2px;
}

/* ISSUE #544 DR-7: classifier-source chips on /console/narrative/{code}
   become hidden-radio + sibling-label, the same mechanism as the date pills
   (.adm-choice-input, DR-1) — kept as its own rule block because the two
   visual families' focus colour already disagreed (navy vs orange) before
   this change. `.adm-chip.on` (server-rendered, still used by the
   "Aktiivsed: … ×" row and the Avastused type/status chips) is untouched. */
.adm-choice-input:checked + .adm-chip {
    background: var(--orange-soft);
    border-color: var(--orange);
    color: #B8430C;
}

.adm-choice-input:hover + .adm-chip {
    border-color: var(--navy);
    color: var(--navy);
}

.adm-choice-input:focus-visible + .adm-chip {
    outline: 2px solid var(--orange);
    outline-offset: 2px;
}

.adm-toolbar-lbl {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--text2);
}

.adm-toolbar-spacer {
    flex: 1;
}

.adm-chip-x {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    min-height: 24px;
    color: var(--text2);
    text-decoration: none;
    border-radius: 3px;
}

.adm-chip-x:hover {
    color: var(--red-700);
}

.adm-chip-x:focus-visible {
    outline: 2px solid var(--orange);
    outline-offset: 2px;
}

.adm-text-secondary {
    color: var(--text2);
}


/* ── FORM INPUTS ────────────────────────────────────────────── */
.adm-input {
    background: #fff;
    border: 1px solid var(--adm-border);
    border-radius: 3px;
    padding: 7px 11px;
    font-size: 12.5px;
    color: var(--text);
    font-family: inherit;
    outline: none;
    transition: border-color .12s;
}

.adm-input:focus {
    border-color: var(--navy);
}

.adm-input:focus-visible {
    outline: 2px solid var(--navy);
    outline-offset: 1px;
    border-color: var(--navy);
}

.adm-input.sm {
    padding: 5px 9px;
    font-size: 11.5px;
}

.adm-inline-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.adm-inline-field label {
    font-size: 10.5px;
    font-weight: 600;
    color: var(--text2); /* #5A6478 — WCAG AA ≥4.5:1 on white */
    text-transform: uppercase;
    letter-spacing: .4px;
}

.adm-date-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 10.5px;
    font-weight: 600;
    color: var(--text2);
    text-transform: uppercase;
    letter-spacing: .4px;
}


/* ── TABLE ──────────────────────────────────────────────────── */
.adm-table-wrap {
    background: #fff;
    border: 1px solid var(--adm-border);
    border-radius: 4px;
    overflow: hidden;
}

/* A floating funnel popover (.col-filter-pop) is an absolutely positioned
   descendant of this wrap; overflow:hidden above clips it whenever the table
   is short. Wraps that host one opt out and hand-restore the corner radii
   overflow:hidden was providing (ISSUE #345 / KB-0132). The thead corners are
   restored only when the table is the wrap's top edge: a wrap that opens with
   a card head (/console/clusters #klastrid) restores just the foot. */
.adm-table-wrap.has-popovers { overflow: visible; }
.adm-table-wrap.has-popovers > .adm-table:first-child thead th:first-child { border-top-left-radius: 4px; }
.adm-table-wrap.has-popovers > .adm-table:first-child thead th:last-child  { border-top-right-radius: 4px; }
.adm-table-wrap.has-popovers .adm-table-foot { border-radius: 0 0 4px 4px; }

.adm-table {
    width: 100%;
    border-collapse: collapse;
}

.adm-table thead th {
    text-align: left;
    padding: 11px 14px;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: .7px;
    text-transform: uppercase;
    color: var(--text2); /* #5A6478 — WCAG AA ≥4.5:1 on white */
    background: var(--adm-thead-bg);
    border-bottom: 1px solid var(--adm-border);
    white-space: nowrap;
}

.adm-table thead th.num {
    text-align: right;
}

.adm-table tbody tr {
    border-bottom: 1px solid var(--adm-border-2);
    transition: background .1s;
}

.adm-table tbody tr:last-child {
    border-bottom: none;
}

.adm-table tbody tr:hover {
    background: var(--adm-row-hover);
}

.adm-table td {
    padding: 13px 14px;
    font-size: 12.5px;
    color: var(--text);
    vertical-align: middle;
}

.adm-table td.muted {
    color: var(--text2); /* #5A6478 — WCAG AA ≥4.5:1 on white */
}

.adm-table.adm-t-articles td.num {
    text-align: center;
}

.adm-table td.actions {
    text-align: right;
    white-space: nowrap;
}

.adm-table td a {
    color: var(--navy);
    text-decoration: none;
    font-weight: 500;
}

/* ── SORT LINKS ─────────────────────────────────────────────────── */
.adm-sort-link {
    color: var(--text2);
    text-decoration: none;
    font-size: inherit;
    font-weight: inherit;
    letter-spacing: inherit;
    text-transform: inherit;
}

.adm-sort-link:hover {
    color: var(--navy);
}

.adm-sort-link.on {
    color: var(--navy);
    font-weight: 700;
}

.adm-sort-link:focus-visible {
    outline: 2px solid var(--orange);
    outline-offset: 2px;
    border-radius: 2px;
}


/* ── CHIPS ROW ──────────────────────────────────────────────────── */
.adm-chips-row {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 10px;
}


/* ── SEARCH ROW ─────────────────────────────────────────────────── */
.adm-search-row {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 14px;
}


/* ── INLINE LINK (table cells, etc.) ───────────────────────────── */
.adm-link {
    color: var(--navy);
    text-decoration: none;
    font-weight: 500;
}

.adm-link:hover {
    color: var(--orange-700);
    text-decoration: underline;
}

.adm-link:focus-visible {
    outline: 2px solid var(--orange);
    outline-offset: 2px;
    border-radius: 2px;
}


/* ── STATUS PILLS ───────────────────────────────────────────── */
.adm-status-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
}

.adm-status-pill::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

/* Contrast-safe foreground colours (all ≥4.5:1 on their bg).
   .ok   #166534 on #E5F4EC = 7.5:1   .warn #92400E on #FFF4E5 = 5.5:1
   .err  #991B1B on #FCE4E4 = 7.1:1   .idle var(--text2)/#5A6478 on --adm-bg/#F4F5F7 = 5.95:1 */
.adm-status-pill.ok   { background: #E5F4EC; color: #166534; }
.adm-status-pill.warn { background: #FFF4E5; color: #92400E; }
.adm-status-pill.err  { background: #FCE4E4; color: #991B1B; }
.adm-status-pill.idle { background: var(--adm-bg); color: var(--text2); }


/* ── TABLE FOOTER / PAGER ───────────────────────────────────── */
.adm-table-foot {
    padding: 10px 14px;
    background: var(--adm-thead-bg);
    border-top: 1px solid var(--adm-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 11.5px;
    color: var(--text2); /* #5A6478 — WCAG AA ≥4.5:1 on white */
}

.adm-pager {
    display: flex;
    gap: 3px;
}

.adm-pager a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 26px;
    background: #fff;
    border: 1px solid var(--adm-border);
    border-radius: 3px;
    font-size: 11.5px;
    font-weight: 600;
    color: var(--text2);
    text-decoration: none;
    padding: 0 6px;
}

.adm-pager a:hover {
    border-color: var(--navy);
    color: var(--navy);
}

.adm-pager a:focus-visible {
    outline: 2px solid var(--orange);
    outline-offset: 2px;
}

.adm-pager a.on {
    background: var(--navy);
    border-color: var(--navy);
    color: #fff;
}

.adm-pager a[aria-disabled="true"] {
    opacity: .4;
    pointer-events: none;
}

.adm-pager-disabled {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 26px;
    background: #fff;
    border: 1px solid var(--adm-border);
    border-radius: 3px;
    font-size: 11.5px;
    font-weight: 600;
    color: var(--text2);
    padding: 0 6px;
    opacity: .4;
    cursor: default;
    user-select: none;
}


/* ── KPI WIDGETS ────────────────────────────────────────────── */
.adm-kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-bottom: 18px;
}

.adm-kpi-grid--3 {
    grid-template-columns: repeat(3, 1fr);
}

.adm-kpi {
    background: #fff;
    border: 1px solid var(--adm-border);
    border-radius: 4px;
    padding: 16px 18px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.adm-kpi-lbl {
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: .7px;
    text-transform: uppercase;
    color: var(--text2); /* A11Y: was --text3 (#9CA3AF fails AA); --text2 = #5A6478, 5.95:1 */
}

.adm-kpi-val {
    font-family: var(--ff-serif);
    font-size: 28px;
    font-weight: 600;
    color: var(--navy);
    line-height: 1;
    letter-spacing: -.5px;
}

.adm-kpi-val a {
    color: inherit;
    text-decoration: underline;
    text-decoration-color: var(--adm-border-2);
    text-underline-offset: 4px;
}

.adm-kpi-val a:hover,
.adm-kpi-val a:focus-visible {
    text-decoration-color: currentColor;
}

/* A KPI tile whose value is a set of narrative pills, not a number */
.adm-kpi-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    font-family: var(--ff-sans);
    letter-spacing: 0;
    line-height: 1.3;
}

.adm-kpi-foot {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 11.5px;
    color: var(--text2);
}

.adm-kpi-delta {
    font-weight: 700;
}

.adm-kpi-spark {
    height: 30px;
    margin-top: 4px;
}

@media (max-width: 1100px) {
    .adm-kpi-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Two 3-tile rows in a 2-column grid would each leave a hole; flow them as one grid instead */
    .adm-kpi-stack {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 14px;
        margin-bottom: 1.5rem;
    }

    .adm-kpi-stack > .adm-kpi-grid {
        display: contents;
    }
}


/* ── EMPTY STATE ─────────────────────────────────────────────── */
.adm-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
    color: var(--text2); /* A11Y: was --text3 (#9CA3AF fails AA); --text2 = #5A6478, 5.95:1 */
    text-align: center;
    gap: 12px;
}

.adm-empty-state-icon {
    font-size: 2.5rem;
    opacity: .5;
}

.adm-empty-state-msg {
    font-size: 13px;
    color: var(--text2); /* A11Y: was --text3 (#9CA3AF fails AA); --text2 = #5A6478, 5.95:1 */
}


/* ── ALERTS in admin shell ───────────────────────────────────── */
.adm-alert {
    padding: 10px 14px;
    border-radius: 4px;
    font-size: 12.5px;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.adm-alert__body {
    min-width: 0;
    overflow-wrap: anywhere;
}

.adm-alert__body p {
    margin: 0;
}

.adm-alert.danger {
    background: var(--red-soft);
    color: var(--red-700);
    border: 1px solid rgba(220, 38, 38, .2);
}

.adm-alert.success {
    background: var(--green-soft);
    color: var(--green-800);
    border: 1px solid rgba(34, 160, 75, .2);
}


/* ── ADMIN-SHELL DASHBOARD OVERRIDES ─────────────────────────────
   All rules below are scoped to .adm-shell so the PUBLIC dark
   dashboard is unaffected. Applied in response to review #96.
   ─────────────────────────────────────────────────────────────── */

:root {
    --green-700: #15803D;
    --green-800: #146c34; /* ~6.3:1 on --green-soft — success-alert text needs more margin than --green-700 (~4.46:1) */
}

/* Chart cards inside admin shell are transparent containers */
.adm-shell .pm-chart-card {
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 0;
}

/* Section headers use --text2 for AA contrast */
.adm-shell .pm-section-header { color: var(--text2); }

/* Filter info text uses --text2 for AA contrast */
.adm-shell .pm-filter-info { color: var(--text2); }

/* Heatmap cell labels use --navy for strong contrast */
.adm-shell .pm-heatmap-cell-label { color: var(--navy); }


/* ═══════════════════════════════════════════════════════════════
   ADMIN ARTICLE DETAIL — .aa-* and .ner-* classes
   Ported from the Propamon-20-UI demo (uidemos/) AdminArticle.html <style>
   with WCAG AA fixes applied (AC-10, feedback_admin_palette_contrast).
   No @import, no CDN — fonts come from admin_base.html/fonts.css.
   ═══════════════════════════════════════════════════════════════ */

/* Back-link */
.aa-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text2);       /* #5A6478 — AA on white (5.95:1) */
    margin-bottom: 14px;
    cursor: pointer;
    text-decoration: none;
}
.aa-back:hover { color: var(--orange-700); }

/* Translate button (ISSUE #391) — sits above the language tabs */
.aa-tr-form {
    display: flex;
    justify-content: flex-end;
    padding: 10px 14px 0;
}

/* Two-column grid */
.aa-grid {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 22px;
    align-items: start;
    margin-top: 4px;
}

/* Article title */
.aa-title-ru {
    font-family: var(--ff-serif);
    font-size: 22px;
    font-weight: 600;
    color: var(--navy);
    line-height: 1.3;
    letter-spacing: -.3px;
    margin-bottom: 12px;
    text-wrap: balance;
}

/* Meta row */
.aa-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 18px;
    align-items: center;
    font-size: 12px;
    color: var(--text2);       /* #5A6478 — AA on white (5.95:1) */
    margin-bottom: 4px;
}
.aa-meta .dot {
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: var(--text4);
}
.aa-meta b { color: var(--navy); font-weight: 600; }

/* Mono utility */
.aa-mono {
    font-family: var(--ff-mono);
    font-size: 11.5px;
    color: var(--text2);       /* WCAG AA fix: was --text3 (#9CA3AF fails 4.5:1 on white) */
}

/* Article body text */
.aa-body {
    font-family: var(--ff-serif);
    font-size: 15px;
    line-height: 1.72;
    color: var(--text);
    max-width: 64ch;
}
.aa-body p { margin-bottom: 15px; }

/* Summary block — sits between the article's meta row and its body, and is a
   .aa-pane so it switches with the language tabs (ISSUE #420/#421) */
.aa-sum {
    margin-top: 16px;
    padding: 12px 14px;
    background: var(--adm-bg);
    border-left: 3px solid var(--orange);
    border-radius: 3px;
    max-width: 64ch;
}
/* Targets the text element, not every <p> in the block: the provenance marker
   is a <p> too, and `.aa-sum p` (0,1,1) outranked its own (0,1,0) size rule. */
.aa-sum .aa-sum-txt {
    font-size: 13.5px;
    line-height: 1.6;
    color: var(--text);
    margin: 0;
}

/* Machine-text notices — original-language, machine-translated, AI-written.
   One shape for all of them (ISSUE #512): only the tint says which is which,
   so the same notice never reads as two different weights of statement
   depending on which block it sits in. Mirrored by `.pm-ai-note` in
   static/css/components/article_detail.css for the public page. */
.aa-trans-note,
.aa-mt-note {
    font-size: var(--fs-xs);
    color: var(--text2);       /* WCAG AA fix: was --text3 */
    font-style: italic;
    padding: var(--sp-3xs) var(--sp-xs);
    border-radius: 3px;
    margin-bottom: var(--sp-lg);
    display: flex;
    align-items: center;
    gap: var(--sp-2xs);
}

.aa-trans-note { background: var(--adm-bg); }

.aa-mt-note { background: var(--orange-soft); }

/* Language tabs */
.aa-tabs {
    display: flex;
    gap: 2px;
    border-bottom: 1px solid var(--adm-border);
    margin-bottom: 0;
    padding: 0 4px;
}
.aa-tab {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 11px 15px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text2);       /* WCAG AA fix: was --text3 */
    cursor: pointer;
    border: none;
    background: none;
    font-family: inherit;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: color .12s;
}
.aa-tab:hover { color: var(--navy); }
.aa-tab:focus-visible { outline: 2px solid var(--navy); outline-offset: 2px; }
.aa-tab.on { color: var(--orange-700); border-bottom-color: var(--orange); }
.aa-tab .flag {
    font-size: 11px;
    font-weight: 700;
    font-family: var(--ff-mono);
    opacity: .7;
}
.aa-tab.on .flag { opacity: 1; }
.aa-tab .badge-orig {
    font-size: 9.5px;
    font-weight: 700;
    letter-spacing: .4px;
    text-transform: uppercase;
    color: var(--text2);
    background: var(--adm-bg);
    padding: 2px 6px;
    border-radius: 2px;
}

/* Language panes */
.aa-pane { display: none; }
.aa-pane.on { display: block; }

/* Narrative tag — colour is data-driven: --lbl-bg/--lbl-ink set inline, consumed by .nar-label-soft. */
.aa-nar-tag {
    display: inline-block;
    padding: 3px 10px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 2px;
}

/* KV metadata list */
.aa-kv { display: flex; flex-direction: column; gap: 0; }
.aa-kv-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--adm-border-2);
}
.aa-kv-row:last-child { border-bottom: none; }
.aa-kv-k {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .4px;
    text-transform: uppercase;
    color: var(--text2);       /* WCAG AA fix: was --text3 */
}
.aa-kv-v {
    font-size: 12.5px;
    color: var(--navy);
    font-weight: 500;
    text-align: right;
}

/* Risk score display */
.aa-risk { display: flex; align-items: baseline; gap: 8px; }
.aa-risk-num {
    font-family: var(--ff-serif);
    font-size: 40px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: -1.5px;
    font-variant-numeric: tabular-nums;
}
/* WCAG AA risk colors (verified ≥4.5:1 on white):
   hi #C0392B = 5.36:1   md #A05C00 = 5.70:1   lo #166534 = 7.20:1 */
.aa-risk-num.hi { color: #C0392B; }
.aa-risk-num.md { color: #A05C00; }
.aa-risk-num.lo { color: #166534; }
.aa-risk-unit { font-size: 18px; color: var(--text2); font-weight: 400; }
.aa-risk-bar {
    height: 6px;
    background: var(--adm-bg);
    border-radius: 3px;
    overflow: hidden;
    margin-top: 12px;
}
.aa-risk-bar div { height: 100%; }
.aa-risk-bar div.hi { background: #C0392B; }
.aa-risk-bar div.md { background: #C77B0E; }
.aa-risk-bar div.lo { background: #1F8B5F; }

/* Section label (uppercase) */
.aa-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .5px;
    text-transform: uppercase;
    color: var(--text2);       /* WCAG AA fix: was --text3 */
    margin-bottom: 8px;
}

/* Heuristic bar (admin variant using aa-* classes) */
.ner-group { margin-bottom: 16px; }
.ner-group:last-child { margin-bottom: 0; }
.ner-glabel {
    font-family: var(--ff-mono);
    font-size: 11px;
    color: var(--text2);       /* WCAG AA fix: was --text3 */
    margin-bottom: 8px;
}
.ner-tags { display: flex; flex-wrap: wrap; gap: 7px; }
.ner-tag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12.5px;
    font-weight: 500;
    padding: 5px 11px;
    border-radius: 4px;
    line-height: 1.2;
    cursor: default;
}
.ner-tag .cnt {
    font-size: 10.5px;
    font-weight: 600;
    opacity: .7;
    font-variant-numeric: tabular-nums;
}
/* NER color groups — AA on their backgrounds */
.ner-loc { background: #EAF1FB; color: #2A63B8; }  /* #2A63B8 = 5.43:1 on #EAF1FB */
.ner-per { background: #E7F4EC; color: #1F8B5F; }  /* #1F8B5F = 4.68:1 on #E7F4EC */
.ner-org { background: #FCEEE4; color: #C25A1E; }  /* #C25A1E = 4.59:1 on #FCEEE4 */

/* Correction feedback */
.aa-correction-feedback {
    font-size: 12px;
    margin-top: 8px;
    color: var(--text2);
}

@media (max-width: 900px) {
    .aa-grid { grid-template-columns: 1fr; }
}
/* ══════════════════════════════════════════════════════════════════════
   #116 — Allikad design-parity additions
   All palette-contrast rules: NEVER --text3 for text; use --text2/--orange-700.
   ══════════════════════════════════════════════════════════════════════ */

/* ── UNDERLINE TABS ──────────────────────────────────────────────────
   Ported from demo admin.css:133-142 with palette correction:
   .adm-tab .count: demo uses --text3 (fails AA) → use --text2 (#5A6478, 5.95:1)
   Active tab: border-bottom 2px solid --orange; count: --orange-700 on --orange-soft
   ────────────────────────────────────────────────────────────────────── */
.adm-tabs {
    display: flex;
    align-items: center;
    gap: 0;
    border-bottom: 2px solid var(--adm-border);
    margin-bottom: 16px;
}

.adm-tab {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 16px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text2); /* #5A6478, 5.95:1 on white — WCAG AA */
    text-decoration: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: color .12s, border-color .12s;
    white-space: nowrap;
}

.adm-tab:hover {
    color: var(--navy);
    border-bottom-color: var(--adm-border);
}

.adm-tab.on {
    color: var(--navy);
    border-bottom-color: var(--orange);
    background: var(--orange-soft);
    border-radius: 4px 4px 0 0;
}

.adm-tab .count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    font-size: 10.5px;
    font-weight: 700;
    background: var(--adm-border);
    color: var(--text2); /* palette fix: demo --text3 fails AA; --text2 = #5A6478, 5.95:1 */
}

.adm-tab.on .count {
    background: var(--orange-soft);
    color: #B45309; /* 4.61:1 on --orange-soft #FFF3EA — WCAG AA */
}

.adm-tab:focus-visible {
    outline: 2px solid var(--orange);
    outline-offset: 2px;
    border-radius: 4px;
}


/* ── SOURCES SUBNAV (Allikad / Sihtmärgid, #266) ─────────────────────
   Top-level subnav above the .adm-tabs RSS/Telegram/archived tabs.
   Inactive = --text2 (not --text3, fails AA); active = --orange-700 text +
   --orange underline (KB-0019 / palette memory) — same pattern as .aa-tab.
   ────────────────────────────────────────────────────────────────────── */
.adm-subnav {
    display: flex;
    align-items: center;
    gap: 4px;
    border-bottom: 1px solid var(--adm-border);
    margin-bottom: 16px;
}

.adm-subnav-item {
    display: inline-flex;
    align-items: center;
    padding: 9px 4px;
    margin-right: 20px;
    font-size: 13.5px;
    font-weight: 700;
    color: var(--text2); /* #5A6478, 5.95:1 on white — WCAG AA */
    text-decoration: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: color .12s, border-color .12s;
}

.adm-subnav-item:hover {
    color: var(--navy);
}

.adm-subnav-item.on {
    color: var(--orange-700);
    border-bottom-color: var(--orange);
}

.adm-subnav-item:focus-visible {
    outline: 2px solid var(--orange);
    outline-offset: 2px;
    border-radius: 4px;
}


/* ── COLUMN FILTER (funnel popover) ─────────────────────────────────
   Ported from demo. PALETTE FIX: .col-filter resting → --text2 (not --text3);
   hover/has-filter → --orange on --orange-soft. .col-filter-pop label → --text2.
   ────────────────────────────────────────────────────────────────────── */
.adm-table thead th {
    position: relative; /* needed for .col-filter-pop absolute positioning */
}

.col-filter {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px; /* WCAG 2.5.8 target size — glyph stays 10px, hit box grows */
    height: 24px;
    border: none;
    background: none;
    cursor: pointer;
    color: var(--text2); /* palette fix: --text2 not --text3 for accessible control */
    padding: 0;
    margin-left: 4px;
    border-radius: 2px;
    font-size: 10px;
    transition: color .12s, background .12s;
    vertical-align: middle;
    font-family: inherit;
}

.col-filter:hover,
.col-filter:focus-visible {
    color: var(--orange-700);
    background: var(--orange-soft);
}

.col-filter:focus-visible {
    outline: 2px solid var(--orange);
    outline-offset: 1px;
}

th.has-filter .col-filter {
    color: var(--orange-700);
    opacity: 1;
    background: var(--orange-soft);
    border-radius: 2px;
}

.col-filter-pop {
    display: none;
    position: absolute;
    top: calc(100% + 2px);
    left: 0;
    z-index: 200;
    background: #fff;
    border: 1px solid var(--adm-border);
    border-radius: 4px;
    box-shadow: 0 8px 22px rgba(15,36,64,.12);
    padding: 10px;
    width: 220px;
    white-space: normal;
    /* .adm-table thead th sets uppercase + letter-spacing .7px — the popover
       sits inside that <th> and would otherwise inherit both onto its typed
       inputs and the Tühjenda/Rakenda pair (R-22e proto-conformance). */
    text-transform: none;
    letter-spacing: normal;
}

/* Open state renders the floating card above (no chrome-cancelling override) —
   the wrap opts out of overflow:hidden via has-popovers so it isn't clipped
   (ISSUE #345 / KB-0132). */
details.col-filter-details[open] > .col-filter-pop {
    display: block;
}

.col-filter-pop label {
    display: block;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: .4px;
    text-transform: uppercase;
    color: var(--text2); /* palette fix: --text3 fails AA → --text2 */
    margin-bottom: 5px;
}

.col-filter-pop .adm-input {
    width: 100%;
    box-sizing: border-box;
    margin-bottom: 6px;
}

.col-filter-pop select.adm-input {
    padding-right: 22px;
}

.col-filter-actions {
    display: flex;
    gap: 6px;
    margin-top: 8px;
    justify-content: flex-end;
}


/* ── SORTABLE-HEADER LAYOUT (ISSUE #347) ─────────────────────────────
   Ported from uidemos/current/assets/admin.css:192-198 (tokens only).
   ────────────────────────────────────────────────────────────────────── */
.adm-table thead th .th-inner {
    display: flex;
    align-items: center;
    gap: 16px;
}

.adm-table thead th.num .th-inner {
    flex-direction: row-reverse;
}

.adm-table thead th .th-lbl {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    flex: 1;
    min-width: 0;
    min-height: 24px; /* WCAG 2.5.8 — text line-height alone bounds this to ~14-18px */
    color: inherit;
    text-decoration: none;
}

.adm-table thead th .th-lbl:focus-visible {
    outline: 2px solid var(--orange);
    outline-offset: 2px;
}

.adm-table thead th .th-sep {
    width: 1px;
    height: 13px;
    background: var(--adm-border);
    flex: none;
}

/* row-reverse would put the divider on the cell's left edge, doubling it up
   with the previous column's; order:-1 lays it out last along the reversed
   axis, i.e. back at the right edge. */
.adm-table thead th.num .th-sep {
    order: -1;
}

.adm-table thead th .sort-arrow {
    opacity: .75; /* WCAG 1.4.11 (round 2) — .6 blended to ~2.51:1 on --adm-thead-bg
                     #F9FAFB, below 3:1; verifier requires >=.68, .75 gives ~3.35:1 */
    margin-left: 4px;
    font-size: 10px;
}

.adm-table thead th.sorted .sort-arrow {
    opacity: 1;
    color: var(--orange);
}

/* Filter card layout — prototype parity (uidemos AdminArticles.html):
   labelled fields on a grid inside .adm-card-body. */
.adm-filter-grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr 1fr 1fr auto;
    gap: 14px;
}

.adm-filter-apply {
    justify-content: flex-end;
}

/* A checkbox and a submit sitting directly on the grid have no field label
   above them, so they would top-align against the labelled selects. */
.adm-filter-grid > .adm-btn,
.adm-filter-grid > .adm-filter-toggle {
    align-self: end;
}

/* The console's other filter shape: a flowing row of labelled controls ending
   in its buttons, for cards whose fields don't divide into fixed columns the
   way .adm-filter-grid's do. `.adm-filter-row` was already the class on the
   activity-log filter but had no rules at all, so that row rendered as a
   plain block stack (ISSUE #496). */
.adm-filter-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 12px 14px;
}

.adm-filter-row .adm-inline-field {
    flex: 1 1 200px;
    min-width: 0;
}

.adm-filter-row > .adm-btn,
.adm-filter-row > .adm-filter-toggle {
    align-self: flex-end;
}

.adm-filter-toggle {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 12.5px;
    color: var(--text2);
    cursor: pointer;
    padding-bottom: 7px;
}

.adm-filter-toggle input {
    accent-color: var(--orange);
    width: 14px;
    height: 14px;
    flex: none;
}

.adm-filter-toggle .pm-hint {
    margin-left: 0;
}

.adm-filter-apply .adm-btn {
    align-self: end;
}

@media (max-width: 900px) {
    .adm-filter-grid {
        grid-template-columns: 1fr 1fr;
    }
}

/* Row selection (A6, owner reversal of D-2) — a narrow, unlabelled-by-sight
   checkbox column; the accessible name comes from the visually-hidden
   header <label>/per-row aria-label, not visible text (prototype parity,
   uidemos AdminArticles.html has no visible label either). */
.adm-select-col {
    width: 34px;
    text-align: center;
}

/* Selection count string appended to the export buttons' own text (A6),
   e.g. "Ekspordi CSV (3 valitud)" — admin-articles.js sets/clears this. */
.adm-export-count {
    margin-left: 2px;
}

/* Page-size picker (A7, owner reversal of the D-6 fixed 25) — a compact
   inline form living in .adm-table-foot, next to the pager. */
.adm-page-size-form {
    display: flex;
    align-items: center;
    gap: 6px;
}

.adm-page-size-form label {
    color: var(--text2);
}

@media (max-width: 540px) {
    .adm-filter-grid {
        grid-template-columns: 1fr;
    }
}

.adm-pager-gap {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    color: var(--text2); /* A11Y: 1.4.3 — was --text3 (2.43:1 on the --adm-thead-bg table foot); --text2 = 5.69:1 */
}

.adm-narr-badge {
    display: inline-flex;
    align-items: center;
    padding: 1px 7px;
    border-radius: 2px;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: .2px;
    white-space: nowrap;
    /* Colour is data-driven: --lbl-bg/--lbl-ink (soft_bg + label_ink) set inline per row,
       consumed by .nar-label-soft — same treatment as the narrative-matrix cards. */
}


/* ── FRIEND BADGE (squared pill) ────────────────────────────────────
   #1F6B47 on #E5F4EC = ~6.5:1, passes AA as-is.
   ────────────────────────────────────────────────────────────────────── */
.adm-friend-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 1px 6px;
    border-radius: 3px; /* squared, not pill */
    background: #E5F4EC;
    color: #1F6B47; /* ~6.5:1 on #E5F4EC — WCAG AA */
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: .2px;
}


/* ── TOGGLE SWITCH (born-AA; no demo equivalent) ─────────────────────
   Visually-hidden native <input type="checkbox"> keeps keyboard + SR access.
   Track: OFF = --adm-border grey; ON = --orange (both ≥3:1 on white bg).
   Focus ring: 2px --orange outline on :focus-visible (≥3:1 non-text contrast).
   ────────────────────────────────────────────────────────────────────── */
.adm-switch {
    position: relative;
    display: inline-flex;
    align-items: center;
    width: 34px;
    height: 18px;
    cursor: pointer;
    flex-shrink: 0;
}

.adm-switch input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    cursor: pointer;
    z-index: 1;
}

.adm-switch-slider {
    position: absolute;
    inset: 0;
    background: var(--adm-border);
    border-radius: 9px;
    transition: background .15s, box-shadow .15s;
    pointer-events: none;
    box-shadow: 0 0 0 1px #767676; /* OFF-track border: 4.54:1 on white — WCAG 1.4.11 */
}

.adm-switch-slider::after {
    content: '';
    position: absolute;
    left: 2px;
    top: 2px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,.25);
    transition: transform .15s;
}

.adm-switch input[type="checkbox"]:checked + .adm-switch-slider {
    background: #1F8B5F; /* proto ON-track green — 4.3:1 on white (WCAG 1.4.11); remove OFF-track border */
    box-shadow: none;
}

.adm-switch input[type="checkbox"]:checked + .adm-switch-slider::after {
    transform: translateX(16px);
}

.adm-switch input[type="checkbox"]:focus-visible + .adm-switch-slider {
    outline: 2px solid var(--orange);
    outline-offset: 2px;
}

.adm-switch input[type="checkbox"]:disabled + .adm-switch-slider {
    opacity: .45;
    cursor: wait;
}

.adm-switch input[type="checkbox"]:disabled {
    cursor: wait;
}

/* Inline toggle form wrapper */
.adm-toggle-form {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}


/* ── LEAVING ROW ANIMATION ───────────────────────────────────────────
   opacity-only transition to avoid layout thrash; 180ms matches JS timeout.
   Respects prefers-reduced-motion.
   ────────────────────────────────────────────────────────────────────── */
.adm-table tbody tr.leaving {
    opacity: 0;
    transition: opacity .18s ease;
}

@media (prefers-reduced-motion: reduce) {
    .adm-table tbody tr.leaving {
        transition: none;
    }
}


/* ── RAIL USER CARD ──────────────────────────────────────────────────
   On dark navy rail. Bump email (.adm-rail-user-role) to rgba(255,255,255,.7)
   for AA on navy (small text requires higher ratio).
   ────────────────────────────────────────────────────────────────────── */
.adm-rail-user {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 10px 8px 6px;
}

.adm-rail-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--adm-rail-active);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.adm-rail-user-info {
    min-width: 0;
    flex: 1;
}

.adm-rail-user-name {
    font-size: 12px;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.adm-rail-user-role {
    font-size: 10.5px;
    color: rgba(255, 255, 255, .7); /* bumped from .5 → .7 for AA on navy (small text) */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 1px;
}


/* ── NAV BADGE (Allikad count) ────────────────────────────────────────
   #FFB890 on rgba(242,101,34,.18) over navy.
   Measured: #FFB890 on navy #1E2637 = ~5.4:1 (AA for normal text).
   ────────────────────────────────────────────────────────────────────── */
.adm-rail-link span.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 16px;
    padding: 0 5px;
    border-radius: 8px;
    font-size: 10px;
    font-weight: 700;
    background: rgba(242, 101, 34, .18);
    color: #FFB890; /* ~5.4:1 on rail navy #1E2637 — WCAG AA */
    margin-left: auto;
    flex-shrink: 0;
}


/* ── SHELL COLLAPSE ──────────────────────────────────────────────────
   .adm-shell.collapsed narrows the rail to 64px; labels/badges/user-info hidden.
   Pre-paint: adm-pre-collapsed on <html> collapses before JS loads to avoid flash.
   ────────────────────────────────────────────────────────────────────── */
.adm-shell.collapsed,
.adm-pre-collapsed .adm-shell {
    grid-template-columns: 64px 1fr;
}

.adm-shell.collapsed .adm-rail-name,
.adm-pre-collapsed .adm-shell .adm-rail-name,
.adm-shell.collapsed .adm-rail-tag,
.adm-pre-collapsed .adm-shell .adm-rail-tag,
.adm-shell.collapsed span.badge,
.adm-pre-collapsed .adm-shell span.badge,
.adm-shell.collapsed .adm-rail-section,
.adm-pre-collapsed .adm-shell .adm-rail-section,
.adm-shell.collapsed .adm-rail-user-info,
.adm-pre-collapsed .adm-shell .adm-rail-user-info {
    display: none;
}

/* Collapsed nav labels are visually hidden (not removed) so each icon-only
   link keeps its accessible name. */
.adm-shell.collapsed .adm-rail-link .label,
.adm-pre-collapsed .adm-shell .adm-rail-link .label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
}

.adm-shell.collapsed .adm-rail-link,
.adm-pre-collapsed .adm-shell .adm-rail-link {
    justify-content: center;
    padding: 9px 0;
}

.adm-shell.collapsed .adm-rail-action,
.adm-pre-collapsed .adm-shell .adm-rail-action {
    justify-content: center;
}

.adm-shell.collapsed .adm-rail-action span,
.adm-pre-collapsed .adm-shell .adm-rail-action span {
    display: none;
}

.adm-shell.collapsed .adm-rail-user,
.adm-pre-collapsed .adm-shell .adm-rail-user {
    justify-content: center;
    padding: 10px 0 6px;
}

.adm-shell.collapsed .adm-rail-top,
.adm-pre-collapsed .adm-shell .adm-rail-top {
    padding-left: 0;
    padding-right: 0;
}

.adm-shell.collapsed .adm-rail-logo,
.adm-pre-collapsed .adm-shell .adm-rail-logo {
    justify-content: center;
}


/* ── COLLAPSE BUTTON ─────────────────────────────────────────────────
   In .adm-topbar. Palette: --text2 (not --text3).
   ────────────────────────────────────────────────────────────────────── */
.adm-collapse-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    background: none;
    cursor: pointer;
    color: var(--text2);
    border-radius: 4px;
    font-size: 14px;
    margin-right: 8px;
    flex-shrink: 0;
    font-family: inherit;
    transition: background .12s, color .12s;
}

.adm-collapse-btn:hover {
    background: var(--adm-row-hover);
    color: var(--navy);
}

.adm-collapse-btn:focus-visible {
    outline: 2px solid var(--orange);
    outline-offset: 2px;
}

/* Tablet and below: force the icon-only rail so the content area keeps usable
   width (the manual toggle still governs wider screens). */
@media (max-width: 1024px) {
    .adm-shell {
        grid-template-columns: 64px 1fr;
    }
    .adm-shell .adm-rail-name,
    .adm-shell .adm-rail-tag,
    .adm-shell span.badge,
    .adm-shell .adm-rail-section,
    .adm-shell .adm-rail-user-info,
    .adm-shell .adm-rail-action span {
        display: none;
    }
    .adm-shell .adm-rail-link .label {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
    }
    .adm-shell .adm-rail-link {
        justify-content: center;
        padding: 9px 0;
    }
    .adm-shell .adm-rail-action {
        justify-content: center;
    }
    .adm-shell .adm-rail-user {
        justify-content: center;
        padding: 10px 0 6px;
    }
    .adm-shell .adm-rail-top {
        padding-left: 0;
        padding-right: 0;
    }
    .adm-shell .adm-rail-logo {
        justify-content: center;
    }
    .adm-collapse-btn {
        display: none;
    }
}


/* ── NARRATIVES — card grid + activity chart ─────────────────────── */
.nar-grid-head {
    margin-bottom: 14px;
}

.nar-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.nar-card {
    background: var(--adm-surface);
    border: 1px solid var(--adm-border);
    border-radius: 10px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: border-color .12s, box-shadow .12s;
}

.nar-card:hover {
    border-color: var(--navy);
    box-shadow: 0 2px 10px rgba(27, 58, 92, .08);
}

.nar-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.nar-card-badge {
    font-weight: 600;
    text-decoration: none;
}

/* The soft-label colour contract, shared across the admin/public boundary (KB-0166).
   Both bases load this file, so it is the only place all three consumers can see; the
   per-component stylesheets deliberately do NOT re-declare the pair, or the fallback
   would drift in three files. Class names stay per-side (the admin/public class
   split is mechanically enforced) — what is unified is the declaration, not the selector.
   The fallbacks matter because the custom properties are set inline per element: a
   caller that forgets one would otherwise render transparent ink on a transparent
   ground, an invisible label with no error. */
.nar-label-soft,
.pm-nar-badge,
.pm-ss-badge {
    background: var(--lbl-bg, var(--surface-alt));
    color: var(--lbl-ink, var(--text2));
}

/* Must stay AFTER .adm-chip in this file: both are single-class selectors, so on a
   pill carrying both the winner is source order. */
.nar-label-soft {
    border: 1px solid rgba(15, 23, 42, .08);
}

/* `.adm-table td a { color: var(--navy) }` is (0,2,1) and outranks the soft-label
   contract's (0,1,0), so a pill that is BOTH a link and inside a table cell — only
   /console/dashboard's — silently renders navy and loses its narrative hue at rest.
   Measured in a browser; every static check passes because the inline --lbl-ink is
   present and correct, it just never wins. Raise the specificity to (0,3,1). */
.adm-table td a.nar-label-soft {
    color: var(--lbl-ink, var(--text2));
}

.nar-card-view {
    color: var(--text2);
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    flex-shrink: 0;
    transition: background .12s, color .12s;
}

.nar-card-view:hover {
    background: var(--navy-50);
    color: var(--navy);
}

.nar-card-view:focus-visible {
    outline: 2px solid var(--orange);
    outline-offset: 2px;
}

.nar-card-desc {
    margin: 0;
    font-size: 13px;
    line-height: 1.45;
    color: var(--text2);
    min-height: 36px;
}

.nar-card-terms {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.nar-kw {
    font-family: var(--ff-mono);
    font-size: 11px;
    color: var(--text2);
    background: var(--navy-50);
    border: 1px solid var(--adm-border-2);
    border-radius: 4px;
    padding: 2px 6px;
}

.nar-spark {
    display: flex;
    align-items: flex-end;
    gap: 2px;
    height: 34px;
}

.nar-spark-bar {
    flex: 1;
    min-height: 2px;
    border-radius: 1px;
    opacity: .7;
    height: var(--bar-h, 0);
    background: var(--bar-c, var(--navy));
}

.nar-stats {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    border-top: 1px solid var(--adm-border-2);
    padding-top: 10px;
    margin-top: auto;
}

.nar-stats > div {
    display: flex;
    flex-direction: column;
}

.nar-stats b {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
}

.nar-stats span {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--text2);
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.nar-delta.up { color: var(--red-700); }
.nar-delta.down { color: var(--green-700); }

.nar-chart-toggles {
    display: flex;
    gap: 6px;
    margin-bottom: 12px;
}

.nar-toggle {
    font-family: inherit;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text2);
    background: var(--adm-surface);
    border: 1px solid var(--adm-border);
    border-radius: 6px;
    padding: 5px 12px;
    cursor: pointer;
    transition: background .12s, border-color .12s, color .12s;
}

.nar-toggle:hover {
    border-color: var(--navy);
    color: var(--navy);
}

.nar-toggle.on {
    background: var(--orange-soft);
    border-color: var(--orange);
    color: #B8430C;
}

.nar-toggle:focus-visible {
    outline: 2px solid var(--orange);
    outline-offset: 2px;
}

.nar-activity-plot {
    position: relative;
}

/* No inset:0 (unlike .pm-chart-empty) -- empty, this is a 0x0 box: out of
   the accessibility tree is wrong for a role=status region (KB-0280), but a
   sized box would cover the chart underneath. */
.nar-activity-status {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    margin: 0;
    max-width: calc(100% - 32px);
    text-align: center;
    font-size: 13px;
    color: var(--text2);
    pointer-events: none;
}

.nar-activity-status:not(:empty) {
    /* A fixed width lets the background span the whole row: shrink-to-fit
       left the in-canvas legend showing through beside a reflowed message
       (narrow viewport, 1.4.12 text spacing). */
    width: calc(100% - 32px);
    padding: 2px 6px;
    background: var(--adm-surface);
}


/* ── NARRATIVES — unclassified queue ─────────────────────────────── */
/* Sektsioonipiir, mitte järgmine kaart: .nar-grid annab kaartide vahele 20px,
   siin on vaja rohkem, sest allpool algab teist liiki sisu. */
.nar-unclass { display: block; margin-top: 36px; }

.nar-unclass-banner {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 13px 16px;
    margin-bottom: 18px;
    background: #FFF8EC;
    border: 1px solid #F0D9AE;
    border-radius: 8px;
}

.nar-unclass-icon {
    flex: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--orange);
    color: #fff;
    font-weight: 700;
    font-size: 14px;
}

.nar-unclass-text {
    flex: 1;
    font-size: 13px;
    color: var(--text);
    line-height: 1.45;
}

.nar-unclass-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 14px;
    margin-bottom: 14px;
}

.nar-unclass-title,
.nar-grid-title {
    font-family: var(--ff-serif);
    font-size: 16px;
    font-weight: 600;
    color: var(--navy);
    letter-spacing: -.2px;
    margin: 0;
}

.nar-unclass-sub {
    font-size: 12px;
    color: var(--text2);
    margin: 3px 0 0;
}

.nar-unclass-search {
    display: flex;
    gap: 8px;
}

.nar-assign-feedback {
    display: block;
    font-size: 11.5px;
    margin-top: 4px;
    min-height: 1em;
}

.nar-assign-feedback.ok  { color: #166534; }
.nar-assign-feedback.err { color: #B91C1C; }


/* ── USERS — filters, avatars, role dots, sortable headers, modals ──── */
.adm-userfilters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 28px;
    margin-bottom: 16px;
}

.adm-pillrow {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}

.adm-pilllabel {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--text2);
    margin-right: 4px;
}

.adm-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 24px;
    min-width: 24px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text2);
    background: var(--adm-surface);
    border: 1px solid var(--adm-border);
    border-radius: 999px;
    padding: 4px 12px;
    text-decoration: none;
    transition: background .12s, border-color .12s, color .12s;
}

/* An inline-flex pill drops the whitespace between label and count, so the
   count carries its own gap — same badge as `.adm-tab .count`. */
.adm-pill .count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    margin-left: 6px;
    padding: 0 5px;
    border-radius: 9px;
    font-size: 10.5px;
    font-weight: 700;
    background: var(--adm-border);
    color: var(--text2);
}

.adm-pill.on .count {
    background: #fff;
    color: #B45309; /* 5.0:1 on white — WCAG AA */
}

.adm-pill:hover { border-color: var(--navy); color: var(--navy); }

.adm-pill.on {
    background: var(--orange-soft);
    border-color: var(--orange);
    color: #B8430C;
}

.adm-pill:focus-visible {
    outline: 2px solid var(--navy);
    outline-offset: 2px;
}

/* ISSUE #544: the pill is a hidden radio + sibling label (DR-1) — the
   `.adm-choice-input` mechanism class is shared with the classifier chips
   (DR-7), but the checked/hover/focus visuals stay per visual family since
   the two already disagreed on focus colour (navy vs orange) before this
   change. `.adm-pill.on` (server-rendered, used by /console/users and the
   Avastused type/status chips) is untouched — these selectors only match
   a label whose preceding sibling is the new radio input. */
.adm-choice-input:checked + .adm-pill {
    background: var(--orange-soft);
    border-color: var(--orange);
    color: #B8430C;
}

.adm-choice-input:hover + .adm-pill {
    border-color: var(--navy);
    color: var(--navy);
}

.adm-choice-input:focus-visible + .adm-pill {
    outline: 2px solid var(--navy);
    outline-offset: 2px;
}

.adm-period-selector {
    display: flex;
    flex-wrap: nowrap;
    align-items: flex-start;
    gap: 10px 18px;
    justify-content: space-between;
    width: 100%;
    margin-bottom: 0;
}

.adm-period-selector > .adm-pillrow { flex: 0 1 auto; min-width: 0; }
.adm-period-selector > .adm-date-form { flex: 0 0 auto; }

@media (max-width: 900px) {
    .adm-period-selector { flex-wrap: wrap; container-type: inline-size; }
    /* Once the date form sits on its own line it must be allowed to shrink,
       or ALATES + KUNI stay on one row and overflow the card on a phone. */
    .adm-period-selector > .adm-date-form { flex: 1 1 100%; min-width: 0; }
}

/* Wraps date_range_filter's row when card=True (default) — narrative pages
   and Articles' row 1 both use it (ISSUE #407 DR-7). */
.adm-filter-card {
    margin-bottom: 16px;
}

.adm-date-form {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 8px;
}

.adm-date-form .adm-input {
    width: 130px;
    max-width: 100%;
}

.adm-date-form .adm-input.on {
    border-color: var(--orange);
}

.adm-date-sep {
    color: var(--text2);
}

/* date-picker-et.js's fallback-insertion path (no `.pm-dp-row`/`.pm-dp-actions`
   wrapper exists in the admin markup, ISSUE #417 § 6.4) appends the calendar
   and its status line straight into `.adm-date-form`, which is flex-wrap —
   without a full-width basis they'd squeeze into the same row as the date
   inputs instead of dropping to their own line.

   They are empty until the calendar opens or a date fails to parse, and an
   empty full-width flex item still claims a row and a row gap: four of them
   made the filter's date form ~66px tall against a 29px pill row, which is
   why the pills sat below the ALATES/KUNI line (ISSUE #496). Hiding them
   while empty costs nothing — the moment the picker writes into one it takes
   its row back. */
.adm-date-form .pm-dp-cal,
.adm-date-form .pm-dp-msg {
    flex-basis: 100%;
    /* `.adm-date-form` is sized by its content (`flex: 0 0 auto` in the
       period selector), so without this the 100% basis and the grid's
       `width: 100%` resolve against each other and the open calendar sized
       the form ~1e6px wide — squeezing the pill row to 0 and pushing the
       day cells off-screen. Containment keeps the calendar out of the form's
       intrinsic width, so it just takes the width the date inputs set. */
    contain: inline-size;
}

.adm-date-form .pm-dp-cal:empty,
.adm-date-form .pm-dp-msg:empty {
    display: none;
}

/* date-picker-et.js hides the native `input[type=date]` and puts a text field
   in its place, built with Bootstrap utilities (`w-100 p-2`) for the PUBLIC
   shell. In the admin filter that field is the one the analyst actually sees,
   so it has to be an `.adm-input`: 14px/8px-padding/100%-wide made the date
   range look like a different component from every other admin control and
   pushed the row past the width the period pills need (ISSUE #496).
   `!important` is not a preference here — it is the only way past Bootstrap's
   own `.w-100 { width: 100% !important }`. */
.adm-date-form .pm-dp-input {
    width: 130px !important;
    padding: 7px 11px !important;
    font-size: 12.5px;
    font-family: inherit;
    color: var(--text);
    background: #fff;
    border: 1px solid var(--adm-border);
    border-radius: 3px;
    outline: none;
    transition: border-color .12s;
}

.adm-date-form .pm-dp-input:focus {
    border-color: var(--navy);
}

/* setLabelActive() (date-picker-et.js) toggles `is-active` on the native
   `label[for=…]` — in the admin shell that's `.adm-date-label`, not the
   public `.pm-dp-lbl` (ISSUE #417). */
.adm-date-label.is-active {
    color: var(--navy);
}

/* Too narrow for ALATES + KUNI side by side: stack them in a two-column grid
   so both inputs line up regardless of the label widths. The container only
   exists at <=900px, so this never matches on desktop. */
@container (max-width: 380px) {
    .adm-date-form {
        display: grid;
        grid-template-columns: auto 1fr;
    }

    .adm-date-form .adm-date-label { display: contents; }
    .adm-date-form > :not(.adm-date-label) { grid-column: 1 / -1; }
    .adm-date-form > .adm-btn { justify-self: start; }
}

/* Articles' filter card row 3 (ISSUE #541): Allikas/Narratiiv/Sihtmärk,
   three EQUAL columns — the owner's requirement is equal width, so this is
   `repeat(3, 1fr)` and not the 2fr/1fr weighting row 2 uses. Own
   media-query branch for the same reason `--dash` needs one: the base
   `.adm-filter-grid` rules sit earlier at the same specificity. */
.adm-filter-grid--triple {
    grid-template-columns: repeat(3, 1fr);
    margin-top: 14px;
}

@media (max-width: 900px) {
    .adm-filter-grid--triple {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 540px) {
    .adm-filter-grid--triple {
        grid-template-columns: 1fr;
    }
}

/* Rakenda moved out of the grid (ISSUE #541): with three equal columns an
   `auto` fourth track would make them unequal, so the button gets its own
   right-aligned row under the filters. */
.adm-filter-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
    margin-top: 14px;
}

/* Articles' filter card row 2 (Otsing 2/3 + Tabamus 1/3 + Allikad 1/3,
   ISSUE #407 V3 layout, ISSUE #588 D-1 widened it to three fields) — the
   top border sits on row 2, not the bottom of row 1, so a card that only
   ever renders row 1 (the narrative pages) never gets a dangling rule. */
.adm-filter-grid--search {
    grid-template-columns: 2fr 1fr 1fr;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--adm-border-2);
}

@media (max-width: 900px) {
    .adm-filter-grid--search {
        grid-template-columns: 1fr;
    }
}

/* Dashboard's filter card row 2 (Prioriteet/Allikad/Narratiiv 1fr each,
   Ridu lehel narrower — ISSUE #417 FR-3). Anonymous viewers render three of
   the four columns (no Allikad select); the grid fills left-to-right, which
   is correct without a separate rule. Own media-query branch is required,
   not redundant: the base `.adm-filter-grid` rules (above) sit earlier in
   this file at the same specificity, so this modifier would otherwise lose
   at every width — exactly the reason `--search` has its own branch too. */
.adm-filter-grid--dash {
    grid-template-columns: 2fr 1fr 1fr;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--adm-border-2);
}

/* The optional Allikad field (authed viewers only) makes this grid's child
   count vary 4/5 against a 4-column template; giving Rakenda its own row
   keeps the template matching its children at either count. */
.adm-filter-grid--dash .adm-filter-apply {
    grid-column: 1 / -1;
}

@media (max-width: 900px) {
    .adm-filter-grid--dash {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 540px) {
    .adm-filter-grid--dash {
        grid-template-columns: 1fr;
    }
}

/* Shared JS-gated no-JS-fallback pattern (ISSUE #407): with JS,
   [data-autosubmit] controls submit their form on change, so a paired
   [data-autosubmit-fallback] button is redundant. adm-autosubmit.js adds
   .js-autosubmit only after binding — fail-safe if the script errors. */
.js-autosubmit [data-autosubmit-fallback] {
    display: none;
}

/* Tõlked column badges (ISSUE #407 AC-7/AC-10) */
.adm-langs {
    display: inline-flex;
    gap: 4px;
}

.adm-lang {
    font-family: var(--ff-mono);
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: .04em;
    color: var(--text2);
    background: var(--adm-border-2);
    border-radius: 4px;
    padding: 1px 5px;
}

.adm-sort {
    color: inherit;
    text-decoration: none;
    white-space: nowrap;
}

.adm-sort:hover { color: var(--navy); }

.adm-sort.on { color: var(--navy); }

.adm-sort:focus-visible {
    outline: 2px solid var(--navy);
    outline-offset: 2px;
    border-radius: 2px;
}

/* A11Y: 1.4.11 — the inactive glyph is the only visual sortability cue on a
   sortable column, so the 3:1 non-text floor applies; --text3 was 2.43:1 on
   --adm-thead-bg. --text2 is 5.69:1 and equals the th's own colour, so the
   arrow now reads as part of the header label: intended, because the
   affordance is the glyph shape and the direction comes from aria-sort. The
   colour is stated rather than left to inherit so that .adm-sort:hover's
   --navy does not carry into the arrow. Active stays --orange (3.02:1). */
.adm-sort-arrow { color: var(--text2); font-size: 11px; }

.adm-sort.on .adm-sort-arrow { color: var(--orange); }

.adm-mono { font-family: var(--ff-mono); font-size: 12.5px; }

/* ISSUE #103 — the pending-invite note under the "Ootel" status pill
   (admin_users.html): a normal-font second line, not the monospace
   `.adm-mono` (which read as data and wrapped awkwardly under the pill). */
.adm-status-note {
    display: block;
    margin-top: 3px;
    font-size: 11.5px;
    color: var(--text2);
    line-height: 1.4;
}

/* ISSUE #103 — the "Saada parooli taastamise link" row action widened
   /console/users' Tegevused column to 4 icons, squeezing Staatus enough
   that the pending note's date+time wrapped onto its own separate lines
   (the middot ties them visually, so a mid-date break reads worst). The
   date+time stays one unbreakable unit; the status column keeps enough
   width for "Kehtib kuni " + that unit on at most two lines. */
.adm-status-note .adm-nowrap { white-space: nowrap; }

.adm-users-table td:nth-child(4) { min-width: 9.5em; }

.adm-user-cell {
    display: flex;
    align-items: center;
    gap: 10px;
}

.adm-user-avatar {
    flex-shrink: 0;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    color: #fff;
    background: var(--navy);
}

.adm-user-avatar.role-admin { background: var(--orange-700); }
.adm-user-avatar.role-editor { background: var(--navy); }
.adm-user-avatar.role-reader { background: var(--text2); }
.adm-user-avatar.inactive { background: var(--adm-border); color: var(--text2); }

.adm-role {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    white-space: nowrap;
}

.adm-role-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    background: var(--text2);
}

.adm-role-dot.role-admin { background: var(--orange-700); }
.adm-role-dot.role-editor { background: var(--navy); }
.adm-role-dot.role-reader { background: var(--text2); }

.adm-card-flush { padding: 0; overflow: hidden; }

.adm-card-flush .adm-table { margin: 0; }

/* Modal form layout (Bootstrap modal shell + admin palette) */
.adm-modal { border: none; border-radius: 10px; }

.adm-modal-title { font-size: 18px; font-weight: 700; color: var(--text); margin: 0; }

.adm-modal-hint { font-size: 12px; color: var(--text2); margin: 0 0 12px; }

.adm-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 12px;
    flex: 1;
}

.adm-field > span {
    font-size: 12px;
    font-weight: 600;
    color: var(--text2);
}

.adm-field-row { display: flex; gap: 12px; }

.adm-kpi-spark canvas {
    display: block;
    width: 100%;
    height: 100%;
}

.pm-trend-toggle,
.pm-entity-tabs {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.adm-pager button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 26px;
    background: #fff;
    border: 1px solid var(--adm-border);
    border-radius: 3px;
    font-size: 11.5px;
    font-weight: 600;
    color: var(--text2);
    cursor: pointer;
    padding: 0 6px;
}
.adm-pager button:hover:not(:disabled) {
    border-color: var(--navy);
    color: var(--navy);
}
.adm-pager button.on {
    background: var(--navy);
    border-color: var(--navy);
    color: #fff;
}
.adm-pager button:disabled { opacity: .4; cursor: default; }
.adm-pager button:focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; }

.pm-entbar-row,
.pm-srcbar-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 18px;
    border-bottom: 1px solid var(--adm-border-2);
    text-decoration: none;
}
.pm-entbar-row:last-child,
.pm-srcbar-row:last-child { border-bottom: 0; }
.pm-entbar-row:hover { background: var(--navy-50); }
.pm-entbar-name,
.pm-srcbar-name {
    flex: 0 0 32%;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--navy);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.pm-entbar-track,
.pm-srcbar-track {
    flex: 1;
    height: 8px;
    background: var(--adm-bg);
    border-radius: 2px;
    overflow: hidden;
}
.pm-entbar-fill,
.pm-srcbar-fill {
    display: block;
    height: 100%;
    border-radius: 2px;
    background: var(--orange);
}
.pm-entbar-val,
.pm-srcbar-val {
    flex: 0 0 auto;
    min-width: 34px;
    text-align: right;
    font-size: 12px;
    font-weight: 700;
    color: var(--navy);
    font-variant-numeric: tabular-nums;
}

.pm-activity-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 18px;
    border-bottom: 1px solid var(--adm-border-2);
    font-size: 12.5px;
    color: var(--navy);
    text-decoration: none;
}
.pm-activity-row:last-child { border-bottom: 0; }
.pm-activity-row:hover { background: var(--navy-50); }
.pm-activity-icon { flex: 0 0 auto; color: var(--text2); }
.pm-activity-text { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pm-activity-time { flex: 0 0 auto; font-size: 11px; color: var(--text2); }

.pm-card-link {
    font-size: 11.5px;
    font-weight: 600;
    color: var(--orange-700);
    text-decoration: none;
    white-space: nowrap;
}
.pm-card-link:hover { text-decoration: underline; }

.pm-chart-empty {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    color: var(--text2);
}

/* ── Sätted: objektid / märksõnad (#139) ──────────────────────────── */
.adm-inline-form { display: inline-block; margin: 0; }
.pm-kw-sugg { display: flex; flex-direction: column; gap: 2px; }
.pm-kw-sugg-desc { font-size: 11px; color: var(--text2); }

/* ── Sätted: entiteedilemmad (#304) ───────────────────────────────── */
.pm-stage-ind { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; }
.pm-stage-ind i { color: var(--text2); }
.pm-lemma-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.pm-lemma-chip {
    display: inline-flex; align-items: center; gap: 4px;
    background: var(--adm-bg); border-radius: 10px; padding: 2px 4px 2px 8px;
    font-size: 12px;
}
.pm-lemma-none { font-size: 12px; }
.pm-lemma-add { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.pm-lemma-add .adm-input.sm { flex: 1 1 160px; min-width: 0; }
.pm-lemma-preview { font-size: 12px; color: var(--text2); }
.pm-preview-result { margin-top: 12px; font-size: 13px; white-space: pre-line; }

/* ── Sätted: uue märksõna lemmaterminite lavastamine (#364) ──────────── */
.pm-lemma-staged { display: flex; flex-wrap: wrap; gap: 6px; }
.pm-lemma-chip--staged { background: var(--orange-soft); }
.tg-rm-chip {
    display: inline-flex; align-items: center; justify-content: center;
    width: 24px; height: 24px; border: none; background: none; padding: 0;
    color: var(--text2); cursor: pointer; border-radius: 4px; font-size: 13px;
}
.tg-rm-chip:hover { color: var(--red-700); background: var(--red-soft); }
/* var(--orange) on the --orange-soft chip/row backgrounds this button sits on
   is ~2.9:1, under the 3:1 non-text-contrast floor (WCAG 1.4.11) — --orange-700
   clears it. */
.tg-rm-chip:focus-visible { outline: 2px solid var(--orange-700); outline-offset: 1px; }

/* ── Sätted: "Tase" veeru selgitav tooltip (#364) ─────────────────────
   KB-0132 pact — verified independently: .adm-card, .adm-card-body, .tg-card
   and .tg-kw-table set no overflow, and this table has no .adm-table-wrap
   ancestor, so no has-popovers modifier is needed here. If this table is
   ever wrapped in .adm-table-wrap, that wrap must carry has-popovers or
   .tg-tase-pop clips exactly as KB-0132 describes. ──────────────────── */
.tg-tase-details { position: relative; display: inline-block; }
.tg-tase-info {
    display: inline-flex; align-items: center; list-style: none; cursor: pointer;
    color: var(--text2);
}
.tg-tase-info::-webkit-details-marker { display: none; }
.tg-tase-info:focus-visible { outline: 2px solid var(--orange); outline-offset: 1px; }
.tg-tase-pop {
    display: none; position: absolute; top: calc(100% + 4px); left: 0;
    z-index: 200; width: 320px; background: #fff; border: 1px solid var(--adm-border);
    border-radius: 4px; box-shadow: 0 8px 22px rgba(15,36,64,.12); padding: 10px;
    /* .tg-kw-table th sets uppercase + letter-spacing + bold + 10.5px — the
       same gotcha .col-filter-pop documents (style.css:2607–2610). */
    text-transform: none; letter-spacing: normal; font-weight: 400;
    font-size: 12px; line-height: 1.55; white-space: normal; text-align: left;
    color: var(--navy);
}
.tg-tase-pop p { margin: 0 0 8px; }
.tg-tase-pop p:last-child { margin-bottom: 0; }
details.tg-tase-details[open] > .tg-tase-pop { display: block; }


/* ── Sihtmärgid master-detail (ISSUE #345) ────────────────────────────
   Ported from uidemos/current/AdminTargets.html:17-67 with the AA
   substitutions KB-0019/KB-0020 require — see architecture.md C-9 for the
   full substitution table. Not ported: .tg-cs-pill/-on/-off, .tg-cs-check
   (case-sensitivity toggle, NG-1), .tg-src-add (no add-select, R-9),
   .tg-kw-del (replaced by the styled .tg-rm checkbox).
   ────────────────────────────────────────────────────────────────────── */
.tg-layout { display: grid; grid-template-columns: 280px 1fr; gap: 22px; align-items: start; }

/* ── target list (left) ── */
.tg-list { display: flex; flex-direction: column; gap: 6px; }
.tg-item {
    display: flex; align-items: center; gap: 10px; padding: 12px 14px;
    border: 1px solid var(--adm-border); border-radius: 6px; background: #fff;
    text-decoration: none; transition: border-color .12s, background .12s;
}
.tg-item:hover { border-color: var(--adm-border-2); background: var(--adm-bg); }
.tg-item.on { border-color: var(--orange); background: var(--orange-soft); }
.tg-item:focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; }
.tg-item-ic {
    width: 30px; height: 30px; flex: none; border-radius: 6px; background: var(--adm-bg);
    display: flex; align-items: center; justify-content: center; color: var(--navy);
}
.tg-item.on .tg-item-ic { background: #fff; color: var(--orange-700); }
.tg-item-body { flex: 1; min-width: 0; }
.tg-item-name { font-size: 13.5px; font-weight: 600; color: var(--navy); line-height: 1.2; }
.tg-item-meta { font-size: 11px; color: var(--text2); margin-top: 2px; } /* was --text3 (2.45:1, fails AA) */
.tg-item.on .tg-item-name { color: #B8430C; } /* --orange-700 is AA on white only; #B8430C is AA on --orange-soft */
.tg-newbtn {
    display: flex; align-items: center; justify-content: center; gap: 7px; padding: 11px;
    border: 1px dashed var(--adm-border-2); border-radius: 6px; background: none;
    color: var(--text2); font-size: 12.5px; font-weight: 600; font-family: inherit;
    cursor: pointer; width: 100%; margin-top: 4px;
}
.tg-newbtn:hover { border-color: var(--orange); color: var(--orange-700); background: var(--orange-soft); }
.tg-newbtn:focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; }

/* ── detail (right) ── */
.tg-card { position: relative; }
.tg-detail-actions { position: absolute; top: 14px; right: 18px; }
.tg-detail-head { padding-right: 52px; }
.tg-name-input {
    font-family: var(--ff-serif); font-size: 21px; font-weight: 600; color: var(--navy);
    border: none; border-bottom: 2px solid transparent; outline: none; background: none;
    padding: 2px 0; width: 100%; letter-spacing: -.3px;
}
.tg-name-input:focus { border-bottom-color: var(--orange); }
.tg-desc-input {
    width: 100%; font-size: 12.5px; color: var(--text2); border: 1px solid transparent;
    border-radius: 4px; outline: none; background: none; padding: 4px 6px;
    margin: 2px 0 0 -6px; font-family: inherit; resize: none; line-height: 1.5;
}
.tg-desc-input:hover { background: var(--adm-bg); }
.tg-desc-input:focus { background: #fff; border-color: var(--adm-border-2); }
.tg-desc-input:focus-visible { outline: 2px solid var(--navy); outline-offset: 1px; }
/* ISSUE #369: editor read-only branch — same typography as the admin input, minus its chrome */
.tg-name-static { font-family: var(--ff-serif); font-size: 21px; font-weight: 600; color: var(--navy); letter-spacing: -.3px; margin: 0; }
.tg-desc-static { font-size: 12.5px; color: var(--text2); line-height: 1.5; }
.tg-src-static { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12.5px; color: var(--text2); }
.tg-active-row { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 12.5px; color: var(--text2); }
.tg-section-lbl {
    font-size: 11px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase;
    color: var(--text2); /* was --text3 */ margin-bottom: 10px; display: flex; align-items: center; gap: 8px;
}
.tg-section-lbl .hint { font-weight: 400; text-transform: none; letter-spacing: 0; color: var(--text2); font-size: 11px; } /* was --text4 */

/* bound sources */
.adm-shell .tg-src-select .ts-wrapper { width: 100%; }

/* keyword table */
.tg-kw-table { width: 100%; border-collapse: collapse; }
.tg-kw-table th {
    text-align: left; font-size: 10.5px; font-weight: 700; letter-spacing: .5px;
    text-transform: uppercase; color: var(--text2); /* matches .adm-table thead th precedent */
    padding: 0 12px 9px; border-bottom: 1px solid var(--adm-border);
}
.tg-kw-table td { padding: 9px 12px; border-bottom: 1px solid var(--adm-border-2); vertical-align: top; }
.tg-kw-table tr:last-child td { border-bottom: none; }
.tg-stem {
    font-family: var(--ff-mono); font-size: 13px; font-weight: 600; color: var(--navy);
    background: var(--parchment); border: 1px solid var(--parchment-line); border-radius: 4px;
    padding: 4px 9px; display: inline-block;
}
.tg-kw-empty { text-align: center; color: var(--text2); font-size: 12.5px; padding: 22px 0; } /* was --text3 */

/* removal affordance — a CSS-styled native checkbox, never a JS-injected control */
.tg-rm {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 24px; min-height: 24px; cursor: pointer; border-radius: 4px;
}
.tg-rm input[type="checkbox"] {
    appearance: none; -webkit-appearance: none; margin: 0;
    width: 20px; height: 20px; border: 1px solid var(--adm-border); border-radius: 4px;
    display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
    color: var(--text2); position: relative;
}
.tg-rm input[type="checkbox"]::after {
    content: "\00d7"; font-size: 15px; line-height: 1; color: var(--text2);
}
.tg-rm input[type="checkbox"]:checked {
    background: var(--red-soft); border-color: var(--red-700);
}
.tg-rm input[type="checkbox"]:checked::after { color: var(--red-700); }
.tg-rm input[type="checkbox"]:focus-visible {
    outline: 2px solid var(--orange); outline-offset: 2px;
}
.tg-pending { text-decoration: line-through; opacity: .55; }

/* .tg-pending's line-through + opacity was designed for a row marked for
   REMOVAL — applied to a staged ADDITION it reads as "being deleted",
   backwards for what it actually means (D-5, #364 revision E). */
tbody[data-staged-rows] .tg-pending { text-decoration: none; opacity: 1; background: var(--orange-soft); }
.tg-pending-tag {
    display: inline-block; margin-left: 6px; padding: 1px 6px; border-radius: 100px;
    background: #fff; color: var(--orange-700); font-size: 10px; font-weight: 700;
    text-transform: uppercase; letter-spacing: .3px;
}

/* add keyword row */
.tg-addrow {
    display: grid; grid-template-columns: 1.1fr 1.3fr 1.6fr auto; gap: 10px; align-items: start;
    padding: 14px; background: var(--adm-bg); border-radius: 6px; margin-top: 14px;
}
.tg-addrow .adm-inline-field { margin: 0; }
/* Term input and its stage button share one line; the live preview drops below
   so the taller lemma column never pushes the sibling labels out of line. */
.tg-lemma-row { display: flex; gap: 6px; align-items: center; }
.tg-lemma-row .adm-input { flex: 1 1 auto; min-width: 0; }
.tg-lemma-row .adm-btn { white-space: nowrap; }
/* The commit button has no label — a spacer with the label's metrics keeps it
   on the input line without a visually-hidden fake label. */
.tg-addrow-spacer { display: block; font-size: 10.5px; height: 1lh; } /* inherits the label's line-height */
.tg-addrow-action .adm-btn { align-self: start; }
/* Tom Select's wrapper pads the control down 5px and sizes it like a full-size
   input; match the sibling .adm-input.sm metrics so the row stays on one line. */
.tg-addrow .ts-wrapper { margin: 0; padding: 0; }
.tg-addrow .ts-wrapper .ts-control { min-height: 0; padding: 5px 9px; font-size: 11.5px; }
.tg-addrow .pm-lemma-staged { margin-top: 6px; }
@media (max-width: 860px) { .tg-addrow { grid-template-columns: 1fr 1fr; } .tg-addrow-action { grid-column: 1 / -1; } }

.tg-save-bar {
    display: flex; align-items: center; gap: 12px; justify-content: flex-end;
    margin-top: 4px; padding-top: 0;
}
.tg-save-note { font-size: 12px; color: var(--text2); margin-right: auto; }

@media (max-width: 860px) {
    .tg-layout { grid-template-columns: 1fr; }
    .tg-addrow { grid-template-columns: 1fr; }
}

/* ── Tom Select skin, scoped to the Sihtmärgid bound-sources control only
   (RK-7) — never a bare .ts-* selector, so /feeds' add/edit modal Tom
   Select instances are untouched. Vendored Tom Select v2.6.1. ── */
.adm-shell .tg-src-select .ts-control { border-color: var(--adm-border); border-radius: 4px; padding: 6px 8px; }
.adm-shell .tg-src-select .ts-control > .item {
    background: var(--adm-bg); border: 1px solid var(--adm-border); border-radius: 100px;
    padding: 3px 5px 3px 10px; font-size: 12.5px; font-weight: 500; color: var(--navy); line-height: 1.3;
}
.adm-shell .tg-src-select .ts-control > .item .remove { color: var(--text2); }
/* The empty Tom Select input doubles as the proto's "+ Seo allikas…" add
   affordance — dashed pill, placeholder always visible next to the items.
   The !importants counter the vendor's own `.ts-control>input { border:0
   !important; padding:0 !important; }` (tom-select.bootstrap5.min.css). */
.adm-shell .tg-src-select .ts-control > input {
    border: 1px dashed var(--adm-border) !important;
    border-radius: 100px;
    padding: 3px 12px !important;
    font-size: 12px; font-weight: 600; color: var(--text2);
    min-width: 120px; flex: 0 0 auto;
}
.adm-shell .tg-src-select .ts-control > input::placeholder {
    color: var(--text2); /* 5.95:1 on white — the pill's real signifier */
    opacity: 1;
}

/* ── /console/clusters (ISSUE #445, restyled to the prototype in ISSUE #493).
   Layout/interaction reference: uidemos/current/AdminClusters.html. Page-scoped
   `clu-*` classes, so nothing here can collide with Bootstrap or with the
   `pm-*` set below that /console/clusters/{id} still owns. The prototype's
   `--text3` has no token here — its role (tertiary grey) is --text2, which
   also clears 4.5:1 on white where the demo's lighter grey would not. ── */

/* Signal cards: ONE per row, full width. Their internal `clu-cols` grid is
   what carries the three-column reading order the demo shows — a three-across
   card row would squeeze the Claude reasoning into a 280px gutter. */
.adm-shell .clu-sig-row { display: grid; grid-template-columns: 1fr; gap: 16px; margin-bottom: 16px; }
.adm-shell .clu-sig-card { background: #fff; border: 1px solid var(--adm-border); border-radius: 4px;
    display: flex; flex-direction: column; }
.adm-shell .clu-sig-body { padding: 16px 18px; flex: 1; display: flex; flex-direction: column; min-width: 0; }
.adm-shell .clu-sig-lbl { font-size: 10px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase;
    color: var(--text2); margin: 0 0 12px; }
/* The label's bottom margin moves to its row so the centred tip sits at the
   text's height, not the margin box's. */
.adm-shell .clu-sig-head { margin-bottom: 12px; }
.adm-shell .clu-sig-head > .clu-sig-lbl { margin: 0; }
.adm-shell .clu-sig-foot { padding: 11px 18px; border-top: 1px solid var(--adm-border); background: var(--adm-thead-bg);
    display: flex; align-items: center; gap: 12px; }
.adm-shell .clu-sig-foot .clu-sig-link { margin-left: auto; }
.adm-shell .clu-foot-note { font-size: 11.5px; color: var(--text2); }
.adm-shell .clu-sig-link { font-size: 11.5px; font-weight: 600; color: var(--orange-700); text-decoration: none; white-space: nowrap; }
.adm-shell .clu-sig-link:hover { text-decoration: underline; }
.adm-shell .clu-sig-empty { font-size: 12px; color: var(--text2); font-style: italic; padding: 6px 0; margin: 0; }

.adm-shell .clu-cols { display: grid; gap: 0; align-items: start; }
.adm-shell .clu-c3 { grid-template-columns: 1.15fr 1fr 1fr; }
.adm-shell .clu-c2 { grid-template-columns: 1fr 1fr; }
.adm-shell .clu-col { padding: 0 22px; min-width: 0; border-left: 1px solid var(--adm-border-2); }
.adm-shell .clu-col:first-child { padding-left: 0; border-left: 0; }
.adm-shell .clu-col:last-child { padding-right: 0; }
.adm-shell .clu-col-hd { font-size: 10px; font-weight: 700; letter-spacing: .9px; text-transform: uppercase;
    color: var(--text2); margin: 0 0 10px; }

.adm-shell .clu-title-link { text-decoration: none; display: block; }
.adm-shell .clu-title-link:hover .clu-ru { text-decoration: underline; }
.adm-shell .clu-ru { font-family: var(--ff-serif); font-size: 16px; font-weight: 600; color: var(--navy); line-height: 1.32; }
.adm-shell .clu-et { font-size: 11.5px; color: var(--text2); line-height: 1.4; margin-top: 3px; }

.adm-shell .clu-count { display: flex; align-items: baseline; gap: 8px; margin: 13px 0 11px; }
.adm-shell .clu-count b { font-family: var(--ff-serif); font-size: 38px; font-weight: 600; color: var(--navy);
    line-height: .9; letter-spacing: -1px; }
.adm-shell .clu-count-u { font-size: 12px; color: var(--text2); }
.adm-shell .clu-count-tot { font-size: 11.5px; color: var(--text2); margin-left: auto; }

.adm-shell .clu-nar-pills { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.adm-shell .clu-npill { display: inline-flex; align-items: center; gap: 5px; font-size: 10.5px; font-weight: 700;
    padding: 2px 8px; border-radius: 3px; line-height: 1.5; white-space: nowrap; border: 1px solid transparent; }
.adm-shell .clu-npill-more { background: #fff; border-color: var(--adm-border); color: var(--text2); }
.adm-shell .nar-label-count { font-variant-numeric: tabular-nums; opacity: .75; font-weight: 600; }

.adm-shell .clu-hr { height: 1px; background: var(--adm-border-2); margin: 16px 0 12px; }
.adm-shell .clu-meta-line { font-size: 11px; color: var(--text2); font-variant-numeric: tabular-nums;
    line-height: 1.5; margin: 0; }

.adm-shell .clu-la-head { display: flex; align-items: center; gap: 7px; margin-bottom: 6px; flex-wrap: wrap; }
.adm-shell .clu-src-badge { font-size: 10px; font-weight: 700; color: #fff; background: var(--navy);
    padding: 2px 7px; border-radius: 2px; white-space: nowrap; }
.adm-shell .clu-la-time { font-size: 10.5px; color: var(--text2); font-variant-numeric: tabular-nums; }
.adm-shell .clu-la-title { font-size: 12.5px; font-weight: 600; color: var(--navy); line-height: 1.45; }
.adm-shell .clu-la-sum { font-size: 11.5px; color: var(--text2); line-height: 1.55; margin: 4px 0 0; }
.adm-shell .clu-more { display: inline-block; margin-top: 4px; font-size: 11px; font-weight: 600; color: var(--orange-700); }

.adm-shell .clu-reason { padding: 11px 13px; background: var(--adm-bg); border-left: 2px solid #C9B6E8;
    border-radius: 0 3px 3px 0; }
.adm-shell .clu-reason-hd { display: flex; align-items: center; gap: 6px; font-size: 10px; font-weight: 700;
    letter-spacing: .6px; text-transform: uppercase; color: #6B5A8C; margin-bottom: 5px; }
.adm-shell .clu-reason p { font-size: 11.5px; color: var(--text2); line-height: 1.55; margin: 0; }

/* 3b — new / revived */
.adm-shell .clu-sub-hd { display: flex; align-items: center; gap: 8px; margin-bottom: 9px; }
.adm-shell .clu-sub-hd h3 { font-size: 12px; font-weight: 700; color: var(--navy); margin: 0; }
.adm-shell .clu-cnt { font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 8px;
    background: var(--adm-bg); color: var(--text2); font-variant-numeric: tabular-nums; }
.adm-shell .clu-nr-list { display: flex; flex-direction: column; gap: 9px; }
.adm-shell .clu-nr-row { display: flex; gap: 9px; }
.adm-shell .clu-nr-dot { width: 7px; height: 7px; border-radius: 50%; flex: none; margin-top: 5px; background: #1F6B47; }
.adm-shell .clu-nr-mark { font-size: 12px; line-height: 1; color: #A9660A; flex: none; margin-top: 2px; font-weight: 700; }
.adm-shell .clu-nr-body { min-width: 0; flex: 1; }
.adm-shell .clu-nr-t { display: block; font-size: 12px; font-weight: 600; color: var(--navy); line-height: 1.4;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-decoration: none; }
.adm-shell .clu-nr-t:hover { text-decoration: underline; }
.adm-shell .clu-nr-m { font-size: 10.5px; color: var(--text2); font-variant-numeric: tabular-nums; margin-top: 2px; }
.adm-shell .clu-gapbar { display: flex; align-items: center; height: 6px; margin-top: 5px; border-radius: 2px;
    overflow: hidden; max-width: 180px; }
.adm-shell .clu-gap-silence { background: var(--adm-border); height: 100%; }
.adm-shell .clu-gap-tick { background: var(--orange-700); height: 100%; width: 6px; flex: none; }

/* 3c — coordination */
.adm-shell .clu-co-intro { font-size: 11.5px; color: var(--text2); line-height: 1.5; margin-bottom: 13px; }
.adm-shell .clu-co-sig { display: flex; align-items: center; gap: 7px; }
.adm-shell .clu-co-rank { width: 18px; height: 18px; border-radius: 3px; background: var(--adm-bg); color: var(--text2);
    font-size: 10.5px; font-weight: 700; display: flex; align-items: center; justify-content: center; flex: none; }
.adm-shell .clu-co-sig b { font-size: 12.5px; font-weight: 700; }
.adm-shell .clu-co-grade-1 { color: #92400e; }
.adm-shell .clu-co-grade-2 { color: #9a3412; }
.adm-shell .clu-co-grade-3 { color: #991b1b; }
.adm-shell .clu-co-t { display: block; font-size: 11.5px; color: var(--text2); line-height: 1.45; margin-top: 3px;
    text-decoration: none; }
.adm-shell .clu-co-t:hover { text-decoration: underline; }
.adm-shell .clu-co-meta { margin-top: 5px; display: flex; align-items: center; gap: 6px;
    flex-wrap: wrap; font-size: 10.5px; color: var(--text2); font-variant-numeric: tabular-nums; }
.adm-shell .clu-burst { position: relative; height: 14px; margin: 8px 0 3px; background: var(--adm-bg); border-radius: 2px; }
.adm-shell .clu-burst-dot { position: absolute; top: 3px; width: 8px; height: 8px; border-radius: 50%;
    margin-left: -4px; border: 1.5px solid #fff; }
.adm-shell .clu-burst-ax { display: flex; justify-content: space-between; font-size: 9.5px; color: var(--text2);
    font-variant-numeric: tabular-nums; }
/* Same seven slots as the detail page's Levik stack, so a source reads the
   same way on both cluster surfaces. */
.adm-shell .clu-src-0 { background: #b45309; }
.adm-shell .clu-src-1 { background: #0369a1; }
.adm-shell .clu-src-2 { background: #15803d; }
.adm-shell .clu-src-3 { background: #9333ea; }
.adm-shell .clu-src-4 { background: #be123c; }
.adm-shell .clu-src-5 { background: #92400e; }
.adm-shell .clu-src-6 { background: #475569; }
/* ISSUE #495: caller-supplied global colour overrides the rotating clu-src-N
   slot -- colour only, shape stays on .clu-src-badge. Specificity (0,3,0) must
   beat .adm-shell .clu-src-badge (0,2,0), otherwise navy wins. */
.adm-shell .clu-src-badge.clu-src-fixed {
    background: var(--lbl-bg, var(--navy));
    color: var(--lbl-ink, var(--text2));
}

/* Coordination grade — three stepped bars (the ordinal is visually hidden text) */
.adm-shell .clu-bars { display: inline-flex; align-items: flex-end; gap: 2px; height: 11px; vertical-align: -1px; }
.adm-shell .clu-bars i { width: 3px; background: var(--adm-border); border-radius: 1px; display: block; }
.adm-shell .clu-bars i:nth-child(1) { height: 5px; }
.adm-shell .clu-bars i:nth-child(2) { height: 8px; }
.adm-shell .clu-bars i:nth-child(3) { height: 11px; }
.adm-shell .clu-bars-1 i.on { background: #B45309; }
.adm-shell .clu-bars-2 i.on { background: #C2410C; }
.adm-shell .clu-bars-3 i.on { background: #B91C1C; }

/* Quick filters + table */
.adm-shell .clu-qf { display: flex; align-items: center; gap: 6px; margin-bottom: 12px; flex-wrap: wrap; }
.adm-shell .clu-table-scroll { overflow-x: auto; }
.adm-shell .clu-table { min-width: 980px; margin: 0; }
.adm-shell .clu-t-teema { width: 34%; min-width: 320px; }
.adm-shell .clu-table td:nth-child(2) { min-width: 210px; }
.adm-shell .clu-t-teema a { text-decoration: none; }
.adm-shell .clu-t-teema a:hover .clu-ru { text-decoration: underline; }
.adm-shell .clu-t-teema .clu-ru { font-family: inherit; font-size: 12.5px; line-height: 1.4; display: inline; }
.adm-shell .clu-t-teema .clu-et { font-size: 11px; }
.adm-shell .clu-badge-new, .adm-shell .clu-badge-rev { display: inline-block; font-size: 9px; font-weight: 700;
    letter-spacing: .4px; padding: 1px 5px; border-radius: 2px; margin-right: 5px; text-transform: uppercase; }
.adm-shell .clu-badge-new { background: #E7F5EC; color: #1F6B47; }
.adm-shell .clu-badge-rev { background: #FFF4E5; color: #A9660A; }
.adm-shell .clu-of { color: var(--text2); font-weight: 400; }
.adm-shell .clu-dash { color: var(--text2); }
.adm-shell .clu-muted { color: var(--text2); }
.adm-shell .clu-num-cell { font-variant-numeric: tabular-nums; white-space: nowrap; }
.adm-shell .clu-mini-spark { display: inline-flex; align-items: flex-end; gap: 1px; height: 18px; width: 56px; }
.adm-shell .clu-mini-spark i { flex: 1; background: var(--orange-700); opacity: .55; border-radius: .5px; min-height: 1px; }
.adm-shell .clu-sort-form { display: inline; margin: 0; }
.adm-shell .clu-sort-btn { background: none; border: none; font: inherit; font-weight: 600; color: var(--text);
    cursor: pointer; padding: 6px 2px; margin: -6px -2px; } /* >=24px pointer target, visually unchanged */
.adm-shell .clu-sort-btn:hover, .adm-shell .clu-sort-btn:focus-visible { text-decoration: underline; }
.adm-shell .clu-sort-arrow { color: var(--text2); }

/* Timeline — server-rendered lanes; `left`/`width` are percentages of the
   filter window, computed in cluster_signals.build_timeline(). */
.adm-shell .clu-tl-row { display: flex; align-items: center; gap: 9px; height: 30px; }
.adm-shell .clu-tl-name { width: 150px; flex: none; font-size: 11px; white-space: nowrap; overflow: hidden;
    text-overflow: ellipsis; }
.adm-shell .clu-tl-name a { color: var(--text2); text-decoration: none; }
.adm-shell .clu-tl-name a:hover { text-decoration: underline; }
.adm-shell .clu-tl-track { flex: 1; position: relative; height: 100%; }
.adm-shell .clu-tl-bar { position: absolute; top: 50%; transform: translateY(-50%); border-radius: 2px;
    background: var(--lbl-bg); }
.adm-shell .clu-tl-gap { position: absolute; top: 50%; transform: translateY(-50%); height: 2px;
    background: repeating-linear-gradient(90deg, var(--adm-border) 0 3px, transparent 3px 6px); }
.adm-shell .clu-tl-ax { display: flex; justify-content: space-between; font-size: 9.5px; color: var(--text2);
    margin-left: 159px; margin-top: 4px; font-variant-numeric: tabular-nums; }
.adm-shell .clu-tl-foot { margin-top: 12px; border-top: 1px solid var(--adm-border); }

@media (max-width: 1100px) {
    .adm-shell .clu-c3, .adm-shell .clu-c2 { grid-template-columns: 1fr; }
    .adm-shell .clu-col { padding: 14px 0 0; border-left: 0; border-top: 1px solid var(--adm-border-2); }
    .adm-shell .clu-col:first-child { padding-top: 0; border-top: 0; }
    .adm-shell .clu-tl-name { width: 110px; }
    .adm-shell .clu-tl-ax { margin-left: 119px; }
}

/* Shared with /console/clusters/{id} — the hint type, the filter row's own
   bits and the language chips. Everything else that page needs now lives in
   the `clu-*` block below, next to the list view's. */
.adm-shell .pm-hint { color: var(--text2); font-size: 11px; margin-left: 8px; }
.adm-shell .pm-cluster-filter-row { margin-top: 10px; }
.adm-shell .pm-lang-chips { margin-top: 10px; display: flex; gap: 6px; }

/* ── Sätted page (ISSUE #450) — page-scoped `set-*` classes only, so nothing
   here collides with Bootstrap's `.card`/`.row` (RS-5). Layout/interaction
   reference: uidemos/current/AdminSettings.html; the login, sankey and
   entity-bar blocks from that prototype are intentionally not ported. ── */
.set-wrap { display: grid; grid-template-columns: 212px minmax(0, 1fr); gap: 26px; align-items: start; max-width: 1080px; }
.set-nav { position: sticky; top: 70px; display: flex; flex-direction: column; gap: 1px; }
.set-nav a {
    display: flex; align-items: center; padding: 8px 11px; border-radius: 3px;
    font-size: 12.5px; font-weight: 600; color: var(--text2); text-decoration: none;
    border-left: 2px solid transparent;
}
.set-nav a:hover { background: #fff; color: var(--navy); }
.set-nav a.on { background: #fff; color: var(--navy); border-left-color: var(--orange); }

/* Usage strip */
.set-usage { background: #fff; border: 1px solid var(--adm-border); border-radius: 4px; margin-bottom: 16px; }
.set-usage-top { display: grid; grid-template-columns: 1.3fr 1.3fr 1fr 1fr 1fr; gap: 0; }
.set-u-cell { padding: 16px 18px; border-left: 1px solid var(--adm-border-2); min-width: 0; }
.set-u-cell:first-child { border-left: 0; }
.set-u-l { font-size: 10px; font-weight: 700; letter-spacing: .7px; text-transform: uppercase; color: var(--text2); margin-bottom: 7px; }
.set-u-v { font-family: var(--ff-serif); font-size: 22px; font-weight: 600; color: var(--navy); line-height: 1; letter-spacing: -.4px; font-variant-numeric: tabular-nums; }
.set-u-v .set-of { color: var(--text2); font-size: 14px; font-weight: 500; }
.set-u-s { font-size: 11px; color: var(--text2); margin-top: 6px; font-variant-numeric: tabular-nums; }
.set-u-bar { height: 5px; background: var(--adm-bg); border-radius: 3px; overflow: hidden; margin-top: 9px; }
.set-u-bar i { display: block; height: 100%; border-radius: 3px; background: var(--orange-700); } /* A11Y: was --orange (~2.9:1 on --adm-bg, fails 3:1 non-text); --orange-700 measured ~4.5:1 */
.set-pill { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600; padding: 2px 9px; border-radius: 10px; }
.set-pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.set-pill-idle { background: var(--adm-bg); color: var(--text2); }
.set-pill-active { background: var(--orange-soft, #FFF3EA); color: #B8430C; } /* 4.75:1 on --orange-soft #FFF3EA (WCAG AA), same value as .adm-chip.on */

.set-utabs { display: flex; flex-direction: column; gap: 0; border-top: 1px solid var(--adm-border); }
.set-utab { min-width: 0; border-top: 1px solid var(--adm-border-2); }
.set-utab:first-child { border-top: 0; }
.set-utab-h { padding: 10px 18px 0; font-size: 10px; font-weight: 700; letter-spacing: .7px; text-transform: uppercase; color: var(--text2); }
.set-main { min-width: 0; }
.set-usage, .set-usage-section, .set-card { min-width: 0; }
.set-mini-wrap { overflow-x: auto; margin-top: 6px; }
.set-mini { margin: 0; min-width: 480px; }
.set-mini th, .set-mini td { font-size: 12px; }
.set-mini th[scope="row"] { padding: 13px 14px; font-weight: 600; white-space: nowrap; }
.set-usage-note { padding: 12px 18px; border-top: 1px solid var(--adm-border); background: var(--adm-thead-bg); font-size: 11.5px; line-height: 1.6; }

/* Settings cards + field rows */
.set-card { background: #fff; border: 1px solid var(--adm-border); border-radius: 4px; margin-bottom: 16px; scroll-margin-top: 70px; }
.set-usage-section { scroll-margin-top: 70px; }
.set-card-head { padding: 14px 18px; border-bottom: 1px solid var(--adm-border); }
.set-card-title { font-size: 13px; font-weight: 700; color: var(--navy); }
.set-card-sub { font-size: 11.5px; color: var(--text2); margin-top: 3px; line-height: 1.5; }
.set-card-body { padding: 4px 18px 18px; }

.set-row { display: grid; grid-template-columns: minmax(220px, 1fr) minmax(0, 300px); gap: 22px; align-items: start; padding: 14px 0; border-bottom: 1px solid var(--adm-border-2); }
.set-row:last-child { border-bottom: 0; }
.set-row-l label { font-size: 12.5px; font-weight: 600; color: var(--navy); display: block; }
.set-help { font-size: 11.5px; color: var(--text2); line-height: 1.55; margin-top: 4px; max-width: 58ch; }
.set-with-unit { display: flex; align-items: stretch; border: 1px solid var(--adm-border); border-radius: 3px; background: #fff; overflow: hidden; transition: border-color .12s; }
.set-with-unit:focus-within { border-color: var(--navy); }
.set-with-unit .adm-input { border: 0; border-radius: 0; flex: 1; min-width: 0; }
.set-with-unit .adm-input:focus { border: 0; outline: none; }
.set-affix { display: flex; align-items: center; padding: 0 0 0 11px; font-size: 12.5px; color: var(--text2); flex: none; }
.set-hintline { font-size: 11px; color: var(--text2); text-align: right; margin-top: 4px; }

/* Toggle switch */
.set-toggle { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; user-select: none; }
.set-toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.set-toggle .set-track { width: 38px; height: 21px; border-radius: 11px; background: var(--adm-border); position: relative; transition: background .14s; flex: none; }
.set-toggle .set-track::after { content: ''; position: absolute; top: 2px; left: 2px; width: 17px; height: 17px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(15, 36, 64, .2); transition: transform .14s; }
.set-toggle input:checked + .set-track { background: var(--orange); }
.set-toggle input:checked + .set-track::after { transform: translateX(17px); }
.set-toggle input:focus-visible + .set-track { outline: 2px solid var(--orange); outline-offset: 2px; }
.set-toggle-state { font-size: 11.5px; font-weight: 600; color: var(--text2); width: 38px; }

/* Callouts */
.set-note { display: flex; gap: 10px; padding: 11px 13px; border-radius: 3px; font-size: 11.5px; line-height: 1.6; margin: 14px 0 0; }
.set-note-info { background: var(--adm-bg); color: var(--text2); }
.set-note-warn { background: #FFF8EC; border: 1px solid #F2DDB4; color: #7A4F0E; }

/* Field-level errors + required-field legend */
.set-field-error { font-size: 11.5px; color: var(--red-700); margin-top: 4px; }
.set-legend { font-size: 11.5px; color: var(--text2); margin-bottom: 14px; }
.set-legend span { color: var(--orange); }

/* Actions + sticky save bar. The static in-form submit (AC-8) stays visible
   by default and is hidden only while the sticky bar is independently
   visible — .set-js-bound is toggled in lockstep with .set-savebar.on by
   admin-settings.js, never unconditionally on load, so a 200
   validation-error re-render (dirty count 0) always keeps a reachable
   submit control. */
.set-actions { display: flex; justify-content: flex-end; margin-top: 4px; }
.set-actions.set-js-bound { display: none; }
.set-savebar {
    position: fixed; left: 240px; right: 0; bottom: 0; z-index: 50; background: #fff;
    border-top: 1px solid var(--adm-border); box-shadow: 0 -6px 22px rgba(15, 36, 64, .08);
    padding: 12px 32px; display: flex; align-items: center; gap: 12px;
    transform: translateY(110%); transition: transform .2s ease;
}
.set-savebar.on { transform: none; }
.set-savebar-msg { font-size: 12.5px; color: var(--text2); display: flex; align-items: center; gap: 8px; }
.set-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--orange); flex: none; }
.set-savebar-actions { margin-left: auto; display: flex; gap: 9px; }
.adm-shell.collapsed ~ .set-savebar { left: 64px; }

/* Keyboard focus inside the form must never land under the fixed save bar.
   Page-scoped (not the shared .adm-content rule, which other admin pages
   also use) — a spacer div reserves room below the form, and
   every focusable control gets a matching scroll-margin-bottom so
   focus-scroll (Tab, or a screen reader's virtual cursor) stops clear of
   the bar even on narrow viewports where it wraps to two lines. */
.set-bottom-spacer { height: 96px; }
.set-wrap .adm-input,
.set-wrap .set-toggle,
.set-wrap button { scroll-margin-bottom: 96px; }
@media (max-width: 900px) {
    .set-bottom-spacer { height: 140px; }
    .set-wrap .adm-input,
    .set-wrap .set-toggle,
    .set-wrap button { scroll-margin-bottom: 140px; }
}

@media (max-width: 1240px) {
    .set-wrap { grid-template-columns: minmax(0, 1fr); gap: 16px; max-width: none; }
    .set-nav { position: static; flex-direction: row; overflow-x: auto; gap: 4px; background: #fff; border: 1px solid var(--adm-border); border-radius: 4px; padding: 6px; }
    .set-nav a { border-left: 0; border-bottom: 2px solid transparent; white-space: nowrap; }
    .set-nav a.on { border-left: 0; border-bottom-color: var(--orange); background: var(--orange-soft, #FFF3EA); }
}
@media (max-width: 1100px) {
    .set-usage-top { grid-template-columns: 1fr 1fr; }
    .set-u-cell:nth-child(odd) { border-left: 0; }
    .set-u-cell:nth-child(n+3) { border-top: 1px solid var(--adm-border-2); }
}
@media (max-width: 960px) {
    .set-row { grid-template-columns: 1fr; gap: 8px; }
}
@media (max-width: 900px) {
    .set-savebar { left: 0; padding: 12px 14px; flex-wrap: wrap; }
    .set-u-cell { border-left: 0; border-top: 1px solid var(--adm-border-2); }
    .set-u-cell:first-child { border-top: 0; }
    .set-usage-top { grid-template-columns: 1fr; }
}

/* ── /console/clusters/{id} (ISSUE #446, restyled to the prototype in ISSUE
   #502). Layout reference: uidemos/current/AdminCluster.html. Shares the
   `clu-*` namespace with the list view above — the pills, the coordination
   bars, the source colour slots and the empty-state type are one set across
   both cluster surfaces, not two that drift. ── */
.adm-shell .clu-back { display: inline-flex; align-items: center; gap: 7px; font-size: 12px;
    font-weight: 600; color: var(--text2); text-decoration: none; margin-bottom: 14px; }
.adm-shell .clu-back:hover { color: var(--navy); }

.adm-shell .clu-hero { background: #fff; border: 1px solid var(--adm-border); border-radius: 4px;
    padding: 20px 22px; margin-bottom: 16px; }
.adm-shell .clu-hero-top { display: flex; align-items: flex-start; gap: 20px; }
.adm-shell .clu-hero-titles { min-width: 0; flex: 1; }
.adm-shell .clu-hero-ttl { font-family: var(--ff-serif); font-size: 25px; font-weight: 600;
    color: var(--navy); line-height: 1.25; letter-spacing: -.4px; margin: 0; }
.adm-shell .clu-hero-et { font-size: 13px; color: var(--text2); line-height: 1.5; margin: 6px 0 0; }
.adm-shell .clu-hero .pm-lang-chips { margin-top: 0; flex: none; }
.adm-shell .clu-badge-rev { display: inline-block; font-size: 9.5px; font-weight: 700;
    letter-spacing: .4px; padding: 2px 6px; border-radius: 2px; background: #FFF4E5; color: #A9660A;
    text-transform: uppercase; vertical-align: 3px; margin-right: 8px; }

.adm-shell .clu-tiles { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
    margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--adm-border-2); }
.adm-shell .clu-tile { padding: 0 18px; border-left: 1px solid var(--adm-border-2); min-width: 0; }
.adm-shell .clu-tile:first-child { padding-left: 0; border-left: 0; }
.adm-shell .clu-tile-l { font-size: 10px; font-weight: 700; letter-spacing: .9px;
    text-transform: uppercase; color: var(--text2); margin-bottom: 6px; }
.adm-shell .clu-tile-lrow { margin-bottom: 6px; }
.adm-shell .clu-tile-lrow > .clu-tile-l { margin-bottom: 0; }
.adm-shell .clu-tile-v { font-family: var(--ff-serif); font-size: 24px; font-weight: 600;
    color: var(--navy); line-height: 1; letter-spacing: -.5px; font-variant-numeric: tabular-nums; }
.adm-shell .clu-tile-v-sm { font-size: 17px; letter-spacing: -.2px; }
.adm-shell .clu-tile-v .clu-bars { margin-left: 5px; }
.adm-shell .clu-tile-s { font-size: 10.5px; color: var(--text2); margin-top: 4px;
    font-variant-numeric: tabular-nums; }

.adm-shell .clu-hero-narr { margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--adm-border-2); }
.adm-shell .clu-hero-narr .clu-col-hd { margin-bottom: 9px; }
.adm-shell .clu-hero-narr .clu-narr-head { margin-bottom: 9px; }
.adm-shell .clu-hero-narr .clu-narr-head > .clu-col-hd { margin-bottom: 0; }
.adm-shell .clu-pill-note { font-size: 11px; color: var(--text2); margin: 9px 0 0; }

/* Section card */
.adm-shell .clu-sec { background: #fff; border: 1px solid var(--adm-border); border-radius: 4px;
    margin-bottom: 16px; }
.adm-shell .clu-sec-h { padding: 14px 18px; border-bottom: 1px solid var(--adm-border);
    display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.adm-shell .clu-sec-t { font-size: 13px; font-weight: 700; color: var(--navy); margin: 0; }
.adm-shell .clu-sec-b { padding: 18px; }
.adm-shell .clu-sec-note { font-size: 11px; color: var(--text2); }
.adm-shell .clu-ner-n { color: var(--text2); font-weight: 600; }

/* Levik — one column per day, stacked by source */
.adm-shell .clu-legend { display: flex; gap: 12px; flex-wrap: wrap; }
.adm-shell .clu-lg { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; color: var(--text2); }
.adm-shell .clu-lg i { width: 9px; height: 9px; border-radius: 2px; display: block; }
.adm-shell .clu-levik { position: relative; display: flex; align-items: flex-end; gap: 3px;
    height: 170px; padding-top: 8px; }
.adm-shell .clu-lv-day { flex: 1; display: flex; flex-direction: column; justify-content: flex-end;
    gap: 1px; min-width: 0; height: 100%; }
.adm-shell .clu-lv-day i { display: block; border-radius: 1px; min-height: 2px; }
.adm-shell .clu-lv-gap { position: absolute; top: 0; bottom: 0;
    background: repeating-linear-gradient(135deg, #F1F3F5 0 5px, #E8EAED 5px 10px);
    border-left: 1px dashed var(--adm-border); border-right: 1px dashed var(--adm-border);
    display: flex; align-items: center; justify-content: center; }
.adm-shell .clu-lv-gap span { font-size: 10px; font-weight: 700; color: var(--text2);
    text-transform: uppercase; letter-spacing: .5px; background: #fff;
    border: 1px solid var(--adm-border); border-radius: 2px; padding: 2px 7px; white-space: nowrap; }
.adm-shell .clu-lv-ax { display: flex; justify-content: space-between; font-size: 9.5px;
    color: var(--text2); margin-top: 8px; font-variant-numeric: tabular-nums; }

/* Top olemid */
.adm-shell .clu-ner-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; }
.adm-shell .clu-ner-col { padding: 0 20px; border-left: 1px solid var(--adm-border-2); min-width: 0; }
.adm-shell .clu-ner-col:first-child { padding-left: 0; border-left: 0; }
.adm-shell .clu-cloud { display: flex; flex-wrap: wrap; gap: 6px; }
.adm-shell .clu-ent { display: inline-flex; align-items: center; gap: 6px;
    border: 1px solid var(--adm-border); border-radius: 3px; padding: 4px 9px;
    font-size: 12px; color: var(--text); background: #fff; }
.adm-shell .clu-ent-n { font-size: 10px; font-weight: 700; color: var(--text2);
    font-variant-numeric: tabular-nums; }
.adm-shell .clu-ent.clu-tier-lg { font-size: 13px; font-weight: 600; color: var(--navy);
    border-color: var(--navy); }
.adm-shell .clu-ent.clu-tier-md { font-weight: 500; }
.adm-shell .clu-ner-more { margin-top: 10px; }
.adm-shell .clu-ner-more summary { cursor: pointer; font-size: 11.5px; font-weight: 600;
    color: var(--orange-700); list-style: none; }
.adm-shell .clu-ner-more summary::-webkit-details-marker { display: none; }
.adm-shell .clu-ner-more .clu-cloud { margin-top: 10px; }

/* Article accordion */
.adm-shell .clu-arow { border-bottom: 1px solid var(--adm-border-2); }
.adm-shell .clu-arow:last-of-type { border-bottom: 0; }
.adm-shell .clu-arow-h { display: flex; align-items: center; gap: 12px; padding: 12px 18px;
    cursor: pointer; list-style: none; }
.adm-shell .clu-arow-h::-webkit-details-marker { display: none; }
.adm-shell .clu-arow-h:hover { background: var(--adm-row-hover, var(--adm-thead-bg)); }
.adm-shell .clu-arow-h:focus-visible { outline: 2px solid var(--navy); outline-offset: -2px; }
.adm-shell .clu-arow-t { flex: 1; min-width: 0; font-size: 12.5px; font-weight: 600;
    color: var(--navy); line-height: 1.45; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.adm-shell .clu-conf { font-size: 11px; font-weight: 700; color: var(--text2);
    font-variant-numeric: tabular-nums; flex: none; width: 34px; text-align: right; }
.adm-shell .clu-atime { font-size: 11px; color: var(--text2); font-variant-numeric: tabular-nums;
    flex: none; width: 112px; text-align: right; }
.adm-shell .clu-chev { color: var(--text2); flex: none; transition: transform .15s; }
.adm-shell .clu-arow[open] .clu-chev { transform: rotate(180deg); }
.adm-shell .clu-arow-b { padding: 2px 18px 16px; }
.adm-shell .clu-arow-b p { font-size: 12px; color: var(--text2); line-height: 1.6; max-width: 80ch; margin: 0; }
.adm-shell .clu-arow-b p.clu-none { color: var(--text2); font-style: italic; }
.adm-shell .clu-arow-b .clu-col-hd { margin-bottom: 5px; }
.adm-shell .clu-arow-links { display: flex; gap: 14px; margin-top: 12px; font-size: 11.5px; font-weight: 600; }
.adm-shell .clu-arow-actions { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.adm-shell .clu-arow-actions .adm-input { max-width: 320px; }
.adm-shell .clu-mono-url { font-family: var(--ff-mono, monospace); font-weight: 400; color: var(--text2); }
.adm-shell .clu-en-badge { display: inline-block; font-size: 8.5px; font-weight: 700;
    letter-spacing: .5px; color: var(--text2); border: 1px solid var(--adm-border);
    border-radius: 2px; padding: 0 3px; vertical-align: 1px; margin-right: 5px; }

@media (max-width: 1100px) {
    .adm-shell .clu-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 0; }
    .adm-shell .clu-tile:nth-child(odd) { padding-left: 0; border-left: 0; }
    .adm-shell .clu-ner-grid { grid-template-columns: 1fr; }
    .adm-shell .clu-ner-col { padding: 14px 0 0; border-left: 0; border-top: 1px solid var(--adm-border-2); }
    .adm-shell .clu-ner-col:first-child { padding-top: 0; border-top: 0; }
    .adm-shell .clu-hero-top { flex-wrap: wrap; }
}

/* ISSUE #447/#448 — narrative list card: keyboard-openable drawer trigger,
   pencil/eye action group, .selected highlight while its drawer is open. */
.nar-card:focus-visible {
    outline: 2px solid var(--orange);
    outline-offset: 2px;
}

.nar-card.selected {
    border-color: var(--orange);
    box-shadow: 0 0 0 3px var(--orange-soft, rgba(242, 101, 34, .12));
}

.nar-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

/* Activity log (Sätted): a collapsed run expands in place via native <details>,
   so the whole panel works with JS off. */
.adm-event-run {
    list-style: none;
    margin: 6px 0 0;
    padding: 0 0 0 4px;
    border-left: 2px solid var(--adm-border);
}

.adm-event-run li {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 3px 0 3px 10px;
    font-size: 0.85rem;
    color: var(--text2);
}

.adm-event-run code,
.adm-event-detail {
    font-size: 0.8rem;
    color: var(--text2);
    word-break: break-word;
}

.adm-event-detail {
    display: block;
    margin-top: 6px;
}

.adm-table details > summary {
    cursor: pointer;
}

/* Pager links carry `#<id>` so paging keeps the reader at the list instead of
   at the top of the document (ISSUE #496); the target reserves the sticky
   .adm-topbar's height plus a little air. */
.adm-anchor { scroll-margin-top: 72px; }

/* ── AI / machine-translation provenance marker, admin shell (ISSUE #512) ──
   Reuses .aa-trans-note / .aa-mt-note for the tint; this adds only the
   tooltip mechanics, which are CSS-only so they need no JS. */
.aa-ai-note {
    position: relative;   /* containing block for .aa-ai-tip, a sibling of the button */
    margin: 0 0 var(--sp-2xs);
}
.aa-ai-info {
    display: inline-flex;
    align-items: center;
    padding: 0;
    border: 0;
    background: none;
    color: inherit;
    cursor: help;
}
.aa-ai-tip {
    position: absolute;
    left: 0;
    bottom: calc(100% + var(--sp-2xs));
    z-index: 5;
    display: none;
    width: max-content;
    max-width: min(32ch, 90vw);
    padding: var(--sp-2xs) var(--sp-sm);
    border-radius: var(--radius-sm);
    background: var(--navy);
    color: var(--pm-surface);
    font-size: var(--fs-xs);
    font-style: normal;
    box-shadow: 0 4px 14px var(--shadow-navy-18);
}
.aa-ai-info:hover + .aa-ai-tip,
.aa-ai-info:focus-visible + .aa-ai-tip {
    display: block;
}

/* ── Admin ⓘ explanation (info_tip, ISSUE #616) ──
   Short (≤350 char) hover/focus/tap explanations next to a card title or KPI
   label. CSS alone covers hover/focus (no-JS fallback, FR-5); JS
   (adm-info-tip.js) adds tap, Escape, hover persistence and a viewport
   clamp, and marks the wrapper `.adm-info-tip--js` to take over from CSS. */
.adm-info-tip {
    position: relative;
    display: inline-flex;
    vertical-align: middle;
    /* Reset: this sits inside .adm-kpi-lbl / .adm-inline-field label, both
       uppercase with letter-spacing — the tip's own text must not inherit it. */
    text-transform: none;
    letter-spacing: normal;
    font-weight: 400;
}
.adm-info-tip-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    margin-block: -2px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: none;
    color: var(--text2);
    font-size: 13px;
    cursor: help;
}
.adm-info-tip-btn::after {
    /* 24x24 hit area (WCAG 2.5.8) without widening the 16px layout box */
    content: "";
    position: absolute;
    inset: -4px;
}
.adm-info-tip-btn:hover { color: var(--navy); }
.adm-info-tip-btn:focus-visible {
    outline: 2px solid var(--orange-700);
    outline-offset: 1px;
}
.adm-info-tip-panel {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    z-index: 200;
    width: max-content;
    max-width: min(22rem, calc(100vw - 16px));
    padding: 8px 10px;
    background: var(--adm-surface);
    color: var(--navy);
    border: 1px solid var(--adm-border);
    border-radius: 4px;
    box-shadow: 0 4px 14px var(--shadow-navy-18);
    font: 400 12px/1.5 var(--ff-sans);
    letter-spacing: normal;
    text-transform: none;
    white-space: normal;
    text-align: left;
    transform: translateX(var(--adm-info-tip-shift, 0px));
}
.adm-info-tip-panel::before {
    /* Hover bridge across the 6px gap (WCAG 1.4.13 "hoverable") */
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: -7px;
    height: 7px;
}
.adm-info-tip--above > .adm-info-tip-panel {
    top: auto;
    bottom: calc(100% + 6px);
}
.adm-info-tip--above > .adm-info-tip-panel::before {
    top: auto;
    bottom: -7px;
}
/* No-JS fallback (FR-5, AC-8) — turned off once adm-info-tip.js adds --js */
.adm-info-tip:not(.adm-info-tip--js):hover > .adm-info-tip-panel,
.adm-info-tip:not(.adm-info-tip--js) > .adm-info-tip-btn:focus-visible + .adm-info-tip-panel {
    display: block;
}
.adm-info-tip--open > .adm-info-tip-panel { display: block; }
@media (forced-colors: active) {
    .adm-info-tip-panel { border-color: CanvasText; }
    .adm-info-tip-btn { color: ButtonText; }
    .adm-info-tip-btn:focus-visible { outline-color: Highlight; }
}
@media print {
    .adm-info-tip { display: none; }
}
/* .adm-card-head has gap:14px and justify-content:space-between — -8px plus
   the gap leaves 6px after the title, and margin-right:auto keeps the tip
   next to the title instead of splitting the head's other content away. */
.adm-card-head > .adm-info-tip { margin-left: -8px; margin-right: auto; }
.adm-kpi-lbl > .adm-info-tip { margin-left: 4px; }
.adm-label-row { display: flex; align-items: center; gap: 4px; }
.adm-h1-row { gap: 8px; margin-bottom: .5rem; }
.adm-h1-row > .adm-h1 { margin-bottom: 0; }

/* Avastused (/console/discoveries) — candidate card, proximity bar, context
   quotes, bulk bar, add-term panel. Token-only (KB-0020). DISCOVERIES-CSS-START */
.dsc-tb { display: flex; align-items: center; gap: var(--sp-xs); flex-wrap: wrap; margin-bottom: var(--sp-md); }
.dsc-tb-search { display: flex; align-items: center; gap: var(--sp-8px); background: var(--adm-surface);
  border: 1px solid var(--adm-border); border-radius: var(--radius-3xs); padding: var(--sp-2xs) var(--sp-sm);
  flex: 1 1 200px; max-width: 260px; min-width: 0; box-sizing: border-box; }
.dsc-tb-search:focus-within { border-color: var(--navy); }
.dsc-tb-search input { border: 0; outline: 0; background: transparent; width: 100%; font-size: var(--fs-xs); color: var(--text); font-family: inherit; }
.dsc-tb-search i { color: var(--text2); flex: none; }
.dsc-tb-group { display: flex; gap: var(--sp-4px); align-items: center; flex-wrap: wrap; }
.dsc-tb-sep { width: 1px; height: 20px; background: var(--adm-border); flex: none; }
.dsc-tb-lbl { font-size: var(--fs-2xs); font-weight: 700; color: var(--text2); text-transform: uppercase; }
.dsc-tb-select { background: var(--adm-surface); border: 1px solid var(--adm-border); border-radius: var(--radius-3xs);
  padding: var(--sp-2xs) var(--sp-9px); font-size: var(--fs-xs); font-family: inherit; color: var(--navy);
  outline: none; cursor: pointer; font-weight: 600; }
.dsc-tb-select:focus { border-color: var(--navy); }
.dsc-tb-count { margin-left: auto; font-size: var(--fs-xs); color: var(--text2); }
.dsc-tb-count b { color: var(--navy); font-weight: 700; }

.dsc-link-btn { background: none; border: 0; padding: 0; font-size: var(--fs-2xs); font-weight: 600;
  color: var(--orange); font-family: inherit; cursor: pointer; text-decoration: underline; }
.dsc-link-btn:hover { color: var(--orange-700); }
.dsc-toast-close { margin-left: var(--sp-2xs); }

.dsc-select-all { display: flex; align-items: center; gap: var(--sp-2xs); margin-bottom: var(--sp-2xs); font-size: var(--fs-2xs); }
.dsc-bulkbar { display: flex; align-items: center; gap: var(--sp-md); background: var(--adm-rail); color: var(--adm-rail-text-active);
  border-radius: var(--radius-md); padding: var(--sp-2xs) var(--sp-lg); margin-bottom: var(--sp-md); font-size: var(--fs-xs); }
.dsc-bulkbar b { font-weight: 700; }
.dsc-bulkbar .sp { flex: 1; }
.dsc-bulkbar .dsc-link-btn { color: var(--dsc-bulkbar-link); }
.dsc-bulkbar .dsc-link-btn:hover { color: var(--adm-rail-text-active); }

.dsc-cand-list { display: flex; flex-direction: column; gap: var(--sp-xs); }
.dsc-card { background: var(--adm-surface); border: 1px solid var(--adm-border); border-radius: var(--radius-md);
  display: grid; grid-template-columns: 34px 1fr 236px; }
.dsc-card.is-decided { background: var(--adm-bg); border-style: dashed; }
.dsc-card:has(.dsc-row-check:checked) { border-color: var(--orange); box-shadow: inset 3px 0 0 var(--orange); }

.dsc-check { display: flex; align-items: flex-start; justify-content: center; padding-top: var(--sp-xl); }
.dsc-check input { accent-color: var(--orange); cursor: pointer; }

.dsc-main { padding: var(--sp-lg) var(--sp-2xl) var(--sp-lg) var(--sp-5xs); min-width: 0; }
.dsc-top { display: flex; align-items: center; gap: var(--sp-3xs); flex-wrap: wrap; margin-bottom: var(--sp-4xs); }
.dsc-term { font-size: var(--sp-2xl); font-weight: 700; color: var(--navy); }
.dsc-type { display: inline-flex; align-items: center; font-size: var(--fs-2xs); font-weight: 700;
  padding: var(--sp-5xs) var(--sp-2xs); border-radius: var(--radius-sm); text-transform: uppercase; }
.dsc-type-negative { background: var(--dsc-type-neg-bg); color: var(--dsc-type-neg-fg); }
.dsc-type-comparative { background: var(--dsc-type-pat-bg); color: var(--dsc-type-pat-fg); }
.dsc-type-glossary { background: var(--dsc-type-glo-bg); color: var(--dsc-type-glo-fg); }
.dsc-type-entity { background: var(--dsc-type-ner-bg); color: var(--dsc-type-ner-fg); }
.dsc-mech { display: inline-flex; align-items: center; gap: var(--sp-4xs); font-size: var(--fs-2xs);
  color: var(--text2); background: var(--adm-bg); padding: var(--sp-5xs) var(--sp-2xs); border-radius: var(--radius-sm); }
.dsc-seen { font-size: var(--fs-2xs); color: var(--text2); margin-bottom: var(--sp-2xs); }
.dsc-seen b { color: var(--navy); font-weight: 600; }

.dsc-ctx { border-left: 2px solid var(--adm-border); padding-left: var(--sp-sm); display: flex; flex-direction: column; gap: var(--sp-7px); }
.dsc-ctx-row { font-size: var(--fs-xs); color: var(--text); }
.dsc-ctx-row q { quotes: '«' '»'; color: var(--text); }
.dsc-ctx-row mark { background: var(--dsc-mark-bg); color: var(--dsc-mark-fg); font-weight: 600; padding: 0 var(--sp-5xs); border-radius: var(--radius-1px); }
.dsc-ctx-src { display: block; font-size: var(--fs-2xs); color: var(--text2); margin-top: var(--sp-5xs); }
.dsc-ctx-src a { color: var(--navy); text-decoration: none; font-weight: 500; }
.dsc-ctx-src a:hover { text-decoration: underline; }
.dsc-ctx-more { font-size: var(--fs-xs); font-weight: 600; color: var(--orange); cursor: pointer; }
.dsc-sources { margin-top: var(--sp-4xs); font-size: var(--fs-2xs); color: var(--text2); }
.dsc-src-rest { display: block; margin-top: var(--sp-5xs); }

.dsc-act { border-left: 1px solid var(--adm-border-2); padding: var(--sp-lg) var(--sp-16px); display: flex; flex-direction: column; gap: var(--sp-xs); min-width: 0; }
.dsc-decided { display: flex; flex-direction: column; gap: var(--sp-7px); justify-content: center; height: 100%; }
.dsc-decided-msg { font-size: var(--fs-xs); color: var(--text2); }

.dsc-baseline-body { padding: 0 var(--sp-2xl) var(--sp-lg); }
.dsc-baseline-hint { font-size: var(--fs-2xs); color: var(--text2); margin-bottom: var(--sp-xs); }
.dsc-baseline-list { font-size: var(--fs-sm); margin: 0; }
.dsc-add-panel { background: var(--adm-surface); border: 1px solid var(--adm-border); border-radius: var(--radius-md); margin-bottom: var(--sp-lg); }
.dsc-add-head { padding: var(--sp-md) var(--sp-2xl); display: flex; align-items: center; gap: var(--sp-xs); cursor: pointer; list-style: none; }
.dsc-add-head::-webkit-details-marker { display: none; }
.dsc-add-head .t { font-size: var(--fs-sm); font-weight: 700; color: var(--navy); }
.dsc-add-body { padding: var(--sp-lg); display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-md) var(--sp-lg); align-items: end; }
.dsc-add-body .fld { display: flex; flex-direction: column; gap: var(--sp-4xs); min-width: 0; }
.dsc-add-body .fld input.adm-input, .dsc-add-body .fld select.adm-input { width: 100%; box-sizing: border-box; }
.dsc-add-body .fld label { font-size: var(--fs-2xs); font-weight: 700; color: var(--text2); text-transform: uppercase; }
.dsc-add-body .fld label .opt { font-weight: 500; text-transform: none; color: var(--text2); }
.dsc-add-foot { grid-column: 1 / -1; display: flex; align-items: center; gap: var(--sp-xs); padding-top: var(--sp-5xs);
  border-top: 1px solid var(--adm-border-2); margin-top: var(--sp-5xs); }
.dsc-add-foot .hint { font-size: var(--fs-2xs); color: var(--text2); flex: 1; }

.dsc-term-note { font-size: var(--fs-2xs); color: var(--text2); margin-top: var(--sp-4xs); }
.dsc-src-badge { display: inline-flex; align-items: center; font-size: var(--fs-2xs); font-weight: 700;
  padding: var(--sp-5xs) var(--sp-2xs); border-radius: var(--radius-sm); }
.dsc-src-auto { background: var(--dsc-src-auto-bg); color: var(--dsc-src-auto-fg); }
.dsc-src-manual, .dsc-src-config { background: var(--adm-bg); color: var(--text2); }
.dsc-nar-unbound { background: var(--adm-bg); color: var(--text2); }
.dsc-warn { font-size: var(--fs-xs); color: var(--dsc-type-neg-fg); background: var(--dsc-type-neg-bg);
  padding: var(--sp-2xs) var(--sp-sm); border-radius: var(--radius-3xs); margin: var(--sp-md) 0 var(--sp-4xs); }
.dsc-empty-wrap { text-align: center; }
.dsc-empty-wrap .adm-btn { margin-top: var(--sp-2xs); }

.dsc-toasts { position: fixed; right: var(--sp-2xl); bottom: var(--sp-2xl); z-index: 80; }
.dsc-toasts .adm-alert { box-shadow: var(--shadow-navy-24); }

@media (max-width: 1180px) {
  .dsc-card { grid-template-columns: 34px 1fr; }
  .dsc-act { grid-column: 2; border-left: 0; border-top: 1px solid var(--adm-border-2); }
}
@media (max-width: 720px) {
  .dsc-card { grid-template-columns: 1fr; }
  .dsc-check { grid-row: 1; padding: var(--sp-2xs) var(--sp-2xs) 0; }
  .dsc-main { grid-row: 2; }
  .dsc-act { grid-row: 3; grid-column: 1; }
}
/* DISCOVERIES-CSS-END */
