/* ============================================================================
   auth-screens.css — redesigned logged-out auth experience (split layout).
   Self-contained (no Bootstrap/Velzon). All brand colors come from --brand-*
   CSS custom properties set inline on .auth-root from the DB-driven contract.
   High-fidelity to design_handoff_auth_screens. Works light only (auth is a
   pre-login surface); print is irrelevant.
   ========================================================================== */

:root {
    --auth-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --auth-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

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

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    background: #14110d;
}

body {
    font-family: var(--auth-sans);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    color: var(--brand-ink, #1E1B17);
}

/* ---- Root split grid ---------------------------------------------------- */
.auth-root {
    position: fixed;
    inset: 0;
    display: grid;
    grid-template-columns: 1.05fr 1fr;
    background: var(--brand-paper, #F4EFE6);
}

/* ============================================================================
   LEFT — persistent brand panel
   ========================================================================== */
.auth-brand {
    position: relative;
    overflow: hidden;
    padding: 48px 52px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}
.auth-brand__photo {
    position: absolute;
    inset: -4%;
    background-image: var(--brand-photo, none);
    background-size: cover;
    background-position: center;
    filter: blur(8px) saturate(0.92);
    z-index: 0;
}
.auth-brand__overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(155deg, var(--brand-primary), var(--brand-secondary));
    opacity: var(--brand-overlay, 0.72);
    mix-blend-mode: multiply;
    z-index: 1;
}
.auth-brand__darken {
    position: absolute;
    inset: 0;
    background: linear-gradient(155deg, color-mix(in srgb, var(--brand-primary) 60%, transparent), transparent 62%);
    z-index: 2;
}
.auth-brand__logo,
.auth-brand__copy,
.auth-brand__security { position: relative; z-index: 3; }

/* Logo lockup */
.auth-brand__plate {
    display: inline-flex;
    align-items: center;
    padding: 12px 18px;
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 14px;
    box-shadow: 0 8px 26px -10px rgba(0, 0, 0, 0.45);
}
.auth-brand__plate img { display: block; height: 39px; width: auto; }
.auth-brand__wordmark { line-height: 1.05; }
.auth-brand__wordmark-name {
    display: block;
    font-size: 21px;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: #fff;
}
.auth-brand__wordmark-tag {
    display: block;
    margin-top: 4px;
    font-family: var(--auth-mono);
    font-size: 9.5px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.62);
}

/* Marketing copy */
.auth-brand__copy { max-width: 470px; }
.auth-brand__tagline {
    font-family: var(--auth-mono);
    font-size: 12px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.72);
    margin-bottom: 18px;
}
.auth-brand__headline {
    margin: 0;
    font-size: 34px;
    line-height: 1.12;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: #fff;
    text-shadow: 0 2px 18px rgba(0, 0, 0, 0.22);
}
.auth-brand__blurb {
    margin: 16px 0 0;
    font-size: 15px;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.82);
}

/* Security row */
.auth-brand__security {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: center;
}
.auth-brand__sec-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: var(--auth-mono);
    font-size: 11.5px;
    letter-spacing: 0.02em;
    color: rgba(255, 255, 255, 0.62);
}
.auth-brand__sec-item i { font-size: 13px; }

/* ============================================================================
   RIGHT — form column
   ========================================================================== */
.auth-form {
    display: grid;
    place-items: center;
    padding: 32px;
    overflow-y: auto;
}
.auth-form__inner { width: 384px; max-width: 100%; }

.auth-heading-wrap { margin-bottom: 24px; }
.auth-heading-wrap--center { text-align: center; }
.auth-heading {
    margin: 0;
    font-size: 26px;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--brand-ink);
}
.auth-subhead {
    margin: 8px 0 0;
    font-size: 14px;
    line-height: 1.55;
    color: var(--brand-muted);
}
.auth-subhead strong { color: var(--brand-ink); font-weight: 600; }

/* ---- Fields ------------------------------------------------------------- */
.auth-field { margin-bottom: 16px; }
.auth-label-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}
.auth-label {
    display: block;
    margin-bottom: 7px;
    font-size: 12.5px;
    font-weight: 600;
    letter-spacing: 0.01em;
    color: var(--brand-ink);
}
.auth-label__hint {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--brand-secondary);
    text-decoration: none;
}
.auth-label__hint:hover { text-decoration: underline; }

