/* ═══════════════════════════════════════════════════════
   DESIGN TOKENS — Light (Default)
   ═══════════════════════════════════════════════════════ */
:root {
    --bg: #f0f4f8;
    --surface: #ffffff;
    --surface2: #f8fafc;
    --surface3: #f1f5f9;
    --line: #e2e8f0;
    --text: #1a202c;
    --text-secondary: #4a5568;
    --muted: #718096;
    --primary: #0f766e;
    --primary-light: #14b8a6;
    --primary-strong: #0d6460;
    --primary-bg: #f0fdfa;
    --danger: #dc2626;
    --danger-bg: #fef2f2;
    --success: #059669;
    --success-bg: #ecfdf5;
    --warning: #d97706;
    --warning-bg: #fffbeb;
    --info: #2563eb;
    --info-bg: #eff6ff;
    --sidebar: #0B1B3D;
    --sidebar-hover: rgba(255,255,255,0.08);
    --sidebar-active: rgba(15,118,110,0.35);
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
    --shadow: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
    --radius: 10px;
    --radius-sm: 6px;
    --radius-lg: 14px;
    --transition: 0.18s ease;
    /* Dark mode toggle icon */
    --theme-icon: '☀️';
}

/* ═══════════════════════════════════════════════════════
   DESIGN TOKENS — Dark Theme
   ═══════════════════════════════════════════════════════ */
[data-theme="dark"] {
    --bg: #0d1117;
    --surface: #161b22;
    --surface2: #1c2230;
    --surface3: #21262d;
    --line: #30363d;
    --text: #e6edf3;
    --text-secondary: #8b949e;
    --muted: #6e7681;
    --primary: #20d5c4;
    --primary-light: #2dd4bf;
    --primary-strong: #0ea5a0;
    --primary-bg: rgba(32,213,196,0.08);
    --danger: #f85149;
    --danger-bg: rgba(248,81,73,0.1);
    --success: #3fb950;
    --success-bg: rgba(63,185,80,0.1);
    --warning: #e3b341;
    --warning-bg: rgba(227,179,65,0.1);
    --info: #58a6ff;
    --info-bg: rgba(88,166,255,0.1);
    --sidebar: #010409;
    --sidebar-hover: rgba(255,255,255,0.06);
    --sidebar-active: rgba(32,213,196,0.2);
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.4), 0 1px 2px rgba(0,0,0,0.3);
    --shadow: 0 4px 6px -1px rgba(0,0,0,0.5), 0 2px 4px -1px rgba(0,0,0,0.4);
    --shadow-lg: 0 10px 25px -3px rgba(0,0,0,0.6), 0 4px 10px -2px rgba(0,0,0,0.5);
    
    /* Bootstrap Theme Overrides for Dark Mode */
    --bs-body-color: var(--text);
    --bs-heading-color: var(--text);
    --bs-table-color: var(--text);
    --bs-table-striped-color: var(--text);
    --bs-table-hover-color: var(--text);
    --bs-card-color: var(--text);
    --theme-icon: '🌙';
}

/* ═══════════════════════════════════════════════════════
   GLOBAL SMOOTH TRANSITION (applied on theme switch)
   ═══════════════════════════════════════════════════════ */
body.theme-transitioning *,
body.theme-transitioning *::before,
body.theme-transitioning *::after {
    transition:
        background-color 0.35s cubic-bezier(0.4, 0, 0.2, 1),
        border-color     0.35s cubic-bezier(0.4, 0, 0.2, 1),
        color            0.35s cubic-bezier(0.4, 0, 0.2, 1),
        box-shadow       0.35s cubic-bezier(0.4, 0, 0.2, 1) !important;
}



/* ========================================================
   RESET & BASE
   ======================================================== */
*, *::before, *::after { box-sizing: border-box; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: 'Tajawal', system-ui, -apple-system, sans-serif;
    font-size: 15px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}
a { text-decoration: none; color: inherit; }

:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

/* ========================================================
   APP SHELL
   ======================================================== */
.app-shell { display: flex; min-height: 100vh; }

/* ========================================================
   SIDEBAR
   ======================================================== */
/* ========================================================
   SIDEBAR
   ======================================================== */
