:root {
    --auth-ink-950: #020617;
    --auth-ink-900: #0f172a;
    --auth-ink-800: #1e293b;
    --auth-ink-700: #334155;
    --auth-ink-600: #475569;
    --auth-ink-500: #64748b;
    --auth-line: rgba(148, 163, 184, 0.22);
    --auth-line-strong: rgba(15, 23, 42, 0.14);
    --auth-surface: rgba(255, 255, 255, 0.94);
    --auth-surface-soft: rgba(248, 250, 252, 0.88);
    --auth-shadow: 0 28px 80px rgba(15, 23, 42, 0.12);
    --auth-shadow-soft: 0 18px 40px rgba(15, 23, 42, 0.08);
    --auth-focus: rgba(15, 23, 42, 0.08);
    --auth-success-bg: #ecfdf5;
    --auth-success-fg: #166534;
    --auth-danger-bg: #fff1f2;
    --auth-danger-fg: #be123c;
}

body:has(#dashboardSection.hidden),
body:has(#chatSection.hidden) {
    background:
        radial-gradient(circle at top left, rgba(15, 23, 42, 0.05), transparent 22%),
        radial-gradient(circle at bottom right, rgba(148, 163, 184, 0.12), transparent 26%),
        linear-gradient(180deg, #f8fafc 0%, #eff6ff 46%, #f8fafc 100%) !important;
}

#loginSection,
#authSection {
    position: relative;
    isolation: isolate;
}

#loginSection::before,
#authSection::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background:
        radial-gradient(circle at top, rgba(255, 255, 255, 0.75), transparent 26%),
        radial-gradient(circle at bottom right, rgba(15, 23, 42, 0.06), transparent 30%);
}

#loginSection > div:first-child,
#authSection > div:first-child {
    width: min(100%, 34rem);
}

#loginSection > div:first-child,
#authSection > div:first-child,
.auth-card {
    position: relative;
    overflow: hidden;
    border: 1px solid var(--auth-line);
    border-radius: 2rem !important;
    background: var(--auth-surface) !important;
    box-shadow: var(--auth-shadow) !important;
    backdrop-filter: blur(18px);
}

#loginSection > div:first-child::before,
#authSection > div:first-child::before,
.auth-card::before {
    content: "";
    position: absolute;
    inset: 0 0 auto;
    height: 4px;
    background: linear-gradient(90deg, #020617 0%, #334155 52%, #cbd5e1 100%);
}

.auth-brand-stack {
    margin-bottom: 1.85rem;
}

.auth-meta {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.45rem 0.82rem;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.2);
    background: var(--auth-surface-soft);
    color: var(--auth-ink-600);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.auth-mode-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.28rem 0.58rem;
    border-radius: 999px;
    background: var(--auth-ink-900);
    color: #ffffff;
    letter-spacing: 0.12em;
}

.auth-brand-mark {
    width: 4.6rem;
    height: 4.6rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-inline: auto;
    margin-bottom: 1.15rem;
    border-radius: 1.45rem;
    background: linear-gradient(180deg, #020617 0%, #1e293b 100%);
    color: #ffffff;
    box-shadow: 0 18px 36px rgba(15, 23, 42, 0.18);
}

.auth-brand-mark svg {
    width: 2rem;
    height: 2rem;
}

#loginSection .bg-indigo-100.rounded-full,
#loginSection .bg-brand-100.rounded-full,
#authSection .bg-teal-100.rounded-full {
    background: rgba(15, 23, 42, 0.08) !important;
    border: 1px solid rgba(148, 163, 184, 0.22);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65);
}

#loginSection .bg-indigo-100.rounded-full svg,
#loginSection .bg-brand-100.rounded-full svg,
#authSection .bg-teal-100.rounded-full svg,
#loginSection .text-indigo-600,
#loginSection .text-teal-600,
#authSection .text-teal-600 {
    color: var(--auth-ink-900) !important;
}

.auth-brand-title {
    color: var(--auth-ink-950) !important;
    font-size: 2rem !important;
    font-weight: 800 !important;
    letter-spacing: -0.03em;
}

.auth-brand-subtitle {
    margin-top: 0.85rem !important;
    color: var(--auth-ink-600) !important;
    font-weight: 500;
    line-height: 1.75;
    max-width: 30rem;
    margin-inline: auto;
}

