/* ════════════════════════════════════════════════════════════════
   FarDU ITM v3 — Modern admin design system
   • System font stack (no Google Fonts → 0 extra HTTP, 0 FOUT)
   • Light + dark themes via [data-theme="dark"] on <html>
   • ~25 KB minified, designed for fast Jinja SSR (low server RAM)
   • Backwards-compatible with all existing inline `var(--xxx)` styles
   ═══════════════════════════════════════════════════════════════ */

/* ════════════ 1. Tokens ════════════ */
:root {
    /* Surfaces */
    --bg:           #F7F7F8;
    --surface:      #FFFFFF;
    --surface-2:    #F2F2F4;
    --surface-3:    #EBEBEE;
    --surface-hover:#F4F4F6;

    /* Borders */
    --border:       #E4E4E7;
    --border-strong:#D4D4D8;

    /* Text */
    --text:         #0F1011;
    --text-2:       #525258;
    --text-3:       #80818A;
    --text-4:       #A8A9B0;
    --text-on-accent:#FFFFFF;

    /* Accent — modern indigo, Linear-flavor */
    --accent:       #5E5CE6;
    --accent-hover: #4845D2;
    --accent-active:#3E3BC5;
    --accent-soft:  #EFEEFD;
    --accent-border:#D6D5F7;

    /* Status */
    --success:      #1F9A6E;
    --success-soft: #E5F6EE;
    --warning:      #B07012;
    --warning-soft: #FCF1DF;
    --danger:       #B5443A;
    --danger-soft:  #FAEAE7;
    --info:         #1E6FA8;
    --info-soft:    #E5F0F9;
    --teal:         #0E8B8C;
    --teal-soft:    #E0F2F2;
    --purple:       #6E48AB;
    --purple-soft:  #EFE9F7;

    /* Shadows — soft, not heavy */
    --shadow-xs:    0 1px 1px rgb(15 16 17 / 0.04);
    --shadow-sm:    0 1px 2px rgb(15 16 17 / 0.05), 0 1px 1px rgb(15 16 17 / 0.03);
    --shadow:       0 2px 6px -1px rgb(15 16 17 / 0.06), 0 1px 2px rgb(15 16 17 / 0.04);
    --shadow-md:    0 6px 16px -4px rgb(15 16 17 / 0.08), 0 2px 4px rgb(15 16 17 / 0.04);
    --shadow-lg:    0 16px 32px -12px rgb(15 16 17 / 0.10), 0 4px 8px rgb(15 16 17 / 0.05);

    /* Radii */
    --r-xs: 4px; --r-sm: 6px; --r:    8px; --r-md: 10px; --r-lg: 12px; --r-xl: 16px; --r-full: 999px;

    /* Spacing scale (4px grid) */
    --s-1: 4px;  --s-2: 8px;  --s-3: 12px;
    --s-4: 16px; --s-5: 20px; --s-6: 24px;
    --s-7: 32px; --s-8: 40px; --s-9: 48px; --s-10: 64px;

    /* Type — system stack, weights via numeric */
    --font-sans: ui-sans-serif, -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
    --font-mono: ui-monospace, 'SF Mono', 'JetBrains Mono', 'Cascadia Code', Menlo, Consolas, monospace;

    --t-fast:   100ms cubic-bezier(0.4, 0, 0.2, 1);
    --t:        160ms cubic-bezier(0.4, 0, 0.2, 1);
    --t-slow:   260ms cubic-bezier(0.4, 0, 0.2, 1);

    /* Sidebar */
    --sb-w:     232px;
    --sb-bg:    #18181C;
    --sb-bg-2:  #1F1F24;
    --sb-text:  rgba(255,255,255,0.74);
    --sb-text-2:rgba(255,255,255,0.50);
    --sb-text-3:rgba(255,255,255,0.36);
    --sb-active-bg:rgba(94,92,230,0.16);
    --sb-active-fg:#FFFFFF;
    --sb-border:rgba(255,255,255,0.06);

    /* ── Legacy aliases — keep all existing inline styles working ── */
    --slate-50: var(--surface-2); --slate-100: var(--surface-3); --slate-200: var(--border);
    --slate-300: var(--border-strong); --slate-400: var(--text-4); --slate-500: var(--text-3);
    --slate-600: var(--text-2); --slate-700: var(--text-2); --slate-800: var(--text); --slate-900: #000;

    --blue-50: var(--accent-soft); --blue-100: var(--accent-border); --blue-200: #CDCBF3;
    --blue-500: var(--accent); --blue-600: var(--accent); --blue-700: var(--accent-hover);
    --blue-800: var(--accent-active); --blue-900: #2B2A91;

    --green-50: var(--success-soft); --green-100: #CFEEDE; --green-500: #2EA579;
    --green-600: var(--success); --green-700: #196A4D;
    --teal-50: var(--teal-soft); --teal-100: #C0E2E2; --teal-500: var(--teal); --teal-600: var(--teal);
    --yellow-50: var(--warning-soft); --yellow-100: #F4E0BD; --yellow-500: #D08A20;
    --yellow-600: var(--warning); --yellow-700: #885812;
    --red-50: var(--danger-soft); --red-100: #F2C9C2; --red-500: #C25448;
    --red-600: var(--danger); --red-700: #803128;
    --indigo-50: var(--accent-soft); --indigo-500: var(--accent); --indigo-600: var(--accent-hover);
    --purple-50: var(--purple-soft); --purple-500: var(--purple); --purple-600: var(--purple); --purple-700: #573789;
}

/* ── Dark theme overrides ── */
:root[data-theme="dark"] {
    --bg:           #0E0E10;
    --surface:      #16161A;
    --surface-2:    #1B1B1F;
    --surface-3:    #232329;
    --surface-hover:#1F1F24;

    --border:       rgba(255,255,255,0.08);
    --border-strong:rgba(255,255,255,0.14);

    --text:         #FAFAFA;
    --text-2:       #B4B5BD;
    --text-3:       #82838C;
    --text-4:       #5E5F66;

    --accent:       #7C7AEC;
    --accent-hover: #918FF0;
    --accent-active:#A6A4F4;
    --accent-soft:  rgba(124,122,236,0.14);
    --accent-border:rgba(124,122,236,0.32);

    --success:      #34C28C;  --success-soft: rgba(52,194,140,0.12);
    --warning:      #DEAA42;  --warning-soft: rgba(222,170,66,0.12);
    --danger:       #E0625A;  --danger-soft:  rgba(224,98,90,0.12);
    --info:         #5AAEDF;  --info-soft:    rgba(90,174,223,0.12);
    --teal:         #4FC1C2;  --teal-soft:    rgba(79,193,194,0.12);
    --purple:       #B594E2;  --purple-soft:  rgba(181,148,226,0.12);

    --shadow-xs:    0 1px 1px rgb(0 0 0 / 0.30);
    --shadow-sm:    0 1px 2px rgb(0 0 0 / 0.32), 0 1px 1px rgb(0 0 0 / 0.20);
    --shadow:       0 2px 6px -1px rgb(0 0 0 / 0.36), 0 1px 2px rgb(0 0 0 / 0.20);
    --shadow-md:    0 6px 16px -4px rgb(0 0 0 / 0.42), 0 2px 4px rgb(0 0 0 / 0.24);
    --shadow-lg:    0 16px 32px -12px rgb(0 0 0 / 0.48), 0 4px 8px rgb(0 0 0 / 0.28);

    --sb-bg:        #0A0A0C;
    --sb-bg-2:      #131316;
    --sb-text:      rgba(255,255,255,0.78);
    --sb-text-2:    rgba(255,255,255,0.52);
    --sb-text-3:    rgba(255,255,255,0.38);
    --sb-active-bg: rgba(124,122,236,0.18);
    --sb-active-fg: #FFFFFF;
    --sb-border:    rgba(255,255,255,0.05);
}

/* ════════════ 2. Reset & base ════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
html { color-scheme: light; }
html[data-theme="dark"] { color-scheme: dark; }

body {
    font-family: var(--font-sans);
    font-size: 14px;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg);
    min-height: 100vh;
    text-rendering: optimizeLegibility;
    font-feature-settings: "ss01", "cv11";
}

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

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }

img, svg { display: block; max-width: 100%; }
button { font: inherit; color: inherit; cursor: pointer; }

h1, h2, h3, h4, h5 { color: var(--text); letter-spacing: -0.011em; line-height: 1.2; font-weight: 600; }
h1 { font-size: 22px; }
h2 { font-size: 18px; }
h3 { font-size: 16px; }
h4 { font-size: 14px; }

code { font-family: var(--font-mono); font-size: 0.85em; background: var(--surface-2); padding: 1px 5px; border-radius: var(--r-xs); color: var(--text-2); }
pre { font-family: var(--font-mono); font-size: 12px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r); padding: 12px 14px; overflow-x: auto; line-height: 1.5; color: var(--text-2); }
pre code { background: transparent; padding: 0; }

hr { border: none; border-top: 1px solid var(--border); margin: var(--s-5) 0; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 999px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: var(--border-strong); background-clip: padding-box; }

/* Focus ring */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--r-xs); }
button:focus-visible, .btn:focus-visible { outline-offset: 1px; }

/* ════════════ 3. Layout shell ════════════ */
.app-shell { display: flex; min-height: 100vh; }

/* ── Sidebar ── */
.sidebar {
    position: fixed; inset: 0 auto 0 0;
    width: var(--sb-w); height: 100vh;
    background: var(--sb-bg);
    color: var(--sb-text);
    display: flex; flex-direction: column;
    z-index: 50;
    border-right: 1px solid var(--sb-border);
}
.sidebar-brand {
    display: flex; align-items: center; gap: 10px;
    padding: 18px 16px 14px;
    border-bottom: 1px solid var(--sb-border);
}
.brand-icon {
    width: 28px; height: 28px;
    background: linear-gradient(135deg, var(--accent) 0%, #8E8CF0 100%);
    border-radius: 7px;
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 700; color: #FFF;
    letter-spacing: 0;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.18);
}
.brand-title { font-size: 13px; font-weight: 600; color: #FFF; line-height: 1.2; letter-spacing: -0.01em; }
.brand-sub   { font-size: 10.5px; color: var(--sb-text-3); margin-top: 2px; line-height: 1.3; letter-spacing: 0.005em; font-weight: 400; }

.sidebar-nav { flex: 1; overflow-y: auto; padding: 8px 8px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); }

.nav-section {
    font-size: 10px; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.06em;
    color: var(--sb-text-3);
    padding: 14px 10px 6px;
}

