/* ============================================================
   متغيرات الألوان (فاتح / داكن) + متغيرات التصميم العام
============================================================ */
:root {
    --bg-body: #f4f6fa;
    --bg-card: #ffffff;
    --text-main: #1e2430;
    --text-muted: #7c8898;
    --border-color: #e4e8f0;
    --table-header-bg: #f6f8fc;
    --sidebar-bg: #0b0a08;
    --brand-navy: #0b0a08;
    --brand-blue: #c9a24b;
    --radius-lg: 16px;
    --radius-md: 12px;
    --radius-sm: 9px;
    --shadow-soft: 0 2px 10px rgba(10,8,5,0.08);
    --shadow-hover: 0 10px 26px rgba(10,8,5,0.16);
}

body.dark-mode {
    --bg-body: #0d1220;
    --bg-card: #171d2e;
    --text-main: #e9edf5;
    --text-muted: #93a0b8;
    --border-color: #2a3350;
    --table-header-bg: #1e2740;
    --sidebar-bg: #070605;
    --shadow-soft: 0 2px 10px rgba(0,0,0,0.35);
    --shadow-hover: 0 10px 26px rgba(0,0,0,0.5);
}

/* ============================================================
   إعدادات عامة
============================================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html { scroll-behavior: smooth; }

body {
    font-family: 'Inter', 'Segoe UI', Tahoma, Arial, sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    transition: background-color 0.25s ease, color 0.25s ease;
    -webkit-font-smoothing: antialiased;
    position: relative;
}

/* خلفية Mesh Gradient خفيفة تعطي إحساس "بريميوم" بدون تشتيت */
body.dashboard-body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    background:
        radial-gradient(circle at 8% 8%, rgba(42,92,255,0.07), transparent 32%),
        radial-gradient(circle at 92% 18%, rgba(10,8,5,0.08), transparent 28%),
        radial-gradient(circle at 50% 100%, rgba(42,92,255,0.05), transparent 40%);
    pointer-events: none;
}
body.dark-mode.dashboard-body::before {
    background:
        radial-gradient(circle at 8% 8%, rgba(42,92,255,0.10), transparent 32%),
        radial-gradient(circle at 92% 18%, rgba(122,162,255,0.08), transparent 28%),
        radial-gradient(circle at 50% 100%, rgba(42,92,255,0.06), transparent 40%);
}

/* شريط تمرير عصري */
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(42,92,255,0.35); border-radius: 20px; }
::-webkit-scrollbar-thumb:hover { background: rgba(42,92,255,0.55); }

h1, h2, h3, h4 { letter-spacing: -0.01em; }

/* ============================================================
   صفحة تسجيل الدخول
============================================================ */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--brand-navy), var(--brand-blue));
    position: relative;
    overflow: hidden;
}
.login-page::before {
    content: "";
    position: absolute;
    width: 600px; height: 600px;
    background: radial-gradient(circle, rgba(255,255,255,0.08), transparent 70%);
    top: -200px; right: -150px;
    border-radius: 50%;
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
    position: relative;
    z-index: 1;
}

.login-box {
    background: var(--bg-card);
    padding: 44px 34px;
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 50px rgba(0,0,0,0.25);
    text-align: center;
}

.login-box h1 {
    font-size: 22px;
    color: var(--brand-navy);
    margin-bottom: 6px;
    font-weight: 700;
}

.subtitle {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 25px;
}

/* ============================================================
   عناصر النماذج (Inputs / Selects)
============================================================ */
.form-group {
    text-align: right;
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-main);
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 11px 14px;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 14px;
    background: var(--bg-card);
    color: var(--text-main);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    font-family: inherit;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--brand-blue);
    box-shadow: 0 0 0 4px rgba(42,92,255,0.12);
}

.form-group input[type="file"] { padding: 8px; border-style: dashed; }

.form-group textarea {
    width: 100%;
    padding: 11px 14px;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 14px;
    background: var(--bg-card);
    color: var(--text-main);
    font-family: inherit;
    resize: vertical;
}
.form-group textarea:focus {
    outline: none;
    border-color: var(--brand-blue);
    box-shadow: 0 0 0 4px rgba(42,92,255,0.12);
}

