/* Little Achievers ABA intake. Brand: magenta #cc3b8d, navy #112337, blue #5d88c5, light blue #64adca, gold #e0ae40. */
:root {
  --magenta: #cc3b8d;
  --magenta-dark: #a82c72;
  --navy: #112337;
  --blue: #5d88c5;
  --sky: #64adca;
  --gold: #e0ae40;
  --bg: #f5f7fa;
  --paper: #ffffff;
  --ink: #112337;
  --soft: #4d5b6b;
  --rule: #dde3ea;
  --tint: #fbeef5;
  --ok: #2f7d4f;
  --warn-bg: #fff4dc;
  --err: #b3261e;
  --err-bg: #fdeceb;
  --radius: 12px;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.55 'DM Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
}
body.reading { overflow: hidden; }
h1, h2, h3 { font-family: Poppins, 'DM Sans', system-ui, sans-serif; line-height: 1.25; }
h1 { font-size: 1.75rem; margin: 8px 0 8px; outline: none; }
h2 { font-size: 1.15rem; margin: 0 0 10px; }
h3.group-heading { font-size: 1rem; margin: 22px 0 6px; color: var(--navy); }
p { margin: 0 0 12px; }
.lead { color: var(--soft); font-size: 1.05rem; }
.loading { padding: 40px 16px; text-align: center; color: var(--soft); }
.hint { color: var(--soft); font-size: .92rem; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.test-banner {
  background: var(--gold); color: var(--navy); text-align: center; font-weight: 700;
  padding: 8px 16px; font-size: .92rem;
}
header.top {
  max-width: 760px; margin: 0 auto; padding: 18px 16px 4px;
  display: flex; align-items: center; gap: 20px; justify-content: space-between;
}
.logo { height: 54px; width: auto; }
.progress { flex: 1; max-width: 300px; }
.bar { height: 8px; background: var(--rule); border-radius: 99px; overflow: hidden; }
.bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--sky), var(--magenta)); border-radius: 99px; }
.progress-text { font-size: .82rem; color: var(--soft); margin-top: 4px; text-align: right; }

main { max-width: 760px; margin: 0 auto; padding: 8px 16px 48px; }
.card {
  background: var(--paper); border: 1px solid var(--rule); border-radius: var(--radius);
  padding: 20px; margin: 16px 0;
}
ul.plain { margin: 0; padding-left: 20px; }
ul.plain li { margin: 4px 0; }

