:root {
  --bg: #f5f2ea;
  --panel: rgba(255, 255, 255, 0.94);
  --panel-strong: #ffffff;
  --line: #ddd4c6;
  --line-strong: #cabda7;
  --text: #1f2d28;
  --muted: #637069;
  --accent: #1f6a55;
  --accent-strong: #114b3a;
  --accent-soft: #e4f1ec;
  --sand: #f2eadb;
  --warn-bg: #fff1dd;
  --warn-line: #efc77f;
  --warn-text: #7b5008;
  --shadow: 0 20px 40px rgba(31, 45, 40, 0.08);
  --radius-lg: 28px;
  --radius-md: 18px;
  --radius-sm: 12px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "IBM Plex Sans", system-ui, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(17, 75, 58, 0.08), transparent 28%),
    radial-gradient(circle at top right, rgba(201, 174, 132, 0.14), transparent 26%),
    linear-gradient(180deg, #f9f5ef 0%, var(--bg) 55%, #f3efe6 100%);
}

a {
  color: var(--accent-strong);
}

.page-shell {
  max-width: 1320px;
  margin: 0 auto;
  padding: 28px 18px 44px;
}

/* ── Hero ─────────────────────────────────────────────── */

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 18px;
  padding: 26px;
  border: 1px solid rgba(17, 75, 58, 0.12);
  border-radius: 30px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.96), rgba(248, 245, 238, 0.96));
  box-shadow: var(--shadow);
}

.eyebrow,
.panel-kicker,
.page-kicker,
.result-label,
.meta-label {
  margin: 0;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}

.hero h1,
.panel-head h2,
.wizard-page h2,
.result-rec-card h3 {
  margin: 8px 0 0;
  font-family: "Fraunces", Georgia, serif;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.hero h1 {
  font-size: clamp(2rem, 5vw, 3.5rem);
  line-height: 0.98;
}

.hero-text {
  max-width: 670px;
  margin: 16px 0 0;
  line-height: 1.65;
  color: var(--muted);
}

.hero-link-row {
  margin: 16px 0 0;
}

.hero-link-row a {
  font-weight: 600;
}

.hero-meta {
  display: grid;
  gap: 12px;
}

.meta-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--panel);
  box-shadow: 0 10px 26px rgba(31, 45, 40, 0.04);
  padding: 14px 16px;
}

.meta-value {
  margin: 6px 0 0;
  font-weight: 600;
  line-height: 1.45;
}

/* ── Three-pane advisor layout ───────────────────────── */

.advisor-shell {
  margin-top: 20px;
  display: grid;
  grid-template-columns: minmax(340px, 1fr) 320px 280px;
  gap: 18px;
  align-items: start;
}

.advisor-pane {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--panel);
  box-shadow: 0 10px 26px rgba(31, 45, 40, 0.04);
  min-width: 0;
  overflow: hidden;
}

.pane-questions {
  padding: 22px;
}

.pane-recommendation {
  position: sticky;
  top: 20px;
  padding: 0;
  min-width: 0;
}

.pane-rationale {
  position: sticky;
  top: 20px;
  padding: 18px;
  display: grid;
  gap: 18px;
  min-width: 0;
}

/* ── Panel head ──────────────────────────────────────── */

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  min-width: 0;
}

.panel-head > * {
  min-width: 0;
}

.panel-head h2 {
  font-size: 1.6rem;
}

/* ── Buttons ─────────────────────────────────────────── */

.ghost-button,
.primary-button {
  appearance: none;
  border-radius: 999px;
  padding: 10px 16px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: transform 140ms ease, border-color 140ms ease, opacity 140ms ease, background 140ms ease;
}

.ghost-button {
  border: 1px solid rgba(17, 75, 58, 0.2);
  background: rgba(255, 255, 255, 0.85);
  color: var(--accent-strong);
}

.primary-button {
  border: 1px solid rgba(17, 75, 58, 0.08);
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #ffffff;
  box-shadow: 0 10px 20px rgba(17, 75, 58, 0.14);
}

.ghost-button:hover,
.primary-button:hover {
  transform: translateY(-1px);
}

.ghost-button:disabled,
.primary-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

/* ── Progress steps (horizontal) ─────────────────────── */

.progress-root {
  margin-top: 18px;
}

.progress-steps {
  display: flex;
  align-items: center;
  gap: 0;
  flex-wrap: wrap;
}

.progress-step {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fbfaf7;
  cursor: pointer;
  font: inherit;
  font-size: 0.92rem;
  transition: background 140ms ease, border-color 140ms ease;
}

