/* ─── Design tokens ──────────────────────────────────────────────────────────── */
:root {
  --bg: #f7f3ee;
  --surface: #ffffff;
  --surface-2: #f9f6f2;
  --surface-3: rgba(255, 255, 255, 0.7);
  --line: rgba(40, 30, 18, 0.12);
  --line-strong: rgba(40, 30, 18, 0.22);
  --ink: #1e1208;
  --ink-2: #4a3828;
  --muted: #7a6655;
  --accent: #e0622a;
  --accent-dark: #b84518;
  --accent-light: rgba(224, 98, 42, 0.1);
  --green: #0e7c72;
  --green-light: rgba(14, 124, 114, 0.1);
  --gold: #c8921e;
  --gold-light: rgba(200, 146, 30, 0.14);
  --red: #be3a3a;
  --red-light: rgba(190, 58, 58, 0.1);
  --shadow-sm: 0 2px 8px rgba(40, 20, 8, 0.07);
  --shadow: 0 8px 32px rgba(40, 20, 8, 0.1);
  --shadow-lg: 0 24px 72px rgba(40, 20, 8, 0.13);
  --radius-sm: 10px;
  --radius: 18px;
  --radius-lg: 28px;
  --radius-full: 999px;
  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  --font-serif: Georgia, "Times New Roman", serif;
  --transition: 160ms ease;
}

/* ─── Reset & base ───────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-sans);
  color: var(--ink);
  background:
    radial-gradient(ellipse 80% 50% at 0% 0%, rgba(224, 98, 42, 0.12) 0%, transparent 55%),
    radial-gradient(ellipse 60% 40% at 100% 0%, rgba(14, 124, 114, 0.1) 0%, transparent 50%),
    radial-gradient(ellipse 100% 80% at 50% 100%, rgba(200, 146, 30, 0.07) 0%, transparent 60%),
    #f7f3ee;
  background-attachment: fixed;
}

button, input, textarea, select { font: inherit; color: inherit; }

/* ─── Page shell ─────────────────────────────────────────────────────────────── */
.page-shell {
  max-width: 1340px;
  margin: 0 auto;
  padding: 0 16px 64px;
}

/* ─── Top nav ────────────────────────────────────────────────────────────────── */
.top-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  padding: 10px 0;
  background: rgba(247, 243, 238, 0.88);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--line);
}

.top-nav-inner {
  max-width: 1340px;
  margin: 0 auto;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--ink);
}

.logo-icon { font-size: 1.4rem; }
.logo-text {
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.nav-actions { display: flex; gap: 8px; align-items: center; }

/* ─── Buttons ────────────────────────────────────────────────────────────────── */
.primary-button,
.ghost-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: none;
  border-radius: var(--radius-full);
  cursor: pointer;
  font-weight: 600;
  white-space: nowrap;
  transition: transform var(--transition), opacity var(--transition), box-shadow var(--transition);
  -webkit-user-select: none;
  user-select: none;
}

.primary-button {
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  color: #fff;
  padding: 13px 22px;
  font-size: 1rem;
  box-shadow: 0 6px 24px rgba(224, 98, 42, 0.3);
}
.primary-button:hover { transform: translateY(-2px); box-shadow: 0 10px 32px rgba(224, 98, 42, 0.38); }
.primary-button:active { transform: translateY(0); }
.primary-button:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }
.primary-button[aria-busy="true"]::before {
  content: "";
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255,255,255,0.5);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.ghost-button {
  background: rgba(40, 30, 18, 0.07);
  color: var(--ink-2);
  padding: 9px 16px;
  font-size: 0.9rem;
}
.ghost-button:hover { background: rgba(40, 30, 18, 0.12); transform: translateY(-1px); }
.ghost-button:active { transform: translateY(0); }

.remove-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--red-light);
  color: var(--red);
  cursor: pointer;
  transition: background var(--transition), transform var(--transition);
  flex-shrink: 0;
}
.remove-btn:hover { background: rgba(190, 58, 58, 0.2); transform: scale(1.1); }

