:root {
    --auth-bg: #f5f7fb;
    --auth-bg-2: #ffffff;
    --auth-surface: #ffffff;
    --auth-surface-2: #f0f2f8;
    --auth-border: #e3e6ee;
    --auth-border-soft: #ebedf3;
    --auth-text: #0c1322;
    --auth-muted: #5b6478;
    --auth-section: #909aa9;
    --auth-accent: #059669;
    --auth-accent-2: #10b981;
    --auth-accent-soft: rgba(5, 150, 105, 0.10);
    --auth-violet: #7c3aed;
    --auth-violet-2: #6d28d9;
    --auth-violet-soft: rgba(124, 58, 237, 0.10);
    --auth-danger: #dc2626;
    --auth-danger-soft: rgba(220, 38, 38, 0.10);
    --auth-warn: #d97706;
    --auth-warn-soft: rgba(217, 119, 6, 0.10);
}
[data-theme="dark"] {
    --auth-bg: #0b1020;
    --auth-bg-2: #0f152a;
    --auth-surface: #131a30;
    --auth-surface-2: #1a2240;
    --auth-border: #25304e;
    --auth-border-soft: #1d2742;
    --auth-text: #e9edf6;
    --auth-muted: #8d95ac;
    --auth-section: #5d6483;
    --auth-accent: #10b981;
    --auth-accent-2: #059669;
    --auth-accent-soft: rgba(16, 185, 129, 0.12);
    --auth-violet: #8b5cf6;
    --auth-violet-2: #7c3aed;
    --auth-violet-soft: rgba(139, 92, 246, 0.14);
    --auth-danger: #ef4444;
    --auth-danger-soft: rgba(239, 68, 68, 0.12);
    --auth-warn: #f59e0b;
    --auth-warn-soft: rgba(245, 158, 11, 0.12);
}

* { box-sizing: border-box; }

body.auth-body {
    margin: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--auth-bg);
    color: var(--auth-text);
    font-size: 14px;
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    position: relative;
}
body.auth-body::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
        radial-gradient(circle at 15% 20%, var(--auth-violet-soft) 0%, transparent 40%),
        radial-gradient(circle at 85% 80%, var(--auth-accent-soft) 0%, transparent 40%);
    pointer-events: none;
    z-index: 0;
}

.auth-top {
    position: relative;
    z-index: 2;
    padding: 18px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.auth-top__left { display: flex; align-items: center; gap: 12px; }
.auth-brand-mark {
    width: 36px; height: 36px; border-radius: 10px;
    background: linear-gradient(135deg, var(--auth-accent) 0%, var(--auth-violet) 100%);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 13px;
    box-shadow: 0 6px 18px rgba(124, 58, 237, 0.35);
}
.auth-brand-name { font-weight: 700; font-size: 15px; line-height: 36px; }

.auth-top__right { display: flex; align-items: center; gap: 10px; }
.auth-theme-btn {
    height: 38px; padding: 0 14px;
    border-radius: 10px;
    border: 1px solid var(--auth-border);
    background: var(--auth-surface);
    color: var(--auth-muted);
    font-size: 13px; font-weight: 500;
    display: inline-flex; align-items: center; gap: 8px;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
}
.auth-theme-btn:hover { color: var(--auth-text); border-color: var(--auth-violet); }

.auth-shell {
    position: relative;
    z-index: 1;
    min-height: calc(100vh - 74px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
}

.auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--auth-surface);
    border: 1px solid var(--auth-border);
    border-radius: 18px;
    padding: 36px 32px;
    box-shadow: 0 30px 60px -20px rgba(0, 0, 0, 0.10),
                0 0 0 1px rgba(124, 58, 237, 0.04);
    position: relative;
}
.auth-card::before {
    content: '';
    position: absolute;
    top: -1px; left: 24px; right: 24px;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--auth-violet), transparent);
}
.auth-card--wide { max-width: 480px; }

.auth-card__header { text-align: center; margin-bottom: 28px; }
.auth-card__mark {
    width: 56px; height: 56px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--auth-accent) 0%, var(--auth-violet) 100%);
    color: #fff;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 22px;
    margin-bottom: 16px;
    box-shadow: 0 10px 30px -8px rgba(124, 58, 237, 0.5);
}
.auth-card__mark--success {
    background: linear-gradient(135deg, var(--auth-accent) 0%, var(--auth-accent-2) 100%);
}
.auth-card__title { font-size: 22px; font-weight: 700; letter-spacing: -0.01em; }
.auth-card__subtitle { font-size: 13.5px; color: var(--auth-muted); margin-top: 6px; }

.auth-field { margin-bottom: 16px; }
.auth-field__label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--auth-muted);
    margin-bottom: 7px;
    letter-spacing: 0.02em;
}
.auth-field__wrap {
    position: relative;
    display: flex;
    align-items: center;
}
.auth-field__icon {
    position: absolute;
    left: 14px;
    color: var(--auth-section);
    font-size: 13px;
    pointer-events: none;
}
.auth-field__input {
    width: 100%;
    height: 46px;
    background: var(--auth-surface-2);
    border: 1px solid var(--auth-border);
    border-radius: 11px;
    padding: 0 14px 0 42px;
    font-size: 14px;
    color: var(--auth-text);
    font-family: inherit;
    transition: border 0.15s, box-shadow 0.15s;
}
.auth-field__input:focus {
    outline: none;
    border-color: var(--auth-violet);
    box-shadow: 0 0 0 3px var(--auth-violet-soft);
}
.auth-field__input::placeholder { color: var(--auth-section); }
.auth-field__input[readonly] {
    background: var(--auth-surface-2);
    color: var(--auth-text);
    cursor: default;
}
.auth-field__eye {
    position: absolute;
    right: 12px;
    background: transparent;
    border: 0;
    color: var(--auth-section);
    cursor: pointer;
    padding: 6px;
    font-size: 13px;
}
.auth-field__eye:hover { color: var(--auth-text); }
.auth-field__hint { font-size: 11.5px; color: var(--auth-section); margin-top: 6px; }

.auth-btn-primary {
    width: 100%;
    height: 48px;
    border: 0;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--auth-accent) 0%, var(--auth-violet) 100%);
    color: #fff;
    font-size: 14px; font-weight: 600;
    cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    margin-top: 8px;
    box-shadow: 0 10px 25px -8px rgba(124, 58, 237, 0.5);
    transition: transform 0.1s, box-shadow 0.15s;
    text-decoration: none;
}
.auth-btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 32px -8px rgba(124, 58, 237, 0.6);
    color: #fff;
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 22px 0 18px;
    font-size: 11.5px;
    color: var(--auth-section);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}
.auth-divider::before, .auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--auth-border);
}

.auth-register-link {
    text-align: center;
    font-size: 13.5px;
    color: var(--auth-muted);
}
.auth-register-link a {
    color: var(--auth-accent);
    font-weight: 600;
    text-decoration: none;
}
.auth-register-link a:hover { color: var(--auth-violet); }

.auth-footer {
    text-align: center;
    color: var(--auth-section);
    font-size: 12px;
    margin-top: 24px;
}

.auth-alert {
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 13px;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    line-height: 1.4;
}
.auth-alert--error {
    background: var(--auth-danger-soft);
    border: 1px solid rgba(220, 38, 38, 0.25);
    color: var(--auth-danger);
}
.auth-alert--success {
    background: var(--auth-accent-soft);
    border: 1px solid rgba(5, 150, 105, 0.25);
    color: var(--auth-accent);
}
.auth-alert--info {
    background: var(--auth-violet-soft);
    border: 1px solid rgba(124, 58, 237, 0.25);
    color: var(--auth-violet);
}

.auth-success-block {
    background: var(--auth-accent-soft);
    border: 1px solid rgba(5, 150, 105, 0.25);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 18px;
}
.auth-success-block__title {
    font-weight: 600;
    color: var(--auth-accent);
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.auth-success-block__body { font-size: 13px; color: var(--auth-muted); line-height: 1.5; }

.auth-password-display {
    background: var(--auth-surface-2);
    border: 1px dashed var(--auth-violet);
    border-radius: 12px;
    padding: 16px;
    margin: 0 0 16px;
    position: relative;
}
.auth-password-display__label {
    font-size: 11px;
    color: var(--auth-section);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 8px;
}
.auth-password-display__value {
    font-family: 'JetBrains Mono', 'SF Mono', Menlo, monospace;
    font-size: 17px;
    font-weight: 600;
    letter-spacing: 0.05em;
    color: var(--auth-text);
    word-break: break-all;
    padding-right: 44px;
}
.auth-copy-btn {
    position: absolute;
    top: 12px; right: 12px;
    background: var(--auth-surface);
    border: 1px solid var(--auth-border);
    color: var(--auth-muted);
    width: 32px; height: 32px;
    border-radius: 8px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: color 0.15s, border-color 0.15s;
}
.auth-copy-btn:hover { color: var(--auth-violet); border-color: var(--auth-violet); }
.auth-copy-btn.copied { color: var(--auth-accent); border-color: var(--auth-accent); }

.auth-warning-note {
    font-size: 12.5px;
    color: var(--auth-warn);
    background: var(--auth-warn-soft);
    border: 1px solid rgba(217, 119, 6, 0.20);
    padding: 12px 14px;
    border-radius: 11px;
    line-height: 1.5;
    display: flex; gap: 10px; align-items: flex-start;
    margin-bottom: 18px;
}
.auth-warning-note a {
    color: var(--auth-warn);
    font-weight: 600;
    text-decoration: underline;
}

.auth-env-links {
    margin-bottom: 18px;
}
.auth-env-links__label {
    font-size: 12px;
    color: var(--auth-muted);
    margin-bottom: 8px;
    font-weight: 500;
}
.auth-env-links__list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.auth-env-links__item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--auth-surface-2);
    border: 1px solid var(--auth-border);
    border-radius: 10px;
    color: var(--auth-text);
    font-size: 13px;
    text-decoration: none;
    transition: border-color 0.15s, color 0.15s;
}
.auth-env-links__item:hover {
    border-color: var(--auth-violet);
    color: var(--auth-violet);
}
.auth-env-links__item i { color: var(--auth-section); font-size: 12px; }
.auth-env-links__item .auth-env-links__arrow { margin-left: auto; color: var(--auth-section); }

.auth-toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--auth-surface);
    color: var(--auth-text);
    border: 1px solid var(--auth-border);
    border-left: 3px solid var(--auth-accent);
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 13px;
    box-shadow: 0 12px 30px -10px rgba(0, 0, 0, 0.2);
    display: flex; align-items: center; gap: 10px;
    z-index: 1000;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.2s, transform 0.2s;
    pointer-events: none;
}
.auth-toast.show { opacity: 1; transform: translateY(0); }
.auth-toast i { color: var(--auth-accent); }