.progress-step:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.progress-step.is-current {
  border-color: rgba(17, 75, 58, 0.42);
  background: linear-gradient(145deg, rgba(228, 241, 236, 0.98), #ffffff);
}

.progress-step.is-complete {
  border-color: rgba(17, 75, 58, 0.18);
}

.progress-step.is-complete .progress-index {
  background: var(--accent);
  color: #fff;
}

.progress-index {
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: rgba(17, 75, 58, 0.1);
  color: var(--accent-strong);
  font-size: 0.78rem;
  font-weight: 700;
  flex-shrink: 0;
}

.progress-label {
  font-weight: 600;
  white-space: nowrap;
}

.progress-connector {
  width: 18px;
  height: 2px;
  background: var(--line);
  flex-shrink: 0;
}

/* ── Page root ───────────────────────────────────────── */

.page-root {
  margin-top: 18px;
}

.wizard-page {
  display: grid;
  gap: 18px;
}

.page-header {
  display: grid;
  gap: 8px;
}

.page-header-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.page-header h2 {
  font-size: clamp(1.5rem, 4vw, 2rem);
  margin: 0;
}

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

/* ── Option cards (radio + multi-select) ─────────────── */

.option-grid {
  display: grid;
  gap: 12px;
  margin-top: 8px;
}

.option-grid.is-route-grid {
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.option-grid.is-priority-grid {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.option-card {
  position: relative;
}

.option-card input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.option-card label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 100%;
  padding: 16px;
  border: 1px solid #e4ddd1;
  border-radius: 18px;
  background: #fcfbf8;
  cursor: pointer;
  transition: transform 140ms ease, border-color 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

.option-card.is-route-card label {
  min-height: 120px;
}

.option-card.is-priority-card label {
  min-height: 90px;
}

.option-card label:hover {
  transform: translateY(-1px);
  border-color: rgba(17, 75, 58, 0.28);
}

.option-card input:checked + label {
  background: linear-gradient(145deg, rgba(228, 241, 236, 0.98), #ffffff);
  border-color: rgba(17, 75, 58, 0.48);
  box-shadow: 0 12px 20px rgba(17, 75, 58, 0.08);
}

.option-label {
  font-size: 1rem;
  font-weight: 700;
}

.option-help,
.result-text,
.muted {
  color: var(--muted);
  line-height: 1.6;
}

/* ── Constraint toggles ─────────────────────────────── */

.constraints-section {
  margin-top: 14px;
}

.section-head-label {
  margin: 0 0 10px;
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
}

.constraint-stack {
  display: grid;
  gap: 12px;
}

.constraint-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel-strong);
}

.constraint-card h4 {
  margin: 0 0 8px;
  font-size: 0.95rem;
}

.constraint-toggle {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px;
}

.constraint-toggle input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.toggle-pill {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 10px 12px;
  border: 1px solid #e4ddd1;
  border-radius: 12px;
  background: #fcfbf8;
  cursor: pointer;
  font-size: 0.92rem;
  transition: border-color 140ms ease, background 140ms ease;
}

.toggle-pill:hover {
  border-color: rgba(17, 75, 58, 0.28);
}

.constraint-toggle input:checked + .toggle-pill,
.toggle-pill.is-selected {
  border-color: rgba(17, 75, 58, 0.48);
  background: linear-gradient(145deg, rgba(228, 241, 236, 0.98), #ffffff);
}

.toggle-pill small {
  color: var(--muted);
  line-height: 1.4;
  font-size: 0.8rem;
}

/* ── Wizard controls ─────────────────────────────────── */

.wizard-controls {
  margin-top: 20px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

/* ── Recommendation card ─────────────────────────────── */

.rec-card {
  padding: 20px;
  overflow: hidden;
}

.rec-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 16px;
  min-width: 0;
}

.rec-header > * {
  min-width: 0;
}

.rec-slot {
  padding: 10px 0;
  border-top: 1px solid var(--line);
  min-width: 0;
  overflow: hidden;
}

.rec-slot-label {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}

.rec-slot-value {
  margin: 4px 0 0;
  font-size: 1.05rem;
  font-weight: 700;
  font-family: "Fraunces", Georgia, serif;
  letter-spacing: -0.02em;
  transition: opacity 180ms ease, transform 180ms ease;
  overflow-wrap: break-word;
  word-break: break-word;
}

.rec-slot-meta {
  margin: 2px 0 0;
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.45;
  overflow-wrap: break-word;
}

.rec-slot-updating {
  animation: slot-fade 220ms ease;
}

@keyframes slot-fade {
  0% {
    opacity: 0.3;
    transform: translateY(4px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

.rec-slot-rationale {
  border-top: 1px solid var(--line);
  min-width: 0;
  overflow: hidden;
}

.rec-rationale-list {
  margin: 6px 0 0;
  padding-left: 16px;
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.55;
  overflow-wrap: break-word;
}

.rec-rationale-list li + li {
  margin-top: 4px;
}

.rec-warnings {
  margin-top: 10px;
}

/* ── Confidence badge ────────────────────────────────── */

.confidence-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 14px;
  font-size: 0.72rem;
  font-weight: 700;
  white-space: normal;
  text-align: left;
  flex-shrink: 1;
  max-width: 100%;
}

.confidence-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.confidence-badge[data-level="high"] {
  background: rgba(34, 139, 94, 0.12);
  color: #1a6b47;
}

.confidence-badge[data-level="high"] .confidence-dot {
  background: #22b15c;
}

.confidence-badge[data-level="medium"] {
  background: rgba(218, 165, 32, 0.12);
  color: #8b6914;
}

.confidence-badge[data-level="medium"] .confidence-dot {
  background: #daa520;
}

.confidence-badge[data-level="low"] {
  background: rgba(180, 83, 9, 0.1);
  color: #92400e;
}

.confidence-badge[data-level="low"] .confidence-dot {
  background: #b45309;
}

.confidence-badge.is-inline {
  font-size: 0.78rem;
}

/* ── Rationale pane ──────────────────────────────────── */

.rationale-section {
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
  overflow: hidden;
  min-width: 0;
}

.rationale-section:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.rationale-section .panel-kicker {
  margin-bottom: 8px;
}

.alt-card {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: rgba(17, 75, 58, 0.04);
  overflow-wrap: break-word;
  min-width: 0;
  overflow: hidden;
}

.alt-name {
  margin: 0;
  font-weight: 700;
  font-size: 0.95rem;
  overflow-wrap: break-word;
  word-break: break-word;
}

.alt-detail {
  margin: 4px 0 0;
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.5;
  overflow-wrap: break-word;
}

.command-mini {
  margin-top: 8px;
  position: relative;
  overflow: hidden;
  min-width: 0;
}

.command-mini + .command-mini {
  margin-top: 12px;
}

.command-mini-label {
  margin: 0 0 4px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--accent);
}

.command-mini pre {
  margin: 0;
  padding: 8px 10px;
  border-radius: 10px;
  background: #122722;
  color: #edf6f1;
  font-size: 0.72rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-all;
  overflow-wrap: break-word;
  max-width: 100%;
}

.command-mini .copy-button {
  position: absolute;
  top: 0;
  right: 0;
  padding: 4px 10px;
  font-size: 0.72rem;
}

.checklist,
.protocol-links {
  margin: 0;
  padding-left: 18px;
  font-size: 0.85rem;
  line-height: 1.65;
  color: var(--muted);
  overflow-wrap: break-word;
  word-break: break-word;
}

.checklist li + li,
.protocol-links li + li {
  margin-top: 4px;
}

.protocol-links a {
  font-weight: 600;
  font-size: 0.85rem;
}

/* ── Warning inline ──────────────────────────────────── */

.warning-inline {
  margin-top: 6px;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--warn-bg);
  color: var(--warn-text);
  font-size: 0.82rem;
  line-height: 1.5;
  overflow-wrap: break-word;
}

/* ── Results page ────────────────────────────────────── */

.results-page .page-header h2 {
  font-size: 1.6rem;
}

.result-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.result-rec-card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--panel-strong);
  box-shadow: 0 10px 26px rgba(31, 45, 40, 0.04);
}

.result-rec-card h3 {
  font-size: 1.15rem;
}

.result-label {
  margin: 0;
}

.result-link {
  display: inline-block;
  margin-top: 8px;
  font-weight: 600;
  font-size: 0.9rem;
}

.result-link + .result-link {
  margin-left: 12px;
}

.result-block {
  margin-top: 18px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--panel-strong);
}