.auth-input {
    width: 100%;
    height: 46px;
    padding: 0 14px;
    font-size: 14.5px;
    font-family: var(--auth-sans);
    color: var(--brand-ink);
    background: var(--brand-surface);
    border: 1.5px solid var(--brand-line);
    border-radius: 10px;
    outline: none;
    transition: border-color .15s, box-shadow .15s;
}
.auth-input::placeholder { color: color-mix(in srgb, var(--brand-muted) 75%, transparent); }
.auth-input:focus {
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-primary) 16%, transparent);
}
.auth-input.is-match { border-color: var(--brand-secondary); }
.auth-input.is-mismatch { border-color: var(--brand-accent); }

.auth-field__error {
    min-height: 18px;
    margin-top: 5px;
    font-size: 12px;
    color: var(--brand-accent);
}

/* Password field with show/hide toggle */
.auth-pass { position: relative; }
.auth-pass .auth-input { padding-right: 44px; }
.auth-pass__toggle {
    position: absolute;
    right: 6px;
    top: 6px;
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border: none;
    background: none;
    cursor: pointer;
    color: var(--brand-muted);
    border-radius: 7px;
    font-size: 18px;
}
.auth-pass__toggle:hover { color: var(--brand-ink); }

/* ---- Checkbox ----------------------------------------------------------- */
.auth-check {
    display: flex;
    align-items: center;
    gap: 9px;
    margin: 4px 0 20px;
    cursor: pointer;
    user-select: none;
}
.auth-check input { position: absolute; opacity: 0; width: 0; height: 0; }
.auth-check__box {
    width: 18px;
    height: 18px;
    flex: none;
    border-radius: 5px;
    display: grid;
    place-items: center;
    background: var(--brand-surface);
    border: 1.5px solid var(--brand-line);
    color: #fff;
    font-size: 11px;
    transition: all .12s;
}
.auth-check__box i { opacity: 0; }
.auth-check input:checked + .auth-check__box {
    background: var(--brand-primary);
    border-color: var(--brand-primary);
}
.auth-check input:checked + .auth-check__box i { opacity: 1; }
.auth-check input:focus-visible + .auth-check__box {
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-primary) 16%, transparent);
}
.auth-check__label { font-size: 13px; color: var(--brand-muted); }

/* ---- Buttons ------------------------------------------------------------ */
.auth-btn {
    width: 100%;
    height: 48px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 700;
    font-family: var(--auth-sans);
    color: #fff;
    background: var(--brand-primary);
    box-shadow: 0 2px 6px -2px color-mix(in srgb, var(--brand-primary) 50%, transparent);
    transition: filter .15s, box-shadow .15s, transform .05s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    white-space: nowrap;
    text-decoration: none;
}
.auth-btn:hover {
    filter: brightness(1.12);
    box-shadow: 0 8px 22px -8px color-mix(in srgb, var(--brand-primary) 70%, transparent);
}
.auth-btn:active { transform: translateY(0.5px); }
.auth-btn i { font-size: 18px; }
.auth-btn--block { margin-top: 4px; }
.auth-btn.is-disabled { opacity: 0.5; pointer-events: none; }

/* Loading state: hide label, show spinner */
.auth-btn__spinner { display: none; }
.auth-btn.is-loading .auth-btn__label,
.auth-btn.is-loading i { display: none; }
.auth-btn.is-loading .auth-btn__spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: auth-spin 0.7s linear infinite;
}
@keyframes auth-spin { to { transform: rotate(360deg); } }

/* SSO option button */
.auth-sso {
    width: 100%;
    height: 48px;
    border-radius: 10px;
    border: 1.5px solid var(--brand-line);
    background: var(--brand-surface);
    color: var(--brand-ink);
    cursor: pointer;
    font-size: 14.5px;
    font-weight: 600;
    font-family: var(--auth-sans);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    text-decoration: none;
    transition: background .15s;
}
.auth-sso:hover { background: var(--brand-paper); }
.auth-sso i { font-size: 18px; }

