/* ============================================================
   AI Citadel Fleet Console — SOC console stylesheet
   Dark theme by default. All colors sourced from tokens.css.
   Organized by section. Keep maintainable: no hardcoded colors.
   ============================================================ */
@import url("tokens.css");

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: var(--font-sans);
    background: var(--bg);
    color: var(--text);
    font-size: var(--fs-body);
    line-height: var(--lh-normal);
    -webkit-font-smoothing: antialiased;
}

/* ── Skip link (a11y) ── */
.skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    z-index: 200;
    background: var(--brand);
    color: var(--text-on-brand);
    padding: var(--space-2) var(--space-4);
    border-radius: 0 0 var(--radius) 0;
    font-weight: var(--fw-semibold);
    font-size: var(--fs-small);
}
.skip-link:focus { left: 0; }

/* ── Focus visibility (keyboard a11y) ── */
:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
}
.btn:focus-visible, .nav-item:focus-visible, .select:focus-visible,
.toggle-row input[type="checkbox"]:focus-visible, .kind-filter:focus-visible,
.btn-ghost:focus-visible, a:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
}

.layout { display: flex; min-height: 100vh; }

/* ── Sidebar ─────────────────────────────────────────────── */
.sidebar {
    width: 224px;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    flex-shrink: 0;
    border-right: 1px solid var(--border);
}

.brand {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-4);
    border-bottom: 1px solid var(--border);
}
.brand-mark {
    width: 34px; height: 34px;
    flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
}
.brand-mark svg { display: block; }
.brand-name { color: var(--text); font-weight: var(--fw-semibold); font-size: var(--fs-body); letter-spacing: 0.2px; }
.brand-sub { font-size: var(--fs-caption); color: var(--text-3); letter-spacing: 0.5px; text-transform: uppercase; }

.nav { padding: var(--space-3) var(--space-2); flex: 1; overflow-y: auto; }
.nav-item {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius);
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: var(--fs-small);
    margin-bottom: 2px;
    transition: background var(--transition-fast), color var(--transition-fast);
    position: relative;
}
.nav-item:hover { background: var(--sidebar-active); color: var(--text); }
.nav-item.active { background: var(--sidebar-active); color: var(--text); }
.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0; top: 6px; bottom: 6px;
    width: 3px;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    background: var(--brand);
}
.nav-badge {
    margin-left: auto;
    background: var(--surface-3);
    border-radius: var(--radius-pill);
    font-size: 10px;
    font-weight: var(--fw-semibold);
    padding: 1px 7px;
    color: var(--text-2);
}
.nav-badge.warn { background: var(--warn-dim); color: var(--warn); }

.sidebar-footer {
    padding: var(--space-3) var(--space-4);
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}
.conn { display: flex; align-items: center; gap: var(--space-2); font-size: var(--fs-small); color: var(--text-2); }
.conn-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.conn-dot.online { background: var(--ok); box-shadow: 0 0 6px var(--ok); }
.conn-dot.offline { background: var(--danger); }
.policy-chip {
    font-size: var(--fs-caption);
    background: var(--surface-3);
    border-radius: var(--radius-sm);
    padding: 3px var(--space-2);
    align-self: flex-start;
    color: var(--text-2);
}

/* ── Main ────────────────────────────────────────────────── */
.main { flex: 1; padding: var(--space-5) var(--space-6); width: 100%; min-width: 0; }
.view { display: flex; flex-direction: column; gap: var(--space-4); }

/* ── Top bar (instance selector + time range + theme toggle) ── */
.topbar {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: var(--space-2) var(--space-4);
    margin-bottom: var(--space-4);
    flex-wrap: wrap;
}
.topbar-label { color: var(--text-2); font-size: var(--fs-small); white-space: nowrap; }
.topbar-spacer { flex: 1; }
.topbar-right { display: flex; align-items: center; gap: var(--space-2); margin-left: auto; }
.icon-btn {
    width: 34px; height: 34px;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-2);
    cursor: pointer;
    transition: background var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast);
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); border-color: var(--border-strong); }

