:root {
    color-scheme: light;
    --page-bg: #fffdf7;
    --control: #ffffff;
    --text: #172431;
    --muted: #657589;
    --border: #dbe1e8;
    --input: #ffffff;
    --link: #c44a0c;
    --button: #dc5905;
    --button-end: #bb3d02;
    --button-text: #ffffff;
    --subtle: #f5f0e9;
    --focus: #cf651f;
    --brand-text: #172431;
    --brand-accent: #c44a08;
}

:root[data-theme="dark"] {
    color-scheme: dark;
    --page-bg: #151617;
    --control: #262728;
    --text: #f3f3f2;
    --muted: #adafaf;
    --border: #3c3e40;
    --input: #202224;
    --link: #ffb176;
    --button: #d9712b;
    --button-end: #e29255;
    --button-text: #1b1714;
    --subtle: #2b2724;
    --focus: #e99c62;
    --brand-text: #faf8f5;
    --brand-accent: #ffb06e;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--page-bg); }
body {
    margin: 0;
    color: var(--text);
    background: var(--page-bg);
    font-family: Inter, "Segoe UI", Arial, sans-serif;
    font-size: 14px;
    letter-spacing: 0;
}
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible { outline: 3px solid var(--focus); outline-offset: 4px; }

.login-shell {
    display: grid;
    grid-template-columns: minmax(0, 56.7fr) minmax(0, 43.3fr);
    min-height: 100vh;
    min-height: 100svh;
}
.login-brand {
    position: relative;
    isolation: isolate;
    display: flex;
    min-width: 0;
    min-height: 100%;
    flex-direction: column;
    overflow: hidden;
    padding: 60px clamp(32px, 3.2vw, 64px) 42px;
    color: var(--brand-text);
    background: #fffaf1;
}
.login-brand::before {
    position: absolute;
    z-index: -2;
    inset: 0;
    background: url("preventix-ribbons.png") center / cover no-repeat;
    content: "";
}
:root[data-theme="dark"] .login-brand { background: #242322; }
:root[data-theme="dark"] .login-brand::before { mix-blend-mode: multiply; }
.login-product {
    display: flex;
    width: max-content;
    max-width: 100%;
    align-items: center;
    gap: 20px;
}
.login-product-mark { display: block; width: 76px; height: 76px; flex: 0 0 76px; }
.login-wordmark { display: flex; align-items: baseline; font-size: 46px; font-weight: 760; line-height: 1; }
.login-wordmark > span { color: #ed720a; font-size: 60px; font-weight: 800; }
.login-brand-copy { margin-top: 54px; }
.login-brand-copy h1 { margin: 0; font-size: 44px; font-weight: 750; line-height: 1.08; overflow-wrap: break-word; }
.login-brand-copy h1 > span {
    display: block;
    margin-top: 6px;
    color: var(--brand-accent);
    font-size: 38px;
    line-height: 1.18;
}
.login-brand-copy p { max-width: 540px; margin: 20px 0 0; color: var(--muted); font-size: 16px; line-height: 1.6; text-wrap: pretty; }
.brand-rule { display: block; width: 46px; height: 3px; margin-top: 32px; border-radius: 2px; background: var(--brand-accent); }
.login-company-footer { margin: auto 0 0; padding-top: 64px; color: var(--muted); font-size: 11px; font-weight: 650; line-height: 1.6; }

.login-form-panel {
    position: relative;
    display: flex;
    min-width: 0;
    flex-direction: column;
    padding: 64px clamp(32px, 4.2vw, 80px) 28px;
    background: var(--page-bg);
    transition: background-color 220ms ease, color 220ms ease;
}
.login-panel-header { position: absolute; top: 18px; right: 22px; }
.auth-theme-toggle {
    display: grid;
    width: 36px;
    height: 36px;
    place-items: center;
    border: 1px solid transparent;
    border-radius: 50%;
    padding: 8px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    transition: background-color 180ms ease, color 180ms ease, transform 180ms ease;
}
.auth-theme-toggle:hover { background: var(--subtle); color: var(--link); transform: rotate(12deg); }
.auth-theme-toggle:active { transform: scale(.94); }
.auth-theme-toggle span, .auth-theme-toggle svg { display: block; width: 18px; height: 18px; }
.auth-theme-toggle.is-changing span { animation: auth-icon-swap 280ms ease both; }
.login-form-wrap { display: flex; width: 100%; flex: 1; align-items: center; justify-content: center; padding: 12px 0 36px; }
.login-form { width: 100%; max-width: 444px; }
.form-eyebrow { display: block; color: var(--link); font-size: 12px; font-weight: 750; line-height: 1.5; }
.login-form h2 { margin: 12px 0 0; color: var(--text); font-size: 44px; font-weight: 780; line-height: 1.12; overflow-wrap: break-word; }
.form-intro { margin: 14px 0 28px; color: var(--muted); font-size: 14px; line-height: 1.6; }
.auth-error {
    margin: 0 0 20px;
    border-left: 3px solid #c74c43;
    padding: 10px 12px;
    background: #fff0ed;
    color: #a52e26;
    font-size: 13px;
    line-height: 1.5;
    overflow-wrap: anywhere;
}
:root[data-theme="dark"] .auth-error { color: #ffb8ac; background: #362421; }
.auth-field { margin-top: 25px; }
.auth-field.compact-field { margin-top: 18px; }
.auth-field label, .auth-label-row label { display: block; margin: 0 0 9px; color: var(--text); font-size: 13px; font-weight: 650; }
.auth-label-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.auth-label-row a { color: var(--link); font-size: 12px; font-weight: 550; text-decoration: none; }
.auth-label-row a:hover { text-decoration: underline; }
.auth-input-wrap {
    position: relative;
    display: flex;
    height: 52px;
    align-items: center;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: var(--input);
    color: var(--muted);
    box-shadow: 0 1px 2px #17243105;
    overflow: hidden;
    transition: border-color 150ms ease, box-shadow 150ms ease;
}
.auth-input-wrap:focus-within { border-color: var(--focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 15%, transparent); }
.auth-input-wrap > svg { width: 19px; height: 19px; flex: 0 0 19px; margin-left: 15px; }
.auth-input-wrap input { width: 100%; min-width: 0; height: 100%; border: 0; outline: 0; padding: 0 14px; background: transparent; color: var(--text); font-size: 15px; }
.auth-input-wrap input::placeholder { color: var(--muted); opacity: 1; }
.auth-input-wrap input:autofill,
.auth-input-wrap input:-webkit-autofill,
.auth-input-wrap input:-webkit-autofill:hover,
.auth-input-wrap input:-webkit-autofill:focus,
.auth-input-wrap input:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 1000px var(--input) inset;
    box-shadow: 0 0 0 1000px var(--input) inset;
    -webkit-text-fill-color: var(--text);
    caret-color: var(--text);
}
.password-toggle {
    display: grid;
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    place-items: center;
    border: 0;
    border-radius: 4px;
    padding: 12px;
    margin-right: 3px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
}
.password-toggle:hover { color: var(--link); background: var(--subtle); }
.password-toggle:focus-visible { outline-offset: -3px; }
.password-toggle svg { width: 19px; height: 19px; }
.auth-primary {
    display: flex;
    width: 100%;
    min-height: 54px;
    align-items: center;
    justify-content: center;
    margin-top: 26px;
    border: 1px solid transparent;
    border-radius: 7px;
    padding: 12px 20px;
    gap: 13px;
    background: linear-gradient(110deg, var(--button), var(--button-end));
    color: var(--button-text);
    font-size: 15px;
    font-weight: 650;
    text-decoration: none;
    cursor: pointer;
    transition: filter 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}
.auth-primary:hover { filter: brightness(1.06); box-shadow: 0 5px 18px color-mix(in srgb, var(--button) 20%, transparent); transform: translateY(-1px); }
.auth-primary:active { box-shadow: none; transform: translateY(0); }
.auth-primary:disabled { cursor: wait; opacity: .7; transform: none; }
.auth-primary svg { width: 18px; height: 18px; flex: 0 0 18px; }
.account-note { display: flex; align-items: center; justify-content: center; margin-top: 27px; gap: 8px; color: var(--muted); font-size: 12px; line-height: 1.6; }
.account-note svg { width: 17px; height: 17px; flex: 0 0 17px; }
.recovery-note { border-left: 2px solid var(--link); padding: 10px 18px; color: var(--muted); font-size: 14px; line-height: 1.7; }
.password-change-panel { width: 100%; max-width: 444px; }
.password-change-form h2, .auth-message-page h2 { font-size: 32px; }
.password-change-panel .login-form, .password-change-panel .signout-form { max-width: none; }
.signout-form { width: 100%; margin: 12px 0 0; text-align: center; }
.signout-form button { min-height: 40px; border: 0; border-radius: 6px; padding: 0 16px; background: transparent; color: var(--link); cursor: pointer; font-size: 13px; }
.signout-form button:hover { background: var(--subtle); }

@keyframes auth-icon-swap {
    from { opacity: 0; transform: rotate(-40deg) scale(.7); }
    to { opacity: 1; transform: rotate(0) scale(1); }
}
@media (max-width: 1200px) {
    .login-shell { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
    .login-brand { padding: 48px 32px 32px; }
    .login-product { gap: 14px; }
    .login-product-mark { width: 60px; height: 60px; flex-basis: 60px; }
    .login-wordmark { font-size: 36px; }
    .login-wordmark > span { font-size: 48px; }
    .login-brand-copy h1 { font-size: 38px; }
    .login-brand-copy h1 > span { font-size: 32px; max-width: 380px; }
    .login-brand-copy p { font-size: 14px; }
    .login-form-panel { padding-inline: 36px; }
    .login-form h2 { font-size: 38px; }
    .password-change-form h2, .auth-message-page h2 { font-size: 30px; }
}
@media (max-width: 760px) {
    .login-shell { grid-template-columns: minmax(0, 1fr); }
    .login-brand { min-height: 270px; padding: 28px 26px 30px; }
    .login-brand::before { background-position: center 55%; }
    .login-product-mark { width: 46px; height: 46px; flex-basis: 46px; }
    .login-wordmark { font-size: 30px; }
    .login-wordmark > span { font-size: 40px; }
    .login-brand-copy { margin-top: 26px; }
    .login-brand-copy h1 { font-size: 28px; }
    .login-brand-copy h1 > span { max-width: none; font-size: 23px; margin-top: 7px; }
    .login-brand-copy p, .brand-rule, .login-company-footer { display: none; }
    .login-form-panel { padding: 42px 26px 24px; }
    .login-panel-header { top: 12px; right: 16px; }
    .login-form-wrap { padding: 8px 0 34px; }
    .login-form h2 { font-size: 34px; }
    .form-eyebrow { font-size: 11px; }
    .form-intro { margin-bottom: 22px; }
    .auth-input-wrap input { font-size: 16px; }
    .password-change-form h2, .auth-message-page h2 { font-size: 28px; }
}
@media (max-width: 380px) {
    .login-brand, .login-form-panel { padding-inline: 20px; }
    .login-brand-copy h1 > span { font-size: 21px; }
    .account-note { align-items: flex-start; font-size: 11px; }
}
@media (min-width: 761px) and (max-height: 720px) {
    .login-brand { padding-top: 46px; padding-bottom: 30px; }
    .login-brand-copy { margin-top: 40px; }
    .login-form-panel { padding-top: 58px; padding-bottom: 22px; }
    .login-form-wrap { padding-top: 8px; padding-bottom: 20px; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
}