/* questions */
.questions { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 16px; }
.questions > * { grid-column: 1 / -1; }
.questions > .q:not(fieldset):not(.upload):not(.check):not([data-key="street"]) { grid-column: auto; }
@media (max-width: 560px) { .questions > .q:not(fieldset) { grid-column: 1 / -1 !important; } }
.q { margin: 10px 0; border: 0; padding: 0; min-width: 0; }
.q label, .q legend, .upload-label { display: block; font-weight: 500; margin-bottom: 6px; }
.q legend { padding: 0; }
.req { color: var(--magenta); }
input[type=text], input[type=email], input[type=tel], input[type=date], input:not([type]), select, textarea {
  width: 100%; font: inherit; font-size: 16px; color: var(--ink); background: #fff;
  border: 1px solid #b9c3cf; border-radius: 8px; padding: 11px 12px; min-height: 46px;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus, button:focus-visible, .pill:focus-within, .docrow:focus-visible {
  outline: 3px solid var(--sky); outline-offset: 1px;
}
.q.invalid input, .q.invalid select, .q.invalid .pills { border-color: var(--err); box-shadow: 0 0 0 1px var(--err); border-radius: 8px; }
.pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pill { position: relative; display: inline-flex; margin: 0 !important; }
.pill input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.pill span {
  display: inline-block; padding: 9px 16px; border: 1px solid #b9c3cf; border-radius: 99px;
  background: #fff; font-weight: 500; min-height: 44px; line-height: 24px;
}
.pill.on span { background: var(--magenta); border-color: var(--magenta); color: #fff; }
.yna { display: grid; grid-template-columns: 1fr; gap: 6px; padding: 10px 0; border-bottom: 1px solid var(--rule); margin: 0; }
.yna .notes { margin-top: 4px; }
.checkline { display: flex !important; gap: 12px; align-items: flex-start; font-weight: 400 !important; cursor: pointer; }
.checkline input { width: 22px; height: 22px; margin: 2px 0 0; flex: none; accent-color: var(--magenta); }
.checkline.muted { color: var(--soft); }
.doc-intro { margin: 18px 0 2px; padding-top: 14px; border-top: 2px solid var(--rule); }
.doc-intro:first-child { border-top: 0; padding-top: 0; margin-top: 0; }
.doc-intro h2 { margin: 0; }
.doc-code { color: var(--soft); font-size: .85rem; }
.people { display: grid; gap: 12px; }
.person { border: 1px solid var(--rule); border-radius: 10px; padding: 8px 14px 12px; margin: 0; }
.person legend { font-weight: 700; padding: 0 4px; }

.upload { border: 1px dashed #b9c3cf; border-radius: 10px; padding: 14px; }
.upload-button {
  display: inline-block; cursor: pointer; padding: 10px 16px; border-radius: 8px;
  background: var(--tint); color: var(--magenta-dark); font-weight: 700; margin: 0 !important;
}
.upload-done { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; overflow-wrap: anywhere; }
.tick { color: var(--ok); font-weight: 700; }
.upload-status { color: var(--soft); font-size: .92rem; margin-top: 6px; }

.error-summary {
  background: var(--err-bg); border-left: 4px solid var(--err); border-radius: 8px;
  padding: 12px 16px; margin: 12px 0; color: #5c1410;
}
.error-summary ul { margin: 6px 0 0; padding-left: 20px; }

/* buttons */
button { font: inherit; cursor: pointer; }
button.primary, button.secondary {
  min-height: 48px; padding: 12px 22px; border-radius: 10px; font-weight: 700; font-size: 1rem;
}
button.primary { background: var(--magenta); color: #fff; border: 0; }
button.primary:hover { background: var(--magenta-dark); }
button.primary:disabled { background: #c9cfd6; color: #5f6b78; cursor: not-allowed; }
button.secondary { background: #fff; color: var(--navy); border: 1px solid #b9c3cf; }
button.link { background: none; border: 0; color: var(--magenta-dark); text-decoration: underline; padding: 6px 0; font-weight: 500; }
.nav { display: flex; justify-content: space-between; gap: 12px; margin-top: 20px; }

/* signing */
.signer label { font-weight: 500; display: block; margin-bottom: 6px; }
.sigline { margin-top: 14px; padding: 10px 14px; background: var(--tint); border-radius: 10px; }
.siglabel { font-size: .82rem; color: var(--soft); }
.sig { font-family: 'Dancing Script', cursive; font-size: 1.9rem; color: var(--navy); min-height: 1.3em; line-height: 1.3; }
.doc-count { font-weight: 700; margin-bottom: 8px; }
ol.doclist { list-style: none; padding: 0; margin: 0; }
.docrow {
  width: 100%; text-align: left; display: grid; grid-template-columns: 48px 1fr; gap: 2px 10px;
  padding: 12px 8px; background: none; border: 0; border-bottom: 1px solid var(--rule); color: var(--ink);
}
.docrow-code { font-weight: 700; color: var(--soft); grid-row: span 2; }
.docrow-title { font-weight: 500; }
.docrow-state { font-size: .86rem; color: var(--magenta-dark); font-weight: 700; }
.docrow.signed .docrow-state { color: var(--ok); }

.reader {
  position: fixed; inset: 0; z-index: 20; background: var(--paper);
  display: grid; grid-template-rows: auto 1fr auto;
}
.reader-head {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 12px;
  padding: 12px 16px; border-bottom: 1px solid var(--rule); background: var(--bg);
}
.reader-head h2 { margin: 2px 0 0; font-size: 1.05rem; }
.reader-count { font-size: .82rem; color: var(--soft); }
.close { background: none; border: 0; font-size: 2rem; line-height: 1; color: var(--navy); padding: 0 6px; min-width: 44px; min-height: 44px; }
.reader-body { overflow-y: auto; padding: 16px max(16px, calc((100vw - 760px) / 2)); font-size: .98rem; outline: none; }
.reader-body p, .reader-body li { color: #1f2d3d; }
.reader-body h4 { margin: 18px 0 6px; text-decoration: underline; font-size: 1rem; }
.reader-body ul, .reader-body ol { padding-left: 22px; }
.reader-body li { margin: 4px 0; }
.doc-sub { font-family: Poppins, sans-serif; font-weight: 700; font-size: 1.1rem; margin-bottom: 10px; }
.patient { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 0 0 16px; }
.patient > div, .sigblock > div { background: var(--bg); border-radius: 8px; padding: 8px 10px; }
.patient span, .sigblock span:first-child { display: block; font-size: .78rem; color: var(--soft); font-weight: 700; }
@media (max-width: 560px) { .patient { grid-template-columns: 1fr 1fr; } }
.answers { border: 1px solid var(--rule); border-radius: 10px; padding: 8px 14px; margin: 12px 0; }
.ans { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--rule); }
.ans-k { color: var(--soft); font-size: .9rem; }
.ans-v { overflow-wrap: anywhere; }
.ans-heading { font-weight: 700; margin: 10px 0 2px; }
.missing { border: 2px dashed var(--gold); background: var(--warn-bg); border-radius: 10px; padding: 12px 14px; margin: 12px 0; }
.sigblock { display: grid; grid-template-columns: 1fr 1.4fr .8fr; gap: 8px; margin: 20px 0 12px; }
.sigblock .sig { font-size: 1.5rem; }
@media (max-width: 560px) { .sigblock { grid-template-columns: 1fr; } }
.end { height: 1px; }
.reader-foot {
  display: flex; gap: 12px; justify-content: space-between; align-items: center; flex-wrap: wrap;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--rule); background: var(--paper);
}
.signed-note { color: var(--ok); font-weight: 700; }

/* review */
.summary-head { display: flex; justify-content: space-between; align-items: baseline; }
.summary dl { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 6px 14px; margin: 0; }
.summary dt { color: var(--soft); font-size: .92rem; }
.summary dd { margin: 0; overflow-wrap: anywhere; }
@media (max-width: 560px) { .summary dl, .ans { grid-template-columns: 1fr; gap: 0; } .summary dd { margin-bottom: 8px; } }
.send { display: grid; gap: 12px; justify-items: start; }
.receipt { color: var(--soft); }

#toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 140%); z-index: 40;
  background: var(--navy); color: #fff; padding: 12px 18px; border-radius: 10px; max-width: min(92vw, 520px);
  transition: transform .25s ease, visibility 0s .25s; box-shadow: 0 6px 24px rgba(17, 35, 55, .25); visibility: hidden;
}
#toast.show { transform: translate(-50%, 0); visibility: visible; transition: transform .25s ease; }
@media (prefers-reduced-motion: reduce) { #toast { transition: none; } }