.result-block h3 {
  margin: 0 0 10px;
  font-size: 1rem;
}

.warning-block {
  border-color: var(--warn-line);
  background: var(--warn-bg);
}

.warning-block h3 {
  color: var(--warn-text);
}

.alt-block {
  background: rgba(17, 75, 58, 0.03);
}

/* ── Command cards ───────────────────────────────────── */

.command-card {
  padding: 14px;
  border: 1px solid rgba(31, 45, 40, 0.08);
  border-radius: 14px;
  background: rgba(249, 245, 239, 0.75);
}

.command-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.command-card pre {
  margin: 10px 0 0;
  overflow-x: auto;
  padding: 12px;
  border-radius: 12px;
  background: #122722;
  color: #edf6f1;
  font-size: 0.82rem;
  line-height: 1.55;
}

.copy-button {
  padding: 6px 12px;
  font-size: 0.78rem;
}

/* ── Lists ───────────────────────────────────────────── */

.step-list,
.detail-list,
.link-list {
  margin: 8px 0 0;
  padding-left: 20px;
}

.step-list li,
.detail-list li,
.link-list li {
  line-height: 1.7;
}

.step-list li + li,
.detail-list li + li,
.link-list li + li {
  margin-top: 6px;
}

/* ── Content sections ────────────────────────────────── */

