@import url('https://fonts.cdnfonts.com/css/kfgqpc-hafs-uthmanic-script');

:root {
            --bg-deep:      #F8FAFC;
            --bg-primary:   #FFFFFF;
            --bg-card:      #FFFFFF;
            --bg-card-alt:  #F1F5F9;
            --bg-hover:     #F1F5F9;
            --bg-input:     #F8FAFC;
            --text-primary: #0F172A;
            --text-secondary: #334155;
            --text-dim:     #64748B;
            --accent-gold:  #D97706;
            --accent-amber: #F59E0B;
            --green:        #059669;
            --red:          #DC2626;
            --border:       #E2E8F0;
            --border-focus: #CBD5E1;
            --shadow-sm:    0 1px 2px 0 rgb(0 0 0 / 0.05);
            --shadow:       0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
            --shadow-lg:    0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
            --radius:       16px;
            --radius-sm:    8px;
            --radius-lg:    24px;
            --transition:   0.3s cubic-bezier(0.4, 0, 0.2, 1);
        }

        body {
            font-family: 'Noto Sans Arabic', sans-serif;
            background: var(--bg-deep);
            color: var(--text-primary);
            min-height: 100vh;
            line-height: 1.6;
            margin: 0;
            padding: 0;
        }
        
        *, *::before, *::after { box-sizing: border-box; }

        /* ═══════ Navbar & Tabs ═══════ */
        .navbar {
            background: var(--bg-primary);
            border-bottom: 1px solid var(--border);
            padding: 0 24px;
            display: flex;
            justify-content: space-between;
            align-items: center;
            height: 70px;
            box-shadow: var(--shadow-sm);
            position: sticky;
            top: 0;
            z-index: 50;
        }
        .nav-brand {
            font-family: 'KFGQPC HAFS Uthmanic Script', 'Amiri', serif;
            font-size: 1.6rem;
            font-weight: 700;
            color: var(--green);
            display: flex;
            align-items: center;
            gap: 10px;
        }
        .nav-brand svg { color: var(--accent-gold); }
        .nav-tabs {
            display: flex;
            gap: 8px;
            height: 100%;
        }
        .nav-tab {
            display: flex;
            align-items: center;
            gap: 6px;
            padding: 0 20px;
            height: 100%;
            border: none;
            background: none;
            font-family: 'Noto Sans Arabic', sans-serif;
            font-size: 0.95rem;
            font-weight: 600;
            color: var(--text-dim);
            cursor: pointer;
            position: relative;
            transition: color var(--transition);
        }
        .nav-tab:hover { color: var(--text-primary); }
        .nav-tab.active { color: var(--green); }
        .nav-tab::after {
            content: '';
            position: absolute;
            bottom: 0; left: 0; right: 0;
            height: 3px;
            background: var(--green);
            border-radius: 3px 3px 0 0;
            opacity: 0;
            transform: scaleX(0.5);
            transition: all var(--transition);
        }
        .nav-tab.active::after { opacity: 1; transform: scaleX(1); }

        .tab-content { display: none; }
        .tab-content.active { display: block; animation: fade-in 0.3s ease; }
        @keyframes fade-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

        /* ═══════ Review Progress Bar ═══════ */
        .review-progress {
            display: flex;
            align-items: center;
            gap: 12px;
            padding: 12px 24px;
            background: var(--bg-primary);
            border-bottom: 1px solid var(--border);
            font-size: 0.8rem;
            color: var(--text-dim);
        }
        .rp-bar {
            flex: 1;
            height: 6px;
            background: var(--bg-card-alt);
            border-radius: 3px;
            overflow: hidden;
            max-width: 400px;
        }
        .rp-fill {
            height: 100%;
            border-radius: 3px;
            background: linear-gradient(90deg, var(--green), var(--accent-gold));
            transition: width 0.5s ease;
        }
        .rp-stat { white-space: nowrap; font-weight: 600; }
        .rp-correct { color: var(--green); }
        .rp-wrong { color: var(--red); }

        /* ═══════ Container ═══════ */
        .container {
            max-width: 1100px;
            margin: 0 auto;
            padding: 24px 20px 60px;
        }

        /* ═══════ Controls ═══════ */
        .controls {
            display: flex;
            flex-wrap: wrap;
            gap: 16px;
            align-items: center;
            background: var(--bg-card);
            border: 1px solid var(--border);
            border-radius: var(--radius);
            padding: 16px 20px;
            margin-bottom: 24px;
            box-shadow: var(--shadow-sm);
        }
        .control-group {
            display: flex;
            flex-direction: column;
            gap: 4px;
            flex: 1;
            min-width: 160px;
        }
        .control-group label {
            font-size: 0.75rem;
            font-weight: 700;
            color: var(--text-dim);
        }
        .control-group select {
            appearance: none;
            background: var(--bg-input);
            border: 1px solid var(--border);
            border-radius: var(--radius-sm);
            color: var(--text-primary);
            font-family: 'Noto Sans Arabic', sans-serif;
            font-size: 0.95rem;
            padding: 8px 36px 8px 12px;
            cursor: pointer;
            transition: all var(--transition);
            background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' fill='%2364748B' viewBox='0 0 24 24'%3E%3Cpath d='M19 9l-7 7-7-7' stroke='%2364748B' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
            background-repeat: no-repeat;
            background-position: 12px center;
        }
        .control-group select:focus {
            outline: none;
            border-color: var(--green);
            box-shadow: 0 0 0 3px rgba(5,150,105,0.1);
        }

        /* ── State Toggle ── */
        .state-toggle {
            display: flex;
            background: var(--bg-input);
            border: 1px solid var(--border);
            border-radius: var(--radius-sm);
            overflow: hidden;
            padding: 2px;
        }
        .state-btn {
            padding: 6px 16px;
            font-family: 'Noto Sans Arabic', sans-serif;
            font-size: 0.85rem;
            font-weight: 600;
            border: none;
            border-radius: 6px;
            background: transparent;
            color: var(--text-secondary);
            cursor: pointer;
            transition: all var(--transition);
            white-space: nowrap;
        }
        .state-btn.active {
            background: var(--bg-primary);
            color: var(--green);
            box-shadow: var(--shadow-sm);
        }
        .neg-toggle {
            display: flex;
            align-items: center;
            gap: 6px;
            font-size: 0.85rem;
            font-weight: 600;
            color: var(--text-secondary);
            cursor: pointer;
            user-select: none;
        }
        .neg-toggle input[type="checkbox"] {
            accent-color: var(--green);
            width: 16px; height: 16px;
            cursor: pointer;
        }

        /* ═══════ Ayah Card ═══════ */
        .ayah-card {
            background: var(--bg-card);
            border: 1px solid var(--border);
            border-radius: var(--radius-lg);
            padding: 40px 32px 32px;
            margin-bottom: 24px;
            box-shadow: var(--shadow);
            min-height: 200px;
            position: relative;
        }
        .ayah-text {
            display: flex;
            flex-wrap: wrap;
            gap: 8px 18px;
            justify-content: center;
            align-items: flex-start;
            direction: rtl;
            padding: 10px 0 20px;
        }
        .word-wrap {
            display: flex;
            flex-direction: column;
            align-items: center;
            cursor: pointer;
            padding: 6px 8px 4px;
            border-radius: var(--radius-sm);
            transition: all var(--transition);
            position: relative;
        }
        .word-wrap:hover { background: var(--bg-card-alt); transform: translateY(-2px); }
        .word-wrap.active { background: rgba(5,150,105,0.08); box-shadow: inset 0 0 0 1px rgba(5,150,105,0.2); }
        .word-text {
            font-family: 'KFGQPC HAFS Uthmanic Script', 'Amiri', serif;
            font-size: 2.4rem;
            line-height: 1.8;
            color: var(--text-primary);
            white-space: nowrap;
        }
        .word-text.no-rules { color: var(--text-secondary); }

        /* ── Review badges on words ── */
        .word-review-badge {
            position: absolute;
            top: 4px;
            left: 4px;
            width: 16px; height: 16px;
            border-radius: 50%;
            font-size: 10px;
            display: flex;
            align-items: center;
            justify-content: center;
            box-shadow: var(--shadow-sm);
            background: var(--bg-card);
        }
        .word-review-badge.all-correct { color: var(--green); }
        .word-review-badge.has-wrong   { color: var(--red); }
        .word-review-badge.partial     { color: var(--accent-amber); }

        /* ═══════ Details Panel ═══════ */
        .details-panel {
            background: var(--bg-card);
            border: 1px solid var(--border);
            border-radius: var(--radius);
            margin-bottom: 24px;
            overflow: hidden;
            max-height: 0;
            opacity: 0;
            box-shadow: var(--shadow-lg);
            transition: max-height 0.5s ease, opacity 0.4s ease;
        }
        .details-panel.open { max-height: 2000px; opacity: 1; }
        .details-inner { padding: 24px; }
        .details-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            margin-bottom: 16px;
            padding-bottom: 16px;
            border-bottom: 1px solid var(--border);
        }
        .details-word {
            font-family: 'KFGQPC HAFS Uthmanic Script', 'Amiri', serif;
            font-size: 1.8rem;
            color: var(--green);
            font-weight: 700;
        }
        .details-count {
            font-size: 0.85rem;
            font-weight: 600;
            color: var(--text-dim);
            margin-right: 12px;
            background: var(--bg-card-alt);
            padding: 4px 10px;
            border-radius: 20px;
        }
        .details-close {
            background: var(--bg-card-alt);
            border: none;
            color: var(--text-secondary);
            width: 32px; height: 32px;
            border-radius: 50%;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: all var(--transition);
        }
        .details-close:hover { background: #E2E8F0; color: var(--red); }

        /* ── Rule List ── */
        .rule-list { display: flex; flex-direction: column; gap: 12px; }
        .rule-item {
            display: flex;
            flex-direction: column;
            padding: 16px;
            background: var(--bg-card-alt);
            border-radius: var(--radius-sm);
            border-right: 4px solid transparent;
            transition: all var(--transition);
        }
        .rule-item.reviewed-correct { border-right-color: var(--green); background: rgba(5,150,105,0.05); }
        .rule-item.reviewed-wrong   { border-right-color: var(--red);   background: rgba(220,38,38,0.05); }

        .ri-top { display: flex; align-items: flex-start; gap: 12px; }
        .ri-color { width: 12px; height: 12px; border-radius: 50%; margin-top: 6px; flex-shrink: 0; box-shadow: var(--shadow-sm); }
        .ri-body { flex: 1; min-width: 0; }
        .ri-name { font-weight: 700; font-size: 1rem; color: var(--text-primary); }
        .ri-cat { font-size: 0.85rem; color: var(--text-dim); margin-top: 2px; }
        .ri-meta { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
        .ri-badge {
            display: inline-flex;
            align-items: center;
            padding: 2px 8px;
            border-radius: 12px;
            font-size: 0.7rem;
            font-weight: 700;
        }
        .ri-badge.waqf     { background: #FEE2E2; color: #DC2626; }
        .ri-badge.wasl     { background: #D1FAE5; color: #059669; }
        .ri-badge.ibtida   { background: #E0F2FE; color: #0284C7; }
        .ri-badge.sakt     { background: #FEF3C7; color: #D97706; }
        .ri-badge.timed    { background: #EDE9FE; color: #7C3AED; }
        .ri-badge.negative { background: #F1F5F9; color: #475569; }
        .ri-badge.scope-word-boundary { background: #FCE7F3; color: #DB2777; }
        .ri-badge.scope-boundary      { background: #FFEDD5; color: #EA580C; }
        .ri-badge.target-chars { background: #E0F2FE; color: #0284C7; font-family: 'KFGQPC HAFS Uthmanic Script', 'Amiri', serif; font-size: 0.9rem; }
        .ri-manual-badge { background: #FEF3C7; color: #D97706; display: inline-flex; padding: 2px 8px; border-radius: 12px; font-size: 0.7rem; font-weight: 700; }

        /* ── Review Buttons ── */
        .ri-review { display: flex; align-items: center; gap: 8px; margin-right: auto; }
        .rv-btn {
            width: 36px; height: 36px;
            border-radius: 8px;
            border: 1px solid var(--border-focus);
            background: var(--bg-primary);
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: all var(--transition);
            color: var(--text-secondary);
        }
        .rv-btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-sm); }
        .rv-btn.rv-correct:hover, .rv-btn.rv-correct.selected { background: #D1FAE5; border-color: var(--green); color: var(--green); }
        .rv-btn.rv-wrong:hover, .rv-btn.rv-wrong.selected { background: #FEE2E2; border-color: var(--red); color: var(--red); }
        .rv-btn.selected { transform: scale(1.05); box-shadow: var(--shadow-sm); }
        .rv-reset {
            width: 30px; height: 30px;
            border: none; background: transparent;
            color: var(--text-dim);
            cursor: pointer; border-radius: 6px;
            display: flex; align-items: center; justify-content: center;
            transition: all var(--transition);
        }
        .rv-reset:hover { background: var(--bg-card-alt); color: var(--text-primary); }
        .ri-delete-btn {
            width: 30px; height: 30px;
            border: none; background: transparent; color: var(--text-dim);
            cursor: pointer; border-radius: 6px; display: flex; align-items: center; justify-content: center;
            transition: all var(--transition);
        }
        .ri-delete-btn:hover { background: #FEE2E2; color: var(--red); }

        /* ── Correction Form ── */
        .correction-form {
            margin-top: 12px;
            padding: 16px;
            background: #FEF2F2;
            border: 1px solid #FCA5A5;
            border-radius: var(--radius-sm);
            display: none;
        }
        .correction-form.open { display: block; animation: fade-in 0.3s ease; }
        .cf-label { font-size: 0.8rem; font-weight: 700; color: var(--red); margin-bottom: 6px; display: block; }
        .cf-select, .cf-textarea {
            width: 100%;
            background: var(--bg-primary);
            border: 1px solid var(--border-focus);
            border-radius: 6px;
            color: var(--text-primary);
            font-family: 'Noto Sans Arabic', sans-serif;
            font-size: 0.9rem;
            padding: 8px 12px;
            margin-bottom: 12px;
            transition: border-color var(--transition);
        }
        .cf-select:focus, .cf-textarea:focus { outline: none; border-color: var(--red); }
        .cf-actions { display: flex; gap: 12px; }
        .cf-save {
            padding: 8px 20px; border: none; border-radius: 6px;
            font-family: 'Noto Sans Arabic', sans-serif; font-size: 0.9rem; font-weight: 700;
            cursor: pointer; background: var(--red); color: white; display: flex; align-items: center; gap: 6px;
            box-shadow: var(--shadow-sm); transition: all var(--transition);
        }
        .cf-save:hover { filter: brightness(1.1); transform: translateY(-1px); }
        .cf-cancel {
            padding: 8px 16px; border: 1px solid var(--border-focus); border-radius: 6px;
            background: var(--bg-primary); color: var(--text-secondary);
            font-family: 'Noto Sans Arabic', sans-serif; font-size: 0.9rem; font-weight: 600;
            cursor: pointer; transition: all var(--transition);
        }
        .cf-cancel:hover { background: var(--bg-card-alt); }

        /* ═══════ Add Rule ═══════ */
        .add-rule-btn {
            width: 100%;
            padding: 14px;
            margin-top: 12px;
            border: 2px dashed var(--border-focus);
            border-radius: var(--radius-sm);
            background: transparent;
            color: var(--green);
            font-family: 'Noto Sans Arabic', sans-serif;
            font-size: 0.95rem;
            font-weight: 700;
            cursor: pointer;
            display: flex; align-items: center; justify-content: center; gap: 8px;
            transition: all var(--transition);
        }
        .add-rule-btn:hover { border-color: var(--green); background: #F0FDF4; }
        .add-rule-form {
            display: none; margin-top: 12px; padding: 20px;
            background: #F8FAFC; border: 1px solid var(--border); border-radius: var(--radius-sm);
        }
        .add-rule-form.open { display: block; animation: fade-in 0.3s ease; }
        .arf-row { display: flex; gap: 12px; margin-bottom: 12px; align-items: center; }
        .arf-row label { font-size: 0.85rem; font-weight: 700; color: var(--text-dim); min-width: 80px; flex-shrink: 0; }
        
        .char-selector { display: flex; gap: 8px; flex-wrap: wrap; }
        .char-btn {
            padding: 6px 12px;
            border: 1px solid var(--border-focus);
            border-radius: 6px;
            background: var(--bg-primary);
            font-family: 'KFGQPC HAFS Uthmanic Script', 'Amiri', serif;
            font-size: 1.4rem;
            cursor: pointer;
            transition: all var(--transition);
        }
        .char-btn:hover { border-color: var(--green); }
        .char-btn.selected { background: var(--green); color: white; border-color: var(--green); box-shadow: var(--shadow-sm); }
        
        /* ═══════ Stats & Legend ═══════ */
        .stats-bar { display: flex; gap: 20px; flex-wrap: wrap; margin-bottom: 20px; font-size: 0.9rem; color: var(--text-dim); }
        .stat { display: flex; align-items: center; gap: 6px; background: var(--bg-card); padding: 8px 16px; border-radius: 20px; border: 1px solid var(--border); }
        .stat-value { font-weight: 700; color: var(--green); }
        
        .legend { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 24px; box-shadow: var(--shadow-sm); }
        .legend-title { font-size: 0.85rem; font-weight: 700; color: var(--text-dim); margin-bottom: 12px; }
        .legend-grid { display: flex; flex-wrap: wrap; gap: 8px 20px; }
        .legend-item { display: flex; align-items: center; gap: 8px; font-size: 0.9rem; font-weight: 600; color: var(--text-secondary); cursor: pointer; padding: 4px 10px; border-radius: 20px; transition: all var(--transition); border: 1px solid transparent; }
        .legend-item:hover { background: var(--bg-card-alt); border-color: var(--border); }
        .legend-item.active { background: var(--bg-card-alt); border-color: var(--border-focus); box-shadow: var(--shadow-sm); }
        .legend-dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; box-shadow: var(--shadow-sm); }
        
        /* ═══════ Empty & Toast ═══════ */
        .empty-state { text-align: center; padding: 60px 20px; color: var(--text-dim); }
        .empty-state svg { color: var(--border-focus); margin-bottom: 12px; }
        .empty-state .es-text { font-size: 1.1rem; font-weight: 600; }
        
        .toast {
            position: fixed; bottom: 32px; left: 50%; transform: translateX(-50%) translateY(100px);
            background: var(--text-primary); color: white; padding: 12px 24px; border-radius: 30px;
            font-size: 0.95rem; font-weight: 600; box-shadow: var(--shadow-lg); opacity: 0;
            transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1); z-index: 100; pointer-events: none;
            display: flex; align-items: center; gap: 8px;
        }
        .toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }
        
        /* ═══════ Review Log Table ═══════ */
        .log-container {
            background: var(--bg-card);
            border: 1px solid var(--border);
            border-radius: var(--radius);
            box-shadow: var(--shadow-sm);
            overflow: hidden;
            margin-top: 24px;
        }
        .log-table-wrap { overflow-x: auto; }
        .log-table { width: 100%; border-collapse: collapse; text-align: right; }
        .log-table th { background: var(--bg-card-alt); padding: 12px 16px; font-size: 0.85rem; font-weight: 700; color: var(--text-dim); border-bottom: 1px solid var(--border); white-space: nowrap; }
        .log-table td { padding: 12px 16px; border-bottom: 1px solid var(--border); font-size: 0.9rem; color: var(--text-primary); vertical-align: middle; }
        .log-table tr:hover { background: #F8FAFC; }
        .log-table .word-cell { font-family: 'KFGQPC HAFS Uthmanic Script', 'Amiri', serif; font-size: 1.2rem; font-weight: 700; color: var(--green); }
        .status-badge { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 20px; font-size: 0.8rem; font-weight: 700; }
        .status-badge.correct { background: #D1FAE5; color: #059669; }
        .status-badge.wrong { background: #FEE2E2; color: #DC2626; }
        .status-badge.manual { background: #FEF3C7; color: #D97706; }
/* ═══════ Rules Dashboard Table ═══════ */
.rules-container { background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05); overflow: hidden; margin-top: 24px; }
.rules-table { width: 100%; border-collapse: collapse; text-align: right; }
.rules-table th { background: #F8FAFC; padding: 16px 20px; font-size: 0.95rem; font-weight: 700; color: #475569; border-bottom: 2px solid #E2E8F0; white-space: nowrap; }
.rules-table td { padding: 16px 20px; border-bottom: 1px solid #F1F5F9; font-size: 0.95rem; color: var(--text-primary); vertical-align: middle; transition: background 0.2s; }
.rules-table tr:hover td { background: #F8FAFC; }
.rules-table tr:last-child td { border-bottom: none; }

/* =========================================
   REFACTORED INLINE STYLES (v2.0)
   ========================================= */
.hidden { display: none !important; }
.manage-header-title { color: var(--text-main); font-family: 'KFGQPC HAFS Uthmanic Script', 'Amiri', serif; font-size: 1.8rem; display: flex; align-items: center; gap: 10px; margin: 0; }
.manage-header-actions { display: flex; gap: 1rem; align-items: center; }
.search-input-wrapper { position: relative; }
.search-icon { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); }
.search-input { padding: 10px 40px 10px 16px; border: 1px solid var(--border); border-radius: 8px; font-family: 'Noto Sans Arabic', sans-serif; width: 250px; background: white; }
.btn-primary { background: var(--green); color: white; padding: 10px 16px; border: none; border-radius: 8px; font-weight: bold; font-size: 1rem; cursor: pointer; font-family: 'Noto Sans Arabic', sans-serif; display: flex; align-items: center; gap: 8px; box-shadow: var(--shadow-sm); transition: 0.2s; }
.btn-danger { background: var(--red); color: white; padding: 10px 16px; border: none; border-radius: 8px; font-weight: bold; cursor: pointer; font-family: 'Noto Sans Arabic', sans-serif; display: flex; align-items: center; gap: 8px; }
.btn-secondary { background: #e2e8f0; color: var(--text-main); padding: 10px 16px; border: none; border-radius: 8px; font-weight: 600; cursor: pointer; font-family: 'Noto Sans Arabic', sans-serif; }
.btn-icon { background: none; border: none; color: var(--text-dim); cursor: pointer; padding: 4px; }
.btn-cancel { background: #e2e8f0; color: var(--text-main); padding: 10px 16px; border: none; border-radius: 8px; font-weight: 600; cursor: pointer; font-family: 'Noto Sans Arabic', sans-serif; }
.full-width { width: 100%; }
.col-20 { width: 20%; }
.col-25 { width: 25%; }
.admin-container { max-width: 1200px; margin: 2rem auto; }
.admin-title { color: var(--text-main); font-family: 'KFGQPC HAFS Uthmanic Script', 'Amiri', serif; font-size: 1.8rem; display: flex; align-items: center; gap: 10px; margin-bottom: 2rem; }
.admin-card { background: white; padding: 20px; border-radius: 12px; border: 1px solid var(--border); margin-bottom: 24px; }
.admin-card-header { margin-top: 0; font-family: 'KFGQPC HAFS Uthmanic Script', 'Amiri', serif; }
.db-status-wrap { display: flex; gap: 10px; align-items: center; margin-top: 16px; }
.logs-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.logs-title { margin: 0; font-family: 'KFGQPC HAFS Uthmanic Script', 'Amiri', serif; }
.table-responsive { overflow-x: auto; }
.rtl-table { text-align: right; }
.mb-24 { margin-bottom: 24px; }

/* Modal Classes */
.modal-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(15,23,42,0.5); z-index: 9999; backdrop-filter: blur(4px); justify-content: center; align-items: center; opacity: 0; transition: opacity 0.2s; }
.modal-content { background: white; border-radius: 12px; box-shadow: var(--shadow-lg); width: 90%; max-width: 600px; padding: 2rem; transform: scale(0.95); transition: transform 0.2s; }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; }
.modal-title { margin: 0; color: var(--text-main); font-size: 1.4rem; }
.modal-form { display: flex; flex-direction: column; gap: 1.2rem; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-label { font-weight: 600; font-size: 0.9rem; color: var(--text-main); }
.form-input { padding: 10px; border: 1px solid #cbd5e1; border-radius: 8px; font-family: 'Noto Sans Arabic', sans-serif; }
.form-checkbox-wrap { display: flex; gap: 2rem; align-items: center; background: #f8fafc; padding: 1rem; border-radius: 8px; border: 1px solid #e2e8f0; flex-wrap: wrap; }
.form-checkbox-label { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 0.9rem; cursor: pointer; }
.form-checkbox { width: 18px; height: 18px; }
.harakaat-box { display: none; align-items: center; gap: 8px; flex-wrap: wrap; }
.harakaat-label { margin-left: 10px; }
.harakaat-btn-group { display: flex; gap: 6px; }
.hk-btn { width: 36px; height: 36px; border-radius: 8px; border: 1px solid var(--border); background: white; cursor: pointer; font-family: 'Noto Sans Arabic', sans-serif; font-weight: bold; transition: 0.2s; }
.hk-btn.active { background: var(--green) !important; color: white !important; border-color: var(--green) !important; box-shadow: var(--shadow-sm); }
.modal-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; }
.modal-actions { display: flex; gap: 10px; margin-right: auto; }
.hidden-delete-btn { display: none; }
.icon-ml { margin-left: 4px; vertical-align: middle; }

/* Log Classes */
.log-controls { margin-bottom: 0; justify-content: space-between; }
.log-header { font-size: 1.2rem; font-weight: 700; color: var(--text-primary); display: flex; align-items: center; gap: 8px; }
.btn-refresh { padding: 8px 16px; background: var(--bg-card-alt); border-radius: 6px; border: 1px solid var(--border); }

/* Details Form Adjustments */
.arf-select { margin: 0; }
.mt-16 { margin-top: 16px; }
.btn-add-rule-template { display: flex; align-items: center; gap: 8px; }

