:root {
  --ink: #1d2430;
  --muted: #5b6575;
  --line: #d9dee6;
  --bg: #f6f7f9;
  --card: #ffffff;
  --accent: #0b5cad;
  --accent-soft: #e8f1fb;
  --good: #1f7a4d;
  --good-soft: #e7f5ee;
  --error: #b42318;
  --radius: 10px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
}
* { box-sizing: border-box; }
body { margin: 0; line-height: 1.5; }
.wrap { max-width: 600px; margin: 0 auto; padding: 0 20px; }

.top { background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 2; }
.top .wrap:first-child { display: flex; justify-content: space-between; align-items: center; padding-top: 12px; padding-bottom: 8px; }
.brand { display: block; height: 30px; width: auto; }
.call { color: var(--accent); text-decoration: none; font-size: 0.95rem; }
/* Three-section progress bar: Qualify, Sign, Finish (see js/progress.js). */
.progress-wrap { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding-bottom: 10px; }
.progress-wrap[hidden] { display: none; }
.seg .track { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; }
.seg .fill { height: 100%; width: 0; background: var(--accent); border-radius: 3px; transition: width 0.4s ease; }
.seg .lbl { display: block; margin-top: 5px; font-size: 0.78rem; color: var(--muted); }
.seg .n { display: inline-block; min-width: 1.35em; height: 1.35em; line-height: 1.35em; border-radius: 50%; text-align: center;
  font-size: 0.72rem; font-weight: 600; background: var(--line); color: var(--muted); margin-right: 3px; }
.seg.current .lbl { color: var(--ink); font-weight: 600; }
.seg.current .n { background: var(--accent); color: #fff; }
.seg.complete .n { background: var(--good); color: #fff; }
.seg.complete .fill { background: var(--good); }

main { padding-top: 24px; padding-bottom: 32px; }
h1 { font-size: 1.45rem; line-height: 1.3; margin: 8px 0 8px; }
h2 { font-size: 1.1rem; margin-top: 28px; }
.help { color: var(--muted); margin: 0 0 16px; }
.hint { background: var(--accent-soft); border-radius: 6px; padding: 8px 12px; font-size: 0.9rem; margin: 0 0 16px; }

.choices { display: grid; gap: 10px; margin: 16px 0; }
.choice {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  font: inherit; font-size: 1.02rem; color: var(--ink);
  background: var(--card); border: 1.5px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; cursor: pointer; min-height: 52px;
}
.choice:hover { border-color: var(--accent); }
.choice.selected { border-color: var(--accent); background: var(--accent-soft); }
.choice input { width: 20px; height: 20px; margin: 0; accent-color: var(--accent); flex: none; }

form { margin: 0; }
.field { margin: 14px 0; }
.field label { display: block; font-weight: 600; font-size: 0.95rem; margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%; font: inherit; font-size: 1rem; padding: 12px; border: 1.5px solid var(--line);
  border-radius: 8px; background: var(--card); color: var(--ink);
}
.field input:focus, .field select:focus, .field textarea:focus, .choice:focus-visible, button:focus-visible {
  outline: 3px solid var(--accent-soft); border-color: var(--accent);
}
fieldset { border: 1.5px solid var(--line); border-radius: var(--radius); margin: 0 0 14px; padding: 4px 16px 12px; background: var(--card); }
legend { font-weight: 700; color: var(--muted); padding: 0 6px; }

button.primary {
  display: block; width: 100%; margin-top: 20px; padding: 15px; font: inherit; font-weight: 700; font-size: 1.05rem;
  color: #fff; background: var(--accent); border: 0; border-radius: var(--radius); cursor: pointer;
}
button.secondary {
  font: inherit; padding: 10px 14px; background: var(--card); color: var(--accent);
  border: 1.5px dashed var(--accent); border-radius: 8px; cursor: pointer; width: 100%;
}
button.link { background: none; border: 0; color: var(--error); font: inherit; font-size: 0.9rem; cursor: pointer; padding: 0; }
.back { background: none; border: 0; color: var(--muted); font: inherit; cursor: pointer; padding: 0; margin-bottom: 4px; }
.error { color: var(--error); min-height: 1.2em; margin: 8px 0 0; font-size: 0.95rem; }

.banner { background: var(--good-soft); border: 1.5px solid #b9e2cc; border-radius: var(--radius); padding: 8px 20px 12px; margin-top: 8px; }
.banner.neutral { background: var(--card); border-color: var(--line); }
.summary { background: var(--card); border: 1.5px solid var(--line); border-radius: var(--radius); padding: 12px 16px 12px 32px; }
.next li { margin-bottom: 6px; }
.proto, .dbg-note { font-size: 0.85rem; color: var(--muted); border-left: 3px solid #e0b100; padding-left: 10px; }

.foot { color: var(--muted); font-size: 0.8rem; padding-bottom: 40px; }

#debug {
  max-width: 600px; margin: 0 auto 40px; background: #111827; color: #e5e7eb; font-size: 12px;
  border-radius: 8px; padding: 8px 12px;
}
#debug summary { cursor: pointer; font-weight: 700; }
#debug pre { white-space: pre-wrap; word-break: break-word; }
#debug button { font: inherit; }
.fine { font-size: 0.85rem; color: var(--muted); margin: -8px 0 16px; padding-left: 10px; border-left: 3px solid var(--line); }
.note { font-size: 0.85rem; color: var(--muted); margin: -2px 0 6px; }
.auto-note { font-size: 0.85rem; color: var(--accent); margin: 6px 0 0; }
.monthyear { display: grid; grid-template-columns: 1.4fr 1fr; gap: 10px; }
.money { display: flex; align-items: center; gap: 8px; }
.money span { font-weight: 600; color: var(--muted); }

.ctas { display: grid; gap: 8px; margin: 12px 0 8px; }
.cta { display: block; text-align: center; padding: 15px; border-radius: var(--radius); font-weight: 700; font-size: 1.05rem;
  text-decoration: none; background: var(--accent); color: #fff; }
.cta.secondary-cta { background: var(--card); color: var(--accent); border: 1.5px solid var(--accent); font-weight: 600; }
.center { text-align: center; margin: 0; }

/* Signing screen */
.linklike { background: none; border: 0; padding: 8px 0; font: inherit; color: var(--accent); text-decoration: underline; cursor: pointer; display: block; margin: 8px auto 0; }
.help.small { font-size: 0.88rem; margin-top: 12px; }
.spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid var(--line); border-top-color: var(--accent);
  border-radius: 50%; vertical-align: -2px; margin-right: 6px; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } }
