/* ═══════════════════════════════════════════════════════════════
   MUNSIF ADMIN — Premium Dashboard Theme
   Brand: Forest Green (#328264) × Warm Gold (#C49E4A)
   ═══════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Almarai:wght@300;400;700;800&display=swap');

/* --- 1. CSS Custom Properties (Color System) --- */
:root {
    /* Core Brand */
    --m-green: #328264;
    --m-green-dark: #276852;
    --m-green-hover: #286f55;
    --m-green-light: #4fa983;
    --m-green-btn-hover: #276852;
    --m-gold: #c49e4a;
    --m-gold-ui: #c49e4a;

    /* Surfaces */
    --m-bg: #F4F6F9;
    --m-card: #FFFFFF;
    --m-white: #FFFFFF;
    --m-border: #E5E7EB;

    /* Text */
    --m-text: #1F2937;
    --m-text-sec: #6B7280;
    --m-text-muted: #9CA3AF;

    /* Shadows */
    --m-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --m-shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -1px rgba(0,0,0,0.04);
    --m-shadow-lg: 0 10px 25px -3px rgba(0,0,0,0.08), 0 4px 6px -2px rgba(0,0,0,0.03);

    /* Radius & Transition */
    --m-radius: 12px;
    --m-radius-sm: 8px;
    --m-transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);

    /* ═══ Semantic Component Tokens (Light Mode Defaults) ═══ */
    --action-btn-bg: linear-gradient(135deg, rgba(50,130,100,0.10), rgba(196,158,74,0.10));
    --action-btn-border: rgba(50, 130, 100, 0.18);
    --action-btn-text: var(--m-green-dark);
    --action-btn-icon: #328264;
    --action-btn-hover-bg: var(--m-green);
    --action-btn-hover-border: var(--m-green);
    --progress-track: rgba(0, 0, 0, 0.06);
    --recent-table-row-bg: transparent;
    --recent-table-hover-bg: rgba(50, 130, 100, 0.03);
    --recent-table-border: var(--m-border);
    --ref-read-color: var(--m-green-light);
    --ref-unread-color: #ef4444;
    --table-row-hover-bg: rgba(50,130,100,0.04);
    --m-sidebar-width: 300px;
}

a {
    color: #328264;
    text-decoration: underline;
}

/* --- Page Loading Overlay --- */
body:not(.munsif-page-ready)::before,
body.munsif-page-transition::before {
    content: "جاري تحميل الصفحة...";
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-top: 88px;
    background:
        radial-gradient(circle at 50% 42%, rgba(196, 158, 74, .16), transparent 190px),
        linear-gradient(135deg, rgba(39, 104, 82, .96), rgba(50, 130, 100, .98));
    color: #fff;
    font-family: 'Almarai', sans-serif;
    font-size: 1rem;
    font-weight: 800;
    letter-spacing: .01em;
    text-align: center;
    backdrop-filter: blur(6px);
}

body:not(.munsif-page-ready)::after,
body.munsif-page-transition::after {
    content: "";
    position: fixed;
    top: calc(50% - 34px);
    left: calc(50% - 34px);
    z-index: 1000000;
    width: 68px;
    height: 68px;
    border-radius: 50%;
    border: 5px solid rgba(255, 255, 255, .28);
    border-top-color: var(--m-gold);
    border-inline-start-color: #fff;
    animation: munsif-page-loader-spin .85s linear infinite;
    box-shadow: 0 14px 38px rgba(0, 0, 0, .18);
}

body.munsif-page-ready:not(.munsif-page-transition)::before,
body.munsif-page-ready:not(.munsif-page-transition)::after {
    pointer-events: none;
    opacity: 0;
}

@keyframes munsif-page-loader-spin {
    to {
        transform: rotate(360deg);
    }
}

/* Header Buttons Styling */
.munsif-header-btn {
    background: rgba(50, 130, 100, 0.1) !important;
    border: 1px solid var(--m-green) !important;
    border-radius: 20px !important;
    padding: 5px 15px !important;
    color: var(--m-green) !important;
    font-size: 0.85rem !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    transition: var(--m-transition) !important;
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    white-space: nowrap !important;
    margin: 0 4px !important;
}

.munsif-header-btn:hover {
    background: var(--m-green) !important;
    color: #fff !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 10px rgba(50, 130, 100, 0.2) !important;
}

[data-bs-theme="dark"] .munsif-header-btn {
    border-color: var(--m-gold) !important;
    color: var(--m-gold) !important;
    background: rgba(196, 158, 74, 0.1) !important;
}

[data-bs-theme="dark"] .munsif-header-btn:hover {
    background: var(--m-gold) !important;
    color: #000 !important;
}

/* --- 2. Global Reset & RTL/LTR Direction --- */

body {
    background-color: var(--m-bg) !important;
    font-family: 'Almarai', sans-serif !important;
    -webkit-font-smoothing: antialiased;
    color: var(--m-text) !important;
}

/* منطقة المحتوى — نص داكن قابل للقراءة (الشريط الجانبي يبقى أبيض عبر قواعده) */
.app-content,
.app-main > .app-content,
.content-wrapper,
.content-wrapper .container-fluid,
.content-wrapper .row {
    color: var(--m-text) !important;
}

/* RTL (Arabic) — default Munsif direction */
html[dir="rtl"] body,
html[dir="rtl"] .content-wrapper,
html[dir="rtl"] th {
    direction: rtl;
    text-align: right;
}

/* LTR (English) — override direction when language is switched */
html[dir="ltr"] body,
html[dir="ltr"] .content-wrapper,
html[dir="ltr"] th {
    direction: ltr;
    text-align: left;
}

/* Fix Sidebar Toggle Placement */
[data-lte-toggle="sidebar"], [data-widget="pushmenu"] {
    color: var(--m-green-dark) !important;
}

/* --- Floating Sidebar Toggler --- */
.munsif-floating-toggler {
    position: fixed !important;
    top: 15px !important;
    z-index: 1050 !important;
    background: transparent !important;
    border: none !important;
    color: var(--m-gold) !important;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 5px;
    border-radius: 8px;
}

/* RTL toggler: sits inside the right-side sidebar */
html[dir="rtl"] .munsif-floating-toggler {
    right: 215px !important;
    left: auto !important;
    transition: right 0.5s cubic-bezier(0.25, 1, 0.5, 1), color 0.5s ease-in-out !important;
}

/* LTR toggler: sits inside the left-side sidebar */
html[dir="ltr"] .munsif-floating-toggler {
    left: 215px !important;
    right: auto !important;
    transition: left 0.5s cubic-bezier(0.25, 1, 0.5, 1), color 0.5s ease-in-out !important;
}

.munsif-floating-toggler:hover {
    background: rgba(196, 158, 74, 0.15) !important;
}

/* RTL collapsed: park at far right edge */
html[dir="rtl"] body.sidebar-collapse .munsif-floating-toggler {
    right: 12px !important;
    color: var(--m-green-dark) !important;
}

/* LTR collapsed: park at far left edge */
html[dir="ltr"] body.sidebar-collapse .munsif-floating-toggler {
    left: 12px !important;
    color: var(--m-green-dark) !important;
}

body.sidebar-collapse .munsif-floating-toggler:hover {
    background: rgba(50, 130, 100, 0.1) !important;
}

/* --- 3. Sidebar (Premium Deep Forest) --- */
#jazzy-sidebar,
.main-sidebar,
.app-sidebar {
    /* background: #328264 !important; */
    /* background-image: linear-gradient(180deg, #328264 0%, #276852 100%) !important; */
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.2) !important;
    width: var(--m-sidebar-width) !important;
    position: fixed !important;
    top: 0 !important;
    bottom: 0 !important;
    height: 100dvh !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
}

/* RTL sidebar: pinned to RIGHT */
html[dir="rtl"] #jazzy-sidebar,
html[dir="rtl"] .main-sidebar,
html[dir="rtl"] .app-sidebar {
    right: 0;
    left: auto !important;
    border-left: 1px solid rgba(255,255,255,0.05) !important;
    border-right: none !important;
}

/* LTR sidebar: pinned to LEFT */
html[dir="ltr"] #jazzy-sidebar,
html[dir="ltr"] .main-sidebar,
html[dir="ltr"] .app-sidebar {
    left: 0;
    right: auto !important;
    border-right: 1px solid rgba(255,255,255,0.05) !important;
    border-left: none !important;
}

.sidebar-wrapper {
    padding: 0.75rem 0.5rem;
    scrollbar-color: var(--m-gold) transparent;
    scrollbar-width: thin;
    flex: 1 1 auto !important;
    min-height: 0 !important;
    max-height: 100% !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

.main-sidebar .brand-link,
.app-sidebar .brand-link,
.app-sidebar .app-brand {
    flex: 0 0 auto !important;
}

.app-content,
.content-wrapper {
    min-width: 0 !important;
    overflow-x: hidden !important;
}

/* Brand in sidebar */
.brand-link, .app-brand {
    border-bottom: 1px solid rgba(255,255,255,0.05) !important;
    padding: 1.25rem 1rem !important;
    background: rgba(255,255,255,0.02) !important;
}

.brand-text, .app-brand-text {
    font-weight: 800 !important;
    color: var(--m-white) !important;
    letter-spacing: -0.01em;
    font-size: 1.1rem !important;
}

.sidebar-brand .brand-image.img-circle {
    opacity: 0.9 !important;
    max-height: 2.5rem;
    width: auto;
}

.sidebar-brand .brand-text {
    font-size: 1.1rem !important;
    font-weight: 800 !important;
    color: var(--m-white) !important;
}

/* Sidebar nav headers (App Names) */
.nav-header {
    color: rgba(255,255,255,0.4) !important;
    font-size: 0.6rem !important;
    font-weight: 800 !important;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    padding: 1.25rem 1.25rem 0.5rem !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    opacity: 0.6;
}

/* Sidebar nav links */
.nav-sidebar .nav-link {
    color: #ffffff !important;
    border-radius: 10px !important;
    margin: 3px 8px;
    padding: 0.58rem 0.7rem !important;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 0.80rem;
    display: flex;
    align-items: center;
    border: 1px solid transparent;
}

.nav-sidebar .nav-link i {
    color: #ffffff !important;
    margin-left: 8px;
    font-size: 0.95rem;
    width: 20px;
    text-align: center;
    opacity: 1;
}

.nav-sidebar .nav-link:hover {
    background: rgba(255,255,255,0.05) !important;
    color: var(--m-white) !important;
    transform: translateX(-3px);
    border-color: rgba(255,255,255,0.1);
}

.nav-sidebar .nav-link.active,
.nav-pills .nav-link.active,
.sidebar-wrapper .sidebar-menu>.nav-item>.nav-link.active:not(:hover) {
    background: var(--m-gold) !important;
    color: #183d31 !important; 
    font-weight: 800 !important;
    box-shadow: 0 4px 15px rgba(196,158,74,0.35);
    transform: translateX(-3px);
}

.nav-sidebar .nav-link.active i {
    color: #183d31 !important;
    opacity: 1;
}

.nav-sidebar .nav-link > p {
    margin-right: 10px;
    margin-left: 0;
    white-space: normal !important;
    line-height: 1.45;
    overflow: visible !important;
    text-overflow: clip !important;
    word-break: normal;
}

#jazzy-sidebar {
    z-index: 1035 !important;
}