.auth-tab-bar {
    display: flex;
    gap: 0.35rem;
    padding: 0.32rem;
    margin-bottom: 1.7rem !important;
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 999px;
    background: rgba(248, 250, 252, 0.9);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.auth-tab-bar > button {
    position: relative;
    z-index: 1;
    border: 0 !important;
    border-bottom-width: 0 !important;
    border-color: transparent !important;
    border-radius: 999px !important;
    padding: 0.9rem 1rem !important;
    font-weight: 700 !important;
    color: var(--auth-ink-500) !important;
    background: transparent !important;
    transition: background-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

.auth-tab-bar > button:hover {
    color: var(--auth-ink-900) !important;
    background: rgba(226, 232, 240, 0.75) !important;
}

.auth-tab-bar > button.text-indigo-600,
.auth-tab-bar > button.border-indigo-600,
.auth-tab-bar > button.border-b-2.border-indigo-600.text-indigo-600,
.auth-tab-bar > button.border-b-2.border-indigo-600 {
    background: linear-gradient(180deg, #020617 0%, #1e293b 100%) !important;
    color: #ffffff !important;
    -webkit-text-fill-color: #ffffff;
    text-shadow: 0 1px 0 rgba(2, 6, 23, 0.25);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.15);
}

.auth-tab-bar > button.text-gray-500,
.auth-tab-bar > button.border-transparent {
    color: #64748b !important;
}

.auth-tab-bar > button.text-gray-500:hover,
.auth-tab-bar > button.border-transparent:hover {
    color: var(--auth-ink-900) !important;
}

#loginSection h2,
#authSection h2 {
    color: var(--auth-ink-950);
    letter-spacing: -0.02em;
}

#loginSection p,
#authSection p {
    color: var(--auth-ink-500);
}

#loginSection label,
#authSection label {
    color: var(--auth-ink-700) !important;
    font-size: 0.84rem;
    font-weight: 700;
    letter-spacing: 0.01em;
}

#loginSection input[type="text"],
#loginSection input[type="password"],
#loginSection input[type="tel"],
#authSection input[type="text"],
#authSection input[type="password"],
#authSection input[type="tel"] {
    min-height: 3.25rem;
    border: 1px solid rgba(148, 163, 184, 0.24) !important;
    border-radius: 1rem !important;
    background: rgba(255, 255, 255, 0.98) !important;
    color: var(--auth-ink-950) !important;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.74),
        0 1px 2px rgba(15, 23, 42, 0.03);
    transition: border-color 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
}

#loginSection input::placeholder,
#authSection input::placeholder {
    color: #94a3b8 !important;
}

#loginSection input:focus,
#authSection input:focus {
    outline: none;
    border-color: rgba(15, 23, 42, 0.75) !important;
    box-shadow: 0 0 0 4px var(--auth-focus) !important;
}

.auth-primary-btn {
    min-height: 3.25rem;
    border-radius: 1rem !important;
    border: 1px solid rgba(15, 23, 42, 0.94) !important;
    background: linear-gradient(180deg, #020617 0%, #1e293b 100%) !important;
    color: #ffffff !important;
    font-weight: 700 !important;
    letter-spacing: 0.01em;
    box-shadow: 0 14px 28px rgba(15, 23, 42, 0.16);
    transition: transform 0.16s ease, box-shadow 0.16s ease, background-color 0.16s ease !important;
}

.auth-primary-btn:hover {
    transform: translateY(-1px);
    background: linear-gradient(180deg, #111827 0%, #0f172a 100%) !important;
    box-shadow: 0 18px 34px rgba(15, 23, 42, 0.18);
}

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

.auth-choice-card {
    border: 1px solid rgba(148, 163, 184, 0.18) !important;
    border-radius: 1.1rem !important;
    background: rgba(255, 255, 255, 0.92) !important;
    box-shadow: var(--auth-shadow-soft);
    transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease, background-color 0.16s ease;
}

.auth-choice-card:hover {
    transform: translateY(-1px);
    border-color: rgba(15, 23, 42, 0.16) !important;
    background: rgba(248, 250, 252, 0.98) !important;
    box-shadow: 0 18px 36px rgba(15, 23, 42, 0.1);
}

.auth-choice-card .auth-choice-icon {
    width: 2.8rem;
    height: 2.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.95rem;
    border: 1px solid rgba(148, 163, 184, 0.18);
    background: rgba(248, 250, 252, 0.96) !important;
    color: var(--auth-ink-900) !important;
}

.auth-choice-card .auth-choice-copy {
    color: var(--auth-ink-500) !important;
}

.auth-secondary-btn {
    min-height: 3rem;
    border-radius: 1rem !important;
    border: 1px solid rgba(148, 163, 184, 0.2) !important;
    background: rgba(248, 250, 252, 0.96) !important;
    color: var(--auth-ink-700) !important;
    font-weight: 700 !important;
    transition: background-color 0.16s ease, color 0.16s ease, border-color 0.16s ease;
}

.auth-secondary-btn:hover {
    background: #ffffff !important;
    color: var(--auth-ink-950) !important;
    border-color: rgba(15, 23, 42, 0.14) !important;
}

.auth-text-link {
    color: var(--auth-ink-600) !important;
    font-weight: 600;
    transition: color 0.16s ease;
}

.auth-text-link:hover {
    color: var(--auth-ink-950) !important;
}

#loginError,
#authError {
    background: var(--auth-danger-bg) !important;
    color: var(--auth-danger-fg) !important;
    border: 1px solid rgba(244, 63, 94, 0.18);
}

#loginSuccess {
    background: var(--auth-success-bg) !important;
    color: var(--auth-success-fg) !important;
    border: 1px solid rgba(34, 197, 94, 0.18);
}

