:root {
    --xealio-navy: #0a3556;
    --xealio-blue: #0b6ea8;
    --xealio-cyan: #1599be;
    --ink: #183247;
    --muted: #687b89;
    --line: #dfe7ec;
    --surface: #ffffff;
    --page: #ffffff;
    --soft-surface: #f5f8fa;
    --selected-surface: #eef8fc;
    --danger: #b42318;
    --success: #176b3a;
    --shadow: 0 18px 55px rgba(18, 58, 82, 0.09);
}

* {
    box-sizing: border-box;
}

html {
    color-scheme: light;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--page);
    color: var(--ink);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

.page-shell {
    width: min(1160px, calc(100% - 32px));
    margin: 48px auto;
}

.form-card {
    position: relative;
    overflow: hidden;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 24px;
    box-shadow: var(--shadow);
}

.form-card::before {
    content: "";
    position: absolute;
    inset: 0 0 auto;
    z-index: 2;
    height: 5px;
    background: linear-gradient(90deg, var(--xealio-navy), var(--xealio-blue), var(--xealio-cyan));
}

.form-header {
    padding: 38px 40px 30px;
    color: var(--ink);
    background: #ffffff;
    border-bottom: 1px solid var(--line);
}

.brand-row {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

.brand-mark {
    display: grid;
    flex: 0 0 52px;
    width: 52px;
    height: 52px;
    place-items: center;
    border: 1px solid rgba(11, 110, 168, .16);
    border-radius: 16px;
    color: #ffffff;
    background: linear-gradient(145deg, var(--xealio-blue), var(--xealio-navy));
    box-shadow: 0 10px 24px rgba(10, 53, 86, .16);
    font-size: 24px;
    font-weight: 800;
}

.eyebrow,
.step-kicker {
    margin: 0 0 8px;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .16em;
}

.eyebrow {
    color: var(--xealio-blue);
}

.form-header h1 {
    margin: 0;
    font-size: clamp(28px, 4vw, 42px);
    line-height: 1.08;
}

.intro {
    max-width: 720px;
    margin: 12px 0 0;
    color: var(--muted);
    line-height: 1.6;
}

.progress-wrap {
    margin-top: 28px;
}

.progress-meta {
    display: flex;
    justify-content: space-between;
    margin-bottom: 9px;
    font-size: 13px;
    font-weight: 700;
    color: var(--muted);
}

.progress-track {
    height: 8px;
    overflow: hidden;
    border-radius: 999px;
    background: #e8eff3;
}

.progress-bar {
    width: 20%;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--xealio-blue) 0%, var(--xealio-cyan) 100%);
    transition: width .3s ease;
}

.alert {
    margin: 28px 40px 0;
    padding: 14px 16px;
    border-radius: 12px;
    font-weight: 650;
}

.alert-error {
    color: var(--danger);
    background: #fff1f0;
    border: 1px solid #f6c7c3;
}

.alert-success {
    color: var(--success);
    background: #edf9f1;
    border: 1px solid #bce2c8;
}

form {
    padding: 38px 40px 34px;
}

.form-step {
    display: none;
    animation: fadeIn .22s ease;
}

.form-step.active {
    display: block;
}

.step-heading {
    margin-bottom: 26px;
}

.step-kicker {
    color: var(--xealio-blue);
}

.step-heading h2 {
    margin: 0;
    font-size: clamp(24px, 3vw, 34px);
}

.step-heading p {
    margin: 9px 0 0;
    color: var(--muted);
}

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

.treatment-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.choice-card {
    position: relative;
    min-height: 132px;
    cursor: pointer;
}

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

.choice-content {
    display: flex;
    height: 100%;
    flex-direction: column;
    justify-content: space-between;
    gap: 22px;
    padding: 20px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: #fff;
    font-weight: 700;
    line-height: 1.35;
    transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease, background .2s ease;
}

.choice-number {
    color: var(--xealio-blue);
    font-size: 12px;
    letter-spacing: .12em;
}

.choice-card:hover .choice-content {
    transform: translateY(-2px);
    border-color: #83b9d2;
    box-shadow: 0 10px 24px rgba(10, 53, 86, .08);
}

.choice-card input:checked + .choice-content {
    border-color: var(--xealio-blue);
    background: var(--selected-surface);
    box-shadow: 0 0 0 3px rgba(11, 110, 168, .09);
}

.choice-card input:focus-visible + .choice-content {
    outline: 3px solid rgba(21, 153, 190, .28);
    outline-offset: 3px;
}

.form-grid {
    display: grid;
    gap: 20px;
}

.two-columns {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.spacing-top {
    margin-top: 26px;
}

.field-group {
    display: grid;
    gap: 8px;
}

.field-group > span,
.consent-row span {
    font-size: 14px;
    font-weight: 750;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
    color: var(--ink);
    outline: none;
    transition: border-color .18s ease, box-shadow .18s ease;
}

input,
select {
    height: 50px;
    padding: 0 14px;
}

textarea {
    min-height: 132px;
    padding: 14px;
    resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--xealio-blue);
    box-shadow: 0 0 0 4px rgba(11,110,168,.09);
}

