/*
    Shared stylesheet for every Account page: Login, Register, ForgotPassword,
    ResetPassword, ChangePassword.

    Ported from the client's system-auth reference (src/app/system-auth):
    a 1000px two-panel card - a mockup image on the left, the form on the right -
    rather than the small centred card of the client-portal screens, which is a
    different product surface.

    Colour mapping. The reference leans on brand-primary / brand-secondary /
    neutral-slate-* / shadow-subtle-lg, and NONE of those are defined in its own
    stylesheets, so they render as nothing even there. They are mapped here onto
    concrete values: the brand blue is the panel's own --primary (#0A91E8), so the
    sign-in page and the app it signs you into agree, and the greys follow a
    standard slate ramp, which is what the names imply.

    text-h2 is inert in the reference for the same reason - it is declared outside
    @theme, so Tailwind never emits the utility - which leaves that heading at the
    browser's h2 default. 24px is that default, and it is what is used here.
*/

:root {
    --acc-primary: #0A91E8;
    --acc-primary-hover: #0880D3;
    --acc-page: #EAF4FC;
    --acc-card: #FFFFFF;

    --acc-slate-900: #0F172A;
    --acc-slate-800: #1E293B;
    --acc-slate-600: #475569;
    --acc-slate-500: #64748B;
    --acc-slate-400: #94A3B8;
    --acc-slate-300: #CBD5E1;
    --acc-slate-200: #E2E8F0;
    --acc-slate-50: #F8FAFC;

    --acc-danger: #EF4444;
    --acc-danger-bg: #FEF2F2;
    --acc-danger-line: #FECACA;

    --acc-radius: 8px;
    --acc-radius-card: 24px;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body.account {
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px;
    background: var(--acc-page);
    color: var(--acc-slate-900);
    font-family: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* ---------- The two-panel card ---------- */

.acc-shell {
    width: 100%;
    max-width: 1000px;
    display: flex;
    background: var(--acc-card);
    border: 1px solid var(--acc-slate-200);
    border-radius: var(--acc-radius-card);
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.06), 0 2px 8px rgba(15, 23, 42, 0.04);
}

/* Left: the product mockup. Hidden on narrow screens, where the form takes the
   whole card - the same breakpoint the reference uses. */
.acc-aside {
    position: relative;
    width: 45%;
    flex: none;
    background: var(--acc-slate-50);
    border-right: 1px solid var(--acc-slate-200);
}

.acc-aside img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.acc-main {
    width: 55%;
    flex: none;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px;
    background: var(--acc-card);
}

.acc-form-wrap { width: 100%; max-width: 448px; }

/* ---------- Header ---------- */

.acc-head { margin-bottom: 22px; }

/* No logo above the heading: the reference has none, and the left panel plus the
   heading already carry the brand. Kept as a rule for the other Account pages,
   which sit on a plain card with nothing else to identify them. */
.acc-logo {
    height: 28px;
    width: auto;
    display: block;
    margin-bottom: 14px;
}

.acc-title {
    font-size: 20px;
    line-height: 1.3;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin: 0;
    color: var(--acc-slate-900);
}

.acc-sub {
    font-size: 14px;
    color: var(--acc-slate-500);
    margin: 4px 0 0;
}

/* ---------- Form ---------- */

.acc-form { display: flex; flex-direction: column; gap: 16px; }

.acc-field { display: flex; flex-direction: column; }

.acc-label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 6px;
}

.acc-label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--acc-slate-900);
    margin: 0 0 6px;
}

/* Inside a label row the label supplies no margin of its own. */
.acc-label-row .acc-label { margin-bottom: 0; }

.acc-optional {
    font-weight: 400;
    color: var(--acc-slate-400);
    font-size: 12px;
    margin-left: 2px;
}

.acc-req { color: var(--acc-danger); }

.acc-control { position: relative; display: block; }

