:root {
    /* Wired to global brand — Settings Theme Color + Preloader Color */
    --auth-primary: var(--app-brand-action, #312e81);
    --auth-primary-dark: var(--app-brand-action-dark, #1e1b4b);
    --auth-primary-soft: color-mix(in srgb, var(--app-brand-action, #312e81) 14%, transparent);
    --auth-sidebar: var(--app-brand-mid, #1e1b4b);
    --auth-sidebar-deep: var(--app-brand-sidebar, #0f172a);
    --auth-ink: #0f172a;
    --auth-muted: #64748b;
    --auth-border: #cbd5e1;
    --auth-card: #ffffff;
    --auth-radius: 16px;
    --auth-shadow: 0 24px 48px rgba(15, 23, 42, 0.28);
    --auth-form-bg: color-mix(in srgb, var(--app-brand-mid, #1e1b4b) 72%, #475569);
    --auth-form-bg-deep: var(--app-brand-sidebar, #0f172a);
}

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

html,
body.auth-page {
    min-height: 100%;
    margin: 0;
}

body.auth-page {
    font-family: "Source Sans Pro", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--auth-ink);
    background: var(--auth-sidebar-deep);
}

.auth-shell {
    position: relative;
    display: grid;
    min-height: 100vh;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
    overflow: hidden;
    background:
        radial-gradient(circle at 12% 18%, color-mix(in srgb, var(--app-brand-action, #312e81) 22%, transparent), transparent 38%),
        radial-gradient(circle at 92% 10%, color-mix(in srgb, var(--app-brand-action, #312e81) 16%, transparent), transparent 34%),
        radial-gradient(circle at 78% 88%, color-mix(in srgb, var(--app-brand-action-dark, #1e1b4b) 12%, transparent), transparent 36%),
        linear-gradient(112deg, var(--auth-sidebar-deep) 0%, var(--auth-sidebar) 34%, color-mix(in srgb, var(--auth-sidebar) 55%, #475569) 52%, var(--auth-form-bg) 72%, #475569 100%);
}

/* Soft floating orbs — full-page ambient */
.auth-ambient {
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.auth-ambient__orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(56px);
    opacity: 0.26;
    will-change: transform;
}

.auth-ambient__orb--1 {
    width: 320px;
    height: 320px;
    top: 5%;
    left: 4%;
    background: var(--auth-primary);
    animation: auth-orb-drift-a 16s ease-in-out infinite;
}

.auth-ambient__orb--2 {
    width: 240px;
    height: 240px;
    top: 52%;
    left: 18%;
    background: color-mix(in srgb, var(--auth-primary) 70%, #fff);
    animation: auth-orb-drift-b 19s ease-in-out infinite;
    animation-delay: -4s;
}

.auth-ambient__orb--3 {
    width: 280px;
    height: 280px;
    top: 12%;
    right: 8%;
    background: var(--auth-primary-dark);
    animation: auth-orb-drift-c 17s ease-in-out infinite;
    animation-delay: -8s;
}

.auth-ambient__orb--4 {
    width: 200px;
    height: 200px;
    bottom: 8%;
    right: 22%;
    background: color-mix(in srgb, var(--auth-primary) 55%, var(--auth-primary-dark));
    opacity: 0.22;
    animation: auth-orb-drift-a 21s ease-in-out infinite reverse;
    animation-delay: -6s;
}

@keyframes auth-orb-drift-a {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(22px, -28px) scale(1.08); }
}

@keyframes auth-orb-drift-b {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(-26px, 20px) scale(0.96); }
}

@keyframes auth-orb-drift-c {
    0%, 100% { transform: translate(0, 0); opacity: 0.22; }
    50% { transform: translate(18px, 24px); opacity: 0.32; }
}

/* POS / business themed floating shapes */
.auth-shape {
    position: absolute;
    pointer-events: none;
    will-change: transform;
}

.auth-shape--ring {
    border-radius: 50%;
    border: 1.5px solid color-mix(in srgb, var(--auth-primary) 42%, transparent);
    background: color-mix(in srgb, var(--auth-primary) 10%, transparent);
    animation: auth-shape-float-a 16s ease-in-out infinite;
}

.auth-shape--ring.auth-shape--a {
    width: 130px;
    height: 130px;
    top: 12%;
    left: 8%;
    animation-delay: 0s;
}

.auth-shape--ring.auth-shape--b {
    width: 88px;
    height: 88px;
    bottom: 16%;
    right: 14%;
    animation: auth-shape-float-b 20s ease-in-out infinite;
    animation-delay: -6s;
}

.auth-shape--ring.auth-shape--e {
    width: 72px;
    height: 72px;
    top: 62%;
    left: 42%;
    animation: auth-shape-float-c 18s ease-in-out infinite;
    animation-delay: -10s;
}

.auth-shape--square {
    border-radius: 18px;
    border: 1.5px solid color-mix(in srgb, var(--auth-primary) 36%, transparent);
    background: color-mix(in srgb, var(--auth-primary) 12%, transparent);
    animation: auth-shape-float-b 15s ease-in-out infinite;
}

.auth-shape--square.auth-shape--c {
    width: 64px;
    height: 64px;
    top: 24%;
    right: 18%;
    transform: rotate(18deg);
    animation-delay: -3s;
}

.auth-shape--square.auth-shape--d {
    width: 52px;
    height: 52px;
    bottom: 28%;
    left: 24%;
    transform: rotate(-12deg);
    animation-delay: -9s;
}

.auth-shape--square.auth-shape--f {
    width: 44px;
    height: 44px;
    top: 38%;
    left: 4%;
    transform: rotate(24deg);
    animation: auth-shape-float-a 17s ease-in-out infinite reverse;
    animation-delay: -7s;
}

.auth-shape--bar {
    border-radius: 999px;
    background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--auth-primary) 35%, transparent), transparent);
    opacity: 0.35;
    animation: auth-shape-float-c 14s ease-in-out infinite;
}

.auth-shape--bar.auth-shape--g {
    width: 120px;
    height: 3px;
    top: 44%;
    right: 6%;
    transform: rotate(-28deg);
    animation-delay: -2s;
}

.auth-shape--bar.auth-shape--h {
    width: 90px;
    height: 3px;
    bottom: 38%;
    left: 8%;
    transform: rotate(16deg);
    animation-delay: -12s;
}

.auth-shape--icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: color-mix(in srgb, var(--auth-primary) 62%, rgba(255, 255, 255, 0.55));
    opacity: 0.34;
    font-size: 2rem;
    animation: auth-shape-float-a 17s ease-in-out infinite;
}

.auth-shape--icon i {
    filter: drop-shadow(0 6px 14px color-mix(in srgb, var(--auth-primary) 32%, transparent));
}

.auth-shape--receipt {
    top: 18%;
    right: 6%;
    font-size: 2.35rem;
    animation-delay: -2s;
}

.auth-shape--chart {
    bottom: 22%;
    left: 10%;
    font-size: 2.5rem;
    animation: auth-shape-float-c 19s ease-in-out infinite;
    animation-delay: -5s;
}

.auth-shape--boxes {
    top: 50%;
    left: 4%;
    font-size: 2rem;
    animation-delay: -8s;
}

.auth-shape--register {
    bottom: 10%;
    right: 8%;
    font-size: 2.3rem;
    animation: auth-shape-float-c 16s ease-in-out infinite reverse;
    animation-delay: -4s;
}

.auth-shape--cart {
    top: 6%;
    left: 36%;
    font-size: 1.85rem;
    animation-delay: -11s;
}

.auth-shape--warehouse {
    top: 34%;
    right: 4%;
    font-size: 2.1rem;
    animation: auth-shape-float-b 18s ease-in-out infinite;
    animation-delay: -13s;
}

.auth-shape--users {
    bottom: 42%;
    right: 28%;
    font-size: 1.95rem;
    animation-delay: -6s;
}

.auth-shape--barcode {
    top: 72%;
    left: 14%;
    font-size: 2.15rem;
    animation: auth-shape-float-a 20s ease-in-out infinite reverse;
    animation-delay: -9s;
}

.auth-shape--invoice {
    top: 10%;
    left: 22%;
    font-size: 2rem;
    animation: auth-shape-float-c 15s ease-in-out infinite;
    animation-delay: -14s;
}

@keyframes auth-shape-float-a {
    0%, 100% { transform: translate(0, 0) rotate(0deg); opacity: 0.3; }
    50% { transform: translate(18px, -24px) rotate(8deg); opacity: 0.42; }
}

@keyframes auth-shape-float-b {
    0%, 100% { transform: translate(0, 0) rotate(18deg); opacity: 0.28; }
    50% { transform: translate(-20px, 22px) rotate(26deg); opacity: 0.4; }
}

@keyframes auth-shape-float-c {
    0%, 100% { transform: translate(0, 0) rotate(0deg); opacity: 0.26; }
    50% { transform: translate(14px, -20px) rotate(-10deg); opacity: 0.4; }
}

@keyframes auth-fade-up {
    from {
        opacity: 0;
        transform: translateY(14px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}


.auth-shell__brand {
    position: relative;
    z-index: 1;
    overflow: hidden;
    background: transparent;
    color: #fff;
}

.auth-shell__brand::after {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    width: min(28vw, 220px);
    height: 100%;
    background: linear-gradient(90deg, transparent 0%, rgba(51, 65, 85, 0.45) 100%);
    pointer-events: none;
    z-index: 0;
}

.auth-shell__brand-inner {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 100%;
    padding: 3rem clamp(2rem, 5vw, 4rem);
}

.auth-shell__glow {
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
    opacity: 0.35;
    pointer-events: none;
    will-change: transform, opacity;
    animation: auth-glow-pulse 16s ease-in-out infinite;
}

.auth-shell__glow--one {
    width: 280px;
    height: 280px;
    top: -60px;
    right: -40px;
    background: var(--auth-primary);
}

.auth-shell__glow--two {
    width: 320px;
    height: 320px;
    bottom: -80px;
    left: -60px;
    background: var(--auth-primary-dark);
    animation-duration: 20s;
    animation-delay: -5s;
}

@keyframes auth-glow-pulse {
    0%, 100% { transform: translate(0, 0); opacity: 0.32; }
    50% { transform: translate(16px, -12px); opacity: 0.4; }
}

.auth-shell__brand-content {
    max-width: 28rem;
}

.auth-shell__logo-wrap {
    margin-bottom: 1.75rem;
    animation: auth-fade-up 0.6s ease-out both;
}

.auth-shell__logo-img {
    max-height: 56px;
    width: auto;
    filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.18));
}

.auth-shell__logo-mark {
    width: 56px;
    height: 56px;
    display: grid;
    place-items: center;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.18);
    font-size: 1.35rem;
}

.auth-shell__headline {
    margin: 0 0 0.75rem;
    font-size: clamp(1.85rem, 3vw, 2.5rem);
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -0.02em;
    animation: auth-fade-up 0.65s ease-out 0.12s both;
}

.auth-shell__tagline {
    margin: 0 0 2rem;
    font-size: 1.05rem;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.82);
    animation: auth-fade-up 0.65s ease-out 0.22s both;
}

.auth-shell__features {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0.85rem;
}

.auth-shell__features li {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.98rem;
    color: rgba(255, 255, 255, 0.92);
    animation: auth-fade-up 0.6s ease-out both;
}

.auth-shell__features li:nth-child(1) { animation-delay: 0.35s; }
.auth-shell__features li:nth-child(2) { animation-delay: 0.48s; }
.auth-shell__features li:nth-child(3) { animation-delay: 0.61s; }

.auth-shell__features i {
    color: color-mix(in srgb, var(--auth-primary) 55%, #fff);
}

.auth-shell__footer {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.72);
}

.auth-shell__footer strong {
    color: #fff;
    font-weight: 600;
}

.auth-shell__form {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(1.5rem, 4vw, 3rem);
    background: transparent;
}

.auth-shell__form::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: min(24vw, 180px);
    height: 100%;
    background: linear-gradient(270deg, transparent 0%, rgba(30, 41, 59, 0.35) 100%);
    pointer-events: none;
    z-index: 0;
}

.auth-card {
    position: relative;
    z-index: 1;
    width: min(100%, 420px);
    background: var(--auth-card);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--auth-radius);
    box-shadow: var(--auth-shadow);
    padding: clamp(1.5rem, 4vw, 2.25rem);
    animation: auth-card-enter 0.65s ease-out both;
}

@keyframes auth-card-enter {
    from {
        opacity: 0;
        transform: translateY(18px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.auth-card--wide {
    width: min(100%, 460px);
}

.auth-card__mobile-brand {
    display: none;
    margin-bottom: 1.25rem;
    text-align: center;
}

.auth-card__mobile-mark {
    width: 52px;
    height: 52px;
    margin: 0 auto 0.65rem;
    display: grid;
    place-items: center;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--auth-primary) 0%, var(--auth-primary-dark) 100%);
    color: #fff;
    font-size: 1.25rem;
    box-shadow: 0 10px 24px color-mix(in srgb, var(--auth-primary) 30%, transparent);
}

.auth-card__mobile-logo {
    max-height: 44px;
    width: auto;
    display: block;
    margin: 0 auto 0.5rem;
}

.auth-card__mobile-title {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--auth-ink);
}

.auth-card__header h2 {
    margin: 0 0 0.35rem;
    font-size: 1.65rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    animation: auth-fade-up 0.55s ease-out 0.2s both;
}

.auth-card__header p {
    margin: 0 0 1.5rem;
    color: var(--auth-muted);
    font-size: 0.98rem;
    animation: auth-fade-up 0.55s ease-out 0.28s both;
}

.auth-form .auth-field:nth-of-type(1) { animation: auth-fade-up 0.55s ease-out 0.36s both; }
.auth-form .auth-field:nth-of-type(2) { animation: auth-fade-up 0.55s ease-out 0.44s both; }
.auth-form__row { animation: auth-fade-up 0.55s ease-out 0.52s both; }
.auth-card__signup { animation: auth-fade-up 0.55s ease-out 0.6s both; }
.auth-card__mobile-brand { animation: auth-fade-up 0.55s ease-out 0.12s both; }

.auth-alert {
    margin-bottom: 1rem;
    border-radius: 10px;
    font-size: 0.92rem;
}

.auth-form {
    display: grid;
    gap: 1.1rem;
}

.auth-field label {
    display: block;
    margin-bottom: 0.45rem;
    font-size: 0.88rem;
    font-weight: 600;
    color: #334155;
}

.auth-input-wrap {
    position: relative;
}

.auth-input-wrap:focus-within .auth-input-icon {
    color: var(--auth-primary);
    transform: translateY(-50%) scale(1.08);
    transition: color 0.2s ease, transform 0.2s ease;
}

.auth-input-icon {
    position: absolute;
    left: 0.95rem;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    font-size: 0.92rem;
    pointer-events: none;
    transition: color 0.2s ease, transform 0.2s ease;
}

.auth-input {
    width: 100%;
    height: 48px;
    padding: 0 1rem 0 2.65rem;
    border: 1px solid var(--auth-border);
    border-radius: 12px;
    background: #fff;
    font-size: 0.98rem;
    color: var(--auth-ink);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.auth-input::placeholder {
    color: #94a3b8;
}

.auth-input:focus {
    outline: none;
    border-color: var(--auth-primary);
    box-shadow: 0 0 0 4px var(--auth-primary-soft);
}

.auth-input.is-invalid {
    border-color: #ef4444;
}

.auth-field-error {
    margin: 0.4rem 0 0;
    font-size: 0.84rem;
    color: #dc2626;
}

.auth-form__row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.auth-checkbox {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
    font-size: 0.92rem;
    color: #475569;
    cursor: pointer;
    user-select: none;
}

.auth-checkbox input {
    width: 16px;
    height: 16px;
    accent-color: var(--auth-primary);
}

.auth-link {
    color: var(--auth-primary);
    text-decoration: none;
    font-size: 0.92rem;
    font-weight: 500;
}

.auth-link:hover {
    color: var(--auth-primary-dark);
    text-decoration: underline;
}

.auth-link--strong {
    font-weight: 600;
}

.auth-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.65rem;
    width: 100%;
    height: 48px;
    margin-top: 0.25rem;
    border: 0;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--auth-primary) 0%, var(--auth-primary-dark) 100%);
    color: #fff;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 12px 24px color-mix(in srgb, var(--auth-primary) 28%, transparent);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.auth-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 16px 28px color-mix(in srgb, var(--auth-primary) 34%, transparent);
}

.auth-btn:active {
    transform: translateY(0);
}

.auth-card__signup {
    margin: 1.35rem 0 0;
    text-align: center;
    font-size: 0.94rem;
    color: var(--auth-muted);
}

@media (prefers-reduced-motion: reduce) {
    .auth-ambient__orb,
    .auth-shape,
    .auth-shell__glow,
    .auth-card,
    .auth-card__header h2,
    .auth-card__header p,
    .auth-form .auth-field,
    .auth-form__row,
    .auth-card__signup,
    .auth-card__mobile-brand,
    .auth-shell__headline,
    .auth-shell__tagline,
    .auth-shell__logo-wrap,
    .auth-shell__features li {
        animation: none !important;
    }
}

@media (max-width: 991.98px) {
    body.auth-page,
    .auth-shell {
        min-height: 100dvh;
    }

    .auth-shell {
        grid-template-columns: 1fr;
        background:
            radial-gradient(circle at 50% 12%, color-mix(in srgb, var(--app-brand-action, #312e81) 28%, transparent), transparent 42%),
            radial-gradient(circle at 85% 78%, color-mix(in srgb, var(--app-brand-action-dark, #1e1b4b) 18%, transparent), transparent 38%),
            linear-gradient(180deg, var(--auth-sidebar-deep) 0%, var(--auth-sidebar) 55%, color-mix(in srgb, var(--auth-sidebar) 70%, #334155) 100%);
    }

    .auth-shell__brand {
        display: none;
    }

    .auth-shell__form {
        padding: max(1.25rem, env(safe-area-inset-top)) 1rem max(1.25rem, env(safe-area-inset-bottom));
        align-items: center;
    }

    .auth-shell__form::before {
        display: none;
    }

    .auth-card {
        width: min(100%, 440px);
        box-shadow:
            0 20px 40px rgba(15, 23, 42, 0.35),
            0 0 0 1px rgba(255, 255, 255, 0.06);
    }

    .auth-card__mobile-brand {
        display: block;
    }

    /* Mobile: larger shapes around card */
    .auth-ambient__orb--1 {
        width: min(70vw, 280px);
        height: min(70vw, 280px);
        top: 2%;
        left: 50%;
        margin-left: min(-35vw, -140px);
    }

    .auth-ambient__orb--2 {
        width: min(52vw, 200px);
        height: min(52vw, 200px);
        bottom: 4%;
        left: 2%;
    }

    .auth-ambient__orb--3 {
        width: min(58vw, 220px);
        height: min(58vw, 220px);
        top: 38%;
        right: -12%;
    }

    .auth-ambient__orb--4 {
        width: min(40vw, 160px);
        height: min(40vw, 160px);
        bottom: 22%;
        right: 4%;
    }

    .auth-shape--ring.auth-shape--a { top: 8%; left: 4%; width: 96px; height: 96px; }
    .auth-shape--ring.auth-shape--b { bottom: 10%; right: 4%; width: 72px; height: 72px; }
    .auth-shape--ring.auth-shape--e { top: 58%; left: 38%; width: 56px; height: 56px; }
    .auth-shape--square.auth-shape--c { top: 14%; right: 6%; width: 52px; height: 52px; }
    .auth-shape--square.auth-shape--d { bottom: 24%; left: 6%; width: 44px; height: 44px; }
    .auth-shape--square.auth-shape--f { top: 32%; left: 2%; width: 38px; height: 38px; }
    .auth-shape--bar.auth-shape--g { width: 90px; top: 42%; right: 2%; }
    .auth-shape--bar.auth-shape--h { width: 70px; bottom: 34%; left: 4%; }
    .auth-shape--receipt { top: 10%; right: 4%; font-size: 2rem; }
    .auth-shape--chart { bottom: 14%; left: 5%; font-size: 2.15rem; }
    .auth-shape--boxes { top: 44%; left: 2%; font-size: 1.75rem; }
    .auth-shape--register { bottom: 8%; right: 4%; font-size: 1.9rem; }
    .auth-shape--cart { top: 4%; left: 22%; font-size: 1.65rem; }
    .auth-shape--warehouse { top: 28%; right: 2%; font-size: 1.8rem; }
    .auth-shape--users { bottom: 38%; right: 20%; font-size: 1.7rem; }
    .auth-shape--barcode { top: 68%; left: 8%; font-size: 1.85rem; }
    .auth-shape--invoice { top: 8%; left: 16%; font-size: 1.75rem; }
}

@media (min-width: 992px) {
    .auth-shell__form {
        padding: clamp(2rem, 4vw, 3.5rem);
    }

    .auth-shape--icon {
        font-size: 2.2rem;
        opacity: 0.36;
    }

    .auth-shape--receipt { font-size: 2.6rem; right: 5%; }
    .auth-shape--chart { font-size: 2.75rem; left: 7%; }
    .auth-shape--register { font-size: 2.5rem; right: 5%; }
    .auth-shape--cart { font-size: 2rem; left: 40%; }
    .auth-shape--warehouse { font-size: 2.35rem; }
    .auth-shape--invoice { font-size: 2.25rem; left: 20%; }
}