#jazzy-sidebar,
#jazzy-sidebar .sidebar-wrapper,
#jazzy-navigation,
#jazzy-navigation .nav-item,
#jazzy-navigation .nav-link {
    max-width: 100% !important;
}

#jazzy-navigation .nav-sidebar,
#jazzy-navigation.sidebar-menu {
    width: 100%;
}

#jazzy-navigation .nav-link {
    display: flex !important;
    align-items: center !important;
    min-height: 38px;
}

#jazzy-navigation .nav-link p,
#jazzy-navigation .brand-text,
#jazzy-sidebar .brand-text {
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
    max-width: none !important;
    width: auto !important;
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: clip !important;
    line-height: 1.35 !important;
    font-size: 0.80rem !important;
}

#jazzy-navigation .nav-treeview .nav-link {
    padding-inline-start: 1.15rem !important;
}

/* مجموعات القائمة الجانبية القابلة للطي */
#jazzy-navigation .munsif-sidebar-tree > .nav-treeview {
    display: none;
    padding: 0.2rem 0 0.4rem;
    margin: 0;
    list-style: none;
}

#jazzy-navigation .munsif-sidebar-tree.menu-open > .nav-treeview {
    display: block !important;
}

#jazzy-navigation .munsif-sidebar-tree > .nav-link {
    cursor: pointer;
}

#jazzy-navigation .munsif-sidebar-tree .nav-treeview > .nav-item > .nav-link {
    padding-inline-start: 2rem !important;
    font-size: 0.76rem !important;
    margin: 2px 8px;
}

#jazzy-navigation .munsif-sidebar-tree .nav-treeview .nav-link p {
    color: #ffffff !important;
    opacity: 1 !important;
}

#jazzy-navigation .munsif-sidebar-tree > .nav-link p .right {
    float: inline-start;
    margin-inline-end: 0.35rem;
    transition: transform 0.2s ease;
}

html[dir="rtl"] #jazzy-navigation .munsif-sidebar-tree.menu-open > .nav-link p .right,
html[dir="rtl"] #jazzy-navigation .munsif-sidebar-tree.menu-open > .nav-link > i.right {
    transform: rotate(-90deg);
}

.nav-sidebar .nav-link > .nav-icon {
    font-size: 1rem;
    width: 1.6rem;
    text-align: center;
}

/* Sidebar treeview arrows */
.nav-sidebar .nav-treeview > .nav-item > .nav-link > .right {
    left: 1rem; right: auto;
    transform: rotate(90deg);
}
.nav-item.menu-open > .nav-link > i.right { transform: rotate(0deg); }

/* User panel */
.user-panel {
    padding: 0.75rem;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    display: none !important;
}

/* --- 4. Top Navbar (Issue 3: Header Nav Colors) --- */
/* ─── Top Navbar Alignment (RTL/LTR Aware) ─── */
.main-header, .app-header {
    background: linear-gradient(90deg, #ffffff 0%, rgba(50,130,100,0.08) 100%) !important;
    border-bottom: 2px solid rgba(196,158,74,0.35) !important;
    box-shadow: var(--m-shadow) !important;
    backdrop-filter: blur(8px);
    display: flex !important;
    align-items: center !important;
    width: 100% !important;
    padding: 0 1rem !important;
}

/* مسافة بين الشريط العلوي ومحتوى الصفحة (بعد إخفاء app-content-header) */
nav.app-header.navbar.navbar-expand,
.main-header.navbar.navbar-expand {
    margin-bottom: 0 !important;
}

main.app-main {
    padding-top: 1.15rem !important;
}

.app-main > .app-content,
.content-wrapper > .content {
    padding-top: 1.15rem !important;
}

.app-main > .app-content > .container-fluid,
.app-content > .container-fluid {
    padding-top: .35rem !important;
}

/* Fix Header Icons/Text Colors */
.main-header .nav-link,
.main-header .navbar-nav .nav-link i,
.main-header .navbar-nav .nav-link,
.app-header .nav-link,
.app-header .navbar-nav .nav-link i {
    color: var(--m-green-dark) !important;
    transition: var(--m-transition);
}

.main-header .nav-link:hover,
.main-header .nav-link:hover i {
    color: var(--m-gold) !important;
}

/* Profile Icon / User Menu */
.user-menu .user-image, .user-menu i, .main-header .dropdown-toggle i {
    color: var(--m-green-dark) !important;
}

/* Direction-aware Navbar Nav Alignment */
/* Pushes the utility group (profile, lang, mode) to the 'end' */

/* LTR (English): Push to RIGHT */
html[dir="ltr"] .navbar-nav.ml-auto,
html[dir="ltr"] .navbar-nav.ms-auto,
html[dir="ltr"] .navbar-nav:last-child {
    margin-left: auto !important;
    margin-right: 0 !important;
    flex-direction: row !important;
}

/* RTL (Arabic): Push to LEFT */
html[dir="rtl"] .navbar-nav.ml-auto,
html[dir="rtl"] .navbar-nav.ms-auto,
html[dir="rtl"] .navbar-nav:last-child {
    margin-right: auto !important;
    margin-left: 0 !important;
    flex-direction: row !important;
}

/* Ensure navbar items are properly spaced */
.navbar-nav .nav-item {
    display: flex !important;
    align-items: center !important;
}

/* Dropdown Menu Alignment based on direction */
html[dir="ltr"] .navbar-nav.ml-auto .dropdown-menu,
html[dir="ltr"] .navbar-nav:last-child .dropdown-menu {
    right: 0 !important;
    left: auto !important;
}

html[dir="rtl"] .navbar-nav.ml-auto .dropdown-menu,
html[dir="rtl"] .navbar-nav:last-child .dropdown-menu {
    left: 0 !important;
    right: auto !important;
}



/* --- 6. Content Wrapper (RTL + LTR Direction-Aware Layout) --- */

/* ─── RTL Layout (Arabic) ─── */
html[dir="rtl"] body:not(.sidebar-collapse) .content-wrapper,
html[dir="rtl"] body:not(.sidebar-collapse) .app-content,
html[dir="rtl"] body:not(.sidebar-collapse) .main-header,
html[dir="rtl"] body:not(.sidebar-collapse) .app-header,
html[dir="rtl"] body:not(.sidebar-collapse) .main-footer {
    margin-right: var(--m-sidebar-width) !important;
    margin-left: 0 !important;
    width: calc(100% - var(--m-sidebar-width)) !important;
    max-width: calc(100% - var(--m-sidebar-width)) !important;
    transition: margin-right 0.5s cubic-bezier(0.25, 1, 0.5, 1) !important;
}

html[dir="rtl"] body.sidebar-collapse .content-wrapper,
html[dir="rtl"] body.sidebar-collapse .app-content,
html[dir="rtl"] body.sidebar-collapse .main-header,
html[dir="rtl"] body.sidebar-collapse .app-header,
html[dir="rtl"] body.sidebar-collapse .main-footer {
    margin-right: 0 !important;
    margin-left: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    transition: margin-right 0.5s cubic-bezier(0.25, 1, 0.5, 1) !important;
}

/* ─── LTR Layout (English) ─── */
html[dir="ltr"] body:not(.sidebar-collapse) .content-wrapper,
html[dir="ltr"] body:not(.sidebar-collapse) .app-content,
html[dir="ltr"] body:not(.sidebar-collapse) .main-header,
html[dir="ltr"] body:not(.sidebar-collapse) .app-header,
html[dir="ltr"] body:not(.sidebar-collapse) .main-footer {
    margin-left: var(--m-sidebar-width) !important;
    margin-right: 0 !important;
    width: calc(100% - var(--m-sidebar-width)) !important;
    max-width: calc(100% - var(--m-sidebar-width)) !important;
    transition: margin-left 0.5s cubic-bezier(0.25, 1, 0.5, 1) !important;
}

html[dir="ltr"] body.sidebar-collapse .content-wrapper,
html[dir="ltr"] body.sidebar-collapse .app-content,
html[dir="ltr"] body.sidebar-collapse .main-header,
html[dir="ltr"] body.sidebar-collapse .app-header,
html[dir="ltr"] body.sidebar-collapse .main-footer {
    margin-left: 0 !important;
    margin-right: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    transition: margin-left 0.5s cubic-bezier(0.25, 1, 0.5, 1) !important;
}

/* Force Fluid Dashboard Section */
.container-fluid,
.container,
.content-wrapper > .content,
.content-wrapper > .container-fluid {
    width: 100% !important;
    max-width: 100% !important;
    padding-right: 20px !important;
    padding-left: 20px !important;
    margin: 0 !important;
}

/* Sidebar slide animation — RTL: slides right */
html[dir="rtl"] #jazzy-sidebar,
html[dir="rtl"] .main-sidebar,
html[dir="rtl"] .app-sidebar {
    right: 0 !important;
    left: auto !important;
    transition: right 0.5s cubic-bezier(0.25, 1, 0.5, 1),
                opacity 0.4s ease, visibility 0.5s ease !important;
    visibility: visible !important;
    opacity: 1 !important;
}

html[dir="rtl"] body.sidebar-collapse #jazzy-sidebar,
html[dir="rtl"] body.sidebar-collapse .main-sidebar,
html[dir="rtl"] body.sidebar-collapse .app-sidebar {
    right: -280px !important;
    opacity: 0 !important;
    visibility: hidden !important;
}

/* Sidebar slide animation — LTR: slides left */
html[dir="ltr"] #jazzy-sidebar,
html[dir="ltr"] .main-sidebar,
html[dir="ltr"] .app-sidebar {
    left: 0 !important;
    right: auto !important;
    transition: left 0.5s cubic-bezier(0.25, 1, 0.5, 1),
                opacity 0.4s ease, visibility 0.5s ease !important;
    visibility: visible !important;
    opacity: 1 !important;
}

html[dir="ltr"] body.sidebar-collapse #jazzy-sidebar,
html[dir="ltr"] body.sidebar-collapse .main-sidebar,
html[dir="ltr"] body.sidebar-collapse .app-sidebar {
    left: -280px !important;
    opacity: 0 !important;
    visibility: hidden !important;
}

/* --- 7. Cards --- */
.card {
    border: 1px solid var(--m-border) !important;
    border-radius: var(--m-radius) !important;
    box-shadow: var(--m-shadow) !important;
    transition: var(--m-transition);
    overflow: hidden;
}

.card:hover {
    box-shadow: var(--m-shadow-md) !important;
}

.card-header {
    background: var(--m-card) !important;
    border-bottom: 1px solid var(--m-border) !important;
    font-weight: 700;
    padding: 1rem 1.25rem !important;
}

.card-body { padding: 1.25rem !important; }

/* --- 8. Buttons --- */
.btn-primary, .btn-success, .save-box input[name="_save"] {
    background: linear-gradient(135deg, var(--m-green) 0%, var(--m-green-dark) 100%) !important;
    border: none !important;
    color: var(--m-white) !important;
    border-radius: var(--m-radius-sm) !important;
    font-weight: 700 !important;
    padding: 0.5rem 1.25rem !important;
    transition: var(--m-transition);
    box-shadow: 0 2px 4px rgba(50,130,100,0.2);
}

.btn-primary:hover, .btn-success:hover {
    background: linear-gradient(135deg, var(--m-green-btn-hover) 0%, var(--m-green) 100%) !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(50,130,100,0.3);
}

.btn-info {
    --bs-btn-color: #FFF;
    --bs-btn-bg: var(--m-gold);
    --bs-btn-border-color: var(--m-gold);
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: var(--m-green);
    --bs-btn-hover-border-color: var(--m-green);
    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: var(--m-green);
    --bs-btn-active-border-color: var(--m-green);
    border-radius: var(--m-radius-sm) !important;
}

/* --- 9. Tables (Professional Refinement) --- */
.table, #result_list {
    border-collapse: separate;
    border-spacing: 0;
    width: 100% !important;
}

