/* ===========================================================================
   Authentication pages
   ---------------------------------------------------------------------------
   The spec pins this direction: modern fintech, Bootstrap 5.3, dark and light,
   Inter, subtle glassmorphism, soft shadows, rounded corners. Followed as
   written. The one place restraint is spent: a split layout where the left
   panel carries a single ledger-line motif rather than the usual stock
   photograph or gradient blob, because a double-entry ledger is what this
   platform actually is.

   Distinct from installer.css on purpose. That is an operator tool run once;
   this is what investors see every day.
   =========================================================================== */

:root {
    --auth-bg:        #0a0e14;
    --auth-panel:     rgba(22, 28, 38, 0.72);
    --auth-panel-solid: #161c26;
    --auth-border:    rgba(255, 255, 255, 0.08);
    --auth-border-strong: rgba(255, 255, 255, 0.16);

    --auth-text:      #eaeef4;
    --auth-muted:     #8e9bad;
    --auth-faint:     #5e6a7a;

    --auth-accent:    #3d7dfc;
    --auth-accent-hi: #5c93ff;
    --auth-ok:        #2fb98a;
    --auth-warn:      #dda03a;
    --auth-fail:      #e34d52;

    --auth-font: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --auth-mono: 'JetBrains Mono', ui-monospace, Menlo, monospace;

    --auth-radius: 14px;
}

[data-bs-theme="light"] {
    --auth-bg:        #f4f6fa;
    --auth-panel:     rgba(255, 255, 255, 0.86);
    --auth-panel-solid: #ffffff;
    --auth-border:    rgba(16, 24, 40, 0.10);
    --auth-border-strong: rgba(16, 24, 40, 0.18);
    --auth-text:      #131922;
    --auth-muted:     #5a6675;
    --auth-faint:     #8b96a5;
}

* { box-sizing: border-box; }

body.auth {
    margin: 0;
    min-height: 100vh;
    background: var(--auth-bg);
    color: var(--auth-text);
    font-family: var(--auth-font);
    font-size: 15px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* Ambient wash. Subtle enough to read as depth rather than decoration. */
body.auth::before {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    background:
        radial-gradient(760px 420px at 12% -8%, rgba(61, 125, 252, 0.16), transparent 62%),
        radial-gradient(620px 380px at 92% 108%, rgba(47, 185, 138, 0.10), transparent 60%);
}

.auth-shell {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    min-height: 100vh;
    max-width: 1240px;
    margin: 0 auto;
}

/* ------------------------------------------------------------------- aside */

.auth-aside {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 48px 52px;
    background-color: #0a1a3a;
    background-size: cover;
    background-position: center;
    overflow: hidden;
    color: #fff;
}

/* Dark scrim so the logo, headline and footer stay legible over the image. */
.auth-aside::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(6,14,30,.60) 0%, rgba(6,14,30,.12) 42%, rgba(6,14,30,.88) 100%);
    z-index: 0;
}
.auth-aside > * { position: relative; z-index: 1; }
.auth-aside .auth-brand { color: #fff; }
.auth-aside__headline { color: #fff; }
.auth-aside__sub { color: rgba(255,255,255,.80); }
.auth-aside__foot { color: rgba(255,255,255,.66); }

.auth-brand {
    display: flex;
    align-items: center;
    gap: 11px;
    font-weight: 650;
    font-size: 16px;
    letter-spacing: -0.015em;
    text-decoration: none;
    color: var(--auth-text);
}

.auth-brand__mark {
    width: 30px; height: 30px;
    border-radius: 8px;
    display: grid;
    place-items: center;
    background: linear-gradient(140deg, var(--auth-accent), #2c5fd0);
    color: #fff;
    font-size: 15px;
    flex: none;
}

.auth-aside__body { max-width: 30ch; }

.auth-aside__headline {
    font-size: 34px;
    font-weight: 640;
    line-height: 1.18;
    letter-spacing: -0.03em;
    margin: 0 0 14px;
}

.auth-aside__sub {
    color: var(--auth-muted);
    margin: 0;
    font-size: 15px;
}

/* The ledger motif: paired debit/credit rules that always balance. */
.ledger {
    margin-top: 34px;
    border-top: 1px solid var(--auth-border);
    padding-top: 18px;
    font-family: var(--auth-mono);
    font-size: 11.5px;
    color: var(--auth-faint);
}

.ledger__row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px;
    padding: 5px 0;
    border-bottom: 1px dashed var(--auth-border);
}

.ledger__row:last-child {
    border-bottom: 0;
    border-top: 1px solid var(--auth-border-strong);
    margin-top: 4px;
    padding-top: 9px;
    color: var(--auth-muted);
}

.ledger__amount { font-variant-numeric: tabular-nums; }

.auth-aside__foot {
    font-size: 12.5px;
    color: var(--auth-faint);
    margin: 0;
}

/* ------------------------------------------------------------------- stage */

.auth-stage {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px 52px;
}

.auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--auth-panel);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid var(--auth-border);
    border-radius: var(--auth-radius);
    padding: 34px 34px 30px;
    box-shadow: 0 18px 44px rgba(0, 0, 0, 0.26);
}

