/* ==========================================================================
   منصة المعلم — Design system
   Brand: navy #000c40 / sky #01b9ff · Font: Cairo · Bootstrap 5 RTL
   ========================================================================== */
:root {
    --brand-navy: #000c40;
    --brand-navy-2: #0a1a5c;
    --brand-sky: #01b9ff;
    --brand-sky-soft: rgba(1, 185, 255, .12);
    --bg: #f3f5fa;
    --surface: #ffffff;
    --surface-2: #f8fafd;
    --border: #e6eaf2;
    --text: #0f1b3d;
    --muted: #6b7591;
    --success: #10b981; --success-soft: #e7f8f1;
    --warning: #f59e0b; --warning-soft: #fef4e2;
    --danger: #ef4444;  --danger-soft: #fdecec;
    --info: #0ea5e9;    --info-soft: #e5f5fd;
    --purple: #7c3aed;  --purple-soft: #f1ebfe;
    --secondary-soft: #eef1f6;
    --radius: 16px;
    --radius-sm: 10px;
    --shadow: 0 1px 2px rgba(16, 24, 64, .04), 0 6px 24px rgba(16, 24, 64, .05);
    --shadow-lg: 0 18px 50px rgba(0, 12, 64, .14);
    --sidebar-w: 272px;
    --topbar-h: 68px;
    --bs-body-font-family: 'Cairo', system-ui, sans-serif;
    --bs-primary: #01b9ff;
    --bs-primary-rgb: 1, 185, 255;
    --bs-link-color: #0291c9;
    --bs-link-hover-color: #000c40;
}

[data-bs-theme="dark"] {
    --bg: #070c22;
    --surface: #0f1631;
    --surface-2: #131c3d;
    --border: #1f2a52;
    --text: #e6ebff;
    --muted: #8e98bd;
    --success-soft: rgba(16,185,129,.15);
    --warning-soft: rgba(245,158,11,.15);
    --danger-soft: rgba(239,68,68,.15);
    --info-soft: rgba(14,165,233,.15);
    --purple-soft: rgba(124,58,237,.18);
    --secondary-soft: rgba(148,163,184,.12);
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.25);
    --bs-body-bg: #070c22;
    --bs-body-color: #e6ebff;
    --bs-border-color: #1f2a52;
    --bs-link-color: #4fd0ff;
}

