/* ==========================================================
   منصة جرد وتحديد مواقع العدادات الكهربائية - التنسيق العام
   ========================================================== */

:root {
    --primary: #159fd9;
    --primary-dark: #0d6fa3;
    --primary-light: #e6f6fd;
    --secondary: #3cae4c;
    --secondary-dark: #2b8a39;
    --brand-gradient: linear-gradient(135deg, #29abe2 0%, #1f9fd0 35%, #3cae4c 100%);
    --success: #3cae4c;
    --success-light: #e9f8ec;
    --danger: #dc2626;
    --danger-light: #fdecec;
    --warning: #d97706;
    --warning-light: #fef6e7;
    --text-main: #1a1f2b;
    --text-muted: #6b7280;
    --border: #e5e7eb;
    --bg: #f4f8fa;
    --card-bg: #ffffff;
    --radius: 14px;
    --shadow: 0 2px 10px rgba(16, 24, 40, 0.06);
    --shadow-lg: 0 8px 30px rgba(16, 24, 40, 0.12);
    --header-h: 60px;
    --sidebar-w: 240px;
    --sidebar-bg: linear-gradient(195deg, #0c3a55 0%, #0f6d8f 55%, #1f8a5c 100%);
    --card-blue: linear-gradient(135deg, #29abe2, #0d6fa3);
    --card-green: linear-gradient(135deg, #5ec26a, #2b8a39);
    --card-navy: linear-gradient(135deg, #14577a, #0a2f42);
    --card-orange: linear-gradient(135deg, #f5a623, #d9820c);
    --card-purple: linear-gradient(135deg, #2fa7a0, #1c6e68);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
    height: 100%;
    direction: rtl;
}

body {
    font-family: 'Tajawal', 'Segoe UI', Tahoma, Arial, sans-serif;
    background: var(--bg);
    color: var(--text-main);
    -webkit-tap-highlight-color: transparent;
    padding-bottom: env(safe-area-inset-bottom);
}

a { text-decoration: none; color: inherit; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-thumb { background: #c7cdd6; border-radius: 4px; }

/* ============ شاشة تسجيل الدخول ============ */
.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: var(--brand-gradient);
}

.login-card {
    background: rgba(255, 255, 255, 0.18);
    backdrop-filter: blur(22px);
    -webkit-backdrop-filter: blur(22px);
    border: 1px solid rgba(255, 255, 255, 0.35);
    width: 100%;
    max-width: 400px;
    border-radius: 24px;
    padding: 36px 28px;
    box-shadow: 0 12px 40px rgba(10, 40, 70, 0.25);
    animation: fadeUp .5s ease;
}

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}

.login-logo {
    width: 130px;
    height: 130px;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 10px;
    filter: drop-shadow(0 8px 18px rgba(10, 40, 70, 0.25));
}
.login-logo img { width: 100%; height: 100%; object-fit: contain; }

.login-card p.subtitle {
    text-align: center;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 26px;
    text-shadow: 0 1px 4px rgba(0,0,0,.15);
}

.hint-text {
    text-align: center;
    font-size: 12px;
    color: rgba(255,255,255,.85);
    margin-top: 20px;
}

.copyright-line {
    text-align: center;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .5px;
    color: rgba(255,255,255,.7);
    margin-top: 6px;
}

/* تنسيقات خاصة بحقول تسجيل الدخول لتناسب البطاقة الزجاجية الشفافة */
.login-card .form-group label { color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,.15); }
.login-card .form-group input {
    background: rgba(255,255,255,.55);
    border-color: rgba(255,255,255,.6);
}
.login-card .form-group input:focus {
    background: rgba(255,255,255,.85);
    border-color: #fff;
}
.login-card .form-group input::placeholder { color: rgba(30,41,59,.55); }

.form-group { margin-bottom: 16px; position: relative; }

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

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 13px 14px;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    font-size: 15px;
    background: #fbfcfe;
    transition: border-color .15s, background .15s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    background: #fff;
}

.form-group textarea { resize: vertical; min-height: 70px; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 14px 18px;
    border: none;
    border-radius: 10px;
    font-size: 15.5px;
    font-weight: 700;
    transition: transform .1s, opacity .15s, box-shadow .15s;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 4px 14px rgba(13,110,253,.3); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-outline { background: #fff; color: var(--primary); border: 1.5px solid var(--primary); }
.btn-light { background: #f1f3f6; color: var(--text-main); }
.btn-sm { padding: 8px 12px; font-size: 13px; width: auto; border-radius: 8px; }
.btn:disabled { opacity: .6; pointer-events: none; }

.error-box {
    background: var(--danger-light);
    color: var(--danger);
    padding: 11px 14px;
    border-radius: 10px;
    font-size: 13.5px;
    margin-bottom: 14px;
    display: none;
}
.error-box.show { display: block; animation: fadeUp .3s ease; }

.success-box {
    background: var(--success-light);
    color: var(--success);
    padding: 11px 14px;
    border-radius: 10px;
    font-size: 13.5px;
    margin-bottom: 14px;
    display: none;
}
.success-box.show { display: block; }

/* ============ الهيدر العلوي (بعد الدخول) ============ */
.app-header {
    height: var(--header-h);
    background: #fff;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: 0 1px 3px rgba(0,0,0,.03);
}

.app-header .brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 800;
    font-size: 15.5px;
}

.app-header .brand .icon {
    width: 34px; height: 34px;
    background: var(--primary-light);
    border-radius: 9px;
    display: flex; align-items: center; justify-content: center;
    font-size: 17px;
}

.app-header .user-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg);
    padding: 6px 6px 6px 12px;
    border-radius: 30px;
    font-size: 13px;
    font-weight: 600;
    border: none;
    flex-shrink: 0;
}

.app-header .user-chip .avatar {
    width: 26px; height: 26px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 12px;
    font-weight: 800;
    flex-shrink: 0;
}

/* ============ توافق الهيدر مع الشاشات الصغيرة (منع الفيض الأفقي) ============ */
@media (max-width: 420px) {
    .app-header, .admin-topbar { padding: 0 10px; gap: 4px; }
    .app-header .brand, .admin-topbar .mobile-brand { gap: 6px; font-size: 13.5px; min-width: 0; overflow: hidden; }
    .app-header .brand .icon, .admin-topbar .mobile-brand .icon { width: 30px; height: 30px; flex-shrink: 0; }
    .app-header .brand > span[data-i18n],
    .admin-topbar .mobile-brand > span[data-i18n] { display: none; } /* إخفاء اسم المنصة النصي، الأيقونة كافية */
    #myServiceBadge .badge { padding: 3px 8px !important; font-size: 10px !important; }
    .lang-switch { padding: 2px; }
    .lang-switch button { padding: 5px 9px; font-size: 11px; }
    .notif-bell { width: 32px; height: 32px; font-size: 15px; }
    .user-chip { padding: 4px; }
    #userNameLabel { display: none; } /* الاسم يظهر عند الضغط على الأيقونة (الملف الشخصي) */
}

.app-main {
    max-width: 900px;
    margin: 0 auto;
    padding: 16px 14px 90px;
}

/* ============ البطاقات ============ */
.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 18px;
    box-shadow: var(--shadow);
    margin-bottom: 16px;
}

.card-title {
    font-size: 16px;
    font-weight: 800;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ============ شبكة إحصائيات سريعة ============ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 16px;
}
@media (min-width: 640px) {
    .stats-grid { grid-template-columns: repeat(4, 1fr); }
}

.stat-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow);
    text-align: center;
}
.stat-card .num { font-size: 24px; font-weight: 900; color: var(--primary); }
.stat-card .label { font-size: 12px; color: var(--text-muted); margin-top: 4px; font-weight: 600; }

/* ============ GPS ============ */
.gps-box {
    background: var(--primary-light);
    border: 1.5px dashed var(--primary);
    border-radius: 12px;
    padding: 14px;
    text-align: center;
    font-size: 13.5px;
    margin-bottom: 16px;
}
.gps-box.ok { background: var(--success-light); border-color: var(--success); color: #0d7a3d; }
.gps-box.error { background: var(--danger-light); border-color: var(--danger); color: var(--danger); }
.gps-box .coords { font-weight: 800; direction: ltr; display: block; margin-top: 6px; font-size: 13px; }

/* ============ رفع الصورة ============ */
.image-upload {
    border: 2px dashed var(--border);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: border-color .15s, background .15s;
    position: relative;
    overflow: hidden;
}
.image-upload:hover, .image-upload.dragover { border-color: var(--primary); background: var(--primary-light); }
.image-upload input[type=file] { display: none; }
.image-upload .icon { font-size: 30px; margin-bottom: 8px; }
.image-upload .txt { font-size: 13.5px; color: var(--text-muted); font-weight: 600; }
.image-preview {
    width: 100%;
    max-height: 260px;
    object-fit: cover;
    border-radius: 10px;
    display: none;
}
.image-preview.show { display: block; }

/* ============ بطاقة عداد ============ */
.meter-item {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 14px;
    box-shadow: var(--shadow);
    margin-bottom: 12px;
    display: flex;
    gap: 12px;
}
.meter-item img {
    width: 74px; height: 74px;
    object-fit: cover;
    border-radius: 10px;
    flex-shrink: 0;
    background: #eee;
}
.meter-item .info { flex: 1; min-width: 0; }
.meter-item .top-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
}
.meter-item .serial { font-weight: 800; font-size: 14.5px; }
.meter-item .contract { font-size: 12.5px; color: var(--text-muted); margin-top: 2px; }
.meter-item .meta { font-size: 12px; color: var(--text-muted); margin-top: 6px; line-height: 1.6; }
.meter-item .badges { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.badge {
    display: inline-block;
    padding: 3px 9px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    background: var(--primary-light);
    color: var(--primary-dark);
}
.badge.gray { background: #f1f3f6; color: var(--text-muted); }
.meter-item .actions { display: flex; gap: 6px; margin-top: 8px; }
.icon-btn {
    width: 32px; height: 32px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 14px;
}
.icon-btn.danger { color: var(--danger); border-color: #f5c6c6; }
.icon-btn.primary { color: var(--primary); border-color: #bcd6ff; }

/* ============ فلاتر وبحث ============ */
.filters-bar {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
    margin-bottom: 14px;
    -webkit-overflow-scrolling: touch;
}
.filters-bar::-webkit-scrollbar { display: none; }
.search-box {
    display: flex;
    align-items: center;
    background: #fff;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    padding: 10px 14px;
    margin-bottom: 12px;
    gap: 8px;
}
.search-box input { border: none; outline: none; flex: 1; font-size: 14.5px; background: transparent; }
.filter-chip {
    flex-shrink: 0;
    padding: 8px 14px;
    border-radius: 20px;
    border: 1.5px solid var(--border);
    background: #fff;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-muted);
}
.filter-chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ============ التبويبات السفلية (Bottom Nav) ============ */
.bottom-nav {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: #fff;
    border-top: 1px solid var(--border);
    display: flex;
    z-index: 100;
    padding-bottom: env(safe-area-inset-bottom);
}
.bottom-nav .nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 10px 0 8px;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    border: none;
    background: none;
}
.bottom-nav .nav-item .ic { font-size: 20px; }
.bottom-nav .nav-item.active { color: var(--primary); }

/* ============ مودال (نافذة منبثقة) ============ */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(15, 23, 42, 0.55);
    display: none;
    align-items: flex-end;
    justify-content: center;
    z-index: 200;
    animation: fadeIn .2s ease;
}
.modal-overlay.show { display: flex; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal-box {
    background: #fff;
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
    border-radius: 20px 20px 0 0;
    padding: 20px 18px calc(20px + env(safe-area-inset-bottom));
    animation: slideUp .25s ease;
}
@media (min-width: 640px) {
    .modal-overlay { align-items: center; }
    .modal-box { border-radius: 18px; }
}
@keyframes slideUp { from { transform: translateY(40px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}
.modal-header h3 { font-size: 17px; font-weight: 800; }
.modal-close {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: #f1f3f6;
    border: none;
    font-size: 16px;
    display: flex; align-items: center; justify-content: center;
}

/* ============ حالات فارغة ============ */
.empty-state {
    text-align: center;
    padding: 50px 20px;
    color: var(--text-muted);
}
.empty-state .ic { font-size: 44px; margin-bottom: 10px; opacity: .5; }

/* ============ Loader ============ */
.spinner {
    width: 20px; height: 20px;
    border: 3px solid rgba(255,255,255,.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin .7s linear infinite;
    display: inline-block;
}
.spinner.dark { border-color: rgba(13,110,253,.25); border-top-color: var(--primary); }
@keyframes spin { to { transform: rotate(360deg); } }

.page-loader {
    position: fixed; inset: 0;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999;
}

/* ============ جدول (وضع سطح المكتب في لوحة الإدارة) ============ */
.table-wrap { overflow-x: auto; }
table.data-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.data-table th {
    text-align: right;
    padding: 10px 12px;
    background: var(--bg);
    font-weight: 800;
    white-space: nowrap;
}
table.data-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
table.data-table tr:hover td { background: #fafbfc; }

/* ============ تبويبات لوحة الإدارة ============ */
.admin-tabs {
    display: flex;
    background: #fff;
    border-radius: 12px;
    padding: 4px;
    box-shadow: var(--shadow);
    margin-bottom: 16px;
    gap: 4px;
    overflow-x: auto;
}
.admin-tabs button {
    flex: 1;
    padding: 10px 8px;
    border: none;
    background: none;
    border-radius: 9px;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-muted);
    white-space: nowrap;
}
.admin-tabs button.active { background: var(--primary); color: #fff; }

.tab-content { display: none; }
.tab-content.active { display: block; animation: fadeIn .2s ease; }

.grid-2 { display: grid; grid-template-columns: 1fr; gap: 10px; }
@media (min-width: 560px) { .grid-2 { grid-template-columns: 1fr 1fr; } }

/* ============ Toast ============ */
.toast {
    position: fixed;
    bottom: 90px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: #1a1f2b;
    color: #fff;
    padding: 12px 20px;
    border-radius: 30px;
    font-size: 13.5px;
    font-weight: 600;
    z-index: 500;
    opacity: 0;
    pointer-events: none;
    transition: all .25s ease;
    max-width: 90vw;
    text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }

/* ============ عام ============ */
.text-center { text-align: center; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.small-muted { font-size: 12px; color: var(--text-muted); }
.progress-fab {
    position: fixed;
    bottom: 78px;
    left: 16px;
    background: var(--primary);
    color: #fff;
    border-radius: 30px;
    padding: 10px 16px;
    font-size: 12px;
    font-weight: 700;
    box-shadow: var(--shadow-lg);
    z-index: 90;
}

/* ==========================================================
   لوحة الإدارة - تصميم Sidebar داكن + بطاقات ملونة
   ========================================================== */

.admin-body { background: var(--bg); }

.admin-layout {
    display: flex;
    min-height: 100vh;
}

/* ---------- Sidebar (سطح المكتب) ---------- */
.admin-sidebar {
    width: var(--sidebar-w);
    background: var(--sidebar-bg);
    color: #fff;
    flex-shrink: 0;
    display: none;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    z-index: 60;
}
@media (min-width: 900px) {
    .admin-sidebar { display: flex; }
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 22px 18px;
    font-weight: 900;
    font-size: 16px;
    border-bottom: 1px solid rgba(255,255,255,.1);
}
.sidebar-brand .icon {
    width: 38px; height: 38px;
    background: rgba(255,255,255,.12);
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 19px;
}
.sidebar-brand small { display: block; font-size: 10.5px; font-weight: 500; opacity: .7; margin-top: 1px; }

.sidebar-nav { flex: 1; padding: 14px 10px; overflow-y: auto; }
.sidebar-nav button {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border: none;
    background: none;
    color: rgba(255,255,255,.75);
    font-size: 13.5px;
    font-weight: 700;
    border-radius: 10px;
    margin-bottom: 4px;
    text-align: right;
    transition: background .15s, color .15s;
}
.sidebar-nav button .ic { font-size: 17px; width: 22px; text-align: center; }
.sidebar-nav button:hover { background: rgba(255,255,255,.06); color: #fff; }
.sidebar-nav button.active { background: rgba(255,255,255,.14); color: #fff; box-shadow: inset 3px 0 0 #4d9dff; }

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid rgba(255,255,255,.1);
    font-size: 11px;
    opacity: .65;
    text-align: center;
}

/* ---------- المنطقة الرئيسية ---------- */
.admin-content { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.admin-topbar {
    height: var(--header-h);
    background: #fff;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 18px;
    position: sticky;
    top: 0;
    z-index: 50;
}
.admin-topbar .mobile-brand { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 15px; }
.admin-topbar .mobile-brand .icon {
    width: 32px; height: 32px; background: var(--primary-light); border-radius: 8px;
    display: flex; align-items: center; justify-content: center; font-size: 16px;
}
@media (min-width: 900px) { .admin-topbar .mobile-brand { display: none; } }

.admin-main {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 18px 16px 90px;
}
@media (min-width: 900px) { .admin-main { padding: 22px 26px 40px; } }

/* ---------- تبويبات الموبايل (بديل Sidebar) ---------- */
.admin-tabs {
    display: flex;
    background: #fff;
    border-radius: 12px;
    padding: 4px;
    box-shadow: var(--shadow);
    margin-bottom: 16px;
    gap: 4px;
    overflow-x: auto;
    scroll-behavior: smooth;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
    position: relative;
}
@media (min-width: 900px) { .admin-tabs { display: none; } }
.admin-tabs-wrap { position: relative; }
.admin-tabs-wrap::before,
.admin-tabs-wrap::after {
    content: '';
    position: absolute;
    top: 4px; bottom: 20px;
    width: 22px;
    pointer-events: none;
    z-index: 2;
}
.admin-tabs-wrap::before { right: 0; background: linear-gradient(to left, var(--bg), transparent); }
.admin-tabs-wrap::after { left: 0; background: linear-gradient(to right, var(--bg), transparent); }
@media (min-width: 900px) { .admin-tabs-wrap::before, .admin-tabs-wrap::after { display: none; } }
.admin-tabs button {
    flex: 0 0 auto;
    padding: 11px 14px;
    border: none; background: none; border-radius: 9px;
    font-size: 12.5px; font-weight: 700; color: var(--text-muted); white-space: nowrap;
    position: relative;
    overflow: hidden;
    scroll-snap-align: start;
    min-height: 42px;
    transition: background .28s cubic-bezier(.4,0,.2,1), color .28s ease, transform .15s ease;
}
.admin-tabs button::after {
    content: '';
    position: absolute;
    bottom: 3px; left: 50%;
    width: 0; height: 3px;
    background: rgba(255,255,255,.85);
    border-radius: 3px;
    transform: translateX(-50%);
    transition: width .25s ease;
}
.admin-tabs button.active { background: var(--primary); color: #fff; animation: tabActivate .32s cubic-bezier(.34,1.56,.64,1); }
.admin-tabs button.active::after { width: 55%; }
.admin-tabs button:active { transform: scale(.92); }
@keyframes tabActivate {
    0% { transform: scale(.88); }
    60% { transform: scale(1.06); }
    100% { transform: scale(1); }
}

/* تأثير الموجة (Ripple) عند الضغط على أي تبويب */
.side-tab-btn, .admin-tabs button { position: relative; overflow: hidden; }
.ripple-effect {
    position: absolute;
    border-radius: 50%;
    background: rgba(255,255,255,.55);
    transform: scale(0);
    animation: rippleAnim .55s ease-out;
    pointer-events: none;
}
@keyframes rippleAnim {
    to { transform: scale(2.6); opacity: 0; }
}

/* حركة انزلاق ناعمة لمؤشر القائمة الجانبية عند التفعيل */
.side-tab-btn { transition: background .25s ease, color .25s ease, box-shadow .25s ease; }
.side-tab-btn.active { animation: sidePop .3s ease; }
@keyframes sidePop {
    0% { padding-right: 14px; }
    50% { padding-right: 20px; }
    100% { padding-right: 14px; }
}

.tab-content { display: none; }
.tab-content.active { display: block; animation: fadeIn .2s ease; }

/* ---------- بطاقات إحصائيات ملونة ---------- */
.stats-grid-colored {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 18px;
}
@media (min-width: 700px) { .stats-grid-colored { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1100px) { .stats-grid-colored { grid-template-columns: repeat(6, 1fr); } }

.stat-card-c {
    border-radius: 14px;
    padding: 16px 14px;
    color: #fff;
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
    min-height: 92px;
}
.stat-card-c.blue { background: var(--card-blue); }
.stat-card-c.green { background: var(--card-green); }
.stat-card-c.navy { background: var(--card-navy); }
.stat-card-c.orange { background: var(--card-orange); }
.stat-card-c.purple { background: var(--card-purple); }
.stat-card-c .ic { font-size: 18px; opacity: .9; margin-bottom: 6px; }
.stat-card-c .num { font-size: 22px; font-weight: 900; line-height: 1; }
.stat-card-c .label { font-size: 11.5px; font-weight: 600; opacity: .9; margin-top: 6px; }
.stat-card-c .trend { font-size: 10.5px; font-weight: 800; margin-top: 4px; background: rgba(255,255,255,.18); display: inline-block; padding: 1px 7px; border-radius: 20px; }

/* ---------- شبكة لوحة القيادة ---------- */
.dash-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}
@media (min-width: 900px) { .dash-grid { grid-template-columns: 1.4fr 1fr; } }

/* ---------- Donut Chart (CSS خالص) ---------- */
.donut-wrap { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; justify-content: center; }
.donut {
    width: 140px; height: 140px;
    border-radius: 50%;
    flex-shrink: 0;
    position: relative;
    background: conic-gradient(var(--donut-stops, #eee 0 100%));
}
.donut::after {
    content: '';
    position: absolute;
    inset: 20px;
    background: #fff;
    border-radius: 50%;
}
.donut-legend { flex: 1; min-width: 150px; }
.donut-legend .leg-item {
    display: flex; align-items: center; justify-content: space-between;
    font-size: 12.5px; font-weight: 700; margin-bottom: 8px;
}
.donut-legend .leg-item .dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; margin-left: 8px; }
.donut-legend .leg-item .name { display: flex; align-items: center; }

/* ---------- بطاقة تصدير التقارير ---------- */
.export-card { display: flex; gap: 10px; flex-wrap: wrap; }
.export-btn {
    flex: 1;
    min-width: 100px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 14px 10px;
    border-radius: 12px;
    border: none;
    font-weight: 800;
    font-size: 12.5px;
    color: #fff;
}
.export-btn .ic { font-size: 20px; }
.export-btn.excel { background: linear-gradient(135deg,#1d8348,#106334); }
.export-btn.csv { background: linear-gradient(135deg,#1e5fd9,#123b95); }
.export-btn.pdf { background: linear-gradient(135deg,#c0392b,#8e2318); }
.export-btn:active { transform: scale(.96); }

/* ---------- شارات حالة العداد ---------- */
.status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.status-dot.green { background: var(--success); }
.status-dot.orange { background: var(--warning); }
.status-dot.red { background: var(--danger); }

/* ---------- بحث سريع في الشريط العلوي ---------- */
.topbar-search {
    display: none;
    align-items: center;
    gap: 8px;
    background: var(--bg);
    border-radius: 30px;
    padding: 8px 16px;
    font-size: 13px;
    color: var(--text-muted);
    min-width: 260px;
}
@media (min-width: 900px) { .topbar-search { display: flex; } }

/* ==========================================================
   شاشة البداية (Splash Screen) بالشعار
   ========================================================== */
.splash-screen {
    position: fixed;
    inset: 0;
    background: var(--brand-gradient);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    transition: opacity .5s ease, visibility .5s ease;
}
.splash-screen.hide { opacity: 0; visibility: hidden; pointer-events: none; }
.splash-logo {
    width: 190px;
    height: 190px;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    filter: drop-shadow(0 10px 30px rgba(0,0,0,.25));
    animation: splashPop .6s cubic-bezier(.34,1.56,.64,1);
}
.splash-logo img { width: 100%; height: 100%; object-fit: contain; }
@keyframes splashPop {
    0% { transform: scale(.4); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}
.splash-title {
    color: #fff;
    font-weight: 900;
    font-size: 17px;
    margin-top: 18px;
    text-align: center;
    animation: fadeUp .5s ease .2s both;
}
.splash-sub {
    color: rgba(255,255,255,.85);
    font-size: 12.5px;
    margin-top: 4px;
    animation: fadeUp .5s ease .3s both;
}
.splash-dots {
    display: flex;
    gap: 6px;
    margin-top: 26px;
}
.splash-dots span {
    width: 8px; height: 8px;
    background: #fff;
    border-radius: 50%;
    opacity: .4;
    animation: splashBlink 1.2s infinite ease-in-out;
}
.splash-dots span:nth-child(2) { animation-delay: .15s; }
.splash-dots span:nth-child(3) { animation-delay: .3s; }
@keyframes splashBlink {
    0%, 80%, 100% { opacity: .35; transform: scale(.85); }
    40% { opacity: 1; transform: scale(1.1); }
}

/* ==========================================================
   مبدّل اللغة (العربية / الفرنسية)
   ========================================================== */
.lang-switch {
    display: inline-flex;
    background: rgba(255,255,255,.18);
    border-radius: 30px;
    padding: 3px;
    gap: 2px;
}
.lang-switch button {
    border: none;
    background: none;
    padding: 6px 13px;
    border-radius: 30px;
    font-size: 12px;
    font-weight: 800;
    color: #fff;
    opacity: .75;
}
.lang-switch button.active { background: #fff; color: var(--primary-dark); opacity: 1; }

.lang-switch.light { background: var(--bg); }
.lang-switch.light button { color: var(--text-muted); }
.lang-switch.light button.active { background: var(--primary); color: #fff; }

/* دعم اتجاه LTR عند اختيار الفرنسية */
html[dir="ltr"] body { direction: ltr; }
html[dir="ltr"] .app-header .brand,
html[dir="ltr"] .sidebar-brand,
html[dir="ltr"] .mobile-brand { flex-direction: row; }

/* ==========================================================
   شارات حالة العداد
   ========================================================== */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 800;
}
.status-badge::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status-badge.status-ok { background: var(--success-light); color: var(--success); }
.status-badge.status-damaged { background: var(--warning-light); color: var(--warning); }
.status-badge.status-needs_replacement { background: var(--danger-light); color: var(--danger); }
.status-badge.status-dispute { background: #f2ecfd; color: #7c3aed; }

/* ==========================================================
   كشف التكرار
   ========================================================== */
.duplicate-warning {
    background: var(--warning-light);
    color: #92400e;
    border: 1.5px solid #fcd9a6;
    border-radius: 10px;
    padding: 9px 12px;
    font-size: 12.5px;
    font-weight: 600;
    margin-top: -8px;
    margin-bottom: 14px;
    display: none;
}
.duplicate-warning.show { display: block; animation: fadeUp .2s ease; }

/* ==========================================================
   ماسح QR / Barcode
   ========================================================== */
.scan-btn {
    position: absolute;
    left: 8px;
    top: 32px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 8px;
    width: 38px;
    height: 38px;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}
html[dir="ltr"] .scan-btn { left: auto; right: 8px; }
.form-group.has-scan input { padding-left: 52px; }
html[dir="ltr"] .form-group.has-scan input { padding-left: 14px; padding-right: 52px; }

#scannerModal .modal-box { padding: 0; overflow: hidden; }
#scannerReader { width: 100%; }
.scanner-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 16px 18px; border-bottom: 1px solid var(--border);
}
.scanner-hint { padding: 12px 18px; font-size: 12.5px; color: var(--text-muted); text-align: center; }

/* ==========================================================
   العمل بدون إنترنت (Offline)
   ========================================================== */
.offline-banner {
    position: fixed;
    top: 0; left: 0; right: 0;
    background: var(--warning);
    color: #fff;
    text-align: center;
    font-size: 12.5px;
    font-weight: 700;
    padding: 8px 12px;
    z-index: 300;
    display: none;
}
.offline-banner.show { display: block; }
.offline-banner.syncing { background: var(--primary); }

.pending-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--warning-light);
    color: var(--warning);
    border-radius: 30px;
    padding: 6px 14px;
    font-size: 12px;
    font-weight: 800;
    margin-bottom: 12px;
    cursor: pointer;
}

/* ==========================================================
   الخريطة التفاعلية
   ========================================================== */
.map-container {
    width: 100%;
    height: 60vh;
    min-height: 380px;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    z-index: 1;
}
.map-legend {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    margin-top: 12px;
    font-size: 12px;
    font-weight: 700;
}
.map-legend .item { display: flex; align-items: center; gap: 6px; }
.map-legend .dot { width: 10px; height: 10px; border-radius: 50%; }

.leaflet-popup-content { font-family: inherit; direction: rtl; text-align: right; }
.map-popup .title { font-weight: 800; font-size: 13px; margin-bottom: 4px; }
.map-popup .row { font-size: 12px; color: var(--text-muted); margin-bottom: 2px; }

/* ==========================================================
   الإشعارات
   ========================================================== */
.notif-bell {
    position: relative;
    width: 38px; height: 38px;
    border-radius: 50%;
    background: var(--bg);
    border: none;
    display: flex; align-items: center; justify-content: center;
    font-size: 17px;
    flex-shrink: 0;
}
.notif-bell .dot {
    position: absolute;
    top: 6px; left: 7px;
    width: 9px; height: 9px;
    background: var(--danger);
    border: 2px solid #fff;
    border-radius: 50%;
    display: none;
}
.notif-bell.has-unread .dot { display: block; }

.notif-panel {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15,23,42,.5);
    z-index: 400;
    display: none;
    align-items: flex-start;
    justify-content: center;
}
.notif-panel.show { display: flex; animation: fadeIn .2s ease; }
.notif-panel-box {
    background: #fff;
    width: 100%;
    max-width: 420px;
    margin-top: 0;
    max-height: 100vh;
    height: 100%;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}
@media (min-width: 640px) {
    .notif-panel { align-items: flex-start; justify-content: flex-end; padding-top: 66px; padding-left: 16px; }
    .notif-panel-box { border-radius: 16px; height: auto; max-height: 70vh; }
}
.notif-panel-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 16px 18px; border-bottom: 1px solid var(--border);
    position: sticky; top: 0; background: #fff; z-index: 2;
}
.notif-item {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    position: relative;
}
.notif-item.unread { background: var(--primary-light); }
.notif-item.unread::before {
    content: '';
    position: absolute;
    top: 18px; right: 6px;
    width: 7px; height: 7px;
    background: var(--primary);
    border-radius: 50%;
}
html[dir="ltr"] .notif-item.unread::before { right: auto; left: 6px; }
.notif-item .title { font-weight: 800; font-size: 13.5px; margin-bottom: 3px; }
.notif-item .msg { font-size: 12.5px; color: var(--text-muted); line-height: 1.6; }
.notif-item .time { font-size: 11px; color: var(--text-muted); margin-top: 6px; opacity: .8; }
.notif-empty { text-align: center; padding: 40px 20px; color: var(--text-muted); font-size: 13px; }

.notif-sent-item {
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
}

/* ==========================================================
   الإعدادات، Audit Log، مقارنة الفترات، جودة البيانات
   ========================================================== */

/* مفتاح تبديل (Toggle Switch) */
.toggle-switch {
    position: relative;
    width: 48px; height: 26px;
    flex-shrink: 0;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-switch .slider {
    position: absolute; inset: 0;
    background: #d1d5db;
    border-radius: 30px;
    cursor: pointer;
    transition: background .2s;
}
.toggle-switch .slider::before {
    content: '';
    position: absolute;
    width: 20px; height: 20px;
    left: 3px; top: 3px;
    background: #fff;
    border-radius: 50%;
    transition: transform .2s;
    box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.toggle-switch input:checked + .slider { background: var(--warning); }
.toggle-switch input:checked + .slider::before { transform: translateX(-22px); }
html[dir="ltr"] .toggle-switch input:checked + .slider::before { transform: translateX(22px); }

.settings-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
    gap: 12px;
}
.settings-row:last-child { border-bottom: none; }
.settings-row .txt strong { display: block; font-size: 13.5px; margin-bottom: 2px; }
.settings-row .txt span { font-size: 12px; color: var(--text-muted); }

.readonly-banner {
    background: var(--warning-light);
    color: #92400e;
    border: 1.5px solid #fcd9a6;
    border-radius: 10px;
    padding: 12px 14px;
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 14px;
    text-align: center;
}

/* سجل النشاط */
.audit-item {
    display: flex;
    gap: 10px;
    padding: 11px 0;
    border-bottom: 1px solid var(--border);
    font-size: 12.5px;
}
.audit-item .dot2 { width: 8px; height: 8px; border-radius: 50%; background: var(--primary); margin-top: 5px; flex-shrink: 0; }
.audit-item .txt strong { font-weight: 800; }
.audit-item .txt .sub { color: var(--text-muted); font-size: 11.5px; margin-top: 2px; }

/* مقارنة الفترات */
.trend-delta {
    font-size: 10.5px;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    gap: 2px;
    margin-top: 4px;
    background: rgba(255,255,255,.2);
    padding: 1px 7px;
    border-radius: 20px;
}
.trend-delta.up { color: #d9ffe0; }
.trend-delta.down { color: #ffe0e0; }

/* قوائم الجماعات/الأحياء الموحّدة */
.zone-tag-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.zone-tag {
    display: flex; align-items: center; gap: 6px;
    background: var(--bg);
    border-radius: 20px;
    padding: 6px 8px 6px 12px;
    font-size: 12px;
    font-weight: 700;
}
html[dir="ltr"] .zone-tag { padding: 6px 12px 6px 8px; }
.zone-tag button { border: none; background: var(--danger-light); color: var(--danger); width: 18px; height: 18px; border-radius: 50%; font-size: 10px; }

.zone-warning {
    background: var(--warning-light);
    color: #92400e;
    border-radius: 10px;
    padding: 9px 12px;
    font-size: 12.5px;
    font-weight: 600;
    margin-bottom: 14px;
    display: none;
}
.zone-warning.show { display: block; }

/* ==========================================================
   Undo Toast (التراجع عن الحذف)
   ========================================================== */
.undo-toast {
    position: fixed;
    bottom: 90px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: #1a1f2b;
    color: #fff;
    padding: 12px 12px 12px 18px;
    border-radius: 30px;
    font-size: 13px;
    font-weight: 600;
    z-index: 500;
    opacity: 0;
    visibility: hidden;
    transition: all .25s ease;
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: 92vw;
}
.undo-toast.show { opacity: 1; visibility: visible; transform: translateX(-50%) translateY(0); }
.undo-toast button {
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 7px 14px;
    border-radius: 20px;
    font-size: 12.5px;
    font-weight: 800;
    flex-shrink: 0;
}

/* ==========================================================
   ملفي الشخصي
   ========================================================== */
.profile-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 18px;
}
.profile-header .avatar-lg {
    width: 56px; height: 56px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 22px; font-weight: 900;
}
.profile-header .name { font-weight: 800; font-size: 15px; }
.profile-header .role { font-size: 12px; color: var(--text-muted); }

/* ==========================================================
   شريط تنبيه أحمر للإشعارات الجديدة (أعلى الشاشة)
   ========================================================== */
.notif-top-banner {
    position: fixed;
    top: 0; left: 0; right: 0;
    background: var(--danger);
    color: #fff;
    text-align: center;
    font-size: 12.5px;
    font-weight: 700;
    padding: 10px 40px 10px 12px;
    z-index: 350;
    display: none;
    animation: slideDownBanner .3s ease;
    cursor: pointer;
}
.notif-top-banner.show { display: block; }
.notif-top-banner .close-x {
    position: absolute;
    left: 10px; top: 50%;
    transform: translateY(-50%);
    background: rgba(255,255,255,.2);
    border: none;
    color: #fff;
    width: 22px; height: 22px;
    border-radius: 50%;
    font-size: 12px;
    display: flex; align-items: center; justify-content: center;
}
html[dir="ltr"] .notif-top-banner { padding: 10px 12px 10px 40px; }
html[dir="ltr"] .notif-top-banner .close-x { left: auto; right: 10px; }
@keyframes slideDownBanner {
    from { transform: translateY(-100%); }
    to { transform: translateY(0); }
}

/* ==========================================================
   بحث الزبون التلقائي (Autofill Search)
   ========================================================== */
.customer-search-wrap { position: relative; }
.customer-results {
    position: absolute;
    top: 100%; left: 0; right: 0;
    background: #fff;
    border: 1.5px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    margin-top: 4px;
    max-height: 260px;
    overflow-y: auto;
    z-index: 60;
    display: none;
}
.customer-results.show { display: block; }
.customer-result-item {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
}
.customer-result-item:last-child { border-bottom: none; }
.customer-result-item:hover, .customer-result-item:active { background: var(--primary-light); }
.customer-result-item .top { font-weight: 800; font-size: 13px; display: flex; justify-content: space-between; }
.customer-result-item .sub { font-size: 11.5px; color: var(--text-muted); margin-top: 2px; }
.customer-results .no-results { padding: 16px; text-align: center; font-size: 12.5px; color: var(--text-muted); }

/* ==========================================================
   استيراد قاعدة بيانات الزبائن (رابط رفع مبسّط)
   ========================================================== */
.import-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--primary);
    font-weight: 800;
    font-size: 14px;
    text-decoration: none;
    padding: 12px 18px;
    background: var(--primary-light);
    border-radius: 30px;
    border: 1.5px dashed var(--primary);
    cursor: pointer;
    transition: background .2s ease, transform .15s ease;
}
.import-link:active { transform: scale(.97); }
.import-link:hover { background: #d9ecff; }
.import-link .ic { font-size: 17px; }

.import-progress-wrap { display: none; margin-top: 16px; }
.import-progress-wrap.show { display: block; animation: fadeUp .25s ease; }
.import-progress-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
}
.import-progress-bar {
    flex: 1;
    height: 10px;
    background: #eef1f6;
    border-radius: 20px;
    overflow: hidden;
}
.import-progress-bar .fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    border-radius: 20px;
    transition: width .25s ease;
    width: 0%;
}
.import-progress-pct {
    font-weight: 900;
    font-size: 15px;
    color: var(--primary);
    min-width: 44px;
    text-align: left;
}
.import-result {
    margin-top: 12px;
    background: var(--success-light);
    color: #0d7a3d;
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 12.5px;
    font-weight: 700;
    display: none;
}
.import-result.show { display: block; animation: fadeUp .25s ease; }
.import-result .date-line { font-size: 11px; color: #0d7a3d; opacity: .8; margin-top: 3px; font-weight: 600; }

.import-divider {
    display: flex;
    align-items: center;
    text-align: center;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 700;
    margin: 16px 0;
}
.import-divider::before, .import-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}
.import-divider span { padding: 0 12px; }











/* ==========================================================
   بطاقة "تسجيل عداد جديد" - تصميم ملوّن خرافي (Fantastic Colors)
   ========================================================== */
.fantastic-card {
    position: relative;
    border-radius: 22px;
    padding: 2px;
    background: linear-gradient(120deg, #ff6ec7, #6a5cff, #22d3ee, #34e89e, #ff6ec7);
    background-size: 300% 300%;
    animation: fantasticBorder 8s ease infinite;
    box-shadow: 0 10px 34px rgba(106, 92, 255, 0.25);
    margin-bottom: 16px;
}
@keyframes fantasticBorder {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}
.fantastic-card-inner {
    background: #fff;
    border-radius: 20px;
    padding: 18px;
    position: relative;
    overflow: hidden;
}
.fantastic-card-inner::before {
    content: '';
    position: absolute;
    top: -60px; left: -60px;
    width: 160px; height: 160px;
    background: radial-gradient(circle, rgba(106,92,255,.14), transparent 70%);
    border-radius: 50%;
}
.fantastic-card-inner::after {
    content: '';
    position: absolute;
    bottom: -70px; right: -50px;
    width: 180px; height: 180px;
    background: radial-gradient(circle, rgba(34,211,238,.14), transparent 70%);
    border-radius: 50%;
}
.fantastic-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 17px;
    font-weight: 900;
    margin-bottom: 16px;
    position: relative;
    z-index: 1;
}
.fantastic-title .pin-badge {
    width: 40px; height: 40px;
    border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    font-size: 19px;
    background: linear-gradient(135deg, #ff6ec7, #6a5cff);
    box-shadow: 0 6px 16px rgba(255,110,199,.4);
    animation: pinBounce 2.4s ease-in-out infinite;
}
@keyframes pinBounce {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-4px) rotate(-6deg); }
}
.fantastic-title .txt-gradient {
    background: linear-gradient(90deg, #6a5cff, #ff6ec7, #22d3ee);
    background-size: 200% auto;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: gradientShift 4s linear infinite;
}
@keyframes gradientShift {
    to { background-position: 200% center; }
}

.fantastic-card-inner .customer-search-wrap label {
    background: linear-gradient(90deg, #ff6ec7, #6a5cff);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    font-weight: 800;
}

.fantastic-card-inner .form-group input:focus,
.fantastic-card-inner .form-group select:focus,
.fantastic-card-inner .form-group textarea:focus {
    border-color: #6a5cff;
    box-shadow: 0 0 0 4px rgba(106,92,255,.12);
}

.fantastic-card-inner .btn-primary {
    background: linear-gradient(90deg, #ff6ec7, #6a5cff, #22d3ee);
    background-size: 200% auto;
    box-shadow: 0 8px 22px rgba(106,92,255,.35);
    transition: background-position .4s ease, transform .1s ease;
}
.fantastic-card-inner .btn-primary:hover { background-position: 100% center; }
.fantastic-card-inner .btn-primary:active { transform: scale(.98); }

.fantastic-card-inner .gps-box.ok {
    background: linear-gradient(135deg, #e8fff4, #e6fbff);
    border-color: #34e89e;
    box-shadow: 0 0 0 3px rgba(52,232,158,.12);
}

/* ==========================================================
   شارة حالة مطابقة الزبون مع قاعدة البيانات المستوردة
   ========================================================== */
.match-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 12px;
    border-radius: 10px;
    font-size: 12.5px;
    font-weight: 700;
    margin-top: -8px;
    margin-bottom: 14px;
}
.match-status.matched {
    background: var(--success-light);
    color: #0d7a3d;
}
.match-status.not-matched {
    background: var(--warning-light);
    color: #92400e;
}

/* حقول مقفلة (مُعبّأة تلقائيًا من قاعدة الزبائن) */
.form-group input.locked-field {
    background: #f0f4ff;
    border-color: #c7d6ff;
    color: #1f2a5c;
    font-weight: 700;
    cursor: not-allowed;
}

/* ==========================================================
   زر القائمة (Hamburger) - للهاتف فقط
   ========================================================== */
.hamburger-btn {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    width: 38px; height: 38px;
    border: none;
    background: var(--bg);
    border-radius: 10px;
    padding: 0 9px;
    flex-shrink: 0;
}
.hamburger-btn span {
    display: block;
    height: 2.5px;
    background: var(--text-main);
    border-radius: 2px;
    transition: transform .25s ease, opacity .2s ease;
}
@media (max-width: 899px) { .hamburger-btn { display: flex; } }
body.drawer-open .hamburger-btn span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
body.drawer-open .hamburger-btn span:nth-child(2) { opacity: 0; }
body.drawer-open .hamburger-btn span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }

/* ==========================================================
   القائمة المنسدلة الفاخرة (Premium Drawer)
   ========================================================== */
.drawer-overlay {
    position: fixed; inset: 0;
    background: rgba(15,23,42,.55);
    z-index: 400;
    opacity: 0;
    visibility: hidden;
    transition: opacity .3s ease, visibility .3s ease;
}
.drawer-overlay.show { opacity: 1; visibility: visible; }
@media (min-width: 900px) { .drawer-overlay { display: none; } }

.premium-drawer {
    position: fixed;
    top: 0; right: 0;
    width: 82%;
    max-width: 320px;
    height: 100vh;
    background: #fff;
    z-index: 410;
    transform: translateX(105%);
    transition: transform .35s cubic-bezier(.22,1,.36,1);
    display: flex;
    flex-direction: column;
    box-shadow: -10px 0 40px rgba(0,0,0,.18);
    border-radius: 20px 0 0 20px;
    overflow: hidden;
}
html[dir="ltr"] .premium-drawer { right: auto; left: 0; transform: translateX(-105%); border-radius: 0 20px 20px 0; }
.premium-drawer.show { transform: translateX(0); }
html[dir="ltr"] .premium-drawer.show { transform: translateX(0); }
@media (min-width: 900px) { .premium-drawer, .drawer-overlay { display: none; } }

.drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 18px 16px;
    border-bottom: 1px solid var(--border);
}
.drawer-brand { display: flex; align-items: center; gap: 10px; font-weight: 900; font-size: 15px; }
.drawer-logo {
    width: 34px; height: 34px;
    background: var(--primary-light);
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
}
.drawer-logo img { width: 20px; height: 20px; object-fit: contain; }
.txt-gradient-brand {
    background: linear-gradient(90deg, #6a5cff, #159fd9);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.drawer-close {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: var(--bg);
    border: none;
    font-size: 15px;
}

.drawer-nav {
    flex: 1;
    overflow-y: auto;
    padding: 14px 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.drawer-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border: none;
    background: none;
    border-radius: 14px;
    font-size: 14px;
    font-weight: 700;
    color: var(--text-main);
    text-align: right;
    position: relative;
    overflow: hidden;
    transition: background .2s ease, transform .15s ease;
}
html[dir="ltr"] .drawer-item { text-align: left; }
.drawer-item .d-icon {
    width: 34px; height: 34px;
    flex-shrink: 0;
    border-radius: 10px;
    background: var(--bg);
    display: flex; align-items: center; justify-content: center;
    font-size: 16px;
    transition: background .2s ease, transform .2s ease;
}
.drawer-item .d-label { flex: 1; }
.drawer-item .d-arrow {
    font-size: 18px;
    color: var(--text-muted);
    transform: scaleX(-1); /* يشير لليسار في RTL */
    transition: transform .2s ease;
}
html[dir="ltr"] .drawer-item .d-arrow { transform: none; }

.drawer-item:active { transform: scale(.98); }

.drawer-item.active {
    background: linear-gradient(135deg, rgba(106,92,255,.12), rgba(21,159,217,.12));
    color: #4d3fd9;
    box-shadow: inset 0 0 0 1.5px rgba(106,92,255,.25);
}
.drawer-item.active .d-icon {
    background: linear-gradient(135deg, #6a5cff, #159fd9);
    color: #fff;
    transform: scale(1.05);
}
.drawer-item.active .d-arrow { color: #6a5cff; }

.drawer-footer {
    padding: 14px 18px calc(16px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--border);
}
.drawer-toggle-row {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13.5px;
    font-weight: 700;
}
.drawer-toggle-row .d-icon {
    width: 30px; height: 30px;
    border-radius: 9px;
    background: var(--bg);
    display: flex; align-items: center; justify-content: center;
    font-size: 14px;
}
.drawer-toggle-row .d-label { flex: 1; }

/* ==========================================================
   الوضع الليلي (Dark Mode) - تغطية أساسية للعناصر الرئيسية
   ========================================================== */
body.dark-mode {
    background: #0e1420;
    color: #e6e9f2;
}
body.dark-mode .admin-topbar,
body.dark-mode .card,
body.dark-mode .stat-card,
body.dark-mode .modal-box,
body.dark-mode .notif-panel-box,
body.dark-mode .premium-drawer,
body.dark-mode .fantastic-card-inner {
    background: #161d30;
    color: #e6e9f2;
}
body.dark-mode .drawer-header,
body.dark-mode .drawer-footer { border-color: #262f47; }
body.dark-mode .drawer-item { color: #cdd3e4; }
body.dark-mode .drawer-item .d-icon { background: #1f273c; }
body.dark-mode .drawer-close,
body.dark-mode .hamburger-btn { background: #1f273c; }
body.dark-mode .hamburger-btn span { background: #e6e9f2; }
body.dark-mode .form-group input,
body.dark-mode .form-group select,
body.dark-mode .form-group textarea {
    background: #1c2438;
    border-color: #2b3550;
    color: #e6e9f2;
}
body.dark-mode .small-muted,
body.dark-mode .text-muted { color: #8b93a8; }
body.dark-mode .meter-item,
body.dark-mode .notif-item,
body.dark-mode .audit-item { border-color: #262f47; }
body.dark-mode table.data-table th { background: #1c2438; }
body.dark-mode table.data-table td { border-color: #262f47; }

/* ==========================================================
   خريطة التغطية (GIS Coverage)
   ========================================================== */
.coverage-overall-card { padding: 20px; }
.coverage-ring-wrap { display: flex; align-items: center; gap: 18px; }
.coverage-ring {
    width: 84px; height: 84px;
    border-radius: 50%;
    flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    background: conic-gradient(var(--cov-color, #94a3b8) calc(var(--cov-pct, 0) * 1%), #eef1f6 0);
    position: relative;
}
.coverage-ring::after {
    content: '';
    position: absolute;
    inset: 8px;
    background: #fff;
    border-radius: 50%;
}
.coverage-ring span {
    position: relative;
    z-index: 1;
    font-weight: 900;
    font-size: 17px;
    color: var(--text-main);
}

.coverage-item {
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}
.coverage-item:last-child { border-bottom: none; }
.coverage-item .row-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 800;
}
.coverage-item .row-top .pct { font-weight: 900; }
.coverage-item .row-sub { font-size: 11.5px; color: var(--text-muted); margin-top: 4px; }
.coverage-bar-track {
    background: #eef1f6;
    border-radius: 20px;
    height: 9px;
    overflow: hidden;
}
.coverage-bar-fill {
    height: 100%;
    border-radius: 20px;
    transition: width .3s ease;
}

.coverage-tier-green  { color: #16a34a; }
.coverage-tier-yellow { color: #ca8a04; }
.coverage-tier-orange { color: #ea580c; }
.coverage-tier-red    { color: #dc2626; }
