:root {
  --ink: #142b42;
  --muted: #617184;
  --teal: #1f659f;
  --teal-dark: #164a78;
  --mint: #eaf4fc;
  --sky: #f1f7fd;
  --cream: #ffffff;
  --white: #ffffff;
  --line: #d9e4ef;
  --danger: #c93434;
  --danger-bg: #fff0f0;
  --amber: #b63c3c;
  --amber-bg: #fff4f4;
  --shadow: 0 18px 48px rgba(22, 74, 120, .11);
  --radius: 22px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { background: var(--cream); color: var(--ink); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; font-size: 17px; text-size-adjust: 100%; -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100vh; min-height: 100dvh; overflow-x: hidden; background:
  radial-gradient(circle at 88% 2%, rgba(54, 132, 196, .12), transparent 25rem),
  radial-gradient(circle at 8% 95%, rgba(201, 52, 52, .06), transparent 22rem),
  var(--cream); }
button, input, textarea, select { font: inherit; }
button { color: inherit; touch-action: manipulation; }

.shell { width: min(1120px, calc(100% - 40px)); margin: 0 auto; min-height: 100vh; display: flex; flex-direction: column; }
.app-header { display: flex; justify-content: space-between; align-items: center; padding: 24px 0; }
.brand { display: flex; gap: 11px; align-items: center; border: 0; background: transparent; padding: 0; cursor: pointer; text-align: left; }
.brand-mark { width: 37px; height: 37px; border-radius: 12px; display: grid; place-items: center; background: linear-gradient(135deg, var(--teal-dark) 0 68%, var(--danger) 68%); color: white; font-size: 23px; font-weight: 500; }
.brand strong { display: block; font-family: Georgia, serif; font-size: 22px; line-height: .95; }
.brand small { display: block; color: var(--muted); font-size: 12px; margin-top: 4px; }
.privacy-pill { border: 1px solid var(--line); background: rgba(255,255,255,.72); border-radius: 999px; padding: 9px 13px; font-size: 12px; color: var(--muted); cursor: pointer; }
.privacy-pill span { color: var(--teal); font-size: 9px; margin-right: 5px; }

#app { flex: 1; display: flex; flex-direction: column; }
.home { display: grid; grid-template-columns: 1.05fr .95fr; gap: clamp(32px, 7vw, 90px); align-items: center; padding: clamp(34px, 8vh, 90px) 0 60px; }
.eyebrow { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 700; color: var(--danger); letter-spacing: .045em; text-transform: uppercase; margin: 0 0 18px; }
.eyebrow::before { content: ""; width: 22px; height: 2px; background: var(--danger); }
h1, h2, h3, p { margin-top: 0; }
.home h1 { font-family: Georgia, serif; font-weight: 600; font-size: clamp(46px, 6.2vw, 76px); line-height: .98; letter-spacing: -.035em; margin-bottom: 22px; max-width: 720px; }
.home h1 em { font-weight: 500; color: var(--teal); }
.lede { color: var(--muted); font-size: 18px; line-height: 1.65; max-width: 590px; }
.home-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 30px; }
.trust-row { display: flex; flex-wrap: wrap; gap: 20px; margin-top: 35px; color: var(--muted); font-size: 13px; }
.trust-row span { display: inline-flex; align-items: center; gap: 7px; }
.trust-row b { color: var(--danger); }

