/* Security dashboard. No build step: plain CSS, served from /css/app.css (CSP style-src 'self'). */

:root {
    --bg: #f3f5f8;
    --surface: #ffffff;
    --surface-2: #f8f9fb;
    --border: #e2e6ec;
    --text: #172033;
    --text-2: #5a6578;
    --link: #1d5fd6;
    --top: #111a2e;
    --top-text: #e8ecf4;
    --focus: #3b82f6;

    --critical: #c0262d;
    --critical-bg: #fde8e8;
    --high: #c2510b;
    --high-bg: #fdeedd;
    --medium: #8a6100;
    --medium-bg: #fbf1d0;
    --low: #3a5f8a;
    --low-bg: #e4edf7;
    --unknown: #5a6578;
    --unknown-bg: #eceff3;
    --ok: #17703c;
    --ok-bg: #dcf3e4;
    --warn: #8a5a00;
    --warn-bg: #fcefc7;
    --bad: #b42318;
    --bad-bg: #fde4e2;

    --radius: 10px;
    --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 1px 3px rgba(16, 24, 40, 0.04);
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0d1220;
        --surface: #151c2c;
        --surface-2: #1a2235;
        --border: #263049;
        --text: #e6eaf2;
        --text-2: #98a2b6;
        --link: #7aa7ff;
        --top: #0a0f1b;
        --top-text: #e6eaf2;

        --critical: #ff8a8a;
        --critical-bg: #4a1c22;
        --high: #ffad70;
        --high-bg: #4a2a14;
        --medium: #f2c95c;
        --medium-bg: #43361a;
        --low: #9cc0ec;
        --low-bg: #1e3250;
        --unknown: #a8b1c2;
        --unknown-bg: #2a3346;
        --ok: #7ddc9f;
        --ok-bg: #173a27;
        --warn: #f2c95c;
        --warn-bg: #43361a;
        --bad: #ff8a8a;
        --bad-bg: #4a1c22;

        --shadow: none;
    }
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 15px;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }

code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.85em;
    overflow-wrap: anywhere;
}

h1 { font-size: 1.6rem; font-weight: 650; letter-spacing: -0.01em; margin: 0; }
h2 { font-size: 1.05rem; font-weight: 650; margin: 0 0 0.75rem; display: flex; align-items: center; gap: 0.5rem; }

/* Top bar */
.topbar { background: var(--top); color: var(--top-text); }
.topbar-inner {
    max-width: 82rem;
    margin: 0 auto;
    padding: 0.7rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}
.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    color: var(--top-text);
    font-weight: 650;
    letter-spacing: 0.01em;
}
.brand:hover { text-decoration: none; }
.brand-mark { width: 1.35rem; height: 1.35rem; fill: #ee0000; }
.user { display: flex; align-items: center; gap: 0.9rem; font-size: 0.9rem; }
.user-name { opacity: 0.8; }
.user form { margin: 0; }

/* Page */
.page { max-width: 82rem; margin: 0 auto; padding: 2rem 1.5rem 4rem; }
.page-head { margin-bottom: 1.5rem; }
.page-head .sub { margin: 0.35rem 0 0; color: var(--text-2); }
.back { display: inline-block; margin-bottom: 0.75rem; font-size: 0.9rem; }

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.25rem 1.25rem 0.5rem;
    margin-bottom: 1.5rem;
}
.card > table { margin: 0 -1.25rem; width: calc(100% + 2.5rem); }
.card-fold:not([open]) { padding-bottom: 1.25rem; }
.card-fold > summary { cursor: pointer; }
.card-fold > summary h2 { display: inline; }
.card-fold[open] > summary { margin-bottom: 0.75rem; }
.server-pagination { display: flex; gap: 1rem; align-items: center; padding: 0.75rem 0; }
.empty { color: var(--text-2); padding-bottom: 0.75rem; margin: 0; }
.card.empty { padding: 2rem; text-align: center; }
.notice { max-width: 32rem; margin: 3rem auto; padding: 2rem; text-align: center; }
.notice h1 { margin-bottom: 0.75rem; }
.login-form { margin: 0 0 0.75rem; }
.login-form .btn { width: 100%; }

