:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --ink: #182132;
  --muted: #687385;
  --line: #dfe6ee;
  --panel: #ffffff;
  --panel-soft: #eef5f9;
  --accent: #2f7da7;
  --accent-soft: #e6f2f7;
  --accent-wash: #f7fbfd;
  --accent-ink: #ffffff;
  --warn: #9a6715;
  --risk: #b53131;
  --shadow: 0 14px 38px rgba(24, 33, 50, 0.08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--accent) 7%, transparent), transparent 260px),
    var(--bg);
  color: var(--ink);
  overflow: hidden;
}

button,
input {
  font: inherit;
}

button,
input,
.result-item,
.info-card,
.stat-card {
  min-width: 0;
}

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto auto 1fr;
}

.topbar {
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 14px clamp(18px, 3vw, 34px);
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
}

.brand-block {
  display: grid;
  gap: 3px;
}

.topbar-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

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

h1 {
  font-size: 24px;
  line-height: 1.1;
  font-weight: 750;
}

#statusLine {
  margin-top: 6px;
  color: var(--muted);
  font-size: 14px;
}

.icon-button {
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  cursor: pointer;
  display: inline-grid;
  place-items: center;
  font-size: 20px;
}

.sidebar-toggle-icon {
  line-height: 1;
}

.shell.sidebar-collapsed .sidebar-toggle-icon {
  transform: rotate(90deg);
}

.theme-controls {
  min-height: 38px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 7px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.theme-swatch {
  width: 24px;
  height: 24px;
  border: 1px solid color-mix(in srgb, var(--swatch) 55%, #ffffff);
  border-radius: 999px;
  background: color-mix(in srgb, var(--swatch) 72%, #ffffff);
  cursor: pointer;
}

.theme-swatch.is-active {
  outline: 2px solid color-mix(in srgb, var(--swatch) 42%, transparent);
  outline-offset: 2px;
}

.color-picker {
  width: 26px;
  height: 26px;
  display: inline-grid;
  place-items: center;
}

.color-picker span {
  display: none;
}

.color-picker input {
  width: 24px;
  height: 24px;
  min-height: 24px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  cursor: pointer;
}

.icon-button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.78);
}

.metrics div {
  padding: 10px clamp(14px, 2vw, 28px);
  border-right: 1px solid var(--line);
}

.metrics div:last-child {
  border-right: 0;
}

.metrics span {
  display: block;
  font-size: 18px;
  font-weight: 760;
  line-height: 1.1;
}

.metrics small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0;
  line-height: 1.25;
}

.workspace {
  display: grid;
  grid-template-columns: clamp(240px, 23vw, 300px) minmax(0, 1fr);
  min-height: 0;
  height: calc(100vh - 133px);
  overflow: hidden;
  transition: grid-template-columns 160ms ease;
}

.shell.sidebar-collapsed .workspace {
  grid-template-columns: 0px minmax(0, 1fr);
}

.search-pane {
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.7);
  min-height: 0;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

.shell.sidebar-collapsed .search-pane {
  border-right: 0;
  display: none;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  padding: 10px 10px 0;
  gap: 6px;
}

.tab {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--muted);
  cursor: pointer;
  padding: 0 8px;
  font-size: 12px;
  font-weight: 650;
  line-height: 1.15;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tab.is-active {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 36%, var(--line));
  background: var(--accent-soft);
}

.source-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 12px 0 0;
  margin: 0;
}

.source-tabs .tab {
  height: 32px;
  padding: 0 12px;
  font-size: 13px;
  border-radius: 6px;
  white-space: nowrap;
}

.search-form {
  padding: 10px;
  display: grid;
  gap: 10px;
  border-bottom: 1px solid var(--line);
}

label {
  display: grid;
  gap: 6px;
}

label span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  text-transform: uppercase;
}

input {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  padding: 8px 10px;
}

input:focus {
  outline: 2px solid color-mix(in srgb, var(--accent) 20%, transparent);
  border-color: var(--accent);
}

.component-fields {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.primary-button {
  min-height: 38px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
  cursor: pointer;
}

.primary-button:hover {
  filter: brightness(0.95);
}

.result-list {
  overflow-y: auto;
  overflow-x: hidden;
  padding: 8px 10px 12px;
  display: grid;
  gap: 6px;
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--accent) 24%, var(--line)) transparent;
}

