:root {
  color-scheme: light;
  --ink: #162033;
  --muted: #667085;
  --line: #d9e0e8;
  --surface: #ffffff;
  --canvas: #f4f6f8;
  --accent: #1f64d8;
  --accent-soft: #eaf1ff;
  --danger: #b42318;
  --danger-soft: #fff0ed;
  --good: #13795b;
  --warning: #946200;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--canvas);
  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; }

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding: 28px 32px 22px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 7px; font-size: 28px; line-height: 1.25; }
h2 { margin-bottom: 0; font-size: 20px; }
.eyebrow, .section-kicker {
  margin-bottom: 6px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 750;
  text-transform: uppercase;
}
.subtitle, .muted { color: var(--muted); }
.subtitle { margin: 0; font-size: 14px; }

.download-link {
  min-height: 40px;
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  font-weight: 650;
  text-decoration: none;
}

.tabs {
  display: flex;
  gap: 4px;
  padding: 0 32px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.tab {
  padding: 14px 16px 12px;
  border: 0;
  border-bottom: 3px solid transparent;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.tab.is-active { border-color: var(--accent); color: var(--ink); font-weight: 700; }

main { padding: 24px 32px 48px; }
.view { display: none; }
.view.is-active { display: block; }

.metric-band {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}
.metric {
  min-height: 122px;
  padding: 20px;
  border-right: 1px solid var(--line);
}
.metric:last-child { border-right: 0; }
.metric span { display: block; color: var(--muted); font-size: 13px; }
.metric strong { display: block; margin: 8px 0 5px; font-size: 30px; line-height: 1; }
.metric.is-danger strong { color: var(--danger); }

.section-block {
  margin-top: 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}
.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  padding: 20px 22px;
  border-bottom: 1px solid var(--line);
}
.section-heading p:last-child { margin-bottom: 0; }

.breakdown-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.breakdown {
  padding: 20px 22px;
  border-right: 1px solid var(--line);
}
.breakdown:last-child { border-right: 0; }
.breakdown h3 { margin: 0 0 16px; font-size: 15px; }
.rate-row {
  display: grid;
  grid-template-columns: minmax(84px, 1fr) 2fr 68px;
  align-items: center;
  gap: 10px;
  margin: 12px 0;
  font-size: 13px;
}
.rate-track { height: 8px; background: #e9edf2; border-radius: 4px; overflow: hidden; }
.rate-fill { height: 100%; background: var(--accent); }
.rate-row strong { text-align: right; }

.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 12px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { background: #f8fafc; color: #475467; font-size: 12px; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
.rate-bad { color: var(--danger); font-weight: 750; }
.rate-empty { color: var(--muted); }

.bar-list { padding: 18px 22px; }
.bar-row {
  display: grid;
  grid-template-columns: 160px 1fr 96px;
  gap: 14px;
  align-items: center;
  margin: 12px 0;
  font-size: 13px;
}
.bar-track { height: 12px; background: #e9edf2; border-radius: 3px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--danger); }
.bar-row strong { text-align: right; }

#view-schemes {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}
.notice {
  margin: 18px 22px 22px;
  padding: 13px 15px;
  border-left: 3px solid var(--warning);
  background: #fff9e8;
  color: #694b00;
  font-size: 13px;
}

#view-cases {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}
.cases-intro {
  display: grid;
  grid-template-columns: minmax(220px, .65fr) minmax(560px, 1.35fr);
  gap: 24px;
  padding: 20px 22px;
  border-bottom: 1px solid var(--line);
}
.cases-intro p:last-child { margin-bottom: 0; }
.strategy-review-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
}
.strategy-review-tab {
  min-height: 66px;
  padding: 10px 12px;
  border: 0;
  border-right: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}
.strategy-review-tab:last-child { border-right: 0; }
.strategy-review-tab strong,
.strategy-review-tab span { display: block; }
.strategy-review-tab strong { margin-bottom: 5px; font-size: 13px; }
.strategy-review-tab span { color: var(--muted); font-size: 11px; }
.strategy-review-tab.is-active {
  box-shadow: inset 0 -3px 0 var(--accent);
  background: var(--accent-soft);
}
.strategy-review-tab:active { transform: translateY(1px); }
.strategy-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, .7fr)) minmax(260px, 1.6fr);
  border-bottom: 1px solid var(--line);
  background: #f8fafc;
}
.strategy-summary > div {
  min-width: 0;
  padding: 14px 18px;
  border-right: 1px solid var(--line);
}
.strategy-summary > div:last-child { border-right: 0; }
.strategy-summary span,
.strategy-summary strong { display: block; }
.strategy-summary span { margin-bottom: 5px; color: var(--muted); font-size: 11px; }
.strategy-summary strong { font-size: 14px; overflow-wrap: anywhere; }
.cases-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 22px;
  border-bottom: 1px solid var(--line);
}
.cases-toolbar > p { margin: 0; }
.filters {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}
.filters select, .filters input {
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface);
  color: var(--ink);
}
.filters input { width: min(320px, 100%); }

