/* Intake: the guided questionnaire (chat) and the form. Builds on site.css tokens and journey.css panels. */
.intake-nav { position: static; }
.intake-nav .nav-inner { flex-wrap: wrap; }
.intake-nav .journey-back { margin: 0; }
.intake-main { padding: 40px 0 90px; }
.intake-panel h1 { margin-bottom: 8px; }
.intake-privacy { margin-top: 8px; }
/* The form's welcome line (the founders, November 3); the chat says it in its opening bubbles. */
.intake-lead { margin-top: 10px; font-size: 16px; line-height: 1.55; color: var(--text); }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

.intake-progress { margin: 28px 0 8px; font-size: 14px; font-weight: 600; color: var(--forest); }
.intake-progress-bar { height: 6px; border-radius: 6px; background: var(--sand); overflow: hidden; }
.intake-progress-bar span { display: block; height: 100%; width: 0; background: var(--forest); transition: width .2s ease; }

.intake-step { margin-top: 32px; }
.intake-step h2 { font-size: clamp(24px, 3vw, 32px); overflow-wrap: anywhere; }
.intake-step h2:focus { outline: none; }
.intake-step h2:focus-visible { outline: 3px solid var(--terracotta-text); outline-offset: 4px; }

.intake-field { margin: 28px 0 0; border: 0; min-width: 0; }
.intake-field > label, .intake-field legend { display: block; font-weight: 600; color: var(--deep-green); margin-bottom: 8px; padding: 0; overflow-wrap: anywhere; }
.intake-field--placeholder { border: 2px dashed var(--terracotta); border-radius: 16px; padding: 16px; }
.intake-field--placeholder legend { float: left; width: 100%; }
.intake-field--placeholder legend ~ * { clear: both; }
.intake-statement { overflow-wrap: anywhere; }
.intake-optional { font-weight: 400; color: var(--text-muted); }
.intake-hint { font-size: 14px; color: var(--text-muted); margin: -2px 0 10px; }
.intake-subhead { font-size: 14px; font-weight: 600; margin: 8px 0 6px; }

