:root {
    --at-primary: #7c3aed;
    --at-primary-dark: #5b21b6;
    --at-primary-light: #a78bfa;
    --at-ink: #0f172a;
    --at-muted: #64748b;
    --at-surface: #ffffff;
    --at-border: #e2e8f0;
    --at-sidebar-width: 17.5rem;
    --at-sidebar-bg: #1e1b4b;
    --at-sidebar-bg-alt: #312e81;
    --at-sidebar-text: #c4b5fd;
    --at-sidebar-text-active: #ffffff;
    --at-sidebar-border: rgba(255, 255, 255, 0.1);
    --at-sidebar-overlay: rgba(15, 23, 42, 0.55);
    --bs-primary: var(--at-primary);
    --bs-primary-rgb: 124, 58, 237;
    --bs-body-font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
}

.btn-primary {
    --bs-btn-bg: var(--at-primary);
    --bs-btn-border-color: var(--at-primary);
    --bs-btn-hover-bg: var(--at-primary-dark);
    --bs-btn-hover-border-color: var(--at-primary-dark);
    --bs-btn-active-bg: var(--at-primary-dark);
    --bs-btn-active-border-color: var(--at-primary-dark);
    --bs-btn-focus-shadow-rgb: var(--bs-primary-rgb);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--at-primary-light);
    box-shadow: 0 0 0 0.25rem rgba(var(--bs-primary-rgb), 0.2);
}

