:root {
  color-scheme: light;
  --canvas: #f7f5f1;
  --paper: #fffdf8;
  --paper-strong: #ffffff;
  --ink: #191716;
  --graphite: #3d3934;
  --muted: #767068;
  --line: #ded8ce;
  --line-strong: #c9bfb0;
  --burgundy: #812637;
  --burgundy-soft: #f1dfe2;
  --teal: #176d68;
  --teal-soft: #dcefeb;
  --amber: #a66a1a;
  --amber-soft: #f3e3c8;
  --blue: #365f83;
  --blue-soft: #dfeaf2;
  --slate: #66717a;
  --green: #2d6843;
  --shadow: 0 1px 0 rgba(25, 23, 22, 0.04), 0 18px 38px rgba(55, 45, 31, 0.055);
  --shadow-soft: 0 1px 0 rgba(25, 23, 22, 0.035), 0 8px 24px rgba(55, 45, 31, 0.035);
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  overflow-x: hidden;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    linear-gradient(rgba(25, 23, 22, 0.022) 1px, transparent 1px),
    linear-gradient(90deg, rgba(25, 23, 22, 0.022) 1px, transparent 1px),
    var(--canvas);
  background-size: 32px 32px;
  color: var(--ink);
  font-family: var(--sans);
  letter-spacing: 0;
  overflow-x: hidden;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(1720px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 18px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 78px;
  padding: 15px 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.94);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(12px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.brand > div:last-child {
  min-width: 0;
}

.brand-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
}

.brand-mark svg {
  display: block;
  width: 42px;
  height: 42px;
  overflow: visible;
}

.logo-paper {
  fill: #fffdf8;
  stroke: var(--ink);
  stroke-width: 1.8;
}

.logo-axis {
  fill: none;
  stroke: var(--ink);
  stroke-linecap: round;
  stroke-width: 2.2;
}

.logo-curve {
  fill: none;
  stroke: var(--blue);
  stroke-linecap: round;
  stroke-width: 2.2;
}

.logo-bar {
  stroke: var(--ink);
  stroke-width: 1;
}

.logo-bar.ink {
  fill: var(--ink);
}

.logo-bar.teal {
  fill: var(--teal);
}

.logo-bar.burgundy {
  fill: var(--burgundy);
}

.logo-node {
  fill: var(--amber);
  stroke: var(--paper);
  stroke-width: 1.6;
}

.eyebrow,
.section-kicker {
  margin: 0 0 4px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 600;
  line-height: 1.4;
  text-transform: uppercase;
}

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

h1 {
  margin: 0;
  font-size: 23px;
  line-height: 1.1;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 19px;
  line-height: 1.22;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 0;
  font-size: 14px;
  line-height: 1.3;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.dataset-pill,
.method-strip span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbf8f1;
  color: var(--graphite);
  font-family: var(--mono);
  font-size: 12px;
  white-space: nowrap;
}

.method-strip span {
  white-space: normal;
}

.icon-button,
.tab-button,
.text-button,
.primary-button,
.chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.92);
  color: var(--ink);
  transition: border-color 140ms ease, background-color 140ms ease, color 140ms ease, transform 140ms ease;
}

.icon-button {
  width: 38px;
  height: 38px;
}

.icon-button:hover,
.tab-button:hover,
.text-button:hover,
.chip:hover,
.primary-button:hover {
  border-color: var(--ink);
  transform: translateY(-1px);
}

.tab-button:hover {
  transform: none;
}

i,
svg.lucide {
  width: 16px;
  height: 16px;
  stroke-width: 1.8;
  flex-shrink: 0;
}

.workspace-tabs {
  display: flex;
  gap: 7px;
  align-items: center;
  min-height: 50px;
  margin: 10px -3px 10px;
  padding: 4px 3px 7px;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-padding: 6px;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}

.tab-button {
  flex: 0 0 auto;
  min-height: 39px;
  padding: 0 13px;
  color: var(--muted);
  outline: none;
  white-space: nowrap;
}

