:root {
    --sw-primary: #2563eb;
    --sw-primary-hover: #1d4ed8;
    --sw-primary-light: #eff6ff;
    --sw-teal: #0d9488;
    --sw-teal-hover: #0f766e;
    --sw-teal-light: #f0fdfa;
    --sw-accent: #0284c7;
    --sw-bg: #f8fafc;
    --sw-card: #ffffff;
    --sw-border: #e2e8f0;
    --sw-text-main: #0f172a;
    --sw-text-muted: #64748b;
    --sw-sidebar-width: 250px;
    --sw-sidebar-bg: #ffffff;
    --sw-sidebar-border: #e2e8f0;
    --sw-sidebar-text: #475569;
    --sw-radius-sm: 6px;
    --sw-radius-md: 10px;
    --sw-radius-lg: 18px;
    --sw-shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
    --sw-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    --sw-shadow-lg: 0 12px 28px rgba(0, 0, 0, 0.08);
}

body {
    background-color: var(--sw-bg);
    color: var(--sw-text-main);
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ==========================================================================
   Auth / Login Shell (Matches Image 5)
   ========================================================================== */
.auth-shell {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    min-height: 100vh;
    padding: 0;
    background: #0f172a;
    overflow-x: hidden;
}

.login-bg-overlay {
    position: absolute;
    inset: 0;
    background-image: url('../images/background.jpg');
    background-size: cover;
    background-position: center;
    opacity: 0.28;
    z-index: 1;
}

.login-gradient-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(30, 27, 75, 0.65) 0%, rgba(37, 99, 235, 0.45) 50%, rgba(15, 23, 42, 0.9) 100%);
    z-index: 2;
}

.login-header {
    position: relative;
    width: 100%;
    z-index: 10;
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(226, 232, 240, 0.9);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
}

.theme-switcher-pill-static {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    display: inline-block;
    cursor: pointer;
    border: 1.5px solid rgba(255, 255, 255, 0.8);
    transition: transform 0.15s ease;
}

.theme-switcher-pill-static:hover,
.theme-switcher-pill-static.active {
    transform: scale(1.2);
    box-shadow: 0 0 0 2px #3b82f6;
}

.login-card-container {
    position: relative;
    z-index: 10;
    width: 100%;
    max-width: 480px;
    padding: 2rem 1rem;
    margin: auto 0;
}

.auth-panel {
    background: #ffffff;
    border-radius: var(--sw-radius-lg);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.8);
    overflow: hidden;
}

.admin-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: #ede9fe;
    color: #6d28d9;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.3rem 0.85rem;
    border-radius: 20px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.custom-input-group {
    position: relative;
    display: flex;
    align-items: center;
}

.custom-input-group .form-control {
    height: 48px;
    padding-right: 42px;
    border-radius: var(--sw-radius-sm);
    border: 1px solid #cbd5e1;
    font-size: 0.925rem;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.custom-input-group .form-control:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.input-icon-text,
.input-icon-btn {
    position: absolute;
    right: 12px;
    background: transparent;
    border: none;
    color: #94a3b8;
    font-size: 1.15rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.input-icon-btn:hover {
    color: #475569;
}

.btn-control-panel {
    height: 48px;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    border: none;
    border-radius: var(--sw-radius-sm);
    color: #ffffff;
    font-weight: 600;
    font-size: 0.95rem;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
    transition: all 0.2s ease;
}

.btn-control-panel:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.35);
    transform: translateY(-1px);
    color: #ffffff;
}

.btn-google-sso {
    height: 46px;
    background: #ffffff;
    border: 1px solid #dadce0;
    border-radius: var(--sw-radius-sm);
    color: #3c4043;
    font-size: 0.92rem;
    font-weight: 500;
    transition: all 0.2s ease;
    text-decoration: none;
}

.btn-google-sso:hover {
    background: #f8f9fa;
    border-color: #c2c4c7;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
    color: #202124;
}

.warning-box {
    background: #fffbeb;
    border: 1px solid #fef3c7;
    border-left: 4px solid #f59e0b;
    border-radius: var(--sw-radius-sm);
    padding: 0.75rem 0.9rem;
    font-size: 0.8rem;
    color: #92400e;
    line-height: 1.4;
}

.login-footer {
    position: relative;
    width: 100%;
    z-index: 10;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(8px);
    border-top: 1px solid rgba(226, 232, 240, 0.8);
    color: #64748b;
    font-size: 0.825rem;
    text-align: center;
}

