:root {
    color-scheme: light;
    --auth-bg: #f8fafc;
    --auth-card: #ffffff;
    --auth-text: #1e293b;
    --auth-heading: #0f172a;
    --auth-muted: #64748b;
    --auth-faint: #94a3b8;
    --auth-border: #e2e8f0;
    --auth-primary: #2563eb;
    --auth-primary-soft: #eff6ff;
    --auth-shadow: 0 18px 55px rgba(15, 23, 42, .10);
}

html.theme-dark {
    color-scheme: dark;
    --auth-bg: #020617;
    --auth-card: #0f172a;
    --auth-text: #e2e8f0;
    --auth-heading: #f8fafc;
    --auth-muted: #94a3b8;
    --auth-faint: #64748b;
    --auth-border: #243147;
    --auth-primary: #60a5fa;
    --auth-primary-soft: rgba(30, 64, 175, .24);
    --auth-shadow: 0 22px 65px rgba(0, 0, 0, .32);
}

* { box-sizing: border-box; }
html, body, form { min-height: 100%; margin: 0; }

body {
    color: var(--auth-text);
    background: var(--auth-bg);
    font-family: Inter, "Segoe UI", Roboto, Arial, sans-serif;
    font-size: 13px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    transition: background-color .2s ease, color .2s ease;
}

button, input, select, textarea { font: inherit; }

.auth-theme-toggle {
    position: fixed;
    top: 18px;
    right: 18px;
    z-index: 20;
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border: 1px solid var(--auth-border);
    border-radius: 9px;
    color: var(--auth-muted);
    background: rgba(255,255,255,.88);
    box-shadow: 0 6px 18px rgba(15,23,42,.06);
    backdrop-filter: blur(12px);
    cursor: pointer;
}

.theme-dark .auth-theme-toggle { background: rgba(15,23,42,.88); }
.theme-sun { display: none; }
.theme-dark .theme-moon { display: none; }
.theme-dark .theme-sun { display: inline-block; }

.auth-page {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(0, 1.08fr) minmax(410px, .92fr);
}

