:root {
    --bg: #f5f7fb;
    --ink: #111827;
    --muted: #667085;
    --line: #d9e0ea;
    --panel: #ffffff;
    --nav: #101828;
    --blue: #2563eb;
    --cyan: #0891b2;
    --red: #dc2626;
    --amber: #b45309;
    --green: #15803d;
}

* { box-sizing: border-box; }
body { margin: 0; font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; color: var(--ink); background: var(--bg); }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }

.shell { min-height: 100vh; display: grid; grid-template-columns: 260px 1fr; }
.sidebar { background: var(--nav); color: white; padding: 24px 18px; display: flex; flex-direction: column; gap: 28px; }
.brand { display: flex; gap: 12px; align-items: center; }
.brand-mark { width: 38px; height: 38px; display: grid; place-items: center; background: #22d3ee; color: #082f49; font-weight: 900; border-radius: 8px; }
.brand strong { display: block; font-size: 17px; }
.brand small { color: #a7b0c0; display: block; margin-top: 2px; }
nav { display: grid; gap: 6px; }
nav a, .logout button { border: 0; width: 100%; text-align: left; color: #d0d5dd; background: transparent; padding: 11px 12px; border-radius: 8px; cursor: pointer; }
nav a.active, nav a:hover, .logout button:hover { background: #1d2939; color: white; }
.logout { margin-top: auto; }

.content { padding: 28px; min-width: 0; }
.topbar { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; margin-bottom: 24px; }
h1 { margin: 0; font-size: 28px; letter-spacing: 0; }
h2 { margin: 0 0 14px; font-size: 18px; letter-spacing: 0; }
p { color: var(--muted); line-height: 1.5; }
.topbar p { margin: 6px 0 0; }
.user-chip { background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 8px 12px; color: var(--muted); }

.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.metrics article, .panel, .incident-hero { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 18px; }
.metrics span { display: block; font-size: 28px; font-weight: 800; }
.metrics small { color: var(--muted); }
.grid { display: grid; gap: 18px; margin-bottom: 18px; }
.grid.two { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.panel-head a { color: var(--blue); font-weight: 700; }

.table { display: grid; gap: 8px; }
.row { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px 12px; align-items: center; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: #fbfcfe; }
.row:hover { border-color: #9db7e8; }
.row strong { overflow-wrap: anywhere; }
.row small { grid-column: 2; color: var(--muted); overflow-wrap: anywhere; }
.badge { display: inline-flex; align-items: center; justify-content: center; min-height: 24px; padding: 3px 8px; border-radius: 999px; background: #e5e7eb; color: #344054; font-size: 12px; font-weight: 800; text-transform: uppercase; }
.sev-critical { background: #fee2e2; color: #991b1b; }
.sev-high { background: #ffedd5; color: #9a3412; }
.sev-medium { background: #fef3c7; color: #92400e; }
.sev-low { background: #dcfce7; color: #166534; }

.filters { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
input, select, textarea { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; background: white; color: var(--ink); }
textarea { min-height: 110px; resize: vertical; }
button, .primary { border: 0; border-radius: 8px; padding: 10px 14px; background: var(--blue); color: white; font-weight: 800; cursor: pointer; }
button.secondary { background: #344054; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.incident-hero { display: flex; justify-content: space-between; gap: 18px; align-items: flex-start; margin-bottom: 18px; }
.incident-hero h2 { margin-top: 14px; font-size: 24px; }
.stack { display: grid; gap: 10px; }
.evidence, .runbook { border-top: 1px solid var(--line); padding: 12px 0; }
.evidence:first-of-type, .runbook:first-of-type { border-top: 0; }
pre { white-space: pre-wrap; overflow-wrap: anywhere; background: #0b1220; color: #e5edf7; border-radius: 8px; padding: 12px; }
dl { display: grid; grid-template-columns: 140px 1fr; gap: 8px 14px; }
dt { color: var(--muted); }
dd { margin: 0; overflow-wrap: anywhere; }
.notice { border: 1px solid #93c5fd; background: #eff6ff; color: #1e3a8a; border-radius: 8px; padding: 12px; margin-bottom: 16px; }
.empty { color: var(--muted); }
.clean { color: var(--muted); line-height: 1.8; }
.settings-form { display: grid; gap: 14px; margin-top: 12px; }
.form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.form-grid label { display: grid; gap: 6px; color: #344054; font-weight: 700; }
.form-grid input { width: 100%; }
.checkline { align-content: end; grid-template-columns: auto 1fr; display: flex !important; align-items: center; gap: 10px !important; }
.checkline input { width: auto; }
.button-row { display: flex; gap: 10px; margin-top: 12px; }
.secret-grid, .test-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.secret-grid div, .test-card { border: 1px solid var(--line); border-radius: 8px; padding: 12px; background: #fbfcfe; }
.secret-grid small, .test-card span { display: block; color: var(--muted); margin-top: 6px; }
.badge.good { background: #dcfce7; color: #166534; }
.test-card.ok { border-color: #86efac; background: #f0fdf4; }
.test-card.fail { border-color: #fecaca; background: #fef2f2; }
.test-card p { margin-bottom: 0; overflow-wrap: anywhere; }
.error-list { border: 1px solid #fecaca; background: #fef2f2; color: #991b1b; border-radius: 8px; padding: 10px 12px; }
.error-list p { margin: 0; color: #991b1b; }

.login-body { min-height: 100vh; display: grid; place-items: center; background: #101828; padding: 20px; }
.login-panel { width: min(420px, 100%); background: white; border-radius: 8px; padding: 28px; box-shadow: 0 24px 80px rgba(0, 0, 0, .28); }
.login-brand { margin-bottom: 26px; color: var(--ink); }
.login-panel form { display: grid; gap: 12px; }
.error { color: var(--red); margin: 0; }

@media (max-width: 900px) {
    .shell { grid-template-columns: 1fr; }
    .sidebar { position: static; }
    nav { grid-template-columns: repeat(4, 1fr); }
    .metrics, .grid.two, .form-grid, .secret-grid, .test-grid { grid-template-columns: 1fr; }
    .topbar, .incident-hero { flex-direction: column; }
}
