:root {
    /* Premium Executive Design System */
    --primary-color: #1d4ed8;
    /* Trust Blue */
    --primary-gradient: linear-gradient(135deg, #3b82f6 0%, #1e40af 100%);
    --secondary-color: #4f46e5;
    --emerald-color: #10b981;
    /* Growth Green */
    --accent-amber: #f59e0b;
    --accent-rose: #e11d48;
    /* Soft Red */

    /* Dynamic Background - Premium & Alive */
    --bg-gradient: radial-gradient(circle at top left, #fafafa 0%, #f4f5f7 50%, #eaecf0 100%);
    --sidebar-dark-bg: #0f172a;
    /* Dark Blue Mix */
    --card-bg: #ffffff;

    --text-main: #1e293b;
    --text-muted: #475569;
    --text-light: #f8fafc;

    --border-color: rgba(29, 78, 216, 0.1);
    --border-radius: 20px;
    --sidebar-width: 260px;
    --transition: all 0.4s cubic-bezier(0.25, 1, 0.5, 1);
    --shadow-soft: 0 10px 30px -5px rgba(0, 0, 0, 0.05);
    --shadow-lux: 0 25px 50px -12px rgba(15, 23, 42, 0.08);
}

/* Dark Mode Theme */
body.dark-theme {
    --primary-color: #3b82f6;
    --bg-gradient: radial-gradient(circle at top left, #0f172a 0%, #1e293b 50%, #020617 100%);
    --sidebar-dark-bg: #020617;
    --card-bg: #1e293b;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border-color: rgba(255, 255, 255, 0.1);
    --shadow-soft: 0 10px 30px -5px rgba(0, 0, 0, 0.3);
    --shadow-lux: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    --white: #1e293b;
}

body.dark-theme .top-header,
body.dark-theme .ribbon,
body.dark-theme .status-bar {
    background: rgba(15, 23, 42, 0.9) !important;
    border-color: var(--border-color);
}

body.dark-theme .stat-card {
    background: #1e293b !important;
    border-color: var(--border-color);
}

body.dark-theme .search-box {
    background: rgba(30, 41, 59, 0.8);
    color: white;
}

body.dark-theme .search-box input {
    color: white;
}

body.dark-theme .zoom-controls {
    background: #0f172a;
    border-color: var(--border-color);
}

body.dark-theme .data-table td {
    color: #f8fafc;
}

body.dark-theme .modal-card {
    background: #1e293b;
    color: white;
}

body.dark-theme .office-input {
    background: #0f172a;
    color: white;
    border-color: var(--border-color);
}


* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Cairo', sans-serif;
}

body {
    background: var(--bg-gradient);
    background-attachment: fixed;
    color: var(--text-main);
    overflow-x: hidden;
    min-height: 100vh;
}

/* Layout */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-dark-bg);
    border-left: none;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    right: 0;
    z-index: 1000;
    transition: var(--transition);
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.3);
    overflow-y: auto;
}

.sidebar-header {
    padding: 2.5rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-light);
    letter-spacing: -1px;
}

.logo i {
    font-size: 1.8rem;
    filter: drop-shadow(0 4px 6px rgba(99, 102, 241, 0.2));
}

.sidebar-nav {
    flex: 1;
    padding: 1.5rem 1rem;
}

.sidebar-nav ul {
    list-style: none;
}

.sidebar-nav li {
    padding: 1rem 1.2rem;
    margin-bottom: 0.5rem;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 15px;
    color: rgba(255, 255, 255, 0.6);
    transition: var(--transition);
    font-weight: 600;
    font-size: 0.95rem;
}

.sidebar-nav li i {
    font-size: 1.4rem;
    width: 30px;
    text-align: center;
    opacity: 0.8;
    transition: var(--transition);
}

.sidebar-nav li:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-light);
    transform: translateX(-5px);
}

.sidebar-nav li:hover i {
    transform: scale(1.2) rotate(10deg);
}

/* Specific Sidebar Colors per Menu */
.sidebar-nav li[data-page="dashboard"]:hover i {
    color: #1d4ed8;
}

.sidebar-nav li[data-page="statistics"]:hover i,
.sidebar-nav li[data-page="reports"]:hover i {
    color: #4338ca;
}

.sidebar-nav li[data-page="cases"]:hover i,
.sidebar-nav li[data-page="hidden"]:hover i,
.sidebar-nav li[data-page="exceptional"]:hover i {
    color: #e879f9;
}

.sidebar-nav li[data-page="donations"]:hover i {
    color: #22c55e;
    text-shadow: 0 0 10px rgba(234, 179, 8, 0.6);
}

.sidebar-nav li[data-page="expenses"]:hover i {
    color: #e11d48;
}

.sidebar-nav li[data-page="volunteers"]:hover i {
    color: #fb923c;
}

.sidebar-nav li[data-page="affidavit"]:hover i {
    color: #06b6d4;
}

.sidebar-nav li[data-page="settings"]:hover i {
    color: #8b5cf6;
}

.sidebar-nav li.active {
    background: var(--primary-gradient);
    color: #ffffff;
    box-shadow: 0 8px 20px -4px rgba(99, 102, 241, 0.4);
}

/* Main Content */
.main-content {
    flex: 1;
    margin-right: var(--sidebar-width);
    transition: var(--transition);
    display: flex;
    flex-direction: column;
}

.top-header {
    height: 60px;
    background: var(--white);
    border-bottom: 1px solid var(--border-color);
    padding: 0 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: var(--text-main);
    position: sticky;
    top: 0;
    z-index: 900;
    backdrop-filter: blur(10px);
    background: rgba(255, 255, 255, 0.9);
}

.ribbon {
    background: var(--white);
    border-bottom: 1px solid var(--border-color);
    padding: 8px 2rem;
    display: flex;
    gap: 30px;
    align-items: center;
}

.ribbon-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 0 15px;
    border-left: 1px solid var(--border-color);
}

.ribbon-group:last-child {
    border-left: none;
}

.ribbon-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.header-left h1 {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.icon-btn {
    background: #f1f5f9;
    border: none;
    font-size: 1.1rem;
    color: var(--text-main);
    cursor: pointer;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    box-shadow: var(--shadow-soft);
}

.icon-btn:hover {
    background: var(--primary-color);
    color: white;
    transform: rotate(90deg);
}

/* ===== Mobile Header Quick Actions (Menu / Export) =====
   Hidden by default (desktop). Revealed inside the mobile media query below. */
.mobile-header-actions {
    display: none;
    position: relative;
    align-items: center;
    gap: 8px;
}

.mobile-action-btn:hover {
    background: var(--primary-color);
    color: white;
    transform: none;
}

#mobile-menu-btn {
    background: #1d4ed8;
    color: white;
}

#mobile-export-btn {
    background: #16a34a;
    color: white;
}

