:root {
  --brand: #B45309;
  --brand-dark: #8C3F06;
  --brand-tint: #FFF1E0;
  --brand-ink: #7A3505;
  --line-accent: #F7941D;
  --ground: #FBF7F1;
  --surface: #FFFFFF;
  --ink: #1F1A17;
  --ink-2: #4A3F36;
  --muted: #6B5E52;
  --border: #EADFD2;
  --control: #DCCDBB;
  --track: #F3EBE1;
  --error: #B42318;
  --error-tint: #FCE8E6;
  --ok: #1E6B45;
  --ok-tint: #E3F1E8;
  --warn: #8A5300;
  --warn-tint: #FBEFD9;
  --radius: 10px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--ground); color: var(--ink);
  font-family: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', sans-serif; font-size: 16px; line-height: 1.5;
}
h1, h2 { font-family: 'IBM Plex Serif', Georgia, serif; font-weight: 500; margin: 0; }
button, input, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }

.test-banner { background: var(--warn-tint); color: var(--warn); text-align: center; font-size: 13px; font-weight: 600; padding: 6px 16px; }

/* header */
.topbar { background: var(--surface); border-bottom: 3px solid var(--line-accent); }
.topbar-inner { max-width: 1080px; margin: 0 auto; padding: 10px 20px; min-height: 68px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.logo { height: 40px; width: auto; display: block; }
.topbar-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; text-align: right; }
.app-name { font-size: 12px; font-weight: 600; letter-spacing: 0.14em; color: var(--brand); }
.topbar-sub { font-size: 12px; color: var(--muted); }

/* progress */
.progress-wrap { background: var(--surface); border-bottom: 1px solid var(--border); }
.progress-inner { max-width: 1080px; margin: 0 auto; padding: 12px 20px 14px; display: flex; flex-direction: column; gap: 8px; }
.progress-text { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); }
.progress-track { height: 6px; border-radius: 3px; background: var(--track); overflow: hidden; }
.progress-fill { height: 6px; width: 0; background: var(--brand); border-radius: 3px; transition: width .3s ease; }

/* layout */
.app { max-width: 1080px; margin: 0 auto; padding: 24px 20px 40px; }
.narrow { max-width: 560px; margin: 0 auto; }
.layout { display: flex; flex-wrap: wrap; gap: 32px; align-items: flex-start; }
.sidebar { flex: 1 1 240px; display: none; flex-direction: column; gap: 16px; }
.content { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
@media (min-width: 900px) {
  .sidebar { display: flex; position: sticky; top: 16px; }
  .app { padding-top: 40px; }
  .progress-wrap.desktop-hide { display: none; }
}

.eyebrow { font-size: 13px; font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase; color: var(--brand); }
.greeting { font-size: 32px; line-height: 1.2; }
.lead { font-size: 16px; line-height: 1.6; color: var(--ink-2); margin: 0; }
.section-title { font-size: 26px; margin-bottom: 4px; }

.facts { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 4px 16px; }
.fact { display: flex; justify-content: space-between; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--track); font-size: 15px; }
.fact:last-child { border-bottom: 0; }
.fact span:first-child { color: var(--muted); }
.fact span:last-child { font-weight: 500; text-align: right; }

.notice { display: flex; gap: 12px; align-items: flex-start; background: var(--brand-tint); border-radius: 12px; padding: 14px 16px; color: var(--brand-ink); font-size: 14px; line-height: 1.55; }
.notice svg { flex-shrink: 0; margin-top: 1px; }

