#blazor-error-ui {
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

    #blazor-error-ui .dismiss {
        cursor: pointer;
        position: absolute;
        right: 0.75rem;
        top: 0.5rem;
    }

/* ============================================================
   RADZEN COMPONENT DARK MODE — handled via #radzen-dark-overrides
   in index.html (must load AFTER Radzen material-base.css).
   Do NOT add Radzen dark overrides here — they will be
   overridden by the Radzen stylesheet loaded after this file.
   ============================================================ */

/* ============================================================
   GLOBAL LAYOUT FIX - Ensure html/body fill viewport
   ============================================================ */
html, body {
    height: 100%;
    min-height: 100vh;
    margin: 0;
    padding: 0;
}

body {
    overflow-x: hidden;
}

/* Ensure Blazor app root fills viewport */
#app, .page {
    min-height: 100vh;
}

/* ============================================================
   LAYOUT DIMENSIONS FIX - Force correct sizes regardless of Tailwind
   ============================================================ */

/* Sidebar - fit on page, not capped at viewport height */
.sidebar-modern {
    width: 272px !important;
    height: 100vh !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    z-index: 20 !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    background: #ffffff !important;
    display: block !important;
    visibility: visible !important;
    box-shadow: 2px 0 24px rgba(0, 0, 0, 0.06) !important;
}

/* ============================================================
   MODERN HAMBURGER BUTTON
   ============================================================ */
#vertical-menu-btn.hamburger-btn {
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    align-items: center !important;
    gap: 5px !important;
    width: 44px !important;
    height: 44px !important;
    padding: 0 !important;
    margin: 0 4px !important;
    border: 1px solid transparent !important;
    border-radius: 12px !important;
    background: transparent !important;
    cursor: pointer !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    position: relative !important;
    flex-shrink: 0 !important;
}

#vertical-menu-btn.hamburger-btn:hover {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.08), rgba(139, 92, 246, 0.06)) !important;
    border-color: rgba(99, 102, 241, 0.15) !important;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.06) !important;
}

#vertical-menu-btn.hamburger-btn:active {
    transform: scale(0.92) !important;
}

#vertical-menu-btn .hamburger-line {
    display: block !important;
    width: 18px !important;
    height: 2px !important;
    background: linear-gradient(90deg, #475569, #64748b) !important;
    border-radius: 2px !important;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1) !important;
    transform-origin: center !important;
}

#vertical-menu-btn.hamburger-btn:hover .hamburger-line {
    background: linear-gradient(90deg, #6366f1, #8b5cf6) !important;
}

#vertical-menu-btn.hamburger-btn:hover .hamburger-line:nth-child(1) {
    transform: translateX(2px) !important;
}

#vertical-menu-btn.hamburger-btn:hover .hamburger-line:nth-child(3) {
    transform: translateX(-2px) !important;
}

/* Animated toggle: sidebar collapsed → X shape */
/* Desktop: use data-sidebar-size="sm" to show close icon */
body[data-sidebar-size="sm"] #vertical-menu-btn .hamburger-line:nth-child(1) {
    transform: translateY(7px) rotate(45deg) !important;
    background: linear-gradient(90deg, #6366f1, #8b5cf6) !important;
}

body[data-sidebar-size="sm"] #vertical-menu-btn .hamburger-line:nth-child(2) {
    opacity: 0 !important;
    transform: scaleX(0) !important;
}

body[data-sidebar-size="sm"] #vertical-menu-btn .hamburger-line:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg) !important;
    background: linear-gradient(90deg, #6366f1, #8b5cf6) !important;
}

/* ============================================================
   MODERN TENANT BADGE
   ============================================================ */
.topbar-tenant-badge {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    padding: 7px 16px 7px 10px !important;
    background: linear-gradient(135deg, rgba(241, 245, 249, 0.9), rgba(248, 250, 252, 0.95)) !important;
    border: 1px solid rgba(226, 232, 240, 0.8) !important;
    border-radius: 12px !important;
    cursor: default !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    position: relative !important;
    overflow: hidden !important;
    backdrop-filter: blur(8px) !important;
}

.topbar-tenant-badge::before {
    content: '' !important;
    position: absolute !important;
    inset: 0 !important;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.04), rgba(139, 92, 246, 0.02)) !important;
    opacity: 0 !important;
    transition: opacity 0.3s ease !important;
}

.topbar-tenant-badge:hover {
    border-color: rgba(99, 102, 241, 0.2) !important;
    box-shadow: 0 2px 12px rgba(99, 102, 241, 0.08), 0 0 0 1px rgba(99, 102, 241, 0.05) !important;
    transform: translateY(-1px) !important;
}

.topbar-tenant-badge:hover::before {
    opacity: 1 !important;
}

.topbar-tenant-icon {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 28px !important;
    height: 28px !important;
    border-radius: 8px !important;
    background: linear-gradient(135deg, #6366f1, #7c3aed) !important;
    color: #fff !important;
    font-size: 15px !important;
    flex-shrink: 0 !important;
    position: relative !important;
    z-index: 1 !important;
    box-shadow: 0 2px 6px rgba(99, 102, 241, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.15) !important;
}

.topbar-tenant-info {
    display: flex !important;
    flex-direction: column !important;
    gap: 1px !important;
    position: relative !important;
    z-index: 1 !important;
    min-width: 0 !important;
}

.topbar-tenant-label {
    font-size: 9px !important;
    font-weight: 600 !important;
    color: #94a3b8 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.06em !important;
    line-height: 1 !important;
}

.topbar-tenant-name {
    font-size: 12.5px !important;
    font-weight: 600 !important;
    color: #334155 !important;
    letter-spacing: 0.01em !important;
    line-height: 1.2 !important;
    white-space: nowrap !important;
    max-width: 160px !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
}

.topbar-tenant-dot {
    width: 7px !important;
    height: 7px !important;
    border-radius: 50% !important;
    background: #22c55e !important;
    box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.15), 0 0 6px rgba(34, 197, 94, 0.25) !important;
    flex-shrink: 0 !important;
    position: relative !important;
    z-index: 1 !important;
    animation: tenant-pulse 2.5s ease-in-out infinite !important;
}

@keyframes tenant-pulse {
    0%, 100% { box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.15), 0 0 6px rgba(34, 197, 94, 0.25) !important; }
    50% { box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.06), 0 0 8px rgba(34, 197, 94, 0.15) !important; }
}

/* Dark mode tenant badge */
body[data-mode="dark"] .topbar-tenant-badge {
    background: linear-gradient(135deg, rgba(30, 30, 42, 0.9), rgba(39, 39, 50, 0.95)) !important;
    border-color: rgba(63, 63, 70, 0.7) !important;
}

body[data-mode="dark"] .topbar-tenant-badge:hover {
    border-color: rgba(99, 102, 241, 0.3) !important;
    box-shadow: 0 2px 12px rgba(99, 102, 241, 0.12), 0 0 0 1px rgba(99, 102, 241, 0.08) !important;
}

body[data-mode="dark"] .topbar-tenant-badge::before {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.08), rgba(139, 92, 246, 0.05)) !important;
}

body[data-mode="dark"] .topbar-tenant-label {
    color: #64748b !important;
}

body[data-mode="dark"] .topbar-tenant-name {
    color: #e2e8f0 !important;
}

body[data-mode="dark"] .topbar-tenant-dot {
    background: #4ade80 !important;
    box-shadow: 0 0 0 2px rgba(74, 222, 128, 0.15), 0 0 6px rgba(74, 222, 128, 0.25) !important;
}

body[data-mode="dark"] .topbar-tenant-icon {
    background: linear-gradient(135deg, #6366f1, #7c3aed) !important;
    box-shadow: 0 2px 6px rgba(99, 102, 241, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.1) !important;
}

/* Override tailwind2.css #vertical-menu-btn responsive reset */
@media (max-width: 1139px) {
    #vertical-menu-btn.hamburger-btn {
        width: 44px !important;
        height: 44px !important;
        padding: 0 !important;
        margin: 0 4px !important;
    }
}

/* Topbar - force correct position and width */
.atana-topbar {
    position: fixed !important;
    top: 0 !important;
    right: 0 !important;
    left: 272px !important;
    height: 70px !important;
    width: calc(100% - 272px) !important;
    z-index: 10 !important;
    display: flex !important;
    align-items: center !important;
    background-color: rgba(255, 255, 255, 0.85) !important;
    border-bottom: 1px solid #f3f4f6 !important;
    padding-right: 1.5rem !important;
    padding-left: 0.75rem !important;
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1), width 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

