:root {
  color-scheme: light;
  --bg: #eef2ec;
  --surface: #ffffff;
  --surface-soft: #f6f8f4;
  --ink: #17211d;
  --muted: #65716b;
  --line: #d7dfd9;
  --line-strong: #aab8af;
  --forest: #155f46;
  --forest-deep: #0c4032;
  --teal: #0f766e;
  --blue: #2d5b9f;
  --amber: #a86216;
  --red: #b13a32;
  --violet: #7251a3;
  --shadow: 0 14px 32px rgba(30, 48, 39, 0.07);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  margin: 0;
  background:
    linear-gradient(180deg, rgba(21, 95, 70, 0.09), transparent 340px),
    var(--bg);
  color: var(--ink);
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    "PingFang SC",
    "Microsoft YaHei",
    sans-serif;
}

button,
select,
table {
  font: inherit;
}

button,
select,
a {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
}

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

.page-shell {
  width: min(1480px, calc(100% - 34px));
  margin: 0 auto;
  overflow-x: clip;
  padding: 22px 0 48px;
}

.hero,
.boundary-note,
.kpi-grid,
.panel,
.mover-grid,
.coverage-layout {
  margin-bottom: 16px;
}

.top-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.top-nav a,
.action-link,
.meta-chip,
.status-pill {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  text-decoration: none;
}

.top-nav a {
  padding: 0 12px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--muted);
  font-size: 13px;
  font-weight: 720;
}

.top-nav a:hover,
.top-nav a:focus-visible {
  border-color: var(--line-strong);
  color: var(--ink);
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 14px;
}

.hero-copy,
.status-card,
.boundary-note,
.panel,
.kpi-card {
  border: 1px solid rgba(211, 221, 214, 0.94);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.91);
  box-shadow: var(--shadow);
}

.hero-copy {
  min-height: 290px;
  padding: clamp(28px, 5vw, 64px);
  background:
    linear-gradient(110deg, rgba(12, 64, 50, 0.98), rgba(21, 95, 70, 0.93)),
    #0c4032;
  color: white;
}

.eyebrow,
.section-kicker {
  color: var(--teal);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.hero-copy .eyebrow {
  color: #a9e1c9 !important;
}

.hero-copy h1 {
  max-width: 900px;
  margin-top: 10px;
  color: white !important;
  font-size: clamp(36px, 5.7vw, 72px);
  font-weight: 760;
  letter-spacing: -0.045em;
  line-height: 0.98;
}

.hero-lead {
  max-width: 830px;
  margin-top: 20px;
  color: rgba(255, 255, 255, 0.78) !important;
  font-size: 16px;
  line-height: 1.65;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 26px;
}

.action-link {
  padding: 0 14px;
  border-color: rgba(255, 255, 255, 0.25);
  color: rgba(255, 255, 255, 0.84);
  font-size: 13px;
  font-weight: 760;
}

.action-link.primary {
  border-color: white;
  background: white;
  color: var(--forest-deep);
}

.status-card {
  display: grid;
  align-content: space-between;
  gap: 16px;
  padding: 22px;
}

.status-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
}

.status-pill {
  min-height: 30px;
  padding: 0 10px;
  border-color: rgba(21, 95, 70, 0.22);
  background: rgba(21, 95, 70, 0.09);
  color: var(--forest);
  font-weight: 830;
}

.status-pill.loading,
.status-pill.partial {
  border-color: rgba(168, 98, 22, 0.25);
  background: rgba(168, 98, 22, 0.1);
  color: var(--amber);
}

.status-pill.error {
  border-color: rgba(177, 58, 50, 0.25);
  background: rgba(177, 58, 50, 0.1);
  color: var(--red);
}

.status-card > strong {
  font-size: 44px;
  letter-spacing: -0.04em;
}

.status-card p {
  color: var(--muted);
  line-height: 1.6;
}

.status-card a,
.literature-head a,
.method-panel > .panel-head a {
  color: var(--forest);
  font-size: 13px;
  font-weight: 800;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.embedded-note {
  color: var(--muted);
  font-size: 12px;
  font-weight: 720;
}

.boundary-note {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.8fr);
  gap: 18px;
  align-items: center;
  padding: 16px 18px;
  border-left: 4px solid var(--amber);
}

.boundary-note > div {
  display: flex;
  gap: 12px;
  align-items: center;
}

.boundary-mark {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  background: rgba(168, 98, 22, 0.11);
  color: var(--amber);
  font-family: Georgia, serif;
  font-size: 19px;
  font-weight: 800;
}

.boundary-note h2 {
  font-size: 15px;
}

.boundary-note p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.kpi-card {
  min-height: 145px;
  padding: 17px;
}

.kpi-card > span,
.kpi-card small {
  color: var(--muted);
  font-size: 12px;
}

.kpi-card strong {
  display: block;
  margin: 18px 0 7px;
  font-size: clamp(25px, 3.3vw, 39px);
  letter-spacing: -0.045em;
  line-height: 1;
}

