/* OwnMiles design system + qualification funnel.
   Register: product. Audience: rideshare drivers on cheap Androids, cellular, ESL,
   often outdoors in bright light. Priorities: legibility, trust, speed, one-handed use.

   Palette rationale: the seed suggested violet (Linear-adjacent SaaS lane) — rejected as
   the templated-SaaS anti-reference. Primary is a deep pine GREEN: ownership/equity/"go",
   legible cross-culturally for ESL, and the opposite of predatory buy-here-pay-here red.
   Surface is pure white (mood lives in the brand color, not a tinted bg). System fonts
   only (Roboto ships native on Android) = zero webfont download. */

:root {
  /* color — OKLCH */
  --bg: oklch(1 0 0);                       /* pure white */
  --surface: oklch(0.985 0.006 155);        /* barely green-tinted panel */
  --surface-2: oklch(0.965 0.008 155);
  --ink: oklch(0.24 0.02 155);              /* body text — ~13:1 on white */
  --muted: oklch(0.44 0.02 155);            /* secondary text — ≥4.5:1 on white */
  --border: oklch(0.9 0.008 155);
  --primary: oklch(0.42 0.09 155);          /* deep pine green */
  --primary-strong: oklch(0.36 0.10 155);   /* hover/active */
  --primary-ink: oklch(1 0 0);              /* text on primary */
  --primary-wash: oklch(0.95 0.03 155);     /* selected chip bg */
  --accent-money: oklch(0.45 0.13 150);     /* positive $ figures (equity green, text-safe) */
  --danger: oklch(0.47 0.16 25);            /* decline/flag — paired with icon+text, never color alone */
  --danger-wash: oklch(0.96 0.03 25);
  --focus: oklch(0.55 0.14 155);

  /* type — fixed rem, product register; base bumped to 17px for readability/ESL */
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --t-xs: 0.8125rem;  --t-sm: 0.9375rem;  --t-base: 1.0625rem;
  --t-lg: 1.25rem;    --t-xl: 1.5rem;     --t-2xl: 1.875rem;

  /* space + radius + z */
  --sp-1: 0.25rem; --sp-2: 0.5rem; --sp-3: 0.75rem; --sp-4: 1rem;
  --sp-5: 1.5rem;  --sp-6: 2rem;  --sp-8: 3rem;
  --r: 0.75rem; --r-sm: 0.5rem; --r-pill: 999px;
  --z-sticky: 100; --z-toast: 400;
  --tap: 3.25rem;                            /* 52px min touch target */
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--font); font-size: var(--t-base); line-height: 1.55;
  text-rendering: optimizeLegibility; -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { line-height: 1.2; text-wrap: balance; margin: 0 0 var(--sp-3); }
h1 { font-size: var(--t-2xl); letter-spacing: -0.02em; }
h2 { font-size: var(--t-xl); letter-spacing: -0.01em; }
p { margin: 0 0 var(--sp-4); text-wrap: pretty; }
a { color: var(--primary-strong); }

/* layout shell — single column, thumb zone at the bottom */
.shell { max-width: 32rem; margin: 0 auto; min-height: 100dvh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: var(--z-sticky); background: var(--bg);
  border-bottom: 1px solid var(--border); padding: var(--sp-3) var(--sp-4);
  display: flex; align-items: center; gap: var(--sp-3);
}
.brand { font-weight: 700; letter-spacing: -0.01em; color: var(--ink); }
.brand b { color: var(--primary); }
.progress { flex: 1; height: 6px; border-radius: var(--r-pill); background: var(--surface-2); overflow: hidden; }
/* fill animates transform, not width, to avoid layout thrash; JS sets --fill 0..1 */
.progress > i { display: block; height: 100%; width: 100%; transform-origin: left; transform: scaleX(var(--fill, 0)); background: var(--primary); border-radius: inherit; transition: transform .28s cubic-bezier(.22,1,.36,1); }
.stepcount { font-size: var(--t-xs); color: var(--muted); font-variant-numeric: tabular-nums; }

.main { flex: 1; padding: var(--sp-5) var(--sp-4) 0; }
.reassure { color: var(--muted); font-size: var(--t-sm); margin-bottom: var(--sp-5); }
.reassure b { color: var(--ink); font-weight: 600; }

/* steps — only one visible; no-JS shows all (progressive enhancement) */
.step { display: none; animation: fade .25s ease both; }
.step[data-active] { display: block; }
.js-off .step { display: block; margin-bottom: var(--sp-8); } /* fallback set by <noscript>/default */
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .step { animation: none; }
  .progress > i { transition: none; }
}

fieldset { border: 0; margin: 0 0 var(--sp-5); padding: 0; }
legend { font-size: var(--t-lg); font-weight: 650; padding: 0; margin-bottom: var(--sp-1); color: var(--ink); }
.hint { color: var(--muted); font-size: var(--t-sm); margin: 0 0 var(--sp-4); }
label { display: block; font-weight: 600; margin-bottom: var(--sp-2); }

/* text inputs — big, high-contrast */
input[type=text], input[type=email], input[type=tel], input[type=number], select {
  width: 100%; min-height: var(--tap); padding: var(--sp-3) var(--sp-4);
  font-size: var(--t-base); color: var(--ink); background: var(--bg);
  border: 1.5px solid var(--border); border-radius: var(--r); appearance: none;
}
input::placeholder { color: var(--muted); } /* muted meets 4.5:1 */
input:focus-visible, select:focus-visible, .choice:focus-within, button:focus-visible {
  outline: 3px solid var(--focus); outline-offset: 2px; border-color: var(--primary);
}
.prefix { position: relative; }
.prefix > span { position: absolute; left: var(--sp-4); top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.prefix > input { padding-left: 2rem; }

/* choice cards — big tap targets for single/multi select */
.choices { display: grid; gap: var(--sp-3); }
.choices.cols-2 { grid-template-columns: 1fr 1fr; }
.choice {
  position: relative; display: flex; align-items: center; gap: var(--sp-3);
  min-height: var(--tap); padding: var(--sp-3) var(--sp-4);
  border: 1.5px solid var(--border); border-radius: var(--r); background: var(--bg);
  font-weight: 600; cursor: pointer;
}
.choice input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.choice .mark { width: 1.25rem; height: 1.25rem; border-radius: 50%; border: 2px solid var(--border); flex: none; display: grid; place-items: center; }
.choice.multi .mark { border-radius: 6px; }
.choice:has(input:checked) { border-color: var(--primary); background: var(--primary-wash); }
.choice:has(input:checked) .mark { border-color: var(--primary); background: var(--primary); }
.choice:has(input:checked) .mark::after { content: ""; width: 0.55rem; height: 0.55rem; border-radius: inherit; background: var(--primary-ink); }
.choice small { display: block; font-weight: 500; color: var(--muted); font-size: var(--t-xs); }

/* the rental-bleed callout — the priority-segment hook */
.bleed { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: var(--sp-4); margin-bottom: var(--sp-4); }
.bleed .fig { font-size: var(--t-xl); font-weight: 700; color: var(--accent-money); font-variant-numeric: tabular-nums; }

/* down-payment slider — LTV education step */
input[type=range] { width: 100%; margin: var(--sp-2) 0; -webkit-appearance: none; appearance: none; background: transparent; min-height: var(--tap); }
input[type=range]::-webkit-slider-runnable-track { height: 6px; border-radius: var(--r-pill); background: var(--surface-2); }
input[type=range]::-moz-range-track { height: 6px; border-radius: var(--r-pill); background: var(--surface-2); }
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 1.75rem; height: 1.75rem; margin-top: -0.6rem;
  border-radius: 50%; background: var(--primary); border: 3px solid var(--bg); box-shadow: 0 1px 3px oklch(0 0 0 / 0.25); cursor: pointer;
}
input[type=range]::-moz-range-thumb {
  width: 1.75rem; height: 1.75rem; border-radius: 50%; background: var(--primary); border: 3px solid var(--bg); box-shadow: 0 1px 3px oklch(0 0 0 / 0.25); cursor: pointer;
}
input[type=range]:focus-visible { outline: 3px solid var(--focus); outline-offset: 4px; border-radius: var(--r-pill); }

/* error text — paired with the field, never color-only */
.err { color: var(--danger); font-size: var(--t-sm); font-weight: 600; margin-top: var(--sp-2); display: none; }
.err::before { content: "! "; font-weight: 700; }
[data-invalid] .err { display: block; }
[data-invalid] input, [data-invalid] select { border-color: var(--danger); background: var(--danger-wash); }

/* consent — separate, unbundled checkboxes */
.consent { display: grid; gap: var(--sp-3); }
.consent .choice { align-items: flex-start; font-weight: 500; }
.consent .req { color: var(--muted); font-size: var(--t-xs); }

/* actions — pinned in the thumb zone */
.actions {
  position: sticky; bottom: 0; background: linear-gradient(to top, var(--bg) 70%, transparent);
  padding: var(--sp-4); display: flex; gap: var(--sp-3); align-items: center;
}
.btn {
  min-height: var(--tap); padding: 0 var(--sp-5); border-radius: var(--r); border: 1.5px solid transparent;
  font: inherit; font-weight: 700; font-size: var(--t-base); cursor: pointer; flex: 1;
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  transition: background .15s ease, transform .05s ease;
}
.btn-primary { background: var(--primary); color: var(--primary-ink); }
.btn-primary:hover { background: var(--primary-strong); }
.btn-primary:active { transform: translateY(1px); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--border); flex: 0 0 auto; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* confirmation / done */
.done { padding: var(--sp-6) var(--sp-4); text-align: center; }
.done .badge { width: 4rem; height: 4rem; margin: 0 auto var(--sp-4); border-radius: 50%; background: var(--primary-wash); color: var(--primary); display: grid; place-items: center; }
.footer { padding: var(--sp-5) var(--sp-4); color: var(--muted); font-size: var(--t-xs); text-align: center; }
.footer b { color: var(--ink); }
