:root {
  color-scheme: light;
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-muted: #f8fafc;
  --surface-soft: #f5f9ff;
  --line: #e0e2e6;
  --line-strong: #ccd5e2;
  --text: #181d26;
  --text-soft: rgba(4, 14, 32, 0.69);
  --accent: #1b61c9;
  --accent-strong: #254fad;
  --accent-soft: rgba(27, 97, 201, 0.1);
  --critical: #b42318;
  --high: #b54708;
  --medium: #b69208;
  --low: #027a48;
  --info: #3659a2;
  --shadow: rgba(0, 0, 0, 0.08) 0px 0px 2px, rgba(45, 127, 249, 0.14) 0px 1px 3px, rgba(15, 48, 106, 0.05) 0px 10px 30px;
  --shadow-strong: rgba(0, 0, 0, 0.12) 0px 18px 50px, rgba(45, 127, 249, 0.18) 0px 1px 4px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Inter", system-ui, sans-serif;
  background: radial-gradient(circle at top left, #eef5ff 0, #ffffff 28%), var(--bg);
  color: var(--text);
  letter-spacing: 0.08px;
}

body.modal-open {
  overflow: hidden;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 12px;
  font-weight: 500;
  font-size: 0.95rem;
  text-decoration: none;
  transition: all 0.15s ease;
  border: 1px solid transparent;
}

.btn-outline {
  background: var(--surface);
  color: var(--accent);
  border: 1px solid rgba(27, 97, 201, 0.18);
  box-shadow: rgba(45, 127, 249, 0.12) 0px 1px 3px;
}

.btn-outline:hover {
  background: var(--surface-soft);
  border-color: rgba(27, 97, 201, 0.28);
}

.btn-sm {
  padding: 5px 10px;
  font-size: 0.8rem;
}

.app-shell {
  max-width: 1540px;
  margin: 0 auto;
  padding: 28px 32px 40px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  margin-bottom: 28px;
}

.eyebrow,
.section-label {
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-soft);
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 4px;
  font-size: 2.35rem;
  line-height: 1.04;
  letter-spacing: -0.03em;
}

.topbar-meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.meta-item,
.badge,
.review-pill,
.quality-pill {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text-soft);
  padding: 7px 10px;
  border-radius: 999px;
  font-size: 0.84rem;
  font-weight: 600;
}

.layout {
  min-height: calc(100vh - 140px);
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.workspace-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(420px, 1fr);
  gap: 18px;
  align-items: stretch;
}

.hero-copy,
.hero-cards {
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.hero-copy {
  padding: 24px 26px;
  background:
    linear-gradient(135deg, rgba(27, 97, 201, 0.08), rgba(27, 97, 201, 0.02) 42%, rgba(255,255,255,1) 100%);
}

.hero-kicker {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.hero-copy h2 {
  margin: 0 0 12px;
  font-size: 1.65rem;
  line-height: 1.08;
  letter-spacing: -0.03em;
}

.hero-body {
  margin: 0;
  max-width: 58ch;
  color: var(--text-soft);
  font-size: 0.95rem;
  line-height: 1.45;
}

.hero-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  overflow: hidden;
}

.stat-card {
  padding: 18px 18px;
  background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
}

.stat-card + .stat-card {
  border-left: 1px solid var(--line);
}

.stat-label {
  margin: 0 0 10px;
  color: var(--text-soft);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 700;
}

.stat-value {
  margin: 0 0 8px;
  color: var(--text);
  font-size: 1.5rem;
  line-height: 1;
  letter-spacing: -0.04em;
  font-weight: 600;
}

.stat-note {
  margin: 0;
  color: var(--text-soft);
  font-size: 0.82rem;
  line-height: 1.35;
}

.overview-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
  min-height: 0;
  overflow: hidden;
}

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 18px;
  padding: 20px 24px 14px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
}

.toolbar-title h2 {
  margin-bottom: 8px;
  font-size: 1.25rem;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.toolbar-title p {
  margin-bottom: 0;
  color: var(--text-soft);
  max-width: 64ch;
  font-size: 0.92rem;
}

.toolbar-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

.search-field input,
.select-field select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px 13px;
  background: var(--surface);
  color: var(--text);
  box-shadow: rgba(45, 127, 249, 0.08) 0px 1px 3px;
}

.search-field input {
  min-width: 320px;
}

.table-wrap {
  overflow: auto;
  padding: 0 8px 8px;
}

.meta-block-wide {
  grid-column: 1 / -1;
}

table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #ffffff;
  text-align: left;
  color: var(--text-soft);
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  font-weight: 700;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
}

thead th:nth-child(1) { width: 34%; }
thead th:nth-child(2) { width: 8%; }
thead th:nth-child(3) { width: 19%; }
thead th:nth-child(4) { width: 9%; }
thead th:nth-child(5) { width: 17%; }
thead th:nth-child(6) { width: 8%; }
thead th:nth-child(7) { width: 12%; }

.sort-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.sort-button:hover,
.sort-button:focus-visible {
  color: var(--text);
  outline: none;
}

.sort-button.active {
  color: var(--text);
}

.sort-indicator {
  min-width: 12px;
  color: var(--text-soft);
}

tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid #edf1f5;
  vertical-align: top;
  font-size: 0.92rem;
}

.result-row {
  cursor: pointer;
  transition: background 140ms ease, transform 140ms ease;
}

.result-row:hover {
  background: #f7fbff;
}

.result-row.selected {
  background: #edf4ff;
}