/* Inner topbar wrapper */
.atana-topbar > div {
    width: 100% !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
}

/* Main content - force correct offset */
.atana-main-content {
    margin-left: 272px !important;
    min-height: 100vh !important;
    padding-top: 70px !important;
    display: block !important;
    visibility: visible !important;
    transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1), width 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

/* Page content inside main */
.atana-main-content .page-content {
    min-height: calc(100vh - 70px) !important;
    padding: 1rem !important;
}

/* Desktop sm/md sidebar responsive is handled in the DESKTOP (≥1024px) section below (line ~1389) */

/* Old mobile breakpoints (.sidebar-modern.show) removed.
   New breakpoints using body.sidebar-enable are in the TABLET/MOBIAL sections below. */

/* Custom Navigation Styles - Legacy (prefixed to avoid conflict with sidebar-modern) */
.atana-nav {
    height: 100%;
    width: 100%;
    max-width: 100%;
    background: #ffffff;
    border-right: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    position: relative;
    overflow: hidden;
    box-sizing: border-box;
}

.atana-nav-header {
    padding: 1rem;
    border-bottom: 1px solid #e5e7eb;
    background: #ffffff;
    flex-shrink: 0;
    width: 100%;
    box-sizing: border-box;
}

.atana-nav-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    min-width: 0;
}

.atana-nav-logo {
    width: 2rem;
    height: 2rem;
    object-fit: contain;
    flex-shrink: 0;
}

.atana-nav-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: #1f2937;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.atana-nav-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 1rem 0;
    position: relative;
    width: 100%;
    box-sizing: border-box;
}

/* Legacy nav-menu scoped to .atana-nav to prevent global conflict */
.atana-nav .atana-nav-menu {
    list-style: none;
    margin: 0;
    padding: 0;
    width: 100%;
    box-sizing: border-box;
}

.atana-nav-item {
    margin: 0;
    position: relative;
    width: 100%;
    box-sizing: border-box;
}

.atana-nav-dropdown {
    position: relative;
    width: 100%;
}

.atana-nav-link {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    color: #374151;
    text-decoration: none;
    background: none;
    border: none;
    width: calc(100% - 1.5rem);
    max-width: calc(100% - 1.5rem);
    text-align: left;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    border-radius: 0.5rem;
    margin: 0.125rem 0.75rem;
    font-size: 0.95rem;
    box-sizing: border-box;
    min-width: 0;
}

.atana-nav-link:hover {
    background: #f3f4f6;
    color: #1f2937;
}

.atana-nav-link.active {
    background: #3b82f6;
    color: white;
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.2);
}

