
:root {
    --background: #0b1018;
    --sidebar: #0e1520;
    --surface: #141e2c;
    --surface-hover: #1a2738;
    --border: #253347;
    --text: #e6edf3;
    --muted: #94a3b8;
    --accent: #00ff88;
    --critical: #f87171;
    --high: #fb923c;
    --medium: #facc15;
    --low: #4ade80;
    --blue: #60a5fa;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--background);
    color: var(--text);
    font-family: Arial, Helvetica, sans-serif;
    font-size: 14px;
    line-height: 1.6;
}

a {
    color: var(--accent);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

button, input, select {
    font: inherit;
}

button, select {
    cursor: pointer;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
summary:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 245px;
    background: var(--sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 24px 16px;
    overflow-y: auto;
}

.brand {
    padding: 0 8px 24px;
}

.brand h1 {
    margin: 0;
    font-size: 23px;
}

.brand h1 span {
    color: var(--accent);
}

.brand p {
    font-size: 11px;
    color: var(--muted);
    margin: 4px 0;
}

.nav-label {
    color: var(--muted);
    font-size: 10px;
    letter-spacing: 1.5px;
    margin: 24px 10px 8px;
}

nav button,
nav a {
    display: block;
    width: 100%;
    background: transparent;
    color: var(--muted);
    text-align: left;
    border: 1px solid transparent;
    border-radius: 7px;
    padding: 11px 12px;
    margin-bottom: 4px;
    text-decoration: none;
}

nav button:hover,
nav a:hover {
    background: var(--surface-hover);
    color: var(--text);
    text-decoration: none;
}

nav button.active {
    background: #123429;
    color: var(--accent);
    border-color: #205440;
}

.sidebar-footer {
    margin-top: auto;
    padding: 24px 10px 0;
    color: var(--muted);
    font-size: 11px;
}

.sidebar-footer p {
    margin: 2px 0;
}

.workspace {
    margin-left: 245px;
    min-height: 100vh;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 20px 32px;
    border-bottom: 1px solid var(--border);
    background: var(--sidebar);
}

.topbar h2 {
    margin: 0;
    font-size: 20px;
}

#system-status {
    color: var(--accent);
    font-family: monospace;
    font-size: 12px;
}

.content {
    max-width: 1600px;
    margin: auto;
    padding: 30px 32px;
    min-height: 75vh;
}

.muted {
    color: var(--muted);
    font-size: 12px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card, .panel, .intel-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 20px;
    overflow-wrap: anywhere;
}

.stat-card h3 {
    font-size: 13px;
    color: var(--muted);
    margin: 0;
    font-weight: normal;
}

.stat-card strong {
    font-size: 32px;
    color: var(--accent);
}

.stat-card.critical strong {
    color: var(--critical);
}

.stat-card.exploited strong {
    color: var(--high);
}

.stat-card.blue strong {
    color: var(--blue);
}

.panel {
    margin-bottom: 20px;
}

.panel h3, .intel-card h3 {
    margin: 0 0 12px;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
}

.filters {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
}

.source-picker {
    min-width: 0;
    max-width: 100%;
}

.source-options:not([hidden]) {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 8px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface);
    max-width: min(25rem, 70vw);
    white-space: normal;
    overflow-wrap: anywhere;
}

.source-picker button:focus-visible, .source-options a:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}

.reference-detail {
    margin-top: 12px;
    white-space: normal;
    overflow-wrap: anywhere;
}

input, select, .action-button {
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 10px 12px;
}

input[type="search"] {
    flex: 1;
    min-width: 180px;
}

.action-button:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.action-button:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.table-wrapper {
    overflow-x: auto;
}

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

th, td {
    padding: 14px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}

th {
    color: var(--muted);
    font-size: 12px;
    font-weight: normal;
}

tbody tr:hover {
    background: var(--surface-hover);
}

details summary {
    cursor: pointer;
    color: var(--muted);
}

