:root {
  --bg: #ffffff;
  --fg: #1c1f23;
  --muted: #5f6670;
  --line: #d9dde2;
  --accent: #2f5d8a;
  --on-accent: #ffffff;
  --danger: #a3322a;
  --panel: #ffffff;
  --soft: #eef2f6;
  --ok-bg: #e6f4ea;
  --ok-fg: #1d5a2c;
  --ok-line: #9fd2ad;
  --wait-bg: #fff3d6;
  --wait-fg: #5c3c00;
  --wait-line: #e3c27a;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15171a;
    --fg: #e9ecef;
    --muted: #a3aab3;
    --line: #2e3238;
    --accent: #8db6de;
    --on-accent: #10161c;
    --danger: #e38a82;
    --panel: #1d2024;
    --soft: #262a30;
    --ok-bg: #16301e;
    --ok-fg: #a6dcb4;
    --ok-line: #2e5a3a;
    --wait-bg: #33290f;
    --wait-fg: #f1d38f;
    --wait-line: #6b5420;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html, body { margin: 0; background: var(--bg); color: var(--fg); }
body {
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
.skip { position: absolute; left: -9999px; top: 8px; padding: 8px 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; z-index: 20; }
.skip:focus { left: 8px; }
.bar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px max(16px, env(safe-area-inset-right)) 12px max(16px, env(safe-area-inset-left));
  border-bottom: 1px solid var(--line);
}
.wordmark { font-weight: 600; }
main { max-width: 480px; margin: 0 auto; padding: 24px 16px 48px; }
h1 { font-size: 1.5rem; margin: 0 0 8px; }
h2 { font-size: 1.1rem; margin: 32px 0 8px; }
.muted { color: var(--muted); }
label { display: block; margin: 16px 0 6px; font-weight: 500; }
/* 16px minimum stops mobile browsers zooming on focus. */
input, textarea, select {
  width: 100%; font: inherit; font-size: 16px; padding: 12px; min-height: 48px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: inherit;
}
input[type="date"], input[type="time"] { min-height: 48px; -webkit-appearance: none; appearance: none; }
select {
  -webkit-appearance: none; appearance: none; padding-right: 40px;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 20px) 50%, calc(100% - 14px) 50%;
  background-size: 6px 6px, 6px 6px; background-repeat: no-repeat;
}
input:focus-visible, textarea:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible {
  outline: 3px solid var(--accent); outline-offset: 2px;
}
input[aria-invalid="true"] { border-color: var(--danger); }
textarea { resize: vertical; }
button, .btn-link {
  display: inline-flex; align-items: center; justify-content: center; text-decoration: none;
  font: inherit; font-size: 16px; min-height: 44px; margin-top: 16px; padding: 10px 18px;
  border: 0; border-radius: 8px; background: var(--accent); color: var(--on-accent); cursor: pointer;
  touch-action: manipulation;
}
button:disabled { opacity: 0.6; cursor: default; }
button.link {
  background: none; color: var(--accent); padding: 0; margin: 0; min-height: 44px;
  text-decoration: underline;
}
button.link.inline { min-height: 0; display: inline; font-size: inherit; }
button.link.danger { color: var(--danger); }
.msg { color: var(--danger); }
[hidden] { display: none !important; }

/* Founders' build assistant: a glowing button beside the wordmark, panel drops below */
.bar-left { display: flex; align-items: center; gap: 12px; }
.ba { position: fixed; left: 16px; top: 64px; z-index: 10; }
.ba-toggle {
  width: 40px; height: 40px; min-height: 40px; margin: 0; padding: 0; border-radius: 20px;
  display: flex; align-items: center; justify-content: center;
  animation: ba-glow 2.4s ease-in-out infinite;
}
.ba-toggle[aria-expanded="true"] { animation: none; box-shadow: 0 0 0 3px var(--accent); }
@keyframes ba-glow {
  0%, 100% { box-shadow: 0 0 4px 1px var(--accent); }
  50% { box-shadow: 0 0 16px 6px var(--accent); }
}
@media (prefers-reduced-motion: reduce) {
  .ba-toggle { animation: none; box-shadow: 0 0 10px 3px var(--accent); }
}
.ba-panel {
  width: min(360px, calc(100vw - 32px)); max-height: min(560px, calc(100vh - 100px));
  display: flex; flex-direction: column; padding: 16px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.18);
}
.ba-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.ba-head h2 { margin: 0; font-size: 1.05rem; }
.ba-sub { margin: 2px 0 0; font-size: 14px; color: var(--muted); }
.ba-log { list-style: none; margin: 12px 0 0; padding: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; flex: 1; min-height: 0; }
.ba-log li { padding: 10px 12px; border-radius: 10px; font-size: 15px; white-space: pre-wrap; }
.ba-you { background: var(--accent); color: var(--on-accent); align-self: flex-end; max-width: 85%; }
.ba-ai { background: var(--soft); align-self: flex-start; max-width: 90%; }
.ba-form label { margin-top: 12px; font-size: 14px; }
.ba-form button { margin-top: 8px; width: 100%; }
.ba-foot { margin: 8px 0 0; font-size: 13px; color: var(--muted); }