/* Buttons */
.btn, button {
    font: inherit;
    font-size: 0.9rem;
    font-weight: 550;
    display: inline-block;
    padding: 0.4rem 0.9rem;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
}
.btn:hover, button:hover { background: var(--surface-2); text-decoration: none; }
.btn-primary { background: var(--link); border-color: var(--link); color: #fff; }
.btn-primary:hover { background: var(--link); filter: brightness(1.08); }
.btn-small { padding: 0.25rem 0.7rem; font-size: 0.85rem; }
.btn-on-dark { background: transparent; color: var(--top-text); border-color: rgba(255, 255, 255, 0.25); }
.btn-on-dark:hover { background: rgba(255, 255, 255, 0.08); }

/* Tiles */
.tiles {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.tile {
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 4px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1rem 1.1rem;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}
.tile-num { font-size: 2rem; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.tile-label { color: var(--text-2); font-size: 0.88rem; }
.tile-critical { border-left-color: var(--critical); }
.tile-critical .tile-num { color: var(--critical); }
.tile-high { border-left-color: var(--high); }
.tile-high .tile-num { color: var(--high); }
.tile-warn { border-left-color: var(--warn); }
.tile-warn .tile-num { color: var(--warn); }
.tile-note { color: var(--warn); font-size: 0.82rem; font-weight: 600; }

/* Tables */
.table-scroll { overflow-x: auto; margin: 0 -1.25rem; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 0.75rem 1.25rem; vertical-align: top; }
th {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-2);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
td { border-bottom: 1px solid var(--border); }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: var(--surface-2); }
.nowrap { white-space: nowrap; }
.wrap { overflow-wrap: anywhere; max-width: 24rem; }
a.pill { text-decoration: none; }
.muted, .muted-cell { color: var(--text-2); }
.muted { font-size: 0.85rem; }

/* Overview table */
.servers td { padding-top: 1rem; padding-bottom: 1rem; }
.server-name { font-weight: 650; font-size: 1rem; }
.pills { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.35rem; }
.scans { list-style: none; margin: 0; padding: 0; font-size: 0.9rem; }
.scan { display: flex; gap: 0.5rem; }
.scan-kind { color: var(--text-2); min-width: 7.5rem; }
.scan-old time { color: var(--warn); font-weight: 600; }
.col-num { text-align: right; }
th.col-num { text-align: right; }
.num {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.2;
    font-variant-numeric: tabular-nums;
    color: var(--text-2);
}
.num-critical { color: var(--critical); }
.num-high { color: var(--high); }
.split { display: block; font-size: 0.8rem; color: var(--text-2); }
.cell-label { display: none; }

/* Pills and badges */
.pill, .sev, .state {
    display: inline-block;
    padding: 0.1rem 0.55rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 650;
    white-space: nowrap;
}
.pill-ok { background: var(--ok-bg); color: var(--ok); }
.pill-warn { background: var(--warn-bg); color: var(--warn); }
.pill-bad { background: var(--bad-bg); color: var(--bad); }
.pill-neutral { background: var(--unknown-bg); color: var(--unknown); }
.count-badge {
    font-size: 0.8rem;
    font-weight: 650;
    padding: 0 0.5rem;
    border-radius: 999px;
    background: var(--unknown-bg);
    color: var(--text-2);
}

.sev { border-radius: 6px; min-width: 4.5rem; text-align: center; }
.sev-critical { background: var(--critical); color: #fff; }
.sev-high { background: var(--high-bg); color: var(--high); }
.sev-medium { background: var(--medium-bg); color: var(--medium); }
.sev-low { background: var(--low-bg); color: var(--low); }
.sev-unknown { background: var(--unknown-bg); color: var(--unknown); }

.state-fix { background: var(--low-bg); color: var(--low); }
.state-nofix { background: var(--unknown-bg); color: var(--unknown); }

/* Findings */
.findings .vuln { min-width: 14rem; max-width: 26rem; }
.findings .vuln a, .vuln-id { font-weight: 600; }
.findings .pkg { min-width: 12rem; }
.pkg-name { font-weight: 550; }
.versions { margin-top: 0.15rem; display: flex; flex-wrap: wrap; align-items: center; gap: 0.3rem; }
.versions code { background: var(--surface-2); border: 1px solid var(--border); border-radius: 5px; padding: 0 0.3rem; }
.versions .fixed { color: var(--ok); }
.arrow { color: var(--text-2); }
.affected { margin-top: 0.25rem; }
.target { font-size: 0.85rem; color: var(--text-2); overflow-wrap: break-word; min-width: 9rem; max-width: 16rem; }
.handling { min-width: 13rem; max-width: 20rem; }
.is-handled td { background: var(--surface-2); }
.is-handled .sev { opacity: 0.6; }
.note p { margin: 0.35rem 0 0.2rem; }
.note form { margin-top: 0.4rem; }
.stale-note { margin-bottom: 0.35rem; }
.error-text { color: var(--bad); font-size: 0.9rem; }
.check-reason { color: var(--text-2); font-size: 0.85rem; margin-top: 0.25rem; overflow-wrap: anywhere; }
.check-fields { display: grid; gap: 0.35rem; justify-items: start; border: 1px solid var(--border); border-radius: 7px; padding: 0.4rem 0.6rem 0.5rem; margin: 0; }
.check-fields legend { font-size: 0.85rem; color: var(--text-2); padding: 0 0.25rem; }
.check-fields label { display: grid; gap: 0.15rem; font-size: 0.85rem; }
.check-fields p { margin: 0.2rem 0 0; }
.form-errors { background: var(--bad-bg); color: var(--bad); border-radius: var(--radius); padding: 0.75rem 1rem; margin-bottom: 1rem; }
.form-errors p { margin: 0 0 0.35rem; font-weight: 600; }
.form-errors ul { margin: 0; padding-left: 1.2rem; }

details.handle summary {
    cursor: pointer;
    color: var(--link);
    font-size: 0.9rem;
    font-weight: 550;
    list-style: none;
}
details.handle summary::-webkit-details-marker { display: none; }
details.handle summary::before { content: "+ "; }
details.handle[open] summary::before { content: "\2212  "; }
details.handle form { margin-top: 0.5rem; display: grid; gap: 0.4rem; justify-items: start; }
select, textarea {
    font: inherit;
    font-size: 0.9rem;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 7px;
    padding: 0.35rem 0.5rem;
}
textarea { width: 100%; min-width: 12rem; resize: vertical; }

/* Narrow screens: the overview table becomes one card per server. */
@media (max-width: 760px) {
    .page { padding: 1.25rem 1rem 3rem; }
    .topbar-inner { padding: 0.6rem 1rem; }
    .user-name { display: none; }
    .servers thead { display: none; }
    .servers, .servers tbody, .servers tr, .servers td { display: block; width: 100%; }
    .servers tr { border-bottom: 1px solid var(--border); padding: 0.5rem 0; }
    .servers td { border: 0; padding: 0.35rem 1.25rem; text-align: left; }
    .servers .col-num { display: flex; align-items: baseline; gap: 0.6rem; }
    .servers .cell-label { display: inline; min-width: 6rem; color: var(--text-2); font-size: 0.85rem; }
    .servers .num { display: inline; font-size: 1.15rem; }
    .servers .split { display: inline; }
}

/* Navigation, intrusion signals and known lists. */
.nav { margin-left: auto; margin-right: 1rem; font-size: 0.9rem; }
.nav a { color: var(--top-text); opacity: 0.85; }
.filters { margin: 0 0 0.75rem; font-size: 0.9rem; color: var(--text-2); }
.filter { margin-left: 0.5rem; padding: 0.1rem 0.5rem; border-radius: 999px; }
.filter-on { background: var(--unknown-bg); color: var(--text); font-weight: 600; }
.events .is-closed td { color: var(--text-2); }
details.bulk { margin-bottom: 0.75rem; }
details.bulk label { display: grid; gap: 0.2rem; font-size: 0.9rem; }
input[type="text"] {
    font: inherit;
    font-size: 0.9rem;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 7px;
    padding: 0.35rem 0.5rem;
    min-width: 14rem;
}
.notice-inline { color: var(--warn); font-weight: 600; margin: 0 0 0.75rem; }

.tag-new { background: var(--medium-bg); color: var(--medium); border-radius: 6px; padding: 0 0.4rem; font-size: 0.75rem; }

.settings { display: grid; grid-template-columns: max-content 1fr; gap: 0.25rem 1rem; margin: 0 0 0.5rem; }
.settings dt { font-weight: 600; }
.settings dd { margin: 0; overflow-wrap: anywhere; }
