:root {
    --auth-left-bg: #111827;
    --auth-panel-width: 520px;
    --auth-radius: 24px;
    --auth-line: rgba(15, 23, 42, 0.1);
    --auth-shadow: 0 28px 90px rgba(15, 23, 42, 0.12);
}

body.auth-layout {
    background: var(--app-bg);
    overflow-x: hidden;
}

.auth-stage {
    min-height: 100vh;
    background: var(--app-bg);
    color: var(--app-text);
}

.auth-left {
    min-height: 100vh;
}

.auth-left__bg {
    position: relative;
    display: flex;
    width: 100%;
    min-height: 100vh;
    overflow: hidden;
    isolation: isolate;
    background:
        linear-gradient(135deg, rgba(233, 30, 99, 0.18), transparent 38%),
        linear-gradient(145deg, #0b1220 0%, #111827 46%, #172033 100%);
}

.auth-shell--warn .auth-left__bg {
    background:
        linear-gradient(135deg, rgba(217, 119, 6, 0.2), transparent 38%),
        linear-gradient(145deg, #0b1220 0%, #111827 46%, #172033 100%);
}

.auth-shell--danger .auth-left__bg {
    background:
        linear-gradient(135deg, rgba(239, 68, 68, 0.18), transparent 38%),
        linear-gradient(145deg, #0b1220 0%, #111827 46%, #172033 100%);
}

.auth-left__bg::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -2;
    background:
        linear-gradient(rgba(255, 255, 255, 0.055) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.055) 1px, transparent 1px);
    background-size: 56px 56px;
    mask-image: linear-gradient(135deg, rgba(0, 0, 0, 0.95), transparent 88%);
}

.auth-left__bg::after {
    content: "";
    position: absolute;
    inset: auto 9% 12% auto;
    width: 420px;
    height: 420px;
    z-index: -1;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    opacity: 0.5;
}

.auth-left__grid {
    position: absolute;
    inset: 0;
    z-index: -1;
    background:
        linear-gradient(125deg, transparent 0 38%, rgba(255, 255, 255, 0.045) 38% 39%, transparent 39% 100%),
        linear-gradient(60deg, transparent 0 58%, rgba(255, 255, 255, 0.04) 58% 59%, transparent 59% 100%);
}

.auth-left__brand,
.auth-left__quote,
.auth-left__footer {
    position: absolute;
    z-index: 3;
    left: clamp(32px, 5vw, 72px);
    right: clamp(32px, 5vw, 72px);
}

.auth-left__brand {
    top: clamp(28px, 5vh, 56px);
    display: flex;
    align-items: center;
    gap: 14px;
}

.auth-left__brand .sidebar-logo,
.auth-mobile-brand .sidebar-logo {
    width: 46px;
    height: 46px;
    object-fit: contain;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.08);
    padding: 8px;
}

.auth-left__brand h5,
.auth-mobile-brand h5 {
    margin: 0;
    font-size: 17px;
    font-weight: 800;
    color: #ffffff;
}

.auth-left__brand p,
.auth-mobile-brand p {
    margin: 3px 0 0;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.68);
}

.auth-command {
    position: relative;
    z-index: 2;
    width: min(660px, calc(100% - 112px));
    margin: auto;
    padding: 22px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 30px;
    background: rgba(15, 23, 42, 0.68);
    box-shadow: 0 34px 100px rgba(2, 6, 23, 0.35);
    backdrop-filter: blur(18px);
    transform: translateY(-14px);
    animation: authPanelIn 0.7s ease both;
}

.auth-command__top,
.auth-left__footer,
.auth-kpi-strip,
.auth-insight-card {
    display: flex;
    align-items: center;
}

.auth-command__top {
    justify-content: space-between;
    gap: 18px;
}

.auth-command__eyebrow {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 0 10px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 999px;
    color: rgba(255, 255, 255, 0.74);
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
}

.auth-command h3 {
    margin: 12px 0 0;
    color: #ffffff;
    font-size: clamp(28px, 3vw, 42px);
    line-height: 1;
    font-weight: 850;
    letter-spacing: 0;
}

