/* ============================================================
   Shared intake-form shell
   ------------------------------------------------------------
   Progress rail, section nav, panels, fields, question cards,
   signature block, buttons and the completion card.

   This used to be copy-pasted into every *Form.razor.css. It now
   lives here once; per-form stylesheets hold only what is genuinely
   specific to that form.
   ============================================================ */

.af {
    /* Role aliases onto the global palette in app.css. Nothing is
       redefined here: change a colour once in app.css and every
       intake form follows. */
    --ink: var(--text-primary);
    --muted: var(--text-secondary);
    --line: var(--border-color);
    --card: var(--card-background);
    --accent: var(--accent-color);
    --accent-ink: var(--accent-ink);
    --accent-soft: var(--accent-soft);
    --no: var(--neutral-color);
    --error: var(--error-color);
    --error-soft: var(--error-soft);
    display: grid;
    grid-template-columns: 240px minmax(0, 1fr);
    gap: 28px;
    align-items: start;
    max-width: 1040px;
    margin: 0 auto;
    color: var(--ink);
}

    .af.solo {
        display: block;
    }

/* ---------- Progress rail ---------- */

.af-rail {
    position: sticky;
    top: 84px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    padding: 20px 16px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 16px;
}

.ring {
    position: relative;
    width: 104px;
    height: 104px;
    flex: none;
}

    .ring svg {
        width: 100%;
        height: 100%;
    }

    .ring circle {
        fill: none;
        stroke-width: 7;
        stroke-linecap: round;
    }

.ring-bg {
    stroke: var(--line);
}

.ring-fg {
    stroke: var(--accent);
    transition: stroke-dashoffset .5s cubic-bezier(.4, 0, .2, 1);
}

.ring-num {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

    .ring-num small {
        margin-left: 1px;
        font-size: .75rem;
        font-weight: 500;
        color: var(--muted);
    }

.rail-text {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 2px;
}

    .rail-text .draft {
        margin-top: 6px;
        color: var(--accent-ink);
    }

    .rail-text span {
        font-size: .8rem;
        color: var(--muted);
    }

.dots {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
}

.dot {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 1.5px solid var(--line);
    border-radius: 50%;
    background: var(--card);
    color: var(--muted);
    font: inherit;
    font-size: .8rem;
    cursor: pointer;
    transition: background .2s, border-color .2s, color .2s;
}

    .dot:hover {
        border-color: var(--accent);
    }

    .dot.partial {
        border-color: var(--accent);
        background: var(--accent-soft);
        color: var(--accent-ink);
    }

    .dot.done {
        border-color: var(--accent);
        background: var(--accent);
        color: var(--on-accent);
    }

    .dot.missing {
        border-color: var(--error);
        background: var(--error-soft);
        color: var(--error);
    }

    .dot:focus-visible,
    .btn:focus-visible,
    .link:focus-visible {
        outline: 2px solid var(--accent);
        outline-offset: 2px;
    }

/* ---------- Header ---------- */

.af-head {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 16px;
}

.head-icon {
    display: grid;
    place-items: center;
    width: 52px;
    height: 52px;
    flex: none;
    border-radius: 50%;
    background: var(--accent-soft);
    color: var(--accent-ink);
}

.head-text {
    flex: 1;
    min-width: 0;
}

.af-head h1 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
    line-height: 1.25;
}

.lede,
.hint {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: .92rem;
}

.date {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex: none;
    padding: 6px 12px;
    border-radius: 999px;
    background: var(--surface-muted);
    color: var(--muted);
    font-size: .85rem;
    white-space: nowrap;
}

/* ---------- Sections and question cards ---------- */

.af-sec {
    margin-top: 28px;
    scroll-margin-top: 100px;
}

    .af-sec h2 {
        margin: 0;
        font-size: 1.125rem;
        font-weight: 600;
    }

