/* Regula — Alexela CVI v1.1 aligned (cyan #00BCF1 / navy #172057, Commissioner). */

@font-face {
    font-family: 'Commissioner';
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url('brand/fonts/commissioner-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: 'Commissioner';
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url('brand/fonts/commissioner-latin-ext.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
    font-family: 'Adieu';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('brand/fonts/Adieu-Bold.woff2') format('woff2');
}

:root {
    /* Canonical Alexela CVI tokens — pinned to the values shared across the
       suite. `--alx-*` aliases preserved so existing Regula-specific
       selectors (which already used those names) keep working. */
    --alx-brand: #00BCF1;
    --alx-brand-light: #E0F6FD;
    --alx-brand-dark: #0095C4;
    --alx-navy: #172057;
    --alx-navy-mid: #1A3654;
    --alx-grey-75: #4E6267;
    --alx-grey-50: #969696;
    --alx-grey-25: #C7C7C7;
    --alx-grey-10: #EBEBEB;
    --alx-success: #3D866B;
    --alx-warning: #C27050;
    --alx-alert: #C27050;

    /* CVI semantic tokens (light-only — dark mode dropped to match the
       other apps). */
    --paper:       #f7f6f2;
    --card:        #ffffff;
    --ink:         #172057;
    --ink-2:       #4E6267;
    --ink-3:       #969696;
    --line:        #e2e2e0;
    --line-soft:   #ececea;
    --accent:      #00BCF1;
    --accent-soft: #E0F6FD;
    --bar:         50px;
    --sidebar:     220px;

    /* Legacy aliases used by existing Regula-specific selectors. */
    --primary: var(--ink);
    --alexela-cyan: var(--accent);
    --alexela-cyan-dark: var(--alx-brand-dark);
    --bg: var(--paper);
    --border: var(--line);
    --text: var(--ink);
    --muted: var(--ink-3);
    --input-bg: var(--card);
    --surface-muted: var(--line-soft);
    --header-bg: var(--card);
    --header-bg-end: var(--card);
    --header-text: var(--ink);
    --header-link: var(--ink-2);
    --header-link-hover-bg: var(--line-soft);
    --header-shadow: none;
    --row-hover: rgba(0, 188, 241, 0.06);
    --chip-bg: var(--accent-soft);
    --success-bg: #C0FFD3;
    --success-text: #3D866B;
    --error-bg: #FFF6E1;
    --error-text: #C27050;
    --warning-bg: #FFF6E1;
    --warning-text: #C27050;
    --critical: #C27050;
    --high: #E67E22;
    --medium: var(--alx-warning);
    --low: var(--alx-success);
    color-scheme: light;
}

[data-theme="dark"] {
    --primary: var(--alx-brand);
    --bg: #0B1520;
    --card: #152232;
    --border: #2A4055;
    --text: #E8EDF2;
    --muted: #94A3B4;
    --input-bg: #1A2D42;
    --surface-muted: #1A2D42;
    --header-bg: #060E18;
    --header-bg-end: #0F2338;
    --header-text: #FFFFFF;
    --header-link: rgba(255, 255, 255, 0.82);
    --header-link-hover-bg: rgba(0, 188, 241, 0.18);
    --header-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
    --row-hover: rgba(0, 188, 241, 0.08);
    --chip-bg: rgba(0, 188, 241, 0.15);
    --success-bg: rgba(34, 160, 107, 0.18);
    --success-text: #6DD4A8;
    --error-bg: rgba(229, 57, 53, 0.15);
    --error-text: #FF8A80;
    --warning-bg: rgba(232, 155, 12, 0.15);
    --warning-text: #FFCC80;
    --paper: #0B1520;
    --ink: #E8EDF2;
    --ink-2: #94A3B4;
    --ink-3: #64748b;
    --line: #2A4055;
    --line-soft: #1A2D42;
    color-scheme: dark;
}

* { box-sizing: border-box; }

body {
    font-family: 'Commissioner', -apple-system, "Segoe UI", Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    margin: 0;
    line-height: 1.5;
}
h1, h2, h3, h4 {
    font-family: 'Adieu', 'Commissioner', Arial, sans-serif;
    color: var(--ink);
    letter-spacing: -0.3px;
}

/* ── Topbar + body + sidebar ─ */
.topbar {
    height: var(--bar);
    background: var(--card);
    border-bottom: 1px solid var(--line);
    display: grid;
    grid-template-columns: minmax(240px, auto) 1fr minmax(140px, auto);
    align-items: center;
    padding: 0 20px;
    position: sticky; top: 0; z-index: 50;
}
.topbar__brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; }
.topbar__mark {
    width: 28px; height: 28px;
    background: var(--accent);
    -webkit-mask: url('brand/monogram.svg') center / 78% no-repeat;
            mask: url('brand/monogram.svg') center / 78% no-repeat;
    flex: 0 0 auto;
}
.topbar__name { font-weight: 600; font-size: 15px; letter-spacing: -0.2px; color: var(--ink); }
.topbar__sep { width: 1px; height: 18px; background: var(--line); margin: 0 4px; }
.topbar__app { color: var(--ink-2); font-size: 14px; font-weight: 500; }
.topbar__menu { display: flex; justify-content: center; gap: 2px; }
.topbar__menu-link {
    color: var(--ink-2); font-size: 13.5px; font-weight: 500;
    padding: 8px 14px; border-radius: 6px; text-decoration: none;
}
.topbar__menu-link:hover { background: var(--line-soft); color: var(--ink); }
.topbar__right { display: flex; justify-content: flex-end; align-items: center; gap: 12px; }
.topbar__user { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); }
.topbar__avatar {
    width: 26px; height: 26px; border-radius: 50%;
    background: #FFF6E1; color: var(--ink);
    display: flex; align-items: center; justify-content: center;
    font-size: 10.5px; font-weight: 600; letter-spacing: 0.3px;
}
.topbar__logout {
    border: 1px solid var(--line); background: var(--card); color: var(--ink);
    padding: 6px 12px; border-radius: 6px; font-size: 13px; font-weight: 500;
    text-decoration: none;
}
.topbar__logout:hover { background: var(--line-soft); }

.body {
    display: flex;
    min-height: calc(100vh - var(--bar));
}
.body > main {
    flex: 1; min-width: 0;
    overflow: auto;
}
.side {
    flex: 0 0 var(--sidebar);
    border-left: 1px solid var(--line);
    background: var(--card);
    padding: 18px 12px;
    display: flex; flex-direction: column; gap: 18px;
}
.side__group { display: flex; flex-direction: column; gap: 2px; }
.side__group-title {
    font: 500 10px/1 ui-monospace, monospace;
    color: var(--ink-3);
    text-transform: uppercase; letter-spacing: 1.5px;
    padding: 0 10px 6px;
}
.side__link {
    color: var(--ink-2); font-size: 13.5px; font-weight: 500;
    padding: 8px 10px; border-radius: 6px;
    display: flex; align-items: center; gap: 10px;
    text-decoration: none;
}
.side__link:hover { background: var(--paper); color: var(--ink); }
.side__link--active { background: var(--accent-soft); color: var(--accent); }
.side__link--active:hover { background: var(--accent-soft); color: var(--accent); }
.side__dot {
    width: 6px; height: 6px; border-radius: 50%;
    background: currentColor; opacity: 0.5; flex: 0 0 auto;
}

/* === Site header === */
.site-header {
    background: linear-gradient(135deg, var(--header-bg) 0%, var(--header-bg-end) 100%);
    color: var(--header-text);
    border-bottom: 3px solid var(--alx-brand);
    box-shadow: var(--header-shadow);
}
.site-header-top {
    max-width: 1400px;
    margin: 0 auto;
    padding: 6px 32px 0;
    position: relative;
    z-index: 40;
    overflow: visible;
}
.system-status-bar-wrap { min-height: 28px; overflow: visible; }
.system-status-bar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px 12px;
    font-size: 11px;
    padding: 4px 0 6px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