.atana-nav-icon {
    font-size: 1.25rem;
    margin-right: 0.75rem;
    width: 1.25rem;
    height: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.atana-nav-text {
    flex: 1;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.atana-nav-arrow {
    font-size: 1rem;
    transition: transform 0.2s ease-in-out;
    margin-left: auto;
    flex-shrink: 0;
    width: 1rem;
    height: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.atana-nav-dropdown .atana-nav-arrow {
    transform: rotate(0deg);
}

.atana-nav-dropdown.open .atana-nav-arrow {
    transform: rotate(180deg);
}

.atana-nav-submenu {
    list-style: none;
    margin: 0;
    padding: 0;
    background: #f9fafb;
    border-radius: 0.5rem;
    margin: 0.25rem 0.75rem 0.5rem 0.75rem;
    overflow: hidden;
    max-height: 0;
    transition: max-height 0.3s ease-in-out;
    width: calc(100% - 1.5rem);
    box-sizing: border-box;
    position: relative;
}

.atana-nav-submenu.open {
    max-height: 500px;
    padding: 0.25rem 0;
}

.atana-nav-subitem {
    margin: 0;
    width: 100%;
    box-sizing: border-box;
}

.atana-nav-sublink {
    display: block;
    padding: 0.625rem 1rem 0.625rem 3rem;
    color: #4b5563;
    text-decoration: none;
    font-size: 0.875rem;
    transition: all 0.2s ease-in-out;
    border-radius: 0.375rem;
    margin: 0.125rem 0.5rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: calc(100% - 1rem);
    max-width: calc(100% - 1rem);
    box-sizing: border-box;
    min-width: 0;
}

.atana-nav-sublink:hover {
    background: #e5e7eb;
    color: #1f2937;
}

.atana-nav-sublink.active {
    background: #dbeafe;
    color: #1d4ed8;
    font-weight: 500;
}

/* Custom scrollbar */
.atana-nav-content::-webkit-scrollbar {
    width: 4px;
}

.atana-nav-content::-webkit-scrollbar-track {
    background: #f1f5f9;
}

.atana-nav-content::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 2px;
}

.atana-nav-content::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Custom scrollbar for consoles and lists */
.custom-scrollbar::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.custom-scrollbar::-webkit-scrollbar-track {
    background: #111;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
    background: #444;
    border-radius: 4px;
    border: 1px solid #222;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Material Design Icons compatibility */
.material-icons {
    font-family: 'Material Icons';
    font-weight: normal;
    font-style: normal;
    font-size: 24px;
    line-height: 1;
    letter-spacing: normal;
    text-transform: none;
    display: inline-block;
    white-space: nowrap;
    word-wrap: normal;
    direction: ltr;
    -webkit-font-feature-settings: 'liga';
    -webkit-font-smoothing: antialiased;
}

/* Navigation link states */
.atana-nav a[href] {
    text-decoration: none;
    color: inherit;
}

.atana-nav a[href]:hover {
    text-decoration: none;
}

/* Custom focus styles for accessibility */
.nav-link:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
    border-radius: 0.5rem;
}

/* Ensure proper containment */
.nav-item * {
    box-sizing: border-box;
}

/* Prevent horizontal overflow globally */
.atana-nav * {
    max-width: 100%;
    box-sizing: border-box;
}

/* Mobile responsive adjustments */
@media (max-width: 768px) {
    .nav-title {
        font-size: 1rem;
    }
    
    .nav-link {
        padding: 0.625rem 0.75rem;
        font-size: 0.875rem;
        width: calc(100% - 1rem);
        max-width: calc(100% - 1rem);
        margin: 0.125rem 0.5rem;
    }
    
    .nav-sublink {
        padding: 0.5rem 0.75rem 0.5rem 2.5rem;
        font-size: 0.8125rem;
        width: calc(100% - 0.75rem);
        max-width: calc(100% - 0.75rem);
        margin: 0.125rem 0.375rem;
    }

    .nav-submenu {
        margin: 0.25rem 0.5rem 0.5rem 0.5rem;
        width: calc(100% - 1rem);
    }

    .nav-icon {
        margin-right: 0.5rem;
    }

    .nav-text {
        font-size: 0.875rem;
    }
}

/* Extra small screens */
@media (max-width: 480px) {
    .nav-header {
        padding: 0.75rem;
    }

    .nav-title {
        font-size: 0.95rem;
    }

    .nav-link {
        padding: 0.5rem 0.625rem;
        font-size: 0.8125rem;
        margin: 0.0625rem 0.375rem;
        width: calc(100% - 0.75rem);
        max-width: calc(100% - 0.75rem);
    }

    .nav-sublink {
        padding: 0.4375rem 0.625rem 0.4375rem 2rem;
        font-size: 0.75rem;
        margin: 0.0625rem 0.25rem;
        width: calc(100% - 0.5rem);
        max-width: calc(100% - 0.5rem);
    }

    .nav-submenu {
        margin: 0.25rem 0.375rem 0.5rem 0.375rem;
        width: calc(100% - 0.75rem);
    }

    .nav-icon {
        font-size: 1.125rem;
        width: 1.125rem;
        height: 1.125rem;
        margin-right: 0.375rem;
    }
}

/* Radzen Component Fixes (Tailwind Compatibility) */
:root {
    --rz-input-height: 32px;
    --rz-input-font-size: 0.875rem;
}

/* Override Radzen native padding (default: 7px 15px) that makes components too tall */
.rz-dropdown,
.rz-combobox,
.rz-lookup {
    height: var(--rz-input-height) !important;
    min-height: var(--rz-input-height) !important;
    padding: 0 !important;
    box-sizing: border-box !important;
}

.rz-dropdown-label,
.rz-lookup-label {
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    padding-left: 8px !important;
    height: var(--rz-input-height) !important;
    line-height: normal !important;
    font-size: var(--rz-input-font-size) !important;
    min-height: unset !important;
    display: flex !important;
    align-items: center !important;
    box-sizing: border-box !important;
}

.rz-dropdown-trigger {
    height: var(--rz-input-height) !important;
    display: flex !important;
    align-items: center !important;
    padding: 0 !important;
}

/* TextBox and Numeric inputs */
.rz-textbox,
.rz-inputtext,
.rz-numeric-input {
    padding: 4px 8px !important;
    height: var(--rz-input-height) !important;
    min-height: var(--rz-input-height) !important;
    line-height: 1.2 !important;
    font-size: var(--rz-input-font-size) !important;
    box-sizing: border-box !important;
}
/* Radzen Loading Overlay - Make Transparent */
:root {
    --rz-datagrid-loading-background-color: transparent;
}

.rz-datagrid-loading-content {
    background-color: transparent !important;
    background: transparent !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

/* Radzen Loading Overlay - Transparent Fix */
:root {
    --rz-grid-loading-indicator-background-color: transparent;
    --rz-grid-loading-indicator-background-opacity: 0;
}

.rz-datatable-loading {
    background-color: transparent !important;
    opacity: 0 !important;
}

/* ============================================================
   SIDEBAR RESPONSIVE MODES (data-sidebar-size attribute on body)
   Moved from NavMenu.razor.css :global() to app.css (global)
   ============================================================ */

/* ---- Small mode (icon-only, ~60px) ---- */
@media (min-width: 1024px) {
    body[data-sidebar-size="sm"] .sidebar-modern {
        width: 60px;
    }

    body[data-sidebar-size="sm"] .sidebar-brand,
    body[data-sidebar-size="sm"] .sidebar-brand-compact .sidebar-brand-text,
    body[data-sidebar-size="sm"] .sidebar-section-label,
    body[data-sidebar-size="sm"] .sidebar-nav-text,
    body[data-sidebar-size="sm"] .sidebar-nav-arrow,
    body[data-sidebar-size="sm"] .sidebar-submenu,
    body[data-sidebar-size="sm"] .group-data-\[sidebar-size\=sm\]\:hidden {
        display: none !important;
    }

    body[data-sidebar-size="sm"] .sidebar-brand-compact {
        display: block !important;
    }

    body[data-sidebar-size="sm"] .sidebar-nav-link {
        justify-content: center;
        padding: 10px;
        margin: 2px 8px;
    }

    body[data-sidebar-size="sm"] .sidebar-nav-icon {
        margin: 0;
    }

    body[data-sidebar-size="sm"] .sidebar-sublink {
        padding-left: 16px;
    }

    body[data-sidebar-size="sm"] .sidebar-sublink::before {
        display: none;
    }
}

/* ---- Compact mode (md, ~70px) ---- */
@media (min-width: 1024px) {
    body[data-sidebar-size="md"] .sidebar-modern {
        width: 70px;
    }

    body[data-sidebar-size="md"] .sidebar-brand-text,
    body[data-sidebar-size="md"] .sidebar-section-label,
    body[data-sidebar-size="md"] .sidebar-nav-text,
    body[data-sidebar-size="md"] .sidebar-nav-arrow,
    body[data-sidebar-size="md"] .sidebar-submenu {
        display: none !important;
    }

    body[data-sidebar-size="md"] .sidebar-nav-link {
        justify-content: center;
        padding: 10px;
        margin: 2px 8px;
    }

    body[data-sidebar-size="md"] .sidebar-nav-icon {
        margin: 0;
    }
}

/* ============================================================
   SIDEBAR - Modern Dark Sidebar Design
   (Moved from NavMenu.razor.css because Blazor scoped CSS not loading)
   ============================================================ */

/* ---- Sidebar Container (Light mode default) ---- */
.sidebar-modern {
    width: 272px;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 20;
    background: #ffffff;
    box-shadow: 2px 0 24px rgba(0, 0, 0, 0.06);
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

/* ---- Brand / Logo Section ---- */
.sidebar-brand {
    list-style: none;
    padding: 0;
    margin: 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.sidebar-brand-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    text-decoration: none;
    transition: background 0.2s ease;
    min-height: 68px;
}

.sidebar-brand-link:hover {
    background: rgba(0, 0, 0, 0.03);
}

.sidebar-brand-logo {
    width: 36px;
    height: 36px;
    object-fit: contain;
    flex-shrink: 0;
    border-radius: 10px;
    background: rgba(99, 102, 241, 0.08);
    padding: 4px;
}

.sidebar-brand-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.sidebar-brand-name {
    font-size: 17px;
    font-weight: 700;
    color: #1e293b;
    letter-spacing: -0.3px;
    line-height: 1.2;
}

.sidebar-brand-version {
    font-size: 11px;
    font-weight: 500;
    color: rgba(100, 116, 139, 0.7);
    letter-spacing: 0.3px;
    line-height: 1.3;
}

.sidebar-brand-compact {
    list-style: none;
    padding: 0;
    margin: 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.sidebar-brand-compact .sidebar-brand-link {
    justify-content: center;
    padding: 12px;
}

/* ---- Section Labels ---- */
.sidebar-section-label {
    list-style: none;
    padding: 20px 20px 8px 20px;
    margin: 0;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 1.2px;
    color: rgba(100, 116, 139, 0.5);
    text-transform: uppercase;
    cursor: default;
    user-select: none;
}

/* ---- Main Nav Links ---- */
.sidebar-nav-link {
    display: flex !important;
    align-items: center;
    padding: 10px 16px;
    margin: 2px 10px;
    border-radius: 10px;
    text-decoration: none;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    gap: 12px;
    min-height: 42px;
}

.sidebar-nav-link:hover {
    background: rgba(0, 0, 0, 0.04);
}

.sidebar-nav-link:active {
    background: rgba(0, 0, 0, 0.06);
    transform: scale(0.98);
}

/* Active state indicator */
.sidebar-nav-link.active,
.sidebar-nav-link.active:hover {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(139, 92, 246, 0.06)) !important;
    color: #4f46e5 !important;
    border-left: 3px solid #818cf8 !important;
    padding-left: 13px;
}

.sidebar-nav-link.active::before {
    content: '';
    position: absolute;
    left: -10px;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 24px;
    background: linear-gradient(180deg, #818cf8, #a78bfa);
    border-radius: 0 3px 3px 0;
}

/* Dark mode active bar glow */
body[data-mode="dark"] .sidebar-nav-link.active::before,
body[data-mode="dark"] .sidebar-nav-link.active:hover::before {
    box-shadow: 0 0 8px rgba(129, 140, 248, 0.5);
}

.sidebar-nav-link-home {
    color: #334155;
    font-weight: 500;
}

.sidebar-nav-link-home:hover {
    color: #1e293b;
    background: rgba(0, 0, 0, 0.04);
}

/* ---- Nav Icon ---- */
.sidebar-nav-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    color: #64748b;
    transition: color 0.2s ease;
}

.sidebar-nav-link:hover .sidebar-nav-icon,
.sidebar-nav-link.active .sidebar-nav-icon {
    color: #4f46e5 !important;
}

.sidebar-nav-icon i,
.sidebar-nav-icon svg {
    width: 18px;
    height: 18px;
    stroke-width: 1.8;
}

/* ---- Nav Text ---- */
.sidebar-nav-text {
    flex: 1;
    font-size: 13.5px;
    font-weight: 500;
    color: #334155;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: 0.1px;
    line-height: 1.3;
}

.sidebar-nav-link:hover .sidebar-nav-text,
.sidebar-nav-link.active .sidebar-nav-text {
    color: #1e293b !important;
}

/* ---- Nav Arrow (chevron for expandable items) ---- */
.sidebar-nav-arrow {
    font-size: 16px;
    color: rgba(100, 116, 139, 0.5);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), color 0.2s ease;
    flex-shrink: 0;
    margin-left: auto;
}

.sidebar-nav-link:hover .sidebar-nav-arrow {
    color: rgba(100, 116, 139, 0.8);
}

/* Rotated when open (metismenu adds 'mm-active' class) */
li.mm-active > .sidebar-nav-link .sidebar-nav-arrow,
li.mm-show > .sidebar-nav-link .sidebar-nav-arrow {
    transform: rotate(180deg);
}

/* ---- Sub-Menu (Level 1) ---- */
.sidebar-submenu {
    list-style: none;
    margin: 0;
    padding: 4px 0 8px 0;
    background: rgba(0, 0, 0, 0.02);
    border-radius: 0;
    overflow: hidden;
    max-height: 0;
    transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1),
                padding 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.25s ease;
    opacity: 0;
}

/* When visible (metismenu toggles mm-show or mm-collapsing) */
.sidebar-submenu.mm-show,
.sidebar-submenu.mm-collapsing,
.metismenu li.mm-active > .sidebar-submenu {
    max-height: 2000px;
    padding: 4px 0 8px 0;
    opacity: 1;
}

/* ---- Sub-Link (Level 1 items) ---- */
.sidebar-sublink {
    display: block;
    padding: 8px 16px 8px 48px;
    margin: 1px 10px;
    font-size: 13px;
    font-weight: 400;
    color: #475569;
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.18s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    position: relative;
}

.sidebar-sublink::before {
    content: '';
    position: absolute;
    left: 30px;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: rgba(100, 116, 139, 0.3);
    transition: all 0.2s ease;
}

.sidebar-sublink:hover {
    background: rgba(0, 0, 0, 0.04);
    color: #1e293b;
}

.sidebar-sublink:hover::before {
    background: rgba(79, 70, 229, 0.6);
    transform: translateY(-50%) scale(1.3);
}

/* Active sub-link */
.sidebar-sublink.active,
.sidebar-sublink.active:hover {
    background: rgba(99, 102, 241, 0.08) !important;
    color: #4f46e5 !important;
    font-weight: 600 !important;
    border-left: 3px solid #818cf8;
    padding-left: 45px;
}

.sidebar-sublink.active::before {
    background: #818cf8;
    width: 5px;
    height: 5px;
}

/* ---- Sub-Link Parent (clickable expandable) ---- */
.sidebar-sublink-parent {
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Active submenu parent — text must be dark */
li.mm-active > .sidebar-sublink-parent,
.metismenu li.mm-active > a .sidebar-sublink-parent {
    color: #1e293b !important;
    font-weight: 600 !important;
}

/* Override Tailwind CDN purple color on mm-active links */
.metismenu .mm-active > a,
.metismenu .mm-active a,
.mm-active > a {
    color: #4f46e5 !important;
}

.sidebar-sub-arrow {
    font-size: 14px;
    color: rgba(100, 116, 139, 0.5);
    transition: transform 0.25s ease;
    margin-left: 6px;
    display: inline-flex;
    vertical-align: middle;
    flex-shrink: 0;
}

.sidebar-sublink-parent:hover .sidebar-sub-arrow {
    color: rgba(79, 70, 229, 0.7);
}

/* When the sub-level is open, rotate arrow */
li.mm-active > .sidebar-sublink-parent .sidebar-sub-arrow {
    transform: rotate(90deg);
}

/* ---- Sub-Menu Level 2 ---- */
.sidebar-submenu-l2 {
    list-style: none;
    margin: 0;
    padding: 4px 0 4px 0;
    background: rgba(0, 0, 0, 0.015);
    border-left: 2px solid rgba(99, 102, 241, 0.15);
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                padding 0.25s ease,
                opacity 0.25s ease;
    opacity: 0;
}

.sidebar-submenu-l2.mm-show,
.sidebar-submenu-l2.mm-collapsing,
.metismenu li.mm-active > .sidebar-submenu-l2 {
    max-height: 2000px;
    padding: 4px 0;
    opacity: 1;
}

.sidebar-sublink-l2 {
    display: block;
    padding: 6px 16px 6px 64px;
    margin: 1px 10px;
    font-size: 12.5px;
    font-weight: 400;
    color: #64748b;
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.18s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    position: relative;
}

.sidebar-sublink-l2::before {
    content: '';
    position: absolute;
    left: 50px;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: rgba(100, 116, 139, 0.25);
}

.sidebar-sublink-l2:hover {
    background: rgba(0, 0, 0, 0.03);
    color: #1e293b;
}

.sidebar-sublink-l2:hover::before {
    background: rgba(79, 70, 229, 0.5);
}

.sidebar-sublink-l2.active {
    background: rgba(99, 102, 241, 0.06) !important;
    color: #4f46e5 !important;
    font-weight: 600 !important;
    border-left: 3px solid #a5b4fc;
    padding-left: 61px;
}

/* ---- Sub-Menu Level 3 ---- */
.sidebar-submenu-l3 {
    list-style: none;
    margin: 0;
    padding: 4px 0;
    background: rgba(0, 0, 0, 0.01);
    border-left: 2px solid rgba(139, 92, 246, 0.12);
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                padding 0.25s ease,
                opacity 0.25s ease;
    opacity: 0;
}

.sidebar-submenu-l3.mm-show,
.sidebar-submenu-l3.mm-collapsing,
.metismenu li.mm-active > .sidebar-submenu-l3 {
    max-height: 2000px;
    padding: 4px 0;
    opacity: 1;
}

.sidebar-sublink-l3 {
    display: block;
    padding: 5px 16px 5px 80px;
    margin: 1px 10px;
    font-size: 12px;
    font-weight: 400;
    color: #94a3b8;
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.18s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    position: relative;
}

.sidebar-sublink-l3::before {
    content: '';
    position: absolute;
    left: 66px;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: rgba(100, 116, 139, 0.2);
}

.sidebar-sublink-l3:hover {
    background: rgba(0, 0, 0, 0.03);
    color: #1e293b;
}

.sidebar-sublink-l3:hover::before {
    background: rgba(79, 70, 229, 0.4);
}

.sidebar-sublink-l3.active {
    background: rgba(99, 102, 241, 0.06) !important;
    color: #4f46e5 !important;
    font-weight: 600 !important;
    border-left: 3px solid #c7d2fe;
    padding-left: 77px;
}

/* ---- Custom Scrollbar ---- */
.sidebar-modern ::-webkit-scrollbar {
    width: 4px;
}

.sidebar-modern ::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-modern ::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.2);
    border-radius: 4px;
}

.sidebar-modern ::-webkit-scrollbar-thumb:hover {
    background: rgba(148, 163, 184, 0.35);
}

/* ---- Focus styles for accessibility ---- */
.sidebar-nav-link:focus,
.sidebar-sublink:focus,
.sidebar-sublink-l2:focus,
.sidebar-sublink-l3:focus {
    outline: 2px solid rgba(129, 140, 248, 0.5);
    outline-offset: -2px;
}

/* ---- Metismenu base resets ---- */
.metismenu,
.metismenu ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.metismenu li {
    list-style: none;
}

/* Old mobile breakpoints (.sidebar-modern.show) removed.
   New breakpoints using body.sidebar-enable are in the TABLET/MOBIAL sections below. */

/* ============================================================
   SIDEBAR OVERLAY (mobile backdrop)
   ============================================================ */
.sidebar-overlay {
    display: none !important;
    position: fixed !important;
    inset: 0 !important;
    background: rgba(0, 0, 0, 0.5) !important;
    z-index: 40 !important;
    backdrop-filter: blur(2px) !important;
    -webkit-backdrop-filter: blur(2px) !important;
    transition: opacity 0.3s ease !important;
    opacity: 0 !important;
}

.sidebar-overlay.active {
    display: block !important;
    opacity: 1 !important;
}

/* Duplicate .atana-topbar and .atana-main-content declarations removed.
   Base declarations with transitions are in the LAYOUT DIMENSIONS section above. */

/* ============================================================
   DESKTOP (≥1024px): sm/md sidebar modes
   ============================================================ */
@media (min-width: 1024px) {
    body[data-sidebar-size="sm"] .sidebar-modern {
        width: 60px !important;
    }

    body[data-sidebar-size="sm"] .atana-topbar {
        left: 60px !important;
        width: calc(100% - 60px) !important;
    }

    body[data-sidebar-size="sm"] .atana-main-content {
        margin-left: 60px !important;
        width: calc(100% - 60px) !important;
    }

    body[data-sidebar-size="md"] .sidebar-modern {
        width: 70px !important;
    }

    body[data-sidebar-size="md"] .atana-topbar {
        left: 70px !important;
        width: calc(100% - 70px) !important;
    }

    body[data-sidebar-size="md"] .atana-main-content {
        margin-left: 70px !important;
        width: calc(100% - 70px) !important;
    }
}

/* ============================================================
   TABLET (768px–1023px): sidebar overlay mode
   ============================================================ */
@media (min-width: 768px) and (max-width: 1023px) {
    .sidebar-modern {
        transform: translateX(-100%) !important;
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
        z-index: 50 !important;
        width: 272px !important;
    }

    /* Connect JS sidebar-enable class to sidebar visibility */
    body.sidebar-enable .sidebar-modern {
        transform: translateX(0) !important;
    }

    .atana-topbar {
        left: 0 !important;
        width: 100% !important;
    }

    .atana-main-content {
        margin-left: 0 !important;
        width: 100% !important;
    }

    /* Prevent main content scroll when sidebar overlay is open */
    body.sidebar-enable .atana-main-content {
        pointer-events: none !important;
        user-select: none !important;
    }

    /* Mobile/tablet: show close icon when sidebar overlay is open */
    body.sidebar-enable #vertical-menu-btn .hamburger-line:nth-child(1) {
        transform: translateY(7px) rotate(45deg) !important;
        background: linear-gradient(90deg, #6366f1, #8b5cf6) !important;
    }

    body.sidebar-enable #vertical-menu-btn .hamburger-line:nth-child(2) {
        opacity: 0 !important;
        transform: scaleX(0) !important;
    }

    body.sidebar-enable #vertical-menu-btn .hamburger-line:nth-child(3) {
        transform: translateY(-7px) rotate(-45deg) !important;
        background: linear-gradient(90deg, #6366f1, #8b5cf6) !important;
    }
}