.auth-hero {
    position: relative;
    overflow: hidden;
    padding: clamp(42px, 6vw, 92px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    border-right: 1px solid var(--auth-border);
    color: var(--auth-text);
    background:
        radial-gradient(circle at 15% 15%, rgba(59,130,246,.12), transparent 28%),
        radial-gradient(circle at 88% 82%, rgba(16,185,129,.10), transparent 30%),
        linear-gradient(145deg, #ffffff, #f8fafc 55%, #f0f9ff);
}

.theme-dark .auth-hero {
    background:
        radial-gradient(circle at 15% 15%, rgba(59,130,246,.17), transparent 28%),
        radial-gradient(circle at 88% 82%, rgba(16,185,129,.12), transparent 30%),
        linear-gradient(145deg, #020617, #0f172a 55%, #071225);
}

.auth-hero:before {
    content: "";
    position: absolute;
    inset: 0;
    opacity: .38;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(148,163,184,.12) 1px, transparent 1px),
        linear-gradient(90deg, rgba(148,163,184,.12) 1px, transparent 1px);
    background-size: 36px 36px;
    mask-image: linear-gradient(to bottom right, #000, transparent 82%);
}

.hero-brand {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 11px;
}

.hero-logo {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 11px;
    color: #fff;
    background: linear-gradient(135deg, #2563eb, #4f46e5 58%, #7c3aed);
    box-shadow: 0 10px 24px rgba(37,99,235,.23);
    font-size: 17px;
}

.hero-brand strong {
    color: var(--auth-heading);
    font-size: 14px;
    font-weight: 780;
}

.hero-eyebrow {
    position: relative;
    z-index: 1;
    display: inline-flex;
    width: max-content;
    margin-top: 48px;
    padding: 5px 8px;
    border: 1px solid #bfdbfe;
    border-radius: 999px;
    color: #1d4ed8;
    background: #eff6ff;
    font-size: 8px;
    font-weight: 800;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.theme-dark .hero-eyebrow {
    border-color: rgba(30,64,175,.65);
    color: #93c5fd;
    background: rgba(30,58,138,.25);
}

.auth-hero h1 {
    position: relative;
    z-index: 1;
    max-width: 650px;
    margin: 16px 0 13px;
    color: var(--auth-heading);
    font-size: clamp(31px, 4vw, 54px);
    font-weight: 800;
    letter-spacing: -.045em;
    line-height: 1.05;
}

.auth-hero p {
    position: relative;
    z-index: 1;
    max-width: 580px;
    margin: 0;
    color: var(--auth-muted);
    font-size: 13px;
    line-height: 1.75;
}

.hero-points {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    max-width: 610px;
    margin-top: 28px;
}

.hero-point {
    min-height: 76px;
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 13px;
    border: 1px solid var(--auth-border);
    border-radius: 11px;
    color: var(--auth-muted);
    background: rgba(255,255,255,.68);
    box-shadow: 0 6px 18px rgba(15,23,42,.035);
    backdrop-filter: blur(8px);
    font-size: 10px;
    font-weight: 600;
}

.theme-dark .hero-point { background: rgba(15,23,42,.68); }

.hero-point i {
    width: 31px;
    height: 31px;
    flex: 0 0 31px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    color: #2563eb;
    background: #dbeafe;
    font-size: 12px;
}

.theme-dark .hero-point i { background: rgba(30,58,138,.32); }

.auth-panel {
    display: grid;
    place-items: center;
    padding: 34px;
    background: var(--auth-bg);
}

.auth-card {
    width: min(100%, 455px);
    padding: 31px;
    border: 1px solid var(--auth-border);
    border-radius: 15px;
    background: var(--auth-card);
    box-shadow: var(--auth-shadow);
}

.auth-card-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 14px;
    padding: 5px 8px;
    border-radius: 999px;
    color: #047857;
    background: #ecfdf5;
    font-size: 8px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .09em;
}

.theme-dark .auth-card-badge {
    color: #34d399;
    background: rgba(6,78,59,.28);
}

.auth-card h2 {
    margin: 0;
    color: var(--auth-heading);
    font-size: 23px;
    font-weight: 790;
    letter-spacing: -.028em;
}

.auth-card .subtitle {
    margin: 7px 0 23px;
    color: var(--auth-muted);
    font-size: 10.5px;
    line-height: 1.65;
}

.field { margin-bottom: 15px; }

.field label {
    display: block;
    margin-bottom: 6px;
    color: var(--auth-text);
    font-size: 9.5px;
    font-weight: 720;
}

.input-wrap { position: relative; }

.input-wrap > i {
    position: absolute;
    left: 13px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--auth-faint);
    font-size: 11px;
    pointer-events: none;
}

.form-control {
    width: 100%;
    height: 44px;
    padding: 0 41px;
    border: 1px solid var(--auth-border);
    border-radius: 9px;
    color: var(--auth-text);
    background: var(--auth-card);
    font-size: 11px;
    outline: none;
    transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}

.form-control::placeholder { color: var(--auth-faint); }

.form-control:focus {
    border-color: #60a5fa;
    box-shadow: 0 0 0 3px rgba(37,99,235,.09);
}

.toggle-password {
    position: absolute;
    right: 5px;
    top: 5px;
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 8px;
    color: var(--auth-muted);
    background: transparent;
    cursor: pointer;
}

.toggle-password:hover {
    color: var(--auth-primary);
    background: var(--auth-primary-soft);
}

.btn-primary {
    width: 100%;
    height: 44px;
    border: 0;
    border-radius: 9px;
    color: #fff;
    background: linear-gradient(90deg, #2563eb, #4f46e5);
    box-shadow: 0 10px 20px rgba(37,99,235,.19);
    font-size: 10.5px;
    font-weight: 760;
    cursor: pointer;
    transition: transform .16s ease, filter .16s ease, box-shadow .16s ease;
}

.btn-primary:hover {
    filter: brightness(.99);
    transform: translateY(-1px);
    box-shadow: 0 13px 24px rgba(37,99,235,.22);
}

.btn-primary:focus-visible,
.form-control:focus-visible,
.toggle-password:focus-visible,
.auth-theme-toggle:focus-visible {
    outline: 3px solid rgba(96,165,250,.35);
    outline-offset: 2px;
}

.auth-links {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 18px;
    font-size: 9.5px;
}

.auth-links a {
    color: var(--auth-primary);
    text-decoration: none;
    font-weight: 680;
}

.auth-links a:hover { text-decoration: underline; }

.alert {
    padding: 10px 12px;
    margin-bottom: 15px;
    border-radius: 9px;
    font-size: 10px;
    line-height: 1.5;
}

.alert-error {
    color: #991b1b;
    background: #fef2f2;
    border: 1px solid #fecaca;
}

.alert-success {
    color: #166534;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
}

.security-note {
    margin-top: 17px;
    padding-top: 14px;
    border-top: 1px solid var(--auth-border);
    color: var(--auth-muted);
    font-size: 8.5px;
    line-height: 1.65;
}

.validation {
    display: block;
    margin-top: 5px;
    color: #b91c1c;
    font-size: 8.5px;
}

.password-rules {
    margin: -3px 0 15px;
    padding: 10px 12px;
    border: 1px solid var(--auth-border);
    border-radius: 9px;
    color: var(--auth-muted);
    background: var(--auth-bg);
    font-size: 8.5px;
    line-height: 1.65;
}

@media (max-width: 900px) {
    .auth-page { grid-template-columns: 1fr; }
    .auth-hero { display: none; }
    .auth-panel { min-height: 100vh; padding: 20px; }
    .auth-card { padding: 27px; }
}

@media (max-width: 480px) {
    .auth-theme-toggle { top: 12px; right: 12px; }
    .auth-panel { padding: 13px; }
    .auth-card { padding: 23px 19px; border-radius: 13px; }
    .auth-card h2 { font-size: 21px; }
    .auth-links { flex-wrap: wrap; }
}