/* ============================================================
   الأزرار
============================================================ */
.btn-primary {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, var(--brand-navy), var(--brand-blue));
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14.5px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 10px;
    transition: transform 0.15s ease, box-shadow 0.2s ease, opacity 0.2s ease;
    box-shadow: 0 4px 14px rgba(42,92,255,0.28);
    font-family: inherit;
    position: relative;
    overflow: hidden;
}
.btn-primary::after {
    content: "";
    position: absolute;
    top: 0; left: -60%;
    width: 40%; height: 100%;
    background: linear-gradient(120deg, transparent, rgba(255,255,255,0.35), transparent);
    transform: skewX(-20deg);
    transition: left 0.55s ease;
}
.btn-primary:hover::after { left: 130%; }

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 22px rgba(42,92,255,0.38);
    opacity: 0.96;
}
.btn-primary:active {
    transform: scale(0.97) translateY(0);
}

.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    font-size: 13.5px;
    border: 1px solid transparent;
}

.alert-error {
    background: #fdecea;
    color: #c0392b;
    border-color: #f5c6cb;
}

.alert-success {
    background: #eafaf1;
    color: #219653;
    border-color: #c3e6cb;
}
body.dark-mode .alert-error { background: #351d1d; border-color: #5a2c2c; color:#ff8a80; }
body.dark-mode .alert-success { background: #16301f; border-color: #2c5a3c; color:#7ee6a4; }

/* ============================================================
   لوحة التحكم (Dashboard Layout)
============================================================ */
.dashboard-wrapper {
    display: flex;
    min-height: 100vh;
    gap: 18px;
    padding: 18px;
}

.sidebar {
    width: 250px;
    background: linear-gradient(165deg, var(--sidebar-bg) 0%, #050b1c 100%);
    color: #fff;
    padding: 24px 0;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 18px;
    height: calc(100vh - 36px);
    overflow-y: auto;
    border-radius: var(--radius-lg);
    box-shadow: 0 14px 40px rgba(5,10,25,0.35);
    border: 1px solid rgba(255,255,255,0.06);
}

.sidebar h2 {
    font-size: 15px;
    font-weight: 700;
    text-align: center;
    margin-bottom: 24px;
    padding: 0 16px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar ul {
    list-style: none;
    flex: 1;
    padding: 0 10px;
}

.sidebar ul li { margin-bottom: 2px; }

.sidebar ul li a {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 11px 14px;
    color: #b9c4dd;
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 500;
    border-radius: 10px;
    transition: all 0.2s ease;
    position: relative;
}

.sidebar ul li a:hover {
    background: rgba(255,255,255,0.07);
    color: #fff;
    padding-inline-start: 18px;
}

.sidebar ul li a.active {
    background: linear-gradient(135deg, var(--brand-blue), #e3bd6e);
    color: #fff;
    box-shadow: 0 4px 16px rgba(42,92,255,0.4), inset 0 1px 0 rgba(255,255,255,0.15);
}
.sidebar ul li a.active::before {
    content: "";
    position: absolute;
    inset-inline-start: -10px;
    top: 50%; transform: translateY(-50%);
    width: 4px; height: 60%;
    background: #fff;
    border-radius: 4px;
    box-shadow: 0 0 10px rgba(255,255,255,0.8);
}

.main-content {
    flex: 1;
    padding: 8px 4px 26px;
    min-width: 0;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    background: rgba(255,255,255,0.65);
    backdrop-filter: blur(14px) saturate(160%);
    -webkit-backdrop-filter: blur(14px) saturate(160%);
    padding: 16px 26px;
    border-radius: var(--radius-md);
    margin-bottom: 22px;
    box-shadow: var(--shadow-soft);
    border: 1px solid rgba(255,255,255,0.5);
    border-bottom: 3px solid transparent;
    border-image: linear-gradient(90deg, var(--brand-blue), transparent 60%) 1;
    position: sticky;
    top: 18px;
    z-index: 10;
}
body.dark-mode .topbar {
    background: rgba(23,29,46,0.65);
    border-color: rgba(255,255,255,0.06);
}
.topbar h2 { font-size: 18px; font-weight: 700; }

/* شريحة المستخدم بشريط العنوان (تُضاف تلقائيًا عبر JS من sidebar.php) */
.topbar-user-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--table-header-bg);
    padding: 6px 14px 6px 6px;
    border-radius: 30px;
    margin-inline-start: auto;
}
html[dir="ltr"] .topbar-user-chip { padding: 6px 6px 6px 14px; }
.topbar-user-chip .chip-avatar {
    width: 30px; height: 30px; border-radius: 50%;
    background: linear-gradient(135deg, var(--brand-navy), var(--brand-blue));
    color: #fff; display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 700; flex-shrink: 0;
    box-shadow: 0 0 0 3px rgba(42,92,255,0.15);
}
.topbar-user-chip .chip-info { line-height: 1.3; }
.topbar-user-chip .chip-name { font-size: 12.5px; font-weight: 700; color: var(--text-main); }
.topbar-user-chip .chip-role { font-size: 10.5px; color: var(--text-muted); text-transform: capitalize; }

.cards-row {
    display: flex;
    gap: 18px;
    flex-wrap: wrap;
    margin-bottom: 25px;
}

.card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 20px 22px;
    flex: 1;
    min-width: 180px;
    box-shadow: var(--shadow-soft);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border: 1px solid transparent;
    position: relative;
    overflow: hidden;
    animation: fadeInUp 0.5s ease both;
}
.card::before {
    content: "";
    position: absolute;
    top: 0; inset-inline-start: 0; inset-inline-end: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--brand-blue), #e3bd6e);
    opacity: 0;
    transition: opacity 0.25s ease;
}
.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
}
.card:hover::before { opacity: 1; }