.is-invalid,
input:invalid:focus,
select:invalid:focus,
textarea:invalid:focus {
    border-color: var(--danger);
    box-shadow: 0 0 0 4px rgba(180,35,24,.08);
}

.input-unit {
    display: grid;
    grid-template-columns: 1fr auto;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 12px;
}

.input-unit input {
    border: 0;
    border-radius: 0;
}

.input-unit span {
    display: grid;
    place-items: center;
    padding: 0 14px;
    background: var(--soft-surface);
    color: var(--muted);
    font-size: 13px;
    font-weight: 750;
}

.full-width {
    grid-column: 1 / -1;
}

.consent-row {
    display: flex;
    gap: 11px;
    align-items: flex-start;
    padding: 15px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--soft-surface);
}

.consent-row input {
    width: 18px;
    height: 18px;
    margin-top: 1px;
    flex: 0 0 auto;
}

.form-navigation {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-top: 34px;
    padding-top: 24px;
    border-top: 1px solid var(--line);
}

.btn {
    min-height: 50px;
    padding: 0 24px;
    border: 0;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 800;
    transition: transform .18s ease, box-shadow .18s ease, opacity .18s ease;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn-primary:hover {
    box-shadow: 0 13px 28px rgba(10,53,86,.20);
}

.btn-secondary:hover {
    background: #e9f0f4;
}

.btn:disabled {
    cursor: not-allowed;
    opacity: .65;
    transform: none;
}

.btn-primary {
    margin-left: auto;
    color: #fff;
    background: linear-gradient(135deg, var(--xealio-blue), var(--xealio-navy));
    box-shadow: 0 10px 22px rgba(10,53,86,.16);
}

.btn-secondary {
    color: var(--ink);
    background: var(--soft-surface);
}

.honeypot {
    position: absolute !important;
    left: -9999px !important;
    width: 1px !important;
    height: 1px !important;
    opacity: 0 !important;
}

.field-error {
    min-height: 1px;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 900px) {
    .choice-grid,
    .treatment-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .page-shell {
        width: min(100% - 18px, 1160px);
        margin: 9px auto;
    }

    .form-card {
        border-radius: 18px;
    }

    .form-header,
    form {
        padding-left: 20px;
        padding-right: 20px;
    }

    .brand-row {
        gap: 14px;
    }

    .brand-mark {
        flex-basis: 44px;
        width: 44px;
        height: 44px;
        border-radius: 13px;
    }

    .choice-grid,
    .treatment-grid,
    .two-columns {
        grid-template-columns: 1fr;
    }

    .choice-card {
        min-height: 104px;
    }

    .full-width {
        grid-column: auto;
    }

    .form-navigation {
        position: sticky;
        bottom: 0;
        margin-left: -20px;
        margin-right: -20px;
        margin-bottom: -34px;
        padding: 16px 20px;
        background: rgba(255,255,255,.96);
        backdrop-filter: blur(10px);
    }

    .btn {
        width: 100%;
        padding: 0 15px;
    }
}

.additional-fieldset {
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
}

.additional-fieldset legend {
    margin-bottom: 10px;
    padding: 0;
    font-size: 14px;
    font-weight: 750;
}

.additional-fieldset legend small {
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
}

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

.checkbox-option {
    display: flex;
    min-height: 50px;
    align-items: center;
    gap: 10px;
    padding: 11px 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
    cursor: pointer;
    transition: border-color .18s ease, background .18s ease, box-shadow .18s ease;
}

.checkbox-option:hover {
    border-color: #83b9d2;
    background: var(--soft-surface);
}

.checkbox-option:has(input:checked) {
    border-color: var(--xealio-blue);
    background: var(--selected-surface);
    box-shadow: 0 0 0 3px rgba(11, 110, 168, .08);
}

.checkbox-option input {
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
    accent-color: var(--xealio-blue);
}

.checkbox-option span {
    font-size: 13px;
    font-weight: 700;
    line-height: 1.35;
}

@media (max-width: 640px) {
    .checkbox-grid {
        grid-template-columns: 1fr;
    }
}

.flow-input-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 150px;
    gap: 10px;
}

.field-group small,
.conditional-upload small {
    color: var(--muted);
    font-size: 12px;
    line-height: 1.45;
}

.conditional-upload {
    padding: 18px;
    border: 1px dashed #9fc5d8;
    border-radius: 14px;
    background: var(--selected-surface);
}

.conditional-upload > label {
    font-size: 14px;
    font-weight: 750;
}

.conditional-upload input[type="file"] {
    height: auto;
    min-height: 50px;
    padding: 10px 12px;
    background: #fff;
}

.conditional-upload input[type="file"]::file-selector-button {
    margin-right: 12px;
    padding: 9px 12px;
    border: 0;
    border-radius: 9px;
    color: #fff;
    background: var(--xealio-blue);
    cursor: pointer;
    font-weight: 750;
}

@media (max-width: 640px) {
    .flow-input-row {
        grid-template-columns: 1fr;
    }
}
