:root {
  color-scheme: light;
  --surface-1: #fcfcfb;
  --surface-2: #f4f4f1;
  --page: #f9f9f7;
  --text-primary: #0b0b0b;
  --text-secondary: #52514e;
  --text-muted: #898781;
  --grid: #e1e0d9;
  --baseline: #c3c2b7;
  --border: rgba(11, 11, 11, 0.1);
  --series-1: #2a78d6;
  --series-1-soft: rgba(42, 120, 214, 0.12);
  --series-2: #eb6834;
  --status-good: #0ca30c;
  --status-warning: #fab219;
  --status-serious: #ec835a;
  --status-critical: #d03b3b;
  --accent: #6250d6;
  --shadow: 0 1px 2px rgba(11, 11, 11, 0.04), 0 8px 24px rgba(11, 11, 11, 0.05);
}

@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme='light'])) {
    color-scheme: dark;
    --surface-1: #1a1a19;
    --surface-2: #232322;
    --page: #0d0d0d;
    --text-primary: #f0efec;
    --text-secondary: #c3c2b7;
    --text-muted: #898781;
    --grid: #2c2c2a;
    --baseline: #383835;
    --border: rgba(255, 255, 255, 0.1);
    --series-1: #3987e5;
    --series-1-soft: rgba(57, 135, 229, 0.16);
    --series-2: #d95926;
    --accent: #9085e9;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.35);
  }
}

:root[data-theme='dark'] {
  color-scheme: dark;
  --surface-1: #1a1a19;
  --surface-2: #232322;
  --page: #0d0d0d;
  --text-primary: #f0efec;
  --text-secondary: #c3c2b7;
  --text-muted: #898781;
  --grid: #2c2c2a;
  --baseline: #383835;
  --border: rgba(255, 255, 255, 0.1);
  --series-1: #3987e5;
  --series-1-soft: rgba(57, 135, 229, 0.16);
  --series-2: #d95926;
  --accent: #9085e9;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--page);
  color: var(--text-primary);
  font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

a { color: inherit; }

.wrap {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 20px 80px;
}

/* ---------- header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--page) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.site-header .wrap {
  padding-top: 14px;
  padding-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  font-weight: 650;
  font-size: 17px;
  letter-spacing: -0.01em;
}

.brand img { width: 30px; height: 30px; border-radius: 7px; display: block; }

.brand small {
  display: block;
  font-weight: 400;
  font-size: 12px;
  color: var(--text-muted);
  letter-spacing: 0;
}

.tabs {
  display: flex;
  gap: 2px;
  padding: 3px;
  background: var(--surface-2);
  border-radius: 9px;
  margin-left: auto;
}

.tabs button {
  border: 0;
  background: transparent;
  color: var(--text-secondary);
  font: inherit;
  font-size: 13.5px;
  padding: 6px 14px;
  border-radius: 7px;
  cursor: pointer;
}

.tabs button[aria-selected='true'] {
  background: var(--surface-1);
  color: var(--text-primary);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
  font-weight: 550;
}

.icon-btn {
  border: 1px solid var(--border);
  background: var(--surface-1);
  color: var(--text-secondary);
  border-radius: 8px;
  width: 34px;
  height: 34px;
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
}

.sync-note {
  font-size: 12.5px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 7px;
}

.pulse {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--status-good);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--status-good) 22%, transparent);
}

/* ---------- hero ---------- */

.hero {
  padding: 40px 0 8px;
  max-width: 720px;
}

.hero h1 {
  margin: 0 0 10px;
  font-size: 34px;
  line-height: 1.15;
  letter-spacing: -0.025em;
  font-weight: 680;
}

.hero p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 16px;
}

/* ---------- tiles ---------- */

.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
  margin: 26px 0 18px;
}

.tile {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 13px;
  padding: 15px 17px 16px;
}

.tile .label {
  font-size: 12.5px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
  margin-bottom: 7px;
}

.tile .value {
  font-size: 30px;
  font-weight: 660;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.tile .sub {
  font-size: 12.5px;
  color: var(--text-secondary);
  margin-top: 3px;
}

/* ---------- panels ---------- */

.panel {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 13px;
  padding: 18px 20px 20px;
  margin-bottom: 16px;
}

.panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 4px;
}

.panel h2 {
  margin: 0;
  font-size: 15.5px;
  font-weight: 620;
  letter-spacing: -0.01em;
}

.panel .caption {
  font-size: 12.5px;
  color: var(--text-muted);
  margin: 0 0 14px;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1.55fr 1fr;
  gap: 16px;
  align-items: start;
}

@media (max-width: 860px) {
  .grid-2 { grid-template-columns: 1fr; }
}

/* ---------- charts ---------- */

.chart {
  position: relative;
  width: 100%;
}

.chart svg { display: block; width: 100%; height: auto; overflow: visible; }

.axis-label {
  font-size: 11px;
  fill: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.gridline { stroke: var(--grid); stroke-width: 1; }
.baseline { stroke: var(--baseline); stroke-width: 1; }

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 12px;
  font-size: 12.5px;
  color: var(--text-secondary);
}

