@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600&display=swap');

* {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* =============================================================================
   THEME TEXT COLOR CSS VARIABLES
   Activated by data-bs-theme attribute toggled by color mode callback.
   ============================================================================= */

[data-bs-theme="dark"] {
    --text-primary: #c1c2c5;
    --text-secondary: #909296;
}

[data-bs-theme="light"] {
    --text-primary: #1a1a1a;
    --text-secondary: #666666;
}

/* =============================================================================
   BRAND THEME CSS VARIABLES
   Activated by data-brand-theme attribute on root container.
   ============================================================================= */

:root, [data-brand-theme="purple"] {
    --brand-primary: #9C00BF;
    --brand-primary-hover: #8400a2;
    --brand-primary-active: #75008f;
    --brand-primary-rgb: 156, 0, 191;
    --brand-text-on-primary: #ffffff;
}

[data-brand-theme="archblue"] {
    --brand-primary: #244BD8;
    --brand-primary-hover: #1E3EB8;
    --brand-primary-active: #1b36a2;
    --brand-primary-rgb: 36, 75, 216;
    --brand-text-on-primary: #ffffff;
}

/* =============================================================================
   BRAND UTILITY CLASSES
   ============================================================================= */

.brand-color { color: var(--brand-primary) !important; }
.brand-bg { background-color: var(--brand-primary) !important; }
.brand-border { border-color: var(--brand-primary) !important; }
.brand-underline {
    width: 100px; margin: 1rem auto 1.5rem auto;
    border: none; border-top: 3px solid var(--brand-primary); border-radius: 2px;
}
.brand-icon svg { color: var(--brand-primary) !important; }

/* =============================================================================
   BRAND BUTTONS
   ============================================================================= */

.brand-btn {
    background-color: var(--brand-primary) !important;
    border-color: var(--brand-primary) !important;
    color: var(--brand-text-on-primary, #ffffff) !important;
    font-weight: 500;
    transition: all 0.15s ease-in-out;
}

.brand-btn:hover {
    background-color: var(--brand-primary-hover) !important;
    border-color: var(--brand-primary-hover) !important;
    filter: brightness(0.9);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(var(--brand-primary-rgb), 0.3);
}

.brand-btn:active {
    background-color: var(--brand-primary-active) !important;
    border-color: var(--brand-primary-active) !important;
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(var(--brand-primary-rgb), 0.2);
}

.brand-btn-outline {
    background-color: transparent !important;
    border-color: var(--brand-primary) !important;
    color: var(--brand-primary) !important;
    font-weight: 500;
    transition: all 0.15s ease-in-out;
}

.brand-btn-outline:hover {
    background-color: var(--brand-primary) !important;
    border-color: var(--brand-primary) !important;
    color: #ffffff !important;
    filter: brightness(0.9);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(var(--brand-primary-rgb), 0.3);
}

.brand-btn-outline:active {
    background-color: var(--brand-primary-active) !important;
    border-color: var(--brand-primary-active) !important;
    color: #ffffff !important;
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(var(--brand-primary-rgb), 0.2);
}

/* Danger outline button (destructive actions) */
.brand-btn-danger-outline {
    background-color: transparent !important;
    border: 1px solid #fa5252 !important;
    color: #fa5252 !important;
    font-weight: 500;
    transition: all 0.15s ease-in-out;
}

.brand-btn-danger-outline:hover {
    background-color: #fa5252 !important;
    border-color: #fa5252 !important;
    color: #ffffff !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(250, 82, 82, 0.3);
}

.brand-btn-danger-outline:active {
    background-color: #e03131 !important;
    border-color: #e03131 !important;
    color: #ffffff !important;
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(250, 82, 82, 0.2);
}

/* =============================================================================
   BRAND LINKS
   ============================================================================= */

.brand-link {
    color: var(--brand-primary) !important;
    text-decoration: none;
}

.brand-link:hover {
    color: var(--brand-primary-hover) !important;
    text-decoration: underline;
}

/* Brand-colored border top (for footer hr dividers) */
.brand-border-top {
    border: none !important;
    border-top: 2px solid var(--brand-primary) !important;
}

/* =============================================================================
   MODERN TABLE SYSTEM
   ============================================================================= */

.table-modern-container {
    border-radius: 12px;
    overflow: auto;
}

.table-modern {
    margin-bottom: 0;
    font-family: 'Inter', 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 0.875rem;
}

/* Brand-colored sticky header */
.table-modern thead th {
    background-color: var(--brand-primary) !important;
    color: var(--brand-text-on-primary, #ffffff) !important;
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding: 0.875rem 1rem;
    border: none !important;
    white-space: nowrap;
    position: sticky !important;
    top: 0 !important;
    z-index: 10 !important;
}

.table-modern thead th:first-child {
    border-top-left-radius: 12px;
}

.table-modern thead th:last-child {
    border-top-right-radius: 12px;
}

/* Body cells */
.table-modern tbody td {
    padding: 0.75rem 1rem;
    vertical-align: middle;
    border-color: rgba(0, 0, 0, 0.05);
    transition: background-color 0.15s ease;
}

.table-modern.table-dark tbody td {
    border-color: rgba(255, 255, 255, 0.05);
}

/* Brand-tinted hover */
.table-modern tbody tr:hover td {
    background-color: rgba(var(--brand-primary-rgb), 0.08) !important;
}

/* Striped rows: Light mode */
.table-modern.table-striped tbody tr:nth-of-type(odd) td {
    background-color: rgba(0, 0, 0, 0.04);
}

.table-modern.table-striped tbody tr:nth-of-type(even) td {
    background-color: #ffffff;
}

.table-modern.table-striped tbody tr:nth-of-type(odd):hover td {
    background-color: rgba(var(--brand-primary-rgb), 0.12) !important;
}

.table-modern.table-striped tbody tr:nth-of-type(even):hover td {
    background-color: rgba(var(--brand-primary-rgb), 0.08) !important;
}

/* Striped rows: Dark mode */
.table-modern.table-dark.table-striped tbody tr:nth-of-type(odd),
.table-modern.table-dark.table-striped tbody tr:nth-of-type(odd) td,
.table-dark.table-striped tbody tr:nth-of-type(odd),
.table-dark.table-striped tbody tr:nth-of-type(odd) td {
    background-color: #2e2e2e !important;
    --bs-table-striped-bg: #2e2e2e !important;
}

.table-modern.table-dark.table-striped tbody tr:nth-of-type(even),
.table-modern.table-dark.table-striped tbody tr:nth-of-type(even) td,
.table-dark.table-striped tbody tr:nth-of-type(even),
.table-dark.table-striped tbody tr:nth-of-type(even) td {
    background-color: #252525 !important;
    --bs-table-bg: #252525 !important;
}

.table-modern.table-dark.table-striped tbody tr:nth-of-type(odd):hover td {
    background-color: rgba(var(--brand-primary-rgb), 0.15) !important;
}

.table-modern.table-dark.table-striped tbody tr:nth-of-type(even):hover td {
    background-color: rgba(var(--brand-primary-rgb), 0.12) !important;
}

/* Last row bottom rounding */
.table-modern tbody tr:last-child td:first-child {
    border-bottom-left-radius: 8px;
}

.table-modern tbody tr:last-child td:last-child {
    border-bottom-right-radius: 8px;
}

/* --- Brand Theme Table Headers (standalone, not inside .table-modern) --- */
thead.table-brand,
thead.table-brand tr {
    background-color: var(--brand-primary) !important;
}

thead.table-brand th {
    background-color: var(--brand-primary) !important;
    color: var(--brand-text-on-primary, #ffffff) !important;
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding: 0.875rem 1rem;
    border: none !important;
    white-space: nowrap;
    /* Sticky header support */
    position: sticky;
    top: 0;
    z-index: 1;
}

/* =============================================================================
   TABLE SCROLLBAR STYLING
   ============================================================================= */

/* Light mode scrollbar */
.table-scroll-container {
    scrollbar-width: thin;
    scrollbar-color: var(--brand-primary) #e9ecef;
}

.table-scroll-container::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

.table-scroll-container::-webkit-scrollbar-track {
    background: #e9ecef;
}

.table-scroll-container::-webkit-scrollbar-thumb {
    background: var(--brand-primary);
    border-radius: 5px;
    border: 2px solid #e9ecef;
}

.table-scroll-container::-webkit-scrollbar-thumb:hover {
    background: var(--brand-primary-hover);
}

.table-scroll-container::-webkit-scrollbar-corner {
    background: #e9ecef;
}

/* Dark mode scrollbar */
[data-bs-theme="dark"] .table-scroll-container,
.table-scroll-container.dark-mode {
    scrollbar-color: var(--brand-primary) #252525;
}

[data-bs-theme="dark"] .table-scroll-container::-webkit-scrollbar-track,
.table-scroll-container.dark-mode::-webkit-scrollbar-track {
    background: #252525;
}

[data-bs-theme="dark"] .table-scroll-container::-webkit-scrollbar-thumb,
.table-scroll-container.dark-mode::-webkit-scrollbar-thumb {
    background: var(--brand-primary);
    border: 2px solid #252525;
}

[data-bs-theme="dark"] .table-scroll-container::-webkit-scrollbar-corner,
.table-scroll-container.dark-mode::-webkit-scrollbar-corner {
    background: #252525;
}

/* =============================================================================
   GLOBAL DEFAULTS
   ============================================================================= */

.mantine-Switch-root {
    cursor: pointer !important;
}

.table-purple th,
.table-purple thead th,
.table.table-purple thead th {
    background-color: var(--brand-primary, rgba(156, 0, 191, 1)) !important;
    color: var(--brand-text-on-primary, white) !important;
}

/* =============================================================================
   NAVIGATION - Theme-Responsive Text Colors
   Nav links and dropdowns respond to data-bs-theme toggle.
   ============================================================================= */

[data-bs-theme="dark"] .navbar-nav .nav-link {
    color: rgba(255, 255, 255, 0.85) !important;
}
[data-bs-theme="dark"] .navbar-nav .nav-link:hover {
    color: #ffffff !important;
}
[data-bs-theme="light"] .navbar-nav .nav-link {
    color: rgba(0, 0, 0, 0.7) !important;
}
[data-bs-theme="light"] .navbar-nav .nav-link:hover {
    color: #000000 !important;
}
[data-bs-theme="dark"] .dropdown-menu {
    background-color: #2b2b2b;
    border-color: rgba(255, 255, 255, 0.1);
}
[data-bs-theme="dark"] .dropdown-item {
    color: rgba(255, 255, 255, 0.85);
}
[data-bs-theme="dark"] .dropdown-item:hover,
[data-bs-theme="dark"] .dropdown-item:focus {
    color: #ffffff;
    background-color: rgba(255, 255, 255, 0.1);
}
[data-bs-theme="light"] .dropdown-menu {
    background-color: #ffffff;
    border-color: rgba(0, 0, 0, 0.1);
}
[data-bs-theme="light"] .dropdown-item {
    color: rgba(0, 0, 0, 0.7);
}
[data-bs-theme="light"] .dropdown-item:hover,
[data-bs-theme="light"] .dropdown-item:focus {
    color: #000000;
    background-color: rgba(0, 0, 0, 0.05);
}

/* =============================================================================
   NAVIGATION - Active State & Hover Effects
   ============================================================================= */

/* Active nav link - prominent brand highlight */
.nav-link.active {
    background-color: rgba(var(--brand-primary-rgb, 156, 0, 191), 0.25) !important;
    color: #ffffff !important;
    border-radius: 6px;
    font-weight: 600 !important;
    position: relative;
}

/* Underline effect for active nav link - only on xl screens (matches navbar expand="xl" breakpoint) */
@media (min-width: 1200px) {
    .nav-link.active::after {
        content: '';
        position: absolute;
        bottom: 2px;
        left: 50%;
        transform: translateX(-50%);
        width: 60%;
        height: 2px;
        background-color: var(--brand-primary, #9C00BF);
        border-radius: 1px;
    }
}

/* Hover effect for nav links */
.nav-link:hover:not(.active) {
    background-color: rgba(var(--brand-primary-rgb, 156, 0, 191), 0.1) !important;
    border-radius: 6px;
}

/* Logout button styling — base state responds to theme via data-bs-theme */
#signout-button {
    transition: all 0.2s ease;
}

#signout-button:hover {
    cursor: pointer;
    opacity: 0.85;
}

[data-bs-theme="dark"] #signout-button {
    border: 1px solid white !important;
    color: white !important;
}

[data-bs-theme="dark"] #signout-button:hover {
    background-color: rgba(255, 255, 255, 0.15) !important;
    border-color: white !important;
    color: white !important;
}

[data-bs-theme="light"] #signout-button {
    border: 1px solid #333 !important;
    color: #333 !important;
}

