/* ===== Design tokens (espanago.ru) ===== */
:root {
    --ivory: #f8f7f1;
    --mint: #d9ede4;
    --lavender: #e6e0f0;
    --peach: #fbe6d4;
    --dark: #333333;
    --primary: #6e57b2;
    --primary-dark: #5b4696;
    --secondary: #7fc9aa;
    --accent: #f8c05a;
    --rejection: #e57373;
    --white: #ffffff;
    --muted: rgba(51, 51, 51, 0.6);
    --line: rgba(0, 0, 0, 0.08);
    --shadow-soft: 0 4px 12px rgba(0, 0, 0, 0.05);
    --shadow-medium: 0 8px 24px rgba(0, 0, 0, 0.08);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background:
        radial-gradient(1200px 600px at 10% -10%, var(--lavender), transparent 60%),
        radial-gradient(900px 500px at 110% 0%, var(--mint), transparent 55%),
        var(--ivory);
    min-height: 100vh;
    color: var(--dark);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; transition: color .3s; }
a:hover { text-decoration: underline; }

.form-shell {
    max-width: 56rem;
    margin: 0 auto;
    padding: 2rem 1rem 4rem;
}
@media (min-width: 768px) { .form-shell { padding: 3rem 1.5rem 5rem; } }

/* ===== Header ===== */
.form-header { text-align: center; margin-bottom: 2rem; }
.logo-link { display: inline-block; margin-bottom: 1.5rem; }
.logo-mark {
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--primary);
    letter-spacing: -0.02em;
}

.form-eyebrow {
    display: inline-block;
    background: rgba(110, 87, 178, 0.1);
    color: var(--primary);
    font-size: 0.8125rem;
    font-weight: 600;
    padding: 0.375rem 1rem;
    border-radius: 9999px;
    margin-bottom: 1rem;
}

.form-title {
    font-size: 1.875rem;
    font-weight: 700;
    line-height: 1.15;
    margin-bottom: 0.75rem;
}
.form-title .hl { color: var(--primary); }
@media (min-width: 768px) { .form-title { font-size: 2.5rem; } }

.form-lead {
    color: rgba(51, 51, 51, 0.7);
    font-size: 1rem;
    max-width: 36rem;
    margin: 0 auto;
}

/* ===== Progress ===== */
.progress {
    background: var(--white);
    border-radius: 1rem;
    box-shadow: var(--shadow-soft);
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.progress-track {
    display: flex;
    gap: 0.5rem;
    list-style: none;
    align-items: center;
    min-width: max-content;
}
.progress-step {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--muted);
    font-size: 0.8125rem;
    font-weight: 500;
    white-space: nowrap;
}
.progress-step .dot {
    width: 1.75rem; height: 1.75rem;
    border-radius: 50%;
    background: rgba(110, 87, 178, 0.1);
    color: var(--primary);
    display: inline-flex;
    align-items: center; justify-content: center;
    font-weight: 700; font-size: 0.8125rem;
    border: 2px solid transparent;
    transition: all .3s;
}
.progress-step.active .dot {
    background: var(--primary); color: var(--white);
    box-shadow: 0 0 0 4px rgba(110, 87, 178, 0.15);
}
.progress-step.done .dot {
    background: var(--secondary); color: var(--white);
}
.progress-step.active { color: var(--dark); font-weight: 600; }
.progress-step + .progress-step::before {
    content: '';
    width: 1.5rem; height: 2px;
    background: var(--line);
    margin-right: 0.25rem;
}

/* ===== Card / Steps ===== */
.step-pane { display: none; animation: fadeIn .35s ease both; }
.step-pane.active { display: block; }
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.card {
    background: var(--white);
    border-radius: 1.25rem;
    padding: 1.5rem;
    box-shadow: var(--shadow-medium);
    border: 1px solid var(--line);
}
@media (min-width: 768px) { .card { padding: 2.25rem; } }

.card-badge {
    display: inline-block;
    background: var(--lavender);
    color: var(--primary);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    margin-bottom: 0.75rem;
}

.card-title {
    font-size: 1.375rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    line-height: 1.25;
}
@media (min-width: 768px) { .card-title { font-size: 1.625rem; } }