.acc-input {
    width: 100%;
    height: 44px;
    padding: 0 16px 0 40px;
    border: 1px solid var(--acc-slate-300);
    border-radius: var(--acc-radius);
    background: var(--acc-card);
    font-family: inherit;
    font-size: 14px;
    color: var(--acc-slate-900);
    transition: border-color .15s ease, box-shadow .15s ease;
}

.acc-input::placeholder { color: var(--acc-slate-400); }
.acc-input:hover { border-color: var(--acc-slate-400); }

.acc-input:focus {
    outline: none;
    border-color: var(--acc-primary);
    box-shadow: 0 0 0 3px rgba(10, 145, 232, 0.16);
}

.acc-input.has-toggle { padding-right: 42px; }

.acc-lead {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: var(--acc-slate-400);
    pointer-events: none;
}

.acc-toggle {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--acc-slate-400);
    cursor: pointer;
}
.acc-toggle:hover { color: var(--acc-slate-600); }
.acc-toggle:focus-visible { outline: 2px solid var(--acc-primary); outline-offset: 1px; }
.acc-toggle svg { display: block; }
.acc-toggle .ic-on { display: none; }
.acc-toggle.revealed .ic-off { display: none; }
.acc-toggle.revealed .ic-on { display: block; }

.acc-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
.acc-row > * { min-width: 0; }

.acc-msg {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    font-weight: 500;
    color: var(--acc-danger);
}
.acc-msg:empty { display: none; }

.acc-alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    border: 1px solid var(--acc-danger-line);
    border-radius: var(--acc-radius);
    background: var(--acc-danger-bg);
    color: #B91C1C;
    font-size: 13px;
    margin-bottom: 20px;
}
.acc-alert svg { flex: none; margin-top: 1px; }
.acc-alert span { display: block; }

/* ---------- Remember me ---------- */

.acc-check {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--acc-slate-600);
    cursor: pointer;
    user-select: none;
}
.acc-check input {
    width: 16px;
    height: 16px;
    margin: 0;
    flex: none;
    accent-color: var(--acc-primary);
}

/* ---------- Buttons ---------- */

/* The reference stacks the primary action and the Google button, primary first,
   with no divider between them. */
.acc-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-top: 4px;
}

.acc-btn {
    width: 100%;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 1px solid transparent;
    border-radius: var(--acc-radius);
    background: var(--acc-primary);
    color: #fff;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background .15s ease, border-color .15s ease;
}
.acc-btn:hover { background: var(--acc-primary-hover); }
.acc-btn:focus-visible { outline: 2px solid var(--acc-slate-900); outline-offset: 2px; }
.acc-btn svg { flex: none; }

.acc-btn-outline {
    background: var(--acc-card);
    border-color: var(--acc-slate-300);
    color: var(--acc-slate-900);
    gap: 10px;
}
.acc-btn-outline:hover { background: var(--acc-slate-50); border-color: var(--acc-slate-400); }
.acc-btn-outline svg { width: 20px; height: 20px; }

.acc-link {
    color: var(--acc-primary);
    font-weight: 600;
    text-decoration: none;
}
.acc-link:hover { color: var(--acc-primary-hover); text-decoration: underline; }
.acc-link:focus-visible { outline: 2px solid var(--acc-primary); outline-offset: 2px; border-radius: 3px; }

.acc-link-sm { font-size: 12px; }

.acc-foot {
    margin: 20px 0 0;
    text-align: center;
    font-size: 14px;
    color: var(--acc-slate-500);
}
.acc-foot .acc-link { font-weight: 700; }

/* ---------- Icon sprite ---------- */

/* Takes the <symbol> sprite out of flow. This CANNOT be an inline style
   attribute: these pages declare style-src without 'unsafe-inline', which blocks
   style attributes as well as <style> blocks. Left in flow the sprite is an
   inline element whose line box pushed the layout down 25px, producing a gap
   above the card and a scrollbar exactly that tall. */