[data-theme="light"] .system-status-bar {
    border-bottom-color: rgba(31, 78, 120, 0.12);
}
.system-status-bar--loading { opacity: 0.7; font-style: italic; }
.system-status-group {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}
.system-status-label {
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-size: 10px;
    opacity: 0.75;
}
.system-status-sep { opacity: 0.35; user-select: none; }
.system-status-chip {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 999px;
    font-weight: 600;
    line-height: 1.4;
}
.system-status-chip--active,
.system-status-chip--live {
    background: rgba(0, 188, 241, 0.28);
    color: var(--alx-brand);
    box-shadow: 0 0 0 1px rgba(0, 188, 241, 0.35);
}
.system-status-chip--live {
    animation: status-chip-pulse 1.4s ease-in-out infinite;
}
@keyframes status-chip-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.72; }
}
.system-status-bar--busy {
    border-bottom-color: rgba(0, 188, 241, 0.45);
}
.system-status-group--active .system-status-label {
    color: var(--alx-brand);
    opacity: 1;
}
[data-theme="light"] .system-status-chip--live {
    background: rgba(0, 140, 200, 0.15);
    color: #0077a8;
}
.system-status-chip--warn {
    background: rgba(255, 193, 7, 0.18);
    color: #ffc107;
}
[data-theme="light"] .system-status-chip--warn { color: #9a7200; }
.system-status-chip--muted {
    background: rgba(255, 255, 255, 0.08);
    opacity: 0.85;
}
[data-theme="light"] .system-status-chip--muted {
    background: rgba(31, 78, 120, 0.08);
    color: var(--text-muted);
}
/* Väline rike (LLM ei vasta) — ainus punane silt ribal. */
.system-status-chip--error {
    background: rgba(229, 57, 53, 0.2);
    color: #ef9a9a;
    box-shadow: 0 0 0 1px rgba(229, 57, 53, 0.4);
}
[data-theme="light"] .system-status-chip--error { color: #c62828; }
.system-status-chip--ok {
    background: rgba(76, 175, 80, 0.15);
    color: #81c784;
}
[data-theme="light"] .system-status-chip--ok { color: #2e7d32; }
.system-status-bar--idle .system-status-chip--ok { opacity: 0.8; }

.system-status-group--has-detail {
    position: relative;
    cursor: default;
    border-radius: 4px;
    outline: none;
}
.system-status-group--has-detail:hover,
.system-status-group--has-detail:focus-within {
    background: rgba(255, 255, 255, 0.04);
}
[data-theme="light"] .system-status-group--has-detail:hover,
[data-theme="light"] .system-status-group--has-detail:focus-within {
    background: rgba(31, 78, 120, 0.06);
}
/* Nähtamatu „sild“ hiire teekonna jaoks riba ja paneeli vahel */
.system-status-group--has-detail::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    height: 14px;
    z-index: 199;
    display: none;
}
.system-status-group--has-detail:hover::after,
.system-status-group--has-detail:focus-within::after,
.system-status-group--has-detail.system-status-group--open::after {
    display: block;
}
.system-status-detail {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 200;
    pointer-events: auto;
    min-width: min(360px, 92vw);
    max-width: min(440px, 96vw);
    max-height: min(70vh, 420px);
    overflow: auto;
    padding: 10px 12px;
    border-radius: 8px;
    background: var(--surface-elevated, #1a2744);
    border: 1px solid rgba(0, 188, 241, 0.35);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
    font-size: 0.78rem;
    font-weight: 400;
    line-height: 1.35;
    text-transform: none;
    letter-spacing: normal;
}
[data-theme="light"] .system-status-detail {
    background: #fff;
    border-color: rgba(31, 78, 120, 0.2);
    box-shadow: 0 8px 20px rgba(31, 78, 120, 0.12);
}
.system-status-group--has-detail:hover .system-status-detail,
.system-status-group--has-detail:focus-within .system-status-detail,
.system-status-group--has-detail.system-status-group--open .system-status-detail {
    display: block;
}
.system-status-detail::before {
    content: "";
    position: absolute;
    left: -6px;
    right: -6px;
    top: -14px;
    height: 14px;
}
.system-status-detail-section + .system-status-detail-section {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}
[data-theme="light"] .system-status-detail-section + .system-status-detail-section {
    border-top-color: rgba(31, 78, 120, 0.1);
}
.system-status-detail-heading {
    display: block;
    font-weight: 700;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    opacity: 0.75;
    margin-bottom: 4px;
}
.system-status-detail-list {
    margin: 0;
    padding: 0;
    list-style: none;
}
.system-status-detail-item {
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-rows: auto auto;
    gap: 0 8px;
    padding: 4px 0;
}
.system-status-detail-item--source {
    display: block;
}
.system-status-detail-source {
    font-weight: 600;
}
.system-status-detail-hint {
    display: block;
    opacity: 0.7;
    font-size: 0.72rem;
    margin-top: 1px;
}
.system-status-detail-link {
    grid-row: 1 / span 2;
    font-weight: 700;
    color: var(--alx-brand);
    text-decoration: none;
    white-space: nowrap;
}
.system-status-detail-link:hover { text-decoration: underline; }
.system-status-detail-meta {
    opacity: 0.8;
    font-size: 0.72rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.system-status-detail-title {
    grid-column: 2;
    opacity: 0.9;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.system-status-detail-more {
    opacity: 0.65;
    font-style: italic;
    padding-top: 2px;
}
.system-status-detail-empty,
.system-status-detail-note {
    margin: 0;
    opacity: 0.8;
}
.system-status-detail-foot {
    margin: 8px 0 0;
    padding-top: 6px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 0.72rem;
    opacity: 0.75;
}
[data-theme="light"] .system-status-detail-foot {
    border-top-color: rgba(31, 78, 120, 0.1);
}
.system-status-detail-foot a {
    color: var(--alx-brand);
    text-decoration: none;
}
.system-status-detail-foot a:hover { text-decoration: underline; }

.process-run-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.panel--compact { padding: 12px 16px; }
.process-run-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 4px;
}
.process-run-toolbar h2 {
    margin: 0;
    font-size: 16px;
}
.process-date-field {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 600;
    margin: 0;
}
.process-date-field input[type="date"] {
    font-size: 13px;
    padding: 4px 8px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--input-bg);
    color: var(--text);
}
.field-table-wrap--compact { margin: 0; max-height: 320px; overflow-y: auto; }
.hour-breakdown-table { font-size: 12px; }
.hour-breakdown-table th,
.hour-breakdown-table td { padding: 3px 8px; }
.hour-breakdown-table .col-select { width: 32px; text-align: center; }
.hour-breakdown-table .col-num { width: 52px; text-align: right; white-space: nowrap; }
.hour-row--empty { opacity: 0.45; }
.hour-row--day { background: var(--chip-bg); }
.num-warn { color: #ffc107; font-weight: 600; }
[data-theme="light"] .num-warn { color: #9a7200; }
.num-muted { color: var(--muted); }
.num-active { color: var(--alx-brand); font-weight: 600; }
.process-run-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 6px;
}
.selection-summary--compact {
    padding: 0;
    border: none;
    background: transparent;
    font-size: 12px;
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 6px;
}
.selection-summary-main { margin: 0; }
.pending-count-number {
    font-size: 14px;
    font-weight: 700;
    color: var(--alx-brand);
}
.selection-summary-hint { font-size: 11px; }
.reprocess-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    margin: 0;
    white-space: nowrap;
}
.hint-inline { font-size: 11px; color: var(--muted); font-weight: 400; }
.checkbox-row input, .reprocess-toggle input { margin: 0; }
.process-run-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 12px;
}
.process-run-actions .btn-collect { padding: 6px 14px; font-size: 13px; }
.process-run-actions.is-busy .btn-collect { opacity: 0.7; }
.process-run-actions.is-busy #process-spinner { display: inline; color: var(--alx-brand); font-weight: 600; }
.process-run-log-link { margin-left: auto; }
.process-run-section { margin-top: 0; }
.process-run-section .step-num { background: var(--muted); font-size: 11px; }
.processing-section-divider {
    height: 1px;
    margin: 28px 0 20px;
    background: linear-gradient(90deg, transparent, var(--border) 15%, var(--border) 85%, transparent);
}
.log-main .log-panel-header { margin-bottom: 12px; }
.log-main .log-panel-header h2 { margin: 0 0 4px; font-size: 18px; color: var(--primary); }
.log-panel-hint { margin: 0; }
.log-subnav {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}
.log-subnav-link {
    display: inline-flex;
    align-items: center;
    padding: 8px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--card);
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    transition: border-color 0.12s, color 0.12s, background 0.12s;
}
.log-subnav-link:hover {
    border-color: var(--alx-brand);
    color: var(--primary);
}
.log-subnav-link--active {
    border-color: var(--primary);
    background: rgba(0, 188, 241, 0.08);
    color: var(--primary);
}
.log-pagination { margin-top: 16px; }
a.pagination-btn { text-decoration: none; }
.log-filters-form { margin-bottom: 20px; }
.log-filters-form .form-actions { margin-top: 12px; }
.log-filters-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}
@media (max-width: 1100px) {
    .log-filters-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
    .log-filters-grid { grid-template-columns: 1fr; }
    .log-filters-grid .span-2 { grid-column: span 1; }
}
.log-row-details { margin-top: 6px; }
.log-row-details summary {
    cursor: pointer;
    font-size: 12px;
    color: var(--primary);
    list-style: none;
    user-select: none;
}
.log-row-details summary::-webkit-details-marker { display: none; }
.log-row-details[open] summary { margin-bottom: 6px; }
.log-payload {
    margin: 0;
    padding: 10px 12px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-family: var(--font-mono, ui-monospace, monospace);
    font-size: 11px;
    line-height: 1.45;
    overflow-x: auto;
    max-height: 220px;
    color: var(--text);
}
.log-event-code {
    font-family: var(--font-mono, ui-monospace, monospace);
    font-size: 11px;
    color: var(--text-muted);
}
.log-audit-table td .meta-line,
.log-technical-table td .meta-line { margin-top: 4px; }
.collect-log-table .collect-error-code {
    font-family: var(--font-mono, ui-monospace, monospace);
    font-size: 11px;
    color: var(--error-text);
}
.run-status--muted { background: var(--chip-bg); color: var(--text-muted); }
.run-doc-link { color: inherit; text-decoration: none; }
.run-doc-link:hover { color: var(--primary); text-decoration: underline; }
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
[data-theme="light"] .site-header {
    background: var(--header-bg);
}
[data-theme="dark"] .site-header {
    background: linear-gradient(135deg, var(--header-bg) 0%, var(--header-bg-end) 55%, var(--alx-navy-mid) 100%);
}
.site-header-inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 14px 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    flex-wrap: wrap;
}
.site-brand {
    display: flex;
    align-items: center;
    gap: 16px;
    text-decoration: none;
    color: inherit;
    min-width: 0;
}
.site-brand:hover .site-product { color: var(--alx-brand); }
.site-logo {
    height: 22px;
    width: auto;
    display: block;
    flex-shrink: 0;
    object-fit: contain;
}
.site-brand-text {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}
.site-product {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: var(--header-text);
    transition: color 0.15s;
}
.site-page {
    font-size: 14px;
    font-weight: 600;
    color: var(--alx-brand);
}
.site-tagline {
    font-size: 12px;
    color: var(--muted);
    opacity: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 420px;
}
.site-nav {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}
.site-nav-link {
    color: var(--header-link);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    padding: 8px 14px;
    border-radius: 6px;
    transition: background 0.15s, color 0.15s;
}
.site-nav-link:hover {
    background: var(--header-link-hover-bg);
    color: var(--header-text);
}
.site-nav-link--active {
    background: var(--header-link-hover-bg);
    color: var(--alx-brand);
    box-shadow: inset 0 0 0 1px rgba(0, 188, 241, 0.35);
}

/* Teema lüliti */
.theme-switch {
    display: inline-flex;
    align-items: center;
    margin-left: 8px;
    padding: 3px;
    border-radius: 8px;
    background: var(--header-link-hover-bg);
    border: 1px solid rgba(0, 188, 241, 0.2);
    gap: 2px;
}
.theme-switch-btn {
    border: none;
    background: transparent;
    color: var(--header-link);
    width: 30px;
    height: 28px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    transition: background 0.15s, color 0.15s;
}
.theme-switch-btn:hover {
    background: rgba(0, 188, 241, 0.15);
    color: var(--header-text);
}
.theme-switch-btn--active {
    background: var(--alx-brand);
    color: #fff;
}

/* Legacy header (fallback) */
/* Vanad leheküljed — mitte .site-header ega .doc-header */
header:not(.site-header) {
    background: var(--alx-navy);
    color: #fff;
    padding: 20px 32px;
}
[data-theme="dark"] header:not(.site-header) {
    background: var(--header-bg-end);
}
header:not(.site-header) h1 { margin: 0; font-size: 22px; }
header:not(.site-header) .sub { margin: 4px 0 0; opacity: 0.85; font-size: 13px; }
.header-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.header-nav { display: flex; gap: 16px; flex-wrap: wrap; }
.header-nav a { color: white; opacity: 0.9; text-decoration: none; font-size: 14px; }
.header-nav a:hover { opacity: 1; text-decoration: underline; }

main { padding: 24px 32px; max-width: 1200px; margin: 0 auto; }

.actions {
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
    margin-bottom: 12px; padding: 12px 16px;
    background: var(--card); border: 1px solid var(--border); border-radius: 6px;
}
.actions-label { font-size: 13px; color: var(--muted); margin-right: 4px; }

.btn-collect {
    padding: 6px 14px; font-size: 13px; font-weight: 500;
    color: #fff; background: var(--alx-navy); border: none; border-radius: 4px;
    cursor: pointer;
}
[data-theme="dark"] .btn-collect { background: var(--alx-brand); color: var(--alx-navy); }
.btn-collect:hover { opacity: 0.9; }
.btn-collect:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-collect--all { background: var(--alx-navy-mid); }
.btn-collect--sm { padding: 5px 12px; font-size: 12px; background: var(--alexela-cyan-dark); }
.btn-collect--sm:hover { background: var(--alexela-cyan); }

.htmx-indicator { display: none; font-size: 13px; color: var(--muted); margin-left: 8px; }
.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator { display: inline; }

.collect-result {
    margin-bottom: 16px; padding: 10px 14px; border-radius: 4px; font-size: 13px;
}
.collect-result--ok { background: var(--success-bg); border: 1px solid var(--alx-success); color: var(--success-text); }
.collect-result--error { background: var(--error-bg); border: 1px solid var(--alx-alert); color: var(--error-text); }
.collect-result--warn { background: var(--warning-bg); border: 1px solid var(--alx-warning); color: var(--warning-text); }
.collect-result ul { margin: 6px 0 0; padding-left: 20px; }

/* Seemnemärge: tekst vasakule, nupp paremale. */
.seed-notice { display: flex; align-items: center; gap: 16px; justify-content: space-between; }
.seed-notice-form { margin: 0; flex: none; }

.panel {
    background: var(--card); border: 1px solid var(--border); border-radius: 8px;
    padding: 20px 24px; margin-bottom: 20px;
}
.panel h2 { margin: 0 0 16px; font-size: 18px; color: var(--primary); }
.panel h3 { margin: 16px 0 8px; font-size: 15px; color: var(--primary); }

.source-form .form-grid {
    display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px;
}
.source-form .span-2 { grid-column: span 2; }
.source-form label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.source-form input, .source-form select,
input, select, textarea {
    background: var(--input-bg);
    color: var(--text);
}
.source-form input, .source-form select {
    padding: 8px 10px; border: 1px solid var(--border); border-radius: 4px; font-size: 14px;
}
.checkbox-label { flex-direction: row !important; align-items: center; gap: 8px !important; color: var(--text) !important; }
.settings-switch {
    flex-direction: row !important;
    align-items: center;
    gap: 12px !important;
    cursor: pointer;
    color: var(--text) !important;
    position: relative;
}
.settings-switch input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
}
.settings-switch__track {
    width: 40px;
    height: 22px;
    border-radius: 11px;
    background: var(--surface-muted);
    border: 1px solid var(--border);
    position: relative;
    flex-shrink: 0;
}
.settings-switch__track::after {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    transition: transform 0.15s ease;
}
.settings-switch input:checked + .settings-switch__track {
    background: var(--alx-brand);
    border-color: var(--alx-brand);
}
.settings-switch input:checked + .settings-switch__track::after {
    transform: translateX(18px);
}
.settings-switch input:focus-visible + .settings-switch__track {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}
.settings-switch__text { font-size: 14px; }
.form-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 16px; }
.meta-line { font-size: 12px; color: var(--muted); margin: 12px 0 0; }
.id-code { font-size: 11px; color: var(--muted); }

.btn-primary, .btn-secondary {
    padding: 8px 16px; border-radius: 4px; font-size: 13px; cursor: pointer; border: none;
}
.btn-primary { background: var(--alx-brand); color: #fff; }
.btn-primary:hover { background: var(--alx-brand-dark); }
.btn-secondary { background: var(--surface-muted); color: var(--text); }
[data-theme="dark"] .btn-primary { background: var(--alx-brand); color: var(--alx-navy); }
.btn-link { font-size: 13px; color: var(--primary); text-decoration: none; background: none; border: none; cursor: pointer; padding: 0; }
.btn-link:hover { text-decoration: underline; }
.btn-danger { color: var(--critical); }

.source-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.source-table th, .source-table td { padding: 10px 8px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.source-table th { color: var(--muted); font-weight: 600; font-size: 12px; }
.url-cell a { color: var(--primary); word-break: break-all; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11px; background: var(--bg); }
.badge-ok { background: var(--success-bg); color: var(--success-text); }
.badge-off { background: var(--surface-muted); color: var(--muted); }
.test-ok { color: var(--success-text); font-weight: 600; }
.test-fail { color: var(--critical); font-weight: 600; }
.source-group + .source-group { margin-top: 24px; }

.filters { margin-bottom: 16px; }
.filters select {
    padding: 6px 12px; border: 1px solid var(--border); border-radius: 4px;
    background: var(--input-bg); font-size: 14px; color: var(--text);
}

.empty { color: var(--muted); padding: 40px 0; text-align: center; }

.finding {
    background: var(--card); border: 1px solid var(--border); border-left: 4px solid var(--muted);
    border-radius: 6px; padding: 16px 20px; margin-bottom: 12px;
}
.finding.score-5 { border-left-color: var(--critical); }
.finding.score-4 { border-left-color: var(--high); }
.finding.score-3 { border-left-color: var(--medium); }
.finding.score-2, .finding.score-1 { border-left-color: var(--low); }

.finding .meta {
    display: flex; gap: 12px; font-size: 12px; color: var(--muted);
    margin-bottom: 8px; flex-wrap: wrap;
}
.finding .meta span {
    background: var(--bg); padding: 3px 8px; border-radius: 12px;
}
.finding .meta .topic { font-weight: 600; color: var(--primary); }
.finding h2 { font-size: 16px; margin: 4px 0 8px; color: var(--primary); }
.finding .summary { margin: 0 0 12px; color: var(--text); }
.finding .footer {
    display: flex; justify-content: space-between; align-items: center;
    font-size: 12px; color: var(--muted);
}
.finding .footer a { color: var(--primary); text-decoration: none; }
.finding .footer a:hover { text-decoration: underline; }

.hint { font-size: 13px; color: var(--muted); margin: 0 0 12px; }
.panel-header-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.panel-header-row h2 { margin: 0; flex: 1; }
textarea.mono { font-family: ui-monospace, monospace; font-size: 12px; }
.source-form textarea {
    padding: 8px 10px; border: 1px solid var(--border); border-radius: 4px; font-size: 14px;
    width: 100%; resize: vertical;
}

.runs-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.runs-table th, .runs-table td { padding: 10px 8px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.runs-table th { color: var(--muted); font-weight: 600; font-size: 12px; }
.run-status { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; text-transform: uppercase; }
.run-status--completed { background: var(--success-bg); color: var(--success-text); }
.run-status--rejected { background: var(--warning-bg); color: var(--warning-text); }
.run-status--failed { background: var(--error-bg); color: var(--error-text); }
.run-status--in_progress { background: var(--chip-bg); color: var(--alx-brand-dark); }
.step-badge--completed { background: var(--success-bg); }
.step-badge--rejected { background: var(--warning-bg); }
.step-badge { display: inline-block; padding: 2px 6px; margin: 2px; border-radius: 4px; font-size: 10px; background: var(--surface-muted); }
.reject-reason { font-size: 12px; max-width: 280px; }

/* Info töötlemise seadistused */
.processing-main { max-width: 960px; }

.step-nav {
    display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px;
}
.step-nav-link {
    padding: 6px 12px; font-size: 13px; color: var(--primary);
    background: var(--card); border: 1px solid var(--border); border-radius: 20px;
    text-decoration: none;
}
.step-nav-link:hover { background: var(--row-hover); }

.prompt-textarea {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 12px;
    line-height: 1.45;
    min-height: 120px;
}

/* Koodi poolt lisatav promptiosa — ainult vaatamiseks. */
.prompt-readonly {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 12px;
    line-height: 1.45;
    white-space: pre-wrap;
    max-height: 420px;
    overflow: auto;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--row-hover);
    color: var(--muted);
}

.step-accordion { padding: 0; overflow: hidden; }
.step-accordion > summary {
    list-style: none; cursor: pointer; padding: 16px 20px;
    display: flex; align-items: center; gap: 12px; user-select: none;
}
.step-accordion > summary::-webkit-details-marker { display: none; }
.step-accordion > summary::after {
    content: "▸"; margin-left: auto; color: var(--muted); transition: transform 0.15s;
}
.step-accordion[open] > summary::after { transform: rotate(90deg); }
.step-accordion > summary:hover { background: var(--row-hover); }
.step-num {
    display: inline-flex; align-items: center; justify-content: center;
    width: 28px; height: 28px; border-radius: 50%; background: var(--primary);
    color: white; font-size: 13px; font-weight: 700; flex-shrink: 0;
}
.step-title { font-weight: 600; font-size: 15px; color: var(--primary); }
.step-desc { font-size: 13px; color: var(--muted); margin-left: 4px; }
.step-body { padding: 0 20px 20px; border-top: 1px solid var(--border); }
.step-body h3 { font-size: 14px; margin: 20px 0 8px; color: var(--text); }
.step-config-grid { margin: 8px 0 16px; }
.step-config-grid > div > span:not(.meta-label) {
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
}
.topic-add-row {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 8px;
}
.significance-topic-add {
    align-items: center;
}
.significance-topic-picker {
    width: auto;
    min-width: 12rem;
    max-width: 20rem;
}
.significance-topic-add-hint {
    flex-basis: 100%;
    margin: 0;
    font-size: 12px;
}
.topic-label { font-weight: 600; color: var(--text); }

.label-hint, .th-hint { display: block; font-size: 12px; color: var(--muted); font-weight: 400; margin-top: 2px; }
.compact-grid { margin-top: 16px; }

.field-table-wrap { overflow-x: auto; margin: 8px 0 12px; }
.field-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.field-table th {
    text-align: left; padding: 8px; color: var(--muted); font-weight: 600;
    font-size: 12px; border-bottom: 2px solid var(--border);
}
.field-table td { padding: 6px 8px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.field-select, .field-wide {
    width: 100%; padding: 6px 8px; border: 1px solid var(--border); border-radius: 4px; font-size: 13px;
}
.btn-icon {
    width: 28px; height: 28px; border: 1px solid var(--border); border-radius: 4px;
    background: var(--input-bg); color: var(--muted); cursor: pointer; font-size: 18px; line-height: 1;
}
.btn-icon:hover { background: var(--error-bg); color: var(--error-text); border-color: var(--alx-alert); }
.btn-sm { font-size: 12px; padding: 6px 12px; margin-bottom: 16px; }

.checkbox-grid-fieldset {
    border: 1px solid var(--border); border-radius: 6px; padding: 12px 16px; margin: 16px 0;
}
.checkbox-grid-fieldset legend { font-weight: 600; font-size: 13px; color: var(--text); padding: 0 4px; }
.checkbox-grid { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.checkbox-chip {
    display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px;
    border: 1px solid var(--border); border-radius: 16px; font-size: 13px; cursor: pointer;
    background: var(--bg);
}
.checkbox-chip:has(input:checked) { background: var(--chip-bg); border-color: var(--alx-brand); color: var(--primary); }
.checkbox-chip input { margin: 0; }
.checkbox-grid--flat { margin-top: 0; }

/* Olulisuse maatriks (teema × valdkond) */
.sig-matrix-wrap { margin-top: 12px; }
.sig-matrix-table { table-layout: auto; }
.sig-matrix-table th,
.sig-matrix-table td { vertical-align: middle; }
.sig-matrix-col-topic {
    min-width: 5rem;
    position: sticky;
    left: 0;
    z-index: 2;
    background: var(--card);
}
.sig-matrix-col-score {
    width: 3.5rem;
    text-align: center;
}
.sig-matrix-score-select {
    width: 3rem;
    min-width: 0;
    padding: 4px 2px;
    text-align: center;
}
.sig-matrix-col-valdkond {
    width: 2.25rem;
    max-width: 2.75rem;
    padding: 6px 2px !important;
    text-align: center;
    vertical-align: bottom;
}
.sig-matrix-valdkond-label {
    display: inline-block;
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    font-size: 10px;
    font-weight: 500;
    line-height: 1.15;
    max-height: 5.5rem;
    overflow: hidden;
    color: var(--muted);
}
.sig-matrix-cell {
    text-align: center;
    padding: 4px 2px !important;
}
.sig-matrix-check {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    margin: 0 auto;
    border-radius: 4px;
    cursor: pointer;
}
.sig-matrix-check:hover { background: var(--chip-bg); }
.sig-matrix-check:has(input:checked) { background: rgba(0, 120, 200, 0.15); }
.sig-matrix-check input {
    width: 15px;
    height: 15px;
    margin: 0;
    cursor: pointer;
}
.sig-matrix-col-action {
    width: 2rem;
    text-align: center;
    position: sticky;
    right: 0;
    z-index: 2;
    background: var(--card);
}
.sig-matrix-empty {
    text-align: center;
    color: var(--muted);
}
.sig-advanced-settings {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
    gap: 12px;
    margin-top: 20px;
}
.sig-fieldset-compact { margin: 0; }
.sig-fieldset-hint { margin: 0 0 8px; font-size: 12px; }
.sig-advanced-settings__footer {
    grid-column: 1 / -1;
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 16px 24px;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--input-bg);
}
.sig-inline-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 13px;
    color: var(--muted);
}
.sig-inline-field select {
    min-width: 8rem;
    padding: 6px 8px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 13px;
    color: var(--text);
    background: var(--bg);
}
.sig-filter-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px 16px;
}
.sig-filter-checkbox { margin: 0; font-size: 13px; }
.sig-min-score { margin: 0; }

.inline-field { margin: 8px 0 16px 24px; }
.inline-field label { font-size: 13px; }

/* Dashboard */
.dashboard-main { max-width: none; padding: 24px 32px 48px; }

.dashboard-table-panel {
    padding: 0;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(15, 35, 56, 0.06), 0 8px 24px rgba(15, 35, 56, 0.04);
}
[data-theme="dark"] .dashboard-table-panel {
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.25);
}

.dashboard-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    padding: 14px 16px 12px;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(180deg, var(--card) 0%, var(--bg) 100%);
}
.dashboard-read-legend {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: var(--muted);
    font-weight: 500;
}
.dashboard-read-legend__text {
    text-transform: lowercase;
}
.dashboard-panel-head__title {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.filters-toggle-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--card);
    color: var(--text);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.12s, color 0.12s, background 0.12s;
}
.filters-toggle-btn:hover {
    border-color: var(--alx-brand);
    color: var(--primary);
    background: rgba(0, 188, 241, 0.06);
}
.filters-toggle-btn__chevron {
    display: inline-block;
    width: 10px;
    height: 10px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 12 12'%3E%3Cpath fill='%2394A3B4' d='M3 4.5 6 7.5 9 4.5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    transition: transform 0.15s ease;
}
.filters-toggle-btn.is-open .filters-toggle-btn__chevron {
    transform: rotate(180deg);
}

.findings-filters-panel {
    display: none;
    padding: 10px 16px 12px;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
}
.findings-filters-panel.is-open {
    display: block;
}
.findings-filters-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.findings-filters-section--compact {
    margin: 0;
}
.findings-filters-row--tags {
    align-items: flex-end;
    gap: 8px;
}
.filter-field--grow {
    flex: 1 1 160px;
    min-width: 120px;
}
.filter-select--compact,
.col-filter-input--compact {
    min-height: 32px;
    padding-top: 4px;
    padding-bottom: 4px;
    font-size: 13px;
}
.tag-filter-meta__hint {
    display: block;
    font-size: 11px;
    font-weight: 400;
    color: var(--muted);
    margin-top: 4px;
}
.tag-filter-chip--ungrouped {
    border-style: dashed;
}
.tag-filter-meta {
    margin: 0;
    flex: 0 0 auto;
    font-size: 12px;
    color: var(--muted);
    white-space: nowrap;
    padding-bottom: 6px;
}
.tag-filter-panel {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(108px, 1fr));
    gap: 4px;
    max-height: 132px;
    overflow-y: auto;
    padding: 6px 8px;
    margin-top: 4px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--card);
}
.tag-filter-empty {
    grid-column: 1 / -1;
    font-size: 12px;
    color: var(--muted);
    padding: 4px 2px;
}
.tag-filter-chip__label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}
.findings-filters-section__title {
    margin: 0 0 10px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
}
.findings-filters-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: flex-end;
}
.findings-col-filters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
    gap: 8px;
}
.findings-filters-actions {
    display: flex;
    justify-content: flex-end;
    padding-top: 4px;
}
.findings-filters-defaults {
    display: flex;
    justify-content: flex-end;
    padding-top: 4px;
}
.dashboard-panel-head h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--primary);
}
.findings-count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 24px;
    padding: 0 8px;
    border-radius: 999px;
    background: var(--chip-bg);
    color: var(--primary);
    font-size: 12px;
    font-weight: 700;
    border: 1px solid rgba(0, 188, 241, 0.25);
}
.filter-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
}
.filter-field--checkbox {
    flex-direction: row;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding-top: 18px;
}
.filter-field--checkbox .filter-checkbox {
    width: 16px;
    height: 16px;
    margin: 0;
    cursor: pointer;
    accent-color: var(--alx-brand);
}
.filter-field--checkbox .filter-field__label {
    text-transform: none;
    letter-spacing: normal;
    font-size: 13px;
    color: var(--text);
}
.filter-field__label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
}
.filter-select {
    min-width: 0;
    width: 100%;
    padding: 8px 32px 8px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--input-bg);
    color: var(--text);
    font-size: 13px;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394A3B4' d='M3 4.5 6 7.5 9 4.5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.filter-select:hover { border-color: var(--alx-brand); }
.filter-select:focus {
    outline: none;
    border-color: var(--alx-brand);
    box-shadow: 0 0 0 3px rgba(0, 188, 241, 0.15);
}

