        /* ===== متغيرات الألوان الموحدة ===== */
        :root {
            --primary: #4361ee;
            --primary-light: #4895ef;
            --primary-dark: #3f37c9;
            --secondary: #f72585;
            --secondary-light: #ff4d6d;
            --secondary-dark: #b5179e;
            --success: #4cc9f0;
            --warning: #f8961e;
            --danger: #f94144;
            --dark: #2b2d42;
            --light: #f8f9fa;
            --gray: #adb5bd;
            --gradient-main: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
            --gradient-success: linear-gradient(135deg, var(--success) 0%, var(--primary-light) 100%);
            --gradient-danger: linear-gradient(135deg, var(--danger) 0%, var(--secondary) 100%);
            --gradient-warning: linear-gradient(135deg, var(--warning) 0%, #ffba08 100%);
            --gradient-dark: linear-gradient(135deg, var(--dark) 0%, #4a4e69 100%);
            --shadow-sm: 0 5px 15px rgba(0,0,0,0.05);
            --shadow-md: 0 10px 25px rgba(0,0,0,0.08);
            --shadow-lg: 0 20px 40px rgba(0,0,0,0.12);
            --border-radius: 20px;
            --border-radius-sm: 12px;
            --transition: all 0.25s ease;
        }

        body {
            background: linear-gradient(145deg, #f5f7fa 0%, #e9ecef 100%);
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            min-height: 100vh;
            padding: 20px 0;
            color: var(--dark);
        }

        .main-container {
            max-width: 1400px;
            margin: 0 auto;
            padding: 0 20px;
        }

        /* ===== الهيدر المتناسق ===== */
        .app-header {
            background: var(--gradient-main);
            color: white;
            padding: 30px 25px;
            border-radius: var(--border-radius);
            margin-bottom: 30px;
            box-shadow: var(--shadow-lg);
            position: relative;
            overflow: hidden;
        }

        .app-header::before {
            content: '';
            position: absolute;
            top: -50%;
            left: -50%;
            width: 200%;
            height: 200%;
            background: radial-gradient(circle, rgba(255,255,255,0.2) 0%, transparent 70%);
            animation: rotate 30s linear infinite;
        }

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

        .app-title {
            font-size: 2.2rem;
            font-weight: 700;
            margin-bottom: 10px;
            position: relative;
            display: flex;
            align-items: center;
            gap: 15px;
        }

        .app-title i {
            font-size: 2.5rem;
            animation: pulse 2.5s infinite;
        }

        @keyframes pulse {
            0%, 100% { transform: scale(1); }
            50% { transform: scale(1.08); }
        }

        .app-subtitle {
            font-size: 1.1rem;
            opacity: 0.95;
            margin-bottom: 0;
            display: flex;
            align-items: center;
            gap: 8px;
        }

        /* ===== بطاقات الإحصائيات ===== */
        .stats-card {
            background: white;
            border-radius: var(--border-radius-sm);
            padding: 20px;
            display: flex;
            align-items: center;
            gap: 15px;
            box-shadow: var(--shadow-sm);
            transition: var(--transition);
            border: 1px solid rgba(0,0,0,0.02);
            height: 100%;
        }

        .stats-card:hover {
            transform: translateY(-5px);
            box-shadow: var(--shadow-md);
        }

        .stats-icon {
            width: 55px;
            height: 55px;
            border-radius: 15px;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 1.8rem;
            color: white;
            background: var(--gradient-main);
            box-shadow: 0 10px 20px rgba(67, 97, 238, 0.2);
        }

        .stats-icon i {
            filter: drop-shadow(0 2px 5px rgba(0,0,0,0.1));
        }

        .stats-info h6 {
            margin: 0;
            color: var(--gray);
            font-size: 0.85rem;
            font-weight: 600;
            text-transform: uppercase;
            letter-spacing: 0.5px;
        }

        .stats-info h3 {
            margin: 5px 0 0;
            font-weight: 700;
            color: var(--dark);
            font-size: 1.8rem;
        }

        /* ===== البطاقات الرئيسية ===== */
        .modern-card {
            background: white;
            border-radius: var(--border-radius);
            border: none;
            box-shadow: var(--shadow-md);
            transition: var(--transition);
            margin-bottom: 30px;
            overflow: hidden;
        }

        .modern-card:hover {
            box-shadow: var(--shadow-lg);
        }

        .card-header-gradient {
            background: var(--gradient-dark);
            color: white;
            padding: 20px 25px;
            border-bottom: none;
        }

        .card-header-gradient h5 {
            margin: 0;
            font-weight: 600;
            display: flex;
            align-items: center;
            gap: 10px;
        }

        .card-body-custom {
            padding: 25px;
        }

        /* ===== حقول الإدخال ===== */
        .modern-input {
            border: 2px solid #e9ecef;
            border-radius: 12px;
            padding: 12px 18px;
            font-size: 1rem;
            transition: var(--transition);
            background: white;
        }

        .modern-input:focus {
            border-color: var(--primary);
            box-shadow: 0 0 0 4px rgba(67, 97, 238, 0.1);
            outline: none;
        }

        .modern-input:hover {
            border-color: var(--secondary-light);
        }

        /* ===== الأزرار الموحدة ===== */
        .btn-modern {
            border: none;
            border-radius: 12px;
            padding: 12px 24px;
            font-weight: 600;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            gap: 8px;
            transition: var(--transition);
            position: relative;
            overflow: hidden;
            background: white;
            color: var(--dark);
            border: 1px solid var(--gray);
        }

        .btn-modern::before {
            content: '';
            position: absolute;
            top: 50%;
            left: 50%;
            width: 0;
            height: 0;
            border-radius: 50%;
            background: rgba(255,255,255,0.4);
            transform: translate(-50%, -50%);
            transition: width 0.5s, height 0.5s;
        }

        .btn-modern:hover::before {
            width: 300px;
            height: 300px;
        }

        .btn-gradient-primary {
            background: var(--gradient-main);
            color: white;
            border: none;
        }

        .btn-gradient-success {
            background: var(--gradient-success);
            color: white;
            border: none;
        }

        .btn-gradient-danger {
            background: var(--gradient-danger);
            color: white;
            border: none;
        }

        .btn-outline-modern {
            background: transparent;
            border: 2px solid var(--primary);
            color: var(--primary);
        }

        .btn-outline-modern:hover {
            background: var(--gradient-main);
            color: white;
            border-color: transparent;
        }

        .btn-modern:disabled {
            opacity: 0.6;
            cursor: not-allowed;
        }

        /* ===== الجدول ==== */
        .table-modern {
            width: 100%;
            border-collapse: separate;
            border-spacing: 0 8px;
            margin: 0;
        }

        .table-modern thead th {
            background: var(--gradient-dark);
            color: white;
            font-weight: 600;
            padding: 15px 12px;
            border: none;
            font-size: 0.9rem;
            white-space: nowrap;
        }

        .table-modern thead th:first-child {
            border-radius: 0 12px 12px 0;
        }

        .table-modern thead th:last-child {
            border-radius: 12px 0 0 12px;
        }

        .table-modern tbody tr {
            background: white;
            box-shadow: 0 2px 8px rgba(0,0,0,0.02);
            border-radius: 12px;
            transition: var(--transition);
        }

        .table-modern tbody tr:hover {
            box-shadow: 0 8px 16px rgba(67, 97, 238, 0.1);
            transform: scale(1.01);
        }

        .table-modern td {
            padding: 15px 12px;
            vertical-align: middle;
            border: none;
            background: inherit;
        }

        .table-modern td:first-child {
            border-radius: 0 12px 12px 0;
        }

        .table-modern td:last-child {
            border-radius: 12px 0 0 12px;
        }

        /* ===== شارات الحالة ===== */
        .badge-modern {
            padding: 8px 16px;
            border-radius: 30px;
            font-weight: 500;
            font-size: 0.8rem;
            display: inline-flex;
            align-items: center;
            gap: 6px;
            white-space: nowrap;
        }

        .badge-active {
            background: var(--gradient-success);
            color: white;
        }

        .badge-inactive {
            background: var(--gradient-danger);
            color: white;
        }

        /* ===== أزرار الإجراءات ===== */
        .action-buttons {
            display: flex;
            gap: 8px;
            justify-content: flex-start;
            flex-wrap: wrap;
        }

        .action-btn {
            width: 40px;
            height: 40px;
            border-radius: 10px;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            border: none;
            transition: var(--transition);
            color: white;
            font-size: 1rem;
            cursor: pointer;
        }

        .action-btn:hover {
            transform: translateY(-3px);
            filter: brightness(1.1);
        }

        .btn-edit {
            background: var(--gradient-warning);
        }

        .btn-delete {
            background: var(--gradient-danger);
        }

        /* ===== مودال التعديل ===== */
        .modern-modal .modal-content {
            border-radius: var(--border-radius);
            border: none;
            box-shadow: var(--shadow-lg);
            overflow: hidden;
        }

        .modern-modal .modal-header {
            background: var(--gradient-main);
            color: white;
            border-bottom: none;
            padding: 20px 25px;
        }

        .modern-modal .modal-header .btn-close {
            filter: brightness(0) invert(1);
            opacity: 0.8;
        }

        .modern-modal .modal-body {
            padding: 25px;
        }

        .modern-modal .modal-footer {
            border-top: 1px solid #e9ecef;
            padding: 20px 25px;
        }

        /* ===== محمل (Spinner) ===== */
        .spinner-modern {
            width: 45px;
            height: 45px;
            border: 4px solid rgba(67, 97, 238, 0.1);
            border-top: 4px solid var(--primary);
            border-radius: 50%;
            animation: spin 0.8s linear infinite;
            margin: 20px auto;
        }

        @keyframes spin {
            0% { transform: rotate(0deg); }
            100% { transform: rotate(360deg); }
        }

        /* ===== إشعارات ===== */
        .notification {
            position: fixed;
            top: 20px;
            left: 50%;
            transform: translateX(-50%);
            padding: 14px 25px;
            border-radius: 40px;
            color: white;
            font-weight: 600;
            display: flex;
            align-items: center;
            gap: 12px;
            box-shadow: var(--shadow-lg);
            z-index: 9999;
            animation: slideDown 0.3s ease;
            font-size: 0.95rem;
            max-width: 90%;
            white-space: nowrap;
        }

        @media (max-width: 576px) {
            .notification {
                white-space: normal;
                text-align: center;
                font-size: 0.85rem;
            }
        }

        @keyframes slideDown {
            from {
                top: -100px;
                opacity: 0;
            }
            to {
                top: 20px;
                opacity: 1;
            }
        }

        .notification-success {
            background: var(--gradient-success);
        }

        .notification-error {
            background: var(--gradient-danger);
        }

        /* ===== البحث ===== */
        .search-box {
            position: relative;
            width: 100%;
        }

        .search-box i {
            position: absolute;
            right: 15px;
            top: 50%;
            transform: translateY(-50%);
            color: var(--gray);
            z-index: 3;
        }

        .search-input {
            padding-right: 45px;
            width: 100%;
        }

        /* ===== تحسينات الجوال ===== */
        @media (max-width: 992px) {
            .app-title {
                font-size: 1.8rem;
            }
            .app-title i {
                font-size: 2rem;
            }
        }

        @media (max-width: 768px) {
            .main-container {
                padding: 0 12px;
            }

            .app-header {
                padding: 20px;
            }

            .app-title {
                font-size: 1.6rem;
                gap: 10px;
            }

            .app-subtitle {
                font-size: 0.95rem;
                flex-wrap: wrap;
            }

            .stats-card {
                padding: 15px;
            }

            .stats-icon {
                width: 45px;
                height: 45px;
                font-size: 1.5rem;
            }

            .stats-info h3 {
                font-size: 1.5rem;
            }

            .card-body-custom {
                padding: 20px;
            }

            .table-modern thead {
                display: none; /* إخفاء رأس الجدول في الجوال */
            }

            .table-modern,
            .table-modern tbody,
            .table-modern tr,
            .table-modern td {
                display: block;
                width: 100%;
            }

            .table-modern tbody tr {
                margin-bottom: 15px;
                padding: 15px;
                position: relative;
                border-radius: 16px;
            }

            .table-modern td {
                padding: 8px 0;
                border: none !important;
                display: flex;
                justify-content: space-between;
                align-items: center;
                text-align: right;
                border-bottom: 1px dashed #e9ecef !important;
            }

            .table-modern td:last-child {
                border-bottom: none !important;
            }

            .table-modern td::before {
                content: attr(data-label);
                font-weight: 700;
                color: var(--dark);
                background: var(--light);
                padding: 4px 12px;
                border-radius: 20px;
                font-size: 0.75rem;
                margin-left: 10px;
                white-space: nowrap;
            }

            .action-buttons {
                justify-content: flex-end;
            }

            .search-box {
                width: 100%;
                margin-top: 10px;
            }

            .btn-modern {
                padding: 10px 16px;
                font-size: 0.9rem;
            }

            .card-header-gradient {
                padding: 15px 20px;
                flex-direction: column;
                align-items: flex-start;
                gap: 10px;
            }
        }

        @media (max-width: 576px) {
            .app-title {
                font-size: 1.4rem;
            }

            .app-title i {
                font-size: 1.6rem;
            }

            .stats-card {
                flex-direction: column;
                text-align: center;
            }

            .stats-info {
                text-align: center;
            }

            .row.g-4 > [class*="col-"] {
                margin-bottom: 12px;
            }

            .btn-modern {
                width: 100%;
            }
        }

        /* ===== تحسينات إضافية ===== */
        .form-check-input:checked {
            background-color: var(--primary);
            border-color: var(--primary);
        }

        .connection-badge {
            background: rgba(255,255,255,0.2);
            backdrop-filter: blur(5px);
            padding: 8px 16px;
            border-radius: 40px;
            font-size: 0.9rem;
        }

        .text-primary-gradient {
            background: var(--gradient-main);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            background-clip: text;
        }

        .icon-primary {
            color: var(--primary);
        }

        .text-primary-solid {
            color: var(--primary);
        }

        .delay-100 {
            animation-delay: 0.1s;
        }

        .delay-200 {
            animation-delay: 0.2s;
        }

        .status-dot {
            transition: color 0.25s ease;
        }

        .status-connected {
            color: #2ecc71;
        }

        .status-disconnected {
            color: #e74c3c;
        }