/* ============================================================
   MOBILE (≤767px): sidebar overlay mode
   ============================================================ */
@media (max-width: 767px) {
    .sidebar-modern {
        transform: translateX(-100%) !important;
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
        z-index: 50 !important;
        width: 280px !important;
        max-width: 85vw !important;
    }

    /* Connect JS sidebar-enable class to sidebar visibility */
    body.sidebar-enable .sidebar-modern {
        transform: translateX(0) !important;
    }

    .atana-topbar {
        left: 0 !important;
        width: 100% !important;
        padding-left: 0.75rem !important;
        padding-right: 0.75rem !important;
    }

    .atana-main-content {
        margin-left: 0 !important;
        width: 100% !important;
    }

    .atana-main-content .page-content {
        padding: 0.75rem !important;
    }

    /* Prevent main content interaction when sidebar overlay is open */
    body.sidebar-enable .atana-main-content {
        pointer-events: none !important;
        user-select: none !important;
    }

    /* Mobile: show close icon when sidebar overlay is open */
    body.sidebar-enable #vertical-menu-btn .hamburger-line:nth-child(1) {
        transform: translateY(7px) rotate(45deg) !important;
        background: linear-gradient(90deg, #6366f1, #8b5cf6) !important;
    }

    body.sidebar-enable #vertical-menu-btn .hamburger-line:nth-child(2) {
        opacity: 0 !important;
        transform: scaleX(0) !important;
    }

    body.sidebar-enable #vertical-menu-btn .hamburger-line:nth-child(3) {
        transform: translateY(-7px) rotate(-45deg) !important;
        background: linear-gradient(90deg, #6366f1, #8b5cf6) !important;
    }
}

