/* ── Design tokens ── */
:root {
    --bg: hsl(45, 30%, 97%);
    --fg: hsl(200, 25%, 15%);
    --card: #ffffff;
    --primary: hsl(45, 90%, 50%);
    --primary-fg: hsl(200, 30%, 12%);
    --secondary: hsl(160, 45%, 40%);
    --secondary-fg: #ffffff;
    --muted: hsl(45, 15%, 92%);
    --muted-fg: hsl(200, 10%, 45%);
    --border: hsl(45, 15%, 85%);
    --radius: 0.75rem;
    --step-active: hsl(45, 90%, 50%);
    --step-done: hsl(160, 45%, 40%);
    --step-pending: hsl(45, 15%, 80%);
    --green-dark: hsl(160, 50%, 26%);
    --green-mid: hsl(160, 45%, 36%);
}

/* ── Reset ── */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
    min-height: 100vh;
    background: linear-gradient(150deg, var(--green-dark) 0%, var(--green-mid) 100%);
    color: var(--fg);
}

/* ── Header ── */
header {
    position: sticky;
    top: 0;
    z-index: 20;
    background: rgba(255,255,255,.95);
    backdrop-filter: blur(10px);
    box-shadow: 0 1px 12px rgba(0,0,0,.12);
}

.header-inner {
    max-width: 780px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
}

.header-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

    .header-icon svg {
        width: 20px;
        height: 20px;
        color: var(--primary-fg);
    }

.header-title {
    font-size: 1.1rem;
    font-weight: 700;
    line-height: 1.2;
}

.header-sub {
    font-size: 0.72rem;
    color: var(--muted-fg);
}

/* ── Page wrapper ── */
.page-wrapper {
    max-width: 760px;
    margin: 0 auto;
    padding: 32px 16px 48px;
}

/* ── Main card ── */
.main-card {
    background: var(--card);
    border-radius: 20px;
    box-shadow: 0 24px 64px rgba(0,0,0,.22), 0 4px 12px rgba(0,0,0,.08);
    padding: 36px 32px;
}

@media (max-width: 540px) {
    .main-card {
        padding: 24px 16px;
        border-radius: 14px;
    }

    .page-wrapper {
        padding: 16px 10px 36px;
    }
}

/* ── Step indicator ── */
.step-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-bottom: 32px;
}

.step-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.step-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    font-weight: 700;
    transition: all .25s;
}

    .step-circle.pending {
        background: var(--step-pending);
        color: var(--muted-fg);
    }

    .step-circle.active {
        background: var(--step-active);
        color: var(--primary-fg);
        box-shadow: 0 4px 14px hsl(45 90% 50% / .4);
    }

    .step-circle.done {
        background: var(--step-done);
        color: #fff;
    }

.step-label {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--muted-fg);
}

    .step-label.active {
        color: var(--fg);
    }

.step-line {
    width: 48px;
    height: 2px;
    margin-bottom: 20px;
    background: var(--step-pending);
    border-radius: 2px;
    transition: background .25s;
}

    .step-line.done {
        background: var(--step-done);
    }

/* ── Screen visibility ── */
.screen {
    display: none;
}

    .screen.active {
        display: block;
    }

/* ══════════════════════════════════
   SCREEN 1 – CPF
══════════════════════════════════ */
.cpf-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 28px;
    max-width: 380px;
    margin: 0 auto;
}

.big-icon {
    width: 80px;
    height: 80px;
    border-radius: 16px;
    background: hsl(45 90% 50% / .14);
    display: flex;
    align-items: center;
    justify-content: center;
}

    .big-icon svg {
        width: 40px;
        height: 40px;
        color: var(--primary-fg);
        opacity: .8;
    }

.text-center {
    text-align: center;
}

.title-lg {
    font-size: 1.45rem;
    font-weight: 800;
}

.subtitle {
    color: var(--muted-fg);
    font-size: 0.88rem;
    margin-top: 6px;
}

