/* Inter (interface) and JetBrains Mono (hashes, IPs, domains): self-hosted, Latin subset,
   variable weight. SIL Open Font License; see fonts/*-OFL.txt. */
@font-face {
  font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("/static/fonts/inter-latin-wght-normal.woff2") format("woff2");
}
@font-face {
  font-family: "JetBrains Mono"; font-style: normal; font-weight: 100 800; font-display: swap;
  src: url("/static/fonts/jetbrains-mono-latin-wght-normal.woff2") format("woff2");
}

:root {
  color-scheme: light;
  --page: #f9f9f7;
  --surface: #fcfcfb;
  --surface-2: #f0efec;
  --text: #0b0b0b;
  --text-secondary: #52514e;
  --text-muted: #6f6e69;
  --border: rgba(11, 11, 11, 0.12);
  --grid: #e1e0d9;
  --accent: #006db0;        /* logo blue */
  --accent-ink: #ffffff;
  --series-1: #2a78d6;
  --series-soft: #9ec5f4;
  --good: #0ca30c;
  --warning: #fab219;
  --serious: #ec835a;
  --critical: #d03b3b;
  --match-bg: #e3f0ff;
  --match-ink: #184f95;
  --radius: 10px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page: #0d0d0d;
    --surface: #1a1a19;
    --surface-2: #262624;
    --text: #ffffff;
    --text-secondary: #c3c2b7;
    --text-muted: #9a998f;
    --border: rgba(255, 255, 255, 0.12);
    --grid: #2c2c2a;
    --accent: #3d9ae0;        /* logo blue, lifted for dark backgrounds */
    --accent-ink: #0b0b0b;    /* white on this blue is only 3:1 */
    --series-1: #3987e5;
    --series-soft: #1c5cab;
    --match-bg: #13345c;
    --match-ink: #cde2fb;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0d0d0d; --surface: #1a1a19; --surface-2: #262624; --text: #ffffff; --text-secondary: #c3c2b7;
  --text-muted: #9a998f; --border: rgba(255, 255, 255, 0.12); --grid: #2c2c2a; --accent: #3d9ae0; --accent-ink: #0b0b0b;
  --series-1: #3987e5; --series-soft: #1c5cab; --match-bg: #13345c; --match-ink: #cde2fb;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--page); color: var(--text); font: 15px/1.55 var(--font); min-height: 100vh; display: flex; flex-direction: column;
  /* Inter alternates that keep I, l and 1 distinct; useful when reading indicators. */
  font-feature-settings: "cv05", "cv08"; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
a { color: var(--accent); }
h1 { font-size: 1.65rem; font-weight: 700; margin: 0 0 .25rem; letter-spacing: -0.022em; line-height: 1.25; }
h2 { font-size: 1.05rem; font-weight: 600; margin: 0 0 .25rem; letter-spacing: -0.011em; }
h3 { font-size: 1rem; margin: 0; }
code { font-family: var(--mono); font-size: .85em; }
/* Numbers line up in tiles, tables and counts. */
.tile-value, td, .bar-value, .hash-value, .tile-sub { font-variant-numeric: tabular-nums; }
.muted { color: var(--text-muted); }
.small { font-size: .85rem; }
.hint { display: block; font-size: .8rem; color: var(--text-muted); font-weight: normal; }

.container { width: 100%; max-width: 1240px; margin: 0 auto; padding: 24px 16px 48px; flex: 1; }
.footer { text-align: center; padding: 16px; font-size: .8rem; }

.topbar { display: flex; flex-wrap: wrap; gap: 8px 24px; align-items: center; justify-content: space-between;
  padding: 12px 16px; background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 5; }
.brand { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; }
.brand img { display: block; }
/* Logo artwork comes in two inks; show the one that suits the current theme. */
.on-dark { display: none !important; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .on-light { display: none !important; }
  :root:not([data-theme="light"]) .on-dark { display: block !important; }
}
:root[data-theme="dark"] .on-light { display: none !important; }
:root[data-theme="dark"] .on-dark { display: block !important; }
.topbar nav { display: flex; flex-wrap: wrap; gap: 4px 16px; align-items: center; }
.topbar nav a { color: var(--text-secondary); text-decoration: none; }
.topbar nav a:hover { color: var(--text); }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.row { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; }
.row.tight { gap: 6px; }
.inline { display: inline; margin: 0; }

label { display: flex; flex-direction: column; gap: 4px; font-weight: 550; font-size: .9rem; }
input, select, textarea, button, .button { font: inherit; color: var(--text); }
input:not([type=checkbox]):not([type=radio]), select, textarea {
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; min-width: 0; }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible, .bar-row:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px; }
button, .button { display: inline-block; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 14px; cursor: pointer; text-decoration: none; font-weight: 550; }
button:hover, .button:hover { border-color: var(--text-muted); }
button.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
button.small, .button.small { padding: 4px 10px; font-size: .85rem; }
button.danger { color: var(--critical); }
button.link { background: none; border: none; padding: 0; color: var(--text-secondary); font-weight: normal; }
fieldset { border: 1px solid var(--border); border-radius: 8px; padding: 10px 14px; margin: 0; }
legend { font-weight: 550; font-size: .9rem; padding: 0 4px; }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 4px 16px; }
.check { flex-direction: row; align-items: center; gap: 8px; font-weight: normal; }

