:root {
    --bg: #0f1218;
    --bg-muted: #141a23;
    --surface: #ffffff;
    --surface-muted: #f7f9fb;
    --surface-sunken: #eef1f6;
    --border: #e3e7ee;
    --border-strong: #c9d1dc;
    --text: #1a2330;
    --text-muted: #6b7685;
    --accent: #2563eb;
    --accent-hover: #1d4ed8;
    --accent-tint: #dbeafe;
    --danger: #dc2626;
    --danger-hover: #b91c1c;
    --success: #16a34a;
    --warn: #d97706;
    --sev-critical: #dc2626;
    --sev-high: #ea580c;
    --sev-medium: #d97706;
    --sev-low: #64748b;
    --radius: 6px;
    --radius-lg: 10px;
    --shadow: 0 1px 2px rgba(15, 18, 24, 0.04), 0 2px 8px rgba(15, 18, 24, 0.04);
    --shadow-lift: 0 4px 20px rgba(15, 18, 24, 0.06);
    --gap: 16px;
    --gap-lg: 24px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    font-size: 14px;
    color: var(--text);
    background: var(--surface-muted);
    line-height: 1.5;
}
code { font-family: 'SFMono-Regular', ui-monospace, Menlo, Monaco, Consolas, monospace; font-size: 0.9em; background: var(--surface-sunken); padding: 1px 6px; border-radius: 4px; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.2; letter-spacing: -0.01em; }
h1 { font-size: 24px; font-weight: 700; }
h2 { font-size: 15px; font-weight: 600; }
h3 { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.8px; color: var(--text-muted); }
p  { margin: 0; }
.muted { color: var(--text-muted); }
.small { font-size: 12px; }
.ta-right { text-align: right; }

/* ========================================================================
   Layout
   ======================================================================== */
.layout {
    display: grid;
    grid-template-columns: 240px minmax(0, 1fr);
    min-height: 100vh;
    max-width: 100vw;
}
.sidebar {
    background: var(--bg);
    color: #e3e7ee;
    padding: 22px 18px;
    display: flex;
    flex-direction: column;
    gap: 22px;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}