@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Tooltips ───────────────────────────────────────────────────────────────── */
[data-tooltip] { position: relative; }

[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 9px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  background: #1c1a17;
  color: #f5f2ee;
  padding: 7px 11px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.45;
  width: max-content;
  max-width: 220px;
  white-space: normal;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.14s ease, transform 0.14s ease;
  z-index: 300;
  box-shadow: 0 4px 16px rgba(0,0,0,0.22);
}
[data-tooltip]::before {
  content: '';
  position: absolute;
  bottom: calc(100% + 4px);
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: #1c1a17;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.14s ease;
  z-index: 300;
}
[data-tooltip]:hover::after,
[data-tooltip]:focus-visible::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
[data-tooltip]:hover::before,
[data-tooltip]:focus-visible::before { opacity: 1; }

/* Tooltip below variant (for items near the top of the page) */
[data-tooltip].tooltip-below::after {
  bottom: auto;
  top: calc(100% + 9px);
  transform: translateX(-50%) translateY(-4px);
}
[data-tooltip].tooltip-below:hover::after { transform: translateX(-50%) translateY(0); }
[data-tooltip].tooltip-below::before {
  bottom: auto;
  top: calc(100% + 4px);
  border-top-color: transparent;
  border-bottom-color: #1c1a17;
}

/* Tooltip align-left variant (for left-edge items) */
[data-tooltip].tooltip-left::after { left: 0; transform: translateX(0) translateY(4px); }
[data-tooltip].tooltip-left:hover::after { transform: translateX(0) translateY(0); }
[data-tooltip].tooltip-left::before { left: 12px; }

/* Info icon — small ⓘ circles next to labels */
.info-tip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  color: var(--muted);
  font-size: 9px;
  font-style: normal;
  font-weight: 700;
  cursor: default;
  vertical-align: middle;
  margin-left: 5px;
  flex-shrink: 0;
  line-height: 1;
}
.info-tip::after { max-width: 240px; }

/* ─── Hero ───────────────────────────────────────────────────────────────────── */
.hero {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  align-items: start;
  padding: 48px 0 32px;
  transition: padding var(--transition);
}

.hero.is-compact {
  padding: 20px 0 16px;
}
.hero.is-compact .hero-benefits,
.hero.is-compact .template-gallery {
  display: none;
}
.hero.is-compact h1 {
  font-size: clamp(1.8rem, 3vw, 2.4rem);
  margin-bottom: 6px;
}
.hero.is-compact .hero-text { display: none; }
.hero.is-compact .eyebrow { display: none; }

.hero-inner {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--accent);
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin: 0;
}

h1 {
  margin: 0;
  font-family: var(--font-serif);
  font-size: clamp(2.8rem, 5vw, 4.4rem);
  line-height: 1.0;
  letter-spacing: -0.04em;
  color: var(--ink);
}

.hero-text {
  margin: 0;
  font-size: 1.08rem;
  line-height: 1.65;
  color: var(--muted);
  max-width: 54ch;
}

/* ─── Template chips ─────────────────────────────────────────────────────────── */
.template-gallery { display: flex; flex-direction: column; gap: 10px; }

.gallery-label {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.template-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border: 1.5px solid var(--line-strong);
  border-radius: var(--radius-full);
  background: var(--surface);
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--ink-2);
  transition: background var(--transition), border-color var(--transition), transform var(--transition), box-shadow var(--transition);
  white-space: nowrap;
  box-shadow: var(--shadow-sm);
}
.chip:hover {
  background: var(--accent-light);
  border-color: var(--accent);
  color: var(--accent-dark);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}
.chip-icon { font-size: 1rem; }
.chip-text { font-weight: 600; }

/* ─── Hero benefits ──────────────────────────────────────────────────────────── */
.hero-benefits {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  align-self: start;
}

