/* ═══════════════════════════════════════════════════════════════
   محاسبي — Mohasabi Accounting System
   Premium Purple Theme — Designed for Arabic RTL
   Developer: Amer
   ═══════════════════════════════════════════════════════════════ */

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

/* ── CSS Variables ── */
:root {
    --moh-purple-50: #faf5ff;
    --moh-purple-100: #f3e8ff;
    --moh-purple-200: #e9d5ff;
    --moh-purple-300: #d8b4fe;
    --moh-purple-400: #c084fc;
    --moh-purple-500: #a855f7;
    --moh-purple-600: #9333ea;
    --moh-purple-700: #7e22ce;
    --moh-purple-800: #6b21a8;
    --moh-purple-900: #581c87;
    --moh-purple-950: #3b0764;

    --moh-violet-400: #a78bfa;
    --moh-violet-500: #8b5cf6;
    --moh-violet-600: #7c3aed;

    --moh-fuchsia-400: #e879f9;
    --moh-fuchsia-500: #d946ef;

    --moh-indigo-400: #818cf8;
    --moh-indigo-500: #6366f1;

    --moh-slate-50: #f8fafc;
    --moh-slate-100: #f1f5f9;
    --moh-slate-200: #e2e8f0;
    --moh-slate-300: #cbd5e1;
    --moh-slate-400: #94a3b8;
    --moh-slate-500: #64748b;
    --moh-slate-600: #475569;
    --moh-slate-700: #334155;
    --moh-slate-800: #1e293b;
    --moh-slate-900: #0f172a;

    --moh-success: #10b981;
    --moh-success-light: #d1fae5;
    --moh-warning: #f59e0b;
    --moh-warning-light: #fef3c7;
    --moh-danger: #ef4444;
    --moh-danger-light: #fee2e2;
    --moh-info: #06b6d4;
    --moh-info-light: #cffafe;

    --moh-gradient-primary: linear-gradient(135deg, #7e22ce 0%, #9333ea 30%, #a855f7 60%, #c084fc 100%);
    --moh-gradient-sidebar: linear-gradient(180deg, #1a0533 0%, #2d1052 40%, #3b1470 100%);
    --moh-gradient-card: linear-gradient(135deg, rgba(147,51,234,0.05) 0%, rgba(168,85,247,0.02) 100%);
    --moh-gradient-glass: linear-gradient(135deg, rgba(255,255,255,0.9) 0%, rgba(255,255,255,0.7) 100%);
    --moh-gradient-hero: linear-gradient(135deg, #581c87 0%, #7e22ce 40%, #a855f7 80%, #c084fc 100%);

    --moh-shadow-sm: 0 1px 3px rgba(88,28,135,0.08);
    --moh-shadow-md: 0 4px 14px rgba(88,28,135,0.1);
    --moh-shadow-lg: 0 10px 30px rgba(88,28,135,0.12);
    --moh-shadow-xl: 0 20px 60px rgba(88,28,135,0.15);
    --moh-shadow-glow: 0 0 40px rgba(147,51,234,0.2);
    --moh-shadow-card: 0 2px 12px rgba(88,28,135,0.06), 0 0 0 1px rgba(147,51,234,0.04);

    --moh-radius-sm: 8px;
    --moh-radius-md: 12px;
    --moh-radius-lg: 16px;
    --moh-radius-xl: 24px;
    --moh-radius-full: 9999px;

    --sidebar-width: 280px;
    --sidebar-collapsed: 78px;
    --navbar-height: 68px;

    --font-primary: 'Cairo', 'Tajawal', sans-serif;
    --font-display: 'Cairo', sans-serif;
}

/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
    font-size: 15px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-primary);
    background: var(--moh-slate-100);
    color: var(--moh-slate-800);
    direction: rtl;
    text-align: right;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
}

body.auth-page {
    background: var(--moh-purple-950);
    background-image:
        radial-gradient(ellipse at 20% 50%, rgba(147,51,234,0.3) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(139,92,246,0.2) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 100%, rgba(168,85,247,0.15) 0%, transparent 50%);
}

a { text-decoration: none; color: var(--moh-purple-600); transition: color 0.2s; }
a:hover { color: var(--moh-purple-800); }

::selection {
    background: var(--moh-purple-200);
    color: var(--moh-purple-900);
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--moh-purple-300); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--moh-purple-400); }

/* ═══════════════════════════════════════
   SIDEBAR
   ═══════════════════════════════════════ */
.moh-sidebar {
    position: fixed;
    top: 0;
    right: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--moh-gradient-sidebar);
    z-index: 1050;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    border-left: 1px solid rgba(168,85,247,0.1);
    overflow: hidden;
}

.moh-sidebar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        radial-gradient(circle at 80% 20%, rgba(139,92,246,0.15) 0%, transparent 60%),
        radial-gradient(circle at 20% 80%, rgba(168,85,247,0.1) 0%, transparent 60%);
    pointer-events: none;
}