.qcard {
    margin-top: 10px;
    padding: 16px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 14px;
    scroll-margin-top: 100px;
    transition: border-color .25s, background-color .25s;
}

    .qcard.done {
        border-color: var(--accent-border);
    }

    .qcard.missing {
        border-color: var(--error);
        background: var(--error-soft);
    }

.qrow {
    display: flex;
    align-items: center;
    gap: 14px;
}

.qnum {
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    flex: none;
    border: 1.5px solid var(--line);
    border-radius: 50%;
    color: var(--muted);
    font-size: .8rem;
    transition: background .25s, border-color .25s, color .25s;
}

.qcard.done .qnum {
    border-color: var(--accent);
    background: var(--accent);
    color: var(--on-accent);
}

.qtext {
    flex: 1;
    margin: 0;
    line-height: 1.45;
}

/* Yes / No toggle (rendered by YesNoToggle) */

/* The Yes/No control itself is styled by YesNoToggle.razor.css, which owns
   that markup. Only its placement inside a question row is set here. */

/* Follow-ups expand smoothly using grid rows */

.fu {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows .3s ease;
}

    .fu.open {
        grid-template-rows: 1fr;
    }

.fu-inner {
    min-height: 0;
    overflow: hidden;
    margin-left: 14px;
    padding-left: 28px;
    border-left: 2px solid var(--accent-soft);
}

.srow {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-top: 12px;
}

.stext {
    margin: 0;
    font-size: .92rem;
    line-height: 1.4;
}

.srow.missing .stext {
    color: var(--error);
}

.err {
    display: flex;
    margin: 10px 0 0 42px;
    color: var(--error);
    font-size: .85rem;
}

    .err.flush {
        margin-left: 0;
    }

/* ---------- Signature ---------- */

.signcard {
    margin-top: 10px;
    padding: 20px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 14px;
    transition: border-color .25s, background-color .25s;
}

    .signcard.missing {
        border-color: var(--error);
        background: var(--error-soft);
    }

.consent {
    margin: 0;
    padding: 14px 16px;
    border-radius: 12px;
    background: var(--surface-subtle);
    color: var(--muted);
    font-size: .92rem;
    line-height: 1.6;
}

.agree {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 16px 0 20px;
    cursor: pointer;
}

    .agree input {
        width: 20px;
        height: 20px;
        accent-color: var(--accent);
    }

.sig-label {
    display: block;
    margin-bottom: 4px;
    color: var(--muted);
    font-size: .85rem;
}

.sig-input {
    width: 100%;
    max-width: 420px;
    padding: 10px 2px;
    border: 0;
    border-bottom: 2px solid var(--line);
    background: transparent;
    color: var(--ink);
    font: inherit;
    font-size: 1rem;
    transition: border-color .2s;
}

    .sig-input:focus {
        border-bottom-color: var(--accent);
        outline: none;
    }

    .sig-input:focus-visible {
        outline: 2px solid var(--accent);
        outline-offset: 4px;
        border-radius: 4px;
    }

.sig-preview {
    min-height: 3rem;
    margin: 14px 0 0;
    font-family: "Segoe Script", "Bradley Hand", "Brush Script MT", cursive;
    font-size: 1.9rem;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

    .sig-preview.empty {
        color: var(--text-disabled);
    }

/* ---------- Summary and actions ---------- */

.summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 20px;
    padding: 12px 16px;
    border: 1px solid var(--error-border);
    border-radius: 12px;
    background: var(--error-soft);
    color: var(--error);
}

.link {
    padding: 4px 6px;
    border: 0;
    background: none;
    color: var(--error);
    font: inherit;
    font-weight: 600;
    text-decoration: underline;
    cursor: pointer;
}

.actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
    padding-bottom: 24px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 44px;
    padding: 0 22px;
    border: 1.5px solid transparent;
    border-radius: 999px;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: background .2s, border-color .2s, transform .12s;
}

    .btn:active {
        transform: scale(.98);
    }

    .btn.ghost {
        border-color: var(--line);
        background: transparent;
        color: var(--ink);
    }

        .btn.ghost:hover {
            background: var(--surface-muted);
        }

    .btn.primary {
        background: var(--accent);
        color: var(--on-accent);
    }

        .btn.primary:hover {
            background: var(--accent-ink);
        }

    .btn:disabled {
        opacity: .65;
        cursor: default;
    }

.spin {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, .5);
    border-top-color: var(--on-accent);
    border-radius: 50%;
    animation: spin .7s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ---------- Success ---------- */

.done-card {
    max-width: 480px;
    margin: 48px auto;
    padding: 40px 28px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--card);
    text-align: center;
}

    .done-card h2 {
        margin: 16px 0 6px;
        font-size: 1.4rem;
        font-weight: 600;
    }

    .done-card p {
        margin: 0 0 24px;
        color: var(--muted);
    }

.tick {
    width: 72px;
    height: 72px;
}

.tick-c,
.tick-p {
    fill: none;
    stroke: var(--accent);
    stroke-linecap: round;
    stroke-linejoin: round;
}

.tick-c {
    stroke-width: 2;
    stroke-dasharray: 151;
    stroke-dashoffset: 151;
    animation: draw .6s ease forwards;
}

.tick-p {
    stroke-width: 3;
    stroke-dasharray: 40;
    stroke-dashoffset: 40;
    animation: draw .35s .45s ease forwards;
}

@keyframes draw {
    to {
        stroke-dashoffset: 0;
    }
}


.notice {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 16px;
    padding: 12px 16px;
    border: 1px solid var(--accent-border);
    border-radius: 12px;
    background: var(--accent-soft);
    color: var(--accent-ink);
}

/* ---------- Small screens ---------- */