.kpi-card p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.kpi-card.accent {
  border-color: rgba(21, 95, 70, 0.3);
  background: #f7fbf8;
}

.panel {
  padding: 20px;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.panel-head.compact {
  margin-bottom: 12px;
}

.panel-head h2 {
  margin-top: 5px;
  font-size: 22px;
  letter-spacing: -0.02em;
}

.panel-head p:not(.section-kicker) {
  max-width: 790px;
  margin-top: 7px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.section-kicker.positive {
  color: var(--forest);
}

.section-kicker.negative {
  color: var(--red);
}

.history-head {
  align-items: center;
}

.history-controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.segmented {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-soft);
}

.segment {
  min-height: 34px;
  padding: 0 12px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  font-weight: 780;
}

.segment.active {
  background: var(--forest-deep);
  color: white;
  box-shadow: 0 3px 8px rgba(12, 64, 50, 0.18);
}

.select-control {
  display: flex;
  min-height: 42px;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--muted);
  font-size: 12px;
}

.select-control select,
#industry-select {
  border: 0;
  background: transparent;
  color: var(--ink);
  font-weight: 750;
  outline: none;
}

.chart-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 250px;
  gap: 14px;
  align-items: stretch;
}

.chart-stage {
  position: relative;
  min-height: 440px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fbfcfa;
}

.chart-stage svg,
.detail-chart svg,
.coverage-chart svg {
  display: block;
  width: 100%;
  height: auto;
}

.chart-stage svg:focus-visible {
  outline: 3px solid rgba(45, 91, 159, 0.28);
  outline-offset: -3px;
}

.chart-stage .grid-line,
.detail-chart .grid-line {
  stroke: #e0e6e1;
  stroke-width: 1;
}

.chart-stage .axis-label,
.detail-chart .axis-label,
.coverage-chart text {
  fill: var(--muted);
  font-size: 12px;
}

.chart-line {
  fill: none;
  stroke-width: 2.5;
  stroke-linejoin: round;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}

.chart-cursor {
  stroke: #738078;
  stroke-width: 1;
  stroke-dasharray: 4 4;
}

.chart-marker {
  stroke: white;
  stroke-width: 2;
}

.chart-tooltip {
  position: absolute;
  z-index: 4;
  width: min(250px, calc(100% - 24px));
  padding: 10px 12px;
  border: 1px solid rgba(12, 64, 50, 0.28);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 10px 24px rgba(28, 42, 34, 0.13);
  pointer-events: none;
  font-size: 12px;
}

.chart-tooltip strong {
  display: block;
  margin-bottom: 7px;
}

.tooltip-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 4px;
}

.tooltip-row span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chart-help {
  margin-top: 8px;
  color: var(--muted);
  font-size: 11px;
}

.legend-panel {
  min-height: 440px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-soft);
}

.legend-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.legend-head h3 {
  font-size: 14px;
}

.legend-head button {
  border: 0;
  background: transparent;
  color: var(--forest);
  cursor: pointer;
  font-size: 11px;
  font-weight: 800;
}

.series-legend {
  display: grid;
  gap: 3px;
  max-height: 380px;
  overflow: auto;
  padding-right: 3px;
}

.legend-item {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  gap: 7px;
  align-items: center;
  min-height: 34px;
  padding: 4px 5px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 11px;
}

.legend-item:hover {
  background: white;
}

.legend-item input {
  width: 15px;
  height: 15px;
  margin: 0;
  accent-color: var(--forest);
}

.legend-item span:nth-child(2) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.legend-value {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

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

.mover-grid .panel {
  margin: 0;
}

.mover-list {
  display: grid;
  gap: 8px;
}

.mover-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.mover-item:first-child {
  border-top: 0;
}

.mover-item strong {
  display: block;
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mover-item small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
}

.mover-value {
  font-size: 15px;
  font-weight: 850;
  font-variant-numeric: tabular-nums;
}

.mover-value.up {
  color: var(--forest);
}

.mover-value.down {
  color: var(--red);
}

.meta-chip {
  min-height: 30px;
  padding: 0 10px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 760;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 9px;
}

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

th,
td {
  padding: 11px 13px;
  border-bottom: 1px solid var(--line);
  text-align: right;
  white-space: nowrap;
}

th {
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

th:first-child,
td:first-child,
.sample-table th:nth-child(2),
.sample-table td:nth-child(2),
.sample-table th:nth-child(3),
.sample-table td:nth-child(3) {
  text-align: left;
}

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

.rotation-table tbody tr:hover {
  background: #f7faf7;
}

.industry-button {
  max-width: 360px;
  padding: 0;
  overflow: hidden;
  border: 0;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  font-weight: 760;
  text-align: left;
  text-decoration: underline;
  text-decoration-color: transparent;
  text-overflow: ellipsis;
  text-underline-offset: 3px;
  white-space: nowrap;
}

.industry-button:hover,
.industry-button:focus-visible {
  color: var(--forest);
  text-decoration-color: currentColor;
}

.value-cell {
  font-variant-numeric: tabular-nums;
  font-weight: 760;
}

.delta-up {
  color: var(--forest);
}

.delta-down {
  color: var(--red);
}

.percentile-track {
  display: inline-flex;
  width: 94px;
  height: 6px;
  margin-right: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: #e5ebe7;
  vertical-align: middle;
}

.percentile-track i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--teal);
}

