/*
 * Single source of truth for the admin panel color scheme.
 * Change these variables to re-skin the whole panel (light + dark).
 */
:root {
    --brand-gradient-start: #5b2a86;
    --brand-gradient-end: #c4267c;
    --brand-primary: #6f42c1;
    --brand-primary-rgb: 111, 66, 193;
    --brand-primary-hover: #5e36a6;
    --brand-accent: #ffb400;

    --sidebar-bg: #ffffff;
    --sidebar-bg-active: #450b7f;
    --sidebar-text: #514a61;
    --sidebar-text-active: #ffffff;

    --topbar-bg: #ffffff;
    --body-bg: #f4f5fa;
    --card-bg: #ffffff;
    --card-border: #ececf3;
    --text-muted: #8a8aa3;

    --success: #2dce89;
    --danger: #f5365c;
    --warning: #fb6340;
    --info: #11cdef;
}

[data-bs-theme="dark"] {
    --sidebar-bg: #15131f;
    --sidebar-bg-active: #450b7f;
    --sidebar-text: #a9a3c2;
    --sidebar-text-active: #ffffff;

    --topbar-bg: #1a1826;
    --body-bg: #100e19;
    --card-bg: #1a1826;
    --card-border: #2a2740;
    --text-muted: #8a8aa3;
}

html {
    font-size: 16px;
}

body {
    background-color: var(--body-bg);
    transition: background-color .2s ease;
    overflow-x: hidden;
}

/* ---------- Auth pages ---------- */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 16px;
    background-color: #31008c;
    background-image: url('../images/auth-hex-background.png');
    background-repeat: no-repeat;
    background-position: center center;
    background-size: cover;
    background-attachment: fixed;
    position: relative;
    overflow: hidden;
}

.auth-page::before {
    content: none;
}

.auth-card {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 480px;
    background: var(--card-bg);
    border-radius: 18px;
    padding: 42px 40px;
    box-shadow: 0 20px 60px rgba(0,0,0,.35);
}

.auth-card h1 {
    color: var(--brand-primary);
    font-weight: 700;
    font-size: 1.9rem;
    text-align: center;
}

.auth-card .auth-subtitle {
    text-align: center;
    color: var(--text-muted);
    margin-bottom: 28px;
}

.auth-input-group {
    display: flex;
    align-items: stretch;
    border: 1px solid var(--card-border);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 16px;
}

.auth-input-group .auth-input-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    background: var(--body-bg);
    color: var(--text-muted);
    border-right: 1px solid var(--card-border);
}

.auth-input-group input,
.auth-input-group select {
    border: none;
    flex: 1;
    padding: 0 14px;
    background: transparent;
    color: inherit;
}

.auth-input-group input:focus {
    outline: none;
    box-shadow: none;
}

.btn-brand {
    background: linear-gradient(90deg, var(--brand-gradient-start), var(--brand-gradient-end));
    border: none;
    color: #fff;
    font-weight: 600;
    letter-spacing: .5px;
    border-radius: 10px;
    padding: 10px 18px;
}

.btn-brand:hover {
    filter: brightness(1.08);
    color: #fff;
}

.auth-links a {
    color: var(--brand-primary);
    text-decoration: none;
}

.auth-links a:hover {
    text-decoration: underline;
}

/* ---------- Admin layout ---------- */
.admin-sidebar {
    width: 260px;
    height: 100vh;
    background: var(--sidebar-bg);
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1030;
    transition: transform .2s ease, width .2s ease;
    overflow: hidden;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,.2) transparent;
}
.admin-sidebar{display:flex;flex-direction:column;min-height:0}.admin-sidebar .sidebar-brand{flex:0 0 auto}.admin-sidebar nav{display:block!important;flex:1 1 0;min-height:0;height:0;overflow-y:auto!important;overflow-x:hidden;padding-bottom:24px;scrollbar-width:thin;scrollbar-color:rgba(255,255,255,.32) transparent;overscroll-behavior:contain;touch-action:pan-y;-webkit-overflow-scrolling:touch}
.admin-sidebar nav>.nav-link,.admin-sidebar nav>.submenu{flex:none!important;min-height:auto}.admin-sidebar .submenu.show{display:block!important;height:auto!important;overflow:visible!important}.admin-sidebar .submenu.collapsing{height:0;overflow:hidden;transition:height .22s ease}
.admin-sidebar nav::-webkit-scrollbar{width:7px}.admin-sidebar nav::-webkit-scrollbar-track{background:transparent}.admin-sidebar nav::-webkit-scrollbar-thumb{background:rgba(255,255,255,.28);border-radius:10px}.admin-sidebar nav:hover::-webkit-scrollbar-thumb{background:rgba(255,255,255,.48)}