.instance-bar { /* legacy alias kept for compatibility */ }

/* ── KPI cards ───────────────────────────────────────────── */
.kpi-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-3); }
.kpi {
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 3px solid var(--brand);
    border-radius: var(--radius);
    padding: var(--space-4);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.kpi-label {
    font-size: var(--fs-caption);
    font-weight: var(--fw-semibold);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-3);
    margin-bottom: var(--space-2);
}
.kpi-value {
    font-size: var(--fs-h1);
    font-weight: var(--fw-bold);
    font-variant-numeric: tabular-nums;
    line-height: var(--lh-tight);
    letter-spacing: -0.5px;
}
.kpi:nth-child(2) { border-left-color: var(--purple); }
.kpi:nth-child(3) { border-left-color: var(--info); }
.kpi:nth-child(4) { border-left-color: var(--ok); }
.kpi:hover { box-shadow: var(--shadow-card); border-color: var(--border-strong); }

.grid-2col { display: grid; grid-template-columns: 1.5fr 1fr; gap: var(--space-4); align-items: start; width: 100%; }
.stack { display: flex; flex-direction: column; gap: var(--space-4); }

/* ── Card ────────────────────────────────────────────────── */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: var(--space-4);
    box-shadow: var(--shadow-card);
}
.card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    margin-bottom: var(--space-3);
}
.card-head h2 { font-size: var(--fs-h2); font-weight: var(--fw-bold); letter-spacing: -0.2px; }
.muted { color: var(--text-2); font-size: var(--fs-small); margin-bottom: var(--space-2); }
.prose { font-size: var(--fs-small); color: var(--text-2); line-height: 1.6; }
.prose p { margin-bottom: var(--space-3); }
.prose strong { color: var(--text); }

code {
    background: var(--surface-2);
    padding: 1px 6px;
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--brand-2);
}
pre {
    background: var(--sidebar-bg);
    color: var(--text-2);
    padding: var(--space-3);
    border-radius: var(--radius);
    font-family: var(--font-mono);
    font-size: 12.5px;
    overflow-x: auto;
    margin: var(--space-2) 0;
    border: 1px solid var(--border);
}

/* ── Chips / badges ──────────────────────────────────────── */
.chip {
    font-size: var(--fs-caption);
    font-weight: var(--fw-semibold);
    padding: 2px var(--space-2);
    border-radius: var(--radius-pill);
    background: var(--surface-2);
    color: var(--text-2);
    white-space: nowrap;
}
.chip-warn { background: var(--warn-dim); color: var(--warn); }
.chip-purple { background: var(--purple-dim); color: var(--purple); }

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
    border: 1px solid var(--border-strong);
    background: var(--surface-2);
    color: var(--text);
    border-radius: var(--radius);
    padding: var(--space-2) var(--space-4);
    font-size: var(--fs-small);
    font-weight: var(--fw-medium);
    cursor: pointer;
    transition: background var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
}
.btn:hover { background: var(--surface-3); border-color: var(--border-strong); }
.btn-sm { padding: var(--space-1) var(--space-3); font-size: var(--fs-caption); }
.btn-ghost { border-color: transparent; color: var(--text-2); background: transparent; }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-danger { background: var(--danger-dim); color: var(--danger); border-color: transparent; }
.btn-danger:hover { background: var(--danger); color: var(--text-on-danger); border-color: var(--danger); }
.btn-accent { background: var(--brand); color: var(--text-on-brand); border-color: var(--brand); font-weight: var(--fw-semibold); }
.btn-accent:hover { background: var(--brand-2); border-color: var(--brand-2); }
.btn-ok { background: var(--ok); color: var(--text-on-brand); border-color: var(--ok); font-weight: var(--fw-semibold); }
.btn-ok:hover { background: var(--brand-2); border-color: var(--brand-2); }
.btn-row { display: flex; gap: var(--space-2); margin-top: var(--space-2); }
.btn-row .btn { flex: 1; }

