/* مقراة اتلوه باتقان - التصميم الرئيسي */

:root {
    --primary: #0d6e4f;
    --primary-dark: #094d38;
    --primary-light: #12a372;
    --accent: #c9a227;
    --accent-light: #e8c547;
    --bg: #f4f7f5;
    --surface: #ffffff;
    --text: #1a2e28;
    --text-muted: #5a7268;
    --border: #d4e4dc;
    --shadow: 0 4px 24px rgba(13, 110, 79, 0.08);
    --shadow-lg: 0 12px 40px rgba(13, 110, 79, 0.12);
    --radius: 12px;
    --radius-sm: 8px;
    --danger: #dc3545;
    --success: #198754;
    --warning: #ffc107;
    --info: #0dcaf0;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Tajawal', 'Segoe UI', Tahoma, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: var(--primary-light);
}

/* Layout */
.app-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 260px;
    background: linear-gradient(180deg, var(--primary-dark) 0%, var(--primary) 55%, #0a5c44 100%);
    color: #ffffff;
    padding: 1.5rem 0 10.5rem;
    position: fixed;
    top: 0;
    right: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 100;
    border-radius: 28px 0 0 28px;
    box-shadow: -4px 0 24px rgba(9, 77, 56, 0.25);
}

.sidebar-brand {
    padding: 0 1.5rem 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.16);
    margin-bottom: 1rem;
}

.sidebar-brand .logo-icon {
    width: 72px;
    height: 72px;
    margin-bottom: 0.65rem;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18);
}

.sidebar-brand .logo-icon .icon i {
    font-size: 1.85rem;
    color: #ffffff;
}

.sidebar-logo {
    width: 72px;
    height: 72px;
    object-fit: contain;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.96);
    padding: 6px;
    margin-bottom: 0.65rem;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.22);
}

.sidebar-brand h1 {
    font-size: 1.1rem;
    font-weight: 700;
    line-height: 1.4;
    color: #ffffff;
}

.sidebar-brand p {
    font-size: 0.78rem;
    color: rgba(255, 255, 255, 0.82);
    margin-top: 0.35rem;
}

.sidebar-nav {
    list-style: none;
    padding: 0 0.75rem;
}

.sidebar-nav li a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: rgba(255, 255, 255, 0.92);
    border-radius: var(--radius-sm);
    margin-bottom: 0.25rem;
    transition: all 0.2s;
    width: 100%;
    font-weight: 500;
}

.sidebar-nav li a:hover {
    background: rgba(255, 255, 255, 0.14);
    color: #ffffff;
}

.sidebar-nav li a.active {
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
    font-weight: 700;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.sidebar-nav li a .icon {
    width: 1.35rem;
    height: 1.35rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sidebar-nav li a .icon i {
    font-size: 1.05rem;
    line-height: 1;
    opacity: 0.95;
}

.sidebar-nav li a.active .icon i {
    opacity: 1;
}

.sidebar-nav-group {
    margin-bottom: 0.25rem;
}

.sidebar-nav-toggle {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.75rem 1rem;
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.92);
    border-radius: var(--radius-sm);
    font: inherit;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-align: right;
}

.sidebar-nav-toggle:hover,
.sidebar-nav-toggle.active {
    background: rgba(255, 255, 255, 0.14);
    color: #ffffff;
}

.sidebar-nav-toggle.active {
    font-weight: 700;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.sidebar-chevron {
    margin-right: auto;
    font-size: 0.75rem;
    opacity: 0.85;
    transition: transform 0.2s ease;
}

.sidebar-nav-group.is-open .sidebar-chevron {
    transform: rotate(180deg);
}

.sidebar-subnav {
    list-style: none;
    margin: 0.15rem 0 0.35rem;
    padding: 0 0.35rem 0 0;
    display: none;
}

.sidebar-nav-group.is-open .sidebar-subnav {
    display: block;
}

.sidebar-subnav li a {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 0.85rem 0.55rem 1rem;
    margin-bottom: 0.15rem;
    margin-right: 0.65rem;
    border-radius: var(--radius-sm);
    color: rgba(255, 255, 255, 0.82);
    font-size: 0.88rem;
    font-weight: 500;
    transition: all 0.2s;
}

.sidebar-subnav li a:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

.sidebar-subnav li a.active {
    background: rgba(255, 255, 255, 0.16);
    color: #ffffff;
    font-weight: 600;
}

.sidebar-footer {
    position: absolute;
    bottom: 0;
    right: 0;
    left: 0;
    padding: 1rem 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.16);
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.9);
    background: rgba(0, 0, 0, 0.08);
}

.sidebar-footer a {
    color: rgba(255, 255, 255, 0.88);
}

.sidebar-footer a:hover {
    color: #ffffff;
}

.sidebar-logout {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.88);
    margin-top: 0.35rem;
}

.sidebar-logout .icon {
    width: 1rem;
    height: 1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.sidebar-logout .icon i {
    font-size: 0.95rem;
}

.sidebar-logout:hover {
    color: #ffffff;
}

.sidebar-account-link {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.88);
    margin: 0.35rem 0;
    padding: 0.35rem 0;
}

.sidebar-account-link:hover,
.sidebar-account-link.active {
    color: #ffffff;
}

.sidebar-account-link .icon i {
    font-size: 0.95rem;
}

.developer-credit {
    margin: 0.65rem 0 0.5rem;
    font-size: 0.78rem;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.72);
}

