:root {
  color-scheme: light;
  font-family: "Segoe UI Variable", "Segoe UI", Arial, sans-serif;
  font-size: 16px;
  --bg: #eef1f5;
  --surface: #ffffff;
  --ink: #17191c;
  --muted: #59616c;
  --line: #cfd5dd;
  --line-strong: #8b95a3;
  --accent: #0f6cbd;
  --accent-hover: #0b5da7;
  --focus: #2899f5;
  --critical: #a4262c;
  --critical-bg: #fde7e9;
  --warning: #8a4b08;
  --warning-bg: #fff4ce;
  --scheduled: #0b6a0b;
  --scheduled-bg: #dff6dd;
  --neutral-bg: #e8ebef;
  --radius: 4px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
}

button, input, select { font: inherit; }
button, label.button { transition: background-color 120ms ease, border-color 120ms ease, transform 80ms ease; }
button:active, label.button:active { transform: translateY(1px); }
button:focus-visible, input:focus-visible, select:focus-visible, label.button:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--focus) 48%, transparent);
  outline-offset: 2px;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: 76px;
  display: grid;
  grid-template-columns: minmax(250px, 0.7fr) minmax(440px, 1.7fr) auto;
  align-items: center;
  gap: 24px;
  padding: 10px clamp(20px, 2.2vw, 42px);
  background: #202428;
  color: #ffffff;
  border-bottom: 3px solid var(--accent);
}