.case-list { min-height: 220px; }
.case-row {
  display: grid;
  grid-template-columns: minmax(250px, .85fr) minmax(320px, 1.2fr) minmax(280px, 1fr);
  border-bottom: 1px solid var(--line);
}
.case-row:last-child { border-bottom: 0; }
.case-cell { padding: 18px 20px; border-right: 1px solid var(--line); min-width: 0; }
.case-cell:last-child { border-right: 0; }
.case-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 7px;
  border-radius: 4px;
  background: var(--accent-soft);
  color: #174ea6;
  font-size: 11px;
  font-weight: 700;
}
.pill.is-danger { background: var(--danger-soft); color: var(--danger); }
.case-title { margin: 0 0 8px; font-size: 15px; line-height: 1.45; overflow-wrap: anywhere; }
.case-description {
  display: -webkit-box;
  margin: 0 0 11px;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
}
.case-description.is-source { -webkit-line-clamp: 2; }
.case-link { color: var(--accent); font-size: 12px; font-weight: 700; text-decoration: none; }
.case-label { display: block; margin: 14px 0 6px; color: var(--muted); font-size: 11px; text-transform: uppercase; }
.case-meta + .case-label { margin-top: 0; }
.source-account { display: block; overflow-wrap: anywhere; }
.source-link {
  display: inline-block;
  margin-top: 7px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  text-decoration: none;
}
.case-reason { margin-bottom: 16px; line-height: 1.55; }
.query-box {
  padding: 10px;
  background: #f6f8fa;
  border-radius: 5px;
  color: #344054;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.case-evidence {
  margin: 0;
  padding-left: 18px;
  color: #344054;
  font-size: 12px;
  line-height: 1.55;
}
.case-evidence li + li { margin-top: 6px; }
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 16px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}
.icon-button {
  width: 38px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface);
  cursor: pointer;
}
.icon-button:disabled { opacity: .4; cursor: default; }

.method-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px;
}
.method-section {
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.method-section > p:not(.section-kicker) { margin-top: 16px; color: #344054; line-height: 1.7; }
.decision-table { margin-top: 20px; border-top: 1px solid var(--line); }
.decision-table div {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 16px;
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}
.decision-table span { color: var(--muted); }
dl { margin: 18px 0 0; }
dl div { display: grid; grid-template-columns: 140px 1fr; gap: 16px; padding: 11px 0; border-bottom: 1px solid var(--line); }
dt { color: var(--muted); font-size: 12px; }
dd { margin: 0; font-size: 13px; overflow-wrap: anywhere; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

@media (max-width: 980px) {
  .metric-band { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric { border-bottom: 1px solid var(--line); }
  .breakdown-grid, .method-grid { grid-template-columns: 1fr; }
  .breakdown { border-right: 0; border-bottom: 1px solid var(--line); }
  .case-row { grid-template-columns: 1fr; }
  .case-cell { border-right: 0; border-bottom: 1px solid var(--line); }
  .cases-intro { grid-template-columns: 1fr; }
  .strategy-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .strategy-summary > div { border-bottom: 1px solid var(--line); }
  .strategy-summary-wide { grid-column: 1 / -1; }
  .cases-toolbar { align-items: flex-start; flex-direction: column; }
  .filters { justify-content: flex-start; width: 100%; }
}

@media (max-width: 680px) {
  .topbar { align-items: flex-start; flex-direction: column; padding: 22px 18px; }
  h1 { font-size: 23px; }
  .tabs { padding: 0 12px; overflow-x: auto; }
  .tab { white-space: nowrap; }
  main { padding: 16px 12px 32px; }
  .metric-band { grid-template-columns: 1fr; }
  .metric { min-height: 100px; border-right: 0; }
  .section-heading { align-items: flex-start; flex-direction: column; padding: 18px; }
  .cases-intro { padding: 18px; }
  .strategy-review-tabs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .strategy-review-tab:nth-child(2) { border-right: 0; }
  .strategy-review-tab:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .cases-toolbar { padding: 14px 18px; }
  .filters select, .filters input { width: 100%; }
  .bar-row { grid-template-columns: 110px 1fr 70px; }
  .case-cell { padding: 16px; }
}