.moh-sidebar.collapsed {
    width: var(--sidebar-collapsed);
}

.moh-sidebar .sidebar-brand {
    padding: 20px 24px;
    display: flex;
    align-items: center;
    gap: 14px;
    border-bottom: 1px solid rgba(168,85,247,0.15);
    position: relative;
    z-index: 1;
    min-height: var(--navbar-height);
}

.moh-sidebar .brand-icon {
    width: 42px;
    height: 42px;
    background: var(--moh-gradient-primary);
    border-radius: var(--moh-radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    color: white;
    flex-shrink: 0;
    box-shadow: 0 4px 15px rgba(147,51,234,0.4);
    position: relative;
}

.moh-sidebar .brand-icon::after {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: var(--moh-radius-md);
    background: var(--moh-gradient-primary);
    opacity: 0.3;
    filter: blur(8px);
    z-index: -1;
}

.moh-sidebar .brand-text {
    color: white;
    font-weight: 800;
    font-size: 1.35rem;
    letter-spacing: -0.02em;
    white-space: nowrap;
    opacity: 1;
    transition: opacity 0.2s;
}

.moh-sidebar.collapsed .brand-text,
.moh-sidebar.collapsed .nav-label,
.moh-sidebar.collapsed .nav-section-title,
.moh-sidebar.collapsed .nav-badge {
    opacity: 0;
    width: 0;
    overflow: hidden;
}

.moh-sidebar .sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 16px 12px;
    position: relative;
    z-index: 1;
}

.moh-sidebar .sidebar-nav::-webkit-scrollbar { width: 3px; }
.moh-sidebar .sidebar-nav::-webkit-scrollbar-thumb { background: rgba(168,85,247,0.3); border-radius: 10px; }

.moh-sidebar .nav-section-title {
    color: rgba(196,181,253,0.5);
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: 12px 14px 6px;
    margin-top: 8px;
    white-space: nowrap;
    transition: opacity 0.2s;
}

.moh-sidebar .nav-item {
    margin-bottom: 2px;
}

.moh-sidebar .nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: var(--moh-radius-md);
    color: rgba(226,215,255,0.7);
    font-weight: 500;
    font-size: 0.88rem;
    transition: all 0.2s ease;
    position: relative;
    white-space: nowrap;
}

.moh-sidebar .nav-link:hover {
    background: rgba(147,51,234,0.15);
    color: white;
    transform: translateX(-2px);
}

.moh-sidebar .nav-link.active {
    background: linear-gradient(135deg, rgba(147,51,234,0.25) 0%, rgba(168,85,247,0.15) 100%);
    color: white;
    font-weight: 600;
    box-shadow: inset 0 0 0 1px rgba(168,85,247,0.2);
}

.moh-sidebar .nav-link.active::before {
    content: '';
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    background: var(--moh-gradient-primary);
    border-radius: 0 var(--moh-radius-full) var(--moh-radius-full) 0;
}

.moh-sidebar .nav-link .nav-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--moh-radius-sm);
    font-size: 1rem;
    flex-shrink: 0;
    background: rgba(168,85,247,0.1);
    transition: all 0.2s;
}

.moh-sidebar .nav-link:hover .nav-icon,
.moh-sidebar .nav-link.active .nav-icon {
    background: rgba(168,85,247,0.2);
    box-shadow: 0 0 12px rgba(147,51,234,0.2);
}

.moh-sidebar .nav-link .nav-label {
    flex: 1;
    transition: opacity 0.2s;
}

.moh-sidebar .nav-badge {
    background: var(--moh-fuchsia-500);
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: var(--moh-radius-full);
    min-width: 20px;
    text-align: center;
    transition: opacity 0.2s;
}

.moh-sidebar .sidebar-footer {
    padding: 16px;
    border-top: 1px solid rgba(168,85,247,0.15);
    position: relative;
    z-index: 1;
}

.moh-sidebar .user-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--moh-radius-md);
    background: rgba(147,51,234,0.1);
    cursor: pointer;
    transition: background 0.2s;
}

.moh-sidebar .user-card:hover {
    background: rgba(147,51,234,0.2);
}