.cards-row .card:nth-child(1){animation-delay:.03s}
.cards-row .card:nth-child(2){animation-delay:.07s}
.cards-row .card:nth-child(3){animation-delay:.11s}
.cards-row .card:nth-child(4){animation-delay:.15s}
.cards-row .card:nth-child(5){animation-delay:.19s}
.cards-row .card:nth-child(6){animation-delay:.23s}
.cards-row .card:nth-child(7){animation-delay:.27s}
.cards-row .card:nth-child(8){animation-delay:.31s}

.card h3 {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.card .value {
    font-size: 27px;
    font-weight: 800;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, var(--brand-navy), var(--brand-blue));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
body.dark-mode .card .value {
    background: linear-gradient(135deg, #9db8ff, #e3bd6e);
    -webkit-background-clip: text;
    background-clip: text;
}

/* ============================================================
   الجداول
============================================================ */
table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-soft);
}

table th, table td {
    padding: 13px 16px;
    text-align: right;
    border-bottom: 1px solid var(--border-color);
    font-size: 13.5px;
}

table th {
    background: var(--table-header-bg);
    color: var(--text-muted);
    font-weight: 700;
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

table tbody tr { transition: background 0.15s ease; }
table tbody tr:hover { background: var(--table-header-bg); }
table tbody tr:last-child td { border-bottom: none; }

.badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 11.5px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.badge-success { background: #e3f9ec; color: #1a9d5c; }
.badge-danger  { background: #fdecea; color: #d63b3b; }
.badge-warning { background: #fef4e0; color: #c78d10; }
body.dark-mode .badge-success { background: rgba(30,157,92,0.18); color: #4ade8a; }
body.dark-mode .badge-danger  { background: rgba(214,59,59,0.18); color: #ff8a80; }
body.dark-mode .badge-warning { background: rgba(199,141,16,0.18); color: #f5c563; }

.badge::before { content:""; width:6px; height:6px; border-radius:50%; background:currentColor; display:inline-block; opacity:0.75; }

/* تحسين شكل خلايا "لا توجد بيانات" بكل جداول النظام */
table td[colspan] {
    padding: 42px 20px !important;
    text-align: center !important;
    color: var(--text-muted);
    font-size: 13px;
    background: var(--bg-card);
}

/* ============================================================
   زر تبديل الوضع الليلي / زر اللغة بالسايدبار
============================================================ */
.theme-toggle-btn {
    display: block;
    width: calc(100% - 20px);
    margin: 6px 10px;
    padding: 10px;
    background: rgba(255,255,255,0.06);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 10px;
    cursor: pointer;
    font-size: 12.5px;
    text-align: center;
    font-family: inherit;
    transition: background 0.2s ease;
}
.theme-toggle-btn:hover { background: rgba(255,255,255,0.14); }

body.dark-mode .form-group input,
body.dark-mode .form-group select {
    background: #10182a;
    color: var(--text-main);
    border-color: var(--border-color);
}

/* ============================================================
   مؤثرات بصرية عامة (Hover / Fade-in / Logo Pulse)
============================================================ */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: translateY(0); }
}
.fade-in { animation: fadeInUp 0.6s ease both; }
.fade-in-delay-1 { animation: fadeInUp 0.6s ease 0.1s both; }
.fade-in-delay-2 { animation: fadeInUp 0.6s ease 0.2s both; }
.fade-in-delay-3 { animation: fadeInUp 0.6s ease 0.3s both; }

.main-content { animation: fadeInUp 0.35s ease both; }

@keyframes logoPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(42,92,255,0.35); }
    50% { box-shadow: 0 0 0 14px rgba(42,92,255,0); }
}
.logo-pulse {
    border-radius: 50%;
    animation: logoPulse 2.2s ease-in-out infinite;
}

/* ============================================================
   دعم اتجاه LTR عند التبديل للإنجليزية
============================================================ */
html[dir="ltr"] .form-group,
html[dir="ltr"] table th,
html[dir="ltr"] table td {
    text-align: left;
}
html[dir="ltr"] .sidebar ul li a.active {
    box-shadow: 0 4px 14px rgba(42,92,255,0.35);
}

/* ============================================================
   عناصر الداشبورد المشتركة (Hero Banner / Stats / Quick Actions)
   تُستخدم بكل داشبوردات الأدوار الأربعة
============================================================ */
.hero-banner {
    background: linear-gradient(135deg, var(--brand-navy), var(--brand-blue));
    border-radius: var(--radius-lg);
    padding: 28px 30px;
    color: #fff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 22px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 16px 40px rgba(15,31,77,0.28);
}
.hero-banner::after {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 90% -10%, rgba(255,255,255,0.18), transparent 60%);
}
.hero-banner::before {
    content: "";
    position: absolute;
    width: 220px; height: 220px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255,255,255,0.08), transparent 70%);
    bottom: -80px; inset-inline-start: 30%;
}
.hero-banner h2 { font-size: 22px; margin-bottom: 6px; position: relative; z-index: 1; }
.hero-banner p { color: #d6e0f0; font-size: 13px; position: relative; z-index: 1; }
.hero-status { text-align: center; position: relative; z-index: 1; }
.hero-status .btn-primary { background: #fff; background-image:none; color: var(--brand-navy); font-weight: 700; width: auto; padding: 10px 26px; box-shadow: 0 6px 18px rgba(0,0,0,0.18); }
.hero-status .btn-primary:hover { background: #eef2ff; }
.hero-status .mini-note { font-size: 12px; color: #d6e0f0; margin-top: 8px; }

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
    margin-bottom: 22px;
}
.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 18px;
    box-shadow: var(--shadow-soft);
    display: flex;
    align-items: center;
    gap: 14px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    animation: fadeInUp 0.5s ease both;
}
.stat-grid .stat-card:nth-child(1){animation-delay:.03s}
.stat-grid .stat-card:nth-child(2){animation-delay:.07s}
.stat-grid .stat-card:nth-child(3){animation-delay:.11s}
.stat-grid .stat-card:nth-child(4){animation-delay:.15s}
.stat-grid .stat-card:nth-child(5){animation-delay:.19s}
.stat-grid .stat-card:nth-child(6){animation-delay:.23s}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); }
.stat-card .stat-icon {
    width: 46px; height: 46px; border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    font-size: 20px; flex-shrink: 0;
}
.stat-card .stat-value { font-size: 22px; font-weight: 700; color: var(--text-main); }
.stat-card .stat-label { font-size: 12px; color: var(--text-muted); }