.alert { border-radius: 8px; padding: 10px 14px; border: 1px solid var(--border); background: var(--surface-2); }
.alert.error { border-color: var(--critical); }
.alert.ok { border-color: var(--good); }
.alert.info { border-color: var(--accent); }
.secret { user-select: all; background: var(--surface); padding: 2px 6px; border-radius: 4px; border: 1px solid var(--border); }

.auth-wrap { flex: 1; display: grid; place-items: center; padding: 24px 16px; }
.auth-card { width: 100%; max-width: 400px; }
.auth-logo { display: flex; justify-content: center; margin: 4px 0 12px; }
.auth-logo img { max-width: 100%; height: auto; }
.auth-card > p.muted:first-of-type { text-align: center; }

.page-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: end; gap: 8px; margin-bottom: 12px; }
.page-head p { margin: 0; }

.filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; margin: 8px 0 16px; }
.filters select { max-width: 220px; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: var(--surface); }
.seg label { flex-direction: row; font-weight: 550; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { padding: 8px 14px; cursor: pointer; color: var(--text-secondary); }
.seg input:checked + span { background: var(--accent); color: var(--accent-ink); }
.seg input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: -2px; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.tile-label { color: var(--text-secondary); font-size: .85rem; font-weight: 550; }
.tile-value { font-size: 2rem; font-weight: 650; line-height: 1.2; margin: 4px 0; letter-spacing: -0.02em; }
.tile-sub { color: var(--text-muted); font-size: .8rem; }

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.grid-2 .wide { grid-column: 1 / -1; }
@media (max-width: 820px) { .grid-2 { grid-template-columns: minmax(0, 1fr); } }
.chart-card p { margin: 0 0 10px; }
.chart-box { position: relative; height: 220px; }

.bars { display: flex; flex-direction: column; gap: 6px; }
.bar-row { display: grid; grid-template-columns: minmax(90px, 38%) 1fr 48px; gap: 10px; align-items: center; font-size: .85rem; border-radius: 4px; }
.bar-row:hover { background: var(--surface-2); }
.bar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-secondary); }
.bar-track { height: 12px; }
.bar-fill { display: block; height: 100%; background: var(--series-soft); border-radius: 0 4px 4px 0; }
.bar-fill.mine { background: var(--series-1); }
.bar-value { text-align: right; font-variant-numeric: tabular-nums; color: var(--text-secondary); }

.mini-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; font-size: .9rem; }