.result-item {
  width: 100%;
  text-align: left;
  border: 1px solid transparent;
  background: transparent;
  border-radius: 7px;
  padding: 10px;
  cursor: pointer;
  display: grid;
  gap: 6px;
}

.result-item:hover,
.result-item.is-active {
  background: var(--panel);
  border-color: color-mix(in srgb, var(--accent) 18%, var(--line));
  box-shadow: 0 2px 12px rgba(24, 33, 50, 0.06);
}

.result-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  font-size: 12px;
}

.result-meta .badge {
  font-size: 11px;
}

.result-main {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: baseline;
  min-width: 0;
}

.result-title {
  font-weight: 720;
  overflow-wrap: anywhere;
  line-height: 1.3;
  min-width: 0;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 8px;
  color: var(--muted);
  background: var(--panel-soft);
  font-size: 12px;
  line-height: 1.15;
  max-width: 100%;
  overflow-wrap: anywhere;
  gap: 4px;
}

.badge.critical {
  color: #fff;
  background: #b53131;
  border-color: #b53131;
  font-weight: 600;
}

.badge.high {
  color: #fff;
  background: #d47422;
  border-color: #d47422;
  font-weight: 600;
}

.badge.medium {
  color: #5e4a1a;
  background: #fcec9f;
  border-color: #e0cc6d;
}

.badge.low {
  color: #3a6835;
  background: #dff5da;
  border-color: #a8d4a0;
}

.badge.none {
  color: var(--muted);
  background: var(--panel-soft);
}

.badge.risk {
  color: #fff;
  background: #b53131;
  border-color: #b53131;
  font-weight: 600;
}

.badge.warn {
  color: #5e4a1a;
  background: #fff3cd;
  border-color: #e0cc6d;
}

.muted {
  color: var(--muted);
}

.detail-pane {
  min-width: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: clamp(18px, 2.5vw, 32px);
  max-width: 1440px;
  width: 100%;
}

.empty-state {
  max-width: 620px;
  padding-top: 16vh;
}

.empty-state h2 {
  font-size: 28px;
  margin-bottom: 8px;
}

.detail-header {
  display: grid;
  gap: 12px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.detail-title {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.detail-title h2 {
  font-size: clamp(22px, 2.3vw, 30px);
  line-height: 1.08;
  overflow-wrap: anywhere;
}

.detail-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  color: var(--muted);
  font-size: 13px;
}

.detail-meta-row b {
  color: var(--ink);
  font-weight: 650;
}

.detail-sections {
  margin-top: 18px;
  display: grid;
  gap: 18px;
}

.detail-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
  padding: 14px;
  box-shadow: 0 8px 24px rgba(24, 33, 50, 0.04);
}

.section-h {
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--muted);
  letter-spacing: 0;
  margin-bottom: 12px;
}

.card-stack {
  display: grid;
  gap: 8px;
}

.info-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  display: grid;
  gap: 8px;
}

.info-card-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
}

.info-card-body {
  margin: 0;
  line-height: 1.5;
  color: #3d4654;
  font-size: 13px;
  overflow-wrap: anywhere;
}

.description-primary {
  background: var(--accent-wash);
  border-color: color-mix(in srgb, var(--accent) 18%, var(--line));
}

.description-more {
  margin-top: 10px;
}

.description-more summary {
  width: fit-content;
  cursor: pointer;
  color: var(--accent);
  font-size: 13px;
  font-weight: 650;
  padding: 4px 0;
}

.description-more .card-stack {
  margin-top: 8px;
}

.chip-label {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  font-weight: 650;
  align-self: center;
}

.tag-source {
  font-size: 10px;
  padding: 1px 6px;
  min-height: 18px;
  background: #edf5fb;
  color: #245c86;
  border-color: #c6ddea;
}

.ref-link {
  color: var(--accent);
  font-size: 13px;
  word-break: break-all;
}

.upload-area {
  display: grid;
  gap: 8px;
  padding: 12px 0;
}

.upload-btn {
  width: fit-content;
  padding: 8px 18px;
}

.finding-table {
  font-size: 13px;
}

.finding-table th {
  position: sticky;
  top: 0;
  z-index: 1;
}

.finding-row:hover {
  background: #edf7f3;
}

.finding-cve {
  color: var(--accent);
  font-weight: 600;
}

.finding-header {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 8px 0 4px;
}

.summary {
  max-width: 1120px;
  color: #3d4654;
  line-height: 1.55;
  font-size: 14px;
  overflow-wrap: anywhere;
}

.detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 0.42fr);
  gap: 24px;
  margin-top: 22px;
}

.section {
  border-top: 1px solid var(--line);
  padding-top: 16px;
  margin-top: 20px;
}

.section h3 {
  font-size: 15px;
  line-height: 1.2;
  margin-bottom: 10px;
  text-transform: uppercase;
  color: var(--muted);
}

.table {
  width: 100%;
  border-collapse: collapse;
  background: var(--panel);
  border: 1px solid var(--line);
}

.table th,
.table td {
  border-bottom: 1px solid var(--line);
  padding: 9px 10px;
  text-align: left;
  vertical-align: top;
  font-size: 13px;
}

.table th {
  color: var(--muted);
  font-weight: 700;
  background: #f9faf7;
}

.table tr:last-child td {
  border-bottom: 0;
}

.kv {
  display: grid;
  grid-template-columns: minmax(110px, 0.35fr) 1fr;
  border: 1px solid var(--line);
  background: var(--panel);
}

.kv div {
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
}

.kv div:nth-child(odd) {
  color: var(--muted);
  background: #f9faf7;
  font-weight: 650;
}

.kv div:nth-last-child(-n + 2) {
  border-bottom: 0;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-height: 280px;
  overflow: auto;
  margin: 0;
  padding: 10px;
  border: 1px solid var(--line);
  background: #fbfcfa;
  border-radius: 8px;
  font-size: 12px;
}

.source-card-list {
  display: grid;
  gap: 10px;
}

.source-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 12px;
  display: grid;
  gap: 8px;
}

.detail-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 12px 0;
  border-bottom: 1px solid var(--line);
  padding-bottom: 8px;
}

.detail-tab {
  height: 32px;
  padding: 0 14px;
}

.overview-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.stat-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
  padding: 12px;
  display: grid;
  gap: 3px;
}

.stat-card span {
  font-size: 20px;
  font-weight: 760;
}

.stat-card small {
  color: var(--muted);
  text-transform: uppercase;
  font-size: 11px;
}

.compact-chips {
  padding-top: 2px;
}

.source-card-head {
  display: grid;
  gap: 6px;
}

.source-card strong {
  overflow-wrap: anywhere;
}

.source-card p {
  color: #3f473d;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

a {
  color: var(--accent);
}

@media (max-width: 900px) {
  body {
    overflow: auto;
  }

  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .workspace,
  .detail-grid {
    grid-template-columns: 1fr;
    height: auto;
    overflow: visible;
  }

  .shell.sidebar-collapsed .workspace {
    grid-template-columns: 1fr;
  }

  .overview-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .search-pane {
    min-height: auto;
    max-height: min(52vh, 520px);
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

}

@media (max-width: 560px) {
  .topbar {
    min-height: 74px;
    align-items: flex-start;
    gap: 12px;
  }

  .topbar-actions {
    width: 100%;
    justify-content: space-between;
  }

  .theme-controls {
    order: 3;
    width: 100%;
    justify-content: center;
  }

  h1 {
    font-size: 23px;
  }

  .metrics {
    grid-template-columns: 1fr;
  }

  .overview-grid {
    grid-template-columns: 1fr;
  }

  .metrics div {
    border-right: 0;
  }

  .component-fields {
    grid-template-columns: 1fr;
  }

  .kv {
    grid-template-columns: 1fr;
  }

  .kv div:nth-child(odd) {
    border-bottom: 0;
    padding-bottom: 3px;
  }
}

.cvss-vector {
  margin-top: 8px;
  display: grid;
  gap: 6px;
}

.cvss-vector-string {
  font-size: 13px;
  background: #f5f7f2;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 10px;
  display: inline-block;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.cvss-toggle {
  width: fit-content;
  border: 0;
  background: none;
  color: var(--accent);
  cursor: pointer;
  font-size: 13px;
  padding: 2px 0;
}

.cvss-toggle:hover {
  text-decoration: underline;
}

.cvss-breakdown {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
  overflow: hidden;
}

.cvss-metrics {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.cvss-metrics td,
.cvss-metrics th {
  padding: 6px 10px;
  border-bottom: 1px solid var(--line);
}

.cvss-metrics th {
  text-align: left;
  font-weight: 620;
  background: #f4f6f1;
}

.cvss-metrics tr:last-child td,
.cvss-metrics tr:last-child th {
  border-bottom: 0;
}
