:root {
  --bg: #f5f1ea;
  --panel: #fffdf9;
  --ink: #1d1b1a;
  --muted: #5f5a53;
  --line: #dfd7ca;
  --accent: #2b4c7e;
  --accent-soft: #e7eef7;
  --blue-dark: #1a3050;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Inter, system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  padding: 32px 20px 80px;
}

.site-nav-band {
  max-width: 1280px;
  margin: 0 auto 18px;
}

.app-shell {
  max-width: 860px;
  margin: 0 auto;
  padding: 0 18px 64px;
}

.site-footer {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 20px;
  text-align: center;
  font-size: 13px;
  line-height: 1.6;
  color: var(--muted);
}

.site-footer a {
  color: var(--blue-dark);
}

.header-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  width: 100%;
}

.header-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: var(--blue-dark);
  background: rgba(43,76,126,0.08);
  border: 1px solid rgba(43,76,126,0.16);
  border-radius: 999px;
  padding: 8px 12px;
  text-decoration: none;
}

.header-link:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.header-link.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.header-link:focus-visible {
  outline: 2px solid rgba(43,76,126,0.45);
  outline-offset: 2px;
}

.app-header {
  margin-bottom: 24px;
}

.eyebrow {
  font: 700 11px/1.4 "JetBrains Mono", monospace;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 10px;
}

h1 {
  margin: 0 0 10px;
  font-size: 2rem;
  line-height: 1.1;
}

.lead {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 24px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.04);
}

.phase-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.phase-chip {
  appearance: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  min-height: 34px;
  padding: 0 12px;
  background: white;
  color: var(--muted);
  font: 700 11px/1.2 "JetBrains Mono", monospace;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
}

.phase-chip.current {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.phase-chip.available {
  color: var(--ink);
}

.phase-chip.current.available,
.phase-chip.current:visited,
.phase-chip.current:hover,
.phase-chip.current:active,
.phase-chip.current:focus {
  color: #fff;
}

.phase-chip:disabled {
  opacity: 0.55;
  cursor: default;
}

.step-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  color: var(--muted);
  font-size: 0.95rem;
}

.step-title {
  margin: 0 0 10px;
  font-size: 1.6rem;
  line-height: 1.2;
}

.step-copy {
  margin: 0 0 18px;
  color: var(--muted);
  line-height: 1.65;
}

.field {
  display: grid;
  gap: 8px;
  margin-bottom: 18px;
}

.field label {
  font-weight: 700;
}

.field input {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: white;
  font-size: 1rem;
}

.inline-input {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: auto;
  max-width: 100%;
}

.stepper-btn {
  appearance: none;
  border: 1px solid var(--line);
  border-radius: 12px;
  min-width: 42px;
  min-height: 48px;
  background: white;
  color: var(--ink);
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
}

.input-with-unit {
  position: relative;
  flex: 0 0 88px;
}

.input-with-unit input {
  padding-right: 40px;
  text-align: center;
}

.input-unit {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-weight: 700;
  pointer-events: none;
}

.help {
  font-size: 0.95rem;
  color: var(--muted);
  line-height: 1.6;
}

.default-note {
  margin-top: 6px;
  font-size: 0.92rem;
  color: var(--muted);
}

.options {
  display: grid;
  gap: 12px;
}

.option {
  position: relative;
  display: block;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: white;
  padding: 14px 16px;
  cursor: pointer;
  transition: border-color 120ms ease, background 120ms ease, box-shadow 120ms ease;
}

.option input[type="radio"] {
  position: absolute;
  opacity: 0;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: pointer;
}

.option:hover {
  border-color: #b9c7da;
  box-shadow: 0 6px 16px rgba(43, 76, 126, 0.08);
}

.option:has(input[type="radio"]:checked) {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 8px 18px rgba(43, 76, 126, 0.12);
}

.option strong {
  display: block;
  margin-bottom: 4px;
}

.nav {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 24px;
}

.result-edit-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 10px 0 18px;
}

.result-edit-link {
  appearance: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  min-height: 36px;
  padding: 0 12px;
  background: white;
  color: var(--ink);
  font-weight: 700;
  cursor: pointer;
}

.btn {
  appearance: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  min-height: 44px;
  padding: 0 16px;
  background: white;
  color: var(--ink);
  font-weight: 700;
  cursor: pointer;
}

.btn-primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff !important;
}

.btn-primary:visited,
.btn-primary:hover,
.btn-primary:active,
.btn-primary:focus {
  color: #fff !important;
}

.progress {
  height: 8px;
  border-radius: 999px;
  background: #e9e2d6;
  overflow: hidden;
  margin-bottom: 18px;
}

.progress-bar {
  height: 100%;
  background: var(--accent);
}

.results-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 18px 0;
}

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