.card-lead {
    color: rgba(51, 51, 51, 0.7);
    margin-bottom: 1.5rem;
    font-size: 0.9375rem;
}

.subtitle {
    font-size: 1rem;
    font-weight: 700;
    color: var(--primary);
    margin: 1.75rem 0 0.875rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--line);
}

/* ===== Form blocks ===== */
.form-block {
    background: var(--ivory);
    border: 1px solid var(--line);
    border-radius: 1rem;
    padding: 1.25rem;
    margin-bottom: 1rem;
}
@media (min-width: 768px) {
    .form-block { padding: 1.5rem; }
}
.form-block:last-of-type { margin-bottom: 0; }

.block-title {
    font-size: 0.8125rem;
    font-weight: 700;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.block-title::before {
    content: '';
    width: 0.625rem;
    height: 0.625rem;
    background: var(--primary);
    border-radius: 50%;
    flex-shrink: 0;
}

.block-hint {
    font-size: 0.8125rem;
    color: var(--muted);
    margin: -0.5rem 0 1rem;
}

/* ===== Grid + Fields ===== */
.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: 1fr; }
.grid-3 { grid-template-columns: repeat(3, 1fr); gap: 0.625rem; }
@media (min-width: 640px) { .grid-2 { grid-template-columns: repeat(2, 1fr); } }

.field { display: flex; flex-direction: column; gap: 0.375rem; }
.field-wide { grid-column: 1 / -1; }
.field[hidden],
[hidden] { display: none !important; }

.label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--dark);
}
.label .muted { color: var(--muted); font-weight: 400; }

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="number"],
select {
    width: 100%;
    padding: 0.75rem 0.875rem;
    font-size: 0.9375rem;
    font-family: inherit;
    color: var(--dark);
    background: var(--ivory);
    border: 1.5px solid var(--line);
    border-radius: 0.75rem;
    transition: border-color .2s, box-shadow .2s, background .2s;
    appearance: none;
}
select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%236e57b2' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.875rem center;
    padding-right: 2.25rem;
}
input:focus, select:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--white);
    box-shadow: 0 0 0 4px rgba(110, 87, 178, 0.12);
}
input.invalid, select.invalid {
    border-color: var(--rejection);
    background: rgba(229, 115, 115, 0.05);
}

/* ===== Radio/Choice cards ===== */
.choice-group {
    display: grid;
    gap: 0.75rem;
    grid-template-columns: 1fr;
    margin-bottom: 1.5rem;
}
@media (min-width: 640px) { .choice-group { grid-template-columns: repeat(2, 1fr); } }

.choice {
    position: relative;
    background: var(--ivory);
    border: 2px solid var(--line);
    border-radius: 1rem;
    padding: 1rem 1.125rem;
    cursor: pointer;
    transition: all .2s;
    display: flex;
    gap: 0.875rem;
    align-items: flex-start;
}
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice .radio-mark {
    width: 1.25rem; height: 1.25rem;
    border-radius: 50%;
    border: 2px solid var(--primary);
    flex-shrink: 0;
    margin-top: 0.125rem;
    position: relative;
    transition: all .2s;
}
.choice input:checked + .radio-mark::after {
    content: '';
    position: absolute;
    inset: 3px;
    background: var(--primary);
    border-radius: 50%;
}
.choice-body strong { display: block; font-size: 0.9375rem; }
.choice-body span { font-size: 0.8125rem; color: var(--muted); }
.choice:hover { border-color: var(--primary); }
.choice:has(input:checked) {
    border-color: var(--primary);
    background: rgba(110, 87, 178, 0.06);
    box-shadow: 0 0 0 4px rgba(110, 87, 178, 0.08);
}

/* ===== Checkbox ===== */
.checkbox {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    padding: 0.875rem 1rem;
    border: 1.5px solid var(--line);
    border-radius: 0.75rem;
    background: var(--ivory);
    margin-bottom: 0.75rem;
    cursor: pointer;
    transition: all .2s;
    font-size: 0.875rem;
    line-height: 1.5;
}
.checkbox:hover { border-color: var(--primary); }
.checkbox input { margin-top: 0.2rem; accent-color: var(--primary); width: 1rem; height: 1rem; flex-shrink: 0; }
.checkbox:has(input:checked) {
    border-color: var(--primary);
    background: rgba(110, 87, 178, 0.05);
}