.developer-credit-label {
    display: block;
    margin-bottom: 0.1rem;
}

.developer-credit-link {
    color: #ffffff;
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 3px;
    transition: color 0.2s, opacity 0.2s;
}

.developer-credit-link:hover {
    color: var(--accent-light);
}

.developer-credit-light {
    color: #64748b;
}

.developer-credit-light .developer-credit-link {
    color: var(--primary);
}

.developer-credit-light .developer-credit-link:hover {
    color: var(--primary-light);
}

.sidebar-nav li a:hover,
.sidebar-nav li a.active {
    color: #ffffff;
}

.main-content {
    margin-right: 260px;
    flex: 1;
    padding: 2rem;
    min-height: 100vh;
}

/* Page header */
.page-header {
    margin-bottom: 2rem;
}

.page-header h2 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary-dark);
}

.page-header p {
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* Cards */
.card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    overflow: hidden;
}

.card-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.card-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
}

.card-body {
    padding: 1.5rem;
}

/* Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    background: rgba(13, 110, 79, 0.1);
    color: var(--primary);
}

.stat-icon.gold {
    background: rgba(201, 162, 39, 0.15);
    color: var(--accent);
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary-dark);
    line-height: 1;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.6rem 1.25rem;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-light);
    color: white;
}

.btn-accent {
    background: var(--accent);
    color: var(--text);
}

.btn-accent:hover {
    background: var(--accent-light);
    color: var(--text);
}

.btn-outline {
    background: transparent;
    border: 1.5px solid var(--primary);
    color: var(--primary);
}

.btn-outline:hover {
    background: var(--primary);
    color: white;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-whatsapp {
    background: #25d366;
    color: white;
}

.btn-whatsapp:hover {
    background: #1ebe57;
    color: white;
}

.btn-sm {
    padding: 0.4rem 0.85rem;
    font-size: 0.85rem;
}

.btn-lg {
    padding: 0.85rem 1.75rem;
    font-size: 1.05rem;
}

/* Forms */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.4rem;
    color: var(--text);
}

.form-control {
    width: 100%;
    padding: 0.65rem 0.9rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.95rem;
    background: var(--surface);
    color: var(--text);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(13, 110, 79, 0.15);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
}

.form-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.phone-input-wrap {
    display: flex;
    align-items: stretch;
    gap: 0.5rem;
}

.phone-dial-prefix {
    display: inline-flex;
    align-items: center;
    padding: 0.45rem 0.65rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text-muted);
    font-size: 0.9rem;
    white-space: nowrap;
    min-width: 4.5rem;
    justify-content: center;
}

.phone-local-input {
    flex: 1;
    min-width: 0;
}

.student-delete-card {
    margin-top: 1.25rem;
    border-color: rgba(220, 53, 69, 0.35);
}

.student-delete-card .card-header h3 {
    color: var(--danger);
    font-size: 1rem;
}

.country-search-input {
    margin-bottom: 0.35rem;
}

.country-select-expanded {
    height: auto;
    min-height: 2.4rem;
}

select.form-control {
    cursor: pointer;
}

textarea.form-control {
    resize: vertical;
    min-height: 80px;
}

/* Radio / checkbox groups */
.radio-group, .checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.radio-item, .checkbox-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 1rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
}

.radio-item:hover, .checkbox-item:hover {
    border-color: var(--primary);
    background: rgba(13, 110, 79, 0.04);
}

.radio-item input:checked + span,
.checkbox-item input:checked + span {
    color: var(--primary);
    font-weight: 600;
}

.radio-item:has(input:checked),
.checkbox-item:has(input:checked) {
    border-color: var(--primary);
    background: rgba(13, 110, 79, 0.08);
}

/* Tables */
.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

table th,
table td {
    padding: 0.85rem 1rem;
    text-align: right;
    border-bottom: 1px solid var(--border);
}

table th {
    background: rgba(13, 110, 79, 0.06);
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--primary-dark);
}

table tr:hover td {
    background: rgba(13, 110, 79, 0.03);
}

/* Badges */
.badge {
    display: inline-block;
    padding: 0.25rem 0.65rem;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 600;
}

.badge-hifz {
    background: rgba(13, 110, 79, 0.12);
    color: var(--primary);
}

.badge-tilawa {
    background: rgba(201, 162, 39, 0.15);
    color: #8a6d10;
}

.badge-both {
    background: rgba(13, 110, 79, 0.12);
    color: var(--primary);
}

/* Performance bar */
.perf-bar {
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
    min-width: 80px;
}

.perf-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.3s;
}