/* ── Alert table ─────────────────────────────────────────── */
.alert-table { width: 100%; border-collapse: collapse; font-size: var(--fs-small); }
.alert-table th {
    text-align: left;
    font-size: var(--fs-caption);
    font-weight: var(--fw-semibold);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-3);
    border-bottom: 1px solid var(--border);
    padding: var(--space-2) var(--space-2);
    position: sticky;
    top: 0;
    background: var(--surface);
    z-index: 1;
}
.alert-table td {
    padding: var(--space-2) var(--space-2);
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}
.alert-table tbody tr { transition: background var(--transition-fast); }
.alert-table tbody tr:hover { background: var(--surface-2); }
.alert-time { font-family: var(--font-mono); font-size: 12px; color: var(--text-2); white-space: nowrap; }
.alert-host { font-weight: var(--fw-semibold); white-space: nowrap; }
.alert-action {
    font-family: var(--font-mono);
    font-size: var(--fs-caption);
    font-weight: var(--fw-semibold);
    padding: 2px var(--space-2);
    border-radius: var(--radius-sm);
    white-space: nowrap;
}
.alert-action.kill, .alert-action.denied { background: var(--danger-dim); color: var(--danger); }
.alert-action.would_block { background: var(--warn-dim); color: var(--warn); }
.alert-action.observe { background: var(--info-dim); color: var(--info); }
.alert-narr { color: var(--text); }
.alert-verdict { display: block; margin-top: 3px; font-size: 12px; color: var(--brand-2); font-family: var(--font-mono); }

.empty-note {
    padding: var(--space-6);
    text-align: center;
    color: var(--text-3);
    font-size: var(--fs-small);
}

/* ── Toggles & selects ───────────────────────────────────── */
.toggle-list { display: flex; flex-direction: column; gap: var(--space-2); margin-top: var(--space-3); }
.toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    padding: var(--space-3);
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: var(--fs-small);
}
.toggle-row input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 40px; height: 22px;
    background: var(--surface-3);
    border-radius: var(--radius-pill);
    position: relative;
    cursor: pointer;
    transition: background var(--transition);
    flex-shrink: 0;
    border: 1px solid var(--border-strong);
}
.toggle-row input[type="checkbox"]:checked { background: var(--brand); border-color: var(--brand); }
.toggle-row input[type="checkbox"]::after {
    content: '';
    position: absolute;
    width: 16px; height: 16px;
    background: var(--toggle-knob);
    border-radius: 50%;
    top: 2px; left: 2px;
    transition: left var(--transition);
}
.toggle-row input[type="checkbox"]:checked::after { left: 20px; }
.select {
    border: 1px solid var(--border-strong);
    background: var(--surface-2);
    color: var(--text);
    border-radius: var(--radius);
    padding: var(--space-2) var(--space-3);
    font-size: var(--fs-small);
    font-family: inherit;
    cursor: pointer;
    transition: border-color var(--transition-fast);
}
.select:hover { border-color: var(--brand); }
.select:focus-visible { box-shadow: var(--focus-ring); }

/* ── Kind dot ────────────────────────────────────────────── */
.kind-dot {
    display: inline-block;
    width: 8px; height: 8px;
    border-radius: 50%;
    margin-right: 6px;
    vertical-align: middle;
    flex-shrink: 0;
}
.kind-dot.honeytoken { background: var(--purple); }
.kind-dot.egress { background: var(--info); }
.kind-dot.ransomware { background: var(--danger); }
.kind-dot.dns, .kind-dot.dga { background: var(--info); }
.kind-dot.path { background: var(--warn); }
.kind-dot.c2 { background: var(--danger); }
.kind-dot.provenance { background: var(--ok); }

