﻿@import url('https://cdn.jsdelivr.net/gh/rastikerdar/vazirmatn@v33.003/Vazirmatn-font-face.css');

/* ============================================================
   1. RESET & BASE VARIABLES (LIGHT THEME)
   ============================================================ */
* {
    font-family: 'Vazirmatn', sans-serif !important;
    letter-spacing: -0.01em !important;
    box-sizing: border-box;
}

:root {
    --brand: #059669;
    --brand-light: #10b981;
    --brand-dark: #064e3b;
    --brand-glow: rgba(16, 185, 129, .15);
    --accent-amber: #f59e0b;
    --accent-blue: #3b82f6;
    --accent-purple: #8b5cf6;
    --accent-rose: #f43f5e;
    --accent-cyan: #06b6d4;
    --sp-1: 4px;
    --sp-2: 8px;
    --sp-3: 12px;
    --sp-4: 16px;
    --sp-5: 20px;
    --sp-6: 24px;
    --sp-8: 32px;
    --sp-10: 40px;
    --sp-12: 48px;
    --r-xs: 8px;
    --r-sm: 10px;
    --r-md: 14px;
    --r-lg: 18px;
    --r-xl: 22px;
    --r-full: 9999px;
    --bg-body: #f5f7f6;
    --bg-card: #ffffff;
    --bg-surface: #ffffff;
    --bg-muted: #f0f3f2;
    --bg-muted-strong: #e4e9e7;
    --bg-glass: rgba(255, 255, 255, .85);
    --border: #e2e8e5;
    --border-focus: #059669;
    --text-primary: #0f1f1a;
    --text-secondary: #5f7a71;
    --text-disabled: #9cb3ab;
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, .04);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, .05), 0 1px 2px rgba(0, 0, 0, .03);
    --shadow-md: 0 4px 12px -2px rgba(0, 0, 0, .08);
    --shadow-lg: 0 12px 28px -8px rgba(0, 0, 0, .12);
    --shadow-brand: 0 8px 24px -6px rgba(5, 150, 105, .35);
    --shadow-card-hover: 0 12px 32px -8px rgba(5, 150, 105, .15);
    --shadow-glow: 0 0 20px rgba(16, 185, 129, .2);
    --ease: cubic-bezier(.4, 0, .2, 1);
    --ease-spring: cubic-bezier(.34, 1.56, .64, 1);
    --duration: .25s;
    /* تگ‌ها در حالت لایت */
    --tag-green-bg: rgba(5, 150, 105, .12);
    --tag-green-text: #059669;
    --tag-amber-bg: rgba(245, 158, 11, .12);
    --tag-amber-text: #d97706;
    --tag-red-bg: rgba(244, 63, 94, .12);
    --tag-red-text: #e11d48;
    --tag-blue-bg: rgba(59, 130, 246, .12);
    --tag-blue-text: #2563eb;
}

/* ============================================================
   2. DARK MODE SYSTEM ENGINE (VARIABLE OVERRIDES)
   ============================================================ */
.mud-theme-dark,
.mud-theme-dark * {
    color-scheme: dark;
}

.mud-theme-dark {
    --bg-body: #070e0b !important;
    --bg-card: #0e1b15 !important;
    --bg-surface: #0e1b15 !important;
    --bg-muted: #152720 !important;
    --bg-muted-strong: #1e362c !important;
    --bg-glass: rgba(14, 27, 21, .85) !important;
    --border: #1d332a !important;
    --border-focus: #10b981 !important;
    --text-primary: #ecf3f0 !important;
    --text-secondary: #8ea99f !important;
    --text-disabled: #557367 !important;
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, .5);
    --shadow-md: 0 6px 16px -2px rgba(0, 0, 0, .6);
    --shadow-lg: 0 14px 32px -8px rgba(0, 0, 0, .7);
    --shadow-brand: 0 8px 24px -6px rgba(16, 185, 129, .25);
    --shadow-card-hover: 0 12px 32px -8px rgba(16, 185, 129, .15);
    --shadow-glow: 0 0 30px rgba(16, 185, 129, .18);
    /* بازنویسی رنگ تگ‌ها برای دارک مود (خوانایی عالی و ملایم) */
    --tag-green-bg: rgba(16, 185, 129, 0.16);
    --tag-green-text: #34d399;
    --tag-amber-bg: rgba(245, 158, 11, 0.16);
    --tag-amber-text: #fbbf24;
    --tag-red-bg: rgba(244, 63, 94, 0.16);
    --tag-red-text: #fb7185;
    --tag-blue-bg: rgba(59, 130, 246, 0.16);
    --tag-blue-text: #60a5fa;
}

html, body {
    background-color: var(--bg-body) !important;
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
}

body {
    direction: rtl;
    text-align: right;
    font-size: 14px;
    color: var(--text-primary) !important;
}

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--bg-muted-strong);
    border-radius: var(--r-full);
}