/* ===== Consent box ===== */
.consent-box {
    background: var(--ivory);
    border-left: 4px solid var(--primary);
    border-radius: 0 0.75rem 0.75rem 0;
    padding: 1rem 1.25rem;
    margin: 1.25rem 0 1.5rem;
    font-size: 0.875rem;
    color: rgba(51, 51, 51, 0.8);
}
.consent-box p { margin-bottom: 0.625rem; }
.consent-box p:last-child { margin-bottom: 0; }

/* ===== Buttons ===== */
.step-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--line);
}

.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: var(--primary);
    color: var(--white);
    padding: 0.875rem 1.75rem;
    border-radius: 0.75rem;
    font-size: 1rem;
    font-weight: 700;
    border: none;
    cursor: pointer;
    box-shadow: var(--shadow-medium);
    transition: all .3s;
    font-family: inherit;
    text-decoration: none;
}
.btn-primary:hover {
    background: var(--primary-dark);
    color: var(--white);
    transform: translateY(-2px);
    box-shadow: 0 12px 32px rgba(110, 87, 178, 0.3);
    text-decoration: none;
}
.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-ghost {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    background: transparent;
    color: var(--primary);
    padding: 0.875rem 1.25rem;
    border-radius: 0.75rem;
    font-size: 0.9375rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    font-family: inherit;
    transition: all .2s;
}
.btn-ghost:hover { background: rgba(110, 87, 178, 0.08); }

/* ===== Review ===== */
.review {
    background: var(--ivory);
    border-radius: 1rem;
    padding: 1.25rem;
    margin-bottom: 1.5rem;
    max-height: 26rem;
    overflow-y: auto;
}
.review-block { margin-bottom: 1.25rem; }
.review-block:last-child { margin-bottom: 0; }
.review-block h4 {
    font-size: 0.9375rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.5rem;
    padding-bottom: 0.375rem;
    border-bottom: 1px solid var(--line);
}
.review-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.125rem;
    padding: 0.375rem 0;
    font-size: 0.875rem;
}
@media (min-width: 640px) { .review-row { grid-template-columns: 12rem 1fr; gap: 0.75rem; } }
.review-row .k { color: var(--muted); }
.review-row .v { color: var(--dark); font-weight: 500; }

/* ===== Success ===== */
.card-success { text-align: center; }
.success-icon {
    width: 4rem; height: 4rem;
    border-radius: 50%;
    background: var(--secondary);
    color: var(--white);
    font-size: 2rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center; justify-content: center;
    margin: 0 auto 1.25rem;
    box-shadow: 0 8px 24px rgba(127, 201, 170, 0.4);
}

.muted { color: var(--muted); font-size: 0.875rem; }

/* ===== Footer ===== */
.form-footer {
    text-align: center;
    margin-top: 2rem;
    font-size: 0.8125rem;
    color: var(--muted);
}

/* ===== Field hints / notices ===== */
.field-hint {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.75rem;
    color: var(--muted);
    line-height: 1.4;
    font-weight: 400;
}

.subtitle-hint {
    margin: -0.5rem 0 1rem;
    font-size: 0.8125rem;
    color: var(--muted);
}

.latin-notice {
    background: rgba(248, 192, 90, 0.18);
    border-left: 4px solid var(--accent);
    border-radius: 0 0.75rem 0.75rem 0;
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    color: var(--dark);
    margin-bottom: 1.5rem;
}

.conditional {
    display: none;
}
.conditional.visible {
    display: contents;
}

/* ===== Error toast ===== */
.error-msg {
    color: var(--rejection);
    font-size: 0.8125rem;
    margin-top: 0.375rem;
    font-weight: 500;
}

/* ===== Questionnaire additions ===== */