.findings-table-host { position: relative; min-height: 120px; }
.findings-table-host:has(.htmx-request.findings-loading) .findings-table-wrap {
    opacity: 0.55;
    pointer-events: none;
}
.findings-loading {
    display: none;
    position: absolute;
    top: 12px;
    right: 20px;
    z-index: 3;
    padding: 6px 12px;
    border-radius: 999px;
    background: var(--chip-bg);
    color: var(--primary);
    font-size: 12px;
    font-weight: 600;
    border: 1px solid rgba(0, 188, 241, 0.2);
}
.findings-loading.htmx-request { display: block; }

.findings-empty {
    padding: 48px 32px;
    text-align: center;
}
.findings-empty__title {
    margin: 0 0 8px;
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
}
.findings-empty__hint {
    margin: 0;
    max-width: 480px;
    margin-inline: auto;
    font-size: 14px;
    color: var(--muted);
    line-height: 1.6;
}

.findings-table-wrap {
    overflow-x: auto;
    margin: 0;
    padding: 0 4px;
}
.findings-table {
    width: 100%;
    min-width: 1100px;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 13px;
}
.findings-table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    padding: 0;
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted);
    background: var(--surface-muted);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.findings-table thead th:first-child { border-radius: 0; }
.th-static {
    padding: 12px 14px;
}
.th-static--actions { text-align: right; }
.col-filter-input {
    width: 100%;
    min-width: 0;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--input-bg);
    color: var(--text);
    font-size: 13px;
    line-height: 1.3;
    transition: border-color 0.12s, box-shadow 0.12s;
}
.col-filter-input::placeholder { color: var(--muted); opacity: 0.85; }
.col-filter-input:hover { border-color: rgba(0, 188, 241, 0.45); }
.col-filter-input:focus {
    outline: none;
    border-color: var(--alx-brand);
    box-shadow: 0 0 0 2px rgba(0, 188, 241, 0.15);
}
.col-filter-select {
    padding-right: 24px;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 12 12'%3E%3Cpath fill='%2394A3B4' d='M3 4.5 6 7.5 9 4.5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    cursor: pointer;
}
.filter-clear-btn {
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--card);
    color: var(--muted);
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: border-color 0.12s, color 0.12s, background 0.12s;
}
.filter-clear-btn:hover {
    border-color: var(--alx-brand);
    color: var(--primary);
    background: rgba(0, 188, 241, 0.06);
}
.filter-active-badge {
    display: inline-block;
    margin-left: 6px;
    padding: 2px 7px;
    border-radius: 999px;
    background: rgba(0, 188, 241, 0.12);
    color: var(--primary);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    vertical-align: middle;
}
.filter-active-badge[hidden] {
    display: none !important;
}
.findings-filters-actions[hidden] {
    display: none !important;
}
.findings-table-wrap--head-only {
    border-top: 1px solid var(--border);
}

.th-sortable { padding: 0; }
.th-sort-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    padding: 12px 14px;
    border: none;
    background: transparent;
    color: inherit;
    font: inherit;
    font-weight: inherit;
    text-transform: inherit;
    letter-spacing: inherit;
    text-align: left;
    cursor: pointer;
    white-space: nowrap;
    transition: color 0.15s, background 0.15s;
}
.th-sort-btn:hover {
    color: var(--primary);
    background: rgba(0, 188, 241, 0.06);
}
.th-sortable--active .th-sort-btn {
    color: var(--primary);
    background: rgba(0, 188, 241, 0.08);
}
.th-sort-btn__icon {
    display: inline-flex;
    width: 14px;
    height: 14px;
    opacity: 0;
    transition: opacity 0.15s;
    background-repeat: no-repeat;
    background-position: center;
    background-size: 10px;
}
.th-sortable:hover .th-sort-btn__icon,
.th-sortable--active .th-sort-btn__icon { opacity: 0.85; }
.th-sortable--asc .th-sort-btn__icon {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'%3E%3Cpath fill='%2300BCF1' d='M5 2 8 7H2z'/%3E%3C/svg%3E");
}
.th-sortable--desc .th-sort-btn__icon {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'%3E%3Cpath fill='%2300BCF1' d='M5 8 2 3h6z'/%3E%3C/svg%3E");
}
[data-theme="dark"] .th-sortable--asc .th-sort-btn__icon,
[data-theme="dark"] .th-sortable--desc .th-sort-btn__icon {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'%3E%3Cpath fill='%2300BCF1' d='M5 2 8 7H2z'/%3E%3C/svg%3E");
}
[data-theme="dark"] .th-sortable--desc .th-sort-btn__icon {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'%3E%3Cpath fill='%2300BCF1' d='M5 8 2 3h6z'/%3E%3C/svg%3E");
}

.findings-table tbody td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
    line-height: 1.4;
}
.findings-table tbody tr:last-child td { border-bottom: none; }
.findings-table tbody tr {
    transition: background 0.12s;
}
.findings-table tbody tr:hover {
    background: var(--row-hover);
}
.findings-table .docs-row { border-left: 4px solid transparent; }
.findings-table .score-row-5 { border-left-color: var(--critical); }
.findings-table .score-row-4 { border-left-color: var(--high); }
.findings-table .score-row-3 { border-left-color: var(--medium); }
.findings-table .score-row-2,
.findings-table .score-row-1 { border-left-color: var(--low); }
.findings-table .docs-row--unread {
    background: rgba(0, 188, 241, 0.06);
}
[data-theme="dark"] .findings-table .docs-row--unread {
    background: rgba(0, 188, 241, 0.08);
}
.findings-table .docs-row--read {
    background: transparent;
}

.cell-empty { color: var(--muted); opacity: 0.6; }
.cell-meta {
    display: block;
    margin-top: 6px;
    font-size: 11px;
    color: var(--muted);
    line-height: 1.3;
}

.cell-date { width: 96px; white-space: nowrap; }
.cell-date .date-chip { display: block; margin-bottom: 4px; }
.cell-date .date-chip:last-child { margin-bottom: 0; }
.date-chip {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 6px;
    background: var(--surface-muted);
    font-size: 12px;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    color: var(--text);
}
.date-chip--muted {
    background: transparent;
    color: var(--muted);
    font-weight: 400;
    font-size: 11px;
    padding: 0 2px;
}

.cell-title { min-width: 200px; max-width: 280px; width: 280px; }
.doc-title-link {
    color: var(--primary);
    font-weight: 500;
    text-decoration: none;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    overflow-wrap: anywhere;
    word-break: break-word;
    transition: color 0.12s;
}
.doc-title-link:hover {
    color: var(--alx-brand);
    text-decoration: underline;
}
[data-theme="light"] .doc-title-link { color: var(--alx-navy-mid); }
[data-theme="light"] .doc-title-link:hover { color: var(--alx-brand-dark); }

.cell-source { min-width: 110px; max-width: 130px; }
.source-name {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--muted);
    line-height: 1.35;
}

.cell-classify { min-width: 110px; }
.badge-row {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: center;
}
.topic-badge {
    display: inline-block;
    padding: 3px 9px;
    border-radius: 999px;
    background: var(--chip-bg);
    color: var(--primary);
    font-size: 11px;
    font-weight: 600;
    border: 1px solid rgba(0, 188, 241, 0.2);
}
.jur-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 999px;
    background: var(--surface-muted);
    font-size: 10px;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.cell-keywords { min-width: 130px; max-width: 170px; }
.kw-chip-row { display: flex; flex-wrap: wrap; gap: 4px; }
.kw-chip {
    display: inline-block;
    padding: 3px 8px;
    background: var(--warning-bg);
    border: 1px solid rgba(232, 155, 12, 0.35);
    border-radius: 999px;
    font-size: 10px;
    font-weight: 500;
    color: var(--warning-text);
    line-height: 1.2;
}
.kw-chip--more {
    background: var(--surface-muted);
    border-color: var(--border);
    color: var(--muted);
}

.cell-summary { min-width: 220px; max-width: 300px; }
.summary-clamp {
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.5;
    color: var(--text);
    font-size: 13px;
}
.why-relevant-clamp {
    margin: 6px 0 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.45;
    font-size: 12px;
    color: var(--muted);
}
.why-relevant-clamp .why-label {
    font-weight: 600;
    color: var(--text);
}
.why-relevant {
    margin-top: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--surface-muted);
    border-radius: 6px;
    line-height: 1.5;
}

