:root {
    color-scheme: light;
    --bg: #f3f6ff;
    --bg-soft: #eef3ff;
    --card: #ffffff;
    --text: #0f172a;
    --muted: #65708a;
    --border: #e1e6f0;
    --primary: #007aff;
    --primary-soft: rgba(0, 122, 255, 0.12);
    --danger: #ff3b30;
    --success: #34c759;
    --shadow: 0 22px 48px rgba(16, 24, 40, 0.16);
    --radius-lg: 22px;
    --radius-md: 14px;
    --radius-sm: 12px;
}

.auth-body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", sans-serif;
    color: var(--text);
    min-height: 100vh;
    background: radial-gradient(circle at top, #ffffff 0%, var(--bg) 55%, var(--bg-soft) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 20px 48px;
}

.auth-body::before {
    content: "";
    position: fixed;
    inset: 0;
    background-image: radial-gradient(rgba(15, 23, 42, 0.03) 1px, transparent 0);
    background-size: 22px 22px;
    opacity: 0.5;
    pointer-events: none;
}

.auth-body.dark {
    color-scheme: dark;
    --bg: #0f172a;
    --bg-soft: #151f34;
    --card: #1b2437;
    --text: #f8fafc;
    --muted: #b4bed6;
    --border: #2b3550;
    --primary: #5aa5ff;
    --primary-soft: rgba(90, 165, 255, 0.15);
    --shadow: 0 26px 50px rgba(0, 0, 0, 0.45);
}

.auth-shell {
    width: min(480px, 100%);
    position: relative;
    z-index: 1;
}

.auth-card {
    background: var(--card);
    border-radius: var(--radius-lg);
    padding: 26px;
    box-shadow: var(--shadow);
    border: 1px solid rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(12px);
}

.auth-brand {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, rgba(0, 122, 255, 0.12), rgba(0, 122, 255, 0.02));
    margin-bottom: 24px;
}

.auth-body.dark .auth-brand {
    background: linear-gradient(135deg, rgba(90, 165, 255, 0.22), rgba(27, 36, 55, 0.1));
}

.auth-brand-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.auth-app {
    font-weight: 600;
    margin: 0;
    font-size: 0.95rem;
}

.auth-tagline {
    margin: 0;
    font-size: 0.8rem;
    color: var(--muted);
}

.auth-logo {
    width: 46px;
    height: 46px;
    border-radius: 16px;
    background: var(--text);
    color: #ffffff;
    display: grid;
    place-items: center;
    font-weight: 600;
    letter-spacing: 1px;
    font-size: 0.9rem;
}

.auth-content {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.auth-header h1 {
    margin: 0 0 6px;
    font-size: 1.4rem;
}

.auth-header p {
    margin: 0;
    color: var(--muted);
    font-size: 0.95rem;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.field-label {
    font-size: 0.85rem;
    color: var(--muted);
}

.input-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    transition: border 0.2s ease, box-shadow 0.2s ease;
}

.input-wrap input {
    border: none;
    outline: none;
    background: transparent;
    flex: 1;
    font-size: 0.95rem;
    color: var(--text);
}

.input-wrap input::placeholder {
    color: rgba(101, 112, 138, 0.6);
}

.auth-body.dark .input-wrap input::placeholder {
    color: rgba(180, 190, 214, 0.7);
}

.input-wrap:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.18);
}

.input-icon {
    color: rgba(101, 112, 138, 0.9);
    display: flex;
    align-items: center;
}

.input-action {
    border: none;
    background: transparent;
    color: rgba(101, 112, 138, 0.9);
    cursor: pointer;
    padding: 4px;
}

.field.has-error .input-wrap {
    border-color: rgba(255, 59, 48, 0.6);
}

.field-error {
    color: var(--danger);
    font-size: 0.8rem;
    margin: 0;
}

.field-hint {
    color: var(--muted);
    font-size: 0.8rem;
    margin: 0;
}

.options {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    font-size: 0.85rem;
}

.checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--muted);
}

.checkbox input {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
}

.btn {
    border: none;
    border-radius: var(--radius-md);
    padding: 12px 16px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: transform 0.15s ease, box-shadow 0.2s ease;
}

.btn-primary {
    background: var(--primary);
    color: #ffffff;
    box-shadow: 0 12px 24px rgba(0, 122, 255, 0.3);
}

.btn-primary:hover {
    transform: translateY(-1px);
}

.btn-primary:disabled {
    opacity: 0.65;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-spinner {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #ffffff;
    display: none;
    animation: spin 0.8s linear infinite;
}

.btn.is-loading .btn-spinner {
    display: inline-block;
}

.link {
    color: var(--primary);
    text-decoration: none;
}

.link:hover {
    text-decoration: underline;
}

.helper-text {
    text-align: center;
    font-size: 0.85rem;
    color: var(--muted);
    margin: 0;
}

.auth-alert {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 10px 12px;
    border-radius: 12px;
    font-size: 0.85rem;
    margin-bottom: 16px;
}

.auth-alert.is-error {
    background: rgba(255, 59, 48, 0.12);
    color: #b42318;
}

.auth-alert.is-success {
    background: rgba(52, 199, 89, 0.12);
    color: #137547;
}

.auth-body.dark .auth-alert.is-error {
    color: #ffb4ac;
}

.auth-body.dark .auth-alert.is-success {
    color: #b3f0c8;
}

.alert-icon {
    display: grid;
    place-items: center;
}

.stepper {
    display: flex;
    gap: 8px;
}

.step {
    width: 38px;
    height: 4px;
    border-radius: 999px;
    background: rgba(101, 112, 138, 0.3);
}

.step.active {
    background: var(--primary);
}

.divider {
    height: 1px;
    background: var(--border);
    margin: 4px 0 2px;
}

.otp-group {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 8px;
}

.otp-group input {
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 10px 0;
    text-align: center;
    font-size: 1rem;
    background: transparent;
    color: var(--text);
}

.otp-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.18);
}

.otp-hint {
    margin: 6px 0 0;
    font-size: 0.8rem;
    color: var(--muted);
}

@media (max-width: 600px) {
    .auth-body {
        padding: 18px 14px 32px;
    }

    .auth-card {
        padding: 22px;
    }
}

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