     :root { --gold: #D4AF37; --dark: #1A1A1A; --light-bg: #F4F4F9; }
        body { font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; background-color: var(--light-bg); margin: 0; padding: 0; }
        header { background-color: var(--dark); color: var(--gold); padding: 15px; text-align: center; box-shadow: 0 4px 6px rgba(0,0,0,0.1); }
        .container { width: 95%; margin: 20px auto; max-width: 1200px; }
        
        .alert-danger { background-color: #f8d7da; color: #721c24; padding: 15px; border-radius: 6px; border: 1px solid #f5c6cb; margin-bottom: 20px; font-weight: bold; }
        .card { background: white; padding: 20px; border-radius: 8px; box-shadow: 0 2px 10px rgba(0,0,0,0.05); margin-bottom: 20px; border-top: 4px solid var(--gold); }
        .card-past { border-top: 4px solid #6c757d; } 
        .card-trash { border-top: 4px solid #dc3545; } 
        
        .top-bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; flex-wrap: wrap; gap: 15px; }
        
        .btn { padding: 10px 15px; border: none; border-radius: 4px; cursor: pointer; text-decoration: none; font-weight: bold; font-size: 0.9em; display: inline-block; text-align: center; }
        .btn-gold { background-color: var(--gold); color: var(--dark); }
        .btn-dark { background-color: var(--dark); color: white; }
        .btn-danger { background-color: #dc3545; color: white; }
        .btn-edit { background-color: #28a745; color: white; }
        .btn-secondary { background-color: #6c757d; color: white; }
        .btn-sm { padding: 6px 10px; font-size: 0.8em; }
        
        form.add-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 15px; }
        .form-group { display: flex; flex-direction: column; }
        .form-group label { margin-bottom: 5px; font-weight: bold; font-size: 0.9em; }
        .form-group input, .form-group select { padding: 10px; border: 1px solid #ccc; border-radius: 4px; font-family: inherit; }
        .form-group.full-width { grid-column: 1 / -1; }
        
        .search-bar form { display: flex; gap: 10px; flex-wrap: wrap; }
        .search-bar input[type="text"] { padding: 10px; width: 250px; border: 1px solid #ccc; border-radius: 4px; flex-grow: 1;}
        .filter-input { padding: 8px; border: 1px solid #ccc; border-radius: 4px; font-family: inherit; }

        table { width: 100%; border-collapse: collapse; margin-top: 10px; }
        th, td { padding: 10px; text-align: right; border-bottom: 1px solid #ddd; font-size: 0.95em;}
        th { background-color: var(--dark); color: var(--gold); }
        tr:hover { background-color: #f9f9f9; }
        td input.edit-input, td select.edit-input { width: 90%; padding: 6px; border: 2px solid var(--gold); border-radius: 4px; font-size: 0.9em; }
        .timer-badge { background: #e9ecef; padding: 4px 8px; border-radius: 4px; font-size: 0.85em; font-weight: bold; display: block; margin-top: 5px; width: fit-content;}

        .header-with-stats { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; margin-bottom: 15px; gap: 10px; }
        .stats-badges { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
        .stat-badge { padding: 8px 12px; border-radius: 6px; font-weight: bold; font-size: 0.9em; display: flex; align-items: center; gap: 5px; }
        .badge-total { background-color: #e2e3e5; color: #383d41; border: 1px solid #d6d8db; }
        .badge-month { background-color: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
        .badge-money { background-color: #fff3cd; color: #856404; border: 1px solid #ffeeba; }

        .status-paid { color: #28a745; font-weight: bold; }
        .status-deposit { color: #fd7e14; font-weight: bold; }
        .status-pending { color: #dc3545; font-weight: bold; }

     @media (max-width: 768px) {
            table, thead, tbody, th, td, tr { display: block; }
            thead tr { display: none; }
            tr { margin-bottom: 15px; border: 1px solid var(--gold); border-radius: 8px; box-shadow: 0 2px 5px rgba(0,0,0,0.1); background: #fff; position: relative; padding: 10px; }
            
            /* --- التعديلات تبدأ من هنا لترتيب وضع التعديل --- */
            td { 
                text-align: left; 
                /* تعديل الهوامش: تخصيص مساحة كافية يميناً للنص، ومساحة لليسار للحقول */
                padding: 15px 10px 15px 35%; 
                padding-right: 30%; 
                position: relative; 
                border-bottom: 1px dotted #ccc; 
                min-height: 25px; 
                display: flex; 
                flex-direction: column; /* جعل الحقول تترتب فوق بعضها (عمودياً) عند التعديل */
                align-items: flex-end; /* محاذاة الحقول لليسار */
                justify-content: center;
                gap: 8px; /* مسافة مريحة بين الحقول المتعددة (مثل التاريخ والوقت) */
            }
            
            td::before { 
                content: attr(data-label); 
                position: absolute; 
                right: 10px; 
                top: 15px; /* تثبيت العنوان في الأعلى لمنعه من التداخل عندما تكثر الحقول */
                transform: none; /* إلغاء التوسيط العمودي السابق */
                font-weight: bold; 
                color: var(--dark); 
            }
            
            td:last-child { 
                border-bottom: none; 
                justify-content: center; 
                padding: 10px; 
                align-items: center; 
            }
            td:last-child::before { display: none; }
            
            td input.edit-input, td select.edit-input { 
                width: 100%; 
                text-align: right; 
                box-sizing: border-box; /* منع الحقول من الخروج عن الإطار */
                margin-bottom: 0 !important; /* الاعتماد على gap للترتيب */
            }
            /* --- نهاية التعديلات --- */

            .action-buttons { display: flex; gap: 5px; width: 100%; justify-content: center; flex-wrap: wrap;}
            .top-bar { flex-direction: column; align-items: stretch; }
            .search-bar form { flex-direction: column; }
            .header-with-stats { flex-direction: column; align-items: flex-start; }
        }