/* EduSystem — shared styles. Uses logical properties (inline-start/end) so the same rules serve RTL and LTR. */
/* ---------- Theme tokens ----------
   Each theme only redefines the colour tokens below; every rule uses the tokens.
   The active theme is <html data-theme="..."> (server-rendered from the theme cookie, switched live by app.js). */
:root, [data-theme="blue"] {
    --edu-primary: #1d4ed8;
    --edu-primary-600: #1e40af;
    --edu-primary-rgb: 29, 78, 216;
    --edu-primary-2: #6366f1;
    --edu-accent: #f59e0b;
    --edu-sidebar: #0f1d36;
    --edu-sidebar-2: #13284b;
    --edu-sidebar-text: #b9c4da;
    --edu-sidebar-section: #6f80a3;
    --edu-active-bg: rgba(59, 130, 246, .22);
    --edu-auth-glow: #2b56d4;
    --edu-bg: #f3f5fa;
}
[data-theme="emerald"] {
    --edu-primary: #059669; --edu-primary-600: #047857; --edu-primary-rgb: 5, 150, 105; --edu-primary-2: #10b981;
    --edu-accent: #fbbf24; --edu-sidebar: #062a22; --edu-sidebar-2: #0a3b30; --edu-sidebar-text: #b5d6cb;
    --edu-sidebar-section: #6f9c8d; --edu-active-bg: rgba(16, 185, 129, .22); --edu-auth-glow: #0f8f6a; --edu-bg: #f2f7f5;
}
[data-theme="violet"] {
    --edu-primary: #7c3aed; --edu-primary-600: #6d28d9; --edu-primary-rgb: 124, 58, 237; --edu-primary-2: #c026d3;
    --edu-accent: #f472b6; --edu-sidebar: #1e1238; --edu-sidebar-2: #2a1850; --edu-sidebar-text: #cbbfe6;
    --edu-sidebar-section: #8b7bb0; --edu-active-bg: rgba(167, 139, 250, .22); --edu-auth-glow: #6d3ae0; --edu-bg: #f5f3fa;
}
[data-theme="teal"] {
    --edu-primary: #0e7490; --edu-primary-600: #155e75; --edu-primary-rgb: 14, 116, 144; --edu-primary-2: #0891b2;
    --edu-accent: #f97316; --edu-sidebar: #082f3a; --edu-sidebar-2: #0c3f4d; --edu-sidebar-text: #b4d3dc;
    --edu-sidebar-section: #6d98a5; --edu-active-bg: rgba(34, 211, 238, .18); --edu-auth-glow: #0e7f9c; --edu-bg: #f1f6f8;
}
[data-theme="maroon"] {
    --edu-primary: #9f1239; --edu-primary-600: #881337; --edu-primary-rgb: 159, 18, 57; --edu-primary-2: #be123c;
    --edu-accent: #fbbf24; --edu-sidebar: #2a0a16; --edu-sidebar-2: #3b0f20; --edu-sidebar-text: #e2bcc8;
    --edu-sidebar-section: #a07585; --edu-active-bg: rgba(251, 113, 133, .2); --edu-auth-glow: #a3163f; --edu-bg: #f8f3f4;
}
[data-theme="graphite"] {
    --edu-primary: #334155; --edu-primary-600: #1e293b; --edu-primary-rgb: 51, 65, 85; --edu-primary-2: #64748b;
    --edu-accent: #f97316; --edu-sidebar: #111827; --edu-sidebar-2: #1f2937; --edu-sidebar-text: #c3c9d4;
    --edu-sidebar-section: #7b8494; --edu-active-bg: rgba(249, 115, 22, .18); --edu-auth-glow: #475569; --edu-bg: #f3f4f6;
}