/* ==========================================================================
   Admin / Staff Dashboard & Masters Layout (Matches Images 1-4)
   ========================================================================== */
.admin-layout {
    display: flex;
    min-height: 100vh;
}

.admin-sidebar {
    width: var(--sw-sidebar-width);
    background-color: var(--sw-sidebar-bg);
    border-right: 1px solid var(--sw-sidebar-border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 1030;
    transition: transform 0.25s ease-in-out;
}

.admin-sidebar-header {
    padding: 1.15rem 1.25rem;
    border-bottom: 1px solid var(--sw-sidebar-border);
    background: #ffffff;
}

.sidebar-search-container {
    padding: 0.85rem 1rem 0.25rem;
}

.sidebar-search-input {
    border-radius: 20px;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    font-size: 0.825rem;
    padding: 0.45rem 0.85rem 0.45rem 2rem;
}

.sidebar-search-icon {
    position: absolute;
    left: 1.75rem;
    top: 1.4rem;
    color: #94a3b8;
    font-size: 0.85rem;
}

.admin-sidebar-nav {
    padding: 0.5rem 0.85rem;
    flex: 1;
    overflow-y: auto;
}

/* Sidebar Actions Bar */
.sidebar-actions-bar {
    border-bottom: 1px dashed var(--sw-sidebar-border);
    padding-bottom: 0.35rem;
}

.sidebar-expand-toggle-btn {
    cursor: pointer;
    transition: color 0.15s ease;
}

.sidebar-expand-toggle-btn:hover {
    color: var(--sw-teal) !important;
}

.sidebar-menu-toggle-btn {
    cursor: pointer;
    background: #f8fafc;
    border-color: #e2e8f0 !important;
    transition: all 0.15s ease;
}

.sidebar-menu-toggle-btn:hover {
    background: #f1f5f9;
    color: var(--sw-teal) !important;
    border-color: var(--sw-teal) !important;
}

/* Sidebar Accordion Menu Groups */
.sidebar-menu-group {
    margin-bottom: 0.25rem;
}

.sidebar-category-header {
    font-size: 0.76rem;
    font-weight: 700;
    color: #475569;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.55rem 0.65rem;
    margin-top: 0.35rem;
    border-radius: var(--sw-radius-sm);
    cursor: pointer;
    user-select: none;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.sidebar-category-header:hover {
    background-color: #f1f5f9;
    color: #0f172a;
}

.sidebar-category-header .category-name {
    letter-spacing: 0.2px;
}

.sidebar-category-chevron {
    font-size: 0.72rem;
    color: #94a3b8;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), color 0.2s ease;
}

.sidebar-menu-group.open .sidebar-category-chevron {
    transform: rotate(180deg);
    color: var(--sw-teal);
}

.sidebar-menu-group.open .sidebar-category-header {
    color: #0f172a;
}

.sidebar-submenu-list {
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    transition: max-height 0.32s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.25s ease;
}

.sidebar-menu-group.open .sidebar-submenu-list {
    max-height: 800px;
    opacity: 1;
}

.admin-nav-pill {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.55rem 0.85rem;
    color: #475569;
    border-radius: var(--sw-radius-sm);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.88rem;
    transition: all 0.15s ease;
    margin-bottom: 0.15rem;
}

.admin-nav-pill:hover {
    background-color: #f1f5f9;
    color: #0f172a;
}

.admin-nav-pill.active {
    background: var(--sw-teal);
    color: #ffffff;
    font-weight: 600;
}

.admin-nav-pill.active i {
    color: #ffffff;
}

.admin-sidebar-footer {
    padding: 1rem;
    border-top: 1px solid var(--sw-sidebar-border);
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.admin-main {
    flex: 1;
    margin-left: var(--sw-sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background: #f8fafc;
}

.admin-topbar {
    height: 64px;
    background-color: #ffffff;
    border-bottom: 1px solid var(--sw-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 1020;
}

.admin-content {
    flex: 1;
    padding: 1.75rem 2rem;
}

/* Tab Navigation (Matches Images 1-4) */
.subnav-tabs {
    display: flex;
    gap: 0.5rem;
    border-bottom: 1px solid var(--sw-border);
    margin-bottom: 1.25rem;
}

.subnav-tab-item {
    padding: 0.65rem 1.15rem;
    font-size: 0.88rem;
    font-weight: 600;
    color: #64748b;
    border-radius: var(--sw-radius-sm) var(--sw-radius-sm) 0 0;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    border-bottom: 2px solid transparent;
}

.subnav-tab-item.active {
    color: #2563eb;
    border-bottom-color: #2563eb;
    background: #ffffff;
}

.subnav-toggle-group {
    display: inline-flex;
    background: #f1f5f9;
    padding: 4px;
    border-radius: var(--sw-radius-sm);
    gap: 4px;
}

.subnav-toggle-btn {
    padding: 0.4rem 1.1rem;
    font-size: 0.84rem;
    font-weight: 600;
    border-radius: 4px;
    text-decoration: none;
    color: #475569;
    transition: all 0.15s ease;
}

.subnav-toggle-btn.active {
    background: #2563eb;
    color: #ffffff;
    box-shadow: var(--sw-shadow-sm);
}

/* Stat Cards (Matches Images 1-4) */
.kpi-metric-card {
    background: #ffffff;
    border: 1px solid var(--sw-border);
    border-radius: var(--sw-radius-md);
    padding: 1.1rem 1.25rem;
    box-shadow: var(--sw-shadow-sm);
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.kpi-metric-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--sw-shadow);
}

.kpi-icon-pill {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}

/* Master Data Table */
.master-table-card {
    background: #ffffff;
    border: 1px solid var(--sw-border);
    border-radius: var(--sw-radius-md);
    box-shadow: var(--sw-shadow-sm);
    overflow: hidden;
}

.master-table th {
    background-color: #f8fafc;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #64748b;
    border-bottom: 1px solid #e2e8f0;
    padding: 0.85rem 1rem;
}

.master-table td {
    padding: 0.85rem 1rem;
    font-size: 0.88rem;
    vertical-align: middle;
    border-bottom: 1px solid #f1f5f9;
}

.master-table tr:hover td {
    background-color: #f8fafc;
}

.badge-status-active {
    background-color: #dcfce7;
    color: #15803d;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 0.25rem 0.6rem;
    border-radius: 20px;
}

.btn-action-icon {
    width: 32px;
    height: 32px;
    border-radius: var(--sw-radius-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    font-size: 0.88rem;
    transition: all 0.15s ease;
}

@media (max-width: 991.98px) {
    .admin-sidebar {
        transform: translateX(-100%);
    }
    .admin-sidebar.show {
        transform: translateX(0);
    }
    .admin-main {
        margin-left: 0;
    }
}

/* ==========================================================================
   Desktop Collapsed Sidebar (Triggered by Hamburger Menu)
   ========================================================================== */
@media (min-width: 992px) {
    .admin-sidebar {
        transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1), transform 0.25s ease-in-out;
    }

    .admin-main {
        transition: margin-left 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    }

    body.sidebar-collapsed .admin-sidebar,
    html.sidebar-preload-collapsed body:not(.sidebar-expanded) .admin-sidebar {
        width: 68px;
    }

    body.sidebar-collapsed .admin-main,
    html.sidebar-preload-collapsed body:not(.sidebar-expanded) .admin-main {
        margin-left: 68px;
    }

    /* Hide text labels, brand text, search box, badges, and category labels in mini mode */
    body.sidebar-collapsed .brand-text-container,
    body.sidebar-collapsed .brand-divider,
    body.sidebar-collapsed .brand-vendor-container,
    body.sidebar-collapsed .brand-crest,
    body.sidebar-collapsed .sidebar-search-container,
    body.sidebar-collapsed .sidebar-actions-bar,
    body.sidebar-collapsed .sidebar-category-header .category-name,
    body.sidebar-collapsed .sidebar-category-chevron,
    body.sidebar-collapsed .admin-nav-pill span,
    body.sidebar-collapsed .admin-nav-pill .badge,
    body.sidebar-collapsed .admin-sidebar-footer .leading-tight {
        display: none !important;
    }

    body.sidebar-collapsed .admin-sidebar-header {
        padding: 0.65rem 0.25rem;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 0.35rem;
    }

    body.sidebar-collapsed .admin-sidebar-header .sidebar-menu-toggle-btn {
        margin: 0 !important;
    }

    body.sidebar-collapsed .brand-logo-container {
        justify-content: center;
        gap: 0 !important;
    }

    body.sidebar-collapsed .brand-hanger-icon {
        width: 30px;
        height: 30px;
    }

    body.sidebar-collapsed .admin-sidebar-nav {
        padding: 0.5rem 0.35rem;
    }

    body.sidebar-collapsed .admin-nav-pill {
        justify-content: center;
        padding: 0.65rem 0;
        margin: 0.25rem 0;
        border-radius: 8px;
        border-left: none !important;
    }

    body.sidebar-collapsed .admin-nav-pill i {
        font-size: 1.2rem;
        margin: 0;
    }

    body.sidebar-collapsed .sidebar-category-header {
        justify-content: center;
        padding: 0.4rem 0;
        margin: 0.5rem 0.15rem 0.25rem;
        border-top: 1px solid var(--sw-sidebar-border);
    }

    body.sidebar-collapsed .sidebar-category-header > span > i {
        font-size: 1.05rem;
    }

    body.sidebar-collapsed .admin-sidebar-footer {
        justify-content: center;
        padding: 0.75rem 0.25rem;
    }

    /* In mini mode, keep all submenus open so icons are visible and clickable */
    body.sidebar-collapsed .sidebar-submenu-list {
        max-height: none !important;
        opacity: 1 !important;
        display: block !important;
        padding-left: 0 !important;
    }
}

/* =========================================================================
   Quick Actions Topbar Dropdown & Interactive Modals
   ========================================================================= */
.sw-quick-actions-btn {
    background-color: #0d9488 !important;
    color: #ffffff !important;
    border: 2px solid transparent !important;
    border-radius: 9999px !important;
    padding: 0.35rem 0.95rem !important;
    font-size: 0.85rem !important;
    font-weight: 600 !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
    transition: all 0.2s ease-in-out !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.sw-quick-actions-btn:hover {
    background-color: #0f766e !important;
    color: #ffffff !important;
}

.sw-quick-actions-btn:focus,
.sw-quick-actions-btn.show,
.sw-quick-actions-btn[aria-expanded="true"] {
    background-color: #0d9488 !important;
    color: #ffffff !important;
    outline: none !important;
    border-color: #0284c7 !important;
    box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.28) !important;
}

/* Hide default bootstrap dropdown caret */
.sw-quick-actions-btn::after {
    display: none !important;
}

.sw-quick-actions-menu {
    border: 1px solid rgba(226, 232, 240, 0.95) !important;
    border-radius: 14px !important;
    padding: 6px !important;
    min-width: 220px !important;
    background: #ffffff !important;
    margin-top: 8px !important;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.12), 0 8px 10px -6px rgba(0, 0, 0, 0.05) !important;
    animation: swQuickActionsFadeIn 0.15s ease-out;
    z-index: 1060 !important;
}

@keyframes swQuickActionsFadeIn {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.sw-quick-actions-menu .dropdown-item.sw-qa-item {
    border-radius: 8px !important;
    padding: 8px 14px !important;
    font-size: 0.88rem !important;
    font-weight: 500 !important;
    color: #1e293b !important;
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    transition: background-color 0.15s ease, color 0.15s ease;
    cursor: pointer;
    text-decoration: none !important;
}

.sw-quick-actions-menu .dropdown-item.sw-qa-item:hover {
    background-color: #f1f5f9 !important;
    color: #0f172a !important;
}

.sw-quick-actions-menu .dropdown-item.sw-qa-item:active,
.sw-quick-actions-menu .dropdown-item.sw-qa-item:focus {
    background-color: #e2e8f0 !important;
    color: #0f172a !important;
}

.sw-quick-actions-menu .dropdown-item.sw-qa-item .sw-qa-icon {
    font-size: 1.25rem !important;
    width: 22px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0 !important;
    transition: transform 0.15s ease;
}

.sw-quick-actions-menu .dropdown-item.sw-qa-item:hover .sw-qa-icon {
    transform: scale(1.1);
}

/* User Profile Dropdown Menu Styling */
.sw-user-dropdown .dropdown-toggle-no-caret::after {
    display: none !important;
}

.sw-user-dropdown .dropdown-menu {
    border: 1px solid #e2e8f0;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.08) !important;
}

.sw-user-dropdown .dropdown-item {
    transition: background-color 0.15s ease, color 0.15s ease;
    border-radius: 6px;
    margin: 1px 6px;
    width: calc(100% - 12px);
}

.sw-user-dropdown .dropdown-item:hover {
    background-color: #f1f5f9;
}