details p {
    max-width: 650px;
    white-space: normal;
}

.severity, .kev-badge {
    display: inline-block;
    border-radius: 5px;
    padding: 4px 8px;
    font-family: monospace;
    font-size: 11px;
    font-weight: bold;
}

.severity-critical {
    background: #450a0a;
    color: var(--critical);
}

.severity-high {
    background: #431407;
    color: var(--high);
}

.severity-medium {
    background: #422006;
    color: var(--medium);
}

.severity-low {
    background: #052e16;
    color: var(--low);
}

.severity-unknown,
.severity-none {
    background: #334155;
    color: #cbd5e1;
}

.kev-badge {
    background: #450a0a;
    color: var(--critical);
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 24px;
    color: var(--muted);
}

.news-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

.news-grid .intel-card {
    display: flex;
    flex-direction: column;
}

.news-grid a {
    margin-top: auto;
}

.briefing-text {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    line-height: 1.8;
}

.briefing-header p, .briefing-priority p {
    overflow-wrap: anywhere;
}

.briefing-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(160px, 100%), 1fr));
    gap: 12px;
    margin-bottom: 24px;
}

.briefing-disclosure > summary {
    cursor: pointer;
    font-weight: 600;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

.briefing-disclosure > summary:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 4px;
}

.briefing-disclosure[open] > summary {
    margin-bottom: 18px;
}

.briefing-disclosure > a {
    display: block;
    margin-block: 8px;
    overflow-wrap: anywhere;
}

.briefing-priority {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

.scanner-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr));
    gap: 16px;
}
.scanner-form label { display: flex; flex-direction: column; gap: 8px; }
.scanner-form input, .scanner-form select { min-width: 0; width: 100%; padding: 10px; }
.scanner-form input[type="checkbox"] { width: auto; align-self: flex-start; }
.scanner-form > p, .scanner-actions { grid-column: 1 / -1; }
.scanner-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.scanner-results p, .scanner-results a { overflow-wrap: anywhere; }
.scanner-results a { margin-right: 12px; }
.scanner-form :focus-visible, .scanner-results summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.distribution-row {
    display: grid;
    grid-template-columns: 80px 1fr 55px;
    align-items: center;
    gap: 12px;
    margin: 14px 0;
}

progress {
    width: 100%;
    height: 12px;
    accent-color: var(--accent);
}

.source-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

.online {
    color: var(--accent);
}

.offline {
    color: var(--critical);
}

.warning {
    color: var(--high);
}

footer {
    padding: 24px 32px;
    border-top: 1px solid var(--border);
    text-align: center;
    color: var(--muted);
    font-size: 11px;
}

/* ========================================
   Responsive Layout
   ======================================== */

@media (max-width: 1200px) {
    .stats-grid,
    .news-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 900px) {
    .sidebar {
        position: static;
        width: 100%;
    }

    .workspace {
        margin-left: 0;
    }

    nav {
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
    }

    nav button, nav a {
        width: auto;
    }

    .nav-label,
    .sidebar-footer {
        display: none;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .content {
        padding: 20px;
    }
}

@media (max-width: 520px) {
    .stats-grid,
    .news-grid {
        grid-template-columns: 1fr;
    }

    .topbar {
        padding: 16px;
        flex-wrap: wrap;
    }
}

/* ========================================
   Briefing Generation Status
   ======================================== */

.briefing-mode {
    display: inline-block;
    padding: 4px 10px;
    border: 1px solid var(--border);
    border-radius: 5px;
    font-family: monospace;
    font-size: 12px;
    font-weight: bold;
}

.briefing-mode-ai {
    background: #123429;
    color: var(--accent);
    border-color: #205440;
}

.briefing-mode-fallback {
    background: #431407;
    color: var(--high);
    border-color: #9a3412;
}

.briefing-mode-unavailable {
    background: #334155;
    color: #cbd5e1;
}