.content-section {
  margin-top: 28px;
  padding: 26px;
  border: 1px solid rgba(17, 75, 58, 0.12);
  border-radius: 30px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.96), rgba(248, 245, 238, 0.96));
  box-shadow: var(--shadow);
}

.section-heading {
  margin: 8px 0 0;
  font-family: "Fraunces", Georgia, serif;
  font-weight: 700;
  font-size: clamp(1.5rem, 4vw, 2.2rem);
  letter-spacing: -0.03em;
}

.section-text {
  max-width: 720px;
  margin: 12px 0 0;
  line-height: 1.65;
  color: var(--muted);
}

/* ── Domain grid ─────────────────────────────────────── */

.domain-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.domain-card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--panel);
  box-shadow: 0 10px 26px rgba(31, 45, 40, 0.04);
}

.domain-card h3 {
  margin: 6px 0 0;
  font-family: "Fraunces", Georgia, serif;
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
}

.domain-desc {
  margin: 8px 0 0;
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--muted);
}

.domain-links {
  margin: 10px 0 0;
  font-size: 0.85rem;
}

.domain-links a {
  font-weight: 600;
}

/* ── Publication card ────────────────────────────────── */

.publication-card {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--panel);
  box-shadow: 0 10px 26px rgba(31, 45, 40, 0.04);
  margin-top: 14px;
}

.publication-card h3 {
  margin: 0;
  font-family: "Fraunces", Georgia, serif;
  font-weight: 700;
  font-size: 1.25rem;
}

.pub-authors,
.pub-journal {
  margin: 6px 0 0;
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.5;
}

.pub-journal {
  font-weight: 600;
  font-style: italic;
}

/* ── Team grid ───────────────────────────────────────── */

.team-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.team-card {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--panel);
}

.team-name {
  margin: 0;
  font-weight: 700;
  font-size: 0.95rem;
}

.team-role {
  margin: 4px 0 0;
  font-size: 0.82rem;
  color: var(--muted);
}

/* ── Advisor section wrapper ─────────────────────────── */

.advisor-section .advisor-shell {
  margin-top: 20px;
}

/* ── Print ───────────────────────────────────────────── */

@media print {
  body {
    background: #fff;
  }

  .hero,
  .advisor-section,
  .ghost-button,
  .primary-button {
    display: none !important;
  }

  .advisor-shell {
    display: block;
  }

  .pane-recommendation {
    position: static;
    border: 2px solid var(--accent);
    page-break-inside: avoid;
    margin-bottom: 20px;
  }

  .pane-questions {
    border: none;
    box-shadow: none;
  }
}

/* ── Responsive ──────────────────────────────────────── */

@media (max-width: 1100px) {
  .advisor-shell {
    grid-template-columns: 1fr 300px;
  }

  .pane-rationale {
    grid-column: 1 / -1;
    position: static;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  }
}

@media (max-width: 860px) {
  .advisor-shell {
    grid-template-columns: 1fr;
  }

  .pane-recommendation {
    position: static;
  }

  .pane-rationale {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 960px) {
  .hero {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .page-shell {
    padding: 16px 12px 28px;
  }

  .hero,
  .pane-questions {
    padding: 18px;
  }

  .panel-head,
  .wizard-controls,
  .page-header-top,
  .command-head {
    flex-direction: column;
    align-items: stretch;
  }

  .option-grid.is-route-grid,
  .option-grid.is-priority-grid,
  .result-cards {
    grid-template-columns: 1fr;
  }

  .constraint-toggle {
    grid-template-columns: 1fr;
  }

  .progress-steps {
    flex-wrap: wrap;
    gap: 6px;
  }

  .progress-connector {
    display: none;
  }

  .content-section {
    padding: 18px;
  }

  .domain-grid,
  .team-grid {
    grid-template-columns: 1fr;
  }
}