.benefit-card {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.benefit-icon { font-size: 1.5rem; flex-shrink: 0; }

.benefit-card strong {
  display: block;
  font-size: 0.92rem;
  font-weight: 700;
  margin-bottom: 4px;
  color: var(--ink);
}
.benefit-card p {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.5;
  color: var(--muted);
}

/* ─── Workflow bar (replaced by sidebar — kept for JS compat, hidden) ─────────── */
.workflow-bar {
  display: none;
  position: sticky;
  top: 57px;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 16px;
  margin: 0 -16px 24px;
  background: rgba(247, 243, 238, 0.94);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
}

.workflow-steps {
  display: flex;
  list-style: none;
  margin: 0;
  padding: 0;
  gap: 4px;
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
}
.workflow-steps::-webkit-scrollbar { display: none; }

.workflow-step {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 12px;
  border-radius: var(--radius-full);
  cursor: default;
  opacity: 0.4;
  transition: opacity var(--transition), background var(--transition), transform var(--transition);
  white-space: nowrap;
}

.workflow-step.is-active {
  opacity: 1;
  background: var(--accent-light);
  transform: none;
}
.workflow-step.is-complete {
  opacity: 0.75;
  background: var(--green-light);
}

.step-bubble {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--muted);
  color: #fff;
  font-size: 0.74rem;
  font-weight: 700;
  flex-shrink: 0;
  transition: background var(--transition);
}
.workflow-step.is-active .step-bubble { background: var(--accent); }
.workflow-step.is-complete .step-bubble { background: var(--green); }

.step-label { font-size: 0.82rem; font-weight: 600; color: var(--ink-2); }

.workflow-note {
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted);
  flex-shrink: 0;
  margin-left: auto;
}

/* ─── Screen-reader only ─────────────────────────────────────────────────────── */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* ─── Workspace shell: sidebar + stacked panels ──────────────────────────────── */
.workspace-shell {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 0 20px;
  align-items: start;
  margin-top: 16px;
}

/* ─── Left step sidebar ──────────────────────────────────────────────────────── */
.step-sidebar {
  position: sticky;
  top: 68px;
  padding-top: 4px;
}

.sidebar-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.sidebar-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  cursor: default;
}

.sidebar-bubble {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid var(--line-strong);
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 800;
  position: relative;
  z-index: 1;
  transition: background var(--transition), border-color var(--transition), color var(--transition), box-shadow var(--transition);
  cursor: pointer;
}

.sidebar-step.is-active .sidebar-bubble {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 0 0 5px var(--accent-light);
}

.sidebar-step.is-complete .sidebar-bubble {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}

/* Checkmark on complete steps */
.sidebar-step.is-complete .sidebar-bubble::after {
  content: "✓";
  font-size: 0.9rem;
  font-weight: 900;
}
.sidebar-step.is-complete .sidebar-bubble { font-size: 0; } /* hide number */

.sidebar-label {
  font-size: 0.6rem;
  font-weight: 700;
  color: var(--muted);
  margin-top: 5px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
  transition: color var(--transition);
  text-align: center;
}

.sidebar-step.is-active .sidebar-label { color: var(--accent); }
.sidebar-step.is-complete .sidebar-label { color: var(--green); }

.sidebar-connector {
  display: block;
  width: 2px;
  height: 44px;
  background: var(--line-strong);
  margin: 5px 0;
  border-radius: 1px;
  transition: background var(--transition);
}
.sidebar-step.is-complete .sidebar-connector { background: var(--green); }

/* ─── Workspace: stacked panels ──────────────────────────────────────────────── */
.workspace {
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
}

.panel {
  padding: 28px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

/* All panels full-width in the flex column */
.intake-panel,
.summary-panel,
.grid-panel,
.scenario-panel { width: 100%; }

/* ─── Panel headers ──────────────────────────────────────────────────────────── */
.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 20px;
}

.panel-title-group { flex: 1; min-width: 0; }

.panel-kicker {
  margin: 0 0 6px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent);
}