.moh-sidebar .user-avatar {
    width: 38px;
    height: 38px;
    border-radius: var(--moh-radius-full);
    background: var(--moh-gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.moh-sidebar .user-info {
    flex: 1;
    overflow: hidden;
}

.moh-sidebar .user-name {
    color: white;
    font-weight: 600;
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.moh-sidebar .user-role {
    color: rgba(196,181,253,0.5);
    font-size: 0.72rem;
    white-space: nowrap;
}

/* ═══════════════════════════════════════
   NAVBAR
   ═══════════════════════════════════════ */
.moh-navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: var(--sidebar-width);
    height: var(--navbar-height);
    background: rgba(255,255,255,0.85);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid rgba(147,51,234,0.08);
    z-index: 1040;
    display: flex;
    align-items: center;
    padding: 0 28px;
    transition: right 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-collapsed ~ .moh-navbar {
    right: var(--sidebar-collapsed);
}

.moh-navbar .page-title-area {
    display: flex;
    align-items: center;
    gap: 16px;
    flex: 1;
}

.moh-navbar .toggle-sidebar {
    width: 38px;
    height: 38px;
    border-radius: var(--moh-radius-sm);
    border: 1px solid var(--moh-purple-100);
    background: white;
    color: var(--moh-purple-600);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 1.1rem;
}

.moh-navbar .toggle-sidebar:hover {
    background: var(--moh-purple-50);
    border-color: var(--moh-purple-200);
    transform: scale(1.05);
}

.moh-navbar .page-title {
    font-weight: 700;
    font-size: 1.15rem;
    color: var(--moh-slate-800);
}

.moh-navbar .page-subtitle {
    font-size: 0.78rem;
    color: var(--moh-slate-400);
    font-weight: 400;
}

.moh-navbar .navbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.moh-navbar .nav-action-btn {
    width: 40px;
    height: 40px;
    border-radius: var(--moh-radius-full);
    border: none;
    background: transparent;
    color: var(--moh-slate-500);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.1rem;
    transition: all 0.2s;
    position: relative;
}

.moh-navbar .nav-action-btn:hover {
    background: var(--moh-purple-50);
    color: var(--moh-purple-600);
}

.moh-navbar .nav-action-btn .badge-dot {
    position: absolute;
    top: 8px;
    left: 10px;
    width: 8px;
    height: 8px;
    background: var(--moh-danger);
    border-radius: 50%;
    border: 2px solid white;
}

.moh-navbar .search-box {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--moh-slate-50);
    border: 1px solid var(--moh-slate-200);
    border-radius: var(--moh-radius-full);
    padding: 0 16px;
    height: 40px;
    min-width: 260px;
    transition: all 0.3s;
}

.moh-navbar .search-box:focus-within {
    border-color: var(--moh-purple-300);
    background: white;
    box-shadow: 0 0 0 3px rgba(147,51,234,0.1);
}

.moh-navbar .search-box i { color: var(--moh-slate-400); font-size: 0.9rem; }

.moh-navbar .search-box input {
    border: none;
    background: transparent;
    outline: none;
    font-family: var(--font-primary);
    font-size: 0.85rem;
    color: var(--moh-slate-700);
    width: 100%;
    direction: rtl;
}

.moh-navbar .search-box input::placeholder {
    color: var(--moh-slate-400);
}

/* ═══════════════════════════════════════
   MAIN CONTENT
   ═══════════════════════════════════════ */
.moh-main {
    margin-right: var(--sidebar-width);
    margin-top: var(--navbar-height);
    padding: 28px;
    min-height: calc(100vh - var(--navbar-height));
    transition: margin-right 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-collapsed ~ .moh-main {
    margin-right: var(--sidebar-collapsed);
}

/* ═══════════════════════════════════════
   CARDS & CONTAINERS
   ═══════════════════════════════════════ */
.moh-card {
    background: white;
    border-radius: var(--moh-radius-lg);
    border: 1px solid rgba(147,51,234,0.06);
    box-shadow: var(--moh-shadow-card);
    overflow: hidden;
    transition: all 0.3s ease;
}

.moh-card:hover {
    box-shadow: var(--moh-shadow-md);
}

.moh-card .card-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--moh-slate-100);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--moh-gradient-card);
}

.moh-card .card-header h3 {
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--moh-slate-800);
    display: flex;
    align-items: center;
    gap: 10px;
}

.moh-card .card-header h3 i {
    color: var(--moh-purple-500);
    font-size: 1.1rem;
}

.moh-card .card-body {
    padding: 24px;
}

.moh-card .card-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--moh-slate-100);
    background: var(--moh-slate-50);
}

/* ── Stat Cards ── */
.moh-stat-card {
    background: white;
    border-radius: var(--moh-radius-lg);
    padding: 24px;
    border: 1px solid rgba(147,51,234,0.06);
    box-shadow: var(--moh-shadow-card);
    display: flex;
    align-items: flex-start;
    gap: 18px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.moh-stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 100%;
    height: 3px;
    background: var(--moh-gradient-primary);
    opacity: 0;
    transition: opacity 0.3s;
}

.moh-stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--moh-shadow-lg);
}

.moh-stat-card:hover::before {
    opacity: 1;
}

