/* ==========================================================
   Vision X — Sign-in pages (clean, centred card, colours from the logo)
   ========================================================== */
:root,
[data-bs-theme="light"] {
    --auth-bg: #f4f6fb;
    --auth-glow: rgba(30, 107, 255, .10);
    --auth-card: #ffffff;
    --auth-card-border: #e3e8f2;
    --auth-shadow: 0 1px 2px rgba(10, 20, 50, .04), 0 12px 32px -12px rgba(10, 30, 90, .16);
    --auth-text: #0a0f1f;
    --auth-muted: #667085;
    --auth-border: #cfd5e1;
    --auth-border-hover: #98a2b3;
    --auth-field-bg: #ffffff;
    --auth-primary: #1a5cf0;
    --auth-primary-hover: #1449c8;
    --auth-btn: linear-gradient(180deg, #2f6dff 0%, #1a4fd6 100%);
    --auth-btn-hover: linear-gradient(180deg, #2662f0 0%, #1440b8 100%);
    --auth-ring: rgba(26, 92, 240, .18);
    --auth-error: #d00e17;
    --auth-error-bg: #fdecec;
    --auth-ok-bg: #e9f7ef;
    --auth-ok-text: #0b6b35;
}

[data-bs-theme="dark"] {
    color-scheme: dark;
    --auth-bg: #0b0e14;
    --auth-glow: rgba(47, 109, 255, .16);
    --auth-card: #131823;
    --auth-card-border: #232a38;
    --auth-shadow: 0 12px 40px -12px rgba(0, 0, 0, .6);
    --auth-text: #ececf1;
    --auth-muted: #9ca3af;
    --auth-border: #343c4d;
    --auth-border-hover: #5b6476;
    --auth-field-bg: #0f131c;
    --auth-primary: #6d8dff;
    --auth-primary-hover: #8ea6ff;
    --auth-btn: linear-gradient(180deg, #3a78ff 0%, #2154e0 100%);
    --auth-btn-hover: linear-gradient(180deg, #4a84ff 0%, #2a5ef0 100%);
    --auth-ring: rgba(109, 141, 255, .28);
    --auth-error: #ff6b6b;
    --auth-error-bg: rgba(255, 107, 107, .12);
    --auth-ok-bg: rgba(34, 197, 94, .12);
    --auth-ok-text: #6ee7a0;
}

html, body { background: var(--auth-bg); }

.vx-auth {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    color: var(--auth-text);
    -webkit-font-smoothing: antialiased;
    padding: 0 1rem;
    /* soft brand-blue glow behind the card */
    background: radial-gradient(60rem 30rem at 50% -10%, var(--auth-glow), transparent 70%) no-repeat, var(--auth-bg);
}

.vx-auth-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2.5rem 0 1rem;
}

/* ---------- Card ---------- */
.vx-auth-card {
    width: 100%; max-width: 400px;
    padding: 2.5rem 2.25rem 2rem;
    background: var(--auth-card);
    border: 1px solid var(--auth-card-border);
    border-radius: 16px;
    box-shadow: var(--auth-shadow);
}
.vx-auth-card h1 {
    font-size: 1.5rem; font-weight: 700; letter-spacing: -.02em; line-height: 1.25;
    text-align: center; margin: 0 0 .4rem;
}
.vx-auth-sub { text-align: center; color: var(--auth-muted); font-size: .9rem; margin: 0 0 1.75rem; }

/* ---------- Brand ---------- */
.vx-auth-logo {
    display: flex; align-items: center; justify-content: center; gap: .6rem;
    text-decoration: none;
    margin: 0 auto 1.75rem; padding-bottom: 1.75rem;
    border-bottom: 1px solid var(--auth-card-border);
}
.vx-auth-mark { width: 58px; height: 58px; object-fit: contain; flex-shrink: 0; }
.vx-auth-wordmark { height: 54px; width: auto; display: block; }
/* the wordmark's lettering is near-black: flip it for dark backgrounds, keeping the blues blue */
[data-bs-theme="dark"] .vx-auth-wordmark { filter: invert(1) hue-rotate(180deg); }

/* ---------- Floating-label fields ---------- */
.vx-field { position: relative; margin-bottom: 1rem; }
.vx-field input {
    width: 100%; height: 52px;
    /* top padding leaves room for the floated label above the typed text */
    padding: 1.4rem .95rem .4rem;
    line-height: 1.25;
    font-size: 1rem; color: var(--auth-text);
    background: var(--auth-field-bg);
    border: 1px solid var(--auth-border); border-radius: 8px;
    outline: none; transition: border-color .15s, box-shadow .15s;
}
.vx-field input:hover { border-color: var(--auth-border-hover); }
.vx-field input:focus { border-color: var(--auth-primary); box-shadow: 0 0 0 3px var(--auth-ring); }
.vx-field label {
    position: absolute; left: .95rem; top: 50%; transform: translateY(-50%);
    font-size: 1rem; line-height: 1.2; color: var(--auth-muted);
    pointer-events: none; transition: all .15s ease; background: transparent;
}
.vx-field input:focus + label,
.vx-field input:not(:placeholder-shown) + label {
    top: .5rem; transform: none; font-size: .72rem;
}
.vx-field input:focus + label { color: var(--auth-primary); }
.vx-field.has-error input { border-color: var(--auth-error); }
.vx-field.has-error input:focus { box-shadow: 0 0 0 3px var(--auth-error-bg); }
.vx-field.has-error label { color: var(--auth-error); }
.vx-field .vx-field-action {
    position: absolute; right: .5rem; top: 50%; transform: translateY(-50%);
    border: 0; background: none; color: var(--auth-muted);
    width: 36px; height: 36px; border-radius: 6px; display: grid; place-items: center;
}
.vx-field .vx-field-action:hover { color: var(--auth-text); }
.vx-field.with-action input { padding-right: 3rem; }

.vx-field-error {
    display: flex; gap: .4rem; align-items: flex-start;
    color: var(--auth-error); font-size: .8rem; margin: -.5rem 0 1rem;
}

/* read-only email chip on the password step */
.vx-email-chip {
    display: flex; align-items: center; justify-content: space-between; gap: .75rem;
    height: 52px; padding: 0 .5rem 0 .95rem; margin-bottom: 1rem;
    border: 1px solid var(--auth-border); border-radius: 8px; background: var(--auth-field-bg);
}
.vx-email-chip .who { min-width: 0; line-height: 1.2; }
.vx-email-chip .who small { display: block; font-size: .72rem; color: var(--auth-muted); }
.vx-email-chip .who span { display: block; font-size: .95rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vx-link-btn {
    border: 0; background: none; color: var(--auth-primary); font-weight: 500; font-size: .875rem;
    padding: .35rem .5rem; border-radius: 6px; text-decoration: none; flex-shrink: 0;
}
.vx-link-btn:hover { color: var(--auth-primary-hover); background: var(--auth-ring); }

.vx-auth-row { display: flex; align-items: center; justify-content: space-between; margin: -.25rem 0 1.25rem; font-size: .85rem; }
.vx-auth-row .form-check-input { margin-top: 0; }
.vx-auth-row .form-check { display: flex; align-items: center; gap: .45rem; margin: 0; padding: 0; }
.vx-auth-row .form-check-input { float: none; margin-left: 0; }
.vx-auth-row label { color: var(--auth-muted); cursor: pointer; }
.form-check-input:checked { background-color: var(--auth-primary); border-color: var(--auth-primary); }
.form-check-input:focus { box-shadow: 0 0 0 3px var(--auth-ring); border-color: var(--auth-primary); }

/* ---------- Button ---------- */
.vx-continue {
    width: 100%; height: 50px; border: 0; border-radius: 8px;
    background: var(--auth-btn); color: #fff;
    font-size: 1rem; font-weight: 600;
    box-shadow: 0 1px 2px rgba(10, 30, 90, .2), inset 0 1px 0 rgba(255, 255, 255, .12);
    display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
    transition: filter .15s;
}
.vx-continue:hover { background: var(--auth-btn-hover); }
.vx-continue:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--auth-ring); }
.vx-continue:disabled { opacity: .75; cursor: progress; }

/* ---------- Notices & helper text ---------- */
.vx-auth-notice {
    display: flex; gap: .5rem; align-items: flex-start;
    padding: .7rem .85rem; border-radius: 6px; margin-bottom: 1.25rem; font-size: .85rem;
}
.vx-auth-notice.ok { background: var(--auth-ok-bg); color: var(--auth-ok-text); }
.vx-auth-notice.error { background: var(--auth-error-bg); color: var(--auth-error); }

.vx-auth-help {
    color: var(--auth-muted); font-size: .8rem; line-height: 1.45; text-align: center;
    margin: 1.5rem 0 0;
}
.vx-auth-help .bi { color: var(--auth-primary); margin-right: .3rem; }

/* ---------- Footer ---------- */
.vx-auth-footer {
    display: flex; justify-content: center; align-items: center; gap: .6rem;
    padding: 1rem 0 calc(1.5rem + env(safe-area-inset-bottom, 0px));
    font-size: .8rem; color: var(--auth-muted);
}
.vx-auth-footer a { color: var(--auth-primary); text-decoration: none; }
.vx-auth-footer a:hover { text-decoration: underline; }

[hidden] { display: none !important; }

/* small phones: drop the card chrome so the form uses the full width */
@media (max-width: 480px) {
    .vx-auth-main { justify-content: flex-start; padding-top: 2rem; }
    .vx-auth-card { padding: 1.5rem .25rem; background: transparent; border: 0; box-shadow: none; }
    .vx-auth-wordmark { height: 46px; }
    .vx-auth-mark { width: 50px; height: 50px; }
}

@media (prefers-reduced-motion: reduce) {
    .vx-field input, .vx-field label, .vx-continue { transition: none; }
}
