* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background: #f0f2f5;
    color: #1a1a2e;
    line-height: 1.6;
}

/* ============================================================
   صفحة تسجيل الدخول
   ============================================================ */
.login-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(145deg, #0f0c29, #302b63, #24243e);
    position: relative;
    overflow: hidden;
}

.login-page::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at 30% 50%, rgba(102, 126, 234, 0.15) 0%, transparent 50%),
                radial-gradient(circle at 70% 80%, rgba(118, 75, 162, 0.1) 0%, transparent 50%);
    animation: rotate 30s linear infinite;
    z-index: 0;
}

@keyframes rotate {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.login-container {
    width: 100%;
    max-width: 420px;
    padding: 20px;
    position: relative;
    z-index: 1;
}

.login-box {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    padding: 45px 35px 40px;
    border-radius: 20px;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.4);
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.login-box .login-logo {
    margin-bottom: 25px;
}

.login-box .login-logo img {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    object-fit: cover;
    box-shadow: 0 8px 30px rgba(102, 126, 234, 0.35);
    border: 3px solid rgba(102, 126, 234, 0.3);
}

.login-box .login-logo .app-name {
    font-size: 30px;
    font-weight: 800;
    color: #1a1a2e;
    margin-top: 10px;
    letter-spacing: -0.5px;
}

.login-box .login-logo .app-name span {
    color: #667eea;
}

.login-box .login-logo .app-sub {
    font-size: 13px;
    color: #888;
    margin-top: 2px;
    font-weight: 500;
    letter-spacing: 0.5px;
}

.login-box .login-logo .app-sub span {
    color: #667eea;
    font-weight: 700;
}

.login-box h2 {
    font-size: 18px;
    color: #555;
    margin-bottom: 28px;
    font-weight: 500;
    text-align: center;
}

/* ============================================================
   النماذج
   ============================================================ */
.form-group {
    margin-bottom: 18px;
    text-align: right;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    font-size: 13px;
    color: #444;
    letter-spacing: 0.3px;
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e8ecf1;
    border-radius: 10px;
    font-size: 15px;
    transition: 0.3s;
    background: #fafbfc;
    color: #1a1a2e;
}

.form-control:focus {
    border-color: #667eea;
    outline: none;
    background: white;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

.form-control::placeholder {
    color: #aaa;
}

/* ============================================================
   الأزرار
   ============================================================ */
.btn {
    display: inline-block;
    padding: 12px 28px;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.3s;
    text-decoration: none;
    letter-spacing: 0.3px;
}

.btn-primary {
    background: #667eea;
    color: white;
    width: 100%;
    padding: 14px;
    font-size: 16px;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.btn-primary:hover {
    background: #5a6fd6;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-block {
    display: block;
    width: 100%;
}

.btn-success {
    background: #27ae60;
    color: white;
    box-shadow: 0 4px 15px rgba(39, 174, 96, 0.3);
}

.btn-success:hover {
    background: #219a52;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(39, 174, 96, 0.4);
}

.btn-warning {
    background: #f39c12;
    color: white;
    box-shadow: 0 4px 15px rgba(243, 156, 18, 0.3);
}

.btn-warning:hover {
    background: #e08e0b;
    transform: translateY(-2px);
}

.btn-danger {
    background: #e74c3c;
    color: white;
    box-shadow: 0 4px 15px rgba(231, 76, 60, 0.3);
}

.btn-danger:hover {
    background: #c0392b;
    transform: translateY(-2px);
}

.btn-sm {
    padding: 6px 14px;
    font-size: 12px;
    border-radius: 8px;
}

.btn-back {
    background: #95a5a6;
    color: white;
    padding: 8px 18px;
    border-radius: 8px;
    text-decoration: none;
    font-size: 13px;
    transition: 0.3s;
    display: inline-block;
}

.btn-back:hover {
    background: #7f8c8d;
    transform: translateY(-2px);
}

/* ============================================================
   التنبيهات
   ============================================================ */
.alert {
    padding: 14px 18px;
    border-radius: 10px;
    margin-bottom: 20px;
    font-size: 14px;
    font-weight: 500;
}

.alert-danger {
    background: #fde8e8;
    color: #c0392b;
    border: 1px solid #f5c6c6;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
    border-radius: 10px;
    padding: 14px 18px;
    margin-bottom: 15px;
}

/* ============================================================
   Dashboard - اللوحة الرئيسية
   ============================================================ */
.dashboard-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
    padding: 14px 28px;
    border-radius: 14px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    margin-bottom: 28px;
}

.top-bar .brand {
    display: flex;
    align-items: center;
    gap: 14px;
}

.top-bar .brand img {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(102, 126, 234, 0.2);
}

.top-bar .brand .app-name {
    font-size: 20px;
    font-weight: 700;
    color: #1a1a2e;
}

.top-bar .brand .app-name span {
    color: #667eea;
}

.top-bar .user-info {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 14px;
}

.top-bar .user-info .badge {
    background: #667eea;
    color: white;
    padding: 4px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.top-bar .user-info a {
    color: #e74c3c;
    text-decoration: none;
    font-weight: 600;
    font-size: 13px;
    transition: 0.3s;
}

.top-bar .user-info a:hover {
    color: #c0392b;
    text-decoration: underline;
}

/* بطاقات الإحصائيات */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    padding: 24px 20px;
    border-radius: 14px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    text-align: center;
    transition: 0.3s;
    border: 1px solid transparent;
}

.stat-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.1);
    border-color: #667eea;
}

