/* How Much Longer: calm, plain and readable. Families arrive here worried;
   nothing should feel flashy or salesy. */
:root {
  --bg: #f7f6f3; --surface: #ffffff; --surface-2: #f0eee9; --border: #dedad2;
  --text: #22211f; --muted: #6a675f; --accent: #2f5d8a; --accent-text: #ffffff;
  --accent-soft: #e4ecf4; --ok: #3d7a3a; --error: #b3261e; --error-soft: #fbe9e7;
  --ad: #8a6a1f; --ad-soft: #fbf5e6;
  --radius: 10px; --shadow: 0 1px 2px rgba(0,0,0,.05);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #18191b; --surface: #222326; --surface-2: #2a2b2f; --border: #3a3b40;
    --text: #ebeae6; --muted: #a3a19a; --accent: #7fb0e0; --accent-text: #10161c;
    --accent-soft: #233243; --ok: #8cc488; --error: #f2938b; --error-soft: #3a2220;
    --ad: #e0c27a; --ad-soft: #332c1c; --shadow: none;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); }
img { max-width: 100%; }
.wrap { max-width: 980px; margin: 0 auto; padding: 0 16px; }
.narrow { max-width: 720px; }
.tiny { max-width: 440px; }

/* Header and footer */
header.site { background: var(--surface); border-bottom: 1px solid var(--border); }
header.site .wrap { display: flex; align-items: center; justify-content: space-between;
  gap: 12px; min-height: 60px; flex-wrap: wrap; }
.brand { font-weight: 700; font-size: 19px; color: var(--text); text-decoration: none; letter-spacing: -.01em; }
.brand span { color: var(--accent); }
nav.main { display: flex; gap: 4px 16px; align-items: center; flex-wrap: wrap; font-size: 15px; }
nav.main a { color: var(--muted); text-decoration: none; }
nav.main a:hover { color: var(--text); }
nav.main a.btn, nav.main a.btn:hover { color: var(--accent-text); }
nav.main form { margin: 0; }
footer.site { margin-top: 64px; padding: 28px 0 40px; border-top: 1px solid var(--border);
  color: var(--muted); font-size: 14px; }
footer.site .links { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-bottom: 10px; }
footer.site a { color: var(--muted); }

main { padding: 28px 0 0; }
h1 { font-size: 30px; line-height: 1.2; margin: 0 0 12px; letter-spacing: -.01em; }
h2 { font-size: 21px; margin: 32px 0 10px; }
h3 { font-size: 17px; margin: 22px 0 8px; }
p.lede { font-size: 18px; color: var(--muted); margin: 0 0 22px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }

/* Buttons and forms */
.btn, button.btn { display: inline-block; padding: 11px 20px; border-radius: 8px; border: 1px solid transparent;
  background: var(--accent); color: var(--accent-text); font: inherit; font-weight: 600; text-decoration: none;
  cursor: pointer; line-height: 1.2; }
.btn:hover { filter: brightness(1.07); }
.btn.secondary { background: transparent; color: var(--text); border-color: var(--border); font-weight: 500; }
.btn.danger { background: var(--error); color: #fff; }
.btn.small { padding: 7px 12px; font-size: 14px; }
button.link { background: none; border: 0; padding: 0; color: var(--muted); font: inherit; cursor: pointer; }
button.link:hover { color: var(--text); }
label { display: block; font-size: 14px; color: var(--muted); margin: 0 0 5px; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=number],
input[type=tel], input[type=url], select, textarea {
  width: 100%; padding: 10px 11px; border: 1px solid var(--border); border-radius: 7px;
  background: var(--surface); color: var(--text); font: inherit; font-size: 15px; }
textarea { min-height: 110px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
.field { margin-bottom: 14px; }
.check { display: flex; gap: 9px; align-items: flex-start; margin: 0 0 12px; color: var(--text); font-size: 15px; }
.check input { margin-top: 4px; flex: none; }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > * { flex: 1 1 140px; min-width: 0; }
.hp { position: absolute; left: -9999px; }

/* Cards and panels */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px; margin-bottom: 18px; box-shadow: var(--shadow); }
.card h2:first-child, .card h3:first-child { margin-top: 0; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }

/* Messages */
.flash { padding: 11px 14px; border-radius: 8px; margin: 0 0 16px; font-size: 15px;
  background: var(--accent-soft); border: 1px solid var(--accent); }
.flash.error { background: var(--error-soft); border-color: var(--error); color: var(--error); }
.notice { padding: 14px 16px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--border);
  margin: 0 0 18px; font-size: 15px; }

/* Landing page */
.hero { padding: 26px 0 8px; }
.hero h1 { font-size: 38px; max-width: 640px; }
.hero .cta { display: flex; gap: 12px; flex-wrap: wrap; margin: 6px 0 10px; }
.steps { counter-reset: step; }
.steps .card { position: relative; padding-left: 62px; }
.steps .card::before { counter-increment: step; content: counter(step); position: absolute; left: 20px; top: 20px;
  width: 30px; height: 30px; border-radius: 50%; background: var(--accent-soft); color: var(--accent);
  display: grid; place-items: center; font-weight: 700; }
.state-list { columns: 3 200px; column-gap: 24px; padding: 0; list-style: none; margin: 0; }
.state-list li { break-inside: avoid; padding: 3px 0; }

/* Pricing */
.price { font-size: 34px; font-weight: 700; margin: 4px 0 2px; }
.price small { font-size: 16px; font-weight: 400; color: var(--muted); }
ul.ticks { padding: 0; list-style: none; margin: 12px 0 18px; }
ul.ticks li { padding: 4px 0 4px 26px; position: relative; }
ul.ticks li::before { content: "\2713"; position: absolute; left: 2px; color: var(--ok); font-weight: 700; }

/* Guides */
.guide h1 { font-size: 28px; }
.guide table { border-collapse: collapse; width: 100%; margin: 12px 0; font-size: 15px; display: block; overflow-x: auto; }
.guide th, .guide td { border: 1px solid var(--border); padding: 7px 9px; text-align: left; vertical-align: top; }
.guide hr { border: 0; border-top: 1px solid var(--border); margin: 26px 0; }

/* "Check if the state has an official estimate" box. */
.official { border-left: 4px solid var(--accent); margin: 18px 0; }
.official h3 { margin-top: 0; }
.official p { margin: 0 0 8px; }

/* Sponsor box: always labeled as an ad. */
.sponsor { border: 1px solid var(--ad); background: var(--ad-soft); border-radius: var(--radius); padding: 14px 16px;
  margin: 18px 0; font-size: 15px; }
.sponsor .ad-label { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--ad);
  font-weight: 700; margin-bottom: 4px; }