.auth-card--wide { max-width: 560px; }

.auth-card__title {
    font-size: 24px;
    font-weight: 640;
    letter-spacing: -0.02em;
    margin: 0 0 7px;
}

.auth-card__lead {
    color: var(--auth-muted);
    font-size: 14.5px;
    margin: 0 0 24px;
}

/* ------------------------------------------------------------------ fields */

.auth-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.auth-field { margin-bottom: 16px; }
.auth-field--full { grid-column: 1 / -1; }

.auth-field label {
    display: block;
    font-size: 13px;
    font-weight: 550;
    margin-bottom: 6px;
}

.auth-field label .optional {
    color: var(--auth-faint);
    font-weight: 400;
}

.auth-input {
    width: 100%;
    background: var(--auth-panel-solid);
    border: 1px solid var(--auth-border-strong);
    border-radius: 9px;
    padding: 11px 13px;
    color: var(--auth-text);
    font-family: inherit;
    font-size: 14.5px;
    transition: border-color 0.14s ease, box-shadow 0.14s ease;
}

.auth-input::placeholder { color: var(--auth-faint); }

.auth-input:focus {
    outline: none;
    border-color: var(--auth-accent);
    box-shadow: 0 0 0 3px rgba(61, 125, 252, 0.2);
}

.auth-input.is-invalid {
    border-color: var(--auth-fail);
}

.auth-input.is-invalid:focus {
    box-shadow: 0 0 0 3px rgba(227, 77, 82, 0.2);
}

select.auth-input { appearance: none; }

.auth-error {
    display: block;
    color: var(--auth-fail);
    font-size: 12.5px;
    margin-top: 5px;
}

.auth-hint {
    font-size: 12.5px;
    color: var(--auth-faint);
    margin: 5px 0 0;
}

.auth-reveal { position: relative; display: flex; }
.auth-reveal .auth-input { padding-right: 44px; }

.auth-reveal__btn {
    position: absolute;
    right: 1px; top: 1px; bottom: 1px;
    width: 40px;
    background: none;
    border: 0;
    color: var(--auth-faint);
    cursor: pointer;
    border-radius: 0 9px 9px 0;
}
.auth-reveal__btn:hover { color: var(--auth-text); }

/* Six-box one-time code entry. */
.auth-code {
    width: 100%;
    text-align: center;
    font-family: var(--auth-mono);
    font-size: 26px;
    letter-spacing: 0.42em;
    text-indent: 0.42em;
    padding: 15px 13px;
}

/* ----------------------------------------------------------- policy meter */

.auth-policy {
    list-style: none;
    margin: 10px 0 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 3px 14px;
    font-size: 12.5px;
    color: var(--auth-faint);
}

.auth-policy li { display: flex; align-items: center; gap: 6px; }
.auth-policy li.met { color: var(--auth-ok); }

/* ---------------------------------------------------------------- messages */

.auth-alert {
    display: flex;
    gap: 11px;
    padding: 13px 15px;
    border-radius: 10px;
    border: 1px solid var(--auth-border);
    margin-bottom: 20px;
    font-size: 14px;
}

