:root {
    color-scheme: light dark;
    --bg: #f5f6f8;
    --surface: #ffffff;
    --border: #dfe2e8;
    --text: #1c2026;
    --muted: #626b78;
    --accent: #1f9d57;
    --red: #c62828;
    --orange: #b86100;
    --green: #1b7f47;
    --grey: #5b6472;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #14161a;
        --surface: #1c1f25;
        --border: #2e333c;
        --text: #e7e9ed;
        --muted: #98a1ae;
        --accent: #2ecc71;
        --red: #f0635f;
        --orange: #f2a14a;
        --green: #4bd68b;
        --grey: #a2abb8;
    }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 14px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

h1 { margin: 0; font-size: 18px; font-weight: 650; }

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

button, .button { cursor: pointer; text-decoration: none; white-space: nowrap; display: inline-block; }
button:hover:not(:disabled), .button:hover { border-color: var(--muted); }
button:disabled { opacity: .5; cursor: default; }
button.primary { background: var(--accent); border-color: var(--accent); color: #06130b; font-weight: 600; }
button.danger { color: var(--red); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.error { color: var(--red); margin: 0; min-height: 1.5em; }

.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card {
    width: min(340px, 100%);
    display: grid;
    gap: 10px;
    padding: 24px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
}
.login-card label { color: var(--muted); }

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 24px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.content { max-width: 1240px; margin: 0 auto; padding: 20px 24px 40px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.stats > div { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 12px 16px; }
.stat-value { display: block; font-size: 22px; font-weight: 650; font-variant-numeric: tabular-nums; }
.stat-label { color: var(--muted); font-size: 13px; }

.filters { display: flex; flex-wrap: wrap; gap: 8px; }
.filters input { flex: 1 1 280px; }

.table-wrap { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; color: var(--muted); font-weight: 500; font-size: 13px; }
th, td { padding: 9px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
tbody tr:last-child td { border-bottom: none; }

.name {
    display: block;
    max-width: 340px;
    padding: 0;
    border: none;
    background: none;
    font-weight: 550;
    text-align: left;
    overflow: hidden;
    text-overflow: ellipsis;
}
.name:hover { text-decoration: underline; }

.badge { font-size: 12px; font-weight: 600; text-transform: capitalize; color: var(--grey); }
.badge.malicious { color: var(--red); }
.badge.suspicious { color: var(--orange); }
.badge.clean, .badge.safe { color: var(--green); }

.details td { white-space: normal; background: var(--bg); }
.details dl { display: grid; grid-template-columns: max-content 1fr; gap: 2px 16px; margin: 0 0 10px; }
.details dt { color: var(--muted); }
.details dd { margin: 0; font-family: ui-monospace, "Cascadia Code", Menlo, monospace; font-size: 13px; overflow-wrap: anywhere; }
.actions { display: flex; flex-wrap: wrap; gap: 6px; }

.empty { text-align: center; color: var(--muted); padding: 24px; margin: 0; }

.pager { display: flex; justify-content: center; align-items: center; gap: 12px; color: var(--muted); }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }

@media (max-width: 720px) {
    .topbar { padding: 12px 16px; }
    .content { padding: 16px; }
    .stats { grid-template-columns: repeat(2, 1fr); }
}