.panel-title-group h2 {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 1.55rem;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.section-help {
  margin: 6px 0 0;
  font-size: 0.88rem;
  line-height: 1.55;
  color: var(--muted);
}

.panel-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
}

/* ─── Tips box ───────────────────────────────────────────────────────────────── */
.tips-box {
  margin-bottom: 16px;
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface-2);
}
.tips-title {
  margin: 0 0 8px;
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--ink);
}
.tips-list {
  margin: 0;
  padding-left: 18px;
  font-size: 0.84rem;
  line-height: 1.7;
  color: var(--muted);
}
.tips-list em { color: var(--ink-2); font-style: normal; }

/* ─── Intake form ────────────────────────────────────────────────────────────── */
.field-label {
  display: block;
  margin-bottom: 8px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

textarea {
  width: 100%;
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  background: var(--surface-2);
  line-height: 1.6;
  resize: vertical;
  min-height: 160px;
  transition: border-color var(--transition), box-shadow var(--transition);
  color: var(--ink);
}
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(224, 98, 42, 0.12);
  background: var(--surface);
}

.intake-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  flex-wrap: wrap;
}
.char-count { font-size: 0.78rem; color: var(--muted); }
.intake-actions { display: flex; gap: 10px; align-items: center; }

.status-line {
  margin: 10px 0 0;
  font-size: 0.84rem;
  color: var(--muted);
  line-height: 1.5;
}

/* ─── Summary readout ────────────────────────────────────────────────────────── */
.summary-copy {
  margin: 0 0 18px;
  font-size: 0.95rem;
  line-height: 1.65;
  color: var(--ink-2);
}

.meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.meta-card-wide { grid-column: 1 / -1; }

.meta-card {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.meta-label {
  margin: 0 0 10px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}

.token-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
  padding: 0;
  margin: 0;
}

.token {
  padding: 5px 12px;
  border-radius: var(--radius-full);
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: 0.82rem;
  color: var(--ink-2);
}
.muted-token { color: var(--muted); font-style: italic; }

/* ─── Recommendation card ────────────────────────────────────────────────────── */
.recommendation-card { display: flex; flex-direction: column; gap: 10px; }

.rec-winner {
  display: flex;
  align-items: center;
  gap: 10px;
}
.rec-label { font-size: 1.05rem; font-weight: 700; color: var(--ink); }

.rec-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}
.rec-stat {
  display: flex;
  align-items: baseline;
  gap: 4px;
  font-size: 0.84rem;
  color: var(--muted);
}
.rec-stat strong { color: var(--ink); font-size: 1rem; }
.rec-stat-label { color: var(--muted); }
.rec-stat-unit { color: var(--muted); font-size: 0.78rem; }

.all-rankings { display: flex; flex-direction: column; gap: 6px; }

