/* Instant Estimate — white-label engine styling. Calm, spacious, one-thing-per
   screen: closer to a good insurance quote flow than a builder's website. The
   client's brand colour drives the accent; everything else stays neutral and
   trustworthy. Designed at 390px first, one-handed. */

:root {
  --brand: #35566B;
  --on-brand: #FFFFFF;
  --bg: #F4F6F8;
  --surface: #FFFFFF;
  --ink: #1C2228;
  --muted: #5D6873;
  --line: #E4E8EC;
  --line-strong: #CBD3DA;
  --ok: #1F8A4C;
  --radius: 14px;
  --focus: #2563EB;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 1.0625rem/1.55 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  min-height: 100vh;
}
img { max-width: 100%; display: block; }
a { color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* Shell */
.shell { max-width: 560px; margin: 0 auto; padding: 0 18px 160px; min-height: 100vh; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 0 8px; position: sticky; top: 0; background: var(--bg); z-index: 5;
}
.biz { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1rem; min-width: 0; }
.biz-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--brand); flex: none; }
.biz-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.back {
  border: 0; background: none; cursor: pointer; color: var(--muted);
  font: 600 0.95rem/1 inherit; font-family: inherit; padding: 10px; margin: -10px;
  display: inline-flex; align-items: center; gap: 6px;
}
.back:hover { color: var(--ink); }

/* Progress dots */
.progress { display: flex; gap: 6px; padding: 6px 0 18px; }
.progress-dot { height: 6px; border-radius: 3px; background: var(--line-strong); flex: 1; transition: background 0.2s; }
.progress-dot.done { background: var(--brand); }
.progress-dot.current { background: var(--brand); opacity: 0.5; }

/* Question */
.step { animation: rise 0.25s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.q-kicker { color: var(--brand); font-weight: 700; font-size: 0.8rem; letter-spacing: 0.08em; text-transform: uppercase; margin: 0 0 8px; }
.q-title { font-size: 1.5rem; line-height: 1.2; font-weight: 800; letter-spacing: -0.01em; margin: 0 0 8px; }
.q-help { color: var(--muted); margin: 0 0 20px; }
.q-help-img { margin: 0 0 20px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }

/* Choice / multi options — big tap targets */
.options { display: grid; gap: 12px; }
.option {
  display: flex; align-items: center; gap: 14px; width: 100%; text-align: left;
  background: var(--surface); border: 2px solid var(--line); border-radius: var(--radius);
  padding: 18px 16px; cursor: pointer; font: inherit; color: inherit;
  min-height: 64px; transition: border-color 0.15s, background 0.15s;
}
.option:hover { border-color: var(--line-strong); }
.option[aria-pressed="true"], .option.selected { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 7%, white); }
.option-check {
  width: 26px; height: 26px; border-radius: 50%; flex: none;
  border: 2px solid var(--line-strong); display: grid; place-items: center;
  color: transparent; font-size: 15px; font-weight: 800;
}
.option.selected .option-check, .option[aria-pressed="true"] .option-check {
  background: var(--brand); border-color: var(--brand); color: var(--on-brand);
}
.multi .option-check { border-radius: 7px; }
.option-body { min-width: 0; }
.option-label { display: block; font-weight: 700; }
.option-help { display: block; color: var(--muted); font-size: 0.9rem; margin-top: 2px; }

/* Number / slider */
.numwrap { background: var(--surface); border: 2px solid var(--line); border-radius: var(--radius); padding: 22px 18px; }
.numrow { display: flex; align-items: baseline; gap: 10px; justify-content: center; }
.numrow input {
  font: 800 2.6rem/1 inherit; font-family: inherit; width: 4.5em; text-align: center;
  border: 0; border-bottom: 3px solid var(--brand); background: none; color: var(--ink);
  padding: 4px 0;
}
.numrow input::-webkit-outer-spin-button, .numrow input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.numrow input[type=number] { -moz-appearance: textfield; }
.numunit { font-size: 1.3rem; font-weight: 700; color: var(--muted); }
.slider { width: 100%; margin-top: 22px; accent-color: var(--brand); height: 36px; }
.numhint { display: flex; justify-content: space-between; color: var(--muted); font-size: 0.85rem; margin-top: 6px; }

/* Primary / secondary buttons */
.btn {
  display: block; width: 100%; border: 0; border-radius: var(--radius); cursor: pointer;
  font: 800 1.1rem/1.2 inherit; font-family: inherit; padding: 17px; text-align: center; text-decoration: none;
  min-height: 58px;
}
.btn-primary { background: var(--brand); color: var(--on-brand); margin-top: 20px; }
.btn-primary:hover { filter: brightness(0.94); }
.btn-ghost { background: none; box-shadow: inset 0 0 0 2px var(--line-strong); color: var(--ink); font-weight: 700; }
.btn-skip { background: none; color: var(--muted); font-weight: 600; box-shadow: none; margin-top: 4px; }

