/* =====================================================================
   Premium auth design system — shared by /login and /register only.
   Loaded AFTER app.css so it refines (never fights) the app theme.
   All rules are scoped to the auth pages (.auth-* / body.auth-body), so
   dashboard pages that never load this file are unaffected.
   Dark mode follows the app: app.js sets html[data-bs-theme="dark"].
   ===================================================================== */

:root {
    --auth-hero-1: #07130d;
    --auth-hero-2: #0f3a29;
    --auth-hero-3: #17734a;
    --auth-radius: 22px;
    --auth-card-radius: 18px;

    --auth-pane-bg: radial-gradient(1200px 600px at 90% -10%, #eaf2ee 0, transparent 55%), linear-gradient(180deg, #f4f7f5 0%, #eef2f0 100%);
    --auth-card-bg: #ffffff;
    --auth-card-border: #e6ebe8;
    --auth-card-shadow: 0 30px 70px -38px rgba(11, 40, 28, .40), 0 2px 8px -4px rgba(11, 40, 28, .12);
    --auth-input-bg: #f7faf9;
    --auth-input-border: #dde5e1;
    --auth-text: #10201a;
    --auth-muted: #5c6b64;
    --auth-ring: rgba(23, 115, 74, .20);
}

html[data-bs-theme="dark"] {
    --auth-pane-bg: radial-gradient(1200px 600px at 90% -10%, #10201a 0, transparent 55%), linear-gradient(180deg, #0b100e 0%, #080c0a 100%);
    --auth-card-bg: #111815;
    --auth-card-border: #232e29;
    --auth-card-shadow: 0 30px 70px -34px rgba(0, 0, 0, .70);
    --auth-input-bg: #0d1310;
    --auth-input-border: #2a352f;
    --auth-text: #e9f1ec;
    --auth-muted: #9fb0a8;
    --auth-ring: rgba(52, 199, 123, .22);
}

/* ---------- Shell ---------- */
body.auth-body {
    min-height: 100vh;
    margin: 0;
    background: var(--auth-pane-bg);
    color: var(--auth-text);
    font-family: var(--adminuiux-content-font, "Open Sans", system-ui, sans-serif);
}
.auth-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(0, 48fr) minmax(0, 52fr);
}

/* ---------- LEFT: product experience ---------- */
.auth-hero {
    position: relative;
    color: #fff;
    padding: clamp(30px, 3.2vw, 56px);
    display: flex;
    flex-direction: column;
    gap: 1.75rem;
    overflow: hidden;
    background: linear-gradient(160deg, var(--auth-hero-1) 0%, var(--auth-hero-2) 52%, var(--auth-hero-3) 100%);
}
.auth-hero::before {                       /* engineering dot grid */
    content: "";
    position: absolute; inset: 0;
    background-image: radial-gradient(rgba(255, 255, 255, .10) 1px, transparent 1.4px);
    background-size: 26px 26px;
    -webkit-mask-image: radial-gradient(circle at 20% 8%, #000 0, transparent 70%);
    mask-image: radial-gradient(circle at 20% 8%, #000 0, transparent 70%);
    opacity: .55;
}
.auth-hero::after {                        /* soft glow */
    content: "";
    position: absolute; width: 620px; height: 620px; right: -180px; top: -160px;
    background: radial-gradient(circle, rgba(52, 199, 123, .30) 0, transparent 62%);
    pointer-events: none;
}
.auth-hero > * { position: relative; z-index: 1; }

.auth-brand { display: flex; align-items: center; gap: .7rem; }
.auth-brand .brand-logo { height: 38px; width: auto; filter: brightness(0) invert(1); }
.auth-brand .brand-text { line-height: 1.1; }
.auth-brand .brand-name { font-family: var(--adminuiux-title-font, "Poppins", sans-serif); font-weight: 600; font-size: 1.12rem; }
.auth-brand .brand-sub { font-size: .74rem; opacity: .72; letter-spacing: .02em; }

.hero-copy .eyebrow { text-transform: uppercase; letter-spacing: .14em; font-size: .70rem; font-weight: 700; opacity: .82; margin-bottom: .6rem; }
.hero-copy h1 {
    font-family: var(--adminuiux-title-font, "Poppins", sans-serif);
    font-weight: 600; line-height: 1.14; margin: 0 0 .75rem;
    font-size: clamp(1.65rem, 2.1vw, 2.25rem);
}
.hero-copy .lead-copy { opacity: .90; max-width: 44ch; margin: 0; font-size: .98rem; }

.hero-benefits { display: flex; flex-direction: column; gap: .55rem; }
.hero-benefit { display: flex; gap: .6rem; align-items: center; font-size: .92rem; color: rgba(255, 255, 255, .94); }
.hero-benefit i { color: #7fe9b0; font-size: 1.05rem; }

/* --- CSS-only dashboard preview --- */
.hero-preview { position: relative; margin-top: .25rem; }
.hero-preview-label {
    display: inline-flex; align-items: center; gap: .4rem; margin-bottom: .55rem;
    font-size: .68rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
    color: rgba(255, 255, 255, .78);
}
.hero-preview-label i { font-size: .82rem; color: #7fe9b0; }
.hp-card {
    background: rgba(255, 255, 255, .97);
    color: #14231d;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, .5);
    box-shadow: 0 26px 50px -24px rgba(0, 0, 0, .55);
    padding: 16px;
}
.hp-head { display: flex; align-items: center; gap: .35rem; margin-bottom: 14px; }
.hp-dot { width: 9px; height: 9px; border-radius: 50%; background: #e2e6e4; }
.hp-dot:nth-child(1) { background: #ff6058; } .hp-dot:nth-child(2) { background: #ffbd2e; } .hp-dot:nth-child(3) { background: #28c840; }
.hp-head .hp-title { margin-left: auto; font-size: .72rem; font-weight: 600; color: #6b7a72; }
.hp-metrics { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 12px; }
.hp-tile { background: #f5f8f6; border: 1px solid #eaefec; border-radius: 12px; padding: 10px 12px; }
.hp-tile .hp-ico { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; font-size: .8rem; color: #fff; background: #17734a; margin-bottom: 6px; }
.hp-tile .hp-ico.warn { background: #e0912f; } .hp-tile .hp-ico.blue { background: #2f6fe0; } .hp-tile .hp-ico.violet { background: #6b4fe0; }
.hp-tile small { display: block; color: #6b7a72; font-size: .68rem; }
.hp-tile b { font-size: 1.02rem; font-weight: 700; }
.hp-tile .hp-trend { font-size: .64rem; font-weight: 600; }
.hp-trend.up { color: #1f9d63; } .hp-trend.down { color: #d64545; }
.hp-chart { display: flex; align-items: flex-end; gap: 6px; height: 54px; padding: 8px 4px 0; border-top: 1px dashed #e7ece9; }
.hp-bar { flex: 1; background: linear-gradient(180deg, #34c77b, #17734a); border-radius: 4px 4px 0 0; opacity: .9; }
.hp-row { display: flex; align-items: center; gap: 8px; margin-top: 10px; padding-top: 10px; border-top: 1px solid #eef2f0; }
.hp-row .hp-av { width: 26px; height: 26px; border-radius: 7px; background: #e8f4ee; color: #17734a; display: grid; place-items: center; font-size: .72rem; }
.hp-row .hp-name { font-size: .74rem; font-weight: 600; }
.hp-row .hp-sub { font-size: .64rem; color: #6b7a72; }
.hp-row .hp-amt { margin-left: auto; font-size: .76rem; font-weight: 700; }
.hp-row .hp-pill { font-size: .58rem; font-weight: 700; padding: 2px 7px; border-radius: 999px; background: #e6f6ee; color: #1f9d63; }

.hp-float {
    position: absolute; background: rgba(255, 255, 255, .98); color: #14231d;
    border-radius: 12px; padding: 8px 12px; box-shadow: 0 18px 34px -18px rgba(0, 0, 0, .55);
    display: flex; align-items: center; gap: 8px; font-size: .74rem; font-weight: 600;
}
.hp-float i { width: 24px; height: 24px; border-radius: 7px; display: grid; place-items: center; color: #fff; }
.hp-float small { display: block; font-weight: 500; color: #6b7a72; font-size: .62rem; }
.hp-float-1 { top: -14px; right: -8px; }
.hp-float-1 i { background: #e0912f; }
.hp-float-2 { bottom: -16px; left: -10px; }
.hp-float-2 i { background: #1f9d63; }

.hero-trust {
    display: flex; align-items: center; gap: .7rem; margin-top: auto;
    padding: 12px 14px; border-radius: 14px;
    background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .16);
    backdrop-filter: blur(6px); font-size: .84rem;
}
.hero-trust i { color: #7fe9b0; font-size: 1.2rem; }

/* ---------- RIGHT: elevated auth card ---------- */
.auth-pane {
    display: flex;
    padding: clamp(24px, 3vw, 48px);
    overflow-y: auto; max-height: 100vh;
}
.auth-card {
    /* margin:auto centres the card when it fits and, unlike align-items:center,
       keeps the top reachable (nav buttons never hidden) when it overflows a
       short viewport — the pane then scrolls normally. */
    margin: auto;
    width: 100%; max-width: 500px;
    background: var(--auth-card-bg);
    border: 1px solid var(--auth-card-border);
    border-radius: var(--auth-card-radius);
    box-shadow: var(--auth-card-shadow);
    padding: clamp(24px, 3vw, 40px);
    position: relative;
}
.auth-card::before {                       /* subtle inner top highlight */
    content: ""; position: absolute; inset: 0 0 auto 0; height: 1px; border-radius: var(--auth-card-radius) var(--auth-card-radius) 0 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .6), transparent);
    opacity: .6;
}
html[data-bs-theme="dark"] .auth-card::before { background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .10), transparent); }
.auth-card--wide { max-width: 580px; }

.auth-mark {
    width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center;
    background: linear-gradient(160deg, #17734a, #0f3a29); color: #fff; margin-bottom: 1rem;
    box-shadow: 0 10px 22px -12px rgba(23, 115, 74, .8);
}
.auth-mark img { width: 26px; height: 26px; object-fit: contain; filter: brightness(0) invert(1); }
.auth-eyebrow { color: #17734a; text-transform: uppercase; letter-spacing: .08em; font-size: .72rem; font-weight: 700; margin-bottom: .35rem; }
html[data-bs-theme="dark"] .auth-eyebrow { color: #45d488; }
.auth-title { font-family: var(--adminuiux-title-font, "Poppins", sans-serif); font-weight: 600; color: var(--auth-text); margin-bottom: .3rem; letter-spacing: -.01em; }
.auth-sub { color: var(--auth-muted); margin-bottom: 1.6rem; }

/* ---------- Form controls (scoped) ---------- */
.auth-pane .form-label { font-weight: 600; font-size: .84rem; color: var(--auth-text); margin-bottom: .4rem; }
.auth-pane .form-text { color: var(--auth-muted); }
.auth-pane .form-control,
.auth-pane .form-select {
    min-height: 52px;
    border-radius: 13px;
    background-color: var(--auth-input-bg);
    border: 1px solid var(--auth-input-border);
    color: var(--auth-text);
    transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
}
.auth-pane .form-control::placeholder { color: var(--auth-muted); opacity: .8; }
.auth-pane .form-control:focus,
.auth-pane .form-select:focus {
    border-color: #17734a;
    background-color: var(--auth-card-bg);
    box-shadow: 0 0 0 .25rem var(--auth-ring);
}
html[data-bs-theme="dark"] .auth-pane .form-control:focus,
html[data-bs-theme="dark"] .auth-pane .form-select:focus { border-color: #34c77b; }
.auth-pane .form-select option { color: var(--auth-text); background: var(--auth-card-bg); }

/* validation errors must win over the custom input border above */
.auth-pane .form-control.is-invalid,
.auth-pane .form-select.is-invalid { border-color: var(--bs-danger, #dc3545); }
.auth-pane .form-control.is-invalid:focus,
.auth-pane .form-select.is-invalid:focus { box-shadow: 0 0 0 .25rem rgba(220, 53, 69, .22); }
.auth-pane .invalid-feedback { color: var(--bs-danger, #dc3545); font-size: .8rem; }

/* clear keyboard focus for non-input controls */
.auth-theme-toggle:focus-visible,
.auth-pane .affix-btn:focus-visible,
.auth-pane a:focus-visible,
.auth-pane .btn:focus-visible { outline: 2px solid #34c77b; outline-offset: 2px; }

/* icon-affixed inputs */
.auth-field { position: relative; }
.auth-field .field-ico {
    position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
    color: var(--auth-muted); font-size: 1.05rem; pointer-events: none; z-index: 3;
}
.auth-field.has-ico .form-control { padding-left: 42px; }
.auth-field .affix-btn {
    position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
    z-index: 4; border: 0; background: transparent; color: var(--auth-muted); line-height: 1; padding: .3rem .5rem;
}
.auth-field .affix-btn:hover { color: #17734a; }

/* autofill polish */
.auth-pane input:-webkit-autofill,
.auth-pane input:-webkit-autofill:focus {
    -webkit-text-fill-color: var(--auth-text);
    -webkit-box-shadow: 0 0 0 1000px var(--auth-input-bg) inset;
    caret-color: var(--auth-text);
    transition: background-color 9999s ease-out 0s;
}

/* buttons */
.auth-pane .btn-primary-cta {
    min-height: 52px; border-radius: 13px; font-weight: 600; border: 0; color: #fff;
    background: linear-gradient(160deg, #1f9d63 0%, #17734a 60%, #0f5d3b 100%);
    box-shadow: 0 14px 26px -14px rgba(23, 115, 74, .85);
    transition: transform .12s ease, box-shadow .15s ease, filter .15s ease;
}
.auth-pane .btn-primary-cta:hover { filter: brightness(1.05); box-shadow: 0 18px 30px -14px rgba(23, 115, 74, .9); transform: translateY(-1px); color: #fff; }
.auth-pane .btn-primary-cta:active { transform: translateY(0); }
.auth-pane .btn-primary-cta:disabled { filter: grayscale(.2) brightness(.95); opacity: .8; }
.auth-pane .btn-ghost {
    min-height: 48px; border-radius: 13px; font-weight: 600;
    background: transparent; color: var(--auth-text);
    border: 1px solid var(--auth-input-border);
}
.auth-pane .btn-ghost:hover { border-color: #17734a; color: #17734a; }
html[data-bs-theme="dark"] .auth-pane .btn-ghost:hover { color: #45d488; border-color: #34c77b; }

.auth-divider { display: flex; align-items: center; gap: .8rem; color: var(--auth-muted); font-size: .8rem; margin: 1.4rem 0; }
.auth-divider::before, .auth-divider::after { content: ""; height: 1px; flex: 1; background: var(--auth-input-border); }

.auth-trustline { color: var(--auth-muted); font-size: .8rem; }
.auth-footlinks { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; margin-top: 1.5rem; }
.auth-footlinks a { color: var(--auth-muted); font-size: .8rem; text-decoration: none; }
.auth-footlinks a:hover { color: #17734a; text-decoration: underline; }

/* alerts */
.auth-pane .alert { border-radius: 12px; border: 1px solid transparent; }

/* theme toggle */
.auth-theme-toggle {
    position: fixed; top: 16px; right: 16px; z-index: 30;
    width: 42px; height: 42px; border-radius: 50%;
    display: grid; place-items: center;
    border: 1px solid var(--auth-card-border); background: var(--auth-card-bg); color: var(--auth-text);
    box-shadow: 0 8px 20px -12px rgba(0, 0, 0, .5);
}

/* =========== Register wizard =========== */
.reg-stepmeta { display: flex; align-items: center; justify-content: space-between; margin-bottom: .5rem; }
.reg-stepmeta .step-count { font-size: .78rem; font-weight: 700; color: #17734a; }
html[data-bs-theme="dark"] .reg-stepmeta .step-count { color: #45d488; }
.reg-stepmeta .step-name { font-size: .78rem; color: var(--auth-muted); }

.reg-steps { display: flex; align-items: center; gap: .2rem; margin-bottom: 1rem; }
.reg-step { display: flex; align-items: center; gap: .5rem; flex: 0 0 auto; }
.reg-step .dot {
    width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
    font-weight: 700; font-size: .85rem; border: 2px solid var(--auth-input-border);
    color: var(--auth-muted); background: var(--auth-card-bg); transition: all .2s ease;
}
.reg-step .dot .bi { font-size: .95rem; }
.reg-step .lbl { font-size: .8rem; font-weight: 600; color: var(--auth-muted); }
.reg-step-line { flex: 1 1 auto; height: 2px; min-width: 10px; background: var(--auth-input-border); border-radius: 2px; transition: background .2s ease; }
.reg-step.is-active .dot { border-color: #17734a; color: #17734a; box-shadow: 0 0 0 4px var(--auth-ring); }
html[data-bs-theme="dark"] .reg-step.is-active .dot { border-color: #34c77b; color: #45d488; }
.reg-step.is-done .dot { background: #17734a; border-color: #17734a; color: #fff; }
.reg-step.is-done + .reg-step-line { background: #17734a; }
.reg-step.is-active .lbl, .reg-step.is-done .lbl { color: var(--auth-text); }

.reg-progress { height: 6px; border-radius: 6px; background: var(--auth-input-border); }
.reg-progress .progress-bar { background: linear-gradient(90deg, #1f9d63, #17734a); border-radius: 6px; }

.reg-body { min-height: 356px; }         /* keep card height stable across steps */
.reg-panel { display: none; }
.reg-panel.is-active { display: block; animation: authfade .28s ease; }
@keyframes authfade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.reg-summary { border: 1px solid var(--auth-card-border); border-radius: 14px; overflow: hidden; }
.reg-summary .sum-head { padding: 10px 14px; background: var(--auth-input-bg); font-weight: 700; font-size: .76rem; text-transform: uppercase; letter-spacing: .04em; color: var(--auth-muted); display: flex; align-items: center; gap: .4rem; }
.reg-summary .sum-body { padding: 12px 14px; }
.reg-summary dl { margin: 0; }
.reg-summary .sum-row { display: flex; justify-content: space-between; gap: 1rem; padding: 4px 0; }
.reg-summary .sum-row dt { color: var(--auth-muted); font-size: .8rem; font-weight: 500; }
.reg-summary .sum-row dd { margin: 0; font-weight: 600; font-size: .84rem; text-align: right; }

.trial-card { border: 1px solid var(--auth-card-border); border-radius: 14px; padding: 14px 16px; background: linear-gradient(160deg, rgba(31, 157, 99, .10), rgba(23, 115, 74, .04)); }
.trial-card .tc-item { display: flex; align-items: center; gap: .55rem; font-size: .86rem; padding: 3px 0; }
.trial-card .tc-item i { color: #1f9d63; }

.pw-meter { height: 6px; border-radius: 6px; background: var(--auth-input-border); overflow: hidden; margin-top: .5rem; }
.pw-meter > span { display: block; height: 100%; width: 0; transition: width .25s ease, background .25s ease; }
.pw-label { font-size: .72rem; font-weight: 600; }

/* =========== Responsive =========== */
@media (max-width: 1199.98px) {
    .auth-shell { grid-template-columns: minmax(0, 44fr) minmax(0, 56fr); }
    .hp-float { display: none; }
}
@media (max-width: 991.98px) {
    .auth-shell { grid-template-columns: 1fr; }
    .auth-hero { gap: 1.1rem; padding: 24px 22px 26px; }
    .auth-hero .hero-preview,
    .auth-hero .hero-benefits,
    .auth-hero .hero-trust { display: none; }         /* compact branding header on tablet/mobile */
    .hero-copy h1 { font-size: 1.4rem; margin-bottom: .35rem; }
    .hero-copy .lead-copy { font-size: .9rem; }
    .auth-pane { max-height: none; padding: 26px 20px 42px; }
    .reg-steps .lbl { display: none; }
    .reg-body { min-height: 0; }
}
@media (max-width: 575.98px) {
    .auth-hero { flex-direction: row; align-items: center; justify-content: space-between; padding: 16px 20px; }
    .hero-copy, .hero-foot { display: none; }
    .auth-card { padding: 22px 18px; border-radius: 16px; }
    .auth-theme-toggle { top: 12px; right: 12px; width: 38px; height: 38px; }
}
