:root {
    color-scheme: dark;
    --bg: #0a0e14;
    --surface: #111822;
    --surface-2: #161f2b;
    --surface-3: #1c2735;
    --border: #212d3b;
    --border-strong: #2d3c4d;
    --text: #e8eef5;
    --text-muted: #8b9bad;
    --text-dim: #5f6f80;
    --brand: #10b981;
    --brand-strong: #34d399;
    --accent: #38bdf8;
    --ok: #22c55e;
    --warn: #f59e0b;
    --danger: #f43f5e;
    --crit: #fb7185;
    --high: #fb923c;
    --med: #fbbf24;
    --low: #38bdf8;
    --info: #64748b;
    --radius: 14px;
    --radius-sm: 9px;
    --shadow: 0 1px 1px rgba(0,0,0,.25);
    --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, monospace;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
    margin: 0;
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.5;
    background: radial-gradient(1200px 600px at 20% -10%, #0e1824 0%, var(--bg) 55%);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
}

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

.brand {
    display: inline-flex;
    align-items: center;
    gap: .55rem;
    font-weight: 700;
    letter-spacing: -.01em;
    font-size: 1.1rem;
    color: var(--text);
}
.brand .mark {
    width: 26px; height: 26px; border-radius: 7px;
    background: linear-gradient(135deg, var(--brand) 0%, var(--accent) 100%);
    display: grid; place-items: center;
    color: #04130d; font-weight: 800; font-size: .85rem;
    box-shadow: 0 0 0 1px rgba(16,185,129,.25), 0 4px 14px rgba(16,185,129,.25);
}
.brand small { display: block; font-weight: 500; font-size: .72rem; color: var(--text-dim); letter-spacing: .02em; }

.auth {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 1.5rem;
}
.auth-card {
    width: 100%;
    max-width: 380px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 2rem 1.75rem;
    box-shadow: var(--shadow);
}
.auth-card .brand { font-size: 1.3rem; margin-bottom: .25rem; }
.auth-head { margin-bottom: 1.5rem; }
.auth-head p { margin: .35rem 0 0; color: var(--text-muted); font-size: .85rem; }

.app-shell {
    display: grid;
    grid-template-columns: 248px 1fr;
    min-height: 100vh;
}
.sidebar {
    background: linear-gradient(180deg, #0d141d 0%, #0a0e14 100%);
    border-right: 1px solid var(--border);
    padding: 1.4rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}
.sidebar .brand { padding: 0 .5rem; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-label { padding: 0 .75rem; font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: var(--text-dim); margin-bottom: .4rem; }
.nav a {
    display: flex; align-items: center; gap: .6rem;
    padding: .55rem .75rem; border-radius: var(--radius-sm);
    color: var(--text-muted); font-weight: 500;
}
.nav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav a.active { background: var(--surface-3); color: var(--text); box-shadow: inset 2px 0 0 var(--brand); }
.sidebar-foot { margin-top: auto; }

.main { padding: 2.25rem 2.5rem; max-width: 1200px; }
.topbar {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 1.75rem;
}
.topbar h1 { font-size: 1.35rem; margin: 0; letter-spacing: -.01em; }
.topbar .sub { color: var(--text-muted); font-size: .85rem; margin-top: .15rem; }
.topbar-actions { display: flex; align-items: center; gap: 1rem; }

.pill {
    display: inline-flex; align-items: center; gap: .4rem;
    padding: .3rem .6rem; border-radius: 999px;
    background: var(--surface-2); border: 1px solid var(--border);
    font-size: .8rem; color: var(--text-muted);
}
.pill .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--brand); }

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.4rem;
    box-shadow: var(--shadow);
}
.card + .card { margin-top: 1.25rem; }
.card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.card-head h2, .card-head h3 { margin: 0; font-size: 1rem; font-weight: 600; }
.card-head p { margin: .2rem 0 0; color: var(--text-muted); font-size: .82rem; }

label { display: block; margin-bottom: .35rem; font-size: .82rem; font-weight: 500; color: var(--text-muted); }
input, select {
    width: 100%; padding: .6rem .75rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-strong);
    background: #0c121a; color: var(--text);
    font-family: inherit; font-size: .9rem;
    transition: border-color .12s, box-shadow .12s;
}
input:focus, select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(16,185,129,.15); }
input::placeholder { color: var(--text-dim); }

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
    padding: .6rem 1rem; border: 0; border-radius: var(--radius-sm);
    background: var(--brand); color: #04130d; font-weight: 600; font-size: .9rem;
    cursor: pointer; font-family: inherit;
    transition: filter .12s, transform .02s;
}
.btn:hover { filter: brightness(1.07); }
.btn:active { transform: translateY(1px); }
.btn--block { width: 100%; }
.btn--ghost { background: transparent; color: var(--text-muted); border: 1px solid var(--border-strong); }
.btn--ghost:hover { background: var(--surface-2); color: var(--text); filter: none; }
.btn--sm { padding: .4rem .7rem; font-size: .82rem; }