.table thead th, #result_list thead th {
    background: #328264 !important;
    color: var(--m-white) !important;
    font-weight: 700;
    font-size: 0.85rem;
    padding: 1rem !important;
    border: none !important;
    border-bottom: 2px solid var(--m-gold) !important; /* Premium Gold Accent */
    text-transform: none;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

/* Fix sorting icon colors */
.table thead th a, #result_list thead th a {
    color: var(--m-white) !important;
}

.table thead th:first-child { border-radius: 0 var(--m-radius-sm) 0 0; }
.table thead th:last-child { border-radius: var(--m-radius-sm) 0 0 0; }

/* LTR adjustments for rounded corners */
html[dir="ltr"] .table thead th:first-child { border-radius: var(--m-radius-sm) 0 0 0; }
html[dir="ltr"] .table thead th:last-child { border-radius: 0 var(--m-radius-sm) 0 0; }

.table tbody tr {
    transition: var(--m-transition);
    border-bottom: 1px solid var(--m-border);
}

.table tbody tr:hover {
    background: var(--table-row-hover-bg) !important;
}

.table tbody td {
    padding: 0.875rem 1rem !important;
    vertical-align: middle;
    font-size: 0.925rem !important; /* Increased for readability */
    color: var(--m-text) !important;
}

/* Links inside tables */
.table tbody td a, #result_list td a {
    color: var(--m-green-dark) !important;
    font-weight: 600;
}

.table tbody td a:hover, #result_list td a:hover {
    color: var(--m-gold) !important;
    text-decoration: underline !important;
}

.table tbody tr:last-child td { border-bottom: none; }

/* --- 10. Breadcrumbs --- */
.breadcrumb-item a[href="/admin/"] { font-size: 0; }
.breadcrumb-item a[href="/admin/"]::before {
    content: "الرئيسية";
    font-size: 0.85rem;
    color: var(--m-green);
}

.breadcrumb { font-size: 0.85rem; }

/* --- 11. Forms & Inputs --- */
.form-control, select, input[type="text"], input[type="email"],
input[type="password"], input[type="number"], textarea {
    border: 1px solid var(--m-border) !important;
    border-radius: var(--m-radius-sm) !important;
    padding: 0.5rem 0.75rem !important;
    transition: var(--m-transition);
    font-family: 'Almarai', sans-serif !important;
}

.form-control:focus, select:focus, input:focus, textarea:focus {
    border-color: var(--m-green) !important;
    box-shadow: 0 0 0 3px rgba(50,130,100,0.12) !important;
    outline: none !important;
}

/* --- 12. Pagination --- */
.page-link {
    border-radius: var(--m-radius-sm) !important;
    margin: 0 2px;
    border: 1px solid var(--m-border);
    color: var(--m-green);
    transition: var(--m-transition);
}

.page-item.active .page-link {
    background: var(--m-green) !important;
    border-color: var(--m-green) !important;
}

/* --- 13. Filters Sidebar --- */
#changelist-filter {
    background: var(--m-card);
    border: 1px solid var(--m-border);
    border-radius: var(--m-radius);
    padding: 1rem;
    box-shadow: var(--m-shadow);
}

/* --- Munsif Recent Activity Table & General Admin Tables --- */
.munsif-recent-table a,
#result_list a {
    color: var(--m-green-dark) !important;
    font-weight: 600;
}

.munsif-recent-table a:hover,
#result_list a:hover {
    color: var(--m-gold) !important;
    text-decoration: underline !important;
}

/* --- Card Links & Text Colors (Fix Blue Text Issue) --- */
.card-body, 
.card-body a, 
.munsif-stat-list,
.munsif-stat-list a, 
.munsif-action-card a,
.munsif-kpi-label,
.munsif-kpi-number,
.munsif-kpi-label span {
    color: var(--m-green-dark) !important;
}

.munsif-kpi-label {
    opacity: 0.8;
}

.card-body a:hover {
    color: var(--m-gold) !important;
}

.text-primary {
    color: var(--m-green-dark) !important;
}

.btn-link {
    color: var(--m-green) !important;
}

#changelist-filter h3 {
    color: var(--m-green-dark);
    font-weight: 700;
    font-size: 0.9rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--m-gold);
    margin-bottom: 0.75rem;
}

/* --- 14. Fieldsets --- */
fieldset {
    border: 1px solid var(--m-border) !important;
    border-radius: var(--m-radius) !important;
    padding: 1.25rem !important;
    margin-bottom: 1.5rem !important;
    background: var(--m-card);
}

fieldset legend, fieldset h2 {
    color: var(--m-green-dark) !important;
    font-weight: 700 !important;
    font-size: 1rem !important;
    padding: 0.25rem 0.75rem !important;
    background: transparent !important;
}

/* --- 15. Badges & Alerts --- */
.badge {
    border-radius: 50px;
    font-weight: 700;
    font-size: 0.75rem;
    padding: 0.3em 0.85em;
}

.alert {
    border-radius: var(--m-radius) !important;
    border: none !important;
}

/* --- 16. Footer --- */
.main-footer, .app-footer {
    background: var(--m-card) !important;
    border-top: 1px solid var(--m-border) !important;
    color: var(--m-text-muted);
    font-size: 0.8rem;
    min-width: 0 !important;
    padding: 0.85rem 1.25rem !important;
    overflow-wrap: anywhere;
    white-space: normal !important;
    box-sizing: border-box;
}

html[dir="rtl"] body:not(.sidebar-collapse) .app-footer {
    margin-right: var(--m-sidebar-width) !important;
    margin-left: 0 !important;
    width: calc(100% - var(--m-sidebar-width)) !important;
    max-width: calc(100% - var(--m-sidebar-width)) !important;
}

html[dir="ltr"] body:not(.sidebar-collapse) .app-footer {
    margin-left: var(--m-sidebar-width) !important;
    margin-right: 0 !important;
    width: calc(100% - var(--m-sidebar-width)) !important;
    max-width: calc(100% - var(--m-sidebar-width)) !important;
}

body.sidebar-collapse .app-footer {
    margin-right: 0 !important;
    margin-left: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
}

/* --- 17. Login Page --- */
.login-page {
    background: linear-gradient(135deg, var(--m-green-dark) 0%, var(--m-green) 50%, var(--m-gold) 100%) !important;
}

.login-box .card, .login-card-body {
    border-radius: var(--m-radius) !important;
    box-shadow: var(--m-shadow-lg) !important;
}

/* --- 18. Scrollbar --- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: var(--m-gold);
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover { background: var(--m-green); }

/* --- 19. Selection Color --- */
::selection {
    background: var(--m-gold);
    color: var(--m-green-dark);
}

/* --- 20. Background overrides --- */
.bg-body-secondary {
    --bs-bg-opacity: 1;
    background-color: var(--m-green) !important;
}

/* --- 21. Live Region Fix --- */
.live-region {
    position: absolute;
    left: auto !important;
    width: 1px; height: 1px;
    overflow: hidden;
}

/* --- 21b. Complaint list — new complaint toast (no full-page reload) --- */
.munsif-complaint-toast {
    position: fixed;
    top: 1rem;
    left: 50%;
    transform: translateX(-50%) translateY(-120%);
    z-index: 10050;
    width: min(560px, calc(100vw - 2rem));
    opacity: 0;
    pointer-events: none;
    transition: transform 0.35s ease, opacity 0.35s ease;
}

.munsif-complaint-toast--visible {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
    pointer-events: auto;
}

.munsif-complaint-toast-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.65rem 0.85rem;
    padding: 0.85rem 1rem;
    background: linear-gradient(135deg, #328264 0%, #2a6d52 100%);
    color: #fff;
    border-radius: 12px;
    box-shadow: 0 12px 32px rgba(50, 130, 100, 0.35);
    border: 1px solid rgba(196, 158, 74, 0.45);
    font-weight: 700;
    font-size: 0.95rem;
}

.munsif-complaint-toast-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background: rgba(196, 158, 74, 0.25);
    color: #f5e6b8;
    flex-shrink: 0;
}

.munsif-complaint-toast-text {
    flex: 1 1 auto;
    min-width: 140px;
}

.munsif-complaint-toast-link {
    color: #f5e6b8 !important;
    text-decoration: underline;
    font-weight: 700;
    white-space: nowrap;
}

.munsif-complaint-toast-link:hover {
    color: #fff !important;
}

.munsif-complaint-toast-refresh {
    border: 1px solid rgba(255, 255, 255, 0.55);
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    border-radius: 8px;
    padding: 0.35rem 0.75rem;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
}

.munsif-complaint-toast-refresh:hover {
    background: rgba(255, 255, 255, 0.22);
}

.munsif-complaint-toast-close {
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.85);
    font-size: 1.35rem;
    line-height: 1;
    padding: 0 0.25rem;
    cursor: pointer;
    margin-inline-start: auto;
}

.munsif-complaint-toast-close:hover {
    color: #fff;
}

/* تحديث قائمة الشكاوى في الخلفية */
#changelist.munsif-complaint-changelist--refreshing {
    opacity: 0.72;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

#result_list.munsif-complaint-changelist--updated {
    animation: munsifComplaintListFlash 1.2s ease;
}

@keyframes munsifComplaintListFlash {
    0% { box-shadow: inset 0 0 0 0 rgba(50, 130, 100, 0); }
    25% { box-shadow: inset 0 0 0 3px rgba(50, 130, 100, 0.45); }
    100% { box-shadow: inset 0 0 0 0 rgba(50, 130, 100, 0); }
}

/* --- 21c. Complaint changelist — column widths & wrapping --- */
body.model-complaint.change-list #result_list th.field-status_badge,
body.model-complaint.change-list #result_list td.field-status_badge {
    width: 1%;
    min-width: 13.5rem;
    white-space: nowrap !important;
    vertical-align: middle;
}

body.model-complaint.change-list #result_list th.field-status_badge {
    white-space: nowrap !important;
}

body.model-complaint.change-list .munsif-complaint-status-badge {
    display: inline-block;
    white-space: nowrap;
    max-width: none;
}

body.model-complaint.change-list #result_list th.field-authority_info,
body.model-complaint.change-list #result_list td.field-authority_info {
    min-width: 9rem;
    max-width: 15rem;
    width: 15rem;
    white-space: normal !important;
    word-wrap: break-word;
    overflow-wrap: break-word;
    vertical-align: top;
}

body.model-complaint.change-list #result_list th.field-authority_info {
    white-space: normal !important;
    line-height: 1.4;
}