/* ── Endpoints ───────────────────────────────────────────── */
.endpoint-list { display: flex; flex-direction: column; gap: var(--space-2); max-height: 340px; overflow-y: auto; }
.endpoint-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: var(--space-3); }
.endpoint-card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: var(--space-3);
    background: var(--surface-2);
    transition: border-color var(--transition-fast);
}
.endpoint-card:hover { border-color: var(--border-strong); }
.endpoint-head { display: flex; align-items: center; gap: var(--space-2); margin-bottom: var(--space-2); }
.endpoint-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.endpoint-dot.online { background: var(--ok); box-shadow: 0 0 5px var(--ok); }
.endpoint-dot.offline { background: var(--danger); }
.endpoint-name { font-weight: var(--fw-semibold); }
.endpoint-seen { margin-left: auto; font-size: var(--fs-caption); color: var(--text-3); }
.metric-row { display: flex; align-items: center; gap: var(--space-2); margin: 3px 0; }
.metric-label { width: 34px; font-size: var(--fs-caption); color: var(--text-3); }
.metric-bar { flex: 1; height: 5px; background: var(--surface-3); border-radius: var(--radius-pill); overflow: hidden; }
.metric-fill { height: 100%; border-radius: var(--radius-pill); }
.metric-val { width: 40px; text-align: right; font-size: var(--fs-caption); font-variant-numeric: tabular-nums; color: var(--text-2); }
.endpoint-net { font-size: var(--fs-caption); color: var(--text-3); margin-top: 5px; font-family: var(--font-mono); }

/* ── Status grid (Governor view) ─────────────────────────── */
.status-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: var(--space-2) var(--space-4);
}
.status-item {
    display: flex;
    justify-content: space-between;
    gap: var(--space-3);
    padding: var(--space-2) var(--space-3);
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: var(--fs-small);
}
.status-label { color: var(--text-2); }
.status-item > span:last-child { font-family: var(--font-mono); font-weight: var(--fw-medium); }

/* ── Alert detail (rozbalení řádku) ──────────────────────── */
.alert-row { cursor: pointer; }
.alert-detail-row td {
    background: var(--surface-2);
    border-bottom: 1px solid var(--border);
    padding: var(--space-2) var(--space-3);
}
.alert-detail-json {
    font-family: var(--font-mono);
    font-size: 11.5px;
    color: var(--text-2);
    white-space: pre-wrap;
    word-break: break-all;
}

/* ── Kind filtry (Incidents view) ────────────────────────── */
.kind-filters {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin-bottom: var(--space-3);
}
.kind-filter {
    border: 1px solid var(--border-strong);
    background: var(--surface-2);
    border-radius: var(--radius-pill);
    padding: 3px var(--space-3);
    font-size: 12px;
    font-weight: var(--fw-medium);
    cursor: pointer;
    color: var(--text-2);
    transition: background var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast);
}
.kind-filter:hover { border-color: var(--brand); color: var(--text); }
.kind-filter.active {
    background: var(--brand);
    border-color: var(--brand);
    color: var(--text-on-brand);
    font-weight: var(--fw-semibold);
}

/* ── DNS list ────────────────────────────────────────────── */
.dns-list { display: flex; flex-direction: column; gap: 6px; max-height: 220px; overflow-y: auto; }
.dns-item {
    display: flex;
    justify-content: space-between;
    gap: var(--space-3);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: var(--space-2) var(--space-3);
    font-size: 12px;
    background: var(--surface-2);
}
.dns-narr { font-family: var(--font-mono); color: var(--text-2); overflow: hidden; text-overflow: ellipsis; }
.dns-meta { color: var(--ok); white-space: nowrap; }

/* ── Graph ───────────────────────────────────────────────── */
.graph-box {
    height: 380px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface-2);
}
.graph-box.tall { height: 68vh; }

/* ── Filter bar ──────────────────────────────────────────── */
.filter-bar { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-bottom: var(--space-3); }
.filter-search { flex: 1; min-width: 180px; cursor: text; }
.subhead {
    font-size: var(--fs-caption);
    font-weight: var(--fw-semibold);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-3);
    margin-bottom: var(--space-2);
}