.field-row { display: flex; gap: .75rem; align-items: flex-end; flex-wrap: wrap; }
.field-row > div { flex: 1; min-width: 180px; }
.field-row .btn { flex: 0 0 auto; }

.error { color: var(--danger); font-size: .82rem; margin-top: .5rem; }

table { width: 100%; border-collapse: collapse; }
thead th {
    text-align: left; padding: .55rem .6rem;
    font-size: .72rem; text-transform: uppercase; letter-spacing: .06em;
    color: var(--text-dim); border-bottom: 1px solid var(--border);
}
tbody td { padding: .7rem .6rem; border-bottom: 1px solid var(--border); font-size: .88rem; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: var(--surface-2); }
td .mono { font-family: var(--mono); font-size: .83rem; color: var(--text-muted); }

.badge {
    display: inline-flex; align-items: center; gap: .35rem;
    padding: .2rem .55rem; border-radius: 999px;
    font-size: .76rem; font-weight: 600; letter-spacing: .01em;
    border: 1px solid transparent;
}
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge--ok { color: var(--ok); background: rgba(34,197,94,.1); border-color: rgba(34,197,94,.25); }
.badge--deny { color: var(--danger); background: rgba(244,63,94,.1); border-color: rgba(244,63,94,.25); }
.badge--run { color: var(--warn); background: rgba(245,158,11,.1); border-color: rgba(245,158,11,.25); }
.badge--muted { color: var(--text-muted); background: var(--surface-2); border-color: var(--border); }

.empty { text-align: center; padding: 2rem 1rem; color: var(--text-dim); }
.muted { color: var(--text-muted); }
.linklike { background: none; border: 0; color: var(--text-muted); cursor: pointer; font: inherit; padding: 0; }
.linklike:hover { color: var(--text); text-decoration: underline; }
.inline { display: inline; }

/* premium components */
.kpi-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-bottom: 1.25rem; }
.stat {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem 1.3rem;
}
.stat .label { font-size: .72rem; text-transform: uppercase; letter-spacing: .07em; color: var(--text-dim); font-weight: 600; }
.stat .value { font-size: 2.1rem; font-weight: 700; letter-spacing: -.03em; margin-top: .45rem; line-height: 1; color: var(--text); }
.stat .value small { font-size: .95rem; font-weight: 500; color: var(--text-dim); letter-spacing: 0; }
.stat .sub { margin-top: .5rem; font-size: .8rem; color: var(--text-muted); }
.stat--accent .value { color: var(--brand-strong); }
.stat--crit .value { color: var(--crit); }

.grid-2 { display: grid; grid-template-columns: 1.1fr .9fr; gap: 1.25rem; align-items: start; }

.divider { height: 1px; background: var(--border); border: 0; margin: 1.1rem 0; }

.sev { display: inline-flex; align-items: center; gap: .45rem; font-weight: 600; font-size: .82rem; }
.sev::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--info); }
.sev--critical { color: var(--crit); } .sev--critical::before { background: var(--crit); }
.sev--high { color: var(--high); } .sev--high::before { background: var(--high); }
.sev--medium { color: var(--med); } .sev--medium::before { background: var(--med); }
.sev--low { color: var(--low); } .sev--low::before { background: var(--low); }
.sev--info { color: var(--info); } .sev--info::before { background: var(--info); }

.bars { display: flex; flex-direction: column; gap: .7rem; }
.bar-row { display: grid; grid-template-columns: 90px 1fr 34px; align-items: center; gap: .75rem; font-size: .82rem; }
.bar-track { height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.bar-fill { height: 100%; border-radius: 999px; }
.bar-fill--critical { background: var(--crit); }
.bar-fill--high { background: var(--high); }
.bar-fill--medium { background: var(--med); }
.bar-fill--low { background: var(--low); }
.bar-fill--info { background: var(--info); }
.bar-count { text-align: right; color: var(--text-muted); font-variant-numeric: tabular-nums; }

.score { display: flex; align-items: baseline; gap: .5rem; }
.score .n { font-size: 3rem; font-weight: 700; letter-spacing: -.04em; line-height: 1; }
.score .d { color: var(--text-dim); font-size: 1rem; }
.score--good .n { color: var(--brand-strong); }
.score--warn .n { color: var(--med); }
.score--bad .n { color: var(--crit); }

.tag { display: inline-flex; padding: .15rem .5rem; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--border); font-size: .74rem; color: var(--text-muted); font-family: var(--mono); }

@media (max-width: 1000px) { .kpi-row { grid-template-columns: repeat(2, 1fr); } .grid-2 { grid-template-columns: 1fr; } }

@media (max-width: 760px) {
    .kpi-row { grid-template-columns: 1fr; }
    .app-shell { grid-template-columns: 1fr; }
    .sidebar { flex-direction: row; align-items: center; justify-content: space-between; }
    .nav { flex-direction: row; }
    .nav-label, .sidebar-foot { display: none; }
    .main { padding: 1.25rem; }
}