.tab-button:focus-visible {
  box-shadow: inset 0 0 0 2px rgba(54, 95, 131, 0.36);
}

.tab-button.active {
  border-color: var(--ink);
  background: var(--ink);
  color: #fffdf9;
  box-shadow: 0 6px 14px rgba(25, 23, 22, 0.08);
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

#atlasPanel {
  grid-template-columns: 282px minmax(0, 1fr) 356px;
  gap: 14px;
  align-items: stretch;
}

#atlasPanel.active {
  display: grid;
}

.filter-rail,
.atlas-stage,
.inspector,
.wide-panel,
.scenario-controls,
.scenario-output {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.96);
  box-shadow: var(--shadow-soft);
}

.filter-rail,
.inspector {
  min-height: 690px;
  padding: 17px;
}

.rail-header {
  margin-bottom: 18px;
}

.field,
.slider-field {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}

.field span,
.slider-field span,
.toggle-row span,
.detail-grid span,
.compact-metric span,
.index-tile span,
.uncertainty-band span,
.scenario-summary span,
.policy-matrix span,
.version-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

select,
input[type="search"] {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fffdf8;
  color: var(--ink);
  outline: none;
}

select {
  padding: 0 34px 0 12px;
}

input[type="search"] {
  padding: 0 12px 0 36px;
}

select:focus,
input[type="search"]:focus {
  border-color: var(--ink);
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  margin: 4px 0 16px;
}

input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--ink);
}

.metric-stack {
  display: grid;
  gap: 8px;
  margin: 18px 0;
}

.compact-metric {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  min-height: 48px;
  padding: 11px 0;
  border-top: 1px solid var(--line);
}

.compact-metric strong {
  font-family: var(--mono);
  font-size: 17px;
}

.metric-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.metric-info-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 19px;
  height: 19px;
  min-width: 19px;
  padding: 0;
  border: 1px solid rgba(118, 112, 104, 0.42);
  border-radius: 999px;
  background: rgba(255, 253, 248, 0.72);
  color: var(--muted);
  transform: none;
  transition: border-color 140ms ease, background-color 140ms ease, color 140ms ease;
}

.metric-info-button svg {
  width: 11px;
  height: 11px;
  stroke-width: 2;
}

.metric-info-button:hover,
.metric-info-button:focus-visible {
  border-color: var(--ink);
  background: var(--paper-strong);
  color: var(--ink);
  outline: none;
}

.evidence-note {
  display: flex;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbf8f1;
}

.evidence-note p {
  margin: 0;
  color: var(--graphite);
  font-size: 13px;
  line-height: 1.45;
}

.atlas-stage {
  min-width: 0;
  padding: 17px;
}

.stage-header,
.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  justify-content: flex-end;
  color: var(--graphite);
  font-size: 12px;
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
}

.legend-dot.productivity {
  background: var(--teal);
}

.legend-dot.retrain {
  background: var(--burgundy);
}

.legend-dot.mixed {
  background: var(--amber);
}

.legend-dot.low {
  background: var(--slate);
}

.chart-wrap {
  position: relative;
  min-height: 574px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(129, 38, 55, 0.052) 0 50%, rgba(23, 109, 104, 0.052) 50% 100%),
    var(--paper-strong);
  overflow: hidden;
}

#atlasChart,
#scenarioChart {
  display: block;
  width: 100%;
  height: 100%;
}

#atlasChart {
  min-height: 574px;
}

.chart-callout {
  position: absolute;
  z-index: 2;
  max-width: 250px;
  padding: 10px;
  border: 1px solid var(--ink);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.98);
  box-shadow: 0 10px 24px rgba(23, 23, 23, 0.1);
  color: var(--graphite);
  font-size: 12px;
  pointer-events: none;
}

.chart-callout strong {
  display: block;
  margin-bottom: 4px;
  color: var(--ink);
  font-size: 13px;
}

.method-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.inspector-header {
  min-height: 94px;
}