.moh-stat-card .stat-icon {
    width: 54px;
    height: 54px;
    border-radius: var(--moh-radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
}

.moh-stat-card .stat-icon.purple {
    background: linear-gradient(135deg, var(--moh-purple-100) 0%, var(--moh-purple-50) 100%);
    color: var(--moh-purple-600);
}

.moh-stat-card .stat-icon.green {
    background: linear-gradient(135deg, #d1fae5 0%, #ecfdf5 100%);
    color: #059669;
}

.moh-stat-card .stat-icon.blue {
    background: linear-gradient(135deg, #dbeafe 0%, #eff6ff 100%);
    color: #2563eb;
}

.moh-stat-card .stat-icon.orange {
    background: linear-gradient(135deg, #fed7aa 0%, #fff7ed 100%);
    color: #ea580c;
}

.moh-stat-card .stat-icon.pink {
    background: linear-gradient(135deg, #fce7f3 0%, #fdf2f8 100%);
    color: #db2777;
}

.moh-stat-card .stat-icon.cyan {
    background: linear-gradient(135deg, #cffafe 0%, #ecfeff 100%);
    color: #0891b2;
}

.moh-stat-card .stat-content { flex: 1; }

.moh-stat-card .stat-label {
    font-size: 0.78rem;
    color: var(--moh-slate-500);
    font-weight: 500;
    margin-bottom: 6px;
}

.moh-stat-card .stat-value {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--moh-slate-800);
    line-height: 1.2;
    letter-spacing: -0.02em;
}

.moh-stat-card .stat-change {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.72rem;
    font-weight: 600;
    margin-top: 6px;
    padding: 2px 8px;
    border-radius: var(--moh-radius-full);
}

.moh-stat-card .stat-change.up {
    background: var(--moh-success-light);
    color: #059669;
}

.moh-stat-card .stat-change.down {
    background: var(--moh-danger-light);
    color: var(--moh-danger);
}

/* ═══════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════ */
.moh-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 22px;
    border-radius: var(--moh-radius-md);
    font-family: var(--font-primary);
    font-weight: 600;
    font-size: 0.88rem;
    border: none;
    cursor: pointer;
    transition: all 0.25s ease;
    white-space: nowrap;
    text-decoration: none;
    position: relative;
    overflow: hidden;
}

.moh-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s ease;
}

.moh-btn:hover::before {
    left: 100%;
}

.moh-btn-primary {
    background: var(--moh-gradient-primary);
    color: white;
    box-shadow: 0 4px 14px rgba(147,51,234,0.3);
}

.moh-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(147,51,234,0.4);
    color: white;
}

.moh-btn-secondary {
    background: white;
    color: var(--moh-purple-600);
    border: 1px solid var(--moh-purple-200);
}

.moh-btn-secondary:hover {
    background: var(--moh-purple-50);
    border-color: var(--moh-purple-300);
    color: var(--moh-purple-700);
}

.moh-btn-ghost {
    background: transparent;
    color: var(--moh-slate-600);
    border: 1px solid var(--moh-slate-200);
}

.moh-btn-ghost:hover {
    background: var(--moh-slate-50);
    color: var(--moh-slate-700);
}

.moh-btn-success {
    background: linear-gradient(135deg, #059669, #10b981);
    color: white;
    box-shadow: 0 4px 14px rgba(16,185,129,0.3);
}

.moh-btn-danger {
    background: linear-gradient(135deg, #dc2626, #ef4444);
    color: white;
    box-shadow: 0 4px 14px rgba(239,68,68,0.3);
}

.moh-btn-sm {
    padding: 6px 14px;
    font-size: 0.8rem;
    border-radius: var(--moh-radius-sm);
    margin-top: 7px;
}

.moh-btn-lg {
    padding: 14px 30px;
    font-size: 1rem;
    border-radius: var(--moh-radius-lg);
}

.moh-btn-icon {
    width: 38px;
    height: 38px;
    padding: 0;
    justify-content: center;
}

/* ═══════════════════════════════════════
   FORMS
   ═══════════════════════════════════════ */
.moh-form-group {
    margin-bottom: 20px;
}

.moh-form-group label {
    display: block;
    font-weight: 600;
    font-size: 0.82rem;
    color: var(--moh-slate-700);
    margin-bottom: 6px;
}

.moh-form-control {
    width: 100%;
    padding: 10px 16px;
    border: 1.5px solid var(--moh-slate-200);
    border-radius: var(--moh-radius-md);
    font-family: var(--font-primary);
    font-size: 0.88rem;
    color: var(--moh-slate-800);
    background: white;
    transition: all 0.25s ease;
    direction: rtl;
    outline: none;
}

.moh-form-control:focus {
    border-color: var(--moh-purple-400);
    box-shadow: 0 0 0 3px rgba(147,51,234,0.1);
}

.moh-form-control::placeholder {
    color: var(--moh-slate-400);
}

select.moh-form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2394a3b8' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: left 14px center;
    padding-left: 36px;
}

textarea.moh-form-control {
    resize: vertical;
    min-height: 100px;
}

/* ═══════════════════════════════════════
   TABLES
   ═══════════════════════════════════════ */
.moh-table-wrapper {
    overflow-x: auto;
    border-radius: var(--moh-radius-lg);
}

.moh-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.88rem;
}

.moh-table thead th {
    background: linear-gradient(135deg, var(--moh-purple-50), var(--moh-slate-50));
    color: var(--moh-slate-600);
    font-weight: 700;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 14px 18px;
    border-bottom: 2px solid var(--moh-purple-100);
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 10;
}

.moh-table tbody tr {
    transition: all 0.15s ease;
}

.moh-table tbody tr:hover {
    background: rgba(147,51,234,0.03);
}

.moh-table tbody td {
    padding: 14px 18px;
    border-bottom: 1px solid var(--moh-slate-100);
    color: var(--moh-slate-700);
    vertical-align: middle;
}

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

/* ── Status Badges ── */
.moh-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 12px;
    border-radius: var(--moh-radius-full);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.moh-badge-purple { background: var(--moh-purple-100); color: var(--moh-purple-700); }
.moh-badge-green { background: var(--moh-success-light); color: #059669; }
.moh-badge-yellow { background: var(--moh-warning-light); color: #b45309; }
.moh-badge-red { background: var(--moh-danger-light); color: var(--moh-danger); }
.moh-badge-blue { background: #dbeafe; color: #2563eb; }
.moh-badge-gray { background: var(--moh-slate-100); color: var(--moh-slate-600); }
.moh-badge-cyan { background: var(--moh-info-light); color: #0e7490; }

.moh-badge-dot::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

/* ═══════════════════════════════════════
   PAGINATION
   ═══════════════════════════════════════ */
.moh-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    margin-top: 24px;
}

.moh-pagination .page-btn {
    width: 38px;
    height: 38px;
    border: 1px solid var(--moh-slate-200);
    background: white;
    color: var(--moh-slate-600);
    border-radius: var(--moh-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
    font-family: var(--font-primary);
}

.moh-pagination .page-btn:hover {
    background: var(--moh-purple-50);
    border-color: var(--moh-purple-200);
    color: var(--moh-purple-600);
}

.moh-pagination .page-btn.active {
    background: var(--moh-gradient-primary);
    color: white;
    border-color: transparent;
    box-shadow: 0 3px 10px rgba(147,51,234,0.3);
}

/* ═══════════════════════════════════════
   AUTH PAGES
   ═══════════════════════════════════════ */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    position: relative;
}

.auth-container::before {
    content: '';
    position: absolute;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(147,51,234,0.15), transparent 70%);
    top: -100px;
    right: -100px;
    pointer-events: none;
    animation: authGlow 8s ease-in-out infinite alternate;
}

@keyframes authGlow {
    0% { transform: translate(0, 0) scale(1); opacity: 0.5; }
    100% { transform: translate(-50px, 50px) scale(1.2); opacity: 0.8; }
}

.auth-card {
    width: 100%;
    max-width: 440px;
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px);
    border-radius: var(--moh-radius-xl);
    padding: 48px 40px;
    box-shadow: 0 30px 80px rgba(0,0,0,0.3), 0 0 0 1px rgba(255,255,255,0.1);
    position: relative;
    z-index: 1;
}

.auth-card .auth-logo {
    text-align: center;
    margin-bottom: 36px;
}

.auth-card .auth-logo .logo-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
    background: var(--moh-gradient-primary);
    border-radius: var(--moh-radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    color: white;
    box-shadow: 0 8px 25px rgba(147,51,234,0.4);
}

.auth-card .auth-logo h1 {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--moh-purple-900);
    margin-bottom: 6px;
}

.auth-card .auth-logo p {
    color: var(--moh-slate-500);
    font-size: 0.88rem;
}

.auth-card .auth-form .moh-form-control {
    padding: 12px 18px;
    font-size: 0.92rem;
    border-radius: var(--moh-radius-md);
}

.auth-card .auth-footer {
    text-align: center;
    margin-top: 28px;
    color: var(--moh-slate-500);
    font-size: 0.85rem;
}

.auth-card .auth-footer a {
    color: var(--moh-purple-600);
    font-weight: 600;
}

/* ═══════════════════════════════════════
   CHARTS & DASHBOARD
   ═══════════════════════════════════════ */
.moh-chart-card {
    background: white;
    border-radius: var(--moh-radius-lg);
    border: 1px solid rgba(147,51,234,0.06);
    box-shadow: var(--moh-shadow-card);
    padding: 24px;
}

.moh-chart-card .chart-title {
    font-weight: 700;
    font-size: 1rem;
    color: var(--moh-slate-800);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.moh-chart-card .chart-title i {
    color: var(--moh-purple-500);
}

/* ── Quick Actions Grid ── */
.quick-actions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 14px;
}

.quick-action-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 18px;
    border-radius: var(--moh-radius-md);
    background: white;
    border: 1px solid var(--moh-slate-200);
    cursor: pointer;
    transition: all 0.25s ease;
    text-decoration: none;
    color: var(--moh-slate-700);
}

.quick-action-item:hover {
    border-color: var(--moh-purple-300);
    background: var(--moh-purple-50);
    transform: translateY(-2px);
    box-shadow: var(--moh-shadow-md);
    color: var(--moh-purple-700);
}

.quick-action-item .action-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--moh-radius-sm);
    background: var(--moh-purple-50);
    color: var(--moh-purple-500);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.quick-action-item:hover .action-icon {
    background: var(--moh-purple-100);
}