.app-sidebar.deep-blue-sidebar {
    width: 260px;
    flex: 0 0 260px;
    background: var(--sidebar);
    color: #e2e8f0;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.1) transparent;
    z-index: 100;
    transition: width 0.22s cubic-bezier(0.4, 0, 0.2, 1), flex 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ═══════════════════════════════════════════════════════
   SIDEBAR COLLAPSED STATE (Desktop Ergonomics)
   ═══════════════════════════════════════════════════════ */
body.sidebar-collapsed .app-sidebar.deep-blue-sidebar,
.app-sidebar.collapsed {
    width: 70px !important;
    flex: 0 0 70px !important;
}

/* Hide text labels when collapsed */
body.sidebar-collapsed .brand-details,
.app-sidebar.collapsed .brand-details,
body.sidebar-collapsed .search-placeholder,
.app-sidebar.collapsed .search-placeholder,
body.sidebar-collapsed .search-shortcut,
.app-sidebar.collapsed .search-shortcut,
body.sidebar-collapsed .sidebar-favorites-section,
.app-sidebar.collapsed .sidebar-favorites-section,
body.sidebar-collapsed .group-title,
.app-sidebar.collapsed .group-title,
body.sidebar-collapsed .group-chevron,
.app-sidebar.collapsed .group-chevron,
body.sidebar-collapsed .sub-module-label,
.app-sidebar.collapsed .sub-module-label,
body.sidebar-collapsed .item-label,
.app-sidebar.collapsed .item-label,
body.sidebar-collapsed .favorite-btn,
.app-sidebar.collapsed .favorite-btn,
body.sidebar-collapsed .user-meta,
.app-sidebar.collapsed .user-meta {
    display: none !important;
}

/* Center elements when collapsed */
body.sidebar-collapsed .sidebar-brand-wrapper,
.app-sidebar.collapsed .sidebar-brand-wrapper {
    padding: 12px 6px !important;
    justify-content: center !important;
}

body.sidebar-collapsed .sidebar-brand-wrapper a,
.app-sidebar.collapsed .sidebar-brand-wrapper a {
    justify-content: center !important;
    width: 100%;
}

body.sidebar-collapsed .brand-mark-logo,
.app-sidebar.collapsed .brand-mark-logo {
    margin: 0 auto;
    width: 38px;
    height: 38px;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 10px;
    transition: background 0.15s ease;
}
body.sidebar-collapsed .brand-mark-logo:hover,
.app-sidebar.collapsed .brand-mark-logo:hover {
    background: rgba(255, 255, 255, 0.1);
}

body.sidebar-collapsed .sidebar-toggle-btn,
.app-sidebar.collapsed .sidebar-toggle-btn {
    display: none !important;
}

body.sidebar-collapsed .sidebar-search-box,
.app-sidebar.collapsed .sidebar-search-box {
    padding: 0 8px !important;
    margin: 8px 0 !important;
}

body.sidebar-collapsed .search-input-wrapper,
.app-sidebar.collapsed .search-input-wrapper {
    padding: 8px 0 !important;
    justify-content: center !important;
    width: 44px;
    height: 44px;
    margin: 0 auto;
    border-radius: 10px;
}

body.sidebar-collapsed .sidebar-group-header,
.app-sidebar.collapsed .sidebar-group-header {
    padding: 8px 0 !important;
    justify-content: center !important;
    position: relative;
}

body.sidebar-collapsed .header-content,
.app-sidebar.collapsed .header-content {
    justify-content: center !important;
    width: 100%;
}

body.sidebar-collapsed .group-icon,
.app-sidebar.collapsed .group-icon {
    font-size: 16px !important;
    width: 44px;
    height: 44px;
    display: flex !important;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    transition: all 0.15s ease;
    margin: 0 auto;
}

body.sidebar-collapsed .sidebar-group:hover .group-icon,
.app-sidebar.collapsed .sidebar-group:hover .group-icon {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
}

body.sidebar-collapsed .sidebar-group.active-group .group-icon,
.app-sidebar.collapsed .sidebar-group.active-group .group-icon {
    background: var(--primary, #0f766e);
    color: #fff;
    box-shadow: 0 2px 8px rgba(15, 118, 110, 0.4);
}

/* Collapsed Flyout Popover Menu */
body.sidebar-collapsed .sidebar-group .sidebar-group-items,
.app-sidebar.collapsed .sidebar-group .sidebar-group-items {
    display: none;
}

body.sidebar-collapsed .sidebar-group:hover .sidebar-group-items,
.app-sidebar.collapsed .sidebar-group:hover .sidebar-group-items {
    display: block !important;
    position: fixed;
    right: 70px;
    margin-top: -44px;
    width: 230px;
    background: #0B1B3D;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.45);
    z-index: 1060;
    padding: 8px;
}

body.sidebar-collapsed .sidebar-group:hover .item-label,
.app-sidebar.collapsed .sidebar-group:hover .item-label {
    display: inline-block !important;
}

body.sidebar-collapsed .sidebar-group:hover .sub-module-label,
.app-sidebar.collapsed .sidebar-group:hover .sub-module-label {
    display: block !important;
}

body.sidebar-collapsed .sidebar-group:hover .favorite-btn,
.app-sidebar.collapsed .sidebar-group:hover .favorite-btn {
    display: inline-block !important;
}

body.sidebar-collapsed .sidebar-group:hover .nav-link,
.app-sidebar.collapsed .sidebar-group:hover .nav-link {
    justify-content: flex-start !important;
    padding: 6px 10px !important;
}

body.sidebar-collapsed .sidebar-user-footer,
.app-sidebar.collapsed .sidebar-user-footer {
    padding: 12px 6px !important;
    flex-direction: column;
    gap: 8px;
    align-items: center;
    justify-content: center;
}
.sidebar-header-context {
    padding: 24px 20px 16px;
    text-align: center;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}
.erp-badge {
    background: rgba(255,255,255,0.1);
    color: #fff;
    font-size: 11px;
    font-weight: 800;
    padding: 3px 10px;
    border-radius: 12px;
    display: inline-block;
    margin-bottom: 8px;
    letter-spacing: 1px;
}
.context-title {
    font-size: 22px;
    font-weight: 800;
    color: #fff;
    margin: 0 0 4px;
}
.context-subtitle {
    font-size: 12px;
    color: rgba(255,255,255,0.5);
}
.sidebar-search-box .search-input-wrapper {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 20px;
    padding: 8px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: rgba(255,255,255,0.5);
    font-size: 13px;
    cursor: text;
    transition: all 0.2s ease;
}
.sidebar-search-box .search-input-wrapper:hover {
    background: rgba(255,255,255,0.1);
}
.search-shortcut {
    margin-right: auto;
    background: rgba(255,255,255,0.1);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
}

.main-dashboard-link {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: var(--radius);
    color: #fff !important;
    justify-content: center;
    padding: 12px !important;
}
.main-dashboard-link:hover {
    background: rgba(255,255,255,0.1) !important;
}

.app-sidebar::-webkit-scrollbar { width: 4px; }
.app-sidebar::-webkit-scrollbar-track { background: transparent; }
.app-sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }

/* Brand */
.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 16px 14px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    color: #fff;
    font-weight: 700;
    font-size: 16px;
    flex-shrink: 0;
}
.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px; height: 38px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 8px rgba(15,118,110,0.4);
    flex-shrink: 0;
}
.brand-text { line-height: 1.2; }
.brand-text small { display: block; font-size: 11px; font-weight: 400; color: rgba(255,255,255,0.4); margin-top: 1px; }

