/* Customer front end — ACS brand palette (memory/context/brand-and-formatting.md) */
:root {
  --navy-900: #0b1f35; --navy-800: #12304f; --navy-700: #1a4270; --navy-600: #23558c;
  --gold: #b8892b; --gold-light: #d9a94a; --gold-text: #906000; --warm: #fff7e8;
  --slate-700: #3d4a58; --slate-500: #61707f; --slate-300: #c3ccd5; --slate-100: #eef1f4; --slate-50: #f7f9fb;

  --bg: var(--slate-50); --surface: #fff; --text: var(--slate-700); --muted: var(--slate-500);
  --heading: var(--navy-900); --line: var(--slate-300); --fill: var(--slate-100);
  --accent: var(--navy-700); --accent-soft: #e8eef6; --on-accent: #fff;
  --b1: #b4473a; --b2: #c58b00; --b3: #23558c; --b4: #2e7d4f;
  --radius: 4px;
  --shadow: 0 1px 2px rgba(11, 31, 53, .06);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #08172a; --surface: #0f2340; --text: #d5dde6; --muted: #9aa8b7; --heading: #f2f5f8;
    --line: #284468; --fill: #15304f; --accent: #6fa3dc; --accent-soft: #15304f; --on-accent: #08172a;
    --warm: #2a2312; --gold-text: #d9a94a; --b1: #e07b6e; --b2: #e0b04a; --b3: #6fa3dc; --b4: #5fbf86;
  }
}
:root[data-theme="dark"] {
  --bg: #08172a; --surface: #0f2340; --text: #d5dde6; --muted: #9aa8b7; --heading: #f2f5f8;
  --line: #284468; --fill: #15304f; --accent: #6fa3dc; --accent-soft: #15304f; --on-accent: #08172a;
  --warm: #2a2312; --gold-text: #d9a94a; --b1: #e07b6e; --b2: #e0b04a; --b3: #6fa3dc; --b4: #5fbf86;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 17px/1.6 "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  min-height: 100vh; display: flex; flex-direction: column;
}
h1, h2, h3 { color: var(--heading); font-weight: 700; letter-spacing: -0.015em; line-height: 1.2; margin: 0 0 12px; }
h1 { font-size: clamp(1.6rem, 4vw, 2.3rem); }
h1:focus { outline: none; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; margin: 0; }
p { margin: 0 0 12px; }
a { color: var(--accent); }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.eyebrow { text-transform: uppercase; letter-spacing: .08em; font-size: .78rem; font-weight: 700; color: var(--gold-text); margin-bottom: 8px; }
.lead { font-size: 1.1rem; color: var(--text); max-width: 46em; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: inherit; font-weight: 600; font-size: 1rem; line-height: 1.2; text-decoration: none; cursor: pointer;
  padding: 12px 20px; min-height: 46px; border-radius: var(--radius); border: 1px solid transparent;
  transition: filter .15s, background .15s;
}
.btn-lg { padding: 15px 26px; font-size: 1.08rem; min-height: 54px; }
.btn-primary { background: var(--navy-700); color: #fff; }
.btn-primary:hover { background: var(--navy-800); }
.btn-gold { background: var(--gold); color: #fff; }
.btn-gold:hover { filter: brightness(1.08); }
.btn-light { background: #fff; color: var(--navy-900); }
.btn-ghost { background: transparent; color: var(--accent); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--accent); }
.btn:focus-visible, .link-btn:focus-visible, .brand:focus-visible { outline: 3px solid var(--gold-light); outline-offset: 2px; }
.link-btn { font: inherit; background: none; border: 0; color: var(--accent); text-decoration: underline; cursor: pointer; padding: 8px 4px; }

/* Header */
.top {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 10px 20px; padding-top: max(10px, env(safe-area-inset-top));
  background: var(--navy-900); border-bottom: 3px solid var(--gold);
}
.brand { display: flex; align-items: center; gap: 10px; background: none; border: 0; padding: 0; cursor: pointer; text-align: left; color: #fff; font: inherit; }
.brand img { border-radius: var(--radius); }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text b { font-size: 1rem; }
.brand-text small { font-size: .74rem; color: var(--slate-300); }
.btn-install { background: var(--gold); color: #fff; min-height: 38px; padding: 8px 14px; font-size: .9rem; }

/* Progress */
.progress { position: sticky; top: 0; z-index: 10; background: var(--surface); border-bottom: 1px solid var(--line); }
.progress-inner { max-width: 820px; margin: 0 auto; padding: 10px 20px 12px; }
.progress-text { display: flex; gap: 10px; font-size: .88rem; margin-bottom: 7px; }
#progressLabel { color: var(--muted); font-weight: 600; white-space: nowrap; }
#progressName { color: var(--heading); font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.progress-track { height: 6px; background: var(--fill); border-radius: 3px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--gold); transition: width .35s ease; }

main { flex: 1; width: 100%; max-width: 820px; margin: 0 auto; padding: 32px 20px 120px; }
body[data-screen="welcome"] main, body[data-screen="results"] main { max-width: 1040px; padding-bottom: 48px; }
main > section { animation: rise .3s ease; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { main > section { animation: none; } .progress-fill { transition: none; } }

/* Welcome */
.hero {
  background: var(--navy-900); color: #fff; border-radius: var(--radius);
  padding: clamp(28px, 5vw, 56px); margin-bottom: 28px; border-left: 6px solid var(--gold);
}
.hero h1 { color: #fff; font-size: clamp(1.9rem, 4.6vw, 2.9rem); max-width: 18em; }
.hero .lead { color: #dbe3ec; }
.hero .eyebrow { color: var(--gold-light); }
.hero-cta { display: flex; flex-wrap: wrap; gap: 12px; margin: 26px 0 30px; }
.hero .btn-primary { background: var(--gold); }
.hero .btn-primary:hover { background: #a57a24; }
.hero .btn-ghost { color: #fff; border-color: rgba(255,255,255,.45); }
.facts { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; border-top: 1px solid rgba(255,255,255,.15); padding-top: 22px; }
.facts b { display: block; color: #fff; font-size: 1.05rem; }
.facts span { color: #b9c6d4; font-size: .9rem; }
.areas, .how { margin-bottom: 28px; }
.area-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.area { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.area b { display: block; color: var(--heading); margin: 6px 0 4px; line-height: 1.3; }
.area p { font-size: .88rem; color: var(--muted); margin: 0; }
.area-n { display: inline-flex; width: 26px; height: 26px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: .85rem; align-items: center; justify-content: center; }
.area-readiness { border-top: 3px solid var(--gold); }
.how-list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 20px 20px 44px; margin: 0; }
.how-list li { margin-bottom: 8px; }
.how-list li:last-child { margin-bottom: 0; }
.how-list b { color: var(--heading); }

/* Question steps */
.step .lead { margin-bottom: 20px; }
.think { background: var(--warm); border-left: 4px solid var(--gold); padding: 12px 16px; border-radius: var(--radius); font-size: .98rem; }
.think b { color: var(--heading); }
.questions { display: flex; flex-direction: column; gap: 16px; }
.qcard {
  margin: 0; padding: 20px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); box-shadow: var(--shadow); transition: border-color .2s;
}
.qcard.answered { border-left: 4px solid var(--b4); }
.qcard.err { border-color: var(--b1); border-left: 4px solid var(--b1); }
.qcard legend { display: contents; }
.qnum { display: inline-flex; width: 26px; height: 26px; border-radius: 50%; background: var(--navy-700); color: #fff; font-size: .82rem; font-weight: 700; align-items: center; justify-content: center; margin-right: 8px; vertical-align: 1px; }
.qcap { font-size: .8rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.qtext { display: block; font-size: 1.12rem; font-weight: 600; color: var(--heading); margin: 8px 0 14px; line-height: 1.4; }
.qchoice .qtext { margin-top: 0; }
.qhint { display: block; font-size: .85rem; color: var(--muted); margin: -10px 0 12px; }
.qerr { display: none; color: var(--b1); font-size: .9rem; font-weight: 600; margin: 10px 0 0; }
.qcard.err .qerr { display: block; }

.rating { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.opt { position: relative; cursor: pointer; }
.opt input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.opt-box {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; text-align: center;
  height: 100%; min-height: 84px; padding: 12px 8px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); font-size: .92rem; line-height: 1.25; color: var(--text); transition: background .15s, border-color .15s;
}
.opt-dot { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--slate-300); flex: none; transition: all .15s; }
.opt:hover .opt-box { border-color: var(--accent); background: var(--accent-soft); }
.opt input:checked + .opt-box { border-color: var(--navy-700); background: var(--navy-700); color: #fff; font-weight: 600; }
.opt input:checked + .opt-box .opt-dot { border-color: #fff; background: var(--gold); box-shadow: inset 0 0 0 3px var(--navy-700); }
.opt input:focus-visible + .opt-box { outline: 3px solid var(--gold-light); outline-offset: 2px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { position: relative; cursor: pointer; }
.chip input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.chip span { display: inline-block; padding: 10px 16px; border: 1px solid var(--line); border-radius: 22px; background: var(--surface); font-size: .95rem; transition: all .15s; }
.chip:hover span { border-color: var(--accent); background: var(--accent-soft); }
.chip input:checked + span { background: var(--navy-700); border-color: var(--navy-700); color: #fff; font-weight: 600; }
.chip input:focus-visible + span { outline: 3px solid var(--gold-light); outline-offset: 2px; }
.other-input {
  margin-top: 12px; width: 100%; font: inherit; font-size: 1rem; color: var(--text); background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 11px 12px;
}
.other-input:focus { outline: 2px solid var(--accent); border-color: var(--accent); }

/* Bottom navigation */
.stepnav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  background: var(--surface); border-top: 1px solid var(--line); box-shadow: 0 -4px 16px rgba(11,31,53,.08);
  padding-bottom: env(safe-area-inset-bottom);
}
.stepnav-inner { max-width: 820px; margin: 0 auto; padding: 12px 20px; display: flex; align-items: center; gap: 12px; }
.nav-hint { flex: 1; text-align: center; font-size: .88rem; color: var(--muted); }
#nextBtn { min-width: 150px; }

.missing { padding-left: 20px; }

/* Results */
.verdict {
  background: var(--navy-900); color: #fff; border-radius: var(--radius); border-left: 6px solid var(--gold);
  padding: clamp(24px, 4vw, 44px); margin-bottom: 24px;
}
.verdict h1 { color: #fff; }
.verdict .eyebrow { color: var(--gold-light); }
.verdict .lead { color: #dbe3ec; }
.verdict-rec { background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.14); border-radius: var(--radius); padding: 14px 16px; margin: 18px 0 14px; max-width: 46em; }
.verdict-rec p { margin: 6px 0 0; font-size: 1.05rem; color: #fff; }
.rec-tag { font-size: .75rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--gold-light); }
.verdict-meta { font-size: .85rem; color: #9fb0c2; margin: 0; }

.rings { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 24px; }
.ring-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; text-align: center; box-shadow: var(--shadow); }
.ring { width: 132px; height: 132px; display: block; margin: 0 auto 10px; }
.ring-bg { fill: none; stroke: var(--fill); stroke-width: 9; }
.ring-fg { fill: none; stroke: var(--line); stroke-width: 9; stroke-linecap: round; transform: rotate(-90deg); transform-origin: 50% 50%; transition: stroke-dashoffset .8s ease; }
.ring-num { font-size: 26px; font-weight: 700; fill: var(--heading); text-anchor: middle; dominant-baseline: middle; }
.ring-of { font-size: 9px; fill: var(--muted); text-anchor: middle; }
[data-band="b1"] .ring-fg { stroke: var(--b1); } [data-band="b2"] .ring-fg { stroke: var(--b2); }
[data-band="b3"] .ring-fg { stroke: var(--b3); } [data-band="b4"] .ring-fg { stroke: var(--b4); }
.ring-label { font-weight: 700; color: var(--heading); }
.ring-cat { font-weight: 600; color: var(--gold-text); margin-bottom: 6px; }
.ring-note { font-size: .86rem; color: var(--muted); margin: 0; }

.block { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; margin-bottom: 24px; box-shadow: var(--shadow); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.grid-2 .block { margin-bottom: 24px; }
.top-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.top-card { border: 1px solid var(--line); border-top: 4px solid var(--gold); border-radius: var(--radius); padding: 16px; }
.top-card p { font-size: .94rem; margin: 10px 0 0; }
.top-head { display: flex; align-items: center; gap: 10px; }
.top-head h3 { flex: 1; line-height: 1.25; }
.top-rank { flex: none; width: 30px; height: 30px; border-radius: 50%; background: var(--navy-900); color: var(--gold-light); font-weight: 700; display: flex; align-items: center; justify-content: center; }
.top-score { flex: none; font-weight: 700; font-size: 1.2rem; font-variant-numeric: tabular-nums; }
.top-score[data-band="b1"] { color: var(--b1); } .top-score[data-band="b2"] { color: var(--b2); }
.top-score[data-band="b3"] { color: var(--b3); } .top-score[data-band="b4"] { color: var(--b4); }
.callout-note { background: var(--warm); border-left: 4px solid var(--gold); padding: 12px 16px; border-radius: var(--radius); margin: 16px 0 0; font-size: .95rem; }

.bars { list-style: none; padding: 0; margin: 0; }
.bars li { margin-bottom: 12px; }
.bar-row { display: flex; justify-content: space-between; gap: 10px; font-size: .95rem; }
.bar-row b { color: var(--heading); font-variant-numeric: tabular-nums; }
.bar { height: 8px; background: var(--fill); border-radius: 4px; overflow: hidden; margin-top: 4px; }
.bar-fill { height: 100%; background: var(--line); border-radius: 4px; }
.bar-fill[data-band="b1"] { background: var(--b1); } .bar-fill[data-band="b2"] { background: var(--b2); }
.bar-fill[data-band="b3"] { background: var(--b3); } .bar-fill[data-band="b4"] { background: var(--b4); }

.checks { list-style: none; padding: 0; margin: 0 0 12px; }
.checks li { display: flex; align-items: center; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.checks li:last-child { border-bottom: 0; }
.check-dot { width: 12px; height: 12px; border-radius: 50%; flex: none; }
.check-name { flex: 1; color: var(--heading); font-weight: 600; font-size: .95rem; }
.check-status { font-size: .85rem; font-weight: 700; }
.check-ok .check-dot { background: var(--b4); } .check-ok .check-status { color: var(--b4); }
.check-part .check-dot { background: var(--b2); } .check-part .check-status { color: var(--b2); }
.check-gap .check-dot { background: var(--b1); } .check-gap .check-status { color: var(--b1); }

.cta {
  display: grid; grid-template-columns: 1.4fr 1fr; gap: 24px; align-items: center;
  background: var(--navy-800); color: #dbe3ec; border-radius: var(--radius); padding: clamp(22px, 4vw, 36px); margin-bottom: 20px;
}
.cta h2 { color: #fff; }
.cta p { margin: 0; }
.cta-actions { display: flex; flex-direction: column; gap: 10px; }
.save-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 24px; }
.rule { font-size: .88rem; color: var(--muted); border-top: 1px solid var(--line); padding-top: 16px; }
.rule b { color: var(--text); }

/* Install dialog */
.install-dialog {
  max-width: 460px; width: calc(100% - 32px); border: 1px solid var(--line); border-top: 4px solid var(--gold);
  border-radius: var(--radius); padding: 24px; background: var(--surface); color: var(--text);
  box-shadow: 0 12px 40px rgba(11, 31, 53, .25);
}
.install-dialog::backdrop { background: rgba(11, 31, 53, .55); }
.install-step { background: var(--fill); border-radius: var(--radius); padding: 12px 14px; margin: 12px 0; }
.install-step b:first-child { color: var(--heading); }
.install-step p { margin: 4px 0 0; font-size: .95rem; }
.install-dialog form { margin: 16px 0 0; text-align: right; }

/* Lead form */
.lead-card {
  background: var(--surface); border: 1px solid var(--line); border-top: 4px solid var(--gold);
  border-radius: var(--radius); padding: clamp(20px, 3.5vw, 32px); margin-bottom: 24px; box-shadow: var(--shadow);
}
.lead-intro p:last-child { max-width: 44em; }
.lead-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; margin: 18px 0 14px; }
.field span { display: block; font-size: .9rem; font-weight: 600; color: var(--heading); margin-bottom: 5px; }
.field i, .consent i { color: var(--b1); font-style: normal; }
.field input {
  width: 100%; font: inherit; font-size: 1rem; color: var(--text); background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 11px 12px;
}
.field input:focus { outline: 2px solid var(--accent); border-color: var(--accent); }
.consent { display: flex; gap: 10px; align-items: flex-start; font-size: .95rem; cursor: pointer; }
.consent input { width: 20px; height: 20px; margin-top: 2px; flex: none; accent-color: var(--navy-700); }
.lead-err { color: var(--b1); font-weight: 600; margin: 12px 0 0; }
.lead-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; margin-top: 18px; }
.lead-actions .btn:disabled { opacity: .7; cursor: wait; }
.bot-field { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.lead-done { border-top-color: var(--b4); }
.lead-done p { margin: 0; }

.foot { text-align: center; font-size: .82rem; color: var(--muted); padding: 24px 20px 32px; border-top: 1px solid var(--line); }
.foot p { margin: 0 0 4px; }
body[data-screen="question"] .foot { padding-bottom: 100px; }

/* Responsive */
@media (max-width: 860px) {
  .area-grid { grid-template-columns: repeat(2, 1fr); }
  .top-cards, .rings { grid-template-columns: 1fr; }
  .ring-card { display: grid; grid-template-columns: 96px 1fr; text-align: left; gap: 4px 16px; align-items: center; }
  .ring { width: 96px; height: 96px; margin: 0; grid-row: span 3; }
  .grid-2, .cta { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  body { font-size: 16px; }
  main { padding: 22px 16px 120px; }
  .top { padding: 8px 16px; }
  .brand-text small { display: none; }
  .progress-inner { padding: 8px 16px 10px; }
  .stepnav-inner { padding: 10px 16px; }
  .nav-hint { font-size: .78rem; }
  #nextBtn { min-width: 0; flex: none; }
  .facts { grid-template-columns: 1fr; gap: 10px; }
  .hero-cta .btn { width: 100%; }
  .qcard { padding: 16px; }
  .rating { grid-template-columns: 1fr; gap: 6px; }
  .opt-box { flex-direction: row; justify-content: flex-start; min-height: 48px; padding: 10px 14px; text-align: left; font-size: .98rem; }
  .save-row .btn { flex: 1 1 100%; }
  .lead-fields { grid-template-columns: 1fr; }
  .lead-actions .btn { width: 100%; }
}
@media (max-width: 420px) {
  .area-grid { grid-template-columns: 1fr; }
}

/* Print: results report only */
@media print {
  body { background: #fff; font-size: 10.5pt; display: block; }
  .top { background: #fff; border-bottom: 2px solid var(--gold); }
  .brand { color: var(--navy-900); }
  .brand-text small { color: var(--slate-500); display: inline; }
  .progress, .stepnav, .btn-install, .no-print, .cta-actions, .foot p:last-child { display: none !important; }
  main { padding: 12px 0; max-width: none; }
  main > section { animation: none; }
  .verdict, .cta { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .verdict, .rings, .ring-card, .block, .top-card, .cta, .checks li, .bars li, p { break-inside: avoid; }
  .ring-fg { transition: none; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; box-shadow: none !important; }
}
