/* Cyber Watch — self-contained stylesheet (no external fonts / CDNs). */
:root {
  --bg: #f9f9f7;
  --surface: #fcfcfb;
  --surface-2: #f1f1ee;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --ink-3: #7a7973;
  --border: rgba(11, 11, 11, 0.10);
  --accent: #2a78d6;
  --accent-ink: #ffffff;
  --good: #0ca30c;
  --warning: #fab219;
  --serious: #ec835a;
  --critical: #d03b3b;
  --federal: #2a78d6;
  --commercial: #7a7973;
  --shadow: 0 1px 2px rgba(0,0,0,.06);
  --radius: 10px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
:root[data-theme="dark"] {
  --bg: #0d0d0d;
  --surface: #1a1a19;
  --surface-2: #232322;
  --ink: #ffffff;
  --ink-2: #c3c2b7;
  --ink-3: #8f8e86;
  --border: rgba(255, 255, 255, 0.10);
  --accent: #3987e5;
  --federal: #3987e5;
  --commercial: #9a9990;
  --shadow: none;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding: 0 16px 40px;
  max-width: 1400px;
  margin: 0 auto;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: var(--mono); font-size: 12px; background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }
.muted { color: var(--ink-2); }
.small { font-size: 12px; }
.mono { font-family: var(--mono); }

/* header */
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 0 10px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 18px; color: var(--ink); }
.brand svg { color: var(--accent); }
.brand .sub { font-weight: 400; font-size: 12px; color: var(--ink-2); margin-left: 6px; }
.top-right { display: flex; align-items: center; gap: 10px; }
.btn {
  background: var(--accent); color: var(--accent-ink); border: 1px solid transparent;
  border-radius: 8px; padding: 7px 12px; font: inherit; font-size: 13px; cursor: pointer;
}
.btn:hover { filter: brightness(1.08); }
.btn:disabled { opacity: .55; cursor: wait; }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--border); }
.btn.ghost:hover { background: var(--surface-2); filter: none; }

/* stat tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; margin: 6px 0 14px; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow); }
.tile .label { font-size: 12px; color: var(--ink-2); }
.tile .value { font-size: 28px; font-weight: 600; line-height: 1.15; margin-top: 2px; }
.tile .value.accent { color: var(--accent); }
.tile .delta { font-size: 12px; color: var(--ink-2); margin-top: 2px; }
.tile .value.bad { color: var(--critical); }
.tile .value.ok { color: var(--good); }

/* tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 12px; }
.tab { background: none; border: none; border-bottom: 2px solid transparent; color: var(--ink-2); padding: 9px 14px; font: inherit; font-size: 14px; cursor: pointer; }
.tab:hover { color: var(--ink); }
.tab.active { color: var(--ink); border-bottom-color: var(--accent); font-weight: 600; }
.view { display: none; }
.view.active { display: block; }

/* filters */
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 8px; }
.filters input[type=search] {
  flex: 1 1 260px; min-width: 200px; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface); color: var(--ink); font: inherit;
}
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { background: var(--surface); border: 1px solid var(--border); color: var(--ink-2); border-radius: 999px; padding: 4px 11px; font: inherit; font-size: 12px; cursor: pointer; }
.chip.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: var(--surface); }
.seg button { background: none; border: none; color: var(--ink-2); padding: 6px 10px; font: inherit; font-size: 12px; cursor: pointer; border-right: 1px solid var(--border); }
.seg button:last-child { border-right: none; }
.seg button.on { background: var(--surface-2); color: var(--ink); font-weight: 600; }
.toggle { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-2); cursor: pointer; }
.meta-row { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin: 4px 0 10px; }

/* feed items */
.list { display: flex; flex-direction: column; gap: 8px; }
.item { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 14px; box-shadow: var(--shadow); }
.item.watch { border-left: 3px solid var(--accent); }
.item-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 12px; color: var(--ink-2); }
.item .src { font-weight: 600; color: var(--ink); }
.item .cat { text-transform: capitalize; }
.item .title { margin: 4px 0 2px; font-size: 15px; font-weight: 600; line-height: 1.3; }
.item .title a { color: var(--ink); }
.item .title a:visited { color: var(--ink-2); }
.item .summary { margin: 2px 0 6px; color: var(--ink-2); font-size: 13px; }
.tags { display: flex; flex-wrap: wrap; gap: 5px; }
.tag { font-size: 11px; padding: 1px 7px; border-radius: 999px; border: 1px solid var(--border); color: var(--ink-2); background: var(--surface-2); }
.tag.cve { font-family: var(--mono); }
.tag.hit { border-color: var(--accent); color: var(--accent); background: transparent; font-weight: 600; }
.tag.topic { border-color: var(--border); color: var(--ink); background: var(--surface-2); }
.tag.topic::before { content: ""; display: inline-block; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); margin-right: 5px; vertical-align: middle; opacity: .7; }
.tag.filter { cursor: pointer; }
.tag.filter:hover { border-color: var(--accent); }
.badge { font-size: 11px; padding: 1px 7px; border-radius: 4px; font-weight: 600; letter-spacing: .02em; }
.badge.sector.federal { background: var(--federal); color: #fff; }
.badge.sector.commercial { background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--border); }
.more { text-align: center; margin: 14px 0; }
.empty { color: var(--ink-2); padding: 30px; text-align: center; }

/* tables */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; font-weight: 600; font-size: 12px; color: var(--ink-2); padding: 9px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; position: sticky; top: 0; background: var(--surface); }
.tbl td { padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
.tbl tr:last-child td { border-bottom: none; }
.tbl tr:hover td { background: var(--surface-2); }
.tbl td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl .desc { max-width: 620px; color: var(--ink-2); }
.tbl .desc b { color: var(--ink); font-weight: 500; }
.tbl .nowrap { white-space: nowrap; }
.clamp { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; cursor: pointer; }
.clamp.open { -webkit-line-clamp: unset; }

/* severity: colour + label, never colour alone */
.sev { display: inline-block; min-width: 42px; text-align: center; font-family: var(--mono); font-size: 12px; font-weight: 600; padding: 2px 6px; border-radius: 5px; color: #fff; }
.sev.CRITICAL { background: var(--critical); }
.sev.HIGH { background: var(--serious); color: #1a1a19; }
.sev.MEDIUM { background: var(--warning); color: #1a1a19; }
.sev.LOW { background: var(--good); }
.sev.NONE, .sev.UNSCORED { background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--border); }
.epss { font-family: var(--mono); font-size: 12px; }
.epss.hot { color: var(--critical); font-weight: 600; }
.kevflag { font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 4px; background: var(--critical); color: #fff; }
.due.soon { color: var(--critical); font-weight: 600; }
.due.past { color: var(--ink-3); text-decoration: line-through; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.dot.ok { background: var(--good); }
.dot.err { background: var(--critical); }
.dot.na { background: var(--ink-3); }
.err-text { color: var(--critical); font-size: 12px; max-width: 420px; word-break: break-word; }

.foot { margin-top: 28px; border-top: 1px solid var(--border); padding-top: 10px; }

@media (max-width: 720px) {
  .brand .sub { display: none; }
  .tile .value { font-size: 22px; }
  .tbl .desc { max-width: 320px; }
}