.sidebar-nav a {
    display: flex; align-items: center; gap: 10px;
    padding: 7px 10px;
    margin: 1px 0;
    color: var(--sb-text);
    text-decoration: none;
    font-size: 13px; font-weight: 450;
    border-radius: var(--r-sm);
    transition: background var(--t-fast), color var(--t-fast);
    position: relative;
}
.sidebar-nav a:hover { background: rgba(255,255,255,0.04); color: #FFF; text-decoration: none; }
.sidebar-nav a.active { background: var(--sb-active-bg); color: var(--sb-active-fg); font-weight: 500; }
.sidebar-nav a.active::before {
    content: ''; position: absolute; left: -8px; top: 8px; bottom: 8px; width: 2px;
    background: var(--accent); border-radius: 0 2px 2px 0;
}
.sidebar-nav a svg { width: 15px; height: 15px; flex-shrink: 0; opacity: 0.7; stroke-width: 1.7; }
.sidebar-nav a.active svg { opacity: 1; color: var(--accent); }
.sidebar-nav a .badge-new {
    margin-left: auto;
    font-size: 9px; font-weight: 700;
    padding: 1px 5px; border-radius: 3px;
    background: var(--accent); color: #FFF;
    letter-spacing: 0.04em;
}

.sidebar-footer {
    padding: 10px 12px;
    border-top: 1px solid var(--sb-border);
    display: flex; align-items: center; justify-content: space-between;
    gap: 8px;
}
.sidebar-footer a {
    display: inline-flex; align-items: center; gap: 6px;
    color: var(--sb-text-2); text-decoration: none;
    font-size: 12px; font-weight: 450;
    transition: color var(--t-fast);
}
.sidebar-footer a:hover { color: #FFF; text-decoration: none; }
.sidebar-footer a svg { width: 14px; height: 14px; opacity: 0.7; }

.theme-toggle {
    display: flex; align-items: center; justify-content: center;
    width: 28px; height: 28px;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--sb-border);
    border-radius: var(--r-sm);
    color: var(--sb-text-2);
    cursor: pointer;
    transition: all var(--t-fast);
}
.theme-toggle:hover { color: #FFF; background: rgba(255,255,255,0.08); }
.theme-toggle svg { width: 14px; height: 14px; }

/* Locale switcher (sidebar footer) — three flat letter pills (UZ/RU/EN). */
.locale-switcher {
    display: inline-flex;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--sb-border);
    border-radius: var(--r-sm);
    overflow: hidden;
}
.locale-switcher .locale-opt {
    padding: 4px 7px;
    font-size: 10px; font-weight: 600; letter-spacing: 0.04em;
    color: var(--sb-text-3);
    text-decoration: none;
    transition: all var(--t-fast);
    border-right: 1px solid var(--sb-border);
}
.locale-switcher .locale-opt:last-child { border-right: none; }
.locale-switcher .locale-opt:hover { color: #FFF; background: rgba(255,255,255,0.06); text-decoration: none; }
.locale-switcher .locale-opt.is-active {
    color: #FFF;
    background: var(--accent);
}
.locale-switcher .locale-opt.is-active:hover { background: var(--accent-hover); }

/* ── Main column ── */
.main { margin-left: var(--sb-w); flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
    position: sticky; top: 0; z-index: 30;
    height: 48px; padding: 0 24px;
    background: rgba(247,247,248,0.85);
    backdrop-filter: saturate(140%) blur(8px);
    -webkit-backdrop-filter: saturate(140%) blur(8px);
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; gap: 12px;
}
[data-theme="dark"] .topbar { background: rgba(14,14,16,0.85); }
.topbar .crumb { font-size: 12.5px; color: var(--text-2); display: flex; align-items: center; gap: 6px; }
.topbar .crumb b { color: var(--text); font-weight: 500; }
.topbar .crumb svg { width: 12px; height: 12px; opacity: 0.4; }
.topbar .grow { flex: 1; }
.topbar .meta { font-size: 12px; color: var(--text-3); }

.content { padding: 24px 24px 64px; min-height: calc(100vh - 48px); }

/* ════════════ 4. Page elements ════════════ */
.page-header {
    display: flex; align-items: flex-start; justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}
.page-title { font-size: 22px; font-weight: 600; letter-spacing: -0.018em; color: var(--text); line-height: 1.2; }
.page-subtitle { font-size: 13px; color: var(--text-2); margin-top: 4px; }

/* ════════════ 5. Buttons ════════════ */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 6px 12px;
    font-size: 13px; font-weight: 500; line-height: 1.4;
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    cursor: pointer; text-decoration: none;
    transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast), box-shadow var(--t-fast);
    white-space: nowrap;
    box-shadow: var(--shadow-xs);
}
.btn:hover { background: var(--surface-hover); border-color: var(--border-strong); text-decoration: none; }
.btn:active { box-shadow: none; transform: translateY(0.5px); }
.btn-sm { padding: 4px 9px; font-size: 12px; gap: 4px; }
.btn-lg { padding: 9px 16px; font-size: 14px; }

.btn-primary {
    background: var(--accent);
    color: var(--text-on-accent);
    border-color: transparent;
    box-shadow: 0 1px 0 inset rgba(255,255,255,0.16), var(--shadow-xs);
}
.btn-primary:hover { background: var(--accent-hover); border-color: transparent; color: var(--text-on-accent); }
.btn-primary:active { background: var(--accent-active); }

/* .btn-outline — alias for default .btn (kept as a marker class only) */
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); box-shadow: none; }
.btn-ghost:hover { background: var(--surface-hover); border-color: transparent; color: var(--text); }

.btn-danger { background: var(--danger); color: #FFF; border-color: transparent; }
.btn-danger:hover { background: #9F3A30; color: #FFF; }

.btn-success { background: var(--success); color: #FFF; border-color: transparent; }
.btn-success:hover { background: #198458; color: #FFF; }

.btn[disabled], .btn:disabled { opacity: 0.55; cursor: not-allowed; }

.btn svg { width: 14px; height: 14px; flex-shrink: 0; }

/* ════════════ 6. Cards ════════════ */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: 20px;
    box-shadow: var(--shadow-xs);
}
.card + .card { margin-top: 16px; }
.card-title {
    font-size: 14px; font-weight: 600; color: var(--text);
    margin-bottom: 16px;
    display: flex; align-items: center; gap: 8px;
    letter-spacing: -0.01em;
}
.card-padded { padding: 24px; }
.card-flush { padding: 0; overflow: hidden; }
.card-flush .card-header,
.card-flush .card-footer { padding: 14px 18px; }
.card-flush .card-header { border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.card-flush table { border-radius: 0; }

/* ════════════ 7. Stats / metrics ════════════ */
.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
}
.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: 16px;
    display: flex; align-items: flex-start; gap: 12px;
    box-shadow: var(--shadow-xs);
    transition: box-shadow var(--t), border-color var(--t), transform var(--t);
    position: relative;
}
.stat-card:hover { box-shadow: var(--shadow-sm); border-color: var(--border-strong); transform: translateY(-1px); }
a.stat-card { color: inherit; text-decoration: none; }
a.stat-card:hover { text-decoration: none; }
.stat-icon {
    width: 36px; height: 36px;
    border-radius: 9px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    font-size: 16px;
}
.stat-icon svg { width: 18px; height: 18px; stroke-width: 1.8; }
.stat-value { font-size: 22px; font-weight: 600; line-height: 1.15; letter-spacing: -0.022em; color: var(--text); }
.stat-label { font-size: 11px; color: var(--text-3); margin-top: 2px; text-transform: uppercase; letter-spacing: 0.05em; font-weight: 500; }

/* ════════════ 8. Tables ════════════ */
.table-responsive { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th {
    font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em;
    color: var(--text-3); font-weight: 500;
    padding: 10px 14px;
    text-align: left;
    background: var(--surface-2);
    border-bottom: 1px solid var(--border);
    position: sticky; top: 0;
}
.card td, .card th { padding: 10px 14px; }
td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    color: var(--text-2);
    vertical-align: middle;
}
td b, td strong { color: var(--text); font-weight: 500; }
tbody tr { transition: background var(--t-fast); }
tbody tr:hover { background: var(--surface-2); }
tbody tr:last-child td { border-bottom: none; }

/* ════════════ 9. Badges (status pills) ════════════ */
.badge, [class*="badge-"] {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 2px 8px;
    border-radius: var(--r-full);
    font-size: 11.5px; font-weight: 500;
    letter-spacing: 0;
    line-height: 1.4;
    border: 1px solid transparent;
}
.badge-success, .badge-green, .badge-approved, .badge-completed, .badge-active, .badge-accepted { background: var(--success-soft); color: var(--success); }
.badge-warning, .badge-yellow, .badge-pending, .badge-returned, .badge-partially_completed, .badge-supervisor_review { background: var(--warning-soft); color: var(--warning); }
.badge-danger, .badge-red, .badge-rejected, .badge-overdue, .badge-mandatory { background: var(--danger-soft); color: var(--danger); }
.badge-info, .badge-blue, .badge-submitted, .badge-planned { background: var(--accent-soft); color: var(--accent-active); }
.badge-purple, .badge-in_review, .badge-under_review, .badge-in_progress { background: var(--purple-soft); color: var(--purple); }
.badge-teal { background: var(--teal-soft); color: var(--teal); }
.badge-gray, .badge-slate, .badge-draft, .badge-archived, .badge-cancelled { background: var(--surface-3); color: var(--text-2); }

/* ════════════ 10. Forms ════════════ */
.form-group { margin-bottom: 14px; }
.form-group label {
    display: block;
    font-size: 12px; font-weight: 500;
    color: var(--text-2);
    margin-bottom: 6px;
    letter-spacing: 0;
}
.form-control {
    width: 100%;
    padding: 7px 10px;
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    font-size: 13px;
    font-family: inherit;
    transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
    box-shadow: var(--shadow-xs);
}
.form-control::placeholder { color: var(--text-4); }
.form-control:hover { border-color: var(--border-strong); }
.form-control:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
    background: var(--surface);
}
textarea.form-control { resize: vertical; min-height: 72px; line-height: 1.5; }
select.form-control { cursor: pointer; padding-right: 28px; appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2380818A' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 8px center;
}

.filters { display: flex; gap: 12px; flex-wrap: wrap; align-items: end; }
.filters .form-group { margin-bottom: 0; }

/* ════════════ 11. Alerts ════════════ */
.alert {
    padding: 10px 14px;
    border-radius: var(--r-sm);
    margin-bottom: 14px;
    font-size: 13px;
    display: flex; align-items: flex-start; gap: 8px;
    border: 1px solid;
    line-height: 1.5;
}
/* Fallback border-color for browsers without color-mix support (pre-2023). */
.alert-success { background: var(--success-soft); color: var(--success); border-color: var(--success-soft); }
.alert-error   { background: var(--danger-soft);  color: var(--danger);  border-color: var(--danger-soft); }
.alert-warning { background: var(--warning-soft); color: var(--warning); border-color: var(--warning-soft); }
.alert-info    { background: var(--info-soft);    color: var(--info);    border-color: var(--info-soft); }
@supports (border-color: color-mix(in srgb, red, blue)) {
    .alert-success { border-color: color-mix(in srgb, var(--success) 25%, transparent); }
    .alert-error   { border-color: color-mix(in srgb, var(--danger) 25%, transparent); }
    .alert-warning { border-color: color-mix(in srgb, var(--warning) 25%, transparent); }
    .alert-info    { border-color: color-mix(in srgb, var(--info) 25%, transparent); }
}

/* ════════════ 12. Detail rows ════════════ */
.detail-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.detail-item { padding: 6px 0; }
.detail-item .label { font-size: 11px; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.04em; font-weight: 500; }
.detail-item .value { font-size: 14px; margin-top: 2px; color: var(--text); }

/* ════════════ 13. Pagination ════════════ */
.pagination { display: flex; gap: 4px; justify-content: center; margin-top: 16px; }
.pagination a {
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    text-decoration: none; color: var(--text-2);
    font-size: 12.5px; font-weight: 500;
    background: var(--surface);
    transition: all var(--t-fast);
}
.pagination a:hover { background: var(--surface-hover); border-color: var(--border-strong); color: var(--text); text-decoration: none; }
.pagination a.active { background: var(--accent); color: #FFF; border-color: transparent; }

/* ════════════ 14. Sortable table headers ════════════ */
.sortable-th .sort-link {
    display: inline-flex; align-items: center; gap: 4px;
    color: var(--text-3); text-decoration: none;
    transition: color var(--t-fast);
}
.sortable-th .sort-link:hover { color: var(--text); text-decoration: none; }
.sortable-th .sort-link.active { color: var(--accent); }

/* ════════════ 15. Details / disclosure ════════════ */
details > summary {
    cursor: pointer;
    user-select: none;
    padding: 4px 0;
    list-style: none;
    transition: color var(--t-fast);
}
details > summary::-webkit-details-marker { display: none; }
details > summary::before {
    content: "›";
    display: inline-block;
    transform: rotate(0deg);
    transition: transform var(--t-fast);
    margin-right: 6px;
    color: var(--text-3);
    font-weight: 600;
}
details[open] > summary::before { transform: rotate(90deg); }
details[open] > summary { margin-bottom: 8px; }
details > summary:hover { color: var(--accent); }

/* ════════════ 16. Modal ════════════ */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(15, 16, 17, 0.50);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex; align-items: center; justify-content: center;
    animation: fadein var(--t) ease-out;
}
.modal-content {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    width: 90vw; max-width: 880px; max-height: 90vh;
    display: flex; flex-direction: column;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    animation: zoomin var(--t) cubic-bezier(0.16, 1, 0.3, 1);
}
.modal-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 14px 18px; border-bottom: 1px solid var(--border);
}
.modal-body { flex: 1; overflow: auto; min-height: 280px; padding: 4px; }
.modal-body iframe { width: 100%; height: 75vh; border: none; }
.modal-body img { max-width: 100%; max-height: 75vh; display: block; margin: 16px auto; }