/* ============================================================
   SMALL MOBILE (≤480px): tighter spacing
   ============================================================ */
@media (max-width: 480px) {
    .atana-topbar {
        height: 56px !important;
        padding-left: 0.5rem !important;
        padding-right: 0.5rem !important;
    }

    .atana-main-content {
        padding-top: 56px !important;
    }

    /* Hide tenant badge text on very small screens */
    .topbar-tenant-badge .topbar-tenant-label {
        display: none !important;
    }

    .topbar-tenant-name {
        max-width: 100px !important;
        font-size: 11px !important;
    }

    .sidebar-modern {
        width: 260px !important;
        max-width: 80vw !important;
    }

    .atana-main-content .page-content {
        padding: 0.5rem !important;
    }
}

/* ============================================================
   FIX DOUBLE ARROW (metismenu auto-generated + our HTML arrow)
   ============================================================ */
.metismenu .has-arrow::before,
.metismenu .has-arrow::after,
.metismenu .has-arrow > span:not(.sidebar-nav-icon):not(.sidebar-nav-text):not(.sidebar-nav-arrow) {
    content: none !important;
    display: none !important;
}

/* Hide ::after content on expandable nav links (metismenu adds chevron via ::after) */
#side-menu a[href="javascript: void(0);"]::after,
#side-menu a[href="javascript:void(0);"]::after,
.sidebar-nav-link.nav-menu::after,
.sidebar-nav-link[href="javascript: void(0);"]::after,
.sidebar-nav-link[href="javascript:void(0);"]::after {
    content: none !important;
    display: none !important;
    width: 0 !important;
    height: 0 !important;
}

/* Also hide ::after on sublink-parent (level 2/3 expandable items) */
.sidebar-sublink-parent::after,
.sidebar-sublink[href="javascript:void(0);"]::after,
.sidebar-sublink[href="javascript: void(0);"]::after {
    content: none !important;
    display: none !important;
}

/* ============================================================
   THEME TOGGLE BUTTON (in topbar)
   ============================================================ */
.atana-theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 70px;
    padding: 0 1rem;
    border: 0;
    background: transparent;
    color: #4b5563;
    cursor: pointer;
    transition: color 0.2s ease, background-color 0.2s ease;
}

.atana-theme-toggle:hover {
    color: #1f2937;
    background-color: rgba(0, 0, 0, 0.04);
}

.atana-theme-toggle i {
    font-size: 1.25rem;
}

/* Show sun icon in light mode, moon icon in dark mode */
body[data-mode="dark"] .atana-theme-toggle .light-mode-icon {
    display: none;
}

body[data-mode="light"] .atana-theme-toggle .dark-mode-icon,
body:not([data-mode]) .atana-theme-toggle .dark-mode-icon {
    display: none;
}

/* On login page (no main app), always show moon icon (click to go dark) */
body:not([data-mode]) .atana-theme-toggle .light-mode-icon {
    display: none;
}

body:not([data-mode]) .atana-theme-toggle .dark-mode-icon {
    display: inline-block;
}

/* ============================================================
   DARK MODE STYLES
   Scoped to .atana-main-content so login page is never affected
   ============================================================ */

/* --- Topbar dark mode (topbar only exists in main app) --- */
body[data-mode="dark"] .atana-topbar {
    background-color: rgba(39, 39, 42, 0.9) !important;
    border-bottom: 1px solid #3f3f46 !important;
}

body[data-mode="dark"] .atana-topbar .hamburger-btn {
    background: transparent !important;
    border-color: transparent !important;
}

body[data-mode="dark"] .atana-topbar .hamburger-btn:hover {
    background: rgba(99, 102, 241, 0.12) !important;
    border-color: rgba(99, 102, 241, 0.2) !important;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1) !important;
}