.cell-significance { min-width: 120px; }
.significance-stack { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.significance-meta { display: flex; flex-direction: column; gap: 4px; }
.meta-chip {
    display: inline-block;
    padding: 2px 7px;
    border-radius: 4px;
    background: var(--surface-muted);
    font-size: 10px;
    color: var(--muted);
    line-height: 1.35;
}
.meta-chip--dept { max-width: 140px; }
.meta-chip--valdkond {
    background: rgba(120, 180, 255, 0.15);
    border: 1px solid rgba(120, 180, 255, 0.35);
    color: var(--text-muted);
}
.meta-chip--valdkond-inactive {
    opacity: 0.65;
    border-style: dashed;
}

.score-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    padding: 4px 10px;
    border-radius: 999px;
    font-weight: 700;
    font-size: 12px;
    color: #fff;
    letter-spacing: 0.02em;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
}
.score-pill--5 { background: linear-gradient(135deg, #E53935, #C62828); }
.score-pill--4 { background: linear-gradient(135deg, #E67E22, #D35400); }
.score-pill--3 { background: linear-gradient(135deg, #E89B0C, #C77D00); }
.score-pill--2,
.score-pill--1 { background: linear-gradient(135deg, #22A06B, #1B7F4E); }

.cell-quantify { min-width: 130px; max-width: 190px; }
.quantify-text {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: 12px;
    color: var(--muted);
    line-height: 1.45;
}

.cell-links { min-width: 120px; text-align: right; }
.link-stack {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
}
.action-link {
    display: inline-flex;
    align-items: center;
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.action-link--primary {
    background: rgba(0, 188, 241, 0.12);
    color: var(--primary);
    border: 1px solid rgba(0, 188, 241, 0.25);
}
.action-link--primary:hover {
    background: rgba(0, 188, 241, 0.2);
    border-color: var(--alx-brand);
}
.action-link--external {
    background: transparent;
    color: var(--muted);
    border: 1px solid transparent;
    font-weight: 500;
}
.action-link--external::after {
    content: " ↗";
    font-size: 10px;
}
.action-link--external:hover {
    color: var(--primary);
    border-color: var(--border);
    background: var(--surface-muted);
}

.findings-footer {
    margin: 0;
    padding: 14px 24px 18px;
    border-top: 1px solid var(--border);
    background: var(--bg);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.table-footer__summary {
    margin: 0;
    font-size: 13px;
    color: var(--muted);
}
.table-footer__summary strong {
    color: var(--text);
    font-weight: 700;
}
.table-footer__sep { opacity: 0.45; margin: 0 2px; }

.table-pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
}
.pagination-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    min-width: 32px;
    height: 32px;
    padding: 0 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--card);
    color: var(--text);
    font-size: 12px;
    font-weight: 500;
    line-height: 1;
    cursor: pointer;
    transition: border-color 0.12s, color 0.12s, background 0.12s;
}
.pagination-btn:hover:not(.pagination-btn--current) {
    border-color: var(--alx-brand);
    color: var(--primary);
    background: rgba(0, 188, 241, 0.06);
}
.pagination-btn--current {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
    text-align: center;
    font-weight: 700;
    cursor: default;
}
.pagination-btn--current:disabled {
    opacity: 1;
}
[data-theme="dark"] .pagination-btn--current {
    background: var(--alx-brand);
    border-color: var(--alx-brand);
    color: var(--alx-navy);
}
.pagination-btn--nav { padding: 0 14px; }
.pagination-ellipsis {
    padding: 0 4px;
    color: var(--muted);
    font-size: 12px;
    user-select: none;
}

@media (max-width: 900px) {
    .dashboard-panel-head {
        flex-direction: column;
        align-items: stretch;
    }
    .dashboard-filters { width: 100%; }
    .filter-select { flex: 1; min-width: 0; }
    .dashboard-main { padding: 16px; }
}

/* Legacy aliases — teised lehed kasutavad docs-table klassi */
.docs-table { width: 100%; min-width: 1100px; border-collapse: collapse; font-size: 13px; }
.docs-table th {
    text-align: left; padding: 10px 10px; color: var(--muted); font-weight: 600;
    font-size: 12px; border-bottom: 2px solid var(--border); white-space: nowrap;
    background: var(--bg); position: sticky; top: 0;
}
.docs-table td { padding: 12px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
.docs-row:hover { background: var(--row-hover); }
.score-row-5 { border-left: 3px solid var(--critical); }
.score-row-4 { border-left: 3px solid var(--high); }
.score-row-3 { border-left: 3px solid var(--medium); }
.score-row-2, .score-row-1 { border-left: 3px solid var(--low); }
.table-wrap { overflow-x: auto; margin: 0 -4px; }
.table-footer { margin-top: 12px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.table-footer__summary { margin: 0; }
.filters { display: flex; gap: 16px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 16px; }
.filters label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.dashboard-table-panel h2 { margin: 0; font-size: 18px; color: var(--primary); }
.link-primary { display: block; color: var(--primary); font-weight: 500; text-decoration: none; margin-bottom: 4px; }
.link-primary:hover { text-decoration: underline; }
.link-secondary { display: block; font-size: 12px; color: var(--muted); text-decoration: none; }
.link-secondary:hover { color: var(--primary); text-decoration: underline; }
.th-sortable { padding: 0; }
.th-sort-btn {
    display: flex; align-items: center; gap: 4px; width: 100%;
    padding: 10px 10px; border: none; background: transparent;
    color: inherit; font: inherit; font-weight: inherit; text-align: left;
    cursor: pointer; white-space: nowrap;
}
.th-sort-btn:hover { color: var(--primary); }
.th-sortable--active .th-sort-btn { color: var(--primary); }
.th-sortable--asc .th-sort-btn::after { content: "▲"; font-size: 9px; opacity: 0.7; }
.th-sortable--desc .th-sort-btn::after { content: "▼"; font-size: 9px; opacity: 0.7; }
.docs-row--rejected { opacity: 0.9; background: var(--surface-muted); }
.status-badge {
    display: inline-block; padding: 3px 8px; border-radius: 10px;
    font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
}
.status-badge--rejected { background: var(--warning-bg); color: var(--warning-text); border: 1px solid var(--alx-warning); }
.status-badge--completed { background: var(--success-bg); color: var(--success-text); border: 1px solid var(--alx-success); }
.summary-clamp--rejected { color: var(--muted); font-style: italic; }
.rejected-banner {
    padding: 12px 16px; margin-bottom: 16px; border-radius: 6px;
    background: var(--warning-bg); border: 1px solid var(--alx-warning); color: var(--warning-text); font-size: 13px;
}
.rejected-reason { margin: 8px 0 0; line-height: 1.5; }
.manual-edit-banner {
    padding: 12px 16px; margin-bottom: 16px; border-radius: 6px;
    background: var(--chip-bg); border: 1px solid var(--alx-brand); color: var(--primary); font-size: 13px;
}
.doc-review-section { margin-bottom: 24px; padding: 16px 18px; }
.doc-review-section h3 { margin: 0 0 8px; font-size: 15px; }
.doc-workflow-section {
    margin-bottom: 20px;
    padding: 10px 14px;
}
.doc-workflow-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 8px 14px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}
.doc-workflow-row:first-child {
    padding-top: 0;
}
.doc-workflow-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}
.doc-workflow-label {
    flex: 0 0 88px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--primary);
    padding-top: 4px;
}
.doc-workflow-body {
    flex: 1 1 200px;
    min-width: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 10px;
}
.doc-workflow-empty {
    font-size: 12px;
    color: var(--muted);
}
.doc-workflow-picker {
    flex: 0 0 100%;
    margin-top: 2px;
}
.doc-workflow-picker summary {
    font-size: 12px;
    color: var(--muted);
    cursor: pointer;
    user-select: none;
}
.doc-workflow-picker[open] summary {
    margin-bottom: 6px;
}
.finding-valdkond-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.doc-workflow-row--review .doc-workflow-body {
    display: block;
}
.doc-review-form--compact .doc-review-grid--compact {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px 10px;
    margin-bottom: 8px;
}
.doc-review-form--compact select,
.doc-review-form--compact textarea {
    padding: 6px 8px;
    font-size: 13px;
}
.doc-review-comment--compact {
    margin-bottom: 8px;
}
.doc-review-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 14px;
}
.doc-review-reject--compact {
    margin: 0;
    font-size: 12px;
}
.doc-tag-add--inline {
    margin-top: 0;
    flex: 1 1 180px;
    max-width: 280px;
}
@media (max-width: 640px) {
    .doc-workflow-label {
        flex: 0 0 100%;
        padding-top: 0;
    }
    .doc-review-form--compact .doc-review-grid--compact {
        grid-template-columns: 1fr;
    }
}
.doc-review-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px 16px; margin-bottom: 12px;
}
.doc-review-form label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.doc-review-form select,
.doc-review-form textarea {
    padding: 8px 10px; border: 1px solid var(--border); border-radius: 4px;
    font-size: 14px; background: var(--input-bg); color: var(--text);
}
.doc-review-comment { margin-bottom: 12px; }
.doc-review-reject { margin-bottom: 16px; }
.doc-review-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.field-label { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; }
.panel--nested { background: var(--bg); border: 1px solid var(--border); border-radius: 6px; }
.sources-collect-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}
.sources-collect-toolbar h2 { margin: 0; font-size: 16px; }
.sources-collect-body {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
    padding: 10px 12px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
}
.sources-collect-segment {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}
.sources-collect-segment__label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted);
}
.sources-collect-segment__actions { display: flex; flex-wrap: wrap; gap: 6px; }
.sources-collect-segment--group select {
    padding: 5px 8px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 13px;
    background: var(--input-bg);
    color: var(--text);
    min-width: 120px;
    max-width: 180px;
}
.sources-collect-segment--group select:disabled { opacity: 0.55; cursor: not-allowed; }
.sources-collect-divider {
    width: 1px;
    height: 26px;
    background: var(--border);
    flex-shrink: 0;
}
.sources-collect-status:not(:empty) { margin-top: 10px; }
.sources-collect-status:empty { display: none; }
.sources-collect-status .collect-result { margin-bottom: 0; }
@media (max-width: 720px) {
    .sources-collect-divider { display: none; }
    .sources-collect-segment { width: 100%; }
}
.group-badge {
    display: inline-block; padding: 2px 8px; border-radius: 10px;
    background: var(--surface-muted); font-size: 12px; font-weight: 500;
}
.cell-status { white-space: nowrap; width: 80px; }

/* Dokumendi vaade */
.document-main { max-width: 900px; margin: 0 auto; padding: 24px 32px 48px; }
.doc-panel { padding: 24px 28px; }
.doc-header { margin-bottom: 16px; }
.doc-header__crumb {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0 6px;
    margin: 0 0 10px;
    font-size: 12px;
}
.doc-header__crumb a {
    color: var(--alx-brand-dark);
    text-decoration: none;
    font-weight: 600;
}
[data-theme="dark"] .doc-header__crumb a {
    color: var(--alx-brand);
}
.doc-header__crumb a:hover { text-decoration: underline; }
.doc-header__sep { color: var(--muted); user-select: none; }
.doc-header__current { color: var(--muted); font-weight: 500; }
.doc-panel .doc-title {
    margin: 0;
    font-size: 22px;
    font-weight: 600;
    color: var(--text);
    line-height: 1.35;
}
.doc-meta-grid > div > span:not(.meta-label) {
    color: var(--text);
}
.doc-refetch-form { display: inline; margin: 0; }
.doc-refetch-btn.is-busy { opacity: 0.65; cursor: wait; }
.doc-refetch-banner {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 6px;
    margin: -12px 0 16px;
    font-size: 12px;
}
.doc-refetch-banner--busy {
    background: var(--chip-bg);
    border: 1px solid var(--alx-brand);
    color: var(--text);
}
.doc-refetch-banner--busy strong { color: var(--alx-brand-dark); }
[data-theme="dark"] .doc-refetch-banner--busy strong { color: var(--alx-brand); }
.doc-refetch-banner--ok {
    background: var(--success-bg);
    border: 1px solid var(--alx-success);
    color: var(--success-text);
}
.doc-refetch-banner--error {
    background: var(--error-bg);
    border: 1px solid var(--alx-alert);
    color: var(--error-text);
}
.doc-refetch-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(0, 188, 241, 0.25);
    border-top-color: var(--alx-brand);
    border-radius: 50%;
    animation: doc-refetch-spin 0.8s linear infinite;
    flex-shrink: 0;
    margin-top: 2px;
}
@keyframes doc-refetch-spin { to { transform: rotate(360deg); } }
.doc-meta-grid__full { grid-column: 1 / -1; }
.doc-meta-grid__toolbar {
    grid-column: 1 / -1;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding-top: 12px;
    margin-top: 4px;
    border-top: 1px solid var(--border);
}
.doc-refetch-btn {
    background: var(--alx-warning);
    color: var(--alx-navy);
    font-weight: 600;
}
.doc-refetch-btn:hover { background: #f5a623; opacity: 1; }
.doc-refetch-btn:disabled,
.doc-refetch-btn.is-busy {
    background: var(--surface-muted);
    color: var(--muted);
    opacity: 1;
    cursor: not-allowed;
}
[data-theme="dark"] .doc-refetch-btn:not(:disabled):not(.is-busy) {
    background: var(--alx-warning);
    color: var(--alx-navy);
}
.doc-url-link {
    word-break: break-all;
    color: var(--alx-brand-dark);
    font-weight: 500;
}
[data-theme="dark"] .doc-url-link { color: var(--alx-brand); }
.doc-meta-grid {
    display: grid; grid-template-columns: 1fr 1fr; gap: 12px 24px;
    padding: 14px 16px;
    background: var(--surface-muted);
    border: 1px solid var(--border);
    border-radius: 6px;
    margin-bottom: 20px;
    font-size: 13px;
}
.meta-label { display: block; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.03em; margin-bottom: 2px; }
.doc-meta-grid a:not(.btn-collect) { word-break: break-all; }
[data-theme="dark"] .btn-collect--neutral {
    background: var(--input-bg);
    color: var(--text);
    border: 1px solid var(--border);
}
[data-theme="dark"] .btn-collect--neutral:hover {
    border-color: var(--alx-brand);
    color: var(--alx-brand);
}
.doc-finding-summary {
    padding: 16px; border: 1px solid var(--border); border-radius: 6px;
    margin-bottom: 24px; background: var(--surface-muted);
}
.doc-finding-summary h3 { margin: 0 0 12px; font-size: 15px; color: var(--text); }
.doc-finding-summary p { color: var(--text); }
.finding-badges { margin-bottom: 12px; }
.doc-content-section h3 { margin: 0 0 12px; font-size: 15px; color: var(--text); }
.doc-content {
    white-space: pre-wrap; word-break: break-word; font-size: 14px; line-height: 1.6;
    max-height: 70vh; overflow-y: auto; padding: 16px; background: var(--bg);
    border: 1px solid var(--border); border-radius: 6px;
}
.doc-attachments-section { margin-top: 24px; }
.doc-attachments-section h3 { margin: 0 0 8px; font-size: 15px; color: var(--text); }
.doc-attachments-list { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.doc-attachment-item {
    padding: 12px 14px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg);
}
.doc-attachment-meta { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.doc-attachment-kind {
    font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em;
    color: var(--muted); background: var(--surface); padding: 2px 6px; border-radius: 4px;
}
.doc-attachment-preview {
    margin: 8px 0 0; font-size: 13px; color: var(--muted); line-height: 1.5;
    white-space: pre-wrap; word-break: break-word;
}

/* Statistika */
.stats-main { max-width: 960px; margin: 0 auto; padding: 24px 32px 48px; }
.stats-filters { margin-bottom: 20px; }
.stats-filters h2 { margin-bottom: 12px; }
.stats-filter-row {
    display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: flex-end;
}
.stats-filter-row label {
    display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted);
}
.stats-filter-row select {
    padding: 8px 10px; border: 1px solid var(--border); border-radius: 4px; font-size: 14px;
    min-width: 140px;
}
.stats-cards {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px;
}
@media (max-width: 1100px) {
    .stats-cards { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 800px) {
    .stats-cards { grid-template-columns: 1fr; }
}
.stats-card {
    background: var(--card); border: 1px solid var(--border); border-radius: 8px;
    padding: 20px; display: flex; flex-direction: column; gap: 6px;
}
.stats-card--findings { border-color: var(--accent); }
.stats-card--findings .stats-card-value { color: var(--accent); }
.stats-card--impact { border-color: var(--high); }
.stats-card-label { font-size: 13px; color: var(--muted); }
.stats-card-value { font-size: 32px; color: var(--primary); line-height: 1.1; }
.stats-card--impact .stats-card-value { color: var(--high); }
.stats-card-hint { font-size: 12px; color: var(--muted); line-height: 1.4; }
.stats-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.stats-table th, .stats-table td {
    padding: 10px 12px; border-bottom: 1px solid var(--border); text-align: left;
}
.stats-table th { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.03em; }
.stats-table td:not(:first-child) { text-align: center; width: 120px; }
.stats-row--active { background: var(--row-hover); }
.stats-row-total { font-weight: 600; background: var(--bg); }
.stats-row-total td { border-bottom: none; }
.stats-impact {
    display: inline-block; min-width: 28px; padding: 2px 8px; border-radius: 12px;
    background: var(--high); color: white; font-weight: 600; font-size: 13px;
}
.stats-month-link { color: var(--primary); text-decoration: none; font-weight: 500; }
.stats-month-link:hover { text-decoration: underline; }

/* Ajakava — kompaktne */
.schedules-main { max-width: 1100px; margin: 0 auto; padding: 16px 24px 32px; }
.schedules-main--compact { max-width: 1200px; }
.schedules-main--dense {
    max-width: 1400px;
    padding: 10px 20px 24px;
}
.schedules-flash {
    margin: 0 0 8px;
    padding: 6px 10px;
    font-size: 12px;
}
.schedules-hint { margin: 0 0 12px; font-size: 12px; }
.schedule-groups { display: flex; flex-direction: column; gap: 16px; }
.schedule-group {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
}
.schedule-group-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 12px;
    background: var(--card);
    border-bottom: 1px solid var(--border);
}
.schedule-group-title {
    margin: 0;
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
}
.schedule-group-count {
    font-size: 11px;
    color: var(--muted);
    white-space: nowrap;
}
.schedule-bulk-form { margin: 0; }
.schedule-bulk-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px 16px;
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}
.schedule-bulk-actions--top {
    margin-top: 0;
    margin-bottom: 12px;
    padding-top: 0;
    border-top: none;
}
.schedule-bulk-hint { margin: 0; }
.schedule-bulk-hint--bottom { margin-top: 8px; }
.schedule-list { display: flex; flex-direction: column; gap: 8px; }
.schedule-list--dense { gap: 3px; }