.brand-block { min-width: 0; }
.product-mark { margin: 0; font-size: 1.16rem; font-weight: 650; letter-spacing: -0.015em; }
.dataset-meta { margin: 4px 0 0; overflow: hidden; color: #c8ced6; font-size: 0.78rem; text-overflow: ellipsis; white-space: nowrap; }
.smart-search { width: 100%; max-width: 820px; margin: 0 auto; }
.smart-search input { width: 100%; min-height: 40px; padding: 8px 13px; border: 1px solid #747d87; border-radius: var(--radius); background: #ffffff; color: var(--ink); }
.smart-search input::placeholder { color: #59616c; }
.smart-search input:focus { border-color: var(--focus); outline: 2px solid var(--focus); outline-offset: 1px; }
.smart-search p { margin: 4px 0 0; color: #b7bec7; font-size: 0.72rem; line-height: 1.2; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

.button {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 7px 13px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}
.button.primary { background: var(--accent); color: #ffffff; }
.button.primary:hover { background: var(--accent-hover); }
.button.secondary { background: #ffffff; color: #24282d; border-color: #b8c0ca; }
.button.secondary:hover { background: #f1f4f7; border-color: #8f99a5; }
.button:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.text-button { min-height: 34px; border: 0; background: transparent; color: var(--accent); cursor: pointer; padding: 5px 8px; font-weight: 600; }
.text-button:hover { text-decoration: underline; }

.workspace { width: min(100%, 1920px); margin: 0 auto; padding: 0 clamp(14px, 1.8vw, 34px) 34px; }
.command-bar { min-height: 58px; display: flex; align-items: center; justify-content: space-between; gap: 20px; border-bottom: 1px solid var(--line); }
.dataset-controls, .view-controls { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.month-select { min-height: 36px; min-width: 225px; padding: 6px 30px 6px 9px; border: 1px solid #b8c0ca; border-radius: var(--radius); background: #ffffff; color: #24282d; }

.filter-ribbon { margin: 14px 0 0; padding: 13px 15px 15px; background: var(--surface); border: 1px solid var(--line); }
.filter-ribbon[hidden] { display: none; }
.panel-heading { display: flex; align-items: baseline; gap: 18px; margin-bottom: 11px; }
.panel-heading h1 { margin: 0; font-size: 1rem; font-weight: 650; }
.panel-heading p { margin: 0; color: var(--muted); font-size: 0.82rem; }
.filter-groups { display: grid; grid-template-columns: minmax(280px, 1.5fr) minmax(150px, 0.75fr) minmax(180px, 0.85fr) minmax(190px, 0.9fr) minmax(340px, 1.7fr); gap: 0; border-top: 1px solid var(--line); }
.filter-group { min-width: 0; margin: 0; padding: 12px 14px 4px; border: 0; border-right: 1px solid var(--line); }
.filter-group:first-child { padding-left: 0; }
.filter-group:last-child { padding-right: 0; border-right: 0; }
legend { margin-bottom: 8px; padding: 0; font-size: 0.85rem; font-weight: 650; }
.choice-list { display: grid; gap: 6px 12px; }
.compact-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.choice-list label { display: grid; grid-template-columns: 17px minmax(0, 1fr); gap: 7px; align-items: start; font-size: 0.82rem; line-height: 1.28; }
.choice-list input { width: 15px; height: 15px; margin: 1px 0 0; accent-color: var(--accent); }
.products-group .choice-list, .mitigations-group .choice-list { max-height: 126px; overflow-y: auto; padding-right: 7px; scrollbar-width: thin; }
.muted-copy, .field-help { color: var(--muted); font-size: 0.78rem; line-height: 1.35; }
.field-help { margin: -2px 0 8px; }

.results-panel { min-width: 0; padding-top: 14px; }
.results-heading { display: grid; grid-template-columns: auto minmax(320px, 1fr); align-items: center; gap: 22px; margin-bottom: 10px; }
.summary-strip { display: flex; align-items: stretch; background: transparent; border: 0; }
.summary-strip div { min-width: 116px; display: flex; flex-direction: column; justify-content: center; padding: 4px 16px 5px; border-right: 1px solid var(--line); }
.summary-strip div:first-child { padding-left: 0; }
.summary-strip div:last-child { border-right: 0; }
.summary-value { font-size: 1.42rem; font-weight: 650; font-variant-numeric: tabular-nums; line-height: 1.05; }
.summary-value + span { margin-top: 3px; color: var(--muted); font-size: 0.73rem; letter-spacing: 0.03em; text-transform: uppercase; }
.status { color: var(--muted); font-size: 0.82rem; line-height: 1.38; text-align: right; }

.table-shell { position: relative; max-height: 57dvh; overflow: auto; background: var(--surface); border: 1px solid var(--line); }
body.filters-collapsed .table-shell { max-height: calc(100dvh - 240px); }
table { width: 100%; min-width: 1280px; border-collapse: collapse; table-layout: fixed; }
th { position: sticky; top: 0; z-index: 2; padding: 9px 11px; background: #e9edf2; color: #303841; border-bottom: 1px solid var(--line-strong); font-size: 0.73rem; font-weight: 650; letter-spacing: 0.035em; text-align: left; text-transform: uppercase; }
th:nth-child(1) { width: 10%; }
th:nth-child(2) { width: 25%; }
th:nth-child(3) { width: 23%; }
th:nth-child(4) { width: 18%; }
th:nth-child(5) { width: 11%; }
th:nth-child(6) { width: 13%; }
td { padding: 10px 11px; border-bottom: 1px solid #e1e5ea; vertical-align: top; font-size: 0.82rem; line-height: 1.32; overflow-wrap: anywhere; }
tbody tr { cursor: pointer; }
tbody tr:hover { background: #f4f8fc; }
tbody tr[aria-selected="true"] { background: #e2f0fb; box-shadow: inset 3px 0 var(--accent); }

.cve-id { color: var(--accent); font-weight: 650; white-space: nowrap; }
.title-cell { font-weight: 550; }
.secondary-line { display: block; margin-top: 3px; color: var(--muted); font-size: 0.75rem; font-weight: 400; }
.threat-line { display: block; font-weight: 650; }
.kev-line { display: block; margin-top: 4px; color: var(--critical); font-size: 0.75rem; font-weight: 650; }
.tag-list { display: flex; flex-wrap: wrap; gap: 3px; }
.tag { display: inline-block; padding: 1px 5px; border: 1px solid #bdd7ee; border-radius: 2px; background: #eef6fc; color: #004f88; font-size: 0.7rem; }
.decision { display: inline-block; min-width: 92px; padding: 3px 6px; border-radius: 2px; font-size: 0.74rem; font-weight: 650; text-align: center; }
.decision.immediate { color: var(--critical); background: var(--critical-bg); }
.decision.out-of-cycle { color: var(--warning); background: var(--warning-bg); }
.decision.scheduled { color: var(--scheduled); background: var(--scheduled-bg); }
.decision.defer-and-review { color: #303841; background: var(--neutral-bg); }
.change-note { display: block; margin-top: 4px; color: var(--muted); font-size: 0.72rem; }
.empty-state { padding: 48px 20px; text-align: center; color: var(--muted); }

.detail-panel { margin-top: 12px; padding: 15px 17px 17px; background: var(--surface); border: 1px solid var(--line); }
.detail-placeholder { margin: 0; color: var(--muted); line-height: 1.45; }
.detail-grid { display: grid; grid-template-columns: minmax(230px, 0.9fr) minmax(260px, 1.15fr) minmax(420px, 1.8fr) minmax(230px, 0.95fr); gap: 0; }
.detail-section { min-width: 0; padding: 0 18px; border-right: 1px solid var(--line); }
.detail-section:first-child { padding-left: 0; }
.detail-section:last-child { padding-right: 0; border-right: 0; }
.detail-panel h2 { margin: 0 0 4px; font-size: 1.08rem; }
.detail-panel h3 { margin: 0 0 8px; font-size: 0.82rem; font-weight: 650; }
.detail-panel p { margin: 7px 0; font-size: 0.82rem; line-height: 1.4; }
.detail-meta { color: var(--muted); font-size: 0.76rem !important; }
.reason-list { margin: 0; padding-left: 18px; font-size: 0.8rem; line-height: 1.4; }
.mitigation-row { padding: 0 0 9px; margin-bottom: 9px; border-bottom: 1px solid #e1e5ea; font-size: 0.79rem; line-height: 1.35; }
.mitigation-row:last-child { padding-bottom: 0; margin-bottom: 0; border-bottom: 0; }
.mitigation-name { font-weight: 650; }
.confidence { margin: 2px 0; color: var(--muted); font-size: 0.73rem; }
.source-link { color: var(--accent); font-size: 0.77rem; overflow-wrap: anywhere; }

@media (max-width: 1320px) {
  .app-header { grid-template-columns: minmax(220px, 0.65fr) minmax(360px, 1.4fr) auto; gap: 14px; }
  .filter-groups { grid-template-columns: 1.3fr 0.65fr 0.8fr 0.85fr 1.45fr; }
  .compact-grid { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 18px; }
  .detail-section:nth-child(2) { border-right: 0; }
}

@media (max-width: 980px) {
  .app-header { position: static; grid-template-columns: 1fr auto; }
  .smart-search { grid-column: 1 / -1; grid-row: 2; max-width: none; }
  .command-bar, .results-heading { align-items: flex-start; flex-direction: column; display: flex; }
  .status { text-align: left; }
  .filter-groups { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filter-group { border-bottom: 1px solid var(--line); }
  .filter-group:nth-child(2n) { border-right: 0; }
  .mitigations-group { grid-column: 1 / -1; border-bottom: 0; }
  .mitigations-group .choice-list, .products-group .choice-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 680px) {
  .app-header { display: flex; align-items: stretch; flex-direction: column; }
  .workspace { padding-inline: 10px; }
  .command-bar { padding-block: 10px; }
  .dataset-controls, .view-controls { width: 100%; }
  .month-select { width: 100%; }
  .filter-groups, .detail-grid { display: block; }
  .filter-group, .detail-section { padding: 12px 0; border-right: 0; border-bottom: 1px solid var(--line); }
  .filter-group:last-child, .detail-section:last-child { border-bottom: 0; }
  .compact-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .summary-strip { width: 100%; overflow-x: auto; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