body[data-mode="dark"] .atana-topbar .hamburger-line {
    background: linear-gradient(90deg, #94a3b8, #cbd5e1) !important;
}

body[data-mode="dark"] .atana-topbar .hamburger-btn:hover .hamburger-line {
    background: linear-gradient(90deg, #818cf8, #a78bfa) !important;
}

body[data-mode="dark"] .atana-topbar .text-gray-600,
body[data-mode="dark"] .atana-topbar .text-gray-800 {
    color: #d4d4d8 !important;
}

body[data-mode="dark"] .atana-topbar .border-\[\#e9e9ef\] {
    border-color: #3f3f46 !important;
}

body[data-mode="dark"] .atana-topbar .bg-gray-50\/30 {
    background-color: rgba(63, 63, 70, 0.5) !important;
}

body[data-mode="dark"] .atana-theme-toggle {
    color: #d4d4d8;
}

body[data-mode="dark"] .atana-theme-toggle:hover {
    color: #f4f4f5;
    background-color: rgba(255, 255, 255, 0.06);
}

/* --- Main content dark mode (scoped to .atana-main-content) --- */
body[data-mode="dark"] .atana-main-content {
    background-color: #18181b;
    color: #e4e4e7;
}

body[data-mode="dark"] .atana-main-content .page-content {
    background-color: #18181b !important;
}

/* --- Cards and panels (scoped to main content only) --- */
body[data-mode="dark"] .atana-main-content .bg-white {
    background-color: #27272a !important;
}

body[data-mode="dark"] .atana-main-content .text-gray-700,
body[data-mode="dark"] .atana-main-content .text-gray-800 {
    color: #e4e4e7 !important;
}

body[data-mode="dark"] .atana-main-content .text-gray-600 {
    color: #a1a1aa !important;
}

body[data-mode="dark"] .atana-main-content .border-gray-50,
body[data-mode="dark"] .atana-main-content .border-gray-100,
body[data-mode="dark"] .atana-main-content .border-gray-200 {
    border-color: #3f3f46 !important;
}

body[data-mode="dark"] .atana-main-content .bg-gray-50 {
    background-color: #1f1f23 !important;
}

/* --- Dropdown menus (scoped to topbar) --- */
body[data-mode="dark"] .atana-topbar .dropdown-menu {
    background-color: #27272a !important;
    border-color: #3f3f46 !important;
}

body[data-mode="dark"] .atana-topbar .dropdown-item {
    color: #e4e4e7 !important;
}

body[data-mode="dark"] .atana-topbar .dropdown-item:hover {
    background-color: rgba(255, 255, 255, 0.06) !important;
}

body[data-mode="dark"] .atana-topbar .dropdown .btn {
    color: #d4d4d8 !important;
}

/* --- Radzen components (scoped to main content) --- */
body[data-mode="dark"] .atana-main-content .rz-dialog,
body[data-mode="dark"] .atana-main-content .rz-notification {
    background-color: #27272a !important;
    color: #e4e4e7 !important;
}

body[data-mode="dark"] .atana-main-content .rz-datatable {
    background-color: #27272a !important;
    color: #e4e4e7 !important;
}

body[data-mode="dark"] .atana-main-content .rz-datatable thead {
    background-color: #1f1f23 !important;
}

body[data-mode="dark"] .atana-main-content .rz-datatable .rz-cell-filter,
body[data-mode="dark"] .atana-main-content .rz-datatable .rz-cell-filter .rz-textbox {
    border-color: #3f3f46 !important;
    background-color: #1f1f23 !important;
    color: #e4e4e7 !important;
}

body[data-mode="dark"] .atana-main-content input,
body[data-mode="dark"] .atana-main-content select,
body[data-mode="dark"] .atana-main-content textarea {
    background-color: #1f1f23 !important;
    color: #e4e4e7 !important;
    border-color: #3f3f46 !important;
}

/* Radzen form labels */
body[data-mode="dark"] .atana-main-content .rz-label,
body[data-mode="dark"] .atana-main-content label,
body[data-mode="dark"] .atana-main-content .rz-text-label {
    color: #d4d4d8 !important;
}

/* Radzen dropdown/select */
body[data-mode="dark"] .atana-main-content .rz-dropdown,
body[data-mode="dark"] .atana-main-content .rz-select,
body[data-mode="dark"] .atana-main-content .rz-multiselect {
    background-color: #1f1f23 !important;
    color: #e4e4e7 !important;
    border-color: #3f3f46 !important;
}

body[data-mode="dark"] .atana-main-content .rz-dropdown-panel,
body[data-mode="dark"] .atana-main-content .rz-select-panel,
body[data-mode="dark"] .atana-main-content .rz-popup {
    background-color: #27272a !important;
    color: #e4e4e7 !important;
    border-color: #3f3f46 !important;
}

body[data-mode="dark"] .atana-main-content .rz-dropdown-item,
body[data-mode="dark"] .atana-main-content .rz-select-item {
    color: #e4e4e7 !important;
}

body[data-mode="dark"] .atana-main-content .rz-dropdown-item:hover,
body[data-mode="dark"] .atana-main-content .rz-select-item:hover {
    background-color: #3f3f46 !important;
    color: #f4f4f5 !important;
}

/* Radzen checkboxes and radio buttons */
body[data-mode="dark"] .atana-main-content .rz-chkbox-box,
body[data-mode="dark"] .atana-main-content .rz-radiobutton-box {
    background-color: #1f1f23 !important;
    border-color: #52525b !important;
}

/* Radzen buttons (secondary) */
body[data-mode="dark"] .atana-main-content .rz-button.rz-secondary,
body[data-mode="dark"] .atana-main-content .rz-button.btn-light {
    background-color: #3f3f46 !important;
    color: #e4e4e7 !important;
    border-color: #52525b !important;
}

/* Radzen dialog header */
body[data-mode="dark"] .atana-main-content .rz-dialog-header,
body[data-mode="dark"] .atana-main-content .rz-dialog-title {
    background-color: #1f1f23 !important;
    color: #f4f4f5 !important;
    border-bottom: 1px solid #3f3f46 !important;
}

body[data-mode="dark"] .atana-main-content .rz-dialog-content,
body[data-mode="dark"] .atana-main-content .rz-dialog-footer {
    background-color: #27272a !important;
    color: #e4e4e7 !important;
    border-top: 1px solid #3f3f46 !important;
}

/* Radzen data grid rows */
body[data-mode="dark"] .atana-main-content .rz-datatable .rz-data-row {
    background-color: #27272a !important;
    color: #e4e4e7 !important;
    border-color: #3f3f46 !important;
}

body[data-mode="dark"] .atana-main-content .rz-datatable .rz-data-row:hover {
    background-color: #3f3f46 !important;
}

body[data-mode="dark"] .atana-main-content .rz-datatable .rz-sortable-column {
    color: #d4d4d8 !important;
}

body[data-mode="dark"] .atana-main-content .rz-datatable .rz-cell-data {
    color: #e4e4e7 !important;
}

/* Radzen checkbox text */
body[data-mode="dark"] .atana-main-content .rz-chkbox-label {
    color: #d4d4d8 !important;
}

/* Radzen required indicator (asterisk) */
body[data-mode="dark"] .atana-main-content .rz-required {
    color: #f87171 !important;
}

/* --- Tables (scoped to main content) --- */
body[data-mode="dark"] .atana-main-content table {
    color: #e4e4e7 !important;
}

body[data-mode="dark"] .atana-main-content table thead {
    background-color: #1f1f23 !important;
}

/* --- Icons in main content (general) --- */
body[data-mode="dark"] .atana-main-content i[class*="mdi"],
body[data-mode="dark"] .atana-main-content i[class*="fa-"],
body[data-mode="dark"] .atana-main-content .feather,
body[data-mode="dark"] .atana-main-content i[data-feather] {
    color: #d4d4d8;
}

body[data-mode="dark"] .atana-main-content i[class*="mdi"]:hover,
body[data-mode="dark"] .atana-main-content i[class*="fa-"]:hover {
    color: #f4f4f5;
}

/* --- Headings in main content --- */
body[data-mode="dark"] .atana-main-content h1,
body[data-mode="dark"] .atana-main-content h2,
body[data-mode="dark"] .atana-main-content h3,
body[data-mode="dark"] .atana-main-content h4,
body[data-mode="dark"] .atana-main-content h5,
body[data-mode="dark"] .atana-main-content h6 {
    color: #f4f4f5 !important;
}

/* --- Links in main content --- */
body[data-mode="dark"] .atana-main-content a:not(.btn):not(.rz-button) {
    color: #93c5fd;
}

body[data-mode="dark"] .atana-main-content a:not(.btn):not(.rz-button):hover {
    color: #bfdbfe;
}

/* --- Form labels and text --- */
body[data-mode="dark"] .atana-main-content .form-label,
body[data-mode="dark"] .atana-main-content .form-control-label,
body[data-mode="dark"] .atana-main-content span:not([class*="bg-"]):not([class*="text-"]) {
    color: #d4d4d8;
}

/* --- Cards with shadow --- */
body[data-mode="dark"] .atana-main-content .shadow,
body[data-mode="dark"] .atana-main-content .shadow-sm,
body[data-mode="dark"] .atana-main-content .shadow-md,
body[data-mode="dark"] .atana-main-content .shadow-lg {
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.4) !important;
}

/* --- Scrollbar dark mode --- */
body[data-mode="dark"] .atana-main-content *::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

body[data-mode="dark"] .atana-main-content *::-webkit-scrollbar-track {
    background: #1f1f23;
}

body[data-mode="dark"] .atana-main-content *::-webkit-scrollbar-thumb {
    background: #3f3f46;
    border-radius: 4px;
}

body[data-mode="dark"] .atana-main-content *::-webkit-scrollbar-thumb:hover {
    background: #52525b;
}

/* --- Radzen slider, progressbar --- */
body[data-mode="dark"] .atana-main-content .rz-slider,
body[data-mode="dark"] .atana-main-content .rz-progressbar {
    background-color: #3f3f46 !important;
}

/* --- Radzen tab strip --- */
body[data-mode="dark"] .atana-main-content .rz-tabview-nav {
    background-color: #1f1f23 !important;
    border-bottom-color: #3f3f46 !important;
}

body[data-mode="dark"] .atana-main-content .rz-tabview-selected,
body[data-mode="dark"] .atana-main-content .rz-tabview li {
    color: #e4e4e7 !important;
}

body[data-mode="dark"] .atana-main-content .rz-tabview-pane {
    background-color: #27272a !important;
    color: #e4e4e7 !important;
}

/* --- Radzen tooltip --- */
body[data-mode="dark"] .atana-main-content .rz-tooltip {
    background-color: #3f3f46 !important;
    color: #f4f4f5 !important;
}

/* --- Placeholder text --- */
body[data-mode="dark"] .atana-main-content input::placeholder,
body[data-mode="dark"] .atana-main-content textarea::placeholder {
    color: #71717a !important;
}

/* ============================================================
   OVERRIDE: Force white text on active sidebar items
   SCOPED to dark mode only to avoid invisible text in light mode
   ============================================================ */
body[data-mode="dark"] .metismenu .mm-active > a {
    color: #ffffff !important;
}

body[data-mode="dark"] .metismenu .mm-active > a .sidebar-nav-text {
    color: #ffffff !important;
}

body[data-mode="dark"] .metismenu .mm-active > a .sidebar-nav-icon {
    color: #ffffff !important;
}

body[data-mode="dark"] .metismenu .mm-active .active {
    color: #ffffff !important;
}

body[data-mode="dark"] .metismenu .mm-active a.sidebar-sublink {
    color: #ffffff !important;
}

body[data-mode="dark"] .metismenu .mm-active a.sidebar-sublink.active {
    color: #ffffff !important;
    background: rgba(99, 102, 241, 0.4) !important;
    font-weight: 600 !important;
}

/* --- Light mode: active menu clear indigo colors --- */
body[data-mode="light"] .mm-active > a,
.mm-active > a {
    color: #4338ca !important;
}

body[data-mode="light"] .mm-active > a .sidebar-nav-text,
.mm-active > a .sidebar-nav-text {
    color: #312e81 !important;
}

body[data-mode="light"] .mm-active > a .sidebar-nav-icon,
.mm-active > a .sidebar-nav-icon {
    color: #6366f1 !important;
}

body[data-mode="light"] .mm-active a.sidebar-sublink.active,
.mm-active a.sidebar-sublink.active {
    color: #4338ca !important;
    background: rgba(99, 102, 241, 0.1) !important;
    font-weight: 500 !important;
}

/* ============================================================
   SIDEBAR - Dark Mode Overrides
   ============================================================ */

body[data-mode="dark"] .sidebar-modern {
    background: #27272a !important;
    box-shadow: 2px 0 24px rgba(0, 0, 0, 0.3) !important;
}

body[data-mode="dark"] .sidebar-brand {
    border-bottom-color: rgba(255, 255, 255, 0.06) !important;
}

body[data-mode="dark"] .sidebar-brand-link:hover {
    background: rgba(255, 255, 255, 0.04) !important;
}

body[data-mode="dark"] .sidebar-brand-logo {
    background: rgba(255, 255, 255, 0.1) !important;
}

body[data-mode="dark"] .sidebar-brand-name {
    color: #ffffff !important;
}

body[data-mode="dark"] .sidebar-brand-version {
    color: rgba(148, 163, 184, 0.7) !important;
}

body[data-mode="dark"] .sidebar-brand-compact {
    border-bottom-color: rgba(255, 255, 255, 0.06) !important;
}

body[data-mode="dark"] .sidebar-section-label {
    color: rgba(148, 163, 184, 0.45) !important;
}

body[data-mode="dark"] .sidebar-nav-link:hover {
    background: rgba(255, 255, 255, 0.08) !important;
}

body[data-mode="dark"] .sidebar-nav-link:active {
    background: rgba(255, 255, 255, 0.05) !important;
}

body[data-mode="dark"] .sidebar-nav-link.active,
body[data-mode="dark"] .sidebar-nav-link.active:hover {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.25), rgba(139, 92, 246, 0.18)) !important;
    color: #ffffff !important;
    border-left: 3px solid #818cf8 !important;
    padding-left: 13px !important;
}