.auth-command__status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 12px;
    border-radius: 999px;
    background: rgba(16, 185, 129, 0.1);
    color: #a7f3d0;
    font-size: 12px;
    font-weight: 800;
}

.auth-command__status span {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: #34d399;
    box-shadow: 0 0 0 6px rgba(52, 211, 153, 0.13);
}

.auth-kpi-strip {
    gap: 12px;
    margin-top: 18px;
}

.auth-kpi {
    flex: 1;
    min-width: 0;
    padding: 11px 13px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.055);
}

.auth-kpi span,
.auth-module small,
.auth-insight-card p {
    color: rgba(255, 255, 255, 0.62);
}

.auth-kpi span {
    display: block;
    font-size: 11px;
    font-weight: 700;
}

.auth-kpi strong {
    display: block;
    margin-top: 4px;
    color: #ffffff;
    font-size: 18px;
    font-weight: 850;
}

.auth-flow {
    position: relative;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-top: 15px;
}

.auth-flow::before {
    content: "";
    position: absolute;
    inset: 50% 8%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(var(--app-primary-rgb), 0.75), transparent);
    animation: authFlow 4s ease-in-out infinite;
}

.auth-module {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 76px;
    padding: 13px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.062);
    animation: authFloat 6.5s ease-in-out infinite;
}

.auth-module--inventory,
.auth-module--pos {
    animation-delay: -2.3s;
}

.auth-module span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    border-radius: 14px;
    background: rgba(var(--app-primary-rgb), 0.18);
    color: #ffffff;
}

.auth-module strong,
.auth-insight-card strong {
    display: block;
    color: #ffffff;
    font-size: 14px;
    font-weight: 850;
}

.auth-module small {
    display: block;
    margin-top: 3px;
    font-size: 12px;
    line-height: 1.35;
}

.auth-insight-card {
    gap: 14px;
    margin-top: 15px;
    padding: 13px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    background: linear-gradient(135deg, rgba(var(--app-primary-rgb), 0.18), rgba(255, 255, 255, 0.06));
}

.auth-insight-card__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 46px;
    height: 46px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

.auth-insight-card p {
    margin: 4px 0 0;
    font-size: 12px;
    line-height: 1.45;
}

.auth-left__quote {
    bottom: 86px;
    max-width: 680px;
    padding-left: 18px;
    border-left: 2px solid rgba(255, 255, 255, 0.25);
}

.auth-left__quote h4 {
    margin: 0 0 8px;
    color: #ffffff;
    font-size: 23px;
    font-weight: 850;
}

.auth-left__quote p {
    margin: 0;
    max-width: 620px;
    color: rgba(255, 255, 255, 0.68);
    font-size: 14px;
    line-height: 1.6;
}

.auth-left__footer {
    bottom: 42px;
    justify-content: space-between;
    color: rgba(255, 255, 255, 0.52);
}

.auth-right {
    min-height: 100vh;
    padding: 32px;
    background: var(--app-surface);
    border-left: 1px solid var(--app-border);
}

.auth-panel {
    width: 100%;
    max-width: var(--auth-panel-width);
}

.auth-panel__inner {
    width: 100%;
    padding: 56px 28px;
    animation: authFormIn 0.55s ease both;
}

.auth-panel__toolbar {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 22px;
}

.theme-toggle--auth {
    flex: 0 0 auto;
}

.auth-mobile-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 30px;
    text-align: left;
}

.auth-mobile-brand .sidebar-logo {
    background: var(--app-icon-surface);
    border: 1px solid var(--app-border);
}

.auth-mobile-brand h5 {
    color: var(--app-heading);
}

.auth-mobile-brand p {
    color: var(--app-muted);
}

.auth-brand-dot {
    width: 11px;
    height: 11px;
    border-radius: 999px;
    background: var(--app-primary);
    box-shadow: 0 0 0 7px rgba(var(--app-primary-rgb), 0.1);
    margin-bottom: 15px;
}