[data-bs-theme="light"] #signout-button:hover {
    background-color: rgba(0, 0, 0, 0.08) !important;
    border-color: #333 !important;
    color: #333 !important;
}

/* =============================================================================
   SIDEBAR NAVIGATION
   ============================================================================= */

/* Base Sidebar Container */
.sidebar-container {
    position: fixed;
    top: 0;
    height: 100vh;
    background-color: #25262b; /* DARK_BG_CARD */
    display: flex;
    flex-direction: column;
    z-index: 1050;
    transition: width 0.3s ease;
    overflow: hidden;
}

/* Hidden sidebar for top/bottom navbar compatibility */
.sidebar-hidden {
    display: none !important;
    visibility: hidden !important;
    width: 0 !important;
    height: 0 !important;
    position: absolute !important;
    pointer-events: none !important;
}

/* Position-specific styles */
.sidebar-container.left {
    left: 0;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-container.right {
    right: 0;
    border-left: 1px solid rgba(255, 255, 255, 0.1);
}

/* Expanded/Collapsed states */
.sidebar-container.expanded {
    width: 220px;
}

.sidebar-container.collapsed {
    width: 60px;
    overflow: visible;
}

.sidebar-container.collapsed .sidebar-nav {
    overflow: visible;
}

/* --- Sidebar Brand --- */
.sidebar-brand {
    padding: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    min-height: 60px;
}

.sidebar-brand-img {
    transition: opacity 0.2s ease, width 0.2s ease;
}

.sidebar-container.collapsed .sidebar-brand-img {
    opacity: 0;
    width: 0;
    display: none;
}

/* Logo/icon shown when sidebar is collapsed */
.sidebar-brand-collapsed-img {
    display: none;
    transition: opacity 0.2s ease;
}

.sidebar-container.collapsed .sidebar-brand-collapsed-img {
    display: block;
}

/* --- Sidebar User Info --- */
.sidebar-user-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-container.collapsed .sidebar-user-info {
    padding: 12px 8px;
    align-items: center;
}

.sidebar-container.collapsed .sidebar-user-info .mantine-Badge-root {
    padding: 4px;
    min-width: auto;
}

.sidebar-container.collapsed .sidebar-user-info .mantine-Badge-label {
    display: none;
}

/* --- Sidebar Toggle Button --- */
.sidebar-toggle-btn {
    width: 100%;
    padding: 12px;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.85);
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    transition: background-color 0.2s ease;
}