@media (max-width: 900px) {
    .af {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .af-rail {
        top: 60px;
        z-index: 5;
        flex-direction: row;
        gap: 12px;
        padding: 10px 14px;
        border-radius: 12px;
    }

    .ring {
        width: 48px;
        height: 48px;
    }

    .ring-num {
        font-size: .8rem;
    }

        .ring-num small,
        .dots {
            display: none;
        }

    .rail-text {
        align-items: flex-start;
        text-align: left;
    }
}

@media (max-width: 600px) {
    .af-head {
        flex-wrap: wrap;
    }

    .qrow {
        flex-wrap: wrap;
    }

    .qtext {
        flex: 1 1 calc(100% - 44px);
    }

    .qrow .seg {
        margin-left: 42px;
    }

    .fu-inner {
        margin-left: 8px;
        padding-left: 16px;
    }

    .srow {
        flex-wrap: wrap;
    }

    .actions {
        flex-direction: column-reverse;
    }

    .btn {
        width: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    .af *,
    .af *::before,
    .af *::after {
        transition: none !important;
        animation: none !important;
    }

    .tick-c,
    .tick-p {
        stroke-dashoffset: 0;
    }
}
/* Section list in the progress rail */

.steps {
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 100%;
}

.step {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--muted);
    font: inherit;
    font-size: .9rem;
    text-align: left;
    cursor: pointer;
    transition: background .2s, color .2s;
}

    .step:hover {
        background: var(--surface-muted);
    }

    .step:focus-visible {
        outline: 2px solid var(--accent);
        outline-offset: 2px;
    }

.step-dot {
    display: grid;
    place-items: center;
    width: 26px;
    height: 26px;
    flex: none;
    border: 1.5px solid var(--line);
    border-radius: 50%;
    font-size: .75rem;
    transition: background .2s, border-color .2s, color .2s;
}

.step.done {
    color: var(--ink);
}

    .step.done .step-dot {
        border-color: var(--accent);
        background: var(--accent);
        color: var(--on-accent);
    }

.step.missing {
    color: var(--error);
}

    .step.missing .step-dot {
        border-color: var(--error);
        background: var(--error-soft);
        color: var(--error);
    }

/* Panels and fields */

.panel {
    margin-top: 10px;
    padding: 20px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 14px;
    transition: border-color .25s, background-color .25s;
}

    .panel.done {
        border-color: var(--accent-border);
    }

    .panel.missing {
        border-color: var(--error);
        background: var(--error-soft);
    }

.grid2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.span2 {
    grid-column: 1 / -1;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

    .field > span {
        font-size: .88rem;
        font-weight: 500;
    }

        .field > span em,
        .plabel em {
            color: var(--muted);
            font-style: normal;
            font-weight: 400;
        }

    .field input,
    .field select,
    .field textarea {
        width: 100%;
        padding: 10px 12px;
        border: 1.5px solid var(--line);
        border-radius: 10px;
        background: var(--card-background);
        color: var(--ink);
        font: inherit;
        transition: border-color .2s;
    }

    .field textarea {
        min-height: 96px;
        resize: vertical;
        line-height: 1.5;
    }

        .field input:focus,
        .field select:focus,
        .field textarea:focus {
            border-color: var(--accent);
            outline: none;
        }

        .field input:focus-visible,
        .field select:focus-visible,
        .field textarea:focus-visible {
            outline: 2px solid var(--accent);
            outline-offset: 1px;
        }

        .field input:disabled,
        .field select:disabled,
        .field textarea:disabled {
            background: var(--surface-subtle);
            color: var(--ink);
            opacity: 1;
        }

    .field.bad input,
    .field.bad select,
    .field.bad textarea {
        border-color: var(--error);
    }

.ferr {
    color: var(--error);
    font-size: .82rem;
}

.fhint {
    color: var(--muted);
    font-size: .85rem;
}

.plabel {
    margin: 0 0 10px;
    font-size: .92rem;
    font-weight: 500;
}

.mt {
    margin-top: 22px;
}

.agree.tight {
    margin: 0 0 12px;
}


/* ---------- LIFT / PAT evaluation ---------- */



/* ============================================================
   Lift / PAT evaluation  (LFTIntakeForm, PATIntakeForm)
   ============================================================ */

.elist {
    padding: 4px 20px;
}

.erow {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    padding: 14px 0;
    border-top: 1px solid var(--line);
    scroll-margin-top: 100px;
}

    .erow:first-child {
        border-top: 0;
    }

    .erow.missing .ename {
        color: var(--error);
    }

.ename {
    flex: 1 1 200px;
    font-weight: 500;
}

.span-all {
    flex-basis: 100%;
}

.weight {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--muted);
    font-size: .9rem;
}

    .weight input,
    .weight select {
        width: 110px;
        padding: 8px 10px;
        border: 1.5px solid var(--line);
        border-radius: 10px;
        background: var(--card-background);
        color: var(--ink);
        font: inherit;
    }

    .weight.bad input,
    .weight.bad select {
        border-color: var(--error);
    }

    .weight input:focus-visible,
    .weight select:focus-visible {
        outline: 2px solid var(--accent);
        outline-offset: 1px;
    }

.fixed {
    color: var(--muted);
    font-size: .9rem;
}

.sec-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.bp {
    display: flex;
    align-items: center;
    gap: 8px;
}

    .bp input {
        min-width: 0;
    }

.grip {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.grip-col {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.grip-head {
    font-weight: 600;
}

.summary-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 10px;
}

.sum-card,
.final {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--card);
}

.final {
    margin-top: 14px;
    font-weight: 600;
}

.result {
    padding: 4px 12px;
    border-radius: 999px;
    font-size: .85rem;
    letter-spacing: .02em;
}

    .result.pass {
        background: var(--accent-soft);
        color: var(--accent-ink);
    }

    .result.fail {
        background: var(--error-soft);
        color: var(--error);
    }

    .result.pending {
        background: var(--surface-muted);
        color: var(--muted);
        font-weight: 500;
    }

@media (max-width: 600px) {
    .summary-grid {
        grid-template-columns: 1fr;
    }

    .elist {
        padding: 4px 14px;
    }
}

/* ============================================================
   Body map, pain scale and symptom chips
   (InitialIntakeForm, InjuryFirstReportForm)
   ============================================================ */

/* Symptom chips */

.chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.chip {
    padding: 8px 14px;
    border: 1.5px solid var(--line);
    border-radius: 999px;
    background: var(--card-background);
    color: var(--muted);
    font: inherit;
    cursor: pointer;
    transition: background .18s, border-color .18s, color .18s, transform .12s;
}

    .chip:hover:not(:disabled) {
        border-color: var(--accent);
    }

    .chip:active:not(:disabled) {
        transform: scale(.97);
    }

    .chip:focus-visible {
        outline: 2px solid var(--accent);
        outline-offset: 2px;
    }

    .chip.on {
        border-color: var(--accent);
        background: var(--accent-soft);
        color: var(--accent-ink);
        font-weight: 600;
    }

    .chip:disabled {
        cursor: default;
    }

/* Body diagram */

.body-wrap {
    position: relative;
    max-width: 700px;
    margin: 10px auto 0;
    overflow: hidden;
    border: 1.5px solid var(--line);
    border-radius: 12px;
    background: var(--card-background);
    cursor: crosshair;
    touch-action: manipulation;
}

    .body-wrap.locked {
        cursor: default;
    }

    .body-wrap img {
        display: block;
        width: 100%;
        pointer-events: none;
        user-select: none;
    }

.body-dot {
    position: absolute;
    width: 14px;
    height: 14px;
    border: 2px solid var(--card-background);
    border-radius: 50%;
    background: #dc2626;
    box-shadow: 0 0 0 1px #991b1b;
    transform: translate(-50%, -50%);
    pointer-events: none;
    animation: pop .2s ease;
}

@keyframes pop {
    from {
        transform: translate(-50%, -50%) scale(0);
    }

    to {
        transform: translate(-50%, -50%) scale(1);
    }
}

.body-tools {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-top: 12px;
}

.btn.sm {
    height: 36px;
    padding: 0 16px;
    font-size: .9rem;
}

/* Pain scale */

.pain {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 10px;
}

.pain-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 12px 6px;
    border: 1.5px solid var(--line);
    border-radius: 12px;
    background: var(--card-background);
    color: var(--muted);
    font: inherit;
    text-align: center;
    cursor: pointer;
    transition: background .18s, border-color .18s, color .18s, transform .12s;
}

    .pain-btn:hover:not(:disabled) {
        border-color: var(--accent);
    }

    .pain-btn:active:not(:disabled) {
        transform: scale(.97);
    }

    .pain-btn:focus-visible {
        outline: 2px solid var(--accent);
        outline-offset: 2px;
    }

    .pain-btn.on {
        border-color: var(--accent);
        background: var(--accent-soft);
        color: var(--accent-ink);
    }

    .pain-btn:disabled {
        cursor: default;
    }