/* Textarea — same look as inputs */
textarea {
    width: 100%;
    padding: 0.75rem 0.875rem;
    font-size: 0.9375rem;
    font-family: inherit;
    color: var(--dark);
    background: var(--ivory);
    border: 1.5px solid var(--line);
    border-radius: 0.75rem;
    transition: border-color .2s, box-shadow .2s, background .2s;
    resize: vertical;
    min-height: 3rem;
    line-height: 1.5;
}
textarea:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--white);
    box-shadow: 0 0 0 4px rgba(110, 87, 178, 0.12);
}
textarea.invalid { border-color: var(--rejection); background: rgba(229, 115, 115, 0.05); }

/* Single-column choice group (long descriptions / routing question) */
@media (min-width: 640px) {
    .choice-group--single { grid-template-columns: 1fr; }
}

/* Checkbox cards — reuse .choice layout with a square mark */
.choice--check .check-mark {
    width: 1.25rem; height: 1.25rem;
    border-radius: 0.375rem;
    border: 2px solid var(--primary);
    flex-shrink: 0;
    margin-top: 0.125rem;
    position: relative;
    transition: all .2s;
}
.choice--check input:checked + .check-mark {
    background: var(--primary);
}
.choice--check input:checked + .check-mark::after {
    content: '';
    position: absolute;
    left: 0.34rem; top: 0.12rem;
    width: 0.3rem; height: 0.6rem;
    border: solid var(--white);
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* ===== Chooser (landing /services/) ===== */
.chooser-grid {
    display: grid;
    gap: 1.25rem;
    grid-template-columns: 1fr;
}
@media (min-width: 768px) { .chooser-grid { grid-template-columns: repeat(2, 1fr); } }

.path-card {
    display: flex;
    flex-direction: column;
    background: var(--white);
    border: 2px solid var(--line);
    border-radius: 1.25rem;
    padding: 1.75rem;
    box-shadow: var(--shadow-soft);
    transition: all .25s;
    text-decoration: none;
    color: var(--dark);
    height: 100%;
}
.path-card:hover {
    border-color: var(--primary);
    transform: translateY(-3px);
    box-shadow: var(--shadow-medium);
    text-decoration: none;
}
.path-card .path-emoji { font-size: 1.75rem; margin-bottom: 0.75rem; }
.path-card h3 { font-size: 1.25rem; font-weight: 700; margin-bottom: 0.5rem; line-height: 1.2; }
.path-card .path-sub { color: var(--primary); font-weight: 600; font-size: 0.875rem; margin-bottom: 0.875rem; }
.path-card p { color: rgba(51,51,51,0.7); font-size: 0.9375rem; margin-bottom: 1rem; }
.path-card ul { list-style: none; margin: 0 0 1.25rem; padding: 0; }
.path-card li {
    position: relative;
    padding-left: 1.5rem;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    color: var(--dark);
}
.path-card li::before {
    content: '✓';
    position: absolute; left: 0;
    color: var(--secondary);
    font-weight: 700;
}
.path-card .path-go {
    margin-top: auto;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--primary);
    font-weight: 700;
    font-size: 0.9375rem;
}
.path-card--nl:hover { border-color: var(--secondary); }
.path-card--nl .path-sub { color: var(--secondary); }

.chooser-help {
    text-align: center;
    margin-top: 1.5rem;
    font-size: 0.9375rem;
    color: var(--muted);
}

/* Вторичная карточка чузера (шенгенская виза — не ВНЖ) */
.chooser-secondary {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem 1.25rem;
    margin-top: 1.25rem;
    padding: 1.25rem 1.5rem;
    border: 2px dashed var(--line);
    border-radius: 1.25rem;
    background: var(--ivory);
    text-decoration: none;
    color: var(--dark);
    transition: all .25s;
}
.chooser-secondary:hover { border-color: var(--accent); text-decoration: none; }
.chooser-secondary .path-emoji { font-size: 1.5rem; }
.chooser-secondary strong { display: block; font-size: 1rem; }
.chooser-secondary span.sub { font-size: 0.875rem; color: var(--muted); }
.chooser-secondary .path-go { margin-left: auto; }

/* ===== Опросник «Шенген»: карточки участников ===== */
.person-block {
    background: var(--white);
    border-color: rgba(110, 87, 178, 0.25);
}
.person-block + .person-block { margin-top: 1.25rem; }
.person-block .choice-group:last-of-type { margin-bottom: 0; }
.person-block .field[hidden] + .choice-group { margin-top: 0; }