.sidebar-toggle-btn:hover {
    background-color: rgba(255, 255, 255, 0.06);
}

/* --- Sidebar Navigation --- */
.sidebar-nav {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 10px 0;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
}

/* Sidebar links (dark sidebar default) */
.sidebar-link {
    display: flex !important;
    align-items: center;
    gap: 9px;
    padding: 6px 14px !important;
    color: rgba(255, 255, 255, 0.85) !important;
    text-decoration: none !important;
    transition: all 0.2s ease;
    white-space: nowrap;
    border-radius: 0 !important;
}

.sidebar-link:hover {
    background-color: rgba(var(--brand-primary-rgb, 156, 0, 191), 0.2) !important;
    color: #ffffff !important;
    text-decoration: none !important;
}

.sidebar-link.active {
    background-color: rgba(var(--brand-primary-rgb, 156, 0, 191), 0.4) !important;
    color: #ffffff !important;
    font-weight: 600;
}

/* Remove underline from sidebar link container */
.sidebar-link.active::after {
    display: none !important;
}

/* Add underline to sidebar label text only */
.sidebar-link.active .sidebar-label {
    position: relative;
}

.sidebar-link.active .sidebar-label::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: var(--brand-primary, #9C00BF);
    border-radius: 1px;
}

/* Hide label underline in collapsed mode (label becomes tooltip) */
.sidebar-container.collapsed .sidebar-link.active .sidebar-label::after {
    display: none;
}

