
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            font-family: 'Cairo', sans-serif;
        }

        /* Light Mode */
        :root {
            --fs-base: 14px; --fs-card: 0.78rem; --fs-title: 0.88rem; --fs-text: 0.84rem; --fs-meta: 0.72rem;
            --bg-gradient-start: #f5f0e8;
            --bg-gradient-end: #e8e0d5;
            --page-bg: #fcf8f0;
            --tabs-bg: #ffffff;
            --surface-alt: #f0e8e0;
            --tab-btn-color: #5a4a3a;
            --tab-btn-active-bg: #2d6a4f;
            --tab-btn-active-color: white;
            --rail-bg: #e8e0d5;
            --rail-slot-bg: #ffffff;
            --rail-slot-color: #5a4a3a;
            --rail-slot-border: #d4c9bc;
            --rail-slot-active-bg: #2d6a4f;
            --card-bg: #ffffff;
            --card-header-bg: #faf7f2;
            --card-border: #e8e0d5;
            --title-color: #2d6a4f;
            --text-color: #4a3728;
            --desc-color: #7a6a5a;
            --source-color: #9a8a7a;
            --text-muted: #9a8a7a;
            --text-secondary: #7a6a5a;
            --accent: #2d6a4f;
            --counter-btn-bg: #f0e8e0;
            --counter-btn-color: #4a3728;
            --done-btn-bg: #f0e8e0;
            --done-btn-completed-bg: #2d6a4f;
            --footer-color: #9a8a7a;
            --modal-bg: #ffffff;
            --modal-header-bg: linear-gradient(135deg, #2d6a4f, #1b4d3a);
            --manage-cat-tabs-bg: #f0e8e0;
            --manage-item-bg: #ffffff;
            --manage-item-border: #e0d5c8;
            --form-bg: #faf7f2;
            --form-border: #e0d5c8;
            --input-bg: #ffffff;
            --input-color: #4a3728;
            --subcat-bg: #ffffff;
            --subcat-border: #ddd0bc;
            --subcat-color: #5a4a3a;
            --subcat-active-bg: #2d6a4f;
            --bead-bg: radial-gradient(circle at 30% 30%, #d4c4b0, #b8a890);
            --bead-color: #4a3728;
            --active-bead-bg: radial-gradient(circle at 30% 30%, #f5c542, #e8a020);
            --player-bg: #ffffff;
            --player-shadow: 0 -4px 20px rgba(0,0,0,0.15);
            --fab-bg: #2d6a4f;
            --fab-hover: #1b4d3a;
            --search-bg: #ffffff;
            --search-border: #e0d5c8;
            --favorite-color: #f5c542;

            --menu-bg: #2d6a4f;
            --menu-hover: #1b4d3a;
            --lang-btn-bg: #3498db;
            --highlight-color: #27ae60;
            --highlight-bg: rgba(39,174,96,0.2);
            --player-btn-bg: #f0e8e0;
            --player-btn-color: #4a3728;
            --progress-bg: #e0d5c8;
            --glow-shadow: 0 0 30px rgba(46,204,113,0.5);
        }

        /* Dark Mode */
        body.dark {
            --bg-gradient-start: #0d1117;
            --bg-gradient-end: #161b22;
            --tabs-bg: #21262d;
            --surface-alt: #30363d;
            --tab-btn-color: #c9d1d9;
            --tab-btn-active-bg: #238636;
            --tab-btn-active-color: #ffffff;
            --rail-bg: #161b22;
            --rail-slot-bg: #21262d;
            --rail-slot-color: #c9d1d9;
            --rail-slot-border: #30363d;
            --rail-slot-active-bg: #238636;
            --card-bg: #21262d;
            --card-header-bg: #1a1f2e;
            --card-border: #30363d;
            --title-color: #3fb950;
            --text-color: #e6edf3;
            --desc-color: #8b949e;
            --source-color: #6e7681;
            --text-muted: #6e7681;
            --text-secondary: #8b949e;
            --accent: #3fb950;
            --counter-btn-bg: #30363d;
            --counter-btn-color: #c9d1d9;
            --done-btn-bg: #30363d;
            --done-btn-completed-bg: #238636;
            --footer-color: #6e7681;
            --modal-bg: #21262d;
            --modal-header-bg: linear-gradient(135deg, #1b4d3a, #0d2e22);
            --manage-cat-tabs-bg: #161b22;
            --manage-item-bg: #21262d;
            --manage-item-border: #30363d;
            --form-bg: #161b22;
            --form-border: #30363d;
            --input-bg: #21262d;
            --input-color: #e6edf3;
            --subcat-bg: #21262d;
            --subcat-border: #30363d;
            --subcat-color: #c9d1d9;
            --subcat-active-bg: #238636;
            --bead-bg: radial-gradient(circle at 30% 30%, #3d4f6e, #2a3a5c);
            --bead-color: #c9d1d9;
            --active-bead-bg: radial-gradient(circle at 30% 30%, #e8a84c, #d4842a);
            --player-bg: #21262d;
            --player-shadow: 0 -4px 20px rgba(0,0,0,0.4);
            --fab-bg: #238636;
            --fab-hover: #1a6e2e;
            --search-bg: #21262d;
            --search-border: #30363d;
            --favorite-color: #e8a84c;

            --menu-bg: #238636;
            --menu-hover: #1a6e2e;
            --lang-btn-bg: #1f6feb;
            --highlight-color: #3fb950;
            --highlight-bg: rgba(63,185,80,0.2);
            --player-btn-bg: #30363d;
            --player-btn-color: #c9d1d9;
            --progress-bg: #30363d;
            --glow-shadow: 0 0 30px rgba(63,185,80,0.5);
            --page-bg: #1a1e24;
        }

        body {
            background: linear-gradient(145deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%);
            min-height: 100vh;
            padding: 1rem;
            padding-bottom: 5rem;
            transition: background 0.3s ease;
        }
        .container { max-width: 800px; margin: 0 auto; }

        /* ===== Completion Animation ===== */
        @keyframes cardComplete {
            0%   { transform: scale(1); box-shadow: 0 4px 12px rgba(0,0,0,0.1); }
            18%  { transform: scale(1.025); box-shadow: 0 0 0 3px var(--highlight-color), 0 12px 36px rgba(39,174,96,0.38); }
            62%  { transform: scale(1.012); box-shadow: 0 0 0 2px var(--highlight-color), 0 8px 22px rgba(39,174,96,0.18); }
            100% { transform: scale(1); box-shadow: 0 4px 12px rgba(0,0,0,0.1); }
        }
        .card.completed-animation {
            animation: cardComplete 1s cubic-bezier(0.22, 1, 0.36, 1) forwards;
            position: relative;
        }

        /* Shimmer sweep injected inside card */
        .completion-shimmer {
            position: absolute;
            inset: 0;
            border-radius: inherit;
            overflow: hidden;
            pointer-events: none;
            z-index: 3;
        }
        .completion-shimmer::after {
            content: '';
            position: absolute;
            top: 0; left: -80%;
            width: 55%; height: 100%;
            background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.22) 50%, transparent 100%);
            transform: skewX(-14deg);
            animation: shimmerSweep 0.55s 0.08s ease-out forwards;
        }
        body.dark .completion-shimmer::after {
            background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.09) 50%, transparent 100%);
        }
        @keyframes shimmerSweep {
            0%   { left: -80%; opacity: 1; }
            100% { left: 140%; opacity: 0.2; }
        }

        /* Check circle bubble (fixed-position via JS) */
        .completion-check {
            position: fixed;
            width: 54px; height: 54px;
            margin-left: -27px; margin-top: -27px;
            border-radius: 50%;
            background: var(--highlight-color);
            box-shadow: 0 4px 22px rgba(39,174,96,0.65);
            display: flex; align-items: center; justify-content: center;
            pointer-events: none;
            z-index: 9999;
            animation: checkBubbleIn 0.42s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
        }
        @keyframes checkBubbleIn {
            0%   { opacity: 0; transform: scale(0.15); }
            55%  { opacity: 1; transform: scale(1.14); }
            78%  { transform: scale(0.93); }
            100% { opacity: 1; transform: scale(1); }
        }
        .completion-check.fade-out {
            animation: checkBubbleOut 0.3s ease-in forwards !important;
        }
        @keyframes checkBubbleOut {
            0%   { opacity: 1; transform: scale(1) translateY(0); }
            100% { opacity: 0; transform: scale(0.55) translateY(-20px); }
        }
        .completion-check svg path {
            stroke-dasharray: 100;
            stroke-dashoffset: 100;
            animation: drawCheck 0.38s 0.1s ease-out forwards;
        }
        @keyframes drawCheck {
            to { stroke-dashoffset: 0; }
        }

        /* Burst particles (fixed-position via JS) */
        .completion-particle {
            position: fixed;
            border-radius: 50%;
            pointer-events: none;
            z-index: 9998;
            animation: particleOut var(--dur, 0.72s) var(--delay, 0s) ease-out forwards;
        }
        @keyframes particleOut {
            0%   { opacity: 1; transform: translate(0, 0) scale(1); }
            60%  { opacity: 0.7; }
            100% { opacity: 0; transform: translate(var(--dx), var(--dy)) scale(0); }
        }

        /* ===== Audio Player ===== */
        .audio-player-bar {
            position: fixed;
            bottom: 80px;
            left: 50%;
            transform: translateX(-50%) translateY(200px);
            width: 92%;
            max-width: 560px;
            background: var(--player-bg);
            border-radius: 1.1rem;
            padding: 0.72rem 1rem 0.65rem;
            transition: transform 0.38s cubic-bezier(0.34, 1.15, 0.64, 1), opacity 0.3s ease, visibility 0s 0.4s;
            z-index: 1500;
            box-shadow: var(--player-shadow);
            border: 1px solid var(--card-border);
            opacity: 0;
            visibility: hidden;
        }
        .audio-player-bar.active {
            transform: translateX(-50%) translateY(0);
            opacity: 1;
            visibility: visible;
            transition: transform 0.38s cubic-bezier(0.34, 1.15, 0.64, 1), opacity 0.3s ease;
        }
        /* Two-row layout */
        .player-row {
            display: flex;
            align-items: center;
            gap: 0.55rem;
        }
        .player-row-top { margin-bottom: 0.48rem; }

        /* Animated waveform */
        .player-wave {
            display: flex;
            align-items: flex-end;
            gap: 2.5px;
            height: 18px;
            flex-shrink: 0;
        }
        .player-wave span {
            display: block;
            width: 3px;
            background: var(--tab-btn-active-bg);
            border-radius: 3px;
            animation: waveBar 0.7s ease-in-out infinite alternate;
            transform-origin: bottom;
        }
        .player-wave span:nth-child(1) { height: 7px;  animation-delay: 0s; }
        .player-wave span:nth-child(2) { height: 14px; animation-delay: 0.12s; }
        .player-wave span:nth-child(3) { height: 9px;  animation-delay: 0.24s; }
        .player-wave span:nth-child(4) { height: 16px; animation-delay: 0.08s; }
        .player-wave span:nth-child(5) { height: 6px;  animation-delay: 0.2s; }
        .player-wave.paused span { animation-play-state: paused; }
        @keyframes waveBar {
            0%   { transform: scaleY(0.3); opacity: 0.6; }
            100% { transform: scaleY(1);   opacity: 1; }
        }

        /* Title */
        .player-title-wrap { flex: 1; overflow: hidden; }
        .player-title {
            font-size: 0.82rem;
            font-weight: 700;
            color: var(--text-color);
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            direction: rtl;
        }
        .player-audio-desc {
            font-size: 0.7rem;
            opacity: 0.6;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            direction: rtl;
            margin-top: 1px;
        }

        /* Top action chips */
        .player-top-actions { display: flex; align-items: center; gap: 0.35rem; flex-shrink: 0; }
        .player-chip-btn {
            background: var(--player-btn-bg);
            border: 1px solid var(--card-border);
            border-radius: 2rem;
            padding: 0.17rem 0.52rem;
            font-size: 0.7rem;
            font-weight: 700;
            color: var(--player-btn-color);
            cursor: pointer;
            transition: all 0.18s ease;
            font-family: 'Cairo', sans-serif;
            line-height: 1.5;
            display: flex;
            align-items: center;
            gap: 4px;
        }
        .player-chip-btn:hover, .player-chip-btn.active {
            background: var(--tab-btn-active-bg);
            color: white;
            border-color: transparent;
        }
        .close-player {
            background: var(--player-btn-bg);
            border: 1px solid var(--card-border);
            width: 26px;
            height: 26px;
            border-radius: 50%;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            color: var(--source-color);
            font-size: 0.75rem;
            transition: all 0.18s ease;
            flex-shrink: 0;
        }
        .close-player:hover { background: #e74c3c; color: white; border-color: transparent; transform: scale(1.08); }

        /* Controls row */
        .player-controls { display: flex; align-items: center; gap: 0.3rem; flex-shrink: 0; }
        .player-btn {
            background: var(--player-btn-bg);
            border: none;
            width: 30px;
            height: 30px;
            border-radius: 50%;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 0.78rem;
            color: var(--player-btn-color);
            transition: all 0.18s ease;
        }
        .player-btn:hover { transform: scale(1.08); background: var(--tab-btn-active-bg); color: white; }
        .player-btn-main {
            width: 36px !important;
            height: 36px !important;
            font-size: 0.9rem !important;
            background: var(--tab-btn-active-bg) !important;
            color: white !important;
            box-shadow: 0 2px 8px rgba(45,106,79,0.3);
        }
        .player-btn-main:hover { background: var(--fab-hover) !important; transform: scale(1.07) !important; }
        .player-btn.loading { opacity: 0.8; pointer-events: none; }
        .player-btn.loading i { animation: spinIcon 0.7s linear infinite; display: inline-block; }
        @keyframes spinIcon { to { transform: rotate(360deg); } }

        /* Progress bar */
        .player-progress-wrap {
            flex: 1;
            display: flex;
            align-items: center;
            gap: 0.45rem;
            min-width: 0;
            direction: ltr;
        }
        .player-progress {
            flex: 1;
            height: 5px;
            background: var(--progress-bg);
            border-radius: 5px;
            cursor: pointer;
            position: relative;
            transition: height 0.15s ease;
        }
        .player-progress:hover { height: 7px; }
        .player-progress-fill {
            height: 100%;
            background: linear-gradient(90deg, var(--tab-btn-active-bg), var(--highlight-color));
            border-radius: 5px;
            position: relative;
            width: 0%;
            transition: width 0.12s linear;
        }
        .player-progress-fill::after {
            content: '';
            position: absolute;
            right: -6px;
            top: 50%;
            transform: translateY(-50%) scale(0);
            width: 13px;
            height: 13px;
            background: var(--tab-btn-active-bg);
            border-radius: 50%;
            box-shadow: 0 1px 4px rgba(0,0,0,0.25);
            transition: transform 0.15s ease;
        }
        .player-progress:hover .player-progress-fill::after { transform: translateY(-50%) scale(1); }
        .time-display {
            font-size: 0.67rem;
            font-variant-numeric: tabular-nums;
            color: var(--source-color);
            white-space: nowrap;
            flex-shrink: 0;
            font-family: monospace;
        }

        /* Volume */
        .volume-control { display: flex; align-items: center; gap: 0.3rem; flex-shrink: 0; }
        .player-vol-icon {
            background: none;
            border: none;
            cursor: pointer;
            color: var(--source-color);
            font-size: 0.82rem;
            padding: 2px 4px;
            transition: color 0.18s ease;
            display: flex;
            align-items: center;
            border-radius: 4px;
        }
        .player-vol-icon:hover { color: var(--text-color); }
        .player-vol-icon.muted { color: #e74c3c; }
        .volume-slider { width: 58px; cursor: pointer; accent-color: var(--tab-btn-active-bg); }

        @media (max-width: 600px) {
            .audio-player-bar { padding: 0.58rem 0.85rem 0.5rem; }
            .volume-control { display: none; }
            .player-title { font-size: 0.78rem; }
            .player-btn { width: 28px; height: 28px; font-size: 0.75rem; }
            .player-btn-main { width: 34px !important; height: 34px !important; font-size: 0.85rem !important; }
            .time-display { font-size: 0.62rem; }
            .player-chip-btn { padding: 0.14rem 0.42rem; font-size: 0.66rem; }
            .close-player { width: 24px; height: 24px; font-size: 0.7rem; }
            /* Mobile Quran */
            .quran-toolbar { padding: 4px 8px; gap: 6px; top: calc(0.8rem + 38px + 4px); }
            .quran-tb-btn { width: 30px; height: 30px; font-size: 0.78rem; }
            .quran-tb-title { font-size: 0.74rem; }
            .quran-main { padding: 0 8px 20px 8px; }
            .quran-sidebar { width: 85vw; max-width: 85vw; right: -85vw; }
            .quran-sidebar.open { right: 0; }
            .quran-layout.sidebar-open .quran-main { margin-right: 85vw; }
            .scroll-to-top { bottom: 80px; right: 10px !important; left: auto !important; width: 38px; height: 38px; font-size: 0.85rem; }
            /* Mobile dashboard sections */
            .quran-pos-dashboard { padding: 10px; }
            .quran-pos-dashboard .quran-audio-dash-header { font-size: 0.75rem; }
            #quranPosSurah { font-size: 0.78rem !important; }
            #quranPosContinueBtn { padding: 6px 10px !important; font-size: 0.65rem !important; }
            .quran-audio-dashboard { padding: 10px; }
            .quran-audio-dash-header { font-size: 0.75rem; margin-bottom: 6px; }
            .quran-audio-select { font-size: 0.7rem; padding: 6px 8px; margin-bottom: 6px; }
            .quran-audio-play-btn { padding: 7px; font-size: 0.72rem; }

            .popout-menu { bottom: 12px; inset-inline-start: 12px; }
            .menu-toggle { width: 46px; height: 46px; font-size: 1.3rem; }
        }

        /* Top Bar - Fixed Width */
        .top-bar { 
            display: flex; 
            justify-content: space-between; 
            align-items: center; 
            margin-bottom: 1rem; 
            gap: 1rem; 
            flex-wrap: wrap; 
        }
        .lang-toggle { 
            background: var(--lang-btn-bg); 
            border: none; 
            padding: 0.5rem 1rem; 
            border-radius: 2rem; 
            color: white; 
            font-weight: bold; 
            cursor: pointer; 
            display: flex; 
            align-items: center; 
            gap: 8px; 
            transition: all 0.2s ease; 
            font-size: 0.85rem; 
            flex-shrink: 0;
            min-width: 110px;
            justify-content: center;
        }
        
        .popout-menu { position: fixed; bottom: 20px; inset-inline-start: 20px; z-index: 1000; }
        .menu-toggle { width: 55px; height: 55px; border-radius: 50%; background: var(--menu-bg); color: white; border: none; cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 1.6rem; box-shadow: 0 6px 16px rgba(0,0,0,0.25); transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); z-index: 1002; }
        .menu-toggle.active { transform: rotate(90deg); }
        .menu-items { position: absolute; bottom: 65px; inset-inline-start: 0; display: flex; flex-direction: column; gap: 12px; visibility: hidden; opacity: 0; transform: translateY(20px) scale(0.9); transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); pointer-events: none; z-index: 1003; }
        .menu-items.active { visibility: visible; opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }
        .menu-item { width: 48px; height: 48px; border-radius: 50%; background: var(--menu-bg); color: white; border: none; cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 1.3rem; transition: all 0.2s ease; box-shadow: 0 4px 12px rgba(0,0,0,0.2); animation: fadeInUp 0.3s ease backwards; pointer-events: auto; }
        .menu-item:nth-child(1) { animation-delay: 0.02s; } .menu-item:nth-child(2) { animation-delay: 0.06s; } .menu-item:nth-child(3) { animation-delay: 0.1s; } .menu-item:nth-child(4) { animation-delay: 0.14s; } .menu-item:nth-child(5) { animation-delay: 0.18s; }
        @keyframes fadeInUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
        .menu-item:hover { transform: scale(1.1); background: var(--menu-hover); }
        .menu-item.manage { background: #8e44ad; }
        .menu-item.manage:hover { background: #7d3c98; }
        .menu-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.4); z-index: 998; visibility: hidden; opacity: 0; transition: all 0.3s ease; pointer-events: none; }
        .menu-overlay.active { visibility: visible; opacity: 1; pointer-events: auto; }

        .page-nav { display: flex; gap: 0; margin-bottom: 0.8rem; background: var(--tabs-bg); border-radius: 2rem; padding: 3px; border: 1px solid var(--card-border); position: sticky; top: 1rem; z-index: 100; box-shadow: 0 2px 8px rgba(0,0,0,0.08); }
        .page-nav-btn { flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 16px; border: none; border-radius: 2rem; font-size: 0.8rem; font-weight: 700; cursor: pointer; background: transparent; color: var(--text-muted); transition: all 0.2s; }
        .page-nav-btn.active { background: var(--tab-btn-active-bg); color: #fff; box-shadow: 0 2px 8px rgba(0,0,0,0.15); }
        .page-nav-btn i { font-size: 0.85rem; }
        .page-nav-label { font-size: 0.78rem; }

        .streak-header { background: var(--tabs-bg); border-radius: 1.5rem; padding: 0.6rem 1rem; margin-bottom: 1rem; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 0.5rem; border: 1px solid var(--card-border); }
        .streak-info { display: flex; align-items: center; gap: 0.8rem; flex-wrap: wrap; }
        .streak-box { background: var(--tab-btn-active-bg); border-radius: 2rem; padding: 0.4rem 1rem; color: white; display: flex; align-items: center; gap: 8px; }
        .streak-box.best-streak { background: var(--counter-btn-bg); color: var(--text-color); border: 1px solid var(--card-border); }
        .streak-number { font-size: 1.3rem; font-weight: 800; }
        .streak-label { font-size: 0.65rem; opacity: 0.9; }
        .last-active { font-size: 0.7rem; color: var(--source-color); }

        .search-toolbar { display: flex; gap: 0.5rem; margin-bottom: 0.8rem; align-items: center; }
        .autoplay-bar { 
            display: flex; 
            justify-content: center; 
            gap: 0.8rem; 
            margin-bottom: 1rem; 
            flex-wrap: wrap; 
            align-items: center;
        }
        .autoplay-btn { 
            background: var(--tab-btn-active-bg); 
            border: none; 
            padding: 0.5rem 1.2rem; 
            border-radius: 2.5rem; 
            color: white; 
            font-weight: bold; 
            font-size: 0.85rem; 
            cursor: pointer; 
            display: flex; 
            align-items: center; 
            gap: 8px; 
            transition: all 0.2s ease; 
        }
        .autoplay-btn.active { 
            background: #e8a84c; 
            animation: pulse 1s infinite; 
        }
        @keyframes pulse {
            0% { opacity: 1; transform: scale(1); }
            50% { opacity: 0.85; transform: scale(0.98); }
            100% { opacity: 1; transform: scale(1); }
        }

        .search-container { margin-bottom: 0.8rem; position: relative; }
        .search-input { width: 100%; padding: 0.7rem 1rem; padding-inline-end: 2.5rem; border: 1px solid var(--search-border); border-radius: 2.5rem; font-size: 0.85rem; background: var(--search-bg); color: var(--text-color); outline: none; transition: all 0.2s ease; }
        .search-input:focus { border-color: var(--tab-btn-active-bg); box-shadow: 0 0 0 2px rgba(35,134,54,0.1); }
        .search-icon { position: absolute; inset-inline-start: 15px; top: 50%; transform: translateY(-50%); color: var(--source-color); font-size: 0.9rem; }
        .clear-search { position: absolute; inset-inline-end: 15px; top: 50%; transform: translateY(-50%); background: none; border: none; color: var(--source-color); cursor: pointer; display: none; font-size: 0.9rem; }
        .clear-search.visible { display: block; }

        .filter-bar { display: flex; gap: 0.8rem; margin-bottom: 1rem; justify-content: flex-end; }
        .favorites-filter-btn { background: var(--counter-btn-bg); border: 1px solid var(--search-border); padding: 0.4rem 1rem; border-radius: 2rem; cursor: pointer; display: flex; align-items: center; gap: 6px; font-size: 0.8rem; font-weight: 600; color: var(--text-color); transition: all 0.2s ease; }
        .favorites-filter-btn.active { background: var(--favorite-color); color: #1a1a2e; border-color: var(--favorite-color); }
        .favorites-filter-btn:hover { transform: scale(1.02); }
        .reset-btn { background: var(--counter-btn-bg); border: 1px solid var(--search-border); padding: 0.4rem 1rem; border-radius: 2rem; cursor: pointer; display: flex; align-items: center; gap: 6px; font-size: 0.8rem; font-weight: 600; color: #e74c3c; transition: all 0.2s ease; }
        .reset-btn:hover { background: #e74c3c; color: #fff; transform: scale(1.02); }

        .tabs-wrapper { position: relative; margin-bottom: 1rem; border-radius: 3rem; background: var(--tabs-bg); }
        .tabs { display: flex; gap: 0.4rem; padding: 0.45rem; border: none; }
        .tab-btn { background: transparent; border: none; padding: 0.45rem 0.85rem; font-size: 0.8rem; font-weight: 700; border-radius: 2rem; cursor: pointer; color: var(--tab-btn-color); display: inline-flex; align-items: center; gap: 5px; flex-shrink: 0; transition: all 0.2s ease; }
        .tab-btn.dropdown-tab { background: var(--surface-alt); color: var(--text-color); width: 100%; justify-content: space-between; padding: 0.6rem 1rem; border: 1px solid var(--card-border); box-shadow: 0 1px 3px rgba(0,0,0,0.06); }
        .tab-btn.dropdown-tab .fa-chevron-down { transition: transform 0.25s ease; }
        .tab-btn.dropdown-tab:hover { background: var(--card-bg); border-color: var(--accent); }
        .tab-btn.dropdown-tab.active { background: var(--accent); color: white; border-color: var(--accent); }
        .tab-btn.dropdown-tab.active .fa-chevron-down { transform: rotate(180deg); }
        .tab-btn.active { background: var(--tab-btn-active-bg); color: white; }
        .cat-grid-overlay { display: none; position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 100; background: var(--card-bg); border: 1px solid var(--card-border); border-radius: 16px; padding: 14px; max-height: 320px; overflow-y: auto; box-shadow: 0 8px 32px rgba(0,0,0,0.18); }
        .cat-grid-overlay.open { display: flex; flex-direction: column; }
        .cat-grid-overlay .cat-grid-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
        .cat-grid-overlay .cat-grid-header span { font-weight: 800; font-size: 0.85rem; color: var(--text-color); }
        .cat-grid-overlay .cat-grid-header button { background: none; border: none; cursor: pointer; color: var(--text-muted); font-size: 1rem; padding: 4px; border-radius: 50%; }
        .cat-grid-overlay .cat-grid-header button:hover { background: var(--surface-alt); }
        .cat-grid-overlay .cat-grid-section-label { font-weight: 700; font-size: 0.7rem; color: var(--accent); padding: 4px 2px; margin-bottom: 4px; }
        .cat-grid-overlay .cat-grid-items { display: flex; flex-wrap: wrap; gap: 6px; }
        .cat-grid-overlay .cat-grid-items .tab-btn { font-size: 0.75rem; padding: 6px 14px; background: var(--surface-alt); border: 1px solid var(--card-border); }
        .cat-grid-overlay .cat-grid-items .tab-btn:hover { border-color: var(--accent); background: var(--card-bg); }
        .cat-grid-overlay .cat-grid-items .tab-btn.active { background: var(--tab-btn-active-bg); color: white; border-color: var(--tab-btn-active-bg); }
        .cat-grid-overlay .cat-grid-search-wrap { position: relative; margin-bottom: 8px; }
        .cat-grid-overlay .cat-grid-search-input { width: 100%; padding: 6px 10px; border: 1px solid var(--card-border); border-radius: 2rem; background: var(--surface-alt); color: var(--text-color); font-size: 0.75rem; font-family: inherit; outline: none; box-sizing: border-box; }

        .card.highlighted { border-color: var(--accent) !important; background: var(--surface-alt) !important; animation: cardPulse 0.6s ease-in-out 2; }
        @keyframes cardPulse { 0%, 100% { box-shadow: 0 0 4px var(--accent); } 50% { box-shadow: 0 0 14px var(--accent); } }
        .subcategories-container { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 1rem; padding: 0.5rem; background: var(--rail-bg); border-radius: 2rem; justify-content: center; border: 1px solid var(--card-border); }
        .subcat-btn { background: var(--subcat-bg); border: 1px solid var(--subcat-border); padding: 0.35rem 0.9rem; border-radius: 2rem; font-size: 0.75rem; font-weight: 600; cursor: pointer; color: var(--subcat-color); display: flex; align-items: center; gap: 5px; transition: all 0.2s ease; }
        .subcat-btn.active { background: var(--subcat-active-bg); color: white; border-color: var(--subcat-active-bg); }

        .rail-container { background: var(--rail-bg); padding: 0.6rem; border-radius: 3rem; margin-bottom: 1.2rem; overflow-x: auto; white-space: nowrap; border: 1px solid var(--card-border); }
        .rail { display: inline-flex; gap: 0.5rem; }
        .rail-slot { background: var(--rail-slot-bg); border-radius: 2rem; padding: 0.4rem 0.9rem; font-size: 0.7rem; font-weight: 600; color: var(--rail-slot-color); cursor: pointer; display: inline-flex; align-items: center; gap: 5px; border: 1px solid var(--rail-slot-border); transition: all 0.2s ease; }
        .rail-slot.active-rail { background: var(--rail-slot-active-bg); color: white; border-color: var(--rail-slot-active-bg); }
        .rail-slot:hover { transform: translateY(-1px); }

        .cards-container { display: flex; flex-direction: column; gap: 1rem; }
        .card { background: var(--card-bg); border-radius: 1.5rem; box-shadow: 0 4px 12px rgba(0,0,0,0.1); overflow: hidden; border-inline-start: 4px solid var(--tab-btn-active-bg); transition: all 0.2s ease; position: relative; }
        .card-content { max-height: 0; overflow: hidden; transition: max-height 0.5s cubic-bezier(0.4, 0, 0.2, 1); padding: 0 1.2rem; }
        .card.expanded .card-content { max-height: 3000px; padding: 0.9rem 1.2rem 1rem; }
        .card-header { display: flex; align-items: center; justify-content: space-between; padding: 0.8rem 1.2rem; cursor: pointer; user-select: none; gap: 0.5rem; background: var(--card-header-bg); }
        .card-header .title { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 0.95rem; color: var(--title-color); min-width: 0; }
        .card-header .title i.fa-hands-praying { color: var(--title-color); font-size: 0.85rem; flex-shrink: 0; }
        .card-header > div:last-child { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
        .card-header .fa-chevron-down { font-size: 0.75rem; color: var(--source-color); transition: transform 0.3s ease; }
        .card.expanded .card-header .fa-chevron-down { transform: rotate(180deg); }
        .zekr-text { font-size: 1rem; line-height: 1.8; color: var(--text-color); margin-bottom: 0.8rem; font-weight: 500; }
        .card .zekr-text.quran-text { font-family: 'Amiri', serif; font-size: 1.15rem; line-height: 2; font-weight: 700; }
        .description, .source { color: var(--desc-color); font-size: 0.75rem; margin-bottom: 0.3rem; }
        .counter-controls { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin-top: 0.8rem; }
        .counter-buttons { display: flex; gap: 0.8rem; align-items: center; }
        .counter-btn { background: var(--counter-btn-bg); border: 1px solid var(--form-border); width: 36px; height: 36px; border-radius: 50%; font-size: 1.3rem; font-weight: bold; cursor: pointer; color: var(--counter-btn-color); transition: all 0.1s ease; }
        .counter-btn:active { transform: scale(0.95); }
        .counter-btn:disabled { opacity: 0.5; cursor: not-allowed; }
        .counter-value { font-size: 1.3rem; font-weight: 800; min-width: 50px; text-align: center; color: var(--text-color); }
        .target-count { font-size: 0.7rem; color: var(--source-color); }
        .action-buttons { display: flex; gap: 8px; flex-wrap: wrap; }
        .done-btn, .audio-btn, .copy-btn, .share-btn { background: var(--done-btn-bg); border: 1px solid var(--form-border); padding: 0.35rem 0.9rem; border-radius: 2rem; font-weight: 600; cursor: pointer; display: flex; align-items: center; gap: 6px; color: var(--text-color); font-size: 0.75rem; transition: all 0.2s ease; }
        .copy-btn:hover { background: var(--tab-btn-active-bg); color: white; transform: scale(1.02); }
        .done-btn.completed { background: var(--done-btn-completed-bg); color: white; border-color: transparent; }
        .toast-message { position: fixed; bottom: 100px; left: 50%; transform: translateX(-50%); background: var(--tab-btn-active-bg); color: white; padding: 0.5rem 1rem; border-radius: 2rem; font-size: 0.8rem; z-index: 2000; animation: fadeOut 2s ease forwards; }
        @keyframes fadeOut { 0% { opacity: 1; } 70% { opacity: 1; } 100% { opacity: 0; visibility: hidden; } }

        .modal { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.7); backdrop-filter: blur(4px); z-index: 2000; align-items: center; justify-content: center; }
        .modal-content { background: var(--modal-bg); max-width: 500px; width: 90%; border-radius: 1.5rem; padding: 1.5rem; text-align: center; border: 1px solid var(--card-border); box-shadow: 0 20px 40px rgba(0,0,0,0.3); }
        .beads-ring { position: relative; width: 250px; height: 250px; margin: 1rem auto; }
        .bead { position: absolute; width: 38px; height: 38px; background: var(--bead-bg); border-radius: 50%; cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 0.75rem; font-weight: bold; color: var(--bead-color); border: 1px solid var(--card-border); transition: all 0.15s ease; }
        .bead:hover { transform: scale(1.05); }
        .bead.active-bead { background: var(--active-bead-bg); transform: scale(1.1); box-shadow: 0 0 12px rgba(232,168,76,0.5); }
        .sebha-counter { font-size: 2.2rem; font-weight: 800; margin: 0.5rem 0; color: var(--title-color); }
        .modal-buttons { display: flex; gap: 1rem; justify-content: center; margin-top: 1rem; }
        .modal-buttons button { padding: 0.5rem 1.2rem; border-radius: 2rem; border: 1px solid var(--form-border); font-weight: bold; cursor: pointer; background: var(--counter-btn-bg); color: var(--text-color); transition: all 0.2s ease; }
        .modal-buttons button:hover { transform: scale(1.02); }
        footer { text-align: center; margin-top: 1.5rem; font-size: 0.7rem; color: var(--footer-color); }

        /* Management Modal */
        .manage-modal .modal-content { max-width: 700px; padding: 0; overflow: hidden; max-height: 85vh; display: flex; flex-direction: column; }
        .manage-header { display: flex; justify-content: space-between; align-items: center; padding: 1rem 1.5rem; background: var(--modal-header-bg); color: white; }
        .manage-header h3 { font-size: 1.1rem; font-weight: 800; margin: 0; }
        .manage-close-btn { background: rgba(255,255,255,0.2); border: none; width: 32px; height: 32px; border-radius: 50%; cursor: pointer; color: white; font-size: 1rem; transition: all 0.2s ease; }
        .manage-close-btn:hover { background: rgba(255,255,255,0.3); transform: scale(1.05); }
        .manage-body { overflow-y: auto; flex: 1; padding: 1.2rem; background: var(--modal-bg); }
        .categories-manager, .azkar-manager { background: var(--card-header-bg); border-radius: 1rem; padding: 1rem; margin-bottom: 1rem; border: 1px solid var(--card-border); }
        .manage-section-title { font-size: 0.85rem; font-weight: 800; color: var(--title-color); margin-bottom: 0.8rem; display: flex; align-items: center; gap: 6px; }
        .categories-list { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-bottom: 0.8rem; }
        .category-item { background: var(--card-bg); border-radius: 2rem; padding: 0.35rem 1rem; display: flex; align-items: center; gap: 8px; border: 1px solid var(--manage-item-border); font-size: 0.8rem; }
        .category-item span { font-weight: 600; color: var(--title-color); }
        .category-actions { display: flex; gap: 5px; }
        .category-actions button { background: none; border: none; cursor: pointer; font-size: 0.8rem; padding: 4px; border-radius: 50%; width: 28px; height: 28px; transition: all 0.2s ease; }
        .category-actions button:hover { background: var(--counter-btn-bg); transform: scale(1.05); }
        .edit-cat-btn { color: #2d6a4f; }

        /* ========== PDF MODAL ========== */
        .pdf-modal .modal-content { max-width: 640px; padding: 0; overflow: hidden; max-height: 88vh; display: flex; flex-direction: column; border-radius: 1.5rem; }
        .pdf-modal .manage-body { padding: 1.2rem; display: flex; flex-direction: column; gap: 1rem; }
        .pdf-section { background: var(--card-header-bg); border-radius: 1rem; padding: 1rem 1.1rem; border: 1px solid var(--card-border); }
        .pdf-section-title { font-size: 0.8rem; font-weight: 800; color: var(--title-color); margin-bottom: 0.75rem; display: flex; align-items: center; gap: 6px; }
        .pdf-row { display: flex; gap: 0.6rem; flex-wrap: wrap; }
        .pdf-chip { display: flex; align-items: center; gap: 6px; background: var(--card-bg); border: 1.5px solid var(--card-border); border-radius: 2rem; padding: 0.3rem 0.85rem; cursor: pointer; font-size: 0.78rem; font-weight: 600; color: var(--text-color); transition: all 0.18s ease; user-select: none; }
        .pdf-chip input[type=checkbox] { display: none; }
        .pdf-chip.selected { background: var(--tab-btn-active-bg); border-color: var(--tab-btn-active-bg); color: white; }
        .pdf-chip:not(.selected) { background: var(--card-bg); color: var(--text-color); opacity: 0.75; }
        .pdf-chip:hover { transform: scale(1.03); }
        .pdf-chip .sel-icon { display: none; }
        .pdf-chip .uns-icon { display: inline-block; }
        .pdf-chip.selected .sel-icon { display: inline-block; }
        .pdf-chip.selected .uns-icon { display: none; }
        .pdf-chip[data-size] { flex: 1; justify-content: center; }
        .pdf-chip[data-size="small"] { font-size: 0.72rem; }
        .pdf-chip[data-size="medium"] { font-size: 0.85rem; }
        .pdf-chip[data-size="large"] { font-size: 1rem; }
        .pdf-chip.theme-light:not(.selected) { background: #fff; color: #2d6a4f; border-color: #c8e0d0; }
        .pdf-chip.theme-warm:not(.selected) { background: #faf7f0; color: #5a4a3a; border-color: #e0d5c8; }
        .pdf-chip.theme-green:not(.selected) { background: #1b4d3a; color: #a8f0c6; border-color: #2d6a4f; }
        .pdf-chip.theme-minimal:not(.selected) { background: #f4f4f4; color: #333; border-color: #ccc; }
        .pdf-title-input { width: 100%; padding: 0.55rem 0.9rem; border-radius: 0.75rem; border: 1.5px solid var(--form-border); background: var(--input-bg); color: var(--input-color); font-family: 'Cairo', sans-serif; font-size: 0.9rem; outline: none; transition: border 0.2s ease; }
        .pdf-title-input:focus { border-color: var(--tab-btn-active-bg); }
        .pdf-cats-grid { display: flex; flex-wrap: wrap; gap: 0.5rem; }
        .pdf-cat-chip { display: flex; align-items: center; gap: 6px; background: var(--card-bg); border: 1.5px solid var(--card-border); border-radius: 2rem; padding: 0.28rem 0.75rem; cursor: pointer; font-size: 0.78rem; font-weight: 600; color: var(--text-color); transition: all 0.18s ease; }
        .pdf-cat-chip.selected { background: var(--tab-btn-active-bg); border-color: var(--tab-btn-active-bg); color: white; }
        .pdf-cat-chip:hover { transform: scale(1.03); }
        .pdf-select-all { font-size: 0.72rem; background: none; border: none; color: var(--title-color); font-weight: 700; cursor: pointer; padding: 0; text-decoration: underline; }
        .pdf-modal-footer { padding: 1rem 1.2rem; border-top: 1px solid var(--card-border); display: flex; gap: 0.7rem; justify-content: flex-end; background: var(--modal-bg); }
        .pdf-generate-btn { background: var(--tab-btn-active-bg); color: white; border: none; border-radius: 2rem; padding: 0.55rem 1.5rem; font-size: 0.9rem; font-weight: 800; font-family: 'Cairo', sans-serif; cursor: pointer; display: flex; align-items: center; gap: 8px; transition: all 0.2s ease; }
        .pdf-generate-btn:hover { background: var(--fab-hover); transform: scale(1.02); }
        .pdf-cancel-btn { background: var(--counter-btn-bg); color: var(--text-color); border: 1px solid var(--form-border); border-radius: 2rem; padding: 0.55rem 1.2rem; font-size: 0.85rem; font-weight: 700; font-family: 'Cairo', sans-serif; cursor: pointer; transition: all 0.2s ease; }
        .pdf-cancel-btn:hover { transform: scale(1.02); }
        .pdf-cancel-btn:hover { transform: scale(1.02); }
        .toggle-other-btn { color: #f5c542; }
        .add-category-form { display: flex; gap: 0.6rem; flex-wrap: wrap; margin-top: 0.8rem; }
        .add-category-form input, .add-category-form select { padding: 0.4rem 0.8rem; border: 1px solid var(--form-border); border-radius: 2rem; background: var(--input-bg); color: var(--input-color); font-size: 0.8rem; flex: 1; }
        .add-category-form button { background: var(--tab-btn-active-bg); color: white; border: none; padding: 0.4rem 1rem; border-radius: 2rem; cursor: pointer; transition: all 0.2s ease; }
        .add-category-form button:hover { transform: scale(1.02); }
        .manage-cat-tabs { display: flex; gap: 0.4rem; background: var(--manage-cat-tabs-bg); padding: 0.4rem; border-radius: 2rem; margin-bottom: 1rem; flex-wrap: wrap; }
        .manage-cat-btn { flex: 1; border: none; padding: 0.4rem 0.6rem; border-radius: 1.5rem; font-weight: 700; font-size: 0.75rem; cursor: pointer; background: transparent; color: var(--tab-btn-color); transition: all 0.2s ease; }
        .manage-cat-btn.active { background: var(--tab-btn-active-bg); color: white; }
        .azkar-manage-list { display: flex; flex-direction: column; gap: 0.5rem; margin-bottom: 1rem; max-height: 250px; overflow-y: auto; }
        .manage-item { background: var(--manage-item-bg); border: 1px solid var(--manage-item-border); border-radius: 0.8rem; padding: 0.5rem; transition: all 0.2s ease; }
        .manage-item:hover { border-color: var(--tab-btn-active-bg); }
        .manage-item-main { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
        .manage-item-info { flex: 1; }
        .manage-item-title { font-size: 0.8rem; font-weight: 700; color: var(--title-color); }
        .manage-item-meta { font-size: 0.7rem; color: var(--source-color); }
        .manage-item-actions { display: flex; gap: 6px; }
        .manage-edit-btn, .manage-delete-btn { background: var(--counter-btn-bg); border: 1px solid var(--form-border); width: 30px; height: 30px; border-radius: 50%; cursor: pointer; transition: all 0.2s ease; }
        .manage-edit-btn:hover, .manage-delete-btn:hover { transform: scale(1.05); background: var(--tab-btn-active-bg); color: white; }
        .add-zikr-form { background: var(--form-bg); border-radius: 1rem; padding: 1rem; border: 1px solid var(--form-border); }
        .form-field { margin-bottom: 0.8rem; }
        .form-field label { display: block; font-size: 0.7rem; font-weight: 700; color: var(--title-color); margin-bottom: 4px; }
        .form-field input, .form-field textarea, .form-field select { width: 100%; padding: 0.5rem; border: 1px solid var(--form-border); border-radius: 0.8rem; background: var(--input-bg); color: var(--input-color); font-size: 0.8rem; transition: all 0.2s ease; }
        .pwd-wrapper { position: relative; }
        .pwd-wrapper input { padding-inline-end: 2.2rem; }
        .pwd-toggle { position: absolute; top: 50%; transform: translateY(-50%); inset-inline-end: 0.6rem; cursor: pointer; color: var(--source-color); font-size: 0.85rem; padding: 0.3rem; display: flex; align-items: center; z-index: 2; }
        .pwd-toggle:hover { color: var(--accent-color); }
        .form-field input:focus, .form-field textarea:focus, .form-field select:focus { outline: none; border-color: var(--tab-btn-active-bg); }
        .form-field textarea { resize: vertical; min-height: 60px; }
        .form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; }
        .form-actions { display: flex; gap: 0.6rem; justify-content: flex-end; }
        .btn-add-zikr { background: var(--tab-btn-active-bg); color: white; border: none; padding: 0.4rem 1rem; border-radius: 2rem; cursor: pointer; font-size: 0.8rem; transition: all 0.2s ease; }
        .btn-add-zikr:hover { transform: scale(1.02); background: var(--fab-hover); }
        .btn-reset-defaults { background: transparent; color: var(--text-color); border: 1px solid var(--form-border); padding: 0.4rem 1rem; border-radius: 2rem; cursor: pointer; font-size: 0.75rem; transition: all 0.2s ease; }
        .btn-reset-defaults:hover { border-color: #c0392b; color: #c0392b; }

        /* Icon Picker */
        .icon-picker-wrap { margin-top: 0.8rem; }
        .icon-picker-label { font-size: 0.72rem; font-weight: 700; color: var(--title-color); margin-bottom: 6px; display: flex; align-items: center; gap: 8px; }
        .icon-picker-current { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; background: var(--tab-btn-active-bg); color: white; border-radius: 50%; font-size: 0.85rem; }
        .icon-picker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(36px, 1fr)); gap: 5px; background: var(--form-bg); border: 1px solid var(--form-border); border-radius: 0.8rem; padding: 0.6rem; max-height: 180px; overflow-y: auto; }
        .icon-option { width: 36px; height: 36px; border: 1px solid transparent; border-radius: 0.5rem; display: flex; align-items: center; justify-content: center; cursor: pointer; font-size: 1rem; color: var(--text-color); transition: all 0.15s ease; background: var(--input-bg); }
        .icon-option:hover { background: var(--counter-btn-bg); border-color: var(--form-border); transform: scale(1.08); }
        .icon-option.selected { background: var(--tab-btn-active-bg); color: white; border-color: var(--tab-btn-active-bg); box-shadow: 0 2px 8px rgba(45,106,79,0.35); transform: scale(1.08); }
        .edit-modal .modal-content { max-width: 550px; padding: 1.2rem; max-height: 85vh; overflow-y: auto; }
        .edit-form-buttons { display: flex; gap: 1rem; justify-content: center; margin-top: 1rem; }
        .save-edit-btn { background: var(--tab-btn-active-bg); color: white; border: none; padding: 0.5rem 1.5rem; border-radius: 2rem; cursor: pointer; transition: all 0.2s ease; }
        .save-edit-btn:hover { transform: scale(1.02); }
        .cancel-edit-btn { background: var(--counter-btn-bg); color: var(--text-color); border: 1px solid var(--form-border); padding: 0.5rem 1.5rem; border-radius: 2rem; cursor: pointer; transition: all 0.2s ease; }
        @media (max-width: 550px) { .form-row-2 { grid-template-columns: 1fr; } .top-bar { justify-content: center; } }

        /* Edit Category Modal */
        .edit-cat-modal .modal-content { max-width: 480px; padding: 1.4rem; }
        .edit-cat-modal h3 { font-size: 1rem; font-weight: 800; color: var(--title-color); margin-bottom: 1rem; display: flex; align-items: center; gap: 8px; }
        .edit-cat-icon-picker { margin-top: 0.8rem; }
        .edit-cat-icon-label { font-size: 0.72rem; font-weight: 700; color: var(--title-color); margin-bottom: 6px; display: flex; align-items: center; gap: 8px; }
        .edit-cat-icon-current { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; background: var(--tab-btn-active-bg); color: white; border-radius: 50%; font-size: 0.85rem; }
        /* Edit Category Modal icon grid reuses .icon-picker-grid / .icon-option */
        .edit-cat-modal .modal-content { max-width: 480px; padding: 1.4rem; }
        .edit-cat-modal h3 { font-size: 1rem; font-weight: 800; color: var(--title-color); margin-bottom: 1rem; display: flex; align-items: center; gap: 8px; }

        .login-modal {
    max-width: 380px;
    text-align: center;
}

.auth-tabs {
    display: flex;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 1.2rem;
}

.auth-tab {
    flex: 1;
    padding: 0.6rem 0;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-color);
    cursor: pointer;
    opacity: 0.5;
    transition: opacity 0.2s;
    user-select: none;
}

.auth-tab.active {
    opacity: 1;
    border-bottom: 2px solid var(--highlight-color);
    margin-bottom: -2px;
    color: var(--highlight-color);
}

.auth-form .form-field input {
    text-align: center;
    font-size: 0.85rem;
}

#loginMsg, #regMsg {
    color: var(--source-color);
}

.login-error {
    color: #e74c3c !important;
}

.login-success {
    color: var(--highlight-color) !important;
}

.user-menu {
    position: absolute;
    top: calc(100% + 6px);
    inset-inline-start: 0;
    z-index: 2100;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    box-shadow: 0 6px 24px rgba(0,0,0,0.15);
    min-width: 200px;
    overflow: hidden;
    animation: fadeIn 0.15s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.user-menu-header {
    padding: 0.75rem 1rem;
    font-size: 0.78rem;
    font-weight: 700;
    background: var(--tab-btn-active-bg);
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-menu-item {
    padding: 0.6rem 1rem;
    font-size: 0.78rem;
    color: var(--text-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: background 0.15s;
}

.user-menu-item:hover {
    background: var(--tab-btn-hover-bg);
}

.user-menu-item i {
    width: 1rem;
    text-align: center;
    font-size: 0.82rem;
}

.user-menu-logout {
    color: #e74c3c;
}

.user-menu-logout:hover {
    background: #fde8e8 !important;
}

.user-menu-divider {
    height: 1px;
    background: var(--border-color);
    margin: 0.2rem 0;
}

.streak-fire-particle {
    position: fixed;
    border-radius: 50%;
    pointer-events: none;
    z-index: 9999;
    animation: streakFireBurst var(--s, 0.8s) ease-out forwards;
}

@keyframes streakFireBurst {
    0%   { opacity: 1; transform: translate(0, 0) scale(1); }
    100% { opacity: 0; transform: translate(var(--dx), var(--dy)) scale(0.2); }
}

.streak-best-particle {
    position: fixed;
    border-radius: 50%;
    pointer-events: none;
    z-index: 9999;
    animation: streakBestBurst var(--s, 1s) ease-out forwards;
}

@keyframes streakBestBurst {
    0%   { opacity: 1; transform: translate(0, 0) scale(1); }
    60%  { opacity: 1; transform: translate(var(--dx), var(--dy)) scale(1.2); }
    100% { opacity: 0; transform: translate(calc(var(--dx) * 1.4), calc(var(--dy) * 1.4)) scale(0.1); }
}

/* ===== Daily Zikr Card ===== */
.daily-zikr-card {
    border-radius: 18px;
    overflow: hidden;
    border: 1px solid var(--card-border);
    background: var(--card-bg);
    transition: all 0.2s ease;
    margin-bottom: 12px;
}
.daily-zikr-card { border-left: 4px solid #f59e0b; }
.daily-zikr-card.completed { border-left-color: var(--title-color); }
.daily-zikr-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 14px 16px 0;
}
.daily-zikr-header i {
    font-size: 0.85rem;
    color: var(--title-color);
}
.daily-zikr-label {
    font-size: 0.75rem;
    font-weight: 800;
    color: var(--title-color);
    flex: 1;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}
.daily-zikr-check { color: var(--title-color); font-size: 0.9rem; }
.daily-zikr-reset { cursor: pointer; font-size: 0.65rem; color: var(--source-color); opacity: 0.5; transition: opacity 0.15s; }
.daily-zikr-reset:hover { opacity: 1; color: var(--text-color); }
.daily-zikr-autoplay-btn { cursor: pointer; font-size: 0.7rem; color: var(--title-color); opacity: 0.6; transition: opacity 0.15s; margin-right: 4px; }
.daily-zikr-autoplay-btn:hover { opacity: 1; }
.daily-zikr-autoplay-btn.fa-pause { opacity: 1; }
.daily-zikr-body { padding: 10px 16px 0; }
.daily-zikr-text {
    font-size: 0.9rem;
    color: var(--text-color);
    line-height: 1.55;
}
.daily-zikr-completed .daily-zikr-text { opacity: 0.55; }
.daily-zikr-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 6px;
}
.daily-zikr-meta-title {
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--source-color);
}
.daily-zikr-meta-target {
    font-size: 0.68rem;
    color: var(--source-color);
}
.daily-zikr-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px 14px;
    gap: 10px;
}
.daily-zikr-counter {
    display: flex;
    align-items: center;
    gap: 10px;
}
.daily-zikr-counter-btn {
    width: 34px; height: 34px;
    border-radius: 50%;
    border: 1px solid var(--card-border);
    background: var(--counter-btn-bg);
    color: var(--counter-btn-color);
    font-size: 1.15rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.12s;
    line-height: 1;
    user-select: none;
}
.daily-zikr-counter-btn:active { transform: scale(0.9); }
.daily-zikr-counter-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.daily-zikr-count {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--text-color);
    min-width: 30px;
    text-align: center;
}
.daily-zikr-done-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 7px 16px;
    border-radius: 20px;
    border: none;
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s;
}
.daily-zikr-done-btn:active { transform: scale(0.96); }
.daily-zikr-done-btn.active {
    background: var(--counter-btn-bg);
    color: var(--title-color);
}
.daily-zikr-done-btn:not(.active) {
    background: var(--title-color);
    color: #fff;
}

/* ===== Daily Plan List ===== */
.daily-plan-section {
    padding: 0 16px 14px;
    border-top: 1px solid var(--card-border);
    margin-top: 2px;
}
.daily-cat-chips { display: flex; gap: 6px; flex-wrap: wrap; margin: 4px 0 8px; }
.daily-cat-chip { display: inline-block; padding: 3px 12px; border-radius: 14px; font-size: 0.68rem; font-weight: 700; cursor: pointer; border: 1px solid var(--card-border); color: var(--source-color); background: var(--counter-btn-bg); transition: all 0.15s; }
.daily-cat-chip.active { background: var(--tab-btn-active-bg); color: #fff; border-color: var(--tab-btn-active-bg); }
.daily-cat-chip:hover { transform: scale(1.03); }
.daily-plan-label {
    font-size: 0.62rem;
    font-weight: 700;
    color: var(--source-color);
    padding-top: 10px;
    margin-bottom: 8px;
    letter-spacing: 0.4px;
    text-transform: uppercase;
}
.daily-plan-items {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.daily-plan-item {
    display: flex;
    flex-direction: column;
    padding: 8px 12px;
    border-radius: 12px;
    border: 1.5px solid var(--card-border);
    background: var(--card-header-bg);
    min-width: 90px;
    flex: 1;
    cursor: pointer;
    transition: all 0.18s ease;
    position: relative;
}
.daily-plan-item:hover {
    border-color: var(--title-color);
    background: var(--card-bg);
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(0,0,0,0.08);
}
.daily-plan-item:active {
    transform: translateY(0);
    box-shadow: none;
}
.daily-plan-item.active {
    border-color: var(--title-color);
    background: var(--card-bg);
    box-shadow: 0 0 0 2px var(--title-color);
}
.daily-plan-item.completed {
    border-color: var(--title-color);
    opacity: 0.65;
}
.daily-plan-item.completed:hover {
    opacity: 0.85;
}
.daily-plan-item-row {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 4px;
}
.daily-plan-item-row i {
    font-size: 0.55rem;
    color: var(--source-color);
    flex-shrink: 0;
}
.daily-plan-item-row i.filled { color: var(--title-color); }
.daily-plan-item-title {
    font-size: 0.6rem;
    font-weight: 600;
    color: var(--text-color);
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.daily-plan-item-check { font-size: 0.55rem; color: var(--title-color); flex-shrink: 0; }
.daily-plan-browse {
    font-size: 0.55rem !important;
    color: var(--source-color) !important;
    cursor: pointer !important;
    margin-left: 2px;
    padding: 3px;
    border-radius: 50%;
    transition: all 0.15s;
    flex-shrink: 0;
}
.daily-plan-browse:hover {
    color: var(--title-color) !important;
    background: var(--counter-btn-bg);
}
.daily-plan-bar {
    width: 100%; height: 4px;
    background: var(--card-border);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 3px;
}
.daily-plan-fill {
    height: 4px;
    border-radius: 3px;
    transition: width 0.3s ease;
    background: var(--title-color);
}
.daily-plan-item-text {
    font-size: 0.5rem;
    color: var(--source-color);
    font-weight: 500;
}

/* ===== Empty Daily Zikr ===== */
.daily-zikr-empty {
    border-radius: 18px;
    border: 1px dashed var(--card-border);
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--card-header-bg);
    margin-bottom: 12px;
}
.daily-zikr-empty i { color: var(--title-color); font-size: 0.9rem; }
.daily-zikr-empty span {
    font-size: 0.75rem;
    color: var(--source-color);
    font-weight: 500;
}

#favoritesBox { margin-bottom: 10px; }
.favorites-section { margin-bottom: 12px; }
.favorites-section .card { margin-bottom: 10px; }
.favorites-section-header { display: flex; align-items: center; gap: 6px; margin-bottom: 10px; }
.fav-autoplay-btn { margin-left: auto; background: var(--counter-btn-bg); border: 1px solid var(--card-border); width: 30px; height: 30px; border-radius: 50%; cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 0.75rem; color: var(--text-color); transition: all 0.15s; }
.fav-autoplay-btn.active { background: var(--tab-btn-active-bg); color: #fff; border-color: var(--tab-btn-active-bg); }
.fav-autoplay-btn:hover { transform: scale(1.05); }
.favorites-section-header i { color: var(--highlight-color); font-size: 0.85rem; }
.favorites-section-title { font-size: 0.82rem; font-weight: 800; color: var(--title-color); }
.favorites-section-count { font-size: 0.7rem; color: var(--source-color); font-weight: 600; }


.share-modal { max-width: 340px !important; }
.share-grid { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
.share-item {
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    width: 80px; cursor: pointer; padding: 8px 4px; border-radius: 12px;
    transition: background 0.15s;
    color: var(--text-color);
}
.share-item:hover { background: var(--tab-btn-hover-bg); }
.share-icon {
    width: 48px; height: 48px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 1.3rem;
}

/* ==================== SETTINGS VIEW ==================== */
.page-view { padding: 0 12px; }
.settings-scroll { padding-bottom: 20px; }
.settings-content { margin: 0 auto; }
.progress-title { font-size: 1.1rem; font-weight: 800; color: var(--title-color); margin: 14px 0 16px; display: flex; align-items: center; gap: 8px; }
.settings-section { background: var(--card-bg); border: 1px solid var(--card-border); border-radius: 16px; padding: 16px; margin-bottom: 14px; }
.settings-section-header { display: flex; align-items: center; gap: 8px; font-size: 0.85rem; font-weight: 700; color: var(--title-color); margin-bottom: 12px; }
.settings-section-header i { color: var(--accent); font-size: 0.85rem; }
.settings-btn { display: flex; align-items: center; justify-content: center; gap: 6px; width: 100%; background: var(--tab-btn-active-bg); color: #fff; border: none; border-radius: 10px; padding: 10px; font-size: 0.8rem; font-weight: 700; cursor: pointer; margin-top: 8px; transition: transform 0.1s; }
.settings-btn:hover { transform: scale(1.02); }
.settings-btn:active { transform: scale(0.98); }
.settings-btn-outline { background: transparent; border: 1px solid var(--card-border); color: var(--text-color); }
.settings-btn-danger { background: #e74c3c; color: #fff; border: none; }
.settings-btn-danger:hover { background: #c0392b; }
.settings-btn-danger { background: #1a0808; border: 1px solid #2a1010; color: #e74c3c; }
.settings-input { width: 100%; box-sizing: border-box; background: var(--surface-alt); border: 1px solid var(--card-border); border-radius: 10px; padding: 10px; font-size: 0.8rem; color: var(--text-color); margin-bottom: 8px; outline: none; }
.settings-input:focus { border-color: var(--accent); }
.settings-row { display: flex; align-items: center; justify-content: space-between; padding: 8px 0; }
.settings-row-info { display: flex; align-items: center; gap: 8px; font-size: 0.82rem; color: var(--text-color); }
.settings-row-info i { color: var(--source-color); font-size: 0.8rem; }
.settings-switch { position: relative; display: inline-block; width: 40px; height: 22px; }
.settings-switch input { opacity: 0; width: 0; height: 0; }
.settings-switch .slider { position: absolute; cursor: pointer; inset: 0; background: #c0c8c0; border-radius: 22px; transition: 0.3s; }
.settings-switch .slider::before { content: ''; position: absolute; height: 16px; width: 16px; left: 3px; bottom: 3px; background: #fff; border-radius: 50%; transition: 0.3s; }
.settings-switch input:checked + .slider { background: var(--tab-btn-active-bg); }
.settings-switch input:checked + .slider::before { transform: translateX(18px); }
[dir="ltr"] .settings-switch .slider::before { left: 3px; right: auto; }
[dir="ltr"] .settings-switch input:checked + .slider::before { transform: translateX(18px); }
.settings-size-opts { display: flex; gap: 6px; }
.settings-size-chip { padding: 5px 12px; border-radius: 14px; font-size: 0.72rem; font-weight: 700; cursor: pointer; background: var(--surface-alt); color: var(--source-color); border: 1px solid var(--card-border); transition: all 0.15s; }
.settings-size-chip.active { background: var(--tab-btn-active-bg); color: #fff; border-color: var(--tab-btn-active-bg); }
.settings-size-chip:hover { transform: scale(1.03); }
.settings-theme-opts { display: flex; flex-wrap: wrap; gap: 6px; }
.settings-theme-chip { display: flex; align-items: center; gap: 5px; padding: 5px 10px; border-radius: 14px; font-size: 0.7rem; font-weight: 700; cursor: pointer; background: var(--surface-alt); color: var(--source-color); border: 1px solid var(--card-border); transition: all 0.15s; }
.settings-theme-chip.active { background: var(--tab-btn-active-bg); color: #fff; border-color: var(--tab-btn-active-bg); }
.settings-theme-chip:hover { transform: scale(1.03); }
.theme-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; }
.settings-lang-btn { padding: 5px 14px; border-radius: 14px; font-size: 0.72rem; font-weight: 700; cursor: pointer; background: transparent; color: var(--accent); border: 1px solid var(--card-border); }

/* ==================== PROGRESS VIEW ==================== */
.progress-streak-box { display: flex; gap: 10px; margin-bottom: 14px; }
.progress-streak-card { flex: 1; display: flex; align-items: center; gap: 10px; background: var(--surface-alt); border-radius: 16px; padding: 12px 16px; }
.progress-streak-card-bordered { border: 1px solid var(--card-border); background: transparent; }
.progress-streak-card i { font-size: 1.2rem; }
.progress-streak-card .fa-fire { color: #ff6b00; }
.progress-streak-card .fa-trophy { color: #ffd700; }
.progress-streak-num { font-size: 1.3rem; font-weight: 800; color: var(--title-color); line-height: 1.2; }
.progress-streak-label { font-size: 0.6rem; color: var(--source-color); }
.progress-last-active { font-size: 0.65rem; color: var(--source-color); text-align: center; margin-bottom: 14px; }
.progress-section { border: 1px solid var(--card-border); border-radius: 16px; padding: 16px; margin-bottom: 14px; }
.progress-section-title { font-size: 0.82rem; font-weight: 700; color: var(--title-color); margin-bottom: 12px; }
.progress-stats-row { display: flex; gap: 12px; }
.progress-stat { flex: 1; display: flex; align-items: center; gap: 10px; }
.progress-stat-icon { width: 36px; height: 36px; border-radius: 10px; background: var(--surface-alt); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.progress-stat-icon .fa-check-double { color: #4caf50; font-size: 0.9rem; }
.progress-stat-icon .fa-pray { color: #7c4dff; font-size: 0.9rem; }
.progress-stat-num { font-size: 1.05rem; font-weight: 800; color: var(--title-color); line-height: 1.2; }
.progress-stat-label { font-size: 0.6rem; color: var(--source-color); }
.progress-hint { font-size: 0.7rem; color: var(--source-color); text-align: center; padding: 10px; margin-bottom: 14px; background: var(--surface-alt); border-radius: 12px; }
.progress-cal-header { display: flex; justify-content: space-around; margin-bottom: 6px; color: var(--source-color); }
.progress-cal-row { display: flex; justify-content: space-around; }
.progress-cal-cell { width: 28px; height: 28px; border-radius: 6px; display: flex; align-items: center; justify-content: center; font-size: 0.55rem; font-weight: 700; }
.progress-cat-row { margin-bottom: 12px; }
.progress-cat-header { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.progress-cat-header i { font-size: 0.65rem; color: var(--source-color); width: 14px; text-align: center; }
.progress-cat-header span:first-of-type { font-size: 0.72rem; font-weight: 600; color: var(--title-color); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.progress-cat-header span:last-child { font-size: 0.65rem; color: var(--source-color); font-weight: 700; }
.progress-cat-bar { width: 100%; height: 6px; background: var(--card-border); border-radius: 3px; overflow: hidden; }
.progress-cat-fill { height: 6px; border-radius: 3px; transition: width 0.3s; }
.progress-no-data { font-size: 0.75rem; color: var(--source-color); text-align: center; }

/* === Hadith View === */
.hadith-header { display: flex; align-items: center; gap: 10px; font-size: 1.1rem; font-weight: 800; color: var(--title-color); padding: 12px 0 16px 0; }
.hadith-header i { font-size: 1.2rem; }
.hadith-collection-list { display: flex; flex-direction: column; gap: 6px; }
.hadith-collection-item { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 14px; background: var(--card-bg); border: 1px solid var(--card-border); cursor: pointer; transition: all 0.12s; }
.hadith-collection-item:hover { border-color: var(--accent); }
.hadith-collection-item:active { background: var(--surface-alt); }
.hadith-collection-icon { width: 36px; height: 36px; border-radius: 10px; background: var(--surface-alt); display: flex; align-items: center; justify-content: center; color: var(--accent); font-size: 0.9rem; flex-shrink: 0; }
.hadith-collection-info { flex: 1; min-width: 0; }
.hadith-collection-name { font-size: 0.8rem; font-weight: 700; color: var(--text-color); }
.hadith-collection-error { text-align: center; padding: 30px 16px; color: var(--source-color); font-size: 0.82rem; }
.hadith-collection-count { font-size: 0.6rem; color: var(--source-color); font-weight: 600; white-space: nowrap; background: var(--surface-alt); padding: 2px 8px; border-radius: 8px; }
.hadith-collection-arrow { font-size: 0.7rem; color: var(--source-color); }
.hadith-browse-header { display: flex; align-items: center; gap: 10px; font-size: 1rem; font-weight: 700; color: var(--title-color); padding: 12px 0; }
.hadith-back-btn { background: none; border: none; color: var(--accent); font-size: 0.78rem; font-weight: 600; cursor: pointer; display: flex; align-items: center; gap: 4px; padding: 4px 8px; border-radius: 8px; transition: background 0.12s; }
.hadith-back-btn:hover { background: var(--surface-alt); }
.hadith-search-container { position: relative; margin-bottom: 10px; }
.hadith-search-container .search-input { width: 100%; padding: 10px 36px 10px 12px; border-radius: 12px; border: 1px solid var(--search-border); background: var(--search-bg); color: var(--input-color); font-size: 0.82rem; outline: none; }
.hadith-search-container .search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--source-color); font-size: 0.78rem; }
.hadith-search-container .clear-search { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); background: none; border: none; color: var(--source-color); cursor: pointer; font-size: 0.9rem; padding: 4px; }
.hadith-loading { text-align: center; padding: 20px; color: var(--source-color); font-size: 0.8rem; }
.hadith-error { text-align: center; padding: 16px; color: #e74c3c; font-size: 0.78rem; font-weight: 600; background: rgba(231,76,60,0.08); border-radius: 12px; margin-bottom: 12px; }
.hadith-results { display: flex; flex-direction: column; gap: 10px; }
.hadith-card { background: var(--card-bg); border: 1px solid var(--card-border); border-radius: 14px; padding: 14px; }
.hadith-card-header { display: flex; align-items: baseline; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.hadith-card-collection { font-size: 0.62rem; font-weight: 700; color: #fff; background: var(--accent); padding: 2px 8px; border-radius: 8px; }
.hadith-card-number { font-size: 0.6rem; color: var(--source-color); font-weight: 600; }
.hadith-card-text { font-size: 0.82rem; color: var(--text-color); line-height: 1.6; margin-bottom: 6px; }
.hadith-card-highlight { border-color: var(--accent) !important; box-shadow: 0 0 0 2px var(--accent); }
.hadith-card-elaboration { font-size: 0.72rem; color: var(--desc-color); line-height: 1.5; padding-top: 6px; border-top: 1px solid var(--card-border); margin-top: 6px; }
.expl-toggle-btn { display:inline-flex;align-items:center;gap:4px;background:var(--surface-alt);border:1px solid var(--card-border);border-radius:12px;padding:3px 10px;font-size:0.68rem;font-weight:700;color:var(--accent);cursor:pointer; }
.hadith-hint { text-align: center; padding: 30px 16px; color: var(--source-color); font-size: 0.82rem; }
.hadith-hint i { font-size: 1.2rem; display: block; margin-bottom: 8px; }
.hadith-status { text-align: center; font-size: 0.65rem; color: var(--source-color); padding: 8px 0; }
[dir="ltr"] .hadith-header { flex-direction: row; }
[dir="ltr"] .hadith-search-container .search-icon { left: auto; right: 12px; }
[dir="ltr"] .hadith-search-container .clear-search { right: auto; left: 8px; }
[dir="ltr"] .hadith-search-container .search-input { padding: 10px 12px 10px 36px; }
[dir="ltr"] .hadith-back-btn i { transform: scaleX(-1); }
.hadith-source-link { color: var(--accent); text-decoration: underline; cursor: pointer; }
.hadith-source-link:hover { opacity: 0.8; }

/* === Quran View === */
/* Quran toolbar */
.quran-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 16px;
  margin-bottom: 12px;
  position: sticky;
  top: calc(1rem + 44px + 6px);
  z-index: 50;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 1.5rem;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  width: calc(100% - 24px);
  margin-left: auto;
  margin-right: auto;
}

.quran-tb-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.82rem;
  transition: all 0.15s;
  flex-shrink: 0;
  position: relative;
}
.quran-tb-btn:hover { background: var(--surface-alt); color: var(--title-color); }

.quran-toolbar-nav {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: 1;
  justify-content: center;
}

.quran-nav-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--card-border);
  background: var(--surface-alt);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.8rem;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.quran-nav-btn:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  transform: scale(1.05);
}

.quran-nav-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 140px;
  cursor: pointer;
  text-align: center;
}

.quran-nav-surah {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--title-color);
  font-family: 'Amiri', serif;
  line-height: 1.2;
}

.quran-nav-meta {
  font-size: 0.65rem;
  color: var(--source-color);
  font-weight: 600;
  opacity: 0.8;
}

/* Quran sidebar */
.quran-sidebar {
  position: fixed;
  top: 0;
  right: -280px;
  width: 260px;
  max-width: 85vw;
  height: 100vh;
  border: none;
  border-left: 1px solid var(--card-border);
  display: flex;
  flex-direction: column;
  padding: 12px 10px 16px;
  background: var(--card-bg);
  box-shadow: -4px 0 24px rgba(0,0,0,0.12);
  z-index: 500;
  transition: right 0.25s ease;
}
.quran-sidebar.open { right: 0; }
.quran-sidebar-header { display: flex; align-items: center; gap: 6px; padding: 4px 0 10px; font-size: 0.9rem; font-weight: 800; color: var(--title-color); }
.quran-sidebar-header i:first-child { font-size: 0.9rem; color: var(--title-color); }
.quran-sb-close {
  margin-inline-start: auto;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
}
.quran-sb-close:hover { background: var(--surface-alt); }

/* Quran Layout */
.quran-layout { display: flex; gap: 0; position: relative; }
/* Sidebar tabs */
.quran-sidebar-tabs { display: flex; gap: 3px; padding: 0 0 8px; }
.quran-sb-tab { flex: 1; display: flex; align-items: center; justify-content: center; gap: 3px; padding: 6px 2px; border: 1px solid var(--card-border); border-radius: 8px; background: var(--card-bg); color: var(--text-muted); font-size: 0.62rem; font-weight: 700; cursor: pointer; transition: all 0.1s; position: relative; }
.quran-sb-tab i { font-size: 0.6rem; }
.quran-sb-tab.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.quran-sb-tab:hover:not(.active) { border-color: var(--accent); color: var(--text-color); }
.quran-sb-label { font-size: 0.6rem; }
.quran-sb-badge { position: absolute; top: 2px; inset-inline-end: 2px; width: 7px; height: 7px; border-radius: 50%; background: var(--favorite-color); border: 1px solid var(--card-bg); }
/* Sidebar panes */
.quran-sb-content { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.quran-sb-pane { display: none; flex-direction: column; flex: 1; overflow: hidden; }
.quran-sb-pane.active { display: flex; }
/* Bookmarks list in sidebar */
.quran-sb-pane[data-pane="bookmarks"] .quran-bookmarks-list { flex: 1; overflow-y: auto; }
.quran-sb-pane[data-pane="bookmarks"] .quran-bookmarks-empty { padding: 20px 8px; text-align: center; font-size: 0.7rem; color: var(--source-color); }
/* Khatma pane */
.quran-sb-pane[data-pane="khatma"] { padding: 4px 0; gap: 4px; }
.quran-sb-pane[data-pane="khatma"] .quran-khatma-header { font-size: 0.8rem; padding: 4px 0; }
.quran-sb-pane[data-pane="khatma"] .quran-khatma-stats { display: flex; flex-wrap: wrap; gap: 2px 8px; font-size: 0.6rem; opacity: 0.7; justify-content: center; }
.quran-reciter-select { display: flex; align-items: center; gap: 6px; padding: 4px 0 4px 0; }
.quran-reciter-select i { font-size: 0.75rem; color: var(--accent-color); }
.quran-reciter-select select { flex:1; padding: 5px 8px; border-radius: 8px; border: 1px solid var(--form-border); background: var(--form-bg); color: var(--text-color); font-size: 0.72rem; font-weight: 600; cursor: pointer; outline: none; }
.quran-reciter-select select:focus { border-color: var(--accent-color); }
.quran-search-box { padding: 0 0 8px 0; }
.quran-search-box .search-input { width: 100%; padding: 7px 10px; border-radius: 10px; border: 1px solid var(--search-border); background: var(--search-bg); color: var(--input-color); font-size: 0.74rem; outline: none; }
.quran-surah-list, .quran-juz-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 3px; padding-bottom: 12px; }
.quran-surah-item { display: flex; align-items: center; gap: 6px; padding: 6px 8px; border-radius: 8px; background: var(--card-bg); border: 1px solid var(--card-border); cursor: pointer; transition: all 0.1s; }
.quran-surah-item:hover { border-color: var(--accent); }
.quran-surah-item.active { border-color: var(--accent); background: var(--surface-alt); }
.quran-surah-num { width: 24px; height: 24px; border-radius: 50%; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 0.55rem; font-weight: 800; flex-shrink: 0; }
.quran-surah-name { flex: 1; font-weight: 700; color: var(--text-color); font-size: 0.74rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.quran-surah-roman { font-size: 0.55rem; color: var(--source-color); white-space: nowrap; }
.quran-surah-count { font-size: 0.55rem; color: var(--source-color); font-weight: 600; white-space: nowrap; }
.quran-surah-juz-badge { font-size: 0.5rem; font-weight: 700; color: var(--accent); background: var(--surface-alt); padding: 1px 5px; border-radius: 4px; white-space: nowrap; }
.quran-surah-play-btn { width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--card-border); background: transparent; color: var(--accent); display: flex; align-items: center; justify-content: center; cursor: pointer; font-size: 0.48rem; flex-shrink: 0; padding: 0; transition: all 0.1s; }
.quran-surah-play-btn:hover { background: var(--accent); color: #fff; border-color: var(--accent); }
.quran-surah-play-all { width: 28px; height: 28px; border-radius: 50%; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 0.65rem; flex-shrink: 0; }
.quran-full-play { cursor: pointer; }
/* Khatma (complete reading) tracker */
.quran-khatma { border-top: 1px solid var(--card-border); padding: 8px 4px 4px; flex-shrink: 0; }
.quran-khatma-header { display: flex; align-items: center; gap: 5px; font-size: 0.65rem; font-weight: 700; color: var(--title-color); margin-bottom: 4px; }
.quran-khatma-header i { font-size: 0.6rem; color: var(--accent); }
.quran-khatma-bar { height: 4px; border-radius: 2px; background: var(--card-border); overflow: hidden; }
.quran-khatma-fill { height: 100%; width: 0%; background: var(--accent); border-radius: 2px; transition: width 0.3s; }
.quran-khatma-text { display: flex; justify-content: space-between; font-size: 0.5rem; color: var(--source-color); margin-top: 2px; }
.quran-khatma-stats { display: flex; justify-content: space-between; margin-top: 2px; }
.quran-khatma-reset { background: none; border: none; color: var(--source-color); cursor: pointer; font-size: 0.6rem; padding: 2px 4px; margin-top: 2px; opacity: 0.5; transition: opacity 0.2s; }
.quran-khatma-reset:hover { opacity: 1; color: var(--accent-color); }
.quran-khatma-actions { display: flex; gap: 4px; margin-top: 2px; }
.quran-khatma-setup-btn { background: var(--hover-bg); border: 1px solid var(--card-border); color: var(--title-color); cursor: pointer; font-size: 0.6rem; padding: 3px 8px; border-radius: 8px; margin-top: 2px; opacity: 0.8; transition: 0.2s; font-weight: 600; }
.quran-khatma-setup-btn:hover { opacity: 1; color: var(--accent); border-color: var(--accent); }
.khatma-plan-bar { margin-top: 4px; padding: 4px 6px; background: var(--card-bg); border-radius: 4px; font-size: 0.5rem; }
.khatma-plan-bar-header { display: flex; justify-content: space-between; font-weight: 700; color: var(--title-color); margin-bottom: 2px; }
.khatma-plan-bar-track { height: 3px; border-radius: 2px; background: var(--card-border); overflow: hidden; }
.khatma-plan-bar-fill { height: 3px; border-radius: 2px; transition: width 0.3s; }
.khatma-plan-bar-footer { display: flex; justify-content: space-between; color: var(--source-color); margin-top: 1px; font-size: 0.45rem; }

/* Khatma Setup Modal */
.khatma-setup-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.5); z-index: 1000; display: flex; align-items: center; justify-content: center; }
.khatma-setup-modal { background: var(--card-bg); border: 1px solid var(--card-border); border-radius: 12px; width: 340px; max-width: 90vw; max-height: 80vh; overflow-y: auto; box-shadow: 0 8px 40px rgba(0,0,0,0.2); }
.khatma-setup-header { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--card-border); font-weight: 700; font-size: 0.85rem; color: var(--title-color); }
.khatma-setup-header i { color: var(--accent); }
.khatma-setup-close { margin-left: auto; background: none; border: none; color: var(--source-color); cursor: pointer; font-size: 1rem; padding: 2px 6px; border-radius: 4px; }
.khatma-setup-close:hover { background: var(--hover-bg); }
.khatma-setup-body { padding: 16px; }
.khatma-setup-toggle { margin-bottom: 12px; }
.khatma-toggle-label { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 0.8rem; color: var(--text-color); user-select: none; }
.khatma-toggle-label input[type="checkbox"] { display: none; }
.khatma-toggle-slider { width: 36px; height: 20px; background: var(--card-border); border-radius: 10px; position: relative; transition: 0.2s; flex-shrink: 0; }
.khatma-toggle-slider::after { content: ''; position: absolute; width: 16px; height: 16px; border-radius: 50%; background: #fff; top: 2px; left: 2px; transition: 0.2s; }
.khatma-toggle-label input:checked + .khatma-toggle-slider { background: var(--accent); }
.khatma-toggle-label input:checked + .khatma-toggle-slider::after { transform: translateX(16px); }
.khatma-field { margin-bottom: 10px; }
.khatma-field label { display: block; font-size: 0.72rem; font-weight: 600; color: var(--title-color); margin-bottom: 4px; }
.khatma-field input[type="date"] { width: 100%; padding: 8px 10px; font-size: 0.8rem; border: 1px solid var(--form-border); border-radius: 6px; background: var(--form-bg); color: var(--text-color); }
.khatma-plan-preview { padding: 10px; background: var(--form-bg); border: 1px solid var(--card-border); border-radius: 8px; }
.khatma-plan-title { font-weight: 700; font-size: 0.75rem; color: var(--title-color); margin-bottom: 8px; }
.khatma-plan-row { display: flex; justify-content: space-between; font-size: 0.7rem; color: var(--text-color); padding: 2px 0; }
.khatma-plan-row.highlight { font-weight: 700; color: var(--accent); }
.khatma-plan-row.ahead { color: #2e7d32; }
.khatma-plan-row.behind { color: #e74c3c; }
.khatma-plan-val { font-weight: 700; }

/* Progress page khatma section */
.progress-khatma-section { margin-top: 16px; padding: 12px; background: var(--card-bg); border: 1px solid var(--card-border); border-radius: 12px; }
.progress-khatma-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.progress-khatma-title { font-weight: 700; font-size: 0.8rem; color: var(--title-color); display: flex; align-items: center; gap: 6px; }
.progress-khatma-title i { color: var(--accent); }
.progress-khatma-setup-btn { background: none; border: 1px solid var(--card-border); color: var(--source-color); cursor: pointer; font-size: 0.65rem; padding: 4px 10px; border-radius: 6px; transition: 0.2s; }
.progress-khatma-setup-btn:hover { border-color: var(--accent); color: var(--accent); }
.progress-khatma-disabled { font-size: 0.7rem; color: var(--source-color); padding: 8px; text-align: center; }
.quran-khatma-prompt { transition: opacity 0.2s, transform 0.2s; }
.quran-khatma-prompt:hover { opacity: 0.8; transform: scale(1.01); }

/* Read page badge */
.quran-page-read { position: relative; }
.quran-page-read .quran-page-band { background: linear-gradient(90deg, transparent 3%, #2e7d32 12%, #2e7d32 88%, transparent 97%) !important; opacity: 0.5 !important; }
.quran-page-read-badge { position: absolute; top: 8px; left: 10px; right: auto; z-index: 20; color: #2e7d32; font-size: 1.5rem; opacity: 0.9; pointer-events: none; text-shadow: 0 0 6px rgba(46,125,50,0.4); }

/* Target page marker */
.quran-page-target { position: relative; }
.quran-page-target .quran-page-band { background: linear-gradient(90deg, transparent 3%, #b8860b 12%, #b8860b 88%, transparent 97%) !important; opacity: 0.3 !important; }
.quran-page-target-marker { position: absolute; top: 6px; left: 10px; z-index: 5; background: #b8860b; color: #fff; font-size: 0.6rem; padding: 2px 8px; border-radius: 8px; font-weight: 700; pointer-events: none; display: flex; align-items: center; gap: 4px; }
/* Main area — continuous scroll */
.quran-main { flex: 1; overflow-y: auto; padding: 0 20px 30px 16px; transition: margin-right 0.25s ease; scroll-behavior: smooth; }
.quran-layout.sidebar-open .quran-main { margin-right: 260px; }
.quran-loading { text-align: center; padding: 40px; color: var(--source-color); font-size: 0.85rem; }

/* Quran page — each page looks like a real printed Madani mushaf page */
.quran-page {
  background: #fdfaf3; /* Mushaf paper color */
  background-image: radial-gradient(rgba(201, 176, 132, 0.05) 1px, transparent 0);
  background-size: 20px 20px;
  margin-bottom: 40px;
  box-shadow: 0 15px 35px rgba(0,0,0,0.1), 0 5px 15px rgba(0,0,0,0.05);
  position: relative;
  border: 1px solid #e2d1b0;
  max-width: 850px;
  margin-left: auto;
  margin-right: auto;
  border-radius: 2px;
  overflow: hidden;
}

body.dark .quran-page {
  background: #1c1e22;
  background-image: none;
  border-color: #2c2e33;
  box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

/* Decorative frame border */
.quran-page-inner {
  margin: 15px;
  border: 2px solid #c9b084; /* Gold frame */
  position: relative;
  min-height: 400px;
  padding: 10px;
}

body.dark .quran-page-inner {
  border-color: #4a4235;
}

/* Decorative frame corners */
.quran-page-inner::before,
.quran-page-inner::after {
  content: '💠';
  position: absolute;
  font-size: 0.8rem;
  color: #c9b084;
  z-index: 5;
  background: #fdfaf3;
  padding: 0 4px;
}
body.dark .quran-page-inner::before, body.dark .quran-page-inner::after { background: #1c1e22; color: #8a7a5a; }
.quran-page-inner::before { top: -12px; right: -10px; }
.quran-page-inner::after { bottom: -12px; left: -10px; }

/* Top decorative band */
.quran-page-band { height: 5px; background: linear-gradient(90deg, transparent 3%, var(--accent) 12%, var(--accent) 88%, transparent 97%); opacity: 0.18; }
/* Page header: surah name left, juz+page right in a double-line header */
.quran-page-header { display: flex; align-items: center; justify-content: space-between; padding: 15px 25px 8px; font-family: 'Amiri', serif; direction: rtl; border-bottom: 1px solid rgba(201, 176, 132, 0.3); margin-bottom: 15px; }
.quran-page-header-right { text-align: right; }
.quran-page-header-center { text-align: center; }
.quran-page-header-left { text-align: left; }
.quran-page-header-surah { font-size: 0.88rem; font-weight: 700; color: var(--title-color); }
.quran-page-header-juz { font-size: 0.6rem; color: var(--source-color); font-weight: 600; letter-spacing: 0.5px; }
.quran-page-header-page-num { font-size: 0.6rem; color: var(--source-color); font-weight: 600; }
.quran-page-play-btn { width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--card-border); background: var(--surface-alt); color: var(--accent); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; font-size: 0.65rem; transition: all 0.1s; }
.quran-page-play-btn:hover { background: var(--accent); color: #fff; border-color: var(--accent); }
/* Decorative divider line below header */
.quran-page-divider { display: block; height: 1px; background: linear-gradient(90deg, transparent 10%, var(--card-border) 30%, var(--card-border) 70%, transparent 90%); margin: 8px 20px 0; }
/* Surah start banner — traditional mushaf-style surah heading */
.quran-page-surah-start { text-align: center; padding: 20px 24px 8px; }
.quran-page-surah-start-border { display: inline-block; }
.quran-page-surah-start-name { font-size: 1.4rem; font-weight: 800; color: var(--accent); display: block; font-family: 'Amiri', serif; letter-spacing: 1px; }
.quran-page-surah-start-ornament { display: block; text-align: center; font-size: 1.6rem; color: var(--accent); opacity: 0.55; margin-bottom: 4px; }
.quran-page-surah-start-meta { font-size: 0.65rem; color: var(--source-color); font-family: 'Cairo', sans-serif; opacity: 0.7; margin-top: 2px; }
.quran-basmalah { text-align: center; padding: 10px 24px 16px; font-size: 1.5rem; font-family: 'Amiri', serif; color: var(--accent); font-weight: 700; opacity: 0.6; line-height: 2; letter-spacing: 1px; position: relative; }
.quran-basmalah::before { content: ''; display: block; width: 40px; height: 1px; background: var(--accent); opacity: 0.2; margin: 0 auto 10px; }
.quran-ayahs-container { padding: 0; }
.mushaf-text { direction: rtl; font-family: 'Amiri', serif; padding: 0 20px 20px; }
/* Each mushaf line is one typeset row — centered with generous tracking */
.mushaf-line {
  direction: rtl;
  font-family: 'Amiri', serif;
  line-height: 1;           /* tight — spacing comes from padding below */
  padding: 14px 30px;
  text-align: center;
  font-size: clamp(20px, 3.2vh, 48px);
  color: #2c2c2c;
  word-spacing: 6px;
  letter-spacing: 0.5px;
  border-bottom: 1px solid rgba(201, 176, 132, 0.12);
}
.mushaf-line:last-child { border-bottom: none; }

body.dark .mushaf-line { color: #e0e0e0; border-bottom-color: rgba(138,122,90,0.1); }

.mushaf-line-header { text-align: center; margin: 25px 0 15px; background: rgba(201, 176, 132, 0.1); border-radius: 8px; padding: 12px 0; border-top: 2px solid #c9b084; border-bottom: 2px solid #c9b084; }
body.dark .mushaf-line-header { background: rgba(138, 122, 90, 0.05); border-color: #4a4235; }

.mushaf-line-header-border { display: inline-block; }
.mushaf-line-header-ornament { display: block; font-size: 1.6rem; color: var(--accent); opacity: 0.55; margin-bottom: 2px; }
.mushaf-line-header-name { font-size: 1.6rem; font-weight: 800; color: #8a734e; font-family: 'Amiri', serif; letter-spacing: 1px; }
body.dark .mushaf-line-header-name { color: #c9b084; }

.mushaf-basmala-line { text-align: center; padding: 4px 0 12px; font-size: 1.8rem; color: #5d4e36; font-weight: 700; opacity: 0.8; }
body.dark .mushaf-basmala-line { color: #a89474; }

.mushaf-ayah { color: var(--text-color); cursor: pointer; transition: background 0.08s; border-radius: 3px; font-family: 'Amiri', serif; display: inline; padding: 0 2px; }
.mushaf-ayah:active { background: var(--card-border); }

/* Hover and selected highlight all fragments of the same ayah */
.mushaf-ayah.hover { background: rgba(201, 176, 132, 0.2); }
.mushaf-ayah.selected { background: rgba(201, 176, 132, 0.15); border-radius: 4px; }
body.dark .mushaf-ayah.hover { background: rgba(201, 176, 132, 0.12); }
body.dark .mushaf-ayah.selected { background: rgba(201, 176, 132, 0.08); }

/* Ayah marker styling */
.mushaf-ayah {
  position: relative;
}

.ayah-num-ornament {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  margin: 0 6px;
  font-family: 'Amiri', serif;
  font-size: 0.75rem;
  font-weight: 700;
  color: #8a734e;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cpath fill='none' stroke='%23c9b084' stroke-width='1.5' d='M16 2l3 3.5l4.5-1l1 4.5l4 2.5l-2.5 4.5l2.5 4.5l-4 2.5l-1 4.5l-4.5-1l-3 3.5l-3-3.5l-4.5 1l-1-4.5l-4-2.5l2.5-4.5l-2.5-4.5l4-2.5l1-4.5l4.5 1l3-3.5z'/%3E%3Ccircle cx='16' cy='16' r='8' fill='none' stroke='%23c9b084' stroke-width='0.5' stroke-dasharray='1 1'/%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  vertical-align: middle;
  transform: translateY(-2px);
  user-select: none;
}

body.dark .ayah-num-ornament {
  color: #c9b084;
  filter: brightness(1.2);
}

/* Ayah number ornament at end of each verse */
.ayah-num-ornament {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  margin: 0 8px;
  font-family: 'Amiri', serif;
  font-size: 0.8rem;
  font-weight: 700;
  color: #8a734e;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cpath fill='none' stroke='%23c9b084' stroke-width='1.2' d='M16 2l3 3.5l4.5-1l1 4.5l4 2.5l-2.5 4.5l2.5 4.5l-4 2.5l-1 4.5l-4.5-1l-3 3.5l-3-3.5l-4.5 1l-1-4.5l-4-2.5l2.5-4.5l-2.5-4.5l4-2.5l1-4.5l4.5 1l3-3.5z'/%3E%3Ccircle cx='16' cy='16' r='7.5' fill='none' stroke='%23c9b084' stroke-width='0.5' stroke-dasharray='1 1'/%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  vertical-align: middle;
  transform: translateY(-2px);
  flex-shrink: 0;
  pointer-events: none;
}
body.dark .ayah-num-ornament {
  color: #c9b084;
  filter: brightness(1.2);
}

/* Mushaf text alignment */
.mushaf-text { 
  direction: rtl; 
  font-family: 'Amiri', serif; 
  padding: 0 30px 20px;
  text-align: justify;
  text-justify: inter-word;
}

.quran-page-footer { text-align: center; font-size: 0.65rem; color: var(--source-color); font-family: 'Amiri', serif; padding: 10px 0 20px; opacity: 0.6; letter-spacing: 2px; direction: rtl; border-top: 1px double #c9b084; margin-top: 10px; }
body.dark .quran-page-footer { border-top-color: #4a4235; }

.mushaf-surah-sep { text-align: center; margin: 22px 0 10px; padding: 0 12px; }
.mushaf-surah-sep-border { display: inline-block; padding-bottom: 8px; position: relative; }
.mushaf-surah-sep-border::after { content: ''; display: block; width: 40px; height: 1px; background: var(--accent); opacity: 0.2; margin: 10px auto 0; }
.mushaf-surah-sep-ornament { display: block; font-size: 1.6rem; color: var(--accent); opacity: 0.55; margin-bottom: 4px; }
.mushaf-surah-sep-name { font-size: 1.2rem; font-weight: 800; color: var(--accent); font-family: 'Amiri', serif; margin-bottom: 2px; letter-spacing: 1px; }
.mushaf-surah-sep-meta { font-size: 0.65rem; color: var(--source-color); font-family: 'Cairo', sans-serif; opacity: 0.7; }
.mushaf-quarter-marker { display: inline-block; font-size: 0.55rem; font-weight: 700; color: #8a734e; padding: 2px 8px; margin: 0 4px; vertical-align: middle; font-family: 'Cairo', sans-serif; background: rgba(201, 176, 132, 0.1); border-radius: 4px; }
.mushaf-translations { padding: 0 28px 20px; }
.mushaf-translation { font-size: 0.75rem; color: var(--desc-color); line-height: 1.6; padding: 5px 10px; cursor: pointer; border-radius: 8px; margin-bottom: 2px; }
.mushaf-translation:hover { background: rgba(201, 176, 132, 0.1); }
.mushaf-trans-num { color: var(--accent); font-weight: 800; font-size: 0.65rem; }

.quran-search-result { padding: 8px 10px; border-radius: 10px; background: var(--card-bg); border: 1px solid var(--card-border); cursor: pointer; transition: all 0.1s; margin-bottom: 6px; }
.quran-search-result:hover { border-color: var(--accent); }
.quran-search-result:active { background: var(--surface-alt); }
.quran-search-result-header { font-size: 0.6rem; color: var(--source-color); font-weight: 700; margin-bottom: 3px; }
.quran-search-result-ar { font-size: 0.85rem; line-height: 1.6; color: var(--text-color); margin-bottom: 2px; font-weight: 600; direction: rtl; text-align: right; font-family: 'Amiri', serif; }
.quran-search-result-en { font-size: 0.68rem; color: var(--desc-color); line-height: 1.4; }

/* Tafseer Slide Panel — slides in from the right */
.tafseer-panel-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.35); z-index: 999; }
.tafseer-panel { position: fixed; top: 0; right: 0; bottom: 0; width: 380px; max-width: 92vw; background: var(--card-bg); z-index: 1000; display: flex; flex-direction: column; box-shadow: -6px 0 24px rgba(0,0,0,0.15); animation: panelSlideIn 0.25s ease-out; }
[dir="ltr"] .tafseer-panel { right: auto; left: 0; box-shadow: 6px 0 24px rgba(0,0,0,0.15); }
@keyframes panelSlideIn { from { transform: translateX(100%); } to { transform: translateX(0); } }
.tafseer-panel-header { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; background: var(--accent); color: #fff; font-weight: 700; font-size: 0.9rem; flex-shrink: 0; }
.tafseer-panel-close { background: none; border: none; color: #fff; font-size: 1.1rem; cursor: pointer; padding: 4px; }
.tafseer-panel-body { flex: 1; overflow-y: auto; padding: 16px; }
.tafseer-panel-ayah { font-size: 1.3rem; line-height: 2; color: var(--text-color); font-weight: 700; text-align: center; font-family: 'Amiri', serif; padding: 8px 0 12px; }
.tafseer-panel-actions { display: flex; gap: 8px; justify-content: center; padding: 8px 0 12px; }
.tafseer-panel-play-btn { display: flex; align-items: center; gap: 5px; padding: 7px 12px; border-radius: 10px; border: 1px solid var(--card-border); background: var(--surface-alt); color: var(--text-color); font-size: 0.72rem; font-weight: 600; cursor: pointer; transition: all 0.1s; white-space: nowrap; }
.tafseer-panel-play-btn:hover { border-color: var(--accent); }
.tafseer-panel-play-btn i { font-size: 0.7rem; }
.tafseer-panel-divider { height: 1px; background: var(--card-border); margin: 4px 0 12px; }
.tafseer-panel-text { font-size: 0.85rem; line-height: 1.8; color: var(--text-color); }
.tafseer-panel-text h2 { font-size: 0.95rem; margin: 12px 0 6px; color: var(--accent, #c9a04e); }
.tafseer-panel-text p { margin: 6px 0; }
.tafseer-panel-text span.gray { color: var(--text-secondary, #888); }
.tafseer-panel-translation { display: none; font-size: 0.85rem; line-height: 1.6; color: var(--text-secondary, #888); font-style: italic; text-align: left; padding: 0 0 10px; }


/* Quran Recitation Player Bar */
.quran-rec-bar { position: sticky; bottom: 0; background: var(--card-bg); border-top: 1px solid var(--card-border); padding: 6px 12px; z-index: 50; box-shadow: 0 -4px 16px rgba(0,0,0,0.08); }
.quran-rec-bar-inner { display: flex; align-items: center; gap: 10px; max-width: 800px; margin: 0 auto; }
.quran-rec-btn { width: 34px; height: 34px; border-radius: 50%; border: none; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; cursor: pointer; font-size: 0.8rem; flex-shrink: 0; }
.quran-rec-btn:hover { opacity: 0.85; }
.quran-rec-close { background: var(--surface-alt); color: var(--text-muted); }
.quran-rec-info { font-size: 0.72rem; color: var(--desc-color); min-width: 0; flex-shrink: 1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.quran-rec-info span { display: block; }
.quran-rec-progress { flex: 1; height: 4px; border-radius: 2px; background: var(--card-border); overflow: hidden; }
.quran-rec-progress-bar { height: 100%; width: 0%; background: var(--accent); transition: width 0.3s; border-radius: 2px; }

/* Ayah highlighting during recitation */
.mushaf-ayah.reciting { background: rgba(45, 106, 79, 0.12); border-radius: 4px; box-shadow: 0 0 0 2px var(--accent); transition: all 0.15s; }

/* Dashboard → Quran navigation: highlighted ayah */
.mushaf-ayah.highlighted { background: rgba(45, 106, 79, 0.25) !important; border-radius: 4px; box-shadow: 0 0 0 2px var(--accent); }

/* Force scroll-to-top to always be on the physical right side */
[dir="rtl"] .scroll-to-top,
[dir="ltr"] .scroll-to-top {
  right: 16px !important;
  left: auto !important;
}

/* LTR fixes for Quran */
[dir="ltr"] .quran-sidebar { border-left: 1px solid var(--card-border); }

/* Quran Audio Dashboard */
.quran-audio-dashboard { background: var(--card-bg); border: 1px solid var(--card-border); border-radius: 16px; padding: 14px; }
.quran-audio-dash-header { display: flex; align-items: center; gap: 8px; font-size: 0.9rem; font-weight: 800; color: var(--title-color); margin-bottom: 10px; }
.quran-audio-dash-header i { font-size: 1rem; color: var(--title-color); }
.quran-audio-select { width: 100%; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--card-border); background: var(--surface-alt); color: var(--text-color); font-size: 0.8rem; margin-bottom: 10px; outline: none; }
.quran-audio-controls { display: flex; gap: 8px; }
.quran-audio-play-btn { flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px; padding: 10px; border-radius: 12px; border: none; background: var(--accent); color: #fff; font-size: 0.82rem; font-weight: 700; cursor: pointer; }
.quran-audio-play-btn:hover { opacity: 0.85; }

/* Quran position dashboard */
.quran-pos-dashboard { background: var(--card-bg); border: 1px solid var(--card-border); border-radius: 16px; padding: 14px; border-right: 4px solid var(--accent); }
.quran-pos-dashboard .quran-audio-dash-header { margin-bottom: 0; }
/* Dashboard Cards */
.dash-item-wrapper { margin-bottom: 10px; cursor: pointer; }
.dash-card { background: var(--card-bg); border: 1px solid var(--card-border); border-radius: 16px; padding: 14px; }
.dash-quran-card { border-right: 4px solid var(--accent); }
.dash-hadith-card { border-right: 4px solid var(--highlight-color); }
.dash-card-header { display: flex; align-items: center; gap: 8px; font-size: 0.82rem; font-weight: 800; color: var(--title-color); margin-bottom: 10px; }
.dash-card-header i.fa-quran { color: var(--accent); }
.dash-card-header i.fa-quote-right { color: var(--highlight-color); }
.dash-card-label { flex: 1; font-size: 0.78rem; }
.dash-refresh-btn, .dash-remove-btn, .dash-play-btn { background: var(--counter-btn-bg); border: 1px solid var(--card-border); width: 28px; height: 28px; border-radius: 50%; cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 0.65rem; color: var(--text-color); transition: all 0.15s; }
.dash-refresh-btn:hover, .dash-remove-btn:hover, .dash-play-btn:hover { transform: scale(1.05); }
.dash-refresh-btn:hover { background: var(--tab-btn-active-bg); color: #fff; }
.dash-remove-btn:hover { background: #e74c3c; color: #fff; }
.dash-play-btn:hover { background: var(--accent); color: #fff; }
.dash-play-small { width: 22px; height: 22px; font-size: 0.55rem; }
.dash-goto-link { color: var(--source-color); font-size: 0.75rem; text-decoration: none; }
.dash-goto-link:hover { color: var(--accent); }
.dash-card-body { margin-bottom: 8px; }
.dash-quran-ar { font-family: 'Amiri', 'Traditional Arabic', serif; font-size: 1.15rem; line-height: 1.8; direction: rtl; text-align: center; color: var(--text-color); margin-bottom: 4px; }
.dash-quran-en { font-size: 0.78rem; color: var(--source-color); line-height: 1.5; margin-top: 4px; padding-top: 6px; border-top: 1px solid var(--card-border); }
.dash-hadith-text { font-size: 0.92rem; line-height: 1.7; direction: rtl; text-align: center; color: var(--text-color); }
.dash-hadith-elab { font-size: 0.78rem; color: var(--source-color); line-height: 1.5; margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--card-border); }
.dash-card-source { font-size: 0.7rem; color: var(--source-color); font-weight: 600; text-align: center; }
.dash-card-source::before { content: "— "; }

/* Dashboard Manager Overlay/Modal */
.dash-mgr-overlay { position: fixed; top:0; left:0; width:100%; height:100%; z-index:2000; background: rgba(0,0,0,0.5); display:flex; align-items:center; justify-content:center; }
.dash-mgr-modal { background: var(--card-bg); border: 1px solid var(--card-border); border-radius: 20px; padding: 20px; width: 90%; max-width: 380px; max-height: 85vh; overflow-y: auto; }
.dash-mgr-modal-header { display: flex; align-items: center; gap: 8px; font-size: 0.95rem; font-weight: 800; color: var(--title-color); margin-bottom: 14px; }
.dash-mgr-modal-header span { flex: 1; }
.dash-mgr-close-btn { background: none; border: none; font-size: 1.1rem; cursor: pointer; color: var(--source-color); padding: 4px; }
.dash-mgr-close-btn:hover { color: var(--text-color); }
.dash-mgr-items { margin-bottom: 14px; }
.dash-mgr-item { display: flex; align-items: center; gap: 6px; padding: 10px 0; border-bottom: 1px solid var(--card-border); }
.dash-mgr-item:last-child { border-bottom: none; }
.dash-mgr-item-info { flex: 1; display: flex; align-items: center; gap: 6px; font-size: 0.78rem; color: var(--text-color); }
.dash-mgr-item-icon { width: 20px; text-align: center; font-size: 0.8rem; }
.dash-mgr-item-icon i.fa-quran { color: var(--accent); }
.dash-mgr-item-icon i.fa-quote-right { color: var(--highlight-color); }
.dash-mgr-item-actions { display: flex; gap: 4px; }
.dash-mgr-btn { background: var(--counter-btn-bg); border: 1px solid var(--card-border); border-radius: 8px; width: 28px; height: 28px; cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 0.65rem; color: var(--text-color); }
.dash-mgr-btn:hover { background: var(--tab-btn-active-bg); color: #fff; }
.dash-mgr-del-btn:hover { background: #e74c3c; color: #fff; }
.dash-mgr-empty { text-align: center; padding: 20px; color: var(--source-color); font-size: 0.8rem; }
.dash-mgr-add-section { border-top: 1px solid var(--card-border); padding-top: 14px; }
.dash-mgr-add-title { font-size: 0.78rem; font-weight: 700; color: var(--title-color); margin-bottom: 10px; }
.dash-mgr-add-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.dash-mgr-add-btn { flex: 1; min-width: 100px; display: flex; align-items: center; justify-content: center; gap: 5px; padding: 10px; border-radius: 12px; border: 1px solid var(--card-border); background: var(--surface-alt); color: var(--text-color); font-size: 0.75rem; font-weight: 700; cursor: pointer; transition: all 0.15s; }
.dash-mgr-add-btn:hover { background: var(--accent); color: #fff; border-color: var(--accent); }
.dash-add-modal { max-height: 90vh; }
.dash-add-body { display: flex; flex-direction: column; gap: 10px; }
.dash-add-label { font-size: 0.75rem; font-weight: 700; color: var(--title-color); }
.dash-add-select, .dash-add-input { width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--card-border); background: var(--surface-alt); color: var(--text-color); font-size: 0.8rem; outline: none; }
.dash-add-input { width: auto; }
.dash-add-confirm-btn { padding: 12px; border-radius: 12px; border: none; background: var(--accent); color: #fff; font-size: 0.85rem; font-weight: 700; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 4px; }
.dash-add-confirm-btn:hover { opacity: 0.85; }

/* ─── Dashboard Section Layout ─── */

#dashboardSections {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
}

.dash-section {
    border-radius: 12px;
    padding: 2px;
}

.dash-section.hidden-section {
    display: none;
}

.dash-mgr-vis-badge {
    font-size: 0.55rem;
    padding: 1px 6px;
    border-radius: 8px;
    background: var(--surface-alt);
    margin-left: 4px;
}

/* ─── Accent Color Themes ─── */

/* Blue */
body.theme-blue { --accent: #1a73e8; --tab-btn-active-bg: #1a73e8; --rail-slot-active-bg: #1a73e8; --title-color: #1a73e8; --done-btn-completed-bg: #1a73e8; --fab-bg: #1a73e8; --fab-hover: #1557b0; --menu-bg: #1a73e8; --menu-hover: #1557b0; --subcat-active-bg: #1a73e8; --highlight-color: #1a73e8; --highlight-bg: rgba(26,115,232,0.2); --glow-shadow: 0 0 30px rgba(26,115,232,0.5); --modal-header-bg: linear-gradient(135deg, #1a73e8, #1557b0); }
body.dark.theme-blue { --tab-btn-active-bg: #3b8cff; --rail-slot-active-bg: #3b8cff; --accent: #3b8cff; --title-color: #3b8cff; --done-btn-completed-bg: #3b8cff; --fab-bg: #3b8cff; --fab-hover: #2a6fdb; --menu-bg: #3b8cff; --menu-hover: #2a6fdb; --subcat-active-bg: #3b8cff; --highlight-color: #3b8cff; --highlight-bg: rgba(59,140,255,0.2); --glow-shadow: 0 0 30px rgba(59,140,255,0.5); --modal-header-bg: linear-gradient(135deg, #1a5ab0, #0e3d7a); }

/* Purple */
body.theme-purple { --accent: #7c3aed; --tab-btn-active-bg: #7c3aed; --rail-slot-active-bg: #7c3aed; --title-color: #7c3aed; --done-btn-completed-bg: #7c3aed; --fab-bg: #7c3aed; --fab-hover: #5b21b6; --menu-bg: #7c3aed; --menu-hover: #5b21b6; --subcat-active-bg: #7c3aed; --highlight-color: #7c3aed; --highlight-bg: rgba(124,58,237,0.2); --glow-shadow: 0 0 30px rgba(124,58,237,0.5); --modal-header-bg: linear-gradient(135deg, #7c3aed, #5b21b6); }
body.dark.theme-purple { --tab-btn-active-bg: #a78bfa; --rail-slot-active-bg: #a78bfa; --accent: #a78bfa; --title-color: #a78bfa; --done-btn-completed-bg: #a78bfa; --fab-bg: #a78bfa; --fab-hover: #8b5cf6; --menu-bg: #a78bfa; --menu-hover: #8b5cf6; --subcat-active-bg: #a78bfa; --highlight-color: #a78bfa; --highlight-bg: rgba(167,139,250,0.2); --glow-shadow: 0 0 30px rgba(167,139,250,0.5); --modal-header-bg: linear-gradient(135deg, #6d28d9, #4c1d95); }

/* Gold */
body.theme-gold { --accent: #b8860b; --tab-btn-active-bg: #b8860b; --rail-slot-active-bg: #b8860b; --title-color: #b8860b; --done-btn-completed-bg: #b8860b; --fab-bg: #b8860b; --fab-hover: #8a6508; --menu-bg: #b8860b; --menu-hover: #8a6508; --subcat-active-bg: #b8860b; --highlight-color: #b8860b; --highlight-bg: rgba(184,134,11,0.2); --glow-shadow: 0 0 30px rgba(184,134,11,0.5); --modal-header-bg: linear-gradient(135deg, #b8860b, #8a6508); }
body.dark.theme-gold { --tab-btn-active-bg: #d4a017; --rail-slot-active-bg: #d4a017; --accent: #d4a017; --title-color: #d4a017; --done-btn-completed-bg: #d4a017; --fab-bg: #d4a017; --fab-hover: #b8860b; --menu-bg: #d4a017; --menu-hover: #b8860b; --subcat-active-bg: #d4a017; --highlight-color: #d4a017; --highlight-bg: rgba(212,160,23,0.2); --glow-shadow: 0 0 30px rgba(212,160,23,0.5); --modal-header-bg: linear-gradient(135deg, #9a6f08, #6e4e06); }

/* Teal */
body.theme-teal { --accent: #0d9488; --tab-btn-active-bg: #0d9488; --rail-slot-active-bg: #0d9488; --title-color: #0d9488; --done-btn-completed-bg: #0d9488; --fab-bg: #0d9488; --fab-hover: #0f766e; --menu-bg: #0d9488; --menu-hover: #0f766e; --subcat-active-bg: #0d9488; --highlight-color: #0d9488; --highlight-bg: rgba(13,148,136,0.2); --glow-shadow: 0 0 30px rgba(13,148,136,0.5); --modal-header-bg: linear-gradient(135deg, #0d9488, #0f766e); }
body.dark.theme-teal { --tab-btn-active-bg: #2dd4bf; --rail-slot-active-bg: #2dd4bf; --accent: #2dd4bf; --title-color: #2dd4bf; --done-btn-completed-bg: #2dd4bf; --fab-bg: #2dd4bf; --fab-hover: #14b8a6; --menu-bg: #2dd4bf; --menu-hover: #14b8a6; --subcat-active-bg: #2dd4bf; --highlight-color: #2dd4bf; --highlight-bg: rgba(45,212,191,0.2); --glow-shadow: 0 0 30px rgba(45,212,191,0.5); --modal-header-bg: linear-gradient(135deg, #0f766e, #0a5c55); }

/* Rose */
body.theme-rose { --accent: #e11d48; --tab-btn-active-bg: #e11d48; --rail-slot-active-bg: #e11d48; --title-color: #e11d48; --done-btn-completed-bg: #e11d48; --fab-bg: #e11d48; --fab-hover: #be123c; --menu-bg: #e11d48; --menu-hover: #be123c; --subcat-active-bg: #e11d48; --highlight-color: #e11d48; --highlight-bg: rgba(225,29,72,0.2); --glow-shadow: 0 0 30px rgba(225,29,72,0.5); --modal-header-bg: linear-gradient(135deg, #e11d48, #be123c); }
body.dark.theme-rose { --tab-btn-active-bg: #fb7185; --rail-slot-active-bg: #fb7185; --accent: #fb7185; --title-color: #fb7185; --done-btn-completed-bg: #fb7185; --fab-bg: #fb7185; --fab-hover: #f43f5e; --menu-bg: #fb7185; --menu-hover: #f43f5e; --subcat-active-bg: #fb7185; --highlight-color: #fb7185; --highlight-bg: rgba(251,113,133,0.2); --glow-shadow: 0 0 30px rgba(251,113,133,0.5); --modal-header-bg: linear-gradient(135deg, #9f1239, #7f1d2e); }

/* Scrollable Category Tabs */

/* ===== Scroll to Top Button ===== */
.scroll-to-top {
  position: fixed;
  bottom: 90px;
  right: 16px;
  left: auto;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  border: none;
  box-shadow: 0 4px 16px rgba(0,0,0,0.25);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  z-index: 900;
  opacity: 0;
  visibility: hidden;
  transform: translateY(16px);
  transition: opacity 0.25s ease, transform 0.25s ease, visibility 0s 0.25s;
}
.scroll-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  transition: opacity 0.25s ease, transform 0.25s ease, visibility 0s 0s;
}
.scroll-to-top:hover {
  transform: translateY(-2px) scale(1.06);
  opacity: 0.9;
}

/* ===== Quran Bookmarks ===== */

.quran-bookmarks-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
  max-height: 140px;
  overflow-y: auto;
}
.quran-bookmark-item {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 6px;
  border-radius: 6px;
  background: var(--surface-alt);
  cursor: pointer;
  font-size: 0.62rem;
  color: var(--text-color);
  transition: background 0.1s;
}
.quran-bookmark-item:hover { background: var(--card-border); }
.quran-bookmark-item .bm-surah { font-weight: 700; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.quran-bookmark-item .bm-ayah { color: var(--source-color); font-size: 0.58rem; white-space: nowrap; }
.quran-bookmark-remove {
  background: none;
  border: none;
  color: var(--source-color);
  cursor: pointer;
  font-size: 0.58rem;
  padding: 2px;
  flex-shrink: 0;
}
.quran-bookmark-remove:hover { color: #e74c3c; }
.quran-bookmarks-empty {
  font-size: 0.6rem;
  color: var(--source-color);
  text-align: center;
  padding: 6px 0;
}

/* Bookmarked state for tafseer bookmark button */
#tafseerBookmarkBtn.bookmarked i { font-weight: 900; color: var(--favorite-color); }
#tafseerBookmarkBtn.bookmarked { border-color: var(--favorite-color); }

/* Highlighted bookmarked ayah in mushaf */
.mushaf-ayah.bookmarked-ayah {
  background: rgba(245, 197, 66, 0.15);
  box-shadow: 0 0 0 2px rgba(245, 197, 66, 0.35);
  border-radius: 4px;
  padding: 0 2px;
}
body.dark .mushaf-ayah.bookmarked-ayah {
  background: rgba(232, 168, 76, 0.12);
  box-shadow: 0 0 0 2px rgba(232, 168, 76, 0.3);
}

/* ==================== CALENDAR & PRAYER TIMES VIEW ==================== */
.calendar-scroll { padding-bottom: 20px; }
.calendar-content { margin: 0 auto; }
.cal-section { background: var(--card-bg); border: 1px solid var(--card-border); border-radius: 16px; padding: 16px; margin-bottom: 14px; }
.cal-section-header { display: flex; align-items: center; gap: 8px; font-size: 0.85rem; font-weight: 700; color: var(--title-color); margin-bottom: 12px; }
.cal-section-header i { color: var(--accent); font-size: 0.85rem; }

/* Prayer Times */
.prayer-location-bar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; padding-bottom: 10px; border-bottom: 1px solid var(--card-border); flex-wrap: wrap; gap: 6px; }
.prayer-location-name { font-size: 0.75rem; color: var(--text-color); display: flex; align-items: center; gap: 4px; }
.prayer-location-name i { color: var(--accent); }
.prayer-loc-btn { background: var(--surface-alt); border: 1px solid var(--card-border); border-radius: 2rem; padding: 4px 12px; font-size: 0.7rem; font-weight: 700; cursor: pointer; color: var(--text-color); display: flex; align-items: center; gap: 4px; transition: all 0.15s; }
.prayer-loc-btn:hover { background: var(--tab-btn-active-bg); color: #fff; border-color: var(--tab-btn-active-bg); }

.prayer-times-grid { display: flex; flex-direction: column; gap: 2px; }
.prayer-time-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; transition: background 0.15s; position: relative; }
.prayer-time-row.next-prayer { background: var(--highlight-bg); border: 1px solid var(--highlight-color); }
.prayer-time-icon { width: 28px; text-align: center; font-size: 1rem; flex-shrink: 0; }
.prayer-time-label { flex: 1; display: flex; flex-direction: column; gap: 1px; }
.prayer-time-name { font-size: 0.82rem; font-weight: 700; color: var(--text-color); }
.prayer-time-next-badge { font-size: 0.6rem; color: var(--highlight-color); font-weight: 700; }
.prayer-time-value { font-size: 0.85rem; font-weight: 700; color: var(--title-color); direction: ltr; text-align: end; font-family: 'Cairo', monospace; min-width: 60px; }

/* Hijri Calendar */
.hijri-nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; gap: 8px; }
.hijri-nav-btn { background: var(--surface-alt); border: 1px solid var(--card-border); border-radius: 50%; width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; cursor: pointer; color: var(--text-color); font-size: 0.8rem; transition: all 0.15s; flex-shrink: 0; }
.hijri-nav-btn:hover { background: var(--tab-btn-active-bg); color: #fff; border-color: var(--tab-btn-active-bg); }
.hijri-nav-title { text-align: center; flex: 1; }
.hijri-nav-month { font-size: 0.9rem; font-weight: 800; color: var(--title-color); }
.hijri-nav-greg { font-size: 0.65rem; color: var(--source-color); margin-top: 1px; }

.hijri-dow-row { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; margin-bottom: 4px; }
.hijri-dow { text-align: center; font-size: 0.68rem; font-weight: 700; color: var(--source-color); padding: 4px 0; }

.hijri-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.hijri-day { text-align: center; padding: 6px 2px; border-radius: 8px; cursor: pointer; position: relative; transition: all 0.12s; min-height: 32px; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.hijri-day:hover { background: var(--surface-alt); }
.hijri-day.empty { cursor: default; }
.hijri-day.empty:hover { background: transparent; }
.hijri-day.today { background: var(--tab-btn-active-bg); color: #fff; font-weight: 700; }
.hijri-day.today:hover { background: var(--fab-hover); }
.hijri-day-num { font-size: 0.78rem; font-weight: 600; }
.hijri-day.today .hijri-day-num { font-weight: 800; }
.hijri-event-dot { width: 4px; height: 4px; border-radius: 50%; background: var(--favorite-color); margin-top: 1px; }
.hijri-day.today .hijri-event-dot { background: #fff; }
.hijri-today-badge { font-size: 0.5rem; position: absolute; top: 1px; inset-inline-end: 3px; opacity: 0.6; }

.hijri-today-btn { display: flex; align-items: center; justify-content: center; gap: 6px; width: 100%; background: var(--surface-alt); border: 1px solid var(--card-border); border-radius: 2rem; padding: 6px 12px; font-size: 0.72rem; font-weight: 700; cursor: pointer; color: var(--text-color); margin-top: 8px; transition: all 0.15s; }
.hijri-today-btn:hover { background: var(--tab-btn-active-bg); color: #fff; border-color: var(--tab-btn-active-bg); }

.hijri-events { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--card-border); }
.hijri-events-title { display: flex; align-items: center; gap: 6px; font-size: 0.78rem; font-weight: 700; color: var(--title-color); margin-bottom: 6px; }
.hijri-events-title i { color: var(--favorite-color); font-size: 0.7rem; }
.hijri-event-item { display: flex; align-items: center; gap: 6px; font-size: 0.75rem; color: var(--text-color); padding: 3px 0; }
.hijri-event-item i { font-size: 0.45rem; color: var(--accent); }
.hijri-event-day { font-size: 0.62rem; font-weight: 700; color: var(--title-color); background: var(--surface-alt); border-radius: 4px; padding: 0 5px; min-width: 20px; text-align: center; }

@media (max-width: 600px) {
  .hijri-day { min-height: 28px; padding: 4px 1px; }
  .hijri-day-num { font-size: 0.72rem; }
  .prayer-time-row { padding: 6px 8px; }
  .prayer-time-name { font-size: 0.78rem; }
}

/* ─── Quran Search Suggestions ─── */
.quran-search-box { position: relative; }
.qs-dropdown { position: absolute; top: 100%; left: 0; right: 0; background: var(--surface); border: 1px solid var(--form-border); border-radius: 0 0 8px 8px; max-height: 320px; overflow-y: auto; z-index: 100; box-shadow: 0 4px 12px rgba(0,0,0,0.12); display: none; }
.qs-header { font-size: 0.6rem; color: var(--source-color); padding: 4px 10px 2px; font-weight: 700; letter-spacing: 0.5px; }
.qs-item { padding: 6px 12px; font-size: 0.75rem; cursor: pointer; color: var(--text-color); transition: background 0.08s; }
.qs-item:hover { background: var(--surface-hover); }
.qs-item.qs-history { color: var(--source-color); font-size: 0.72rem; }
.qs-clear { padding: 4px 12px 8px; font-size: 0.6rem; color: var(--accent); cursor: pointer; text-align: right; }
.qs-clear:hover { text-decoration: underline; }

/* Search result highlights */
.qs-highlight { background: rgba(201, 176, 132, 0.3); padding: 0 2px; border-radius: 2px; }
body.dark .qs-highlight { background: rgba(201, 176, 132, 0.25); }

/* Quran search result cards */
.quran-search-result { padding: 6px 8px; border-bottom: 1px solid var(--card-border); cursor: pointer; transition: background 0.08s; }
.quran-search-result:last-child { border-bottom: none; }
.quran-search-result:hover { background: var(--surface-hover); }
.quran-search-result-header { font-size: 0.6rem; color: var(--source-color); margin-bottom: 3px; font-weight: 700; }
.quran-search-result-ar { font-size: 1.1rem; line-height: 1.7; color: var(--text-color); font-family: 'Amiri', serif; direction: rtl; text-align: right; }
.quran-search-result-en { font-size: 0.72rem; color: var(--text-secondary); margin-top: 2px; line-height: 1.4; }

/* ─── Stories View ─── */
.stories-header { display:flex; flex-direction:column; align-items:center; gap:4px; padding:20px 12px 16px; }
.stories-header i { font-size:1.5rem; color:var(--accent); }
.stories-header span:first-of-type { font-size:1rem; font-weight:800; color:var(--title-color); }
.stories-grid { display:flex; flex-wrap:wrap; gap:12px; padding:8px 12px; }
.stories-cat-card { width:calc(50% - 6px); border-radius:16px; border:1px solid var(--card-border); background:var(--card-bg); padding:24px 14px; display:flex; flex-direction:column; align-items:center; gap:10px; cursor:pointer; transition:transform 0.15s,box-shadow 0.15s; box-shadow:0 1px 4px rgba(0,0,0,0.06); }
.stories-cat-card:hover { transform:translateY(-2px); box-shadow:0 4px 12px rgba(0,0,0,0.1); }
.stories-cat-icon { width:48px; height:48px; border-radius:24px; display:flex; align-items:center; justify-content:center; font-size:1.3rem; }
.stories-cat-title { font-weight:700; font-size:0.82rem; text-align:center; color:var(--title-color); }
.stories-cat-desc { font-weight:500; font-size:0.68rem; text-align:center; color:var(--source-color); }
.stories-cat-header { display:flex; align-items:center; gap:8px; padding:10px 12px; border-bottom:1px solid var(--card-border); background:var(--card-bg); }
.stories-back-btn { background:none; border:none; font-size:0.78rem; font-weight:700; color:var(--accent); cursor:pointer; display:flex; align-items:center; gap:4px; padding:6px 10px; border-radius:8px; }
.stories-back-btn:hover { background:var(--surface-hover); }
.stories-back-btn i { font-size:0.85rem; }
.stories-cat-header span:last-child { flex:1; text-align:center; font-weight:700; font-size:0.9rem; color:var(--title-color); }
.stories-list { padding:12px; }
.story-card-item { border-radius:12px; border:1px solid var(--card-border); border-left:3px solid var(--accent); background:var(--card-bg); padding:14px; margin-bottom:10px; cursor:pointer; transition:transform 0.1s; }
.story-card-item:hover { transform:translateX(2px); }
.story-card-title { font-weight:700; font-size:0.85rem; color:var(--title-color); margin-bottom:4px; }
.story-card-summary { font-weight:500; font-size:0.72rem; color:var(--source-color); line-height:1.5; }

/* ─── Milestones ─── */
.milestones-filter-row { display:flex; justify-content:center; gap:8px; padding:10px 12px; border-bottom:1px solid var(--card-border); background:var(--card-bg); }
.milestone-filter-chip { padding:6px 16px; border-radius:20px; font-size:0.72rem; font-weight:600; cursor:pointer; background:var(--surface-alt); color:var(--text-muted); transition:all 0.15s; }
.milestone-filter-chip.active { background:var(--accent); color:#fff; }
.milestones-list { padding:12px; }
.milestone-card { border-radius:16px; border:1px solid var(--card-border); background:var(--card-bg); padding:16px; margin-bottom:16px; box-shadow:0 1px 4px rgba(0,0,0,0.06); }
.milestone-card-header { display:flex; align-items:center; justify-content:space-between; margin-bottom:8px; }
.milestone-era-badge { border-radius:8px; padding:3px 10px; font-size:0.68rem; font-weight:600; }
.milestone-title { font-weight:800; font-size:0.95rem; color:var(--title-color); margin-bottom:8px; }
.milestone-summary { font-weight:500; font-size:0.78rem; color:var(--text-color); line-height:1.7; margin-bottom:12px; }
.milestone-lesson-box { border-radius:12px; border:1px solid; padding:12px; }
.milestone-lesson-header { display:flex; align-items:center; gap:6px; margin-bottom:6px; }
.milestone-lesson-label { font-weight:700; font-size:0.7rem; }
.milestone-lesson-text { font-weight:500; font-size:0.72rem; line-height:1.6; font-style:italic; }
.stories-flashcard-btn { background:none; border:none; font-size:1rem; color:var(--accent); cursor:pointer; padding:6px 10px; border-radius:8px; }
.stories-flashcard-btn:hover { background:var(--surface-hover); }

/* ─── Tafseer Detail Tabs ─── */
.tafseer-detail-tabs { display:flex; gap:2px; padding:6px 8px 0; overflow-x:auto; }
.tafseer-detail-tab { flex-shrink:0; padding:6px 10px; border:none; background:transparent; font-size:0.65rem; font-weight:600; color:var(--text-muted); cursor:pointer; border-radius:8px 8px 0 0; display:flex; align-items:center; gap:4px; transition:all 0.12s; }
.tafseer-detail-tab.active { background:var(--card-bg); color:var(--accent); box-shadow:0 -1px 3px rgba(0,0,0,0.05); }
.tafseer-detail-tab:hover:not(.active) { background:var(--surface-hover); }
.tafseer-detail-tab i { font-size:0.6rem; }

/* ─── Stories Manager ─── */
.stories-manager { margin-top:20px; padding-top:16px; border-top:2px solid var(--border-color); }
.story-manage-item { border-radius:12px; border:1px solid var(--card-border); background:var(--card-bg); padding:12px; margin-bottom:10px; display:flex; align-items:center; gap:10px; }
.story-manage-icon { width:36px; height:36px; border-radius:10px; background:var(--accent)18; color:var(--accent); display:flex; align-items:center; justify-content:center; flex-shrink:0; font-size:0.9rem; }
.story-manage-info { flex:1; min-width:0; }
.story-manage-title { font-weight:700; font-size:0.82rem; color:var(--title-color); }
.story-manage-cat { font-size:0.68rem; color:var(--text-muted); }
.story-manage-actions { display:flex; gap:4px; flex-shrink:0; }
.story-manage-actions button { width:32px; height:32px; border-radius:8px; border:none; background:var(--surface-alt); color:var(--text-muted); cursor:pointer; display:flex; align-items:center; justify-content:center; font-size:0.75rem; transition:all 0.12s; }
.story-manage-actions button:hover { background:var(--accent); color:#fff; }
.story-manage-actions .story-del-btn:hover { background:#e74c3c; color:#fff; }
.story-add-form { display:flex; gap:8px; margin-top:10px; flex-wrap:wrap; }
.story-add-form input { flex:1; min-width:120px; padding:8px 10px; border-radius:8px; border:1px solid var(--card-border); background:var(--card-bg); font-size:0.78rem; color:var(--text-color); }
.story-add-form button { padding:8px 16px; border-radius:8px; border:none; background:var(--accent); color:#fff; font-weight:600; font-size:0.78rem; cursor:pointer; }
.story-add-form button:hover { opacity:0.85; }

/* ─── Story Editor Modal ─── */
.story-edit-modal .modal-content { max-width:600px; max-height:90vh; overflow-y:auto; }
.story-edit-field { margin-bottom:12px; }
.story-edit-field label { display:block; font-weight:600; font-size:0.72rem; color:var(--text-muted); margin-bottom:4px; }
.story-edit-field input,.story-edit-field select,.story-edit-field textarea { width:100%; padding:8px 10px; border-radius:8px; border:1px solid var(--card-border); background:var(--card-bg); font-size:0.82rem; color:var(--text-color); }
.story-edit-field textarea { min-height:80px; resize:vertical; }
.story-edit-row-2 { display:grid; grid-template-columns:1fr 1fr; gap:10px; }
.story-block-item { border-radius:10px; border:1px solid var(--card-border); background:var(--surface-alt); padding:12px; margin-bottom:10px; }
.story-block-header { display:flex; align-items:center; justify-content:space-between; margin-bottom:8px; }
.story-block-header label { font-weight:700; font-size:0.72rem; color:var(--title-color); }
.story-block-remove { width:28px; height:28px; border-radius:6px; border:none; background:#e74c3c20; color:#e74c3c; cursor:pointer; display:flex; align-items:center; justify-content:center; font-size:0.7rem; }
.story-block-remove:hover { background:#e74c3c; color:#fff; }
.story-add-block-btn { padding:8px 14px; border-radius:8px; border:1px dashed var(--accent); background:transparent; color:var(--accent); font-size:0.75rem; font-weight:600; cursor:pointer; display:flex; align-items:center; gap:6px; margin-top:6px; }
.story-add-block-btn:hover { background:var(--accent)10; }
.story-edit-buttons { display:flex; gap:8px; margin-top:14px; }
.story-edit-buttons button { flex:1; padding:10px; border-radius:10px; border:none; font-weight:700; font-size:0.82rem; cursor:pointer; }
.story-save-btn { background:var(--accent); color:#fff; }
.story-cancel-btn { background:var(--surface-alt); color:var(--text-muted); }

/* --- Rawatib Prayer Widget --- */

.rawatib-widget {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
}
.rawatib-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.rawatib-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--title-color);
}
.rawatib-ring-container {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}
.rawatib-ring-text {
  position: absolute;
  font-size: 0.6rem;
  font-weight: 700;
  color: var(--text-muted);
}
.rawatib-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.rawatib-card {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 5px 8px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 10px;
  min-width: 100px;
  flex: 1;
  cursor: pointer;
  transition: opacity 0.15s ease;
}
.rawatib-card.done {
  cursor: default;
  opacity: 0.7;
  pointer-events: none;
}
.rawatib-card:not(.done):hover {
  border-color: var(--accent);
}
.rawatib-card-header {
  display: flex;
  align-items: center;
  gap: 3px;
  white-space: nowrap;
}
.rawatib-label {
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--title-color);
}
.rawatib-count {
  font-size: 0.6rem;
  color: var(--text-muted);
  margin-left: auto;
}

/* --- Skeleton Loading --- */
@keyframes skeletonPulse {
  0% { opacity: 0.3; }
  50% { opacity: 0.7; }
  100% { opacity: 0.3; }
}
#dashboardSections.syncing .dash-section > *:not(.skeleton-ready) {
  animation: skeletonPulse 1.4s ease-in-out infinite;
  background: var(--border);
  border-radius: 8px;
  color: transparent !important;
}
#dashboardSections.syncing .dash-section > * {
  pointer-events: none;
}
#dashboardSections.syncing .dash-section > * i,
#dashboardSections.syncing .dash-section > * svg,
#dashboardSections.syncing .dash-section > * img {
  opacity: 0;
}