::selection {
    background: rgba(16, 185, 129, .35);
    color: #fff;
}

/* ============================================================
   3. APP BAR & NAVIGATION
   ============================================================ */
.glass-appbar {
    background: var(--bg-glass) !important;
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    border-bottom: 1px solid var(--border) !important;
    box-shadow: none !important;
    height: 64px !important;
}

    .glass-appbar .mud-toolbar {
        min-height: 64px !important;
        padding: 0 var(--sp-5) !important;
    }

.brand-icon-box {
    width: 38px;
    height: 38px;
    border-radius: var(--r-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(145deg, var(--brand-light), var(--brand-dark));
    box-shadow: var(--shadow-brand);
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
}

    .brand-icon-box::after {
        content: '';
        position: absolute;
        inset: 0;
        background: linear-gradient(135deg, rgba(255,255,255,.2) 0%, transparent 60%);
    }

.header-search {
    background: var(--bg-muted);
    border-radius: var(--r-sm);
    border: 1.5px solid transparent;
    transition: all var(--duration) var(--ease);
    width: 300px;
    height: 38px;
}

    .header-search:focus-within {
        border-color: var(--border-focus);
        box-shadow: 0 0 0 3px var(--brand-glow);
        background: var(--bg-card);
    }

    .header-search .mud-input-slot {
        font-size: 13px !important;
    }

.status-live-chip {
    background: rgba(16,185,129,.12) !important;
    color: var(--brand-light) !important;
    border: 1px solid rgba(16,185,129,.25) !important;
    font-weight: 700 !important;
    font-size: 11px !important;
    border-radius: var(--r-full) !important;
    height: 28px !important;
}

.status-live-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--brand-light);
    display: inline-block;
    margin-left: 5px;
    box-shadow: 0 0 0 3px rgba(16,185,129,.18);
    animation: livePulse 2s ease-in-out infinite;
}

@keyframes livePulse {
    0%,100% {
        opacity: 1;
        box-shadow: 0 0 0 3px rgba(16,185,129,.18);
    }

    50% {
        opacity: .5;
        box-shadow: 0 0 0 5px rgba(16,185,129,.08);
    }
}

.icon-btn-sm {
    border-radius: var(--r-xs) !important;
}

    .icon-btn-sm:hover {
        background: var(--bg-muted) !important;
    }

    .icon-btn-sm .mud-icon-root {
        font-size: 20px !important;
    }

.profile-pill {
    display: flex;
    align-items: center;
    padding: 4px 10px 4px 6px;
    border-radius: var(--r-sm);
    border: 1.5px solid transparent;
    cursor: pointer;
    transition: all var(--duration) var(--ease);
    height: 42px;
}

    .profile-pill:hover {
        background: var(--bg-muted);
        border-color: var(--border);
    }

.mud-drawer {
    border-left: 1px solid var(--border) !important;
    background: var(--bg-card) !important;
}

.sidebar-header-box {
    height: 64px;
    display: flex;
    align-items: center;
    padding: 0 var(--sp-5) !important;
    border-bottom: 1px solid var(--border);
}

.ehsan-nav-menu {
    padding: var(--sp-3) var(--sp-2) !important;
}

.nav-section-label {
    font-size: 10px;
    font-weight: 800;
    color: var(--text-disabled);
    text-transform: uppercase;
    letter-spacing: 0.08em !important;
    padding: var(--sp-5) var(--sp-4) var(--sp-1);
    display: block;
    user-select: none;
}

.mud-nav-link {
    border-radius: var(--r-xs) !important;
    margin: 1px var(--sp-2) !important;
    padding: 8px var(--sp-3) !important;
    font-weight: 500 !important;
    font-size: 13px !important;
    min-height: 36px !important;
    transition: all .15s var(--ease) !important;
    color: var(--text-secondary) !important;
}

    .mud-nav-link .mud-icon-root {
        font-size: 18px !important;
        opacity: .7;
    }

    .mud-nav-link:hover {
        background: var(--bg-muted) !important;
        color: var(--text-primary) !important;
    }

        .mud-nav-link:hover .mud-icon-root {
            opacity: 1;
        }

    .mud-nav-link.active:not(.mud-nav-link-disabled) {
        font-weight: 700 !important;
        background: var(--brand-glow) !important;
        color: var(--brand-light) !important;
        border-right: 3px solid var(--brand-light) !important;
        border-radius: 0 var(--r-xs) var(--r-xs) 0 !important;
    }

    .mud-nav-link.active .mud-icon-root {
        opacity: 1;
        color: var(--brand-light) !important;
    }

.mud-nav-group .mud-nav-link {
    font-size: 12.5px !important;
    padding-right: var(--sp-8) !important;
    min-height: 34px !important;
}

.mud-nav-group-header {
    font-size: 13px !important;
    font-weight: 600 !important;
    min-height: 36px !important;
    padding: 8px var(--sp-3) !important;
    border-radius: var(--r-xs) !important;
}

