/* =====================================================================
   SQUID2 SIGN-IN PAGES
   Login, forgot password, reset password. Standalone pages (no app
   shell), sharing the brand tokens of squid.css.
   Markup: app/views/auth/partials/shell-top.php and shell-bottom.php.
   ===================================================================== */

:root {
    --ep-navy: #0a1628;
    --ep-blue: #0050A0;
    --ep-blue-hover: #00438a;
    --ep-blue-soft: #e9f1fa;
    --ep-green: #1EB400;
    --ink: #0f1b2d;
    --ink-soft: #44526a;
    --muted: #6b7890;
    --faint: #8b96a8;
    --line: #e3e8ef;
    --line-strong: #d0d8e3;
    --bg: #f4f6fa;
    --surface: #ffffff;
    --danger: #a52b22;
    --danger-bg: #fdf0ef;
    --danger-line: #f2cdca;
    --success: #125f07;
    --success-bg: #edf8ea;
    --success-line: #cfe8c9;
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-display: 'Hanken Grotesk', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html, body { margin: 0; }

body.auth {
    min-height: 100vh;
    background: var(--surface);
    color: var(--ink);
    font-family: var(--font-sans);
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.auth-layout { display: grid; grid-template-columns: minmax(360px, 44%) minmax(0, 1fr); min-height: 100vh; }

/* ---------- Brand panel ---------- */
.auth-brand {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 48px;
    padding: 48px 56px;
    overflow: hidden;
    background:
        radial-gradient(900px 540px at 105% 105%, rgba(0, 80, 160, 0.6), transparent 62%),
        radial-gradient(640px 420px at -10% -10%, rgba(30, 180, 0, 0.12), transparent 60%),
        var(--ep-navy);
    color: #fff;
}

.auth-brand__logo { display: block; width: 176px; height: auto; }
.auth-brand__copy { max-width: 460px; }

.auth-brand__eyebrow {
    margin: 0 0 18px;
    color: rgba(255, 255, 255, 0.62);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.auth-brand__title {
    margin: 0;
    font-family: var(--font-display);
    font-size: clamp(28px, 2.7vw, 40px);
    font-weight: 600;
    line-height: 1.16;
    letter-spacing: -0.015em;
    text-wrap: balance;
}

.auth-brand__foot { margin: 0; color: rgba(255, 255, 255, 0.5); font-size: 13px; }

/* ---------- Form column ---------- */
.auth-main {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 56px 24px 32px;
    background: var(--surface);
}

.auth-panel { width: 100%; max-width: 400px; }
.auth-panel__logo { display: none; width: 156px; height: auto; margin-bottom: 40px; }

.auth-title {
    margin: 0;
    font-family: var(--font-display);
    font-size: 30px;
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: -0.015em;
}

.auth-sub { margin: 8px 0 32px; color: var(--muted); }

.auth-icon {
    display: grid;
    place-items: center;
    width: 56px;
    height: 56px;
    margin-bottom: 24px;
    border-radius: 16px;
    background: var(--ep-blue-soft);
    color: var(--ep-blue);
    font-size: 26px;
}

.auth-alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin: 0 0 24px;
    padding: 12px 14px;
    border: 1px solid;
    border-radius: 10px;
    font-size: 14px;
}

.auth-alert i { margin-top: 1px; }
.auth-alert--error { border-color: var(--danger-line); background: var(--danger-bg); color: var(--danger); }
.auth-alert--success { border-color: var(--success-line); background: var(--success-bg); color: var(--success); }

.auth-form { display: grid; gap: 20px; }

.field__row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.field__label { display: block; margin-bottom: 8px; color: var(--ink); font-size: 14px; font-weight: 600; }
.field__link { color: var(--ep-blue); font-size: 13px; font-weight: 500; text-decoration: none; }
.field__link:hover { text-decoration: underline; }
.field__hint { margin: 6px 0 0; color: var(--muted); font-size: 13px; }

.control { position: relative; }

.control__icon {
    position: absolute;
    top: 50%;
    left: 14px;
    color: var(--faint);
    font-size: 16px;
    pointer-events: none;
    transform: translateY(-50%);
}

.control__input {
    width: 100%;
    height: 48px;
    padding: 0 14px 0 42px;
    border: 1px solid var(--line-strong);
    border-radius: 10px;
    background: var(--surface);
    color: var(--ink);
    font: inherit;
    font-size: 15px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.control__input--toggle { padding-right: 48px; }
.control__input:hover { border-color: #b9c3d1; }
.control__input:focus { border-color: var(--ep-blue); outline: none; box-shadow: 0 0 0 4px rgba(0, 80, 160, 0.12); }

.control__toggle {
    position: absolute;
    top: 50%;
    right: 6px;
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--faint);
    font-size: 16px;
    cursor: pointer;
    transform: translateY(-50%);
}

.control__toggle:hover { background: var(--bg); color: var(--ink); }

.auth-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    height: 48px;
    margin-top: 8px;
    border: 0;
    border-radius: 10px;
    background: var(--ep-blue);
    box-shadow: 0 1px 2px rgba(10, 22, 40, 0.12), 0 8px 20px rgba(0, 80, 160, 0.18);
    color: #fff;
    font: inherit;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease;
}

.auth-btn:hover { background: var(--ep-blue-hover); }
.auth-btn.is-loading { opacity: 0.8; pointer-events: none; }

.auth-btn__spinner {
    display: none;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: auth-spin 0.7s linear infinite;
}

.auth-btn.is-loading .auth-btn__spinner { display: inline-block; }
@keyframes auth-spin { to { transform: rotate(360deg); } }

.auth-note {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 32px 0 0;
    padding-top: 24px;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 13px;
}

.auth-text { margin: 0 0 16px; color: var(--ink-soft); }
.auth-text strong { color: var(--ink); }

.auth-back {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 28px;
    color: var(--ep-blue);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
}

.auth-back:hover { text-decoration: underline; }

.auth-copy { margin: 56px 0 0; color: var(--muted); font-size: 12px; }

.field__link:focus-visible,
.control__toggle:focus-visible,
.auth-btn:focus-visible,
.auth-back:focus-visible { outline: 2px solid var(--ep-blue); outline-offset: 2px; }

/* ---------- Small screens: form only, logo on top ---------- */
@media (max-width: 900px) {
    .auth-layout { grid-template-columns: minmax(0, 1fr); }
    .auth-brand { display: none; }
    .auth-main { justify-content: flex-start; padding: 48px 22px 28px; border-top: 4px solid var(--ep-navy); }
    .auth-panel__logo { display: block; }
    .control__input { font-size: 16px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition-duration: 0.01ms !important; }
    .auth-btn__spinner { animation-duration: 1.6s; }
}

/* ---------- Two-step sign-in (added 2026-09-14) ---------- */
.auth-steps { margin: 0 0 24px; padding-left: 20px; color: var(--ink-soft); }
.auth-steps li { margin-bottom: 6px; }

.auth-qr { display: flex; justify-content: center; margin: 0 0 20px; }
.auth-qr svg { display: block; width: 208px; height: 208px; padding: 6px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }

.auth-key { display: grid; gap: 6px; margin: 0 0 28px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); text-align: center; }
.auth-key__label { color: var(--muted); font-size: 13px; }
.auth-key__label--after { font-size: 12px; }
.auth-key__value { color: var(--ink); font-size: 17px; font-weight: 600; letter-spacing: 0.06em; word-spacing: 0.3em; overflow-wrap: anywhere; user-select: all; }

.control__input--code { font-size: 20px; font-weight: 600; letter-spacing: 0.18em; font-variant-numeric: tabular-nums; }

.auth-alt { margin: 20px 0 0; }
.auth-linkbtn { padding: 0; border: 0; background: none; color: var(--ep-blue); font: inherit; font-weight: 500; cursor: pointer; }
.auth-linkbtn:hover { text-decoration: underline; }
.auth-linkbtn:focus-visible { outline: 2px solid var(--ep-blue); outline-offset: 2px; }

.auth-codes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 0 0 24px; padding: 0; list-style: none; }
.auth-codes li { padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--ink); font-size: 16px; font-weight: 600; letter-spacing: 0.06em; text-align: center; font-variant-numeric: tabular-nums; }

.auth-actions { display: grid; gap: 12px; margin-top: 8px; }
.auth-actions .auth-btn { margin-top: 0; }
a.auth-btn { text-decoration: none; }
.auth-btn--quiet { border: 1px solid var(--line-strong); background: var(--surface); box-shadow: none; color: var(--ep-blue); }
.auth-btn--quiet:hover { background: var(--bg); }

@media print {
    .auth-brand, .auth-panel__logo, .auth-actions, .auth-copy, .auth-icon { display: none !important; }
    .auth-layout { display: block; min-height: 0; }
    .auth-main { padding: 0; }
}