.detail-panel .panel-head {
  align-items: center;
}

#industry-select {
  max-width: min(420px, 100%);
  min-height: 40px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.detail-metrics {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.detail-metric {
  min-height: 92px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.detail-metric span,
.detail-metric small {
  color: var(--muted);
  font-size: 11px;
}

.detail-metric strong {
  display: block;
  margin: 10px 0 4px;
  font-size: 21px;
}

.detail-chart,
.coverage-chart {
  min-height: 230px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fbfcfa;
}

.coverage-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(300px, 0.6fr);
  gap: 10px;
}

.coverage-layout .panel {
  margin: 0;
}

.coverage-bar {
  fill: rgba(21, 95, 70, 0.76);
}

.coverage-floor {
  stroke: var(--amber);
  stroke-width: 1.5;
  stroke-dasharray: 5 4;
}

.quality-list {
  display: grid;
  gap: 0;
}

.quality-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  padding: 11px 0;
  border-top: 1px solid var(--line);
}

.quality-row:first-child {
  border-top: 0;
}

.quality-row dt {
  color: var(--muted);
  font-size: 12px;
}

.quality-row dd {
  font-size: 12px;
  font-weight: 830;
}

.quality-pass {
  color: var(--forest);
}

.literature-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 9px;
}

.literature-card {
  min-height: 260px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-soft);
}

.literature-card .theme-number {
  color: var(--forest);
  font-family: Georgia, serif;
  font-size: 28px;
  font-style: italic;
}

.literature-card h3 {
  margin-top: 12px;
  font-size: 16px;
  line-height: 1.35;
}

.literature-card p {
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.62;
}

.literature-card a {
  display: inline-block;
  margin-top: 12px;
  color: var(--forest);
  font-size: 11px;
  font-weight: 800;
}

.inference-guard {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 20px;
  margin-top: 12px;
  padding: 18px;
  border-left: 4px solid var(--red);
  background: #fbf6f5;
}

.inference-guard h3 {
  font-size: 15px;
}

.inference-guard ul {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 20px;
  margin: 0;
  padding-left: 18px;
  color: #684c47;
  font-size: 12px;
  line-height: 1.5;
}

.method-grid,
.source-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
}

.method-card,
.source-card {
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.method-card span,
.source-card span {
  color: var(--teal);
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0.08em;
}

.method-card h3,
.source-card h3 {
  margin-top: 8px;
  font-size: 14px;
}

.method-card p,
.source-card p {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.source-card a {
  display: inline-block;
  margin-top: 10px;
  color: var(--forest);
  font-size: 11px;
  font-weight: 800;
}

.sample-details {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-soft);
}

.sample-details summary {
  padding: 14px 16px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
}

.sample-table-wrap {
  margin: 0 10px 10px;
  background: white;
}

.sample-table td {
  font-size: 12px;
}

.sample-table a {
  color: var(--forest);
  font-weight: 780;
}

.error-box {
  margin-top: 12px;
  padding: 14px;
  border: 1px solid rgba(177, 58, 50, 0.28);
  border-radius: 8px;
  background: rgba(177, 58, 50, 0.07);
  color: var(--red);
  font-size: 12px;
  line-height: 1.5;
}

.empty-state {
  display: grid;
  min-height: 180px;
  place-items: center;
  color: var(--muted);
  font-size: 13px;
}

@media (max-width: 1160px) {
  .kpi-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .chart-layout {
    grid-template-columns: 1fr;
  }

  .legend-panel {
    min-height: 0;
  }

  .series-legend {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    max-height: none;
  }

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

@media (max-width: 860px) {
  .hero-grid,
  .boundary-note,
  .coverage-layout {
    grid-template-columns: 1fr;
  }

  .status-card {
    min-height: 220px;
  }

  .mover-grid,
  .method-grid,
  .source-grid {
    grid-template-columns: 1fr;
  }

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

  .inference-guard {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .page-shell {
    width: min(100% - 20px, 1480px);
    padding-top: 10px;
  }

  .hero-copy {
    min-height: 310px;
    padding: 28px 22px;
  }

  .hero-copy h1 {
    font-size: 43px;
  }

  .boundary-note,
  .panel {
    padding: 16px;
  }

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

  .kpi-card:last-child {
    grid-column: 1 / -1;
  }

  .history-head,
  .panel-head {
    display: grid;
  }

  .history-controls {
    justify-content: flex-start;
  }

  .segmented {
    width: 100%;
  }

  .segment {
    flex: 1;
  }

  .chart-stage {
    min-height: 330px;
    overflow-x: auto;
  }

  .chart-stage svg {
    min-width: 760px;
  }

  .series-legend,
  .literature-grid,
  .inference-guard ul {
    grid-template-columns: 1fr;
  }

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

  th,
  td {
    padding: 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}
