:root {
    --auth-bg: #eef1ec;
    --auth-ink: #17211d;
    --auth-muted: #66736d;
    --auth-line: rgba(23, 33, 29, 0.12);
    --auth-surface: #fffdf8;
    --auth-surface-soft: #f7f1e7;
    --auth-forest: #183d34;
    --auth-mint: #8fd8b1;
    --auth-coral: #ef6f5c;
    --auth-amber: #f4b24d;
    --auth-danger: #c64545;
    --auth-success: #168354;
    --auth-shadow-lg: 0 28px 80px rgba(24, 61, 52, 0.16);
    --auth-shadow-md: 0 18px 42px rgba(24, 61, 52, 0.12);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
}

body {
    min-height: 100svh;
    display: grid;
    place-items: center;
    padding: 24px;
    color: var(--auth-ink);
    font-family: 'Manrope', 'Segoe UI', sans-serif;
    background:
        linear-gradient(135deg, rgba(239, 111, 92, 0.13), transparent 30%),
        linear-gradient(315deg, rgba(143, 216, 177, 0.2), transparent 34%),
        var(--auth-bg);
}

.auth-shell {
    width: min(1120px, 100%);
    min-height: min(720px, calc(100svh - 48px));
    display: grid;
    grid-template-columns: minmax(0, 1.08fr) minmax(360px, 0.92fr);
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.68);
    border-radius: 28px;
    background: var(--auth-surface);
    box-shadow: var(--auth-shadow-lg);
}

.auth-hero {
    position: relative;
    display: flex;
    min-height: 100%;
    flex-direction: column;
    justify-content: space-between;
    padding: clamp(28px, 5vw, 64px);
    color: #f7fff8;
    background:
        linear-gradient(150deg, rgba(24, 61, 52, 0.97), rgba(24, 61, 52, 0.78)),
        repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.08) 0 1px, transparent 1px 58px),
        repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.06) 0 1px, transparent 1px 58px);
    isolation: isolate;
}

.auth-hero::after {
    content: '';
    position: absolute;
    inset: auto 0 0;
    height: 44%;
    background: linear-gradient(180deg, transparent, rgba(8, 23, 18, 0.62));
    z-index: -1;
}

.brand-mark {
    width: 76px;
    height: 76px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 22px;
    background: rgba(255, 253, 248, 0.11);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18);
    animation: auth-rise 0.6s ease both;
}

.brand-mark span {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--auth-mint);
}

.auth-kicker {
    margin: clamp(28px, 6vw, 74px) 0 12px;
    color: rgba(247, 255, 248, 0.7);
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
}

.auth-hero h1 {
    max-width: 12ch;
    margin: 0;
    color: #fffdf8;
    font-family: 'Space Grotesk', sans-serif;
    font-size: clamp(2.4rem, 6vw, 5.7rem);
    font-weight: 700;
    line-height: 0.95;
    animation: auth-rise 0.72s 0.06s ease both;
}

.auth-copy {
    max-width: 54ch;
    margin: 24px 0 0;
    color: rgba(247, 255, 248, 0.78);
    font-size: clamp(0.98rem, 1.2vw, 1.08rem);
    line-height: 1.72;
    animation: auth-rise 0.72s 0.12s ease both;
}

.signal-board {
    width: min(420px, 100%);
    margin-top: 36px;
    padding: 18px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 20px;
    background: rgba(255, 253, 248, 0.1);
    box-shadow: 0 22px 60px rgba(0, 0, 0, 0.18);
    backdrop-filter: blur(14px);
    animation: auth-rise 0.72s 0.18s ease both;
}

.signal-head,
.signal-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.signal-head {
    padding-bottom: 12px;
    color: rgba(247, 255, 248, 0.62);
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
}

.signal-head strong {
    color: var(--auth-mint);
}

.signal-row {
    min-height: 44px;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    color: rgba(247, 255, 248, 0.78);
    font-size: 0.9rem;
}

.signal-row strong {
    color: #fffdf8;
    font-size: 1.1rem;
}

.signal-bars {
    height: 86px;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    align-items: end;
    gap: 10px;
    margin-top: 16px;
}

.signal-bars span {
    min-height: 22px;
    border-radius: 999px 999px 6px 6px;
    background: linear-gradient(180deg, var(--auth-amber), var(--auth-coral));
    transform-origin: bottom;
    animation: auth-pulse 2.8s ease-in-out infinite;
}

.signal-bars span:nth-child(1) {
    height: 44%;
}

.signal-bars span:nth-child(2) {
    height: 72%;
    animation-delay: 0.16s;
}

.signal-bars span:nth-child(3) {
    height: 55%;
    animation-delay: 0.3s;
}

.signal-bars span:nth-child(4) {
    height: 86%;
    animation-delay: 0.44s;
}