.sidebar-footer-card {
    background: linear-gradient(145deg, var(--brand), var(--brand-dark));
    border-radius: var(--r-md);
    color: white;
    position: relative;
    overflow: hidden;
    padding: var(--sp-5) !important;
}

    .sidebar-footer-card::before {
        content: '';
        position: absolute;
        width: 120px;
        height: 120px;
        background: rgba(255,255,255,.06);
        border-radius: 50%;
        top: -40px;
        left: -30px;
    }

/* ============================================================
   4. MAIN CONTENT & BENTO GRID
   ============================================================ */
.mud-main-content {
    background-color: var(--bg-body) !important;
}

.page-container {
    max-width: 1480px;
    margin: 0 auto;
    background-color: transparent !important;
}

.page-header {
    margin-bottom: var(--sp-8);
}

.breadcrumb-text {
    font-size: 11.5px;
    font-weight: 600;
    color: var(--text-disabled);
    display: flex;
    align-items: center;
    gap: 5px;
    margin-bottom: var(--sp-3);
}

.page-title {
    font-size: 24px !important;
    font-weight: 900 !important;
    color: var(--text-primary) !important;
}

.page-subtitle {
    font-size: 13px !important;
    color: var(--text-secondary) !important;
    margin-top: 4px;
    font-weight: 500;
}

.bento-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: var(--sp-4);
    margin-bottom: var(--sp-8);
}

.bento-hero {
    grid-column: span 5;
    min-height: 260px;
}

.bento-stack {
    grid-column: span 7;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--sp-4);
}

.hero-kpi-card {
    border-radius: var(--r-xl);
    background: linear-gradient(155deg, #022c22 0%, #064e3b 45%, #065f46 100%);
    color: white;
    position: relative;
    overflow: hidden;
    padding: var(--sp-8) var(--sp-6);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
    min-height: 260px;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

    .hero-kpi-card::before {
        content: '';
        position: absolute;
        width: 300px;
        height: 300px;
        border-radius: 50%;
        background: radial-gradient(circle, rgba(16,185,129,.25) 0%, transparent 70%);
        top: -120px;
        left: -60px;
        pointer-events: none;
    }

    .hero-kpi-card::after {
        content: '';
        position: absolute;
        width: 180px;
        height: 180px;
        border-radius: 50%;
        background: radial-gradient(circle, rgba(52,211,153,.12) 0%, transparent 70%);
        bottom: -60px;
        right: -40px;
        pointer-events: none;
    }

    .hero-kpi-card > * {
        position: relative;
        z-index: 1;
    }

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: rgba(255,255,255,.1);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255,255,255,.08);
    color: #6ee7b7;
    border-radius: var(--r-xs);
    font-size: 11px;
    font-weight: 700;
    padding: 4px 10px;
    width: fit-content;
}

.hero-kpi-label {
    font-size: 13px;
    color: #94d9c4;
    font-weight: 500;
}

.hero-kpi-value {
    font-size: 48px;
    font-weight: 900;
    line-height: 1;
    margin: var(--sp-2) 0 var(--sp-3);
    text-shadow: 0 2px 12px rgba(0,0,0,.15);
}

.hero-trend {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    flex-wrap: wrap;
}

.trend-pill {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: var(--r-xs);
}

.trend-up {
    background: rgba(52,211,153,.15);
    color: #6ee7b7;
}

.trend-down {
    background: rgba(244,63,94,.15);
    color: #fda4af;
}

.hero-note {
    font-size: 11px;
    color: rgba(148,217,196,.7);
}

.mini-kpi-card {
    border-radius: var(--r-lg);
    border: 1px solid var(--border);
    background: var(--bg-card);
    box-shadow: var(--shadow-xs);
    transition: all var(--duration) var(--ease);
    padding: var(--sp-5);
    position: relative;
    overflow: hidden;
    cursor: default;
}

    .mini-kpi-card:hover {
        transform: translateY(-2px);
        box-shadow: var(--shadow-card-hover);
        border-color: rgba(16, 185, 129, .3);
    }