.stat-card .number {
    font-size: 34px;
    font-weight: 800;
    color: #667eea;
    letter-spacing: -1px;
}

.stat-card .label {
    font-size: 14px;
    color: #888;
    margin-top: 6px;
    font-weight: 500;
}

/* قائمة الصفحات */
.menu-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
}

.menu-item {
    background: white;
    padding: 22px 16px;
    border-radius: 14px;
    text-align: center;
    text-decoration: none;
    color: #1a1a2e;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    transition: 0.3s;
    border: 1px solid transparent;
}

.menu-item:hover {
    transform: translateY(-6px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.1);
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.menu-item .icon {
    font-size: 32px;
    display: block;
    margin-bottom: 8px;
}

.menu-item .label {
    font-size: 14px;
    font-weight: 600;
}

/* ============================================================
   رأس الصفحات الداخلية
   ============================================================ */
.page-header {
    background: white;
    padding: 18px 28px;
    border-radius: 14px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    margin-bottom: 22px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.page-header h2 {
    font-size: 20px;
    color: #1a1a2e;
    font-weight: 700;
}

.page-header .actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* ============================================================
   الجداول
   ============================================================ */
.table-container {
    background: white;
    border-radius: 14px;
    padding: 24px 24px 28px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    overflow-x: auto;
}

.filters {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    margin-bottom: 22px;
    align-items: center;
}

.filters input,
.filters select {
    padding: 10px 14px;
    border: 2px solid #e8ecf1;
    border-radius: 10px;
    font-size: 14px;
    background: #fafbfc;
    transition: 0.3s;
    color: #1a1a2e;
}

.filters input:focus,
.filters select:focus {
    border-color: #667eea;
    outline: none;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.08);
}

table {
    width: 100%;
    border-collapse: collapse;
}

table th {
    background: #f8f9fc;
    padding: 14px 16px;
    text-align: right;
    font-weight: 700;
    color: #444;
    border-bottom: 2px solid #e8ecf1;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

table td {
    padding: 14px 16px;
    border-bottom: 1px solid #f0f2f5;
    font-size: 14px;
    color: #1a1a2e;
}

table tr:hover {
    background: #f8f9fc;
}

table .actions-cell {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

/* ============================================================
   المودالات
   ============================================================ */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    justify-content: center;
    align-items: center;
    z-index: 999;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: white;
    padding: 35px 32px 32px;
    border-radius: 18px;
    width: 90%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.3);
}

.modal-content h3 {
    margin-bottom: 22px;
    color: #1a1a2e;
    font-size: 22px;
    font-weight: 700;
}

.modal-content .form-group {
    text-align: right;
}

.modal-content .btn {
    width: 100%;
    margin-top: 10px;
}

/* ============================================================
   كلاسات إضافية للصفحات
   ============================================================ */
.profile-btn {
    background: #667eea;
    color: white;
    padding: 5px 10px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 13px;
    display: inline-block;
    transition: 0.3s;
    border: none;
    cursor: pointer;
}
.profile-btn:hover {
    background: #5a6fd6;
}

.stage-badge {
    display: inline-block;
    padding: 3px 12px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 600;
}
.stage-badge.new {
    background: #e3f2fd;
    color: #0d47a1;
}
.stage-badge.old {
    background: #e8f5e9;
    color: #1b5e20;
}

.main-header {
    background: white;
    padding: 15px 25px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}
.main-header .title {
    font-size: 22px;
    font-weight: 700;
    color: #333;
}
.main-header .actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

/* ============================================================
   تنسيقات الموبايل (إضافية بدون تغيير الألوان)
   ============================================================ */

@media (max-width: 768px) {
    .dashboard-container {
        padding: 10px;
    }

    .top-bar {
        flex-direction: column;
        align-items: center;
        padding: 12px 15px;
        min-height: auto;
        gap: 10px;
        flex-wrap: wrap;
    }

    .top-bar .brand {
        flex-direction: column;
        align-items: center;
        gap: 8px;
    }

    .top-bar .brand img {
        width: 100px;
        height: 100px;
    }

    .top-bar .brand .app-name {
        font-size: 17px;
    }

    .top-bar .user-info {
        font-size: 12px;
        flex-wrap: wrap;
        justify-content: center;
        gap: 8px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .stat-card .number {
        font-size: 24px;
    }

    .stat-card {
        padding: 16px 12px;
    }

    .menu-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .menu-item {
        padding: 14px 10px;
    }

    .menu-item .icon {
        font-size: 22px;
    }

    .menu-item .label {
        font-size: 12px;
    }

    .page-header {
        flex-direction: column;
        align-items: stretch;
        padding: 12px 15px;
        gap: 10px;
    }

    .page-header h2 {
        font-size: 16px;
        text-align: center;
    }

    .page-header .actions {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 8px;
    }

    .page-header .actions .btn {
        font-size: 13px;
        padding: 8px 14px;
        width: auto;
        min-width: 80px;
    }

    /* ===== تنسيقات الموبايل للصفحات الداخلية ===== */
    
    .main-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
        padding: 12px 15px;
        gap: 10px;
    }
    
    .main-header .title {
        font-size: 18px;
    }
    
    .main-header .actions {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .main-header .actions .btn {
        width: auto;
        font-size: 13px;
        padding: 8px 14px;
        min-width: 80px;
    }

    .table-container {
        padding: 10px;
        overflow-x: auto;
    }

    .filters {
        flex-direction: column;
        gap: 8px;
        align-items: stretch;
    }

    .filters input,
    .filters select {
        width: 100%;
        font-size: 14px;
        padding: 8px 12px;
        box-sizing: border-box;
    }

    .filters .btn {
        width: 100%;
        text-align: center;
        box-sizing: border-box;
    }
    
    .filters .btn-back {
        width: 100%;
        text-align: center;
        box-sizing: border-box;
    }

    table {
        font-size: 13px;
        min-width: 500px;
    }

    table th,
    table td {
        padding: 8px 10px;
        font-size: 12px;
        white-space: nowrap;
    }

    table .actions-cell {
        display: flex;
        flex-wrap: wrap;
        gap: 4px;
        justify-content: center;
    }

    table .actions-cell .btn-sm,
    table .actions-cell .profile-btn {
        font-size: 11px;
        padding: 4px 8px;
        min-width: 40px;
    }

    .modal-content {
        padding: 18px 14px;
        max-width: 95%;
        margin: 10px;
    }

    .modal-content h3 {
        font-size: 17px;
    }

    .modal-content .field-group {
        flex-direction: column;
        gap: 8px;
    }

    .modal-content .field-group > div {
        min-width: auto;
        width: 100%;
    }

    .modal-content .form-control {
        font-size: 14px;
        padding: 8px 12px;
    }

    .modal-content .btn {
        font-size: 14px;
        padding: 10px;
    }

    .btn {
        font-size: 13px;
        padding: 8px 14px;
    }

    .btn-sm {
        font-size: 11px;
        padding: 4px 10px;
    }

    .btn-back {
        font-size: 12px;
        padding: 6px 12px;
    }

    .form-group {
        margin-bottom: 12px;
    }

    .form-group label {
        font-size: 13px;
    }

    .form-control {
        font-size: 14px;
        padding: 8px 12px;
    }

    .alert {
        font-size: 13px;
        padding: 10px 14px;
    }

    .login-box {
        padding: 25px 18px;
    }

    .login-logo img {
        width: 100px;
        height: 100px;
    }

    .login-logo .app-name {
        font-size: 22px;
    }

    .total-card {
        flex-direction: column;
        align-items: center;
        text-align: center;
        padding: 15px;
    }

    .total-card .amount {
        font-size: 24px;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    .menu-grid {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    .top-bar .brand img {
        width: 80px;
        height: 80px;
    }

    .top-bar .brand .app-name {
        font-size: 15px;
    }

    .stat-card .number {
        font-size: 20px;
    }

    .stat-card {
        padding: 10px 8px;
    }

    .menu-item .icon {
        font-size: 18px;
    }

    .menu-item .label {
        font-size: 11px;
    }

    .menu-item {
        padding: 10px 6px;
    }

    .page-header h2 {
        font-size: 14px;
    }

    .page-header .actions .btn {
        font-size: 12px;
        padding: 6px 10px;
        min-width: 60px;
    }

    .main-header .title {
        font-size: 16px;
    }
    
    .main-header .actions .btn {
        font-size: 12px;
        padding: 6px 10px;
        min-width: 60px;
    }

    table {
        font-size: 11px;
        min-width: 400px;
    }

    table th,
    table td {
        padding: 6px 8px;
        font-size: 11px;
    }

    table .actions-cell .btn-sm,
    table .actions-cell .profile-btn {
        font-size: 10px;
        padding: 3px 6px;
        min-width: 35px;
    }

    .modal-content {
        padding: 14px 10px;
    }

    .modal-content h3 {
        font-size: 15px;
    }

    .modal-content .form-control {
        font-size: 13px;
        padding: 6px 10px;
    }

    .modal-content .btn {
        font-size: 13px;
        padding: 8px;
    }

    .btn {
        font-size: 12px;
        padding: 6px 10px;
    }

    .btn-sm {
        font-size: 10px;
        padding: 3px 8px;
    }

    .form-control {
        font-size: 13px;
        padding: 6px 10px;
    }

    .filters input,
    .filters select {
        font-size: 13px;
        padding: 6px 10px;
    }

    .login-logo img {
        width: 80px;
        height: 80px;
    }

    .login-logo .app-name {
        font-size: 20px;
    }

    .login-box {
        padding: 20px 15px;
    }
}