.feed-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; }
.feed-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.feed-tools input { width: 280px; max-width: 100%; }
.tabs { display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 8px; }
.tabs button { background: none; border: none; border-bottom: 2px solid transparent; border-radius: 0; padding: 8px 12px; color: var(--text-secondary); }
.tabs button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); }
.items { list-style: none; padding: 0; margin: 0; }
.item { padding: 14px 0; border-bottom: 1px solid var(--border); }
.item:last-child { border-bottom: none; }
.item-top { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.item-top a { color: var(--text); text-decoration: none; }
.item-top a:hover { text-decoration: underline; }
.item-top time { white-space: nowrap; }
.item-meta { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.item-summary { margin: 6px 0; color: var(--text-secondary); font-size: .9rem; overflow-wrap: anywhere; }
.item p.muted { margin: 0; }
.ioc { display: inline-block; margin: 2px 0; padding: 2px 6px; background: var(--surface-2); border-radius: 4px; overflow-wrap: anywhere; }
.chip { font-size: .75rem; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--border); color: var(--text-secondary); }
.chip.subtle { border-style: dashed; }
.chip.match { background: var(--match-bg); color: var(--match-ink); border-color: transparent; font-weight: 600; }

/* Severity: colored dot + text label, never color alone. */
.sev { font-size: .75rem; font-weight: 600; display: inline-flex; align-items: center; gap: 5px; color: var(--text-secondary); }
.sev::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--text-muted); }
.sev-critical::before { background: var(--critical); }
.sev-high::before { background: var(--serious); }
.sev-medium::before { background: var(--warning); }
.sev-ok::before { background: var(--good); }

.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: .9rem; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: var(--text-secondary); font-weight: 600; font-size: .8rem; }

/* --- Subscriber tools ------------------------------------------------------------ */
.topbar nav a[aria-current="page"] { color: var(--text); font-weight: 600; text-decoration: underline;
  text-decoration-color: var(--accent); text-decoration-thickness: 2px; text-underline-offset: 6px; }
.hero { margin-bottom: 16px; }
.lead { color: var(--text-secondary); font-size: 1.05rem; max-width: 70ch; margin: 4px 0 0; }
.row.spread { justify-content: space-between; align-items: center; }
.stack.tight { gap: 8px; }
h3.sub { font-size: .95rem; margin: 18px 0 8px; }
ul.plain { padding-left: 18px; margin: 0; display: flex; flex-direction: column; gap: 6px; }
textarea { width: 100%; font-family: var(--mono); font-size: .85rem; resize: vertical; }
.button.primary-link { background: var(--accent); color: var(--accent-ink); border-color: transparent; }

/* Verdict panel: status color + icon + word, never color alone. */
.verdict { --tone: var(--text-muted); background: var(--surface); border: 1px solid var(--border);
  border-left: 6px solid var(--tone); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 16px; }
.verdict-critical { --tone: var(--critical); }
.verdict-serious { --tone: var(--serious); }
.verdict-good { --tone: var(--good); }
.verdict-badge { display: inline-flex; align-items: center; gap: 10px; font-size: 1.5rem; font-weight: 700; }
.verdict-icon { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%;
  background: var(--tone); color: #fff; font-size: 1.05rem; }
.verdict-reason { font-size: 1.05rem; margin: 10px 0 14px; max-width: 80ch; }
.next-step { background: var(--surface-2); border-radius: 8px; padding: 10px 14px; }
.next-step p { margin: 2px 0 0; font-weight: 600; }
.next-step-label { font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-secondary); font-weight: 700; }