@media (max-width: 900px) {
    .layout { grid-template-columns: 1fr; }
    .sidebar { position: static; height: auto; max-height: none; }
    .nav { flex-direction: row; flex-wrap: wrap; }
    .nav-label { width: 100%; }
    .logout { flex-direction: row; align-items: center; }
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
    width: 34px; height: 34px; border-radius: 7px;
    background: linear-gradient(135deg, #2563eb, #8b5cf6);
    color: white; display: grid; place-items: center; font-weight: 700; font-size: 13px;
}
.brand-mark--lg { width: 52px; height: 52px; font-size: 18px; border-radius: 12px; }
.brand-name { font-weight: 700; color: white; }
.brand-sub { color: #8996a8; font-size: 12px; }

.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-label { font-size: 10px; text-transform: uppercase; letter-spacing: 1.2px; color: #6b7685; margin: 6px 2px 8px; font-weight: 600; }
.nav-label-section { margin-top: 14px; }
.nav-item {
    padding: 8px 10px; border-radius: var(--radius); color: #c5cdda; font-weight: 500; font-size: 13px;
    display: block;
}
.nav-item-sub {
    padding-left: 22px;
    position: relative;
    font-size: 12.5px;
    color: #a9b3c4;
}
.nav-item-sub::before {
    content: '';
    position: absolute;
    left: 10px;
    top: 50%;
    width: 5px; height: 5px;
    border-radius: 50%;
    background: #3a4556;
    transform: translateY(-50%);
}
.nav-item:hover { background: #1c242f; text-decoration: none; color: white; }
.nav-item.is-active { background: #1c242f; color: white; }
.nav-item.is-active.nav-item-sub::before { background: var(--accent); }
.nav-item.is-disabled { color: #556071; cursor: not-allowed; }
.nav-item.is-disabled:hover { background: transparent; color: #556071; }

.logout { display: flex; flex-direction: column; gap: 10px; }
.user-chip { background: #1c242f; border-radius: var(--radius); padding: 8px 10px; font-size: 12px; }
.user-name { color: white; }

.main {
    padding: 28px 32px;
    max-width: 1400px;
    width: 100%;
    min-width: 0;   /* allow grid track to shrink instead of overflow */
}
@media (max-width: 640px) {
    .main { padding: 20px 16px; }
}

/* ========================================================================
   Page header + section rhythm
   ======================================================================== */
.page-header {
    display: flex; justify-content: space-between; align-items: flex-start; gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}
.page-header h1 { margin-bottom: 4px; }
.page-header > div:first-child { min-width: 0; flex: 1 1 320px; }
.page-header-actions {
    display: flex; gap: 8px; flex-wrap: wrap;
    flex-shrink: 0;
    justify-content: flex-end;
}

/* Vertical rhythm between dashboard sections */
.section { margin-bottom: var(--gap-lg); }
.section-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--gap);
}
@media (max-width: 900px) {
    .section-grid { grid-template-columns: 1fr; }
}

/* ========================================================================
   Cards
   ======================================================================== */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 18px 20px;
}
.card + .card { margin-top: var(--gap); }
.card-narrow { max-width: 520px; }
.card-subtle { background: #fbfcfe; }
.card-header {
    display: flex; justify-content: space-between; align-items: baseline;
    margin-bottom: 14px; gap: 12px;
}
.card-header h2 { font-size: 15px; font-weight: 600; }

/* ========================================================================
   KPI
   ======================================================================== */
.kpi-row {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: var(--gap);
}
.kpi-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 18px 20px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.kpi-card-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    font-weight: 600;
}
.kpi-card-value { font-size: 30px; font-weight: 700; color: var(--text); line-height: 1; }
.kpi-card-sub { margin-top: 4px; }

/* Legacy kpi-grid (still used on runs/health) */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: var(--gap);
    margin-bottom: var(--gap);
}
.kpi {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px 18px;
    box-shadow: var(--shadow);
}
.kpi-value { font-size: 26px; font-weight: 700; color: var(--text); }
.kpi-critical { color: var(--sev-critical); }
.kpi-label { color: var(--text-muted); font-size: 13px; margin-top: 2px; }

/* ========================================================================
   Tabs
   ======================================================================== */
.tabs {
    display: flex;
    gap: 2px;
    border-bottom: 1px solid var(--border);
    margin-bottom: var(--gap);
    overflow-x: auto;
}
.tab {
    appearance: none;
    background: none;
    border: 0;
    border-bottom: 2px solid transparent;
    padding: 10px 14px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    transition: color 80ms ease, border-color 80ms ease;
    text-decoration: none;
    white-space: nowrap;
}
.tab:hover { color: var(--text); text-decoration: none; }
.tab.is-active {
    color: var(--accent);
    border-bottom-color: var(--accent);
    font-weight: 600;
}
.tab-badge {
    display: inline-block;
    margin-left: 6px;
    padding: 1px 7px;
    font-size: 10px;
    background: var(--surface-sunken);
    color: var(--text-muted);
    border-radius: 999px;
    font-weight: 600;
}
.tab.is-active .tab-badge { background: var(--accent-tint); color: var(--accent); }
.tabs-plain .tab { padding: 6px 12px; border-bottom: 0; border-radius: 999px; }
.tabs-plain .tab.is-active { background: var(--accent-tint); color: var(--accent); }
.tabs-plain { border-bottom: 0; margin-bottom: var(--gap); flex-wrap: wrap; }

.tab-panel { display: none; }
.tab-panel.is-active { display: block; }

/* ========================================================================
   Tables
   ======================================================================== */
/* Wrap scrollable tables so the grid track doesn't grow */
.table-wrap { overflow-x: auto; margin: 0 -4px; }
.card > .table, .card > .table-wrap { margin-top: 10px; }

.table { width: 100%; border-collapse: collapse; table-layout: auto; }
.table th, .table td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table td code, .table th code { word-break: break-all; }
.table th {
    font-weight: 600;
    color: var(--text-muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    background: var(--surface-muted);
}
.table tbody tr:hover { background: var(--surface-muted); }
.table.table-compact th, .table.table-compact td { padding: 7px 8px; font-size: 13px; }

.finding-link { color: var(--text); font-weight: 500; }
.finding-link:hover { color: var(--accent); text-decoration: none; }
.finding-link code { background: transparent; padding: 0; font-size: 13px; color: inherit; }

/* ========================================================================
   Charts
   ======================================================================== */
.chart { display: block; width: 100%; height: auto; }
.chart-line { max-height: 220px; }
.chart-donut { display: block; margin: 0 auto; }
.chart-empty { min-height: 60px; }

.donut-with-legend {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 20px;
    align-items: center;
}
.legend {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.legend li {
    display: grid;
    grid-template-columns: 12px 1fr auto;
    gap: 10px;
    align-items: center;
    font-size: 13px;
}
.legend .dot { width: 10px; height: 10px; border-radius: 2px; }
.legend strong { font-weight: 700; color: var(--text); }

/* Legacy bars on detail pages (still used on runs/show.phtml) */
.bars { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.bars li { display: grid; grid-template-columns: 140px 1fr 40px; gap: 10px; align-items: center; }
.bar-label { font-weight: 500; }
.bar-track { background: var(--surface-sunken); height: 10px; border-radius: 5px; overflow: hidden; }
.bar-fill  { background: var(--accent); height: 100%; border-radius: 5px; }
.bar-value { text-align: right; color: var(--text-muted); font-size: 12px; }

/* ========================================================================
   Brand tiles (on overview)
   ======================================================================== */
.brand-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: var(--gap);
}
.brand-tile {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 14px 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    color: var(--text);
    transition: border-color 80ms ease, transform 80ms ease, box-shadow 80ms ease;
    text-decoration: none;
}
.brand-tile:hover {
    text-decoration: none;
    border-color: var(--accent-tint);
    transform: translateY(-1px);
    box-shadow: var(--shadow-lift);
}
.brand-tile-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}
.brand-tile-name { font-weight: 600; font-size: 14px; }
.brand-tile-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}
.brand-tile-stat {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.brand-tile-stat-value { font-size: 22px; font-weight: 700; line-height: 1; }
.brand-tile-stat-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--text-muted);
    font-weight: 600;
}
.brand-tile-foot { margin-top: auto; }

/* ========================================================================
   Threat list / run list on overview
   ======================================================================== */
.threat-list, .run-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.threat-item {
    padding: 10px 12px;
    background: var(--surface-muted);
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.threat-meta { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.threat-title { font-weight: 500; color: var(--text); }
.threat-title:hover { color: var(--accent); }
.threat-sub { font-size: 12px; }

.run-item {
    display: grid;
    grid-template-columns: 8px minmax(0, 1fr);
    gap: 10px;
    align-items: flex-start;
    padding: 8px 0;
    border-bottom: 1px dashed var(--border);
}
.run-item:last-child { border-bottom: 0; }
.run-item-body { min-width: 0; }
.run-item-body a { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.run-item-body .muted { word-break: break-word; }
.run-item-status {
    width: 8px; height: 8px; border-radius: 50%; background: var(--sev-low); margin-top: 7px;
}
.run-completed { background: var(--success); }
.run-running   { background: var(--accent); }
.run-failed, .run-error { background: var(--danger); }
.run-pending   { background: var(--warn); }

/* ========================================================================
   Summary meta on finding detail
   ======================================================================== */
.summary-meta {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 10px;
    margin-top: 14px;
}
.summary-meta > div { display: flex; flex-direction: column; gap: 2px; }
.meta-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--text-muted);
    font-weight: 600;
}
.reason-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}
@media (max-width: 800px) { .reason-grid { grid-template-columns: 1fr; } }
.reason-col-header {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--text-muted);
    font-weight: 700;
    margin-bottom: 10px;
}

/* ========================================================================
   Chips / pills
   ======================================================================== */
.chip {
    display: inline-flex; align-items: center; gap: 6px;
    background: var(--surface-sunken); color: var(--text);
    padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 500;
}
.chip-primary { background: var(--accent-tint); color: var(--accent-hover); }
.chip-cat { background: var(--accent-tint); color: var(--accent-hover); font-weight: 600; }
.chip-tag { font-style: normal; background: rgba(0,0,0,0.08); padding: 1px 6px; border-radius: 999px; font-size: 10px; }
.chip-list { list-style: none; padding: 0; margin: 12px 0 0; display: flex; flex-direction: column; gap: 6px; }
.chip-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 4px 0; }

.sev {
    text-transform: uppercase; font-size: 10px; font-weight: 700; letter-spacing: 0.6px;
    padding: 3px 8px; border-radius: 999px; white-space: nowrap;
}
.sev-critical { background: #fee2e2; color: var(--sev-critical); }
.sev-high     { background: #ffedd5; color: var(--sev-high); }
.sev-medium   { background: #fef3c7; color: var(--sev-medium); }
.sev-low      { background: var(--surface-sunken); color: var(--sev-low); }

.conf {
    text-transform: uppercase; font-size: 10px; font-weight: 700; letter-spacing: 0.6px;
    padding: 3px 8px; border-radius: 999px; white-space: nowrap;
}
.conf-verified { background: #dcfce7; color: #15803d; }
.conf-high     { background: #dbeafe; color: #1d4ed8; }
.conf-medium   { background: #e0e7ff; color: #4338ca; }
.conf-low      { background: var(--surface-sunken); color: #475569; }

.reason-kind {
    font-family: 'SFMono-Regular', ui-monospace, Menlo, Monaco, Consolas, monospace;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 4px;
    margin-right: 8px;
    white-space: nowrap;
}
.reason-kind-severity   { background: #fee2e2; color: var(--sev-critical); }
.reason-kind-confidence { background: var(--accent-tint); color: var(--accent); }

/* ========================================================================
   Forms + inputs
   ======================================================================== */
.form, .inline-form { display: flex; flex-direction: column; gap: 12px; }
.inline-form { flex-direction: row; align-items: center; gap: 8px; margin: 4px 0 10px; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field > span { font-weight: 500; font-size: 13px; color: var(--text); }
input[type="text"], input[type="password"], input[type="file"], textarea, select {
    padding: 9px 11px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    font-size: 13px;
    background: white;
    color: var(--text);
    font-family: inherit;
    width: 100%;
}
select { padding: 8px 11px; }
input[type="text"]:focus, input[type="password"]:focus, textarea:focus, select:focus {
    outline: 2px solid rgba(37, 99, 235, 0.25);
    border-color: var(--accent);
}
input[type="file"] { padding: 6px 11px; background: white; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }

.filter-panel {
    background: var(--surface-muted);
    border-radius: var(--radius);
    padding: 8px 12px;
    margin-bottom: 14px;
}
.filter-panel summary {
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 4px 0;
}
.filter-panel[open] { padding-bottom: 12px; }
.filter-bar { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.filter-bar select, .filter-bar input[type="text"] {
    padding: 6px 10px; border: 1px solid var(--border-strong); border-radius: var(--radius);
    font-size: 13px; background: white; color: var(--text); font-family: inherit; min-width: 140px;
    width: auto;
}

.bulk-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    margin-bottom: 8px;
    background: var(--surface-muted);
    border-radius: var(--radius);
    flex-wrap: wrap;
}
.bulk-bar label { display: flex; align-items: center; gap: 6px; cursor: pointer; }

/* ========================================================================
   Progress bar for in-flight runs
   ======================================================================== */
.progress {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 140px;
}
.progress-bar {
    flex: 1;
    height: 6px;
    background: var(--surface-sunken);
    border-radius: 3px;
    overflow: hidden;
    min-width: 80px;
}
.progress-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 3px;
    transition: width 400ms ease;
}
.progress-fill--live {
    background: linear-gradient(90deg, var(--accent) 0%, #60a5fa 50%, var(--accent) 100%);
    background-size: 200% 100%;
    animation: progress-shimmer 1.6s linear infinite;
}
@keyframes progress-shimmer {
    0%   { background-position: 100% 0; }
    100% { background-position: -100% 0; }
}
.progress-label {
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}
.progress-lg { min-width: 280px; }
.progress-lg .progress-bar { height: 10px; border-radius: 5px; }
.progress-lg .progress-fill { border-radius: 5px; }
.progress-lg .progress-label { font-size: 12px; color: var(--text); font-weight: 600; }

.progress-block { margin-bottom: 14px; }

.phase-list {
    list-style: none;
    padding: 0;
    margin: 10px 0 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 4px 14px;
}
.phase-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-muted);
}
.phase-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 1.5px solid var(--border-strong);
    background: white;
    flex-shrink: 0;
    position: relative;
}
.phase-done { color: var(--text); }
.phase-done .phase-dot {
    background: var(--success);
    border-color: var(--success);
}
.phase-done .phase-dot::after {
    content: '';
    position: absolute;
    left: 2px;
    top: 0;
    width: 3px;
    height: 6px;
    border: solid white;
    border-width: 0 1.5px 1.5px 0;
    transform: rotate(45deg);
}

.status-pill {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.6px;
}
.status-completed { background: #dcfce7; color: #15803d; }
.status-failed    { background: #fee2e2; color: var(--danger); }
.status-cancelled { background: var(--surface-sunken); color: var(--text-muted); }

/* ========================================================================
   Signals / reasons / evidence / audit / raw
   ======================================================================== */
.reasons { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.reasons li { padding: 8px 12px; background: var(--surface-muted); border-radius: var(--radius); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 13px; }
.reason-sev { border-left: 3px solid var(--sev-critical); }
.reason-conf { border-left: 3px solid var(--accent); }
.reasons code { margin-right: 4px; }

.evidence-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 18px; }
.evidence-item { padding: 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-muted); }
.evidence-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.evidence-signals { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.evidence-shot {
    max-width: 100%;
    border-radius: 6px;
    border: 1px solid var(--border);
    margin-top: 10px;
    display: block;
}

.audit { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.audit li { padding: 6px 0; border-bottom: 1px dashed var(--border); }
.audit li:last-child { border-bottom: none; }

.raw-json {
    background: #0f1218; color: #cfd3dc; padding: 14px; border-radius: var(--radius);
    overflow-x: auto; font-size: 12px; max-height: 420px;
}
.stat-list { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.stat-list li { padding: 8px 12px; background: var(--surface-muted); border-radius: var(--radius); }

.signal-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 12px;
}
.signal-block {
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface-muted);
}
.signal-block h3 { margin: 0 0 10px; }
.signal-block dl { margin: 0; display: grid; grid-template-columns: 110px 1fr; row-gap: 4px; column-gap: 10px; font-size: 12px; }
.signal-block dt { color: var(--text-muted); }
.signal-block dd { margin: 0; word-break: break-word; }
.signal-block code { background: transparent; padding: 0; }

.notes-area {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    font: inherit;
    font-size: 13px;
    min-height: 120px;
    resize: vertical;
    background: white;
    color: var(--text);
}
.notes-area:focus { outline: 2px solid rgba(37, 99, 235, 0.25); border-color: var(--accent); }

/* ========================================================================
   Buttons
   ======================================================================== */
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 8px 14px; font-size: 13px; font-weight: 600;
    border: 1px solid transparent; border-radius: var(--radius);
    cursor: pointer; background: white; color: var(--text);
    transition: background 80ms ease, border-color 80ms ease, transform 80ms ease;
    font-family: inherit;
    white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-sm { padding: 6px 10px; font-size: 12px; }
.btn-xs { padding: 3px 8px; font-size: 11px; }
.btn-block { width: 100%; }
.btn-primary { background: var(--accent); color: white; border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-ghost { background: white; border-color: var(--border-strong); color: var(--text); }
.btn-ghost:hover { background: var(--surface-muted); border-color: var(--border-strong); }
.btn-danger { background: var(--danger); color: white; border-color: var(--danger); }
.btn-danger:hover { background: var(--danger-hover); }

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

/* ========================================================================
   Empty states + flash
   ======================================================================== */
.empty {
    text-align: center; padding: 28px 16px; color: var(--text-muted);
    display: flex; flex-direction: column; align-items: center; gap: 10px;
}

.flash {
    border: 1px solid; border-radius: var(--radius);
    padding: 10px 14px; margin-bottom: 14px; font-size: 13px;
}
.flash-success { background: #ecfdf5; border-color: #a7f3d0; color: #065f46; }
.flash-error   { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.flash-floating { position: fixed; top: 16px; right: 16px; z-index: 100; box-shadow: var(--shadow); }

/* ========================================================================
   Login
   ======================================================================== */
body.bare { background: var(--bg); display: grid; place-items: center; min-height: 100vh; color: var(--text); }
.login-wrap { width: 100%; max-width: 400px; padding: 24px; }
.login-card {
    background: white; border-radius: 12px; padding: 28px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
    display: flex; flex-direction: column; gap: 14px;
}
.login-brand { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; margin-bottom: 8px; }
.login-hint { margin-top: 10px; text-align: center; }
