/* Sign-in pages (registration/login.html and the password pages): a centred card, mobile first.
   Scoped to .w3-auth, so no other page changes. Tokens: w3-mobile-tokens.css (loaded first).
   No dark mode: the W3 shell has none. */

/* The SIMS+ chrome (top bar, sidebar) is hidden by script on these pages; hide it in CSS too so
   it never flashes. :has() is only a progressive enhancement; the script stays as the fallback. */
body:has(.w3-auth) #topbar,
body:has(.w3-auth) #sidebar,
body:has(.w3-auth) #logoBanner,
body:has(.w3-auth) #toggleSidebar { display: none !important; }

/* base.html's off-canvas right panel sits at x=100% and its shadow bleeds into the viewport as a thin strip; hide it on auth pages only. */
body:has(.w3-auth) #rightPanel { display: none; }

body:has(.w3-auth) { background: var(--w3-bg, #f3f7fa); margin: 0; }

.w3-auth {
    box-sizing: border-box;
    display: flex;
    align-items: flex-start;               /* top-aligned: the card scrolls instead of being cut off */
    justify-content: center;
    min-height: 100vh;                      /* fallback */
    min-height: var(--w3-vh, 100dvh);
    width: 100%;
    margin: 0;
    padding: max(var(--w3-s-6), var(--w3-safe-t)) max(var(--w3-gutter), var(--w3-safe-r))
             max(var(--w3-s-6), var(--w3-safe-b)) max(var(--w3-gutter), var(--w3-safe-l));
    font-family: var(--w3-font);
    font-size: var(--w3-fs-body);
    line-height: var(--w3-lh-body);
    color: var(--w3-ink);
    background: var(--w3-bg, #f3f7fa);
}
.w3-auth *, .w3-auth *::before, .w3-auth *::after { box-sizing: border-box; }

.w3-auth__card {
    width: 100%;
    max-width: 420px;
    margin: auto 0;                         /* vertically centred when there is room */
    padding: var(--w3-s-6) var(--w3-s-5);
    background: #fff;
    border: 1px solid var(--w3-line);
    border-radius: 16px;
    box-shadow: var(--w3-shadow);
    min-width: 0;
}
@media (min-width: 480px) { .w3-auth__card { padding: var(--w3-s-8); } }

.w3-auth__logo {
    display: block;
    width: 180px; max-width: 70%; height: auto;
    margin: 0 auto var(--w3-s-4);
}
.w3-auth__title {
    margin: 0 0 var(--w3-s-2);
    font-size: var(--w3-fs-head);
    line-height: var(--w3-lh-tight);
    font-weight: 700;
    color: var(--w3-navy);
    text-align: center;
    overflow-wrap: anywhere;
}
.w3-auth__lead { margin: 0 0 var(--w3-s-4); color: var(--w3-muted); text-align: center; }
.w3-auth p { overflow-wrap: anywhere; }
.w3-auth__error {
    margin: var(--w3-s-3) 0;
    padding: var(--w3-s-3) var(--w3-s-4);
    color: var(--w3-danger);
    background: #fdf1f0;
    border: 1px solid #f0c9c6;
    border-radius: 10px;
    font-size: var(--w3-fs-body);
}

.w3-auth__form { display: block; margin: 0; }
.w3-auth__sr {
    position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden;
    clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
}
.w3-auth__input {
    display: block;
    width: 100%;
    min-height: var(--w3-tap);
    margin: 0 0 var(--w3-s-3);
    padding: 10px var(--w3-s-4);
    font: inherit;
    font-size: var(--w3-fs-input);          /* 16px: no iOS focus zoom */
    color: var(--w3-ink);
    background: #fff;
    border: 1px solid #b9c5d6;
    border-radius: 10px;
}
.w3-auth__input::placeholder { color: var(--w3-muted); }
.w3-auth__input[aria-invalid="true"] { border-color: var(--w3-danger); }
.w3-auth__pw { position: relative; }
.w3-auth__pw .w3-auth__input { padding-right: 52px; }   /* room for the toggle: no layout shift */
.w3-auth__eye {
    position: absolute; top: 0; right: 0;
    width: var(--w3-tap); height: var(--w3-tap);
    margin: 0; padding: 0;                  /* beat the global button {margin-top; padding} */
    display: flex; align-items: center; justify-content: center;
    color: var(--w3-muted); background: transparent; border: 0; border-radius: 10px;
    cursor: pointer;
}
.w3-auth__eye-off { display: none; }
.w3-auth__eye.is-shown .w3-auth__eye-on { display: none; }
.w3-auth__eye.is-shown .w3-auth__eye-off { display: block; }

.w3-auth__btn {
    display: flex;
    width: 100%;
    min-height: var(--w3-tap);
    margin: var(--w3-s-2) 0 0;              /* beat global button {margin-top: 20px} */
    padding: 10px var(--w3-s-4);
    align-items: center; justify-content: center;
    font-size: var(--w3-fs-input);
    font-weight: 600;
    line-height: 1.25;
    border-radius: 10px;
    text-align: center;
}
.w3-auth__google { margin-top: 0; }

.w3-auth__input:focus-visible,
.w3-auth__eye:focus-visible,
.w3-auth__btn:focus-visible {
    outline: 3px solid var(--w3-cyan);
    outline-offset: 2px;
    box-shadow: none;
}

.w3-auth__or {
    display: flex; align-items: center; gap: var(--w3-s-3);
    margin: var(--w3-s-5) 0;
    color: var(--w3-muted);
    font-size: var(--w3-fs-cap);
    text-transform: uppercase; letter-spacing: .08em;
}
.w3-auth__or::before, .w3-auth__or::after { content: ""; flex: 1; height: 1px; background: var(--w3-line); }

/* Other sign-in pages share the card */
.w3-auth__card form p { margin: 0 0 var(--w3-s-3); }
.w3-auth__card form label { display: block; font-weight: 600; margin-bottom: var(--w3-s-1); }
.w3-auth__card form input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]):not([type="submit"]) {
    display: block; width: 100%; min-height: var(--w3-tap); padding: 10px var(--w3-s-4);
    font-size: var(--w3-fs-input); border: 1px solid #b9c5d6; border-radius: 10px;
}
.w3-auth__card .helptext, .w3-auth__card form ul { color: var(--w3-muted); font-size: var(--w3-fs-body); padding-left: var(--w3-s-5); }
.w3-auth__card .errorlist { color: var(--w3-danger); list-style: none; padding-left: 0; margin: 0 0 var(--w3-s-2); }
.w3-auth__link { display: inline-flex; align-items: center; min-height: var(--w3-tap); }

/* Landscape phones: less vertical padding so the form is reachable */
@media (max-height: 480px) {
    .w3-auth { padding-top: max(var(--w3-s-3), var(--w3-safe-t)); padding-bottom: max(var(--w3-s-3), var(--w3-safe-b)); }
    .w3-auth__logo { width: 120px; margin-bottom: var(--w3-s-2); }
}
@media (prefers-reduced-motion: reduce) {
    .w3-auth *, .w3-auth *::before, .w3-auth *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

/* "Keep me signed in on this device": the label row keeps the tap-target height, the hint wraps under it. */
.w3-auth__remember { display: grid; grid-template-columns: auto 1fr; align-items: center; column-gap: var(--w3-s-3); margin: var(--w3-s-3) 0 var(--w3-s-4); }
.w3-auth__remember input[type="checkbox"] { width: 22px; height: 22px; margin: 0; accent-color: var(--w3-navy); }
.w3-auth__remember label { display: flex; align-items: center; min-height: var(--w3-tap); margin: 0; cursor: pointer; font-weight: 600; }
.w3-auth__hint { grid-column: 1 / -1; margin: 0; color: var(--w3-muted); font-size: .875rem; line-height: 1.35; }