.login-shell {
    background: linear-gradient(135deg, #1e1b4b 0%, #312e81 45%, #4c1d95 100%);
    min-height: 100vh;
    min-height: 100dvh;
}

.login-hero {
    color: #f8fafc;
    padding: clamp(1.5rem, 4vw, 3.5rem);
    position: relative;
}

.login-hero::before {
    background:
        radial-gradient(circle at 20% 20%, rgba(167, 139, 250, 0.35), transparent 45%),
        radial-gradient(circle at 80% 70%, rgba(99, 102, 241, 0.25), transparent 40%);
    content: "";
    inset: 0;
    pointer-events: none;
    position: absolute;
}

.login-hero__content {
    max-width: 36rem;
    position: relative;
    z-index: 1;
}

.login-hero__badge {
    backdrop-filter: blur(8px);
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 999px;
    color: #ede9fe;
    display: inline-flex;
    font-size: 0.85rem;
    font-weight: 600;
    gap: 0.45rem;
    letter-spacing: 0.02em;
    margin-bottom: 1.25rem;
    padding: 0.45rem 0.9rem;
}

.login-hero__title {
    font-size: clamp(2rem, 4vw, 3.25rem);
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.1;
    margin-bottom: 1rem;
}

.login-hero__text {
    color: #ddd6fe;
    font-size: clamp(1rem, 1.6vw, 1.15rem);
    line-height: 1.6;
    margin-bottom: 2rem;
}

.login-hero__stats {
    display: grid;
    gap: 0.85rem;
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.login-hero__stat {
    backdrop-filter: blur(8px);
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 0.85rem;
    padding: 0.9rem 1rem;
}

.login-hero__stat strong {
    display: block;
    font-size: 1.05rem;
    margin-bottom: 0.15rem;
}

.login-hero__stat span {
    color: #c4b5fd;
    font-size: 0.8rem;
}

.login-panel {
    background: var(--at-surface);
    min-height: 100vh;
    min-height: 100dvh;
    padding: clamp(1.25rem, 3vw, 2.5rem);
}

.login-panel__inner {
    margin: 0 auto;
    max-width: 28rem;
    width: 100%;
}

.login-panel__brand {
    align-items: center;
    color: var(--at-ink);
    display: flex;
    font-size: 1.15rem;
    font-weight: 800;
    gap: 0.65rem;
    margin-bottom: 1.75rem;
}

.login-panel__brand-icon {
    align-items: center;
    background: linear-gradient(135deg, var(--at-primary), var(--at-primary-dark));
    border-radius: 0.75rem;
    color: #fff;
    display: inline-flex;
    font-size: 1.1rem;
    height: 2.5rem;
    justify-content: center;
    width: 2.5rem;
}

.login-panel__heading {
    font-size: clamp(1.6rem, 2.5vw, 2rem);
    font-weight: 800;
    letter-spacing: -0.02em;
    margin-bottom: 0.35rem;
}

.login-panel__subheading {
    color: var(--at-muted);
    font-size: 0.95rem;
    margin-bottom: 1.75rem;
}

.login-form .form-label {
    color: #334155;
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.4rem;
}

.login-form .input-group-text {
    background: #f8fafc;
    border-color: var(--at-border);
    color: var(--at-muted);
}

.login-form .form-control {
    border-color: var(--at-border);
    min-height: 3rem;
    padding: 0.65rem 0.9rem;
}

.login-form .btn {
    font-weight: 700;
    min-height: 3rem;
    padding: 0.7rem 1rem;
}

.login-mobile-hero {
    background: linear-gradient(135deg, #312e81, #5b21b6);
    color: #fff;
    padding: 1.25rem 1.5rem;
}

@media (max-width: 991.98px) {
    .login-hero__stats {
        grid-template-columns: 1fr;
    }

    .login-panel {
        min-height: auto;
    }
}

/* Admin shell */
.admin-shell {
    min-height: 100vh;
    min-height: 100dvh;
    width: 100%;
}

.admin-content {
    margin-left: var(--at-sidebar-width);
    min-height: 100vh;
    min-height: 100dvh;
    min-width: 0;
    transition: margin-left 0.2s ease;
    width: calc(100% - var(--at-sidebar-width));
}

/* Sidebar */
.at-sidebar {
    background:
        radial-gradient(circle at 0% 0%, rgba(167, 139, 250, 0.18), transparent 42%),
        radial-gradient(circle at 100% 100%, rgba(99, 102, 241, 0.14), transparent 38%),
        linear-gradient(180deg, var(--at-sidebar-bg) 0%, var(--at-sidebar-bg-alt) 52%, #1e1b4b 100%);
    border-right: 1px solid var(--at-sidebar-border);
    color: var(--at-sidebar-text);
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    left: 0;
    overflow: hidden;
    position: fixed;
    top: 0;
    width: var(--at-sidebar-width);
    z-index: 1040;
}

.at-sidebar__header {
    align-items: center;
    border-bottom: 1px solid var(--at-sidebar-border);
    display: flex;
    flex-shrink: 0;
    gap: 0.75rem;
    justify-content: space-between;
    padding: 1.15rem 1rem 1rem;
}

.at-sidebar__brand {
    align-items: center;
    color: var(--at-sidebar-text-active);
    display: flex;
    gap: 0.75rem;
    min-width: 0;
    text-decoration: none;
}

.at-sidebar__brand:hover {
    color: #ede9fe;
}

.at-sidebar__brand-icon {
    align-items: center;
    background: linear-gradient(135deg, var(--at-primary), var(--at-primary-dark));
    border-radius: 0.75rem;
    box-shadow: 0 8px 20px rgba(124, 58, 237, 0.35);
    color: #fff;
    display: inline-flex;
    flex-shrink: 0;
    font-size: 1.05rem;
    height: 2.5rem;
    justify-content: center;
    width: 2.5rem;
}

.at-sidebar__brand-text {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    min-width: 0;
}

.at-sidebar__brand-text strong {
    font-size: 0.98rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.at-sidebar__brand-text small {
    color: #a5b4fc;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.at-sidebar__close {
    align-items: center;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 0.6rem;
    color: #ede9fe;
    display: inline-flex;
    flex-shrink: 0;
    height: 2.25rem;
    justify-content: center;
    padding: 0;
    width: 2.25rem;
}

.at-sidebar__close:hover {
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
}

.at-sidebar__nav {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 0.85rem 0.75rem 1rem;
    scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
    scrollbar-width: thin;
}

.at-sidebar__section + .at-sidebar__section {
    margin-top: 1rem;
}

.at-sidebar__section-label {
    color: #8b5cf6;
    display: block;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    margin-bottom: 0.45rem;
    padding: 0 0.65rem;
    text-transform: uppercase;
}

.at-sidebar__links {
    display: grid;
    gap: 0.25rem;
}

.at-sidebar__link {
    align-items: center;
    border-radius: 0.75rem;
    color: var(--at-sidebar-text);
    display: flex;
    font-size: 0.92rem;
    font-weight: 600;
    gap: 0.7rem;
    padding: 0.68rem 0.75rem;
    position: relative;
    text-decoration: none;
    transition: background-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.at-sidebar__link:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--at-sidebar-text-active);
}

.at-sidebar__link.is-active {
    background: rgba(124, 58, 237, 0.28);
    box-shadow: inset 0 0 0 1px rgba(167, 139, 250, 0.22);
    color: var(--at-sidebar-text-active);
}

.at-sidebar__link-icon {
    align-items: center;
    display: inline-flex;
    flex-shrink: 0;
    font-size: 1.05rem;
    justify-content: center;
    opacity: 0.92;
    width: 1.25rem;
}

.at-sidebar__link-label {
    flex: 1 1 auto;
    min-width: 0;
}

.at-sidebar__link-indicator {
    background: #c4b5fd;
    border-radius: 999px;
    flex-shrink: 0;
    height: 0.45rem;
    width: 0.45rem;
}

.at-sidebar__footer {
    border-top: 1px solid var(--at-sidebar-border);
    flex-shrink: 0;
    padding: 0.9rem 0.85rem 1rem;
}

.at-sidebar__user {
    align-items: center;
    backdrop-filter: blur(8px);
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0.85rem;
    display: flex;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    padding: 0.75rem;
}

.at-sidebar__avatar {
    align-items: center;
    background: linear-gradient(135deg, #a78bfa, #7c3aed);
    border-radius: 0.7rem;
    color: #fff;
    display: inline-flex;
    flex-shrink: 0;
    font-size: 0.78rem;
    font-weight: 800;
    height: 2.35rem;
    justify-content: center;
    letter-spacing: 0.03em;
    width: 2.35rem;
}

.at-sidebar__user-meta {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
}

.at-sidebar__user-meta strong {
    color: var(--at-sidebar-text-active);
    font-size: 0.88rem;
    font-weight: 700;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.at-sidebar__role {
    color: #ddd6fe;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.at-sidebar__logout {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 0.75rem;
    color: #f8fafc;
    font-size: 0.88rem;
    font-weight: 700;
    min-height: 2.65rem;
    padding: 0.55rem 0.85rem;
}

.at-sidebar__logout:hover {
    background: rgba(255, 255, 255, 0.16);
    border-color: rgba(255, 255, 255, 0.2);
    color: #fff;
}

/* Mobile top bar */
.at-mobile-topbar {
    align-items: center;
    backdrop-filter: blur(10px);
    background: rgba(255, 255, 255, 0.92);
    border-bottom: 1px solid var(--at-border);
    display: flex;
    gap: 0.75rem;
    left: 0;
    padding: 0.7rem 0.9rem;
    position: fixed;
    right: 0;
    top: 0;
    z-index: 1030;
}

.at-sidebar-toggle {
    align-items: center;
    background: #f8fafc;
    border: 1px solid var(--at-border);
    border-radius: 0.7rem;
    color: var(--at-ink);
    display: inline-flex;
    height: 2.5rem;
    justify-content: center;
    padding: 0;
    width: 2.5rem;
}

.at-sidebar-toggle:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
    color: var(--at-primary-dark);
}

.at-mobile-topbar__brand {
    align-items: center;
    color: var(--at-ink);
    display: flex;
    font-size: 0.95rem;
    font-weight: 800;
    gap: 0.55rem;
    min-width: 0;
}

.at-mobile-topbar__icon {
    align-items: center;
    background: linear-gradient(135deg, var(--at-primary), var(--at-primary-dark));
    border-radius: 0.55rem;
    color: #fff;
    display: inline-flex;
    flex-shrink: 0;
    font-size: 0.85rem;
    height: 1.85rem;
    justify-content: center;
    width: 1.85rem;
}

.at-sidebar-overlay {
    background: var(--at-sidebar-overlay);
    inset: 0;
    opacity: 0;
    pointer-events: none;
    position: fixed;
    transition: opacity 0.2s ease;
    z-index: 1035;
}

.at-sidebar-overlay.is-open {
    opacity: 1;
    pointer-events: auto;
}

@media (max-width: 991.98px) {
    .at-sidebar {
        box-shadow: 0 20px 50px rgba(15, 23, 42, 0.35);
        transform: translateX(-100%);
        transition: transform 0.22s ease;
    }

    .at-sidebar.is-open {
        transform: translateX(0);
    }

    .admin-content {
        margin-left: 0;
        min-height: calc(100vh - 4rem);
        min-height: calc(100dvh - 4rem);
        padding-top: 4rem;
        width: 100%;
    }

    body.sidebar-open {
        overflow: hidden;
    }
}