:root {
    --edu-surface: #ffffff;
    --edu-border: #e3e8f1;
    --edu-text: #1b2333;
    --edu-muted: #667085;
    --edu-sidebar-w: 264px;
    --edu-radius: 14px;
    --bs-body-font-family: 'Cairo', system-ui, -apple-system, 'Segoe UI', Tahoma, sans-serif;
    --bs-border-color: var(--edu-border);
}
/* Re-point Bootstrap's own variables to the theme on every element that may carry data-theme. */
:root, [data-theme] {
    --bs-primary: var(--edu-primary);
    --bs-primary-rgb: var(--edu-primary-rgb);
    --bs-link-color: var(--edu-primary);
    --bs-link-color-rgb: var(--edu-primary-rgb);
    --bs-link-hover-color: var(--edu-primary-600);
    --bs-primary-text-emphasis: var(--edu-primary-600);
    --bs-primary-bg-subtle: rgba(var(--edu-primary-rgb), .12);
    --bs-primary-border-subtle: rgba(var(--edu-primary-rgb), .3);
    --bs-focus-ring-color: rgba(var(--edu-primary-rgb), .25);
    --bs-body-bg: var(--edu-bg);
    --bs-body-color: var(--edu-text);
}

body { font-family: var(--bs-body-font-family); background: var(--edu-bg); }
code, kbd, pre, .code-input { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.btn-primary { --bs-btn-bg: var(--edu-primary); --bs-btn-border-color: var(--edu-primary); --bs-btn-hover-bg: var(--edu-primary-600); --bs-btn-hover-border-color: var(--edu-primary-600); --bs-btn-active-bg: var(--edu-primary-600); }
a { color: var(--edu-primary); }
:focus-visible { outline: 3px solid rgba(var(--edu-primary-rgb), .35); outline-offset: 2px; }

/* ---------- App shell ---------- */
.app { min-height: 100vh; }
.sidebar {
    background: linear-gradient(180deg, var(--edu-sidebar) 0%, var(--edu-sidebar-2) 100%);
    color: var(--edu-sidebar-text);
    width: var(--edu-sidebar-w);
}
@media (min-width: 992px) {
    .sidebar { position: fixed; inset-block: 0; inset-inline-start: 0; overflow-y: auto; z-index: 1030; }
    .main { margin-inline-start: var(--edu-sidebar-w); }
}
.sidebar-brand { display: flex; align-items: center; gap: .75rem; padding: 1.25rem 1.25rem 1rem; border-bottom: 1px solid rgba(255, 255, 255, .07); }
.brand-name { color: #fff; font-weight: 700; font-size: 1.05rem; line-height: 1.2; }
.brand-scope { font-size: .78rem; color: var(--edu-sidebar-text); max-width: 170px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-nav { padding: .75rem .75rem 2rem; display: flex; flex-direction: column; gap: 2px; }
.sidebar-nav .nav-section { font-size: .72rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--edu-sidebar-section); padding: 1rem .75rem .35rem; }
.sidebar-nav .nav-link { display: flex; align-items: center; gap: .75rem; color: var(--edu-sidebar-text); border-radius: 10px; padding: .55rem .75rem; font-weight: 600; font-size: .93rem; transition: background .15s, color .15s; }
.sidebar-nav .nav-link i { font-size: 1.1rem; width: 1.25rem; text-align: center; }
.sidebar-nav .nav-link:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.sidebar-nav .nav-link.active { background: var(--edu-active-bg); color: #fff; box-shadow: inset 3px 0 0 var(--edu-accent); }
[dir="rtl"] .sidebar-nav .nav-link.active { box-shadow: inset -3px 0 0 var(--edu-accent); }
/* Collapsible nav group */
.sidebar-nav .nav-group-toggle { display: flex; align-items: center; gap: .75rem; width: 100%; background: transparent; border: none; color: var(--edu-sidebar-text); border-radius: 10px; padding: .55rem .75rem; font-weight: 600; font-size: .93rem; transition: background .15s, color .15s; cursor: pointer; text-align: start; }
.sidebar-nav .nav-group-toggle:hover { background: rgba(255,255,255,.06); color: #fff; }
.sidebar-nav .nav-group-toggle.active { color: #fff; }
.sidebar-nav .nav-group-icon i { font-size: 1.1rem; width: 1.25rem; text-align: center; }
.sidebar-nav .nav-group-label { flex: 1; }
.sidebar-nav .nav-group-arrow { font-size: .75rem; transition: transform .2s; margin-inline-start: auto; }
.sidebar-nav .nav-group-toggle[aria-expanded="true"] .nav-group-arrow { transform: rotate(-180deg); }
.sidebar-nav .nav-group-items { display: flex; flex-direction: column; gap: 2px; }
.sidebar-nav .nav-sub-link { padding-inline-start: 2.25rem !important; font-size: .88rem !important; }

.topbar { position: sticky; top: 0; z-index: 1020; display: flex; align-items: center; gap: .75rem; padding: .7rem 1.5rem; background: rgba(255, 255, 255, .9); backdrop-filter: blur(8px); border-bottom: 1px solid var(--edu-border); }
.topbar-title { font-weight: 700; color: var(--edu-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.btn-icon { --bs-btn-padding-x: .45rem; --bs-btn-padding-y: .25rem; color: var(--edu-muted); background: transparent; border: 0; }
.btn-icon:hover { color: var(--edu-primary); background: rgba(var(--edu-primary-rgb), .08); }
.btn-lang { border: 1px solid var(--edu-border); background: #fff; color: var(--edu-text); font-weight: 600; display: inline-flex; gap: .4rem; align-items: center; }
.btn-lang:hover { border-color: var(--edu-primary); color: var(--edu-primary); }
.user-chip { display: inline-flex; align-items: center; gap: .5rem; border: 1px solid var(--edu-border); background: #fff; border-radius: 999px; padding: .2rem .75rem .2rem .25rem; font-weight: 600; }
[dir="rtl"] .user-chip { padding: .2rem .25rem .2rem .75rem; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: linear-gradient(135deg, var(--edu-primary), var(--edu-primary-2)); color: #fff; display: inline-grid; place-items: center; font-size: .85rem; }

.acting-banner { display: flex; align-items: center; gap: .75rem; padding: .55rem 1.5rem; background: #7c2d12; color: #fff; font-weight: 600; }
.content { padding: 1.5rem; max-width: 1440px; }
@media (max-width: 575.98px) { .content { padding: 1rem; } .topbar { padding: .6rem 1rem; } }

/* ---------- Page structure ---------- */
.page-header { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; }
.page-title { font-size: 1.45rem; font-weight: 700; margin: 0; }
.page-subtitle { color: var(--edu-muted); margin: .2rem 0 0; }
.card { border: 1px solid var(--edu-border); border-radius: var(--edu-radius); box-shadow: 0 1px 2px rgba(16, 24, 40, .04); }
.card-header { background: transparent; font-weight: 700; padding: .9rem 1.25rem; border-bottom-color: var(--edu-border); }
.card-footer { background: #fafbfd; border-top-color: var(--edu-border); border-radius: 0 0 var(--edu-radius) var(--edu-radius) !important; }
.form-card { max-width: 820px; }
.form-card-wide { max-width: 1080px; }
.form-section { font-size: .95rem; font-weight: 700; color: var(--edu-primary); padding-bottom: .4rem; margin-bottom: 1rem; border-bottom: 1px dashed var(--edu-border); }
.form-actions { display: flex; gap: .5rem; padding: .9rem 1.25rem; }
.form-label { font-weight: 600; font-size: .9rem; }
.form-control, .form-select { border-radius: 10px; }
.input-group-text { background: #f7f8fb; }
.input-validation-error { border-color: var(--bs-danger); }
.field-validation-error { color: var(--bs-danger); }

/* ---------- Stats & lists ---------- */
.stat { display: flex; gap: 1rem; align-items: center; background: var(--edu-surface); border: 1px solid var(--edu-border); border-radius: var(--edu-radius); padding: 1.1rem 1.25rem; height: 100%; }
.stat-icon { width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center; font-size: 1.35rem; flex-shrink: 0; }
.stat-value { font-size: 1.6rem; font-weight: 700; line-height: 1.1; }
.stat-value small { font-size: .95rem; color: var(--edu-muted); font-weight: 600; }
.stat-label { color: var(--edu-muted); font-size: .88rem; }
.activity .list-group-item { padding: .75rem 1.25rem; }
.status { display: inline-flex; align-items: center; gap: .3rem; font-size: .8rem; font-weight: 700; padding: .2rem .6rem; border-radius: 999px; }
.status::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status-on { background: #e7f6ec; color: #13703a; }
.status-off { background: #f1f2f6; color: #5d6679; }
.status-warn { background: #fff4e0; color: #9a5b00; }
.status-warn::before { display: none; }
.status-info { background: #e8f0fe; color: #1d4ed8; }
.status-danger { background: #fdecec; color: #b42318; }
.row-actions { display: inline-flex; gap: .15rem; align-items: center; justify-content: flex-end; }
.check-list { max-height: 260px; overflow-y: auto; border: 1px solid var(--edu-border); border-radius: 10px; padding: .6rem .9rem; background: #fcfcfe; }
.module-grid, .perm-grid { display: grid; gap: .5rem 1.25rem; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
.perm-grid { gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.perm-group { border: 1px solid var(--edu-border); border-radius: 12px; padding: .75rem 1rem; background: #fcfcfe; }
.perm-group legend { float: none; width: auto; font-size: .95rem; font-weight: 700; margin-bottom: .4rem; padding: 0; }

/* ---------- Tables ---------- */
.table { --bs-table-hover-bg: #f6f8fd; margin-bottom: 0; }
.table thead th { font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .02em; color: var(--edu-muted); background: #f8f9fc; border-bottom-width: 1px; white-space: nowrap; }
[lang="ar"] .table thead th { text-transform: none; letter-spacing: 0; font-size: .85rem; }
div.dt-container .dt-search input { border-radius: 10px; min-width: 220px; }
div.dt-container .dt-paging .pagination { gap: 2px; }
div.dt-container div.dt-layout-row { margin: .5rem 0; }

/* ---------- Misc ---------- */
.empty-state { text-align: center; padding: 3.5rem 1rem; }
.empty-state > i { font-size: 3rem; color: #a7b2c7; display: block; margin-bottom: .75rem; }
.small-state { padding: 2rem 1rem; }
.qr { width: 172px; height: 172px; background: #fff; border: 1px solid var(--edu-border); border-radius: 12px; padding: 6px; }
.qr svg { width: 100%; height: 100%; }
.steps { padding-inline-start: 1.2rem; }
.steps li { margin-bottom: .75rem; }
.recovery-codes { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .5rem; }
.recovery-codes code { background: #f3f5fa; padding: .4rem .6rem; border-radius: 8px; text-align: center; color: var(--edu-text); }
.audit-json { background: #0f172a; color: #e2e8f0; border-radius: 10px; padding: .75rem; font-size: .8rem; min-height: 120px; white-space: pre-wrap; word-break: break-word; }
.code-input { letter-spacing: .3em; }

/* ---------- Authentication pages ---------- */
.auth { background: var(--edu-bg); }
.auth-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); }
.auth-aside { background: radial-gradient(circle at 20% 15%, var(--edu-auth-glow) 0%, var(--edu-sidebar) 55%); color: #dbe4ff; padding: 4rem 3.5rem; display: flex; flex-direction: column; justify-content: center; }
.auth-aside h1 { color: #fff; font-size: 2rem; font-weight: 700; margin: 1.25rem 0 .5rem; }
.auth-aside p { font-size: 1.05rem; max-width: 28rem; color: #c3d0f5; }
.auth-points { list-style: none; padding: 0; margin: 2rem 0 0; display: grid; gap: .9rem; }
.auth-points li { display: flex; align-items: center; gap: .75rem; font-weight: 600; }
.auth-points i { width: 36px; height: 36px; border-radius: 10px; background: rgba(255, 255, 255, .1); display: grid; place-items: center; color: var(--edu-accent); }
.auth-main { display: flex; flex-direction: column; padding: 1.5rem; }
.auth-top { display: flex; justify-content: flex-end; }
.auth-card { width: 100%; max-width: 420px; margin: auto; background: #fff; border: 1px solid var(--edu-border); border-radius: 18px; padding: 2.25rem; box-shadow: 0 10px 30px rgba(15, 29, 54, .06); }
.auth-title { font-size: 1.5rem; font-weight: 700; margin-bottom: .35rem; }
@media (max-width: 991.98px) {
    .auth-shell { grid-template-columns: 1fr; }
    .auth-aside { display: none; }
    .auth-card { padding: 1.5rem; }
}

/* Wide tables scroll inside the card on small screens instead of stretching the page. */
div.dt-container .dt-layout-table { overflow-x: auto; }

/* ---------- Bootstrap components whose primary colour is compiled in ---------- */
.btn-outline-primary { --bs-btn-color: var(--edu-primary); --bs-btn-border-color: var(--edu-primary); --bs-btn-hover-bg: var(--edu-primary); --bs-btn-hover-border-color: var(--edu-primary); --bs-btn-active-bg: var(--edu-primary-600); --bs-btn-active-border-color: var(--edu-primary-600); }
.text-bg-primary { background-color: var(--edu-primary) !important; }
.form-check-input:checked { background-color: var(--edu-primary); border-color: var(--edu-primary); }
.form-check-input:focus, .form-control:focus, .form-select:focus { border-color: rgba(var(--edu-primary-rgb), .5); box-shadow: 0 0 0 .25rem rgba(var(--edu-primary-rgb), .2); }
.form-switch .form-check-input:focus:not(:checked) { --bs-form-switch-bg: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='rgba%280,0,0,.25%29'/%3e%3c/svg%3e"); }
.pagination { --bs-pagination-active-bg: var(--edu-primary); --bs-pagination-active-border-color: var(--edu-primary); --bs-pagination-color: var(--edu-primary); --bs-pagination-hover-color: var(--edu-primary-600); --bs-pagination-focus-box-shadow: 0 0 0 .25rem rgba(var(--edu-primary-rgb), .2); }
.dropdown-menu { --bs-dropdown-link-active-bg: var(--edu-primary); }

/* ---------- Theme picker ---------- */
.theme-menu { min-width: 220px; }
.theme-option { display: flex; align-items: center; gap: .6rem; }
.theme-swatch { width: 22px; height: 22px; border-radius: 50%; flex-shrink: 0; box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .6), 0 0 0 1px rgba(0, 0, 0, .08); }
.theme-option .bi-check2 { margin-inline-start: auto; visibility: hidden; color: var(--edu-primary); }
.theme-option.active { background: rgba(var(--edu-primary-rgb), .08); color: var(--edu-text); }
.theme-option.active .bi-check2 { visibility: visible; }
.btn-theme { border: 1px solid var(--edu-border); background: #fff; color: var(--edu-primary); }
.btn-theme:hover { border-color: var(--edu-primary); }

/* ---------- Phase 2 components ---------- */
.btn-year { border: 1px solid var(--edu-border); background: #fff; color: var(--edu-text); font-weight: 600; display: inline-flex; align-items: center; gap: .4rem; }
.btn-year:hover { border-color: var(--edu-primary); color: var(--edu-primary); }
.lookup { position: relative; }
.lookup-results { position: absolute; inset-inline: 0; top: 100%; max-height: 280px; overflow-y: auto; z-index: 1050; }
.lookup.has-value .lookup-input { border-color: var(--bs-success); background-color: #f3fbf6; }
.mode-switch { display: inline-flex; gap: .25rem; padding: .25rem; background: #f1f3f8; border-radius: 10px; margin-bottom: 1rem; }
.mode-switch .btn { border: 0; font-weight: 600; }
.mode-switch .btn-check:checked + .btn { background: #fff; color: var(--edu-primary); box-shadow: 0 1px 2px rgba(16, 24, 40, .08); }
.profile-head { display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; }
.profile-avatar { width: 64px; height: 64px; border-radius: 18px; display: grid; place-items: center; font-size: 1.6rem; font-weight: 700; color: #fff; background: linear-gradient(135deg, var(--edu-primary), var(--edu-primary-2)); }
.kv { display: grid; grid-template-columns: minmax(120px, 34%) 1fr; gap: .45rem 1rem; margin: 0; }
.kv dt { color: var(--edu-muted); font-weight: 600; font-size: .88rem; }
.kv dd { margin: 0; }
.nav-tabs { border-bottom-color: var(--edu-border); }
.nav-tabs .nav-link { font-weight: 600; color: var(--edu-muted); border: 0; border-bottom: 3px solid transparent; }
.nav-tabs .nav-link.active { color: var(--edu-primary); border-bottom-color: var(--edu-primary); background: transparent; }
.tree { list-style: none; padding-inline-start: 0; margin: 0; }
.tree .tree { padding-inline-start: 1.5rem; border-inline-start: 2px dashed var(--edu-border); margin-inline-start: .75rem; }
.tree-node { display: flex; align-items: center; gap: .6rem; padding: .5rem .75rem; border-radius: 10px; }
.tree-node:hover { background: rgba(var(--edu-primary-rgb), .05); }
.tree-kind { font-size: .72rem; font-weight: 700; padding: .15rem .5rem; border-radius: 999px; background: rgba(var(--edu-primary-rgb), .1); color: var(--edu-primary); white-space: nowrap; }
.grade-chips { display: flex; flex-wrap: wrap; gap: .4rem; padding: .25rem .75rem .75rem; padding-inline-start: 2.5rem; }
.grade-chip { display: inline-flex; align-items: center; gap: .35rem; border: 1px solid var(--edu-border); border-radius: 999px; padding: .2rem .35rem .2rem .7rem; background: #fff; font-size: .85rem; }
[dir="rtl"] .grade-chip { padding: .2rem .7rem .2rem .35rem; }
.grade-chip .btn { --bs-btn-padding-y: 0; --bs-btn-padding-x: .3rem; }
.pipeline { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }
.pipeline a { display: inline-flex; align-items: center; gap: .5rem; padding: .45rem .9rem; border-radius: 999px; border: 1px solid var(--edu-border); background: #fff; color: var(--edu-text); text-decoration: none; font-weight: 600; font-size: .9rem; }
.pipeline a.active { border-color: var(--edu-primary); background: rgba(var(--edu-primary-rgb), .08); color: var(--edu-primary); }
.pipeline .count { background: #f1f3f8; border-radius: 999px; padding: 0 .5rem; font-size: .8rem; }
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline li { position: relative; padding-inline-start: 1.75rem; padding-bottom: 1rem; }
.timeline li::before { content: ''; position: absolute; inset-inline-start: .45rem; top: .4rem; bottom: -.2rem; width: 2px; background: var(--edu-border); }
.timeline li:last-child::before { display: none; }
.timeline li::after { content: ''; position: absolute; inset-inline-start: .2rem; top: .3rem; width: .7rem; height: .7rem; border-radius: 50%; background: var(--edu-primary); box-shadow: 0 0 0 3px rgba(var(--edu-primary-rgb), .15); }
.year-card { border: 1px solid var(--edu-border); border-radius: var(--edu-radius); background: #fff; padding: 1.1rem 1.25rem; height: 100%; display: flex; flex-direction: column; gap: .5rem; }
.year-card.current { border-color: var(--edu-primary); box-shadow: 0 0 0 3px rgba(var(--edu-primary-rgb), .12); }
.capacity { height: 6px; border-radius: 999px; background: #eef1f6; overflow: hidden; }
.capacity > span { display: block; height: 100%; background: var(--edu-primary); }
.capacity.full > span { background: var(--bs-danger); }
.masked { letter-spacing: .1em; color: var(--edu-muted); }
.kv-compact { grid-template-columns: minmax(100px, 42%) 1fr; }
.text-uppercase::placeholder { text-transform: none; }
/* ---------- Timetable ---------- */
.timetable { table-layout: fixed; min-width: 760px; }
.timetable th, .timetable td { vertical-align: top; }
.timetable thead th { background: var(--bs-tertiary-bg); text-align: center; font-size: .9rem; }
.timetable .tt-period { width: 120px; background: var(--bs-tertiary-bg); font-weight: 600; font-size: .85rem; }
.timetable td { height: 74px; padding: .35rem; }
.tt-cell { position: relative; background: rgba(var(--edu-primary-rgb), .08); border-inline-start: 3px solid var(--edu-primary); border-radius: 6px; padding: .3rem .5rem; margin-bottom: .25rem; font-size: .85rem; }
.tt-cell .small span + span::before { content: " · "; }
.tt-cell .tt-remove { position: absolute; inset-inline-end: 2px; top: 2px; padding: 0 .25rem; line-height: 1; opacity: .5; }
.tt-cell .tt-remove:hover { opacity: 1; color: var(--bs-danger); }
.tt-add { display: flex; align-items: center; justify-content: center; height: 100%; min-height: 58px; color: var(--edu-muted); border: 1px dashed var(--edu-border); border-radius: 6px; opacity: 0; transition: opacity .15s; }
td:hover > .tt-add, .tt-add:focus { opacity: 1; }
@media print {
    .sidebar, .topbar, .d-print-none, .alert { display: none !important; }
    .main, .content { margin: 0 !important; padding: 0 !important; max-width: none !important; }
    .page-header .btn { display: none !important; }
    .card { box-shadow: none !important; border: 0 !important; }
    body { background: #fff !important; }
}
/* ---------- Attendance ---------- */
.att-dot { display: inline-block; width: .6rem; height: .6rem; border-radius: 50%; margin-inline-end: .15rem; }
.att-present { background: var(--bs-success); } .att-absent { background: var(--bs-danger); }
.att-late { background: var(--bs-warning); } .att-excused { background: var(--bs-info); }
.attendance-sheet .att-choice .btn { min-width: 2.4rem; }
[dir="rtl"] .flip-rtl { display: inline-block; transform: scaleX(-1); }
.validation-summary-valid { display: none !important; }
.no-print {} @media print { .no-print { display: none !important; } }
/* ---------- Grading ---------- */
.band { display: inline-block; padding: .1rem .45rem; border-radius: 999px; font-size: .8rem; border: 1px solid; }
.band-pass { background: rgba(25, 135, 84, .08); color: var(--bs-success-text-emphasis); border-color: rgba(25, 135, 84, .25); }
.band-fail { background: rgba(220, 53, 69, .08); color: var(--bs-danger-text-emphasis); border-color: rgba(220, 53, 69, .25); }
.gradebook th, .gradebook td { white-space: nowrap; }
.gradebook .gb-student { min-width: 210px; position: sticky; inset-inline-start: 0; background: var(--edu-surface); z-index: 1; }
.gradebook .gb-col { min-width: 110px; }
.gradebook .score-input { width: 5.5rem; margin-inline: auto; }
.gradebook .gb-total { background: rgba(var(--edu-primary-rgb), .05); }
.gradebook .gb-absent .score-input, .gradebook td.gb-absent { color: var(--bs-danger); }
.gradebook .gb-exempt .score-input, .gradebook td.gb-exempt { color: var(--edu-muted); }
.card-link:hover { border-color: rgba(var(--edu-primary-rgb), .4); }
[dir="ltr"] .flip-ltr { display: inline-block; transform: scaleX(-1); }
/* ---------- Printable documents (report cards, transcripts) ---------- */
.print-doc .card-body { padding: 2rem; }
.doc-head { display: flex; justify-content: space-between; align-items: center; border-bottom: 2px solid var(--edu-primary); padding-bottom: .75rem; margin-bottom: 1rem; }
.doc-brand { display: flex; align-items: center; gap: .6rem; }
.doc-brand .bi { font-size: 1.8rem; color: var(--edu-primary); }
.doc-title { font-size: 1.15rem; font-weight: 700; text-align: center; margin-bottom: 1rem; }
.doc-info { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .4rem 1.5rem; margin-bottom: 1rem; }
.doc-info div { display: flex; gap: .5rem; }
.doc-info dt { color: var(--edu-muted); font-weight: 600; font-size: .85rem; min-width: 90px; }
.doc-info dd { margin: 0; }
.doc-table th { background: var(--bs-tertiary-bg); font-size: .85rem; }
.doc-table tfoot td { background: rgba(var(--edu-primary-rgb), .05); }
.doc-term { text-align: start; background: rgba(var(--edu-primary-rgb), .08) !important; }
.doc-year { font-size: 1rem; font-weight: 700; margin: 1.25rem 0 .5rem; }
.doc-summary { display: flex; flex-wrap: wrap; gap: .5rem 2rem; padding: .75rem 1rem; border: 1px solid var(--edu-border); border-radius: 8px; }
.doc-signatures { display: flex; justify-content: space-between; gap: 1rem; margin-top: 3rem; }
.doc-signatures div { flex: 1; text-align: center; border-top: 1px dashed var(--edu-muted); padding-top: .4rem; font-size: .85rem; color: var(--edu-muted); }
@media print {
    .print-doc { break-after: page; border: 0 !important; }
    .print-doc:last-of-type { break-after: auto; }
    .print-doc .card-body { padding: 0; }
    .band { border: 1px solid #999 !important; }
}
