:root {
    --bg: #f6f8f5;
    --panel: #ffffff;
    --text: #17231d;
    --muted: #65746c;
    --line: #dce5df;
    --accent: #176b43;
    --accent-dark: #0f4f31;
    --accent-soft: #e8f4ee;
    --danger: #b42318;
    --shadow: 0 18px 48px rgba(23, 35, 29, 0.12);
}

* {
    box-sizing: border-box;
}

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

button,
input {
    font: inherit;
}

.app-shell {
    width: 100%;
    min-height: 100vh;
    padding: 16px;
}

.form-panel {
    width: min(100%, 760px);
    margin: 0 auto;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.form-header {
    position: sticky;
    top: 0;
    z-index: 2;
    background: rgba(255, 255, 255, 0.96);
    border-bottom: 1px solid var(--line);
    padding: 18px 18px 14px;
}

.section-count {
    margin: 0 0 6px;
    color: var(--accent);
    font-size: 0.82rem;
    font-weight: 800;
    text-transform: uppercase;
}

h1,
h2 {
    margin: 0;
    line-height: 1.15;
}

h1 {
    font-size: clamp(1.35rem, 6vw, 2rem);
}

h2 {
    margin-bottom: 18px;
    font-size: 1.28rem;
}

.progress {
    height: 8px;
    margin-top: 16px;
    background: #edf2ef;
    border-radius: 999px;
    overflow: hidden;
}

.progress span {
    display: block;
    width: 12.5%;
    height: 100%;
    background: var(--accent);
    border-radius: inherit;
    transition: width 180ms ease;
}

form {
    padding: 18px;
}

.step {
    display: none;
}

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

label,
fieldset {
    display: block;
    margin: 0 0 14px;
}

label {
    color: var(--text);
    font-size: 0.95rem;
    font-weight: 700;
}

input[type="text"],
input[type="tel"],
input:not([type]) {
    width: 100%;
    min-height: 48px;
    margin-top: 7px;
    padding: 12px 13px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--text);
    outline: none;
}

input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(23, 107, 67, 0.14);
}

fieldset {
    padding: 13px;
    border: 1px solid var(--line);
    border-radius: 8px;
}

legend {
    padding: 0 4px;
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 800;
}

fieldset label,
.consent {
    display: flex;
    align-items: flex-start;
    min-height: 44px;
    gap: 10px;
    margin: 4px 0;
    padding: 8px;
    border-radius: 8px;
    font-weight: 650;
}

fieldset label:has(input:checked),
.consent:has(input:checked) {
    background: var(--accent-soft);
}

input[type="radio"],
input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin: 1px 0 0;
    accent-color: var(--accent);
    flex: 0 0 auto;
}

.privacy-note {
    margin: 10px 0 0;
    color: var(--muted);
    font-size: 0.9rem;
    line-height: 1.45;
}

.hp-field {
    position: absolute;
    left: -10000px;
    width: 1px;
    height: 1px;
    opacity: 0;
}

.status {
    min-height: 28px;
    margin-top: 16px;
    color: var(--muted);
    font-weight: 700;
}

.status.is-error {
    color: var(--danger);
}

.status.is-success {
    color: var(--accent-dark);
}

.actions {
    position: sticky;
    bottom: 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin: 18px -18px -18px;
    padding: 12px 18px calc(12px + env(safe-area-inset-bottom));
    background: rgba(255, 255, 255, 0.96);
    border-top: 1px solid var(--line);
}

.button {
    min-height: 50px;
    border: 0;
    border-radius: 8px;
    background: var(--accent);
    color: #fff;
    font-weight: 850;
    cursor: pointer;
}

.button:disabled {
    cursor: wait;
    opacity: 0.7;
}

.button-secondary {
    background: #eef3f0;
    color: var(--text);
}

#submitBtn {
    display: none;
}

.is-final #nextBtn {
    display: none;
}

.is-final #submitBtn {
    display: block;
}

.is-first #prevBtn {
    visibility: hidden;
}

.field-error {
    border-color: var(--danger) !important;
}

@media (min-width: 760px) {
    .app-shell {
        padding: 40px 20px;
    }

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

    .actions {
        margin-left: -28px;
        margin-right: -28px;
        padding-left: 28px;
        padding-right: 28px;
    }

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

    legend {
        grid-column: 1 / -1;
    }
}