.mobile-dropdown-menu {
    display: none;
    position: fixed;
    top: 65px;
    left: 12px;
    right: 12px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 14px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.18);
    width: auto;
    max-width: 320px;
    max-height: 75vh;
    overflow-y: auto;
    z-index: 3500;
    padding: 8px;
}

.mobile-dropdown-menu.open {
    display: block;
    animation: mobileMenuFadeIn 0.15s ease-out;
}

@keyframes mobileMenuFadeIn {
    from {
        opacity: 0;
        transform: translateY(-6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.mobile-dropdown-title {
    font-weight: 800;
    font-size: 0.85rem;
    color: var(--primary-color);
    padding: 8px 10px;
    border-bottom: 1px solid #f1f5f9;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.mobile-dropdown-menu ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.mobile-dropdown-menu li {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 10px;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--text-main);
    transition: background 0.15s;
}

.mobile-dropdown-menu li:active,
.mobile-dropdown-menu li:hover {
    background: #eff6ff;
    color: var(--primary-color);
}

.mobile-dropdown-menu li i {
    width: 20px;
    text-align: center;
    color: var(--primary-color);
}

.mobile-dropdown-menu li.danger {
    color: #ef4444;
}

.mobile-dropdown-menu li.danger i {
    color: #ef4444;
}

.mobile-dropdown-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.3);
    z-index: 2999;
}

.mobile-dropdown-overlay.open {
    display: block;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.search-box {
    background: rgba(241, 245, 249, 0.8);
    backdrop-filter: blur(4px);
    padding: 0 15px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    border: 1px solid rgba(0, 0, 0, 0.05);
    transition: var(--transition);
}

.search-box:focus-within {
    background: white;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
    border-color: var(--primary-color);
    width: 320px !important;
}

/* Zoom Controls Header Styling */
.zoom-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f1f5f9;
    padding: 6px 12px;
    border-radius: 30px;
    color: var(--text-main);
    border: 1px solid var(--border-color);
}

.zoom-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.1rem;
    padding: 4px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.zoom-btn:hover {
    background: #e2e8f0;
    color: var(--primary-color);
    transform: scale(1.1);
}

.zoom-btn.reset-zoom {
    margin-right: 5px;
    padding-right: 8px;
    border-right: 1px solid var(--border-color);
    border-radius: 0;
    font-size: 0.9rem;
}

#zoom-level {
    font-size: 0.9rem;
    font-weight: 700;
    min-width: 50px;
    text-align: center;
    user-select: none;
    color: var(--text-main);
}


.search-box input {
    background: none;
    border: none;
    outline: none;
    width: 100%;
    font-size: 0.9rem;
}

.notifications {
    position: relative;
    cursor: pointer;
    font-size: 1.2rem;
    color: var(--text-muted);
}

.notifications .badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ef4444;
    color: white;
    font-size: 0.7rem;
    padding: 2px 5px;
    border-radius: 10px;
    border: 2px solid white;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 5px 10px;
    border-radius: 30px;
    cursor: pointer;
    transition: var(--transition);
}

.user-profile:hover {
    background: #f1f5f9;
}

.user-profile img {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    object-fit: cover;
}

.user-profile span {
    font-weight: 700;
    font-size: 0.9rem;
}

/* Content Area */
.content-area {
    padding: 1.5rem;
    max-width: 100%;
    margin: 0;
}