.full-width {
    width: 100%;
}

/* ── Inputs & Selects ── */
input, select {
    width: 100%;
    padding: 0 14px !important;
    height: 44px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    background: var(--card);
    color: var(--fg);
    font-family: inherit;
    font-size: 0.92rem;
    transition: border-color .2s, box-shadow .2s;
    outline: none;
    appearance: none;
}

    input:focus, select:focus {
        border-color: var(--secondary);
        box-shadow: 0 0 0 3px hsl(160 45% 40% / .18);
    }

    input.cpf-input {
        text-align: center;
        font-size: 1.2rem;
        height: 56px;
        font-family: monospace;
        letter-spacing: 0.18em;
        border-width: 2px;
    }

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 48px;
    padding: 0 20px;
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 0.92rem;
    font-weight: 700;
    cursor: pointer;
    border: none;
    transition: all .2s;
    width: 100%;
}

    .btn:disabled {
        opacity: .42;
        cursor: not-allowed;
    }

.btn-primary {
    background: var(--primary);
    color: var(--primary-fg);
}

    .btn-primary:not(:disabled):hover {
        background: hsl(45 90% 44%);
        transform: translateY(-1px);
        box-shadow: 0 4px 14px hsl(45 90% 50% / .35);
    }

.btn-secondary {
    background: var(--secondary);
    color: var(--secondary-fg);
}

    .btn-secondary:not(:disabled):hover {
        background: hsl(160 45% 34%);
        transform: translateY(-1px);
    }

.btn-outline {
    background: transparent;
    color: var(--fg);
    border: 1.5px solid var(--border);
}

    .btn-outline:not(:disabled):hover {
        background: var(--muted);
    }

.btn-sm {
    height: 42px;
}

.btn-tall {
    height: 56px;
    font-size: .9rem;
}

/* ── Spinner ── */
.spinner {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid hsl(200 30% 12% / .25);
    border-top-color: var(--primary-fg);
    animation: spin .7s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ══════════════════════════════════
   SCREEN 2 – FORM
══════════════════════════════════ */
.form-header {
    text-align: center;
    margin-bottom: 28px;
}

/* Section blocks */
.form-section {
    margin-bottom: 8px;
}

.section-header {
    display: flex;
    align-items: center;
    gap: 10px;
    background: hsl(160, 30%, 95%);
    border-left: 4px solid var(--secondary);
    border-radius: 8px;
    padding: 10px 14px;
    margin-bottom: 18px;
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: hsl(160, 40%, 26%);
}

    .section-header svg {
        width: 16px;
        height: 16px;
        flex-shrink: 0;
    }

/* Grid */
.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.grid-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 14px;
}

@media (max-width: 500px) {
    .grid-3 {
        grid-template-columns: 1fr 1fr;
    }

    .mobile-full {
        grid-column: 1 / -1;
    }

    .spacer {
        display: none;
    }
}

.col-span-2 {
    grid-column: span 2;
}

/* Field */
.field-label {
    display: block;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--muted-fg);
    margin-bottom: 5px;
}

/* Custom select */
.select-wrap {
    position: relative;
}

    .select-wrap select {
        padding-right: 34px;
    }

    .select-wrap::after {
        content: '';
        position: absolute;
        right: 12px;
        top: 50%;
        transform: translateY(-50%);
        width: 0;
        height: 0;
        border-left: 5px solid transparent;
        border-right: 5px solid transparent;
        border-top: 5px solid var(--muted-fg);
        pointer-events: none;
    }

/* Section divider between form sections */
.section-gap {
    margin-top: 24px;
}

/* Button row */
.btn-row {
    display: flex;
    gap: 12px;
    margin-top: 28px;
}

    .btn-row .btn {
        flex: 1;
    }

/* ══════════════════════════════════
   SCREEN 3 – PHOTO
══════════════════════════════════ */
.photo-wrap {
    max-width: 420px;
    margin: 0 auto;
}

