/* ════════════════════════════════════════════════════════════════════
   AUTH SHELL — shared by login.php, forgot_password.php, reset_password.php,
   access_denied.php and lockout.php
   ════════════════════════════════════════════════════════════════════
   NOT the same file as auth/auth.css, which is the older two-panel guest
   design (.wrapper / .panel-left / .login-card) still used by
   auth/check_email.php. That file also owns
   .brand, .brand-name, .pw-toggle, .flash-alert and .floating-alert with
   different declarations, so the two must never be loaded together — the
   classes here are the ones above, and the button is .btn-auth (not
   .btn-submit, which modules/shared/styles/primitives.css already owns).

   The minimal, single-column look the auth pages share:

     centred column → frosted .glass pane → brand lockup → h1 + .sub
     → .field rows → one solid .btn-auth → .alt link → footer

   Deliberately minimal: no card edge, no accent strip, no icons inside the
   inputs, no background gradient — the fields sit on the pane and nothing
   competes with the form.

   WHY THE WASH EXISTS — a frosted pane blurs what is behind it. With a flat
   page the pane is indistinguishable from a plain white card, and a white
   border on a light background vanishes entirely. So the three radial
   gradients are centred UNDER the panel, and the pane carries a dark
   hairline ring (0 0 0 1px) as well as its white border.

   Components below the shell are page-specific but small enough to live
   here rather than in a second file: .facts (forgot), .strength / .rules /
   .err-text / input.bad (reset), .lock-* (lockout).

   Contract kept for auth/auth.js — do not rename:
     #flashMsg + #flashCloseBtn          initFlashMessages()
     .btn-spinner                        injected by initFormLoading()
     .strength / .strength-track / .strength-seg / .strength-value,
     .rules .rule(.ok), .err-text(.show), input.bad
                                         read/written by reset_password.php
   Changing the markup? Run: node tools/build-assets.js
   ════════════════════════════════════════════════════════════════════ */

* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --green:   #0ea86a;
    --green-d: #0c945d;
    --green-dd:#057a4d;
    --danger:  #c23b3b;
    --page:    #f4f6fa;
    --line:    #e4e8f0;
    --text:    #1a2035;
    --muted:   #8a94aa;
}

html, body { height: 100%; }
body {
    font-family: 'DM Sans', sans-serif;
    background: var(--page);
    color: var(--text);
    display: flex; flex-direction: column;
    min-height: 100%;
    -webkit-font-smoothing: antialiased;
    background-image:
        radial-gradient(720px 520px at 47% 4%,  rgba(14,168,106,.24), transparent 66%),
        radial-gradient(620px 500px at 90% 96%, rgba(56,132,255,.22), transparent 68%),
        radial-gradient(540px 440px at 4% 72%,  rgba(139,92,246,.16), transparent 70%);
    background-attachment: fixed;
    background-repeat: no-repeat;
}
a { color: inherit; text-decoration: none; }
i { line-height: 1; }

/* ── COLUMN ── */
main { flex: 1; display: flex; align-items: center; justify-content: center; padding: 48px 24px; }
.col { width: 100%; max-width: 410px; }

/* ── GLASS PANE ── */
.glass {
    position: relative;
    padding: clamp(26px, 5vw, 34px);
    background: rgba(255,255,255,.50);
    border: 1px solid rgba(255,255,255,.80);
    border-radius: 18px;
    -webkit-backdrop-filter: blur(22px) saturate(180%);
    backdrop-filter: blur(22px) saturate(180%);
    box-shadow:
        0 0 0 1px rgba(16,24,40,.06),
        0 22px 55px -26px rgba(16,24,40,.34),
        0 2px 8px -3px rgba(16,24,40,.08),
        inset 0 1px 0 rgba(255,255,255,.9);
}
/* The sheen: a 1px ring drawn as a gradient, masked to the border only. */
.glass::before {
    content: ""; position: absolute; inset: 0; border-radius: inherit;
    padding: 1px; pointer-events: none;
    background: linear-gradient(140deg,
        rgba(255,255,255,.95), rgba(255,255,255,.18) 38%, rgba(255,255,255,0) 64%);
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
            mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
            mask-composite: exclude;
}
/* No backdrop-filter (older Firefox/Safari): go opaque rather than leaving
   text over an unblurred wash. */
@supports not ((backdrop-filter: blur(2px)) or (-webkit-backdrop-filter: blur(2px))) {
    .glass { background: rgba(255,255,255,.94); }
}