/* Active state border */
.sidebar-container.left .sidebar-link.active {
    border-left: 3px solid var(--brand-primary, #9C00BF);
}

.sidebar-container.right .sidebar-link.active {
    border-right: 3px solid var(--brand-primary, #9C00BF);
}

.sidebar-icon {
    font-size: 1.1rem;
    flex-shrink: 0;
    width: 22px;
    text-align: center;
}

.sidebar-label {
    font-size: 0.9rem;
    transition: opacity 0.3s ease, width 0.3s ease;
}

.sidebar-container.collapsed .sidebar-label {
    opacity: 0;
    width: 0;
    overflow: hidden;
}

/* Tooltip: reuse .sidebar-label as a floating tooltip when collapsed */
.sidebar-container.collapsed .sidebar-link {
    padding: 8px;
    justify-content: center;
    position: relative;
    overflow: visible;
}

.sidebar-container.collapsed .sidebar-link:hover .sidebar-label {
    opacity: 1;
    width: auto;
    overflow: visible;
    position: absolute;
    left: calc(100% + 8px);
    top: 50%;
    transform: translateY(-50%);
    background: #1a1b1e;
    color: #fff;
    padding: 4px 12px;
    border-radius: 6px;
    white-space: nowrap;
    font-size: 0.85rem;
    z-index: 10000;
    pointer-events: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    transition: opacity 0.15s ease;
}

/* Light mode tooltip */
.sidebar-container.sidebar-light.collapsed .sidebar-link:hover .sidebar-label {
    background: #212529;
    color: #fff;
}

/* Right sidebar: tooltip appears on the left */
.sidebar-container.collapsed.right .sidebar-link:hover .sidebar-label {
    left: auto;
    right: calc(100% + 8px);
}

/* --- Sidebar Logout --- */
.sidebar-logout {
    margin-top: auto;
    flex-shrink: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding: 15px;
    padding-bottom: 25px;
}

.sidebar-logout-link {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    cursor: pointer;
}

.sidebar-logout-link:hover {
    background-color: rgba(255, 100, 100, 0.2) !important;
}

/* --- Content Wrapper for Sidebar Layouts --- */
.content-with-sidebar-left {
    margin-left: 220px;
    width: calc(100vw - 220px);
    max-width: calc(100vw - 220px);
    transition: margin-left 0.3s ease, width 0.3s ease;
    overflow-x: hidden;
}

.content-with-sidebar-left.sidebar-collapsed {
    margin-left: 60px;
    width: calc(100vw - 60px);
    max-width: calc(100vw - 60px);
}

.content-with-sidebar-right {
    margin-right: 220px;
    width: calc(100vw - 220px);
    max-width: calc(100vw - 220px);
    transition: margin-right 0.3s ease, width 0.3s ease;
    overflow-x: hidden;
}

.content-with-sidebar-right.sidebar-collapsed {
    margin-right: 60px;
    width: calc(100vw - 60px);
    max-width: calc(100vw - 60px);
}

/* --- Layout Flexbox for Sidebar --- */
.layout-left,
.layout-right {
    display: flex;
    flex-direction: row;
}

.layout-right {
    flex-direction: row-reverse;
}

/* --- Dark Mode Sidebar --- */
.sidebar-container.sidebar-dark {
    background: linear-gradient(180deg,
        #25262b 0%,
        rgba(var(--brand-primary-rgb, 156, 0, 191), 0.04) 50%,
        #25262b 100%),
        #25262b;
    border-color: rgba(255, 255, 255, 0.1);
}

.sidebar-container.sidebar-dark .sidebar-brand,
.sidebar-container.sidebar-dark .sidebar-user-info,
.sidebar-container.sidebar-dark .sidebar-toggle-btn,
.sidebar-container.sidebar-dark .sidebar-logout {
    border-color: rgba(255, 255, 255, 0.08);
}

.sidebar-container.sidebar-dark .sidebar-toggle-btn {
    color: rgba(255, 255, 255, 0.85);
}

.sidebar-container.sidebar-dark .sidebar-link {
    color: rgba(255, 255, 255, 0.85) !important;
}

.sidebar-container.sidebar-dark .sidebar-link:hover {
    background-color: rgba(var(--brand-primary-rgb, 156, 0, 191), 0.2) !important;
    color: #ffffff !important;
}

.sidebar-container.sidebar-dark .sidebar-link.active {
    background-color: rgba(var(--brand-primary-rgb, 156, 0, 191), 0.4) !important;
    color: #ffffff !important;
}

/* --- Light Mode Sidebar --- */
.sidebar-container.sidebar-light {
    background: linear-gradient(180deg,
        #e2e6ea 0%,
        rgba(var(--brand-primary-rgb, 156, 0, 191), 0.04) 50%,
        #e2e6ea 100%),
        #e2e6ea;
    border-color: rgba(0, 0, 0, 0.1);
}

.sidebar-container.sidebar-light .sidebar-brand,
.sidebar-container.sidebar-light .sidebar-user-info,
.sidebar-container.sidebar-light .sidebar-toggle-btn,
.sidebar-container.sidebar-light .sidebar-logout {
    border-color: rgba(0, 0, 0, 0.1);
}

.sidebar-container.sidebar-light.left {
    border-right-color: rgba(0, 0, 0, 0.1);
}

.sidebar-container.sidebar-light.right {
    border-left-color: rgba(0, 0, 0, 0.1);
}

.sidebar-container.sidebar-light .sidebar-toggle-btn {
    color: #212529;
}

.sidebar-container.sidebar-light .sidebar-toggle-btn:hover {
    background-color: rgba(0, 0, 0, 0.08);
}

.sidebar-container.sidebar-light .sidebar-link {
    color: #212529 !important;
}

.sidebar-container.sidebar-light .sidebar-link:hover {
    background-color: rgba(0, 0, 0, 0.08) !important;
    color: #000 !important;
}

.sidebar-container.sidebar-light .sidebar-link.active {
    background-color: rgba(var(--brand-primary-rgb, 156, 0, 191), 0.15) !important;
    color: #000 !important;
}

/* --- Responsive Sidebar --- */
@media (max-width: 991px) {
    .sidebar-container {
        width: 60px !important;
        overflow: visible;
    }

    .sidebar-container .sidebar-nav {
        overflow: visible;
    }

    .sidebar-container .sidebar-label,
    .sidebar-container .sidebar-brand-img {
        opacity: 0;
        width: 0;
    }

    .sidebar-container .sidebar-link {
        padding: 12px;
        justify-content: center;
        position: relative;
        overflow: visible;
    }

    /* Tooltip on responsive collapse */
    .sidebar-container .sidebar-link:hover .sidebar-label {
        opacity: 1;
        width: auto;
        overflow: visible;
        position: absolute;
        left: calc(100% + 8px);
        top: 50%;
        transform: translateY(-50%);
        background: #1a1b1e;
        color: #fff;
        padding: 4px 12px;
        border-radius: 6px;
        white-space: nowrap;
        font-size: 0.85rem;
        z-index: 10000;
        pointer-events: none;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    }

    .sidebar-container.right .sidebar-link:hover .sidebar-label {
        left: auto;
        right: calc(100% + 8px);
    }

    .content-with-sidebar-left {
        margin-left: 60px !important;
        max-width: calc(100vw - 60px) !important;
    }

    .content-with-sidebar-right {
        margin-right: 60px !important;
        max-width: calc(100vw - 60px) !important;
    }
}

@media (max-width: 576px) {
    .sidebar-container {
        width: 50px !important;
    }

    .content-with-sidebar-left {
        margin-left: 50px !important;
        max-width: calc(100vw - 50px) !important;
    }

    .content-with-sidebar-right {
        margin-right: 50px !important;
        max-width: calc(100vw - 50px) !important;
    }

    .sidebar-icon {
        font-size: 1rem;
    }
}

/* =============================================================================
   DARK MODE — Heading Color Fix
   Bootstrap defaults headings to dark color, overriding Mantine's scheme.
   This ensures headings (skeleton titles, etc.) use light text in dark mode.
   ============================================================================= */

[data-mantine-color-scheme="dark"] h1,
[data-mantine-color-scheme="dark"] h2,
[data-mantine-color-scheme="dark"] h3,
[data-mantine-color-scheme="dark"] h4,
[data-mantine-color-scheme="dark"] h5,
[data-mantine-color-scheme="dark"] h6 {
    color: #c1c2c5;
}

/* =============================================================================
   DARK MODE — Bootstrap Overrides
   Activated when data-bs-theme="dark" is set on an ancestor element.
   ============================================================================= */

[data-bs-theme="dark"] .form-select,
[data-bs-theme="dark"] .form-control {
    background-color: #2c2e33;
    color: #c1c2c5;
    border-color: #373A40;
}

[data-bs-theme="dark"] .table {
    --bs-table-bg: #25262b;
    --bs-table-color: #c1c2c5;
    --bs-table-border-color: #373A40;
}

[data-bs-theme="dark"] .table-striped > tbody > tr:nth-of-type(odd) > * {
    --bs-table-striped-bg: #2c2e33;
    --bs-table-striped-color: #c1c2c5;
}

[data-bs-theme="dark"] .table-hover > tbody > tr:hover > * {
    --bs-table-hover-bg: #373A40;
    --bs-table-hover-color: #c1c2c5;
}

[data-bs-theme="dark"] .accordion-button {
    background-color: #2c2e33;
    color: #c1c2c5;
}

[data-bs-theme="dark"] .accordion-button:not(.collapsed) {
    background-color: #373A40;
    color: #c1c2c5;
}

[data-bs-theme="dark"] .accordion-body {
    background-color: #25262b;
    color: #c1c2c5;
}

[data-bs-theme="dark"] .card {
    background-color: #25262b;
    border-color: #373A40;
    color: #c1c2c5;
}

/* =============================================================================
   DARK MODE — Mantine Portaled Component Overrides
   Mantine combobox dropdowns, modals, and inputs render inside a portal
   outside the main React tree. These selectors target dark scheme attributes.
   ============================================================================= */

/* Dark mode combobox — dual selectors for both data-mantine-color-scheme AND data-bs-theme
   (portals render outside MantineProvider, so we sync both attributes to html/body) */
[data-mantine-color-scheme="dark"] .mantine-Combobox-dropdown,
[data-bs-theme="dark"] .mantine-Combobox-dropdown {
    background-color: #25262b !important;
    border-color: #373A40;
}

[data-mantine-color-scheme="dark"] .mantine-Combobox-option,
[data-bs-theme="dark"] .mantine-Combobox-option {
    color: #c1c2c5 !important;
    background-color: transparent !important;
}

[data-mantine-color-scheme="dark"] .mantine-Combobox-option:hover,
[data-mantine-color-scheme="dark"] .mantine-Combobox-option[data-combobox-active],
[data-mantine-color-scheme="dark"] .mantine-Combobox-option[data-hovered],
[data-bs-theme="dark"] .mantine-Combobox-option:hover,
[data-bs-theme="dark"] .mantine-Combobox-option[data-combobox-active],
[data-bs-theme="dark"] .mantine-Combobox-option[data-hovered] {
    background-color: #404040 !important;
}

[data-mantine-color-scheme="dark"] .mantine-Combobox-option[data-combobox-selected],
[data-bs-theme="dark"] .mantine-Combobox-option[data-combobox-selected] {
    background-color: var(--brand-primary, #9c00bf) !important;
    color: var(--brand-text-on-primary, #ffffff) !important;
}

/* Light mode combobox */
[data-mantine-color-scheme="light"] .mantine-Combobox-option,
[data-bs-theme="light"] .mantine-Combobox-option {
    color: #1a1a1a !important;
    background-color: transparent !important;
}

[data-mantine-color-scheme="light"] .mantine-Combobox-option:hover,
[data-mantine-color-scheme="light"] .mantine-Combobox-option[data-combobox-active],
[data-mantine-color-scheme="light"] .mantine-Combobox-option[data-hovered],
[data-bs-theme="light"] .mantine-Combobox-option:hover,
[data-bs-theme="light"] .mantine-Combobox-option[data-combobox-active],
[data-bs-theme="light"] .mantine-Combobox-option[data-hovered] {
    background-color: #f0f0f0 !important;
}

[data-mantine-color-scheme="light"] .mantine-Combobox-option[data-combobox-selected],
[data-bs-theme="light"] .mantine-Combobox-option[data-combobox-selected] {
    background-color: var(--brand-primary, #9c00bf) !important;
    color: var(--brand-text-on-primary, #ffffff) !important;
}

[data-mantine-color-scheme="dark"] .mantine-Modal-content {
    background-color: #25262b;
    color: #c1c2c5;
}

[data-mantine-color-scheme="dark"] .mantine-Modal-header {
    background-color: #25262b;
    color: #c1c2c5;
}

[data-mantine-color-scheme="dark"] .mantine-Input-input {
    background-color: #2c2e33;
    color: #c1c2c5 !important;
    border-color: #373A40;
}

[data-mantine-color-scheme="dark"] .mantine-Pill {
    color: #c1c2c5;
}

/* =============================================================================
   CHECKBOX ACCENT — Both Modes
   ============================================================================= */

.mantine-Checkbox-input:checked {
    background-color: var(--brand-primary, #9C00BF);
    border-color: var(--brand-primary, #9C00BF);
}

/* =============================================================================
   DARK MODE — Scrollbar Styling
   ============================================================================= */

[data-bs-theme="dark"] ::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

[data-bs-theme="dark"] ::-webkit-scrollbar-track {
    background: #1a1b1e;
}

[data-bs-theme="dark"] ::-webkit-scrollbar-thumb {
    background: #373A40;
    border-radius: 4px;
}

[data-bs-theme="dark"] ::-webkit-scrollbar-thumb:hover {
    background: #4a4d54;
}

/* =============================================================================
   VERTICAL INDENTATION LINE — subordinate/conditional settings
   ============================================================================= */

.indent-line {
    border-left: 3px solid var(--brand-primary);
    padding-left: 15px;
    margin-left: 5px;
    margin-top: 10px;
}

/* =============================================================================
   UPLOAD DROPZONE HOVER
   ============================================================================= */

.upload-dropzone {
    transition: all 0.15s ease-in-out;
}

.upload-dropzone:hover {
    border-color: var(--brand-primary) !important;
    background-color: rgba(var(--brand-primary-rgb), 0.06) !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(var(--brand-primary-rgb), 0.15);
}

/* =============================================================================
   DARK MODE — Dash DataTable Hover/Selection Fix
   DataTable's built-in active/selected cell styles use light backgrounds
   that turn cells pure white in dark mode, making text unreadable.
   ============================================================================= */

[data-mantine-color-scheme="dark"] .dash-spreadsheet-container .dash-spreadsheet-inner td.dash-cell.cell--active,
[data-mantine-color-scheme="dark"] .dash-spreadsheet-container .dash-spreadsheet-inner td.dash-cell.cell--selected {
    background-color: rgba(var(--brand-primary-rgb), 0.2) !important;
    color: #d1d4dc !important;
}

[data-mantine-color-scheme="dark"] .dash-spreadsheet-container .dash-spreadsheet-inner td.dash-cell.focused {
    box-shadow: inset 0 0 0 2px var(--brand-primary) !important;
    background-color: rgba(var(--brand-primary-rgb), 0.15) !important;
    color: #d1d4dc !important;
}

[data-mantine-color-scheme="dark"] .dash-spreadsheet-container .dash-spreadsheet-inner input {
    background-color: #2c2e33 !important;
    color: #d1d4dc !important;
}

/* Dark mode — DataTable filter row (white-on-white fix) */
[data-mantine-color-scheme="dark"] .dash-spreadsheet-container .dash-spreadsheet-inner td.dash-filter {
    background-color: #1e1e1e !important;
    color: #d1d4dc !important;
    border-bottom: 1px solid #3a3a3a !important;
}

[data-mantine-color-scheme="dark"] .dash-spreadsheet-container .dash-spreadsheet-inner td.dash-filter input {
    background-color: #2c2e33 !important;
    color: #d1d4dc !important;
    border: 1px solid #3a3a3a !important;
    border-radius: 3px !important;
}

[data-mantine-color-scheme="dark"] .dash-spreadsheet-container .dash-spreadsheet-inner td.dash-filter input::placeholder {
    color: #6c7086 !important;
}

/* Dark mode — DataTable row hover (too bright fix) */
[data-mantine-color-scheme="dark"] .dash-spreadsheet-container .dash-spreadsheet-inner tr:hover td.dash-cell {
    background-color: #333333 !important;
    color: #d1d4dc !important;
}

/* Preserve alternating row color on hover for odd rows */
[data-mantine-color-scheme="dark"] .dash-spreadsheet-container .dash-spreadsheet-inner tr:nth-child(odd):hover td.dash-cell {
    background-color: #383838 !important;
}

/* Dark mode — Mantine checkbox visibility fix (unchecked border invisible on dark bg) */
[data-mantine-color-scheme="dark"] .mantine-Checkbox-input:not(:checked) {
    border-color: #5c5f66 !important;
}

/* Mantine checkbox — pointer cursor on non-disabled checkboxes */
.mantine-Checkbox-input:not(:disabled) {
    cursor: pointer !important;
}
.mantine-Checkbox-root:has(.mantine-Checkbox-input:not(:disabled)) {
    cursor: pointer !important;
}
.mantine-Checkbox-root:has(.mantine-Checkbox-input:not(:disabled)) .mantine-Checkbox-label {
    cursor: pointer !important;
}