.preview-card { position: relative; background: white; border: 1px solid var(--line); border-radius: 30px; padding: 28px; box-shadow: var(--shadow); transform: rotate(1.5deg); }
.preview-card::before { content: ""; position: absolute; inset: 16px -14px -16px 18px; border-radius: 30px; background: var(--mint); z-index: -1; transform: rotate(-4deg); }
.preview-top { display: flex; justify-content: space-between; gap: 20px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.preview-top strong { font-family: Georgia, serif; font-size: 22px; }
.preview-top span { color: var(--muted); font-size: 12px; }
.preview-section { padding: 18px 0 2px; }
.preview-section small { color: var(--teal); font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.preview-section p { margin: 8px 0 12px; line-height: 1.55; }
.mini-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.mini-tags span { background: var(--sky); color: #315f88; padding: 7px 10px; border-radius: 999px; font-size: 12px; }
.note-strip { background: var(--amber-bg); color: var(--amber); border-radius: 14px; padding: 12px 14px; font-size: 12px; margin-top: 18px; }

.button { border: 0; border-radius: 14px; min-height: 56px; padding: 0 22px; font-size: 16px; font-weight: 700; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; transition: transform .15s, box-shadow .15s, background .15s; text-decoration: none; }
.button:hover { transform: translateY(-1px); }
.button:focus-visible, .option:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 3px solid rgba(31,101,159,.28); outline-offset: 2px; }
.button.primary { background: var(--danger); color: white; box-shadow: 0 10px 22px rgba(201,52,52,.18); }
.button.primary:hover { background: #aa2929; }
.button.secondary { background: white; color: var(--ink); border: 1px solid var(--line); }
.button.ghost { background: transparent; color: var(--muted); }
.button.danger { background: var(--danger-bg); color: var(--danger); }
.button:disabled { opacity: .45; cursor: not-allowed; transform: none; }

.wizard { width: min(820px, 100%); margin: 22px auto 60px; }
.progress-head { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 13px; margin-bottom: 10px; }
.progress-head strong { color: var(--ink); }
.progress { height: 7px; background: #e6edf5; border-radius: 999px; overflow: hidden; margin-bottom: 24px; }
.progress > div { height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--teal-dark), var(--teal) 72%, var(--danger)); transition: width .25s ease; }
.form-card { background: rgba(255,255,255,.92); border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(24px, 5vw, 46px); box-shadow: var(--shadow); }
.step-kicker { color: var(--danger); font-size: 13px; font-weight: 700; margin-bottom: 10px; }
.form-card h1 { font-family: Georgia, serif; font-size: clamp(34px, 5vw, 49px); line-height: 1.05; letter-spacing: -.025em; margin-bottom: 12px; }
.step-help { color: var(--muted); line-height: 1.55; margin-bottom: 26px; max-width: 650px; }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.field { display: block; margin-bottom: 18px; }
.field > span, fieldset legend { display: block; font-size: 16px; line-height: 1.4; color: var(--ink); font-weight: 700; margin-bottom: 10px; }
input, textarea, select { width: 100%; color: var(--ink); background: white; border: 1.5px solid var(--line); border-radius: 13px; padding: 15px 16px; min-height: 56px; font-size: 18px; }
textarea { min-height: 105px; resize: vertical; line-height: 1.5; }
input::placeholder, textarea::placeholder { color: #8b98a6; }
fieldset { border: 0; padding: 0; margin: 0 0 22px; }
.option-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.option-grid.three { grid-template-columns: repeat(3, 1fr); }
.option { position: relative; display: flex; align-items: center; gap: 12px; width: 100%; min-height: 64px; padding: 16px 17px; border: 2px solid var(--line); background: white; border-radius: 15px; cursor: pointer; font-size: 17px; font-weight: 600; line-height: 1.35; user-select: none; transition: color .15s, background .15s, border-color .15s, transform .1s, box-shadow .15s; }
.option:hover { border-color: var(--teal); background: var(--sky); }
.option:active { transform: scale(.985); }
.option:focus-within { outline: 3px solid rgba(31,101,159,.3); outline-offset: 2px; }
.option input { position: absolute; opacity: 0; pointer-events: none; }
.option:has(input:checked) { border-color: #0e5f39; background: #157a4a; color: white; box-shadow: 0 8px 18px rgba(21,122,74,.22); }
.option-mark { width: 23px; height: 23px; border-radius: 7px; border: 2px solid #9aafc2; display: grid; place-items: center; flex: none; font-size: 14px; color: transparent; }
.option input[type="radio"] + .option-mark { border-radius: 50%; }
.option:has(input:checked) .option-mark { border-color: white; background: white; color: #0e5f39; }
.scale { display: grid; grid-template-columns: repeat(11, 1fr); gap: 6px; }
.scale .option { min-height: 56px; padding: 0; justify-content: center; font-size: 17px; }
.scale .option-mark { display: none; }
.scale-labels { display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; margin-top: 7px; }
.wizard-actions { display: flex; justify-content: space-between; gap: 12px; margin-top: 30px; }
.wizard-actions > div { display: flex; gap: 10px; }
.safety-box { background: var(--danger-bg); border: 1px solid #f0c5bf; border-radius: 15px; padding: 15px 17px; color: #74332c; line-height: 1.5; font-size: 14px; margin-bottom: 24px; }
.inline-note { background: var(--sky); border-radius: 14px; padding: 14px 16px; color: #315f88; font-size: 13px; line-height: 1.5; margin-bottom: 20px; }
.branch-label { background: var(--sky); border-left: 4px solid var(--teal); border-radius: 12px; padding: 14px 16px; margin-bottom: 22px; color: #315f88; }
.voice-button { width: auto; min-height: 42px; margin-top: 8px; padding: 8px 13px; border: 1px solid var(--line); border-radius: 11px; background: var(--white); color: var(--teal-dark); font-weight: 700; cursor: pointer; }
.severity-grid { display: grid; gap: 18px; margin-bottom: 26px; }
.mini-scale { margin-bottom: 0; }
.microcopy { color: var(--muted); font-size: 13px; line-height: 1.5; }
.emergency-card { text-align: center; padding: 6px 0 0; }
.safety-symbol { width: 48px; height: 48px; margin: 0 auto 14px; display: grid; place-items: center; border-radius: 50%; background: var(--danger); color: white; font-size: 27px; font-weight: 800; box-shadow: 0 9px 20px rgba(201,52,52,.22); }
.safety-symbol.large { width: 64px; height: 64px; font-size: 38px; }
.emergency-card h2 { font-family: Georgia, serif; font-size: clamp(31px, 5vw, 43px); margin-bottom: 12px; }
.emergency-question { max-width: 620px; margin: 0 auto 28px; color: var(--ink); font-size: clamp(20px, 3.5vw, 28px); font-weight: 700; line-height: 1.35; }
.binary-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; max-width: 520px; margin: 0 auto 16px; }
.binary-actions .button { min-height: 62px; font-size: 18px; }
.danger-choice { background: var(--danger); color: white; }
.safe-choice { background: var(--teal-dark); color: white; }
.emergency-stop { display: grid; place-items: center; flex: 1; padding: 34px 0 60px; }
.emergency-stop-card { width: min(680px, 100%); padding: clamp(28px, 6vw, 58px); text-align: center; border: 2px solid var(--danger); border-radius: 26px; background: white; box-shadow: var(--shadow); }
.emergency-stop-card .eyebrow { margin-inline: auto; }
.emergency-stop-card h1 { font-family: Georgia, serif; font-size: clamp(42px, 7vw, 64px); line-height: 1; color: var(--danger); }
.emergency-stop-card p { max-width: 550px; margin: 0 auto 16px; font-size: 18px; line-height: 1.55; }
.emergency-stop-card .button { width: 100%; margin-top: 12px; }
.emergency-call { background: var(--danger); color: white; min-height: 62px; font-size: 20px; }

.summary-page { width: min(940px, 100%); margin: 20px auto 60px; }
.summary-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 15px; margin-bottom: 18px; }
.summary-toolbar h1 { margin: 0; font-family: Georgia, serif; font-size: 34px; }
.summary-toolbar-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.report { background: white; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: clamp(25px, 6vw, 58px); }
.report-head { display: flex; justify-content: space-between; gap: 30px; padding-bottom: 24px; border-bottom: 2px solid var(--ink); }
.report-head h2 { font-family: Georgia, serif; font-size: 34px; margin-bottom: 6px; }
.report-head p { color: var(--muted); margin: 0; }
.report-date { text-align: right; font-size: 13px; color: var(--muted); }
.report-section { display: grid; grid-template-columns: 165px 1fr; gap: 28px; padding: 24px 0; border-bottom: 1px solid var(--line); }
.report-section:last-child { border-bottom: 0; }
.report-section h3 { color: var(--teal); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; margin: 3px 0; }
.report-content { line-height: 1.62; }
.report-content p:last-child { margin-bottom: 0; }
.report-list { margin: 0; padding-left: 20px; }
.report-list li + li { margin-top: 5px; }
.report-alert { background: var(--danger-bg); border: 1px solid #efc3bd; border-radius: 14px; padding: 14px 16px; color: #74332c; }
.route-card { border-radius: 14px; padding: 16px 18px; }
.route-card strong { display: block; font-size: 19px; margin-bottom: 5px; }
.route-card p { margin: 0; line-height: 1.5; }
.route-card.urgent { background: #fff3e5; border: 1px solid #efbd79; color: #75430a; }
.route-card.routine { background: var(--sky); border: 1px solid #b9d6ee; color: #274f72; }
.small-note { color: var(--muted); font-size: 13px; }
.report-disclaimer { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; line-height: 1.5; }
.empty { color: var(--muted); font-style: italic; }

dialog { border: 0; padding: 0; background: transparent; }
dialog::backdrop { background: rgba(20, 43, 66, .5); backdrop-filter: blur(3px); }
.dialog-card { width: min(430px, calc(100vw - 32px)); background: white; padding: 30px; border-radius: 22px; box-shadow: var(--shadow); text-align: center; }
.dialog-icon { width: 44px; height: 44px; display: grid; place-items: center; margin: 0 auto 15px; border-radius: 50%; background: var(--mint); color: var(--teal); font-weight: 800; }
.dialog-card h2 { font-family: Georgia, serif; font-size: 28px; }
.dialog-card p { color: var(--muted); line-height: 1.55; }
.dialog-card .button { width: 100%; margin-top: 8px; }
.toast { position: fixed; left: 50%; bottom: 22px; transform: translate(-50%, 20px); background: var(--teal-dark); color: white; padding: 11px 16px; border-radius: 999px; opacity: 0; pointer-events: none; transition: .2s ease; z-index: 20; font-size: 13px; box-shadow: var(--shadow); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.site-footer { display: flex; justify-content: space-between; gap: 20px; padding: 20px 0 30px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.footer-links { display: flex; flex-wrap: wrap; gap: 14px; }
.site-footer a { color: var(--teal-dark); font-weight: 700; text-decoration: none; }
.site-footer a:hover, .site-footer a:focus-visible { text-decoration: underline; }

@media (max-width: 760px) {
  body { background: var(--cream); }
  .shell { width: min(100% - 20px, 660px); }
  .app-header { position: sticky; top: 0; z-index: 8; margin: 0 -10px; padding: calc(12px + env(safe-area-inset-top)) 10px 12px; background: rgba(255,255,255,.94); border-bottom: 1px solid rgba(217,228,239,.82); backdrop-filter: blur(12px); }
  .brand-mark { width: 40px; height: 40px; }
  .brand strong { font-size: 21px; }
  .privacy-pill { width: 42px; height: 42px; padding: 0; font-size: 0; display: grid; place-items: center; }
  .privacy-pill span { font-size: 12px; margin: 0; }
  .home { grid-template-columns: 1fr; gap: 34px; padding: 34px 4px 46px; }
  .home h1 { font-size: clamp(43px, 13vw, 62px); line-height: 1; margin-bottom: 18px; }
  .lede { font-size: 16px; line-height: 1.55; }
  .home-actions { display: grid; grid-template-columns: 1fr; margin-top: 24px; }
  .home-actions .button { width: 100%; min-height: 60px; font-size: 17px; }
  .trust-row { display: grid; grid-template-columns: 1fr; gap: 10px; margin-top: 24px; font-size: 14px; }
  .preview-card { margin: 0 6px 20px; padding: 22px; border-radius: 23px; transform: none; }
  .preview-card::before { inset: 11px -6px -11px 9px; border-radius: 23px; transform: rotate(-1deg); }
  .preview-top { align-items: flex-start; }
  .preview-top span { text-align: right; }
  .wizard { width: 100%; margin: 12px auto 36px; }
  .progress-head { padding: 0 4px; font-size: 13px; }
  .progress { margin: 0 4px 14px; }
  .form-card { padding: 26px 18px 0; border-radius: 20px; box-shadow: 0 8px 30px rgba(22,74,120,.09); }
  .form-card h1 { font-size: clamp(34px, 10vw, 44px); }
  .step-help { font-size: 15px; margin-bottom: 22px; }
  .field-grid, .option-grid, .option-grid.three { grid-template-columns: 1fr; }
  .field > span, fieldset legend { font-size: 16px; }
  .option-grid { gap: 12px; }
  .option { min-height: 68px; padding: 17px 16px; font-size: 17px; }
  .option-mark { width: 24px; height: 24px; }
  .scale { grid-template-columns: repeat(6, 1fr); gap: 8px; }
  .scale .option { min-height: 58px; font-size: 17px; }
  .wizard-actions { position: sticky; bottom: 0; z-index: 7; margin: 28px -18px 0; padding: 12px 18px calc(12px + env(safe-area-inset-bottom)); background: rgba(255,255,255,.97); border-top: 1px solid var(--line); border-radius: 0 0 20px 20px; box-shadow: 0 -10px 24px rgba(22,74,120,.08); }
  .wizard-actions .button { min-height: 58px; font-size: 16px; }
  .wizard-actions > div { flex: 1; }
  .wizard-actions > div .button { width: 100%; }
  .summary-page { margin: 12px auto 36px; }
  .summary-toolbar { align-items: flex-start; flex-direction: column; }
  .summary-toolbar h1 { font-size: 31px; }
  .summary-toolbar-actions { display: grid; grid-template-columns: 1fr 1fr; width: 100%; }
  .summary-toolbar-actions .button:last-child { grid-column: 1 / -1; }
  .report { padding: 28px 20px; border-radius: 18px; box-shadow: 0 8px 30px rgba(22,74,120,.09); }
  .report-head { gap: 12px; }
  .report-head h2 { font-size: 30px; }
  .report-section { grid-template-columns: 1fr; gap: 7px; }
  .report-head { flex-direction: column; }
  .report-date { text-align: left; }
  .site-footer { flex-direction: column; gap: 7px; padding-bottom: calc(24px + env(safe-area-inset-bottom)); }
  dialog { max-width: 100%; }
  .dialog-card { padding: 26px 20px; }
  .binary-actions { grid-template-columns: 1fr; }
  .emergency-stop { padding: 16px 12px 36px; }
  .emergency-stop-card { border-radius: 20px; }
  .toast { bottom: calc(18px + env(safe-area-inset-bottom)); width: max-content; max-width: calc(100vw - 30px); text-align: center; }
}

@media (max-width: 470px) {
  .shell { width: 100%; }
  .app-header { margin: 0; padding-left: 14px; padding-right: 14px; }
  .home, .wizard, .summary-page { padding-left: 12px; padding-right: 12px; }
  .home h1 { font-size: 45px; }
  .preview-card { margin-left: 3px; margin-right: 3px; }
  .form-card { padding-left: 16px; padding-right: 16px; }
  .wizard-actions { margin-left: -16px; margin-right: -16px; padding-left: 16px; padding-right: 16px; }
  .wizard-actions > .button.ghost { padding-left: 10px; padding-right: 10px; }
  .summary-toolbar-actions .button { min-height: 48px; padding: 0 12px; font-size: 14px; }
}

@media print {
  @page { margin: 14mm; }
  body { background: white; }
  .no-print, .summary-toolbar { display: none !important; }
  .shell { width: 100%; }
  .summary-page { margin: 0; width: 100%; }
  .report { box-shadow: none; border: 0; padding: 0; }
  .report-section { break-inside: avoid; }
}

@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }
