:root {
    --auth-bg: #0b1220;
    --auth-surface: #111827;
    --auth-surface-2: #172033;
    --auth-border: #2b3950;
    --auth-text: #f8fafc;
    --auth-muted: #94a3b8;
    --auth-primary: #3b82f6;
    --auth-danger: #ef4444;
    --auth-success: #22c55e;
    --auth-shadow: 0 28px 80px rgba(0,0,0,.34);
}

html[data-auth-theme="day"] {
    --auth-bg: #eef2f7;
    --auth-surface: #ffffff;
    --auth-surface-2: #f8fafc;
    --auth-border: #dbe3ec;
    --auth-text: #172033;
    --auth-muted: #64748b;
    --auth-shadow: 0 26px 64px rgba(15,23,42,.12);
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body.modern-auth-page {
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    background:
        radial-gradient(circle at 16% 10%, rgba(59,130,246,.14), transparent 30%),
        var(--auth-bg);
    color: var(--auth-text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
}

.modern-auth-shell {
    min-height: 100vh;
    min-height: 100dvh;
    display: grid;
    place-items: center;
    padding: 72px 20px 34px;
    position: relative;
}

.modern-auth-toolbar {
    position: fixed;
    top: 18px;
    right: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 5;
}

.auth-tool-button,
.modern-auth-language {
    min-height: 40px;
    border: 1px solid var(--auth-border);
    border-radius: 11px;
    background: var(--auth-surface);
    color: var(--auth-text);
    box-shadow: 0 8px 20px rgba(0,0,0,.08);
}
.auth-tool-button {
    width: 42px;
    padding: 0;
    cursor: pointer;
    font-size: 18px;
}
html[data-auth-theme="night"] .auth-theme-sun { display: none; }
html[data-auth-theme="day"] .auth-theme-moon { display: none; }
.modern-auth-language { display: inline-flex; align-items: center; padding: 0 8px; }
.modern-auth-language select {
    border: 0;
    outline: 0;
    min-width: 92px;
    background: transparent;
    color: var(--auth-text);
    height: 38px;
    font-size: 12px;
}

.modern-auth-card-wrap {
    width: min(100%, 430px);
    background: var(--auth-surface);
    border: 1px solid var(--auth-border);
    border-radius: 22px;
    padding: 28px 28px 22px;
    box-shadow: var(--auth-shadow);
}

.modern-auth-brand-simple { display: flex; justify-content: center; margin-bottom: 18px; }
.modern-auth-logo { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; color: var(--auth-text); }
.modern-auth-logo img { max-width: 180px; max-height: 70px; object-fit: contain; }
.modern-auth-logo__mark {
    min-width: 58px;
    height: 46px;
    border-radius: 12px;
    display: inline-grid;
    place-items: center;
    font-size: 14px;
    font-weight: 900;
    letter-spacing: .08em;
    color: #fff;
    background: linear-gradient(135deg, #2563eb, #3b82f6);
}

.modern-login-heading { text-align: center; margin-bottom: 24px; }
.modern-login-heading h1 { margin: 0; font-size: 28px; line-height: 1.15; letter-spacing: -.035em; font-weight: 800; color: var(--auth-text); }

.modern-login-alert { margin-bottom: 16px; border-radius: 11px; padding: 11px 13px; font-size: 13px; line-height: 1.45; border: 1px solid transparent; }
.modern-login-alert--error { color: #fecaca; background: rgba(127,29,29,.25); border-color: rgba(239,68,68,.32); }
.modern-login-alert--success { color: #bbf7d0; background: rgba(20,83,45,.25); border-color: rgba(34,197,94,.30); }
html[data-auth-theme="day"] .modern-login-alert--error { color: #991b1b; background: #fef2f2; }
html[data-auth-theme="day"] .modern-login-alert--success { color: #166534; background: #f0fdf4; }

.modern-login-form { display: grid; gap: 17px; }
.modern-field label { display: block; margin: 0 0 7px; color: var(--auth-text); font-size: 12px; font-weight: 700; }
.modern-field__label-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.modern-field__label-row a { margin-bottom: 7px; color: #60a5fa; text-decoration: none; font-size: 11px; font-weight: 700; }
html[data-auth-theme="day"] .modern-field__label-row a { color: #2563eb; }
.modern-field__control {
    min-height: 52px;
    display: flex;
    align-items: center;
    border: 1px solid var(--auth-border);
    border-radius: 13px;
    background: var(--auth-surface-2);
    overflow: hidden;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.modern-field__control:focus-within { border-color: #4f83cf; box-shadow: 0 0 0 3px rgba(59,130,246,.15); }
.modern-field--error .modern-field__control { border-color: var(--auth-danger); }
.modern-field__icon { width: 46px; flex: 0 0 46px; display: grid; place-items: center; color: var(--auth-muted); font-size: 14px; font-weight: 800; }
.modern-field__control input {
    flex: 1;
    min-width: 0;
    height: 50px;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--auth-text);
    font-size: 15px;
    padding: 0 10px 0 0;
}
.modern-field__control input::placeholder { color: var(--auth-muted); opacity: .75; }
.modern-password-toggle { width: 46px; height: 50px; border: 0; background: transparent; color: var(--auth-muted); cursor: pointer; font-size: 16px; }

.modern-login-options { display: flex; align-items: center; justify-content: space-between; min-height: 24px; }
.modern-remember { display: inline-flex; align-items: center; gap: 8px; color: var(--auth-muted); font-size: 12px; cursor: pointer; }
.modern-remember input { width: 16px; height: 16px; accent-color: var(--auth-primary); }

.modern-login-submit {
    min-height: 52px;
    border: 0;
    border-radius: 13px;
    background: linear-gradient(135deg, #1d4ed8, #3b82f6);
    color: #fff;
    font-size: 14px;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 12px 24px rgba(37,99,235,.24);
    position: relative;
}
.modern-login-submit:hover { filter: brightness(1.06); }
.modern-login-submit:disabled { opacity: .72; cursor: wait; }
.modern-login-submit__spinner { display: none; width: 18px; height: 18px; border: 2px solid rgba(255,255,255,.35); border-top-color: #fff; border-radius: 50%; animation: authSpin .7s linear infinite; margin: 0 auto; }
.modern-login-submit.is-loading .modern-login-submit__label { display: none; }
.modern-login-submit.is-loading .modern-login-submit__spinner { display: block; }
@keyframes authSpin { to { transform: rotate(360deg); } }

.modern-login-register-mobile { margin-top: 16px; text-align: center; }
.modern-login-register-mobile a { color: #60a5fa; text-decoration: none; font-size: 12px; font-weight: 700; }
.modern-demo-panel { margin-top: 18px; display: grid; grid-template-columns: repeat(2,1fr); gap: 7px; }
.modern-demo-button { min-height: 36px; border: 1px solid var(--auth-border); border-radius: 9px; background: var(--auth-surface-2); color: var(--auth-text); font-size: 11px; cursor: pointer; }
.modern-auth-footer { margin-top: 22px; text-align: center; color: var(--auth-muted); font-size: 10px; }

@media (max-width: 600px) {
    .modern-auth-shell { padding: 68px 12px 20px; }
    .modern-auth-toolbar { top: 12px; right: 12px; }
    .modern-auth-card-wrap { border-radius: 17px; padding: 24px 18px 18px; }
    .modern-login-heading h1 { font-size: 25px; }
    .modern-field__control input { font-size: 16px; }
}
.modern-field__icon svg { width: 18px; height: 18px; fill: currentColor; }
