:root {
  color-scheme: light;
  --ink: #18202a;
  --muted: #5b6672;
  --line: #d9dedf;
  --paper: #f7f7f4;
  --panel: #ffffff;
  --panel-2: #eef3ef;
  --blue: #1d5c8f;
  --green: #1f7a58;
  --amber: #a9691f;
  --red: #a43e35;
  --violet: #6a4c93;
  --shadow: 0 18px 60px rgba(18, 29, 38, 0.09);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--paper);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

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

button {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--ink);
  cursor: pointer;
  padding: 0.65rem 0.8rem;
}

button:hover,
button:focus-visible {
  border-color: var(--blue);
  outline: none;
}

.shell {
  min-height: 100svh;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: 0.5rem;
  z-index: 10;
  transform: translateY(-160%);
  border-radius: 6px;
  background: var(--ink);
  color: white;
  padding: 0.55rem 0.7rem;
  text-decoration: none;
}

.skip-link:focus {
  transform: translateY(0);
}

.topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 2rem;
  padding: 2rem clamp(1rem, 3vw, 2.5rem) 1.25rem;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.eyebrow {
  margin: 0 0 0.35rem;
  color: var(--green);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0.4rem;
  font-size: clamp(2rem, 4vw, 4.75rem);
  line-height: 0.95;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0.5rem;
  font-size: 1rem;
}

h3 {
  margin-bottom: 0.4rem;
  font-size: 0.95rem;
}

.subhead {
  max-width: 760px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 1rem;
}

.top-actions {
  min-width: 230px;
  display: grid;
  gap: 0.7rem;
  justify-items: end;
}

.status-panel {
  min-width: 190px;
  display: grid;
  gap: 0.25rem;
  justify-items: end;
  color: var(--muted);
  font-size: 0.85rem;
}

.status-panel strong {
  color: var(--ink);
  font-size: 1.1rem;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.45rem;
}

.action-row button {
  min-height: 2.25rem;
  padding-block: 0.45rem;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(250px, 310px) minmax(0, 1fr);
  min-height: calc(100svh - 155px);
}

.filters {
  position: sticky;
  top: 0;
  align-self: start;
  height: calc(100svh - 155px);
  overflow: auto;
  padding: 1.25rem;
  border-right: 1px solid var(--line);
  background: #fbfbf8;
}

.filters section + section {
  margin-top: 1.6rem;
  padding-top: 1.4rem;
  border-top: 1px solid var(--line);
}

label {
  display: block;
  margin: 0.75rem 0 0.35rem;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 650;
}

input,
select {
  width: 100%;
  min-height: 2.4rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--ink);
  padding: 0.55rem 0.65rem;
}

input:focus,
select:focus {
  border-color: var(--blue);
  outline: none;
}

.checkbox {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--ink);
}

.checkbox input {
  width: 1rem;
  min-height: 1rem;
}

.weight-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.5rem;
  align-items: center;
  margin-top: 0.8rem;
}

.weight-row input {
  grid-column: 1 / -1;
  padding: 0;
}

.weight-row span {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.weight-row small {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 0.72rem;
}

.candidate-weight strong {
  color: var(--muted);
}

.mainstage {
  min-width: 0;
  padding: 1.25rem clamp(1rem, 2.4vw, 2rem) 2rem;
}

.metric-row {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.8rem;
  margin-bottom: 1rem;
}

.metric {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 1rem;
}

.metric span {
  display: block;
  margin-bottom: 0.4rem;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}

.metric strong {
  display: block;
  font-size: 1.45rem;
  line-height: 1.05;
}

.viz-band,
.table-section,
.detail-panel,
.sources-panel,
.compare-panel,
.methodology-panel,
.recommendation-panel,
.source-intel-panel,
.coverage-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.recommendation-panel,
.source-intel-panel,
.coverage-panel {
  margin-bottom: 1rem;
  padding: 1rem;
}

.viz-band {
  padding: 1rem;
}

.section-title {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.8rem;
}

.section-title p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.88rem;
}

#scatter {
  display: block;
  width: 100%;
  height: 420px;
  overflow: visible;
}

.axis text,
.point-label,
.axis-label {
  fill: var(--muted);
  font-size: 12px;
}

.axis line,
.axis path,
.grid-line {
  stroke: var(--line);
  stroke-width: 1;
}

.point {
  cursor: pointer;
  transition: r 150ms ease, opacity 150ms ease;
}

.point:hover {
  r: 8;
}

.recommendation-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
}

.recommendation-card {
  border-top: 1px solid var(--line);
  padding-top: 0.8rem;
}

.recommendation-card span {
  display: block;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
}

.recommendation-card strong {
  display: block;
  margin-top: 0.25rem;
  font-size: 1.25rem;
  line-height: 1.1;
}

.recommendation-card p {
  margin: 0.5rem 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.source-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.7rem;
  margin-bottom: 0.9rem;
}

.source-summary-item {
  border-top: 1px solid var(--line);
  padding-top: 0.7rem;
}

.source-summary-item span {
  display: block;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
}

.source-summary-item strong {
  display: block;
  margin-top: 0.2rem;
  font-size: 1.35rem;
}

.source-catalog {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 0.75rem;
}

.source-card {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfbf8;
  padding: 0.85rem;
}