/* Sidebar User */
.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    flex-shrink: 0;
}
.sidebar-avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 14px; color: #fff;
    flex-shrink: 0;
}
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name { font-size: 13px; font-weight: 600; color: #e2e8f0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-role { font-size: 11px; color: rgba(255,255,255,0.4); }

/* Sidebar Navigation */
.sidebar-nav { flex: 1; padding: 10px 10px; overflow-y: auto; }

/* Scrollbar styling for sidebar */
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 4px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }

.sidebar-group {
    margin-bottom: 8px;
    background: rgba(255,255,255,0.03);
    border-radius: var(--radius);
    border: 1px solid rgba(255,255,255,0.05);
    overflow: hidden;
}
.sidebar-group-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 12px;
    color: rgba(255,255,255,0.9);
    cursor: pointer;
    transition: all var(--transition);
    user-select: none;
    background: rgba(0,0,0,0.15);
}
.sidebar-group-header .header-content {
    display: flex;
    align-items: center;
    gap: 10px;
}
.sidebar-group-header:hover {
    background: rgba(255,255,255,0.08);
}
.sidebar-group.open > .sidebar-group-header {
    background: rgba(255,255,255,0.1);
    color: #fff;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}
.group-icon {
    width: 18px;
    text-align: center;
    font-size: 15px;
    opacity: 0.8;
}
.sidebar-group-header:hover .group-icon, .sidebar-group.open > .sidebar-group-header .group-icon {
    opacity: 1;
}
.group-title {
    font-size: 14px;
    font-weight: 600;
}
.group-chevron {
    font-size: 10px;
    transition: transform 0.3s ease;
    opacity: 0.5;
}
.sidebar-group.open > .sidebar-group-header .group-chevron {
    transform: rotate(-90deg);
}

.sidebar-group-items {
    display: none;
}
.sidebar-group.open > .sidebar-group-items {
    display: block;
}
.sidebar-group-items-inner {
    padding: 10px 12px;
}

/* Sidebar Filtered State & Domain Indicator */
.sidebar-domain-indicator {
    background: linear-gradient(135deg, rgba(255,255,255,0.08), rgba(255,255,255,0.03));
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: var(--radius, 10px);
    margin: 0 10px 12px 10px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    transition: all 0.2s ease;
}
.sidebar-domain-indicator .domain-icon-badge {
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}
.sidebar-domain-indicator .clear-filter-btn {
    background: rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.8);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 20px;
    padding: 3px 10px;
    font-size: 11px;
    font-weight: 600;
    transition: all 0.2s ease;
    cursor: pointer;
    text-decoration: none;
}
.sidebar-domain-indicator .clear-filter-btn:hover {
    background: rgba(255,255,255,0.25);
    color: #fff;
    border-color: rgba(255,255,255,0.3);
}

.sidebar-group.filtered-out {
    display: none !important;
}

.app-sidebar.is-filtered .sidebar-group:not(.filtered-out) {
    background: transparent;
    border: none;
}
.app-sidebar.is-filtered .sidebar-group:not(.filtered-out) > .sidebar-group-header {
    display: none;
}
.app-sidebar.is-filtered .sidebar-group:not(.filtered-out) > .sidebar-group-items {
    display: block !important;
}
.app-sidebar.is-filtered .sidebar-group:not(.filtered-out) .sidebar-group-items-inner {
    padding: 0 10px;
}