#loginSection #otpInput {
    letter-spacing: 0.55em;
    font-variant-numeric: tabular-nums;
}

#loginSection #otpInput,
#authSection .otp-inputs input {
    border-radius: 1rem !important;
    background: rgba(255, 255, 255, 0.98) !important;
    color: var(--auth-ink-950) !important;
}

#authSection .otp-inputs {
    gap: 0.72rem;
}

#authSection .otp-inputs input {
    width: 3.45rem;
    height: 3.9rem;
    border: 1px solid rgba(148, 163, 184, 0.24);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.74),
        0 1px 2px rgba(15, 23, 42, 0.03);
}

#authSection .otp-inputs input:focus {
    border-color: rgba(15, 23, 42, 0.75);
    box-shadow: 0 0 0 4px var(--auth-focus);
}

#authSection .otp-inputs input.filled {
    border-color: rgba(15, 23, 42, 0.75);
    background: rgba(248, 250, 252, 0.98);
}

#authSection .step-dot.active,
#authSection .step-line.active {
    background: var(--auth-ink-900) !important;
}

#authSection .resend-timer,
#loginSection #resendTimer {
    color: var(--auth-ink-500) !important;
}

#authSection .resend-timer .countdown {
    color: var(--auth-ink-800) !important;
}

.captcha-visual {
    position: relative;
    overflow: hidden;
    isolation: isolate;
    background:
        radial-gradient(circle at 18% 28%, rgba(15, 23, 42, 0.14) 0 1.5px, transparent 2px),
        radial-gradient(circle at 74% 62%, rgba(2, 6, 23, 0.12) 0 1px, transparent 2px),
        repeating-linear-gradient(17deg, rgba(15, 23, 42, 0.06) 0 2px, transparent 2px 12px),
        linear-gradient(135deg, #ffffff 0%, #f8fafc 52%, #e2e8f0 100%) !important;
    letter-spacing: 0.22em;
    transform: skewX(-4deg);
    text-shadow:
        1px 0 rgba(15, 23, 42, 0.16),
        -1px 1px rgba(148, 163, 184, 0.34);
    user-select: none;
}

.captcha-visual::before,
.captcha-visual::after {
    content: "";
    position: absolute;
    inset: -20%;
    pointer-events: none;
    z-index: -1;
}

.captcha-visual::before {
    background:
        linear-gradient(103deg, transparent 0 41%, rgba(15, 23, 42, 0.22) 42% 43%, transparent 44% 100%),
        linear-gradient(-18deg, transparent 0 58%, rgba(100, 116, 139, 0.26) 59% 60%, transparent 61% 100%);
    transform: rotate(-3deg);
}

.captcha-visual::after {
    background-image:
        radial-gradient(circle, rgba(15, 23, 42, 0.18) 0 1px, transparent 1.5px),
        radial-gradient(circle, rgba(148, 163, 184, 0.18) 0 1px, transparent 1.5px);
    background-position: 0 0, 9px 7px;
    background-size: 17px 13px, 19px 15px;
    opacity: 0.72;
}

@media (max-width: 768px) {
    #loginSection,
    #authSection {
        padding: 1rem !important;
    }

    #loginSection > div:first-child,
    #authSection > div:first-child,
    .auth-card {
        border-radius: 1.45rem !important;
        padding: 1.35rem !important;
    }

    .auth-brand-title {
        font-size: 1.7rem !important;
    }

    .auth-meta {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
    }

    .auth-tab-bar {
        flex-direction: column;
        border-radius: 1.25rem;
    }

    .auth-tab-bar > button {
        width: 100%;
    }

    #authSection .otp-inputs input {
        width: 3rem;
        height: 3.5rem;
        font-size: 1.35rem;
    }

    #loginSection #otpInput {
        font-size: 1.65rem !important;
        letter-spacing: 0.34em;
    }
}