.signal-bars span:nth-child(5) {
    height: 64%;
    animation-delay: 0.58s;
}

.auth-panel {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: clamp(24px, 4vw, 54px);
    background:
        linear-gradient(180deg, rgba(255, 253, 248, 0.98), rgba(247, 241, 231, 0.72)),
        var(--auth-surface);
}

.panel-eyebrow {
    margin: 0 0 10px;
    color: var(--auth-coral);
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
}

.auth-panel-header h2 {
    margin: 0;
    color: var(--auth-ink);
    font-family: 'Space Grotesk', sans-serif;
    font-size: clamp(1.9rem, 3vw, 2.7rem);
    line-height: 1;
}

.auth-panel-header p:last-child {
    max-width: 34ch;
    margin: 12px 0 0;
    color: var(--auth-muted);
    font-size: 0.95rem;
    line-height: 1.58;
}

.auth-tabs {
    position: relative;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    margin-top: 28px;
    padding: 6px;
    border: 1px solid var(--auth-line);
    border-radius: 16px;
    background: rgba(247, 241, 231, 0.72);
}

.auth-tab {
    min-height: 42px;
    border: 0;
    border-radius: 11px;
    background: transparent;
    color: var(--auth-muted);
    cursor: pointer;
    font: inherit;
    font-weight: 800;
    transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.auth-tab:hover {
    color: var(--auth-forest);
}

.auth-tab.active {
    color: #fffdf8;
    background: var(--auth-forest);
    box-shadow: 0 12px 24px rgba(24, 61, 52, 0.18);
}

.auth-form {
    display: grid;
    gap: 10px;
    margin-top: 22px;
    animation: auth-fade 0.22s ease both;
}

.auth-form.is-hidden {
    display: none;
}

.field-label {
    margin-top: 4px;
    color: var(--auth-ink);
    font-size: 0.84rem;
    font-weight: 800;
}

.field-input {
    width: 100%;
    min-height: 50px;
    padding: 0 15px;
    border: 1px solid var(--auth-line);
    border-radius: 14px;
    outline: none;
    color: var(--auth-ink);
    background: rgba(255, 255, 255, 0.76);
    font: inherit;
    transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.field-input::placeholder {
    color: rgba(102, 115, 109, 0.66);
}

.field-input:focus {
    border-color: rgba(239, 111, 92, 0.72);
    background: #ffffff;
    box-shadow: 0 0 0 4px rgba(239, 111, 92, 0.13);
}

.btn-primary {
    min-height: 50px;
    margin-top: 4px;
    padding: 0 18px;
    border: 0;
    border-radius: 14px;
    color: #fffdf8;
    background: var(--auth-forest);
    box-shadow: 0 18px 34px rgba(24, 61, 52, 0.22);
    cursor: pointer;
    font: inherit;
    font-size: 0.96rem;
    font-weight: 800;
    transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.btn-primary:hover {
    background: #205246;
    box-shadow: 0 22px 42px rgba(24, 61, 52, 0.26);
    transform: translateY(-1px);
}

.btn-primary:active {
    transform: translateY(0);
}

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

.btn-primary.is-loading::after {
    content: '';
    width: 14px;
    height: 14px;
    display: inline-block;
    margin-left: 9px;
    border: 2px solid rgba(255, 255, 255, 0.42);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: auth-spin 0.8s linear infinite;
    vertical-align: -2px;
}

.form-message {
    min-height: 22px;
    margin: 4px 0 0;
    color: var(--auth-muted);
    font-size: 0.86rem;
    line-height: 1.45;
}

.form-message.is-error {
    color: var(--auth-danger);
}

.form-message.is-success {
    color: var(--auth-success);
}

.otp-overlay {
    position: fixed;
    inset: 0;
    z-index: 40;
    display: grid;
    place-items: center;
    padding: 22px;
    background: rgba(15, 27, 23, 0.46);
    backdrop-filter: blur(10px);
}

.otp-overlay.is-hidden {
    display: none;
}

.otp-card {
    width: min(440px, 100%);
    padding: 26px;
    border: 1px solid rgba(255, 255, 255, 0.68);
    border-radius: 24px;
    color: var(--auth-ink);
    background: var(--auth-surface);
    box-shadow: var(--auth-shadow-md);
}

.otp-card h3 {
    margin: 0;
    color: var(--auth-ink);
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.42rem;
}

.otp-card p {
    margin: 10px 0 0;
    color: var(--auth-muted);
}

.otp-email {
    color: var(--auth-forest);
    font-weight: 800;
}

.otp-inputs {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 8px;
    margin-top: 18px;
}

.otp-digit {
    width: 100%;
    min-height: 52px;
    border: 1px solid var(--auth-line);
    border-radius: 14px;
    outline: none;
    color: var(--auth-ink);
    background: rgba(247, 241, 231, 0.72);
    text-align: center;
    font-size: 1.2rem;
    font-weight: 800;
}

.otp-digit:focus {
    border-color: rgba(239, 111, 92, 0.72);
    box-shadow: 0 0 0 4px rgba(239, 111, 92, 0.13);
}

.btn-verify {
    width: 100%;
    margin-top: 16px;
}

.otp-resend-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 14px;
    color: var(--auth-muted);
    font-size: 0.86rem;
}

.btn-link {
    border: 0;
    padding: 0;
    color: var(--auth-forest);
    background: transparent;
    cursor: pointer;
    font: inherit;
    font-weight: 800;
}

.btn-link:disabled {
    color: rgba(102, 115, 109, 0.48);
    cursor: not-allowed;
}

/* Divider */
.auth-divider {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 14px 0 8px;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--auth-line);
}

.auth-divider span {
    padding: 0 12px;
    color: var(--auth-muted);
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 1px;
    text-transform: uppercase;
}

/* Button Login with Code */
.btn-code-login {
    width: 100%;
    min-height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 16px;
    border: 1.5px solid rgba(24, 61, 52, 0.22);
    border-radius: 14px;
    color: var(--auth-forest);
    background: rgba(247, 241, 231, 0.6);
    font: inherit;
    font-size: 0.94rem;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.18s ease;
}

.btn-code-login:hover {
    background: #ffffff;
    border-color: var(--auth-forest);
    box-shadow: 0 8px 20px rgba(24, 61, 52, 0.08);
    transform: translateY(-1px);
}

.btn-code-login:active {
    transform: translateY(0);
}

.btn-code-login:disabled {
    cursor: not-allowed;
    opacity: 0.65;
    transform: none;
}

.btn-code-login.is-loading::after {
    content: '';
    width: 14px;
    height: 14px;
    display: inline-block;
    margin-left: 6px;
    border: 2px solid rgba(24, 61, 52, 0.25);
    border-top-color: var(--auth-forest);
    border-radius: 50%;
    animation: auth-spin 0.8s linear infinite;
    vertical-align: -2px;
}

/* Code Login Header & Elements */
.code-login-header {
    padding: 4px 0 6px;
}

.code-login-kicker {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 8px;
    background: rgba(143, 216, 177, 0.25);
    color: var(--auth-forest);
    font-size: 0.8rem;
    font-weight: 800;
    margin-bottom: 6px;
}

.code-login-desc {
    margin: 4px 0 10px;
    color: var(--auth-muted);
    font-size: 0.88rem;
    line-height: 1.5;
}

.code-login-desc strong {
    color: var(--auth-forest);
}

.code-timer-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 10px;
    background: #fef2f2;
    border: 1px solid #fee2e2;
    color: #991b1b;
    font-size: 0.82rem;
    font-weight: 700;
}