.icon-box-sm {
    width: 40px;
    height: 40px;
    border-radius: var(--r-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: var(--sp-3);
    transition: transform var(--duration) var(--ease-spring);
}

.mini-kpi-card:hover .icon-box-sm {
    transform: scale(1.08);
}

.icon-box-sm .mud-icon-root {
    font-size: 20px !important;
}

.icon-emerald {
    background: rgba(16, 185, 129, .15);
    color: var(--brand-light);
}

.icon-gold {
    background: rgba(245, 158, 11, .15);
    color: var(--accent-amber);
}

.icon-blue {
    background: rgba(59, 130, 246, .15);
    color: var(--accent-blue);
}

.icon-purple {
    background: rgba(139, 92, 246, .15);
    color: var(--accent-purple);
}

.mini-kpi-value {
    font-size: 26px;
    font-weight: 900;
    line-height: 1.1;
    color: var(--text-primary);
}

    .mini-kpi-value small {
        font-size: 13px;
        font-weight: 600;
        color: var(--text-secondary);
        margin-right: 2px;
    }

.mini-kpi-label {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 600;
    margin-top: 3px;
}

.mini-kpi-trend {
    position: absolute;
    top: var(--sp-4);
    left: var(--sp-4);
    display: inline-flex;
    align-items: center;
    gap: 2px;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: var(--r-xs);
}

.mini-kpi-trend-up {
    background: rgba(16, 185, 129, .12);
    color: var(--brand-light);
}

.mini-kpi-trend-down {
    background: rgba(244, 63, 94, .12);
    color: var(--accent-rose);
}

/* ============================================================
   5. SURFACE CARDS, CARDS & CONTAINERS
   ============================================================ */
.surface-card,
.campaign-card,
.household-main-card,
.premium-card,
.ehsan-card,
.stat-card,
.notif-card,
.announcement-card,
.audit-stat-card,
.role-stat-card,
.ticket-stat,
.sms-stat,
.cashier-box,
.builder-card,
.column-picker-box,
.module-perm-card,
.template-card-new,
.settings-section,
.upload-card,
.member-modern-card,
.form-section {
    border-radius: var(--r-lg) !important;
    border: 1px solid var(--border) !important;
    background-color: var(--bg-card) !important;
    color: var(--text-primary) !important;
    box-shadow: var(--shadow-xs) !important;
}

.bg-light-card {
    background-color: var(--bg-muted) !important;
    border-color: var(--border) !important;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: var(--sp-5);
    flex-wrap: wrap;
    gap: var(--sp-3);
}

.section-title {
    font-size: 16px !important;
    font-weight: 800 !important;
    color: var(--text-primary) !important;
}

.section-subtitle {
    font-size: 12px !important;
    color: var(--text-secondary) !important;
    margin-top: 2px;
}

.radial-progress-wrapper {
    display: flex;
    justify-content: center;
    margin: var(--sp-5) 0;
}

.radial-progress {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: conic-gradient(var(--brand) calc(var(--percent) * 1%), var(--bg-muted) 0);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    box-shadow: var(--shadow-glow);
}

    .radial-progress::before {
        content: '';
        position: absolute;
        inset: 10px;
        border-radius: 50%;
        background: var(--bg-card);
    }

.radial-progress-label {
    position: relative;
    z-index: 1;
    text-align: center;
}

    .radial-progress-label .value {
        font-size: 26px;
        font-weight: 900;
        color: var(--text-primary);
    }

    .radial-progress-label .label {
        font-size: 10px;
        color: var(--text-secondary);
        font-weight: 600;
    }

.progress-breakdown {
    display: flex;
    justify-content: center;
    gap: var(--sp-8);
    margin-top: var(--sp-5);
}

.progress-stat {
    text-align: center;
}

    .progress-stat .stat-value {
        font-size: 15px;
        font-weight: 800;
    }

    .progress-stat .stat-label {
        font-size: 10.5px;
        color: var(--text-secondary);
        margin-top: 2px;
    }

/* ============================================================
   6. MASTER DARK MODE OVERRIDES (DEEP & INLINE OVERRIDES)
   ============================================================ */
.mud-theme-dark .mud-paper,
.mud-theme-dark .mud-card,
.mud-theme-dark .mud-dialog,
.mud-theme-dark .mud-table,
.mud-theme-dark .mud-table-container,
.mud-theme-dark .mud-popover,
.mud-theme-dark .mud-menu,
.mud-theme-dark .mud-list,
.mud-theme-dark .campaign-card,
.mud-theme-dark .bg-light-card,
.mud-theme-dark .household-main-card,
.mud-theme-dark .notif-card,
.mud-theme-dark .premium-card,
.mud-theme-dark .surface-card,
.mud-theme-dark .ehsan-card,
.mud-theme-dark .stat-card,
.mud-theme-dark .announcement-card,
.mud-theme-dark .audit-stat-card,
.mud-theme-dark .role-stat-card,
.mud-theme-dark .ticket-stat,
.mud-theme-dark .sms-stat,
.mud-theme-dark .cashier-box,
.mud-theme-dark .builder-card,
.mud-theme-dark .column-picker-box,
.mud-theme-dark .module-perm-card,
.mud-theme-dark .template-card-new,
.mud-theme-dark .settings-section,
.mud-theme-dark .upload-card,
.mud-theme-dark .member-modern-card,
.mud-theme-dark .form-section,
.mud-theme-dark [style*="background: #fff"],
.mud-theme-dark [style*="background:#fff"],
.mud-theme-dark [style*="background: #ffffff"],
.mud-theme-dark [style*="background:#ffffff"],
.mud-theme-dark [style*="background: white"],
.mud-theme-dark [style*="background:white"],
.mud-theme-dark [style*="background: rgb(255, 255, 255)"],
.mud-theme-dark [style*="background: #f8fafc"],
.mud-theme-dark [style*="background:#f8fafc"],
.mud-theme-dark [style*="background: #f5f7f6"],
.mud-theme-dark [style*="background:#f5f7f6"],
.mud-theme-dark [style*="background: #eff6ff"],
.mud-theme-dark [style*="background:#eff6ff"],
.mud-theme-dark [style*="background: #f0f3f2"],
.mud-theme-dark [style*="background:#f0f3f2"],
.mud-theme-dark [style*="background:#fafafa"],
.mud-theme-dark [style*="background: #fafafa"],
.mud-theme-dark [style*="background:#f0fdf4"],
.mud-theme-dark [style*="background: #f0fdf4"] {
    background-color: var(--bg-card) !important;
    background: var(--bg-card) !important;
    color: var(--text-primary) !important;
    border-color: var(--border) !important;
}

/* استایل کادرهای اینلاین در حالت دارک */
.mud-theme-dark [style*="border: 1px solid #e2e8f0"],
.mud-theme-dark [style*="border:1px solid #e2e8f0"],
.mud-theme-dark [style*="border: 1px solid #cbd5e1"],
.mud-theme-dark [style*="border:1px solid #cbd5e1"],
.mud-theme-dark [style*="border: 1px solid #bae6fd"],
.mud-theme-dark [style*="border:1px solid #bae6fd"],
.mud-theme-dark [style*="border: 1px solid #e2e8e5"],
.mud-theme-dark .border-bottom,
.mud-theme-dark .border-top,
.mud-theme-dark .border-left,
.mud-theme-dark .border-right {
    border-color: var(--border) !important;
}

/* استایل متون اینلاین در دارک مود */
.mud-theme-dark [style*="color: #0f172a"],
.mud-theme-dark [style*="color:#0f172a"],
.mud-theme-dark [style*="color: #1e293b"],
.mud-theme-dark [style*="color:#1e293b"],
.mud-theme-dark [style*="color: #334155"],
.mud-theme-dark [style*="color:#334155"],
.mud-theme-dark [style*="color: #475569"],
.mud-theme-dark [style*="color:#475569"],
.mud-theme-dark [style*="color: #0f1f1a"],
.mud-theme-dark [style*="color:#0f1f1a"] {
    color: var(--text-primary) !important;
}

.mud-theme-dark [style*="color: #64748b"],
.mud-theme-dark [style*="color:#64748b"],
.mud-theme-dark [style*="color: #94a3b8"],
.mud-theme-dark [style*="color:#94a3b8"],
.mud-theme-dark [style*="color: #5f7a71"],
.mud-theme-dark [style*="color:#5f7a71"] {
    color: var(--text-secondary) !important;
}

/* اصلاح اسکلتون لودینگ و اینپوت‌ها */
.mud-theme-dark .mud-skeleton {
    background: var(--bg-muted-strong) !important;
}

.mud-theme-dark .mud-input,
.mud-theme-dark .mud-input-root {
    color: var(--text-primary) !important;
}

.mud-theme-dark .mud-input-outlined-border {
    border-color: var(--border) !important;
}

.mud-theme-dark .mud-input:focus-within ~ .mud-input-outlined-border {
    border-color: var(--border-focus) !important;
}

/* اصلاح هدر جدول در دارک مود */
.mud-theme-dark .modern-table .mud-table-head .mud-table-cell,
.mud-theme-dark .modern-table th.mud-table-cell,
.mud-theme-dark .modern-table thead tr th {
    background-color: #064e3b !important;
    border-bottom: 1px solid var(--border) !important;
}

.mud-theme-dark .modern-table .mud-table-cell {
    border-color: var(--border) !important;
    color: var(--text-primary) !important;
}

.mud-theme-dark .modern-table .mud-table-row:hover {
    background-color: var(--bg-muted) !important;
}

/* نوتفیکیشن‌ها و آیتم‌ها */
.mud-theme-dark .notif-card.unread {
    background-color: rgba(59, 130, 246, 0.16) !important;
    border-color: rgba(59, 130, 246, 0.3) !important;
}

.mud-theme-dark .notif-card.read {
    opacity: 0.6;
}

.mud-theme-dark .template-body-new,
.mud-theme-dark .pos-history-row {
    background-color: var(--bg-muted) !important;
    color: var(--text-primary) !important;
}

.mud-theme-dark .border-bottom-dashed,
.mud-theme-dark .border-top-dashed {
    border-color: var(--border) !important;
}

/* رنگ‌های کاربردی در دارک مود */
.mud-theme-dark .text-success {
    color: #34d399 !important;
}

.mud-theme-dark .text-warning {
    color: #fbbf24 !important;
}

.mud-theme-dark .text-primary {
    color: #60a5fa !important;
}

/* بج لایو در دارک مود */
.mud-theme-dark .ehsan-live-indicator-tag {
    background: rgba(239, 68, 68, 0.2) !important;
    color: #f87171 !important;
}

/* ============================================================
   7. TABLE BASE & STYLES
   ============================================================ */
.modern-table .mud-table-container {
    border-radius: var(--r-md) !important;
    overflow: hidden !important;
    border: 1px solid var(--border) !important;
}

.modern-table .mud-table-head .mud-table-cell,
.modern-table th.mud-table-cell,
.modern-table thead tr th {
    background-color: #059669;
    color: #ffffff !important;
    font-weight: 800 !important;
    font-size: 12.5px !important;
    border-bottom: none !important;
    padding: 12px 14px !important;
    white-space: nowrap !important;
    text-align: center;
}

    .modern-table .mud-table-head .mud-table-cell *,
    .modern-table thead tr th * {
        color: #ffffff !important;
    }

.modern-table .mud-table-row {
    transition: background-color 0.15s ease;
}

    .modern-table .mud-table-row:hover {
        background-color: var(--bg-muted) !important;
    }

.modern-table .mud-table-cell {
    border-bottom: 1px solid var(--border) !important;
    padding: 10px 14px !important;
    font-size: 13px !important;
    color: var(--text-primary) !important;
    vertical-align: middle;
}

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

.status-active {
    background: var(--brand-light);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, .2);
}