.admin-sidebar::-webkit-scrollbar {
    width: 6px;
}

.admin-sidebar::-webkit-scrollbar-thumb {
    background-color: rgba(255,255,255,.2);
    border-radius: 3px;
}

.admin-sidebar .sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--brand-primary);
    font-weight: 700;
    padding: 18px 20px;
    border-bottom: 1px solid var(--card-border);
}
.sidebar-search-wrap{flex:0 0 auto;margin:10px;padding:8px 10px;display:flex;gap:8px;align-items:center;border:1px solid var(--card-border);background:var(--body-bg);border-radius:8px;color:var(--sidebar-text)}
.sidebar-search-wrap input{width:100%;border:0;outline:0;background:transparent;color:inherit;font-size:.78rem}.sidebar-search-wrap input::placeholder{color:var(--text-muted)}.menu-search-hidden{display:none!important}
.sidebar-close-btn{display:none;margin-left:auto;width:34px;height:34px;border:0;border-radius:8px;background:rgba(var(--brand-primary-rgb),.09);color:var(--brand-primary)}.sidebar-backdrop{display:none}
[data-bs-theme="dark"] .admin-sidebar .sidebar-brand{color:#fff;border-bottom-color:rgba(255,255,255,.08)}[data-bs-theme="dark"] .sidebar-search-wrap{border-color:rgba(255,255,255,.12);background:rgba(255,255,255,.06)}

.admin-sidebar .nav-link {
    color: var(--sidebar-text);
    padding: 10px 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-radius: 8px;
    margin: 2px 10px;
}

.admin-sidebar .nav-link:hover,
.admin-sidebar .nav-link.active {
    background: var(--sidebar-bg-active);
    color: var(--sidebar-text-active);
}

.admin-sidebar .nav-group-title {
    color: var(--text-muted);
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    padding: 14px 20px 6px;
}

.admin-sidebar .submenu {
    padding-left: 14px;
}

.admin-sidebar .menu-toggle-icon {
    margin-left: auto;
    transition: transform .2s ease;
}

.admin-sidebar .nav-link[aria-expanded="true"] .menu-toggle-icon {
    transform: rotate(90deg);
}

.admin-main {
    margin-left: 260px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left .2s ease;
}

/* Collapsed = icon-only rail on desktop, not fully hidden */
body.sidebar-collapsed .admin-sidebar {
    width: 76px;
    overflow-y: auto;
    overflow-x: hidden;
}

body.sidebar-collapsed .admin-main {
    margin-left: 76px;
}

body.sidebar-collapsed .admin-sidebar .sidebar-brand {
    justify-content: center;
    padding-left: 0;
    padding-right: 0;
}

body.sidebar-collapsed .admin-sidebar .nav-link {
    justify-content: center;
    padding-left: 0;
    padding-right: 0;
    margin-left: 8px;
    margin-right: 8px;
}

body.sidebar-collapsed .admin-sidebar .nav-link i:first-child {
    font-size: 1.15rem;
}

body.sidebar-collapsed .admin-sidebar .menu-text,
body.sidebar-collapsed .admin-sidebar .sidebar-brand .brand-text,
body.sidebar-collapsed .admin-sidebar .nav-group-title,
body.sidebar-collapsed .admin-sidebar .menu-toggle-icon,
body.sidebar-collapsed .admin-sidebar .submenu {
    display: none;
}
body.sidebar-collapsed .sidebar-search-wrap{display:none}

.admin-topbar {
    background: var(--topbar-bg);
    border-bottom: 1px solid var(--card-border);
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 1020;
}
.module-switcher-btn{display:flex;align-items:center;gap:8px;background:rgba(var(--brand-primary-rgb),.08);border:1px solid rgba(var(--brand-primary-rgb),.18);color:var(--brand-primary);font-weight:600;white-space:nowrap}.module-switcher-btn:hover,.module-switcher-btn.show{background:#450b7f;color:#fff;border-color:#450b7f}.module-switcher-menu{width:520px;max-width:calc(100vw - 32px);border:1px solid var(--card-border);border-radius:12px;box-shadow:0 16px 45px rgba(26,18,53,.18)}.module-switcher-title{padding:6px 8px 10px;font-size:.72rem;text-transform:uppercase;letter-spacing:.08em;color:var(--text-muted);font-weight:700}.module-switcher-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:5px}.module-switcher-item{display:flex;align-items:center;gap:10px;padding:10px;border-radius:8px;text-decoration:none;color:inherit;font-size:.8rem}.module-switcher-item i{width:30px;height:30px;display:grid;place-items:center;border-radius:8px;background:rgba(var(--brand-primary-rgb),.1);color:var(--brand-primary);font-size:1rem}.module-switcher-item:hover,.module-switcher-item.active{background:#450b7f;color:#fff}.module-switcher-item:hover i,.module-switcher-item.active i{background:rgba(255,255,255,.16);color:#fff}
.top-module-nav{display:flex;align-items:center;gap:8px;min-width:0}.module-launcher-btn{display:flex;align-items:center;gap:7px;background:#450b7f;color:#fff;border:1px solid #450b7f;font-weight:600;white-space:nowrap}.module-launcher-btn:hover,.module-launcher-btn.show{background:#5a159b;color:#fff;border-color:#5a159b}.top-module-links{display:flex;align-items:center;gap:2px;min-width:0}.top-module-dropdown{position:relative}.top-module-link{display:flex;align-items:center;gap:6px;padding:8px 9px;border-radius:7px;color:var(--bs-body-color);text-decoration:none;font-size:.85rem;font-weight:600;white-space:nowrap;transition:.18s ease}.top-module-link>i:first-child{color:var(--brand-primary);font-size:.95rem}.top-module-chevron{font-size:.58rem;color:var(--text-muted);transition:transform .18s}.top-module-link:hover,.top-module-link.active,.top-module-dropdown:hover>.top-module-link{background:rgba(var(--brand-primary-rgb),.09);color:#450b7f}.top-module-dropdown:hover .top-module-chevron{transform:rotate(180deg)}.top-module-dropdown:hover>.top-module-menu,.top-module-dropdown:focus-within>.top-module-menu{display:block;animation:moduleMenuIn .18s ease}.top-module-menu{width:460px;max-width:calc(100vw - 32px);margin-top:0!important;padding:0;border:1px solid var(--card-border);border-radius:13px;overflow:hidden;box-shadow:0 18px 50px rgba(30,18,60,.2);transform:translateX(-12%)}.top-module-menu-head{display:flex;align-items:center;gap:12px;padding:16px 18px;background:linear-gradient(135deg,#450b7f,#721487);color:#fff}.top-module-menu-head small{display:block;opacity:.75;font-size:.7rem}.top-module-menu-icon{width:38px;height:38px;display:grid;place-items:center;border-radius:10px;background:rgba(255,255,255,.15);font-size:1.15rem}.top-module-menu-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:3px;padding:10px}.top-module-menu-grid a{display:flex;align-items:center;gap:9px;padding:9px 10px;border-radius:7px;color:var(--bs-body-color);text-decoration:none;font-size:.76rem}.top-module-menu-grid a i{color:var(--brand-primary)}.top-module-menu-grid a:hover{background:rgba(var(--brand-primary-rgb),.09);color:#450b7f}.top-module-view-all{display:flex;justify-content:space-between;align-items:center;padding:11px 18px;background:var(--body-bg);border-top:1px solid var(--card-border);color:var(--brand-primary);text-decoration:none;font-size:.75rem;font-weight:700}@keyframes moduleMenuIn{from{opacity:0;transform:translateX(-12%) translateY(7px)}to{opacity:1;transform:translateX(-12%) translateY(0)}}
.top-module-dropdown:nth-last-child(-n+2)>.top-module-menu{left:auto!important;right:0!important;transform:none}.top-module-dropdown:nth-last-child(-n+2):hover>.top-module-menu,.top-module-dropdown:nth-last-child(-n+2):focus-within>.top-module-menu{animation:moduleMenuRightIn .18s ease}@keyframes moduleMenuRightIn{from{opacity:0;transform:translateY(7px)}to{opacity:1;transform:translateY(0)}}

.admin-content {
    flex: 1 0 auto;
    padding: 24px;
}

.admin-footer {
    flex: 0 0 100px;
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px 24px;
    background: var(--card-bg);
    border-top: 1px solid var(--card-border);
    color: var(--text-muted);
    font-size: .82rem;
    text-align: center;
}

.admin-footer p {
    margin: 0;
}

.theme-toggle-btn {
    border: 1px solid var(--card-border);
    background: var(--card-bg);
    border-radius: 50%;
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
}

@media (max-width: 991.98px) {
    .admin-sidebar {
        transform: translateX(-260px);
        width: 260px;
    }
    .admin-main {
        margin-left: 0;
    }
    /* On mobile the toggle means "show the full off-canvas sidebar", not icon-rail */
    body.sidebar-collapsed .admin-sidebar {
        transform: translateX(0);
        width: 260px;
    }
    body.sidebar-collapsed .sidebar-backdrop{display:block;position:fixed;inset:0;background:rgba(13,8,25,.48);backdrop-filter:blur(2px);z-index:1025}
    body.sidebar-collapsed .sidebar-close-btn{display:inline-grid;place-items:center}
    body.sidebar-collapsed .admin-main {
        margin-left: 0;
    }
    body.sidebar-collapsed .admin-sidebar .sidebar-brand,
    body.sidebar-collapsed .admin-sidebar .nav-link {
        justify-content: flex-start;
        padding-left: 20px;
        padding-right: 20px;
        margin-left: 10px;
        margin-right: 10px;
    }
    body.sidebar-collapsed .admin-sidebar .menu-text,
    body.sidebar-collapsed .admin-sidebar .sidebar-brand .brand-text,
    body.sidebar-collapsed .admin-sidebar .nav-group-title,
    body.sidebar-collapsed .admin-sidebar .menu-toggle-icon {
        display: inline;
    }
    body.sidebar-collapsed .admin-sidebar .submenu.show {
        display: block;
    }
}
@media(max-width:1699.98px){.admin-topbar{gap:9px;padding-left:12px;padding-right:12px}.top-module-nav{gap:4px}.top-module-links{gap:0}.top-module-link{gap:5px;padding:8px 6px;font-size:.85rem}.module-launcher-btn{padding-left:10px;padding-right:10px}}
@media(max-width:1399.98px){.topbar-user-name{display:none}.admin-topbar>.dropdown:last-child .dropdown-toggle{padding-left:6px;padding-right:6px}}
@media(max-width:1199.98px){.top-module-links{display:none}}
@media(max-width:767.98px){.module-launcher-btn span{display:none}.module-switcher-grid{grid-template-columns:1fr}.admin-topbar .breadcrumb{display:none}.module-switcher-menu{width:300px;max-height:calc(100dvh - 58px);overflow-y:auto;overflow-x:hidden;overscroll-behavior:contain;-webkit-overflow-scrolling:touch;scrollbar-gutter:stable}.module-switcher-menu::-webkit-scrollbar{width:6px}.module-switcher-menu::-webkit-scrollbar-thumb{background:rgba(69,11,127,.35);border-radius:10px}}

/* ---------- Compact buttons & controls across the whole panel ---------- */
.btn {
    padding: .3rem .75rem;
    font-size: .8125rem;
    border-radius: 6px;
}

.btn-lg {
    padding: .45rem 1rem;
    font-size: .9rem;
}

.btn-brand {
    padding: .3rem .75rem;
}

.table {
    font-size: .8125rem;
}

.form-label {
    font-size: .8125rem;
    margin-bottom: .25rem;
}

.form-control,
.form-select {
    font-size: .8125rem;
    padding-top: .375rem;
    padding-bottom: .375rem;
}

.nav-tabs .nav-link,
.nav-pills .nav-link {
    font-size: .8125rem;
    padding: .4rem .75rem;
}

.card {
    font-size: .8125rem;
}

.modal-title {
    font-size: 1rem;
}
.workspace-card{border:0;box-shadow:0 5px 22px rgba(38,30,65,.06);border-radius:12px;overflow:visible}.workspace-toolbar{background:linear-gradient(135deg,rgba(var(--brand-primary-rgb),.08),transparent);border-bottom:1px solid var(--card-border);border-radius:12px 12px 0 0}.workspace-table-wrap{overflow:visible}.workspace-table thead th{white-space:nowrap;text-transform:uppercase;letter-spacing:.035em;font-size:.7rem;color:var(--text-muted);background:var(--body-bg);padding:.8rem}.workspace-table td{padding:.75rem}.workspace-table .dropdown{position:static}.workspace-table .dropdown-menu{z-index:1080}.form-control:focus,.form-select:focus{border-color:rgba(var(--brand-primary-rgb),.65);box-shadow:0 0 0 .2rem rgba(var(--brand-primary-rgb),.12)}.field-required::after{content:' *';color:var(--danger)}
@media(max-width:767.98px){.workspace-table-wrap{overflow-x:auto;overflow-y:visible}.admin-content{padding:16px}.workspace-table{min-width:760px}}