@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
@keyframes zoomin { from { opacity: 0; transform: translateY(8px) scale(0.98); } to { opacity: 1; transform: none; } }

/* ════════════ 17. Login screen ════════════ */
.login-shell {
    min-height: 100vh; display: grid;
    grid-template-columns: 1fr;
    align-items: center; justify-items: center;
    padding: 24px;
    background: var(--bg);
}

/* 2-pane variant: brand storytelling on the left, form on the right */
.login-2pane {
    min-height: 100vh; display: grid;
    grid-template-columns: 1fr;
    background: var(--bg);
}
@media (min-width: 1024px) {
    .login-2pane { grid-template-columns: minmax(480px, 1fr) minmax(480px, 0.92fr); }
}
.login-hero {
    display: none;
    position: relative;
    padding: 48px 56px;
    background: #17181D;
    color: rgba(255,255,255,0.92);
    overflow: hidden;
}
@media (min-width: 1024px) { .login-hero { display: flex; flex-direction: column; justify-content: space-between; } }
.login-hero::before { content: ''; position: absolute; inset: 0 0 auto; height: 1px; background: rgba(255,255,255,0.10); pointer-events: none; }
.login-hero > * { position: relative; z-index: 1; }
.login-hero .brand {
    display: inline-flex; align-items: center; gap: 12px;
    font-size: 16px; font-weight: 600; letter-spacing: 0;
}
.login-hero .brand small { display: block; font-size: 12px; color: rgba(255,255,255,0.55); margin-top: 2px; font-weight: 400; }
.login-hero .brand .brand-icon { background: var(--accent); width: 36px; height: 36px; font-size: 14px; }
.login-hero .pitch {
    margin-top: 72px;
    max-width: 460px;
}
.login-eyebrow {
    width: fit-content;
    color: rgba(255,255,255,0.66);
    background: rgba(255,255,255,0.07);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: var(--r-sm);
    padding: 5px 8px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0;
    margin-bottom: 14px;
}
.login-hero .pitch h1 {
    font-size: 32px; font-weight: 600; line-height: 1.18;
    color: #FFF; letter-spacing: 0;
    margin-bottom: 16px;
}
.login-hero .pitch p {
    font-size: 15px; line-height: 1.6;
    color: rgba(255,255,255,0.70);
    margin-bottom: 32px;
}
.login-hero .feature-list { display: grid; gap: 10px; max-width: 420px; }
.login-hero .feature-list li {
    list-style: none;
    display: flex; align-items: flex-start; gap: 10px;
    font-size: 13.5px;
    color: rgba(255,255,255,0.78);
}
.login-hero .feature-list li svg {
    width: 16px; height: 16px;
    color: var(--accent);
    flex-shrink: 0;
    margin-top: 2px;
}
.login-hero .footer-meta {
    font-size: 11px;
    color: rgba(255,255,255,0.40);
    letter-spacing: 0.01em;
}

.login-form-pane {
    display: flex; align-items: center; justify-content: center;
    padding: 32px 24px;
    background: var(--surface);
}
.login-form-pane .login-card {
    width: 100%; max-width: 440px;
    box-shadow: none; border: none; padding: 0;
    background: transparent;
}

.login-card {
    width: 100%; max-width: 408px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: 28px 28px 24px;
    box-shadow: var(--shadow);
}
.login-card .brand-row {
    display: flex; align-items: center; gap: 12px;
    margin-bottom: 22px;
}
.login-card .brand-row .brand-icon { width: 36px; height: 36px; font-size: 14px; border-radius: 9px; }
.login-card .brand-row h1 { font-size: 16px; font-weight: 600; letter-spacing: 0; color: var(--text); margin-bottom: 2px; }
.login-card .brand-row small { display: block; font-size: 12px; color: var(--text-3); font-weight: 400; line-height: 1.4; }

.login-card-head { margin-bottom: 18px; }
.login-kicker {
    color: var(--accent);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: uppercase;
    margin-bottom: 6px;
}
.login-card-head h2 {
    font-size: 24px;
    line-height: 1.18;
    letter-spacing: 0;
    margin-bottom: 8px;
}
.login-card-head p {
    color: var(--text-2);
    font-size: 13.5px;
    line-height: 1.55;
}

.login-divider {
    display: flex; align-items: center; gap: 12px;
    color: var(--text-4); font-size: 11px;
    text-transform: uppercase; letter-spacing: 0.06em; font-weight: 500;
    margin: 14px 0;
}
.login-divider::before, .login-divider::after {
    content: ''; flex: 1; height: 1px; background: var(--border);
}

.btn-google {
    display: flex; align-items: center; justify-content: center; gap: 10px;
    width: 100%;
    min-height: 44px;
    padding: 10px 16px;
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    background: var(--surface);
    color: var(--text);
    font-size: 13.5px; font-weight: 500;
    cursor: pointer; text-decoration: none;
    transition: all var(--t-fast);
    box-shadow: var(--shadow-xs);
}
.btn-google:hover { border-color: var(--border-strong); background: var(--surface-hover); text-decoration: none; }
.btn-google svg { width: 18px; height: 18px; flex-shrink: 0; }

.login-oauth-disabled {
    display: grid;
    gap: 4px;
    padding: 12px 14px;
    border: 1px solid var(--warning-soft);
    border-radius: var(--r-sm);
    background: var(--warning-soft);
    color: var(--text-2);
    font-size: 12.5px;
    line-height: 1.45;
}
.login-oauth-disabled strong { color: var(--text); font-size: 13px; }

.login-flow {
    display: grid;
    gap: 10px;
    margin-top: 18px;
}
.login-flow li {
    list-style: none;
    display: grid;
    grid-template-columns: 26px 1fr;
    gap: 10px;
    align-items: flex-start;
    padding: 12px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
}
.login-step-num {
    width: 26px;
    height: 26px;
    display: grid;
    place-items: center;
    border-radius: var(--r-sm);
    background: var(--accent-soft);
    color: var(--accent-active);
    font-size: 12px;
    font-weight: 700;
}
.login-flow strong { display: block; color: var(--text); font-size: 13px; line-height: 1.3; }
.login-flow small { display: block; color: var(--text-3); font-size: 12px; line-height: 1.45; margin-top: 2px; }

.login-audience {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 14px;
}
.login-audience span {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 4px 8px;
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    color: var(--text-2);
    background: var(--surface);
    font-size: 11.5px;
    line-height: 1.25;
}

.login-emergency {
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
}
.login-emergency summary {
    cursor: pointer;
    color: var(--text-2);
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 8px;
}
.login-emergency-note {
    color: var(--text-3);
    font-size: 12px;
    line-height: 1.45;
    margin-bottom: 12px;
}
.login-emergency-submit { width: 100%; justify-content: center; }

.login-footnote {
    text-align: center;
    margin-top: 18px;
    color: var(--text-3);
    font-size: 12px;
    line-height: 1.55;
}

@media (max-width: 1023px) {
    .login-form-pane {
        min-height: 100vh;
        align-items: flex-start;
        padding: 28px 20px;
        background: var(--bg);
    }
    .login-form-pane .login-card {
        max-width: 520px;
        margin: 0 auto;
        padding: 22px;
        background: var(--surface);
        border: 1px solid var(--border);
        border-radius: var(--r-lg);
        box-shadow: var(--shadow-sm);
    }
}

@media (max-width: 480px) {
    .login-form-pane { padding: 18px 14px; }
    .login-form-pane .login-card { padding: 18px; }
    .login-card-head h2 { font-size: 21px; }
    .login-flow li { grid-template-columns: 24px 1fr; padding: 10px; }
    .login-step-num { width: 24px; height: 24px; }
}