.ranking-row {
  display: grid;
  grid-template-columns: 42px 1fr auto 40px;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
}
.ranking-row.is-winner .ranking-label { font-weight: 700; }
.ranking-label { font-size: 0.88rem; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ranking-bar-wrap { height: 6px; background: var(--line); border-radius: var(--radius-full); overflow: hidden; }
.ranking-bar { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-dark)); border-radius: var(--radius-full); transition: width 400ms ease; }
.ranking-row.is-winner .ranking-bar { background: linear-gradient(90deg, var(--green), #0a5e57); }
.ranking-score { font-size: 0.8rem; font-weight: 700; color: var(--ink-2); text-align: right; }

/* ─── Rank pills ─────────────────────────────────────────────────────────────── */
.rank-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  padding: 4px 8px;
  border-radius: var(--radius-full);
  font-size: 0.76rem;
  font-weight: 800;
  white-space: nowrap;
  flex-shrink: 0;
}
.rank-1 { background: var(--gold-light); color: #7a5202; }
.rank-2 { background: rgba(120, 120, 120, 0.12); color: #555; }
.rank-3 { background: rgba(180, 100, 50, 0.1); color: #6b3a20; }
.rank-pill:not(.rank-1):not(.rank-2):not(.rank-3) { background: var(--line); color: var(--muted); }

/* ─── Rationale ──────────────────────────────────────────────────────────────── */
.rationale-list { display: flex; flex-direction: column; gap: 6px; }

.rationale-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--line);
}
.rationale-key { font-size: 0.85rem; color: var(--muted); }
.rationale-val { font-size: 0.88rem; color: var(--ink); }

/* ─── Empty states ───────────────────────────────────────────────────────────── */
.empty-state-text {
  margin: 0;
  font-size: 0.88rem;
  color: var(--muted);
  font-style: italic;
}

.empty-grid {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 48px 24px;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
}
.empty-grid-icon { font-size: 2.4rem; }

/* ─── Decision grid ──────────────────────────────────────────────────────────── */
.grid-scroll-hint {
  display: none;
  text-align: center;
  font-size: 0.75rem;
  color: var(--muted);
  padding: 6px;
  border-bottom: 1px solid var(--line);
}

.grid-scroll-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.decision-grid {
  width: 100%;
  min-width: 700px;
  border-collapse: collapse;
  font-size: 0.9rem;
}

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

.decision-grid thead th {
  position: sticky;
  top: 0;
  background: rgba(249, 246, 242, 0.97);
  backdrop-filter: blur(12px);
  z-index: 2;
  border-bottom: 2px solid var(--line-strong);
}

.criterion-heading {
  min-width: 240px;
  max-width: 280px;
}
.th-hint {
  display: block;
  font-size: 0.72rem;
  font-weight: 400;
  color: var(--muted);
  margin-top: 2px;
}

.option-heading { min-width: 180px; }

.option-header-cell {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.option-rank-row { display: flex; align-items: center; gap: 8px; }
.option-score { font-size: 0.88rem; font-weight: 700; color: var(--ink-2); }
.score-unit { font-size: 0.72rem; font-weight: 400; color: var(--muted); }

.option-name-input {
  width: 100%;
  border: 1.5px dashed var(--line-strong);  /* dashed = "this is editable" signal */
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  background: transparent;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--ink);
  cursor: text;
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}
.option-name-input:hover {
  border-color: var(--accent);
  background: var(--surface-2);
}
.option-name-input:focus {
  outline: none;
  border-style: solid;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(224, 98, 42, 0.1);
  background: var(--surface);
}

/* Criterion cell */
.criterion-cell { min-width: 240px; }
.criterion-inner { display: flex; flex-direction: column; gap: 8px; }
.criterion-label-row { display: flex; align-items: center; gap: 6px; }

.criterion-name-input {
  flex: 1;
  min-width: 0;
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  background: transparent;
  font-size: 0.85rem;
  cursor: text;
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}
.criterion-name-input:hover {
  border-color: var(--accent);
  background: var(--surface-2);
}
.criterion-name-input:focus {
  outline: none;
  border-style: solid;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(224, 98, 42, 0.1);
  background: var(--surface);
}

/* Weight row — slider + percentage badge */
.weight-row { display: flex; align-items: center; gap: 8px; }
.weight-slider {
  flex: 1;
  min-width: 0;
  -webkit-appearance: none;
  appearance: none;
  height: 20px;           /* tall click area */
  background: transparent;
  cursor: pointer;
  padding: 8px 0;         /* extra vertical hit target */
}
.weight-slider::-webkit-slider-runnable-track {
  height: 5px;
  background: var(--line-strong);
  border-radius: var(--radius-full);
}
.weight-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  margin-top: -5.5px;
  box-shadow: 0 1px 4px rgba(224, 98, 42, 0.35);
  transition: transform 120ms ease, box-shadow 120ms ease;
}
.weight-slider:hover::-webkit-slider-thumb,
.weight-slider:focus::-webkit-slider-thumb {
  transform: scale(1.2);
  box-shadow: 0 1px 8px rgba(224, 98, 42, 0.5);
}
.weight-slider::-moz-range-track {
  height: 5px;
  background: var(--line-strong);
  border-radius: var(--radius-full);
}
.weight-slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border: none;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 1px 4px rgba(224, 98, 42, 0.35);
}
.weight-badge {
  min-width: 40px;
  text-align: right;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-light);
  padding: 2px 7px;
  border-radius: var(--radius-full);
  white-space: nowrap;
}