.muted {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.index-duo {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 12px 0;
}

.index-tile {
  min-height: 92px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.index-tile strong {
  display: block;
  margin-top: 12px;
  font-family: var(--mono);
  font-size: 31px;
  line-height: 1;
}

.index-tile.substitution {
  background: var(--burgundy-soft);
}

.index-tile.augmentation {
  background: var(--teal-soft);
}

.detail-grid,
.scenario-summary,
.policy-matrix,
.version-grid {
  display: grid;
  gap: 8px;
}

.detail-grid {
  grid-template-columns: 1fr 1fr;
  margin-bottom: 16px;
}

.detail-grid div,
.scenario-summary article,
.policy-matrix div,
.version-card {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf8;
}

.detail-grid strong,
.scenario-summary strong,
.policy-matrix strong {
  display: block;
  margin-top: 8px;
  font-family: var(--mono);
  font-size: 17px;
}

.contribution-block {
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

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

.text-button {
  min-height: 32px;
  padding: 0 9px;
  color: var(--graphite);
  font-size: 12px;
}

.action-list {
  display: grid;
  gap: 8px;
  max-height: 264px;
  overflow: auto;
  padding-right: 4px;
}

.action-item {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf8;
}

.action-item p {
  margin: 0;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.35;
}

.action-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
}

.action-bar {
  display: grid;
  grid-template-columns: 1fr 1fr;
  height: 6px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--line);
}

.action-bar span:first-child {
  background: var(--burgundy);
}

.action-bar span:last-child {
  background: var(--teal);
}

.uncertainty-band {
  display: grid;
  gap: 8px;
  margin-top: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbf8f1;
}

.uncertainty-band strong {
  display: block;
  margin-top: 6px;
  font-family: var(--mono);
}

.band-track {
  height: 8px;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
}

.band-track span {
  display: block;
  height: 100%;
  width: 40%;
  background: var(--amber);
}

.wide-panel {
  padding: 18px;
}

.search-box {
  position: relative;
  width: min(480px, 100%);
}

.search-box i,
.search-box svg {
  position: absolute;
  top: 12px;
  left: 12px;
  color: var(--muted);
}

.quality-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.chip {
  min-height: 34px;
  padding: 0 12px;
  color: var(--muted);
  font-size: 13px;
}

.chip.active {
  border-color: var(--ink);
  color: var(--ink);
  background: #fbf8f1;
}

.table-wrap {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: auto;
  background: var(--paper-strong);
}

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

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

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #fbf8f1;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
}

td {
  color: var(--graphite);
  font-size: 13px;
  line-height: 1.4;
}

td strong {
  color: var(--ink);
}

.score-badge {
  display: inline-flex;
  min-width: 52px;
  justify-content: center;
  padding: 4px 7px;
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 12px;
}

.score-badge.substitution {
  background: var(--burgundy-soft);
  color: var(--burgundy);
}

.score-badge.augmentation {
  background: var(--teal-soft);
  color: var(--teal);
}

.score-badge.reliability {
  background: var(--blue-soft);
  color: var(--blue);
}

.research-lab,
.validation-lab {
  display: grid;
  gap: 14px;
}

.status-ledger {
  display: grid;
  gap: 5px;
  min-width: 230px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbf8f1;
}

.status-ledger span,
.research-question-grid span,
.equation-grid span,
.validation-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.status-ledger strong {
  color: var(--ink);
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.35;
}

.status-ledger.warning {
  border-color: rgba(166, 106, 26, 0.35);
  background: var(--amber-soft);
}

.research-question-grid,
.equation-grid,
.validation-grid {
  display: grid;
  gap: 10px;
}

.research-question-grid {
  grid-template-columns: 1.35fr 1fr 1fr;
}

.research-question-grid article,
.equation-grid article,
.validation-card,
.method-card,
.validation-note {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf8;
}

.research-question-grid article,
.equation-grid article,
.validation-card {
  padding: 13px;
}

.research-question-grid p,
.equation-grid p,
.validation-card p,
.method-card p,
.validation-roadmap p,
.validation-note p {
  margin: 8px 0 0;
  color: var(--graphite);
  font-size: 13px;
  line-height: 1.48;
}

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