.acc-sprite {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

/* ---------- Narrow screens ---------- */

/* Below the reference's lg breakpoint the mockup goes and the form takes the
   whole card. */
@media (max-width: 1023px) {
    .acc-aside { display: none; }
    .acc-main { width: 100%; }
}

@media (max-width: 640px) {
    body.account {
        padding: 0;
        background: var(--acc-card);
        align-items: flex-start;
    }
    .acc-shell {
        min-height: 100vh;
        border: 0;
        border-radius: 0;
        box-shadow: none;
    }
    .acc-main { padding: 28px 20px 40px; }
    .acc-row { grid-template-columns: 1fr; gap: 20px; }
}

@media (prefers-reduced-motion: reduce) {
    .acc-input, .acc-btn, .acc-toggle { transition: none; }
}

/* Short viewports: give back vertical space before the page is forced to scroll.
   The controls keep their size; the decoration around them shrinks. */
@media (max-height: 760px) {
    body.account { padding: 20px; }
    .acc-main { padding: 24px 28px; }
    .acc-head { margin-bottom: 16px; }
    .acc-title { font-size: 19px; }
    .acc-form { gap: 13px; }
    .acc-foot { margin-top: 14px; }
}

/* ── Pending-approval notice ──────────────────────────────────────────────
   Shown to a self-registered trial tenant admin whose request is awaiting a
   super admin's approval. Styling-only (CSP forbids inline styles), reusing
   the account shell so it sits in the same split-screen as sign in. */
.acc-notice { text-align: center; }
.acc-notice-badge {
    width: 76px; height: 76px; margin: 4px auto 22px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 999px;
    background: #ECFDF5; color: #059669; border: 1px solid #A7F3D0;
}
.acc-notice-badge svg { width: 36px; height: 36px; }
.acc-notice .acc-title { text-align: center; }
.acc-notice-text { margin: 10px auto 0; max-width: 40ch; font-size: 15px; line-height: 1.65; color: var(--acc-slate-600); }
.acc-notice-panel {
    margin: 24px 0 4px; padding: 15px 16px;
    background: var(--acc-slate-50); border: 1px solid var(--acc-slate-200);
    border-radius: var(--acc-radius);
    font-size: 14px; line-height: 1.6; color: var(--acc-slate-600);
    text-align: left; display: flex; gap: 11px; align-items: flex-start;
}
.acc-notice-panel svg { flex: none; width: 18px; height: 18px; color: var(--acc-primary); margin-top: 2px; }
.acc-notice-email { font-weight: 600; color: var(--acc-slate-800); word-break: break-all; }
.acc-notice-foot { margin-top: 26px; text-align: center; }
.acc-notice-badge-info { background: #EFF6FF; color: var(--acc-primary); border-color: #BFDBFE; }
.acc-notice-actions { margin-top: 24px; display: grid; gap: 12px; }

/* ── Two-step sign-in (Mfa/Verify, Mfa/Setup, recovery codes) ─────────────
   The second step lives in the same card as the password form: the password
   form slides out to the left on submit (body.acc-leaving), the next step
   slides in from the right (.acc-slide-in). */

@keyframes acc-slide-in {
    from { opacity: 0; transform: translateX(32px); }
    to   { opacity: 1; transform: none; }
}
.acc-slide-in { animation: acc-slide-in 0.38s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
.acc-form-wrap { transition: transform 0.28s ease, opacity 0.28s ease; }
body.acc-leaving .acc-form-wrap { transform: translateX(-32px); opacity: 0; }

/* Progress: Password ✓ — Verification */
.acc-steps {
    display: flex;
    align-items: center;
    gap: 10px;
    list-style: none;
    padding: 0;
    margin: 0 0 18px;
    font-size: 12px;
    font-weight: 600;
}
.acc-step { display: flex; align-items: center; gap: 8px; color: var(--acc-slate-500); }
.acc-step-dot {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 999px;
    font-size: 11px;
    border: 1.5px solid var(--acc-slate-300);
    background: var(--acc-card);
}
.acc-step.is-done .acc-step-dot { background: var(--acc-primary); border-color: var(--acc-primary); color: #fff; }
.acc-step.is-current { color: var(--acc-slate-900); }
.acc-step.is-current .acc-step-dot { border-color: var(--acc-primary); color: var(--acc-primary); box-shadow: 0 0 0 4px rgba(10, 145, 232, 0.12); }
.acc-step-bar { flex: 1; max-width: 64px; height: 2px; border-radius: 2px; background: var(--acc-primary); }

/* Which account is signing in */
.acc-identity {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    margin-bottom: 18px;
    border: 1px solid var(--acc-slate-200);
    border-radius: 999px;
    background: var(--acc-slate-50);
}
.acc-identity-avatar {
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 999px;
    background: var(--acc-primary);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
}
.acc-identity-email {
    flex: 1;
    min-width: 0;
    font-size: 13px;
    font-weight: 600;
    color: var(--acc-slate-800);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Six digit boxes (built by account-ui.js from .acc-otp-source) */
.acc-otp { display: flex; gap: 10px; justify-content: space-between; }
.acc-otp input {
    width: 100%;
    min-width: 0;
    max-width: 56px;
    height: 54px;
    text-align: center;
    font-size: 22px;
    font-weight: 700;
    font-family: inherit;
    color: var(--acc-slate-900);
    border: 1px solid var(--acc-slate-300);
    border-radius: 10px;
    background: var(--acc-card);
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.acc-otp input:hover { border-color: var(--acc-slate-400); }
.acc-otp input:focus { border-color: var(--acc-primary); box-shadow: 0 0 0 3px rgba(10, 145, 232, 0.15); }
.acc-otp input.is-filled { border-color: var(--acc-primary); background: #F4FAFF; }
.acc-otp.is-invalid input { border-color: var(--acc-danger); }
.acc-otp-source.is-enhanced { display: none; }

/* QR + manual key (setup) */
.acc-qr-row { display: flex; gap: 18px; align-items: center; margin-bottom: 18px; }
.acc-qr {
    flex: none;
    width: 148px;
    height: 148px;
    padding: 8px;
    background: #fff;
    border: 1px solid var(--acc-slate-200);
    border-radius: 12px;
}
.acc-qr svg { display: block; width: 100%; height: 100%; }
.acc-key { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.acc-key-label { font-size: 12px; color: var(--acc-slate-500); }
.acc-key-value {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 14px;
    letter-spacing: 0.06em;
    color: var(--acc-slate-900);
    word-break: break-all;
}
.acc-btn-sm { height: 34px; padding: 0 12px; font-size: 13px; width: auto; align-self: flex-start; }

/* Recovery codes */
.acc-codes {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    list-style: none;
    margin: 0 0 12px;
    padding: 12px;
    border: 1px solid var(--acc-slate-200);
    border-radius: 12px;
    background: var(--acc-slate-50);
}
.acc-codes li {
    padding: 6px 8px;
    text-align: center;
    border-radius: 6px;
    background: var(--acc-card);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 14px;
}
.acc-row-buttons { display: flex; gap: 8px; margin-bottom: 14px; }
.acc-success-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    margin-bottom: 12px;
    border-radius: 999px;
    background: #ECFDF5;
    color: #059669;
}
.acc-btn.is-disabled { opacity: 0.5; }

@media (max-width: 640px) {
    .acc-qr-row { flex-direction: column; align-items: flex-start; }
    .acc-otp { gap: 6px; }
    .acc-otp input { height: 48px; font-size: 20px; }
}

@media (prefers-reduced-motion: reduce) {
    .acc-slide-in { animation: none; }
    .acc-form-wrap, body.acc-leaving .acc-form-wrap { transition: none; transform: none; opacity: 1; }
}