.sponsor .firm { font-weight: 700; font-size: 17px; }

/* Tables (saved list, admin) */
table.list { width: 100%; border-collapse: collapse; font-size: 15px; }
table.list th, table.list td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--border); vertical-align: top; }
table.list th { color: var(--muted); font-weight: 500; font-size: 13px; }
.table-scroll { overflow-x: auto; }
.stat { font-size: 28px; font-weight: 700; }
.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; background: var(--surface-2);
  border: 1px solid var(--border); color: var(--muted); }
.badge.ok { color: var(--ok); border-color: var(--ok); }

/* Calculator */
.mode-switch { display: inline-flex; border: 1px solid var(--border); border-radius: 999px; overflow: hidden; background: var(--surface); }
.mode-switch label { margin: 0; }
.mode-switch input { position: absolute; opacity: 0; pointer-events: none; }
.mode-switch span { display: block; padding: 6px 14px; font-size: 14px; color: var(--muted); cursor: pointer; border-right: 1px solid var(--border); }
.mode-switch label:last-child span { border-right: 0; }
.mode-switch input:checked + span { background: var(--accent); color: var(--accent-text); }
.mode-switch input:focus-visible + span { outline: 2px solid var(--text); outline-offset: -2px; }
.mode-bar { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; margin: 0 0 16px; }
.mode-bar p { flex: 1 1 240px; margin: 0; font-size: 14px; color: var(--muted); }
.incident-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--border); }
.incident-row input[type=date] { flex: 0 0 160px; width: 160px; }
/* A long incident description must not stretch the row past the screen. */
.incident-row select { flex: 1 1 220px; width: 0; min-width: 0; max-width: 100%; text-overflow: ellipsis; }
select { max-width: 100%; }
.incident-row .controls { flex: 1 1 100%; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.incident-row .controls .btn { margin-left: auto; }
.incident-row input[type=number] { flex: 0 0 140px; width: 140px; }
.incident-row input[type=number]:disabled { opacity: .45; }
.incident-row .hypo { display: flex; gap: 6px; align-items: center; margin: 0; color: var(--text); font-size: 14px; }
#result .line { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--border); }
#result .line .k { color: var(--muted); }
#result .line .v { text-align: right; font-weight: 600; }
#result .big { font-size: 26px; font-weight: 700; margin: 2px 0 10px; }
#result ul.notes { padding-left: 20px; font-size: 15px; }
#result ul.notes li { margin-bottom: 8px; }
.hypo-banner { background: var(--accent-soft); border: 1px solid var(--accent); border-radius: 8px; padding: 10px 12px; margin-bottom: 12px; font-size: 14px; }
table.compare { width: 100%; border-collapse: collapse; margin: 8px 0; font-size: 15px; }
table.compare th, table.compare td { padding: 7px 4px; border-bottom: 1px solid var(--border); text-align: right; }
table.compare th:first-child { text-align: left; color: var(--muted); font-weight: 400; }
.save-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-top: 16px; }
.save-row .field { flex: 1 1 220px; margin: 0; }
[hidden] { display: none !important; }

@media (max-width: 560px) {
  h1 { font-size: 26px; }
  .hero h1 { font-size: 30px; }
  .card { padding: 18px; }
  .incident-row input[type=date] { flex: 1 1 100%; width: 100%; }
}
@media print {
  header.site, footer.site, .no-print, .mode-bar, #inputs { display: none !important; }
  body { background: #fff; color: #000; }
  .card { border: 0; box-shadow: none; padding: 0; }
}