.pipeline-step {
  min-height: 178px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(54, 95, 131, 0.035), transparent 46%),
    #fffdf8;
}

.step-index,
.validation-roadmap span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  margin-bottom: 14px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
}

.pipeline-step h3,
.validation-roadmap h3 {
  margin: 0;
}

.pipeline-step p {
  margin: 9px 0 0;
  color: var(--graphite);
  font-size: 13px;
  line-height: 1.45;
}

.pipeline-step strong,
.validation-card strong {
  color: var(--ink);
  font-family: var(--mono);
}

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

.equation-grid h3 {
  margin-top: 8px;
  font-family: var(--mono);
  font-size: 19px;
}

.method-card {
  display: grid;
  grid-template-columns: 0.85fr 1.15fr;
  gap: 14px;
  align-items: start;
  padding: 15px;
  background:
    linear-gradient(90deg, rgba(23, 109, 104, 0.06), rgba(255, 253, 248, 0) 48%),
    #fffdf8;
}

.method-card h3 {
  font-size: 16px;
}

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

.validation-card strong {
  display: block;
  margin-top: 8px;
  font-size: 17px;
}

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

.validation-roadmap article {
  min-height: 192px;
  padding: 14px;
  border-right: 1px solid var(--line);
}

.validation-roadmap article:last-child {
  border-right: 0;
}

.validation-note {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 13px;
  background: var(--burgundy-soft);
}

.validation-note p {
  margin: 0;
}

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

.scenario-controls,
.scenario-output {
  padding: 18px;
}

.slider-field {
  grid-template-columns: 1fr auto;
  align-items: center;
}

.slider-field input {
  grid-column: 1 / -1;
  width: 100%;
  accent-color: var(--ink);
}

.slider-field strong {
  font-family: var(--mono);
}

.scenario-summary {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 12px;
}

.scenario-chart {
  height: 390px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper-strong);
  overflow: hidden;
}

.policy-matrix {
  grid-template-columns: 1fr 1fr;
  margin-top: 12px;
}

.primary-button {
  min-height: 40px;
  padding: 0 13px;
  background: var(--ink);
  color: #fffdf9;
}

.version-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 14px;
}

.version-card.current {
  border-color: var(--ink);
}

.version-card h3 {
  margin-top: 8px;
  font-family: var(--mono);
  font-size: 15px;
}

.version-card p {
  margin: 9px 0 0;
  color: var(--graphite);
  font-size: 13px;
  line-height: 1.45;
}

.change-log {
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.change-log ul {
  display: grid;
  gap: 8px;
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
}

.change-log li {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  color: var(--graphite);
  font-size: 13px;
}

.change-log time {
  font-family: var(--mono);
  color: var(--muted);
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 10;
  max-width: 360px;
  padding: 12px 14px;
  border: 1px solid var(--ink);
  border-radius: 8px;
  background: var(--paper-strong);
  box-shadow: var(--shadow);
  color: var(--graphite);
  font-size: 13px;
}

.passport-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(25, 23, 22, 0.24);
  backdrop-filter: blur(7px);
}

.passport-backdrop[hidden] {
  display: none;
}

.passport-modal {
  position: relative;
  width: min(760px, 100%);
  max-height: min(760px, calc(100vh - 36px));
  overflow: auto;
  padding: 22px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--paper-strong);
  box-shadow: 0 26px 74px rgba(25, 23, 22, 0.18);
}

.passport-close {
  position: absolute;
  top: 14px;
  right: 14px;
}

.passport-modal h2 {
  max-width: calc(100% - 48px);
  margin-bottom: 8px;
  overflow-wrap: anywhere;
}

.passport-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 16px;
}

.passport-grid div {
  min-height: 128px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf8;
}

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