.evidence { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.evidence li { display: grid; grid-template-columns: 96px 1fr; gap: 12px; align-items: start; }
.evidence li p { margin: 2px 0 0; color: var(--text-secondary); font-size: .9rem; overflow-wrap: anywhere; }
.ev-weight { font-size: .75rem; font-weight: 700; padding: 3px 8px; border-radius: 999px; text-align: center;
  background: var(--surface-2); color: var(--text-secondary); }
.evidence .strong .ev-weight, .evidence .missed .ev-weight { background: color-mix(in srgb, var(--critical) 18%, transparent); color: var(--text); }
.evidence .medium .ev-weight { background: color-mix(in srgb, var(--serious) 20%, transparent); color: var(--text); }
.evidence .caught .ev-weight { background: color-mix(in srgb, var(--good) 20%, transparent); color: var(--text); }

.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; font-size: .9rem; }
.facts dt { color: var(--text-secondary); font-weight: 600; }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.links { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 4px; }
.chip-bad { border-color: var(--critical); color: var(--text); font-weight: 600; }
.howto { margin-top: 14px; font-size: .9rem; }
.howto summary { cursor: pointer; font-weight: 600; color: var(--accent); }
.howto ul { margin: 8px 0 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; }

.pill { --tone: var(--text-muted); display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px;
  border-radius: 999px; font-size: .8rem; font-weight: 700; border: 1px solid var(--tone); white-space: nowrap; }
.pill-critical { --tone: var(--critical); }
.pill-serious { --tone: var(--serious); }
.pill-good { --tone: var(--good); }
.pill > span { color: var(--tone); }

.hash-results { list-style: none; padding: 0; margin: 0; }
.hash-result { padding: 14px 0; border-bottom: 1px solid var(--border); }
.hash-result:last-child { border-bottom: none; }
.hash-top { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 8px; }
.hash-value { overflow-wrap: anywhere; }

.scenario-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.scenario-card { color: var(--text); text-decoration: none; display: flex; flex-direction: column; gap: 4px; }
.scenario-card:hover { border-color: var(--accent); }
.scenario-card p { margin: 0; color: var(--text-secondary); }
.scenario-card .button { align-self: flex-start; margin-top: 8px; }

.mock-email { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  margin-bottom: 16px; overflow: hidden; }
.mock-email header { padding: 14px 18px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.mock-subject { font-weight: 700; font-size: 1.1rem; margin-bottom: 8px; }
.mock-email dl { display: grid; grid-template-columns: max-content 1fr; gap: 2px 12px; margin: 0; font-size: .85rem; }
.mock-email dt { color: var(--text-muted); }
.mock-email dd { margin: 0; overflow-wrap: anywhere; }
.mock-body { padding: 16px 18px; white-space: pre-wrap; font-size: .95rem; }

.raw-message { white-space: pre-wrap; overflow-wrap: anywhere; font-size: .8rem; background: var(--surface-2);
  padding: 12px; border-radius: 8px; max-height: 420px; overflow: auto; margin: 0; }

@media (max-width: 600px) {
  .evidence li { grid-template-columns: 1fr; gap: 4px; }
  .evidence .ev-weight { justify-self: start; }
  .facts { grid-template-columns: 1fr; }
  .facts dd { margin-bottom: 6px; }
}

/* Hash lookup: VirusTotal file details */
.file-about { margin-top: 12px; padding-top: 4px; border-top: 1px solid var(--border); }
.file-about .sub { margin-top: 8px; }

/* Threat picture: threat groups targeting the sector */
.actors { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.actor { border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; }
.actor h3 { margin: 0; font-size: 1rem; }
.actor .aka { font-size: .8rem; color: var(--text-secondary); }
.actor p { margin: 0; font-size: .88rem; }
.actor .meta { display: flex; flex-wrap: wrap; gap: 6px; }

/* Keep dates on one line in hash results. */
.hash-results td:nth-child(n+4) { white-space: nowrap; }

/* Help */
.help-tools { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-bottom: 16px; }
.help-tools .card { display: flex; flex-direction: column; gap: 4px; margin: 0; color: inherit; text-decoration: none; transition: border-color .15s; }
.help-tools .card:hover, .help-tools .card:focus-visible { border-color: var(--accent); }
.help-tools strong { color: var(--accent); }
.help-section { scroll-margin-top: 80px; }
.help-section h2 { margin-top: 0; }
.help-section ul { padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }
.help-section p:last-child { margin-bottom: 0; }