/* ── MITRE ATT&CK heatmap ────────────────────────────────── */
.heatmap-wrap { overflow-x: auto; padding-bottom: var(--space-2); }
.heatmap-legend {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-top: var(--space-3);
    font-size: var(--fs-caption);
    color: var(--text-3);
}
.heatmap-scale {
    display: flex;
    gap: 2px;
}
.heatmap-scale span {
    width: 16px; height: 12px;
    border-radius: 2px;
}
.heatmap-grid {
    display: grid;
    gap: 3px;
    min-width: 760px;
}
.heatmap-corner, .heatmap-tactichd, .heatmap-techhd {
    font-size: 10px;
    color: var(--text-3);
    padding: var(--space-1) var(--space-2);
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    line-height: 1.15;
    font-weight: var(--fw-semibold);
}
.heatmap-corner { background: transparent; }
.heatmap-tactichd {
    background: var(--surface-2);
    border-radius: var(--radius-sm);
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.heatmap-techhd {
    background: var(--surface-2);
    border-radius: var(--radius-sm);
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    font-family: var(--font-mono);
    font-weight: var(--fw-medium);
}
.heatmap-rowlabel {
    font-size: 10px;
    color: var(--text-2);
    padding: var(--space-1) var(--space-2);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    text-align: right;
    font-weight: var(--fw-semibold);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    white-space: nowrap;
}
.heatmap-cell {
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: var(--fw-semibold);
    font-variant-numeric: tabular-nums;
    color: var(--text);
    cursor: pointer;
    min-height: 26px;
    transition: outline var(--transition-fast);
    border: 1px solid transparent;
}
.heatmap-cell:hover {
    outline: 2px solid var(--brand);
    outline-offset: 1px;
    border-color: var(--brand);
}
.heatmap-cell.zero { color: var(--text-3); }
.heatmap-cell.count-1 { background: var(--hm-bg-1); color: var(--hm-text-1); }
.heatmap-cell.count-2 { background: var(--hm-bg-2); color: var(--hm-text-2); }
.heatmap-cell.count-3 { background: var(--hm-bg-3); color: var(--hm-text-3); }
.heatmap-cell.count-4 { background: var(--hm-bg-4); color: var(--hm-text-4); }
.heatmap-cell.count-max { background: var(--hm-bg-max); color: var(--hm-text-max); }
:root[data-theme="light"] .heatmap-cell.count-1 { background: var(--hm-bg-1); color: var(--hm-text-1); }
:root[data-theme="light"] .heatmap-cell.count-2 { background: var(--hm-bg-2); color: var(--hm-text-2); }
:root[data-theme="light"] .heatmap-cell.count-3 { background: var(--hm-bg-3); color: var(--hm-text-3); }
:root[data-theme="light"] .heatmap-cell.count-4 { background: var(--hm-bg-4); color: var(--hm-text-4); }
:root[data-theme="light"] .heatmap-cell.count-max { background: var(--hm-bg-max); color: var(--hm-text-max); }

/* ── Attack replay (incident drawer) ─────────────────────── */
.replay-box { margin-bottom: var(--space-3); }
.replay-graph { height: 260px; margin-bottom: var(--space-2); }
.replay-controls { display: flex; gap: var(--space-2); align-items: center; margin-bottom: var(--space-2); }
.replay-controls .btn { flex: none; }
.replay-slider { flex: 1; min-width: 0; }
.replay-steps {
    display: flex;
    flex-direction: column;
    gap: 2px;
    max-height: 180px;
    overflow-y: auto;
}
.replay-step {
    padding: var(--space-1) var(--space-2);
    border-radius: var(--radius-sm);
    font-size: 12px;
    cursor: pointer;
    border-left: 2px solid transparent;
    transition: background var(--transition-fast);
}
.replay-step:hover { background: var(--surface-2); }
.replay-step.active { background: var(--brand-dim); border-left-color: var(--brand); color: var(--text); }
.replay-ts { font-family: var(--font-mono); font-size: var(--fs-caption); color: var(--text-3); margin-right: 6px; }

/* ── Status badge (incident triage) ──────────────────────── */
.status-badge {
    font-size: var(--fs-caption);
    padding: 2px var(--space-2);
    border-radius: var(--radius-pill);
    white-space: nowrap;
    font-weight: var(--fw-semibold);
}
.status-badge.status-new { background: var(--danger-dim); color: var(--danger); }
.status-badge.status-in_progress { background: var(--info-dim); color: var(--info); }
.status-badge.status-resolved { background: var(--ok-dim); color: var(--ok); }
.status-badge.status-false_positive { background: var(--surface-3); color: var(--text-2); }

/* ── MITRE chip ──────────────────────────────────────────── */
.chip-mitre {
    font-size: var(--fs-caption);
    padding: 2px var(--space-2);
    border-radius: var(--radius-pill);
    background: var(--purple-dim);
    color: var(--purple);
    white-space: nowrap;
    font-weight: var(--fw-semibold);
}

/* ── Incident detail drawer ──────────────────────────────── */
.drawer-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(7, 11, 18, 0.65);
    backdrop-filter: blur(2px);
    z-index: 40;
}
.drawer {
    position: fixed;
    top: 0; right: 0;
    height: 100vh;
    width: 480px;
    max-width: 94vw;
    background: var(--surface);
    border-left: 1px solid var(--border);
    box-shadow: var(--shadow-drawer);
    z-index: 50;
    display: flex;
    flex-direction: column;
}
.drawer-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--border);
    background: var(--surface);
}
.drawer-head h2 { font-size: var(--fs-small); font-weight: var(--fw-semibold); font-family: var(--font-mono); color: var(--brand-2); }
.drawer-body {
    padding: var(--space-4);
    overflow-y: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}