body[data-mode="dark"] .sidebar-nav-link-home {
    color: #e2e8f0 !important;
}

body[data-mode="dark"] .sidebar-nav-link-home:hover {
    color: #ffffff !important;
    background: rgba(255, 255, 255, 0.08) !important;
}

body[data-mode="dark"] .sidebar-nav-icon {
    color: rgba(148, 163, 184, 0.8) !important;
}

body[data-mode="dark"] .sidebar-nav-link:hover .sidebar-nav-icon,
body[data-mode="dark"] .sidebar-nav-link.active .sidebar-nav-icon {
    color: #ffffff !important;
}

body[data-mode="dark"] .sidebar-nav-text {
    color: #cbd5e1 !important;
}

body[data-mode="dark"] .sidebar-nav-link:hover .sidebar-nav-text,
body[data-mode="dark"] .sidebar-nav-link.active .sidebar-nav-text {
    color: #ffffff !important;
}

body[data-mode="dark"] .sidebar-nav-arrow {
    color: rgba(148, 163, 184, 0.5) !important;
}

body[data-mode="dark"] .sidebar-nav-link:hover .sidebar-nav-arrow {
    color: rgba(148, 163, 184, 0.8) !important;
}

body[data-mode="dark"] .sidebar-submenu {
    background: rgba(0, 0, 0, 0.15) !important;
}

body[data-mode="dark"] .sidebar-sublink {
    color: rgba(203, 213, 225, 0.85) !important;
}

body[data-mode="dark"] .sidebar-sublink::before {
    background: rgba(148, 163, 184, 0.3) !important;
}

body[data-mode="dark"] .sidebar-sublink:hover {
    background: rgba(255, 255, 255, 0.06) !important;
    color: #e2e8f0 !important;
}

body[data-mode="dark"] .sidebar-sublink:hover::before {
    background: rgba(199, 210, 254, 0.6) !important;
}

body[data-mode="dark"] .sidebar-sublink.active,
body[data-mode="dark"] .sidebar-sublink.active:hover {
    background: rgba(99, 102, 241, 0.35) !important;
    color: #e0e7ff !important;
    font-weight: 500 !important;
}

body[data-mode="dark"] .sidebar-sublink.active::before {
    background: #c7d2fe !important;
    box-shadow: 0 0 8px rgba(165, 180, 252, 0.5) !important;
}

body[data-mode="dark"] li.mm-active > .sidebar-sublink-parent,
body[data-mode="dark"] .metismenu li.mm-active > a .sidebar-sublink-parent {
    color: #ffffff !important;
}

body[data-mode="dark"] .metismenu .mm-active > a,
body[data-mode="dark"] .metismenu .mm-active a,
body[data-mode="dark"] .mm-active > a,
body[data-mode="dark"] .metismenu .mm-active > a .sidebar-nav-text,
body[data-mode="dark"] .metismenu .mm-active > a .sidebar-nav-icon {
    color: #ffffff !important;
}

body[data-mode="dark"] .sidebar-sub-arrow {
    color: rgba(148, 163, 184, 0.5) !important;
}

body[data-mode="dark"] .sidebar-sublink-parent:hover .sidebar-sub-arrow {
    color: rgba(199, 210, 254, 0.7) !important;
}

body[data-mode="dark"] .sidebar-submenu-l2 {
    background: rgba(0, 0, 0, 0.12) !important;
    border-left-color: rgba(99, 102, 241, 0.2) !important;
}

body[data-mode="dark"] .sidebar-sublink-l2 {
    color: rgba(203, 213, 225, 0.8) !important;
}

body[data-mode="dark"] .sidebar-sublink-l2.active {
    background: rgba(99, 102, 241, 0.35) !important;
    color: #e0e7ff !important;
    font-weight: 500 !important;
}

body[data-mode="dark"] .sidebar-sublink-l2::before {
    background: rgba(148, 163, 184, 0.3) !important;
}

body[data-mode="dark"] .sidebar-sublink-l2:hover {
    background: rgba(255, 255, 255, 0.05) !important;
    color: #e2e8f0 !important;
}

