/* =====================================================
   DaaemDEEP - Custom Theme & Global Styles
   ===================================================== */

/* --- Base --- */
body {
    background-color: #f0f2f5;
    color: #2d353c;
    transition: background-color 0.3s ease, color 0.3s ease;
}

body, html {
    color: #2d353c;
}

a {
    color: var(--bs-app-theme, #038fbd);
    transition: all 150ms ease;
}

a:hover {
    color: var(--bs-app-theme-hover, #0174a6);
    filter: brightness(0.9);
}

a:focus {
    outline: 0;
    outline-offset: 0;
}

/* ===================================================
   THEME COLOR SYSTEM — Complete SaaS Theme Definitions
   Each theme provides all CSS variables used across the UI.
   =================================================== */

/* --- Yellow (Default) — Warm Professional --- */
.theme-yellow {
    --bs-app-theme: #F9C74F;
    --bs-app-theme-rgb: 249, 199, 79;
    --bs-app-theme-color: #1a1200;
    --bs-app-theme-color-rgb: 26, 18, 0;
    --bs-app-theme-hover: #E5B33C;
    --bs-app-theme-hover-border-color: #E5B33C;
    --bs-app-theme-hover-color: #1a1200;
    --bs-app-theme-active: #D4A33A;
    --bs-app-theme-active-border-color: #D4A33A;
    --bs-app-theme-active-color: #1a1200;
    --bs-app-theme-disabled: #FBD87A;
    --bs-app-theme-disabled-border-color: #FBD87A;
    --bs-app-theme-disabled-color: #1a1200;
    --bs-app-theme-soft: rgba(249, 199, 79, 0.1);
    --bs-app-theme-gradient: linear-gradient(135deg, #F9C74F 0%, #F7B731 100%);
}

.bg-yellow { background-color: #F9C74F !important; }

/* --- Teal — Modern Professional --- */
.theme-teal {
    --bs-app-theme: #00ACAC;
    --bs-app-theme-rgb: 0, 172, 172;
    --bs-app-theme-color: #FFFFFF;
    --bs-app-theme-color-rgb: 255, 255, 255;
    --bs-app-theme-hover: #009090;
    --bs-app-theme-hover-border-color: #009090;
    --bs-app-theme-hover-color: #FFFFFF;
    --bs-app-theme-active: #008181;
    --bs-app-theme-active-border-color: #008181;
    --bs-app-theme-active-color: #FFFFFF;
    --bs-app-theme-disabled: #40c1c1;
    --bs-app-theme-disabled-border-color: #40c1c1;
    --bs-app-theme-disabled-color: #FFFFFF;
    --bs-app-theme-soft: rgba(0, 172, 172, 0.08);
    --bs-app-theme-gradient: linear-gradient(135deg, #00ACAC 0%, #00897B 100%);
}

/* --- Blue — Professional Enterprise --- */
.theme-blue {
    --bs-app-theme: #2563EB;
    --bs-app-theme-rgb: 37, 99, 235;
    --bs-app-theme-color: #FFFFFF;
    --bs-app-theme-color-rgb: 255, 255, 255;
    --bs-app-theme-hover: #1D4ED8;
    --bs-app-theme-hover-border-color: #1D4ED8;
    --bs-app-theme-hover-color: #FFFFFF;
    --bs-app-theme-active: #1E40AF;
    --bs-app-theme-active-border-color: #1E40AF;
    --bs-app-theme-active-color: #FFFFFF;
    --bs-app-theme-disabled: #60A5FA;
    --bs-app-theme-disabled-border-color: #60A5FA;
    --bs-app-theme-disabled-color: #FFFFFF;
    --bs-app-theme-soft: rgba(37, 99, 235, 0.08);
    --bs-app-theme-gradient: linear-gradient(135deg, #2563EB 0%, #1D4ED8 100%);
}

.bg-blue-theme { background-color: #2563EB !important; }

/* --- Pink — Bold Creative --- */
.theme-pink {
    --bs-app-theme: #FB5597;
    --bs-app-theme-rgb: 251, 85, 151;
    --bs-app-theme-color: #FFFFFF;
    --bs-app-theme-color-rgb: 255, 255, 255;
    --bs-app-theme-hover: #E8407F;
    --bs-app-theme-hover-border-color: #E8407F;
    --bs-app-theme-hover-color: #FFFFFF;
    --bs-app-theme-active: #BC4071;
    --bs-app-theme-active-border-color: #BC4071;
    --bs-app-theme-active-color: #FFFFFF;
    --bs-app-theme-disabled: #FC82B3;
    --bs-app-theme-disabled-border-color: #FC82B3;
    --bs-app-theme-disabled-color: #FFFFFF;
    --bs-app-theme-soft: rgba(251, 85, 151, 0.08);
    --bs-app-theme-gradient: linear-gradient(135deg, #FB5597 0%, #E91E63 100%);
}

/* ===================================================
   THEME SYSTEM - Supports multiple themes + Dark Mode
   =================================================== */

/* --- Theme Panel --- */
.theme-panel .theme-list {
    display: flex;
    gap: 10px;
    justify-content: center;
    padding: 5px 0;
}

.theme-panel .theme-list-item {
    position: relative;
}

.theme-panel .theme-list-link {
    width: 40px !important;
    height: 40px !important;
    border-radius: 50% !important;
    border: 3px solid transparent !important;
    transition: all 0.2s ease !important;
    box-shadow: 0 2px 6px rgba(0,0,0,.15);
}

.theme-panel .theme-list-item.active .theme-list-link {
    border-color: var(--bs-app-theme, #00acac) !important;
    transform: scale(1.15);
    box-shadow: 0 3px 10px rgba(0,0,0,.25);
}

.theme-panel .theme-list-link:hover {
    transform: scale(1.1);
    box-shadow: 0 3px 10px rgba(0,0,0,.2);
}

.theme-panel .theme-collapse-btn {
    background: var(--bs-app-theme, #00acac) !important;
    color: #fff !important;
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-start-start-radius: 50%;
    border-end-start-radius: 50%;
    border-start-end-radius: 0;
    border-end-end-radius: 0;
    box-shadow: -2px 2px 8px rgba(0,0,0,.2);
    transition: all 0.3s ease;
}

.theme-panel .theme-collapse-btn:hover {
    width: 48px;
}

.theme-panel .theme-panel-content h5 {
    color: var(--bs-app-theme, #00acac);
    border-bottom: 2px solid var(--bs-app-theme, #00acac);
    padding-bottom: 10px;
}

/* --- Global Theme Color Integration --- */

/* Buttons */
.btn-theme,
.btn-primary {
    background-color: var(--bs-app-theme) !important;
    border-color: var(--bs-app-theme) !important;
    color: var(--bs-app-theme-color, #fff) !important;
    transition: all 0.2s ease;
}

.btn-theme:hover, .btn-theme:focus,
.btn-primary:hover, .btn-primary:focus {
    background-color: var(--bs-app-theme-hover) !important;
    border-color: var(--bs-app-theme-hover-border-color) !important;
}

/* Nav links and active states */
.nav-link.active,
.nav-pills .nav-link.active {
    background-color: var(--bs-app-theme) !important;
    color: var(--bs-app-theme-color, #fff) !important;
}

/* Form focus & check styles — MOVED to daaem-design-system.css
   (unified Form Design System). See section: FORM DESIGN SYSTEM. */

/* Pagination (theme color overrides) — unified styling lives below.
   These overrides ensure the active page picks up the user's theme color. */
.page-item.active .page-link {
    background-color: var(--bs-app-theme) !important;
    border-color: var(--bs-app-theme) !important;
    color: var(--bs-app-theme-color, #fff) !important;
}

/* Progress */
.progress-bar {
    background-color: var(--bs-app-theme) !important;
}

/* Badges */
.badge.bg-theme {
    background-color: var(--bs-app-theme) !important;
    color: var(--bs-app-theme-color, #fff) !important;
}

/* Sidebar active */
.app-sidebar .menu-item.active > .menu-link {
    color: var(--bs-app-theme) !important;
}

.app-sidebar .menu-item.active > .menu-link .menu-icon {
    color: var(--bs-app-theme) !important;
}

.app-sidebar::-webkit-scrollbar-thumb {
    background-color: rgba(var(--bs-app-theme-rgb), 0.3);
    border-radius: 4px;
}

/* Panel header accent — disabled for cleaner modern look.
   Panel styling is now in daaem-design-system.css (section 19). */

/* Selection color */
::selection {
    background-color: rgba(var(--bs-app-theme-rgb), 0.3);
    color: inherit;
}

/* Spinner */
.spinner-border {
    color: var(--bs-app-theme) !important;
}

/* Alert links */
.alert a {
    color: var(--bs-app-theme);
    font-weight: 600;
}

/* Breadcrumb */
.breadcrumb-item.active {
    color: var(--bs-app-theme);
}

/* Dropdown active */
.dropdown-item.active,
.dropdown-item:active {
    background-color: var(--bs-app-theme) !important;
    color: var(--bs-app-theme-color, #fff) !important;
}

/* DataTables theme */
table.dataTable thead .sorting_asc::after,
table.dataTable thead .sorting_desc::after {
    color: var(--bs-app-theme) !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background: var(--bs-app-theme) !important;
    border-color: var(--bs-app-theme) !important;
    color: var(--bs-app-theme-color, #fff) !important;
}

/* Select2 theme */
.select2-container--default .select2-results__option--highlighted[aria-selected],
.select2-container--bootstrap4 .select2-results__option--highlighted {
    background-color: var(--bs-app-theme) !important;
    color: var(--bs-app-theme-color, #fff) !important;
}

.select2-container--default .select2-selection--single:focus,
.select2-container--bootstrap4.select2-container--focus .select2-selection {
    border-color: var(--bs-app-theme) !important;
}

.select2-container--bootstrap4 .select2-results__option--highlighted,
.select2-container--bootstrap4 .select2-results__option--highlighted.select2-results__option[aria-selected=true] {
    background-color: var(--bs-app-theme) !important;
}

.select2-container--default .select2-results__option--highlighted[aria-selected] {
    background-color: var(--bs-app-theme) !important;
}

/* Toast */
.toast-success {
    background-color: var(--bs-app-theme) !important;
}

/* Datepicker theme */
.datepicker table tr td.active,
.datepicker table tr td.active:hover,
.datepicker table tr td span.active,
.datepicker table tr td span.active:hover {
    background-color: var(--bs-app-theme) !important;
    border-color: var(--bs-app-theme) !important;
}

.datepicker table tr td.active:hover, .datepicker table tr td.active:hover:hover,
.datepicker table tr td.active.disabled:hover, .datepicker table tr td.active.disabled:hover:hover,
.datepicker table tr td.active:focus, .datepicker table tr td.active:hover:focus,
.datepicker table tr td.active.disabled:focus, .datepicker table tr td.active.disabled:hover:focus,
.datepicker table tr td.active:active, .datepicker table tr td.active:hover:active,
.datepicker table tr td.active.disabled:active, .datepicker table tr td.active.disabled:hover:active,
.datepicker table tr td.active.active, .datepicker table tr td.active:hover.active,
.datepicker table tr td.active.disabled.active, .datepicker table tr td.active.disabled:hover.active {
    background-color: var(--bs-app-theme) !important;
    border-color: var(--bs-app-theme) !important;
}

.datepicker table tr td span.active:hover, .datepicker table tr td span.active:hover:hover,
.datepicker table tr td span.active.disabled:hover, .datepicker table tr td span.active.disabled:hover:hover,
.datepicker table tr td span.active:focus, .datepicker table tr td span.active:hover:focus,
.datepicker table tr td span.active.disabled:focus, .datepicker table tr td span.active.disabled:hover:focus,
.datepicker table tr td span.active:active, .datepicker table tr td span.active:hover:active,
.datepicker table tr td span.active.disabled:active, .datepicker table tr td span.active.disabled:hover:active,
.datepicker table tr td span.active.active, .datepicker table tr td span.active:hover.active,
.datepicker table tr td span.active.disabled.active, .datepicker table tr td span.active.disabled:hover.active {
    background-color: var(--bs-app-theme) !important;
    border-color: var(--bs-app-theme) !important;
}

/* Date range picker */
.daterangepicker .ranges li.active,
.daterangepicker .ranges li:hover {
    background: var(--bs-app-theme);
    border: 1px solid var(--bs-app-theme);
}

/* ===================================================
   DARK MODE
   =================================================== */

[data-bs-theme=dark] body,
[data-bs-theme=dark] {
    background-color: var(--ds-bg, #161a1d);
}

[data-bs-theme=dark] .app-content {
    background-color: #1a1f24;
}

/* Dark mode card shadow */
[data-bs-theme=dark] .card {
    box-shadow: 0 2px 8px rgba(0,0,0,.3);
}

/* Tables — dark mode using design tokens */
[data-bs-theme=dark] .table {
    color: var(--ds-text, #e8eaed);
}

[data-bs-theme=dark] .table th {
    background-color: var(--ds-surface, #1e2328);
    color: var(--ds-text, #e8eaed);
    border-color: var(--ds-border, #3d4852);
}

[data-bs-theme=dark] .table td {
    border-color: var(--ds-border, #3d4852);
}

[data-bs-theme=dark] .table-striped > tbody > tr:nth-of-type(odd) {
    background-color: rgba(255,255,255,.03);
}

[data-bs-theme=dark] .table-hover > tbody > tr:hover {
    background-color: rgba(var(--bs-app-theme-rgb, 249,199,79), .04);
}

/* Dark mode form controls — MOVED to daaem-design-system.css */

/* Dropdowns — dark mode using design tokens */
[data-bs-theme=dark] .dropdown-menu {
    background-color: var(--ds-surface-muted, #2d353c);
    border-color: var(--ds-border-strong, #4d5a66);
    box-shadow: 0 4px 12px rgba(0,0,0,.4);
}

[data-bs-theme=dark] .dropdown-item {
    color: var(--ds-text, #e8eaed);
}

[data-bs-theme=dark] .dropdown-item:hover {
    background-color: var(--ds-surface-alt, #252b31);
    color: var(--ds-text, #e8eaed);
}

[data-bs-theme=dark] .dropdown-divider {
    border-top-color: var(--ds-border, #3d4852);
}

/* Modals — dark mode */
[data-bs-theme=dark] .modal-content {
    background-color: var(--ds-surface-muted, #2d353c);
    border-color: var(--ds-border, #3d4852);
}

[data-bs-theme=dark] .modal-header {
    border-bottom-color: var(--ds-border, #3d4852);
}

[data-bs-theme=dark] .modal-footer {
    border-top-color: var(--ds-border, #3d4852);
}

/* Alerts — dark mode (softer backgrounds, readable text) */
[data-bs-theme=dark] .alert { border-width: 1px; }

[data-bs-theme=dark] .alert-success {
    background-color: rgba(22,163,74,.12);
    border-color: rgba(22,163,74,.25);
    color: #86efac;
}

[data-bs-theme=dark] .alert-danger {
    background-color: rgba(220,38,38,.12);
    border-color: rgba(220,38,38,.25);
    color: #fca5a5;
}

[data-bs-theme=dark] .alert-warning {
    background-color: rgba(245,158,11,.12);
    border-color: rgba(245,158,11,.25);
    color: #fbbf24;
}

[data-bs-theme=dark] .alert-info {
    background-color: rgba(var(--bs-app-theme-rgb, 249,199,79), .1);
    border-color: rgba(var(--bs-app-theme-rgb, 249,199,79), .2);
    color: var(--bs-app-theme, #F9C74F);
}

/* Breadcrumbs */
[data-bs-theme=dark] .breadcrumb { background-color: transparent; }
[data-bs-theme=dark] .breadcrumb-item a { color: var(--bs-app-theme); }

/* Text utilities */
[data-bs-theme=dark] .text-dark { color: var(--ds-text, #e8eaed) !important; }
[data-bs-theme=dark] .text-muted { color: var(--ds-text-muted, #6c757d) !important; }

/* List groups */
[data-bs-theme=dark] .list-group-item {
    background-color: var(--ds-surface-muted, #2d353c);
    border-color: var(--ds-border, #3d4852);
    color: var(--ds-text, #e8eaed);
}

[data-bs-theme=dark] .list-group-item:hover {
    background-color: var(--ds-surface-alt, #252b31);
}

/* Select2 — dark mode (inherits from design system but keeping for specificity) */
[data-bs-theme=dark] .select2-container--default .select2-selection--single,
[data-bs-theme=dark] .select2-container--default .select2-selection--multiple {
    background-color: var(--ds-surface, #1e2328);
    border-color: var(--ds-border-strong, #4d5a66);
    color: var(--ds-text, #e8eaed);
}

[data-bs-theme=dark] .select2-container--default .select2-selection--single .select2-selection__rendered {
    color: var(--ds-text, #e8eaed);
}

[data-bs-theme=dark] .select2-dropdown {
    background-color: var(--ds-surface-muted, #2d353c);
    border-color: var(--ds-border-strong, #4d5a66);
}

[data-bs-theme=dark] .select2-container--default .select2-search--dropdown .select2-search__field {
    background-color: #20252a;
    border-color: #495057;
    color: #dee2e6;
}

[data-bs-theme=dark] .dataTables_wrapper .dataTables_filter input,
[data-bs-theme=dark] .dataTables_wrapper .dataTables_length select {
    background-color: #20252a;
    border-color: #495057;
    color: #dee2e6;
}

[data-bs-theme=dark] .dataTables_info {
    color: #adb5bd;
}

[data-bs-theme=dark] .datepicker {
    background-color: #2d353c;
    color: #dee2e6;
}

[data-bs-theme=dark] .datepicker table tr td,
[data-bs-theme=dark] .datepicker table tr th {
    color: #dee2e6;
}

[data-bs-theme=dark] .datepicker table tr td.day:hover {
    background-color: #3d4852;
}

[data-bs-theme=dark] .theme-panel {
    background-color: #2d353c;
    border-color: #495057;
}

[data-bs-theme=dark] .theme-panel .theme-panel-content h5 {
    color: var(--bs-app-theme);
}

[data-bs-theme=dark] .theme-panel-divider {
    border-color: #495057;
}

[data-bs-theme=dark] .theme-panel .control-label.text-dark {
    color: #dee2e6 !important;
}

[data-bs-theme=dark] .theme-panel small.text-dark {
    color: #8b939a !important;
}

[data-bs-theme=dark] ::-webkit-scrollbar {
    width: 8px;
}

[data-bs-theme=dark] ::-webkit-scrollbar-track {
    background: #1a1f24;
}

[data-bs-theme=dark] ::-webkit-scrollbar-thumb {
    background: #495057;
    border-radius: 4px;
}

[data-bs-theme=dark] ::-webkit-scrollbar-thumb:hover {
    background: #6c757d;
}

[data-bs-theme=dark] .badge.bg-white {
    background-color: #495057 !important;
    color: #dee2e6 !important;
}

/* --- Smooth transitions for theme switching --- */
.app-header, .app-sidebar, .app-content,
.panel, .card, .form-control, .form-select,
.btn, .table, .modal-content,
.dropdown-menu, .list-group-item {
    transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

/* ===================================================
   THEME PANEL - Font Family Selector
   =================================================== */
.theme-font-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.theme-font-btn {
    flex: 1 1 calc(50% - 3px);
    padding: 8px 6px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    min-width: 0;
}

.theme-font-btn:hover {
    border-color: var(--bs-app-theme, #00acac);
    background: rgba(var(--bs-app-theme-rgb, 0,172,172), 0.05);
}

.theme-font-btn.active {
    border-color: var(--bs-app-theme, #00acac);
    background: rgba(var(--bs-app-theme-rgb, 0,172,172), 0.1);
    box-shadow: 0 0 0 1px var(--bs-app-theme, #00acac);
}

.theme-font-btn .font-preview {
    font-size: 13px;
    font-weight: 600;
    color: #2d353c;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

[data-bs-theme=dark] .theme-font-btn {
    background: #20252a;
    border-color: #495057;
}

[data-bs-theme=dark] .theme-font-btn:hover {
    background: rgba(var(--bs-app-theme-rgb, 0,172,172), 0.15);
}

[data-bs-theme=dark] .theme-font-btn.active {
    background: rgba(var(--bs-app-theme-rgb, 0,172,172), 0.2);
}

[data-bs-theme=dark] .theme-font-btn .font-preview {
    color: #dee2e6;
}

/* --- Font Size & Border Radius Controls --- */
.theme-font-size-control {
    display: flex;
    align-items: center;
    gap: 8px;
}

.theme-font-size-btn,
.theme-radius-btn {
    width: 30px;
    height: 30px;
    border: 2px solid #e0e0e0;
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    color: #2d353c;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.theme-font-size-btn:hover,
.theme-radius-btn:hover {
    border-color: var(--bs-app-theme, #00acac);
    color: var(--bs-app-theme, #00acac);
    background: rgba(var(--bs-app-theme-rgb, 0,172,172), 0.05);
}

[data-bs-theme=dark] .theme-font-size-btn,
[data-bs-theme=dark] .theme-radius-btn {
    background: #20252a;
    border-color: #495057;
    color: #dee2e6;
}

/* --- Range Slider --- */
.theme-range-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: #e0e0e0;
    outline: none;
    transition: background 0.2s;
    flex: 1;
}

.theme-range-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--bs-app-theme, #00acac);
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,.2);
    transition: transform 0.15s ease;
}

.theme-range-slider::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}

.theme-range-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--bs-app-theme, #00acac);
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,.2);
}

[data-bs-theme=dark] .theme-range-slider {
    background: #495057;
}

[data-bs-theme=dark] .theme-range-slider::-webkit-slider-thumb {
    border-color: #2d353c;
}

/* ===================================================
   MODERN SIDEBAR STYLES - Premium Design
   =================================================== */

/* --- Override sidebar theme variables for modern look --- */
.app-sidebar-modern {
    --sb-bg: var(--bs-app-sidebar-bg, #1e2835);
    --sb-text: var(--bs-app-sidebar-menu-link-color, #a8b6c7);
    --sb-text-hover: var(--bs-app-sidebar-menu-link-hover-color, #fff);
    --sb-active-bg: rgba(var(--bs-app-theme-rgb, 3,143,189), 0.12);
    --sb-active-color: var(--bs-app-theme, #038fbd);
    --sb-icon-color: var(--bs-app-sidebar-menu-icon-color, #637a91);
    --sb-submenu-bg: var(--bs-app-sidebar-menu-submenu-bg, rgba(0,0,0,0.15));
    --sb-radius: 10px;
    --sb-spacing: 8px;
    box-shadow: 2px 0 24px rgba(0,0,0,.06) !important;
    border: none !important;
    transition: box-shadow 0.3s ease;
}

[data-bs-theme=dark] .app-sidebar-modern {
    box-shadow: 2px 0 28px rgba(0,0,0,.3) !important;
}

/* ========== PROFILE SECTION ========== */
.sidebar-profile-modern {
    padding: 0 !important;
    margin-bottom: 6px !important;
    background: transparent !important;
    overflow: visible !important;
}

.sidebar-profile-modern .menu-profile-link {
    margin: 0 !important;
    padding: 0 !important;
    display: block !important;
    overflow: visible !important;
}

.sidebar-profile-modern .menu-profile-link:hover {
    background: transparent !important;
}

.sidebar-profile-cover-modern {
    background: linear-gradient(135deg,
        rgba(var(--bs-app-theme-rgb, 3,143,189), .85) 0%,
        rgba(var(--bs-app-theme-rgb, 3,143,189), .55) 100%) !important;
    height: 70px !important;
    position: relative !important;
    top: auto !important;
    left: auto !important;
    right: auto !important;
    bottom: auto !important;
    display: block !important;
    overflow: hidden;
    border-radius: 0 !important;
}

/* Decorative pattern on cover */
.sidebar-cover-pattern {
    position: absolute;
    inset: 0;
    overflow: hidden;
}

.sidebar-cover-pattern::before {
    content: '';
    position: absolute;
    top: -30px;
    right: -20px;
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: rgba(255,255,255,.06);
}

.sidebar-cover-pattern::after {
    content: '';
    position: absolute;
    bottom: -35px;
    left: -15px;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: rgba(255,255,255,.04);
}

.sidebar-profile-content {
    position: relative;
    z-index: 2;
    display: flex !important;
    justify-content: center;
    margin-top: -30px;
    padding: 0 14px;
}

/* ========== AVATAR ========== */
.sidebar-avatar-modern {
    width: 60px !important;
    height: 60px !important;
    min-width: 60px !important;
    min-height: 60px !important;
    border-radius: 50% !important;
    border: 3px solid var(--bs-app-sidebar-bg, #1e2835) !important;
    box-shadow: 0 4px 14px rgba(0,0,0,.25) !important;
    overflow: hidden !important;
    transition: all 0.3s cubic-bezier(.4,0,.2,1);
    flex-shrink: 0;
    position: relative;
    background: var(--bs-app-sidebar-bg, #1e2835);
    margin-bottom: 0 !important;
}

.sidebar-avatar-modern:hover {
    box-shadow: 0 6px 20px rgba(0,0,0,.3) !important;
    transform: scale(1.05);
}

.sidebar-avatar-modern img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    border-radius: 50% !important;
    display: block !important;
}

.sidebar-avatar-initials {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: linear-gradient(135deg,
        rgba(var(--bs-app-theme-rgb, 3,143,189), 1),
        rgba(var(--bs-app-theme-rgb, 3,143,189), .65)) !important;
    color: #fff !important;
    font-size: 18px !important;
    font-weight: 700 !important;
    letter-spacing: 1.5px;
    overflow: hidden !important;
}

.sidebar-avatar-initials > span:first-child {
    line-height: 1;
    text-shadow: 0 1px 3px rgba(0,0,0,.15);
}

/* ========== PROFILE NAME ROW ========== */
.sidebar-profile-name-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 14px 10px;
    position: relative;
    z-index: 2;
}

.sidebar-user-name {
    font-weight: 600;
    font-size: 13.5px;
    color: var(--bs-app-sidebar-profile-color, #fff);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
    max-width: 160px;
    text-align: center;
}

.sidebar-profile-name-row .menu-caret {
    flex-shrink: 0;
    opacity: .5;
    transition: opacity 0.2s ease;
}

.sidebar-profile-modern .menu-profile-link:hover .sidebar-profile-name-row .menu-caret {
    opacity: 1;
}

/* ========== PROFILE DROPDOWN ========== */
.sidebar-profile-dropdown {
    background: rgba(0,0,0,.1);
    margin: 0 var(--sb-spacing) 2px;
    border-radius: 0 0 var(--sb-radius) var(--sb-radius);
    overflow: hidden;
    padding: 4px 0;
    backdrop-filter: blur(4px);
}

[data-bs-theme=dark] .sidebar-profile-dropdown {
    background: rgba(0,0,0,.2);
}

.sidebar-profile-menu-link {
    border-radius: 8px !important;
    margin: 1px 8px !important;
    padding: 7px 10px !important;
    transition: all 0.2s cubic-bezier(.4,0,.2,1) !important;
}

.sidebar-profile-menu-link:hover {
    background: rgba(var(--bs-app-theme-rgb, 3,143,189), 0.1) !important;
}

.sidebar-profile-menu-icon {
    width: 30px !important;
    height: 30px !important;
    min-width: 30px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 8px !important;
    background: rgba(var(--bs-app-theme-rgb, 3,143,189), 0.1) !important;
    color: var(--sb-active-color) !important;
    font-size: 13px !important;
    transition: all 0.2s ease !important;
}

.sidebar-profile-menu-link:hover .sidebar-profile-menu-icon {
    background: rgba(var(--bs-app-theme-rgb, 3,143,189), 0.18) !important;
    transform: scale(1.05);
}

/* Logout button styling */
.sidebar-logout-form {
    margin: 0;
    padding: 0;
}

.sidebar-logout-btn {
    width: 100%;
    background: none !important;
    border: none !important;
    cursor: pointer;
    text-align: start;
    display: flex !important;
    align-items: center;
}

.sidebar-logout-icon {
    background: rgba(239, 68, 68, 0.1) !important;
    color: #ef4444 !important;
}

.sidebar-logout-btn:hover .sidebar-logout-icon {
    background: rgba(239, 68, 68, 0.18) !important;
    color: #ef4444 !important;
}

.sidebar-logout-btn:hover {
    background: rgba(239, 68, 68, 0.06) !important;
}

/* ========== INLINE SEARCH ========== */
.sidebar-inline-search {
    padding: 6px var(--sb-spacing) 10px;
    margin-bottom: 0 !important;
}

.sidebar-search-wrapper {
    position: relative;
}

.sidebar-search-icon {
    position: absolute;
    top: 50%;
    inset-inline-start: 12px;
    transform: translateY(-50%);
    color: rgba(var(--bs-app-sidebar-component-color-rgb, 168,182,199), 0.35);
    font-size: 12px;
    pointer-events: none;
    transition: color 0.2s ease;
    z-index: 1;
}

/* RTL search icon — now handled by inset-inline-start in main rules */

.sidebar-search-input {
    border-radius: var(--sb-radius) !important;
    border: 1.5px solid rgba(var(--bs-app-sidebar-component-color-rgb, 168,182,199), 0.12) !important;
    background: rgba(var(--bs-app-sidebar-component-color-rgb, 168,182,199), 0.06) !important;
    color: var(--bs-app-sidebar-menu-link-hover-color, rgba(255,255,255,.85)) !important;
    padding-block: 8px !important;
    padding-inline-start: 34px !important;
    padding-inline-end: 14px !important;
    font-size: 12.5px !important;
    transition: border-color 0.25s ease, background 0.25s ease, box-shadow 0.25s ease !important;
    width: 100%;
    caret-color: var(--bs-app-theme, #038fbd);
}

/* RTL search input padding — now handled by padding-inline-start/end in main rules */

/* Override global form-control:focus for sidebar search */
.sidebar-search-input:focus,
.app-sidebar .sidebar-search-input:focus {
    border-color: rgba(var(--bs-app-theme-rgb, 3,143,189), 0.3) !important;
    background: rgba(var(--bs-app-sidebar-component-color-rgb, 168,182,199), 0.1) !important;
    box-shadow: none !important;
    outline: none !important;
}

.sidebar-search-input:focus + .sidebar-search-icon,
.sidebar-search-wrapper:focus-within .sidebar-search-icon {
    color: var(--sb-active-color);
}

.sidebar-search-input::placeholder {
    color: rgba(var(--bs-app-sidebar-component-color-rgb, 168,182,199), 0.35) !important;
    font-size: 12px;
}

/* ========== SECTION HEADERS ========== */
.sidebar-section-header {
    font-size: 10px !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    letter-spacing: 1.2px !important;
    color: rgba(var(--bs-app-sidebar-component-color-rgb, 168,182,199), 0.4) !important;
    padding: 14px 20px 6px !important;
    margin: 0 !important;
    line-height: 1.2 !important;
}

/* ========== MENU ITEMS - CORE ========== */
.app-sidebar-modern .menu {
    padding: 0 4px;
}

.app-sidebar-modern .menu > .menu-item {
    margin: 1px 0;
}

.app-sidebar-modern .menu > .menu-item > .menu-link {
    border-radius: var(--sb-radius) !important;
    margin: 0 var(--sb-spacing) !important;
    padding: 8px 12px !important;
    transition: all 0.2s cubic-bezier(.4,0,.2,1) !important;
    position: relative;
    color: var(--sb-text);
}

.app-sidebar-modern .menu > .menu-item > .menu-link:hover {
    background: rgba(var(--bs-app-theme-rgb, 3,143,189), 0.07) !important;
    color: var(--sb-text-hover) !important;
}

/* --- Active State: Theme-colored left/right bar + subtle background --- */
.app-sidebar-modern .menu > .menu-item.active > .menu-link {
    background: var(--sb-active-bg) !important;
    color: var(--sb-active-color) !important;
    position: relative;
}

.app-sidebar-modern .menu > .menu-item.active > .menu-link::after {
    content: '';
    position: absolute;
    inset-inline-start: 0;
    top: 15%;
    bottom: 15%;
    width: 3px;
    background: var(--sb-active-color);
    border-start-start-radius: 0;
    border-end-start-radius: 0;
    border-start-end-radius: 4px;
    border-end-end-radius: 4px;
    box-shadow: 0 0 8px rgba(var(--bs-app-theme-rgb, 3,143,189), 0.4);
}

/* ========== MENU ICONS ========== */
.app-sidebar-modern .menu > .menu-item > .menu-link > .menu-icon {
    width: 34px !important;
    height: 34px !important;
    min-width: 34px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 9px !important;
    font-size: 16px !important;
    transition: all 0.25s cubic-bezier(.4,0,.2,1) !important;
    background: rgba(var(--bs-app-sidebar-component-color-rgb, 168,182,199), 0.08) !important;
    color: var(--sb-icon-color) !important;
    margin-inline-end: 10px;
}

.app-sidebar-modern .menu > .menu-item > .menu-link:hover > .menu-icon {
    background: rgba(var(--bs-app-theme-rgb, 3,143,189), 0.12) !important;
    color: var(--sb-active-color) !important;
    transform: scale(1.06);
}

.app-sidebar-modern .menu > .menu-item.active > .menu-link > .menu-icon {
    background: rgba(var(--bs-app-theme-rgb, 3,143,189), 0.18) !important;
    color: var(--sb-active-color) !important;
    box-shadow: 0 2px 8px rgba(var(--bs-app-theme-rgb, 3,143,189), 0.2);
}

/* ========== MENU TEXT ========== */
.app-sidebar-modern .menu-text {
    font-size: 13.5px !important;
    font-weight: 500;
    letter-spacing: 0.1px;
    line-height: 1.4;
}

.app-sidebar-modern .menu > .menu-item.active > .menu-link .menu-text {
    font-weight: 600 !important;
    color: var(--sb-active-color) !important;
}

/* ========== MENU CARET (Arrow) ========== */
.app-sidebar-modern .menu-caret {
    transition: transform 0.3s cubic-bezier(.4,0,.2,1) !important;
    opacity: 0.5;
    font-size: 12px !important;
}

.app-sidebar-modern .menu-item:hover > .menu-link > .menu-caret {
    opacity: 0.8;
}

.app-sidebar-modern .menu-item.active > .menu-link > .menu-caret {
    color: var(--sb-active-color) !important;
    opacity: 1;
}

/* ========== SUBMENUS ========== */
.app-sidebar-modern .menu-submenu {
    padding-block: 2px !important;
    padding-inline-start: 6px !important;
    padding-inline-end: 0 !important;
    position: relative;
}

/* Vertical connector line for submenus */
.app-sidebar-modern .menu > .menu-item > .menu-submenu::before {
    content: '';
    position: absolute;
    inset-inline-start: 28px;
    top: 4px;
    bottom: 4px;
    width: 1.5px;
    background: linear-gradient(
        to bottom,
        rgba(var(--bs-app-theme-rgb, 3,143,189), 0.15),
        rgba(var(--bs-app-theme-rgb, 3,143,189), 0.05)
    );
    border-radius: 2px;
}

.app-sidebar-modern .menu-submenu > .menu-item > .menu-link {
    border-radius: 8px !important;
    margin-block: 1px !important;
    margin-inline-start: 6px !important;
    margin-inline-end: 8px !important;
    padding: 6px 10px !important;
    transition: all 0.2s cubic-bezier(.4,0,.2,1) !important;
    font-size: 13px;
}

.app-sidebar-modern .menu-submenu > .menu-item > .menu-link:hover {
    background: rgba(var(--bs-app-theme-rgb, 3,143,189), 0.06) !important;
    color: var(--sb-text-hover) !important;
}

.app-sidebar-modern .menu-submenu > .menu-item.active > .menu-link {
    background: rgba(var(--bs-app-theme-rgb, 3,143,189), 0.08) !important;
}

.app-sidebar-modern .menu-submenu > .menu-item.active > .menu-link .menu-text {
    color: var(--sb-active-color) !important;
    font-weight: 600 !important;
}

/* Dot indicator for active submenu item */
.app-sidebar-modern .menu-submenu > .menu-item.active > .menu-link::before {
    content: '';
    position: absolute;
    inset-inline-start: -3px;
    top: 50%;
    transform: translateY(-50%);
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--sb-active-color);
    box-shadow: 0 0 6px rgba(var(--bs-app-theme-rgb, 3,143,189), 0.4);
}

/* Nested submenu (level 2+) */
.app-sidebar-modern .menu-submenu .menu-submenu {
    padding-inline-start: 10px !important;
}

.app-sidebar-modern .menu-submenu .menu-submenu::before {
    inset-inline-start: 4px;
}

/* ========== BADGE ========== */
.app-sidebar-modern .menu-badge {
    background: linear-gradient(135deg, rgba(var(--bs-app-theme-rgb, 3,143,189), 1), rgba(var(--bs-app-theme-rgb, 3,143,189), .7)) !important;
    color: #fff !important;
    padding: 2px 8px !important;
    border-radius: 20px !important;
    font-size: 10px !important;
    font-weight: 600 !important;
    min-width: 22px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(var(--bs-app-theme-rgb, 3,143,189), 0.25);
    line-height: 1.5;
    animation: sidebar-badge-glow 3s ease-in-out infinite;
}

@keyframes sidebar-badge-glow {
    0%, 100% { box-shadow: 0 2px 8px rgba(var(--bs-app-theme-rgb, 3,143,189), 0.2); }
    50% { box-shadow: 0 2px 12px rgba(var(--bs-app-theme-rgb, 3,143,189), 0.35); }
}

/* ========== LABEL ========== */
.app-sidebar-modern .menu-label {
    background: linear-gradient(135deg, #ef4444, #f97316) !important;
    color: #fff !important;
    padding: 2px 7px !important;
    border-radius: 5px !important;
    font-size: 9px !important;
    font-weight: 700 !important;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    line-height: 1.4;
}

/* ========== SEARCH BOX (legacy) ========== */
.sidebar-search-modern {
    padding: 0 var(--sb-spacing) !important;
}

.sidebar-search-modern .form-control {
    border-radius: var(--sb-radius) !important;
    border: 1.5px solid rgba(255,255,255,.08) !important;
    background: rgba(255,255,255,.04) !important;
    color: var(--bs-app-sidebar-menu-link-hover-color, rgba(255,255,255,.85)) !important;
    padding: 9px 14px !important;
    font-size: 13px !important;
    transition: all 0.2s ease !important;
    caret-color: var(--bs-app-theme, #038fbd);
}

.sidebar-search-modern .form-control:focus {
    border-color: rgba(var(--bs-app-theme-rgb, 3,143,189), 0.4) !important;
    background: rgba(255,255,255,.06) !important;
    box-shadow: 0 0 0 3px rgba(var(--bs-app-theme-rgb, 3,143,189), 0.08) !important;
}

.sidebar-search-modern .form-control::placeholder {
    color: rgba(255,255,255,.3) !important;
}

/* ========== SIDEBAR FOOTER ========== */
.sidebar-footer-section {
    margin-top: auto;
    padding-bottom: 4px;
}

.sidebar-footer-divider {
    border-color: rgba(var(--bs-app-sidebar-component-color-rgb, 168,182,199), 0.08) !important;
    margin: 8px 16px 4px !important;
}

/* Tenant badge */
.sidebar-tenant-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 16px 10px;
    font-size: 10.5px;
    color: rgba(var(--bs-app-sidebar-component-color-rgb, 168,182,199), 0.4);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-tenant-badge i {
    font-size: 10px;
    opacity: 0.6;
}

/* ========== MINIFY BUTTON ========== */
.sidebar-minify-modern {
    border-radius: var(--sb-radius) !important;
    width: 34px !important;
    height: 34px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    margin: 10px 14px !important;
    transition: all 0.25s cubic-bezier(.4,0,.2,1) !important;
    background: rgba(var(--bs-app-sidebar-component-color-rgb, 168,182,199), 0.06) !important;
    color: var(--sb-icon-color) !important;
}

.sidebar-minify-modern:hover {
    background: rgba(var(--bs-app-theme-rgb, 3,143,189), 0.12) !important;
    color: var(--sb-active-color) !important;
    transform: scale(1.08);
}

/* ========== DIVIDER ========== */
.app-sidebar-modern .menu-divider {
    border-color: rgba(var(--bs-app-sidebar-component-color-rgb, 168,182,199), 0.06) !important;
    margin: 6px 16px !important;
}

/* ========== CUSTOM SCROLLBAR ========== */
.app-sidebar-modern .app-sidebar-content::-webkit-scrollbar {
    width: 4px;
}

.app-sidebar-modern .app-sidebar-content::-webkit-scrollbar-track {
    background: transparent;
}

.app-sidebar-modern .app-sidebar-content::-webkit-scrollbar-thumb {
    background: rgba(var(--bs-app-sidebar-component-color-rgb, 168,182,199), 0.12);
    border-radius: 10px;
    transition: background 0.2s ease;
}

.app-sidebar-modern .app-sidebar-content::-webkit-scrollbar-thumb:hover {
    background: rgba(var(--bs-app-sidebar-component-color-rgb, 168,182,199), 0.25);
}

/* Firefox scrollbar */
.app-sidebar-modern .app-sidebar-content {
    scrollbar-width: thin;
    scrollbar-color: rgba(var(--bs-app-sidebar-component-color-rgb, 168,182,199), 0.12) transparent;
}

/* ========== RTL SUPPORT ========== */
[dir="rtl"] .app-sidebar-modern {
    border: none !important;
    box-shadow: -2px 0 24px rgba(0,0,0,.06) !important;
}

/* RTL active link indicator — now handled by logical properties in footer section */

/* Menu icon spacing now uses logical properties on the default rule
   so no RTL-specific mirror is needed. */

/* RTL submenu padding — now handled by padding-inline-start/end in main rules */

/* RTL submenu connector — now handled by inset-inline-start in main rules */

/* RTL active submenu dot — now handled by inset-inline-start in main rules */

/* Nested submenu padding now uses logical properties on the default
   rule so no RTL mirror is needed. */

/* RTL nested submenu connector — now handled by inset-inline-start in main rules */

/* RTL logout — text-align: start in base rule handles both directions */

/* ========== MOBILE RESPONSIVE ========== */
@media (max-width: 767.98px) {
    .app-sidebar-modern .menu > .menu-item > .menu-link {
        padding: 10px 14px !important;
    }

    .sidebar-avatar-modern {
        width: 46px !important;
        height: 46px !important;
        border-radius: 12px !important;
    }

    .sidebar-profile-cover-modern {
        height: 70px !important;
    }

    .sidebar-inline-search {
        padding: 4px 6px 6px;
    }

    .sidebar-tenant-badge {
        display: none;
    }
}

/* Light sidebar override for search input text color */
.app-sidebar-light .sidebar-search-input,
[data-bs-app-sidebar-bg="light"] .sidebar-search-input {
    color: #2d353c !important;
    border-color: rgba(0,0,0,.1) !important;
    background: rgba(0,0,0,.03) !important;
}

.app-sidebar-light .sidebar-search-input:focus,
[data-bs-app-sidebar-bg="light"] .sidebar-search-input:focus {
    border-color: rgba(var(--bs-app-theme-rgb, 3,143,189), 0.3) !important;
    background: rgba(0,0,0,.05) !important;
    box-shadow: none !important;
}

.app-sidebar-light .sidebar-search-input::placeholder,
[data-bs-app-sidebar-bg="light"] .sidebar-search-input::placeholder {
    color: rgba(45, 53, 60, 0.4) !important;
}

.app-sidebar-light .sidebar-search-icon,
[data-bs-app-sidebar-bg="light"] .sidebar-search-icon {
    color: rgba(45, 53, 60, 0.35);
}

.app-sidebar-light .sidebar-online-badge,
[data-bs-app-sidebar-bg="light"] .sidebar-online-badge {
    border-color: #fff;
}

/* ===================================================
   MODERN HEADER STYLES - Premium Design
   =================================================== */

.app-header-modern {
    backdrop-filter: blur(12px) saturate(180%);
    -webkit-backdrop-filter: blur(12px) saturate(180%);
    transition: box-shadow 0.3s ease, background-color 0.3s ease;
}

/* ========== BRAND / LOGO ========== */
.header-brand-modern {
    display: flex !important;
    align-items: center !important;
    gap: 8px;
    text-decoration: none !important;
}

.header-brand-logo {
    height: 32px;
    width: auto;
    transition: transform 0.3s cubic-bezier(.4,0,.2,1);
}

.header-brand-modern:hover .header-brand-logo {
    transform: scale(1.05);
}

.header-brand-version {
    font-size: 10px;
    font-weight: 600;
    color: rgba(var(--bs-app-theme-rgb, 3,143,189), 0.7);
    background: rgba(var(--bs-app-theme-rgb, 3,143,189), 0.08);
    padding: 2px 7px;
    border-radius: 6px;
    letter-spacing: 0.3px;
    line-height: 1.4;
}

/* ========== SUBSCRIPTION ALERT ========== */
.header-sub-alert {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 700;
    white-space: nowrap;
    transition: all 0.25s ease;
    cursor: default;
}

.header-sub-alert-danger {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.header-sub-alert-warning {
    background: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.header-sub-alert-info {
    background: rgba(var(--bs-app-theme-rgb, 3,143,189), 0.08);
    color: var(--bs-app-theme, #038fbd);
    border: 1px solid rgba(var(--bs-app-theme-rgb, 3,143,189), 0.15);
}

.header-sub-alert i {
    font-size: 14px;
}

[data-bs-theme=dark] .header-sub-alert-danger {
    background: rgba(239, 68, 68, 0.15);
}

[data-bs-theme=dark] .header-sub-alert-warning {
    background: rgba(245, 158, 11, 0.15);
}

/* ========== LANGUAGE SWITCHER ========== */
.header-lang-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.header-lang-icon {
    position: absolute;
    inset-inline-start: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--bs-app-theme, #038fbd);
    font-size: 13px;
    pointer-events: none;
    z-index: 1;
}

/* RTL lang icon — now handled by inset-inline-start in main rules */

.header-lang-select {
    min-width: 140px !important;
    border-radius: 8px !important;
    font-weight: 600 !important;
    font-size: 0.8rem !important;
    cursor: pointer !important;
    /* 30px reserves space for the language flag/icon on the inline-start side */
    padding-inline-start: 30px !important;
    padding-inline-end: 12px !important;
    border: 1.5px solid rgba(var(--bs-app-theme-rgb, 3,143,189), 0.15) !important;
    background-color: rgba(var(--bs-app-theme-rgb, 3,143,189), 0.04) !important;
    transition: all 0.2s ease !important;
}

.header-lang-select:hover {
    border-color: rgba(var(--bs-app-theme-rgb, 3,143,189), 0.3) !important;
}

.header-lang-select:focus {
    border-color: var(--bs-app-theme, #038fbd) !important;
    box-shadow: 0 0 0 3px rgba(var(--bs-app-theme-rgb, 3,143,189), 0.1) !important;
}

[data-bs-theme=dark] .header-lang-select {
    background-color: rgba(255,255,255,.05) !important;
    border-color: rgba(255,255,255,.1) !important;
    color: #dee2e6 !important;
}

/* ========== ICON BUTTONS (bell, etc.) ========== */
.header-icon-btn {
    position: relative;
    width: 38px;
    height: 38px;
    display: flex !important;
    align-items: center;
    justify-content: center;
    border-radius: 10px !important;
    transition: all 0.2s cubic-bezier(.4,0,.2,1) !important;
}

.header-icon-btn:hover {
    background: rgba(var(--bs-app-theme-rgb, 3,143,189), 0.08) !important;
}

.header-icon-btn i {
    font-size: 17px;
    transition: transform 0.2s ease;
}

.header-icon-btn:hover i {
    transform: scale(1.1);
}

/* ========== NOTIFICATION BADGE ========== */
.header-notification-badge {
    position: absolute !important;
    top: 4px !important;
    inset-inline-end: 2px !important;
    min-width: 18px;
    height: 18px;
    padding: 0 5px !important;
    border-radius: 10px !important;
    font-size: 10px !important;
    font-weight: 700 !important;
    line-height: 18px !important;
    background: linear-gradient(135deg, #ef4444, #f97316) !important;
    color: #fff !important;
    box-shadow: 0 2px 6px rgba(239, 68, 68, 0.3);
    border: 2px solid var(--bs-app-header-bg, #fff);
}

[data-bs-theme=dark] .header-notification-badge {
    border-color: var(--bs-app-header-bg, #1e2835);
}

/* ========== NOTIFICATION DROPDOWN ========== */
.header-notification-dropdown {
    min-width: 320px !important;
    border-radius: 12px !important;
    border: 1px solid rgba(0,0,0,.08) !important;
    box-shadow: 0 10px 40px rgba(0,0,0,.12) !important;
    overflow: hidden;
    padding: 0 !important;
}

[data-bs-theme=dark] .header-notification-dropdown {
    border-color: rgba(255,255,255,.08) !important;
    box-shadow: 0 10px 40px rgba(0,0,0,.3) !important;
}

.header-notification-header {
    padding: 14px 16px !important;
    font-weight: 700 !important;
    font-size: 13px !important;
    background: rgba(var(--bs-app-theme-rgb, 3,143,189), 0.05);
    border-bottom: 1px solid rgba(0,0,0,.06);
    color: var(--bs-app-theme, #038fbd) !important;
}

.header-notification-body {
    max-height: 300px;
    overflow-y: auto;
}

.header-notification-footer {
    padding: 10px 16px !important;
    text-align: center;
    border-top: 1px solid rgba(0,0,0,.06);
    background: rgba(0,0,0,.02);
}

.header-notification-footer a {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--bs-app-theme, #038fbd);
}

.header-notification-footer a:hover {
    opacity: 0.8;
}

/* ========== USER AVATAR (Header) ========== */
.header-user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    overflow: visible;
    position: relative;
    flex-shrink: 0;
    border: 2px solid rgba(var(--bs-app-theme-rgb, 3,143,189), 0.2);
    transition: all 0.25s ease;
}

.header-user-menu:hover .header-user-avatar {
    border-color: rgba(var(--bs-app-theme-rgb, 3,143,189), 0.4);
    box-shadow: 0 2px 10px rgba(var(--bs-app-theme-rgb, 3,143,189), 0.15);
}

.header-user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
}

.header-user-avatar-initials {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg,
        var(--bs-app-theme, #038fbd),
        rgba(var(--bs-app-theme-rgb, 3,143,189), .65));
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 1px;
}

.header-user-online-dot {
    position: absolute;
    bottom: -1px;
    inset-inline-end: -1px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #22c55e;
    border: 2px solid var(--bs-app-header-bg, #fff);
    z-index: 2;
}

[data-bs-theme=dark] .header-user-online-dot {
    border-color: var(--bs-app-header-bg, #1e2835);
}

/* ========== USER INFO (Header) ========== */
.header-user-info {
    display: flex;
    align-items: center;
    gap: 4px;
}

.header-user-greeting {
    font-size: 12.5px;
    opacity: 0.65;
    font-weight: 500;
}

.header-user-fullname {
    font-size: 13px;
    font-weight: 600;
}

/* ========== USER DROPDOWN ========== */
.header-user-dropdown {
    min-width: 260px !important;
    border-radius: 12px !important;
    border: 1px solid rgba(0,0,0,.08) !important;
    box-shadow: 0 10px 40px rgba(0,0,0,.12) !important;
    overflow: hidden;
    padding: 0 !important;
}

[data-bs-theme=dark] .header-user-dropdown {
    border-color: rgba(255,255,255,.08) !important;
    box-shadow: 0 10px 40px rgba(0,0,0,.3) !important;
}

/* User info card in dropdown */
.header-dropdown-user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: linear-gradient(135deg,
        rgba(var(--bs-app-theme-rgb, 3,143,189), 0.06) 0%,
        rgba(var(--bs-app-theme-rgb, 3,143,189), 0.02) 100%);
}

.header-dropdown-avatar {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    overflow: hidden;
    flex-shrink: 0;
    border: 2px solid rgba(var(--bs-app-theme-rgb, 3,143,189), 0.15);
}

.header-dropdown-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.header-dropdown-avatar-initials {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg,
        var(--bs-app-theme, #038fbd),
        rgba(var(--bs-app-theme-rgb, 3,143,189), .65));
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 1px;
}

.header-dropdown-details {
    min-width: 0;
    flex: 1;
}

.header-dropdown-name {
    font-size: 14px;
    font-weight: 700;
    color: inherit;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.header-dropdown-email {
    font-size: 11.5px;
    color: #6c757d;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 1px;
}

[data-bs-theme=dark] .header-dropdown-email {
    color: #8b939a;
}

/* Dropdown items */
.header-dropdown-item {
    padding: 9px 16px !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    transition: all 0.15s ease !important;
    display: flex !important;
    align-items: center !important;
}

.header-dropdown-item:hover {
    background: rgba(var(--bs-app-theme-rgb, 3,143,189), 0.06) !important;
}

.header-dropdown-item-icon {
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: rgba(var(--bs-app-theme-rgb, 3,143,189), 0.08);
    color: var(--bs-app-theme, #038fbd);
    font-size: 12px !important;
    transition: all 0.2s ease;
}

.header-dropdown-item:hover .header-dropdown-item-icon {
    background: rgba(var(--bs-app-theme-rgb, 3,143,189), 0.14);
    transform: scale(1.05);
}

/* Logout item */
.header-dropdown-logout {
    border: none;
    background: none;
    width: 100%;
    cursor: pointer;
}

.header-dropdown-logout .header-dropdown-item-icon {
    background: rgba(239, 68, 68, 0.08) !important;
    color: #ef4444 !important;
}

.header-dropdown-logout:hover {
    background: rgba(239, 68, 68, 0.05) !important;
}

.header-dropdown-logout:hover .header-dropdown-item-icon {
    background: rgba(239, 68, 68, 0.14) !important;
}

/* Dropdown dividers */
.header-user-dropdown .dropdown-divider {
    margin: 4px 12px !important;
    border-color: rgba(0,0,0,.06);
}

[data-bs-theme=dark] .header-user-dropdown .dropdown-divider {
    border-color: rgba(255,255,255,.06);
}

/* ========== HEADER RESPONSIVE ========== */
@media (max-width: 767.98px) {
    .header-sub-alert {
        padding: 4px 8px;
        font-size: 0.72rem;
    }

    .header-sub-alert span {
        display: none;
    }

    .header-lang-switcher {
        display: none !important;
    }

    .header-user-greeting {
        display: none !important;
    }

    .header-notification-dropdown {
        min-width: 280px !important;
    }

    .header-user-dropdown {
        min-width: 240px !important;
    }

    .header-brand-version {
        display: none;
    }
}

/* ===================================================
   COMPACT MODE
   =================================================== */
.app-compact-mode .app-content {
    padding: 10px;
}

.app-compact-mode .panel-body {
    padding: 10px;
}

.app-compact-mode .panel-heading {
    padding: 8px 12px;
}

.app-compact-mode .table th,
.app-compact-mode .table td {
    padding: 6px 8px;
}

.app-compact-mode .form-control,
.app-compact-mode .form-select {
    padding: 4px 8px;
    font-size: 0.9em;
}

.app-compact-mode .btn {
    padding: 4px 10px;
    font-size: 0.9em;
}

.app-compact-mode h1 { font-size: 1.6rem; }
.app-compact-mode h2 { font-size: 1.4rem; }
.app-compact-mode h3 { font-size: 1.2rem; }
.app-compact-mode h4 { font-size: 1.05rem; }
.app-compact-mode h5 { font-size: 0.95rem; }

.app-compact-mode .app-sidebar .menu-link {
    padding: 6px 16px;
}

.app-compact-mode .app-header {
    min-height: 45px;
}

/* ===================================================
   RTL DIRECTION STYLES
   =================================================== */

body.rtls {
    text-align: right;
    direction: rtl;
}

body.rtls h1, body.rtls h2, body.rtls h3,
body.rtls h4, body.rtls h5, body.rtls h6 {
    font-weight: 700;
}

/* --- Boxed layout --- */
body.boxed-layout {
    background: url(../img/iu-triangle.svg);
    background-attachment: fixed;
    background-repeat: no-repeat;
    background-size: cover;
    height: 100%;
    position: relative;
    width: 100%;
    display: table;
}

body.boxed-layout #wrapper {
    background-color: var(--bs-app-theme, #005a85);
}

/* --- Animated dropdown --- */
.dropdown-menu.animated {
    animation-duration: .4s;
    animation-fill-mode: both;
}

/* --- RTL Checkbox / Radio --- */
body.rtls .abc-checkbox {
    cursor: default;
    padding-left: 4px;
}

body.rtls .abc-checkbox label {
    padding-right: 5px;
}

body.rtls .abc-checkbox label::before {
    right: 0;
    margin-right: -1.25rem;
}

body.rtls .abc-checkbox label::after {
    right: 0;
    margin-right: -1.25rem;
    padding-right: 3px;
}

body.rtls .abc-checkbox input[type="checkbox"],
body.rtls .abc-checkbox input[type="radio"] {
    position: static;
    margin-right: 0;
    margin-left: 0;
    cursor: pointer;
    opacity: 0;
    z-index: 1;
}

body.rtls .abc-checkbox input[type="checkbox"]:indeterminate + label::after,
body.rtls .abc-checkbox input[type="radio"]:indeterminate + label::after {
    margin-left: -16.5px;
}

body.rtls .abc-radio {
    padding-left: 4px;
}

body.rtls .abc-radio label {
    padding-right: 5px;
    padding-left: 0;
}

body.rtls .abc-radio label::before {
    left: auto;
    right: 0;
    margin-right: -20px;
    margin-left: 0;
    border: 1px solid #ced4da;
}

body.rtls .abc-radio label::after {
    right: 3px;
    margin-right: -20px;
    margin-left: 0;
}

body.rtls .abc-radio input[type="radio"] {
    margin-left: 0;
}

/* --- RTL Select2 --- */
body.rtls .select2-container--bootstrap4 .select2-selection__clear {
    padding-right: .3em;
    padding-left: 0;
    float: left;
    margin-left: 1.3em;
    margin-right: 0;
}

body.rtls .select2-container--bootstrap4 .select2-selection--single .select2-selection__arrow {
    right: auto;
    left: 3px;
}

/* --- RTL TouchSpin --- */
body.rtls .bootstrap-touchspin .input-group-btn-vertical {
    left: 0;
    right: auto;
}

body.rtls .bootstrap-touchspin .input-group-btn-vertical > .btn {
    left: 0;
    right: auto;
}

body.rtls .bootstrap-touchspin .form-control {
    text-align: right;
}

/* --- General performance --- */
body.homepage {
    background-color: #fff;
    color: #2d353c;
}

.pace .pace-progress {
    background: var(--bs-app-theme, #129ebf);
}

.sk-spinner-wave div,
.sk-spinner-double-bounce .sk-double-bounce1,
.sk-spinner-double-bounce .sk-double-bounce2,
.sk-spinner-rotating-plane.sk-spinner,
.sk-spinner-chasing-dots .sk-dot1,
.sk-spinner-chasing-dots .sk-dot2,
.sk-spinner-pulse.sk-spinner,
.sk-spinner-wandering-cubes .sk-cube1,
.sk-spinner-wandering-cubes .sk-cube2,
.sk-spinner-cube-grid .sk-cube,
.sk-spinner-circle .sk-circle:before,
.sk-spinner-three-bounce div,
.sk-spinner-fading-circle .sk-circle:before {
    background-color: var(--bs-app-theme, #005a85);
}

.IUstyle .select2-container--bootstrap4.select2-container--focus .select2-selection {
    border-color: var(--bs-app-theme, #005a85);
}

.toast {
    background-color: var(--bs-app-theme, #129ebf);
}

.metismenu .fa.arrow:before {
    content: "\f105";
}

.abc-checkbox input[type="checkbox"]:focus + label::before,
.abc-checkbox input[type="radio"]:focus + label::before,
.abc-radio input[type="radio"]:focus + label::before,
.slick-initialized .slick-slide {
    outline: 0;
}

.ui-datepicker-calendar .ui-state-default {
    text-align: center;
}

/* --- RTL Layout Fixes --- */
body.rtls.fixed-sidebar #page-wrapper {
    margin: 0 220px 0 0;
}

body.rtls .metismenu .arrow {
    float: left;
}

body.rtls .IUstyle .navbar-top-links .dropdown-menu > li > a {
    text-align: right;
}

body.rtls .IUstyle .navbar-top-links .dropdown-menu li a i.fa {
    margin: 0 0 0 5px;
}

body.rtls .IUstyle .nav.navbar-top-links .profile-element .name {
    direction: rtl;
}

body.rtls .toast-header i {
    float: left;
}

body.rtls .toast-header strong {
    margin-right: 10px !important;
    margin-left: auto;
}

body.rtls .toast-header {
    direction: rtl;
}

body.rtls .toast-header button.close {
    margin-right: .5rem !important;
    margin-left: 0 !important;
}

body.rtls .knob {
    direction: ltr;
}

body.rtls .noUi-ltr {
    direction: ltr;
}

body.rtls .cropper-container {
    direction: ltr;
}

.slick-slider {
    direction: ltr;
}

body.rtls .input-group.clockpicker .input-group-addon {
    border: 1px solid #E5E6E7;
    border-right: 0;
}

body.rtls .colorpicker {
    right: auto;
}

body.rtls .onoffswitch {
    direction: ltr;
    text-align: left;
}

body.rtls .custom-file-label::after {
    left: 0;
    right: auto;
}

body.rtls .lock-word {
    direction: ltr;
}

body.rtls .todo-list > li .label {
    margin-right: 10px;
    margin-left: 0;
    float: left;
}

body.rtls .input-group > .input-group-append > .btn,
body.rtls .input-group > .input-group-append > .input-group-text,
body.rtls .input-group > .input-group-prepend:first-child > .btn:not(:first-child),
body.rtls .input-group > .input-group-prepend:first-child > .input-group-text:not(:first-child),
body.rtls .input-group > .input-group-prepend:not(:first-child) > .btn,
body.rtls .input-group > .input-group-prepend:not(:first-child) > .input-group-text {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    border-top-left-radius: .25rem;
    border-bottom-left-radius: .25rem;
}

body.rtls .breadcrumb-item + .breadcrumb-item {
    padding-right: .5rem;
    padding-left: 0;
}

body.rtls .breadcrumb-item + .breadcrumb-item::before {
    padding-left: .5rem;
}

/* --- RTL jTable --- */
body.rtls div.jtable-main-container > table.jtable > thead th.jtable-column-header-sorted-asc div.jtable-column-header-container,
body.rtls div.jtable-main-container > table.jtable > thead th.jtable-column-header-sortable div.jtable-column-header-container {
    background-position: left;
}

body.rtls form.jtable-dialog-form div.jtable-checkbox-input span,
body.rtls form.jtable-dialog-form div.jtable-radio-input span {
    padding-left: 0;
    padding-right: 4px;
}

body.rtls .ui-dialog .ui-dialog-title {
    float: right;
    margin: .1em 0 .1em 16px;
}

body.rtls .ui-dialog .ui-dialog-titlebar-close {
    right: auto;
    left: .7em;
    margin: -13px 0 0 0;
}

body.rtls div.jtable-main-container > div.jtable-bottom-panel {
    text-align: right;
}

body.rtls div.jtable-main-container > div.jtable-bottom-panel div.jtable-right-area {
    left: 0;
}

body.rtls div.jtable-main-container > div.jtable-title div.jtable-toolbar {
    right: auto;
    left: 0;
}

body.rtls div.jtable-main-container div.jtable-title {
    text-align: right;
    padding-left: 0;
    padding-right: 10px;
}

body.rtls div.jtable-main-container div.jtable-title .jtable-close-button + div.jtable-toolbar {
    margin-right: 0;
    margin-left: 30px;
}

body.rtls div.jtable-main-container > div.jtable-title .jtable-close-button {
    right: auto;
    left: 8px;
}

body.rtls div.jtable-main-container > div.jtable-bottom-panel span.jtable-page-info {
    float: left;
}

body.rtls div.jtable-main-container div.jtable-column-selection-container ul.jtable-column-select-list li label span {
    margin-right: 4px;
    margin-left: 0;
}

body.rtls div.jtable-main-container table.jtable thead th {
    text-align: right;
}

body.rtls div.jtable-main-container > table.jtable > thead th.jtable-column-header div.jtable-column-header-container {
    margin-left: 0;
    margin-right: 4px;
}

body.rtls .navbar-top-links li:last-child {
    margin-left: 0;
}

body.rtls .metismenu .fa.arrow:before {
    content: "\f104";
}

body.rtls .metismenu .active > a > .fa.arrow:before {
    content: "\f107";
}

body.rtls .invoice {
    text-align: right;
}

body.rtls .label {
    font-family: inherit;
}

body.rtls .lock-word .first-word {
    min-width: 390px;
}

/* --- RTL Wizard --- */
body.rtls .wizard > .actions {
    text-align: left;
}

body.rtls .wizard > .steps > ul > li,
.wizard > .actions > ul > li {
    float: right;
}

/* --- RTL FooTable --- */
body.rtls .footable > thead > tr > th > span.footable-sort-indicator {
    padding-right: 5px;
    padding-left: 0;
}

body.rtls .footable.breakpoint > tbody > tr > td > span.footable-toggle {
    padding-right: 0;
    padding-left: 5px;
    vertical-align: middle;
}

body.rtls .footable.breakpoint.toggle-arrow-tiny > tbody > tr > td > span.footable-toggle:before {
    content: "\e020";
}

/* --- RTL Timeline --- */
@media only screen and (min-width: 1170px) {
    body.rtls .center-orientation .vertical-timeline-content::before {
        right: 100%;
        border-color: transparent;
        border-right-color: white;
    }

    body.rtls .center-orientation .vertical-timeline-content .btn {
        float: right;
    }

    body.rtls .center-orientation .vertical-timeline-content .vertical-date {
        right: 122%;
    }

    body.rtls .center-orientation .vertical-timeline-block:nth-child(even) .vertical-timeline-content {
        float: left;
    }

    body.rtls .center-orientation .vertical-timeline-block:nth-child(even) .vertical-timeline-content::before {
        right: auto;
        left: 100%;
        border-left-color: white;
        border-right: 0;
    }

    body.rtls .center-orientation .vertical-timeline-block:nth-child(even) .vertical-timeline-content .btn {
        float: left;
    }

    body.rtls .center-orientation .vertical-timeline-block:nth-child(even) .vertical-timeline-content .vertical-date {
        right: auto;
        left: 122%;
        text-align: left;
    }
}

/* --- RTL Landing page --- */
body.rtls.landing-page .comments-avatar img {
    margin-right: 0;
    margin-left: 10px;
}

body.rtls.landing-page .bubble:after {
    left: auto;
    right: 30px;
}

body.rtls.landing-page .list-inline-item:not(:last-child) {
    margin-left: .5rem;
    margin-right: 0;
}

/* ===================================================
   ENTERPRISE FOOTER — Modern, Clean, Theme-Aware
   =================================================== */

.app-footer {
    padding: 10px var(--ds-space-5, 20px);
    border-top: 1px solid var(--ds-divider, rgba(0,0,0,.06));
    background-color: var(--ds-surface, #fff);
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.app-footer-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--ds-space-3, 12px);
    max-width: 100%;
}

.app-footer-copyright {
    font-size: var(--ds-fs-xs, 11px);
    font-weight: 500;
    color: var(--ds-text-muted, #6c757d);
    white-space: nowrap;
    letter-spacing: 0.01em;
}

[data-bs-theme=dark] .app-footer {
    background-color: var(--ds-surface, #1e2328);
    border-top-color: var(--ds-border, #3d4852);
}

[data-bs-theme=dark] .app-footer-copyright {
    color: var(--ds-text-muted, #6c757d);
}

/* ===================================================
   HEADER ENHANCEMENTS — RTL Arrow Fix
   =================================================== */

/* Flip the arrow icon in RTL for "View All" links */
[dir="rtl"] .header-footer-arrow {
    transform: scaleX(-1);
}

/* ===================================================
   SIDEBAR MINIFY ICON — RTL Flip
   =================================================== */

/* In RTL mode, the collapse arrow should point right */
[dir="rtl"] .sidebar-minify-icon {
    transform: scaleX(-1);
}

/* Sidebar search, header lang icon, notification badge, and submenu connectors
   now use inset-inline-start / inset-inline-end in their base rules above,
   so no duplicate overrides are needed here. */

/* ===================================================
   IMPROVED RTL SIDEBAR — Remove old overrides
   Now handled by logical properties above
   =================================================== */

/* Override old RTL-specific rules that are now handled generically */
[dir="rtl"] .app-sidebar-modern .menu > .menu-item.active > .menu-link::after {
    left: auto;
    right: auto;
    border-radius: 0;
    border-start-start-radius: 4px;
    border-end-start-radius: 4px;
    border-start-end-radius: 0;
    border-end-end-radius: 0;
}

/* ===================================================
   APP CONTENT AREA — Improved Spacing
   =================================================== */

.app-content {
    min-height: calc(100vh - 52px - 41px);
    padding: var(--ds-space-5, 20px);
}

@media (max-width: 767.98px) {
    .app-content {
        padding: var(--ds-space-3, 12px);
    }
}

/* ===================================================
   HEADER — Modern Backdrop & Separation
   =================================================== */

.app-header-modern {
    border-bottom: 1px solid var(--ds-divider, rgba(0,0,0,.06));
}

[data-bs-theme=dark] .app-header-modern {
    border-bottom-color: var(--ds-border, #3d4852);
}

/* ===================================================
   SIDEBAR RTL DARK MODE SHADOW
   =================================================== */

[data-bs-theme=dark][dir="rtl"] .app-sidebar-modern,
[dir="rtl"] [data-bs-theme=dark] .app-sidebar-modern {
    box-shadow: -2px 0 28px rgba(0,0,0,.3) !important;
}

/* ===================================================
   LOADING SPINNER — Direction-aware margin
   =================================================== */

#loading-spinner {
    margin-inline-start: 10px;
}

/* ===================================================
   SIDEBAR ACCENT PICKER  (dark / light / themed)
   =================================================== */

/* --- Button group --- */
.sidebar-accent-list {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

.sidebar-accent-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 6px 8px;
    border: 1.5px solid rgba(15, 23, 42, .08);
    border-radius: 12px;
    background: #ffffff;
    cursor: pointer;
    transition: all .18s ease;
    color: #475569;
    font-size: .78rem;
    font-weight: 600;
}

.sidebar-accent-btn:hover {
    border-color: rgba(var(--bs-app-theme-rgb, 0,172,172), .4);
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(15, 23, 42, .06);
}

.sidebar-accent-btn.active {
    border-color: var(--bs-app-theme, #00acac);
    background: rgba(var(--bs-app-theme-rgb, 0,172,172), .05);
    color: var(--bs-app-theme, #00acac);
    box-shadow: 0 0 0 2px rgba(var(--bs-app-theme-rgb, 0,172,172), .15);
}

.sidebar-accent-swatch {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    border: 1.5px solid rgba(15, 23, 42, .1);
    display: block;
}

.sidebar-accent-swatch-dark {
    background: linear-gradient(145deg, #1e2835 0%, #0f172a 100%);
}

.sidebar-accent-swatch-light {
    background: linear-gradient(145deg, #ffffff 0%, #f1f5f9 100%);
}

.sidebar-accent-swatch-accent {
    background: linear-gradient(145deg,
        var(--bs-app-theme, #00acac) 0%,
        var(--bs-app-theme-hover, #009090) 100%);
    border-color: transparent;
}

.sidebar-accent-label {
    display: block;
    line-height: 1;
    letter-spacing: .2px;
}

/* ===================================================
   SIDEBAR — LIGHT VARIANT
   Fires when user picks "Light" in the theme panel.
   =================================================== */
html[data-app-sidebar-accent="light"] .app-sidebar,
html[data-app-sidebar-accent="light"] .app-sidebar-modern {
    --sb-bg: #ffffff;
    --sb-text: #4b5563;
    --sb-text-hover: #0f172a;
    --sb-icon-color: #64748b;
    --sb-submenu-bg: rgba(15, 23, 42, .04);
    background: #ffffff !important;
    color: #4b5563 !important;
    border-right: 1px solid rgba(15, 23, 42, .06) !important;
    box-shadow: 2px 0 24px rgba(15, 23, 42, .05) !important;
}

html[data-app-sidebar-accent="light"] .app-sidebar .menu-link,
html[data-app-sidebar-accent="light"] .app-sidebar .menu-header,
html[data-app-sidebar-accent="light"] .app-sidebar .menu-title,
html[data-app-sidebar-accent="light"] .app-sidebar .menu-text {
    color: #475569 !important;
}

html[data-app-sidebar-accent="light"] .app-sidebar .menu-link:hover,
html[data-app-sidebar-accent="light"] .app-sidebar .menu-item.has-sub > .menu-link:hover {
    background: rgba(var(--bs-app-theme-rgb, 0,172,172), .08) !important;
    color: var(--bs-app-theme, #00acac) !important;
}

html[data-app-sidebar-accent="light"] .app-sidebar .menu-item.active > .menu-link {
    background: rgba(var(--bs-app-theme-rgb, 0,172,172), .12) !important;
    color: var(--bs-app-theme, #00acac) !important;
}

html[data-app-sidebar-accent="light"] .app-sidebar .menu-item.active > .menu-link .menu-icon,
html[data-app-sidebar-accent="light"] .app-sidebar .menu-icon {
    color: inherit !important;
}

html[data-app-sidebar-accent="light"] .app-sidebar .menu-divider {
    background: rgba(15, 23, 42, .08) !important;
}

html[data-app-sidebar-accent="light"] .sidebar-search-input {
    color: #0f172a !important;
    background: rgba(15, 23, 42, .04) !important;
    border-color: rgba(15, 23, 42, .08) !important;
}
html[data-app-sidebar-accent="light"] .sidebar-search-input::placeholder {
    color: rgba(15, 23, 42, .4) !important;
}

/* ===================================================
   SIDEBAR — THEMED (ACCENT) VARIANT
   Subtle gradient using the current theme color as tint.
   =================================================== */
html[data-app-sidebar-accent="accent"] .app-sidebar,
html[data-app-sidebar-accent="accent"] .app-sidebar-modern {
    --sb-bg: transparent;
    --sb-text: rgba(255, 255, 255, .85);
    --sb-text-hover: #ffffff;
    --sb-icon-color: rgba(255, 255, 255, .65);
    --sb-submenu-bg: rgba(0, 0, 0, .18);
    /* Override active-state tokens so the theme-colored sidebar doesn't
       render its active item in the same color as its own background.
       Without this, submenu active text picks up var(--bs-app-theme) from
       the default --sb-active-color definition (line ~732) and becomes
       invisible against the theme-colored gradient background. */
    --sb-active-color: #ffffff;
    --sb-active-bg: rgba(255, 255, 255, 0.18);
    background-image: linear-gradient(180deg,
        var(--bs-app-theme-hover, #008c8c) 0%,
        var(--bs-app-theme, #00acac) 55%,
        var(--bs-app-theme-active, #007272) 100%) !important;
    color: #ffffff !important;
    border: none !important;
    box-shadow: 2px 0 28px rgba(15, 23, 42, .18) !important;
}

html[data-app-sidebar-accent="accent"] .app-sidebar .menu-link,
html[data-app-sidebar-accent="accent"] .app-sidebar .menu-header,
html[data-app-sidebar-accent="accent"] .app-sidebar .menu-title,
html[data-app-sidebar-accent="accent"] .app-sidebar .menu-text {
    color: rgba(255, 255, 255, .88) !important;
}

html[data-app-sidebar-accent="accent"] .app-sidebar .menu-header {
    color: rgba(255, 255, 255, .55) !important;
    letter-spacing: .3px;
}

html[data-app-sidebar-accent="accent"] .app-sidebar .menu-icon {
    color: rgba(255, 255, 255, .75) !important;
}

html[data-app-sidebar-accent="accent"] .app-sidebar .menu-link:hover,
html[data-app-sidebar-accent="accent"] .app-sidebar .menu-item.has-sub > .menu-link:hover {
    background: rgba(255, 255, 255, .10) !important;
    color: #ffffff !important;
}

html[data-app-sidebar-accent="accent"] .app-sidebar .menu-item.active > .menu-link {
    background: rgba(255, 255, 255, .18) !important;
    color: #ffffff !important;
    box-shadow: inset 3px 0 0 rgba(255, 255, 255, .75);
}

html[data-app-sidebar-accent="accent"] .app-sidebar .menu-item.active > .menu-link .menu-icon {
    color: #ffffff !important;
}

/* Submenu active row — the shared rule at .app-sidebar-modern level tints
   the background with the theme color, which disappears when the sidebar
   is already theme-colored. Replace it with a white overlay so the active
   child (e.g. "معلومات الشركة" under الرئيسية) stands out visibly. */
html[data-app-sidebar-accent="accent"] .app-sidebar-modern .menu-submenu > .menu-item.active > .menu-link {
    background: rgba(255, 255, 255, 0.16) !important;
}
html[data-app-sidebar-accent="accent"] .app-sidebar-modern .menu-submenu > .menu-item.active > .menu-link .menu-text,
html[data-app-sidebar-accent="accent"] .app-sidebar-modern .menu-submenu > .menu-item.active > .menu-link .menu-icon {
    color: #ffffff !important;
}

html[data-app-sidebar-accent="accent"] .app-sidebar .menu-submenu {
    background: rgba(0, 0, 0, .14) !important;
}

html[data-app-sidebar-accent="accent"] .app-sidebar .menu-divider {
    background: rgba(255, 255, 255, .12) !important;
}

html[data-app-sidebar-accent="accent"] .sidebar-search-input {
    color: #ffffff !important;
    background: rgba(255, 255, 255, .12) !important;
    border-color: rgba(255, 255, 255, .2) !important;
}
html[data-app-sidebar-accent="accent"] .sidebar-search-input::placeholder {
    color: rgba(255, 255, 255, .6) !important;
}
html[data-app-sidebar-accent="accent"] .sidebar-search-input:focus {
    background: rgba(255, 255, 255, .18) !important;
    border-color: rgba(255, 255, 255, .4) !important;
}

html[data-app-sidebar-accent="accent"] .sidebar-search-icon {
    color: rgba(255, 255, 255, .7) !important;
}

html[data-app-sidebar-accent="accent"] .sidebar-profile-cover-modern {
    background: linear-gradient(135deg,
        rgba(255, 255, 255, .25) 0%,
        rgba(255, 255, 255, .08) 100%) !important;
}

/* Smooth cross-fade when switching accents */
.app-sidebar,
.app-sidebar-modern,
.app-sidebar .menu-link,
.sidebar-profile-cover-modern {
    transition: background 0.3s ease, color 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease !important;
}

/* ===================================================
   SIDEBAR — DARK VARIANT (DEFAULT, REFINED)
   Explicit rules so switching back from light/accent
   restores the dark look, AND modernizes spacing,
   typography, hover and active states.
   =================================================== */

/* Default: when the attribute is missing, treat it as "dark" too. */
.app-sidebar,
.app-sidebar-modern,
html[data-app-sidebar-accent="dark"] .app-sidebar,
html[data-app-sidebar-accent="dark"] .app-sidebar-modern {
    --sb-bg: #141b27;
    --sb-bg-2: #0d1320;
    --sb-text: #b0bccd;
    --sb-text-hover: #ffffff;
    --sb-icon-color: #6b7c93;
    --sb-submenu-bg: rgba(0, 0, 0, .22);
}

html[data-app-sidebar-accent="dark"] .app-sidebar,
html[data-app-sidebar-accent="dark"] .app-sidebar-modern,
html:not([data-app-sidebar-accent]) .app-sidebar,
html:not([data-app-sidebar-accent]) .app-sidebar-modern {
    background-image: linear-gradient(180deg, var(--sb-bg) 0%, var(--sb-bg-2) 100%) !important;
    background-color: var(--sb-bg) !important;
    color: var(--sb-text) !important;
    border: none !important;
    box-shadow: 1px 0 0 rgba(255, 255, 255, .04) inset, 2px 0 28px rgba(0, 0, 0, .22) !important;
}

html[data-app-sidebar-accent="dark"] .app-sidebar .menu-link,
html[data-app-sidebar-accent="dark"] .app-sidebar .menu-text,
html[data-app-sidebar-accent="dark"] .app-sidebar .menu-title,
html:not([data-app-sidebar-accent]) .app-sidebar .menu-link,
html:not([data-app-sidebar-accent]) .app-sidebar .menu-text,
html:not([data-app-sidebar-accent]) .app-sidebar .menu-title {
    color: var(--sb-text) !important;
}

html[data-app-sidebar-accent="dark"] .app-sidebar .menu-icon,
html:not([data-app-sidebar-accent]) .app-sidebar .menu-icon {
    color: var(--sb-icon-color) !important;
}

html[data-app-sidebar-accent="dark"] .app-sidebar .menu-header,
html:not([data-app-sidebar-accent]) .app-sidebar .menu-header {
    color: rgba(255, 255, 255, .35) !important;
    letter-spacing: .3px;
}

html[data-app-sidebar-accent="dark"] .app-sidebar .menu-link:hover,
html[data-app-sidebar-accent="dark"] .app-sidebar .menu-item.has-sub > .menu-link:hover,
html:not([data-app-sidebar-accent]) .app-sidebar .menu-link:hover,
html:not([data-app-sidebar-accent]) .app-sidebar .menu-item.has-sub > .menu-link:hover {
    background: rgba(255, 255, 255, .04) !important;
    color: #ffffff !important;
    transform: translateX(0);
}

html[data-app-sidebar-accent="dark"] .app-sidebar .menu-link:hover .menu-icon,
html:not([data-app-sidebar-accent]) .app-sidebar .menu-link:hover .menu-icon {
    color: var(--bs-app-theme, #00acac) !important;
}

html[data-app-sidebar-accent="dark"] .app-sidebar .menu-item.active > .menu-link,
html:not([data-app-sidebar-accent]) .app-sidebar .menu-item.active > .menu-link {
    background: linear-gradient(90deg,
        rgba(var(--bs-app-theme-rgb, 0,172,172), .18) 0%,
        rgba(var(--bs-app-theme-rgb, 0,172,172), .06) 100%) !important;
    color: #ffffff !important;
    box-shadow: inset 3px 0 0 var(--bs-app-theme, #00acac) !important;
    border-radius: 0 !important;
}

html[data-app-sidebar-accent="dark"] .app-sidebar .menu-item.active > .menu-link .menu-icon,
html:not([data-app-sidebar-accent]) .app-sidebar .menu-item.active > .menu-link .menu-icon {
    color: var(--bs-app-theme, #00acac) !important;
}

html[data-app-sidebar-accent="dark"] .app-sidebar .menu-submenu,
html:not([data-app-sidebar-accent]) .app-sidebar .menu-submenu {
    background: var(--sb-submenu-bg) !important;
}

html[data-app-sidebar-accent="dark"] .app-sidebar .menu-divider,
html:not([data-app-sidebar-accent]) .app-sidebar .menu-divider {
    background: rgba(255, 255, 255, .06) !important;
}

/* Search input on dark */
html[data-app-sidebar-accent="dark"] .sidebar-search-input,
html:not([data-app-sidebar-accent]) .sidebar-search-input {
    color: #ffffff !important;
    background: rgba(255, 255, 255, .05) !important;
    border-color: rgba(255, 255, 255, .08) !important;
}
html[data-app-sidebar-accent="dark"] .sidebar-search-input::placeholder,
html:not([data-app-sidebar-accent]) .sidebar-search-input::placeholder {
    color: rgba(255, 255, 255, .35) !important;
}
html[data-app-sidebar-accent="dark"] .sidebar-search-input:focus,
html:not([data-app-sidebar-accent]) .sidebar-search-input:focus {
    background: rgba(255, 255, 255, .08) !important;
    border-color: rgba(var(--bs-app-theme-rgb, 0,172,172), .35) !important;
    box-shadow: 0 0 0 3px rgba(var(--bs-app-theme-rgb, 0,172,172), .12) !important;
}
html[data-app-sidebar-accent="dark"] .sidebar-search-icon,
html:not([data-app-sidebar-accent]) .sidebar-search-icon {
    color: rgba(255, 255, 255, .45) !important;
}

/* Profile cover gradient on dark — uses theme color tint */
html[data-app-sidebar-accent="dark"] .sidebar-profile-cover-modern,
html:not([data-app-sidebar-accent]) .sidebar-profile-cover-modern {
    background: linear-gradient(135deg,
        rgba(var(--bs-app-theme-rgb, 0,172,172), .55) 0%,
        rgba(var(--bs-app-theme-rgb, 0,172,172), .25) 100%) !important;
}

/* ===================================================
   SIDEBAR — SHARED REFINEMENTS (apply in every accent)
   Fluid menu animation + crisp typography.
   =================================================== */

.app-sidebar .menu-link {
    border-radius: 0 !important;
    padding: 10px 16px !important;
    margin: 1px 0 !important;
    font-weight: 500;
    transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease !important;
}

.app-sidebar .menu-link .menu-icon {
    transition: color 0.2s ease, transform 0.25s cubic-bezier(.4,0,.2,1) !important;
}

.app-sidebar .menu-link:hover .menu-icon {
    transform: scale(1.08);
}

.app-sidebar .menu-item.active > .menu-link .menu-icon {
    transform: scale(1.05);
}

/* Submenu indents nicely */
.app-sidebar .menu-submenu .menu-link {
    padding-inline-start: 36px !important;
    font-size: .85rem;
}

/* =========================================================
   ─────────────────────────────────────────────────────────
   DESIGN POLISH LAYER  —  modern, professional, eye-friendly
   ─────────────────────────────────────────────────────────
   Adds subtle refinements on top of the base theme:
     • Softer shadows and borders
     • Consistent radii + focus rings driven by the theme color
     • Smoother motion, tactile hover states
     • Cleaner tables, forms, modals, buttons, scrollbars
     • Dark-mode parity for every refinement
   ========================================================= */

:root {
    /* Shared design tokens */
    --dp-radius-sm: 10px;
    --dp-radius-md: 14px;
    --dp-radius-lg: 18px;
    --dp-shadow-xs: 0 1px 2px rgba(15, 23, 42, .04), 0 1px 3px rgba(15, 23, 42, .05);
    --dp-shadow-sm: 0 2px 4px rgba(15, 23, 42, .04), 0 4px 10px rgba(15, 23, 42, .05);
    --dp-shadow-md: 0 4px 12px rgba(15, 23, 42, .06), 0 8px 24px rgba(15, 23, 42, .06);
    --dp-shadow-lg: 0 8px 24px rgba(15, 23, 42, .08), 0 20px 48px rgba(15, 23, 42, .08);
    --dp-shadow-focus: 0 0 0 3px rgba(var(--bs-app-theme-rgb, 0,172,172), .18);
    --dp-border: rgba(15, 23, 42, .08);
    --dp-border-strong: rgba(15, 23, 42, .12);
    --dp-surface: #ffffff;
    --dp-surface-muted: #f8fafc;
    --dp-text: #0f172a;
    --dp-text-muted: #64748b;
    --dp-ease: cubic-bezier(.4, 0, .2, 1);
}

[data-bs-theme=dark] {
    --dp-shadow-xs: 0 1px 2px rgba(0, 0, 0, .3), 0 1px 3px rgba(0, 0, 0, .35);
    --dp-shadow-sm: 0 2px 4px rgba(0, 0, 0, .35), 0 4px 10px rgba(0, 0, 0, .28);
    --dp-shadow-md: 0 4px 12px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .35);
    --dp-shadow-lg: 0 8px 24px rgba(0, 0, 0, .5), 0 20px 48px rgba(0, 0, 0, .45);
    --dp-border: rgba(255, 255, 255, .08);
    --dp-border-strong: rgba(255, 255, 255, .14);
    --dp-surface: #1b2332;
    --dp-surface-muted: #151c28;
    --dp-text: #e2e8f0;
    --dp-text-muted: #94a3b8;
}

/* ─────────── PAGE HERO / TITLE ─────────── */
.page-hero,
.hero,
.page-header {
    border-radius: var(--dp-radius-lg);
    box-shadow: var(--dp-shadow-sm);
}

h1.page-header,
.page-title,
h4.page-title {
    letter-spacing: -.01em;
}

/* ─────────── CARDS / PANELS ─────────── */
.card,
.panel {
    border: 1px solid var(--dp-border) !important;
    border-radius: var(--dp-radius-md) !important;
    box-shadow: var(--dp-shadow-xs);
    transition: box-shadow .25s var(--dp-ease), transform .25s var(--dp-ease), border-color .2s var(--dp-ease);
    overflow: hidden;
}

.card:hover,
.panel:hover {
    box-shadow: var(--dp-shadow-sm);
}

/* Tighter card-body inheritance (no double borders) */
.card > .card-header,
.panel > .panel-heading {
    border-bottom: 1px solid var(--dp-border) !important;
    background: transparent;
}

/* Hoverable / clickable card variant */
.card.card-hover,
.card.is-interactive {
    cursor: pointer;
}
.card.card-hover:hover,
.card.is-interactive:hover {
    transform: translateY(-2px);
    box-shadow: var(--dp-shadow-md);
    border-color: rgba(var(--bs-app-theme-rgb, 0,172,172), .3) !important;
}

/* ─────────── BUTTONS ─────────── */
.btn {
    border-radius: var(--dp-radius-sm);
    font-weight: 600;
    letter-spacing: .1px;
    transition: transform .15s var(--dp-ease), box-shadow .2s var(--dp-ease),
                background-color .2s var(--dp-ease), color .2s var(--dp-ease),
                border-color .2s var(--dp-ease);
}

.btn:focus-visible,
.btn:focus {
    box-shadow: var(--dp-shadow-focus) !important;
    outline: 0 !important;
}

.btn:active {
    transform: translateY(1px);
}

.btn.btn-theme,
.btn.btn-primary {
    background: var(--bs-app-theme, #00acac);
    border-color: var(--bs-app-theme, #00acac);
    color: var(--bs-app-theme-color, #fff);
    box-shadow: 0 1px 2px rgba(var(--bs-app-theme-rgb, 0,172,172), .25);
}

.btn.btn-theme:hover,
.btn.btn-primary:hover {
    background: var(--bs-app-theme-hover, #009090);
    border-color: var(--bs-app-theme-hover, #009090);
    box-shadow: 0 4px 12px rgba(var(--bs-app-theme-rgb, 0,172,172), .28);
    transform: translateY(-1px);
}

/* Pill buttons keep the pill radius */
.btn.rounded-pill { border-radius: 50rem !important; }

/* Icon buttons stay square + balanced */
.btn.btn-icon {
    width: 2.4rem;
    height: 2.4rem;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* ─────────── FORM INPUTS ─────────── */
.form-control,
.form-select,
.form-check-input {
    border-color: var(--dp-border-strong) !important;
    transition: border-color .2s var(--dp-ease), box-shadow .2s var(--dp-ease),
                background-color .2s var(--dp-ease);
}

.form-control:hover:not(:focus):not(:disabled):not([readonly]),
.form-select:hover:not(:focus):not(:disabled) {
    border-color: rgba(var(--bs-app-theme-rgb, 0,172,172), .35) !important;
}

.form-control:focus,
.form-select:focus,
.form-check-input:focus {
    border-color: var(--bs-app-theme, #00acac) !important;
    box-shadow: var(--dp-shadow-focus) !important;
}

/* Input-group plays well with focus ring */
.input-group:focus-within {
    box-shadow: var(--dp-shadow-focus);
    border-radius: var(--dp-radius-sm);
}
.input-group:focus-within .form-control,
.input-group:focus-within .input-group-text,
.input-group:focus-within .form-select {
    box-shadow: none !important;
    border-color: var(--bs-app-theme, #00acac) !important;
}

.input-group-text {
    background: var(--dp-surface-muted);
    border-color: var(--dp-border-strong);
    color: var(--dp-text-muted);
}

/* Larger labels read easier */
.form-label {
    font-weight: 600;
    color: var(--dp-text);
    margin-bottom: 6px;
    letter-spacing: .1px;
}

/* Checkbox / radio — softer rounded */
.form-check-input {
    border-radius: 6px;
    cursor: pointer;
}
.form-check-input[type=radio] { border-radius: 50%; }
.form-check-input:checked {
    background-color: var(--bs-app-theme, #00acac);
    border-color: var(--bs-app-theme, #00acac);
}

/* Form switch — consistent color, smoother knob */
.form-switch .form-check-input {
    width: 2.4em;
    height: 1.3em;
    border-radius: 9999px !important;
    cursor: pointer;
    transition: background-color .25s var(--dp-ease), border-color .2s var(--dp-ease);
}
.form-switch .form-check-input:checked {
    background-color: var(--bs-app-theme, #00acac);
    border-color: var(--bs-app-theme, #00acac);
}

/* ─────────── TABLES (Bootstrap + DataTables) ─────────── */
.table {
    --bs-table-bg: transparent;
    margin-bottom: 0;
}

.table > :not(caption) > * > * {
    padding: 12px 14px;
}

.table > thead {
    background: var(--dp-surface-muted);
}

.table > thead th {
    font-weight: 700;
    font-size: .82rem;
    letter-spacing: .2px;
    text-transform: none;
    color: var(--dp-text-muted);
    border-bottom: 1px solid var(--dp-border) !important;
    white-space: nowrap;
}

.table > tbody > tr {
    transition: background-color .15s var(--dp-ease);
}

.table > tbody > tr + tr > * {
    border-top: 1px solid var(--dp-border) !important;
}

.table-hover > tbody > tr:hover {
    background: rgba(var(--bs-app-theme-rgb, 0,172,172), .04);
}

.table-striped > tbody > tr:nth-of-type(odd) > * {
    background: var(--dp-surface-muted);
}

/* DataTables wrapper polish */
.dataTables_wrapper .dataTables_length select,
.dataTables_wrapper .dataTables_filter input {
    border: 1px solid var(--dp-border-strong);
    border-radius: var(--dp-radius-sm);
    padding: 6px 10px;
    background: var(--dp-surface);
    color: var(--dp-text);
    transition: border-color .2s var(--dp-ease), box-shadow .2s var(--dp-ease);
}

.dataTables_wrapper .dataTables_length select:focus,
.dataTables_wrapper .dataTables_filter input:focus {
    border-color: var(--bs-app-theme, #00acac);
    box-shadow: var(--dp-shadow-focus);
    outline: 0;
}

/* DataTables LI reset — visuals live on the inner <a class="page-link"> below.
   See unified Pagination block at end of file. */
.dataTables_wrapper .dataTables_paginate .paginate_button,
.dataTables_wrapper .dataTables_paginate .paginate_button:hover,
.dataTables_wrapper .dataTables_paginate .paginate_button.current,
.dataTables_wrapper .dataTables_paginate .paginate_button.current:hover,
.dataTables_wrapper .dataTables_paginate .paginate_button.disabled {
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    color: inherit !important;
}

/* ─────────── MODALS / DIALOGS ─────────── */
.modal-content {
    border: 1px solid var(--dp-border) !important;
    border-radius: var(--dp-radius-lg) !important;
    box-shadow: var(--dp-shadow-lg) !important;
    overflow: hidden;
}

.modal-header {
    border-bottom: 1px solid var(--dp-border) !important;
    padding: 18px 22px;
}

.modal-title {
    font-weight: 700;
    letter-spacing: -.01em;
}

.modal-body { padding: 20px 22px; }

.modal-footer {
    border-top: 1px solid var(--dp-border) !important;
    padding: 14px 22px;
    gap: 6px;
}

.modal-backdrop.show {
    opacity: .45;
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
}

/* ─────────── DROPDOWNS ─────────── */
.dropdown-menu {
    border: 1px solid var(--dp-border) !important;
    border-radius: var(--dp-radius-md) !important;
    box-shadow: var(--dp-shadow-md) !important;
    padding: 6px;
    background: var(--dp-surface);
    animation: dp-pop .18s var(--dp-ease);
}

@keyframes dp-pop {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

.dropdown-item {
    border-radius: 8px;
    padding: 8px 12px;
    transition: background .15s var(--dp-ease), color .15s var(--dp-ease);
}

.dropdown-item:hover,
.dropdown-item:focus {
    background: rgba(var(--bs-app-theme-rgb, 0,172,172), .08);
    color: var(--bs-app-theme, #00acac);
}

.dropdown-item.active,
.dropdown-item:active {
    background: var(--bs-app-theme, #00acac);
    color: var(--bs-app-theme-color, #fff);
}

.dropdown-divider {
    border-color: var(--dp-border);
    margin: 5px 4px;
}

/* ─────────── BADGES ─────────── */
.badge {
    font-weight: 700;
    letter-spacing: .2px;
    padding: .35em .7em;
    border-radius: 6px;
}

.badge.rounded-pill { padding: .35em .9em; }

/* Soft tinted badges that inherit the theme */
.badge.bg-theme-soft {
    background: rgba(var(--bs-app-theme-rgb, 0,172,172), .12);
    color: var(--bs-app-theme, #00acac);
}

/* ─────────── ALERTS / TOASTS ─────────── */
.alert {
    border: 1px solid var(--dp-border);
    border-radius: var(--dp-radius-md);
    padding: 14px 16px;
}

.toast {
    border: 1px solid var(--dp-border);
    border-radius: var(--dp-radius-md);
    box-shadow: var(--dp-shadow-md);
}

/* ─────────── TABS / PILLS ─────────── */
.nav-tabs .nav-link {
    border: none;
    color: var(--dp-text-muted);
    font-weight: 600;
    padding: 10px 14px;
    border-radius: var(--dp-radius-sm) var(--dp-radius-sm) 0 0;
    transition: color .2s var(--dp-ease), background .2s var(--dp-ease);
}

.nav-tabs .nav-link:hover {
    background: rgba(var(--bs-app-theme-rgb, 0,172,172), .06);
    color: var(--bs-app-theme, #00acac);
}

.nav-tabs .nav-link.active {
    color: var(--bs-app-theme, #00acac);
    background: transparent;
    border-bottom: 2px solid var(--bs-app-theme, #00acac);
}

.nav-pills .nav-link {
    border-radius: var(--dp-radius-sm);
    color: var(--dp-text-muted);
    font-weight: 600;
}
.nav-pills .nav-link.active,
.nav-pills .show > .nav-link {
    background: var(--bs-app-theme, #00acac);
    color: var(--bs-app-theme-color, #fff);
}

/* ─────────── BREADCRUMBS ─────────── */
.breadcrumb {
    background: transparent;
    padding: 0;
    margin-bottom: 10px;
}
.breadcrumb-item {
    font-size: .85rem;
    color: var(--dp-text-muted);
}
.breadcrumb-item.active {
    color: var(--dp-text);
    font-weight: 600;
}
.breadcrumb-item + .breadcrumb-item::before {
    color: var(--dp-border-strong);
}

/* ─────────── TOOLTIPS / POPOVERS ─────────── */
.tooltip .tooltip-inner {
    border-radius: 8px;
    padding: 7px 11px;
    font-size: .78rem;
    font-weight: 600;
    letter-spacing: .1px;
    background: #0f172a;
    box-shadow: var(--dp-shadow-sm);
}

.popover {
    border: 1px solid var(--dp-border) !important;
    border-radius: var(--dp-radius-md) !important;
    box-shadow: var(--dp-shadow-md) !important;
}

/* ─────────── SCROLLBARS (webkit) ─────────── */
*::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}
*::-webkit-scrollbar-track {
    background: transparent;
}
*::-webkit-scrollbar-thumb {
    background: rgba(100, 116, 139, .3);
    border-radius: 999px;
    border: 2px solid transparent;
    background-clip: padding-box;
    transition: background .2s ease;
}
*::-webkit-scrollbar-thumb:hover {
    background: rgba(100, 116, 139, .55);
    background-clip: padding-box;
    border: 2px solid transparent;
}

[data-bs-theme=dark] *::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, .2);
    background-clip: padding-box;
    border: 2px solid transparent;
}
[data-bs-theme=dark] *::-webkit-scrollbar-thumb:hover {
    background: rgba(148, 163, 184, .4);
    background-clip: padding-box;
    border: 2px solid transparent;
}

/* ─────────── HEADER REFINEMENTS ─────────── */
.app-header {
    box-shadow: 0 1px 0 var(--dp-border), 0 2px 12px rgba(15, 23, 42, .04);
    backdrop-filter: saturate(1.1);
}

.app-header .header-input-group .form-control {
    border-radius: 9999px;
    background: var(--dp-surface-muted);
    border: 1px solid var(--dp-border);
}

/* ─────────── APP BODY BACKGROUND ─────────── */
body {
    background: var(--dp-surface-muted);
}
[data-bs-theme=dark] body {
    background: #0c1220;
}

/* ─────────── SIDEBAR PROFILE CARD REFINEMENT ─────────── */
.sidebar-profile-modern {
    position: relative;
}

.sidebar-avatar-modern {
    border: 3px solid transparent !important;
    background: linear-gradient(var(--bs-app-sidebar-bg, #141b27), var(--bs-app-sidebar-bg, #141b27)) padding-box,
                linear-gradient(135deg,
                    var(--bs-app-theme, #00acac),
                    var(--bs-app-theme-hover, #009090)) border-box !important;
}

html[data-app-sidebar-accent="light"] .sidebar-avatar-modern {
    background: linear-gradient(#ffffff, #ffffff) padding-box,
                linear-gradient(135deg,
                    var(--bs-app-theme, #00acac),
                    var(--bs-app-theme-hover, #009090)) border-box !important;
}

html[data-app-sidebar-accent="accent"] .sidebar-avatar-modern {
    background: linear-gradient(rgba(255,255,255,.2), rgba(255,255,255,.1)) padding-box,
                linear-gradient(135deg, rgba(255,255,255,.8), rgba(255,255,255,.5)) border-box !important;
}

/* ─────────── MOTION : FOCUS ACCENT ─────────── */
a:focus-visible,
button:focus-visible,
[role="button"]:focus-visible {
    outline: 2px solid rgba(var(--bs-app-theme-rgb, 0,172,172), .6);
    outline-offset: 2px;
    border-radius: 4px;
}

/* ─────────── UTILITIES ─────────── */
.soft-divider {
    height: 1px;
    background: linear-gradient(to right,
        transparent,
        var(--dp-border-strong) 20%,
        var(--dp-border-strong) 80%,
        transparent);
}

.glass-panel {
    background: rgba(255, 255, 255, .65);
    backdrop-filter: blur(14px) saturate(1.4);
    -webkit-backdrop-filter: blur(14px) saturate(1.4);
    border: 1px solid var(--dp-border);
    border-radius: var(--dp-radius-lg);
    box-shadow: var(--dp-shadow-md);
}
[data-bs-theme=dark] .glass-panel {
    background: rgba(21, 28, 40, .65);
}

/* Skeleton loader (for async content) */
.skeleton {
    background: linear-gradient(90deg,
        var(--dp-surface-muted) 25%,
        rgba(15, 23, 42, .06) 37%,
        var(--dp-surface-muted) 63%);
    background-size: 400% 100%;
    animation: dp-skeleton 1.4s ease-in-out infinite;
    border-radius: 8px;
}
@keyframes dp-skeleton {
    0%   { background-position: 100% 50%; }
    100% { background-position: 0 50%; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: .001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .001ms !important;
    }
}

/* =========================================================
   ─────────────────────────────────────────────────────────
   CONSISTENCY + COMFORT REFINEMENTS  (final pass)
   ─────────────────────────────────────────────────────────
   Tunes contrast, rhythm, and motion on top of the polish
   layer so the whole app feels quieter and easier on the
   eye without losing definition.
   ========================================================= */

/* ── Softer text palette (light mode) ──
   Pure #0f172a feels aggressive next to our soft surfaces.
   Drop to slate-700 for body, reserve near-black for headings. */
body,
body, html {
    color: #1f2937;
}

h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6 {
    color: #0f172a;
    letter-spacing: -.005em;
    line-height: 1.35;
}

p, .text-body, .form-text {
    line-height: 1.65;
    color: #334155;
}

.text-muted,
small.text-muted {
    color: var(--dp-text-muted) !important;
}

[data-bs-theme=dark] body,
[data-bs-theme=dark] html {
    color: #e2e8f0;
}
[data-bs-theme=dark] h1,
[data-bs-theme=dark] h2,
[data-bs-theme=dark] h3,
[data-bs-theme=dark] h4,
[data-bs-theme=dark] h5,
[data-bs-theme=dark] h6 {
    color: #f1f5f9;
}
[data-bs-theme=dark] p {
    color: #cbd5e1;
}

/* ── Warmer, subtler app surface ──
   Pure slate-100 can feel clinical. Nudge to a warm off-white that
   keeps contrast but reads more paper-like. */
body {
    background-color: #f4f6fa;
}

[data-bs-theme=dark] body {
    background-color: #0d1422;
}

/* Soft radial vignette behind content (very subtle — helps cards pop) */
.app-content {
    position: relative;
}
.app-content::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: radial-gradient(1100px 520px at 80% -10%,
                rgba(var(--bs-app-theme-rgb, 0,172,172), .04),
                transparent 60%);
    z-index: 0;
}
.app-content > *:not(.modal):not(.offcanvas):not(.toast-container) { position: relative; z-index: 1; }

[data-bs-theme=dark] .app-content::before {
    background: radial-gradient(1100px 520px at 80% -10%,
                rgba(var(--bs-app-theme-rgb, 0,172,172), .06),
                transparent 60%);
}

/* ── Card header rhythm ──
   Bigger, more readable header, tighter vertical rhythm. */
.card-header,
.panel-heading {
    padding: 14px 16px;
    font-weight: 700;
    letter-spacing: .01em;
    background: transparent !important;
}

.card-title {
    font-weight: 700;
    margin-bottom: 2px;
    color: var(--dp-text);
}

.card-subtitle,
.panel-subtitle {
    color: var(--dp-text-muted);
    font-size: .85rem;
    font-weight: 500;
}

/* ── Input height normalization ──
   Consistent 42px inputs so forms feel grid-aligned. */
.form-control,
.form-select {
    min-height: 42px;
    line-height: 1.5;
    font-size: .95rem;
}
.form-control-sm,
.form-select-sm { min-height: 34px; font-size: .85rem; }
.form-control-lg,
.form-select-lg { min-height: 50px; font-size: 1.02rem; }

/* Input-group alignment with the new height */
.input-group > .input-group-text {
    min-height: 42px;
    display: inline-flex;
    align-items: center;
}

/* ── Button height normalization ── */
.btn {
    min-height: 40px;
    padding-inline: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    line-height: 1;
}
.btn-sm { min-height: 32px; padding-inline: 10px; font-size: .82rem; }
.btn-lg { min-height: 48px; padding-inline: 20px; font-size: 1.02rem; }

.btn .fa,
.btn i {
    line-height: 1;
}

/* ── Tables — quieter rows, clearer header ── */
.table > thead th {
    background: transparent !important;
    text-transform: uppercase;
    font-size: .74rem;
    font-weight: 700;
    letter-spacing: .08em;
}

.table > tbody > tr + tr > * {
    border-top: 1px solid rgba(15, 23, 42, .05) !important;
}

.table-hover > tbody > tr {
    transition: background-color .18s var(--dp-ease), transform .18s var(--dp-ease);
}
.table-hover > tbody > tr:hover {
    background: rgba(var(--bs-app-theme-rgb, 0,172,172), .05);
}

[data-bs-theme=dark] .table > tbody > tr + tr > * {
    border-top-color: rgba(255, 255, 255, .06) !important;
}

/* Status dots / chip variants (handy helpers already used in the app) */
.status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 9999px;
    background: var(--dp-text-muted);
    vertical-align: middle;
}
.status-dot.is-on { background: #16a34a; box-shadow: 0 0 0 3px rgba(22, 163, 74, .18); }
.status-dot.is-off { background: #ef4444; box-shadow: 0 0 0 3px rgba(239, 68, 68, .16); }
.status-dot.is-warn { background: #f59e0b; box-shadow: 0 0 0 3px rgba(245, 158, 11, .18); }

/* ── Sidebar : quieter active hue + denser rhythm ── */
.app-sidebar .menu-link {
    font-size: .88rem;
    padding: 9px 16px !important;
}
.app-sidebar .menu-icon {
    width: 22px;
    text-align: center;
    font-size: .95rem;
}

/* Active rail — taper off so it doesn't feel loud */
html:not([data-app-sidebar-accent]) .app-sidebar .menu-item.active > .menu-link,
html[data-app-sidebar-accent="dark"] .app-sidebar .menu-item.active > .menu-link {
    background: linear-gradient(90deg,
        rgba(var(--bs-app-theme-rgb, 0,172,172), .14) 0%,
        rgba(var(--bs-app-theme-rgb, 0,172,172), .02) 85%) !important;
}

/* ── Header subtle polish ── */
.app-header {
    background: rgba(255, 255, 255, .78) !important;
    backdrop-filter: saturate(1.2) blur(10px);
    -webkit-backdrop-filter: saturate(1.2) blur(10px);
    border-bottom: 1px solid var(--dp-border);
}
[data-bs-theme=dark] .app-header {
    background: rgba(18, 24, 38, .7) !important;
    border-bottom-color: rgba(255, 255, 255, .06);
}

/* ── Modal : softer entrance + quieter close button ── */
.modal.fade .modal-dialog {
    transform: translateY(8px) scale(.98);
    transition: transform .25s var(--dp-ease), opacity .2s var(--dp-ease);
}
.modal.show .modal-dialog {
    transform: translateY(0) scale(1);
}

.btn-close {
    opacity: .55;
    transition: opacity .15s ease, background-color .15s ease;
    border-radius: 8px;
}
.btn-close:hover {
    opacity: .9;
    background-color: rgba(15, 23, 42, .05);
}
[data-bs-theme=dark] .btn-close:hover {
    background-color: rgba(255, 255, 255, .08);
}

/* ── List group refinement ── */
.list-group-item {
    border-color: var(--dp-border);
    padding: 12px 14px;
    transition: background-color .15s var(--dp-ease), color .15s var(--dp-ease);
}
.list-group-item:hover {
    background: rgba(var(--bs-app-theme-rgb, 0,172,172), .04);
}
.list-group-item.active {
    background: var(--bs-app-theme, #00acac);
    border-color: var(--bs-app-theme, #00acac);
    color: var(--bs-app-theme-color, #fff);
}

/* ── Pagination (unified — DataTables + Bootstrap pagination) ──
   Buttons sit in a single pill-shaped row instead of detached
   floating squares. Uses a flex container so spacing is uniform
   and visually cohesive in both LTR and RTL. */
.pagination {
    --bs-pagination-padding-x: .75rem;
    --bs-pagination-padding-y: .375rem;
    display: inline-flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: center;
    margin: 0;
}
.page-item,
.pagination .page-item:not(:first-child) {
    margin: 0 !important;
}
.page-link,
.pagination .page-item:not(:first-child) .page-link {
    border-radius: 8px !important;
    margin: 0 !important;
    min-width: 36px;
    height: 36px;
    padding: 0 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--dp-border, rgba(0,0,0,.08)) !important;
    background: transparent;
    color: var(--dp-text);
    font-weight: 600;
    font-size: .85rem;
    line-height: 1;
    transition: background-color .15s var(--dp-ease, ease),
                color .15s var(--dp-ease, ease),
                border-color .15s var(--dp-ease, ease),
                box-shadow .15s var(--dp-ease, ease);
}
.page-link:hover {
    background: rgba(var(--bs-app-theme-rgb, 0,172,172), .1);
    color: var(--bs-app-theme, #00acac);
    border-color: rgba(var(--bs-app-theme-rgb, 0,172,172), .25);
}
.page-link:focus {
    box-shadow: 0 0 0 3px rgba(var(--bs-app-theme-rgb, 0,172,172), .2);
    z-index: 2;
}
.page-item.active .page-link {
    background: var(--bs-app-theme, #00acac);
    border-color: var(--bs-app-theme, #00acac);
    color: var(--bs-app-theme-color, #fff);
    box-shadow: 0 2px 8px rgba(var(--bs-app-theme-rgb, 0,172,172), .3);
}
.page-item.disabled .page-link {
    opacity: .5;
    background: transparent;
    border-color: var(--dp-border, rgba(0,0,0,.06));
    color: var(--dp-text-muted, #98a2af);
}

/* DataTables uses the same pagination markup — keep it tight & flush */
.dataTables_wrapper .dataTables_paginate {
    padding: 6px 4px !important;
    text-align: end;
}
.dataTables_wrapper .dataTables_paginate ul.pagination {
    justify-content: flex-end;
    margin: 0 !important;
}
@media (max-width: 575.98px) {
    .dataTables_wrapper .dataTables_paginate ul.pagination {
        justify-content: center !important;
    }
}

/* ── Empty states (generic container helper) ── */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--dp-text-muted);
}
.empty-state-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    border-radius: 9999px;
    margin: 0 auto 14px;
    background: rgba(var(--bs-app-theme-rgb, 0,172,172), .1);
    color: var(--bs-app-theme, #00acac);
    font-size: 1.4rem;
}
.empty-state-title {
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--dp-text);
    margin-bottom: 4px;
}
.empty-state-text {
    font-size: .9rem;
    line-height: 1.6;
}

/* ── Selection color ── */
::selection {
    background: rgba(var(--bs-app-theme-rgb, 0,172,172), .25);
    color: inherit;
}

/* ── Image + avatar base polish ── */
img.avatar,
.avatar img {
    border-radius: 9999px;
    object-fit: cover;
}

/* ── Link underline-on-hover (subtle) ── */
a:not(.btn):not(.nav-link):not(.dropdown-item):not(.menu-link):not(.page-link) {
    text-decoration: none;
}
a:not(.btn):not(.nav-link):not(.dropdown-item):not(.menu-link):not(.page-link):hover {
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-thickness: 1.5px;
}

/* ── Dark-mode read tint for data-dense surfaces ── */
[data-bs-theme=dark] .card,
[data-bs-theme=dark] .panel,
[data-bs-theme=dark] .modal-content {
    background: #171f2f;
}
[data-bs-theme=dark] .dropdown-menu {
    background: #1b2332;
}

/* ── Sidebar accent transition smoothing ── */
html[data-app-sidebar-accent] .app-sidebar {
    transition: background 0.35s var(--dp-ease),
                background-image 0.35s var(--dp-ease),
                color 0.3s var(--dp-ease),
                box-shadow 0.3s var(--dp-ease) !important;
}