.brand { display: inline-flex; align-items: center; gap: 9px; margin-bottom: 26px; }
.brand-mark {
    width: 36px; height: 36px; border-radius: 9px; flex: none;
    background: transparent; color: #fff;
    display: grid; place-items: center; font-size: 15px;
}
.brand-mark img { width: 100%; height: 100%; object-fit: contain; display: block; }
.brand-name { font-family: 'DM Serif Display', serif; font-size: 1.05rem; }

h1 { font-size: 1.4rem; font-weight: 600; letter-spacing: -.01em; margin-bottom: 6px; }
.sub { color: var(--muted); font-size: .875rem; margin-bottom: 26px; }

/* ── FIELDS ── */
.field { margin-bottom: 18px; }
.field-top {
    display: flex; align-items: baseline; justify-content: space-between;
    gap: 12px; margin-bottom: 7px;
}
label { font-size: .8rem; font-weight: 500; }
.field-top a { font-size: .78rem; font-weight: 500; color: var(--green-dd); }
.field-top a:hover { text-decoration: underline; text-underline-offset: 2px; }

input {
    width: 100%; height: 44px; padding: 0 14px;
    font: inherit; font-size: .92rem; color: var(--text);
    background: rgba(255,255,255,.82);
    border: 1px solid rgba(16,24,40,.10); border-radius: 9px;
    transition: border-color .15s, box-shadow .15s, background .15s;
}
input::placeholder { color: #a9b1c2; }
input:focus {
    outline: none; background: #fff; border-color: var(--green);
    box-shadow: 0 0 0 3px rgba(14,168,106,.15);
}
input.bad { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(194,59,59,.14); }

.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 46px; }
.pw-toggle {
    position: absolute; right: 5px; top: 50%; transform: translateY(-50%);
    width: 34px; height: 34px; border: 0; border-radius: 7px;
    background: transparent; color: var(--muted); font-size: 15px;
    display: grid; place-items: center; cursor: pointer;
    transition: color .15s, background .15s;
}
.pw-toggle:hover { color: var(--text); background: rgba(16,24,40,.06); }
.pw-toggle:focus-visible { outline: 2px solid var(--green); outline-offset: 1px; }

/* ── SUBMIT ── */
.btn-auth {
    width: 100%; height: 44px; margin-top: 4px;
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    font: inherit; font-size: .92rem; font-weight: 600;
    color: #fff; background: var(--green);
    border: 0; border-radius: 9px; cursor: pointer;
    transition: background .15s;
}
.btn-auth:hover { background: var(--green-d); }
.btn-auth:disabled { background: var(--green-d); cursor: progress; }
.btn-auth:focus-visible { outline: 2px solid var(--green-d); outline-offset: 2px; }