.status-pending {
    background: var(--accent-amber);
    box-shadow: 0 0 0 3px rgba(245, 158, 11, .2);
}

/* ============================================================
   8. TAGS & BUTTONS
   ============================================================ */
.tag {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: var(--r-xs);
    transition: all var(--duration) var(--ease);
}

.tag-green {
    background: var(--tag-green-bg);
    color: var(--tag-green-text);
}

.tag-amber {
    background: var(--tag-amber-bg);
    color: var(--tag-amber-text);
}

.tag-red {
    background: var(--tag-red-bg);
    color: var(--tag-red-text);
}

.tag-blue {
    background: var(--tag-blue-bg);
    color: var(--tag-blue-text);
}

.tag-gray {
    background: var(--bg-muted);
    color: var(--text-secondary);
}

.btn-premium {
    border-radius: var(--r-sm) !important;
    text-transform: none !important;
    font-weight: 700 !important;
    font-size: 12.5px !important;
    transition: all var(--duration) var(--ease) !important;
    box-shadow: none !important;
}

    .btn-premium:hover {
        transform: translateY(-1px);
    }

    .btn-premium.mud-button-filled {
        box-shadow: var(--shadow-brand) !important;
    }

    .btn-premium.mud-button-outlined {
        border-color: var(--border) !important;
    }