.app-sidebar .nav-link {
    color: rgba(255,255,255,0.6);
    display: flex;
    align-items: center;
    gap: 10px;
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    margin: 1px 0;
    font-size: 13.5px;
    font-weight: 500;
    transition: all var(--transition);
    white-space: nowrap;
    position: relative;
}
.app-sidebar .nav-link i { width: 18px; text-align: center; font-size: 14px; flex-shrink: 0; opacity: 0.7; }
.app-sidebar .nav-link:hover { background: rgba(255,255,255,0.05); color: #fff; }
.app-sidebar .nav-link:hover i { opacity: 1; }
.app-sidebar .nav-link.active {
    background: var(--sidebar-active);
    color: #fff;
    font-weight: 600;
}
.app-sidebar .nav-link.active i { opacity: 1; color: var(--primary-light); }

.app-sidebar .nav-link span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.app-sidebar .nav-link .favorite-btn {
    opacity: 0;
    transition: opacity 0.2s, color 0.2s;
    font-size: 13px !important;
    width: auto !important;
    color: rgba(255,255,255,0.4);
    z-index: 10;
}
.app-sidebar .nav-link:hover .favorite-btn,
.app-sidebar .nav-link .favorite-btn.favorited {
    opacity: 1 !important;
}
.app-sidebar .nav-link .favorite-btn:hover {
    color: #ffc107 !important;
}
.app-sidebar .nav-link .favorite-btn.favorited {
    color: #ffc107 !important;
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 12px 10px;
    border-top: 1px solid rgba(255,255,255,0.06);
    flex-shrink: 0;
}
.sidebar-logout {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    background: none;
    border: none;
    color: rgba(255,255,255,0.5);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 14px;
    font-family: inherit;
    transition: all var(--transition);
    text-align: right;
}
.sidebar-logout:hover { background: rgba(220,38,38,0.15); color: #fca5a5; }
.sidebar-logout i { width: 18px; text-align: center; }

/* ========================================================
   MAIN CONTENT
   ======================================================== */
.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow-x: hidden; }

/* Topbar */
.topbar {
    min-height: 62px;
    height: 62px;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 0 16px;
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: var(--shadow-sm);
    flex-wrap: nowrap;
    overflow-x: clip;
}
.topbar-left {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex-shrink: 1;
}
.topbar-title {
    min-width: 0;
    flex-shrink: 1;
}
.topbar-title h1 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.topbar-title small {
    color: var(--muted);
    font-size: 11px;
    display: block;
    margin-top: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.topbar-search-box {
    max-width: 240px;
    flex-shrink: 1;
}
.topbar-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: nowrap !important;
    flex-shrink: 0;
}

@keyframes ring {
    0% { transform: rotate(0); }
    10% { transform: rotate(15deg); }
    20% { transform: rotate(-10deg); }
    30% { transform: rotate(5deg); }
    40% { transform: rotate(-5deg); }
    50% { transform: rotate(0); }
    100% { transform: rotate(0); }
}
.fa-bell.text-warning {
    animation: ring 2s ease-in-out infinite;
    transform-origin: top center;
}

/* ========================================================
   TOP NAV PILLS & MEGA MENU
   ======================================================== */
.secondary-navbar {
    background: var(--surface, #fff);
    border-bottom: 1px solid var(--line, #e2e8f0);
    padding: 0 20px;
    display: flex;
    align-items: center;
    flex-wrap: nowrap !important;
    gap: 6px;
    min-height: 44px;
    height: 44px;
    overflow-x: auto;
    overflow-y: visible;
    scrollbar-width: none;
    -ms-overflow-style: none;
    position: relative;
    z-index: 40;
}
.secondary-navbar::-webkit-scrollbar { display: none; }

.nav-pill-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
}
.nav-pill {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.3;
    transition: all 0.15s ease;
    border: 1px solid transparent;
    white-space: nowrap;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
/* Pill Colors */
.pill-primary { background: #f0f9ff; color: #0284c7; border-color: #bae6fd; }
.pill-primary:hover, .pill-primary.active { background: #0284c7; color: #fff; border-color: #0284c7; box-shadow: 0 2px 8px rgba(2,132,199,0.25); }

.pill-success { background: #f0fdf4; color: #16a34a; border-color: #bbf7d0; }
.pill-success:hover, .pill-success.active { background: #16a34a; color: #fff; border-color: #16a34a; box-shadow: 0 2px 8px rgba(22,163,74,0.25); }

.pill-danger { background: #fef2f2; color: #dc2626; border-color: #fecaca; }
.pill-danger:hover, .pill-danger.active { background: #dc2626; color: #fff; border-color: #dc2626; box-shadow: 0 2px 8px rgba(220,38,38,0.25); }

.pill-info { background: #eef2ff; color: #4f46e5; border-color: #c7d2fe; }
.pill-info:hover, .pill-info.active { background: #4f46e5; color: #fff; border-color: #4f46e5; box-shadow: 0 2px 8px rgba(79,70,229,0.25); }

.pill-warning { background: #fefce8; color: #ca8a04; border-color: #fef08a; }
.pill-warning:hover, .pill-warning.active { background: #ca8a04; color: #fff; border-color: #ca8a04; box-shadow: 0 2px 8px rgba(202,138,4,0.25); }

.pill-secondary { background: #f8fafc; color: #475569; border-color: #e2e8f0; }
.pill-secondary:hover, .pill-secondary.active { background: #475569; color: #fff; border-color: #475569; box-shadow: 0 2px 8px rgba(71,85,105,0.25); }

.pill-purple { background: #faf5ff; color: #9333ea; border-color: #e9d5ff; }
.pill-purple:hover, .pill-purple.active { background: #9333ea; color: #fff; border-color: #9333ea; box-shadow: 0 2px 8px rgba(147,51,234,0.25); }

.pill-dark { background: #f1f5f9; color: #1e293b; border-color: #cbd5e1; }
.pill-dark:hover, .pill-dark.active { background: #1e293b; color: #fff; border-color: #1e293b; box-shadow: 0 2px 8px rgba(30,41,59,0.25); }

/* Mega Dropdown */
.mega-dropdown {
    position: absolute;
    top: 38px;
    right: 0;
    background: #fff;
    border-radius: var(--radius);
    box-shadow: 0 10px 30px rgba(0,0,0,0.12);
    border: 1px solid var(--line);
    min-width: 260px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1050;
}
.nav-pill-wrapper:hover .mega-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
.mega-dropdown-inner {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.mega-section-link {
    display: block;
    padding: 12px 16px;
    border-radius: var(--radius);
    transition: background 0.2s ease;
}
.mega-section-link:hover {
    background: var(--surface2);
}
.mega-section-link:hover .mega-title {
    color: var(--primary);
}

/* ========================================================
   GLOBAL PRINT STYLES
   ======================================================== */
@media print {
    .app-sidebar, .topbar, .secondary-navbar, .page-actions {
        display: none !important;
    }
    .content-wrap {
        padding: 0 !important;
        margin: 0 !important;
        flex: 1 1 100% !important;
        max-width: 100% !important;
    }
    body {
        background: #fff !important;
    }
}

/* Content area */
.content-wrap {
    flex: 1;
    width: 100%;
    max-width: 1600px;
    margin: 0 auto;
    padding: 24px 28px 40px;
}

/* Reports Elegant Styling */
.report-container {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.company-header {
    border-bottom: 3px solid #1a237e;
    padding-bottom: 15px;
    margin-bottom: 25px;
}

.company-name {
    font-size: 24px;
    font-weight: 800;
    color: #1a237e;
    margin: 0;
}

.report-title {
    background-color: #f5f5f5;
    border: 1px solid #ddd;
    padding: 8px 20px;
    font-weight: 700;
    font-size: 18px;
    display: inline-block;
    border-radius: 4px;
}

.meta-info {
    background-color: #424242;
    color: white;
    padding: 4px 12px;
    font-weight: 600;
    font-size: 14px;
    display: inline-block;
}
.meta-info.bg-light {
    background-color: #f8f9fa !important;
    color: #212529 !important;
}

.group-header {
    background-color: #e0e0e0;
    font-weight: 800;
    font-size: 16px;
    color: #000;
    border: 1px solid #bdbdbd;
}

.sub-header {
    background-color: #1a237e;
    color: white;
    font-weight: 700;
    font-size: 14px;
}

.table-custom {
    width: 100%;
    margin-bottom: 30px;
    border-collapse: collapse;
}

.table-custom th, .table-custom td {
    border: 1px solid #e0e0e0;
    padding: 8px 12px;
    font-size: 14px;
    vertical-align: middle;
}

.table-custom th {
    background-color: #f5f5f5;
    font-weight: 600;
    color: #424242;
}

.table-custom .total-row td {
    background-color: #f5f5f5;
    font-weight: 700;
}

.table-custom tbody tr:hover {
    background-color: #f9f9f9;
}
.app-footer { padding: 14px 28px; color: var(--muted); border-top: 1px solid var(--line); font-size: 13px; background: var(--surface); }

/* ========================================================
   CARDS & PANELS
   ======================================================== */
.panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    margin-top: 18px;
    box-shadow: var(--shadow-sm);
}
.panel-body { padding: 20px; }
.panel-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 16px 20px 0;
    margin-bottom: 14px;
}
.panel-head h2 { font-size: 16px; margin: 0; font-weight: 700; }
.panel-head .panel-actions { display: flex; gap: 8px; }

/* Form Panel */
.form-panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 24px;
    margin-top: 16px;
    box-shadow: var(--shadow-sm);
}
.form-panel.narrow { max-width: 600px; }
@media (max-width: 768px) {
    .form-panel.narrow { max-width: 100%; }
}
.form-panel.compact { margin-bottom: 18px; }
.form-panel label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; font-weight: 600; color: var(--text-secondary); }

/* Form Grid */
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; align-items: start; }
.form-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.form-grid.cols-1 { grid-template-columns: 1fr; }
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group label { font-size: 13px; font-weight: 600; color: var(--text-secondary); }
.form-label { font-size: 13px; font-weight: 600; color: var(--text-secondary); margin-bottom: 5px; }

/* Filters bar */
.filters-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: flex-end;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 14px 18px;
    margin-bottom: 16px;
    box-shadow: var(--shadow-sm);
}
.filters-bar .filter-group { display: flex; flex-direction: column; gap: 4px; min-width: 160px; }
.filters-bar .filter-group label { font-size: 12px; font-weight: 600; color: var(--muted); }
.filters-bar .filter-actions { margin-right: auto; display: flex; gap: 8px; }

/* ========================================================
   METRICS / KPI CARDS
   ======================================================== */
.metric-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}
.metric {
    background: linear-gradient(145deg, var(--surface), var(--surface2));
    border: 1px solid rgba(0,0,0,0.05);
    border-left: 4px solid var(--primary);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.04);
    transition: transform var(--transition), box-shadow var(--transition);
    position: relative;
    overflow: hidden;
}
.metric:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.metric-icon {
    width: 44px; height: 44px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px;
    margin-bottom: 12px;
}
.metric-icon.green  { background: var(--success-bg); color: var(--success); }
.metric-icon.red    { background: var(--danger-bg); color: var(--danger); }
.metric-icon.blue   { background: var(--info-bg); color: var(--info); }
.metric-icon.orange { background: var(--warning-bg); color: var(--warning); }
.metric-icon.teal   { background: var(--primary-bg); color: var(--primary); }
.metric-label { font-size: 13px; color: var(--muted); font-weight: 500; margin-bottom: 4px; }
.metric-value { font-size: 26px; font-weight: 800; color: var(--text); line-height: 1.1; }
.metric-sub { font-size: 12px; color: var(--muted); margin-top: 6px; }
.metric-trend-up   { color: var(--success); font-size: 12px; }
.metric-trend-down { color: var(--danger); font-size: 12px; }

/* ========================================================
   TABLES
   ======================================================== */
.table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { margin-bottom: 0; width: 100%; }
.table th {
    color: var(--muted);
    font-weight: 700;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: var(--surface2);
    white-space: nowrap;
    padding: 10px 14px;
    border-bottom: 2px solid var(--line);
}
.table td {
    padding: 11px 14px;
    vertical-align: middle;
    border-bottom: 1px solid var(--line);
    font-size: 14px;
}
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background-color: var(--surface2); }
.table .col-shrink { white-space: nowrap; width: 1%; }
.table .col-desc { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ========================================================
   BADGES & STATUS
   ======================================================== */
.badge-type {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}
.badge-receipt  { background: #d1fae5; color: #065f46; }
.badge-payment  { background: #fee2e2; color: #991b1b; }
.badge-expense  { background: #fef3c7; color: #92400e; }
.badge-transfer { background: #dbeafe; color: #1e40af; }
.badge-exchange { background: #f3e8ff; color: #6b21a8; }
.badge-opening  { background: #e0e7ff; color: #3730a3; }
.badge-active   { background: #d1fae5; color: #065f46; }
.badge-void     { background: #fee2e2; color: #991b1b; }
.badge-admin    { background: #fef3c7; color: #92400e; }
.badge-user     { background: #dbeafe; color: #1e40af; }

/* ========================================================
   BUTTONS
   ======================================================== */
.btn-primary { background: var(--primary); border-color: var(--primary); font-weight: 600; }
.btn-primary:hover, .btn-primary:focus { background: var(--primary-strong); border-color: var(--primary-strong); }
.btn-outline-primary { color: var(--primary); border-color: var(--primary); font-weight: 600; }
.btn-outline-primary:hover { background: var(--primary); border-color: var(--primary); }
.btn-icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 32px; height: 32px;
    border-radius: var(--radius-sm);
    padding: 0;
    font-size: 14px;
}
.actions { display: flex; align-items: center; gap: 6px; }
.page-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.topbar-actions .btn { font-size: 13px; }

/* ========================================================
   REPORTS
   ======================================================== */
.report-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.report-link {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 20px;
    color: var(--text);
    display: flex;
    gap: 14px;
    align-items: center;
    font-weight: 600;
    font-size: 15px;
    transition: all var(--transition);
    box-shadow: var(--shadow-sm);
}
.report-link:hover { border-color: var(--primary-light); transform: translateY(-2px); box-shadow: var(--shadow); color: var(--primary); }
.report-link i { font-size: 24px; color: var(--primary); }
.report-link small { display: block; font-size: 12px; color: var(--muted); font-weight: 400; margin-top: 3px; }
.report-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 18px; flex-wrap: wrap; gap: 12px;
}
.report-header h2 { font-size: 18px; margin: 0; }
.report-actions { display: flex; gap: 8px; }

/* Report Summary Cards */
.report-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}
.summary-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 16px;
    text-align: center;
    box-shadow: var(--shadow-sm);
}
.summary-card .s-label { font-size: 12px; color: var(--muted); font-weight: 600; margin-bottom: 6px; }
.summary-card .s-value { font-size: 20px; font-weight: 800; }
.summary-card.s-green .s-value { color: var(--success); }
.summary-card.s-red .s-value { color: var(--danger); }
.summary-card.s-blue .s-value { color: var(--info); }

/* ========================================================
   CONTENT GRID (2-column)
   ======================================================== */
.content-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; margin-top: 18px; }

/* ========================================================
   FORMS
   ======================================================== */
.check-line { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.form-control:focus, .form-select:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(15,118,110,0.12);
}
.input-group-text { background: var(--surface2); }
.form-section { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.form-section-title { font-size: 14px; font-weight: 700; color: var(--text-secondary); margin-bottom: 14px; }

/* Dynamic field visibility */
[data-hidden] { display: none !important; }

/* ========================================================
   AUTH
   ======================================================== */
.auth-body { min-height: 100vh; background: linear-gradient(135deg, #0f1923 0%, #1a2d40 100%); }
.login-screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-panel {
    width: min(440px, 100%);
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 36px;
    box-shadow: var(--shadow-lg);
}
.login-brand {
    text-align: center;
    margin-bottom: 28px;
}
.login-brand .brand-mark { width: 56px; height: 56px; font-size: 18px; margin: 0 auto 12px; }
.login-brand h1 { font-size: 24px; font-weight: 800; margin: 0 0 4px; }
.login-brand p { color: var(--muted); font-size: 14px; margin: 0; }
.stack-form { display: flex; flex-direction: column; gap: 16px; }

/* ========================================================
   USER MANAGEMENT
   ======================================================== */
.user-avatar {
    width: 38px; height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    display: inline-flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 15px; color: #fff;
    flex-shrink: 0;
}
.user-card {
    display: flex; align-items: center; gap: 12px;
}
.user-card-info .user-name { font-weight: 600; font-size: 14px; }
.user-card-info .user-email { font-size: 12px; color: var(--muted); }

/* ========================================================
   ALERTS
   ======================================================== */
.alert { border: none; border-radius: var(--radius); font-weight: 500; }
.alert i { margin-left: 6px; }

/* ========================================================
   MISC
   ======================================================== */
.error-page { display: grid; place-content: center; min-height: 100vh; text-align: center; gap: 10px; }
.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--muted);
}
.empty-state i { font-size: 48px; margin-bottom: 12px; opacity: 0.4; }
.empty-state p { font-size: 15px; margin: 0; }
.divider { border: none; border-top: 1px solid var(--line); margin: 18px 0; }

/* Skeleton / Loading */
.loading-overlay {
    position: fixed; inset: 0;
    background: rgba(255,255,255,0.8);
    display: flex; align-items: center; justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(2px);
}
.spinner { width: 40px; height: 40px; border: 4px solid var(--line); border-top-color: var(--primary); border-radius: 50%; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ========================================================
   RESPONSIVE
   ======================================================== */
@media (max-width: 1100px) {
    .metric-grid { grid-template-columns: repeat(2, 1fr); }
    .report-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    .app-shell { display: block; }
    .app-sidebar {
        width: 100%;
        height: auto;
        position: static;
        flex-direction: row;
        flex-wrap: wrap;
    }
    .app-sidebar .sidebar-nav { padding: 8px; }
    .app-sidebar .nav { display: grid; grid-template-columns: repeat(3, 1fr); }
    .content-wrap { padding: 14px 14px 30px; }
    .topbar { padding: 10px 14px; }
    .metric-grid, .content-grid, .report-grid, .form-grid { grid-template-columns: 1fr; }
    .filters-bar { flex-direction: column; }
    .filters-bar .filter-group { width: 100%; }
}

/* ── Keyboard Shortcuts Bar ── */
.keyboard-shortcuts-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1040;
    display: flex;
    justify-content: center;
    gap: 18px;
    padding: 6px 16px;
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    color: #94a3b8;
    font-size: 12px;
    border-top: 1px solid #334155;
    direction: ltr;
}
.keyboard-shortcuts-bar span {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
.keyboard-shortcuts-bar kbd {
    display: inline-block;
    padding: 1px 6px;
    font-size: 11px;
    font-family: inherit;
    color: #e2e8f0;
    background: rgba(255,255,255,0.1);
    border: 1px solid #475569;
    border-radius: 4px;
    line-height: 1.5;
}
@media (max-width: 768px) {
    .keyboard-shortcuts-bar { display: none; }
}

/* Select2 Global Adjustments for Compact ERP Look */
.select2-results__option, .select2-search__field { font-size: 0.85rem !important; }
.select2-container--bootstrap-5 .select2-selection { font-size: 0.85rem !important; }
.select2-container--bootstrap-5 .select2-selection { font-size: 0.85rem !important; }

/* Fix Select2 z-index inside Bootstrap Modals */
.select2-container--open { z-index: 999999 !important; }

/* Strong visual cue for focused buttons */
.btn:focus, .btn:focus-visible { outline: none !important; box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.5) !important; border-color: #86b7fe !important; }

/* ════════════════════════════════════════════════════════════════
   DARK MODE — Component Overrides
   ════════════════════════════════════════════════════════════════ */

/* Bootstrap core */
[data-theme="dark"] .table { 
    --bs-table-bg: var(--surface); 
    --bs-table-color: var(--text) !important; 
    --bs-table-striped-color: var(--text) !important; 
    --bs-table-hover-color: var(--text) !important; 
    --bs-table-active-color: var(--text) !important; 
    --bs-table-border-color: var(--line); 
    color: var(--text) !important;
}
[data-theme="dark"] .table-hover > tbody > tr:hover > * { background-color: rgba(255,255,255,0.04); color: var(--text) !important; }
[data-theme="dark"] .table thead th { background: var(--surface2); color: var(--text-secondary) !important; border-bottom-color: var(--line); }
[data-theme="dark"] .table td, [data-theme="dark"] .table th { border-color: var(--line); color: var(--text); }
[data-theme="dark"] .card { background: var(--surface); border-color: var(--line); color: var(--text); }
[data-theme="dark"] .card-body { color: var(--text); }
[data-theme="dark"] .card-header { background: var(--surface2); border-bottom-color: var(--line); color: var(--text); }
[data-theme="dark"] .modal-content { background: var(--surface); border-color: var(--line); }
[data-theme="dark"] .modal-header { border-bottom-color: var(--line); background: var(--surface2); }
[data-theme="dark"] .modal-footer { border-top-color: var(--line); background: var(--surface2); }
[data-theme="dark"] .form-control, [data-theme="dark"] .form-select { background: var(--surface2); border-color: var(--line); color: var(--text); }
[data-theme="dark"] .form-control:focus, [data-theme="dark"] .form-select:focus { background: var(--surface2); border-color: var(--primary); color: var(--text); box-shadow: 0 0 0 3px rgba(32,213,196,0.15); }
[data-theme="dark"] .form-control::placeholder { color: var(--muted); }
[data-theme="dark"] .form-control:disabled, [data-theme="dark"] .form-select:disabled { background: var(--surface3); color: var(--muted); }
[data-theme="dark"] .input-group-text { background: var(--surface3); border-color: var(--line); color: var(--text-secondary); }
[data-theme="dark"] .dropdown-menu { background: var(--surface); border-color: var(--line); box-shadow: 0 8px 32px rgba(0,0,0,0.5); }
[data-theme="dark"] .dropdown-item { color: var(--text); }
[data-theme="dark"] .dropdown-item:hover { background: var(--surface2); color: var(--primary); }
[data-theme="dark"] .dropdown-divider { border-color: var(--line); }
[data-theme="dark"] .btn-light { background: var(--surface2); border-color: var(--line); color: var(--text); }
[data-theme="dark"] .btn-light:hover { background: var(--surface3); color: var(--primary); }
[data-theme="dark"] .btn-outline-secondary { border-color: var(--line); color: var(--text-secondary); }
[data-theme="dark"] .btn-outline-secondary:hover { background: var(--surface2); color: var(--text); border-color: var(--primary); }
[data-theme="dark"] .alert-info    { background: var(--info-bg);    border-color: var(--info);    color: var(--info); }
[data-theme="dark"] .alert-success { background: var(--success-bg); border-color: var(--success); color: var(--success); }
[data-theme="dark"] .alert-warning { background: var(--warning-bg); border-color: var(--warning); color: var(--warning); }
[data-theme="dark"] .alert-danger  { background: var(--danger-bg);  border-color: var(--danger);  color: var(--danger); }
[data-theme="dark"] hr { border-color: var(--line); }
[data-theme="dark"] .text-dark { color: var(--text) !important; }
[data-theme="dark"] .text-muted { color: var(--muted) !important; }
[data-theme="dark"] .bg-white { background: var(--surface) !important; }
[data-theme="dark"] .bg-light { background: var(--surface2) !important; }
[data-theme="dark"] .border { border-color: var(--line) !important; }

/* Topbar & Navbar */
[data-theme="dark"] .topbar { background: var(--surface); border-bottom-color: var(--line); }
[data-theme="dark"] .secondary-navbar { background: var(--surface); border-bottom-color: var(--line); }
[data-theme="dark"] .mega-dropdown { background: var(--surface); border-color: var(--line); box-shadow: 0 10px 40px rgba(0,0,0,0.5); }
[data-theme="dark"] .mega-section-link:hover { background: var(--surface2); }
[data-theme="dark"] .mega-title { color: var(--text) !important; }
[data-theme="dark"] .mega-desc { color: var(--muted) !important; }
[data-theme="dark"] .pill-primary { background: rgba(2,132,199,0.15);   color: #58a6ff; }
[data-theme="dark"] .pill-success { background: rgba(22,163,74,0.15);   color: #3fb950; }
[data-theme="dark"] .pill-danger  { background: rgba(220,38,38,0.15);   color: #f85149; }
[data-theme="dark"] .pill-info    { background: rgba(79,70,229,0.15);   color: #818cf8; }
[data-theme="dark"] .pill-warning { background: rgba(202,138,4,0.15);   color: #e3b341; }
[data-theme="dark"] .pill-dark    { background: var(--surface2);        color: var(--text); }
[data-theme="dark"] .pill-purple  { background: rgba(147,51,234,0.15);  color: #c084fc; }

/* App panels */
[data-theme="dark"] .panel { background: var(--surface); border-color: var(--line); }
[data-theme="dark"] .panel-head { border-bottom-color: var(--line); }
[data-theme="dark"] .filters-bar { background: var(--surface2); border-color: var(--line); }
[data-theme="dark"] .form-panel  { background: var(--surface); }
[data-theme="dark"] .form-section-title { color: var(--text-secondary); border-bottom-color: var(--line); }
[data-theme="dark"] .metric-card { background: var(--surface); border-color: var(--line); }
[data-theme="dark"] .table-wrapper { background: var(--surface); }
[data-theme="dark"] .page-actions { border-bottom-color: var(--line); }

/* Select2 */
[data-theme="dark"] .select2-container--bootstrap-5 .select2-selection { background: var(--surface2); border-color: var(--line); color: var(--text); }
[data-theme="dark"] .select2-dropdown { background: var(--surface); border-color: var(--line); box-shadow: 0 8px 32px rgba(0,0,0,0.5); }
[data-theme="dark"] .select2-results__option { color: var(--text); }
[data-theme="dark"] .select2-results__option--highlighted { background: var(--primary-bg); color: var(--primary); }
[data-theme="dark"] .select2-search__field { background: var(--surface2) !important; border-color: var(--line) !important; color: var(--text) !important; }
[data-theme="dark"] .select2-container--bootstrap-5 .select2-selection--single .select2-selection__placeholder { color: var(--muted); }

/* TomSelect */
[data-theme="dark"] .ts-control { background: var(--surface2) !important; border-color: var(--line) !important; color: var(--text) !important; }
[data-theme="dark"] .ts-dropdown { background: var(--surface) !important; border-color: var(--line) !important; box-shadow: 0 8px 32px rgba(0,0,0,0.5) !important; }
[data-theme="dark"] .ts-dropdown .option { color: var(--text); }
[data-theme="dark"] .ts-dropdown .option.active, [data-theme="dark"] .ts-dropdown .option:hover { background: var(--primary-bg); color: var(--primary); }

/* Dark scrollbar */
[data-theme="dark"] { color-scheme: dark; }
[data-theme="dark"] ::-webkit-scrollbar { width: 6px; height: 6px; }
[data-theme="dark"] ::-webkit-scrollbar-track { background: var(--surface2); }
[data-theme="dark"] ::-webkit-scrollbar-thumb { background: #30363d; border-radius: 3px; }
[data-theme="dark"] ::-webkit-scrollbar-thumb:hover { background: #484f58; }

/* Print always light */
@media print { [data-theme="dark"] * { background: #fff !important; color: #000 !important; } }

/* ── Theme Toggle Button ── */
.theme-toggle-btn {
    width: 38px; height: 38px;
    border-radius: 50%;
    border: none;
    background: var(--surface2);
    color: var(--text-secondary);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; font-size: 17px;
    transition: all 0.25s cubic-bezier(0.4,0,0.2,1);
    position: relative; overflow: hidden; flex-shrink: 0;
}
.theme-toggle-btn:hover { background: var(--primary-bg); color: var(--primary); transform: rotate(20deg) scale(1.1); }
.theme-toggle-btn .icon-sun,
.theme-toggle-btn .icon-moon { position: absolute; transition: all 0.35s cubic-bezier(0.4,0,0.2,1); line-height:1; }
.theme-toggle-btn .icon-sun  { opacity:1; transform:translateY(0)    rotate(0deg); }
.theme-toggle-btn .icon-moon { opacity:0; transform:translateY(20px)  rotate(-90deg); }
[data-theme="dark"] .theme-toggle-btn .icon-sun  { opacity:0; transform:translateY(-20px) rotate(90deg); }
[data-theme="dark"] .theme-toggle-btn .icon-moon { opacity:1; transform:translateY(0)     rotate(0deg); }
[data-theme="dark"] .theme-toggle-btn { background: rgba(32,213,196,0.1); color: var(--primary); }
[data-theme="dark"] .theme-toggle-btn:hover { background: rgba(32,213,196,0.2); transform: rotate(-15deg) scale(1.1); }

/* ═══════════════════════════════════════════════════════
   Report Header Enhancements (Light & Dark)
   ═══════════════════════════════════════════════════════ */
.report-logo-placeholder {
    width: 80px;
    height: 80px;
    background: #f0f0f0;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: #888;
}

[data-theme="dark"] .report-title {
    background-color: var(--surface2) !important;
    border-color: var(--line) !important;
    color: var(--text) !important;
}

[data-theme="dark"] .meta-info {
    background-color: var(--surface3) !important;
    color: var(--text) !important;
    border-color: var(--line) !important;
}

[data-theme="dark"] .report-logo-placeholder {
    background-color: var(--surface2);
    color: var(--text-secondary);
    border: 1px solid var(--line);
}


.company-header .meta-info {
    background-color: #f8f9fa !important;
    color: #212529 !important;
    border-color: #dee2e6 !important;
}


[data-theme="dark"] .company-header .meta-info {
    background-color: var(--surface3) !important;
    color: var(--text) !important;
    border-color: var(--line) !important;
}