.dash-grid {
    display: grid;
    grid-template-columns: 1.1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}
@media (max-width: 900px) { .dash-grid { grid-template-columns: 1fr; } }

.quick-actions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    gap: 12px;
}
.quick-action-btn {
    display: flex; flex-direction: column; align-items: center; gap: 8px;
    padding: 16px 8px; border-radius: var(--radius-sm); text-decoration: none;
    background: var(--table-header-bg); color: var(--text-main);
    font-size: 12px; font-weight: 600; text-align: center;
    transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.2s ease;
}
.quick-action-btn:hover { transform: translateY(-3px); background: linear-gradient(135deg, var(--brand-navy), var(--brand-blue)); color: #fff; box-shadow: 0 8px 18px rgba(201,162,75,0.35); }
.quick-action-btn .qa-icon { font-size: 22px; }

.leave-bar-track { background: var(--table-header-bg); border-radius: 20px; height: 10px; overflow: hidden; margin: 10px 0; }
.leave-bar-fill { background: linear-gradient(90deg, var(--brand-blue), #27ae60); height: 100%; border-radius: 20px; transition: width 0.6s ease; }

.notif-item { display:flex; gap:10px; padding:10px 0; border-bottom:1px solid var(--border-color); font-size:13px; }
.notif-item:last-child { border-bottom:none; }
.mini-list-row { display:flex; justify-content:space-between; padding:9px 0; border-bottom:1px solid var(--border-color); font-size:13px; }
.mini-list-row:last-child { border-bottom:none; }

/* عنصر "مباشر" نابض لصفحات إدارة الاستراحات */
.live-dot { width:8px; height:8px; border-radius:50%; background:#27ae60; display:inline-block; animation: liveDotPulse 1.4s ease-in-out infinite; margin-inline-end:5px; }
@keyframes liveDotPulse { 0%,100%{ opacity:1; } 50%{ opacity:0.35; } }

/* ============================================================
   تحسينات الجوال (Mobile Responsiveness)
   ============================================================ */

/* زر فتح/إغلاق القائمة الجانبية - مخفي على الشاشات الكبيرة، يُحقن بالـ JS داخل .topbar */
.sidebar-toggle-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 40px; height: 40px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-main);
    font-size: 19px;
    cursor: pointer;
    flex-shrink: 0;
    box-shadow: var(--shadow-soft);
}

/* طبقة معتمة خلف القائمة الجانبية عند فتحها على الجوال */
.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(5,8,15,0.55);
    z-index: 998;
    backdrop-filter: blur(2px);
}
.sidebar-backdrop.show { display: block; }

/* غلاف تمرير أفقي للجداول الطويلة على الجوال (يُحقن تلقائيًا بالـ JS حول كل <table>) */
.table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius-sm);
}
.table-scroll table { min-width: 640px; }