/* ---- Divider ------------------------------------------------------------ */
.auth-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 18px 0;
}
.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--brand-line);
}
.auth-divider span {
    font-family: var(--auth-mono);
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--brand-muted);
}

/* ---- Icon badge --------------------------------------------------------- */
.auth-badge {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    display: grid;
    place-items: center;
    margin-bottom: 20px;
    background: color-mix(in srgb, var(--brand-primary) 12%, transparent);
    color: var(--brand-primary);
    font-size: 26px;
}
.auth-badge--center { margin-left: auto; margin-right: auto; }

/* ---- Back link / text links / helper text ------------------------------- */
.auth-back {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin-bottom: 22px;
    font-size: 13px;
    font-weight: 600;
    color: var(--brand-muted);
    text-decoration: none;
}
.auth-back:hover { color: var(--brand-ink); }
.auth-back i { font-size: 16px; }

.auth-link {
    color: var(--brand-secondary);
    font-weight: 600;
    text-decoration: none;
}
.auth-link:hover { text-decoration: underline; }
.auth-linkbtn {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    font-size: inherit;
    font-family: var(--auth-sans);
}
.auth-help {
    margin: 16px 0 0;
    font-size: 13px;
    line-height: 1.5;
    color: var(--brand-muted);
    text-align: center;
}

/* ---- Reset-password requirement checklist ------------------------------- */
.auth-rules {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px 14px;
    margin: 2px 0 16px;
}
.auth-rule {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 12px;
    color: var(--brand-muted);
    transition: color .12s;
}
.auth-rule__dot {
    width: 15px;
    height: 15px;
    flex: none;
    border-radius: 50%;
    display: grid;
    place-items: center;
    border: 1.5px solid var(--brand-line);
    color: #fff;
    font-size: 9px;
}
.auth-rule__dot i { opacity: 0; }
.auth-rule.is-ok { color: var(--brand-secondary); }
.auth-rule.is-ok .auth-rule__dot {
    background: var(--brand-secondary);
    border-color: var(--brand-secondary);
}
.auth-rule.is-ok .auth-rule__dot i { opacity: 1; }

/* ---- MFA code inputs ---------------------------------------------------- */
.auth-mfa {
    display: flex;
    gap: 9px;
    justify-content: center;
    margin-bottom: 22px;
}
.auth-mfa__box {
    width: 46px;
    height: 56px;
    text-align: center;
    font-size: 22px;
    font-weight: 700;
    font-family: var(--auth-mono);
    color: var(--brand-ink);
    background: var(--brand-surface);
    border: 1.5px solid var(--brand-line);
    border-radius: 10px;
    outline: none;
    transition: border-color .15s, box-shadow .15s;
}
.auth-mfa__box:focus {
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-primary) 16%, transparent);
}
.auth-mfa__box.is-filled { border-color: var(--brand-primary); }

/* ---- Centered success/info states --------------------------------------- */
.auth-center { text-align: center; }

/* ---- Alerts ------------------------------------------------------------- */
.auth-alert {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 11px 14px;
    border-radius: 10px;
    font-size: 13.5px;
    margin-bottom: 16px;
    border: 1px solid transparent;
}
.auth-alert i { font-size: 16px; flex: none; }
.auth-alert--error {
    background: color-mix(in srgb, var(--brand-accent) 12%, var(--brand-surface));
    color: var(--brand-accent);
    border-color: color-mix(in srgb, var(--brand-accent) 30%, transparent);
}
.auth-alert--success {
    background: color-mix(in srgb, var(--brand-secondary) 12%, var(--brand-surface));
    color: color-mix(in srgb, var(--brand-secondary) 80%, #000);
    border-color: color-mix(in srgb, var(--brand-secondary) 30%, transparent);
}

/* ---- Footer ------------------------------------------------------------- */
.auth-foot {
    margin: 26px 0 0;
    font-size: 11.5px;
    font-family: var(--auth-mono);
    color: var(--brand-muted);
    text-align: center;
}

/* ============================================================================
   Responsive — below 880px collapse to one column, hide the brand panel.
   ========================================================================== */
@media (max-width: 880px) {
    .auth-root { grid-template-columns: 1fr; }
    .auth-brand { display: none; }
    .auth-form { min-height: 100vh; }
}
