/* Caller — welcome screen (sky blue) */
.auth-screen {
    height: 100dvh;
    max-height: 100dvh;
    display: flex;
    flex-direction: column;
    background: linear-gradient(165deg, #0369a1 0%, #0ea5e9 55%, #38bdf8 100%);
    overflow: hidden;
}

.auth-header {
    position: relative;
    flex: 0 0 auto;
    height: 36dvh;
    min-height: 220px;
    max-height: 300px;
    padding: calc(12px + env(safe-area-inset-top)) 24px 36px;
    background: transparent;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-back-btn {
    position: absolute;
    top: calc(12px + env(safe-area-inset-top));
    left: 20px;
    width: 38px;
    height: 38px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, .18);
    color: #fff;
    font-size: .9rem;
    display: grid;
    place-items: center;
    z-index: 2;
}
.auth-back-btn:active { background: rgba(255, 255, 255, .3); }

.auth-header-hero {
    text-align: center;
    width: 100%;
    max-width: 360px;
    padding: 0 4px;
}

.auth-wordmark {
    font-size: clamp(2.2rem, 10vw, 3.1rem);
    font-weight: 800;
    letter-spacing: -.05em;
    line-height: 1;
    margin-bottom: 18px;
}

.auth-tagline {
    --tagline-h: clamp(3.4rem, 11vw, 4rem);
    height: var(--tagline-h);
    overflow: hidden;
}
.auth-tagline-track {
    display: flex;
    flex-direction: column;
    animation: auth-tagline-cycle 12s cubic-bezier(.45, 0, .2, 1) infinite;
}
.auth-tagline-track span {
    flex-shrink: 0;
    height: var(--tagline-h);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
    font-size: clamp(1.35rem, 5.5vw, 1.75rem);
    font-weight: 500;
    line-height: 1.3;
    letter-spacing: -.015em;
    color: rgba(255, 255, 255, .95);
}
@keyframes auth-tagline-cycle {
    0%, 28% { transform: translateY(0); }
    33%, 61% { transform: translateY(calc(var(--tagline-h) * -1)); }
    66%, 94% { transform: translateY(calc(var(--tagline-h) * -2)); }
    100% { transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
    .auth-tagline-track { animation: none; }
    .auth-tagline { height: auto; overflow: visible; }
    .auth-tagline-track span:not(:first-child) { display: none; }
}

/* White sheet */
.auth-sheet {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 24px 24px 0 0;
    padding: 22px 22px calc(12px + env(safe-area-inset-bottom));
    box-shadow: 0 -6px 28px rgba(3, 105, 161, .18);
}

.auth-head {
    flex-shrink: 0;
    text-align: center;
    margin-bottom: 0;
}
.auth-head h1 {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -.025em;
}

.auth-steps {
    flex-shrink: 0;
    margin-bottom: 12px;
}
.auth-steps-track {
    height: 3px;
    background: #e8ecf0;
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 5px;
}
.auth-steps-track span {
    display: block;
    height: 100%;
    background: #0ea5e9;
    border-radius: 3px;
    transition: width .3s ease;
}
.auth-steps-text {
    font-size: .68rem;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: .05em;
    text-transform: uppercase;
}

.auth-alert {
    flex-shrink: 0;
    background: #991b1b;
    color: #fff;
    padding: 10px 12px;
    border-radius: 10px;
    font-size: .82rem;
    font-weight: 500;
    margin: 10px 0 0;
    border: 1px solid #7f1d1d;
}

.auth-body {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    margin-top: 0;
}

.auth-panel {
    width: 100%;
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}
.auth-panel.hidden { display: none !important; }

.auth-panel-pin {
    align-items: center;
}

.gate-step {
    width: 100%;
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.gate-step.hidden { display: none !important; }

.auth-pin-block {
    width: 100%;
    max-width: 320px;
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* PIN display — shows digits as you type */
.pin-display {
    display: flex;
    justify-content: center;
    gap: 14px;
    width: 100%;
    margin: -6px 0 12px;
    flex-shrink: 0;
}
.pin-cell {
    width: 76px;
    height: 84px;
    background: transparent;
    border: none;
    border-bottom: 3px solid #d4d4d8;
    border-radius: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.75rem;
    font-weight: 700;
    color: var(--text);
    transition: border-color .15s;
}
.pin-cell.filled {
    border-bottom-color: #0ea5e9;
}
.pin-cell.active {
    border-bottom-color: #0ea5e9;
    border-bottom-width: 3px;
}
.pin-display.error .pin-cell {
    border-bottom-color: var(--danger);
    animation: pin-shake .35s ease;
}
@keyframes pin-shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-3px); }
    75% { transform: translateX(3px); }
}

.auth-form {
    width: 100%;
    max-width: 320px;
    padding-top: 16px;
}

.auth-field { margin-bottom: 14px; }
.auth-label {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: .82rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 7px;
}
.auth-label i { font-size: .78rem; color: #94a3b8; }
.auth-field input {
    width: 100%;
    font-size: 1.05rem;
    padding: 10px 0 12px;
    border: none;
    border-bottom: 2px solid #d4d4d8;
    border-radius: 0;
    background: transparent;
    outline: none;
    color: var(--text);
    transition: border-color .15s;
}
.auth-field input:focus {
    border-bottom-color: #0ea5e9;
}
.auth-field input::placeholder { color: #94a3b8; }

.auth-btn {
    width: 100%;
    padding: 15px;
    border: none;
    border-radius: 999px;
    background: #0ea5e9;
    color: #fff;
    font-size: .98rem;
    font-weight: 600;
    margin-top: 6px;
    box-shadow: 0 4px 14px rgba(14, 165, 233, .3);
}
.auth-btn:active { background: #0284c7; }

/* Numpad — sits below PIN display, no huge gap */
.auth-pin-block .numpad {
    flex-shrink: 0;
    margin-top: auto;
    padding-bottom: 4px;
}
.numpad {
    display: grid;
    grid-template-columns: repeat(3, 52px);
    justify-content: center;
    gap: 10px;
}
.numpad button {
    width: 52px;
    height: 52px;
    border: none;
    border-radius: 50%;
    background: #f4f4f5;
    font-size: 1.25rem;
    font-weight: 500;
    color: var(--text);
    display: grid;
    place-items: center;
}
.numpad button:active { background: #e4e4e7; transform: scale(.96); }
.numpad button.numpad-empty { visibility: hidden; pointer-events: none; }
.numpad button.numpad-del {
    font-size: 1rem;
    color: var(--text-muted);
    background: transparent;
}
.numpad button.numpad-del:active { background: #f4f4f5; }

.auth-foot {
    flex-shrink: 0;
    text-align: center;
    padding-top: 10px;
    font-size: .84rem;
    color: var(--text-muted);
}
.auth-foot p.hidden { display: none !important; }
.auth-foot button {
    border: none;
    background: none;
    color: #0ea5e9;
    font-weight: 600;
    font-size: inherit;
    padding: 0;
}

.auth-screen.reg-stepped .auth-foot,
.auth-screen.login-username .auth-foot { display: none; }
.auth-screen.login-username #login-pin-group { display: none; }

@media (min-width: 520px) {
    .auth-screen {
        align-items: center;
        padding: 20px;
        justify-content: center;
    }
    .auth-header {
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        height: 220px;
        max-height: 220px;
    }
    .auth-sheet {
        position: relative;
        flex: none;
        width: 100%;
        max-width: 400px;
        border-radius: 24px;
        max-height: min(560px, calc(100dvh - 180px));
    }
}

@media (max-height: 680px) {
    .auth-header {
        height: 30dvh;
        min-height: 180px;
        padding-bottom: 28px;
    }
    .auth-wordmark { font-size: 2.2rem; margin-bottom: 14px; }
    .auth-tagline { --tagline-h: 3rem; }
    .auth-tagline-track span { font-size: 1.2rem; }
    .pin-cell { width: 66px; height: 72px; font-size: 2.35rem; }
    .numpad { grid-template-columns: repeat(3, 48px); gap: 8px; }
    .numpad button { width: 48px; height: 48px; font-size: 1.15rem; }
}