/* Score cell — badge shows the value, slider changes it */
.score-cell { min-width: 160px; }
.score-inner {
  display: flex;
  align-items: center;
  gap: 10px;
}

.score-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  font-size: 0.9rem;
  font-weight: 800;
  flex-shrink: 0;
  transition: background var(--transition), color var(--transition);
}
.score-level-1 { background: rgba(190, 58, 58, 0.15); color: var(--red); }
.score-level-2 { background: rgba(190, 100, 30, 0.15); color: #b46018; }
.score-level-3 { background: rgba(200, 146, 30, 0.15); color: var(--gold); }
.score-level-4 { background: rgba(50, 140, 100, 0.15); color: #2a8060; }
.score-level-5 { background: var(--green-light); color: var(--green); }

/* Score slider — inline with the badge, no redundant track */
.score-slider {
  flex: 1;
  min-width: 0;
  -webkit-appearance: none;
  appearance: none;
  height: 20px;
  background: transparent;
  cursor: pointer;
  padding: 8px 0;
}
.score-slider::-webkit-slider-runnable-track {
  height: 5px;
  background: var(--line-strong);
  border-radius: var(--radius-full);
}
.score-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--green);
  margin-top: -5.5px;
  box-shadow: 0 1px 4px rgba(14, 124, 114, 0.35);
  transition: transform 120ms ease, box-shadow 120ms ease;
}
.score-slider:hover::-webkit-slider-thumb,
.score-slider:focus::-webkit-slider-thumb {
  transform: scale(1.2);
  box-shadow: 0 1px 8px rgba(14, 124, 114, 0.5);
}
.score-slider::-moz-range-track {
  height: 5px;
  background: var(--line-strong);
  border-radius: var(--radius-full);
}
.score-slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border: none;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 1px 4px rgba(14, 124, 114, 0.35);
}

/* Total row */
.total-row td {
  background: rgba(40, 30, 18, 0.03);
  border-top: 2px solid var(--line-strong);
  border-bottom: none;
}
.total-label { font-size: 0.82rem; font-weight: 700; color: var(--muted); vertical-align: middle; }
.total-cell { display: flex; flex-direction: column; gap: 2px; vertical-align: middle; }
.total-score-line { display: flex; align-items: baseline; gap: 1px; }
.total-score { font-size: 1.15rem; font-weight: 800; color: var(--ink); }
.total-unit { font-size: 0.73rem; color: var(--muted); }
.total-assumption { font-size: 0.75rem; color: var(--green); }
.is-winner-cell .total-score { color: var(--green); }
.is-winner-cell { background: var(--green-light) !important; }

/* ─── Assumptions ────────────────────────────────────────────────────────────── */
.assumptions-list { display: flex; flex-direction: column; gap: 10px; }

.assumption-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 14px 16px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  transition: border-color var(--transition), background var(--transition);
}
.assumption-card.is-active { border-color: rgba(14, 124, 114, 0.3); background: rgba(14, 124, 114, 0.03); }
.assumption-card.is-inactive { opacity: 0.6; }

.assumption-toggle-col { display: flex; align-items: center; }

/* Toggle switch */
.toggle { position: absolute; opacity: 0; width: 0; height: 0; }
.toggle-label { display: block; cursor: pointer; }
.toggle-track {
  display: block;
  width: 44px;
  height: 26px;
  border-radius: var(--radius-full);
  background: var(--line-strong);
  position: relative;
  transition: background var(--transition);
}
.toggle:checked + .toggle-track { background: var(--green); }
.toggle-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition);
}
.toggle:checked + .toggle-track .toggle-thumb { transform: translateX(18px); }