.action-btn {
    min-width: 32px !important;
    width: 32px !important;
    height: 32px !important;
    border-radius: var(--r-xs) !important;
    padding: 0 !important;
}

    .action-btn .mud-icon-root {
        font-size: 17px !important;
    }

/* ============================================================
   9. EMPTY STATE & UTILITIES
   ============================================================ */
.empty-state {
    text-align: center;
    padding: var(--sp-12) var(--sp-6);
    color: var(--text-disabled);
}

    .empty-state .mud-icon-root {
        font-size: 48px !important;
        margin-bottom: var(--sp-3);
        opacity: .5;
    }

.text-muted {
    color: var(--text-secondary) !important;
}

.text-disabled {
    color: var(--text-disabled) !important;
}

.text-success {
    color: #16a34a !important;
}

.text-warning {
    color: #d97706 !important;
}

.text-primary {
    color: #2563eb !important;
}

.fw-bold {
    font-weight: 700 !important;
}

.fw-black {
    font-weight: 900 !important;
}

.font-mono {
    font-family: 'Vazirmatn', sans-serif !important;
    font-variant-numeric: tabular-nums !important; 
    letter-spacing: normal !important;
}

.h-100 {
    height: 100% !important;
}

/* ============================================================
   10. OUTLINED INPUT LABEL FIX (SHRINK BACKGROUNDS)
   ============================================================ */
.mud-input-control > .mud-input-label.mud-input-label-outlined.mud-shrink {
    background-color: var(--bg-card) !important;
    padding: 0 6px !important;
    z-index: 2 !important;
}

.mud-dialog .mud-input-control > .mud-input-label.mud-shrink,
.mobile-bottom-sheet .mud-input-control > .mud-input-label.mud-shrink {
    background-color: var(--bg-card) !important;
}

/* ============================================================
   11. PAGE: CITIES & MOBILE BOTTOM SHEETS
   ============================================================ */
.page-cities .district-icon-avatar {
    width: 40px;
    height: 40px;
    min-width: 40px;
    border-radius: 12px;
    background: rgba(16, 185, 129, 0.15);
    color: var(--brand-light);
    display: flex;
    align-items: center;
    justify-content: center;
}

.page-cities .tag-purple {
    background: rgba(139, 92, 246, .14);
    color: #a78bfa;
    border: 1px solid rgba(139, 92, 246, .25);
}