.source-card-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 0.6rem;
}

.source-card-head a {
  font-weight: 800;
  text-decoration: none;
}

.source-card-head a:hover {
  text-decoration: underline;
}

.source-role {
  margin: 0.45rem 0;
  color: var(--ink);
  font-size: 0.84rem;
  font-weight: 700;
}

.source-card dl {
  display: grid;
  gap: 0.45rem;
  margin: 0.7rem 0;
}

.source-card dt {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.source-card dd {
  margin: 0.12rem 0 0;
  color: var(--ink);
  font-size: 0.84rem;
}

.coverage-matrix {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
}

.coverage-row {
  min-width: 0;
  border-top: 1px solid var(--line);
  padding-top: 0.8rem;
}

.coverage-row h3 {
  margin-bottom: 0.2rem;
}

.coverage-meter {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #e6e2d9;
  margin: 0.65rem 0;
}

.coverage-meter span {
  display: block;
  height: 100%;
  background: var(--blue);
}

.coverage-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.55rem;
}

.coverage-facts span:not(.quality) {
  border-radius: 999px;
  background: #e8edf0;
  color: #344554;
  padding: 0.15rem 0.5rem;
  font-size: 0.72rem;
  font-weight: 800;
}

.compare-panel {
  margin-top: 1rem;
  padding: 1rem;
}

.compare-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
}

.compare-card {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.8rem;
  background: #fbfbf8;
}

.compare-card.selected-card {
  border-color: var(--blue);
}

.compare-card-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 0.5rem;
}

.compare-card-head h3,
.compare-card-head p {
  margin-bottom: 0.2rem;
}

.compare-card-head button {
  width: 1.9rem;
  min-width: 1.9rem;
  height: 1.9rem;
  padding: 0;
}

.compare-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.45rem;
  margin: 0.75rem 0;
}

.compare-stats span {
  color: var(--muted);
  font-size: 0.78rem;
}

.compare-stats strong {
  display: block;
  color: var(--ink);
  font-size: 0.95rem;
}

.table-section {
  margin-top: 1rem;
  overflow: hidden;
}

.table-section .section-title {
  padding: 1rem 1rem 0;
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  min-width: 1160px;
  border-collapse: collapse;
}

th,
td {
  padding: 0.78rem 0.85rem;
  border-top: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 0.76rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

tbody tr {
  cursor: pointer;
}

tbody tr:hover,
tbody tr.selected {
  background: var(--panel-2);
}

.model-name {
  font-weight: 750;
}

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

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.chip {
  display: inline-flex;
  align-items: center;
  min-height: 1.45rem;
  border-radius: 999px;
  background: #e8edf0;
  color: #344554;
  padding: 0.15rem 0.5rem;
  font-size: 0.74rem;
  font-weight: 700;
}

.quality {
  display: inline-flex;
  align-items: center;
  min-height: 1.45rem;
  border-radius: 999px;
  padding: 0.15rem 0.52rem;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.quality.strong {
  background: #dfeee6;
  color: #115f42;
}

.quality.usable {
  background: #eee7d9;
  color: #72521c;
}

.quality.sparse {
  background: #e5e9ef;
  color: #334b62;
}

.quality.weak {
  background: #f0dfdc;
  color: #8a3027;
}

.coverage {
  width: 110px;
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #e6e2d9;
}

.coverage span {
  display: block;
  height: 100%;
  background: var(--green);
}

.detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(280px, 0.9fr);
  gap: 1rem;
  margin-top: 1rem;
}

.detail-panel,
.sources-panel,
.methodology-panel {
  padding: 1rem;
}

.detail-head,
.source-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 0.8rem;
}

.detail-kpis {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.7rem;
  margin: 0.9rem 0;
}

.mini-kpi {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.7rem;
}

.mini-kpi span {
  display: block;
  color: var(--muted);
  font-size: 0.74rem;
}

.mini-kpi strong {
  display: block;
  margin-top: 0.25rem;
}

.bench-list,
.source-list {
  display: grid;
  gap: 0.6rem;
}

.bench-item,
.source-item {
  border-top: 1px solid var(--line);
  padding-top: 0.7rem;
}

.source-item a {
  color: var(--blue);
  font-weight: 700;
  text-decoration: none;
}

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

.methodology-panel {
  margin-top: 1rem;
}

.method-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.8rem;
}

.method-grid > div {
  border-top: 1px solid var(--line);
  padding-top: 0.8rem;
}

@media (max-width: 960px) {
  .topbar {
    align-items: start;
    flex-direction: column;
  }

  .status-panel {
    justify-items: start;
  }

  .top-actions {
    justify-items: start;
  }

  .action-row {
    justify-content: flex-start;
  }

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

  .filters {
    order: 2;
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .mainstage {
    order: 1;
  }

  .metric-row,
  .detail-grid,
  .compare-grid,
  .method-grid,
  .recommendation-grid,
  .source-summary,
  .coverage-matrix {
    grid-template-columns: 1fr;
  }

  #scatter {
    height: 360px;
  }
}

@media (max-width: 640px) {
  .topbar {
    padding-top: 1.25rem;
  }

  .mainstage {
    padding-inline: 0.75rem;
  }

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

  .section-title {
    flex-direction: column;
  }
}