/* Guided dashboard */
body[data-view="view-dashboard"] main { max-width: 1120px; }
.small { font-size: 14px; }
.dash-top { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 12px; }
.dash-top h1 { font-size: 1.8rem; overflow-wrap: anywhere; }
.dash-lede { margin: 0; max-width: 560px; }
.dash-progress-wrap { flex: 0 1 280px; min-width: 220px; }
.dash-progress-head { display: flex; justify-content: space-between; font-size: 14px; margin-bottom: 8px; }
.dash-progress { height: 10px; border-radius: 5px; background: var(--line); overflow: hidden; }
.dash-progress-bar { height: 10px; width: 0; border-radius: 5px; background: var(--accent); transition: width 0.3s; }
.dash-summary { margin: 0 0 20px; padding: 12px 14px; border-radius: 10px; background: var(--soft); font-size: 15px; outline: none; }
.dash-body { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.dash-side { flex: 1 1 280px; min-width: 0; }
.dash-steps { display: flex; flex-direction: column; gap: 8px; }
.steps-toggle { display: none; }
.step {
  display: flex; align-items: center; gap: 12px; width: 100%; margin: 0; padding: 12px 14px; min-height: 60px;
  background: var(--panel); color: var(--fg); border: 1px solid var(--line); border-radius: 12px; text-align: left;
  justify-content: flex-start;
}
.step-on { border: 2px solid var(--accent); padding: 11px 13px; }
.step-num {
  flex: none; width: 32px; height: 32px; border-radius: 16px; display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px; background: var(--soft);
}
.step-num-wait { background: var(--wait-bg); color: var(--wait-fg); border: 1px solid var(--wait-line); }
.step-num-part { background: var(--soft); border: 2px solid var(--accent); }
.step-num-done { background: var(--ok-bg); color: var(--ok-fg); border: 1px solid var(--ok-line); }
.step-txt { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.step-title { font-weight: 600; font-size: 15px; }
.step-status { font-size: 13px; color: var(--muted); }
.dash-panel {
  flex: 999 1 520px; min-width: 0; padding: 28px; background: var(--panel);
  border: 1px solid var(--line); border-radius: 14px; outline: none; scroll-margin-top: 12px;
}
.eyebrow { margin: 0 0 6px; font-size: 13px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--accent); }
.panel-title { margin: 0 0 8px; font-size: 1.5rem; }
.panel-intro { margin: 0 0 12px; color: var(--muted); }
.save-state { margin: 0 0 8px; font-size: 13px; color: var(--muted); min-height: 1.5em; }
.save-state.ok { color: var(--ok-fg); }
.save-state.bad { color: var(--danger); font-weight: 600; }
.note { margin: 0 0 12px; padding: 12px 14px; border-radius: 10px; background: var(--soft); font-size: 14px; }

/* Questions */
.field { margin: 0; padding: 0; border: 0; min-width: 0; }
.q { display: block; margin: 20px 0 6px; font-weight: 600; padding: 0; }
.opt { font-weight: 400; color: var(--muted); font-size: 14px; }
.hint { margin: -2px 0 8px; font-size: 14px; color: var(--muted); }
.field-err { margin: 6px 0 0; font-size: 14px; color: var(--danger); }
.choices { display: flex; flex-direction: column; gap: 8px; margin-top: 20px; }
/* A legend ignores its own top margin, so the fieldset above carries the space. */
.choices legend.q { margin: 0 0 8px; }
.choice {
  display: flex; align-items: flex-start; gap: 12px; margin: 0; padding: 12px 14px; min-height: 48px;
  border: 1px solid var(--line); border-radius: 10px; font-weight: 400; cursor: pointer;
}
.choice:has(input:checked) { border-color: var(--accent); background: var(--soft); }
.choice input { width: 22px; height: 22px; min-height: 0; margin: 1px 0 0; padding: 0; flex: none; accent-color: var(--accent); }
.choice.check { margin-top: 16px; }
.prefixed { display: flex; align-items: stretch; }
.prefix { display: flex; align-items: center; padding: 0 12px; border: 1px solid var(--line); border-right: 0; border-radius: 8px 0 0 8px; background: var(--soft); }
.prefixed input { border-radius: 0 8px 8px 0; }
.group { margin: 24px 0 0; padding: 4px 16px 18px; border: 1px solid var(--line); border-radius: 12px; min-width: 0; }
.group-title { font-weight: 700; font-size: 1.05rem; padding: 0 6px; margin: 0; }
.group .choice.check { margin-top: 10px; }
.list { margin-top: 24px; }
.list h3 { padding: 0; }
.list-empty { margin: 6px 0 0; }
.list-item { margin-top: 12px; padding: 4px 16px 16px; border: 1px solid var(--line); border-radius: 12px; }
.list-item-head { display: flex; justify-content: space-between; align-items: center; margin-top: 4px; }
.add { margin-top: 12px; }
.checklist { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.doc { margin: 0; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; min-width: 0; }
.doc-title { font-weight: 600; padding: 0; }
.seg { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.seg-opt {
  display: flex; align-items: center; gap: 8px; margin: 0; padding: 8px 12px; min-height: 44px;
  border: 1px solid var(--line); border-radius: 999px; font-weight: 400; font-size: 15px; cursor: pointer;
}
.seg-opt:has(input:checked) { border-color: var(--accent); background: var(--soft); font-weight: 600; }
.seg-opt input { width: 18px; height: 18px; min-height: 0; margin: 0; padding: 0; accent-color: var(--accent); }

/* Forwarding and document guidance */
.guide { margin: 16px 0 0; }
.banner {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; margin-bottom: 16px; padding: 14px 16px;
  border-radius: 10px; font-size: 14px;
}
.banner strong { font-size: 15px; }
.banner-wait { background: var(--wait-bg); color: var(--wait-fg); border: 1px solid var(--wait-line); }
.banner-ok { background: var(--ok-bg); color: var(--ok-fg); border: 1px solid var(--ok-line); }
.field-label { margin: 16px 0 6px; font-weight: 600; font-size: 14px; }
.copy-row { display: flex; flex-wrap: wrap; gap: 8px; }
.copy-addr {
  flex: 1 1 240px; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--soft);
  overflow-wrap: anywhere; -webkit-user-select: all; user-select: all;
}
.btn-outline { margin: 0; background: transparent; color: var(--accent); border: 1px solid var(--accent); }
.how { margin: 16px 0 16px; padding-left: 22px; display: flex; flex-direction: column; gap: 8px; }
.code-box { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; margin: 0 0 16px; padding: 14px 16px; border-radius: 10px; background: var(--soft); }
.code-box p { margin: 0; }
.code-box .field-label { margin: 0; }
.code { letter-spacing: 0.06em; font-size: 1.1rem; }

/* Gmail walkthrough: numbered stages that tick themselves off */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.wizard { list-style: none; margin: 8px 0 16px; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.wz-step { border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; background: var(--panel); }
.wz-step:focus { outline: none; }
.wz-step:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.wz-step.current { border: 2px solid var(--accent); }
.wz-step.done { background: var(--ok-bg); border-color: var(--ok-line); }
.wz-step.later { opacity: 0.6; }
.wz-head { display: flex; align-items: center; gap: 12px; }
.wz-num {
  flex: 0 0 auto; width: 30px; height: 30px; border-radius: 15px; display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 15px; background: var(--soft); color: var(--fg);
}
.wz-step.current .wz-num { background: var(--accent); color: var(--on-accent); }
.wz-step.done .wz-num { background: var(--ok-fg); color: var(--ok-bg); }
.wz-title { margin: 0; font-size: 1rem; line-height: 1.35; }
.wz-done { margin: 4px 0 0 42px; font-size: 14px; color: var(--ok-fg); }
.wz-body { margin: 8px 0 0 42px; }
.wz-body > .btn-link { margin-top: 12px; }
.wz-body .how { margin: 12px 0; }
.wz-wait { margin: 12px 0 0; padding: 10px 12px; border-radius: 8px; background: var(--wait-bg); color: var(--wait-fg); font-size: 14px; }
.wz-key { margin: 0; font-weight: 600; }
.wz-body .banner { margin: 8px 0 0; }

/* A drawing of Gmail's Forwarding setting (not a real control) */
.gmock { margin: 8px 0 0; }
.gmock-win { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--bg); font-size: 13px; }
.gmock-tabs { display: flex; flex-wrap: wrap; gap: 14px; padding: 8px 12px; border-bottom: 1px solid var(--line); color: var(--muted); }
.gmock-tabs .on { color: var(--fg); font-weight: 600; border-bottom: 2px solid var(--danger); }
.gmock-sec { padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.gmock-label { font-weight: 600; }
.gmock-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 6px 8px; border-radius: 8px; }
.gmock-row.hl, .gmock-foot { position: relative; }
.gmock-row.hl { box-shadow: 0 0 0 3px var(--danger); }
.gmock-radio { width: 14px; height: 14px; border-radius: 7px; border: 2px solid var(--muted); flex: 0 0 auto; }
.gmock-radio.on { border-color: var(--accent); background: radial-gradient(circle, var(--accent) 0 40%, transparent 45%); }
.gmock-select { padding: 2px 8px; border: 1px solid var(--line); border-radius: 4px; background: var(--soft); overflow-wrap: anywhere; }
.gmock-foot { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-top: 1px solid var(--line); }
.gmock-save { padding: 6px 14px; border-radius: 4px; background: var(--accent); color: var(--on-accent); box-shadow: 0 0 0 3px var(--danger); }
.gmock-cancel { padding: 6px 14px; border-radius: 4px; border: 1px solid var(--line); color: var(--muted); }
.gmock-badge {
  flex: 0 0 auto; width: 22px; height: 22px; border-radius: 11px; display: inline-flex; align-items: center; justify-content: center;
  background: var(--danger); color: var(--bg); font-weight: 700; font-size: 13px;
}
.gmock figcaption { margin-top: 8px; color: var(--muted); }
.gmock figcaption strong { display: inline-flex; width: 20px; height: 20px; border-radius: 10px; align-items: center; justify-content: center; background: var(--danger); color: var(--bg); font-size: 12px; }

.panel-missing { margin-top: 24px; }
.missing { margin: 0; padding-left: 22px; color: var(--fg); }
.done-line { margin: 0; color: var(--ok-fg); font-weight: 600; }
.panel-nav { display: flex; justify-content: space-between; gap: 12px; margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--line); }
.panel-nav button { margin: 0; }
.dash-timeline { margin-top: 28px; padding: 24px 28px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; }
.dash-timeline h2 { margin: 0 0 6px; }
.dash-timeline p { margin: 0; }
.dash-foot { margin-top: 20px; text-align: center; }

/* Phones and narrow windows: the step list folds behind one button. */
@media (max-width: 759px) {
  .dash-top h1 { font-size: 1.5rem; }
  .dash-progress-wrap { flex: 1 1 100%; }
  .steps-toggle {
    display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%; margin: 0;
    padding: 12px 14px; background: var(--panel); color: var(--fg); border: 2px solid var(--accent);
    border-radius: 12px; text-align: left; font-weight: 600;
  }
  .dash-steps { display: none; margin-top: 8px; }
  .dash-steps.open { display: flex; }
  .dash-panel { padding: 20px 16px; border-radius: 12px; }
  .panel-title { font-size: 1.3rem; }
  .panel-nav { position: sticky; bottom: 0; margin: 24px -16px -20px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); background: var(--panel); border-radius: 0 0 12px 12px; }
  .panel-nav button { flex: 1; }
  .group, .list-item { padding-left: 12px; padding-right: 12px; }
  .dash-timeline { padding: 20px 16px; }
  .wz-step { padding: 12px; }
  .wz-body, .wz-done { margin-left: 0; }
}