body.model-complaint.change-list .munsif-complaint-authority-cell {
    white-space: normal !important;
    word-wrap: break-word;
    overflow-wrap: break-word;
    line-height: 1.45;
}

body.model-complaint.change-list .munsif-complaint-authority-cell b,
body.model-complaint.change-list .munsif-complaint-authority-cell small {
    white-space: normal !important;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.d-sm-inline { display: none !important; }

/* ═══════════════════════════════════════════════════════════════
   DASHBOARD-SPECIFIC STYLES (index.html)
   ═══════════════════════════════════════════════════════════════ */

/* --- Welcome Banner with Shimmer Spell --- */
.munsif-welcome {
    background: linear-gradient(135deg, var(--m-green-dark) 0%, var(--m-green) 60%, #3a9d73 100%);
    border-radius: var(--m-radius);
    padding: 2.2rem 2.8rem;
    color: var(--m-white);
    margin-bottom: 1.75rem;
    position: relative;
    overflow: hidden;
    box-shadow: var(--m-shadow-lg);
}

.munsif-welcome::before {
    content: '';
    position: absolute;
    top: 0; left: -150%;
    width: 100%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
    animation: munsifShimmer 4s infinite linear;
}

@keyframes munsifShimmer {
    0% { left: -150%; }
    100% { left: 150%; }
}

.munsif-welcome::after {
    content: '';
    position: absolute;
    bottom: -30%; right: -10%;
    width: 200px; height: 200px;
    background: radial-gradient(circle, rgba(255,255,255,0.05) 0%, transparent 70%);
    border-radius: 50%;
}

.munsif-welcome h2 {
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 0.35rem;
    position: relative;
    z-index: 1;
}

.munsif-welcome p {
    opacity: 0.85;
    font-size: 0.9rem;
    margin: 0;
    position: relative;
    z-index: 1;
}

.munsif-welcome .munsif-clock {
    position: absolute;
    top: 1.5rem;
    left: 2rem;
    font-size: 0.85rem;
    opacity: 0.8;
    direction: ltr;
    z-index: 1;
}

/* --- KPI Cards --- */
.munsif-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.25rem;
    margin-bottom: 1.75rem;
}

.munsif-kpi-card {
    background: var(--m-card);
    border-radius: var(--m-radius);
    padding: 1.5rem;
    border: 1px solid var(--m-border);
    box-shadow: var(--m-shadow);
    transition: var(--m-transition);
    position: relative;
    overflow: hidden;
    opacity: 0;
    transform: translateY(16px);
}

.munsif-kpi-card.munsif-visible {
    opacity: 1;
    transform: translateY(0);
}

.munsif-kpi-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--m-shadow-lg);
}

.munsif-kpi-link,
.munsif-kpi-link:hover {
    color: inherit !important;
    text-decoration: none !important;
}

.munsif-kpi-link {
    cursor: pointer;
}

.munsif-kpi-card::before {
    content: '';
    position: absolute;
    top: 0; right: 0;
    width: 4px; height: 100%;
    border-radius: 0 var(--m-radius) var(--m-radius) 0;
}

.munsif-kpi-card.kpi-total::before { background: #14532D; }
.munsif-kpi-card.kpi-unread::before { background: #DC2626; }
.munsif-kpi-card.kpi-members::before { background: #D97706; }
.munsif-kpi-card.kpi-authorities::before { background: #6366F1; }

.munsif-kpi-icon {
    width: 48px; height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    margin-bottom: 1rem;
}

.kpi-total .munsif-kpi-icon { background: rgba(20, 83, 45, 0.1); color: #14532D; }
.kpi-unread .munsif-kpi-icon { background: rgba(220, 38, 38, 0.1); color: #DC2626; }
.kpi-members .munsif-kpi-icon { background: rgba(217, 119, 6, 0.1); color: #D97706; }
.kpi-authorities .munsif-kpi-icon { background: rgba(99, 102, 241, 0.1); color: #6366F1; }

.munsif-kpi-number {
    font-size: 2rem;
    font-weight: 800;
    color: var(--m-text);
    line-height: 1;
    margin-bottom: 0.25rem;
    direction: ltr;
    text-align: right;
}

.munsif-kpi-label {
    font-size: 0.8rem;
    color: var(--m-text-sec);
    font-weight: 400;
}

/* --- Chart / Status Cards --- */
.munsif-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
    margin-bottom: 1.75rem;
}

@media (max-width: 768px) {
    .munsif-row { grid-template-columns: 1fr; }
}

.munsif-chart-card, .munsif-table-card {
    background: var(--m-card);
    border-radius: var(--m-radius);
    border: 1px solid var(--m-border);
    box-shadow: var(--m-shadow);
    padding: 1.5rem;
    opacity: 0;
    transform: translateY(16px);
    transition: var(--m-transition);
}

.munsif-chart-card.munsif-visible,
.munsif-table-card.munsif-visible {
    opacity: 1;
    transform: translateY(0);
}

.munsif-section-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--m-text);
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.munsif-section-title i {
    color: var(--m-gold);
    font-size: 0.9rem;
}

/* --- Status Breakdown Bars --- */
.munsif-status-item {
    margin-bottom: 1rem;
}

.munsif-status-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.35rem;
    font-size: 0.8rem;
}

.munsif-status-name { color: var(--m-text); font-weight: 600; }
.munsif-status-count { color: var(--m-text-sec); direction: ltr; }

.munsif-progress {
    height: 8px;
    background: var(--m-bg);
    border-radius: 50px;
    overflow: hidden;
}

.munsif-progress-fill {
    height: 100%;
    border-radius: 50px;
    transition: width 1.2s cubic-bezier(0.4, 0, 0.2, 1);
    width: 0%;
}

/* --- Quick Actions --- */
.munsif-actions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 0.75rem;
}

.munsif-action-btn {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.875rem 1rem;
    background: var(--m-bg);
    border: 1px solid var(--m-border);
    border-radius: var(--m-radius-sm);
    color: var(--m-text);
    text-decoration: none !important;
    font-size: 0.8rem;
    font-weight: 600;
    transition: var(--m-transition);
}

.munsif-action-btn:hover {
    background: var(--m-green);
    color: var(--m-white);
    border-color: var(--m-green);
    transform: translateY(-2px);
    box-shadow: var(--m-shadow-md);
}

.munsif-action-btn i { font-size: 1rem; }

/* --- Recent Table --- */
.munsif-recent-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.8rem;
}

.munsif-recent-table thead th {
    background: var(--m-bg);
    color: var(--m-green-dark) !important;
    font-weight: 700;
    font-size: 0.75rem;
    padding: 0.65rem 0.75rem;
    border-bottom: 2px solid var(--m-border);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.munsif-recent-table tbody tr {
    transition: var(--m-transition);
    cursor: pointer;
}

.munsif-recent-table tbody tr:hover {
    background: var(--recent-table-hover-bg);
}

.munsif-recent-table tbody td {
    padding: 0.7rem 0.75rem;
    border-bottom: 1px solid var(--m-border);
    vertical-align: middle;
}

.munsif-recent-table tbody td:not(.munsif-ref-id) {
    color: #111827 !important;
}

.munsif-recent-table .munsif-muted-text,
.munsif-recent-table .munsif-date-text {
    color: #276852 !important;
}

.munsif-status-dot {
    display: inline-block;
    width: 8px; height: 8px;
    border-radius: 50%;
    margin-left: 6px;
}

/* --- Reference ID Status Colors (Theme-Adaptive) --- */
.munsif-ref-id {
    font-weight: 700;
}

.munsif-ref-read {
    color: var(--ref-read-color) !important;
}

.munsif-ref-unread,
.munsif-recent-table tbody td.munsif-ref-id.munsif-ref-unread {
    color: var(--ref-unread-color) !important;
    font-weight: 800 !important;
}

/* --- Unread Pulse --- */
.munsif-unread-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px; height: 24px;
    background: #ef4444;
    color: white;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 800;
    padding: 0 6px;
}

/* --- Status Badge (Premium) --- */
.munsif-status-badge {
    color: white !important;
    padding: 4px 12px !important;
    border-radius: 50px !important;
    font-size: 0.72rem !important;
    font-weight: 700 !important;
    display: inline-block;
    white-space: nowrap;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: var(--m-transition);
}

.munsif-status-badge:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

/* --- Theme Toggle Icon Fix --- */
#dark-mode-toggle i {
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-bs-theme="dark"] #dark-mode-toggle i {
    transform: rotate(360deg);
}

.munsif-pulse {
    animation: munsifPulse 2s ease-in-out infinite;
}

@keyframes munsifPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239,68,68,0.4); }
    50% { box-shadow: 0 0 0 8px rgba(239,68,68,0); }
}

/* --- Entrance Animation --- */
@keyframes munsifFadeUp {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- Empty State --- */
.munsif-empty {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--m-text-muted);
}

.munsif-empty i {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    color: var(--m-border);
}

/* ═══════════════════════════════════════════════════════════════
   DESIGN SPELLS — Micro-interactions & Magic
   ═══════════════════════════════════════════════════════════════ */