.metric-risk {
  position: relative;
}

.risk-band-low {
  border-color: rgba(66, 99, 71, 0.2);
  background: #f6fbf7;
}

.risk-band-medium {
  border-color: rgba(43, 76, 126, 0.18);
  background: #f6f9fd;
}

.risk-band-high {
  border-color: rgba(203, 137, 34, 0.22);
  background: #fffaf1;
}

.risk-band-severe {
  border-color: rgba(160, 74, 58, 0.22);
  background: #fff6f4;
}

.metric-label {
  display: block;
  font: 700 11px/1.4 "JetBrains Mono", monospace;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}

.metric-value {
  font-size: 1.5rem;
  font-weight: 700;
}

.metric-band {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  margin-top: 8px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(29, 27, 26, 0.06);
  color: var(--ink);
  font: 700 11px/1.2 "JetBrains Mono", monospace;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.metric-subtext {
  margin-top: 8px;
  font-size: 0.92rem;
  color: var(--muted);
  line-height: 1.45;
}

.results-section {
  margin-top: 18px;
}

.results-section-title {
  margin: 0 0 10px;
  font-size: 1.1rem;
}

.chart-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  background: white;
}

.chart-card svg {
  display: block;
  width: 100%;
  height: auto;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  margin-top: 12px;
}

.chart-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.92rem;
  color: var(--muted);
  line-height: 1.4;
}

.chart-legend-line {
  width: 22px;
  height: 0;
  border-top: 4px solid var(--accent);
  border-radius: 999px;
}

.chart-legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  display: inline-block;
}

.chart-legend-dot-required {
  background: #cb8922;
}

.chart-legend-dot-proposed {
  background: #426347;
}

.chart-note {
  margin-top: 10px;
  font-size: 0.95rem;
  color: var(--muted);
  line-height: 1.6;
}

.chart-note strong {
  color: var(--ink);
}

.chart-help {
  margin-top: 12px;
  font-size: 0.95rem;
  color: var(--muted);
  line-height: 1.6;
}

.chart-help strong {
  color: var(--ink);
}

.recommendation-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  background: white;
}

.recommendation-card-go {
  border-color: rgba(66, 99, 71, 0.22);
  background: #f6fbf7;
}

.recommendation-card-caution {
  border-color: rgba(203, 137, 34, 0.24);
  background: #fffaf1;
}

.recommendation-card-stop {
  border-color: rgba(160, 74, 58, 0.24);
  background: #fff6f4;
}

.recommendation-card-neutral {
  background: white;
}

.recommendation-kicker {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(43, 76, 126, 0.08);
  color: var(--accent);
  font: 700 11px/1.2 "JetBrains Mono", monospace;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 10px;
}

.recommendation-title {
  margin: 0 0 8px;
  font-size: 1.25rem;
}

.recommendation-copy {
  margin-bottom: 0;
}

.recommendation-callout {
  margin-top: 14px;
  border: 1px solid rgba(29, 27, 26, 0.08);
  border-radius: 14px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.7);
}

.recommendation-callout-title {
  margin: 0 0 8px;
  font: 700 11px/1.4 "JetBrains Mono", monospace;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.recommendation-callout-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 12px;
}

.recommendation-callout-item {
  display: grid;
  gap: 4px;
}

.recommendation-callout-label {
  font-size: 0.92rem;
  color: var(--muted);
}

.recommendation-callout-item strong {
  font-size: 1rem;
}

.recommendation-list {
  margin: 10px 0 0 18px;
  color: var(--muted);
  line-height: 1.6;
}

.tweak-panel {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  background: white;
}

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

.tweak-field {
  display: grid;
  gap: 6px;
}

.tweak-field label {
  font-size: 0.95rem;
  font-weight: 700;
}

.tweak-field input {
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: white;
  font-size: 1rem;
}

.tweak-field .inline-input {
  gap: 6px;
}

.tweak-field .stepper-btn {
  min-width: 38px;
  min-height: 44px;
  border-radius: 10px;
}

.tweak-help {
  margin-top: 10px;
  font-size: 0.92rem;
  color: var(--muted);
}

@media (max-width: 640px) {
  .results-grid {
    grid-template-columns: 1fr;
  }
  .recommendation-callout-grid {
    grid-template-columns: 1fr;
  }
  .tweak-grid {
    grid-template-columns: 1fr;
  }
}

.tweak-actions {
  margin-top: 14px;
  display: flex;
  justify-content: flex-end;
}

.btn-clear {
  color: #8a3f32;
  border-color: rgba(160, 74, 58, 0.22);
  background: #fff6f4;
}

.btn-clear:hover,
.btn-clear:focus {
  border-color: rgba(160, 74, 58, 0.34);
  background: #fff0ec;
}