.auth-shell {
    min-height: 100vh;
    display: grid;
    align-items: start;
    justify-items: center;
    padding: 32px 20px;
    background: var(--bg);
}
.auth-panel {
    width: min(880px, 100%);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-sm);
    padding: 28px;
}
.auth-panel-sm { width: min(520px, 100%); }
.auth-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 22px;
}
.auth-title {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}
.auth-title h1 {
    font-size: 22px;
    letter-spacing: 0;
    margin-bottom: 4px;
}
.auth-title .brand-icon svg { width: 18px; height: 18px; }
.auth-title p {
    color: var(--text-3);
    font-size: 13px;
    line-height: 1.5;
}
.auth-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 32px;
    max-width: 100%;
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    padding: 7px 10px;
    color: var(--text-2);
    background: var(--surface-2);
    font-size: 12px;
    line-height: 1.3;
}
.auth-chip svg { width: 16px; height: 16px; flex-shrink: 0; }
.auth-context {
    display: grid;
    gap: 8px;
    margin: 0 0 18px;
    padding: 12px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
}
.auth-context-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.auth-context strong { color: var(--text); }
.auth-context small { display: block; color: var(--text-3); font-size: 12px; margin-top: 2px; }
.auth-steps {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin: 0 0 18px;
}
.auth-steps span {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 34px;
    padding: 8px 10px;
    border-radius: var(--r-sm);
    border: 1px solid var(--border);
    color: var(--text-2);
    background: var(--surface);
    font-size: 12px;
    line-height: 1.3;
}
.auth-steps b {
    display: grid;
    place-items: center;
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    border-radius: var(--r-xs);
    background: var(--accent-soft);
    color: var(--accent-active);
    font-size: 11px;
}
.auth-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.auth-form-grid .span-2 { grid-column: 1 / -1; }
.auth-section-label {
    grid-column: 1 / -1;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0;
    color: var(--text-3);
    padding-top: 8px;
}
.auth-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 22px;
}
.auth-primary-link { width: 100%; justify-content: center; margin-top: 10px; }
.auth-note {
    color: var(--text-3);
    font-size: 13px;
    line-height: 1.55;
    margin: 14px 0 0;
    text-align: center;
}
.auth-token-mini {
    margin-top: 14px;
    text-align: center;
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--text-3);
}

@media (max-width: 720px) {
    .auth-shell { padding: 20px 14px; }
    .auth-panel { padding: 20px; }
    .auth-head { align-items: flex-start; flex-direction: column; }
    .auth-form-grid { grid-template-columns: 1fr; }
    .auth-steps { grid-template-columns: 1fr; }
    .auth-actions { flex-direction: column-reverse; align-items: stretch; }
    .auth-actions .btn { justify-content: center; width: 100%; }
}

/* ════════════ 18. KBD, code blocks, kbd-style ════════════ */
kbd {
    display: inline-block;
    padding: 1px 6px;
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-2);
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-bottom-width: 2px;
    border-radius: var(--r-xs);
}

/* ════════════ 19. Utilities ════════════ */
.text-sm { font-size: 12px; }
.text-xs { font-size: 11px; }
.text-muted { color: var(--text-3); }
.text-success { color: var(--success); }
.text-danger  { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-accent  { color: var(--accent); }

.gap-1 { gap: 4px; } .gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; }
.flex { display: flex; } .grid { display: grid; }
.items-center { align-items: center; } .items-end { align-items: flex-end; }
.justify-between { justify-content: space-between; }

/* ════════════ 20. Responsive ════════════ */
@media (max-width: 1024px) {
    .stats-row { grid-template-columns: repeat(2, 1fr); }
    .content { padding: 20px 18px 48px; }
}
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); transition: transform var(--t); }
    .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-lg); }
    .main { margin-left: 0; }
    .topbar { padding: 0 14px; }
    .content { padding: 16px 14px 40px; }
    .stats-row, .detail-grid { grid-template-columns: 1fr; }
    .page-header { flex-direction: column; align-items: stretch; }
    .filters { flex-direction: column; align-items: stretch; }
    .filters .form-group { width: 100%; }
    .menu-toggle { display: flex !important; }
}
@media (max-width: 480px) {
    body { font-size: 13.5px; }
    .page-title { font-size: 19px; }
    .btn { padding: 5px 11px; font-size: 12.5px; }
    .card { padding: 14px; }
}

.menu-toggle {
    display: none;
    width: 32px; height: 32px;
    align-items: center; justify-content: center;
    background: transparent; border: 1px solid var(--border); border-radius: var(--r-sm);
    color: var(--text-2); cursor: pointer;
}

/* ════════════ 21. Reduced motion ════════════ */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ════════════ 22. Print ════════════ */
@media print {
    .sidebar, .topbar, .btn { display: none !important; }
    .main { margin-left: 0; }
    body { background: #fff; }
    .card { border-color: #ccc; box-shadow: none; }
}

/* ════════════ 23. Mini-bar charts (used by dashboard widgets) ════════════ */
.mini-bar { display: flex; align-items: center; gap: 8px; }
.mini-bar .track { flex: 1; height: 6px; background: var(--surface-3); border-radius: var(--r-full); overflow: hidden; }
.mini-bar .fill  { height: 100%; background: var(--accent); border-radius: var(--r-full); transition: width var(--t-slow); }
.mini-bar .fill.fill-success { background: var(--success); }
.mini-bar .fill.fill-warning { background: var(--warning); }
.mini-bar .fill.fill-danger  { background: var(--danger); }

/* ════════════ 24. Avatar / chip ════════════ */
.chip {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 3px 8px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--r-full);
    font-size: 12px; color: var(--text-2);
}

.skeleton {
    display: inline-block;
    background: linear-gradient(90deg, var(--surface-2) 0%, var(--surface-3) 50%, var(--surface-2) 100%);
    background-size: 200% 100%;
    animation: shimmer 1.4s ease-in-out infinite;
    border-radius: var(--r-xs);
}
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }

/* ════════════ 25. Link variants ════════════ */
.link { color: var(--accent); text-decoration: none; font-weight: 500; }
.link:hover { text-decoration: underline; text-underline-offset: 2px; }

/* ════════════════════════════════════════════════════════════════
   SPRINT 2 — Component library extensions
   • Forms (switch, checkbox, radio, file, search, password)
   • Tables (toolbar, density, row-select)
   • Modals (dialog/drawer/popover)
   • Toasts
   • Tabs, breadcrumbs, segmented controls
   • Skeleton + empty states
   ═══════════════════════════════════════════════════════════════ */

/* ════════════ 26. Forms — extended ════════════ */

/* Form anatomy: row layout */
.form-row {
    display: grid; grid-template-columns: 200px 1fr;
    gap: 16px; align-items: start;
    padding: 12px 0; border-bottom: 1px solid var(--border);
}
.form-row:last-child { border-bottom: none; }
.form-row > .label { font-size: 13px; font-weight: 500; color: var(--text-2); padding-top: 8px; }
.form-row > .label .required { color: var(--danger); margin-left: 2px; }
.form-row > .label .helper { display: block; font-size: 11.5px; color: var(--text-3); margin-top: 2px; font-weight: 400; }
.form-row > .control { min-width: 0; }
@media (max-width: 768px) { .form-row { grid-template-columns: 1fr; gap: 4px; } .form-row > .label { padding-top: 0; } }

/* Validation states */
.form-control[aria-invalid="true"], .form-control.is-invalid {
    border-color: var(--danger);
    box-shadow: 0 0 0 3px rgba(181, 68, 58, 0.10);
}
.form-control.is-valid {
    border-color: var(--success);
}
.form-help { font-size: 11.5px; color: var(--text-3); margin-top: 4px; line-height: 1.4; }
.form-error { font-size: 11.5px; color: var(--danger); margin-top: 4px; line-height: 1.4; display: flex; align-items: flex-start; gap: 4px; }
.form-error svg { width: 12px; height: 12px; margin-top: 1px; flex-shrink: 0; }

/* Inputs with icon prefix/suffix */
.input-group { display: flex; align-items: stretch; }
.input-group .form-control { border-radius: 0; border-right-width: 0; }
.input-group .form-control:first-child { border-top-left-radius: var(--r-sm); border-bottom-left-radius: var(--r-sm); }
.input-group .form-control:last-child  { border-top-right-radius: var(--r-sm); border-bottom-right-radius: var(--r-sm); border-right-width: 1px; }
.input-group > .addon {
    display: inline-flex; align-items: center;
    padding: 0 10px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text-3);
    font-size: 13px;
}
.input-group > .addon:first-child { border-radius: var(--r-sm) 0 0 var(--r-sm); }
.input-group > .addon:last-child  { border-radius: 0 var(--r-sm) var(--r-sm) 0; }
.input-group > .addon svg { width: 14px; height: 14px; }

/* Input wrapper for inline icons (e.g., search) */
.input-wrap { position: relative; }
.input-wrap > svg.input-icon {
    position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
    width: 14px; height: 14px; color: var(--text-3); pointer-events: none;
}
.input-wrap > .form-control.has-icon-left  { padding-left: 32px; }
.input-wrap > .form-control.has-icon-right { padding-right: 32px; }
.input-wrap > .input-clear {
    position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
    width: 22px; height: 22px;
    border: none; background: var(--surface-2); border-radius: var(--r-full);
    color: var(--text-3); cursor: pointer;
    display: none; align-items: center; justify-content: center;
    transition: background var(--t-fast), color var(--t-fast);
}
.input-wrap > .input-clear svg { width: 12px; height: 12px; }
.input-wrap > .input-clear:hover { background: var(--surface-3); color: var(--text); }
.input-wrap.has-value > .input-clear { display: inline-flex; }