.drawer-section { display: flex; flex-direction: column; gap: var(--space-2); }
.drawer-section + .drawer-section { padding-top: var(--space-4); border-top: 1px solid var(--border); }
.drawer-section h3 {
    font-size: var(--fs-caption);
    font-weight: var(--fw-semibold);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-3);
}
.meta-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-2) var(--space-4); font-size: var(--fs-small); }
.meta-grid .m-label { display: block; font-size: var(--fs-caption); color: var(--text-3); margin-bottom: 2px; text-transform: uppercase; letter-spacing: 0.03em; }
.meta-grid .m-value { font-family: var(--font-mono); font-size: 12.5px; word-break: break-all; }

/* ── Timeline ────────────────────────────────────────────── */
.timeline { display: flex; flex-direction: column; border-left: 2px solid var(--border); margin-left: 6px; }
.timeline-item { padding: var(--space-2) 0 var(--space-2) var(--space-4); position: relative; font-size: var(--fs-small); }
.timeline-item::before {
    content: '';
    position: absolute;
    left: -5px; top: 12px;
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--brand);
}
.timeline-item.ev-status::before { background: var(--warn); }
.timeline-item.ev-action::before { background: var(--danger); }
.timeline-item.ev-note::before { background: var(--purple); }
.timeline-item.ev-suppressed::before { background: var(--text-3); }
.timeline-ts { font-family: var(--font-mono); font-size: var(--fs-caption); color: var(--text-3); margin-right: 6px; }

/* ── Related incidents ───────────────────────────────────── */
.related-item {
    padding: var(--space-2) var(--space-3);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 12px;
    cursor: pointer;
    margin-bottom: 6px;
    transition: background var(--transition-fast), border-color var(--transition-fast);
}
.related-item:hover { background: var(--surface-2); border-color: var(--border-strong); }