.auth-brand-dot--warn {
    background: #d97706;
    box-shadow: 0 0 0 7px rgba(217, 119, 6, 0.11);
}

.auth-brand-dot--danger {
    background: #ef4444;
    box-shadow: 0 0 0 7px rgba(239, 68, 68, 0.11);
}

.auth-title {
    margin: 0;
    color: var(--app-heading);
    font-size: clamp(30px, 4vw, 38px);
    line-height: 1.08;
    font-weight: 850;
    letter-spacing: 0;
}

.auth-subtitle {
    margin: 10px 0 0;
    color: var(--app-muted);
    font-size: 14px;
    line-height: 1.55;
}

.auth-field {
    margin-top: 20px;
}

.auth-field label {
    display: block;
    margin-bottom: 8px;
    color: var(--app-heading);
    font-size: 13px;
    font-weight: 800;
}

.auth-input {
    width: 100%;
    height: 50px;
    border: 1px solid var(--app-border);
    border-radius: 14px;
    background: var(--app-input-bg);
    color: var(--app-heading);
    padding: 0 15px;
    font-size: 14px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

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

.auth-input:focus {
    outline: none;
    border-color: color-mix(in srgb, var(--app-primary) 72%, var(--app-border));
    box-shadow: 0 0 0 4px var(--app-focus-ring);
}

.auth-row,
.otp-meta,
.lock-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.auth-row {
    margin-top: 16px;
    margin-bottom: 22px;
}

.auth-switch {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--app-muted);
    font-size: 14px;
    line-height: 1;
}

.auth-switch label {
    margin: 0;
    cursor: pointer;
}

.auth-switch input[type="checkbox"] {
    appearance: none;
    width: 18px;
    height: 18px;
    margin: 0;
    border: 1.5px solid var(--app-border-strong);
    border-radius: 6px;
    background: var(--app-input-bg);
    display: inline-grid;
    place-content: center;
    cursor: pointer;
    transition: 0.15s ease;
}

.auth-switch input[type="checkbox"]::before {
    content: "";
    width: 10px;
    height: 10px;
    transform: scale(0);
    transition: 0.12s ease;
    box-shadow: inset 1em 1em #ffffff;
    clip-path: polygon(14% 44%, 0 65%, 40% 100%, 100% 18%, 80% 0, 40% 62%);
}

.auth-switch input[type="checkbox"]:checked {
    background: var(--app-primary);
    border-color: var(--app-primary);
}

.auth-switch input[type="checkbox"]:checked::before {
    transform: scale(1);
}

.auth-switch input[type="checkbox"]:focus {
    outline: none;
    box-shadow: 0 0 0 4px var(--app-focus-ring);
}

.auth-link,
.auth-backlink {
    color: var(--app-primary);
    font-size: 13px;
    font-weight: 800;
    text-decoration: none;
}

.auth-backlink {
    color: var(--app-muted);
}

.auth-link:hover,
.auth-backlink:hover {
    text-decoration: underline;
}

.auth-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 50px;
    border: 0;
    border-radius: 14px;
    background: var(--app-primary);
    color: #ffffff;
    font-weight: 800;
    text-decoration: none;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.auth-button:hover {
    color: #ffffff;
    transform: translateY(-1px);
    box-shadow: 0 16px 30px rgba(var(--app-primary-rgb), 0.24);
}

.auth-button:disabled,
.auth-button.disabled {
    cursor: not-allowed;
    opacity: 0.68;
    transform: none;
    box-shadow: none;
}

.auth-button--dark {
    background: var(--app-heading);
    color: var(--app-surface);
}

.auth-button--outline {
    background: transparent;
    border: 1px solid var(--app-border);
    color: var(--app-heading);
}

.auth-button--outline:hover {
    background: var(--app-surface-muted);
    color: var(--app-heading);
    box-shadow: none;
}

.auth-terms,
.auth-meta,
.auth-hint {
    color: var(--app-muted);
    font-size: 13px;
    line-height: 1.55;
}