.quick-action-item .action-text {
    font-weight: 600;
    font-size: 0.85rem;
}

/* ═══════════════════════════════════════
   MODALS
   ═══════════════════════════════════════ */
.moh-modal-backdrop {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15,23,42,0.5);
    backdrop-filter: blur(4px);
    z-index: 1060;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.2s ease;
}

.moh-modal {
    background: white;
    border-radius: var(--moh-radius-xl);
    width: 100%;
    max-width: 640px;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: var(--moh-shadow-xl);
    animation: slideUp 0.3s ease;
}

.moh-modal-header {
    padding: 24px 28px;
    border-bottom: 1px solid var(--moh-slate-100);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.moh-modal-header h3 {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--moh-slate-800);
}

.moh-modal-body {
    padding: 28px;
    overflow-y: auto;
    max-height: calc(90vh - 160px);
}

.moh-modal-footer {
    padding: 18px 28px;
    border-top: 1px solid var(--moh-slate-100);
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
}

.moh-modal.lg { max-width: 860px; }
.moh-modal.xl { max-width: 1100px; }

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(30px) scale(0.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ═══════════════════════════════════════
   EMPTY STATE
   ═══════════════════════════════════════ */
.moh-empty-state {
    text-align: center;
    padding: 60px 20px;
}

.moh-empty-state .empty-icon {
    width: 80px;
    height: 80px;
    border-radius: var(--moh-radius-xl);
    background: var(--moh-purple-50);
    color: var(--moh-purple-300);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    margin: 0 auto 20px;
}

.moh-empty-state h4 {
    font-weight: 700;
    color: var(--moh-slate-700);
    margin-bottom: 8px;
}

.moh-empty-state p {
    color: var(--moh-slate-400);
    font-size: 0.88rem;
    margin-bottom: 24px;
}

/* ═══════════════════════════════════════
   TABS
   ═══════════════════════════════════════ */
.moh-tabs {
    display: flex;
    gap: 4px;
    border-bottom: 2px solid var(--moh-slate-100);
    margin-bottom: 24px;
}

.moh-tab {
    padding: 12px 20px;
    font-weight: 600;
    font-size: 0.88rem;
    color: var(--moh-slate-500);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
    background: none;
    border-top: none;
    border-left: none;
    border-right: none;
    font-family: var(--font-primary);
}

.moh-tab:hover {
    color: var(--moh-purple-600);
}

.moh-tab.active {
    color: var(--moh-purple-600);
    border-bottom-color: var(--moh-purple-600);
}

/* ═══════════════════════════════════════
   ALERTS
   ═══════════════════════════════════════ */
.moh-alert {
    padding: 14px 20px;
    border-radius: var(--moh-radius-md);
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.88rem;
    font-weight: 500;
    margin-bottom: 20px;
    border: 1px solid transparent;
}

.moh-alert-success {
    background: var(--moh-success-light);
    border-color: #a7f3d0;
    color: #065f46;
}

.moh-alert-error {
    background: var(--moh-danger-light);
    border-color: #fecaca;
    color: #991b1b;
}

.moh-alert-warning {
    background: var(--moh-warning-light);
    border-color: #fde68a;
    color: #92400e;
}

.moh-alert-info {
    background: var(--moh-purple-50);
    border-color: var(--moh-purple-100);
    color: var(--moh-purple-800);
}

/* ═══════════════════════════════════════
   INVOICE PRINT PREVIEW
   ═══════════════════════════════════════ */
.invoice-preview {
    max-width: 800px;
    margin: 0 auto;
    background: white;
    border-radius: var(--moh-radius-xl);
    box-shadow: var(--moh-shadow-lg);
    overflow: hidden;
}

.invoice-preview .invoice-header-band {
    background: var(--moh-gradient-hero);
    padding: 40px;
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.invoice-preview .invoice-header-band h2 {
    font-size: 2rem;
    font-weight: 800;
}

.invoice-preview .invoice-body { padding: 40px; }

/* ═══════════════════════════════════════
   LOADING / SKELETON
   ═══════════════════════════════════════ */
.moh-skeleton {
    background: linear-gradient(90deg, var(--moh-slate-100) 25%, var(--moh-slate-50) 50%, var(--moh-slate-100) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
    border-radius: var(--moh-radius-sm);
}

@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.moh-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--moh-purple-100);
    border-top-color: var(--moh-purple-600);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ═══════════════════════════════════════
   TOAST NOTIFICATIONS
   ═══════════════════════════════════════ */
.moh-toast-container {
    position: fixed;
    top: 24px;
    left: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.moh-toast {
    background: white;
    border-radius: var(--moh-radius-md);
    padding: 16px 20px;
    box-shadow: var(--moh-shadow-lg);
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 320px;
    animation: toastIn 0.3s ease;
    border-right: 4px solid var(--moh-purple-500);
}

.moh-toast.success { border-right-color: var(--moh-success); }
.moh-toast.error { border-right-color: var(--moh-danger); }
.moh-toast.warning { border-right-color: var(--moh-warning); }

@keyframes toastIn {
    from { opacity: 0; transform: translateX(-30px); }
    to { opacity: 1; transform: translateX(0); }
}

/* ═══════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════ */
.moh-sidebar-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1045;
}

@media (max-width: 1024px) {
    .moh-sidebar {
        transform: translateX(100%);
    }
    .moh-sidebar.mobile-open {
        transform: translateX(0);
    }
    .moh-sidebar.mobile-open + .moh-sidebar-overlay {
        display: block;
    }
    .moh-navbar {
        right: 0;
    }
    .moh-main {
        margin-right: 0;
    }
    .sidebar-collapsed ~ .moh-navbar { right: 0; }
    .sidebar-collapsed ~ .moh-main { margin-right: 0; }
}

@media (max-width: 768px) {
    .moh-main { padding: 16px; }
    .moh-navbar { padding: 0 16px; }
    .moh-navbar .search-box { display: none; }
    .auth-card { padding: 32px 24px; }
    .moh-stat-card { padding: 16px; }
    .moh-stat-card .stat-value { font-size: 1.3rem; }
}

/* ═══════════════════════════════════════
   UTILITY CLASSES
   ═══════════════════════════════════════ */
.text-purple { color: var(--moh-purple-600) !important; }
.text-muted { color: var(--moh-slate-500) !important; }
.text-success { color: var(--moh-success) !important; }
.text-danger { color: var(--moh-danger) !important; }
.text-warning { color: var(--moh-warning) !important; }
.bg-purple-50 { background: var(--moh-purple-50) !important; }
.fw-800 { font-weight: 800 !important; }
.gap-sm { gap: 8px; }
.gap-md { gap: 16px; }
.gap-lg { gap: 24px; }
.d-grid { display: grid; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 1200px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 768px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }

.currency::after { content: ' ر.س'; font-size: 0.75em; color: var(--moh-slate-400); }

/* ── Animations ── */
.fade-in { animation: fadeIn 0.4s ease; }
.slide-in { animation: slideUp 0.4s ease; }

/* ── Print ── */

    .moh-main { margin: 0; padding: 0; }
    body { background: white; }
}

/* ═══════════════════════════════════════
   ACCESSIBILITY
   ═══════════════════════════════════════ */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
    border-width: 0;
}