.passport-grid p {
  margin: 7px 0 0;
  color: var(--graphite);
  font-size: 13px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.axis-label {
  fill: var(--muted);
  font-family: var(--mono);
  font-size: 10.5px;
}

.axis-title {
  fill: var(--ink);
  font-family: var(--sans);
  font-size: 12.5px;
  font-weight: 700;
}

.quadrant-label {
  fill: rgba(25, 23, 22, 0.42);
  font-family: var(--mono);
  font-size: 11px;
}

.chart-point {
  stroke: #fffdf8;
  stroke-width: 2;
  transition: opacity 160ms ease, r 160ms ease, stroke 160ms ease;
}

.chart-point:hover,
.chart-point.active {
  stroke: var(--ink);
  stroke-width: 3;
}

@media (max-width: 1240px) {
  #atlasPanel.active {
    grid-template-columns: 260px minmax(0, 1fr);
  }

  .inspector {
    grid-column: 1 / -1;
    min-height: auto;
  }
}

@media (max-width: 900px) {
  .app-shell {
    padding: 10px;
  }

  .topbar,
  .stage-header,
  .panel-heading {
    flex-direction: column;
    align-items: stretch;
  }

  .topbar-actions {
    justify-content: space-between;
  }

  #atlasPanel.active,
  .scenario-layout {
    grid-template-columns: 1fr;
  }

  .atlas-stage {
    order: 1;
  }

  .filter-rail {
    order: 2;
  }

  .inspector {
    order: 3;
  }

  .filter-rail,
  .inspector {
    min-height: auto;
  }

  .chart-wrap,
  #atlasChart {
    min-height: 460px;
  }

  .legend {
    justify-content: flex-start;
  }

  .scenario-summary,
  .policy-matrix,
  .version-grid,
  .research-question-grid,
  .equation-grid,
  .method-card,
  .validation-grid {
    grid-template-columns: 1fr;
  }

  .method-pipeline,
  .validation-roadmap {
    grid-template-columns: 1fr 1fr;
  }

  .validation-roadmap article:nth-child(2) {
    border-right: 0;
  }

  .validation-roadmap article:nth-child(-n + 2) {
    border-bottom: 1px solid var(--line);
  }
}