.pain-num {
    font-size: 1.1rem;
    font-weight: 700;
}

.pain-title {
    font-size: .8rem;
    font-weight: 600;
}

.pain-desc {
    font-size: .75rem;
    line-height: 1.3;
}

/* Repeating rows (allergies, medications) */

.rowline {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 12px;
    align-items: end;
    margin-top: 12px;
}

.mrow {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-top: 12px;
    padding: 16px 48px 16px 16px;
    border: 1.5px solid var(--line);
    border-radius: 12px;
}

.mq {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    font-size: .92rem;
}

.icon-btn {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    transition: background .2s, color .2s;
}

    .icon-btn:hover {
        background: var(--surface-muted);
        color: var(--ink);
    }

    .icon-btn:focus-visible {
        outline: 2px solid var(--accent);
        outline-offset: 2px;
    }

    .icon-btn.corner {
        position: absolute;
        top: 10px;
        right: 8px;
    }

/* ---------- Small screens ---------- */

@media (max-width: 600px) {
    .grid2,
    .rowline {
        grid-template-columns: 1fr;
    }

    .pain {
        grid-template-columns: repeat(3, 1fr);
    }

    .mrow {
        padding-right: 16px;
        padding-top: 48px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .body-dot {
        animation: none;
    }
}

/* ============================================================
   Small screens: keep the section nav
   ------------------------------------------------------------
   The rail used to hide .steps below 900px, which left long forms
   with a progress ring and no way to see or jump between sections.
   Instead the rail wraps to two rows and the sections become a
   horizontally scrollable strip.

   These rules sit at the end of the file on purpose: .steps and
   .step are declared after the main media queries above, so a
   mobile override has to come last to win on source order.
   ============================================================ */

@media (max-width: 900px) {
    .af-rail {
        flex-wrap: wrap;
        row-gap: 10px;
    }

    .steps {
        flex-direction: row;
        flex-wrap: nowrap;
        gap: 6px;
        overflow-x: auto;
        overscroll-behavior-x: contain;
        scroll-snap-type: x proximity;
        padding-bottom: 2px;
        margin-bottom: -2px;
        /* Full-width second row of the wrapped rail. */
        flex-basis: 100%;
        scrollbar-width: thin;
    }

        .steps::-webkit-scrollbar {
            height: 4px;
        }

        .steps::-webkit-scrollbar-thumb {
            border-radius: 999px;
            background: var(--border-color);
        }

    .step {
        flex: 0 0 auto;
        gap: 6px;
        padding: 6px 12px 6px 8px;
        border: 1px solid var(--border-color);
        border-radius: 999px;
        background: var(--card-background);
        font-size: .85rem;
        white-space: nowrap;
        scroll-snap-align: start;
    }

        .step.done {
            border-color: var(--accent-border);
        }

        .step.missing {
            border-color: var(--error-border);
        }

    .step-dot {
        width: 20px;
        height: 20px;
        font-size: .75rem;
    }
}

@media (max-width: 600px) {
    /* Also last on purpose: .grid2 / .span2 are declared after the
       main media queries above. */
    .grid2 {
        grid-template-columns: 1fr;
    }

    .span2 {
        grid-column: auto;
    }
}

/* ============================================================
   Three-way answer control
   ------------------------------------------------------------
   For questions the two-state YesNoToggle can't carry, such as
   Yes / No / N-A or Present / Past / No. The three slots are
   styled by meaning, not by label:
     .on    the affirmative answer   (accent)
     .alt   the secondary answer     (neutral)
     .none  the "does not apply" one (grey)
   ============================================================ */

.tri {
    display: inline-flex;
    flex: none;
    gap: 2px;
    padding: 3px;
    border: 1.5px solid var(--line);
    border-radius: 999px;
    background: var(--surface-subtle);
}

.tri-btn {
    min-width: 52px;
    height: 34px;
    padding: 0 12px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--muted);
    font: inherit;
    font-weight: 500;
    cursor: pointer;
    transition: background .18s, color .18s, transform .12s;
}

    .tri-btn:hover:not(:disabled) {
        background: var(--surface-sunken);
    }

    .tri-btn:active:not(:disabled) {
        transform: scale(.96);
    }

    .tri-btn:focus-visible {
        outline: 2px solid var(--accent);
        outline-offset: 2px;
    }

    .tri-btn:disabled {
        cursor: default;
    }

    .tri-btn.on {
        background: var(--accent);
        color: var(--on-accent);
    }

    .tri-btn.alt.on {
        background: var(--neutral-color);
    }

    .tri-btn.none.on {
        background: var(--text-disabled);
    }

.tri.invalid {
    border-color: var(--error);
}

@media (prefers-reduced-motion: reduce) {
    .tri-btn {
        transition: none;
    }
}