.photo-card {
    background: hsl(160, 20%, 97%);
    border: 1px solid hsl(160, 20%, 88%);
    border-radius: 14px;
    padding: 20px;
    margin-top: 8px;
}

.photo-card-title {
    font-size: 0.875rem;
    font-weight: 700;
    margin-bottom: 14px;
}

.photo-guide {
    display: flex;
    gap: 16px;
    align-items: center;
    justify-content: space-around;
}

.photo-container {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-flow: column;
    gap: 18px;
    flex: 0;
}

.photo-face {
    width: 100px;
    height: 130px;
    border-radius: 10px;
    background: var(--muted);
    border: 2px solid var(--step-done);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

    .photo-face.male {
        background: url('avatar_male.webp') no-repeat center center;
        background-size: cover;
    }

    .photo-face.female {
        background: url('avatar_female.webp') no-repeat center center;
        background-size: cover;
    }

    .photo-face svg {
        width: 44px;
        height: 44px;
        color: var(--muted-fg);
    }

.photo-check {
    position: absolute;
    bottom: -7px;
    right: -7px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--step-done);
    display: flex;
    align-items: center;
    justify-content: center;
}

    .photo-check svg {
        width: 12px;
        height: 12px;
        color: #fff;
    }

.photo-tips {
    font-size: 0.8rem;
    color: var(--muted-fg);
    line-height: 1.8;
}

.photo-preview {
    border-radius: 14px;
    overflow: hidden;
    border: 2px solid var(--step-done);
    box-shadow: 0 4px 16px rgba(0,0,0,.1);
}

    .photo-preview img {
        width: 100%;
        display: block;
    }

.photo-btns-row {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

    .photo-btns-row .btn {
        flex: 1;
    }

/* ── Camera modal ── */
.modal-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.65);
    z-index: 100;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

    .modal-backdrop.open {
        display: flex;
    }

.modal {
    background: var(--card);
    border-radius: 16px;
    width: 100%;
    max-width: 520px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    box-shadow: 0 24px 48px rgba(0,0,0,.3);
}

.modal-title {
    font-size: 1.1rem;
    font-weight: 700;
}

.modal-video-wrap {
    border-radius: 10px;
    overflow: hidden;
    background: #111;
    aspect-ratio: 4/3;
}

    .modal-video-wrap video {
        width: 100%;
        height: 100%;
        object-fit: cover;
        display: block;
    }

/* ── Toast ── */
.toast {
    position: fixed;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--secondary);
    color: var(--secondary-fg);
    padding: 12px 28px;
    border-radius: 50px;
    font-weight: 700;
    font-size: 0.88rem;
    box-shadow: 0 6px 28px rgba(0,0,0,.22);
    transition: transform .35s cubic-bezier(.34,1.56,.64,1);
    white-space: nowrap;
    z-index: 200;
}

    .toast.show {
        transform: translateX(-50%) translateY(0);
    }

/* ══════════════════════════════════
   SCREEN 4 – SUCCESS
══════════════════════════════════ */
.success-wrap {
    padding: 20px 0 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.success-inner {
    text-align: center;
    max-width: 340px;
}

.success-circle {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--secondary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 24px;
    box-shadow: 0 8px 24px hsl(160 45% 40% / .35);
}

    .success-circle svg {
        width: 38px;
        height: 38px;
    }

.success-title {
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 12px;
}

.success-msg {
    color: var(--muted-fg);
    line-height: 1.65;
    font-size: 0.92rem;
}

/* ── Camera warning ── */
.camera-warning {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    background: hsl(0, 72%, 97%);
    border: 1.5px solid hsl(0, 72%, 80%);
    border-radius: var(--radius);
    padding: 14px 16px;
    font-size: 0.82rem;
    line-height: 1.55;
    color: hsl(0, 50%, 35%);
    width: 100%;
}

/* ── Utilities ── */
.space-y > * + * {
    margin-top: 12px;
}