/* Dashboard Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--card-bg);
    padding: 1.8rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-soft);
    display: flex;
    align-items: center;
    gap: 20px;
    border: 1px solid var(--border-color);
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-10px);
    box-shadow: var(--shadow-lux);
    border-color: var(--primary-color);
}

/* Varied Dashboard Card Backgrounds - Dark & Light Mix */
.stat-card:nth-child(1) {
    border-right: 5px solid var(--primary-color);
    background: linear-gradient(135deg, #ffffff 0%, #eef2ff 100%);
}

.stat-card:nth-child(1) .stat-icon {
    background: var(--primary-color);
    color: white;
}

.stat-card:nth-child(2) {
    border-right: 5px solid var(--emerald-color);
    background: linear-gradient(135deg, #ffffff 0%, #ecfdf5 100%);
}

.stat-card:nth-child(2) .stat-icon {
    background: var(--emerald-color);
    color: white;
}

.stat-card:nth-child(3) {
    border-right: 5px solid var(--accent-amber);
    background: linear-gradient(135deg, #ffffff 0%, #fff7ed 100%);
}

.stat-card:nth-child(3) .stat-icon {
    background: #b45309;
    color: white;
}

.stat-card:nth-child(4) {
    border-right: 5px solid var(--accent-rose);
    background: linear-gradient(135deg, #ffffff 0%, #fdf2f8 100%);
}

.stat-card:nth-child(4) .stat-icon {
    background: #9d174d;
    color: white;
}

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.stat-info h3 {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.stat-info p {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-main);
}

.icon-emerald {
    background: #ecfdf5;
    color: #10b981;
}

.icon-blue {
    background: #eff6ff;
    color: #3b82f6;
}

.icon-amber {
    background: #fffbeb;
    color: #f59e0b;
}

.icon-purple {
    background: #f5f3ff;
    color: #8b5cf6;
}

/* =====================================================================
   PROFESSIONAL STATISTICS DASHBOARD (v2)
   Grouped, color-coded, responsive stat cards with glassmorphism,
   counter animation hooks and tooltips.
===================================================================== */
.stats-dashboard-v2 {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    margin-bottom: 2rem;
}

.stats-group {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.stats-group-header {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 800;
    font-size: 1.05rem;
    color: var(--text-main);
    padding-inline-start: 4px;
}

.stats-group-header .stats-group-icon {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    color: #fff;
}

.stats-group--revenue .stats-group-icon { background: linear-gradient(135deg, #10b981, #047857); }
.stats-group--expense .stats-group-icon { background: linear-gradient(135deg, #f87171, #b91c1c); }
.stats-group--balance .stats-group-icon { background: linear-gradient(135deg, #3b82f6, #1d4ed8); }
.stats-group--general .stats-group-icon { background: linear-gradient(135deg, #a78bfa, #7c3aed); }

.stat-cards-row {
    display: grid;
    gap: 1.25rem;
}

.stat-cards-row.grid-cols-4 { grid-template-columns: repeat(4, 1fr); }
.stat-cards-row.grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
.stat-cards-row.grid-cols-1 { grid-template-columns: 1fr; }

/* Card */
.stat-card-v2 {
    position: relative;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 1.5rem;
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: var(--shadow-soft);
    transition: var(--transition);
    cursor: default;
    overflow: hidden;
}

body.dark-theme .stat-card-v2 {
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.stat-card-v2::before {
    content: '';
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
}

.stat-card-v2:hover {
    transform: translateY(-8px) scale(1.015);
    box-shadow: var(--shadow-lux);
}

.stat-card-v2:hover::before {
    opacity: 1;
}

/* Color themes */
.stat-card-v2--revenue { border-inline-start: 5px solid #10b981; }
.stat-card-v2--revenue::before { background: linear-gradient(135deg, rgba(16,185,129,0.08), transparent 60%); }
.stat-card-v2--revenue .stat-card-v2-icon { background: linear-gradient(135deg, #34d399, #059669); }
.stat-card-v2--revenue .stat-counter,
.stat-card-v2--revenue .stat-unit { color: #047857; }
body.dark-theme .stat-card-v2--revenue .stat-counter,
body.dark-theme .stat-card-v2--revenue .stat-unit { color: #34d399; }

.stat-card-v2--expense { border-inline-start: 5px solid #ef4444; }
.stat-card-v2--expense::before { background: linear-gradient(135deg, rgba(239,68,68,0.08), transparent 60%); }
.stat-card-v2--expense .stat-card-v2-icon { background: linear-gradient(135deg, #f87171, #b91c1c); }
.stat-card-v2--expense .stat-counter,
.stat-card-v2--expense .stat-unit { color: #b91c1c; }
body.dark-theme .stat-card-v2--expense .stat-counter,
body.dark-theme .stat-card-v2--expense .stat-unit { color: #f87171; }

.stat-card-v2--balance { border-inline-start: 5px solid #1d4ed8; }
.stat-card-v2--balance::before { background: linear-gradient(135deg, rgba(29,78,216,0.08), transparent 60%); }
.stat-card-v2--balance .stat-card-v2-icon { background: linear-gradient(135deg, #60a5fa, #1d4ed8); }
.stat-card-v2--balance .stat-counter,
.stat-card-v2--balance .stat-unit { color: #1d4ed8; }
body.dark-theme .stat-card-v2--balance .stat-counter,
body.dark-theme .stat-card-v2--balance .stat-unit { color: #60a5fa; }

.stat-card-v2--general { border-inline-start: 5px solid #7c3aed; }
.stat-card-v2--general::before { background: linear-gradient(135deg, rgba(124,58,237,0.08), transparent 60%); }
.stat-card-v2--general .stat-card-v2-icon { background: linear-gradient(135deg, #a78bfa, #6d28d9); }
.stat-card-v2--general .stat-counter,
.stat-card-v2--general .stat-unit { color: #6d28d9; }
body.dark-theme .stat-card-v2--general .stat-counter,
body.dark-theme .stat-card-v2--general .stat-unit { color: #a78bfa; }

/* Headline (emphasized) variant */
.stat-card-v2--headline {
    box-shadow: 0 15px 35px -8px rgba(0, 0, 0, 0.12);
}

.stat-card-v2--headline .stat-counter {
    font-size: 1.9rem;
}

.stat-card-v2-icon {
    flex-shrink: 0;
    width: 54px;
    height: 54px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    color: #fff;
    box-shadow: 0 6px 16px -4px rgba(0, 0, 0, 0.25);
}

.stat-card-v2-body {
    flex: 1;
    min-width: 0;
}

.stat-card-v2-body h4 {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.stat-counter-wrap {
    display: flex;
    align-items: baseline;
    gap: 6px;
}

.stat-counter {
    font-size: 1.55rem;
    font-weight: 900;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.stat-unit {
    font-size: 0.75rem;
    font-weight: 700;
    opacity: 0.85;
}

/* Tooltip (data-tooltip attribute driven, CSS-only) */
[data-tooltip] {
    position: relative;
}

[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%) translateY(6px);
    background: #1e293b;
    color: #f8fafc;
    padding: 8px 12px;
    border-radius: 10px;
    font-size: 0.72rem;
    font-weight: 600;
    white-space: normal;
    width: max-content;
    max-width: 220px;
    text-align: center;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, transform 0.25s ease;
    z-index: 50;
    pointer-events: none;
}

[data-tooltip]::before {
    content: '';
    position: absolute;
    bottom: calc(100% + 4px);
    left: 50%;
    transform: translateX(-50%) translateY(6px);
    border: 6px solid transparent;
    border-top-color: #1e293b;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, transform 0.25s ease;
    z-index: 50;
    pointer-events: none;
}

[data-tooltip]:hover::after,
[data-tooltip]:hover::before {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

/* Skeleton loading state */
.stat-card-v2.is-skeleton {
    pointer-events: none;
}

.skeleton-block {
    background: linear-gradient(90deg, rgba(148,163,184,0.18) 25%, rgba(148,163,184,0.32) 37%, rgba(148,163,184,0.18) 63%);
    background-size: 400% 100%;
    animation: skeleton-shimmer 1.4s ease infinite;
    border-radius: 8px;
}

@keyframes skeleton-shimmer {
    0% { background-position: 100% 50%; }
    100% { background-position: 0 50%; }
}

.skeleton-icon {
    width: 54px;
    height: 54px;
    border-radius: 16px;
    flex-shrink: 0;
}

.skeleton-title {
    width: 70%;
    height: 12px;
    margin-bottom: 10px;
}

.skeleton-number {
    width: 50%;
    height: 22px;
}

/* Responsive: Desktop(4) -> Tablet(2) -> Mobile(1) */
@media (max-width: 1024px) {
    .stat-cards-row.grid-cols-4,
    .stat-cards-row.grid-cols-3 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {
    .stat-cards-row.grid-cols-4,
    .stat-cards-row.grid-cols-3,
    .stat-cards-row.grid-cols-1 {
        grid-template-columns: 1fr;
    }

    .stat-card-v2 {
        padding: 1.2rem;
    }

    .stat-counter {
        font-size: 1.3rem;
    }

    [data-tooltip]::after,
    [data-tooltip]::before {
        display: none; /* avoid awkward tooltips on touch devices */
    }
}

/* Tables & Lists */
.card {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-soft);
    padding: 2rem;
    margin-bottom: 2rem;
    border: 1px solid var(--border-color);
    backdrop-filter: blur(20px);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.card-header h2 {
    font-size: 1.2rem;
}

.btn-primary {
    background: var(--primary-gradient);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: var(--transition);
    box-shadow: 0 4px 14px 0 rgba(29, 78, 216, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(29, 78, 216, 0.4);
    filter: brightness(1.1);
}

.table-container {
    width: 100%;
    overflow-x: auto;
    border: 1px solid var(--border-color);
    border-radius: 4px;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 1200px;
    /* Force table to be wide enough for all data */
}

.data-table th {
    text-align: right;
    padding: 16px 15px;
    background: linear-gradient(180deg, #e81123 0%, #d13438 100%);
    /* Official Premium Red */
    color: #ffffff;
    font-weight: 800;
    border-bottom: 3px solid #a80000;
    font-size: 0.95rem;
    white-space: nowrap;
    text-transform: uppercase;
    position: sticky;
    top: 0;
    z-index: 10;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.data-table td {
    padding: 12px;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
    font-size: 0.9rem;
    color: var(--text-main);
}

.data-table tr {
    transition: var(--transition);
}

.data-table tr:hover {
    background-color: rgba(99, 102, 241, 0.05) !important;
}

/* Chromatic Columns for the Table */
.data-table th:nth-child(2),
.data-table td:nth-child(2) {
    color: #d13438;
    font-weight: 800;
}

/* Research # */
.data-table th:nth-child(4),
.data-table td:nth-child(4) {
    color: #059669;
}

/* Center */
.data-table th:nth-child(5),
.data-table td:nth-child(5) {
    color: #4f46e5;
    background: rgba(99, 102, 241, 0.03);
}

/* Name */
.data-table th:nth-child(10),
.data-table td:nth-child(10) {
    color: #b45309;
}

/* Status */
.data-table th:nth-child(11),
.data-table td:nth-child(11) {
    color: #7c3aed;
}

/* Category */
.data-table th:nth-child(12),
.data-table td:nth-child(12) {
    color: #2563eb;
}

/* Source */

.main-case-row {
    cursor: pointer;
    transition: background 0.2s;
}

.main-case-row:hover {
    background-color: #f0f7ff !important;
}

.family-members-row {
    background-color: #fafafa;
    border-right: 4px solid var(--primary-color);
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.05);
}

.family-members-row>td {
    padding: 0 !important;
}

.nested-card {
    background: white;
    margin: 15px;
    border-radius: 8px;
    border: 1px solid #eef0f2;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    overflow: hidden;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Image Preview Styles */
.image-preview-box {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.img-container {
    position: relative;
    width: 140px;
    height: 140px;
    border: 2px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    background: white;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.img-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.img-container:hover img {
    transform: scale(1.1);
}

.img-overlay-btns {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: space-around;
    padding: 5px 0;
    opacity: 0;
    transition: opacity 0.2s;
    z-index: 10;
}

.img-container:hover .img-overlay-btns {
    opacity: 1;
}

.mini-btn-change,
.mini-btn-remove {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 0.9rem;
    padding: 2px 8px;
    border-radius: 4px;
}

.mini-btn-change:hover {
    background: var(--accent-color);
}

.mini-btn-remove:hover {
    background: #d13438;
}

.no-img {
    width: 140px;
    height: 140px;
    background: #fdfdfd;
    border: 2px dashed #bbb;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    color: #aaa;
    cursor: pointer;
    transition: all 0.2s;
}

.no-img:hover {
    border-color: var(--accent-color);
    background: #f0f7ff;
    color: var(--accent-color);
}

/* Status Bar - Dark Contrast */
.status-bar {
    height: 32px;
    background: var(--sidebar-dark-bg);
    color: rgba(255, 255, 255, 0.7);
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    padding: 0 20px;
    font-size: 0.8rem;
    z-index: 1000;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.status-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 700;
}

.status-pending {
    background: #fffbeb;
    color: #d97706;
}

.status-completed {
    background: #ecfdf5;
    color: #059669;
}

/* Splash Screen Styling */
/* ============================================================
   SPLASH SCREEN - PREMIUM REDESIGN
============================================================ */
.splash-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: linear-gradient(135deg, #0a0f2e 0%, #0d1b4b 40%, #1a0a3e 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    color: #f8fafc;
    flex-direction: column;
    overflow: hidden;
}

/* نجوم خلفية متحركة */
.splash-overlay::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background-image:
        radial-gradient(1.5px 1.5px at 10% 20%, rgba(255,255,255,0.6) 0%, transparent 100%),
        radial-gradient(1px 1px at 30% 60%, rgba(255,255,255,0.4) 0%, transparent 100%),
        radial-gradient(1.5px 1.5px at 55% 15%, rgba(255,255,255,0.5) 0%, transparent 100%),
        radial-gradient(1px 1px at 75% 40%, rgba(255,255,255,0.3) 0%, transparent 100%),
        radial-gradient(2px 2px at 85% 70%, rgba(255,255,255,0.5) 0%, transparent 100%),
        radial-gradient(1px 1px at 20% 80%, rgba(255,255,255,0.4) 0%, transparent 100%),
        radial-gradient(1.5px 1.5px at 65% 85%, rgba(255,255,255,0.3) 0%, transparent 100%),
        radial-gradient(1px 1px at 45% 50%, rgba(255,255,255,0.2) 0%, transparent 100%),
        radial-gradient(1px 1px at 90% 10%, rgba(255,255,255,0.5) 0%, transparent 100%),
        radial-gradient(2px 2px at 5% 45%, rgba(255,255,255,0.3) 0%, transparent 100%);
    animation: twinkle 4s ease-in-out infinite alternate;
}

/* هالة ضوء في الوسط */
.splash-overlay::after {
    content: '';
    position: absolute;
    width: 500px; height: 500px;
    background: radial-gradient(circle, rgba(99,102,241,0.15) 0%, transparent 70%);
    border-radius: 50%;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    animation: pulse-glow 3s ease-in-out infinite;
}

@keyframes twinkle {
    0% { opacity: 0.4; }
    100% { opacity: 1; }
}

@keyframes pulse-glow {
    0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 0.6; }
    50% { transform: translate(-50%, -50%) scale(1.3); opacity: 1; }
}

.splash-content {
    text-align: center;
    animation: splashEntrance 1s cubic-bezier(0.34, 1.56, 0.64, 1) both;
    position: relative;
    z-index: 2;
    padding: 20px;
}

@keyframes splashEntrance {
    0% { opacity: 0; transform: translateY(40px) scale(0.9); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

/* الأيقونة الدائرية الرئيسية */
.splash-logo {
    margin-bottom: 28px;
    position: relative;
    display: inline-block;
}

.splash-icon-ring {
    width: 110px;
    height: 110px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1, #8b5cf6, #a78bfa);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    box-shadow:
        0 0 0 12px rgba(99,102,241,0.12),
        0 0 0 24px rgba(99,102,241,0.06),
        0 20px 60px rgba(99,102,241,0.5);
    animation: iconFloat 3s ease-in-out infinite;
    position: relative;
}

.splash-icon-ring::before {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1, transparent, #8b5cf6);
    animation: rotateBorder 3s linear infinite;
    z-index: -1;
}

@keyframes rotateBorder {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes iconFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

.splash-icon-ring i {
    font-size: 2.8rem;
    color: white;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.3));
}

/* عنوان البرنامج الرئيسي */
.splash-title-main {
    font-size: 1.1rem;
    font-weight: 700;
    color: rgba(255,255,255,0.7);
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-bottom: 8px;
    animation: fadeSlideUp 0.8s ease 0.3s both;
}

.splash-title-program {
    font-size: 2rem;
    font-weight: 900;
    background: linear-gradient(135deg, #ffffff 0%, #a5b4fc 50%, #c4b5fd 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.2;
    margin-bottom: 6px;
    animation: fadeSlideUp 0.8s ease 0.5s both;
}

.splash-title-sub {
    font-size: 1.25rem;
    font-weight: 800;
    color: #a5b4fc;
    margin-bottom: 4px;
    animation: fadeSlideUp 0.8s ease 0.6s both;
}

.splash-divider {
    width: 60px;
    height: 3px;
    background: linear-gradient(90deg, transparent, #6366f1, transparent);
    margin: 16px auto;
    border-radius: 2px;
    animation: expandWidth 1s ease 0.8s both;
}

@keyframes expandWidth {
    from { width: 0; opacity: 0; }
    to { width: 60px; opacity: 1; }
}

.splash-tagline {
    font-size: 0.88rem;
    color: rgba(255,255,255,0.45);
    font-weight: 500;
    margin-bottom: 32px;
    animation: fadeSlideUp 0.8s ease 0.9s both;
}

@keyframes fadeSlideUp {
    from { opacity: 0; transform: translateY(15px); }
    to { opacity: 1; transform: translateY(0); }
}

/* بار التحميل الجديد */
.splash-loader {
    width: 200px;
    height: 4px;
    background: rgba(255,255,255,0.1);
    border-radius: 2px;
    margin: 0 auto 16px;
    overflow: hidden;
    position: relative;
    animation: fadeSlideUp 0.6s ease 1s both;
}

.splash-loader::after {
    content: '';
    position: absolute;
    top: 0; right: 0;
    width: 40%;
    height: 100%;
    background: linear-gradient(90deg, transparent, #6366f1, #8b5cf6);
    border-radius: 2px;
    animation: loadingSlide 1.5s ease-in-out infinite;
}

@keyframes loadingSlide {
    0% { right: 100%; width: 30%; }
    50% { width: 50%; }
    100% { right: -50%; width: 30%; }
}

/* نص الحالة */
#splash-status-text {
    font-size: 0.8rem;
    color: rgba(255,255,255,0.4);
    animation: fadeSlideUp 0.6s ease 1.1s both;
    letter-spacing: 0.5px;
}

/* زرار البدء */
.splash-actions .btn-primary {
    background: linear-gradient(135deg, #6366f1, #8b5cf6) !important;
    border: none;
    padding: 14px 45px !important;
    font-size: 1.05rem !important;
    border-radius: 50px !important;
    box-shadow: 0 8px 30px rgba(99,102,241,0.5);
    animation: splashEntrance 0.6s ease both;
    transition: all 0.3s;
}

.splash-actions .btn-primary:hover {
    transform: translateY(-3px) scale(1.03);
    box-shadow: 0 12px 40px rgba(99,102,241,0.7);
}

/* تأثير الخروج */
.splash-overlay.fade-out {
    animation: splashFadeOut 0.6s ease forwards;
}

@keyframes splashFadeOut {
    0% { opacity: 1; transform: scale(1); }
    100% { opacity: 0; transform: scale(1.05); pointer-events: none; }
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes fadeIn {
    0% { opacity: 0; transform: translateY(-20px); }
    100% { opacity: 1; transform: translateY(0); }
}

/* Login Styling */
.login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #0f172a;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.login-overlay[style*="display: flex"],
.login-overlay[style*="display:flex"] {
    display: flex !important;
}

.login-card {
    background: #1e293b;
    color: #f8fafc;
    padding: 0;
    /* padding is handled by children */
    border-radius: 20px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    width: 100%;
    max-width: 450px;
    border: 1px solid #334155;
    overflow: hidden;
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-header i {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 15px;
}

.login-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
}

.login-body p {
    text-align: center;
    color: #cbd5e1 !important;
    margin-bottom: 20px;
}

.login-body .input-group input {
    background: #0f172a;
    border-color: #334155;
    color: #f8fafc;
}

.login-body .input-group input::placeholder {
    color: #64748b;
}

.login-body .input-group i {
    color: #94a3b8;
}

.input-group {
    position: relative;
    margin-bottom: 15px;
}

.input-group i {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.input-group input {
    width: 100%;
    padding: 12px 45px 12px 15px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 1rem;
    outline: none;
}

.input-group input:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(0, 120, 212, 0.1);
}

/* Modal Styling */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2500;
}

.modal-card {
    background: white;
    width: 95%;
    max-width: 1200px;
    height: 95vh;
    border-radius: 24px;
    box-shadow: var(--shadow-lux);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: modalSlideUp 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalSlideUp {
    from {
        transform: translateY(40px) scale(0.98);
        opacity: 0;
    }

    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

.modal-header {
    background: var(--primary-gradient);
    color: white;
    padding: 30px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

.modal-header h3 {
    font-size: 1.8rem;
    font-weight: 800;
    letter-spacing: -1px;
}

.close-modal {
    cursor: pointer;
    color: var(--text-muted);
}

.modal-body {
    padding: 40px;
    flex: 1;
    overflow-y: auto;
    background: #fcfcfd;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 30px;
}

.input-group-office {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.input-group-office label {
    font-weight: 700;
    color: var(--text-main);
    font-size: 0.95rem;
}

.office-input {
    width: 100%;
    padding: 14px 18px;
    border: 2px solid #eef2f6;
    border-radius: 12px;
    font-size: 1rem;
    transition: var(--transition);
    background: #fcfcfd;
}

.office-input:focus {
    border-color: var(--primary-color);
    background: #ffffff;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
    outline: none;
}

/* Colorful Modal Input Groups (Festival of Colors) */
.input-group-office:nth-child(1) label {
    color: #d13438;
}

.input-group-office:nth-child(1) .office-input {
    border-right: 4px solid #d13438;
}

.input-group-office:nth-child(2) label {
    color: #059669;
}

.input-group-office:nth-child(2) .office-input {
    border-right: 4px solid #059669;
}

.input-group-office:nth-child(3) label {
    color: #2563eb;
}

.input-group-office:nth-child(3) .office-input {
    border-right: 4px solid #2563eb;
}

.input-group-office:nth-child(4) label {
    color: #7c3aed;
}

.input-group-office:nth-child(4) .office-input {
    border-right: 4px solid #7c3aed;
}

.input-group-office:nth-child(5) label {
    color: #db2777;
}

.input-group-office:nth-child(5) .office-input {
    border-right: 4px solid #db2777;
}

.input-group-office:nth-child(6) label {
    color: #ea580c;
}

.input-group-office:nth-child(6) .office-input {
    border-right: 4px solid #ea580c;
}

.input-group-office:nth-child(7) label {
    color: #0891b2;
}

.input-group-office:nth-child(7) .office-input {
    border-right: 4px solid #0891b2;
}

/* Classification Grid */
.classification-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 10px;
    background: #f8fafc;
    padding: 15px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    max-height: 200px;
    overflow-y: auto;
}

.check-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    cursor: pointer;
    padding: 5px;
    border-radius: 4px;
    transition: background 0.2s;
}

.check-item:hover {
    background: #edf2f7;
}

.check-item input {
    cursor: pointer;
    width: 16px;
    height: 16px;
}

#case-modal .modal-card {
    max-width: 1300px;
    height: 98vh;
}

.modal-header {
    background: var(--primary-gradient);
    color: white;
    padding: 25px 35px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.modal-footer {
    padding: 20px 35px;
    background: #f8fafc;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 15px;
}

.btn-secondary {
    background: white;
    border: 1px solid var(--border-color);
    padding: 8px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
}

/* Office Form Elements */
.office-input {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 2px;
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.1s;
}

.office-input:focus {
    border-color: var(--accent-color);
}

.office-input::placeholder {
    color: #a19f9d;
}

/* Compact inputs - smaller padding and font for secondary fields */
.compact-input {
    padding: 9px 12px !important;
    font-size: 0.88rem !important;
    border-radius: 8px !important;
    background: #fafbff !important;
}

.input-group-office label {
    font-size: 0.88rem;
}

/* ============================================================
   MOBILE WALLET STYLE (Responsive Design)
============================================================ */
@media (max-width: 1024px) {

    html,
    body {
        overflow-x: hidden !important;
        max-width: 100vw !important;
        width: 100% !important;
    }

    /* Override inline grids that break mobile layout */
    div[style*="grid-template-columns: 1fr 1fr"],
    div[style*="grid-template-columns: 2fr 1fr"],
    div[style*="grid-template-columns: repeat(3, 1fr)"],
    div[style*="grid-template-columns: repeat(2, 1fr)"] {
        grid-template-columns: 1fr !important;
    }

    body {
        background: #f4f5f7;
        /* Flat, clean background for mobile */
    }

    .app-container {
        flex-direction: column;
        width: 100%;
        max-width: 100vw;
        overflow-x: hidden;
    }

    /* Hide the Sidebar entirely on mobile — navigation now happens via the
       3 header quick-action buttons (Menu / Print / Export) instead of a
       bottom nav bar. */
    .sidebar {
        display: none !important;
    }

    /* Reveal the mobile header quick-action buttons (hidden on desktop) */
    .mobile-header-actions {
        display: flex !important;
    }

    /* "ربط مجلد الفلاشة" is a desktop-only workflow; hide it on mobile */
    #link-folder-btn {
        display: none !important;
    }

    /* Main Content Spacing — no bottom nav anymore, so no bottom margin needed */
    .main-content {
        margin-right: 0 !important;
        margin-bottom: 0;
        width: 100%;
    }

    .top-header {
        padding: 0 15px;
        height: 60px;
        justify-content: space-between;
    }

    .header-left span {
        font-size: 0.95rem;
        /* Smaller title */
        font-weight: 800;
    }

    .header-left>span {
        display: none;
        /* Hide the static title text on very small screens if it overflows, or just let it shrink */
    }

    #toggle-sidebar {
        display: none !important;
        /* Sidebar is hidden on mobile; nothing to toggle */
    }

    .zoom-controls {
        display: none !important;
        /* Hide zoom controls on mobile to make room for the quick-action buttons */
    }

    .search-box {
        width: 110px !important;
        padding: 6px 15px 6px 30px !important;
        font-size: 0.85rem !important;
    }

    .search-box:focus-within {
        width: 180px !important;
        position: absolute;
        left: 50px;
        z-index: 10;
    }

    /* Cards & Stats - Wallet vibe */
    .content-area {
        padding: 15px 10px;
        width: 100vw;
        max-width: 100vw;
        overflow-x: hidden;
        box-sizing: border-box;
    }

    .stats-grid {
        grid-template-columns: 1fr;
        gap: 15px;
        width: 100%;
    }

    .stat-card {
        padding: 1.4rem;
        border-radius: 24px;
        /* More rounded wallet feel */
        gap: 15px;
        align-items: center;
        width: 100%;
    }

    .card {
        padding: 1.2rem;
        border-radius: 20px;
        margin-bottom: 20px;
        width: 100%;
        max-width: calc(100vw - 20px);
        overflow-x: hidden;
    }

    /* The ribbon (طباعة بالتصنيف / طباعة / تصدير إكسيل / ربط الفلاشة / إضافة حالة)
       is hidden entirely on mobile. Export + Print now live in the header
       quick-actions menu, and "إضافة حالة جديدة" already has its own button
       inside the إدارة الحالات (cases) page itself. */
    .ribbon {
        display: none !important;
    }

    .ribbon-group {
        border-left: none;
        border-right: 1px solid rgba(0, 0, 0, 0.05);
        padding: 0 10px;
    }

    .ribbon-group:first-child {
        border-right: none;
    }

    .btn-primary {
        min-width: 140px;
        font-size: 0.9rem !important;
        padding: 10px 15px !important;
        justify-content: center;
        white-space: nowrap;
    }

    /* Tables scroll sideways smoothly */
    .table-container {
        border: none;
        box-shadow: none;
        border-radius: 0;
        margin: 0 -10px;
        /* Bleed out */
        padding: 0 10px;
        width: 100vw;
        max-width: 100vw;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .data-table {
        min-width: 700px;
        /* Force scroll but smaller */
        width: 100%;
        max-width: none;
    }

    .form-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .modal-card {
        width: 100%;
        height: 100vh !important;
        max-height: 100vh !important;
        border-radius: 0;
        margin: 0;
        transform: none !important;
    }

    .modal-header {
        padding: 15px 20px;
        position: sticky;
        top: 0;
        z-index: 10;
    }

    .status-bar {
        bottom: 0;
        border-radius: 12px 12px 0 0;
        margin: 0 10px;
        width: calc(100% - 20px);
    }
}

/* Searchable Dropdown Styles */
.dropdown-container {
    position: relative;
    width: 100%;
}

.dropdown-results {
    position: absolute;
    top: calc(100% + 5px);
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: 6px;
    max-height: 250px;
    overflow-y: auto;
    z-index: 2000;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    display: none;
}

.dropdown-item {
    padding: 12px 15px;
    cursor: pointer;
    border-bottom: 1px solid #f8f8f8;
    transition: background 0.2s;
    text-align: right;
}

.dropdown-item:last-child {
    border-bottom: none;
}

.dropdown-item:hover {
    background: #f0f7f2;
}

.dropdown-item strong {
    display: block;
    color: var(--primary-color);
    font-size: 0.95rem;
}

.dropdown-item span {
    display: block;
    font-size: 0.8rem;
    color: #666;
    margin-top: 2px;
}

/* Mode Toggles */
#single-aid-toggle,
#bulk-aid-toggle {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 700;
}

#single-aid-toggle:not(.btn-primary),
#bulk-aid-toggle:not(.btn-primary) {
    opacity: 0.7;
}

#single-aid-toggle.btn-primary,
#bulk-aid-toggle.btn-primary {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    opacity: 1;
}

/* --- Public Case View Styles (Premium) --- */
#public-case-view {
    font-family: 'Cairo', sans-serif;
    animation: fadeInPublic 0.5s ease-out;
}

@keyframes fadeInPublic {
    from {
        opacity: 0;
        transform: scale(0.98);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.case-info-public .info-item {
    background: #ffffff;
    padding: 15px 20px;
    border-radius: 12px;
    border: 1px solid #f1f5f9;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

.case-info-public .info-item:hover {
    border-color: #3730a3;
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(55, 48, 163, 0.08);
}

.case-info-public .info-item strong {
    color: #3730a3;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.75rem;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.case-info-public .info-item span {
    font-weight: 800;
    color: #0f172a;
    font-size: 1.05rem;
}

.case-photos-public .photo-card {
    border: 1px solid #f1f5f9;
    padding: 15px;
    border-radius: 16px;
    background: white;
    text-align: center;
    transition: all 0.3s ease;
}

.case-photos-public .photo-card:hover {
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.05);
}

.case-photos-public img {
    width: 100%;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transition: all 0.4s ease;
    cursor: pointer;
}

.case-photos-public img:hover {
    transform: scale(1.03);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.15);
}

.public-btn-home {
    background: #3730a3;
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(55, 48, 163, 0.3);
}

.public-btn-home:hover {
    background: #1e1b4b;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(55, 48, 163, 0.4);
}

#qrcode-container img {
    border: 8px solid white;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    border-radius: 10px;
}

@media (max-width: 768px) {
    #public-case-view {
        padding: 10px !important;
    }

    #public-case-view>div {
        padding: 20px !important;
    }

    #public-case-content>div {
        grid-template-columns: 1fr !important;
        gap: 20px !important;
    }

    .case-photos-public {
        order: -1;
        flex-direction: row !important;
        overflow-x: auto;
        padding-bottom: 10px;
    }

    .case-photos-public .photo-card {
        min-width: 200px;
    }

    .case-info-public .info-item {
        padding: 12px;
    }
}
/* ============================================================
   DASHBOARD SECTION TOGGLE SWITCHES
============================================================ */
.dash-toggle-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 7px 14px;
    border-radius: 30px;
    background: white;
    border: 1.5px solid #e2e8f0;
    font-size: 0.82rem;
    font-weight: 700;
    color: #374151;
    user-select: none;
    transition: all 0.2s ease;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.dash-toggle-item:hover {
    border-color: #6366f1;
    background: #f5f3ff;
}

.dash-toggle-switch {
    position: relative;
    width: 36px;
    height: 20px;
    border-radius: 10px;
    background: #cbd5e1;
    transition: background 0.25s ease;
    flex-shrink: 0;
}
.dash-toggle-switch.active {
    background: #6366f1;
}
.dash-toggle-knob {
    position: absolute;
    top: 3px;
    right: 3px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: white;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    transition: transform 0.25s ease;
}
.dash-toggle-switch.active .dash-toggle-knob {
    transform: translateX(-16px);
}

/* ============================================================
   CHARITY LOGO UPLOAD (Register & Settings)
============================================================ */
#reg-logo-upload-area:hover {
    background: #ede9fe !important;
    border-color: #4f46e5 !important;
}

.logo-upload-settings {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 16px;
    border: 2px dashed #6366f1;
    border-radius: 12px;
    cursor: pointer;
    background: #f5f3ff;
    transition: background 0.2s;
    margin-top: 10px;
}
.logo-upload-settings:hover {
    background: #ede9fe;
}
.logo-upload-settings img {
    height: 55px;
    border-radius: 8px;
    object-fit: contain;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* ============================================================
   MOBILE HEADER FIX - v2.7
   حل مشكلة ازدحام الهيدر على الموبايل
============================================================ */
@media (max-width: 1024px) {

    /* الهيدر - نخليه صفين بدل صف واحد */
    .top-header {
        height: auto !important;
        min-height: 56px;
        flex-wrap: wrap;
        padding: 8px 10px !important;
        gap: 6px;
    }

    /* الجانب الأيمن (العنوان والبادج) */
    .header-left {
        flex: 1;
        min-width: 0;
        gap: 6px;
        overflow: hidden;
    }

    /* نص العنوان - نصغره ونمنعه يتكسر */
    .header-left > span:not(#charity-badge) {
        font-size: 0.82rem !important;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 140px;
        display: inline-block !important;
    }

    /* بادج النسخة التجريبية - نصغره */
    #charity-badge {
        font-size: 0.55rem !important;
        padding: 1px 5px !important;
        white-space: nowrap;
    }

    /* بادج وضع الموظفين - نصغره ونظبط شكله */
    #staff-mode-badge {
        font-size: 0.65rem !important;
        padding: 3px 8px !important;
        border-radius: 12px !important;
        margin-right: 4px !important;
        white-space: nowrap;
        gap: 3px !important;
    }

    /* الجانب الأيسر (أدوات) - نخليه صف منفصل تحت */
    .header-right {
        width: 100%;
        order: 2;
        gap: 6px !important;
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 2px;
        justify-content: flex-start;
    }

    /* إخفاء عناصر مش ضرورية على الموبايل في الهيدر */
    .header-right .user-profile {
        display: none;
    }

    /* مجموعة السنكرونية مخفية من الهيدر على الموبايل — حالة الاتصال متاحة الآن من صفحة الإعدادات */
    #sync-indicator-group {
        display: none !important;
    }

    /* زووم كنترول - أصغر وأوضح */
    .zoom-controls {
        transform: none !important; /* إلغاء الـ scale القديم */
        padding: 4px 8px !important;
        gap: 4px !important;
        border-radius: 20px !important;
        flex-shrink: 0;
    }

    .zoom-btn {
        font-size: 0.85rem !important;
        padding: 3px !important;
        width: 22px !important;
        height: 22px !important;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    #zoom-level {
        font-size: 0.75rem !important;
        min-width: 35px !important;
    }

    /* زر الوضع الليلي */
    #dark-mode-toggle {
        width: 32px !important;
        height: 32px !important;
        font-size: 0.85rem !important;
        flex-shrink: 0;
    }

    /* أزرار الإجراءات السريعة (القائمة / الإكسبورت) في الهيدر */
    .mobile-header-actions {
        order: -1;
        /* تظهر أول حاجة في صف الأدوات */
        flex-shrink: 0;
        gap: 6px !important;
    }

    .mobile-action-btn {
        width: 34px !important;
        height: 34px !important;
        font-size: 0.95rem !important;
        flex-shrink: 0;
        border-radius: 10px !important;
    }

    /* خانات البحث - الأولى (رقم البحث) */
    .header-right .search-box:first-of-type,
    .search-box[style*="width: 140px"],
    #search-number-input {
        width: 80px !important;
        min-width: 80px;
        max-width: 80px;
        flex-shrink: 0;
    }

    /* خانة البحث الكبيرة - نخليها تمتد */
    .header-right .search-box:last-of-type {
        flex: 1;
        min-width: 0;
        width: auto !important;
    }

    /* البحث عند التفعيل على الموبايل */
    .search-box:focus-within {
        width: auto !important;
        position: static !important;
        flex: 1;
    }

    /* زر تثبيت التطبيق في الهيدر */
    #install-app-header {
        font-size: 0.7rem !important;
        padding: 4px 8px !important;
        white-space: nowrap;
        flex-shrink: 0;
    }

    /* الريبون - تحسين العرض */
    .ribbon-group button.btn-primary {
        padding: 8px 12px !important;
        font-size: 0.8rem !important;
        min-width: 90px !important;
    }

    .ribbon-group button.btn-primary i {
        font-size: 1.1rem !important;
        margin-bottom: 3px !important;
    }

    /* شريط الحالة السفلي - نخفيه على الموبايل */
    .status-bar {
        display: none;
    }
}

/* للشاشات الصغيرة جداً (أقل من 400px) */
@media (max-width: 400px) {
    .header-left > span:not(#charity-badge) {
        max-width: 100px;
    }

    #sync-indicator-group #sync-status {
        display: none; /* نخفي النص، نسيب الدائرة بس */
    }

    .zoom-controls .reset-zoom {
        display: none; /* نخفي زرار الريست على الشاشات الضيقة */
    }
}

/* ============================================================
   MOBILE FULL-WIDTH FIX v2.8
   إزالة الفراغات الجانبية وتملئة الشاشة كاملاً
============================================================ */
@media (max-width: 1024px) {

    /* المحتوى الرئيسي - بدون padding جانبي */
    .content-area {
        padding: 8px 0 !important;
        width: 100vw !important;
        max-width: 100vw !important;
        overflow-x: hidden !important;
        box-sizing: border-box !important;
    }

    /* كل الكروت تملأ العرض كامل بدون margin جانبي */
    .card {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 0 8px 0 !important;
        border-radius: 0 !important;
        padding: 12px 10px !important;
        box-shadow: none !important;
        border-left: none !important;
        border-right: none !important;
        border-top: none !important;
        border-bottom: 1px solid var(--border-color) !important;
    }

    /* card-header داخل الكرت */
    .card .card-header {
        padding: 0 0 12px 0 !important;
    }

    /* الجدول يملأ العرض كامل */
    .table-container {
        width: 100vw !important;
        max-width: 100vw !important;
        margin: 0 !important;
        padding: 0 !important;
        border-radius: 0 !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }

    /* filter-bar يتكيف مع الموبايل */
    .filter-bar,
    div.filter-bar {
        flex-direction: column !important;
        gap: 10px !important;
        padding: 10px !important;
        align-items: flex-start !important;
    }

    .filter-bar > div,
    .filter-bar > label {
        width: 100% !important;
    }

    /* select في الفلتر */
    #age-filter-select {
        width: 100% !important;
        min-width: unset !important;
    }

    /* عنوان الكرت وزرار الإضافة */
    .card .card-header > div:first-child {
        flex-wrap: wrap !important;
        gap: 8px !important;
    }

    .card .card-header h2 {
        font-size: 1rem !important;
    }

    /* إزالة overflow-x من الـ body */
    body {
        overflow-x: hidden !important;
    }

    /* الـ stats-grid تملأ العرض */
    .stats-grid {
        padding: 0 !important;
        width: 100% !important;
    }

    /* stat-card بدون margin جانبي */
    .stat-card {
        border-radius: 12px !important;
        margin: 0 8px 8px 8px !important;
        width: calc(100% - 16px) !important;
    }

    /* إصلاح الزووم على الموبايل - المحتوى يملأ الشاشة */
    #content-area {
        transform-origin: top right !important;
        width: 100% !important;
    }

    /* إزالة الـ padding من main-content */
    .main-content {
        padding: 0 !important;
    }

    /* الـ ribbon لا يسيب فراغ */
    .ribbon {
        margin: 0 !important;
    }
}

/* ============================================================
   🌙 نظام دورات التوزيع الشهري - Distribution Cycles
   ============================================================ */

/* Cycle Cards hover animation */
.distribution-cycle-card {
    transition: transform 0.3s cubic-bezier(0.25, 1, 0.5, 1), box-shadow 0.3s ease;
}
.distribution-cycle-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(99, 102, 241, 0.15) !important;
}

/* Sidebar Distribution item pulse animation */
@keyframes dist-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.4); }
    50% { box-shadow: 0 0 0 6px rgba(99, 102, 241, 0); }
}
.sidebar-nav li[data-page="distribution"] {
    animation: dist-pulse 3s infinite;
    border-radius: 12px;
}
.sidebar-nav li[data-page="distribution"]:hover {
    background: rgba(99, 102, 241, 0.2) !important;
    animation: none;
}
.sidebar-nav li[data-page="distribution"].active {
    background: linear-gradient(135deg, rgba(99,102,241,0.3), rgba(59,130,246,0.2)) !important;
    border: 1px solid rgba(99,102,241,0.4) !important;
    animation: none;
}

/* Delivery status badges */
.delivery-status-waiting  { background: #fef3c7; color: #92400e; }
.delivery-status-delivered{ background: #d1fae5; color: #065f46; }
.delivery-status-absent   { background: #fee2e2; color: #9b1c1c; }
.delivery-status-deferred { background: #e0e7ff; color: #3730a3; }

/* Progress bars inside cycle cards */
.cycle-progress-bar {
    height: 8px;
    border-radius: 4px;
    background: #e2e8f0;
    overflow: hidden;
}
.cycle-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #6366f1, #3b82f6);
    border-radius: 4px;
    transition: width 0.8s ease;
}

/* Warehouse manager table */
#warehouse-beneficiaries-tbody tr:hover {
    background: #f8fafc !important;
}

/* QR scan screen input animation */
#qr-scan-input:focus {
    border-color: #6366f1 !important;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15) !important;
    outline: none;
}

/* Scan results card hover */
#scan-search-results > div:hover {
    border-color: #6366f1 !important;
    background: #f5f3ff !important;
}

/* Delivery confirmation panel */
#delivery-confirmation-panel {
    transition: all 0.3s ease;
}

/* Wh-type-label interactive */
.wh-type-label:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

/* Mobile responsive for distribution */
@media (max-width: 768px) {
    #delivery-confirmation-panel {
        display: none;
    }
    /* Show full width when panel is active */
    #delivery-confirmation-panel.active {
        display: block !important;
        position: fixed;
        inset: 0;
        z-index: 4000;
        border-radius: 0;
        overflow-y: auto;
        padding-top: 60px;
    }
}