@media (max-width: 900px) {
    .dashboard-wrapper { padding: 0; gap: 0; display: block; }

    .sidebar {
        position: fixed;
        top: 0;
        inset-inline-start: -270px;
        height: 100vh;
        width: 250px;
        z-index: 999;
        border-radius: 0;
        transition: inset-inline-start 0.28s ease;
    }
    .sidebar.mobile-open { inset-inline-start: 0; }

    .main-content { padding: 10px 12px 26px; }

    .sidebar-toggle-btn { display: inline-flex; }

    .topbar { padding: 12px 14px; gap: 10px; }
    .topbar h2 { font-size: 16px; }
    .topbar-user-chip { display: none; } /* تظهر بالقائمة الجانبية أصلًا، تكرارها بشريط ضيق يزحم */

    /* بطاقات لوحة المعلومات: عمود واحد */
    .dash-grid, .cards-row { grid-template-columns: 1fr !important; }

    /* أي شبكة استخدمت أنماط inline بـ 2/3/4 أعمدة تنكمش لعمود واحد على الجوال */
    [style*="grid-template-columns:repeat(2"],
    [style*="grid-template-columns: repeat(2"],
    [style*="grid-template-columns:repeat(3"],
    [style*="grid-template-columns: repeat(3"],
    [style*="grid-template-columns:repeat(4"],
    [style*="grid-template-columns: repeat(4"] {
        grid-template-columns: 1fr !important;
    }

    /* صفوف الأزرار/الفلاتر (Flex) تلتف بدل ما تفيض عن الشاشة */
    [style*="display:flex"] { flex-wrap: wrap !important; }

    /* النوافذ المنبثقة (Modals) تاخذ العرض الكامل تقريبًا على الجوال */
    .modal-box { width: 94vw !important; max-width: 94vw !important; max-height: 88vh; overflow-y: auto; }

    /* البطاقات وعناصر النموذج تاخذ مساحة أوسع بدل عرض ثابت صغير */
    .card[style*="max-width"] { max-width: 100% !important; }

    table th, table td { padding: 9px 10px; font-size: 12.5px; white-space: nowrap; }

    .btn-primary { padding: 13px 12px; font-size: 14px; }
}

@media (max-width: 480px) {
    .sidebar { width: 84vw; inset-inline-start: -90vw; }
    .topbar h2 { font-size: 14.5px; }
    .card { padding: 16px; }
}