.perf-fill.excellent { background: #198754; }
.perf-fill.good { background: #20c997; }
.perf-fill.average { background: #ffc107; }
.perf-fill.poor { background: #dc3545; }

/* Alerts */
.alert {
    padding: 0.85rem 1.15rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.alert-success { background: #d1e7dd; color: #0f5132; border: 1px solid #badbcc; }
.alert-danger { background: #f8d7da; color: #842029; border: 1px solid #f5c2c7; }
.alert-warning { background: #fff3cd; color: #664d03; border: 1px solid #ffecb5; }
.alert-info { background: #cff4fc; color: #055160; border: 1px solid #b6effb; }

/* Login page — see login.css */

/* Student cards grid */
.students-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.25rem;
}

.student-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    transition: transform 0.2s, box-shadow 0.2s;
}

.student-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.student-card h4 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.student-card .meta {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.student-card .actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* Lesson section */
.lesson-section {
    border: 2px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
    overflow: hidden;
}

.lesson-section.hifz { border-color: rgba(13, 110, 79, 0.4); }
.lesson-section.tilawa { border-color: rgba(201, 162, 39, 0.5); }

.lesson-section-header {
    padding: 1rem 1.25rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.lesson-section.hifz .lesson-section-header {
    background: rgba(13, 110, 79, 0.08);
    color: var(--primary-dark);
}

.lesson-section.tilawa .lesson-section-header {
    background: rgba(201, 162, 39, 0.12);
    color: #7a6110;
}

.lesson-section-body {
    padding: 1.25rem;
}

/* آخر تسميع */
.last-lesson-banner {
    background: linear-gradient(135deg, rgba(13, 110, 79, 0.06) 0%, rgba(201, 162, 39, 0.08) 100%);
    border: 1.5px dashed var(--primary);
    border-radius: var(--radius-sm);
    padding: 1rem 1.15rem;
    margin-bottom: 1.25rem;
}

.lesson-section.tilawa .last-lesson-banner {
    border-color: var(--accent);
    background: linear-gradient(135deg, rgba(201, 162, 39, 0.1) 0%, rgba(201, 162, 39, 0.04) 100%);
}

.last-lesson-title {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--primary-dark);
    margin-bottom: 0;
}

.last-lesson-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 0.5rem;
}

.lesson-section.tilawa .last-lesson-title {
    color: #7a6110;
}

.last-lesson-details {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 1.25rem;
    font-size: 0.92rem;
    align-items: center;
}

.last-lesson-surah {
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--primary);
}

.lesson-section.tilawa .last-lesson-surah {
    color: #8a6d10;
}

.last-lesson-date {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.last-lesson-perf {
    font-size: 0.88rem;
}

.last-lesson-notes {
    margin-top: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    font-style: italic;
}

.last-lesson-empty {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin: 0;
}

/* المصحف التفاعلي */
.mushaf-panel {
    background: var(--surface);
    border: 2px solid var(--primary);
    border-radius: var(--radius);
    padding: 1.15rem;
    margin-bottom: 1.25rem;
    box-shadow: var(--shadow);
}

.lesson-section.tilawa .mushaf-panel {
    border-color: var(--accent);
}

.mushaf-direction-banner {
    background: rgba(13, 110, 79, 0.1);
    border: 1px solid rgba(13, 110, 79, 0.25);
    border-radius: var(--radius-sm);
    padding: 0.65rem 0.9rem;
    margin-bottom: 0.75rem;
    font-size: 0.88rem;
    line-height: 1.55;
    color: var(--primary-dark);
}

.mushaf-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 1rem;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
}

.mushaf-nav {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.mushaf-page-info {
    font-size: 0.95rem;
    min-width: 100px;
    text-align: center;
}

.mushaf-jump {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.mushaf-jump .form-control-sm {
    width: 90px;
    padding: 0.35rem 0.5rem;
    font-size: 0.85rem;
}

.mushaf-jump select.form-control-sm {
    width: 150px;
}

.mushaf-jump .btn-goto-ayah {
    white-space: nowrap;
    font-size: 0.85rem;
}

.mushaf-select-btns {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.mushaf-search-bar {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 0.75rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
}

.mushaf-word-search-input {
    flex: 1;
    min-width: 180px;
    font-family: 'Amiri', serif;
    font-size: 1rem;
    direction: rtl;
}

.mushaf-search-results {
    margin-bottom: 0.75rem;
    border: 1px solid rgba(13, 110, 253, 0.25);
    border-radius: var(--radius-sm);
    background: rgba(13, 110, 253, 0.04);
    max-height: 220px;
    overflow-y: auto;
}

.mushaf-search-results.hidden {
    display: none;
}

.mushaf-search-results-header {
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    border-bottom: 1px solid rgba(13, 110, 253, 0.15);
    position: sticky;
    top: 0;
    background: rgba(248, 250, 252, 0.95);
}

.mushaf-search-results-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.mushaf-search-result-item {
    width: 100%;
    text-align: right;
    border: none;
    border-bottom: 1px solid rgba(13, 110, 253, 0.1);
    background: transparent;
    padding: 0.55rem 0.75rem;
    cursor: pointer;
    font-family: 'Amiri', serif;
    font-size: 1.05rem;
    line-height: 1.6;
    direction: rtl;
}

.mushaf-search-result-item:hover {
    background: rgba(13, 110, 253, 0.1);
}

.mushaf-search-result-item:last-child {
    border-bottom: none;
}

.mushaf-search-result-meta {
    display: block;
    font-family: inherit;
    font-size: 0.8rem;
    color: var(--primary-dark);
    font-weight: 700;
    margin-bottom: 0.15rem;
}

.mushaf-search-results-empty {
    padding: 0.75rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.mushaf-word.is-search-word {
    background: rgba(13, 110, 253, 0.28);
    box-shadow: inset 0 -2px 0 #0d6efd;
    border-radius: 3px;
}

.mushaf-range-display {
    background: rgba(13, 110, 79, 0.08);
    border-radius: var(--radius-sm);
    padding: 0.65rem 1rem;
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
    color: var(--primary-dark);
}

.mushaf-range-display.is-set {
    background: rgba(25, 135, 84, 0.12);
    border: 1px solid rgba(25, 135, 84, 0.3);
}

.lesson-section.tilawa .mushaf-range-display {
    background: rgba(201, 162, 39, 0.1);
    color: #7a6110;
}

.lesson-section.tilawa .mushaf-range-display.is-set {
    background: rgba(201, 162, 39, 0.15);
    border-color: rgba(201, 162, 39, 0.35);
}

.mushaf-page-wrap {
    background: #faf8f3;
    border: 1px solid #d4c4a8;
    border-radius: var(--radius-sm);
    padding: 1.5rem 2rem;
    max-height: 480px;
    overflow-y: auto;
    box-shadow: inset 0 0 20px rgba(0,0,0,0.03);
}

.mushaf-page-content {
    font-family: 'Amiri', 'Traditional Arabic', serif;
    font-size: 1.55rem;
    line-height: 2.4;
    text-align: justify;
    color: #1a1a1a;
    direction: rtl;
}

.mushaf-surah-header {
    text-align: center;
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--primary-dark);
    margin: 1rem 0 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(13, 110, 79, 0.2);
    font-family: 'Tajawal', sans-serif;
}

.mushaf-surah-header:first-child {
    margin-top: 0;
}

.mushaf-ayah-span {
    cursor: pointer;
    border-radius: 4px;
    padding: 0 2px;
    transition: background 0.15s;
}

.mushaf-ayah-span:hover {
    background: rgba(13, 110, 79, 0.1);
}

.ayah-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: 'Amiri', serif;
    font-size: 0.85em;
    color: var(--primary);
    margin: 0 0.15rem;
}

.mushaf-ayah-span.is-last-marker {
    background: rgba(108, 117, 125, 0.2);
    box-shadow: inset 0 -2px 0 #6c757d;
}

.mushaf-ayah-span.is-start-marker {
    background: rgba(13, 110, 79, 0.15);
    box-shadow: inset 0 -3px 0 var(--primary-light);
}

.mushaf-ayah-span.is-end-marker {
    background: rgba(13, 110, 79, 0.25);
    box-shadow: inset 0 -3px 0 var(--primary-dark);
}

.mushaf-ayah-span.is-in-range {
    background: rgba(13, 110, 79, 0.08);
}

.mushaf-word {
    cursor: context-menu;
}

.mushaf-word.is-forgot {
    background: rgba(217, 119, 6, 0.22);
    box-shadow: inset 0 -2px 0 #d97706;
    border-radius: 3px;
}

.mushaf-ayah-span.is-ayah-forgot {
    background: rgba(217, 119, 6, 0.12);
    box-shadow: inset 0 -2px 0 #d97706;
}

.mushaf-mistake-item.is-forgot {
    border-color: rgba(217, 119, 6, 0.35);
    background: rgba(217, 119, 6, 0.04);
}

.mushaf-mistake-category {
    display: inline-block;
    font-family: 'Tajawal', sans-serif;
    font-size: 0.75rem;
    font-weight: 700;
    margin-left: 0.35rem;
}

.mushaf-mistake-category-error {
    color: #b02a37;
}

.mushaf-mistake-category-forgot {
    color: #92400e;
}

.lesson-mistakes-badges {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.lesson-mistakes-badge-forgot {
    background: rgba(217, 119, 6, 0.12);
    color: #92400e;
}

.lesson-mistake-category {
    display: inline-block;
    font-family: 'Tajawal', sans-serif;
    font-size: 0.75rem;
    font-weight: 700;
    margin-left: 0.35rem;
}

.lesson-mistake-category-error {
    color: #b02a37;
}

.lesson-mistake-category-forgot {
    color: #92400e;
}

.mushaf-word.is-mistake {
    background: rgba(220, 53, 69, 0.22);
    box-shadow: inset 0 -2px 0 #dc3545;
    border-radius: 3px;
}

.mushaf-ayah-span.is-ayah-mistake {
    background: rgba(220, 53, 69, 0.12);
    box-shadow: inset 0 -2px 0 #dc3545;
}

.mushaf-ayah-span.is-search-highlight {
    background: rgba(13, 110, 253, 0.2);
    box-shadow: 0 0 0 2px rgba(13, 110, 253, 0.45);
    border-radius: 4px;
    transition: background 0.4s ease, box-shadow 0.4s ease;
}

.mushaf-mistakes-panel {
    margin: 0.75rem 0 1rem;
    padding: 0.85rem 1rem;
    border: 1px solid rgba(220, 53, 69, 0.25);
    border-radius: var(--radius-sm);
    background: rgba(220, 53, 69, 0.04);
}

.mushaf-mistakes-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.mushaf-mistakes-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.5rem;
    height: 1.5rem;
    padding: 0 0.35rem;
    border-radius: 999px;
    background: #dc3545;
    color: #fff;
    font-size: 0.8rem;
    font-weight: 700;
}

.mushaf-mistakes-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.mushaf-mistake-item {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.35rem 0.5rem;
    padding: 0.35rem 0.5rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
}

.mushaf-mistake-tajweed-hint {
    display: block;
    width: 100%;
    font-size: 0.82rem;
    color: var(--color-primary, #1a6b4a);
    opacity: 0.9;
    padding-right: 0.15rem;
}

.mushaf-mistake-note {
    display: block;
    width: 100%;
    font-size: 0.8rem;
    color: #b45309;
    line-height: 1.45;
    padding: 0.2rem 0.35rem 0.1rem;
    margin-top: 0.1rem;
    border-right: 3px solid rgba(180, 83, 9, 0.45);
}

.mushaf-tajweed-hint {
    margin: 0.5rem 0 0;
    padding: 0.45rem 0.6rem;
    border-radius: var(--radius-sm);
    font-size: 0.84rem;
    line-height: 1.5;
}

.mushaf-tajweed-hint.is-info {
    background: rgba(26, 107, 74, 0.08);
    color: var(--color-primary, #1a6b4a);
    border: 1px solid rgba(26, 107, 74, 0.18);
}

.mushaf-tajweed-hint.is-warn {
    background: rgba(180, 83, 9, 0.1);
    color: #92400e;
    border: 1px solid rgba(180, 83, 9, 0.25);
}

.mushaf-tajweed-hint.is-success {
    background: rgba(26, 107, 74, 0.12);
    color: #145a32;
    border: 1px solid rgba(26, 107, 74, 0.28);
    font-weight: 600;
}

.mushaf-marking-help {
    margin: 0.5rem 0 0.25rem;
    padding: 0.35rem 0.55rem;
    border: 1px dashed var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    color: var(--text-muted);
}

.mushaf-marking-help summary {
    cursor: pointer;
    font-weight: 600;
    color: var(--text);
}

.mushaf-marking-help ul {
    margin: 0.35rem 0 0;
    padding-right: 1.1rem;
    line-height: 1.55;
}

.lesson-mistake-tajweed {
    display: block;
    font-size: 0.85rem;
    color: var(--color-primary, #1a6b4a);
    margin-top: 0.15rem;
}

.mushaf-mistake-text {
    font-family: 'Amiri', serif;
    line-height: 1.5;
}

.lesson-mistakes-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    background: rgba(220, 53, 69, 0.12);
    color: #b02a37;
    font-size: 0.82rem;
    font-weight: 600;
}

.lesson-mistakes-list {
    margin: 0.35rem 0 0;
    padding: 0;
    list-style: none;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.lesson-mistakes-list li {
    padding: 0.15rem 0;
    font-family: 'Amiri', serif;
}

.mushaf-ayah-span.is-rub-start {
    background: linear-gradient(90deg, rgba(217, 119, 6, 0.16), rgba(217, 119, 6, 0.04));
    box-shadow: inset 4px 0 0 #d97706;
}

.mushaf-ayah-span.is-rub-end {
    background: linear-gradient(270deg, rgba(99, 102, 241, 0.16), rgba(99, 102, 241, 0.04));
    box-shadow: inset -4px 0 0 #6366f1;
}

.mushaf-ayah-span.is-rub-start.is-in-range {
    background: linear-gradient(90deg, rgba(217, 119, 6, 0.22), rgba(13, 110, 79, 0.1));
}

.mushaf-ayah-span.is-rub-end.is-in-range {
    background: linear-gradient(270deg, rgba(99, 102, 241, 0.22), rgba(13, 110, 79, 0.1));
}

.rub-edge-tag {
    display: inline-block;
    font-family: 'Tajawal', sans-serif;
    font-size: 0.62rem;
    font-weight: 700;
    padding: 0.1rem 0.35rem;
    border-radius: 4px;
    margin: 0 0.25rem;
    vertical-align: middle;
    white-space: nowrap;
}

.rub-edge-tag.rub-start {
    background: rgba(217, 119, 6, 0.2);
    color: #92400e;
    border: 1px solid rgba(217, 119, 6, 0.45);
}

.rub-edge-tag.rub-end {
    background: rgba(99, 102, 241, 0.18);
    color: #3730a3;
    border: 1px solid rgba(99, 102, 241, 0.4);
}

.mushaf-rub-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 1.25rem;
    margin: 0 0 0.75rem;
    font-size: 0.82rem;
    color: var(--text-muted);
}

.rub-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.rub-legend-item i {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 3px;
}

.rub-legend-item.start i {
    background: rgba(217, 119, 6, 0.25);
    box-shadow: inset 3px 0 0 #d97706;
}

.rub-legend-item.end i {
    background: rgba(99, 102, 241, 0.2);
    box-shadow: inset -3px 0 0 #6366f1;
}

.mushaf-tafsir-hint {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin: 0.35rem 0 0.75rem;
    padding: 0.45rem 0.75rem;
    background: rgba(99, 102, 241, 0.06);
    border-radius: var(--radius-sm);
    border: 1px dashed rgba(99, 102, 241, 0.25);
}

.tafsir-tooltip {
    position: fixed;
    z-index: 9999;
    max-width: min(380px, calc(100vw - 24px));
    max-height: min(280px, calc(100vh - 24px));
    overflow-y: auto;
    background: #1e1b4b;
    color: #f8fafc;
    border-radius: 12px;
    padding: 0.85rem 1rem;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.12);
    pointer-events: none;
}

.tafsir-tooltip.hidden {
    display: none;
}

.tafsir-tooltip-title {
    font-size: 0.82rem;
    font-weight: 700;
    color: #fcd34d;
    margin-bottom: 0.5rem;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.tafsir-tooltip-text {
    font-size: 0.88rem;
    line-height: 1.75;
    font-family: 'Tajawal', sans-serif;
}

.tafsir-tooltip-loading,
.tafsir-tooltip-error {
    font-size: 0.88rem;
    color: rgba(248, 250, 252, 0.85);
}

.tafsir-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.tafsir-modal.hidden {
    display: none;
}

.tafsir-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(4px);
}

.tafsir-modal-box {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 560px;
    max-height: min(80vh, 640px);
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.tafsir-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.25rem;
    background: linear-gradient(135deg, #312e81, #4338ca);
    color: #fff;
}

.tafsir-modal-title {
    font-size: 1rem;
    font-weight: 700;
    margin: 0;
}

.tafsir-modal-close {
    border: none;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 1.35rem;
    line-height: 1;
    cursor: pointer;
    flex-shrink: 0;
}

.tafsir-modal-close:hover {
    background: rgba(255, 255, 255, 0.25);
}

.tafsir-modal-body {
    padding: 1.25rem;
    overflow-y: auto;
    font-size: 1rem;
    line-height: 1.9;
    color: #334155;
}

.tafsir-modal-footer {
    padding: 0.65rem 1.25rem;
    font-size: 0.78rem;
    color: #64748b;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    text-align: center;
}

body.tafsir-modal-open {
    overflow: hidden;
}

.mushaf-word-menu {
    position: fixed;
    z-index: 12050;
    min-width: 9.5rem;
    padding: 0.35rem;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.18);
}

.mushaf-word-menu.hidden {
    display: none;
}

.mushaf-word-menu-item {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    width: 100%;
    padding: 0.5rem 0.65rem;
    border: none;
    border-radius: calc(var(--radius-sm) - 2px);
    background: transparent;
    color: var(--text);
    font: inherit;
    font-size: 0.92rem;
    text-align: right;
    cursor: pointer;
}

.mushaf-word-menu-item:hover {
    background: var(--bg);
}

.mushaf-word-menu-item.is-active {
    font-weight: 700;
}

.mushaf-word-menu-item.is-error.is-active {
    background: rgba(220, 53, 69, 0.1);
    color: #b02a37;
}

.mushaf-word-menu-item.is-forgot.is-active {
    background: rgba(217, 119, 6, 0.12);
    color: #92400e;
}

.mushaf-word-menu-item.is-tafsir:hover {
    background: rgba(26, 107, 74, 0.08);
    color: var(--color-primary, #1a6b4a);
}

.mushaf-word-menu-icon {
    width: 1.25rem;
    text-align: center;
    flex-shrink: 0;
}

.range-summary {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.85rem 1rem;
    margin-bottom: 1rem;
    font-size: 0.92rem;
}

.repeat-card {
    border: 2px solid #dc3545;
    box-shadow: 0 4px 20px rgba(220, 53, 69, 0.15);
}

.whatsapp-notify-card {
    border: 2px solid #25d366;
    box-shadow: 0 4px 20px rgba(37, 211, 102, 0.15);
}

.whatsapp-notify-card .card-header {
    background: rgba(37, 211, 102, 0.12);
    color: #128c7e;
}

.whatsapp-notify-body {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.whatsapp-notify-hint {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.whatsapp-notify-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: rgba(37, 211, 102, 0.04);
}

.whatsapp-notify-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.whatsapp-notify-lesson-line {
    width: 100%;
    margin-top: 0.35rem;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.whatsapp-mistakes-preview {
    width: 100%;
    margin-top: 0.25rem;
    margin-bottom: 0.25rem;
    padding-right: 0.5rem;
    border-right: 2px solid rgba(220, 53, 69, 0.25);
}

.whatsapp-notify-combined {
    border-color: rgba(37, 211, 102, 0.35);
}

.repeat-card .card-header {
    background: #f8d7da;
    color: #842029;
}

.repeat-threshold-badge {
    font-size: 0.78rem;
    background: rgba(220, 53, 69, 0.15);
    padding: 0.25rem 0.65rem;
    border-radius: 20px;
}

.repeat-card-body {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.celebration-panel {
    border: 2px solid rgba(201, 162, 39, 0.4);
    box-shadow: 0 4px 20px rgba(201, 162, 39, 0.12);
}

.celebration-panel .card-header {
    background: rgba(201, 162, 39, 0.12);
    color: #7a5f0d;
}

.celebration-panel-body {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.celebration-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    padding: 0.75rem 1rem;
    border: 1px solid rgba(201, 162, 39, 0.25);
    border-radius: var(--radius-sm);
    background: rgba(201, 162, 39, 0.05);
}

.repeat-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    padding: 0.85rem 1rem;
    background: rgba(220, 53, 69, 0.05);
    border-radius: var(--radius-sm);
    border: 1px solid rgba(220, 53, 69, 0.15);
}

.repeat-item-info {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.65rem;
}

.repeat-score.poor-score {
    background: #dc3545;
    color: white;
    padding: 0.15rem 0.55rem;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 700;
}

.student-card-needs-repeat {
    border: 2px solid rgba(220, 53, 69, 0.4);
}

.repeat-tag {
    display: inline-block;
    background: #dc3545;
    color: white;
    font-size: 0.75rem;
    padding: 0.15rem 0.5rem;
    border-radius: 10px;
    margin-top: 0.35rem;
}

.test-reminder-tag {
    display: inline-block;
    font-size: 0.75rem;
    padding: 0.15rem 0.5rem;
    border-radius: 10px;
    margin-top: 0.35rem;
}

.test-reminder-tag.due {
    background: var(--accent);
    color: var(--text);
}

.test-reminder-tag.soon {
    background: rgba(255, 193, 7, 0.25);
    color: #856404;
    border: 1px solid rgba(255, 193, 7, 0.5);
}

.test-overdue {
    color: #dc3545;
    font-weight: 600;
}

.test-reminder-card {
    border: 2px solid rgba(201, 162, 39, 0.45);
}

.test-reminder-card.due {
    border-color: rgba(201, 162, 39, 0.65);
    background: rgba(201, 162, 39, 0.08);
}

.test-reminder-card.soon {
    border-color: rgba(255, 193, 7, 0.5);
    background: rgba(255, 193, 7, 0.08);
}

.test-reminder-body {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.test-reminder-icon {
    font-size: 1.75rem;
}

.test-reminder-content {
    flex: 1;
    min-width: 200px;
}

.test-reminder-content p {
    margin: 0.35rem 0 0;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.test-reminders-panel {
    border: 2px solid rgba(201, 162, 39, 0.4);
}

.test-reminders-panel .card-header {
    background: rgba(201, 162, 39, 0.1);
}

.test-reminders-list {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.test-reminder-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.test-reminder-row.due {
    border-color: rgba(201, 162, 39, 0.45);
    background: rgba(201, 162, 39, 0.06);
}

.test-reminder-row.soon {
    border-color: rgba(255, 193, 7, 0.45);
    background: rgba(255, 193, 7, 0.06);
}

.test-reminder-row-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.test-reminder-row-actions,
.test-reminder-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
}

.sidebar-badge {
    margin-right: auto;
    min-width: 1.35rem;
    height: 1.35rem;
    padding: 0 0.35rem;
    border-radius: 999px;
    background: var(--accent);
    color: var(--text);
    font-size: 0.72rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.sidebar-version {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.62);
    margin: 0.25rem 0 0.5rem;
}

.tasmee3-choice-card {
    border: 2px solid var(--primary);
}

.tasmee3-choice-body {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.tasmee3-choice {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    padding: 1rem 1.15rem;
    border-radius: var(--radius-sm);
    border: 1.5px solid var(--border);
}

.tasmee3-choice.repeat {
    background: rgba(220, 53, 69, 0.06);
    border-color: rgba(220, 53, 69, 0.35);
}

.tasmee3-choice.normal {
    background: rgba(13, 110, 79, 0.06);
    border-color: rgba(13, 110, 79, 0.25);
}

.tasmee3-choice p {
    margin: 0.35rem 0 0;
    font-size: 0.88rem;
    color: var(--text-muted);
}

.repeat-mode-banner {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem 1.25rem;
    padding: 0.85rem 1.15rem;
    border-radius: var(--radius-sm);
    font-size: 0.92rem;
}

.repeat-mode-banner.hifz {
    background: rgba(220, 53, 69, 0.1);
    border: 1.5px solid rgba(220, 53, 69, 0.35);
    color: #842029;
}

.repeat-mode-banner.tilawa {
    background: rgba(201, 162, 39, 0.15);
    border: 1.5px solid rgba(201, 162, 39, 0.4);
    color: #664d03;
}

.repeat-alert {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    background: #f8d7da;
    border: 1.5px solid #f5c2c7;
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    margin-bottom: 1.25rem;
    color: #842029;
}

.repeat-alert p {
    margin: 0.25rem 0 0;
    font-size: 0.9rem;
}

.repeat-alert.tilawa {
    background: #fff3cd;
    border-color: #ffecb5;
    color: #664d03;
}

.lesson-actions {
    display: flex;
    gap: 0.35rem;
    flex-wrap: wrap;
    align-items: center;
}

.lesson-actions form {
    display: inline;
}

tr.row-needs-repeat td {
    background: rgba(220, 53, 69, 0.04);
}

.quran-loading, .quran-error {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
}

.quran-error {
    color: var(--danger);
}

/* Auto datetime display */
.datetime-display {
    background: linear-gradient(135deg, rgba(13, 110, 79, 0.08) 0%, rgba(201, 162, 39, 0.08) 100%);
    border-radius: var(--radius);
    padding: 1.25rem;
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
    border: 1px solid var(--border);
}

.datetime-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.datetime-item .label {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.datetime-item .value {
    font-weight: 600;
    font-size: 1.05rem;
    color: var(--primary-dark);
}

.clock-hijri {
    display: block;
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-top: 0.2rem;
}

/* Search bar */
.search-bar {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.search-bar .form-control {
    max-width: 320px;
}

/* Performance slider */
.perf-slider-wrap {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.perf-slider {
    flex: 1;
    accent-color: var(--primary);
}

.perf-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
    min-width: 50px;
    text-align: center;
}

.perf-slider.perf-auto {
    pointer-events: none;
    opacity: 0.75;
}

.perf-auto-wrap + .form-hint {
    margin-top: 0.35rem;
    font-size: 0.85rem;
}

/* Hidden sections (JS toggle) */
.hidden { display: none !important; }

/* System / backup page */
.system-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.25rem;
    margin-bottom: 1rem;
}

.system-card .card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.sync-badge {
    font-size: 0.78rem;
    padding: 0.25rem 0.65rem;
    border-radius: 20px;
    background: rgba(13, 110, 79, 0.12);
    color: var(--primary-dark);
}

.sync-badge.synced {
    background: rgba(25, 135, 84, 0.15);
    color: var(--success);
}

.sync-badge.error {
    background: rgba(220, 53, 69, 0.12);
    color: var(--danger);
}

.server-clock-body {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.server-clock-display {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.85rem;
}

.clock-block {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.85rem 1rem;
    text-align: center;
}

.clock-block.main {
    background: linear-gradient(135deg, rgba(13, 110, 79, 0.08), rgba(201, 162, 39, 0.08));
    border-color: rgba(13, 110, 79, 0.25);
}

.clock-label {
    display: block;
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-bottom: 0.35rem;
}

.clock-value {
    display: block;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text);
}

.clock-value.time {
    font-size: 1.75rem;
    font-variant-numeric: tabular-nums;
    color: var(--primary-dark);
}

.clock-compare {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem 1.5rem;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.system-hint {
    font-size: 0.85rem;
    margin: 0;
}

.version-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.65rem 0;
    border-bottom: 1px dashed var(--border);
}

.version-row:last-of-type {
    border-bottom: none;
    margin-bottom: 0.75rem;
}

.version-tag {
    padding: 0.2rem 0.65rem;
    border-radius: 20px;
    font-size: 0.9rem;
}

.version-tag.current {
    background: rgba(13, 110, 79, 0.12);
    color: var(--primary-dark);
}

.version-tag.next {
    background: rgba(201, 162, 39, 0.2);
    color: #664d03;
}

.countdown-wrap {
    margin-top: 0.5rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
}

.countdown-title {
    text-align: center;
    font-weight: 700;
    margin-bottom: 0.85rem;
    color: var(--primary-dark);
}

.countdown-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.65rem;
}

.countdown-unit {
    background: var(--bg);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.75rem 0.5rem;
    text-align: center;
}

.countdown-num {
    display: block;
    font-size: 1.6rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--primary);
    line-height: 1.2;
}

.countdown-label {
    display: block;
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.countdown-sub {
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 0.85rem;
    margin-bottom: 0;
}

.db-info-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
}

.stat-pill {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 0.4rem 0.85rem;
    font-size: 0.88rem;
}

.stat-pill strong {
    color: var(--primary-dark);
}

.system-path {
    font-size: 0.82rem;
    word-break: break-all;
    margin-bottom: 1rem;
}

.backup-upload-card {
    margin-bottom: 1.25rem;
    padding: 1rem 1.1rem;
    border: 1px dashed rgba(13, 110, 79, 0.35);
    border-radius: var(--radius);
    background: rgba(13, 110, 79, 0.04);
}

.backup-upload-card h4 {
    margin: 0 0 0.5rem;
    font-size: 1rem;
}

.backup-upload-hint {
    margin: 0 0 0.85rem;
    font-size: 0.9rem;
}

.backup-upload-form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-width: 520px;
}

.backup-upload-restore-check,
.backup-upload-confirm {
    display: flex;
    align-items: flex-start;
    gap: 0.45rem;
    font-size: 0.9rem;
    color: var(--text);
}

.badge-uploaded {
    background: rgba(37, 99, 235, 0.12);
    color: #1d4ed8;
    font-size: 0.72rem;
    margin-right: 0.35rem;
}

.restore-form {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin-right: 0.35rem;
}

.confirm-restore {
    font-size: 0.78rem;
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
}

.auto-backup-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.auto-backup-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
}

.toggle-label {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    cursor: pointer;
}

.schedule-status {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.schedule-status.active {
    color: var(--success);
}

.auto-backup-fields {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
}

.auto-backup-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem 2rem;
    font-size: 0.9rem;
    color: var(--text-muted);
    padding: 0.75rem 1rem;
    background: var(--bg);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.badge-auto {
    display: inline-block;
    font-size: 0.72rem;
    padding: 0.1rem 0.45rem;
    border-radius: 10px;
    background: rgba(13, 110, 79, 0.12);
    color: var(--primary-dark);
    margin-right: 0.35rem;
}

.actions-cell {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
}

.inline-form {
    display: inline-flex;
    align-items: center;
}

.btn-delete {
    color: var(--danger);
    border-color: rgba(220, 53, 69, 0.45);
}

.btn-delete:hover {
    background: rgba(220, 53, 69, 0.08);
    color: var(--danger);
}

.reset-card {
    border: 2px solid rgba(220, 53, 69, 0.35);
}

.reset-card .card-header h3 {
    color: var(--danger);
}

.reset-warning {
    background: rgba(220, 53, 69, 0.08);
    border: 1px solid rgba(220, 53, 69, 0.25);
    border-radius: var(--radius-sm);
    padding: 0.85rem 1rem;
    margin-bottom: 1rem;
    font-size: 0.92rem;
    color: #842029;
}

.reset-mode-options {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.reset-mode-option {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    padding: 0.85rem 1rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    background: var(--surface);
}

.reset-mode-option:has(input:checked) {
    border-color: rgba(220, 53, 69, 0.45);
    background: rgba(220, 53, 69, 0.04);
}

.reset-mode-option span {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.reset-mode-option small {
    color: var(--text-muted);
    font-size: 0.82rem;
}

.reset-confirm-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-muted);
    cursor: pointer;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
        border-radius: 0 0 var(--radius) var(--radius);
        border-bottom: none;
    }

    .main-content {
        margin-right: 0;
        padding: 1rem;
    }

    .app-layout {
        flex-direction: column;
    }

    .sidebar-footer {
        position: relative;
    }
}

/* Utility */
.text-muted { color: var(--text-muted); }
.text-center { text-align: center; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mb-2 { margin-bottom: 1rem; }
.flex { display: flex; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
