/* app.css — التخطيط والمكوّنات (RTL). يعتمد على متغيرات theme.css. */

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 { margin: 0; font-weight: 800; }
.icon { width: 20px; height: 20px; flex: none; }

/* ── الشكل العام ─────────────────────────────── */
.app { min-height: 100vh; display: flex; flex-direction: column; }
.app-body { flex: 1; display: flex; align-items: stretch; }
.app-main {
    flex: 1; min-width: 0;
    padding: 20px clamp(14px, 3vw, 28px) 90px;
    max-width: 1400px; margin: 0 auto; width: 100%;
}
.app-footer {
    text-align: center; color: var(--text-faint);
    font-size: 12px; padding: 16px; border-top: 1px solid var(--border);
    background: var(--surface);
}

/* ── الشريط العلوي ───────────────────────────── */
.topbar {
    height: var(--topbar-h);
    position: sticky; top: 0; z-index: 40;
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; padding: 0 clamp(12px, 3vw, 24px);
    background: var(--surface); border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}
.topbar-start, .topbar-end { display: flex; align-items: center; gap: 8px; }
.topbar-divider { width: 1px; height: 26px; background: var(--border); margin: 0 2px; flex: none; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; }
.brand-logo {
    width: 38px; height: 38px; border-radius: 11px;
    display: grid; place-items: center;
    background: var(--primary); color: var(--on-primary);
    font-weight: 900; font-size: 20px; overflow: hidden;
}
.auth-logo {
    width: 56px; height: 56px; border-radius: 16px; margin: 0 auto 14px;
    display: grid; place-items: center; overflow: hidden;
    background: var(--primary); color: var(--on-primary); font-size: 28px; font-weight: 900;
}
.brand-logo.has-img, .auth-logo.has-img { background: none; }
.brand-logo img, .auth-logo img { width: 100%; height: 100%; object-fit: contain; display: block; }
.brand-name { font-size: 15px; }
.user-chip {
    display: flex; align-items: center; gap: 9px; color: inherit;
    padding: 4px 10px 4px 4px; border-radius: 999px; transition: background .15s;
}
.user-chip:hover { background: var(--surface-2); }
.user-avatar {
    width: 34px; height: 34px; border-radius: 50%;
    display: grid; place-items: center; flex: none;
    background: var(--secondary-soft); color: var(--secondary);
    font-weight: 800; overflow: hidden;
}
.user-avatar.has-img { background: none; }
.user-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.user-meta { display: flex; flex-direction: column; line-height: 1.25; }
.user-name { font-weight: 700; font-size: 13px; }
.user-role { font-size: 11px; color: var(--text-muted); font-weight: 600; }