/* sidebar steps */
.side-hello { font-family: 'IBM Plex Serif', Georgia, serif; font-size: 22px; }
.side-sub { font-size: 14px; color: var(--muted); }
.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.step { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border-radius: var(--radius); font-size: 15px; color: var(--muted); border: 1px solid transparent; }
.step.current { background: var(--surface); border-color: var(--border); color: var(--ink); font-weight: 600; }
.step.done { color: var(--ink); }
.step-dot { width: 26px; height: 26px; border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 13px; border: 1px solid #C9B8A5; }
.step.current .step-dot { background: var(--brand); border-color: var(--brand); color: #fff; }
.step.done .step-dot { background: var(--ok); border-color: var(--ok); color: #fff; }

/* question cards */
.q { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 20px 16px; display: flex; flex-direction: column; gap: 14px; margin: 0; min-width: 0; }
@media (min-width: 600px) { .q { padding: 24px; } }
.q.has-error { border: 2px solid var(--error); padding: 19px 15px; }
@media (min-width: 600px) { .q.has-error { padding: 23px; } }
.q legend, .q-label { font-size: 16px; font-weight: 500; line-height: 1.45; padding: 0; float: left; width: 100%; }
.q legend + * { clear: both; }
.req { color: var(--error); }
.opt { font-size: 13px; font-weight: 400; color: var(--muted); }
.help { font-size: 13px; color: var(--muted); margin-top: -6px; }
.err { display: flex; gap: 8px; align-items: center; font-size: 14px; color: var(--error); }

.scale { display: grid; gap: 8px; }
.scale-labels { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-top: -6px; }
.pill {
  min-height: 48px; border: 1px solid var(--control); border-radius: var(--radius); background: var(--surface);
  font-size: 17px; font-weight: 500; cursor: pointer; padding: 0 6px; transition: background .15s, border-color .15s;
}
.pill:hover { border-color: var(--brand); }
.pill[aria-checked="true"], .pill[aria-pressed="true"] { background: var(--brand); border: 2px solid var(--brand); color: #fff; font-weight: 600; }
.pill.soft[aria-checked="true"] { background: var(--brand-tint); color: var(--brand); }
.pill:focus-visible, .choice:focus-within, .btn:focus-visible, textarea:focus-visible, input[type=number]:focus-visible { outline: 3px solid var(--line-accent); outline-offset: 2px; }
.yesno { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; max-width: 320px; }

.choices { display: grid; gap: 8px; }
@media (min-width: 700px) { .choices.two { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.choice { display: flex; gap: 12px; align-items: center; min-height: 48px; padding: 8px 14px; border: 1px solid var(--control); border-radius: var(--radius); font-size: 15px; cursor: pointer; background: var(--surface); }
.choice:hover { border-color: var(--brand); }
.choice.checked { border: 2px solid var(--brand); background: var(--brand-tint); font-weight: 500; padding: 7px 13px; }
.choice input { width: 18px; height: 18px; margin: 0; accent-color: var(--brand); flex-shrink: 0; }

textarea, input[type=text] {
  width: 100%; min-height: 48px; padding: 12px 14px; border: 1px solid var(--control); border-radius: var(--radius);
  background: var(--surface); font-size: 15px; line-height: 1.5;
}
textarea { min-height: 120px; resize: vertical; }
.counter { text-align: right; font-size: 12px; color: var(--muted); margin-top: -6px; }

/* buttons */
.btn { min-height: 52px; padding: 0 28px; border-radius: var(--radius); font-size: 16px; font-weight: 600; cursor: pointer; border: 0; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-primary[disabled] { opacity: .6; cursor: progress; }
.btn-secondary { background: var(--surface); color: var(--ink); border: 1px solid var(--control); font-weight: 500; }
.actions { display: flex; justify-content: space-between; gap: 12px; padding-top: 8px; flex-wrap: wrap; }
.actions .btn { flex: 1 1 140px; }
@media (min-width: 600px) { .actions .btn { flex: 0 0 auto; } }
.actions .spacer { flex: 1 1 0; }
.hint { text-align: center; font-size: 13px; color: var(--muted); margin: 0; }
.form-error { background: var(--error-tint); color: var(--error); border-radius: var(--radius); padding: 12px 14px; font-size: 14px; }

/* centered states */
.center-state { max-width: 460px; margin: 8vh auto 0; display: flex; flex-direction: column; align-items: center; gap: 18px; text-align: center; }
.badge { width: 72px; height: 72px; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.badge.ok { background: var(--ok-tint); } .badge.warn { background: var(--warn-tint); } .badge.bad { background: var(--error-tint); }
.center-state h1 { font-size: 28px; line-height: 1.25; }
.receipt { width: 100%; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; display: flex; justify-content: space-between; font-size: 14px; }
.receipt span:first-child { color: var(--muted); }
.spinner { width: 36px; height: 36px; border-radius: 50%; border: 3px solid var(--track); border-top-color: var(--brand); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2.4s; } .progress-fill { transition: none; } }
.noscript { text-align: center; padding: 40px 20px; }