* { font-family: 'Cairo', system-ui, sans-serif; }
html, body { background: var(--bg); color: var(--text); }
body { font-size: .925rem; -webkit-font-smoothing: antialiased; }
a { text-decoration: none; }
::selection { background: var(--brand-sky); color: #fff; }
.text-muted, .muted { color: var(--muted) !important; }
.fw-800 { font-weight: 800; }
.fs-7 { font-size: .82rem; }
.fs-8 { font-size: .74rem; }
.min-w-0 { min-width: 0 !important; }

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #c9d2e3; border-radius: 8px; }
[data-bs-theme="dark"] ::-webkit-scrollbar-thumb { background: #27335f; }

/* ---------- Shell ---------- */
.app-sidebar {
    position: fixed; inset-block: 0; inset-inline-start: 0; width: var(--sidebar-w);
    background: linear-gradient(180deg, #000c40 0%, #03104e 55%, #061a66 100%);
    color: #c9d3f5; z-index: 1040; display: flex; flex-direction: column;
    transition: transform .25s ease;
}
.app-sidebar::after {
    content: ""; position: absolute; inset: 0; pointer-events: none;
    background: radial-gradient(420px 220px at 110% -5%, rgba(1,185,255,.22), transparent 70%);
}
.sidebar-brand {
    height: var(--topbar-h); display: flex; align-items: center; gap: .75rem; padding: 0 1.25rem;
    border-bottom: 1px solid rgba(255,255,255,.07); position: relative; z-index: 1;
}
.brand-mark {
    width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center;
    background: linear-gradient(135deg, #01b9ff, #0066ff); color: #fff; font-size: 1.25rem;
    box-shadow: 0 8px 20px rgba(1,185,255,.35);
}
.brand-title { color: #fff; font-weight: 800; font-size: 1.05rem; line-height: 1.1; }
.brand-sub { color: #7f8bc0; font-size: .72rem; }
.sidebar-scroll { flex: 1; overflow-y: auto; padding: .75rem .75rem 1.5rem; position: relative; z-index: 1; }
.sidebar-scroll::-webkit-scrollbar-thumb { background: rgba(255,255,255,.12); }
.nav-section { margin-bottom: .15rem; }
.nav-head {
    width: 100%; background: none; border: 0; color: #e1e7ff; display: flex; align-items: center; gap: .7rem;
    padding: .62rem .8rem; border-radius: 11px; font-weight: 600; font-size: .9rem; text-align: start;
    transition: background .15s;
}
.nav-head:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-head .bi:first-child { font-size: 1.08rem; color: #8fa0de; width: 22px; text-align: center; }
.nav-head .chev { margin-inline-start: auto; font-size: .7rem; transition: transform .2s; color: #6f7cb5; }
.nav-head[aria-expanded="true"] .chev { transform: rotate(-180deg); }
.nav-head.active, .nav-head[aria-expanded="true"] { color: #fff; }
.nav-head.active .bi:first-child, .nav-head[aria-expanded="true"] .bi:first-child { color: var(--brand-sky); }
a.nav-head.active { background: rgba(1,185,255,.14); }
.nav-sub { list-style: none; margin: .1rem 0 .35rem; padding: 0 2.05rem 0 0; position: relative; }
.nav-sub::before { content: ""; position: absolute; inset-inline-start: 1.25rem; top: 4px; bottom: 4px; width: 1px; background: rgba(255,255,255,.08); }
.nav-sub a {
    display: flex; align-items: center; gap: .5rem; color: #a9b4e0; padding: .42rem .7rem; border-radius: 9px;
    font-size: .84rem; transition: all .15s; position: relative;
}
.nav-sub a:hover { color: #fff; background: rgba(255,255,255,.05); }
.nav-sub a.active { color: #fff; background: rgba(1,185,255,.16); font-weight: 600; }
.nav-sub a.active::before {
    content: ""; position: absolute; inset-inline-start: -.84rem; width: 7px; height: 7px; border-radius: 50%;
    background: var(--brand-sky); box-shadow: 0 0 0 3px rgba(1,185,255,.25);
}
.nav-badge {
    margin-inline-start: auto; background: var(--brand-sky); color: #001033; font-size: .68rem; font-weight: 700;
    border-radius: 20px; padding: 0 .45rem; min-width: 20px; text-align: center; line-height: 1.45rem;
}
.nav-badge.danger { background: #ff5d6c; color: #fff; }
.nav-star { color: #fbbf24; font-size: .7rem; }
.sidebar-foot { padding: .9rem 1rem; border-top: 1px solid rgba(255,255,255,.07); position: relative; z-index: 1; }
.sidebar-user { display: flex; align-items: center; gap: .65rem; color: #fff; }
.sidebar-user small { color: #8592c8; display: block; font-size: .72rem; }

.app-main { margin-inline-start: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column; }
.app-topbar {
    position: sticky; top: 0; z-index: 1030; height: var(--topbar-h); display: flex; align-items: center; gap: 1rem;
    padding: 0 1.75rem; background: color-mix(in srgb, var(--bg) 82%, transparent);
    backdrop-filter: saturate(160%) blur(12px); border-bottom: 1px solid var(--border);
}
.topbar-search { position: relative; flex: 1; max-width: 420px; }
.topbar-search input {
    background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: .55rem 2.6rem .55rem 1rem;
    width: 100%; color: var(--text); font-size: .87rem; transition: border .15s, box-shadow .15s;
}
.topbar-search input:focus { outline: 0; border-color: var(--brand-sky); box-shadow: 0 0 0 4px var(--brand-sky-soft); }
.topbar-search .bi { position: absolute; inset-inline-start: .95rem; top: 50%; transform: translateY(-50%); color: var(--muted); }
.icon-btn {
    width: 42px; height: 42px; border-radius: 12px; display: inline-grid; place-items: center; position: relative;
    background: var(--surface); border: 1px solid var(--border); color: var(--text); font-size: 1.1rem; transition: all .15s;
}
.icon-btn:hover { border-color: var(--brand-sky); color: var(--brand-sky); }
.icon-btn .dot {
    position: absolute; top: 7px; inset-inline-end: 8px; min-width: 17px; height: 17px; border-radius: 10px; font-size: .62rem;
    background: #ff4d5e; color: #fff; display: grid; place-items: center; font-weight: 700; border: 2px solid var(--surface); padding: 0 3px;
}
.app-content { padding: 1.75rem; flex: 1; }
.app-footer { padding: 1rem 1.75rem; color: var(--muted); font-size: .78rem; border-top: 1px solid var(--border); }
.sidebar-backdrop { display: none; }

@media (max-width: 991.98px) {
    .app-sidebar { transform: translateX(100%); }
    body.sidebar-open .app-sidebar { transform: none; box-shadow: var(--shadow-lg); }
    body.sidebar-open .sidebar-backdrop { display: block; position: fixed; inset: 0; background: rgba(0,8,40,.45); z-index: 1035; }
    .app-main { margin-inline-start: 0; }
    .app-content { padding: 1.1rem; }
    .app-topbar { padding: 0 1rem; }
}

/* ---------- Dropdowns ---------- */
.dropdown-menu {
    border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-lg); padding: .45rem;
    background: var(--surface); font-size: .87rem;
}
.dropdown-item { border-radius: 9px; padding: .5rem .75rem; color: var(--text); }
.dropdown-item:hover, .dropdown-item:focus { background: var(--surface-2); color: var(--text); }
.dropdown-item .bi { color: var(--muted); margin-inline-end: .45rem; }
.alert-menu { width: 360px; padding: 0; overflow: hidden; }
.alert-menu .menu-head { padding: .85rem 1rem; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.alert-item { display: flex; gap: .7rem; padding: .75rem 1rem; border-bottom: 1px solid var(--border); color: var(--text); }
.alert-item:hover { background: var(--surface-2); color: var(--text); }
.alert-item.unread { background: color-mix(in srgb, var(--brand-sky) 5%, var(--surface)); }

/* ---------- Page header ---------- */
.page-header { display: flex; flex-wrap: wrap; gap: 1rem; align-items: flex-end; justify-content: space-between; margin-bottom: 1.5rem; }
.page-title { font-size: 1.55rem; font-weight: 800; margin: 0; letter-spacing: -.2px; }
.page-sub { color: var(--muted); margin: .2rem 0 0; font-size: .9rem; }
.crumbs { font-size: .78rem; color: var(--muted); margin-bottom: .3rem; display: flex; gap: .35rem; align-items: center; }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--brand-sky); }

/* ---------- Cards ---------- */
.card, .panel {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); color: var(--text);
}
.panel { padding: 1.35rem; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: 1rem; }
.panel-title { font-weight: 700; font-size: 1rem; margin: 0; display: flex; align-items: center; gap: .5rem; }
.panel-title .bi { color: var(--brand-sky); }
.panel-link { font-size: .8rem; font-weight: 600; color: var(--brand-sky); }
.panel-flush { padding: 0; overflow: hidden; }
.panel-flush .panel-head { padding: 1.1rem 1.35rem 0; }
.card-header, .card-footer { background: transparent; border-color: var(--border); }

/* Stat tiles */
.stat {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.15rem 1.2rem;
    box-shadow: var(--shadow); display: flex; gap: 1rem; align-items: center; height: 100%; position: relative; overflow: hidden;
}
.stat-icon { width: 50px; height: 50px; border-radius: 14px; display: grid; place-items: center; font-size: 1.35rem; flex-shrink: 0; }
.stat-value { font-size: 1.6rem; font-weight: 800; line-height: 1.1; }
.stat-label { color: var(--muted); font-size: .8rem; font-weight: 600; }
.stat-foot { font-size: .74rem; margin-top: .15rem; color: var(--muted); }
.tint-sky { background: var(--brand-sky-soft); color: #0291c9; }
.tint-navy { background: rgba(0,12,64,.08); color: var(--brand-navy); }
[data-bs-theme="dark"] .tint-navy { background: rgba(120,140,255,.14); color: #a9b8ff; }
.tint-success { background: var(--success-soft); color: var(--success); }
.tint-warning { background: var(--warning-soft); color: #d97706; }
.tint-danger { background: var(--danger-soft); color: var(--danger); }
.tint-info { background: var(--info-soft); color: var(--info); }
.tint-purple { background: var(--purple-soft); color: var(--purple); }
.tint-secondary { background: var(--secondary-soft); color: var(--muted); }

/* Hero */
.hero {
    border-radius: 22px; padding: 1.75rem 2rem; color: #fff; position: relative; overflow: hidden;
    background: linear-gradient(120deg, #000c40 0%, #062a8a 60%, #0a7fd1 100%); box-shadow: var(--shadow-lg);
}
.hero::before { content: ""; position: absolute; width: 380px; height: 380px; border-radius: 50%; inset-inline-end: -120px; top: -180px; background: radial-gradient(circle, rgba(1,185,255,.55), transparent 65%); }
.hero::after { content: ""; position: absolute; width: 220px; height: 220px; border-radius: 50%; inset-inline-start: 30%; bottom: -150px; background: radial-gradient(circle, rgba(255,255,255,.12), transparent 70%); }
.hero > * { position: relative; z-index: 1; }
.hero h2 { font-weight: 800; font-size: 1.55rem; margin: 0; }
.hero p { color: #c8d6ff; margin: .25rem 0 0; }
.hero-pill { background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.18); border-radius: 14px; padding: .65rem 1rem; min-width: 120px; }
.hero-pill b { display: block; font-size: 1.35rem; font-weight: 800; }
.hero-pill span { color: #c8d6ff; font-size: .76rem; }

/* ---------- Chips / badges ---------- */
.chip { display: inline-flex; align-items: center; gap: .3rem; font-size: .74rem; font-weight: 700; padding: .22rem .65rem; border-radius: 20px; white-space: nowrap; }
.chip-success { background: var(--success-soft); color: #059669; }
.chip-warning { background: var(--warning-soft); color: #b45309; }
.chip-danger { background: var(--danger-soft); color: #dc2626; }
.chip-info { background: var(--info-soft); color: #0284c7; }
.chip-secondary { background: var(--secondary-soft); color: var(--muted); }
.chip-purple { background: var(--purple-soft); color: var(--purple); }
.chip-navy { background: rgba(0,12,64,.07); color: var(--brand-navy); }
[data-bs-theme="dark"] .chip-navy { background: rgba(120,140,255,.14); color: #b8c3ff; }
[data-bs-theme="dark"] .chip-success { color: #34d399; } [data-bs-theme="dark"] .chip-warning { color: #fbbf24; }
[data-bs-theme="dark"] .chip-danger { color: #f87171; } [data-bs-theme="dark"] .chip-info { color: #38bdf8; }

/* ---------- Buttons ---------- */
.btn { border-radius: 11px; font-weight: 600; font-size: .87rem; padding: .52rem 1.05rem; }
.btn-sm { border-radius: 9px; font-size: .78rem; padding: .32rem .7rem; }
.btn-brand { background: var(--brand-navy); color: #fff; border: 1px solid var(--brand-navy); }
.btn-brand:hover, .btn-brand:focus { background: #071a6b; color: #fff; border-color: #071a6b; }
[data-bs-theme="dark"] .btn-brand { background: var(--brand-sky); border-color: var(--brand-sky); color: #001033; }
.btn-sky { background: var(--brand-sky); color: #001033; border: 1px solid var(--brand-sky); }
.btn-sky:hover { background: #00a5e6; color: #001033; }
.btn-soft { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.btn-soft:hover { border-color: var(--brand-sky); color: var(--brand-sky); background: var(--surface); }
.btn-soft-danger { background: var(--danger-soft); color: var(--danger); border: 1px solid transparent; }
.btn-soft-danger:hover { background: var(--danger); color: #fff; }
.btn-soft-success { background: var(--success-soft); color: #059669; border: 1px solid transparent; }
.btn-soft-success:hover { background: var(--success); color: #fff; }
.btn-icon { width: 34px; height: 34px; padding: 0; display: inline-grid; place-items: center; border-radius: 10px; }

/* ---------- Forms ---------- */
.form-label { font-weight: 600; font-size: .83rem; margin-bottom: .35rem; color: var(--text); }
.form-control, .form-select {
    border-radius: 11px; border-color: var(--border); padding: .58rem .9rem; font-size: .9rem; background-color: var(--surface); color: var(--text);
}
.form-control:focus, .form-select:focus { border-color: var(--brand-sky); box-shadow: 0 0 0 4px var(--brand-sky-soft); }
.form-select { background-position: left .75rem center; padding-left: 2.25rem; padding-right: .9rem; }
.form-check-input:checked { background-color: var(--brand-sky); border-color: var(--brand-sky); }
.form-hint { font-size: .75rem; color: var(--muted); margin-top: .25rem; }
.field-validation-error, .validation-summary-errors { color: var(--danger); font-size: .78rem; }
.validation-summary-errors ul { margin: 0; padding-inline-start: 1rem; }
.input-group-text { background: var(--surface-2); border-color: var(--border); border-radius: 11px; }
.form-section { border-top: 1px dashed var(--border); padding-top: 1.25rem; margin-top: 1.25rem; }
.form-section-title { font-weight: 700; font-size: .92rem; margin-bottom: .9rem; display: flex; gap: .45rem; align-items: center; }
.form-section-title .bi { color: var(--brand-sky); }
.sticky-actions { position: sticky; bottom: 0; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(8px); border-top: 1px solid var(--border); padding: .9rem 1.35rem; margin: 1.35rem -1.35rem -1.35rem; border-radius: 0 0 var(--radius) var(--radius); display: flex; gap: .5rem; justify-content: flex-end; }

/* Filter bar */
.filter-bar { display: flex; flex-wrap: wrap; gap: .6rem; align-items: end; padding: 1rem 1.2rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 1.25rem; box-shadow: var(--shadow); }
.filter-bar .form-control, .filter-bar .form-select { min-width: 170px; }
.filter-bar .grow { flex: 1; min-width: 220px; }

/* ---------- Tables ---------- */
.table { color: var(--text); --bs-table-bg: transparent; margin: 0; --bs-table-hover-bg: var(--surface-2); }
.table > thead th {
    background: var(--surface-2); color: var(--muted); font-weight: 700; font-size: .76rem; border-bottom: 1px solid var(--border);
    padding: .8rem 1rem; white-space: nowrap;
}
.table > tbody td { padding: .8rem 1rem; border-color: var(--border); vertical-align: middle; }
.table-wrap { overflow-x: auto; }
.table-wrap .table > thead th:first-child { border-start-start-radius: 0; }
.row-title { font-weight: 700; color: var(--text); }
.row-title:hover { color: var(--brand-sky); }
.row-sub { color: var(--muted); font-size: .77rem; }

/* ---------- Avatars ---------- */
.avatar { width: 38px; height: 38px; border-radius: 12px; display: inline-grid; place-items: center; color: #fff; font-weight: 700; font-size: .85rem; flex-shrink: 0; object-fit: cover; }
.avatar-sm { width: 30px; height: 30px; border-radius: 9px; font-size: .72rem; }
.avatar-lg { width: 84px; height: 84px; border-radius: 22px; font-size: 1.7rem; }
.avatar-xl { width: 104px; height: 104px; border-radius: 26px; font-size: 2rem; }
.person { display: flex; align-items: center; gap: .7rem; min-width: 0; }
.person-name { font-weight: 700; color: var(--text); line-height: 1.25; }

/* ---------- Progress ---------- */
.progress { height: 8px; border-radius: 10px; background: var(--secondary-soft); }
.progress-bar { border-radius: 10px; background: linear-gradient(90deg, #01b9ff, #0066ff); }
.progress-thin { height: 5px; }
.ring { --p: 0; --c: var(--brand-sky); width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center;
    background: conic-gradient(var(--c) calc(var(--p) * 1%), var(--secondary-soft) 0); }
.ring::before { content: attr(data-label); width: 50px; height: 50px; border-radius: 50%; background: var(--surface); display: grid; place-items: center; font-weight: 800; font-size: .82rem; }

/* ---------- Lists / timeline ---------- */
.list-row { display: flex; align-items: center; gap: .85rem; padding: .8rem 0; border-bottom: 1px solid var(--border); }
.list-row:last-child { border-bottom: 0; padding-bottom: 0; }
.list-row:first-child { padding-top: 0; }
.list-icon { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; flex-shrink: 0; font-size: 1.05rem; }
.timeline-period { display: flex; gap: .9rem; padding: .85rem; border-radius: 14px; border: 1px solid var(--border); background: var(--surface-2); align-items: center; }
.timeline-period + .timeline-period { margin-top: .6rem; }
.timeline-period.now { border-color: var(--brand-sky); background: color-mix(in srgb, var(--brand-sky) 7%, var(--surface)); box-shadow: 0 0 0 4px var(--brand-sky-soft); }
.timeline-period.done { opacity: .72; }
.period-num { width: 46px; height: 46px; border-radius: 13px; background: var(--brand-navy); color: #fff; display: grid; place-items: center; font-weight: 800; flex-shrink: 0; line-height: 1; text-align: center; font-size: .95rem; }
[data-bs-theme="dark"] .period-num { background: #1d2b66; }
.timeline-period.now .period-num { background: var(--brand-sky); color: #001033; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: #22c55e; display: inline-block; box-shadow: 0 0 0 0 rgba(34,197,94,.6); animation: pulse 1.6s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 8px rgba(34,197,94,0); } 100% { box-shadow: 0 0 0 0 rgba(34,197,94,0); } }

/* ---------- Empty state ---------- */
.empty { text-align: center; padding: 2.75rem 1rem; color: var(--muted); }
.empty-icon { width: 74px; height: 74px; border-radius: 22px; margin: 0 auto 1rem; display: grid; place-items: center; font-size: 2rem; background: var(--brand-sky-soft); color: var(--brand-sky); }
.empty h6 { font-weight: 700; color: var(--text); }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: .3rem; border-bottom: 1px solid var(--border); margin-bottom: 1.25rem; overflow-x: auto; }
.tabs .tab { padding: .7rem 1rem; color: var(--muted); font-weight: 600; font-size: .87rem; border-bottom: 2px solid transparent; white-space: nowrap; background: none; border-top: 0; border-inline: 0; display: inline-flex; gap: .4rem; align-items: center; }
.tabs .tab:hover { color: var(--text); }
.tabs .tab.active { color: var(--brand-navy); border-bottom-color: var(--brand-sky); }
[data-bs-theme="dark"] .tabs .tab.active { color: #fff; }
.tabs .count { background: var(--secondary-soft); color: var(--muted); border-radius: 20px; font-size: .7rem; padding: 0 .45rem; }
.tabs .tab.active .count { background: var(--brand-sky); color: #001033; }
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 3px; }
.seg a, .seg button { border: 0; background: none; padding: .38rem .85rem; border-radius: 9px; color: var(--muted); font-weight: 600; font-size: .8rem; }
.seg .active { background: var(--surface); color: var(--text); box-shadow: 0 1px 4px rgba(0,0,0,.08); }

/* ---------- Class cards ---------- */
.class-card { position: relative; overflow: hidden; transition: transform .18s, box-shadow .18s; }
.class-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.class-card .band { height: 6px; }
.subject-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }

/* ---------- Timetable ---------- */
.tt { display: grid; grid-template-columns: 110px repeat(5, minmax(150px, 1fr)); gap: 8px; min-width: 880px; }
.tt-head { font-weight: 700; color: var(--muted); font-size: .8rem; text-align: center; padding: .4rem; }
.tt-head.today { color: var(--brand-sky); }
.tt-time { font-size: .74rem; color: var(--muted); display: flex; flex-direction: column; justify-content: center; align-items: center; background: var(--surface-2); border-radius: 12px; border: 1px solid var(--border); }
.tt-time b { color: var(--text); font-size: .95rem; }
.tt-cell { min-height: 78px; border-radius: 12px; border: 1px dashed var(--border); }
.tt-slot { height: 100%; border-radius: 12px; padding: .55rem .7rem; color: #fff; display: flex; flex-direction: column; justify-content: space-between; border: 0; }
.tt-slot b { font-size: .86rem; }
.tt-slot span { font-size: .72rem; opacity: .9; }

/* ---------- Attendance taking ---------- */
.att-row { display: flex; align-items: center; gap: .75rem; padding: .7rem 1rem; border-bottom: 1px solid var(--border); }
.att-row:last-child { border-bottom: 0; }
.att-opts { display: flex; gap: .35rem; margin-inline-start: auto; flex-wrap: wrap; }
.att-opts input { display: none; }
.att-opts label { border: 1px solid var(--border); border-radius: 10px; padding: .35rem .75rem; font-size: .8rem; font-weight: 600; cursor: pointer; color: var(--muted); background: var(--surface); transition: all .12s; user-select: none; }
.att-opts input[value="1"]:checked + label { background: var(--success); border-color: var(--success); color: #fff; }
.att-opts input[value="2"]:checked + label { background: var(--danger); border-color: var(--danger); color: #fff; }
.att-opts input[value="3"]:checked + label { background: var(--warning); border-color: var(--warning); color: #fff; }
.att-opts input[value="4"]:checked + label { background: var(--info); border-color: var(--info); color: #fff; }
.att-summary { display: flex; gap: .5rem; flex-wrap: wrap; }

/* ---------- Gradebook ---------- */
.gb input.form-control { width: 76px; text-align: center; padding: .35rem .3rem; font-weight: 600; margin: 0 auto; }
.gb th.comp { text-align: center; min-width: 96px; }
.gb td.total { font-weight: 800; text-align: center; }
.gb .sticky-col { position: sticky; inset-inline-start: 0; background: var(--surface); z-index: 1; }
.gb thead .sticky-col { background: var(--surface-2); }
.gb input.changed { border-color: var(--warning); background: var(--warning-soft); }

/* ---------- Misc ---------- */
.kv { display: grid; grid-template-columns: 140px 1fr; gap: .55rem 1rem; font-size: .88rem; }
.kv dt { color: var(--muted); font-weight: 600; }
.kv dd { margin: 0; font-weight: 600; }
.prose { white-space: pre-line; line-height: 1.9; }
.divider { height: 1px; background: var(--border); margin: 1.1rem 0; }
.option-row { display: flex; gap: .5rem; align-items: center; margin-bottom: .5rem; }
.q-card { border: 1px solid var(--border); border-radius: 14px; padding: 1rem 1.1rem; background: var(--surface); }
.q-card + .q-card { margin-top: .75rem; }
.opt { padding: .45rem .75rem; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); margin-top: .4rem; font-size: .87rem; }
.opt.correct { background: var(--success-soft); border-color: rgba(16,185,129,.35); color: #047857; font-weight: 600; }
.msg-bubble { max-width: 78%; padding: .85rem 1rem; border-radius: 16px; background: var(--surface-2); border: 1px solid var(--border); }
.msg-bubble.out { background: var(--brand-navy); color: #e7ecff; border-color: var(--brand-navy); }
.msg-bubble.out .text-muted { color: #9fb0e8 !important; }
.calendar-day { border: 1px solid var(--border); border-radius: 12px; min-height: 104px; padding: .45rem; background: var(--surface); }
.calendar-day.muted-day { background: var(--surface-2); opacity: .6; }
.calendar-day.today { border-color: var(--brand-sky); box-shadow: inset 0 0 0 1px var(--brand-sky); }
.calendar-day .d { font-size: .78rem; font-weight: 700; color: var(--muted); }
.cal-event { display: block; font-size: .72rem; border-radius: 7px; padding: .18rem .4rem; margin-top: .25rem; background: var(--brand-sky-soft); color: #0273a1; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.call-card { border-inline-start: 4px solid var(--warning); }
.call-card.released { border-inline-start-color: var(--success); opacity: .8; }
.file-tile { display: flex; gap: .85rem; align-items: center; padding: 1rem; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); transition: all .15s; height: 100%; }
.file-tile:hover { border-color: var(--brand-sky); box-shadow: var(--shadow); }
.file-tile .bi { font-size: 2rem; }
.toast-zone { position: fixed; bottom: 1.25rem; inset-inline-start: 50%; transform: translateX(50%); z-index: 2000; display: flex; flex-direction: column; gap: .5rem; }
.toast-msg { background: var(--brand-navy); color: #fff; padding: .8rem 1.1rem; border-radius: 14px; box-shadow: var(--shadow-lg); display: flex; gap: .6rem; align-items: center; font-weight: 600; font-size: .88rem; animation: toastIn .3s ease; min-width: 280px; }
.toast-msg.error { background: #b91c1c; }
.toast-msg .bi { font-size: 1.15rem; color: var(--brand-sky); }
.toast-msg.error .bi { color: #fff; }
@keyframes toastIn { from { opacity: 0; transform: translateY(12px); } }
.chart-box { position: relative; height: 280px; }
.chart-box.sm { height: 220px; }
.text-sky { color: var(--brand-sky) !important; }
.text-navy { color: var(--brand-navy) !important; }
[data-bs-theme="dark"] .text-navy { color: #fff !important; }
.bg-surface { background: var(--surface) !important; }
.border-soft { border-color: var(--border) !important; }
.goal-domain { width: 6px; border-radius: 6px; align-self: stretch; }
.rating-stars .bi { color: #fbbf24; }
.modal-content { border-radius: 18px; border: 1px solid var(--border); background: var(--surface); }
.modal-header, .modal-footer { border-color: var(--border); }
.pagination .page-link { border-radius: 9px !important; margin: 0 2px; border-color: var(--border); color: var(--text); background: var(--surface); }
.pagination .active .page-link { background: var(--brand-navy); border-color: var(--brand-navy); color: #fff; }

/* ---------- Login ---------- */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; background: var(--surface); }
.auth-side {
    background: linear-gradient(150deg, #000c40 0%, #05207a 55%, #0a86d8 100%); color: #fff; padding: 3rem; position: relative; overflow: hidden;
    display: flex; flex-direction: column; justify-content: space-between;
}
.auth-side::before { content: ""; position: absolute; width: 560px; height: 560px; border-radius: 50%; top: -220px; inset-inline-end: -200px; background: radial-gradient(circle, rgba(1,185,255,.45), transparent 65%); }
.auth-side > * { position: relative; }
.auth-feature { display: flex; gap: .9rem; align-items: flex-start; margin-bottom: 1.1rem; }
.auth-feature .bi { width: 44px; height: 44px; border-radius: 13px; background: rgba(255,255,255,.12); display: grid; place-items: center; font-size: 1.2rem; flex-shrink: 0; color: #7fdcff; }
.auth-feature p { color: #c2cff7; margin: 0; font-size: .86rem; }
.auth-form { display: flex; align-items: center; justify-content: center; padding: 2.5rem; }
.auth-card { width: 100%; max-width: 420px; }
@media (max-width: 991.98px) { .auth-wrap { grid-template-columns: 1fr; } .auth-side { display: none; } }

@media print {
    .app-sidebar, .app-topbar, .app-footer, .no-print, .page-header .btn { display: none !important; }
    .app-main { margin: 0; } .app-content { padding: 0; } body { background: #fff; }
    .panel, .card { box-shadow: none; border-color: #ddd; }
}

/* ---------- School management additions ---------- */
.chip-sky { background: var(--brand-sky-soft); color: #0284c7; }
[data-bs-theme="dark"] .chip-sky { color: #7dd3fc; }
.seg label { border: 0; background: none; padding: .38rem .85rem; border-radius: 9px; color: var(--muted); font-weight: 600; font-size: .8rem; margin: 0; cursor: pointer; }
.seg label.active { background: var(--surface); color: var(--text); box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.tt-add { cursor: pointer; display: grid; place-items: center; transition: all .15s; }
.tt-add::after { content: "+"; font-size: 1.3rem; color: transparent; font-weight: 300; }
.tt-add:hover { background: var(--brand-sky-soft); border-color: var(--brand-sky); border-style: solid; }
.tt-add:hover::after { color: var(--brand-sky); }
.option-row:has(input:checked) { background: color-mix(in srgb, var(--brand-sky) 7%, transparent); border-color: var(--brand-sky) !important; }
label.chip:has(input:checked) { background: var(--brand-navy); color: #fff; }
body.school .sidebar-brand .brand-sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 170px; }
.tt-compact { grid-template-columns: 84px repeat(5, minmax(118px, 1fr)); min-width: 700px; }