*:focus-visible {
    outline: 2px solid var(--moh-purple-500);
    outline-offset: 2px;
    border-radius: 2px;
}

.moh-sidebar .nav-link:focus-visible {
    outline-color: var(--moh-purple-300);
    background: rgba(147,51,234,0.15);
}

[role="button"],
button,
a,
input,
select,
textarea {
    -webkit-tap-highlight-color: rgba(147,51,234,0.15);
}

/* Skip to content link */
.skip-to-content {
    position: absolute;
    top: -100px;
    right: 0;
    background: var(--moh-purple-600);
    color: white;
    padding: 10px 20px;
    z-index: 9999;
    border-radius: 0 0 0 var(--moh-radius-md);
    font-weight: 700;
    transition: top 0.3s;
}
.skip-to-content:focus {
    top: 0;
    color: white;
}

/* ═══════════════════════════════════════
   SKELETON LOADING
   ═══════════════════════════════════════ */
.moh-skeleton-card {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 28px;
}

.moh-skeleton-card .skel-item {
    background: white;
    border-radius: var(--moh-radius-lg);
    padding: 24px;
    border: 1px solid rgba(147,51,234,0.06);
}

.skel-line {
    height: 14px;
    border-radius: 6px;
    margin-bottom: 10px;
    background: linear-gradient(90deg, var(--moh-slate-100) 25%, var(--moh-slate-50) 50%, var(--moh-slate-100) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
}

.skel-line.w-50 { width: 50%; }
.skel-line.w-70 { width: 70%; }
.skel-line.w-30 { width: 30%; }
.skel-line.h-lg { height: 24px; }
.skel-line.h-xl { height: 32px; margin-bottom: 14px; }

.skel-circle {
    width: 54px;
    height: 54px;
    border-radius: var(--moh-radius-md);
    background: linear-gradient(90deg, var(--moh-slate-100) 25%, var(--moh-slate-50) 50%, var(--moh-slate-100) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
}

.skel-table {
    width: 100%;
}

.skel-table .skel-row {
    display: grid;
    grid-template-columns: 1fr 2fr 1fr 1fr 1fr;
    gap: 12px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--moh-slate-100);
}

/* ═══════════════════════════════════════
   MOBILE TABLE RESPONSIVE
   ═══════════════════════════════════════ */
@media (max-width: 768px) {
    .moh-table-responsive-mobile thead {
        display: none;
    }

    .moh-table-responsive-mobile tbody tr {
        display: block;
        padding: 16px;
        margin-bottom: 12px;
        border: 1px solid var(--moh-slate-200);
        border-radius: var(--moh-radius-md);
        background: white;
    }

    .moh-table-responsive-mobile tbody td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 8px 0;
        border-bottom: 1px solid var(--moh-slate-50);
    }

    .moh-table-responsive-mobile tbody td:last-child {
        border-bottom: none;
    }

    .moh-table-responsive-mobile tbody td::before {
        content: attr(data-label);
        font-weight: 700;
        font-size: 0.78rem;
        color: var(--moh-slate-500);
        margin-left: 12px;
    }

    .moh-stat-card .stat-value {
        font-size: 1.1rem;
    }

    .moh-skeleton-card {
        grid-template-columns: 1fr 1fr;
    }

    .quick-actions-grid {
        grid-template-columns: 1fr;
    }
}