/* ── Note form ───────────────────────────────────────────── */
.note-form textarea {
    width: 100%;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    padding: var(--space-2);
    font-size: var(--fs-small);
    font-family: inherit;
    background: var(--surface-2);
    color: var(--text);
    resize: vertical;
    min-height: 60px;
    margin-bottom: var(--space-2);
}
.note-form textarea:focus { border-color: var(--brand); outline: none; box-shadow: var(--focus-ring); }

/* ── Toast notifikace ────────────────────────────────────── */
.toast-container {
    position: fixed;
    bottom: var(--space-5); right: var(--space-5);
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}
.toast {
    background: var(--surface-3);
    color: var(--text);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    padding: var(--space-3) var(--space-4);
    font-size: var(--fs-small);
    max-width: 340px;
    box-shadow: var(--shadow-pop);
    border-left: 3px solid var(--brand);
}
.toast.ok { border-left-color: var(--ok); }
.toast.error { border-left-color: var(--danger); }

/* ── Fleet health ────────────────────────────────────────── */
.outdated-badge {
    font-size: var(--fs-caption);
    padding: 1px 7px;
    border-radius: var(--radius-pill);
    background: var(--warn-dim);
    color: var(--warn);
    margin-left: 6px;
    white-space: nowrap;
    font-weight: var(--fw-semibold);
}

/* Security skóre badge */
.score-badge {
    font-size: var(--fs-caption);
    padding: 2px var(--space-2);
    border-radius: var(--radius-pill);
    white-space: nowrap;
    font-weight: var(--fw-bold);
    cursor: help;
}
.score-badge.score-A { background: var(--ok-dim); color: var(--ok); }
.score-badge.score-B { background: var(--lime-dim); color: var(--lime); }
.score-badge.score-C { background: var(--warn-dim); color: var(--warn); }
.score-badge.score-D { background: var(--danger-dim); color: var(--danger); }
:root[data-theme="light"] .score-badge.score-B { background: var(--lime-dim); color: var(--lime); }

/* ── Exec Autopilot listy ────────────────────────────────── */
.ap-list { display: flex; flex-direction: column; gap: 6px; }
.ap-item {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: var(--space-2) var(--space-3);
    font-size: 12px;
    background: var(--surface-2);
}
.ap-path {
    font-family: var(--font-mono);
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ── Fleet rules / exclusions (Settings) ─────────────────── */
.rules-lists {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: var(--space-4);
    margin: var(--space-3) 0;
}
.rule-list-block h3 {
    font-size: var(--fs-caption);
    font-weight: var(--fw-semibold);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-3);
    margin: 0 0 var(--space-2) 0;
}
.rule-list-block .ap-item { background: var(--surface); }
.rule-add-row { display: flex; gap: 6px; margin-top: var(--space-2); }
.rule-add-row input { flex: 1; min-width: 0; cursor: text; text-align: left; }

/* ── Policy groups ───────────────────────────────────────── */
.select-sm { padding: 3px var(--space-2); font-size: 12px; }
.pg-item { flex-wrap: wrap; }
.pg-summary { flex: 1; min-width: 160px; font-size: var(--fs-caption); color: var(--text-2); }
.pg-paranoid-label {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    white-space: nowrap;
    cursor: pointer;
    color: var(--text-2);
}
.pg-editing input[type="text"] { flex: 1; min-width: 140px; cursor: text; text-align: left; }

/* ── Instance bar + charts (legacy/compat) ───────────────── */
.instance-bar {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: var(--space-2) var(--space-4);
    margin-bottom: var(--space-4);
}
.instance-bar-label { color: var(--text-2); font-size: var(--fs-small); }
.charts-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-4); }
.chart { width: 100%; height: 140px; display: block; }
.instance-meta {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2) var(--space-6);
    font-size: var(--fs-small);
}
.instance-meta .meta-item { display: flex; gap: var(--space-2); }
.instance-meta .meta-label { color: var(--text-2); }