.page-cities .cell-action-btn {
    text-align: center;
}

    .page-cities .cell-action-btn .d-flex {
        justify-content: center;
        align-items: center;
    }

.mobile-bottom-sheet {
    align-self: flex-end !important;
    margin: 0 !important;
    width: 100vw !important;
    max-width: 100vw !important;
    border-radius: 22px 22px 0 0 !important;
    background: var(--bg-card) !important;
    border: 1px solid var(--border) !important;
    border-bottom: none !important;
    box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.4) !important;
    animation: slideUp 0.3s var(--ease) forwards;
}

    .mobile-bottom-sheet::before {
        content: '';
        display: block;
        width: 40px;
        height: 4px;
        background: var(--bg-muted-strong);
        border-radius: 4px;
        margin: 8px auto 4px;
    }

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }

    to {
        transform: translateY(0);
    }
}

.mobile-details-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 4px;
    padding: 0 4px;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 14px;
    background: var(--bg-muted);
    border-radius: 12px;
    font-size: 12.5px;
}

    .detail-row .label {
        color: var(--text-secondary);
        font-weight: 600;
    }

    .detail-row .value {
        color: var(--text-primary);
        font-weight: 800;
    }

/* ============================================================
   12. PULSE ANIMATIONS
   ============================================================ */
.ehsan-pulse-green {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #22c55e;
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7);
    animation: ehsanPulseGreen 1.5s infinite;
}

@keyframes ehsanPulseGreen {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7);
    }

    70% {
        transform: scale(1);
        box-shadow: 0 0 0 8px rgba(34, 197, 94, 0);
    }

    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(34, 197, 94, 0);
    }
}

.ehsan-pulse-blue {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #3b82f6;
    box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.7);
    animation: ehsanPulseBlue 1.5s infinite;
}

@keyframes ehsanPulseBlue {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.7);
    }

    70% {
        transform: scale(1);
        box-shadow: 0 0 0 8px rgba(59, 130, 246, 0);
    }

    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(59, 130, 246, 0);
    }
}

.ehsan-pulse-monitoring {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #a855f7;
    box-shadow: 0 0 0 0 rgba(168, 85, 247, 0.7);
    animation: ehsanPulseMonitoring 1.5s infinite;
}

@keyframes ehsanPulseMonitoring {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(168, 85, 247, 0.7);
    }

    70% {
        transform: scale(1);
        box-shadow: 0 0 0 10px rgba(168, 85, 247, 0);
    }

    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(168, 85, 247, 0);
    }
}

.ehsan-live-indicator-tag {
    background: #fee2e2;
    color: #ef4444;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 800;
    animation: ehsanBlink 1.2s infinite;
}