/* ═══════════════════════════════════════
   GLOBAL ERROR BANNER
   ═══════════════════════════════════════ */
.moh-error-banner {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--moh-danger);
    color: white;
    padding: 12px 24px;
    border-radius: var(--moh-radius-full);
    font-weight: 600;
    font-size: 0.88rem;
    z-index: 9998;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 8px 30px rgba(239,68,68,0.3);
    animation: slideUp 0.3s ease;
}

.moh-offline-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: var(--moh-warning);
    color: #92400e;
    text-align: center;
    padding: 8px;
    font-weight: 700;
    font-size: 0.82rem;
    z-index: 9999;
}

/* ═══════════════════════════════════════
   HIGH CONTRAST MODE (a11y)
   ═══════════════════════════════════════ */
@media (prefers-contrast: high) {
    :root {
        --moh-purple-600: #7e22ce;
        --moh-slate-400: #475569;
    }
    .moh-stat-card, .moh-card {
        border-width: 2px;
    }
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}


/* ═══════════════════════════════════════════════════════════
   Print Styles — Developer: Amer
   ═══════════════════════════════════════════════════════════ */
@media print {
    /* إخفاء العناصر غير المطلوبة */
    .moh-sidebar, .moh-navbar, .moh-sidebar-overlay, .moh-toast-container,
    .no-print, .skip-to-content, .search-box, .badge-dot,
    .card-footer button, .moh-btn, .moh-form-group select,
    .moh-form-group input[type="date"] { display: none !important; }

    /* إعادة ضبط التخطيط */
    body { background: white !important; margin: 0 !important; padding: 0 !important; font-size: 11pt !important; }
    .moh-main { margin: 0 !important; padding: 10px !important; }

    /* البطاقات والجداول */
    .moh-card { border: 1px solid #ddd !important; box-shadow: none !important; break-inside: avoid; margin-bottom: 12px !important; }
    .moh-stat-card { border: 1px solid #ddd !important; box-shadow: none !important; }
    .moh-table { font-size: 9pt !important; }
    .moh-table th { background: #f3f4f6 !important; color: #1a1a1a !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .moh-table td, .moh-table th { padding: 6px 8px !important; border: 1px solid #ddd !important; }

    /* الفاتورة */
    .invoice-print-area { border: none !important; border-radius: 0 !important; }

    /* ألوان الطباعة */
    * { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }

    /* فاصل صفحات */
    .page-break { page-break-before: always; }

    /* رأس وذيل الصفحة */
    @page { margin: 15mm 10mm; size: A4; }

    /* إخفاء labels القوالب */
    .template-label { display: none !important; }
}

/* ═══ Toolbar ═══ */
.moh-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 23px;
}
.moh-toolbar .toolbar-right {
    display: flex;
    gap: 8px;
    align-items: center;
}
/* ── SIDEBAR ── */
.moh-sidebar {
    position: fixed;
    top: 0;
    right: 0;          /* RTL: sidebar on the right */
    width: 260px;
    height: 100vh;
    overflow-y: auto;
    z-index: 300;
}

/* ── NAVBAR ── */
.moh-navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 260px;      /* don't overlap the sidebar */
    height: 64px;
    z-index: 200;
}

/* ── MAIN CONTENT ── */
.moh-main {
    margin-right: 260px;   /* push away from sidebar (RTL) */
    padding-top: 64px;     /* push below navbar */
    min-height: 100vh;
    padding-right: 24px;
    padding-left: 24px;
    box-sizing: border-box;
}

/* ── OVERLAY (mobile) ── */
.moh-sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 299;
}

/* ── MOBILE: collapse sidebar ── */
@media (max-width: 768px) {
    .moh-sidebar {
        transform: translateX(100%);   /* RTL: slide off to the right */
        transition: transform 0.3s ease;
    }

    .moh-sidebar.open {
        transform: translateX(0);
    }

    .moh-sidebar.open ~ .moh-sidebar-overlay {
        display: block;
    }

    .moh-navbar {
        right: 0;   /* full width on mobile */
    }

    .moh-main {
        margin-right: 0;
    }
}