.assumption-body { display: flex; flex-direction: column; gap: 8px; min-width: 0; }

.assumption-label-input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  background: var(--surface-2);
  font-size: 0.9rem;
  transition: border-color var(--transition);
}
.assumption-label-input:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 2px rgba(14, 124, 114, 0.1);
  background: var(--surface);
}

.assumption-meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.assumption-meta-text { font-size: 0.82rem; color: var(--muted); }

.assumption-select {
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  font-size: 0.84rem;
  cursor: pointer;
}

.impact-input-wrap { display: flex; align-items: center; gap: 4px; }
.impact-input {
  width: 70px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 5px 8px;
  background: var(--surface-2);
  font-size: 0.84rem;
  text-align: center;
  -moz-appearance: textfield;
}
.impact-input::-webkit-outer-spin-button,
.impact-input::-webkit-inner-spin-button { -webkit-appearance: none; }
.impact-unit { font-size: 0.78rem; color: var(--muted); }

.impact-pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 700;
}
.impact-pill.positive { background: var(--green-light); color: var(--green); }
.impact-pill.negative { background: var(--red-light); color: var(--red); }
.impact-pill.neutral { background: var(--line); color: var(--muted); }

.assumption-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.assumption-status { font-size: 0.7rem; font-weight: 700; color: var(--muted); text-transform: uppercase; }

/* ─── Toast ──────────────────────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(120%);
  padding: 12px 20px;
  border-radius: var(--radius-full);
  background: var(--ink);
  color: #fff;
  font-size: 0.88rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  transition: transform 260ms cubic-bezier(0.34, 1.56, 0.64, 1);
  white-space: nowrap;
  max-width: calc(100vw - 32px);
}
.toast.is-visible { transform: translateX(-50%) translateY(0); }
.toast-success { background: var(--green); }
.toast-warn { background: var(--gold); color: var(--ink); }
.toast-error { background: var(--red); }
.toast-info { background: var(--ink-2); }

/* ─── Footer ─────────────────────────────────────────────────────────────────── */
.site-footer {
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
  text-align: center;
  font-size: 0.82rem;
  color: var(--muted);
}

/* ─── Responsive ─────────────────────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .hero {
    grid-template-columns: 1fr;
  }
  .hero-benefits {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 768px) {
  .page-shell { padding: 0 12px 48px; }

  h1 { font-size: clamp(2rem, 7vw, 3rem); }

  .hero { padding: 28px 0 20px; }
  .hero-benefits { grid-template-columns: 1fr; }

  /* Sidebar collapses to just bubbles on mobile */
  .workspace-shell {
    grid-template-columns: 44px 1fr;
    gap: 0 12px;
  }
  .sidebar-label { display: none; }
  .sidebar-bubble { width: 30px; height: 30px; font-size: 0.75rem; }
  .sidebar-connector { height: 32px; }

  .workspace { gap: 12px; }
  .panel { padding: 16px; }
  .panel-header { flex-direction: column; align-items: flex-start; }
  .panel-actions { flex-wrap: wrap; }

  .meta-grid { grid-template-columns: 1fr; }
  .meta-card-wide { grid-column: auto; }

  .grid-scroll-hint { display: block; }

  .assumption-card {
    grid-template-columns: auto 1fr;
    grid-template-rows: auto auto;
  }
  .assumption-actions {
    grid-column: 2;
    flex-direction: row;
    justify-content: flex-end;
  }

  .assumption-meta-row { flex-direction: column; align-items: flex-start; }

  .template-chips { gap: 6px; }
  .chip { padding: 7px 11px; font-size: 0.82rem; }

  .intake-footer { flex-direction: column; align-items: flex-start; }
  .intake-actions { width: 100%; }
  .primary-button { width: 100%; justify-content: center; }
}

@media (max-width: 480px) {
  .nav-share-btn .nav-share-text { display: none; }
  /* Sidebar hides completely on very small screens */
  .workspace-shell { grid-template-columns: 1fr; }
  .step-sidebar { display: none; }
}
