:root {
  --bg: #f5f7f8;
  --surface: #ffffff;
  --surface-soft: #eef5f2;
  --ink: #17201b;
  --muted: #66736c;
  --line: #dce4df;
  --accent: #0f766e;
  --accent-strong: #0b5d57;
  --gold: #b7791f;
  --good: #157347;
  --bad: #b42318;
  --warn: #a15c07;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

a {
  color: inherit;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 14px 28px;
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
}

.brand {
  font-size: 18px;
  font-weight: 760;
  text-decoration: none;
}

.nav-links {
  display: flex;
  gap: 6px;
  align-items: center;
}

.nav-links a {
  padding: 8px 12px;
  border-radius: 6px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 650;
  text-decoration: none;
}

.nav-links a.active,
.nav-links a:hover {
  color: var(--accent-strong);
  background: var(--surface-soft);
}

.page-shell {
  width: min(1220px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 48px;
}

.page-shell.narrow {
  width: min(920px, calc(100% - 32px));
}

.headline-band {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  padding: 16px 0 24px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 760;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(34px, 6vw, 56px);
  line-height: 1;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 14px;
  font-size: 22px;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 8px;
  font-size: 15px;
}

p {
  color: var(--muted);
  line-height: 1.72;
}

.run-meta {
  max-width: 360px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  text-align: right;
}

.stats-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--line);
}

.stats-strip div {
  padding: 18px 20px;
  background: var(--surface);
}

.stat-label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.stats-strip strong {
  font-size: 26px;
}

.toolbar {
  display: grid;
  grid-template-columns: 200px 220px minmax(220px, 1fr);
  gap: 12px;
  margin: 18px 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

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

.toolbar span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

select,
input {
  width: 100%;
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

select:focus,
input:focus {
  outline: 2px solid rgba(15, 118, 110, 0.22);
  border-color: var(--accent);
}

.lead-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
  gap: 18px;
  align-items: stretch;
}

.leader-panel,
.detail-panel,
.content-section,
.criteria-list article,
.table-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.leader-panel {
  min-height: 280px;
  padding: 26px;
}

.leader-topline {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.ticker-lockup {
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin: 20px 0 10px;
}

.ticker-lockup strong {
  font-size: 56px;
  line-height: 1;
}

.ticker-lockup span {
  color: var(--muted);
  font-size: 16px;
}

.leader-metrics,
.detail-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 22px;
}

.metric {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfb;
}

.metric span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.metric strong {
  font-size: 18px;
}

.detail-panel {
  padding: 22px;
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
  margin-top: 18px;
}

.status-pill {
  display: grid;
  place-items: center;
  min-height: 34px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 800;
}

.status-pill.pass {
  color: #fff;
  background: var(--good);
}

.status-pill.fail {
  color: #fff;
  background: var(--bad);
}

.recommendation {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 9px;
  border-radius: 6px;
  background: #e8f5ef;
  color: var(--good);
  font-size: 12px;
  font-weight: 750;
}

.table-section {
  margin-top: 18px;
  overflow: hidden;
}

.section-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.section-title-row h2 {
  margin: 0;
}

.section-title-row span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.table-wrap {
  overflow-x: auto;
}

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

th,
td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

th {
  color: var(--muted);
  background: #f8faf9;
  font-size: 12px;
  font-weight: 800;
}

td {
  font-size: 14px;
}

tbody tr {
  cursor: pointer;
}

tbody tr:hover,
tbody tr.selected {
  background: var(--surface-soft);
}

.company-cell {
  min-width: 220px;
  white-space: normal;
}

.score-badge {
  display: inline-grid;
  place-items: center;
  min-width: 42px;
  height: 28px;
  border-radius: 6px;
  background: #10231f;
  color: #fff;
  font-weight: 800;
}

.content-section {
  margin-bottom: 18px;
  padding: 24px;
}

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

.criteria-list article {
  padding: 20px;
}

.criteria-list h2 {
  margin: 0 0 10px;
  color: var(--accent-strong);
  font-size: 26px;
}

.rules-table th {
  width: 190px;
  color: var(--ink);
  font-size: 14px;
}

.rules-table td {
  white-space: normal;
  color: var(--muted);
  line-height: 1.6;
}

.error-state {
  padding: 20px;
  border: 1px solid #f2b8b5;
  border-radius: 8px;
  background: #fff7f7;
  color: var(--bad);
}

@media (max-width: 900px) {
  .app-header,
  .headline-band {
    align-items: flex-start;
    flex-direction: column;
  }

  .run-meta {
    text-align: left;
  }

  .stats-strip,
  .toolbar,
  .lead-grid,
  .criteria-list {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 560px) {
  .page-shell,
  .page-shell.narrow {
    width: min(100% - 20px, 1220px);
    padding-top: 18px;
  }

  .app-header {
    padding: 12px 14px;
  }

  .nav-links {
    width: 100%;
    overflow-x: auto;
  }

  h1 {
    font-size: 38px;
  }

  .ticker-lockup {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .ticker-lockup strong {
    font-size: 44px;
  }

  .leader-metrics,
  .detail-metrics,
  .status-grid {
    grid-template-columns: 1fr;
  }
}