/* Toggle switch */
.switch {
    --w: 32px; --h: 18px;
    display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none;
}
.switch input[type="checkbox"] { position: absolute; opacity: 0; pointer-events: none; }
.switch .track {
    width: var(--w); height: var(--h);
    background: var(--surface-3); border: 1px solid var(--border-strong);
    border-radius: var(--r-full); position: relative;
    transition: background var(--t), border-color var(--t);
}
.switch .thumb {
    position: absolute; top: 1px; left: 1px;
    width: calc(var(--h) - 4px); height: calc(var(--h) - 4px);
    background: var(--surface); border-radius: 50%;
    transition: transform var(--t), background var(--t);
    box-shadow: var(--shadow-sm);
}
.switch input:checked + .track { background: var(--accent); border-color: var(--accent); }
.switch input:checked + .track .thumb { transform: translateX(calc(var(--w) - var(--h))); background: #FFF; }
.switch input:focus-visible + .track { box-shadow: 0 0 0 3px var(--accent-soft); }
.switch:has(input:disabled) { opacity: 0.5; cursor: not-allowed; }

/* Custom checkbox */
.check, .radio {
    display: inline-flex; align-items: center; gap: 8px;
    cursor: pointer; user-select: none;
    font-size: 13px; color: var(--text);
    line-height: 1.4;
}
.check input, .radio input { position: absolute; opacity: 0; pointer-events: none; }
.check .box, .radio .box {
    width: 16px; height: 16px;
    background: var(--surface);
    border: 1.5px solid var(--border-strong);
    transition: all var(--t-fast);
    flex-shrink: 0;
    display: inline-flex; align-items: center; justify-content: center;
}
.check .box { border-radius: var(--r-xs); }
.radio .box { border-radius: 50%; }
.check input:checked + .box, .radio input:checked + .box {
    background: var(--accent); border-color: var(--accent);
}
.check .box::after {
    content: ""; width: 8px; height: 4px;
    border: 1.5px solid #FFF; border-top: none; border-right: none;
    transform: rotate(-45deg) translateY(-1px) scale(0);
    transition: transform var(--t-fast);
}
.check input:checked + .box::after { transform: rotate(-45deg) translateY(-1px) scale(1); }
.radio .box::after {
    content: ""; width: 6px; height: 6px; background: #FFF; border-radius: 50%;
    transform: scale(0); transition: transform var(--t-fast);
}
.radio input:checked + .box::after { transform: scale(1); }
.check input:focus-visible + .box, .radio input:focus-visible + .box { box-shadow: 0 0 0 3px var(--accent-soft); }
.check input:disabled + .box, .radio input:disabled + .box { opacity: 0.5; cursor: not-allowed; }

/* Indeterminate checkbox */
.check input:indeterminate + .box { background: var(--accent); border-color: var(--accent); }
.check input:indeterminate + .box::after {
    content: ""; width: 8px; height: 1.5px;
    border: none; background: #FFF;
    transform: rotate(0) translateY(0) scale(1);
}

/* File dropzone */
.dropzone {
    border: 1.5px dashed var(--border-strong);
    border-radius: var(--r-md);
    padding: 28px 20px;
    text-align: center;
    background: var(--surface);
    cursor: pointer;
    transition: all var(--t);
    color: var(--text-2);
}
.dropzone:hover { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.dropzone.is-dragging { border-color: var(--accent); background: var(--accent-soft); border-style: solid; }
.dropzone svg { width: 28px; height: 28px; margin: 0 auto 8px; opacity: 0.6; }
.dropzone .title { font-weight: 500; font-size: 14px; color: inherit; margin-bottom: 4px; }
.dropzone .hint  { font-size: 12px; color: var(--text-3); }

/* Password reveal */
.input-password { position: relative; }
.input-password .form-control { padding-right: 38px; }
.input-password .reveal-btn {
    position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
    width: 24px; height: 24px;
    border: none; background: transparent; cursor: pointer;
    color: var(--text-3); display: inline-flex; align-items: center; justify-content: center;
    border-radius: var(--r-xs);
    transition: color var(--t-fast), background var(--t-fast);
}
.input-password .reveal-btn:hover { color: var(--text); background: var(--surface-2); }
.input-password .reveal-btn svg { width: 14px; height: 14px; }

/* Character counter */
.char-counter { font-size: 11px; color: var(--text-3); text-align: right; margin-top: 4px; }
.char-counter.is-near { color: var(--warning); }
.char-counter.is-over { color: var(--danger); }

/* Fieldset */
fieldset { border: 1px solid var(--border); border-radius: var(--r); padding: 16px 18px 12px; margin: 0; }
legend { padding: 0 8px; font-size: 11px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.06em; }


/* ════════════ 27. Buttons — extensions ════════════ */

.btn-group {
    display: inline-flex; align-items: stretch;
    border: 1px solid var(--border); border-radius: var(--r-sm);
    background: var(--surface); box-shadow: var(--shadow-xs);
    overflow: hidden;
}
.btn-group > .btn {
    border-radius: 0; border: none; box-shadow: none;
    border-right: 1px solid var(--border);
}
.btn-group > .btn:last-child { border-right: none; }
.btn-group > .btn.is-active { background: var(--surface-2); color: var(--text); font-weight: 500; }
.btn-group > .btn:hover { background: var(--surface-2); }

/* Split button: action + caret */
.btn-split { display: inline-flex; }
.btn-split > .btn { border-radius: 0; }
.btn-split > .btn:first-child { border-radius: var(--r-sm) 0 0 var(--r-sm); }
.btn-split > .btn:last-child  { border-radius: 0 var(--r-sm) var(--r-sm) 0; padding-left: 8px; padding-right: 8px; border-left: 1px solid rgba(255,255,255,0.18); }

/* Icon-only button */
.btn-icon {
    width: 32px; padding: 0;
    display: inline-flex; align-items: center; justify-content: center;
}
.btn-icon.btn-sm { width: 28px; }
.btn-icon.btn-xs { width: 24px; }


/* ════════════ 28. Tables — toolbar + density + select ════════════ */

.data-table {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md);
    overflow: hidden;
}
.data-table > .toolbar {
    padding: 10px 14px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.data-table > .toolbar .grow { flex: 1; }
.data-table > .toolbar .selection-info {
    display: none;
    font-size: 12.5px; color: var(--text-2);
    padding: 4px 10px; background: var(--accent-soft); color: var(--accent-active);
    border-radius: var(--r-full);
}
.data-table.has-selection > .toolbar .selection-info { display: inline-flex; align-items: center; gap: 6px; }
.data-table > .table-scroll { overflow-x: auto; }
.data-table > .footer {
    padding: 10px 14px;
    background: var(--surface-2);
    border-top: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    font-size: 12.5px; color: var(--text-2);
}

/* Density variants — apply class on parent */
.data-table.density-compact td,
.data-table.density-compact th { padding: 6px 10px; font-size: 12.5px; }
.data-table.density-comfortable td,
.data-table.density-comfortable th { padding: 14px 16px; }

/* Row checkbox column */
.data-table th.col-select, .data-table td.col-select { width: 36px; padding-right: 0; }
.data-table tbody tr.is-selected { background: var(--accent-soft); }
.data-table tbody tr.is-selected td:first-child { box-shadow: inset 2px 0 0 var(--accent); }

/* Empty / loading rows */
.empty-row td, .loading-row td { padding: 48px 14px !important; text-align: center; color: var(--text-3); }


/* ════════════ 29. Modals (dialog / drawer / popover) ════════════ */

.dialog-overlay {
    position: fixed; inset: 0;
    background: rgba(15,16,17,0.45);
    backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
    z-index: 100;
    display: flex; align-items: center; justify-content: center;
    padding: 24px;
    animation: fadein var(--t) var(--ease-out, cubic-bezier(0.16,1,0.3,1));
}
.dialog {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-lg);
    width: 100%; max-width: 480px;
    display: flex; flex-direction: column; max-height: calc(100vh - 48px);
    overflow: hidden;
    animation: zoomin var(--t) cubic-bezier(0.16, 1, 0.3, 1);
}
.dialog-header { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.dialog-header h2 { font-size: 15px; font-weight: 600; }
.dialog-close { width: 28px; height: 28px; padding: 0; border: none; background: transparent; color: var(--text-3); border-radius: var(--r-sm); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.dialog-close:hover { background: var(--surface-2); color: var(--text); }
.dialog-close svg { width: 14px; height: 14px; }
.dialog-body { padding: 20px; overflow-y: auto; }
.dialog-footer { padding: 12px 20px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; background: var(--surface-2); }

/* Drawer — slides in from right */
.drawer-overlay { position: fixed; inset: 0; background: rgba(15,16,17,0.35); -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); z-index: 100; animation: fadein var(--t); }
.drawer {
    position: fixed; top: 0; right: 0; bottom: 0;
    width: 100%; max-width: 480px;
    background: var(--surface);
    border-left: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    display: flex; flex-direction: column;
    animation: slidein var(--t-slow) cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 101;
}
@keyframes slidein { from { transform: translateX(20px); opacity: 0.6; } to { transform: none; opacity: 1; } }
.drawer-header { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.drawer-body { padding: 20px; overflow-y: auto; flex: 1; }
.drawer-footer { padding: 12px 20px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; background: var(--surface-2); }

/* Popover (anchored, no overlay) */
.popover {
    position: absolute;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r);
    box-shadow: var(--shadow-md);
    padding: 12px;
    min-width: 200px;
    animation: zoomin var(--t-fast) var(--ease-out, cubic-bezier(0.16,1,0.3,1));
    z-index: 60;
}


/* ════════════ 30. Toast notifications ════════════ */

.toast-region {
    position: fixed;
    bottom: 16px; right: 16px;
    z-index: 200;
    display: flex; flex-direction: column; gap: 8px;
    max-width: 400px;
    pointer-events: none;
}
.toast {
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 3px solid var(--text-3);
    border-radius: var(--r);
    box-shadow: var(--shadow-md);
    padding: 12px 14px;
    display: flex; align-items: flex-start; gap: 10px;
    pointer-events: auto;
    min-width: 280px;
    animation: toastin 220ms cubic-bezier(0.16, 1, 0.3, 1);
}
.toast.is-leaving { animation: toastout 160ms cubic-bezier(0.7,0,0.84,0) forwards; }
@keyframes toastin  { from { transform: translateX(20px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes toastout { from { transform: none; opacity: 1; } to { transform: translateX(20px); opacity: 0; } }

.toast.toast-success { border-left-color: var(--success); }
.toast.toast-error   { border-left-color: var(--danger); }
.toast.toast-warning { border-left-color: var(--warning); }
.toast.toast-info    { border-left-color: var(--accent); }
.toast > .toast-icon { flex-shrink: 0; width: 16px; height: 16px; margin-top: 2px; }
.toast.toast-success > .toast-icon { color: var(--success); }
.toast.toast-error   > .toast-icon { color: var(--danger); }
.toast.toast-warning > .toast-icon { color: var(--warning); }
.toast.toast-info    > .toast-icon { color: var(--accent); }
.toast > .toast-body { flex: 1; min-width: 0; }
.toast > .toast-body .title { font-size: 13px; font-weight: 500; color: var(--text); line-height: 1.4; }
.toast > .toast-body .desc  { font-size: 12px; color: var(--text-2); margin-top: 2px; line-height: 1.45; }
.toast > .toast-close {
    flex-shrink: 0; width: 22px; height: 22px;
    border: none; background: transparent; color: var(--text-3);
    border-radius: var(--r-xs); cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
}
.toast > .toast-close:hover { background: var(--surface-2); color: var(--text); }
.toast > .toast-close svg { width: 12px; height: 12px; }


/* ════════════ 31. Tabs ════════════ */

.tabs { border-bottom: 1px solid var(--border); display: flex; gap: 0; }
.tabs > a, .tabs > button {
    padding: 10px 14px; border: none; background: transparent;
    color: var(--text-2); font-size: 13px; font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: color var(--t-fast), border-color var(--t-fast);
    display: inline-flex; align-items: center; gap: 6px;
}
.tabs > a:hover, .tabs > button:hover { color: var(--text); text-decoration: none; }
.tabs > a.is-active, .tabs > button.is-active {
    color: var(--accent); border-bottom-color: var(--accent); font-weight: 600;
}
.tabs > a .count, .tabs > button .count {
    background: var(--surface-3); color: var(--text-3);
    padding: 1px 6px; border-radius: var(--r-full);
    font-size: 11px; font-weight: 500;
}
.tabs > .is-active .count { background: var(--accent-soft); color: var(--accent); }

/* Pill tabs (alternative) */
.tabs-pill { gap: 4px; border-bottom: none; }
.tabs-pill > a, .tabs-pill > button {
    border-radius: var(--r-sm); padding: 6px 12px;
    border: 1px solid transparent;
    margin-bottom: 0;
    border-bottom: 1px solid transparent;
}
.tabs-pill > a:hover, .tabs-pill > button:hover { background: var(--surface-2); }
.tabs-pill > a.is-active, .tabs-pill > button.is-active {
    background: var(--accent-soft); color: var(--accent);
    border-color: transparent;
}


/* ════════════ 32. Breadcrumb refinement ════════════ */

.breadcrumb {
    display: flex; align-items: center; gap: 6px;
    font-size: 12.5px; color: var(--text-3);
}
.breadcrumb a { color: var(--text-3); text-decoration: none; transition: color var(--t-fast); }
.breadcrumb a:hover { color: var(--text); text-decoration: none; }
.breadcrumb .sep { color: var(--text-4); display: inline-flex; align-items: center; }
.breadcrumb .sep svg { width: 12px; height: 12px; }
.breadcrumb .current { color: var(--text); font-weight: 500; }


/* ════════════ 33. Skeleton variants ════════════ */

.skel { display: inline-block; background: linear-gradient(90deg, var(--surface-2) 0%, var(--surface-3) 50%, var(--surface-2) 100%); background-size: 200% 100%; animation: shimmer 1.4s ease-in-out infinite; border-radius: var(--r-xs); }
.skel-text { height: 12px; width: 100%; border-radius: 3px; }
.skel-text.short { width: 40%; }
.skel-text.medium { width: 70%; }
.skel-circle { border-radius: 50%; }
.skel-block { border-radius: var(--r-sm); }


/* ════════════ 34. Empty states ════════════ */

.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-3);
}
.empty-state .icon-wrap {
    width: 56px; height: 56px;
    background: var(--surface-2);
    border-radius: var(--r-lg);
    display: inline-flex; align-items: center; justify-content: center;
    margin-bottom: 12px;
}
.empty-state .icon-wrap svg { width: 24px; height: 24px; color: var(--text-3); }
.empty-state h3 { font-size: 15px; color: var(--text-2); font-weight: 500; margin-bottom: 4px; }
.empty-state p  { font-size: 13px; color: var(--text-3); max-width: 360px; margin: 0 auto 16px; line-height: 1.5; }


/* ════════════ 35. Segmented control (button group toggle) ════════════ */

.segmented {
    display: inline-flex;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    padding: 2px;
    gap: 0;
}
.segmented > button {
    border: none; background: transparent;
    padding: 4px 10px;
    font-size: 12.5px; font-weight: 500;
    color: var(--text-2);
    border-radius: calc(var(--r-sm) - 2px);
    cursor: pointer;
    transition: all var(--t-fast);
}
.segmented > button:hover { color: var(--text); }
.segmented > button.is-active {
    background: var(--surface);
    color: var(--text);
    box-shadow: var(--shadow-xs);
}


/* ════════════ 36. Avatar ════════════ */

.avatar {
    display: inline-flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, var(--accent), #8E8CF0);
    color: #FFF;
    font-size: 11px; font-weight: 600;
    border-radius: 50%;
    width: 28px; height: 28px;
    flex-shrink: 0;
    text-transform: uppercase;
    letter-spacing: 0;
}
.avatar.size-xs { width: 20px; height: 20px; font-size: 9px; }
.avatar.size-sm { width: 24px; height: 24px; font-size: 10px; }
.avatar.size-md { width: 28px; height: 28px; font-size: 11px; }
.avatar.size-lg { width: 36px; height: 36px; font-size: 13px; }
.avatar.size-xl { width: 48px; height: 48px; font-size: 16px; }
.avatar-group { display: inline-flex; }
.avatar-group .avatar { box-shadow: 0 0 0 2px var(--surface); margin-left: -8px; }
.avatar-group .avatar:first-child { margin-left: 0; }


/* ════════════ 37. Progress bar ════════════ */

.progress { height: 6px; background: var(--surface-3); border-radius: var(--r-full); overflow: hidden; }
.progress > .bar { height: 100%; background: var(--accent); border-radius: var(--r-full); transition: width var(--t-slow); }
.progress.success > .bar { background: var(--success); }
.progress.warning > .bar { background: var(--warning); }
.progress.danger > .bar  { background: var(--danger); }


/* ════════════ 38. Spinner ════════════ */

.spinner { width: 16px; height: 16px; border: 2px solid var(--surface-3); border-top-color: var(--accent); border-radius: 50%; animation: spin 700ms linear infinite; display: inline-block; }
.spinner.size-sm { width: 12px; height: 12px; border-width: 1.5px; }
.spinner.size-lg { width: 24px; height: 24px; border-width: 2.5px; }
@keyframes spin { to { transform: rotate(360deg); } }


/* ════════════ 39. KBD shortcut row ════════════ */

.kbd-row { display: flex; align-items: center; justify-content: space-between; padding: 6px 10px; border-radius: var(--r-xs); font-size: 13px; }
.kbd-row:hover { background: var(--surface-2); }
.kbd-row .label { color: var(--text); }
.kbd-row .keys { display: inline-flex; gap: 4px; align-items: center; }


/* ════════════ 40. Code block enhanced ════════════ */

.code-block {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--r);
    overflow: hidden;
}
.code-block > .head { padding: 6px 12px; background: var(--surface-3); border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.code-block > .head .lang { font-size: 11px; color: var(--text-3); font-family: var(--font-mono); }
.code-block > .head .copy { font-size: 11px; color: var(--text-3); cursor: pointer; background: transparent; border: none; padding: 2px 6px; border-radius: var(--r-xs); }
.code-block > .head .copy:hover { background: var(--surface); color: var(--text); }
.code-block > pre { margin: 0; border: none; border-radius: 0; background: transparent; padding: 12px 14px; }


/* ════════════ 41. Alert refinement ════════════ */

.alert.alert-banner {
    border-radius: 0; border-left: none; border-right: none;
    border-top: none; border-bottom: 1px solid;
    margin: 0 -24px 16px; padding: 12px 24px;
}


/* ════════════ 42. Mobile bottom navigation ════════════ */

.bottom-nav {
    display: none;
    position: fixed; bottom: 0; left: 0; right: 0;
    background: var(--surface);
    border-top: 1px solid var(--border);
    z-index: 40;
    padding: 4px 4px env(safe-area-inset-bottom, 4px);
    box-shadow: 0 -2px 8px rgb(15 16 17 / 0.04);
}
.bottom-nav-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0;
}
.bottom-nav a {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 3px;
    padding: 8px 4px;
    color: var(--text-3);
    text-decoration: none;
    font-size: 10px; font-weight: 500;
    border-radius: var(--r-sm);
    min-height: 52px;
    transition: color var(--t-fast), background var(--t-fast);
}
.bottom-nav a svg { width: 20px; height: 20px; opacity: 0.7; }
.bottom-nav a.active { color: var(--accent); }
.bottom-nav a.active svg { opacity: 1; }
.bottom-nav a:hover { color: var(--text); text-decoration: none; }

@media (max-width: 768px) {
    .bottom-nav { display: block; }
    .main { padding-bottom: 64px; }
    .content { padding-bottom: 16px; }
}


/* ════════════ 43. Page header pattern with breadcrumb + tabs ════════════ */

.page-shell {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    margin: -24px -24px 24px;
    padding: 20px 24px 0;
}
.page-shell .page-header {
    border-bottom: none; padding-bottom: 16px; margin-bottom: 0;
}
.page-shell .tabs { margin: 0 -24px; padding: 0 24px; border-bottom: none; }


/* ════════════ 44. Detail view sidebar (right context panel) ════════════ */

.detail-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
}
@media (min-width: 1280px) {
    .detail-layout { grid-template-columns: minmax(0, 1fr) 320px; }
}
.detail-aside { display: flex; flex-direction: column; gap: 16px; }
.detail-aside .card { padding: 16px; }
.detail-aside h3 { font-size: 12px; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600; margin-bottom: 12px; }


/* ════════════ 45. Activity timeline ════════════ */

.timeline { position: relative; padding-left: 16px; }
.timeline::before {
    content: ''; position: absolute; left: 5px; top: 4px; bottom: 4px;
    width: 2px; background: var(--border);
}
.timeline-item { position: relative; padding-bottom: 14px; }
.timeline-item::before {
    content: ''; position: absolute;
    left: -15px; top: 6px;
    width: 10px; height: 10px;
    background: var(--surface); border: 2px solid var(--border-strong);
    border-radius: 50%;
    box-shadow: 0 0 0 3px var(--surface);
}
.timeline-item.is-success::before { border-color: var(--success); background: var(--success); }
.timeline-item.is-warning::before { border-color: var(--warning); background: var(--warning); }
.timeline-item.is-danger::before  { border-color: var(--danger);  background: var(--danger); }
.timeline-item.is-accent::before  { border-color: var(--accent);  background: var(--accent); }
.timeline-item .meta { font-size: 11px; color: var(--text-3); margin-bottom: 2px; }
.timeline-item .desc { font-size: 13px; color: var(--text-2); line-height: 1.5; }


/* ════════════ 46. Section divider with title ════════════ */

.section-title {
    display: flex; align-items: center; gap: 12px;
    font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em;
    color: var(--text-3); font-weight: 600;
    margin: 24px 0 12px;
}
.section-title::before, .section-title::after {
    content: ''; flex: 1; height: 1px; background: var(--border);
}


/* ════════════ 47. Command palette (Cmd+K) ════════════ */

/* Topbar trigger — look of a search field, behaviour of a button. */
.cmdk-trigger {
    display: inline-flex; align-items: center; gap: 8px;
    height: 32px; padding: 0 8px 0 10px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    color: var(--text-3);
    font-size: 12px; font-family: inherit;
    cursor: pointer;
    transition: all var(--t-fast);
    min-width: 220px;
}
.cmdk-trigger:hover {
    background: var(--surface);
    border-color: var(--border-strong);
    color: var(--text-2);
}
.cmdk-trigger svg { width: 14px; height: 14px; flex-shrink: 0; color: var(--text-3); }
.cmdk-trigger .cmdk-trigger-label { flex: 1; text-align: left; }
.cmdk-trigger .cmdk-trigger-keys { display: inline-flex; gap: 2px; }
.cmdk-trigger .cmdk-trigger-keys kbd { font-size: 10px; padding: 0 5px; line-height: 18px; }

@media (max-width: 768px) {
    .cmdk-trigger { min-width: 0; padding: 0 8px; }
    .cmdk-trigger .cmdk-trigger-label,
    .cmdk-trigger .cmdk-trigger-keys { display: none; }
}

/* Notification bell — quiet button with red dot indicator. */
.notif-btn {
    position: relative;
    display: inline-flex; align-items: center; justify-content: center;
    width: 32px; height: 32px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    color: var(--text-3);
    cursor: pointer;
    transition: all var(--t-fast);
}
.notif-btn:hover { background: var(--surface-2); color: var(--text); border-color: var(--border-strong); }
.notif-btn svg { width: 14px; height: 14px; }
.notif-btn .notif-dot {
    position: absolute; top: 5px; right: 5px;
    width: 6px; height: 6px;
    background: var(--danger);
    border-radius: 50%;
    box-shadow: 0 0 0 2px var(--surface);
}

/* Backdrop + dialog. */
.cmdk-backdrop {
    position: fixed; inset: 0;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--t-fast);
}
.cmdk-backdrop.is-open {
    opacity: 1;
    pointer-events: auto;
}