/* Tihe rida — üks allikas ≈ 36px */
.schedule-item {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 10px 14px;
}
.schedule-item--dense {
    padding: 0;
    border-radius: 4px;
    overflow: hidden;
}
.schedule-item--dense:hover { border-color: var(--alx-brand); }
.schedule-form-dense { margin: 0; }

.schedule-row {
    display: grid;
    grid-template-columns: minmax(140px, 1.2fr) minmax(200px, 2fr) minmax(100px, 1fr);
    align-items: center;
    gap: 8px 12px;
    padding: 5px 10px;
    min-height: 34px;
}

.schedule-id {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    overflow: hidden;
}
.schedule-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.schedule-url-mini {
    font-size: 10px;
    color: var(--alexela-cyan-dark);
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 120px;
    flex-shrink: 1;
    opacity: 0.85;
}
.schedule-url-mini:hover { text-decoration: underline; color: var(--alexela-cyan); }

.schedule-controls {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px 6px;
}
.schedule-toggle {
    display: flex;
    align-items: center;
    cursor: pointer;
    margin: 0;
    padding: 0;
}
.schedule-toggle input {
    width: 14px;
    height: 14px;
    margin: 0;
    accent-color: var(--alx-brand);
}
.schedule-toggle--labeled {
    gap: 4px;
    min-width: 52px;
}
.schedule-toggle-spacer {
    display: inline-block;
    width: 42px;
    flex-shrink: 0;
}
.schedule-toggle-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--muted);
}
.schedule-enabled-badge {
    font-size: 10px;
    padding: 1px 5px;
    border-radius: 3px;
}
.schedule-select,
.schedule-input-time,
.schedule-input-minute {
    padding: 2px 6px;
    border: 1px solid var(--border);
    border-radius: 3px;
    font-size: 12px;
    min-height: 26px;
    background: var(--input-bg);
    color: var(--text);
}
.schedule-select--freq { min-width: 88px; max-width: 110px; }
.schedule-select--day { min-width: 42px; width: 48px; padding-left: 4px; padding-right: 2px; }
.schedule-input-time { width: 88px; }
.schedule-input-minute { min-height: 24px; padding: 2px 4px; }
.btn-collect--xs {
    padding: 3px 8px;
    font-size: 11px;
    min-height: 26px;
    line-height: 1.2;
}
/* Tabeli tegevused: käivita (roheline) · muuda (sinine) · kustuta (punane) */
.btn-collect--run {
    background: var(--alx-success);
    color: #fff;
}
.btn-collect--run:hover { opacity: 0.92; }
.btn-collect--run:disabled {
    background: var(--surface-muted);
    color: var(--muted);
    opacity: 1;
    cursor: not-allowed;
}
.btn-collect--edit {
    background: var(--alx-brand);
    color: #fff;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.btn-collect--edit:hover { opacity: 0.92; text-decoration: none; }
[data-theme="dark"] .btn-collect.btn-collect--run {
    background: var(--alx-success);
    color: #fff;
}
[data-theme="dark"] .btn-collect.btn-collect--edit {
    background: var(--alx-brand);
    color: var(--alx-navy);
}
[data-theme="dark"] .btn-collect.btn-collect--danger {
    background: var(--alx-alert);
    color: #fff;
}
.btn-collect--danger {
    background: var(--alx-alert);
    color: #fff;
}
.btn-collect--danger:hover { opacity: 0.92; }

.settings-tags-search,
.settings-tags-merge,
.settings-valdkond-add {
    margin-bottom: 1.25rem;
}
.settings-valdkond-dialog-fields {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin: 0.75rem 0;
}
.settings-valdkond-dialog-fields label {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    font-size: 0.875rem;
}
.settings-tags-merge__row {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: flex-end;
}
.settings-tags-merge h3 {
    margin: 0 0 0.5rem;
    font-size: 1rem;
}
.settings-tags-table .settings-tag-rename-form {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}
.settings-tags-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}
.settings-tags-actions .inline-form {
    display: inline;
}
.settings-tags-row--archived td {
    opacity: 0.75;
}
/* Saajate tabelis: raporti valik ja „Saada raport" jäävad ühele reale. */
.report-send-one {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    margin-bottom: 0.35rem;
}
.report-send-one select {
    max-width: 22rem;
}
.panel-hint {
    color: var(--text-muted, #666);
    margin: 0 0 1rem;
    font-size: 0.9rem;
}

.tag-autocomplete {
    position: relative;
    flex: 1;
    min-width: 0;
}
.tag-autocomplete--dialog {
    width: 100%;
}
.tag-autocomplete__input {
    width: 100%;
}
.tag-autocomplete__dropdown {
    position: absolute;
    z-index: 40;
    left: 0;
    right: 0;
    top: calc(100% + 4px);
    max-height: 200px;
    overflow-y: auto;
    margin: 0;
    padding: 4px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--card);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
}
.tag-autocomplete__heading,
.tag-autocomplete__note {
    margin: 0;
    padding: 4px 8px 2px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted);
}
.tag-autocomplete__note {
    text-transform: none;
    font-weight: 500;
    letter-spacing: 0;
    font-size: 11px;
}
.tag-autocomplete__item {
    display: block;
    width: 100%;
    text-align: left;
    padding: 6px 8px;
    margin: 0;
    border: none;
    border-radius: 5px;
    font-size: 13px;
    cursor: pointer;
    background: transparent;
    color: var(--text);
}
.tag-autocomplete__item--mine {
    color: #00bcf1;
}
.tag-autocomplete__item--other {
    color: #94a3b8;
}
.tag-autocomplete__item--similar {
    font-style: italic;
}
.tag-autocomplete__item.is-active,
.tag-autocomplete__item:hover {
    background: rgba(0, 188, 241, 0.12);
}
.tag-autocomplete__item--other.is-active,
.tag-autocomplete__item--other:hover {
    background: rgba(148, 163, 184, 0.15);
}

.tag-name-dialog {
    border: 1px solid var(--border-color, #ccc);
    border-radius: 8px;
    padding: 1rem 1.25rem;
    max-width: 28rem;
    width: calc(100% - 2rem);
}
.tag-name-dialog::backdrop {
    background: rgba(0, 0, 0, 0.35);
}
.tag-name-dialog__title {
    margin: 0 0 0.75rem;
    font-size: 1rem;
}
.tag-name-dialog__actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
}
.btn-collect--neutral {
    background: var(--surface-muted);
    color: var(--text);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.btn-collect--neutral:hover { opacity: 0.92; text-decoration: none; }
.source-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.schedule-aside {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    min-width: 0;
    font-size: 11px;
    color: var(--muted);
    text-align: right;
}
.schedule-summary {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--primary);
    font-weight: 500;
}
.schedule-run {
    flex-shrink: 0;
    font-size: 10px;
    opacity: 0.85;
}

.schedule-panel--inline:not([hidden]) {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.schedule-panel--hourly:not([hidden]) {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 10px 6px;
    border-top: 1px solid var(--border);
    background: var(--surface-muted);
}
.schedule-panel[hidden] {
    display: none !important;
}
.schedule-minute {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
}
.schedule-minute-label {
    font-size: 12px;
    color: var(--muted);
    font-weight: 600;
}

.hour-grid--dense {
    display: grid;
    grid-template-columns: repeat(24, 1fr);
    gap: 2px;
    flex: 1;
    min-width: 0;
}
.hour-chip--dense {
    padding: 0;
    font-size: 9px;
    min-height: 20px;
    line-height: 1;
}
.hour-chip--dense input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}
.hour-chip--dense:has(input:checked) {
    background: var(--alx-brand);
    color: #fff;
    border-color: var(--alx-brand-dark);
    font-weight: 700;
}

.source-schedule-panel {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}
.source-schedule-panel h3 {
    margin: 0 0 8px;
    font-size: 15px;
    color: var(--primary);
}
.schedule-controls--source {
    margin-top: 8px;
}
.schedule-inline-summary {
    margin: 0 0 8px;
}
.schedule-item-top {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 6px 16px;
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--bg);
}
.schedule-item-id {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 6px 10px;
    min-width: 0;
    flex: 1;
}
.schedule-group { font-size: 11px; }
.schedule-url {
    display: block;
    width: 100%;
    font-size: 11px;
    color: var(--alexela-cyan-dark);
    text-decoration: none;
    word-break: break-all;
    line-height: 1.3;
}
.schedule-url:hover { text-decoration: underline; color: var(--alexela-cyan); }
.schedule-item-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    text-align: right;
    flex-shrink: 0;
}
.schedule-last-run { font-size: 11px; max-width: 280px; }
.schedule-form-compact {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 8px 12px;
}
.schedule-field {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 11px;
    color: var(--muted);
}
.schedule-field-label { text-transform: uppercase; letter-spacing: 0.04em; font-size: 10px; }
.schedule-field select,
.schedule-field input[type="time"],
.schedule-field input[type="number"] {
    padding: 4px 8px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 13px;
    min-height: 30px;
}
.input-narrow { width: 40px; }
.schedule-panel--block { width: 100%; flex-basis: 100%; }
.hour-grid--compact {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 3px;
    margin-bottom: 6px;
}
.hour-chip {
    display: flex; align-items: center; justify-content: center; gap: 4px;
    background: var(--input-bg); border: 1px solid var(--border); border-radius: 3px;
    cursor: pointer; color: var(--text);
    position: relative;
}
.hour-chip:has(input:checked) { background: var(--chip-bg); border-color: var(--alx-brand); }
.hour-chip--compact {
    padding: 2px 0;
    font-size: 10px;
    justify-content: center;
    min-height: 24px;
}
.schedule-field--minute { margin-top: 4px; }
.badge-builtin { background: var(--chip-bg); color: var(--alx-brand-dark); }
.badge-custom { background: rgba(0, 188, 241, 0.12); color: var(--alx-brand); }
.badge { display: inline-block; padding: 1px 5px; border-radius: 3px; font-size: 9px; font-weight: 700; text-transform: uppercase; flex-shrink: 0; }

/* Autentimine */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}
.auth-card {
    width: min(420px, 100%);
    padding: 28px 32px;
}
.auth-logo { margin-bottom: 16px; }
.auth-form label { display: block; margin-bottom: 12px; }
.auth-form input { width: 100%; }

/* Seaded */
.settings-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 8px;
}
.settings-tab {
    padding: 6px 12px;
    border-radius: 6px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 14px;
}
.settings-tab--active {
    background: var(--chip-bg);
    color: var(--alx-brand-dark);
    font-weight: 600;
}