/* --- 1. Magnetic Logo Effect --- */
.brand-link:hover .brand-image {
    transform: scale(1.15) rotate(5deg);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* --- 2. Floating Cards Spell --- */
@keyframes munsifFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

.munsif-kpi-card:hover {
    animation: munsifFloat 3s ease-in-out infinite;
    border-color: var(--m-gold) !important;
}

/* --- 3. Glow Buttons Spell --- */
.btn-primary:active, .btn-success:active {
    box-shadow: 0 0 15px var(--m-gold) !important;
}

/* --- 4. Smooth Entrance Spell --- */
.munsif-visible {
    animation: munsifEntrance 0.6s cubic-bezier(0.23, 1, 0.32, 1) forwards;
}

@keyframes munsifEntrance {
    from { opacity: 0; transform: translateY(20px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* --- 5. Glass Nav Spell --- */
.nav-sidebar .nav-item > .nav-link {
    background: rgba(255,255,255,0);
}

.nav-sidebar .nav-item > .nav-link:hover {
    background: rgba(255,255,255,0.05) !important;
    backdrop-filter: blur(4px);
}

/* --- 6. Arabic Title Polish --- */
h1, h2, h3, .card-title {
    letter-spacing: -0.02em;
    word-spacing: 0.05em;
}

/* --- 7. Table Row Highlight Spell --- */
.munsif-recent-table tbody tr:hover td {
    color: var(--m-green-dark);
}

.munsif-recent-table tbody tr:hover td:first-child {
    border-right: 4px solid var(--m-gold);
}

/* --- 8. Scroll Indicator Magic --- */
::-webkit-scrollbar-thumb {
    border: 2px solid transparent;
    background-clip: content-box;
    background-color: var(--m-gold);
}

/* ═══════════════════════════════════════════════════════════════
   DARK MODE — data-bs-theme="dark" & body.dark-mode
   ═══════════════════════════════════════════════════════════════ */

[data-bs-theme="dark"], body.dark-mode {
    /* ═══ Brand Colors — Inverted for Dark Surface Contrast ═══ */
    --m-green: #328264;
    --m-green-dark: #4fa983;
    --m-green-hover: #276852;
    --m-green-btn-hover: #4fa983;
    --m-gold: #c49e4a;
    --m-gold-ui: #c49e4a;

    /* Surfaces */
    --m-bg: #121814;
    --m-card: #1E2621;
    --m-border: rgba(255, 255, 255, 0.08);

    /* Text */
    --m-text: #F3F4F6;
    --m-text-sec: #9CA3AF;
    --m-text-muted: #6B7280;

    /* Shadows */
    --m-shadow: 0 4px 12px rgba(0,0,0,0.4);
    --m-shadow-md: 0 8px 24px rgba(0,0,0,0.5);
    --m-shadow-lg: 0 12px 32px rgba(0,0,0,0.6);

    /* ═══ Semantic Component Tokens (Dark Mode) ═══ */
    --action-btn-bg: #1E2621;
    --action-btn-border: #2A352E;
    --action-btn-text: #D1D5DB;
    --action-btn-icon: #c49e4a;
    --action-btn-hover-bg: #233028;
    --action-btn-hover-border: #328264;
    --progress-track: rgba(255, 255, 255, 0.1);
    --recent-table-row-bg: #1E2621;
    --recent-table-hover-bg: #233028;
    --recent-table-border: #2A352E;
    --ref-read-color: #4fa983;
    --ref-unread-color: #F87171;
    --table-row-hover-bg: rgba(196, 158, 74, 0.08);
}

/* Dark mode Table Specifics */
[data-bs-theme="dark"] .table thead th, 
[data-bs-theme="dark"] #result_list thead th {
    background: #1E2621 !important; /* Dark Surface */
    color: var(--m-gold) !important; /* Gold text in dark mode headers */
    border-bottom: 2px solid rgba(196, 158, 74, 0.3) !important;
}

[data-bs-theme="dark"] .table tbody td a, 
[data-bs-theme="dark"] #result_list td a {
    color: var(--m-gold) !important;
}

[data-bs-theme="dark"] .table tbody td a:hover, 
[data-bs-theme="dark"] #result_list td a:hover {
    color: var(--m-green-light) !important;
}

/* Dark mode — Welcome Banner */
[data-bs-theme="dark"] .munsif-welcome, body.dark-mode .munsif-welcome {
    background: #0A3622 !important;
    box-shadow: 0 4px 20px rgba(16,185,129,0.1) !important;
}

/* Dark mode — Sidebar */
[data-bs-theme="dark"] .main-sidebar, body.dark-mode .main-sidebar,
[data-bs-theme="dark"] .app-sidebar, body.dark-mode .app-sidebar {
    background: #081C12 !important; /* Deepest Forest Shadow */
}

/* Dark mode — Quick Actions: now driven by component tokens above,
   no hardcoded overrides needed. The variables cascade automatically.
   Keeping a hover glow for dark mode only: */
[data-bs-theme="dark"] .munsif-action-btn:hover, body.dark-mode .munsif-action-btn:hover {
    box-shadow: 0 0 15px rgba(16,185,129,0.1) !important;
}

/* Dark mode — Recent Table: driven by component tokens */
[data-bs-theme="dark"] .munsif-recent-table tbody tr, body.dark-mode .munsif-recent-table tbody tr {
    border-bottom: 1px solid var(--recent-table-border) !important;
    background: var(--recent-table-row-bg) !important;
}
[data-bs-theme="dark"] .munsif-recent-table tbody tr:hover, body.dark-mode .munsif-recent-table tbody tr:hover {
    background: var(--recent-table-hover-bg) !important;
}
[data-bs-theme="dark"] .munsif-recent-table tbody td, body.dark-mode .munsif-recent-table tbody td {
    border-color: var(--recent-table-border) !important;
    color: var(--m-text) !important;
}

/* Dark mode — KPIs */
[data-bs-theme="dark"] .munsif-kpi-card.kpi-total::before, body.dark-mode .munsif-kpi-card.kpi-total::before { background: #34D399 !important; }
[data-bs-theme="dark"] .munsif-kpi-card.kpi-unread::before, body.dark-mode .munsif-kpi-card.kpi-unread::before { background: #F87171 !important; }
[data-bs-theme="dark"] .munsif-kpi-card.kpi-members::before, body.dark-mode .munsif-kpi-card.kpi-members::before { background: #FB923C !important; }
[data-bs-theme="dark"] .munsif-kpi-card.kpi-authorities::before, body.dark-mode .munsif-kpi-card.kpi-authorities::before { background: #818CF8 !important; }

[data-bs-theme="dark"] .kpi-total .munsif-kpi-icon, body.dark-mode .kpi-total .munsif-kpi-icon { background: rgba(52, 211, 153, 0.1) !important; color: #34D399 !important; }
[data-bs-theme="dark"] .kpi-unread .munsif-kpi-icon, body.dark-mode .kpi-unread .munsif-kpi-icon { background: rgba(248, 113, 113, 0.1) !important; color: #F87171 !important; }
[data-bs-theme="dark"] .kpi-members .munsif-kpi-icon, body.dark-mode .kpi-members .munsif-kpi-icon { background: rgba(251, 146, 60, 0.1) !important; color: #FB923C !important; }
[data-bs-theme="dark"] .kpi-authorities .munsif-kpi-icon, body.dark-mode .kpi-authorities .munsif-kpi-icon { background: rgba(129, 140, 248, 0.1) !important; color: #818CF8 !important; }

[data-bs-theme="dark"] body, body.dark-mode {
    background-color: var(--m-bg) !important;
    color: var(--m-text) !important;
}

/* Dark mode — Cards & containers */
[data-bs-theme="dark"] .card, body.dark-mode .card,
[data-bs-theme="dark"] .munsif-kpi-card, body.dark-mode .munsif-kpi-card,
[data-bs-theme="dark"] .munsif-chart-card, body.dark-mode .munsif-chart-card,
[data-bs-theme="dark"] .munsif-table-card, body.dark-mode .munsif-table-card {
    background: var(--m-card) !important;
    border-color: var(--m-border) !important;
    color: var(--m-text) !important;
    box-shadow: var(--m-shadow);
}

[data-bs-theme="dark"] .card-header, body.dark-mode .card-header {
    background: rgba(0,0,0,0.2) !important;
    border-bottom-color: var(--m-border) !important;
    color: var(--m-gold) !important;
}

/* Dark mode — Header */
[data-bs-theme="dark"] .main-header, body.dark-mode .main-header,
[data-bs-theme="dark"] .app-header, body.dark-mode .app-header {
    background: rgba(11, 20, 16, 0.95) !important;
    border-bottom-color: var(--m-border) !important;
}

[data-bs-theme="dark"] .main-header .nav-link, body.dark-mode .main-header .nav-link,
[data-bs-theme="dark"] .main-header .nav-link i, body.dark-mode .main-header .nav-link i,
[data-bs-theme="dark"] .main-header .navbar-nav .nav-link, body.dark-mode .main-header .navbar-nav .nav-link {
    color: var(--m-text) !important;
}

[data-bs-theme="dark"] .main-header .nav-link:hover, body.dark-mode .main-header .nav-link:hover,
[data-bs-theme="dark"] .main-header .nav-link:hover i, body.dark-mode .main-header .nav-link:hover i {
    color: var(--m-gold) !important;
}

/* Dark mode — Tables */
[data-bs-theme="dark"] .table, body.dark-mode .table,
[data-bs-theme="dark"] #result_list, body.dark-mode #result_list {
    color: var(--m-text) !important;
}

[data-bs-theme="dark"] .table tbody tr, body.dark-mode .table tbody tr,
[data-bs-theme="dark"] #result_list tbody tr, body.dark-mode #result_list tbody tr {
    border-bottom-color: var(--m-border) !important;
}

[data-bs-theme="dark"] .table tbody td, body.dark-mode .table tbody td,
[data-bs-theme="dark"] #result_list tbody td, body.dark-mode #result_list tbody td {
    background: transparent !important;
    color: var(--m-text) !important;
    border-color: var(--m-border) !important;
}

[data-bs-theme="dark"] .table tbody tr:hover, body.dark-mode .table tbody tr:hover,
[data-bs-theme="dark"] #result_list tbody tr:hover, body.dark-mode #result_list tbody tr:hover {
    background: rgba(196, 158, 74, 0.08) !important;
}

/* Dark mode — content area */
[data-bs-theme="dark"] .content-wrapper, body.dark-mode .content-wrapper,
[data-bs-theme="dark"] .app-content, body.dark-mode .app-content {
    background: var(--m-bg) !important;
}

/* Dark mode — Footer */
[data-bs-theme="dark"] .main-footer, body.dark-mode .main-footer {
    background: var(--m-card) !important;
    border-top-color: var(--m-border) !important;
    color: var(--m-text-muted) !important;
}

/* Dark mode — Form inputs */
[data-bs-theme="dark"] input, body.dark-mode input,
[data-bs-theme="dark"] select, body.dark-mode select,
[data-bs-theme="dark"] textarea, body.dark-mode textarea {
    background: rgba(0, 0, 0, 0.25) !important;
    border-color: var(--m-border) !important;
    color: var(--m-text) !important;
}

[data-bs-theme="dark"] input:focus, body.dark-mode input:focus,
[data-bs-theme="dark"] select:focus, body.dark-mode select:focus,
[data-bs-theme="dark"] textarea:focus, body.dark-mode textarea:focus {
    border-color: var(--m-gold) !important;
    box-shadow: 0 0 0 3px rgba(196, 158, 74, 0.2) !important;
}

/* Dark mode — Links */
[data-bs-theme="dark"] a:not(.btn):not(.nav-link):not(.munsif-header-btn),
body.dark-mode a:not(.btn):not(.nav-link):not(.munsif-header-btn) {
    color: var(--m-gold) !important;
}
[data-bs-theme="dark"] a:not(.btn):not(.nav-link):not(.munsif-header-btn):hover,
body.dark-mode a:not(.btn):not(.nav-link):not(.munsif-header-btn):hover {
    color: #dfba6b !important;
}

/* Dark mode — KPI text */
[data-bs-theme="dark"] .munsif-kpi-number, body.dark-mode .munsif-kpi-number,
[data-bs-theme="dark"] .munsif-kpi-label, body.dark-mode .munsif-kpi-label,
[data-bs-theme="dark"] .munsif-section-title, body.dark-mode .munsif-section-title,
[data-bs-theme="dark"] .munsif-status-name, body.dark-mode .munsif-status-name,
[data-bs-theme="dark"] .munsif-status-count, body.dark-mode .munsif-status-count {
    color: var(--m-text) !important;
}

[data-bs-theme="dark"] .munsif-kpi-label, body.dark-mode .munsif-kpi-label {
    color: var(--m-text-sec) !important;
}

[data-bs-theme="dark"] .munsif-section-title, body.dark-mode .munsif-section-title {
    color: var(--m-gold) !important;
}

/* ═══════════════════════════════════════════════════════════════
   HEADER CONTROL BUTTONS (Dark Mode & Language Switcher)
   ═══════════════════════════════════════════════════════════════ */

.munsif-header-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.75rem;
    border: 1.5px solid var(--m-border);
    border-radius: 50px;
    background: transparent;
    cursor: pointer;
    font-size: 0.78rem;
    font-family: 'Almarai', sans-serif;
    font-weight: 700;
    color: var(--m-green-dark) !important;
    transition: var(--m-transition);
    line-height: 1;
    white-space: nowrap;
    text-decoration: none !important;
}

.munsif-header-btn:hover {
    background: var(--m-green) !important;
    border-color: var(--m-green) !important;
    color: #fff !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(50,130,100,0.3);
}

.munsif-header-btn:hover i {
    color: #fff !important;
}

.munsif-header-btn i {
    font-size: 0.8rem;
    color: inherit;
}

/* Language button accent */
.munsif-lang-btn {
    border-color: var(--m-gold);
    color: var(--m-gold-ui) !important;
}

.munsif-lang-btn:hover {
    background: var(--m-gold) !important;
    border-color: var(--m-gold) !important;
    color: #fff !important;
    box-shadow: 0 4px 12px rgba(196,158,74,0.35);
}

.munsif-theme-toggle-li,
.munsif-lang-toggle-li {
    display: flex;
    align-items: center;
    padding: 0 0.25rem;
}

/* Dark mode button appearance in dark mode */
[data-bs-theme="dark"] .munsif-header-btn {
    border-color: rgba(255,255,255,0.15);
    color: #c9d1d9 !important;
}

[data-bs-theme="dark"] .munsif-header-btn:hover {
    background: var(--m-green) !important;
    color: #fff !important;
}

[data-bs-theme="dark"] .munsif-lang-btn {
    border-color: var(--m-gold);
    color: var(--m-gold) !important;
}

/* Smooth theme transition */
body,
.main-header,
.content-wrapper,
.card,
.munsif-kpi-card,
.main-sidebar,
.main-footer {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease !important;
}/* --- 10. Dashboard Grid & KPI Cards --- */
.munsif-dashboard-container {
    padding: 1.5rem;
}

.munsif-welcome {
    margin-bottom: 2rem;
    position: relative;
    padding: 2.5rem;
    background: linear-gradient(135deg, #2D634B 0%, #1B4332 100%);
    border-radius: var(--m-radius);
    color: white;
    overflow: hidden;
    box-shadow: var(--m-shadow-lg);
}

.munsif-welcome::after {
    content: '';
    position: absolute;
    top: -50px;
    right: -50px;
    width: 200px;
    height: 200px;
    background: rgba(196, 158, 74, 0.05);
    border-radius: 50%;
}

.munsif-welcome h2 { font-weight: 800; margin-bottom: 0.5rem; font-size: 1.75rem; }
.munsif-welcome p { opacity: 0.85; font-size: 1.1rem; }

.munsif-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.munsif-kpi-card {
    background: var(--m-card);
    border-radius: var(--m-radius);
    padding: 1.5rem;
    position: relative;
    border: 1px solid var(--m-border);
    transition: var(--m-transition);
    overflow: hidden;
    box-shadow: var(--m-shadow);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.munsif-kpi-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--m-shadow-md);
    border-color: var(--m-gold);
}

.munsif-kpi-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-bottom: 1rem;
    background: rgba(50, 130, 100, 0.08);
    color: var(--m-green);
}

.munsif-kpi-number {
    font-size: 2.25rem;
    font-weight: 800;
    color: var(--m-green-dark);
    line-height: 1;
    margin-bottom: 0.5rem;
}

.munsif-kpi-label {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--m-text-sec);
}

/* Individual card colors */
.kpi-total { border-bottom: 4px solid var(--m-green); }
.kpi-unread { border-bottom: 4px solid #EF4444; }
.kpi-members { border-bottom: 4px solid var(--m-gold); }
.kpi-authorities { border-bottom: 4px solid #6366F1; }

/* Status Breakdown & Recent */
.munsif-row {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.munsif-chart-card, .munsif-table-card {
    background: var(--m-card);
    border-radius: var(--m-radius);
    padding: 1.5rem;
    border: 1px solid var(--m-border);
    box-shadow: var(--m-shadow);
}

.munsif-section-title {
    font-weight: 800;
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--m-green-dark);
}

.munsif-section-title i { color: var(--m-gold); }

/* Clock Style */
.munsif-clock {
    position: absolute;
    top: 1.5rem;
    left: 1.5rem;
    font-size: 0.85rem;
    font-weight: 700;
    opacity: 0.7;
    letter-spacing: 0.05em;
}

/* --- Munsif Brand Enforcement: #328264 primary, #c49e4a secondary --- */
.bg-primary,
.badge-primary,
.btn-outline-primary:hover,
.page-item.active .page-link,
.custom-control-input:checked ~ .custom-control-label::before {
    background-color: #328264 !important;
    border-color: #328264 !important;
}

.select2-container--default .select2-results__option--highlighted[aria-selected] {
    background-color: rgba(50, 130, 100, 0.1) !important;
    color: #328264 !important;
}

.btn-secondary,
.badge-warning,
.bg-warning {
    background-color: #c49e4a !important;
    border-color: #c49e4a !important;
    color: #183d31 !important;
}

.form-control:focus,
.custom-select:focus,
.select2-container--default.select2-container--focus .select2-selection--multiple,
.select2-container--default .select2-selection--single:focus {
    border-color: #328264 !important;
    box-shadow: 0 0 0 .2rem rgba(50,130,100,.18) !important;
}

.main-header .navbar-nav .nav-link:hover,
.app-header .navbar-nav .nav-link:hover,
.munsif-chat-bell-link:hover,
#munsif-chat-sound-toggle:hover {
    color: #c49e4a !important;
}



/* Hide Jazzmin global top search and keep inactive sidebar links white */
.main-header form[action*="/admin/auth/user/"],
.main-header form[action*="/admin/munsif_app/complaint/"],
.app-header form[action*="/admin/auth/user/"],
.app-header form[action*="/admin/munsif_app/complaint/"],
.main-header .form-control-navbar,
.app-header .form-control-navbar {
    display: none !important;
}

.nav-sidebar .nav-link:not(.active),
.nav-sidebar .nav-link:not(.active) i,
.nav-sidebar .nav-link:not(.active) p {
    color: #ffffff !important;
    opacity: 1 !important;
}

/* --- Global Responsive Layer: desktop, laptop, tablet, mobile --- */
html,
body {
    max-width: 100%;
    overflow-x: hidden;
}

.content-wrapper,
.main-header,
.main-footer,
.app-content,
.app-header,
.app-footer {
    min-width: 0 !important;
}

.card,
.module,
.munsif-chart-card,
.munsif-table-card,
.munsif-kpi-card {
    max-width: 100%;
}

#changelist,
#changelist-form,
.results,
.result-list,
.table-responsive,
.table,
#result_list {
    max-width: 100%;
}

#changelist .results,
.results,
.table-responsive {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
}

#result_list {
    min-width: 760px;
}

@media (max-width: 1199.98px) {
    .munsif-kpi-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
        gap: 1rem;
    }

    .munsif-charts-grid,
    .munsif-row {
        grid-template-columns: 1fr !important;
    }

    .munsif-welcome {
        padding: 1.75rem;
    }
}