.intake-form input[type="text"], .intake-form input[type="email"], .intake-form input[type="tel"], .intake-form select, .intake-form textarea {
    display: block; width: 100%; max-width: 480px; min-height: 48px; padding: 10px 14px;
    border: 1.5px solid #8a8079; border-radius: 12px; background: white; color: var(--text);
    font: inherit; font-size: 16px; line-height: 1.4;
}
.intake-form textarea { max-width: 100%; resize: vertical; }
/* The care partner's 19b (November 2): its example in the empty field, in grey italics (5.3:1 on white). Both views' fields. */
.intake-form textarea::placeholder { font-style: italic; color: #6b6b6b; opacity: 1; }
/* The care partner's 19c: the optional box that fills the field, just under it. */
.intake-fill { padding-top: 10px; max-width: 520px; }
.chat-field .intake-fill { padding-bottom: 10px; }
.intake-form select {
    appearance: none; -webkit-appearance: none; padding-right: 44px; cursor: pointer;
    background-image: linear-gradient(45deg, transparent 50%, var(--forest) 50%), linear-gradient(135deg, var(--forest) 50%, transparent 50%);
    background-position: calc(100% - 22px) 52%, calc(100% - 16px) 52%; background-size: 6px 6px; background-repeat: no-repeat;
}
.intake-form :is(input, select, textarea):focus-visible { outline: 3px solid var(--terracotta-text); outline-offset: 2px; border-color: var(--forest); }
.intake-form :is(input, select, textarea)[aria-invalid="true"] { border-color: #b3261e; border-width: 2px; }

.intake-inline-group + .intake-inline-group { margin-top: 12px; }
.intake-inline { display: flex; flex-wrap: wrap; gap: 12px 16px; }
.intake-inline-item label { display: block; font-size: 14px; margin-bottom: 4px; }
.intake-form .intake-inline input { width: 5.5em; }
.intake-form .intake-inline .intake-date-year, .intake-form .intake-inline .intake-bmi-pounds { width: 7em; }
.intake-bmi-result { margin-top: 10px; font-size: 14px; color: var(--text-muted); min-height: 1.6em; }

.intake-choices { display: grid; gap: 10px; max-width: 520px; }
.intake-choice { display: flex; align-items: flex-start; gap: 12px; min-height: 48px; padding: 12px 14px; border: 1.5px solid #cfc5bc; border-radius: 12px; background: white; cursor: pointer; overflow-wrap: anywhere; }
/* Drawn controls so the checked state reads the same in every engine and window state. */
.intake-choice input { appearance: none; -webkit-appearance: none; flex-shrink: 0; display: grid; place-content: center; width: 22px; height: 22px; margin: 1px 0 0; border: 2px solid #6b625b; background: white; cursor: pointer; }
.intake-choice input[type="radio"] { border-radius: 50%; }
.intake-choice input[type="checkbox"] { border-radius: 6px; }
.intake-choice input::before { content: ''; width: 10px; height: 10px; transform: scale(0); }
.intake-choice input[type="radio"]::before { border-radius: 50%; background: var(--forest); }
.intake-choice input[type="checkbox"]::before { width: 12px; height: 12px; background: white; clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%); }
.intake-choice input:checked { border-color: var(--forest); }
.intake-choice input[type="checkbox"]:checked { background: var(--forest); }
.intake-choice input:checked::before { transform: scale(1); }
@media (forced-colors: active) {
    .intake-choice input { appearance: auto; -webkit-appearance: auto; }
    .intake-choice input::before { display: none; }
    .intake-form select { appearance: auto; -webkit-appearance: auto; background-image: none; padding-right: 14px; }
}
/* Choice and chip labels are their own flex items, so a long word (a drug name with a slash) can wrap.
   WebKit skips emergency breaks while small screens hyphenate automatically (site.css), so labels
   hyphenate only where marked and break long words anywhere. */
.intake-choice > span, .chat-chip-label { min-width: 0; overflow-wrap: anywhere; word-break: break-word; -webkit-hyphens: manual; hyphens: manual; }
.intake-choice:has(input:checked) { border-color: var(--forest); background: #f1f5f2; }
.intake-choice:has(input:focus-visible) { outline: 3px solid var(--terracotta-text); outline-offset: 2px; }
.intake-choice input:focus-visible { outline: none; }

.intake-error { color: #b3261e; font-weight: 600; font-size: 15px; margin: 0 0 8px; }
.intake-field--error { border-left: 4px solid #b3261e; padding-left: 14px; }
.intake-field--placeholder.intake-field--error { border: 2px solid #b3261e; border-left-width: 6px; }
.intake-error-summary { scroll-margin-top: 16px; border: 2px solid #b3261e; border-radius: 16px; padding: 18px 22px; margin: 28px 0 0; background: white; }
.intake-error-summary:focus { outline: 3px solid var(--terracotta-text); outline-offset: 3px; }
.intake-error-summary h3 { font-size: 20px; margin-bottom: 8px; }
.intake-error-summary ul { padding-left: 20px; }
.intake-error-summary li { margin: 4px 0; }

.intake-link-button { background: none; border: 0; padding: 4px 0; color: var(--forest); font: inherit; font-weight: 600; text-decoration: underline; text-underline-offset: 4px; cursor: pointer; text-align: left; overflow-wrap: anywhere; }
.intake-error-summary .intake-link-button { color: #b3261e; }

.intake-actions { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; margin-top: 36px; }
.intake-actions .btn-primary { margin-left: auto; }
/* The wait line under Submit (small call 115), under the button it describes. */
.intake-submit-status { padding-top: 12px; text-align: right; }
.intake-form .btn { min-height: 48px; justify-content: center; }
.intake-form .btn[disabled] { opacity: .6; cursor: not-allowed; transform: none; box-shadow: none; }
.intake-form .btn:focus-visible, .intake-result .btn:focus-visible, .chat-review .btn:focus-visible { outline: 3px solid var(--terracotta-text); outline-offset: 4px; }


.intake-result { margin-top: 32px; padding: 24px; border-radius: 16px; background: #f1f5f2; border-left: 4px solid var(--forest); }
.intake-result h2 { font-size: clamp(24px, 3vw, 30px); margin-bottom: 12px; overflow-wrap: anywhere; }
.intake-result h2:focus { outline: none; }
.intake-result p { margin-top: 10px; }

@media (max-width: 540px) {
    .intake-main { padding-top: 24px; }
    .intake-actions { flex-direction: column-reverse; }
    .intake-actions .btn { width: 100%; margin-left: 0; }
}
@media (max-width: 360px) {
    .intake-main .container { padding: 0 8px; }
    .intake-main .journey-panel { padding: 18px 12px; border-radius: 16px; }
    .intake-field--placeholder { padding: 10px; }
    .intake-choice { padding: 10px; gap: 8px; }
    .intake-error-summary, .intake-result { padding: 14px; }
    .intake-form .intake-inline input { width: 4.5em; }
    .intake-form .intake-inline .intake-date-year, .intake-form .intake-inline .intake-bmi-pounds { width: 6em; }
    .intake-panel h1 { font-size: 26px; }
    .intake-panel h1, .intake-step h2, .intake-review-card :is(h2, h3) { hyphens: auto; -webkit-hyphens: auto; }
}

/* ---------- Mode switch ---------- */
.intake-mode { margin-top: 6px; }
.intake-mode-toggle { font-size: 15px; }
.intake-mode-toggle[disabled] { opacity: .6; cursor: not-allowed; }
.intake-stage { margin-top: 8px; }
/* The partner's questions are shown word for word: no automatic hyphens inserted on small screens
   (site.css hyphenates the body there); long words still wrap where they must. */
.intake-stage, .intake-stage * { -webkit-hyphens: manual; hyphens: manual; }

/* ---------- Guided questionnaire (chat) ---------- */
.chat { margin-top: 24px; }
.chat.is-moving { pointer-events: none; }
.chat-intro { display: grid; gap: 8px; }
.chat-log { display: grid; gap: 14px; margin: 14px 0 0; padding: 0; list-style: none; }
.chat-turn { display: grid; gap: 8px; min-width: 0; }
.chat-turn.is-current { scroll-margin-top: 12px; }
.chat-bubble { max-width: min(36rem, 88%); padding: 12px 16px; border-radius: 18px; font-size: 16px; line-height: 1.5; overflow-wrap: anywhere; }
.chat-bubble--q { justify-self: start; background: var(--warm-white); border: 1px solid var(--line); border-bottom-left-radius: 6px; color: var(--text); }
.chat-bubble--a { justify-self: end; margin: 0; background: var(--forest); color: #FFFFFF; border-bottom-right-radius: 6px; white-space: pre-wrap; }
.chat-answer-items, .intake-review-items { margin: 0; padding-left: 1.1em; white-space: normal; }
.chat-answer-items li + li, .intake-review-items li + li { margin-top: 4px; }
.chat-bubble--placeholder { border: 2px dashed var(--terracotta); }
.chat-bubble:focus { outline: none; }
.chat-bubble:focus-visible { outline: 3px solid var(--terracotta-text); outline-offset: 3px; }
.chat-bubble .intake-optional { color: var(--text-muted); }
.chat-answer { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 4px 12px; min-width: 0; }
.chat-answer .chat-bubble--a { order: 2; }
.chat-edit { order: 1; font-size: 14px; }
.chat-editing-note { order: 1; font-size: 14px; font-weight: 600; color: var(--terracotta-text); }
.chat-turn.is-editing .chat-bubble--a { opacity: .6; }
.chat-count { margin-top: 10px; font-size: 13px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--terracotta-text); }
.chat-hint { justify-self: start; max-width: min(36rem, 88%); font-size: 14px; color: var(--text-muted); }
.intake-flag { display: block; justify-self: end; max-width: min(36rem, 88%); margin-top: 6px; padding: 8px 12px; border-radius: 12px; background: var(--blush-mist); color: var(--ink); font-size: 14px; line-height: 1.45; overflow-wrap: anywhere; }
.chat-turn > .intake-flag { margin-top: 0; }

.chat-composer-area { margin-top: 16px; }
.chat-composer { padding: 16px; border: 1px solid var(--line); border-radius: var(--r-card); background: var(--sand); }
.chat-field { min-width: 0; border: 0; margin: 0; padding: 0; }
.chat-instruction { margin: 0 0 10px; font-size: 14px; color: var(--text-muted); }
.chat-chips--multi .chat-instruction { flex-basis: 100%; }
.chat-chips { display: flex; flex-wrap: wrap; gap: 10px; }
.chat-chip {
    display: inline-flex; align-items: center; gap: 10px; min-height: 48px; max-width: 100%; padding: 10px 18px;
    border: 1.5px solid var(--forest); border-radius: 24px; background: var(--warm-white); color: var(--deep-green);
    font: 600 15px/1.35 var(--font-body); text-align: left; overflow-wrap: anywhere; cursor: pointer;
    transition: background var(--dur-fast) ease, color var(--dur-fast) ease, box-shadow var(--dur-fast) ease;
}
.chat-chip:hover { background: var(--mist); }
.chat-chip:focus-visible { outline: 3px solid var(--terracotta-text); outline-offset: 2px; }
.chat-chip.is-previous { box-shadow: inset 0 0 0 2px var(--forest); }
.chat-chip-mark:empty { display: none; }
.chat-chip.is-chosen { background: var(--forest); color: #FFFFFF; transition-duration: 90ms; }
.chat-chip.is-chosen .chat-chip-mark { display: inline; }
.chat-chip.is-chosen .chat-chip-mark::before { content: '✓'; }
.chat-chip-box { flex-shrink: 0; display: grid; place-content: center; width: 20px; height: 20px; border: 2px solid #6b625b; border-radius: 6px; background: var(--warm-white); }
.chat-chip--toggle[aria-pressed="true"] { background: #f1f5f2; }
.chat-chip--toggle[aria-pressed="true"] .chat-chip-box { border-color: var(--forest); background: var(--forest); }
.chat-chip--toggle[aria-pressed="true"] .chat-chip-box::before { content: ''; width: 11px; height: 11px; background: #FFFFFF; clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%); }
@media (forced-colors: active) {
    .chat-chip--toggle[aria-pressed="true"] { outline: 3px solid Highlight; }
    .chat-chip.is-chosen { outline: 3px solid Highlight; }
}
.chat-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-top: 16px; }
.chat-actions:empty { display: none; }
.chat-actions-end { display: flex; flex-wrap: wrap; gap: 10px; margin-left: auto; }
.chat-actions .btn, .chat-review .btn { min-height: 48px; justify-content: center; }
.chat-actions .btn:focus-visible { outline: 3px solid var(--terracotta-text); outline-offset: 4px; }
.chat-error { margin-bottom: 12px; }

/* ---------- Review card (both modes) ---------- */
.intake-review-card { scroll-margin-top: 12px; margin-top: 8px; padding: clamp(16px, 3vw, 24px); border: 1px solid var(--line); border-radius: var(--r-card); background: var(--warm-white); }
.chat-review .intake-review-card { margin-top: 0; }
.intake-review-card :is(h2, h3) { font-size: clamp(22px, 2.6vw, 28px); overflow-wrap: anywhere; }
.intake-review-card :is(h2, h3):focus { outline: none; }
.intake-review-card :is(h2, h3):focus-visible { outline: 3px solid var(--terracotta-text); outline-offset: 4px; }
.intake-review-card > p { margin-top: 8px; color: var(--text-muted); }
.intake-review-list { margin: 16px 0 0; }
.intake-review-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 16px; padding: 12px 0; border-top: 1px solid var(--line); }
.intake-review-row dt { grid-column: 1; font-weight: 600; overflow-wrap: anywhere; }
/* Checkout's order summary (the founders' ruling of November 5): the label keeps its width and the value takes the rest, so a long
   treatment name wraps on the right instead of squeezing "Treatment" to a letter a line on a phone. */
.intake-order .intake-review-row { grid-template-columns: auto minmax(0, 1fr); }
.intake-order .intake-review-row dt { overflow-wrap: normal; }
.intake-order .intake-review-row dd { grid-column: 2; text-align: right; overflow-wrap: anywhere; }
.intake-review-answer { grid-column: 1; margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.intake-review-note { display: block; margin-top: 4px; font-size: 14px; color: var(--text-muted); white-space: normal; }
.intake-review-edit { grid-column: 2; grid-row: 1 / span 2; margin: 0; align-self: start; }
.intake-review-row .intake-flag { justify-self: start; margin-top: 6px; }
.intake-review-unsent { margin-top: 16px; padding: 14px 16px; border: 1px dashed var(--line-strong); border-radius: 16px; background: var(--sand); }
.intake-review-unsent :is(h3, h4) { font-size: 18px; }
.intake-review-unsent > p { margin-top: 6px; font-size: 14px; color: var(--text-muted); }
.intake-review-card > .journey-fine { margin-top: 16px; font-size: 14px; }
.chat-review .intake-actions { margin-top: 20px; }

/* ---------- After submit ---------- */
.intake-next-step { margin-top: 16px; padding: 14px 16px; border-radius: 14px; background: var(--warm-white); }
.intake-next-step--placeholder { border: 2px dashed var(--terracotta); }
.intake-next-step-label { margin-top: 0; font-size: 13px; font-weight: 700; letter-spacing: .04em; color: var(--terracotta-text); }
.intake-next-step p + p { margin-top: 6px; }

@media (max-width: 540px) {
    .chat-bubble, .chat-hint, .intake-flag { max-width: 100%; }
    .chat-actions .btn, .chat-actions-end { width: 100%; }
    .chat-actions-end { flex-direction: column-reverse; margin-left: 0; }
    .chat-review .intake-actions .btn { width: 100%; margin-left: 0; }
    .chat-chip { width: 100%; }
    .chat-chips--multi .chat-chip { width: 100%; }
}
@media (max-width: 360px) {
    .chat-composer { padding: 10px; }
    .intake-review-unsent { padding: 12px; }
    .chat-bubble { padding: 10px 12px; }
    .chat-chip { padding: 10px 12px; }
    .intake-review-row { grid-template-columns: minmax(0, 1fr); }
    .intake-review-edit { grid-column: 1; grid-row: auto; }
    .intake-review-card, .intake-review-unsent { padding: 12px; }
}
/* A 320 px phone at 200% zoom: tighter chips, so labels wrap between words where they can. */
@media (max-width: 259px) {
    .chat-chip { gap: 6px; padding: 8px 10px; }
    .chat-chip-box { width: 16px; height: 16px; }
    .intake-choice { gap: 6px; padding: 8px; }
}

/* Checkout (intake-checkout.js): the care partner's widgets sit in dashed stand-in boxes until it hands them over. */
.intake-checkout-section { margin-top: 24px; }
.intake-checkout-section h3, .intake-order h3 { margin-bottom: 8px; }
.intake-checkout-slot { margin: 8px 0 12px; padding: 14px 16px; border: 2px dashed var(--terracotta); border-radius: 14px; background: var(--warm-white); }
.intake-checkout-consents { padding-top: 4px; }
.intake-checkout .intake-actions { margin-top: 20px; }
.intake-checkout [data-checkout-address] { margin: 0; }
/* Live checkout's card form (small call 116): Stripe's card element draws no box of its own, so its slot is drawn like
   the address fields, with their ring while the card form has focus (Stripe adds StripeElement--focus to the slot). */
/* Promo codes (the care partner, November 3): "Have a promo code?" under the order lines; open, the field and Apply side by side. */
.intake-promo { padding: 4px 0 8px; }
/* "Have a promo code?" as a bordered, tappable row with a plus (a minus when open), easier to see than a link (the founders'
   ruling of November 5). */
.intake-promo > summary {
    display: flex; align-items: center; gap: 10px; width: 100%; max-width: 480px; min-height: 48px; padding: 12px 14px;
    border: 1.5px dashed var(--line-strong); border-radius: 12px; background: var(--sand);
    color: var(--forest); font-weight: 600; list-style: none; cursor: pointer;
}
.intake-promo > summary::-webkit-details-marker { display: none; }
.intake-promo > summary::before {
    content: '+'; display: grid; place-items: center; flex: 0 0 24px; width: 24px; height: 24px; border-radius: 50%;
    background: var(--forest); color: white; font-size: 18px; line-height: 1;
}
.intake-promo[open] > summary::before { content: '\2212'; }
.intake-promo > summary:focus-visible { outline: 3px solid var(--terracotta-text); outline-offset: 2px; }
.intake-promo-field { padding-top: 8px; }
.intake-promo-row { display: flex; gap: 8px; align-items: stretch; max-width: 480px; }
.intake-form .intake-promo-row input[type="text"] { flex: 1 1 auto; min-width: 0; }
/* On a phone the journey panel makes every .btn full width (journey.css); Apply keeps its own width beside the field. */
.intake-form .intake-promo-row .btn { flex: 0 0 auto; width: auto; }
.intake-promo-status:empty { display: none; }
.intake-card-element { max-width: 480px; padding: 14px; border: 1.5px solid #8a8079; border-radius: 12px; background: white; }
.intake-card-element:focus-within, .intake-card-element.StripeElement--focus { outline: 3px solid var(--terracotta-text); outline-offset: 2px; border-color: var(--forest); }
/* Checkout's consents sit directly in an .intake-field, whose label rule (block, bold, no padding) outranked
   .intake-choice: they lay out like the chat's, the box beside its sentence (small call 117). */
.intake-field > label.intake-choice { display: flex; font-weight: inherit; color: inherit; padding: 12px 14px; }
/* Consent links stand out from their sentence (site.css sets links to inherit colour with no underline). */
.intake-consent a, .chat-bubble a { text-decoration: underline; text-underline-offset: 2px; }
