:root {
  color-scheme: light;
  --ink: #21162f;
  --muted: #6c6078;
  --line: #e5dced;
  --surface: #ffffff;
  --band: #f8f5fb;
  --accent: #6622a8;
  --accent-dark: #32105f;
  --gold: #b7dd18;
  --rose: #a84753;
  --blue: #315f8a;
  --shadow: 0 18px 55px rgba(50, 16, 95, 0.10);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
  max-width: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  max-width: 100%;
  overflow-x: hidden;
  background: #fbfcfa;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

button,
input,
textarea,
select {
  font: inherit;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 16px clamp(18px, 4vw, 54px);
  background: rgba(251, 252, 250, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
  min-width: 0;
}

.brand-button {
  display: grid;
  gap: 0;
  min-height: auto;
  border: 0;
  background: transparent;
  color: var(--ink);
  padding: 0;
  text-align: left;
}

.brand-button:hover,
.brand-button:focus {
  background: transparent;
  color: var(--ink);
}

.app-header h1,
.intro-copy h2,
.section-heading h2 {
  margin: 0;
  letter-spacing: 0;
}

.app-header h1 {
  font-size: clamp(1.2rem, 2vw, 1.75rem);
}

.header-status {
  color: var(--muted);
  font-weight: 800;
  text-align: right;
}

.top-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.top-nav button {
  min-height: 40px;
  border-color: transparent;
  background: transparent;
  color: var(--muted);
}

.top-nav button:hover,
.top-nav button:focus,
.top-nav button.is-active {
  border-color: rgba(31, 122, 90, 0.22);
  background: rgba(31, 122, 90, 0.08);
  color: var(--accent-dark);
}

.top-nav .nav-primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.top-nav .nav-primary:hover,
.top-nav .nav-primary:focus {
  background: var(--accent-dark);
  color: #fff;
}

.app-layout {
  width: min(1180px, calc(100% - 32px));
  margin: 24px auto 0;
}

.app-main {
  min-width: 0;
}

.app-view {
  display: none;
}

body[data-active-view="home"] [data-view="home"],
body[data-active-view="account"] [data-view="account"],
body[data-active-view="profile"] [data-view="profile"],
body[data-active-view="financial"] [data-view="financial"],
body[data-active-view="questionnaire"] [data-view="questionnaire"]:not([hidden]),
body[data-active-view="history"] [data-view="history"] {
  display: block;
}

.questionnaire-page-heading {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
  padding: 18px 0 2px;
}

.questionnaire-page-heading h2 {
  margin: 0;
  font-size: clamp(1.8rem, 3vw, 2.6rem);
  letter-spacing: 0;
}

main,
.app-main {
  min-width: 0;
}

.intro-band,
.section-band {
  margin: 0 0 28px;
  padding: clamp(22px, 4vw, 42px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.intro-band {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 360px);
  gap: 28px;
  align-items: end;
  background:
    linear-gradient(120deg, rgba(31, 122, 90, 0.12), transparent 44%),
    linear-gradient(90deg, #ffffff, #f5f8f4);
}

.intro-band.app-view,
.section-band.app-view,
#questionnaireForm.app-view {
  display: none;
}

body[data-active-view="home"] .intro-band[data-view="home"] {
  display: grid;
}

body[data-active-view="account"] .section-band[data-view="account"],
body[data-active-view="guest"] .section-band[data-view="guest"],
body[data-active-view="profile"] .section-band[data-view="profile"],
body[data-active-view="financial"] .section-band[data-view="financial"],
body[data-active-view="history"] .section-band[data-view="history"],
body[data-active-view="questionnaire"] #questionnaireForm[data-view="questionnaire"]:not([hidden]) {
  display: block;
}

.intro-copy,
.section-band,
.status-panel,
.landing-panel,
.insight-panel,
.first-focus {
  min-width: 0;
}

.intro-copy h2 {
  max-width: 760px;
  font-size: clamp(2.2rem, 5vw, 4.8rem);
  line-height: 1;
  overflow-wrap: anywhere;
}

.intro-copy p:not(.eyebrow) {
  max-width: 720px;
  color: var(--muted);
  font-size: 1.08rem;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent-dark);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.status-panel,
.insight-panel,
.first-focus {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfb;
  padding: 18px;
}

.status-panel {
  display: grid;
  gap: 6px;
}

.status-label {
  color: var(--muted);
  font-size: 0.9rem;
}

.status-panel strong {
  font-size: 2rem;
}

.landing-panel {
  display: grid;
  gap: 14px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfb;
}

.landing-panel h3 {
  margin: 0;
  font-size: 1.25rem;
}

.landing-panel ul {
  display: grid;
  gap: 10px;
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
}

.landing-panel button {
  justify-self: start;
}

.compact-status {
  min-width: min(100%, 320px);
  padding: 14px;
}

.compact-status strong {
  font-size: 1.45rem;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.section-heading h2 {
  font-size: clamp(1.6rem, 3vw, 2.3rem);
}

.with-controls {
  align-items: end;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.auth-layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.auth-card,
.signed-in-panel {
  display: grid;
  gap: 14px;
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.auth-card h3 {
  margin: 0;
  color: var(--ink);
  font-size: 1.25rem;
}

.password-field {
  position: relative;
  display: block;
}

.password-field input {
  width: 100%;
  padding-right: 48px;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 5px;
  display: grid;
  width: 38px;
  min-height: 36px;
  padding: 8px;
  border: 0;
  background: transparent;
  color: var(--muted);
  place-items: center;
  transform: translateY(-50%);
}

.password-toggle:hover,
.password-toggle:focus-visible {
  background: var(--band);
  color: var(--accent-dark);
}

.password-toggle svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.password-toggle .eye-closed,
.password-toggle[aria-pressed="true"] .eye-open {
  display: none;
}

.password-toggle[aria-pressed="true"] .eye-closed {
  display: block;
}

.account-status {
  align-self: end;
  color: var(--accent-dark);
  font-weight: 800;
}

.account-status.error {
  color: var(--rose);
}

.signed-in-panel {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  background: #fbfdfb;
}

.signed-in-panel span {
  display: block;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.signed-in-panel strong {
  display: block;
  margin-top: 2px;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.account-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  margin-top: 16px;
}

.account-workspace[hidden] {
  display: none;
}

.profile-card {
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.form-intro {
  max-width: 850px;
  margin: 0 0 18px;
  color: var(--muted);
}

.compact-heading {
  align-items: end;
  margin-bottom: 14px;
}

.compact-heading h3 {
  margin: 0;
  color: var(--ink);
  font-size: 1.25rem;
}

.submission-history {
  min-height: 120px;
}

.history-list {
  display: grid;
  gap: 10px;
}

.history-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfb;
}

.history-item strong,
.history-item span,
.history-item small {
  display: block;
  overflow-wrap: anywhere;
}

.history-item span,
.history-item small,
.muted-text {
  color: var(--muted);
}

.history-item small {
  font-size: 0.86rem;
}

.history-detail {
  margin-top: 18px;
}

.history-summary {
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.history-summary h4,
.history-summary p {
  margin: 0;
}

.history-summary h4 {
  color: var(--ink);
  font-size: 1rem;
}

.error-text {
  color: var(--rose);
  font-weight: 750;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 700;
}

.wide {
  grid-column: 1 / -1;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 11px 12px;
}

input:focus,
textarea:focus,
select:focus {
  outline: 3px solid rgba(31, 122, 90, 0.18);
  border-color: var(--accent);
}

.consent-row {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}
.required-mark { color: #c62828; font-weight: 800; }

.pathway-selector {
  margin: 20px 0 0;
  padding: 0;
  border: 0;
}

.pathway-selector legend {
  margin-bottom: 10px;
  color: var(--ink);
  font-size: 1.05rem;
  font-weight: 800;
}

.pathway-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.pathway-card {
  position: relative;
  display: flex;
  min-width: 0;
  cursor: pointer;
}

.pathway-card input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.pathway-card span {
  display: grid;
  gap: 5px;
  width: 100%;
  min-height: 126px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
}

.pathway-card strong {
  color: var(--ink);
  font-size: 1.24rem;
}

.pathway-card small {
  font-size: 0.93rem;
  line-height: 1.45;
}

.pathway-card input:checked + span {
  border-color: var(--accent);
  background: rgba(31, 122, 90, 0.08);
  box-shadow: inset 0 0 0 2px rgba(31, 122, 90, 0.18);
}

.pathway-destination {
  margin-top: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfb;
}

.pathway-destination strong {
  display: block;
  color: var(--accent-dark);
  font-size: 1.1rem;
}

.pathway-destination p {
  margin: 6px 0 0;
  color: var(--muted);
}

.pathway-followup {
  margin: 16px 0 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.pathway-followup[hidden] {
  display: none;
}

.pathway-followup legend {
  padding: 0 6px;
  color: var(--ink);
  font-weight: 800;
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 14px;
}

.care-grid {
  margin-top: 16px;
}

.check-label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: var(--ink);
}

.check-label input {
  width: 18px;
  min-width: 18px;
  margin-top: 3px;
}

.search-box {
  min-width: min(320px, 100%);
}

.rating-key {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.rating-key span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 10px;
  color: var(--muted);
  background: var(--band);
  font-size: 0.86rem;
}

.symptom-list {
  display: grid;
  gap: 10px;
}

.question-list {
  display: grid;
  gap: 10px;
}

.question-list.compact {
  margin-bottom: 18px;
}

.symptom-row,
.question-row {
  display: grid;
  grid-template-columns: minmax(210px, 1fr) auto;
  gap: 18px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  min-width: 0;
}

.question-row {
  grid-template-columns: minmax(260px, 1fr) minmax(220px, 360px);
}

.compact-row {
  grid-template-columns: minmax(260px, 1fr) auto;
}

.symptom-name {
  color: var(--ink);
  font-weight: 750;
}

.system-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.system-tags span {
  color: var(--muted);
  background: var(--band);
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 0.78rem;
}

.rating-options {
  display: grid;
  grid-template-columns: repeat(4, 44px);
  gap: 6px;
}

.rating-options.five {
  grid-template-columns: repeat(5, 44px);
}

.rating-options.four {
  grid-template-columns: repeat(4, 44px);
}

.rating-options input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.rating-options span {
  display: grid;
  place-items: center;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  background: #fff;
  font-weight: 800;
  cursor: pointer;
}

.rating-options input:checked + span {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}

.select-answer {
  min-width: 0;
}

.clinical-note {
  margin: 0 0 16px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--band);
  color: var(--muted);
  font-weight: 650;
}

.alert-note {
  border-color: rgba(168, 71, 83, 0.28);
  background: rgba(168, 71, 83, 0.08);
  color: var(--ink);
}

.biomarker-grid {
  margin-top: 18px;
}

.results-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 22px;
}

.first-focus {
  margin-bottom: 16px;
}

.first-focus h3,
.insight-panel h3 {
  margin: 0 0 8px;
  font-size: 1.2rem;
}

.first-focus strong {
  color: var(--accent-dark);
  font-size: clamp(2rem, 4vw, 3rem);
}

.result-bars {
  display: grid;
  gap: 10px;
}

.result-bar {
  display: grid;
  grid-template-columns: minmax(90px, 130px) minmax(0, 1fr) 48px;
  gap: 12px;
  align-items: center;
}

.bar-track {
  height: 13px;
  overflow: hidden;
  border-radius: 999px;
  background: #e7ede9;
}

.bar-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--gold));
}

.bar-score {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
}

.insight-panel p {
  color: var(--muted);
}

.clinical-summary {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px;
}

.summary-card {
  display: grid;
  gap: 6px;
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfb;
}

.summary-card span,
.domain-score span {
  color: var(--muted);
  font-weight: 750;
}

.summary-card strong {
  color: var(--accent-dark);
  font-size: 1.35rem;
}

.summary-card p {
  margin: 0;
  color: var(--muted);
}

.domain-score-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.domain-score {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.domain-score strong {
  font-variant-numeric: tabular-nums;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.voice-recorder {
  display: grid;
  gap: 12px;
  margin-top: 18px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfb;
}

.voice-recorder h3,
.voice-recorder p {
  margin: 0;
}

.voice-recorder p {
  color: var(--muted);
}

.voice-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.voice-controls span {
  color: var(--muted);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.voice-recorder audio {
  width: 100%;
}

.voice-status {
  min-height: 22px;
  color: var(--accent-dark);
  font-weight: 750;
}

.voice-status.error {
  color: var(--rose);
}

.submit-status {
  min-height: 24px;
  margin: 14px 0 0;
  color: var(--accent-dark);
  font-weight: 750;
}

.submit-status.error {
  color: var(--rose);
}

button {
  min-height: 44px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  padding: 10px 16px;
  font-weight: 800;
}

button:hover,
button:focus {
  background: var(--accent-dark);
}

button.secondary {
  border-color: var(--line);
  background: #fff;
  color: var(--ink);
}

footer {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto 32px;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 860px) {
  .app-header,
  .intro-band,
  .results-layout,
  .form-grid,
  .auth-layout,
  .signed-in-panel,
  .account-workspace,
  .history-item,
  .pathway-options,
  .choice-grid,
  .section-heading,
  .summary-grid,
  .domain-score-list,
  .symptom-row,
  .question-row,
  .compact-row {
    grid-template-columns: 1fr;
  }

  .app-header {
    display: grid;
  }

  .top-nav {
    justify-content: flex-start;
  }

  .questionnaire-page-heading {
    display: grid;
  }

  .section-heading {
    display: grid;
  }

  .rating-options {
    grid-template-columns: repeat(4, minmax(44px, 1fr));
  }

  .rating-options.five {
    grid-template-columns: repeat(5, minmax(42px, 1fr));
  }

  .result-bar {
    grid-template-columns: 104px minmax(90px, 1fr) 42px;
  }
}

@media print {
  .app-header,
  .actions,
  .search-box,
  .rating-key {
    display: none;
  }

  body {
    background: #fff;
  }

  main,
  footer {
    width: 100%;
  }

  .intro-band,
  .section-band {
    box-shadow: none;
    break-inside: avoid;
  }
}

/* Exchange Effect brand system */
body {
  background:
    radial-gradient(circle at 8% 0%, rgba(163, 62, 224, .10), transparent 25rem),
    linear-gradient(180deg, #fcfaff 0, #f7f3fa 28rem, #faf9fb 100%);
}

::selection { background: #d9ff6a; color: #271040; }

:focus-visible { outline: 3px solid #b7ea1c; outline-offset: 3px; }

.app-header {
  padding-block: 10px;
  background: rgba(255, 253, 255, .94);
  border-bottom-color: rgba(83, 31, 132, .14);
  box-shadow: 0 8px 30px rgba(51, 13, 89, .06);
}

.brand-button { display: flex; align-items: center; gap: 12px; }
.brand-logo,
.admin-brand-logo {
  width: 54px;
  height: 54px;
  object-fit: cover;
  border-radius: 16px;
  box-shadow: 0 7px 22px rgba(105, 21, 172, .25);
}
.brand-copy { display: block; }
.brand-copy .eyebrow { display: block; margin-bottom: 2px; }
.brand-copy strong { display: block; color: #26103f; font-size: clamp(1.05rem, 2vw, 1.4rem); line-height: 1.15; }
.menu-toggle { display: none; }

.top-nav button { border-radius: 999px; font-weight: 750; }
.top-nav button:hover,
.top-nav button:focus,
.top-nav button.is-active { border-color: #d9c5eb; background: #f1e8f9; color: #461477; }
.top-nav .nav-primary,
button:not(.secondary):not(.danger):not(.password-toggle):not(.brand-button) {
  border-color: #6120a0;
  background: linear-gradient(135deg, #451276, #7b27bf);
  color: #fff;
  box-shadow: 0 7px 18px rgba(83, 22, 137, .18);
}
.top-nav .nav-primary:hover,
button:not(.secondary):not(.danger):not(.password-toggle):not(.brand-button):hover {
  background: linear-gradient(135deg, #35105b, #651b9e);
  transform: translateY(-1px);
}

.intro-band,
.section-band { border-radius: 20px; border-color: rgba(83, 31, 132, .14); }
.intro-band {
  overflow: hidden;
  background:
    radial-gradient(circle at 92% 16%, rgba(193, 255, 36, .26), transparent 13rem),
    linear-gradient(128deg, #fff 35%, #f0e4fb 100%);
}
.intro-copy h2,
.questionnaire-page-heading h2 { color: #241039; letter-spacing: -.035em; }
.eyebrow { color: #681ca5; }
.landing-panel,
.status-panel,
.insight-panel { border-color: #dfd0eb; background: rgba(255, 255, 255, .78); border-radius: 16px; }
.landing-panel li::marker { color: #88ad00; }

input,
textarea,
select { min-height: 46px; border-color: #d9cde2; border-radius: 11px; background: #fff; }
textarea { min-height: 110px; }
input:hover,
textarea:hover,
select:hover { border-color: #a888c1; }
input:focus,
textarea:focus,
select:focus { border-color: #6d25a8; box-shadow: 0 0 0 4px rgba(109, 37, 168, .12); }

.rating-key { padding: 10px 12px; border: 1px solid #dfd2e8; border-radius: 13px; background: #faf6fd; }
.rating-key span { color: #503664; }
.rating-options input:checked + span { border-color: #6f23aa; background: #64209f; box-shadow: 0 0 0 3px rgba(190, 255, 24, .32); }
.question-row,
.symptom-row { border-radius: 14px; }
.first-focus { border-color: #c5e957; background: linear-gradient(135deg, #f8ffe5, #fff); border-radius: 16px; }
.first-focus strong { color: #40106f; }
.required-mark { color: #b12062; }
.field-label { display: inline; }
.field-label .required-mark { display: inline; margin-left: 2px; }
.height-field { min-width: 0; margin: 0; padding: 0; border: 0; }
.height-field legend { margin-bottom: 7px; color: var(--muted); font-size: .92rem; font-weight: 700; }
.height-inputs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.height-inputs label { gap: 5px; }
.height-inputs label > span { font-size: .78rem; }
.submit-status:not(.error), .account-status:not(.error) { color: #4b167d; }

.app-footer {
  display: grid;
  grid-template-columns: auto minmax(240px, 1fr) auto;
  align-items: center;
  gap: clamp(18px, 3vw, 36px);
  width: min(1180px, calc(100% - 32px));
  margin: 12px auto 30px;
  padding: 20px 24px;
  border: 1px solid rgba(128, 55, 180, .28);
  border-radius: 18px;
  background:
    radial-gradient(circle at 5% 0, rgba(195, 255, 42, .14), transparent 12rem),
    linear-gradient(135deg, #22093c, #35105b 65%, #461170);
  color: #eee7f4;
  box-shadow: 0 16px 40px rgba(40, 10, 67, .15);
  text-align: left;
}
.footer-brand { display: flex; align-items: center; gap: 11px; min-width: max-content; }
.footer-brand img { width: 46px; height: 46px; object-fit: cover; border-radius: 13px; box-shadow: 0 5px 16px rgba(199, 49, 255, .25); }
.footer-brand strong,
.footer-brand span { display: block; }
.footer-brand strong { color: #fff; font-size: .98rem; }
.footer-brand span { color: #cfc2db; font-size: .78rem; }
.footer-notice { margin: 0; color: #d9cfe2; font-size: .84rem; line-height: 1.5; }
.footer-links { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px 16px; }
.footer-links a { color: #d7fa5c; font-size: .84rem; font-weight: 750; text-decoration: none; white-space: nowrap; }
.footer-links a:hover { color: #fff; text-decoration: underline; text-underline-offset: 3px; }

@media (max-width: 860px) {
  .app-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px 12px;
    padding: 9px 12px;
  }
  .brand-logo { width: 46px; height: 46px; border-radius: 13px; }
  .brand-button { min-width: 0; }
  .brand-copy strong { font-size: 1rem; }
  .brand-copy .eyebrow { font-size: .67rem; }
  .menu-toggle {
    display: grid;
    place-content: center;
    gap: 5px;
    width: 46px;
    min-height: 46px;
    padding: 0;
    border: 1px solid #ddcee8;
    border-radius: 13px;
    background: #fff !important;
    box-shadow: none !important;
  }
  .menu-toggle span { display: block; width: 21px; height: 2px; border-radius: 2px; background: #41126e; transition: transform .18s ease, opacity .18s ease; }
  .menu-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .menu-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
  .menu-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
  .top-nav {
    display: none;
    grid-column: 1 / -1;
    width: 100%;
    max-height: calc(100vh - 80px);
    overflow-y: auto;
    padding: 8px 0 4px;
    border-top: 1px solid #eadff0;
  }
  .top-nav.is-open { display: grid; grid-template-columns: 1fr; gap: 6px; }
  .top-nav button { width: 100%; min-height: 46px; justify-content: flex-start; border-radius: 11px; text-align: left; }
  .top-nav .nav-primary { justify-content: center; text-align: center; }
  .app-layout { width: min(100% - 20px, 1180px); margin-top: 14px; }
  .intro-band,
  .section-band { margin-bottom: 16px; padding: 20px 16px; border-radius: 16px; }
  .intro-copy h2 { font-size: clamp(2rem, 11vw, 3rem); line-height: 1.04; }
  .questionnaire-page-heading { padding-top: 8px; }
  .questionnaire-page-heading h2 { font-size: 1.7rem; }
  .section-heading { gap: 12px; }
  .section-heading h2 { font-size: 1.5rem; }
  .search-box { min-width: 0; width: 100%; }
  .symptom-row,
  .question-row,
  .compact-row { gap: 14px; padding: 13px; }
  .rating-options,
  .rating-options.four { width: 100%; grid-template-columns: repeat(4, minmax(40px, 1fr)); }
  .rating-options.five { width: 100%; grid-template-columns: repeat(5, minmax(36px, 1fr)); gap: 5px; }
  .rating-options span { min-height: 44px; }
  .rating-key { gap: 6px; }
  .rating-key span { padding: 5px 8px; font-size: .78rem; }
  .actions { display: grid; grid-template-columns: 1fr; }
  .actions button { width: 100%; }
  .voice-recorder { padding: 16px; }
  .voice-controls { align-items: stretch; }
  .voice-controls button { width: 100%; }
  .result-bar { grid-template-columns: 82px minmax(70px, 1fr) 34px; gap: 8px; font-size: .82rem; }
  .history-summary { padding: 14px; }
  .app-footer { grid-template-columns: 1fr; gap: 14px; padding: 20px; }
  .footer-links { justify-content: flex-start; }
}

@media (max-width: 380px) {
  .brand-copy .eyebrow { display: none; }
  .brand-logo { width: 42px; height: 42px; }
  .intro-band,.section-band { padding-inline: 14px; }
  .rating-options.five { grid-template-columns: repeat(5, minmax(34px, 1fr)); gap: 3px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