/* Running estimate bar (pinned, thumb reach) */
.runbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 6;
  background: var(--surface); border-top: 1px solid var(--line);
  padding: 12px 18px calc(12px + env(safe-area-inset-bottom));
  box-shadow: 0 -6px 20px rgba(20, 30, 40, 0.06);
}
.runbar-inner { max-width: 560px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.runbar-label { color: var(--muted); font-size: 0.8rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; }
.runbar-range { font-size: 1.5rem; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.runbar-working { border: 0; background: none; color: var(--brand); font: 700 0.9rem/1 inherit; font-family: inherit; cursor: pointer; padding: 8px; white-space: nowrap; }

/* Result screen */
.result { animation: rise 0.3s ease both; }
.result-badge { display: inline-block; color: var(--brand); background: color-mix(in srgb, var(--brand) 10%, white); font-weight: 700; font-size: 0.78rem; letter-spacing: 0.08em; text-transform: uppercase; padding: 5px 10px; border-radius: 5px; }
.result-range { font-size: clamp(2.4rem, 11vw, 3.4rem); font-weight: 800; letter-spacing: -0.02em; margin: 14px 0 4px; font-variant-numeric: tabular-nums; }
.result-sub { color: var(--muted); margin: 0 0 22px; }
.result-sub strong { color: var(--ink); }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; }
.card h2 { margin: 0 0 12px; font-size: 1.05rem; }
.incexc { display: grid; gap: 6px; list-style: none; margin: 0; padding: 0; }
.incexc li { display: flex; gap: 10px; align-items: flex-start; font-size: 0.98rem; }
.incexc .mark { flex: none; font-weight: 800; }
.inc .mark { color: var(--ok); }
.exc .mark { color: var(--muted); }
.exc li { color: var(--muted); }

/* Working / breakdown */
.working { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); margin-bottom: 16px; overflow: hidden; }
.working summary { cursor: pointer; padding: 16px 18px; font-weight: 700; list-style: none; display: flex; justify-content: space-between; align-items: center; }
.working summary::after { content: "＋"; color: var(--muted); }
.working[open] summary::after { content: "－"; }
.working-body { padding: 0 18px 16px; }
.wline { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-top: 1px solid var(--line); }
.wline:first-child { border-top: 0; }
.wline-label { color: var(--ink); }
.wline-detail { color: var(--muted); font-size: 0.85rem; }
.wline-value { font-variant-numeric: tabular-nums; white-space: nowrap; font-weight: 600; }
.wline.factor .wline-value { color: var(--brand); }
.wline.total { border-top: 2px solid var(--line-strong); font-weight: 800; margin-top: 4px; padding-top: 12px; }
.wline.sub { color: var(--muted); }

.disclaimer { color: var(--muted); font-size: 0.92rem; background: color-mix(in srgb, var(--brand) 5%, white); border-radius: var(--radius); padding: 16px; margin-bottom: 20px; }

/* CTA */
.cta-phone {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  background: var(--brand); color: var(--on-brand); text-decoration: none;
  border-radius: var(--radius); padding: 18px; font-size: 1.25rem; font-weight: 800;
  font-variant-numeric: tabular-nums; margin-bottom: 12px;
}
.cta-or { text-align: center; color: var(--muted); font-size: 0.9rem; margin: 14px 0; }
.field { margin-bottom: 12px; }
.field label { display: block; font-weight: 600; font-size: 0.92rem; margin-bottom: 6px; }
.field input {
  width: 100%; min-height: 52px; border: 1px solid var(--line-strong); border-radius: 10px;
  background: var(--surface); font: inherit; padding: 12px;
}
.form-done { text-align: center; padding: 10px; }
.form-done h3 { color: var(--brand); margin: 0 0 6px; }
.form-done p { color: var(--muted); margin: 0; }
.result-actions { display: flex; gap: 10px; margin-top: 8px; }
.result-actions .btn { margin-top: 0; }

/* Dev warnings */
.devwarn { background: #2A2410; color: #FFD97A; border: 1px solid #4A3F14; border-radius: 10px; padding: 12px 14px; margin: 12px 0; font-size: 0.9rem; }
.devwarn strong { display: block; margin-bottom: 4px; }

/* Trade picker (landing when no ?trade) */
.picker { padding-top: 8px; }
.picker h1 { font-size: 1.7rem; margin: 0 0 6px; }
.picker p.lede { color: var(--muted); margin: 0 0 22px; }
.picker-grid { display: grid; gap: 12px; }
.picker-card {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--surface); border: 2px solid var(--line); border-radius: var(--radius);
  padding: 20px 18px; text-decoration: none; font-weight: 700; font-size: 1.15rem; min-height: 68px;
}
.picker-card:hover { border-color: var(--brand); }
.picker-card .arrow { color: var(--brand); font-size: 1.3rem; }
.picker-note { color: var(--muted); font-size: 0.85rem; margin-top: 20px; }

.page-error { text-align: center; padding: 60px 16px; }
.boot-msg { padding: 60px 0; color: var(--muted); text-align: center; }
.mt16 { margin-top: 16px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
