:root {
    color-scheme: light;
    --page: #f4f6f8;
    --surface: #ffffff;
    --text: #000000;
    --muted: #000000;
    --border: #dce2e8;
    --field-border: #7b8794;
    --field: #ffffff;
    --accent: #D51C0D;
    --accent-hover: #B2180C;
    --focus: #D51C0D;
    --error: #991b1b;
    --error-surface: #fef2f2;
    --error-border: #fca5a5;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
    margin: 0;
    background: var(--page);
    color: var(--text);
    font-family: "Montserrat", system-ui, -apple-system, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}
::selection { background: #e7ecf2; color: #000; }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
button { cursor: pointer; }
button:disabled { cursor: wait; }
a { color: inherit; text-underline-offset: 4px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.login-shell {
    width: min(calc(100% - 40px), 464px);
    margin-inline: auto;
    min-height: 100vh;
    min-height: 100svh;
    display: flex;
    flex-direction: column;
}
.login-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-block: 28px; }
.brand { font-size: 24px; font-weight: 750; letter-spacing: -.03em; white-space: nowrap; }
.brand span { font-weight: 450; }
.login-main { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 24px; padding-bottom: 48px; }
.login-card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 32px; }
.login-intro { margin-bottom: 28px; }
h1 { font-family: "Lora", Georgia, serif; margin: 0 0 12px; font-size: 28px; font-weight: 700; line-height: 1.25; letter-spacing: -.025em; text-wrap: balance; overflow-wrap: anywhere; }
.login-intro > p { margin: 0; color: var(--muted); font-size: 15px; line-height: 1.65; }
form { display: flex; flex-direction: column; gap: 20px; }
.field { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
label { font-size: 14px; font-weight: 650; }
input {
    width: 100%;
    min-width: 0;
    min-height: 50px;
    border: 1px solid var(--field-border);
    border-radius: 10px;
    padding: 12px 14px;
    background: var(--field);
    color: var(--text);
    caret-color: var(--focus);
    font-size: 16px;
}
input::placeholder { color: var(--muted); opacity: 1; }
input:hover { border-color: var(--muted); }
input[aria-invalid="true"] { border-color: var(--error); }
.password-field { position: relative; }
.password-field input { padding-right: 116px; }
.password-toggle { position: absolute; top: 3px; bottom: 3px; right: 4px; min-height: 44px; padding: 8px; border: 0; border-radius: 5px; color: var(--text); background: transparent; font-size: 13px; font-weight: 650; }
.password-toggle:hover { text-decoration: underline; text-underline-offset: 3px; }
.caps-lock { margin: 0; color: var(--error); font-size: 13px; }
.submit-button { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 50px; margin-top: 4px; padding: 12px 16px; border: 1px solid transparent; border-radius: 10px; background: var(--accent); color: #ffffff; font-size: 15px; font-weight: 700; transition: background-color .15s ease, border-color .15s ease; }
.submit-button:hover:not(:disabled) { background: var(--accent-hover); }
.submit-button:disabled { opacity: .75; }
.submit-spinner { width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; }
.account-help { margin: -4px 0 0; color: var(--muted); text-align: center; font-size: 13px; line-height: 1.6; }
.login-error { margin-bottom: 24px; padding: 14px 16px; border: 1px solid var(--error-border); border-radius: 10px; background: var(--error-surface); color: var(--error); font-size: 14px; overflow-wrap: anywhere; }
.error-title { margin: 0 0 4px; font-weight: 700; }
.login-error ul { margin: 0; padding-left: 18px; }
.login-error li + li { margin-top: 4px; }
.app-switcher { text-align: center; color: var(--muted); font-size: 14px; }
.app-switcher > p { margin: 0 0 6px; }
.app-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.app-links a { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 8px 12px; border-radius: 6px; text-decoration: none; font-weight: 600; }
.app-links a:hover { color: var(--text); background: #e7ecf2; text-decoration: underline; }
.skip-link { position: absolute; top: -100px; left: 16px; z-index: 10; padding: 12px; background: var(--surface); color: var(--text); }
.skip-link:focus { top: 12px; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (max-width: 480px) {
    .login-shell { width: calc(100% - 32px); }
    .login-header { padding-block: 20px; }
    .login-main { padding-bottom: 32px; gap: 20px; }
    .login-card { padding: 24px; }
    h1 { font-size: 24px; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto; }
    .submit-button { transition: none; }
    .submit-spinner { animation: none; }
}

.login-brand { display: flex; align-items: center; gap: 16px; }
.login-brand img { width: 112px; height: 64px; object-fit: contain; background: transparent; }
.login-card { border-radius: 20px; }
@media (max-width: 380px) { .login-brand { gap: 12px; } .brand { font-size: 21px; } }

input { transition: border-color .15s ease; }
.app-links a { transition: background-color .15s ease; }
.password-toggle:active { background: #eef1f4; }
@media (prefers-reduced-motion: reduce) { input, .app-links a { transition: none; } }