@media (max-width: 560px) {
  body {
    background-size: 24px 24px;
  }

  .app-shell {
    width: 100%;
    max-width: 100vw;
    padding: 8px;
    overflow: hidden;
  }

  .topbar {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    gap: 12px;
    min-height: auto;
    padding: 12px;
  }

  main,
  .tab-panel,
  #atlasPanel,
  .filter-rail,
  .atlas-stage,
  .inspector,
  .wide-panel,
  .research-lab,
  .validation-lab,
  .scenario-controls,
  .scenario-output {
    min-width: 0;
    max-width: 100%;
  }

  .brand {
    align-items: flex-start;
    gap: 10px;
    width: 100%;
  }

  .brand-mark {
    width: 38px;
    height: 38px;
  }

  .brand-mark svg {
    width: 38px;
    height: 38px;
  }

  .eyebrow,
  .section-kicker {
    font-size: 9.5px;
  }

  .brand .eyebrow {
    white-space: normal;
    overflow-wrap: anywhere;
  }

  h1 {
    font-size: 18px;
  }

  h2 {
    font-size: 18px;
  }

  .topbar-actions {
    position: relative;
    display: block;
    width: 100%;
    min-height: 40px;
    padding-right: 48px;
  }

  .dataset-pill {
    min-width: 0;
    width: 100%;
    min-height: 40px;
    white-space: normal;
    font-size: 11px;
    overflow-wrap: anywhere;
  }

  .icon-button {
    width: 40px;
    height: 40px;
  }

  .topbar-actions .icon-button {
    position: absolute;
    top: 0;
    right: 0;
  }

  .workspace-tabs {
    gap: 6px;
    min-height: 48px;
    margin: 8px -8px 8px;
    padding: 3px 8px 7px;
    max-width: calc(100% + 16px);
    contain: inline-size;
  }

  .tab-button {
    min-height: 40px;
    padding: 0 12px;
    font-size: 14px;
  }

  .filter-rail,
  .atlas-stage,
  .inspector,
  .wide-panel,
  .scenario-controls,
  .scenario-output {
    padding: 13px;
    border-radius: 8px;
  }

  select,
  input[type="search"] {
    min-height: 44px;
    font-size: 16px;
  }

  .toggle-row {
    align-items: flex-start;
    min-height: 44px;
  }

  .compact-metric {
    min-height: 46px;
  }

  .stage-header,
  .panel-heading {
    gap: 10px;
  }

  .legend {
    gap: 7px 12px;
    font-size: 11.5px;
  }

  .chart-wrap {
    max-width: 100%;
    min-height: 430px;
    contain: inline-size;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
  }

  #atlasChart {
    width: 620px;
    min-width: 620px;
    min-height: 430px;
  }

  .chart-callout {
    display: none;
  }

  .method-strip {
    display: grid;
    grid-template-columns: 1fr;
  }

  .method-strip span {
    min-height: 34px;
    padding: 8px 10px;
    font-size: 11px;
  }

  .index-duo,
  .detail-grid {
    grid-template-columns: 1fr;
  }

  .index-tile {
    min-height: 84px;
  }

  .index-tile strong {
    font-size: 29px;
  }

  .action-list {
    max-height: none;
    overflow: visible;
    padding-right: 0;
  }

  .block-title {
    align-items: flex-start;
  }

  .text-button,
  .primary-button,
  .chip {
    min-height: 40px;
  }

  .quality-row {
    flex-wrap: nowrap;
    margin: 0 -13px 12px;
    padding: 0 13px 2px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .chip {
    flex: 0 0 auto;
  }

  .table-wrap {
    max-width: calc(100% + 26px);
    margin: 0 -13px;
    border-right: 0;
    border-left: 0;
    border-radius: 0;
    contain: inline-size;
    -webkit-overflow-scrolling: touch;
  }

  table {
    min-width: 760px;
  }

  th,
  td {
    padding: 10px;
  }

  .scenario-chart {
    max-width: 100%;
    height: 330px;
    contain: inline-size;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
  }

  #scenarioChart {
    width: 650px;
    min-width: 650px;
    height: 330px;
  }

  .slider-field {
    grid-template-columns: 1fr;
  }

  .slider-field strong {
    justify-self: start;
  }

  .change-log li {
    grid-template-columns: 1fr;
  }

  .status-ledger {
    min-width: 0;
  }

  .research-question-grid,
  .equation-grid,
  .method-pipeline,
  .method-card,
  .validation-grid,
  .validation-roadmap {
    grid-template-columns: 1fr;
  }

  .pipeline-step,
  .validation-roadmap article {
    min-height: auto;
  }

  .validation-roadmap article,
  .validation-roadmap article:nth-child(2) {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .validation-roadmap article:last-child {
    border-bottom: 0;
  }

  .passport-backdrop {
    align-items: end;
    padding: 0;
  }

  .passport-modal {
    width: 100%;
    max-height: 88vh;
    padding: 18px 14px calc(18px + env(safe-area-inset-bottom));
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 8px 8px 0 0;
  }

  .passport-close {
    top: 10px;
    right: 10px;
  }

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

  .toast {
    right: 8px;
    bottom: 8px;
    left: 8px;
    max-width: none;
  }
}

.standards-block {
  margin-top: 18px;
}
.standards-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.standard-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding: 4px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  font-size: 11.5px;
  line-height: 1.3;
  color: var(--graphite);
}
.standard-tag b {
  font-weight: 600;
  color: var(--teal);
  font-variant-numeric: tabular-nums;
}
.standards-note {
  margin-top: 10px;
  font-size: 11px;
  line-height: 1.45;
}
.metric-caption {
  margin-top: 4px;
  margin-bottom: 0;
  font-size: 11px;
  line-height: 1.35;
  font-weight: 400;
  color: var(--muted);
}
.chart-howto {
  margin: 0 0 12px;
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--graphite);
  max-width: 780px;
}
