:root {
  color-scheme: light;
  --bg: #f5f7f8;
  --surface: #ffffff;
  --surface-muted: #eef3f1;
  --text: #18211f;
  --muted: #64716d;
  --line: #dce4e1;
  --accent: #116149;
  --accent-strong: #0b4936;
  --amber: #a06408;
  --red: #a33a33;
  --shadow: 0 16px 45px rgba(24, 33, 31, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family:
    Inter, "Noto Sans JP", "Yu Gothic", "Hiragino Kaku Gothic ProN", Meiryo,
    system-ui, sans-serif;
}

a {
  color: inherit;
}

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

.brand {
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}

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

.nav-links a {
  border-radius: 6px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  padding: 10px 12px;
  text-decoration: none;
  white-space: nowrap;
}

.nav-links a.active,
.nav-links a:hover {
  background: var(--surface-muted);
  color: var(--text);
}

.page-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 28px auto 56px;
}

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

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

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

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

.run-meta {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
  text-align: right;
}

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

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

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

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

.notice-strip {
  margin: 20px 0;
  border-left: 4px solid var(--amber);
  background: #fff8ea;
  padding: 16px 18px;
  color: #604516;
  line-height: 1.7;
}

.notice-strip p {
  margin: 0;
}

.market-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 20px 0 14px;
}

.market-tabs button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-weight: 900;
}

.market-tabs button span {
  display: inline-grid;
  place-items: center;
  min-width: 24px;
  height: 24px;
  border-radius: 999px;
  background: var(--surface-muted);
  color: var(--muted);
  font-size: 12px;
}

.market-tabs button.active {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.market-tabs button.active span {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
}

.toolbar {
  display: grid;
  grid-template-columns: 180px 180px minmax(220px, 1fr);
  gap: 12px;
  margin: 20px 0;
}

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

select,
input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  padding: 0 12px;
}

.lead-grid {
  margin: 20px 0;
}

.detail-panel,
.table-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.detail-panel {
  padding: 24px;
}

.leader-topline,
.section-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.detail-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 20px;
  margin-top: 16px;
}

.detail-heading p {
  margin-bottom: 0;
  color: var(--muted);
}

.score-large {
  display: grid;
  place-items: center;
  min-width: 76px;
  height: 76px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 30px;
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(7, 42px);
  gap: 8px;
  margin: 22px 0;
}

.status-pill {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 6px;
  border: 1px solid var(--line);
  color: var(--muted);
  font-weight: 900;
}

.status-pill.pass {
  border-color: #b9d8cc;
  background: #e5f4ee;
  color: var(--accent-strong);
}

.status-pill.fail {
  background: #f6f7f7;
}

.detail-metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.metric {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 14px;
}

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

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

.table-section {
  overflow: hidden;
}

.section-title-row {
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

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

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

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

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

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

tbody tr {
  cursor: pointer;
}

tbody tr:hover,
tbody tr.selected {
  background: #f0f6f4;
}

.company-cell {
  min-width: 180px;
}

.score-badge,
.recommendation {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 900;
  white-space: nowrap;
}

.score-badge {
  min-width: 44px;
  background: var(--surface-muted);
  color: var(--accent-strong);
}

.recommendation {
  padding: 0 10px;
}

.recommendation-strong {
  background: #e5f4ee;
  color: var(--accent-strong);
}

.recommendation-partial {
  background: #fff2d8;
  color: var(--amber);
}

.recommendation-review {
  background: #f3eeee;
  color: var(--red);
}

.error-state {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 24px;
}

@media (max-width: 860px) {
  .app-header {
    align-items: start;
    flex-direction: column;
    padding: 14px 16px;
  }

  .page-shell {
    width: min(100% - 24px, 1180px);
    margin-top: 12px;
  }

  .headline-band {
    align-items: start;
    flex-direction: column;
  }

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

  .stats-strip,
  .market-tabs,
  .toolbar,
  .detail-metrics {
    grid-template-columns: 1fr 1fr;
  }

  .search-box {
    grid-column: 1 / -1;
  }
}

@media (max-width: 560px) {
  .stats-strip,
  .market-tabs,
  .toolbar,
  .detail-metrics {
    grid-template-columns: 1fr;
  }

  .detail-heading {
    flex-direction: column;
  }

  .status-grid {
    grid-template-columns: repeat(7, minmax(32px, 1fr));
  }

  .status-pill {
    width: 100%;
  }
}