.code-timer-badge.is-expired {
    background: #f3f4f6;
    border-color: #e5e7eb;
    color: #6b7280;
}

.timer-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ef4444;
    animation: auth-pulse 1.2s infinite;
}

.code-timer-badge.is-expired .timer-dot {
    background: #9ca3af;
    animation: none;
}

.code-input-single {
    font-family: monospace, Consolas, sans-serif;
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: 8px;
    text-align: center;
}

.code-login-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
}

.btn-back {
    font-size: 0.86rem;
    color: var(--auth-muted);
}

.btn-back:hover {
    color: var(--auth-forest);
}

@keyframes auth-spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes auth-rise {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes auth-fade {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes auth-pulse {
    0%,
    100% {
        transform: scaleY(0.84);
        opacity: 0.72;
    }
    50% {
        transform: scaleY(1);
        opacity: 1;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
    }
}

@media (max-width: 900px) {
    body {
        align-items: start;
        padding: 14px;
    }

    .auth-shell {
        min-height: auto;
        grid-template-columns: 1fr;
        border-radius: 22px;
    }

    .auth-hero {
        min-height: 470px;
    }

    .auth-hero h1 {
        max-width: 13ch;
    }
}

@media (max-width: 560px) {
    body {
        padding: 0;
        background: var(--auth-surface);
    }

    .auth-shell {
        width: 100%;
        border: 0;
        border-radius: 0;
        box-shadow: none;
    }

    .auth-hero,
    .auth-panel {
        padding: 24px;
    }

    .auth-hero {
        min-height: 430px;
    }

    .brand-mark {
        width: 58px;
        height: 58px;
        border-radius: 16px;
    }

    .auth-hero h1 {
        font-size: 2.45rem;
    }

    .signal-board {
        padding: 14px;
    }

    .auth-tabs {
        margin-top: 22px;
    }

    .otp-card {
        padding: 22px;
    }

    .otp-inputs {
        gap: 6px;
    }

    .otp-digit {
        min-height: 48px;
        border-radius: 12px;
    }
}