.auth-alert i { font-size: 16px; line-height: 1.45; flex: none; }
.auth-alert p { margin: 0 0 5px; }
.auth-alert p:last-child { margin-bottom: 0; }
.auth-alert ul { margin: 4px 0 0; padding-left: 17px; }

.auth-alert--error   { border-color: rgba(227, 77, 82, 0.42);  background: rgba(227, 77, 82, 0.09); }
.auth-alert--error i { color: var(--auth-fail); }
.auth-alert--ok      { border-color: rgba(47, 185, 138, 0.42); background: rgba(47, 185, 138, 0.09); }
.auth-alert--ok i    { color: var(--auth-ok); }
.auth-alert--info    { border-color: rgba(61, 125, 252, 0.4);  background: rgba(61, 125, 252, 0.09); }
.auth-alert--info i  { color: var(--auth-accent); }

/* ----------------------------------------------------------------- actions */

.auth-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px 20px;
    border: 1px solid transparent;
    border-radius: 9px;
    font-family: inherit;
    font-size: 15px;
    font-weight: 570;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.14s ease, opacity 0.14s ease;
}

.auth-btn--primary {
    background: var(--auth-accent);
    color: #fff;
    box-shadow: 0 6px 18px rgba(61, 125, 252, 0.26);
}
.auth-btn--primary:hover:not(:disabled) { background: var(--auth-accent-hi); }

.auth-btn--ghost {
    background: transparent;
    border-color: var(--auth-border-strong);
    color: var(--auth-muted);
}
.auth-btn--ghost:hover { color: var(--auth-text); }

.auth-btn:disabled { opacity: 0.45; cursor: not-allowed; }

.auth-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    font-size: 13.5px;
}

.auth-check {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    font-size: 13.5px;
    color: var(--auth-muted);
    cursor: pointer;
}

.auth-check input {
    margin-top: 3px;
    accent-color: var(--auth-accent);
    flex: none;
}

.auth-link {
    color: var(--auth-accent);
    text-decoration: none;
    font-weight: 500;
}
.auth-link:hover { text-decoration: underline; }

.auth-foot {
    margin: 22px 0 0;
    padding-top: 18px;
    border-top: 1px solid var(--auth-border);
    text-align: center;
    font-size: 14px;
    color: var(--auth-muted);
}

.auth-theme {
    position: fixed;
    top: 18px; right: 18px;
    width: 36px; height: 36px;
    display: grid;
    place-items: center;
    border-radius: 9px;
    border: 1px solid var(--auth-border-strong);
    background: var(--auth-panel);
    color: var(--auth-muted);
    cursor: pointer;
    z-index: 10;
}
.auth-theme:hover { color: var(--auth-text); }

.auth-btn:focus-visible,
.auth-input:focus-visible,
.auth-link:focus-visible,
.auth-theme:focus-visible {
    outline: 2px solid var(--auth-accent);
    outline-offset: 2px;
}

/* Recovery codes, shown once after 2FA enrolment. */
.auth-codes {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 7px 14px;
    padding: 16px;
    margin: 4px 0 18px;
    background: var(--auth-panel-solid);
    border: 1px solid var(--auth-border-strong);
    border-radius: 10px;
    font-family: var(--auth-mono);
    font-size: 14px;
    letter-spacing: 0.04em;
}

/* -------------------------------------------------------------- responsive */

@media (max-width: 900px) {
    .auth-shell { grid-template-columns: 1fr; }
    .auth-aside {
        border-right: 0;
        border-bottom: 1px solid var(--auth-border);
        padding: 26px 24px;
        background-image: none !important;
    }
    .auth-aside::before { display: none; }
    .auth-aside__body, .ledger, .auth-aside__foot { display: none; }
    .auth-stage { padding: 32px 24px 56px; }
    .auth-card { padding: 26px 22px 24px; border-radius: 12px; }
    .auth-grid { grid-template-columns: 1fr; }
    .auth-codes { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.001ms !important;
        transition-duration: 0.001ms !important;
    }
}

/* brand logo — the aside is always a dark image, so always use the light-text logo */
.auth-brand .brand-logo { height: 30px; width: auto; display: block; }
.auth-brand .brand-logo--light { display: none; }
.auth-brand .brand-logo--dark { display: block; }