/* ── الأزرار الأيقونية ───────────────────────── */
.icon-btn {
    width: 40px; height: 40px; border-radius: 11px;
    display: grid; place-items: center; cursor: pointer;
    background: var(--surface-2); border: 1px solid var(--border);
    color: var(--text-muted); transition: .15s;
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.theme-toggle .theme-icon-dark { display: none; }
[data-theme="dark"] .theme-toggle .theme-icon-light { display: none; }
[data-theme="dark"] .theme-toggle .theme-icon-dark { display: block; }

/* ── السايدبار ───────────────────────────────── */
.sidebar {
    width: var(--sidebar-w); flex: none;
    background: var(--surface); border-inline-start: 1px solid var(--border);
    padding: 16px 12px; display: flex; flex-direction: column;
    position: sticky; top: var(--topbar-h);
    height: calc(100vh - var(--topbar-h)); overflow-y: auto;
}
.sidebar-user { display: flex; align-items: center; gap: 10px; padding: 6px 8px 14px; margin-bottom: 8px; border-bottom: 1px solid var(--border); }
.sidebar-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-group-title { font-size: 10.5px; font-weight: 800; color: var(--text-faint);
    padding: 14px 14px 5px; letter-spacing: .3px; }
.nav-group-title:first-child { padding-top: 4px; }
.nav-link {
    display: flex; align-items: center; gap: 12px;
    padding: 11px 14px; border-radius: var(--radius);
    color: var(--text-muted); font-weight: 700; font-size: 14px;
    transition: .15s; position: relative;
}
.nav-link:hover { background: var(--surface-2); color: var(--text); }
.nav-link.is-active {
    background: var(--primary-soft); color: var(--primary-700);
}
.nav-link.is-active::before {
    content: ''; position: absolute; inset-inline-start: 0; top: 18%; bottom: 18%;
    width: 4px; border-radius: 4px; background: var(--primary);
}
.nav-label { flex: 1; }
.nav-badge {
    background: var(--primary); color: var(--on-primary);
    font-size: 11px; font-weight: 800; min-width: 22px; height: 22px;
    border-radius: 11px; display: grid; place-items: center; padding: 0 6px;
}
.sidebar-foot { padding-top: 12px; }
.db-status {
    display: flex; align-items: center; gap: 8px;
    font-size: 12px; color: var(--text-muted);
    background: var(--surface-2); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 10px 12px;
}
.dot { width: 9px; height: 9px; border-radius: 50%; }
.dot-online { background: var(--success); box-shadow: 0 0 0 3px rgba(5,150,105,.16); }
.sidebar-overlay {
    display: none; position: fixed; inset: 0; z-index: 44;
    background: rgba(2, 6, 23, .5); backdrop-filter: blur(2px);
}

/* ── تنقل الموبايل ───────────────────────────── */
.mobile-nav {
    display: none; position: fixed; bottom: 0; inset-inline: 0; z-index: 42;
    background: var(--surface); border-top: 1px solid var(--border);
    padding: 6px 4px; justify-content: space-around;
    box-shadow: 0 -4px 16px rgba(0,0,0,.06);
}
.mobile-nav-link {
    display: flex; flex-direction: column; align-items: center; gap: 3px;
    color: var(--text-faint); font-size: 10px; font-weight: 700;
    padding: 4px 8px; border-radius: 10px; flex: 1;
}
.mobile-nav-link.is-active { color: var(--primary); }
.mobile-nav-label { white-space: nowrap; }

/* ── رأس الصفحة ──────────────────────────────── */
.page-head {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; flex-wrap: wrap; margin-bottom: 18px;
}
.page-title { font-size: clamp(18px, 2.4vw, 24px); font-weight: 900; }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ── الأزرار ─────────────────────────────────── */
.btn {
    display: inline-flex; align-items: center; gap: 8px; justify-content: center;
    padding: 10px 16px; border-radius: var(--radius); cursor: pointer;
    font-family: inherit; font-weight: 700; font-size: 14px;
    border: 1px solid transparent; transition: .15s; background: var(--surface-2);
    color: var(--text); border-color: var(--border);
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; box-shadow: none; }
.btn .icon { width: 18px; height: 18px; }
.btn-primary { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-600); }
.btn-secondary { background: var(--secondary); color: #fff; border-color: var(--secondary); }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-ghost { background: transparent; }
.btn-sm { padding: 7px 11px; font-size: 13px; }
.btn-block { width: 100%; }

/* ── البطاقات ────────────────────────────────── */
.card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: 18px; box-shadow: var(--shadow-sm);
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.card-title { font-size: 15px; font-weight: 800; }
.grid { display: grid; gap: 16px; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }

/* بطاقات KPI */
.kpi {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: 18px; box-shadow: var(--shadow-sm);
    display: flex; flex-direction: column; gap: 8px;
    transition: transform .2s, box-shadow .2s;
}
.kpi:hover { transform: translateY(-2px); box-shadow: var(--shadow-md, 0 10px 26px -12px rgba(0,0,0,.22)); }
/* بطاقة البطل: مملوءة بالأحمر */
.kpi--hero {
    background: linear-gradient(135deg, var(--primary), var(--primary-700, #a30019));
    border: none; color: #fff; box-shadow: 0 12px 30px -12px rgba(228,0,43,.5);
}
.kpi--hero .kpi-label, .kpi--hero .kpi-sub { color: rgba(255,255,255,.9); }
.kpi--hero .kpi-icon { background: rgba(255,255,255,.18) !important; color: #fff !important; }
/* حلقة تقدّم (مشتركة) */
.p-ring { --sz: 78px; width: var(--sz); height: var(--sz); position: relative; flex: none; }
.p-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.p-ring .track { fill: none; stroke: rgba(255,255,255,.25); stroke-width: 9; }
.p-ring .bar { fill: none; stroke: #fff; stroke-width: 9; stroke-linecap: round; transition: stroke-dashoffset 1s cubic-bezier(.22,.61,.36,1); }
.p-ring.p-ring--onlight .track { stroke: var(--border); }
.p-ring.p-ring--onlight .bar { stroke: var(--primary); }
.p-ring .pct { position: absolute; inset: 0; display: grid; place-items: center; font-size: 16px; font-weight: 800; }
.kpi-top { display: flex; align-items: center; justify-content: space-between; }
.kpi-icon { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; }
.kpi-icon.i-primary { background: var(--primary-soft); color: var(--primary-700); }
.kpi-icon.i-secondary { background: var(--secondary-soft); color: var(--secondary); }
.kpi-icon.i-warning { background: var(--warning-soft); color: var(--warning); }
.kpi-icon.i-danger { background: var(--danger-soft); color: var(--danger); }
.kpi-icon.i-info { background: var(--info-soft); color: var(--info); }
.kpi-value { font-size: 28px; font-weight: 900; line-height: 1; }
.kpi-label { color: var(--text-muted); font-size: 13px; font-weight: 600; }
.kpi-sub { font-size: 12px; color: var(--text-faint); }

/* ── الجداول ─────────────────────────────────── */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 620px; }
table.data thead th {
    background: var(--surface-3); color: var(--text-muted);
    text-align: start; font-weight: 800; padding: 12px 14px; white-space: nowrap;
    border-bottom: 1px solid var(--border); font-size: 12px;
}
table.data tbody td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover { background: var(--surface-2); }
.row-actions { display: flex; gap: 6px; }
.row-actions .icon-btn { width: 34px; height: 34px; }

/* ── الشارات ─────────────────────────────────── */
.badge {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700;
    background: var(--surface-3); color: var(--text-muted);
}
.badge-primary { background: var(--primary-soft); color: var(--primary-700); }
.badge-success { background: rgba(5,150,105,.14); color: var(--success); }
.badge-secondary { background: var(--secondary-soft); color: var(--secondary); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-muted { background: var(--surface-3); color: var(--text-muted); }

/* ── النماذج ─────────────────────────────────── */
.form-grid { display: grid; gap: 14px; }
.form-row { display: grid; gap: 6px; }
.form-row label { font-weight: 700; font-size: 13px; }
.input, .select, textarea.input {
    width: 100%; padding: 10px 12px; font-family: inherit; font-size: 14px;
    background: var(--surface-2); border: 1px solid var(--border);
    border-radius: var(--radius); color: var(--text); transition: .15s;
}
.input:focus, .select:focus, textarea.input:focus {
    outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft);
}
.field-error { color: var(--danger); font-size: 12px; font-weight: 600; }
.input.is-invalid { border-color: var(--danger); }
.form-actions { display: flex; gap: 10px; justify-content: flex-start; margin-top: 6px; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; align-items: center; }
.filters .input, .filters .select { width: auto; min-width: 160px; }
.filters .search { position: relative; flex: 1; min-width: 200px; }
.filters .search .input { padding-inline-start: 38px; width: 100%; }
.filters .search .search-icon { position: absolute; inset-inline-start: 12px; top: 50%; transform: translateY(-50%); color: var(--text-faint); }

/* toggle group (وسيلة الدفع/نوع المعاملة) */
.toggle-group { display: inline-flex; background: var(--surface-3); border-radius: var(--radius); padding: 4px; gap: 4px; }
.toggle-group button {
    border: 0; background: transparent; padding: 8px 14px; border-radius: 9px;
    cursor: pointer; font-family: inherit; font-weight: 700; color: var(--text-muted); font-size: 13px;
}
.toggle-group button.is-active { background: var(--surface); color: var(--primary-700); box-shadow: var(--shadow-sm); }

/* ── الحالات ─────────────────────────────────── */
.empty-state {
    text-align: center; padding: 48px 20px; color: var(--text-muted);
    background: var(--surface); border: 1px dashed var(--border); border-radius: var(--radius-lg);
}
.empty-state .empty-icon { width: 56px; height: 56px; margin: 0 auto 12px; color: var(--text-faint); }
.empty-state .empty-icon .icon { width: 56px; height: 56px; }
.empty-state h2 { font-size: 18px; margin-bottom: 6px; color: var(--text); }
.error-state { border-color: var(--danger); background: var(--danger-soft); color: var(--danger); }
.error-state .empty-icon, .error-state h2 { color: var(--danger); }

/* لوحة تنبيه */
.alert-panel {
    display: flex; gap: 12px; padding: 14px 16px; border-radius: var(--radius);
    border: 1px solid var(--border); background: var(--surface-2); margin-bottom: 16px;
}
.alert-panel.warn { background: var(--warning-soft); border-color: var(--warning); color: var(--warning); }
.alert-panel.danger { background: var(--danger-soft); border-color: var(--danger); color: var(--danger); }
.alert-panel.info { background: var(--info-soft); border-color: var(--info); color: var(--info); }

/* ── التبويبات ───────────────────────────────── */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 18px; overflow-x: auto; }
.tab-btn { padding: 11px 18px; border: 0; background: transparent; cursor: pointer; font-family: inherit;
    font-weight: 700; font-size: 14px; color: var(--text-muted); border-bottom: 2px solid transparent; white-space: nowrap; display: inline-flex; align-items: center; gap: 7px; }
.tab-btn .icon { width: 17px; height: 17px; }
.tab-btn:hover { color: var(--text); }
.tab-btn.is-active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-btn .count-chip { background: var(--surface-3); color: var(--text-muted); border-radius: 999px; padding: 1px 8px; font-size: 11px; font-weight: 800; }
.tab-btn.is-active .count-chip { background: var(--primary-soft); color: var(--primary-700); }
.tab-panel { display: none; }
.tab-panel.is-active { display: block; animation: fadeIn .2s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ── المودالات ───────────────────────────────── */
.modal-backdrop {
    display: none; position: fixed; inset: 0; z-index: 60;
    background: rgba(2, 6, 23, .55); backdrop-filter: blur(3px);
    align-items: center; justify-content: center; padding: 16px;
}
.modal-backdrop.open { display: flex; }
.modal {
    background: var(--surface); border-radius: var(--radius-xl); box-shadow: var(--shadow-lg);
    width: 100%; max-width: 520px; max-height: 90vh; overflow-y: auto; border: 1px solid var(--border);
}
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--border); }
.modal-title { font-size: 16px; font-weight: 800; }
.modal-body { padding: 20px; }
.modal-foot { padding: 16px 20px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-start; }

/* ── التوست ──────────────────────────────────── */
.toast-container { position: fixed; bottom: 20px; inset-inline-start: 20px; z-index: 80; display: flex; flex-direction: column; gap: 10px; }
.toast {
    display: flex; align-items: center; gap: 10px; padding: 12px 14px;
    background: var(--surface); border: 1px solid var(--border); border-inline-start-width: 4px;
    border-radius: var(--radius); box-shadow: var(--shadow-lg); min-width: 260px; max-width: 400px;
    animation: toastIn .25s ease;
}
.toast-success { border-inline-start-color: var(--success); }
.toast-error { border-inline-start-color: var(--danger); }
.toast-warning { border-inline-start-color: var(--warning); }
.toast-info { border-inline-start-color: var(--info); }
.toast-success .toast-icon { color: var(--success); }
.toast-error .toast-icon, .toast-warning .toast-icon { color: var(--danger); }
.toast-info .toast-icon { color: var(--info); }
.toast-msg { flex: 1; font-weight: 600; font-size: 13px; }
.toast-close { background: none; border: 0; cursor: pointer; color: var(--text-faint); padding: 2px; }
.toast-close .icon { width: 16px; height: 16px; }
@keyframes toastIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* ── الرسوم ──────────────────────────────────── */
.chart-box { position: relative; height: 300px; }
.sparkline { display: inline-flex; align-items: flex-end; gap: 1px; height: 22px; }
.sparkline i { width: 3px; border-radius: 1px; display: block; }
.sparkline .p { background: var(--success); }
.sparkline .a { background: var(--danger); }
.sparkline .n { background: var(--border-strong); }

/* أدوات */
.muted { color: var(--text-muted); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.fw-800 { font-weight: 800; }
.mt-2 { margin-top: 16px; } .mb-2 { margin-bottom: 16px; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.row-flex { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; }
.mobile-only { display: none; }
.branch-switch .select { height: 40px; padding: 0 12px; border-radius: 11px; font-size: 13px; font-weight: 700; min-width: 132px; }
.branch-chip { white-space: nowrap; }
.branch-chip .icon { width: 15px; height: 15px; }
.progress { height: 8px; border-radius: 6px; background: var(--surface-3); overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--primary); }
.pagination { display: flex; gap: 6px; justify-content: center; margin-top: 18px; flex-wrap: wrap; }
.pagination a, .pagination span {
    padding: 7px 12px; border-radius: 9px; border: 1px solid var(--border);
    background: var(--surface); font-weight: 700; font-size: 13px; color: var(--text-muted);
}
.pagination .is-active { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }

/* ── الاستجابة ───────────────────────────────── */
@media (max-width: 1024px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 900px) {
    .mobile-only { display: grid; }

    /* القائمة الجانبية = درج ينزلق من اليمين (RTL) */
    .sidebar {
        position: fixed; top: 0; right: 0; left: auto;
        width: min(284px, 84vw); height: 100vh; z-index: 60;
        transform: translateX(100%); transition: transform .25s ease;
        box-shadow: var(--shadow-lg);
    }
    .sidebar.open { transform: translateX(0); }
    .sidebar-overlay { z-index: 55; }
    .sidebar-overlay.open { display: block; }

    .mobile-nav { display: flex; }
    .app-main { padding-bottom: 84px; }

    /* شريط علوي مضغوط لا يطفح */
    .topbar { gap: 8px; padding: 0 10px; }
    .topbar-start, .topbar-end { gap: 8px; }
    .brand-name { display: none; }
    .user-chip, .topbar-divider { display: none; }   /* الهوية تظهر داخل الدرج */
    .branch-switch .select {
        min-width: 0; max-width: 124px; height: 38px; padding: 0 8px; font-size: 12px;
        text-overflow: ellipsis;
    }
    .icon-btn { width: 38px; height: 38px; }
}
@media (max-width: 640px) {
    .grid-3, .grid-4, .grid-2 { grid-template-columns: 1fr; }
    .user-role { display: none; }
    .branch-switch .select { max-width: 104px; }
}

/* ── تقييم بالنجوم ── */
.crit-box { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 6px 12px; margin: 8px 0; }
.crit-box .crit-head { font-weight: 800; font-size: 13px; color: var(--muted); padding: 8px 2px 4px; }
.crit-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 4px; border-top: 1px solid var(--border); }
.crit-row:first-of-type { border-top: 0; }
.crit-label { font-size: 13px; font-weight: 600; }
.star-rating { display: inline-flex; flex-direction: row-reverse; gap: 2px; }
.star-rating .star {
    background: none; border: 0; cursor: pointer; padding: 0 2px; line-height: 1;
    font-size: 24px; color: var(--border-strong); transition: color .12s, transform .12s;
}
.star-rating .star:hover { transform: scale(1.15); }
.star-rating .star.on { color: #f59e0b; }
.star-rating .star.preview { color: #fbbf24; }
/* عرض النجوم للقراءة فقط (في الجداول) */
.stars-read { color: #f59e0b; letter-spacing: 1px; white-space: nowrap; }
.stars-read .off { color: var(--border-strong); }
.crit-mini { display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 4px; }
.crit-mini span { font-size: 11px; color: var(--muted); }
.crit-mini b { color: var(--text); font-weight: 700; }

/* شريط تبديل الاتجاه داخل مودال التقييم */
.seg-toggle { display: flex; gap: 6px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 4px; margin-bottom: 14px; }
.seg-toggle .tab-btn { flex: 1; justify-content: center; border: 0; border-radius: calc(var(--radius) - 4px); }
.seg-toggle .tab-btn.is-active { background: var(--primary); color: #fff; }

/* ── الجدول البصري للقاعات ── */
.timetable td, .timetable th { text-align: center; vertical-align: middle; }
.timetable .tt-cell { padding: 4px; height: 62px; }
.tt-free { background: repeating-linear-gradient(45deg, transparent, transparent 6px, rgba(148,163,184,.06) 6px, rgba(148,163,184,.06) 12px); }
.tt-add {
    width: 100%; height: 54px; border: 1px dashed var(--border-strong); border-radius: 8px;
    background: transparent; color: var(--muted); font-size: 20px; cursor: pointer; transition: all .12s;
}
.tt-add:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-soft, rgba(228,0,43,.06)); }
.tt-booked .tt-inner {
    position: relative; height: 54px; border-radius: 8px; padding: 6px 8px;
    background: var(--primary); color: #fff; display: flex; flex-direction: column; justify-content: center; gap: 2px;
}
.tt-break .tt-inner { background: #64748b; }
.tt-title { font-weight: 800; font-size: 12px; line-height: 1.2; }
.tt-teacher { font-size: 10px; opacity: .95; display: flex; align-items: center; gap: 3px; }
.tt-teacher .icon { width: 11px; height: 11px; }
.tt-time { font-size: 10px; opacity: .85; }
.tt-del {
    position: absolute; inset-inline-start: 4px; top: 4px; width: 20px; height: 20px; border: 0; border-radius: 6px;
    background: rgba(255,255,255,.22); color: #fff; cursor: pointer; display: grid; place-items: center;
}
.tt-del:hover { background: rgba(255,255,255,.4); }
.tt-del .icon { width: 12px; height: 12px; }

/* ── العرض الأسبوعي الكامل ── */
.week-grid td, .week-grid th { text-align: center; }
.wk-cell { padding: 6px !important; }
.wk-chip { background: var(--primary); color: #fff; border-radius: 8px; padding: 5px 7px; margin-bottom: 5px; text-align: start; }
.wk-chip.wk-break { background: #64748b; }
.wk-top { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.wk-title { font-weight: 800; font-size: 11px; line-height: 1.2; }
.wk-time { font-size: 10px; opacity: .85; }
.wk-teacher { font-size: 10px; opacity: .95; display: block; margin-top: 1px; }
.wk-del { border: 0; background: transparent; color: #fff; font-size: 15px; line-height: 1; cursor: pointer; opacity: .8; padding: 0 2px; }
.wk-del:hover { opacity: 1; }

/* ── ماسح الكاميرا (QR/باركود) ── */
.scan-view { position: relative; width: 100%; aspect-ratio: 4/3; background: #000; border-radius: 12px; overflow: hidden; }
.scan-view video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scan-frame { position: absolute; inset: 18% 14%; border: 3px solid rgba(255,255,255,.9); border-radius: 14px; box-shadow: 0 0 0 100vmax rgba(0,0,0,.35); }

/* ── الطباعة / تصدير PDF ── */
@media print {
    .topbar, .sidebar, .sidebar-overlay, .app-footer, .mobile-nav, .page-actions, .no-print, .wk-del { display: none !important; }
    .app-body { display: block !important; }
    .app-main { margin: 0 !important; padding: 0 !important; }
    .card { box-shadow: none !important; border: 0 !important; }
    body { background: #fff !important; }
    .wk-chip, .tt-inner { -webkit-print-color-adjust: exact; print-color-adjust: exact; break-inside: avoid; }
    .week-grid td, .week-grid th, .timetable td, .timetable th { border: 1px solid #cbd5e1 !important; }
    a[href]::after { content: ""; } /* لا تُلحق الروابط بالطباعة */
}