.host-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    align-items: center;
    margin-bottom: var(--space-2);
}
.host-actions .select { max-width: 140px; }
.btn-danger {
    background: var(--danger-dim, rgba(220, 38, 38, 0.2));
    color: var(--danger, #f87171);
    border: 1px solid var(--danger, #f87171);
}
.btn-danger:hover { filter: brightness(1.1); }

.storyline {
    display: flex;
    flex-direction: column;
    gap: 0;
    max-height: 420px;
    overflow-y: auto;
}
.storyline-item {
    display: grid;
    grid-template-columns: 88px 88px 1fr auto;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    border-bottom: 1px solid var(--border);
    font-size: var(--fs-small);
    align-items: start;
}
.storyline-item:hover { background: var(--surface-2); }
.storyline-ts { color: var(--text-2); font-variant-numeric: tabular-nums; }
.storyline-type {
    font-weight: 600;
    text-transform: uppercase;
    font-size: 10px;
    letter-spacing: 0.04em;
    color: var(--brand);
}
.storyline-type.incident { color: var(--warn, #fbbf24); }
.storyline-type.alert { color: var(--ok, #34d399); }
.storyline-title { color: var(--text); word-break: break-word; }
.storyline-actions { display: flex; gap: 4px; flex-wrap: wrap; }
.storyline-empty { color: var(--text-2); padding: var(--space-4); }

/* ── Loading skeleton ────────────────────────────────────── */
.skeleton {
    background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 37%, var(--surface-2) 63%);
    background-size: 400% 100%;
    animation: skeletonShimmer 1.4s ease infinite;
    border-radius: var(--radius-sm);
}
@keyframes skeletonShimmer {
    0% { background-position: 100% 50%; }
    100% { background-position: 0 50%; }
}
.skeleton-line { height: 12px; margin-bottom: 6px; }
.skeleton-line.short { width: 40%; }
.skeleton-row { display: grid; grid-template-columns: 1fr 2fr 1fr; gap: var(--space-2); padding: var(--space-2) 0; }

/* ── VQC + LLM telemetry panels ──────────────────────────── */
.telemetry-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: var(--space-3);
}
.kpi-row-sm {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-3);
    margin-bottom: var(--space-3);
}
.kpi-sm {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: var(--space-3);
}
.kpi-sm .kpi-label { font-size: var(--fs-caption); color: var(--text-3); margin-bottom: 2px; }
.kpi-sm .kpi-value { font-size: 20px; font-weight: var(--fw-bold); font-variant-numeric: tabular-nums; }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 1100px) {
    .grid-2col { grid-template-columns: 1fr; }
    .kpi-row { grid-template-columns: repeat(2, 1fr); }
    .charts-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .layout { flex-direction: column; }
    .sidebar {
        width: 100%;
        height: auto;
        position: static;
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        padding: var(--space-2);
    }
    .brand { padding: 6px var(--space-2); border-bottom: none; }
    .nav { display: flex; flex-wrap: wrap; padding: 0; gap: 2px; flex: 1; }
    .nav-item { padding: 6px var(--space-3); margin-bottom: 0; font-size: 12px; }
    .nav-item.active::before { display: none; }
    .sidebar-footer { flex-direction: row; border-top: none; padding: 6px var(--space-2); margin-left: auto; }
    .main { padding: var(--space-3); }
    .kpi-row { grid-template-columns: repeat(2, 1fr); }
    .alert-table { display: block; overflow-x: auto; white-space: nowrap; }
    .alert-table thead, .alert-table tbody, .alert-table tr { display: table; width: 100%; table-layout: auto; }
    .alert-table th { position: static; }
    .endpoint-grid { grid-template-columns: 1fr; }
    .graph-box { height: 280px; }
    .drawer { width: 100vw; }
}

@media (max-width: 480px) {
    .kpi-row { grid-template-columns: 1fr; }
    .btn-row { flex-direction: column; }
    .kpi-row-sm { grid-template-columns: 1fr; }
}