/* Kasutajamenüü */
.user-menu {
    position: relative;
    margin-left: 8px;
}
.user-menu-trigger {
    list-style: none;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 13px;
    color: var(--text);
    background: var(--input-bg);
    border: 1px solid var(--border);
}
.user-menu-trigger::-webkit-details-marker { display: none; }
.user-menu-panel {
    position: absolute;
    right: 0;
    top: calc(100% + 4px);
    min-width: 180px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.user-menu-email {
    font-size: 12px;
    color: var(--muted);
    padding: 4px 6px;
    word-break: break-all;
}
.user-menu-panel a,
.user-menu-logout {
    display: block;
    width: 100%;
    text-align: left;
    padding: 6px 8px;
    border-radius: 4px;
    font-size: 13px;
    color: var(--text);
    background: none;
    border: none;
    cursor: pointer;
    text-decoration: none;
}
.user-menu-panel a:hover,
.user-menu-logout:hover {
    background: var(--chip-bg);
}

/* Kasutajajuhend (markdown) */
.guide-main {
    max-width: 900px;
    margin: 0 auto;
    padding: 24px 20px 48px;
}
.guide-prose {
    padding: 28px 32px;
    line-height: 1.65;
    font-size: 15px;
}
.guide-prose h1 {
    font-size: 1.75rem;
    margin: 0 0 1rem;
    color: var(--alx-brand-dark);
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.5rem;
}
.guide-prose h2 {
    font-size: 1.25rem;
    margin: 2rem 0 0.75rem;
    color: var(--text);
}
.guide-prose h3 {
    font-size: 1.05rem;
    margin: 1.5rem 0 0.5rem;
    color: var(--text);
}
.guide-prose p {
    margin: 0 0 1rem;
}
.guide-prose ul,
.guide-prose ol {
    margin: 0 0 1rem;
    padding-left: 1.5rem;
}
.guide-prose li {
    margin-bottom: 0.35rem;
}
.guide-prose table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0 1.5rem;
    font-size: 14px;
}
.guide-prose th,
.guide-prose td {
    border: 1px solid var(--border);
    padding: 8px 12px;
    text-align: left;
    vertical-align: top;
}
.guide-prose th {
    background: var(--chip-bg);
    font-weight: 600;
}
.guide-prose code {
    font-size: 0.9em;
    background: var(--input-bg);
    padding: 2px 6px;
    border-radius: 4px;
}
.guide-prose a {
    color: var(--alx-brand);
    text-decoration: underline;
}
.guide-prose hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 2rem 0;
}
.guide-prose strong {
    font-weight: 600;
}
.guide-prose .mermaid {
    margin: 1.5rem 0;
    padding: 1rem 0.5rem;
    overflow-x: auto;
    background: var(--input-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    text-align: center;
}
.guide-prose pre:not(:has(.language-mermaid)) {
    overflow-x: auto;
    padding: 12px 16px;
    background: var(--input-bg);
    border-radius: 6px;
    font-size: 13px;
}

@media (max-width: 900px) {
    .schedule-row {
        grid-template-columns: 1fr;
        gap: 4px;
        padding: 6px 10px;
    }
    .schedule-aside {
        justify-content: flex-start;
        text-align: left;
    }
    .hour-grid--dense { grid-template-columns: repeat(12, 1fr); }
}
@media (max-width: 700px) {
    .hour-grid--compact { grid-template-columns: repeat(8, 1fr); }
    .schedule-item-meta { align-items: flex-start; text-align: left; width: 100%; }
}

/* Leiude töövoog — tag'id, loetud, bulk */
.findings-bulk-bar {
    display: none;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    margin: 0 12px 8px;
    background: rgba(0, 188, 241, 0.1);
    border: 1px solid rgba(0, 188, 241, 0.35);
    border-radius: 8px;
}
.findings-bulk-bar.is-active {
    display: flex;
}
.findings-bulk-bar .btn,
.findings-bulk-bar .btn-sm {
    margin-bottom: 0;
    line-height: 1.25;
    vertical-align: middle;
}
.findings-bulk-bar__count {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    font-size: 13px;
    font-weight: 600;
    margin: 0 4px 0 0;
    padding: 0;
    color: var(--primary);
    white-space: nowrap;
}
.findings-bulk-bar .btn-danger {
    background: var(--critical);
    color: #fff;
    border: 1px solid transparent;
    font-weight: 600;
}
.findings-bulk-bar .btn-danger:hover {
    filter: brightness(1.08);
    color: #fff;
}
[data-theme="dark"] .findings-bulk-bar .btn-danger {
    background: #b84a3a;
    color: #fff;
}
[data-theme="dark"] .findings-bulk-bar .btn-secondary {
    background: var(--surface-muted);
    color: var(--text);
    border: 1px solid var(--border);
}
.findings-group-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 8px 12px 0;
}
.findings-group-toolbar__hint {
    font-size: 12px;
    color: var(--text-muted);
    margin-left: auto;
}
.finding-group-header__cell {
    padding: 10px 12px !important;
    background: var(--chip-bg);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}
.finding-group-header__inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}
.finding-group-toggle {
    width: 28px;
    height: 28px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--card);
    color: var(--text);
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
}
.finding-group-toggle:hover {
    border-color: var(--primary);
    color: var(--primary);
}
.finding-group-header__title {
    font-weight: 700;
    font-size: 14px;
    letter-spacing: 0.02em;
}
.finding-group-header__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-muted);
}
.finding-group-header__unread {
    font-weight: 600;
    color: var(--primary);
}
.finding-group-header__warn {
    color: var(--warning-text, #8a6d00);
    font-weight: 600;
}
.finding-group-body.is-collapsed {
    display: none;
}
.findings-table--grouped .finding-group-meta tr:hover {
    background: transparent;
}
.doc-title-link--unread {
    font-weight: 700;
    color: var(--alx-brand);
}
.doc-title-link--read {
    font-weight: 500;
    color: var(--text);
}
[data-theme="dark"] .doc-title-link--read {
    color: #b8c5d4;
}
[data-theme="dark"] .doc-title-link--unread {
    color: var(--alx-brand);
}
.read-indicator {
    display: block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.read-indicator--unread {
    background: var(--alx-brand);
    box-shadow: 0 0 0 2px rgba(0, 188, 241, 0.25);
}
.read-indicator--read {
    background: transparent;
    border: 1.5px solid var(--muted);
    opacity: 0.45;
    width: 7px;
    height: 7px;
}
.cell-check__stack {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}
.finding-tag-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 4px;
}
.finding-tag-chips--compact {
    gap: 3px;
    margin-top: 3px;
}
.finding-tag-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 7px;
    border-radius: 4px;
    font-size: 11px;
    line-height: 1.35;
    border: 1px solid transparent;
}
.finding-tag-chip--mine {
    background: rgba(0, 188, 241, 0.18);
    color: #00bcf1;
    border-color: rgba(0, 188, 241, 0.5);
}
.finding-tag-chip--other {
    background: rgba(148, 163, 184, 0.14);
    color: #94a3b8;
    border-color: rgba(148, 163, 184, 0.4);
}
[data-theme="light"] .finding-tag-chip--mine {
    color: var(--alx-brand-dark);
    background: rgba(0, 140, 180, 0.12);
}
[data-theme="light"] .finding-tag-chip--other {
    color: #5c6b7a;
    background: rgba(92, 107, 122, 0.1);
}
.finding-tag-chip--more {
    font-weight: 600;
    cursor: help;
}
.tag-filter-chip {
    display: flex;
    align-items: center;
    gap: 5px;
    min-width: 0;
    padding: 3px 7px;
    border-radius: 6px;
    font-size: 11px;
    cursor: pointer;
    border: 1px solid transparent;
    transition: background 0.1s, border-color 0.1s;
}
.tag-filter-chip--mine {
    border-color: rgba(0, 188, 241, 0.45);
    background: rgba(0, 188, 241, 0.14);
}
.tag-filter-chip--mine .tag-filter-chip__label {
    color: #00bcf1;
    font-weight: 600;
}
.tag-filter-chip--other {
    border-color: rgba(148, 163, 184, 0.35);
    background: rgba(148, 163, 184, 0.1);
}
.tag-filter-chip--other .tag-filter-chip__label {
    color: #94a3b8;
}
.tag-filter-chip:hover {
    filter: brightness(1.08);
}
.tag-filter-chip:has(.tag-filter-checkbox:checked) {
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.15);
}
.tag-filter-chip--mine:has(.tag-filter-checkbox:checked) {
    background: rgba(0, 188, 241, 0.28);
}
.tag-filter-chip--other:has(.tag-filter-checkbox:checked) {
    background: rgba(148, 163, 184, 0.22);
}
.tag-filter-chip input {
    margin: 0;
    flex-shrink: 0;
}
.tag-filter-legend,
.dashboard-tag-legend {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-left: 10px;
    font-size: 11px;
    color: var(--muted);
}
.tag-legend-swatch {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 3px;
    flex-shrink: 0;
}
.tag-legend-swatch--mine {
    background: rgba(0, 188, 241, 0.35);
    border: 1px solid rgba(0, 188, 241, 0.65);
}
.tag-legend-swatch--other {
    background: rgba(148, 163, 184, 0.25);
    border: 1px solid rgba(148, 163, 184, 0.55);
}

.findings-filters-section__title--inline {
    margin: 0;
    flex: 0 0 auto;
    align-self: center;
}
.findings-filters-section--valdkonnad {
    margin: 0;
}
.valdkond-filter-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
}
.valdkond-filter-panel {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    flex: 1 1 auto;
    min-width: 0;
    padding: 0;
}
.valdkond-filter-empty {
    font-size: 11px;
    color: var(--muted);
}
.valdkond-filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 999px;
    border: 1px solid rgba(120, 180, 255, 0.3);
    background: rgba(120, 180, 255, 0.06);
    cursor: pointer;
    font-size: 11px;
    line-height: 1.35;
}
.valdkond-filter-chip:hover {
    background: rgba(120, 180, 255, 0.12);
}
.valdkond-filter-chip:has(.valdkond-filter-checkbox:checked) {
    background: rgba(120, 180, 255, 0.2);
    border-color: rgba(120, 180, 255, 0.5);
}
.valdkond-filter-chip input {
    margin: 0;
    width: 12px;
    height: 12px;
}
.valdkond-filter-chip--none {
    border-style: dashed;
}
.dashboard-tag-legend {
    margin-left: 0;
}
.th-check, .cell-check { width: 40px; text-align: center; vertical-align: middle; }
.tag-chip-remove {
    border: none;
    background: transparent;
    cursor: pointer;
    padding: 0 2px;
    line-height: 1;
    color: inherit;
}
.doc-tag-add {
    display: flex;
    gap: 8px;
    margin-top: 8px;
    align-items: flex-start;
}
.doc-tag-add .tag-autocomplete {
    flex: 1;
}

/* === Objektivaade (regulatory items) ===================================== */

.view-switch {
    display: inline-flex;
    border: 1px solid var(--line);
    border-radius: 999px;
    overflow: hidden;
    background: var(--card);
}
.view-switch a {
    padding: 4px 14px;
    font-size: 13px;
    text-decoration: none;
    color: var(--ink-2);
}
.view-switch a.is-active {
    background: var(--ink);
    color: #fff;
}

/* Objektirida hoiab leiurea kõrgust: pealkiri, üks metarida, kärbitud tekst. */
.items-table .cell-item-title { min-width: 280px; max-width: 340px; }
/* Allikad ja etapid on lühikesed koodid ja üks tekstirida — kokkuvõte vajab
   ruumi rohkem, seega kitsendatakse neid kahte tema kasuks. */
.items-table .cell-item-sources { width: 48px; min-width: 48px; }
.items-table .cell-stages { width: 140px; min-width: 120px; max-width: 150px; }
.items-table .cell-summary { min-width: 340px; max-width: 460px; }
.items-table .summary-clamp { -webkit-line-clamp: 2; }
.items-table .why-relevant-clamp { -webkit-line-clamp: 2; }
.items-table .cell-arikaal,
.items-table .cell-deadline { white-space: nowrap; font-size: 12px; }
.items-table .cell-owner { font-size: 12px; max-width: 140px; }

.item-key-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-bottom: 2px;
}
/* Objekti võti, liik, loendur ja ettepanek mahuvad ühele metareale. */
.item-meta-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-top: 4px;
    font-size: 11px;
    line-height: 1.4;
    color: var(--muted);
}
.item-key {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 11px;
    color: var(--muted);
    background: var(--surface-muted);
    border-radius: 4px;
    padding: 1px 6px;
}
.item-kind-badge {
    font-size: 11px;
    color: var(--text);
    background: var(--chip-bg);
    border-radius: 999px;
    padding: 1px 8px;
    white-space: nowrap;
}
.item-count { font-size: 11px; color: var(--muted); white-space: nowrap; }
.item-suggestion-mark {
    font-size: 11px;
    color: var(--primary);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 0 7px;
    text-decoration: none;
    white-space: nowrap;
}
.item-suggestion-mark:hover { border-color: var(--primary); }
.why-label { color: var(--muted); }

/* Allikad lühikoodidena — pikk nimi jääb tooltip'i. */
.item-source-badges { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.item-source-badge {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.03em;
    color: var(--muted);
    background: var(--surface-muted);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 1px 5px;
}

/* Etapid ühe reana: ainult teadaolevad etapid ja järgmine, veel saabumata. */
.item-stage-line {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: 11px;
    line-height: 1.4;
    color: var(--muted);
}
.stage-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin: 0;
    padding: 0;
    list-style: none;
}
.stage-list__item { font-size: 12px; color: var(--muted); }
.stage-list__item--reached { color: var(--text); }
.stage-list__label {
    font-size: 11px;
    background: var(--chip-bg);
    color: var(--text);
    border-radius: 999px;
    padding: 1px 8px;
}
.stage-list__item:not(.stage-list__item--reached) .stage-list__label {
    background: var(--surface-muted);
    color: var(--muted);
}
.stage-list__date { font-size: 11px; color: var(--muted); margin-left: 6px; }

/* Leiud ja täiendused — ainult detailvaates. */
.item-status-chip {
    font-size: 11px;
    border-radius: 999px;
    padding: 1px 8px;
    background: var(--surface-muted);
    color: var(--muted);
    white-space: nowrap;
}
.item-status-chip--lopetatud { background: var(--success-bg); color: var(--success-text); }
.item-status-chip--huvi_puudub { background: var(--warning-bg); color: var(--warning-text); }
.item-owner { display: block; overflow-wrap: anywhere; }
/* Kuupäev on rühma päis: eelnõu toimik saabub ühe päevaga ja kümme korda
   sama kuupäev rea alguses on müra. */