[data-theme="dark"] .cmdk-backdrop { background: rgba(0, 0, 0, 0.7); }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .cmdk-backdrop { background: rgba(0, 0, 0, 0.7); }
}

.cmdk-dialog {
    position: fixed;
    top: 14vh; left: 50%;
    transform: translateX(-50%) scale(0.97);
    width: min(640px, calc(100vw - 32px));
    max-height: 64vh;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.25), 0 4px 12px rgba(0, 0, 0, 0.08);
    z-index: 1001;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--t-fast), transform var(--t-fast);
    display: flex; flex-direction: column;
    overflow: hidden;
}
.cmdk-dialog.is-open {
    opacity: 1;
    transform: translateX(-50%) scale(1);
    pointer-events: auto;
}

.cmdk-search {
    display: flex; align-items: center; gap: 10px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.cmdk-search svg { width: 16px; height: 16px; color: var(--text-3); flex-shrink: 0; }
.cmdk-search input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text);
    font-size: 15px;
    font-family: inherit;
    padding: 0;
}
.cmdk-search input::placeholder { color: var(--text-4); }
.cmdk-search .cmdk-loader {
    width: 14px; height: 14px;
    border: 2px solid var(--border-strong);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: cmdk-spin 0.7s linear infinite;
    display: none;
}
.cmdk-search.is-loading .cmdk-loader { display: inline-block; }
@keyframes cmdk-spin { to { transform: rotate(360deg); } }