/* ─── Mobile / tablet: overlay sidebar (AdminLTE sidebar-open) ─── */
.munsif-sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    z-index: 1038;
    -webkit-tap-highlight-color: transparent;
}

body.sidebar-open .munsif-sidebar-backdrop {
    display: block;
}

@media (min-width: 992px) {
    .munsif-sidebar-backdrop {
        display: none !important;
    }
}

@media (max-width: 991.98px) {
    /* Show sidebar overlay when open (even if sidebar-collapse is set) */
    html[dir="rtl"] body.sidebar-open #jazzy-sidebar,
    html[dir="rtl"] body.sidebar-open .main-sidebar,
    html[dir="rtl"] body.sidebar-open .app-sidebar {
        right: 0 !important;
        left: auto !important;
        opacity: 1 !important;
        visibility: visible !important;
        pointer-events: auto !important;
        z-index: 1045 !important;
        box-shadow: -8px 0 32px rgba(0, 0, 0, 0.25) !important;
    }

    html[dir="ltr"] body.sidebar-open #jazzy-sidebar,
    html[dir="ltr"] body.sidebar-open .main-sidebar,
    html[dir="ltr"] body.sidebar-open .app-sidebar {
        left: 0 !important;
        right: auto !important;
        opacity: 1 !important;
        visibility: visible !important;
        pointer-events: auto !important;
        z-index: 1045 !important;
        box-shadow: 8px 0 32px rgba(0, 0, 0, 0.25) !important;
    }

    html[dir="rtl"] body.sidebar-collapse:not(.sidebar-open) #jazzy-sidebar,
    html[dir="rtl"] body.sidebar-collapse:not(.sidebar-open) .main-sidebar,
    html[dir="rtl"] body.sidebar-collapse:not(.sidebar-open) .app-sidebar {
        right: calc(-1 * var(--m-sidebar-width)) !important;
        opacity: 0 !important;
        visibility: hidden !important;
        pointer-events: none !important;
    }

    html[dir="ltr"] body.sidebar-collapse:not(.sidebar-open) #jazzy-sidebar,
    html[dir="ltr"] body.sidebar-collapse:not(.sidebar-open) .main-sidebar,
    html[dir="ltr"] body.sidebar-collapse:not(.sidebar-open) .app-sidebar {
        left: calc(-1 * var(--m-sidebar-width)) !important;
        opacity: 0 !important;
        visibility: hidden !important;
        pointer-events: none !important;
    }

    html[dir="rtl"] body.sidebar-open .munsif-floating-toggler {
        right: calc(var(--m-sidebar-width) - 52px) !important;
        color: var(--m-gold) !important;
    }

    html[dir="ltr"] body.sidebar-open .munsif-floating-toggler {
        left: calc(var(--m-sidebar-width) - 52px) !important;
        color: var(--m-gold) !important;
    }

    #jazzy-sidebar,
    .main-sidebar,
    .app-sidebar {
        width: min(var(--m-sidebar-width), 88vw) !important;
        max-width: 88vw !important;
    }

    .nav-sidebar .nav-link {
        min-height: 44px;
        padding: 0.65rem 0.75rem !important;
    }

    #jazzy-navigation .munsif-sidebar-tree .nav-treeview > .nav-item > .nav-link {
        padding-right: 1.5rem !important;
    }

    html[dir="rtl"] body:not(.sidebar-collapse) .content-wrapper,
    html[dir="rtl"] body:not(.sidebar-collapse) .app-content,
    html[dir="rtl"] body:not(.sidebar-collapse) .main-header,
    html[dir="rtl"] body:not(.sidebar-collapse) .app-header,
    html[dir="rtl"] body:not(.sidebar-collapse) .main-footer,
    html[dir="ltr"] body:not(.sidebar-collapse) .content-wrapper,
    html[dir="ltr"] body:not(.sidebar-collapse) .app-content,
    html[dir="ltr"] body:not(.sidebar-collapse) .main-header,
    html[dir="ltr"] body:not(.sidebar-collapse) .app-header,
    html[dir="ltr"] body:not(.sidebar-collapse) .main-footer {
        margin-right: 0 !important;
        margin-left: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
    }

    .container-fluid,
    .container,
    .content-wrapper > .content,
    .content-wrapper > .container-fluid {
        padding-right: 12px !important;
        padding-left: 12px !important;
    }

    .main-header .navbar-nav,
    .app-header .navbar-nav {
        flex-wrap: wrap;
        gap: 4px;
    }

    .munsif-dashboard-container {
        padding: 1rem;
    }

    .munsif-kpi-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .form-row,
    .form-group,
    fieldset .form-row,
    .aligned .form-row {
        display: block !important;
        width: 100% !important;
    }

    .form-row > div,
    .form-group > div,
    .aligned label,
    .aligned .fieldBox {
        width: 100% !important;
        max-width: 100% !important;
        float: none !important;
    }

    input,
    select,
    textarea,
    .select2-container,
    .select2-container--default {
        max-width: 100% !important;
    }
}