@keyframes ehsanBlink {
    0%, 100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

.fade-in {
    animation: fadeIn .3s var(--ease) both;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================================
   13. RESPONSIVE MEDIA QUERIES
   ============================================================ */
@media (max-width: 1100px) {
    .bento-hero, .bento-stack {
        grid-column: span 12;
    }
}

@media (max-width: 767px) {
    .page-title {
        font-size: 20px !important;
    }

    .mud-main-content {
        padding: var(--sp-3) !important;
    }

    .bento-stack {
        grid-template-columns: 1fr;
    }

    .hero-kpi-value {
        font-size: 36px;
    }

    .mini-kpi-value {
        font-size: 22px;
    }

    .mud-dialog {
        width: 95vw !important;
        max-width: 95vw !important;
        margin: 0 auto !important;
        border-radius: var(--r-lg) !important;
    }

    .mud-dialog-content {
        padding: var(--sp-4) var(--sp-3) !important;
    }

    .hide-on-mobile {
        display: none !important;
    }

    .page-container {
        padding: 8px !important;
    }

    .mud-input-control > .mud-input-label.mud-shrink {
        font-size: 11px !important;
    }

    .page-cities .modern-table .mud-table-container {
        background: transparent !important;
        box-shadow: none !important;
    }

    .page-cities .modern-table table,
    .page-cities .modern-table thead,
    .page-cities .modern-table tbody {
        display: block !important;
        width: 100% !important;
    }

    .page-cities .modern-table thead {
        display: none !important;
    }

    .page-cities .modern-table .mud-table-row {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: space-between !important;
        background: var(--bg-card) !important;
        border: 1px solid var(--border) !important;
        border-radius: 14px !important;
        margin-bottom: 10px !important;
        padding: 12px !important;
        box-shadow: var(--shadow-xs) !important;
    }

    .page-cities .modern-table .mud-table-cell {
        display: none !important;
        border: none !important;
        padding: 0 !important;
    }

        .page-cities .modern-table .mud-table-cell.cell-main-info,
        .page-cities .modern-table .mud-table-cell.cell-action-btn {
            display: flex !important;
            align-items: center !important;
        }

    .page-cities .mobile-only-subtitle {
        display: block !important;
        font-size: 11px !important;
        color: var(--text-secondary) !important;
        margin-top: 2px;
    }

    .page-cities .mobile-only-btn {
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        height: 38px !important;
        padding: 0 14px !important;
        font-size: 12px !important;
        font-weight: 700 !important;
        border-radius: 10px !important;
        box-shadow: 0 2px 6px rgba(5,150,105,0.25) !important;
    }
}

/* ============================================================
   NEEDS ASSESSMENT RESPONSIVE STYLES
   ============================================================ */
@media (min-width: 768px) {
    .needs-page .col-desktop-only {
        display: table-cell !important;
    }

    .needs-page .desktop-action-group {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 2px !important;
    }

    .needs-page .mobile-action-group {
        display: none !important;
    }
}

@media (max-width: 767px) {
    .needs-page {
        padding: 0 2px !important;
    }

        .needs-page .premium-card {
            padding: 0 !important;
            background: transparent !important;
            box-shadow: none !important;
        }

        .needs-page .modern-table .col-desktop-only,
        .needs-page .modern-table thead,
        .needs-page .modern-table .mud-table-head,
        .needs-page .desktop-action-group {
            display: none !important;
        }

        .needs-page .mobile-action-group {
            display: flex !important;
            align-items: center !important;
            justify-content: flex-end !important;
        }

    .clean-tabs .mud-tabs-toolbar-inner {
        display: flex !important;
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
        justify-content: flex-start !important;
    }

        .clean-tabs .mud-tabs-toolbar-inner::-webkit-scrollbar {
            display: none !important;
        }

    .clean-tabs .mud-tab {
        flex: 0 0 auto !important;
        font-size: 11.5px !important;
        padding-right: 10px !important;
        padding-left: 10px !important;
    }

    .needs-page .modern-table .mud-table-container,
    .needs-page .modern-table table,
    .needs-page .modern-table tbody {
        display: block !important;
        width: 100% !important;
        border: none !important;
        padding: 0 !important;
        margin: 0 !important;
        background: transparent !important;
        box-shadow: none !important;
    }

    .needs-page .modern-table .mud-table-row {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        align-items: center !important;
        justify-content: space-between !important;
        direction: rtl !important;
        background-color: var(--bg-card) !important;
        color: var(--text-primary) !important;
        border: 1px solid var(--border) !important;
        border-radius: 12px !important;
        margin-bottom: 8px !important;
        padding: 8px 10px !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    .needs-page .modern-table .mud-table-cell.cell-main-info,
    .needs-page .modern-table .mud-table-cell.cell-action-btn {
        display: flex !important;
        align-items: center !important;
        padding: 0 !important;
        margin: 0 !important;
        border: none !important;
        background: transparent !important;
    }

    .needs-page .modern-table .mud-table-cell.cell-main-info {
        flex: 1 1 auto !important;
        min-width: 0 !important;
        justify-content: flex-start !important;
    }

    .needs-page .modern-table .mud-table-cell.cell-action-btn {
        flex: 0 0 auto !important;
        justify-content: flex-end !important;
    }

    .needs-page .mobile-sub-line {
        font-size: 11px !important;
        color: var(--text-secondary) !important;
        margin-top: 1px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .needs-page .mobile-need-btn {
        height: 32px !important;
        padding: 0 10px !important;
        font-size: 12px !important;
        font-weight: 700 !important;
        border-radius: 8px !important;
        white-space: nowrap !important;
    }

    .dash-card {
        padding: 10px 12px !important;
        gap: 8px !important;
    }

    .dash-icon {
        padding: 8px !important;
    }

        .dash-icon svg {
            font-size: 20px !important;
        }

    .dash-value {
        font-size: 16px !important;
    }

    .dash-title {
        font-size: 11px !important;
    }
}

/* responsive header actions */
@media (max-width: 600px) {
    .hide-on-mobile {
        display: none !important;
    }

    .header-actions-grid {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        width: 100% !important;
        gap: 8px !important;
    }
}
/* ============================================================
   FIX: بستن تمام درزهای سفید زیرین در دارک مود و ارتفاع صفحه
   ============================================================ */

/* ۱. اجبار کل تگ‌های ریشه به پر کردن ۱۰۰٪ ارتفاع صفحه */
html,
body,
#app,
app {
    min-height: 100vh !important;
    height: 100% !important;
    background-color: var(--bg-body) !important;
}

/* ۲. تضمین اینکه لایه اصلی مادبلزور تمام ارتفاع را بپوشاند */
.mud-layout {
    min-height: 100vh !important;
    background-color: var(--bg-body) !important;
    display: flex;
    flex-direction: column;
}

.mud-main-content {
    flex: 1 0 auto !important;
    background-color: var(--bg-body) !important;
}

/* ۳. اگر در دارک‌مود کلاس فقط روی تگ داخلی می‌نشیند، به ریشه‌ها هم رنگ دارک را تحمیل کن */
.mud-theme-dark,
body:has(.mud-theme-dark),
html:has(.mud-theme-dark) {
    background-color: #070e0b !important;
}