.result-title {
  font-weight: 600;
  margin-bottom: 0;
  color: var(--text);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.result-subtitle,
.muted,
.empty-state {
  color: var(--text-soft);
  font-size: 0.92rem;
}

.cell-nowrap {
  white-space: nowrap;
}

.cell-cve {
  font-size: 0.82rem;
  line-height: 1.3;
  overflow-wrap: anywhere;
  white-space: normal;
}

.cell-vendor {
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.quality-pill {
  margin-right: 8px;
  background: var(--surface-muted);
}

.severity-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 90px;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border: 1px solid transparent;
}

.severity-critical {
  background: #f7e8e5;
  color: var(--critical);
  border-color: #ebcbc4;
}

.severity-high {
  background: #faefe3;
  color: var(--high);
  border-color: #efd7bc;
}

.severity-medium {
  background: #f8f3de;
  color: var(--medium);
  border-color: #eadf9a;
}

.severity-low {
  background: #e8f2ea;
  color: var(--low);
  border-color: #c9dfcc;
}

.severity-info {
  background: #ebf0f6;
  color: var(--info);
  border-color: #d2dbe7;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 24px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 32, 0.52);
  backdrop-filter: blur(4px);
}

.modal-dialog {
  position: relative;
  z-index: 1;
  width: min(1080px, calc(100vw - 32px));
  max-height: min(88vh, 980px);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid rgba(217, 224, 231, 0.9);
  border-radius: 24px;
  box-shadow: var(--shadow-strong);
  overflow: hidden;
}

.modal-header-bar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  padding: 24px 28px 18px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #fbfdff 0%, #ffffff 100%);
}

.modal-header-bar h2 {
  margin-bottom: 0;
  font-size: 1.55rem;
  line-height: 1.2;
}

.modal-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-muted);
  color: var(--text-soft);
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease;
}

.modal-close:hover,
.modal-close:focus-visible {
  background: #eef4fa;
  border-color: var(--line-strong);
  color: var(--text);
  outline: none;
}

.modal-close span {
  font-size: 1.5rem;
  line-height: 1;
}

.modal-content {
  overflow: auto;
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.detail-header {
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.detail-header h3 {
  margin-bottom: 10px;
  font-size: 1.55rem;
  line-height: 1.2;
}

.detail-meta-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 18px;
}

.meta-block {
  margin: 0;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-muted);
}

.meta-block dt {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-soft);
  margin-bottom: 5px;
}

.meta-block dd {
  margin: 0;
  font-weight: 600;
  line-height: 1.5;
}

.section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.section h3 {
  margin-bottom: 0;
  font-size: 1rem;
}

.section p,
.section li {
  color: #20313f;
  line-height: 1.6;
}

.section ul {
  margin: 0;
  padding-left: 20px;
}

.reference-list,
.script-list {
  display: grid;
  gap: 12px;
}

.script-filters {
  display: flex;
  justify-content: flex-start;
}

.script-filters .select-field select {
  min-width: 220px;
}

.reference-item,
.script-item {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  background: var(--surface-muted);
}

.reference-item a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

.script-item a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

.reference-item a:hover {
  text-decoration: underline;
}

.script-item a:hover {
  text-decoration: underline;
}

.badge-mode-check {
  background: #e8f2ea;
  color: #2c6a34;
  border-color: #bfd8c4;
}

.badge-mode-remediation {
  background: #e8eef8;
  color: #244d7f;
  border-color: #c5d4ec;
}

.badge-mode-other {
  background: #f2f4f7;
  color: #4b5f78;
  border-color: #d9e0e7;
}

.badge-scope-local {
  background: #f7f1e4;
  color: #7a5b1f;
  border-color: #e8d7ac;
}

.badge-scope-remote {
  background: #f6eaf2;
  color: #7d3f62;
  border-color: #e8c7d8;
}

.badge-target-windows {
  background: #edf3ff;
  color: #2f5ca8;
  border-color: #cddcf9;
}

.badge-target-linux {
  background: #eef7e9;
  color: #3f6a2c;
  border-color: #cfe6c0;
}

.badge-target-network {
  background: #f4edf9;
  color: #65428c;
  border-color: #dcccf0;
}

.badge-target-generic {
  background: #f2f4f7;
  color: #4b5f78;
  border-color: #d9e0e7;
}

.script-topline,
.id-row,
.tag-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.code-block {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  background: #13202b;
  color: #edf3f8;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 0.86rem;
  overflow: auto;
  white-space: pre-wrap;
}

.tag {
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 0.8rem;
  font-weight: 600;
}

.hidden {
  display: none !important;
}

.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;
}

.empty-state {
  padding: 22px 18px;
}

@media (max-width: 1100px) {
  .workspace-hero {
    grid-template-columns: 1fr;
  }

  .hero-cards {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .modal-overlay {
    padding: 12px;
  }

  .modal-dialog {
    width: min(100vw - 16px, 100%);
    max-height: calc(100vh - 24px);
    border-radius: 18px;
  }

  .modal-header-bar,
  .modal-content {
    padding-left: 18px;
    padding-right: 18px;
  }
}

@media (max-width: 760px) {
  .app-shell {
    padding: 16px;
  }

  .hero-cards {
    grid-template-columns: 1fr;
  }

  .stat-card + .stat-card {
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .topbar,
  .toolbar,
  .toolbar-actions,
  .modal-header-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .search-field input {
    min-width: 0;
  }

  .detail-meta-grid {
    grid-template-columns: 1fr;
  }

  .modal-close {
    align-self: flex-end;
  }
}