.cmdk-results {
    flex: 1;
    overflow-y: auto;
    padding: 6px;
}
.cmdk-results::-webkit-scrollbar { width: 8px; }
.cmdk-results::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 4px; }

.cmdk-group { padding: 6px 0; }
.cmdk-group-label {
    font-size: 10px; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.06em;
    color: var(--text-3);
    padding: 4px 12px 6px;
}
.cmdk-item {
    display: flex; align-items: center; gap: 12px;
    padding: 8px 12px;
    border-radius: var(--r-sm);
    cursor: pointer;
    color: var(--text);
    text-decoration: none;
    transition: background var(--t-fast);
    user-select: none;
}
.cmdk-item:hover { background: var(--surface-2); }
.cmdk-item.is-active {
    background: var(--accent-soft);
    outline: 1px solid var(--accent);
}
.cmdk-item .cmdk-item-icon {
    flex-shrink: 0;
    width: 28px; height: 28px;
    display: flex; align-items: center; justify-content: center;
    background: var(--surface-2);
    border-radius: var(--r-sm);
    color: var(--text-2);
}
.cmdk-item.is-active .cmdk-item-icon {
    background: var(--surface);
    color: var(--accent);
}
.cmdk-item .cmdk-item-icon svg { width: 14px; height: 14px; }
.cmdk-item .cmdk-item-body { flex: 1; min-width: 0; }
.cmdk-item .cmdk-item-title {
    font-size: 13px; font-weight: 500;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cmdk-item .cmdk-item-sub {
    font-size: 11px; color: var(--text-3);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    margin-top: 1px;
}
.cmdk-item .cmdk-item-enter {
    opacity: 0;
    color: var(--text-3);
    font-size: 11px;
    transition: opacity var(--t-fast);
}
.cmdk-item.is-active .cmdk-item-enter { opacity: 1; }

.cmdk-empty {
    padding: 32px 16px;
    text-align: center;
    color: var(--text-3);
    font-size: 13px;
}
.cmdk-empty .cmdk-empty-hint {
    font-size: 11px;
    margin-top: 6px;
    color: var(--text-4);
}

.cmdk-footer {
    display: flex; align-items: center; justify-content: space-between;
    padding: 8px 12px;
    border-top: 1px solid var(--border);
    background: var(--surface-2);
    font-size: 11px;
    color: var(--text-3);
    flex-shrink: 0;
}
.cmdk-footer .cmdk-hints { display: inline-flex; gap: 14px; }
.cmdk-footer .cmdk-hints span { display: inline-flex; align-items: center; gap: 4px; }
.cmdk-footer kbd { font-size: 10px; padding: 0 5px; line-height: 16px; }

@media (max-width: 480px) {
    .cmdk-dialog { top: 8vh; max-height: 80vh; width: calc(100vw - 16px); }
    .cmdk-footer .cmdk-hints { gap: 8px; }
    .cmdk-footer .cmdk-hints span:nth-child(n+3) { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    .cmdk-backdrop, .cmdk-dialog { transition: none; }
    .cmdk-search .cmdk-loader { animation: none; }
}


/* ════════════ 48. Notifications dropdown ════════════ */

.notif-wrap { position: relative; display: inline-flex; }

.notif-badge {
    position: absolute; top: -4px; right: -4px;
    min-width: 16px; height: 16px;
    padding: 0 4px;
    background: var(--danger);
    color: #fff;
    font-size: 10px; font-weight: 600; line-height: 16px;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 0 0 2px var(--surface);
    pointer-events: none;
}

.notif-panel {
    position: absolute;
    top: calc(100% + 8px); right: 0;
    width: 360px;
    max-height: 70vh;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    box-shadow: 0 20px 48px rgba(0, 0, 0, 0.18), 0 4px 12px rgba(0, 0, 0, 0.08);
    z-index: 900;
    opacity: 0;
    transform: translateY(-4px);
    pointer-events: none;
    transition: opacity var(--t-fast), transform var(--t-fast);
    display: flex; flex-direction: column;
    overflow: hidden;
}
.notif-panel.is-open {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.notif-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.notif-head h4 { font-size: 13px; font-weight: 600; margin: 0; color: var(--text); }
.notif-head .notif-meta { font-size: 11px; color: var(--text-3); }

.notif-body {
    flex: 1;
    overflow-y: auto;
    padding: 4px 0;
}
.notif-body::-webkit-scrollbar { width: 6px; }
.notif-body::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 3px; }

.notif-group { padding: 6px 0; }
.notif-group-label {
    display: flex; align-items: center; justify-content: space-between;
    padding: 6px 14px;
    font-size: 10px; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.06em;
    color: var(--text-3);
}
.notif-group-label .notif-group-count {
    background: var(--surface-2);
    color: var(--text-2);
    padding: 1px 6px;
    border-radius: 8px;
    text-transform: none; letter-spacing: 0;
    font-size: 10px;
}

.notif-item {
    display: flex; gap: 10px;
    padding: 8px 14px;
    color: var(--text); text-decoration: none;
    border-left: 2px solid transparent;
    transition: background var(--t-fast), border-color var(--t-fast);
}
.notif-item:hover {
    background: var(--surface-2);
    border-left-color: var(--accent);
}
.notif-item .notif-dot-mark {
    flex-shrink: 0; width: 6px; height: 6px;
    background: var(--accent); border-radius: 50%;
    margin-top: 7px;
}
.notif-item.sev-warning .notif-dot-mark { background: var(--warning); }
.notif-item.sev-danger  .notif-dot-mark { background: var(--danger); }
.notif-item .notif-body-text { flex: 1; min-width: 0; }
.notif-item .notif-title {
    font-size: 13px; font-weight: 500;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.notif-item .notif-sub {
    font-size: 11px; color: var(--text-3);
    margin-top: 2px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.notif-item .notif-time {
    font-size: 10px; color: var(--text-4);
    margin-top: 2px;
}

.notif-empty {
    padding: 40px 16px;
    text-align: center;
    color: var(--text-3);
    font-size: 13px;
}
.notif-empty svg {
    width: 32px; height: 32px;
    color: var(--text-4);
    margin-bottom: 8px;
}

.notif-foot {
    border-top: 1px solid var(--border);
    padding: 8px 14px;
    font-size: 12px;
    text-align: center;
    background: var(--surface-2);
    flex-shrink: 0;
}
.notif-foot a { color: var(--accent); text-decoration: none; font-weight: 500; }
.notif-foot a:hover { text-decoration: underline; }

@media (max-width: 480px) {
    .notif-panel {
        position: fixed;
        top: 56px; right: 8px; left: 8px; width: auto;
        max-height: calc(100vh - 80px);
    }
}

@media (prefers-reduced-motion: reduce) {
    .notif-panel { transition: none; }
}


/* ════════════ 49. Dark mode polish ════════════ */

/* Smooth theme switch — fade colors over 180ms.
   Gated by .theme-anim on <html>, added by JS on first user toggle to
   avoid a flash of mid-state during the FOUC-prevention initial paint. */
html.theme-anim,
html.theme-anim body,
html.theme-anim .sidebar,
html.theme-anim .topbar,
html.theme-anim .card,
html.theme-anim .surface,
html.theme-anim .btn,
html.theme-anim input,
html.theme-anim textarea,
html.theme-anim select,
html.theme-anim .table,
html.theme-anim .alert,
html.theme-anim .badge,
html.theme-anim .modal,
html.theme-anim .cmdk-dialog,
html.theme-anim .notif-panel {
    transition:
        background-color 180ms ease,
        border-color 180ms ease,
        color 180ms ease,
        box-shadow 180ms ease !important;
}

/* Image dimming — soften photos and SVG screenshots in dark mode. */
[data-theme="dark"] img:not([src*=".svg"]):not(.no-dim) {
    filter: brightness(0.92);
}

/* Code blocks — bump contrast so syntax stays readable on the
   slightly-blue dark surface. */
[data-theme="dark"] code,
[data-theme="dark"] pre {
    color: #D7D8E0;
    background: #1A1A1F;
    border-color: rgba(255, 255, 255, 0.06);
}

/* Selection — accent-tinted in dark mode for legibility. */
[data-theme="dark"] ::selection {
    background: rgba(124, 122, 236, 0.32);
    color: #FFFFFF;
}

/* Charts and inline SVGs that use currentColor stay correct because
   svg fills inherit `color`. The few that hardcode `#000` get neutralised. */
[data-theme="dark"] svg [fill="#000"],
[data-theme="dark"] svg [fill="black"] {
    fill: var(--text-2);
}

/* Backdrop on modals — slightly heavier in dark mode (already set in dialog) */
[data-theme="dark"] .modal-backdrop,
[data-theme="dark"] .overlay-backdrop {
    background: rgba(0, 0, 0, 0.62);
}

/* Hover rows in dark mode — subtler tint than light. */
[data-theme="dark"] .table tr:hover { background: rgba(255, 255, 255, 0.02); }

/* Form field focus rings — accent ring slightly stronger in dark. */
[data-theme="dark"] input:focus,
[data-theme="dark"] textarea:focus,
[data-theme="dark"] select:focus {
    box-shadow: 0 0 0 3px rgba(124, 122, 236, 0.22);
    border-color: var(--accent);
}

/* Toast / inline alerts — dark mode keeps soft tints readable. */
[data-theme="dark"] .alert,
[data-theme="dark"] .toast {
    border-width: 1px;
}

@media (prefers-reduced-motion: reduce) {
    html.theme-anim,
    html.theme-anim * { transition: none !important; }
}


/* ════════════ 49.5 Telegram link badge (Roadmap §5.5) ════════════ */

.tg-badge {
    position: relative;
    display: inline-flex; align-items: center; justify-content: center;
    width: 32px; height: 32px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    color: var(--text-3);
    text-decoration: none;
    transition: all var(--t-fast);
    margin-right: 4px;
}
.tg-badge:hover { background: var(--surface-2); color: var(--text); border-color: var(--border-strong); }
.tg-badge svg { width: 14px; height: 14px; transform: rotate(180deg); /* bell → tg-style stub */ }
.tg-badge .tg-dot {
    position: absolute; top: 4px; right: 4px;
    width: 8px; height: 8px; border-radius: 50%;
    box-shadow: 0 0 0 2px var(--surface);
}
.tg-badge .tg-dot-unknown { background: var(--text-4); }
.tg-badge .tg-dot-linked { background: var(--success); }
.tg-badge .tg-dot-missing { background: var(--danger); }


/* ════════════ 50. Accessibility utilities ════════════ */

/* Visually hide content but keep it readable for screen readers.
   Standard "sr-only" pattern (Tailwind / Bootstrap compatible). */
.sr-only,
.visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* Skip-link — first focusable element on every page; only visible on focus.
   Lets keyboard users jump straight to <main id="main"> without tabbing
   through the entire sidebar. */
.skip-link {
    position: fixed;
    top: 8px; left: 8px;
    z-index: 9999;
    padding: 8px 14px;
    background: var(--accent);
    color: #FFF;
    font-size: 13px; font-weight: 500;
    border-radius: var(--r-sm);
    text-decoration: none;
    box-shadow: var(--shadow);
    transform: translateY(-150%);
    transition: transform var(--t-fast);
}
.skip-link:focus,
.skip-link:focus-visible {
    transform: translateY(0);
    outline: 2px solid var(--surface);
    outline-offset: 2px;
}

/* Stronger focus indicator on interactive elements that don't already
   have a custom one — ensures WCAG 2.1 SC 2.4.7 compliance. */
.btn:focus-visible,
.nav a:focus-visible,
.sidebar-nav a:focus-visible,
.bottom-nav a:focus-visible,
.cmdk-item:focus-visible,
.notif-item:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* aria-current="page" — active nav state, redundant with .active class
   but works without JS-applied classes too. */
[aria-current="page"] {
    font-weight: 600;
}

/* High-contrast mode (Windows / forced-colors) — make borders explicit. */
@media (forced-colors: active) {
    .btn, .card, .input, .modal, .cmdk-dialog, .notif-panel {
        border: 1px solid CanvasText;
    }
    .btn-primary { forced-color-adjust: none; }
}


/* ════════════ 51. Performance utilities ════════════ */

/* Below-the-fold rows can opt into content-visibility — browser skips
   layout/paint until they scroll near the viewport. Estimated row height
   prevents scrollbar jumps. Apply via class="cv-auto". */
.cv-auto { content-visibility: auto; contain-intrinsic-size: 56px; }

/* Long lists wrap — paginated tables benefit from this on huge result sets. */
.table.cv-rows tbody tr { content-visibility: auto; contain-intrinsic-size: 48px; }

/* Native lazy-load class for images (use loading="lazy" attribute too). */
.lazy-img { background: var(--surface-2); }


/* ════════════ 52. Auth screens v2 (modern, focused) ════════════
   Used by /OTKT/login and the Google OAuth onboarding/error/telegram pages.
   Single-column on mobile, 2-column (card + side panel) on desktop.
   Classes are namespaced under .auth-* to avoid colliding with the legacy
   .login-* classes still referenced by other templates. */

.auth-body {
    margin: 0;
    min-height: 100vh;
    background:
      radial-gradient(1200px 600px at 80% -10%, rgba(99,102,241,0.08), transparent 60%),
      radial-gradient(900px 500px at -10% 110%, rgba(16,185,129,0.06), transparent 60%),
      var(--bg);
    color: var(--text);
    display: flex;
    flex-direction: column;
    font-family: var(--font-sans, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif);
    -webkit-font-smoothing: antialiased;
}

.auth-topbar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border);
    background: color-mix(in srgb, var(--surface) 92%, transparent);
    backdrop-filter: saturate(140%) blur(8px);
    position: sticky; top: 0; z-index: 5;
}
.auth-brand {
    display: inline-flex; align-items: center; gap: 12px;
    color: inherit; text-decoration: none;
}
.auth-brand-mark {
    width: 36px; height: 36px; border-radius: 10px;
    background: var(--accent); color: #fff;
    display: inline-flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 13px; letter-spacing: 0.02em;
}
.auth-brand-text strong { display: block; font-size: 14px; font-weight: 600; line-height: 1.1; }
.auth-brand-text small { display: block; font-size: 11.5px; color: var(--text-muted); margin-top: 2px; }
.auth-topbar-meta { display: inline-flex; gap: 18px; }
.auth-topbar-meta a {
    font-size: 13px; color: var(--text-muted); text-decoration: none;
    padding: 6px 8px; border-radius: 6px;
}
.auth-topbar-meta a:hover { color: var(--text); background: var(--surface-2); }

.auth-main {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr;
    gap: 32px;
    max-width: 1120px;
    width: 100%;
    margin: 0 auto;
    padding: 48px 24px;
    align-items: start;
}
@media (min-width: 960px) {
    .auth-main { grid-template-columns: minmax(420px, 520px) minmax(280px, 1fr); gap: 56px; padding: 72px 32px; }
}

.auth-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 36px 36px 32px;
    box-shadow: 0 1px 0 rgba(0,0,0,0.02), 0 24px 60px -28px rgba(15,23,42,0.18);
}
@media (max-width: 640px) {
    .auth-card { padding: 28px 22px 24px; border-radius: 14px; }
}

.auth-eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 11px;
    font-weight: 700;
    color: var(--accent);
    margin: 0 0 10px;
}
.auth-title {
    font-size: 26px;
    line-height: 1.2;
    font-weight: 650;
    margin: 0 0 10px;
    letter-spacing: -0.01em;
}
.auth-subtitle {
    color: var(--text-muted);
    font-size: 14px;
    line-height: 1.55;
    margin: 0 0 24px;
}