body[data-mode="dark"] .sidebar-sublink-l2:hover::before {
    background: rgba(199, 210, 254, 0.5) !important;
}

body[data-mode="dark"] .sidebar-submenu-l3 {
    background: rgba(0, 0, 0, 0.08) !important;
    border-left-color: rgba(139, 92, 246, 0.15) !important;
}

body[data-mode="dark"] .sidebar-sublink-l3 {
    color: rgba(203, 213, 225, 0.75) !important;
}

body[data-mode="dark"] .sidebar-sublink-l3::before {
    background: rgba(148, 163, 184, 0.25) !important;
}

body[data-mode="dark"] .sidebar-sublink-l3:hover {
    background: rgba(255, 255, 255, 0.04) !important;
    color: #e2e8f0 !important;
}

body[data-mode="dark"] .sidebar-sublink-l3:hover::before {
    background: rgba(199, 210, 254, 0.4) !important;
}

body[data-mode="dark"] .sidebar-sublink-l3.active {
    background: rgba(99, 102, 241, 0.3) !important;
    color: #e0e7ff !important;
    font-weight: 500 !important;
}

body[data-mode="dark"] .sidebar-modern ::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.2) !important;
}

body[data-mode="dark"] .sidebar-modern ::-webkit-scrollbar-thumb:hover {
    background: rgba(148, 163, 184, 0.35) !important;
}

/* ============================================================
   RADZEN DIALOG — ROOT-LEVEL dark mode
   (RadzenDialog renders outside .atana-main-content)
   ============================================================ */

body[data-mode="dark"] .rz-dialog {
    background-color: #1f1f23 !important;
    color: #e4e4e7 !important;
}

body[data-mode="dark"] .rz-dialog-header {
    background-color: #27272a !important;
    color: #f4f4f5 !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
}

body[data-mode="dark"] .rz-dialog-title {
    color: #f4f4f5 !important;
}

body[data-mode="dark"] .rz-dialog-content {
    background-color: #1f1f23 !important;
    color: #e4e4e7 !important;
}

body[data-mode="dark"] .rz-dialog-footer {
    background-color: #27272a !important;
    color: #e4e4e7 !important;
    border-top: 1px solid rgba(255, 255, 255, 0.08) !important;
}

/* Radzen overlay (dialog backdrop) */
body[data-mode="dark"] .rz-overlay {
    background-color: rgba(0, 0, 0, 0.6) !important;
}

/* Radzen notification dark mode */
body[data-mode="dark"] .rz-notification {
    background-color: #27272a !important;
    color: #e4e4e7 !important;
    border-color: #3f3f46 !important;
}

body[data-mode="dark"] .rz-notification-message {
    color: #e4e4e7 !important;
}

/* Radzen tooltip dark mode */
body[data-mode="dark"] .rz-tooltip {
    background-color: #27272a !important;
    color: #e4e4e7 !important;
}

body[data-mode="dark"] .rz-tooltip-content {
    color: #e4e4e7 !important;
}

/* Radzen context menu dark mode */
body[data-mode="dark"] .rz-contextmenu {
    background-color: #1f1f23 !important;
    border-color: #3f3f46 !important;
}

body[data-mode="dark"] .rz-contextmenu-item {
    color: #e4e4e7 !important;
}

body[data-mode="dark"] .rz-contextmenu-item:hover {
    background-color: #3f3f46 !important;
    color: #f4f4f5 !important;
}

/* ============================================================
   CUSTOM MODAL (AtanaModalDialog) — dark mode
   ============================================================ */

body[data-mode="dark"] .atana-modal {
    background-color: rgba(0, 0, 0, 0.7) !important;
}

body[data-mode="dark"] .atana-modal-content {
    background-color: #1f1f23 !important;
    color: #e4e4e7 !important;
    border-color: rgba(255, 255, 255, 0.08) !important;
}

/* ============================================================
   RADZEN FORM ELEMENTS — ROOT-LEVEL dark mode
   (Ensures forms outside .atana-main-content also adapt)
   ============================================================ */

body[data-mode="dark"] .rz-textbox,
body[data-mode="dark"] .rz-numeric-textbox,
body[data-mode="dark"] .rz-calendar-input,
body[data-mode="dark"] textarea.rz-textbox {
    background-color: #1f1f23 !important;
    color: #e4e4e7 !important;
    border-color: #3f3f46 !important;
}

body[data-mode="dark"] .rz-textbox:focus,
body[data-mode="dark"] .rz-numeric-textbox:focus,
body[data-mode="dark"] textarea.rz-textbox:focus {
    border-color: #818cf8 !important;
    box-shadow: 0 0 0 2px rgba(129, 140, 248, 0.25) !important;
}

body[data-mode="dark"] .rz-dropdown,
body[data-mode="dark"] .rz-select,
body[data-mode="dark"] .rz-multiselect {
    background-color: #1f1f23 !important;
    color: #e4e4e7 !important;
    border-color: #3f3f46 !important;
}

body[data-mode="dark"] .rz-dropdown-panel,
body[data-mode="dark"] .rz-select-panel,
body[data-mode="dark"] .rz-popup {
    background-color: #1f1f23 !important;
    color: #e4e4e7 !important;
    border-color: #3f3f46 !important;
}

body[data-mode="dark"] .rz-dropdown-item,
body[data-mode="dark"] .rz-select-item {
    color: #e4e4e7 !important;
}

body[data-mode="dark"] .rz-dropdown-item:hover,
body[data-mode="dark"] .rz-select-item:hover {
    background-color: #3f3f46 !important;
    color: #f4f4f5 !important;
}

body[data-mode="dark"] .rz-label,
body[data-mode="dark"] label.rz-text-label {
    color: #d4d4d8 !important;
}

body[data-mode="dark"] .rz-chkbox-box,
body[data-mode="dark"] .rz-radiobutton-box {
    background-color: #1f1f23 !important;
    border-color: #52525b !important;
}

body[data-mode="dark"] .rz-chkbox-label {
    color: #d4d4d8 !important;
}

body[data-mode="dark"] .rz-button.rz-secondary,
body[data-mode="dark"] .rz-button.btn-light {
    background-color: #3f3f46 !important;
    color: #e4e4e7 !important;
    border-color: #52525b !important;
}

body[data-mode="dark"] .rz-button.rz-secondary:hover,
body[data-mode="dark"] .rz-button.btn-light:hover {
    background-color: #52525b !important;
    color: #f4f4f5 !important;
}

body[data-mode="dark"] .rz-required {
    color: #f87171 !important;
}

/* Radzen data grid — root level */
body[data-mode="dark"] .rz-datatable {
    background-color: #1f1f23 !important;
    color: #e4e4e7 !important;
}

body[data-mode="dark"] .rz-datatable thead {
    background-color: #27272a !important;
}

body[data-mode="dark"] .rz-datatable .rz-data-row {
    background-color: #1f1f23 !important;
    color: #e4e4e7 !important;
    border-color: #3f3f46 !important;
}

body[data-mode="dark"] .rz-datatable .rz-data-row:hover {
    background-color: #27272a !important;
}

body[data-mode="dark"] .rz-datatable .rz-sortable-column {
    color: #d4d4d8 !important;
}

body[data-mode="dark"] .rz-datatable .rz-cell-data {
    color: #e4e4e7 !important;
}

body[data-mode="dark"] .rz-datatable .rz-cell-filter,
body[data-mode="dark"] .rz-datatable .rz-cell-filter .rz-textbox {
    border-color: #3f3f46 !important;
    background-color: #1f1f23 !important;
    color: #e4e4e7 !important;
}

/* Radzen tab strip — root level */
body[data-mode="dark"] .rz-tabview-nav {
    background-color: #27272a !important;
    border-bottom-color: #3f3f46 !important;
}

body[data-mode="dark"] .rz-tabview-selected,
body[data-mode="dark"] .rz-tabview li {
    color: #e4e4e7 !important;
}

body[data-mode="dark"] .rz-tabview-pane {
    background-color: #1f1f23 !important;
    color: #e4e4e7 !important;
}

/* Radzen slider / progressbar — root level */
body[data-mode="dark"] .rz-slider,
body[data-mode="dark"] .rz-progressbar {
    background-color: #3f3f46 !important;
}

/* Placeholder text — root level */
body[data-mode="dark"] .rz-textbox::placeholder,
body[data-mode="dark"] textarea::placeholder {
    color: #71717a !important;
}