.btn-spinner {
    display: inline-block;
    width: 13px; height: 13px;
    border: 2px solid rgba(255,255,255,.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.alt { margin-top: 20px; font-size: .82rem; color: var(--muted); }
.alt a { color: var(--green-dd); font-weight: 500; display: inline-flex; align-items: center; gap: 6px; }
.alt a:hover { text-decoration: underline; text-underline-offset: 2px; }
.alt i { font-size: 13px; }

/* ── FORGOT PASSWORD: what happens next ── */
.facts { list-style: none; display: grid; gap: 8px; margin: 2px 0 20px; }
.facts li { display: flex; gap: 9px; align-items: flex-start; font-size: .8rem; color: var(--muted); line-height: 1.5; }
.facts li i { color: var(--green); font-size: 13px; margin-top: 3px; flex: none; }

/* ── RESET PASSWORD: strength meter + requirement chips ── */
.strength { display: none; margin-top: 10px; align-items: center; gap: 10px; }
.strength.show { display: flex; }
.strength-track { display: flex; gap: 5px; flex: 1; }
.strength-seg {
    height: 4px; flex: 1; border-radius: 999px;
    background: rgba(16,24,40,.10);
    transition: background .15s;
}
.strength-value {
    font-size: .72rem; font-weight: 600; color: var(--muted);
    min-width: 48px; text-align: right;
}

.rules { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.rule {
    font-size: .68rem; font-weight: 600; letter-spacing: .02em;
    color: var(--muted); background: rgba(255,255,255,.6);
    border: 1px solid rgba(16,24,40,.10); border-radius: 999px;
    padding: 3px 9px;
    transition: color .15s, background .15s, border-color .15s;
}
.rule.ok { color: var(--green-dd); background: rgba(14,168,106,.12); border-color: rgba(14,168,106,.35); }

.err-text { display: none; font-size: .78rem; color: var(--danger); margin-top: 7px; font-weight: 500; }
.err-text.show { display: block; }

/* ── LOCKOUT: countdown ring + escalation ladder ── */
.lock-who {
    display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
    padding: 9px 12px; margin-bottom: 20px;
    background: rgba(255,255,255,.55);
    border: 1px solid rgba(16,24,40,.08); border-radius: 9px;
    font-size: .78rem; color: var(--muted);
}
.lock-who strong {
    color: var(--text); font-weight: 600; max-width: 64%;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.lock-ring { position: relative; width: 132px; height: 132px; margin: 0 auto 20px; }
.lock-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.lock-ring .track { fill: none; stroke: rgba(16,24,40,.10); stroke-width: 8; }
.lock-ring .progress {
    fill: none; stroke: var(--danger); stroke-width: 8; stroke-linecap: round;
    transition: stroke-dashoffset .6s linear;
}
.lock-ring-inner {
    position: absolute; inset: 0;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
}
.lock-time {
    font-size: 1.5rem; font-weight: 600; letter-spacing: .01em;
    font-variant-numeric: tabular-nums;
}
.lock-time-label {
    font-size: .64rem; font-weight: 600; letter-spacing: .1em;
    text-transform: uppercase; color: var(--muted);
}

.lock-levels { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; margin-bottom: 14px; }
.lock-level {
    display: flex; flex-direction: column; align-items: center; gap: 1px;
    padding: 7px 4px; border-radius: 8px;
    background: rgba(255,255,255,.55);
    border: 1px solid rgba(16,24,40,.10);
    font-size: .78rem; font-weight: 600; color: var(--muted);
}
.lock-level small {
    font-size: .62rem; font-weight: 600; letter-spacing: .05em;
    text-transform: uppercase; opacity: .85;
}
.lock-level.is-passed { opacity: .5; border-style: dashed; }
.lock-level.is-current {
    color: #9f1239; background: rgba(194,59,59,.10);
    border-color: rgba(194,59,59,.38);
}

.lock-hint {
    display: flex; gap: 9px; align-items: flex-start;
    margin-bottom: 18px;
    font-size: .8rem; line-height: 1.55; color: var(--muted);
}
.lock-hint i { color: var(--danger); font-size: 14px; margin-top: 2px; flex: none; }
.lock-hint strong { color: var(--text); font-weight: 600; }

.lock-clock {
    display: flex; align-items: center; justify-content: center; gap: 6px;
    margin-top: 14px; font-size: .74rem; color: var(--muted);
    font-variant-numeric: tabular-nums;
}

/* ── FOOTER ── */
footer {
    padding: 22px 24px;
    display: flex; align-items: center; justify-content: space-between;
    gap: 14px; flex-wrap: wrap;
    font-size: .75rem; color: var(--muted);
}
footer a { color: var(--muted); }
footer a:hover { color: var(--green-dd); }

/* ── FLASH (bound by auth.js: #flashMsg / #flashCloseBtn) ── */
.floating-alert {
    position: fixed; top: 18px; right: 18px; z-index: 1100;
    width: min(360px, calc(100vw - 36px));
}
.flash-alert {
    display: flex; align-items: center; gap: 10px;
    padding: 11px 13px; border-radius: 9px;
    font-size: .82rem; font-weight: 500;
    background: #fff; border: 1px solid var(--line);
    box-shadow: 0 12px 30px -14px rgba(16,24,40,.35);
}
.flash-danger  { background: #fff5f6; border-color: #f6ccd4; color: #9f1239; }
.flash-success { background: #f0fdf6; border-color: #b7f0d3; color: var(--green-dd); }
.flash-close {
    margin-left: auto; padding: 2px; border: 0; border-radius: 5px;
    background: none; color: inherit; font-size: 13px; cursor: pointer;
}
.flash-close:hover { background: rgba(0,0,0,.05); }

@media (max-width: 480px) {
    main { padding: 40px 20px; }
    footer { justify-content: center; text-align: center; }
}
@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; animation: none !important; }
    .btn-spinner { animation: spin 1.4s linear infinite; }
}