.btn-google {
    display: flex; align-items: center; gap: 12px;
    width: 100%;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
    color: var(--text);
    text-decoration: none;
    font-size: 15px; font-weight: 600;
    transition: background 120ms ease, border-color 120ms ease, transform 60ms ease;
    cursor: pointer;
}
.btn-google:hover { background: var(--surface-2); border-color: color-mix(in srgb, var(--accent) 28%, var(--border)); }
.btn-google:active { transform: translateY(1px); }
.btn-google svg { width: 22px; height: 22px; flex: 0 0 auto; }
.btn-google-text { display: flex; flex-direction: column; line-height: 1.15; text-align: left; }
.btn-google-text strong { font-weight: 600; font-size: 14.5px; }
.btn-google-text small { color: var(--text-muted); font-size: 12.5px; font-weight: 500; margin-top: 2px; }
.btn-google-primary {
    border-color: color-mix(in srgb, var(--accent) 32%, var(--border));
    box-shadow: 0 1px 0 rgba(0,0,0,0.02), 0 6px 18px -10px color-mix(in srgb, var(--accent) 60%, transparent);
}

.auth-link-row {
    display: inline-block;
    margin: 12px 0 0;
    padding: 6px 0;
    color: var(--accent);
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 500;
}
.auth-link-row:hover { text-decoration: underline; }

.auth-steps {
    list-style: none;
    margin: 28px 0 18px;
    padding: 0;
    display: grid;
    gap: 14px;
}
.auth-steps li {
    display: grid;
    grid-template-columns: 28px 1fr;
    gap: 12px;
    align-items: start;
}
.auth-step-num {
    width: 26px; height: 26px;
    border-radius: 50%;
    background: var(--surface-2);
    color: var(--text);
    border: 1px solid var(--border);
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 700;
}
.auth-steps strong { display: block; font-size: 14px; font-weight: 600; line-height: 1.3; }
.auth-steps small { display: block; font-size: 12.5px; color: var(--text-muted); margin-top: 2px; line-height: 1.45; }

.auth-audience {
    margin: 8px 0 0;
    padding-top: 18px;
    border-top: 1px solid var(--border);
    font-size: 12.5px;
    color: var(--text-muted);
}

.auth-side {
    padding: 8px 4px;
    color: var(--text);
}
.auth-side h2 {
    font-size: 17px;
    font-weight: 600;
    margin: 0 0 10px;
    letter-spacing: -0.005em;
}
.auth-side > p {
    color: var(--text-muted);
    font-size: 14px;
    line-height: 1.6;
    margin: 0 0 18px;
}
.auth-side-list {
    list-style: none; margin: 0 0 18px; padding: 0;
    display: grid; gap: 10px;
}
.auth-side-list li {
    display: grid;
    grid-template-columns: 18px 1fr;
    gap: 10px;
    align-items: center;
    font-size: 13.5px;
    color: var(--text);
}
.auth-side-list svg {
    width: 18px; height: 18px;
    color: color-mix(in srgb, var(--accent) 70%, var(--text));
}
.auth-side-note {
    margin: 0;
    padding: 12px 14px;
    border-left: 3px solid color-mix(in srgb, var(--accent) 40%, var(--border));
    background: var(--surface-2);
    border-radius: 8px;
    font-size: 12.5px;
    color: var(--text-muted);
    line-height: 1.5;
}

.auth-footer {
    border-top: 1px solid var(--border);
    padding: 16px 24px;
    display: flex; align-items: center; justify-content: space-between;
    font-size: 12px;
    color: var(--text-muted);
}
.auth-footer-meta { display: inline-flex; gap: 10px; align-items: center; }
.auth-footer-meta a { color: inherit; text-decoration: none; }
.auth-footer-meta a:hover { color: var(--text); text-decoration: underline; }

@media (max-width: 640px) {
    .auth-topbar-meta { display: none; }
    .auth-footer { flex-direction: column; gap: 6px; align-items: flex-start; }
}


/* ════════════ 53. Dashboard operational additions ════════════ */
.health-bar { display: inline-flex; gap: 8px; align-items: center; }
.health-pill {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-muted);
}
.health-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-muted); }
.health-pill.is-ok { color: color-mix(in srgb, var(--success, #10b981) 80%, var(--text)); border-color: color-mix(in srgb, var(--success, #10b981) 30%, var(--border)); }
.health-pill.is-ok .health-dot { background: var(--success, #10b981); box-shadow: 0 0 0 3px color-mix(in srgb, var(--success, #10b981) 18%, transparent); }
.health-pill.is-bad { color: color-mix(in srgb, var(--danger, #ef4444) 80%, var(--text)); border-color: color-mix(in srgb, var(--danger, #ef4444) 30%, var(--border)); }
.health-pill.is-bad .health-dot { background: var(--danger, #ef4444); box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger, #ef4444) 18%, transparent); }

.action-needed { border-left: 3px solid color-mix(in srgb, var(--accent) 60%, transparent); }

@media (max-width: 720px) {
    .health-bar { display: none; }
}