@media (max-width: 767.98px) {
    .content-header h1,
    .content-header .h1 {
        font-size: 1.35rem !important;
        line-height: 1.4;
    }

    .munsif-welcome {
        padding: 1.25rem;
        margin-bottom: 1rem;
    }

    .munsif-welcome h2 {
        font-size: 1.35rem;
    }

    .munsif-welcome p {
        font-size: .95rem;
    }

    .munsif-kpi-grid {
        grid-template-columns: 1fr;
        gap: .85rem;
    }

    .munsif-kpi-card,
    .munsif-chart-card,
    .munsif-table-card,
    .card,
    fieldset {
        padding: 1rem !important;
        border-radius: 14px !important;
    }

    .munsif-kpi-number {
        font-size: 1.75rem;
    }

    .object-tools,
    .change-list-actions,
    .submit-row,
    .card-tools {
        display: flex !important;
        flex-wrap: wrap !important;
        gap: .5rem !important;
        float: none !important;
        justify-content: flex-start !important;
    }

    .object-tools li,
    .object-tools a,
    .submit-row input,
    .submit-row a,
    .btn,
    button {
        max-width: 100%;
        white-space: normal;
    }

    #changelist-filter {
        position: static !important;
        width: 100% !important;
        max-width: 100% !important;
        margin-top: 1rem !important;
    }

    #changelist-search,
    #toolbar form,
    #toolbar {
        display: block !important;
        width: 100% !important;
    }

    #toolbar input[type="text"],
    #toolbar select {
        width: 100% !important;
        margin-bottom: .5rem;
    }
}

@media (max-width: 575.98px) {
    .container-fluid,
    .container,
    .content-wrapper > .content,
    .content-wrapper > .container-fluid {
        padding-right: 8px !important;
        padding-left: 8px !important;
    }

    .main-header,
    .app-header {
        min-height: auto !important;
    }

    main.app-main {
        padding-top: .85rem !important;
    }

    .app-main > .app-content,
    .content-wrapper > .content {
        padding-top: .85rem !important;
    }

    .main-header .nav-link,
    .app-header .nav-link {
        padding: .45rem .55rem !important;
    }

    .brand-link,
    .app-brand {
        padding: .85rem !important;
    }

    .munsif-clock {
        position: static;
        margin-bottom: .75rem;
    }

    #result_list {
        min-width: 680px;
        font-size: .85rem;
    }

    .pagination,
    .paginator {
        flex-wrap: wrap;
        gap: .35rem;
    }
}

/* Hide page title + breadcrumb navigation row across all admin pages. */
.app-content-header,
.content-header {
    display: none !important;
}

body.model-adminactivitylog #change-list-date-hierarchy {
    padding: 0 0 1rem !important;
}

body.model-adminactivitylog #change-list-date-hierarchy .date-hierarchy {
    display: inline-flex !important;
    flex-wrap: wrap;
    gap: .45rem;
    align-items: center;
    padding: .6rem;
    background: linear-gradient(135deg, rgba(50, 130, 100, .09), rgba(196, 158, 74, .12));
    border: 1px solid rgba(50, 130, 100, .16);
    border-radius: 999px;
    box-shadow: 0 8px 22px rgba(15, 23, 42, .07);
}

body.model-adminactivitylog #change-list-date-hierarchy .btn {
    border: 0 !important;
    border-radius: 999px !important;
    padding: .45rem .95rem !important;
    font-weight: 800 !important;
    text-decoration: none !important;
    box-shadow: none !important;
}

body.model-adminactivitylog #change-list-date-hierarchy .btn-secondary {
    background: #fff !important;
    color: var(--m-green-dark) !important;
    border: 1px solid rgba(50, 130, 100, .18) !important;
}

body.model-adminactivitylog #change-list-date-hierarchy .btn-primary {
    background: linear-gradient(135deg, var(--m-green), var(--m-green-dark)) !important;
    color: #fff !important;
}

body.model-adminactivitylog #change-list-date-hierarchy .btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(50, 130, 100, .18) !important;
}

.select2-results__option[aria-selected] {
    cursor: pointer;
    color: #000;
}

.select2-results__option[aria-selected]:hover,
.select2-container--default .select2-results__option--highlighted[aria-selected] {
    color: #328264 !important;
}

/* ─── Admin forms: full-width card + bottom action row ─── */
body.munsif-form-bottom-actions .munsif-admin-change-form .munsif-admin-form-row,
body.munsif-user-form-bottom-actions .munsif-user-change-form .munsif-user-form-row {
    margin-left: 0;
    margin-right: 0;
}

body.munsif-form-bottom-actions .munsif-form-actions-bottom,
body.munsif-user-form-bottom-actions .munsif-form-actions-bottom {
    margin-top: 1.25rem;
    padding-top: .25rem;
}

body.munsif-form-bottom-actions #jazzy-actions.munsif-bottom-submit-row,
body.munsif-user-form-bottom-actions #jazzy-actions.munsif-bottom-submit-row {
    position: sticky;
    bottom: 12px;
    z-index: 40;
    width: 100%;
    margin: 0;
    padding: 1rem 1.15rem;
    border-radius: 14px;
    border: 1px solid rgba(50, 130, 100, .2);
    background: linear-gradient(180deg, #fff 0%, #f8fafb 100%);
    box-shadow: 0 10px 28px rgba(15, 23, 42, .1);
}

body.munsif-form-bottom-actions #jazzy-actions.munsif-bottom-submit-row,
body.munsif-user-form-bottom-actions #jazzy-actions.munsif-bottom-submit-row {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    gap: .55rem !important;
}

body.munsif-form-bottom-actions #jazzy-actions .d-flex,
body.munsif-user-form-bottom-actions #jazzy-actions .d-flex {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: wrap !important;
    gap: .55rem !important;
    align-items: center !important;
    justify-content: flex-start !important;
    width: auto !important;
    flex: 1 1 auto;
}

body.munsif-form-bottom-actions #jazzy-actions .d-flex .btn,
body.munsif-form-bottom-actions #jazzy-actions .d-flex input[type="submit"],
body.munsif-user-form-bottom-actions #jazzy-actions .d-flex .btn,
body.munsif-user-form-bottom-actions #jazzy-actions .d-flex input[type="submit"] {
    width: auto !important;
    max-width: none !important;
    flex: 0 0 auto;
}

body.munsif-form-bottom-actions #jazzy-actions .object-tools,
body.munsif-user-form-bottom-actions #jazzy-actions .object-tools {
    width: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    border-top: 0 !important;
    flex: 0 0 auto;
}

body.munsif-form-bottom-actions #jazzy-actions .object-tools ul,
body.munsif-user-form-bottom-actions #jazzy-actions .object-tools ul {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    gap: .5rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

body.munsif-form-bottom-actions #jazzy-actions .object-tools li,
body.munsif-user-form-bottom-actions #jazzy-actions .object-tools li {
    margin: 0;
}

body.munsif-form-bottom-actions #jazzy-actions .object-tools .btn,
body.munsif-form-bottom-actions #jazzy-actions .object-tools a,
body.munsif-user-form-bottom-actions #jazzy-actions .object-tools .btn,
body.munsif-user-form-bottom-actions #jazzy-actions .object-tools a {
    width: auto !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: .45rem 1rem;
    font-weight: 700;
    border-radius: 10px;
}

body.munsif-form-bottom-actions #jazzy-actions .btn,
body.munsif-form-bottom-actions #jazzy-actions input[type="submit"],
body.munsif-user-form-bottom-actions #jazzy-actions .btn,
body.munsif-user-form-bottom-actions #jazzy-actions input[type="submit"] {
    min-height: 38px;
    padding: .45rem 1rem;
    font-weight: 700;
    border-radius: 10px;
    white-space: nowrap;
}

body.munsif-form-bottom-actions .munsif-admin-change-form .card,
body.munsif-user-form-bottom-actions .munsif-user-change-form .card {
    border-radius: 14px;
    border-color: rgba(50, 130, 100, .14);
    box-shadow: var(--m-shadow);
}

/* Hide Jazzmin sidebar action column on full-width Munsif forms */
body.munsif-form-bottom-actions.change-form .col-lg-3:has(#jazzy-actions:not(.munsif-bottom-submit-row)),
body.munsif-user-form-bottom-actions.change-form .col-lg-3:has(#jazzy-actions:not(.munsif-bottom-submit-row)) {
    display: none !important;
}

/* ─── Styled changelist (users + employee profiles) ─── */
body.munsif-styled-changelist #change-list-filters .form-control,
body.munsif-styled-changelist #change-list-filters .btn {
    border-radius: 10px;
}

body.munsif-styled-changelist .munsif-changelist-card {
    border-radius: 14px;
    border: 1px solid rgba(50, 130, 100, .12);
    overflow: hidden;
}

body.munsif-styled-changelist .munsif-changelist-card #changelist,
body.munsif-styled-changelist .munsif-changelist-card #result_list {
    margin-bottom: 0;
}

body.munsif-styled-changelist .munsif-changelist-toolbar #change-list-filters {
    background: linear-gradient(180deg, #fff 0%, #f8fafb 100%);
    border: 1px solid rgba(50, 130, 100, .14);
    border-radius: 14px;
    padding: 1rem 1.1rem;
    box-shadow: var(--m-shadow);
}

@media (max-width: 768px) {
    body.munsif-form-bottom-actions #jazzy-actions.munsif-bottom-submit-row,
    body.munsif-user-form-bottom-actions #jazzy-actions.munsif-bottom-submit-row {
        position: static;
    }

    body.munsif-form-bottom-actions #jazzy-actions.munsif-bottom-submit-row,
    body.munsif-form-bottom-actions #jazzy-actions .d-flex,
    body.munsif-form-bottom-actions #jazzy-actions .object-tools ul,
    body.munsif-user-form-bottom-actions #jazzy-actions.munsif-bottom-submit-row,
    body.munsif-user-form-bottom-actions #jazzy-actions .d-flex,
    body.munsif-user-form-bottom-actions #jazzy-actions .object-tools ul {
        flex-direction: row !important;
        align-items: center !important;
    }
}

/* ─── Employee profile: compact filter_horizontal (M2M selectors) ─── */
body.model-employeeprofile .field-authorities .selector,
body.model-employeeprofile .field-allowed_chat_users .selector,
body.model-user .field-authorities .selector,
body.model-user .field-allowed_chat_users .selector {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    width: 100%;
    max-width: 100%;
    float: none;
}