.legend span.key {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend .swatch {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  display: inline-block;
}

.tooltip {
  position: absolute;
  pointer-events: none;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 12.5px;
  color: var(--text-primary);
  box-shadow: var(--shadow);
  transform: translate(-50%, -120%);
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.1s ease;
  z-index: 5;
}

.tooltip.on { opacity: 1; }
.tooltip .t-val { font-weight: 620; }

details.data-table { margin-top: 12px; }
details.data-table summary {
  font-size: 12.5px;
  color: var(--text-muted);
  cursor: pointer;
}
details.data-table table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 8px;
  font-size: 12.5px;
}
details.data-table th,
details.data-table td {
  text-align: left;
  padding: 4px 8px 4px 0;
  border-bottom: 1px solid var(--border);
  font-variant-numeric: tabular-nums;
}
details.data-table th { color: var(--text-muted); font-weight: 600; }

/* ---------- category groups ---------- */

.group {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 13px;
  margin-bottom: 14px;
  overflow: hidden;
}

.group-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  background: none;
  width: 100%;
  text-align: left;
  font: inherit;
  color: inherit;
}

.group-head:hover { background: var(--surface-2); }

.group-head .title {
  font-weight: 620;
  font-size: 15px;
  letter-spacing: -0.01em;
}

.group-head .blurb {
  font-size: 12.5px;
  color: var(--text-muted);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.count-pill {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 10px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.chevron { color: var(--text-muted); font-size: 12px; transition: transform 0.15s ease; }
.group[data-open='false'] .chevron { transform: rotate(-90deg); }
.group[data-open='false'] .group-body { display: none; }

.group-body { padding: 6px 20px 14px; }

/* ---------- CVE rows ---------- */

.cve {
  display: flex;
  gap: 14px;
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
  align-items: flex-start;
}

.cve:last-child { border-bottom: 0; }

.cve-main { flex: 1; min-width: 0; }

.cve-title {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 3px;
}

.cve-id {
  font-weight: 620;
  font-size: 14px;
  color: var(--text-primary);
  text-decoration: none;
  font-variant-numeric: tabular-nums;
}

.cve-id:hover { text-decoration: underline; text-underline-offset: 2px; }

.cve-desc {
  color: var(--text-secondary);
  font-size: 13.5px;
  margin: 0;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.cve-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 5px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.cve-links {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 7px;
}

.cve-links a {
  font-size: 12px;
  color: var(--text-secondary);
  text-decoration: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px 8px;
  background: var(--surface-2);
}

.cve-links a:hover { color: var(--text-primary); border-color: var(--baseline); }

.score {
  text-align: right;
  min-width: 78px;
  font-variant-numeric: tabular-nums;
}

.score .num { font-size: 19px; font-weight: 640; letter-spacing: -0.01em; }
.score .sev { font-size: 11.5px; font-weight: 650; letter-spacing: 0.05em; }

/* ---------- severity chips ---------- */

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.04em;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  background: var(--surface-2);
  white-space: nowrap;
}

.chip .dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.chip.kev { color: var(--text-primary); }

.sev-CRITICAL { color: var(--status-critical); }
.sev-HIGH { color: var(--status-serious); }
.sev-MEDIUM { color: var(--status-warning); }
.sev-LOW { color: var(--status-good); }
.sev-NONE, .sev-UNKNOWN { color: var(--text-muted); }

.dot-CRITICAL { background: var(--status-critical); }
.dot-HIGH { background: var(--status-serious); }
.dot-MEDIUM { background: var(--status-warning); }
.dot-LOW { background: var(--status-good); }
.dot-NONE, .dot-UNKNOWN { background: var(--text-muted); }

/* ---------- filters ---------- */

.filters {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 14px;
}

.filters input[type='search'],
.filters select {
  font: inherit;
  font-size: 13.5px;
  color: var(--text-primary);
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 10px;
  min-height: 34px;
}

.filters input[type='search'] { min-width: 250px; flex: 1 1 250px; }

.filters label.check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-secondary);
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 11px;
  cursor: pointer;
  min-height: 34px;
}

.btn {
  font: inherit;
  font-size: 13.5px;
  padding: 7px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-1);
  color: var(--text-secondary);
  cursor: pointer;
  min-height: 34px;
}

.btn:hover:not(:disabled) { color: var(--text-primary); border-color: var(--baseline); }
.btn:disabled { opacity: 0.45; cursor: default; }

.result-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.cve-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.cve-table th {
  text-align: left;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  font-weight: 600;
  padding: 0 12px 8px 0;
  border-bottom: 1px solid var(--border);
}

.cve-table td {
  padding: 10px 12px 10px 0;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.cve-table td.num { text-align: right; font-variant-numeric: tabular-nums; padding-right: 0; }
.cve-table .desc-cell { color: var(--text-secondary); max-width: 460px; }

.pager {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 16px;
}

.empty {
  padding: 40px 10px;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
}

.loading { padding: 60px 10px; text-align: center; color: var(--text-muted); }

.view { display: none; }
.view.active { display: block; }

footer.site-footer {
  border-top: 1px solid var(--border);
  margin-top: 40px;
  padding-top: 20px;
  font-size: 12.5px;
  color: var(--text-muted);
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

footer.site-footer a { color: var(--text-secondary); }

@media (max-width: 620px) {
  .hero h1 { font-size: 26px; }
  .tabs { margin-left: 0; width: 100%; }
  .tabs button { flex: 1; }
  .cve { flex-direction: column; }
  .score { text-align: left; }
}