.item-supplement-days { margin: 0; padding: 0; list-style: none; }
.item-supplement-day + .item-supplement-day { margin-top: 10px; }
.item-supplement-day__date {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
}
.item-supplements {
    margin: 0;
    padding: 6px 0 6px 18px;
    list-style: none;
    border-left: 2px solid var(--border);
}
.item-supplement {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 8px;
    padding: 6px 0;
    font-size: 13px;
}
/* Protokoll ja päevakord on menetlusfakt, mitte uus õiguslik sisu. */
.item-supplement--menetluslik { opacity: 0.62; }
.item-supplement__source { color: var(--muted); }
.item-supplement__format {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.03em;
    color: var(--muted);
    background: var(--surface-muted);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0 5px;
}
.item-supplement__role {
    font-size: 11px;
    background: var(--surface-muted);
    color: var(--muted);
    border-radius: 999px;
    padding: 1px 8px;
    white-space: nowrap;
}
.item-supplement__title { font-weight: 500; flex: 1 1 280px; }
.item-supplement__delta {
    flex-basis: 100%;
    color: var(--muted);
    font-style: italic;
    line-height: 1.45;
}
.item-supplement__actions { margin-left: auto; }

/* Pehme seose ettepanek — ainult detailvaates, mitte tabelis. */
.item-candidate {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    background: var(--chip-bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 8px 10px;
    font-size: 13px;
}
.item-candidate--side { margin-bottom: 8px; }
.item-candidate__question { margin-right: 6px; color: var(--muted); }
.item-candidate__target { font-weight: 600; }
.item-candidate__confidence { color: var(--muted); }
/* Liitmise piiride põhjendus — „eri eelnõud: 881 SE vs 1017 SE". */
.item-candidate__warning {
    display: inline-block;
    margin-left: 8px;
    padding: 1px 6px;
    background: #fdf0e9;
    border: 1px solid var(--alx-warning);
    border-radius: 4px;
    color: #8a4526;
    font-size: 12px;
}
.item-candidate__actions { display: inline-flex; gap: 6px; margin-left: 8px; }
.item-candidate__actions .btn[disabled] { opacity: 0.5; cursor: not-allowed; }

/* Algataja ja objekti tõenäosus — ärikaalu seletus. */
.item-probability { display: block; margin-top: 2px; }
.item-detail__probability {
    margin: 4px 0 12px;
    color: var(--muted);
    font-size: 13px;
}

/* Objekti detailvaade. */
.item-detail__grid {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(240px, 1fr);
    gap: 24px;
}
@media (max-width: 900px) {
    .item-detail__grid { grid-template-columns: minmax(0, 1fr); }
}
.item-detail__head { margin-bottom: 12px; }
.item-detail__title { margin: 4px 0; }
.item-detail__scores { display: flex; flex-wrap: wrap; gap: 10px; font-size: 13px; }
.item-detail__summary { line-height: 1.5; }
.item-detail__subhead { margin: 12px 0 4px; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-2); }
.item-detail__summary-meta { margin-top: 4px; }
.item-detail__summary-actions { display: flex; gap: 8px; align-items: flex-start; flex-wrap: wrap; margin: 8px 0 4px; }
.item-detail__summary-edit { flex: 1 1 100%; }
.item-detail__summary-edit > summary { display: inline-block; cursor: pointer; list-style: none; }
.item-detail__summary-edit > summary::-webkit-details-marker { display: none; }
.item-detail__summary-edit textarea { width: 100%; min-width: 0; resize: vertical; font: inherit; }
.item-detail__why { color: var(--ink-2); }
.item-detail__list { margin: 0; padding-left: 18px; }
.item-detail__side > section { margin-bottom: 18px; }
.item-detail__form { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.item-detail__form--inline { margin: 0; }
/* Käsitsi hinnangu vorm avaneb badge'ide alla terve laiuse peal. */
.item-detail__score-edit { flex: 1 1 100%; }
.item-detail__score-edit > summary { display: inline-block; cursor: pointer; list-style: none; }
.item-detail__score-edit > summary::-webkit-details-marker { display: none; }
.item-detail__score-edit textarea { width: 100%; min-width: 0; resize: vertical; font: inherit; }
.item-read-toggle { display: inline-flex; margin: 0; }
/* „käsitsi" märk skooripilli sees — pill ise kannab juba värvi. */
.score-pill__manual {
    margin-left: 4px;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: .04em;
    opacity: .85;
}

.meta-chip--deadline { border-color: var(--alx-warning); }

/* Teated (salvestatud / viga). */
.flash {
    border-radius: 6px;
    padding: 8px 12px;
    margin-bottom: 12px;
    font-size: 13px;
}
.flash--ok { background: #e8f5ef; color: #1f5c46; }
.flash--error { background: #fdecec; color: #8a2626; }

/* === Seaded: ärikontekst ja ärialad täislaiuses === */
.settings-main--wide { max-width: none; padding: 24px 32px 48px; }

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

.context-editor-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 20px;
    align-items: start;
}
.context-editor-pane { display: flex; flex-direction: column; min-width: 0; }
.context-editor-textarea {
    width: 100%;
    /* `rows="60"` annab põhikõrguse; siin ainult alampiir kitsal ekraanil. */
    min-height: 480px;
    resize: vertical;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--input-bg);
    color: var(--text);
}
.context-editor-counter {
    margin: 6px 0 0;
    font-size: 12px;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}
.context-editor-counter--over { color: var(--danger, #d64545); font-weight: 600; }
.context-preview {
    margin-top: 6px;
    min-height: 480px;
    /* Eelvaade järgib redaktori kõrgust, ülejäänu kerib. */
    max-height: 80vh;
    overflow-y: auto;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface-muted);
}
.context-preview:empty::before {
    content: "Salvestatud faktibaas on tühi.";
    color: var(--muted);
    font-size: 13px;
}
.context-contract { margin-top: 16px; }
@media (max-width: 1100px) {
    .context-editor-grid { grid-template-columns: 1fr; }
    .context-editor-textarea, .context-preview { min-height: 260px; }
    .context-preview { max-height: 50vh; }
}

.settings-areas-table { width: 100%; table-layout: fixed; }
.settings-areas-table input[type="text"],
.settings-areas-table textarea,
.settings-areas-table select {
    width: 100%;
    padding: 5px 7px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--input-bg);
    color: var(--text);
    font-size: 13px;
}
.settings-areas-table textarea { resize: vertical; line-height: 1.35; }
.settings-areas-table .areas-col-key { width: 11rem; }
.settings-areas-table .areas-col-key input {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 12px;
}
.settings-areas-table .areas-col-nimi { width: 16rem; }
.settings-areas-table .areas-col-nimi input { white-space: normal; }
.settings-areas-table .areas-col-fakt { width: auto; }
.settings-areas-table .areas-col-kaal { width: 4.5rem; }
.settings-areas-table .areas-col-staatus { width: 9rem; }
.settings-areas-table .areas-col-delete { width: 5rem; text-align: center; }
.settings-areas-table td { vertical-align: top; }
.areas-row--sentinel .areas-key-input { opacity: 0.7; cursor: not-allowed; }
.areas-help { max-width: 70ch; }

/* === Dokumendivaade: ärikaalu plokk === */
.doc-arikaal-section { margin-top: 20px; }
.doc-arikaal-head {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}
.doc-arikaal-head h3 { margin: 0; }
.doc-arikaal-manual { margin: 0 0 10px; }
.doc-arikaal-table { margin-bottom: 12px; }
.doc-arikaal-table .cell-meta { display: block; }
.doc-arikaal-reason { font-size: 12px; line-height: 1.4; }
.doc-arikaal-row--skipped { opacity: 0.6; }
.doc-arikaal-facts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 10px 20px;
    margin: 0 0 12px;
}
.doc-arikaal-facts dt { font-size: 12px; color: var(--muted); font-weight: 600; }
.doc-arikaal-facts dd { margin: 2px 0 0; font-size: 13px; }
.doc-arikaal-formula { font-size: 12px; white-space: normal; }
.doc-arikaal-limits ul { margin: 4px 0 0; padding-left: 20px; font-size: 12px; color: var(--muted); }
.doc-arikaal-edit summary { cursor: pointer; font-size: 13px; font-weight: 600; }
.doc-arikaal-form {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    flex-wrap: wrap;
    margin-top: 8px;
}
.doc-arikaal-form__note { flex: 1 1 320px; }
.doc-arikaal-form textarea,
.doc-arikaal-form select {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--input-bg);
    color: var(--text);
}
.meta-chip--manual {
    background: rgba(255, 196, 120, 0.18);
    border: 1px solid rgba(255, 196, 120, 0.45);
}
.meta-chip--warn {
    background: rgba(230, 126, 34, 0.14);
    border: 1px solid rgba(230, 126, 34, 0.4);
}
.doc-no-finding-hint { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* === Nädalaraport: /reports loend, üks raport, profiil, loobumisleht ===
   Ühtki uut värvi siin ei ole: kõik tuleb samadest `--alx-*` ja semantilistest
   tokenitest, mida objektivaade kasutab, seega tume ja hele teema tulevad
   kaasa ilma eraldi reegliteta. */

.reports-table td { vertical-align: middle; }
/* Toimingud ühel real: „Vaata", „Peida"/„Taasta", „Kustuta". */
.reports-table__actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.reports-table__actions .inline-form { display: inline; margin: 0; }
/* Peidetud versioon jääb nähtavaks, aga tagaplaanile. */
.reports-row--hidden td { opacity: 0.7; }
.report-generate-form { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; margin: 0; }
.report-generate-form .btn-sm { margin-bottom: 0; }

.report-status {
    font-size: 11px;
    border-radius: 999px;
    padding: 1px 8px;
    background: var(--surface-muted);
    color: var(--muted);
    white-space: nowrap;
}
.report-status--sent { background: var(--success-bg); color: var(--success-text); }
.report-status--failed { background: var(--error-bg); color: var(--error-text); }
.report-status--fallback { background: var(--warning-bg); color: var(--warning-text); }

.report-actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 16px; }
.report-actions form { margin: 0; }
.report-actions .btn-sm { margin-bottom: 0; }

/* Kaardid: sama rütm nagu objektivaate leiukaartidel — vasak serv kannab
   muutuse märgise värvi, ülejäänu on paneeli sees. */
.report-cards { display: flex; flex-direction: column; gap: 12px; margin: 8px 0 4px; }
.report-card {
    border: 1px solid var(--border);
    border-left: 3px solid var(--border);
    border-radius: 6px;
    background: var(--surface-muted);
    padding: 12px 14px;
}
.report-card--uus { border-left-color: var(--alx-brand-dark); }
.report-card--liikus { border-left-color: var(--alx-success); }
.report-card--taienes { border-left-color: var(--alx-grey-50); }
.report-card__meta {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    font-size: 12px;
    color: var(--muted);
    margin-bottom: 6px;
}
.report-card__rank { font-weight: 700; color: var(--text); }
.report-card__marker { font-size: 11px; color: var(--muted); white-space: nowrap; }
.report-card__title { margin: 0; font-size: 15px; line-height: 1.35; }
.report-card__title a { color: var(--text); text-decoration: none; }
.report-card__title a:hover { text-decoration: underline; }
.report-card__subtitle { margin: 2px 0 0; font-size: 12px; color: var(--muted); }
.report-card__areas { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 8px; }
.report-card__why { margin: 8px 0 0; font-size: 13px; line-height: 1.5; }
.report-card__todo { margin: 6px 0 0; font-size: 13px; line-height: 1.5; }
.report-card__deadline { margin: 6px 0 0; font-size: 12px; color: var(--warning-text); }

/* Objektilink keset lauset (`weekly_report_render.linkify_objects`). Kirjas
   kannab sama `<a>` inline-värvi, sest e-kirjas välist CSS-i ei ole. */
.report-inline-link { color: var(--alx-brand-dark); text-decoration: none; border-bottom: 1px dotted currentColor; }
.report-inline-link:hover { text-decoration: none; border-bottom-style: solid; }
[data-theme="dark"] .report-inline-link { color: var(--alx-brand); }

.report-list { margin: 8px 0 4px; padding-left: 18px; font-size: 13px; line-height: 1.55; }
.report-list li { margin-bottom: 6px; }
.report-list a { color: var(--text); }
.report-list__note { display: block; font-size: 12px; color: var(--muted); }
.report-list--minor { columns: 2; column-gap: 24px; }
.report-list--minor li { break-inside: avoid; }
@media (max-width: 900px) {
    .report-list--minor { columns: 1; }
}
.report-list--deadlines { list-style: none; padding-left: 0; }
.report-list__date {
    display: inline-block;
    min-width: 88px;
    font-weight: 700;
    color: var(--warning-text);
}
.report-side__note { margin: 6px 0 0; font-size: 12px; color: var(--muted); }

/* Kiri liivakastis: raam on nii kõrge, et kaardid mahuksid ilma sisemise
   kerimiseta ära, ja valge taust on kirja enda oma (kiri ei kohane teemaga). */
.report-letter {
    width: 100%;
    height: 720px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: #ffffff;
}

.profile-panel { max-width: 720px; }
.profile-form { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin: 8px 0 12px; }
.profile-form .btn-sm { margin-bottom: 0; }

.unsubscribe-main { max-width: 640px; margin: 48px auto; padding: 0 20px; }
.unsubscribe-panel h2 { margin-bottom: 12px; }
.unsubscribe-form { margin: 16px 0 8px; }
.unsubscribe-form .btn-sm { margin-bottom: 0; }