body.model-employeeprofile .field-authorities .selector-available,
body.model-employeeprofile .field-authorities .selector-chosen,
body.model-employeeprofile .field-allowed_chat_users .selector-available,
body.model-employeeprofile .field-allowed_chat_users .selector-chosen,
body.model-user .field-authorities .selector-available,
body.model-user .field-authorities .selector-chosen,
body.model-user .field-allowed_chat_users .selector-available,
body.model-user .field-allowed_chat_users .selector-chosen {
    flex: 1 1 220px;
    min-width: 180px;
    max-width: calc(50% - 30px);
    float: none;
}

body.model-employeeprofile .field-authorities .selector-available h2,
body.model-employeeprofile .field-authorities .selector-chosen h2,
body.model-employeeprofile .field-allowed_chat_users .selector-available h2,
body.model-employeeprofile .field-allowed_chat_users .selector-chosen h2,
body.model-user .field-authorities .selector-available h2,
body.model-user .field-authorities .selector-chosen h2,
body.model-user .field-allowed_chat_users .selector-available h2,
body.model-user .field-allowed_chat_users .selector-chosen h2 {
    font-size: .82rem;
    font-weight: 800;
    margin: 0 0 6px;
    line-height: 1.35;
    white-space: normal;
    word-break: break-word;
    color: var(--m-green-dark);
}

body.model-employeeprofile .field-authorities .selector select,
body.model-employeeprofile .field-allowed_chat_users .selector select,
body.model-user .field-authorities .selector select,
body.model-user .field-allowed_chat_users .selector select {
    width: 100% !important;
    min-height: 180px;
    max-height: 260px;
    height: auto;
    border-radius: 10px;
    border-color: var(--m-border);
    font-size: .82rem;
    line-height: 1.35;
}

body.model-employeeprofile .field-authorities .selector select option,
body.model-employeeprofile .field-allowed_chat_users .selector select option,
body.model-user .field-authorities .selector select option,
body.model-user .field-allowed_chat_users .selector select option {
    padding: 6px 8px;
    white-space: normal;
}

body.model-employeeprofile .field-authorities .selector-chooser,
body.model-employeeprofile .field-allowed_chat_users .selector-chooser,
body.model-user .field-authorities .selector-chooser,
body.model-user .field-allowed_chat_users .selector-chooser {
    flex: 0 0 42px;
    width: 42px;
    min-width: 42px;
    margin: 0;
    padding: 0;
    list-style: none;
    align-self: center;
}

body.model-employeeprofile .field-authorities .selector-chooser li,
body.model-employeeprofile .field-allowed_chat_users .selector-chooser li,
body.model-user .field-authorities .selector-chooser li,
body.model-user .field-allowed_chat_users .selector-chooser li {
    margin: 5px 0;
    padding: 0;
}

body.model-employeeprofile .field-authorities .selector-chooser a,
body.model-employeeprofile .field-allowed_chat_users .selector-chooser a,
body.model-user .field-authorities .selector-chooser a,
body.model-user .field-allowed_chat_users .selector-chooser a,
body.model-employeeprofile .field-authorities .selector-chooseall,
body.model-employeeprofile .field-authorities .selector-clearall,
body.model-employeeprofile .field-allowed_chat_users .selector-chooseall,
body.model-employeeprofile .field-allowed_chat_users .selector-clearall,
body.model-user .field-authorities .selector-chooseall,
body.model-user .field-authorities .selector-clearall,
body.model-user .field-allowed_chat_users .selector-chooseall,
body.model-user .field-allowed_chat_users .selector-clearall {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 34px;
    margin: 4px auto 0;
    padding: 0;
    border-radius: 10px;
    border: 1px solid rgba(50, 130, 100, .28);
    background: linear-gradient(135deg, rgba(50, 130, 100, .1), rgba(196, 158, 74, .12));
    color: var(--m-green-dark);
    font-size: 0 !important;
    line-height: 1;
    text-decoration: none !important;
    overflow: hidden;
    position: relative;
    white-space: nowrap;
}

body.model-employeeprofile .field-authorities .selector-chooser a::after,
body.model-employeeprofile .field-allowed_chat_users .selector-chooser a::after,
body.model-user .field-authorities .selector-chooser a::after,
body.model-user .field-allowed_chat_users .selector-chooser a::after,
body.model-employeeprofile .field-authorities .selector-chooseall::after,
body.model-employeeprofile .field-authorities .selector-clearall::after,
body.model-employeeprofile .field-allowed_chat_users .selector-chooseall::after,
body.model-employeeprofile .field-allowed_chat_users .selector-clearall::after,
body.model-user .field-authorities .selector-chooseall::after,
body.model-user .field-authorities .selector-clearall::after,
body.model-user .field-allowed_chat_users .selector-chooseall::after,
body.model-user .field-allowed_chat_users .selector-clearall::after {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: 800;
    color: var(--m-green-dark);
    pointer-events: none;
}

body.model-employeeprofile .field-authorities .selector-add::after,
body.model-employeeprofile .field-allowed_chat_users .selector-add::after,
body.model-user .field-authorities .selector-add::after,
body.model-user .field-allowed_chat_users .selector-add::after {
    content: "←";
}

body.model-employeeprofile .field-authorities .selector-remove::after,
body.model-employeeprofile .field-allowed_chat_users .selector-remove::after,
body.model-user .field-authorities .selector-remove::after,
body.model-user .field-allowed_chat_users .selector-remove::after {
    content: "→";
}

body.model-employeeprofile .field-authorities .selector-chooseall::after,
body.model-employeeprofile .field-allowed_chat_users .selector-chooseall::after,
body.model-user .field-authorities .selector-chooseall::after,
body.model-user .field-allowed_chat_users .selector-chooseall::after {
    content: "⇐";
    font-size: .9rem;
}

body.model-employeeprofile .field-authorities .selector-clearall::after,
body.model-employeeprofile .field-allowed_chat_users .selector-clearall::after,
body.model-user .field-authorities .selector-clearall::after,
body.model-user .field-allowed_chat_users .selector-clearall::after {
    content: "⇒";
    font-size: .9rem;
}

body.model-employeeprofile .field-authorities .selector-chooser a:hover,
body.model-employeeprofile .field-allowed_chat_users .selector-chooser a:hover,
body.model-user .field-authorities .selector-chooser a:hover,
body.model-user .field-allowed_chat_users .selector-chooser a:hover,
body.model-employeeprofile .field-authorities .selector-chooseall:hover,
body.model-employeeprofile .field-authorities .selector-clearall:hover,
body.model-employeeprofile .field-allowed_chat_users .selector-chooseall:hover,
body.model-employeeprofile .field-allowed_chat_users .selector-clearall:hover,
body.model-user .field-authorities .selector-chooseall:hover,
body.model-user .field-authorities .selector-clearall:hover,
body.model-user .field-allowed_chat_users .selector-chooseall:hover,
body.model-user .field-allowed_chat_users .selector-clearall:hover {
    background: var(--m-green);
    border-color: var(--m-green);
}

body.model-employeeprofile .field-authorities .selector-chooser a:hover::after,
body.model-employeeprofile .field-allowed_chat_users .selector-chooser a:hover::after,
body.model-user .field-authorities .selector-chooser a:hover::after,
body.model-user .field-allowed_chat_users .selector-chooser a:hover::after,
body.model-employeeprofile .field-authorities .selector-chooseall:hover::after,
body.model-employeeprofile .field-authorities .selector-clearall:hover::after,
body.model-employeeprofile .field-allowed_chat_users .selector-chooseall:hover::after,
body.model-employeeprofile .field-allowed_chat_users .selector-clearall:hover::after,
body.model-user .field-authorities .selector-chooseall:hover::after,
body.model-user .field-authorities .selector-clearall:hover::after,
body.model-user .field-allowed_chat_users .selector-chooseall:hover::after,
body.model-user .field-allowed_chat_users .selector-clearall:hover::after {
    color: #fff;
}

@media (max-width: 900px) {
    body.model-employeeprofile .field-authorities .selector-available,
    body.model-employeeprofile .field-authorities .selector-chosen,
    body.model-employeeprofile .field-allowed_chat_users .selector-available,
    body.model-employeeprofile .field-allowed_chat_users .selector-chosen,
    body.model-user .field-authorities .selector-available,
    body.model-user .field-authorities .selector-chosen,
    body.model-user .field-allowed_chat_users .selector-available,
    body.model-user .field-allowed_chat_users .selector-chosen {
        max-width: 100%;
        flex-basis: 100%;
    }
}

/* ═══ صفحات إرسال SMS — نصوص واضحة على البطاقات الفاتحة ═══ */
.munsif-sms-page {
    color: #183d31 !important;
}

.munsif-sms-page h1,
.munsif-sms-page h2,
.munsif-sms-page p,
.munsif-sms-page label,
.munsif-sms-page .munsif-sms-target,
.munsif-sms-page .munsif-sms-check,
.munsif-sms-page .munsif-sms-kpi,
.munsif-sms-page .munsif-sms-summary {
    color: #183d31 !important;
}

.munsif-sms-page .munsif-sms-hint,
.munsif-sms-page .munsif-sms-kpi > span:first-child {
    color: #475569 !important;
}

.munsif-sms-page .munsif-sms-hint a {
    color: #276852 !important;
    font-weight: 700;
}

.munsif-sms-page .munsif-sms-field select,
.munsif-sms-page .munsif-sms-field textarea,
.munsif-sms-page .munsif-sms-field input[type="text"] {
    color: #1f2937 !important;
    background: #ffffff !important;
}

.munsif-sms-page .munsif-sms-field select option {
    color: #1f2937;
    background: #ffffff;
}

.munsif-sms-page .munsif-sms-card {
    color: #183d31 !important;
}

.munsif-sms-page .munsif-sms-kpi strong {
    color: #328264 !important;
}

[data-bs-theme="dark"] .munsif-sms-page .munsif-sms-card,
body.dark-mode .munsif-sms-page .munsif-sms-card {
    background: var(--m-card) !important;
    border-color: var(--m-border) !important;
    color: var(--m-text) !important;
}

[data-bs-theme="dark"] .munsif-sms-page h1,
[data-bs-theme="dark"] .munsif-sms-page h2,
[data-bs-theme="dark"] .munsif-sms-page p,
[data-bs-theme="dark"] .munsif-sms-page label,
[data-bs-theme="dark"] .munsif-sms-page .munsif-sms-target,
[data-bs-theme="dark"] .munsif-sms-page .munsif-sms-check,
body.dark-mode .munsif-sms-page h1,
body.dark-mode .munsif-sms-page h2,
body.dark-mode .munsif-sms-page p,
body.dark-mode .munsif-sms-page label,
body.dark-mode .munsif-sms-page .munsif-sms-target,
body.dark-mode .munsif-sms-page .munsif-sms-check {
    color: var(--m-text) !important;
}

[data-bs-theme="dark"] .munsif-sms-page .munsif-sms-hint,
body.dark-mode .munsif-sms-page .munsif-sms-hint {
    color: var(--m-text-sec) !important;
}

[data-bs-theme="dark"] .munsif-sms-page .munsif-sms-kpi,
body.dark-mode .munsif-sms-page .munsif-sms-kpi {
    background: rgba(50, 130, 100, 0.12) !important;
    border-color: rgba(50, 130, 100, 0.25) !important;
}