.auth-terms,
.auth-meta {
    text-align: center;
}

.auth-terms {
    margin: 14px 0 0;
}

.auth-meta {
    margin-top: 24px;
}

.auth-hint {
    margin-top: 10px;
}

.auth-alert {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border: 1px solid transparent;
    border-radius: 14px;
    margin: 14px 0 18px;
}

.auth-alert--success {
    background: color-mix(in srgb, #10b981 10%, var(--app-surface));
    border-color: color-mix(in srgb, #10b981 22%, var(--app-border));
    color: color-mix(in srgb, #047857 76%, var(--app-heading));
}

.auth-alert--danger {
    background: color-mix(in srgb, #ef4444 10%, var(--app-surface));
    border-color: color-mix(in srgb, #ef4444 24%, var(--app-border));
    color: color-mix(in srgb, #b91c1c 76%, var(--app-heading));
}

.auth-alert__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 28px;
    height: 28px;
    border-radius: 10px;
    background: #10b981;
    color: #ffffff;
    font-weight: 900;
}

.auth-alert--danger .auth-alert__icon {
    background: #ef4444;
}

.auth-alert__text,
.auth-alert__li {
    color: inherit;
    font-size: 14px;
    font-weight: 650;
    line-height: 1.45;
}

.auth-alert__close {
    margin-left: auto;
    border: 0;
    background: transparent;
    color: inherit;
    font-size: 18px;
    line-height: 1;
    opacity: 0.62;
    cursor: pointer;
}

.auth-alert__close:hover {
    opacity: 1;
}

.auth-error {
    margin-top: 7px;
    color: #dc2626;
    font-size: 12px;
    font-weight: 700;
}

.auth-info,
.warn-panel,
.danger-panel,
.lock-panel {
    border: 1px solid var(--app-border);
    border-radius: 16px;
    background: var(--app-surface-muted);
    padding: 16px;
}

.auth-info {
    margin-top: 6px;
}

.auth-info-header,
.warn-panel-header,
.danger-panel-header {
    margin-bottom: 10px;
}

.auth-info__text,
.warn-panel__text,
.danger-panel__text {
    color: var(--app-text);
    font-size: 13px;
    line-height: 1.55;
}

.warn-panel,
.warn-panel__chip {
    border-color: color-mix(in srgb, #d97706 25%, var(--app-border));
    background: color-mix(in srgb, #d97706 10%, var(--app-surface));
}

.danger-panel,
.danger-panel__chip {
    border-color: color-mix(in srgb, #ef4444 25%, var(--app-border));
    background: color-mix(in srgb, #ef4444 10%, var(--app-surface));
}

.warn-panel__chip,
.danger-panel__chip {
    margin-top: 12px;
    padding: 10px 12px;
    border: 1px solid;
    border-radius: 12px;
    color: var(--app-heading);
    font-size: 13px;
}

.lock-row {
    margin: 16px 0 14px;
}

.lock-row__label,
.lock-panel__label {
    color: var(--app-muted);
    font-size: 13px;
    font-weight: 700;
}

.lock-chip {
    padding: 10px 12px;
    border: 1px solid var(--app-border);
    border-radius: 12px;
    background: var(--app-surface-muted);
    color: var(--app-heading);
    font-size: 12px;
    font-weight: 850;
}

.lock-panel {
    margin-bottom: 18px;
}

.lock-panel__top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.lock-panel__time {
    color: var(--app-heading);
    font-weight: 900;
}

.lock-progress {
    margin-top: 10px;
    height: 10px;
    border-radius: 999px;
    background: color-mix(in srgb, #d97706 18%, var(--app-surface-soft));
    overflow: hidden;
}

.lock-progress__bar {
    height: 100%;
    width: 0%;
    border-radius: inherit;
    background: #d97706;
    transition: width 0.25s ease;
}

.lock-actions {
    display: grid;
    gap: 10px;
}

.otp-wrap {
    display: flex;
    gap: 10px;
    justify-content: space-between;
}

.otp-box {
    width: 52px;
    height: 56px;
    border: 1px solid var(--app-border);
    border-radius: 14px;
    background: var(--app-input-bg);
    color: var(--app-heading);
    text-align: center;
    font-size: 18px;
    font-weight: 850;
    transition: 0.15s ease;
}

.otp-box:focus {
    outline: none;
    border-color: color-mix(in srgb, var(--app-primary) 72%, var(--app-border));
    box-shadow: 0 0 0 4px var(--app-focus-ring);
}

.otp-meta {
    margin-top: 14px;
    color: var(--app-muted);
    font-size: 13px;
}

.otp-expire strong {
    color: var(--app-heading);
}

.resend-disabled {
    pointer-events: none;
    opacity: 0.62;
}

.auth-tabs {
    display: flex;
    gap: 10px;
    padding: 6px;
    border: 1px solid var(--app-border);
    border-radius: 16px;
    background: var(--app-surface-muted);
}

.auth-tab {
    flex: 1;
    min-height: 40px;
    border: 0;
    border-radius: 12px;
    background: transparent;
    color: var(--app-muted);
    font-size: 13px;
    font-weight: 850;
    transition: 0.15s ease;
}

.auth-tab.is-active,
.auth-tab.active {
    background: var(--app-surface-elevated);
    color: var(--app-heading);
    box-shadow: 0 10px 18px rgba(15, 23, 42, 0.08);
}

html[data-bs-theme="dark"] {
    --auth-line: rgba(148, 163, 184, 0.16);
    --auth-shadow: 0 34px 90px rgba(2, 6, 23, 0.45);
}

html[data-bs-theme="dark"] .auth-stage,
html[data-bs-theme="dark"] body.auth-layout {
    background: var(--app-bg) !important;
}

html[data-bs-theme="dark"] .auth-right {
    background: var(--app-bg);
}

html[data-bs-theme="dark"] .auth-panel__inner {
    border: 1px solid rgba(148, 163, 184, 0.14);
    border-radius: 28px;
    background: rgba(18, 26, 40, 0.78);
    box-shadow: var(--auth-shadow);
    backdrop-filter: blur(18px);
}

html[data-bs-theme="dark"] .auth-button--dark {
    background: var(--app-primary);
    color: #ffffff;
}

@keyframes authPanelIn {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.985);
    }
    to {
        opacity: 1;
        transform: translateY(-14px) scale(1);
    }
}

@keyframes authFormIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes authFloat {
    0%,
    100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-5px);
    }
}

@keyframes authFlow {
    0%,
    100% {
        opacity: 0.25;
        transform: scaleX(0.76);
    }
    50% {
        opacity: 0.85;
        transform: scaleX(1);
    }
}

@media (max-width: 1199.98px) {
    .auth-command {
        width: min(590px, calc(100% - 70px));
        padding: 22px;
    }
}

@media (min-width: 992px) and (max-height: 820px) {
    .auth-left__quote {
        display: none;
    }
}

@media (max-width: 991.98px) {
    .auth-right {
        min-height: 100vh;
        padding: 24px;
        border-left: 0;
        background:
            linear-gradient(135deg, rgba(var(--app-primary-rgb), 0.08), transparent 34%),
            var(--app-bg);
    }

    .auth-panel__inner {
        max-width: 520px;
        margin: 0 auto;
        padding: 34px 0;
    }

    html[data-bs-theme="dark"] .auth-panel__inner {
        padding: 28px;
    }
}

@media (max-width: 575.98px) {
    .auth-right {
        padding: 20px;
        align-items: flex-start !important;
    }

    .auth-panel__inner {
        padding: 22px 0;
    }

    html[data-bs-theme="dark"] .auth-panel__inner {
        padding: 22px;
        border-radius: 22px;
    }

    .auth-row,
    .otp-meta,
    .lock-row {
        align-items: flex-start;
        flex-direction: column;
    }

    .otp-wrap {
        gap: 8px;
    }

    .otp-box {
        width: 44px;
        height: 54px;
    }
}

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