/* ==========================================================================
   SMS admin theme on Bootstrap 5.3 — light + dark via data-bs-theme
   ========================================================================== */
:root {
    --sb-w: 264px;
    --sb-mini-w: 76px;
    --top-h: 64px;
    --brand: #4f46e5;
    --brand-rgb: 79, 70, 229;
    --brand-soft: rgba(79, 70, 229, .1);
    --sb-bg: #0f172a;
    --sb-bg-2: #111c33;
    --sb-text: #94a3b8;
    --sb-text-hi: #f1f5f9;
    --sb-hover: rgba(148, 163, 184, .1);
    --app-bg: #f4f6fb;
    --card-bg: #fff;
    --card-border: #e8ebf3;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, .04), 0 1px 3px rgba(15, 23, 42, .06);
    --radius: .85rem;

    --bs-primary: var(--brand);
    --bs-primary-rgb: var(--brand-rgb);
    --bs-link-color: var(--brand);
    --bs-link-color-rgb: var(--brand-rgb);
    --bs-link-hover-color: #4338ca;
    --bs-body-font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", Arial, sans-serif;
    --bs-body-font-size: .925rem;
    --bs-border-radius: .55rem;
}
[data-bs-theme="dark"] {
    --app-bg: #0b1120;
    --card-bg: #111827;
    --card-border: #1f2937;
    --sb-bg: #0a0f1d;
    --sb-bg-2: #0d1426;
    --brand-soft: rgba(129, 140, 248, .14);
    --bs-body-bg: #0b1120;
    --bs-link-color: #818cf8;
    --bs-link-color-rgb: 129, 140, 248;
    --shadow-sm: none;
}

body { background: var(--app-bg); -webkit-font-smoothing: antialiased; }
.min-w-0 { min-width: 0; }
a { text-decoration: none; }

/* Buttons */
.btn-primary {
    --bs-btn-bg: var(--brand); --bs-btn-border-color: var(--brand);
    --bs-btn-hover-bg: #4338ca; --bs-btn-hover-border-color: #4338ca;
    --bs-btn-active-bg: #3730a3; --bs-btn-active-border-color: #3730a3;
    --bs-btn-disabled-bg: var(--brand); --bs-btn-disabled-border-color: var(--brand);
}
.btn-outline-primary {
    --bs-btn-color: var(--brand); --bs-btn-border-color: var(--brand);
    --bs-btn-hover-bg: var(--brand); --bs-btn-hover-border-color: var(--brand);
    --bs-btn-active-bg: var(--brand); --bs-btn-active-border-color: var(--brand);
}
.btn-light { --bs-btn-bg: var(--bs-tertiary-bg); --bs-btn-border-color: var(--card-border); }
.btn-icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 2.25rem; height: 2.25rem; padding: 0; border-radius: .6rem; border: 0;
    color: var(--bs-secondary-color); background: transparent;
}
.btn-icon.btn-sm { width: 2rem; height: 2rem; }
.btn-icon:hover { background: var(--bs-tertiary-bg); color: var(--bs-body-color); }
.form-control:focus, .form-select:focus { border-color: rgba(var(--brand-rgb), .5); box-shadow: 0 0 0 .2rem rgba(var(--brand-rgb), .15); }
.form-check-input:checked { background-color: var(--brand); border-color: var(--brand); }
.form-label { font-weight: 500; font-size: .85rem; margin-bottom: .35rem; }

/* ---------- Layout ---------- */
.app { display: flex; min-height: 100vh; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; margin-inline-start: var(--sb-w); transition: margin .2s ease; }
.content { flex: 1; padding: 1.5rem; max-width: 1600px; width: 100%; }
.footer { padding: 1rem 1.5rem; font-size: .8rem; color: var(--bs-secondary-color); }

/* ---------- Sidebar ---------- */
.sidebar {
    position: fixed; inset-block: 0; inset-inline-start: 0; z-index: 1040; width: var(--sb-w);
    background: linear-gradient(180deg, var(--sb-bg), var(--sb-bg-2)); color: var(--sb-text);
    display: flex; flex-direction: column; transition: width .2s ease, transform .25s ease;
}
.sidebar-brand { height: var(--top-h); display: flex; align-items: center; gap: .7rem; padding: 0 1.1rem; border-bottom: 1px solid rgba(148, 163, 184, .08); flex-shrink: 0; color: #fff; }
.sidebar-brand:hover { color: #fff; }
.sidebar-brand .brand-mini { border-radius: .55rem; object-fit: contain; background: #fff; padding: 3px; flex-shrink: 0; }
.sidebar-brand .brand-full { font-weight: 700; font-size: .95rem; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.sidebar-brand .brand-full small { display: block; font-weight: 500; font-size: .68rem; color: var(--sb-text); text-transform: uppercase; letter-spacing: .06em; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: .75rem .65rem 2rem; scrollbar-width: thin; scrollbar-color: rgba(148, 163, 184, .25) transparent; }
.nav-top {
    display: flex; align-items: center; gap: .75rem; width: 100%; border: 0; background: none;
    color: var(--sb-text); padding: .6rem .8rem; border-radius: .6rem; font-size: .875rem; font-weight: 500;
    text-align: start; white-space: nowrap; transition: background .15s, color .15s;
}
.nav-top > .bi:first-child { font-size: 1.1rem; width: 1.25rem; text-align: center; flex-shrink: 0; }
.nav-top span { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.nav-top .caret { font-size: .7rem; transition: transform .2s; }
.nav-top:hover { background: var(--sb-hover); color: var(--sb-text-hi); }
.nav-top.active { background: var(--brand); color: #fff; box-shadow: 0 6px 16px -6px rgba(var(--brand-rgb), .7); }
.nav-group.open > .nav-top { color: var(--sb-text-hi); }
.nav-group.open > .nav-top .caret { transform: rotate(180deg); }
.nav-sub { display: none; padding: .2rem 0 .4rem; margin-inline-start: 1.4rem; border-inline-start: 1px solid rgba(148, 163, 184, .15); }
.nav-group.open > .nav-sub { display: block; }
.nav-sub a {
    display: flex; align-items: center; gap: .5rem; padding: .42rem .9rem; margin-inline-start: .35rem;
    color: var(--sb-text); font-size: .835rem; border-radius: .5rem;
}
.nav-sub a span:first-child { flex: 1; }
.nav-sub a:hover { color: var(--sb-text-hi); background: var(--sb-hover); }
.nav-sub a.active { color: #fff; background: rgba(var(--brand-rgb), .35); font-weight: 500; }
.dot-pending { width: 6px; height: 6px; border-radius: 50%; background: rgba(148, 163, 184, .35); flex-shrink: 0; }

/* Mini (collapsed) sidebar on desktop */
@media (min-width: 992px) {
    .sb-mini .sidebar { width: var(--sb-mini-w); }
    .sb-mini .main { margin-inline-start: var(--sb-mini-w); }
    .sb-mini .sidebar-brand { justify-content: center; padding: 0; }
    .sb-mini .sidebar-brand .brand-full { display: none; }
    .sb-mini .nav-top { justify-content: center; padding: .7rem; }
    .sb-mini .nav-top span, .sb-mini .nav-top .caret, .sb-mini .nav-sub { display: none !important; }
    .sb-mini .sidebar:hover { width: var(--sb-w); box-shadow: 8px 0 30px rgba(0, 0, 0, .25); }
    .sb-mini .sidebar:hover .sidebar-brand { justify-content: flex-start; padding: 0 1.1rem; }
    .sb-mini .sidebar:hover .brand-full { display: block; }
    .sb-mini .sidebar:hover .nav-top { justify-content: flex-start; padding: .6rem .8rem; }
    .sb-mini .sidebar:hover .nav-top span, .sb-mini .sidebar:hover .nav-top .caret { display: inline !important; }
    .sb-mini .sidebar:hover .nav-group.open > .nav-sub { display: block !important; }
}
/* Off-canvas sidebar on mobile */
.sidebar-backdrop { display: none; }
@media (max-width: 991.98px) {
    .main { margin-inline-start: 0; }
    .sidebar { transform: translateX(-100%); }
    [dir="rtl"] .sidebar { transform: translateX(100%); }
    .sb-open .sidebar { transform: none; }
    .sb-open .sidebar-backdrop { display: block; position: fixed; inset: 0; z-index: 1035; background: rgba(15, 23, 42, .5); }
    .content { padding: 1rem; }
}

/* ---------- Top bar ---------- */
.topbar {
    position: sticky; top: 0; z-index: 1020; height: var(--top-h); display: flex; align-items: center; gap: .75rem;
    padding: 0 1.25rem; background: rgba(255, 255, 255, .85); backdrop-filter: saturate(180%) blur(10px);
    border-bottom: 1px solid var(--card-border);
}
[data-bs-theme="dark"] .topbar { background: rgba(17, 24, 39, .85); }
.topbar-search { flex: 0 1 420px; }
.topbar-search > .bi { position: absolute; inset-inline-start: .85rem; top: 50%; transform: translateY(-50%); color: var(--bs-secondary-color); pointer-events: none; }
.topbar-search .form-control { padding-inline-start: 2.4rem; border-radius: 2rem; background: var(--bs-tertiary-bg); border-color: transparent; }
.topbar-search .form-control:focus { background: var(--bs-body-bg); }
.topbar-search .dropdown-menu { top: calc(100% + .35rem); max-height: 70vh; overflow-y: auto; }
.session-pick { width: auto; border-radius: 2rem; font-weight: 500; }
.btn-user { display: flex; align-items: center; gap: .6rem; border: 0; padding: .25rem .5rem; border-radius: 2rem; }
.btn-user:hover { background: var(--bs-tertiary-bg); }
@media (max-width: 575.98px) { .topbar-search { display: none; } }

/* ---------- Page header ---------- */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; }
.page-title { font-size: 1.4rem; font-weight: 700; margin: 0; letter-spacing: -.01em; }
.page-sub { margin: .2rem 0 0; color: var(--bs-secondary-color); font-size: .875rem; }

/* ---------- Cards ---------- */
.card { --bs-card-bg: var(--card-bg); --bs-card-border-color: var(--card-border); --bs-card-border-radius: var(--radius); --bs-card-inner-border-radius: calc(var(--radius) - 1px); box-shadow: var(--shadow-sm); }
.card-header { background: transparent; padding: .9rem 1.15rem; border-bottom-color: var(--card-border); }
.card-title { font-size: 1rem; font-weight: 600; margin: 0; }
.card .list-group-item { background: transparent; border-color: var(--card-border); padding: .7rem 1.15rem; }

.stat-card {
    display: flex; gap: 1rem; align-items: center; padding: 1.15rem; height: 100%;
    background: var(--card-bg); border: 1px solid var(--card-border); border-radius: var(--radius);
    box-shadow: var(--shadow-sm); color: inherit; transition: transform .15s, box-shadow .15s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 10px 24px -12px rgba(15, 23, 42, .25); color: inherit; }
.stat-icon { width: 3rem; height: 3rem; border-radius: .85rem; display: grid; place-items: center; font-size: 1.35rem; flex-shrink: 0; }
.stat-label { font-size: .78rem; color: var(--bs-secondary-color); font-weight: 500; text-transform: uppercase; letter-spacing: .03em; }
.stat-value { font-size: 1.5rem; font-weight: 700; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-foot { font-size: .78rem; color: var(--bs-secondary-color); }
.tone-primary .stat-icon { background: var(--brand-soft); color: var(--brand); }
.tone-info .stat-icon { background: rgba(14, 165, 233, .12); color: #0ea5e9; }
.tone-success .stat-icon { background: rgba(16, 185, 129, .12); color: #10b981; }
.tone-warning .stat-icon { background: rgba(245, 158, 11, .14); color: #f59e0b; }
.mini-row { display: flex; align-items: center; gap: .75rem; }
.mini-ic { width: 2.2rem; height: 2.2rem; border-radius: .6rem; display: grid; place-items: center; }
.chart-box { position: relative; height: 300px; }
.chart-box.sm { height: 90px; }

/* ---------- Tables / filters ---------- */
.table { --bs-table-bg: transparent; --bs-table-hover-bg: rgba(var(--brand-rgb), .035); margin: 0; }
.table > :not(caption) > * > * { padding: .7rem 1rem; border-bottom-color: var(--card-border); }
.table thead th { font-size: .74rem; text-transform: uppercase; letter-spacing: .04em; color: var(--bs-secondary-color); font-weight: 600; background: var(--bs-tertiary-bg); white-space: nowrap; }
.table td.text-end, .table th.text-end { white-space: nowrap; }
.filter-bar { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.search-box { max-width: 320px; }
.empty-state { display: flex; flex-direction: column; align-items: center; gap: .35rem; padding: 3rem 1rem; color: var(--bs-secondary-color); }
.empty-state > .bi { font-size: 2.2rem; opacity: .5; }
.empty-state.sm { padding: 1.5rem 1rem; }
.empty-state.sm > .bi { font-size: 1.5rem; }
.nav-pills-soft .nav-link { color: var(--bs-secondary-color); border-radius: 2rem; padding: .4rem 1rem; font-weight: 500; }
.nav-pills-soft .nav-link.active { background: var(--brand-soft); color: var(--brand); }
.pagination { --bs-pagination-active-bg: var(--brand); --bs-pagination-active-border-color: var(--brand); --bs-pagination-color: var(--bs-body-color); }
.avatar { width: 2.4rem; height: 2.4rem; border-radius: 50%; object-fit: cover; flex-shrink: 0; background: var(--bs-tertiary-bg); }
.chip { display: inline-block; padding: .15rem .55rem; border-radius: 2rem; font-size: .75rem; font-weight: 500; background: var(--brand-soft); color: var(--brand); margin: .1rem; }

/* ---------- Profile ---------- */
.profile-hero { position: relative; overflow: hidden; }
.profile-hero::before { content: ""; position: absolute; inset: 0 0 auto; height: 88px; background: linear-gradient(120deg, var(--brand), #7c3aed 60%, #db2777); opacity: .9; }
.profile-hero .card-body { position: relative; }
.profile-photo { width: 104px; height: 104px; border-radius: 1.25rem; object-fit: cover; border: 4px solid var(--card-bg); background: var(--card-bg); box-shadow: var(--shadow-sm); }
.kv { display: grid; grid-template-columns: minmax(130px, 38%) 1fr; gap: .55rem 1rem; font-size: .875rem; margin: 0; }
.kv dt { color: var(--bs-secondary-color); font-weight: 500; }
.kv dd { margin: 0; word-break: break-word; }
.staff-card { text-align: center; padding: 1.25rem 1rem; height: 100%; }
.staff-card img { width: 72px; height: 72px; border-radius: 50%; object-fit: cover; margin-bottom: .6rem; }
.form-section { font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--brand); font-weight: 700; margin: 0 0 .9rem; display: flex; align-items: center; gap: .5rem; }
.form-section::after { content: ""; flex: 1; height: 1px; background: var(--card-border); }
.confirm-icon { width: 3.25rem; height: 3.25rem; margin: 0 auto; border-radius: 50%; display: grid; place-items: center; font-size: 1.4rem; background: rgba(239, 68, 68, .12); color: #ef4444; }
.perm-table td, .perm-table th { text-align: center; }
.perm-table td:first-child, .perm-table th:first-child { text-align: start; }

/* ---------- Attendance ---------- */
.att-pill { min-width: 2.3rem; font-weight: 600; border-radius: .5rem; }
.save-bar {
    position: sticky; bottom: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 1rem;
    padding: .75rem 1.15rem; background: var(--card-bg); border-top: 1px solid var(--card-border);
    border-radius: 0 0 var(--radius) var(--radius); box-shadow: 0 -8px 20px -14px rgba(15, 23, 42, .35);
}
.register { font-size: .78rem; }
.register th, .register td { padding: .35rem .3rem !important; text-align: center; }
.register td:first-child, .register th:first-child { text-align: start; position: sticky; inset-inline-start: 0; background: var(--card-bg); z-index: 1; min-width: 190px; }
.register .wk { background: var(--bs-tertiary-bg); }
.reg-cell { display: inline-block; width: 1.5rem; border-radius: .3rem; font-weight: 700; }

/* ---------- ID card thumbnails ---------- */
.idc-mini { width: 86px; height: 54px; flex-shrink: 0; border-radius: 6px; border: 1px solid var(--card-border); background: var(--card-bg); position: relative; overflow: hidden; }
.idc-mini.v { width: 54px; height: 86px; }
.idc-mini-head { height: 13px; background: var(--hc); }
.idc-mini-photo { position: absolute; left: 6px; top: 18px; width: 18px; height: 22px; border-radius: 3px; background: var(--bs-secondary-bg); border: 1px solid var(--hc); }
.idc-mini.v .idc-mini-photo { left: 17px; }
.idc-mini-lines { position: absolute; left: 30px; top: 20px; right: 6px; display: grid; gap: 4px; }
.idc-mini.v .idc-mini-lines { left: 8px; top: 48px; }
.idc-mini-lines span { height: 3px; border-radius: 2px; background: var(--bs-secondary-bg); }

/* ---------- Calendar ---------- */
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal-head { text-align: center; font-size: .72rem; font-weight: 700; text-transform: uppercase; color: var(--bs-secondary-color); padding: .4rem 0; }
.cal-cell { min-height: 96px; border: 1px solid var(--card-border); border-radius: .5rem; padding: .3rem; display: flex; flex-direction: column; gap: 3px; background: var(--card-bg); }
.cal-cell[data-day] { cursor: pointer; }
.cal-cell[data-day]:hover { border-color: rgba(var(--brand-rgb), .5); }
.cal-cell.muted { background: transparent; border-style: dashed; }
.cal-cell.sun { background: var(--bs-tertiary-bg); }
.cal-num { font-size: .78rem; font-weight: 600; color: var(--bs-secondary-color); width: 1.6rem; height: 1.6rem; display: grid; place-items: center; border-radius: 50%; }
.cal-num.today { background: var(--brand); color: #fff; }
.cal-event { border: 0; text-align: start; font-size: .72rem; line-height: 1.25; padding: .15rem .35rem; border-radius: .3rem; color: #fff; background: var(--c); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
@media (max-width: 575.98px) { .cal-cell { min-height: 64px; } .cal-event { font-size: .6rem; } }

/* ---------- Reports ---------- */
.report-table { font-size: .85rem; }
.report-table > :not(caption) > * > * { padding: .5rem .75rem; white-space: nowrap; }
.report-table tfoot td { background: var(--bs-tertiary-bg); border-top: 2px solid var(--card-border); }
@media print { .report-table { font-size: .72rem; } }

/* ---------- Timetable ---------- */
.tt-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .75rem; }
.tt-day { background: var(--bs-tertiary-bg); border-radius: .75rem; padding: .5rem; min-height: 120px; }
.tt-head { display: flex; justify-content: space-between; align-items: center; font-weight: 700; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; padding: .25rem .4rem .5rem; color: var(--bs-secondary-color); }
.tt-period { background: var(--card-bg); border: 1px solid var(--card-border); border-inline-start: 3px solid var(--brand); border-radius: .55rem; padding: .5rem .6rem; margin-bottom: .45rem; font-size: .85rem; }

/* ---------- Auth ---------- */
.auth-body { background: var(--bs-body-bg); }
.auth-wrap { display: grid; grid-template-columns: 1.1fr 1fr; min-height: 100vh; }
.auth-hero {
    position: relative; color: #fff; display: flex; align-items: flex-end; padding: 3rem;
    background: linear-gradient(135deg, rgba(49, 46, 129, .92), rgba(124, 58, 237, .78)), var(--hero, none) center / cover, #312e81;
}
.auth-hero-inner { max-width: 520px; }
.auth-notices { background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .15); border-radius: 1rem; padding: 1.1rem 1.25rem; backdrop-filter: blur(6px); }
.auth-notice { display: flex; justify-content: space-between; gap: 1rem; padding: .45rem 0; border-top: 1px solid rgba(255, 255, 255, .12); font-size: .9rem; }
.auth-notice:first-of-type { border-top: 0; }
.auth-notice small { opacity: .7; white-space: nowrap; }
.auth-panel { display: flex; align-items: center; justify-content: center; padding: 2rem 1.25rem; }
.auth-card { width: 100%; max-width: 400px; }
.auth-logo { max-height: 56px; max-width: 220px; object-fit: contain; }
.pw-toggle { position: absolute; inset-inline-end: .5rem; top: 50%; transform: translateY(-50%); color: var(--bs-secondary-color); z-index: 5; }
@media (max-width: 991.98px) {
    .auth-wrap { grid-template-columns: 1fr; }
    .auth-hero { display: none; }
}

@media print {
    .sidebar, .topbar, .footer, .page-head .btn, .filter-bar, .btn { display: none !important; }
    .main { margin: 0 !important; }
    .card { box-shadow: none; border: 0; }
}

/* Lesson plan: weekly grid */
.avatar-sm { width: 2rem; height: 2rem; display: inline-flex; align-items: center; justify-content: center; font-size: .75rem; font-weight: 600; color: var(--bs-primary); background: var(--bs-primary-bg-subtle); }
.lp-week { display: grid; grid-template-columns: repeat(var(--lp-days, 7), minmax(150px, 1fr)); gap: .75rem; overflow-x: auto; padding-bottom: .25rem; }
.lp-day { background: var(--bs-body-bg); border: 1px solid var(--bs-border-color-translucent); border-radius: .75rem; padding: .5rem; display: flex; flex-direction: column; gap: .5rem; min-height: 8rem; }
.lp-day.is-today { border-color: var(--bs-primary); box-shadow: 0 0 0 2px var(--bs-primary-bg-subtle); }
.lp-day-head { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; flex-wrap: wrap; font-weight: 600; padding: .125rem .25rem; }
.lp-day-head small { font-weight: 400; color: var(--bs-secondary-color); }
.lp-period { position: relative; border-radius: .5rem; padding: .5rem .625rem; background: var(--bs-tertiary-bg); border-left: 3px solid var(--bs-border-color); }
.lp-period.has-plan { border-left-color: var(--bs-success); background: var(--bs-success-bg-subtle); }
.lp-plan { display: block; margin-top: .375rem; padding-top: .375rem; border-top: 1px dashed var(--bs-border-color); color: var(--bs-success-text-emphasis); text-decoration: none; font-size: .85rem; font-weight: 500; }
.lp-free { color: var(--bs-secondary-color); font-size: .8rem; text-align: center; margin: auto 0; }
.lp-msg { background: var(--bs-tertiary-bg); border-radius: .75rem; padding: .5rem .75rem; max-width: 85%; text-align: left; }
.lp-msg.is-mine { background: var(--bs-primary-bg-subtle); }
@media (max-width: 767.98px) { .lp-week { grid-template-columns: 1fr; overflow: visible; } }
.lp-time { font-size: .75rem; white-space: nowrap; }

/* Download center */
.dc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .875rem; }
.dc-item { position: relative; border: 1px solid var(--bs-border-color-translucent); border-radius: .75rem; overflow: hidden; background: var(--bs-body-bg); transition: box-shadow .15s, border-color .15s; }
.dc-item:hover { box-shadow: 0 4px 14px rgba(15, 23, 42, .08); }
.dc-item.is-selected { border-color: var(--bs-primary); box-shadow: 0 0 0 2px var(--bs-primary-bg-subtle); }
.dc-check { position: absolute; top: .5rem; left: .5rem; z-index: 2; width: 1.15rem; height: 1.15rem; box-shadow: 0 0 0 2px rgba(255, 255, 255, .8); }
.dc-thumb { position: relative; display: flex; align-items: center; justify-content: center; height: 118px; background: var(--bs-tertiary-bg); text-decoration: none; }
.dc-thumb img { width: 100%; height: 100%; object-fit: cover; }
.dc-thumb > .bi { font-size: 2.6rem; }
.dc-thumb .dc-play { position: absolute; font-size: 2.2rem; color: #fff; text-shadow: 0 2px 8px rgba(0, 0, 0, .5); }
.dc-body { padding: .5rem .625rem .375rem; }
.dc-name { font-weight: 500; font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dc-drop { display: flex; flex-direction: column; align-items: center; gap: .25rem; text-align: center; padding: 1.5rem 1rem; border: 2px dashed var(--bs-border-color); border-radius: .75rem; cursor: pointer; transition: background .15s, border-color .15s; word-break: break-word; }
.dc-drop:hover, .dc-drop.is-over { border-color: var(--bs-primary); background: var(--bs-primary-bg-subtle); }
.vt-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 1rem; }
.vt-card { overflow: hidden; }
.vt-thumb { position: relative; display: flex; align-items: center; justify-content: center; aspect-ratio: 16 / 9; width: 100%; border: 0; padding: 0; background: #111; }
.vt-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform .25s; }
.vt-thumb:hover img { transform: scale(1.04); }
.vt-thumb .bi { position: relative; font-size: 3rem; color: #fff; opacity: .92; text-shadow: 0 2px 10px rgba(0, 0, 0, .5); }
.vt-desc { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* System settings: modules, captcha, print header */
.mod-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: .75rem; }
.mod-card { display: flex; align-items: center; gap: .75rem; padding: .875rem 1rem; background: var(--bs-body-bg); border: 1px solid var(--bs-border-color-translucent); border-radius: .75rem; cursor: pointer; transition: border-color .15s, background .15s; margin: 0; }
.mod-card:hover { border-color: var(--bs-primary-border-subtle); }
.mod-card .mod-icon, .mod-icon { display: inline-flex; align-items: center; justify-content: center; width: 2.25rem; height: 2.25rem; border-radius: .6rem; font-size: 1.1rem; background: var(--bs-tertiary-bg); color: var(--bs-secondary-color); flex-shrink: 0; }
.mod-card.is-on .mod-icon { background: var(--bs-primary-bg-subtle); color: var(--bs-primary); }
.mod-card:not(.is-on) span.fw-medium { color: var(--bs-secondary-color); }
.print-preview { display: flex; align-items: center; justify-content: center; min-height: 80px; background: var(--bs-tertiary-bg); border: 1px dashed var(--bs-border-color); border-radius: .5rem; overflow: hidden; }
.print-preview img { max-width: 100%; max-height: 160px; display: block; }
.print-footer-preview { border-top: 2px solid var(--bs-border-color); padding-top: .5rem; font-size: .875rem; color: var(--bs-secondary-color); }
.sf-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: .625rem 1rem; }
.gw-list { max-height: 60vh; overflow: auto; }
.gw-list .list-group-item.active { background: var(--bs-primary-bg-subtle); color: var(--bs-primary-text-emphasis); border-color: var(--bs-border-color-translucent); font-weight: 600; }

/* Student / parent panel */
.portal-who { display: flex; align-items: center; gap: .65rem; margin: 0 .75rem .75rem; padding: .6rem .7rem; border-radius: .75rem; background: rgba(255, 255, 255, .06); color: #fff; }
.portal-who img { border-radius: 50%; object-fit: cover; border: 2px solid rgba(255, 255, 255, .25); }
.portal-who small { color: rgba(255, 255, 255, .6); }
.sb-mini .portal-who { display: none; }
.cal-cell.is-empty { background: transparent; border-style: dashed; }
.cal-cell.is-today { outline: 2px solid var(--brand); outline-offset: -2px; }
.cal-day { font-size: .78rem; font-weight: 600; color: var(--bs-secondary-color); }
.portal .cal-cell { min-height: 70px; align-items: flex-start; }
.notice-body { white-space: normal; }

/* Front CMS: rich text editor, media grid, thumbnails */
.rte { border: 1px solid var(--bs-border-color); border-radius: .5rem; overflow: hidden; background: var(--bs-body-bg); }
.rte-bar { display: flex; flex-wrap: wrap; gap: .2rem; align-items: center; padding: .35rem; border-bottom: 1px solid var(--bs-border-color); background: var(--bs-tertiary-bg); }
.rte-bar .btn { padding: .2rem .45rem; }
.rte-sep { width: 1px; height: 1.2rem; background: var(--bs-border-color); margin: 0 .2rem; }
.rte-body { border: 0 !important; border-radius: 0; min-height: 260px; max-height: 60vh; overflow: auto; box-shadow: none !important; }
.rte-body img { max-width: 100%; height: auto; }
.rte-body blockquote { border-left: 3px solid var(--bs-border-color); padding-left: .75rem; color: var(--bs-secondary-color); }
.rte-source { border: 0 !important; border-radius: 0; min-height: 260px; }
.mp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .75rem; }
.mp-item { position: relative; display: flex; flex-direction: column; padding: 0; border: 2px solid transparent; border-radius: .6rem; overflow: hidden; background: var(--bs-tertiary-bg); text-align: left; }
.mp-item img { width: 100%; aspect-ratio: 3 / 2; object-fit: cover; display: block; }
.mp-item > span { font-size: .75rem; padding: .3rem .45rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mp-item.is-on { border-color: var(--bs-primary); box-shadow: 0 0 0 3px var(--bs-primary-bg-subtle); }
.mp-item.is-on::after { content: '\2713'; position: absolute; top: .35rem; right: .35rem; width: 1.5rem; height: 1.5rem; border-radius: 50%; background: var(--bs-primary); color: #fff; display: grid; place-items: center; font-size: .8rem; }
button.mp-item:hover { border-color: var(--bs-primary-border-subtle); }
.mp-play { position: absolute; top: 30%; left: 50%; transform: translate(-50%, -50%); font-size: 2rem; color: #fff; text-shadow: 0 2px 8px rgba(0, 0, 0, .5); pointer-events: none; }
.mp-remove { position: absolute; top: .3rem; right: .3rem; border: 0; width: 1.6rem; height: 1.6rem; border-radius: 50%; background: rgba(0, 0, 0, .6); color: #fff; display: grid; place-items: center; }
.mp-actions { position: absolute; top: .3rem; right: .3rem; display: flex; gap: .25rem; opacity: 0; transition: opacity .15s; }
.mp-item:hover .mp-actions, .mp-item:focus-within .mp-actions { opacity: 1; }
.cms-thumb { width: 84px; height: 56px; border-radius: .5rem; overflow: hidden; background: var(--bs-tertiary-bg); display: grid; place-items: center; flex-shrink: 0; color: var(--bs-secondary-color); font-size: 1.4rem; }
.cms-thumb img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- Online exam: questions, options, timer ---------- */
.oe-q + .oe-q, .oe-row + .oe-row { border-top: 1px solid var(--bs-border-color); padding-top: 1rem; margin-top: 1rem; }
.oe-html img { max-width: 100%; height: auto; }
.oe-html > :last-child { margin-bottom: 0; }
.oe-opt { display: flex; gap: .6rem; align-items: center; padding: .4rem .6rem; border: 1px solid var(--bs-border-color); border-radius: .5rem; }
.oe-key { font-weight: 600; color: var(--bs-secondary-color); min-width: 1rem; }
.oe-right { border-color: var(--bs-success-border-subtle); background: var(--bs-success-bg-subtle); }
.oe-wrong { border-color: var(--bs-danger-border-subtle); background: var(--bs-danger-bg-subtle); }
label.oe-opt { cursor: pointer; margin: 0; }
label.oe-opt:has(input:checked) { border-color: var(--bs-primary); background: var(--bs-primary-bg-subtle); }
.oe-timer { position: sticky; top: .75rem; z-index: 5; font-variant-numeric: tabular-nums; }
.oe-timer.low { color: var(--bs-danger); }

/* ---------- Chat ---------- */
.chat-card { overflow: hidden; }
.chat-side { max-height: 70vh; overflow-y: auto; }
.chat-main { height: 70vh; min-height: 420px; }
.chat-log { overflow-y: auto; background: var(--bs-tertiary-bg); }
.chat-msg { display: flex; flex-direction: column; align-items: flex-start; margin-bottom: .6rem; }
.chat-msg.mine { align-items: flex-end; }
.chat-bubble { max-width: 75%; padding: .45rem .75rem; border-radius: 1rem; background: var(--bs-body-bg); border: 1px solid var(--bs-border-color); overflow-wrap: anywhere; }
.chat-msg.mine .chat-bubble { background: var(--bs-primary); color: #fff; border-color: var(--bs-primary); }
.chat-time { font-size: .72rem; color: var(--bs-secondary-color); margin-top: .1rem; }
#chatText { resize: none; }

/* ---------- Panel calendar ---------- */
.pcal-grid { table-layout: fixed; width: 100%; min-width: 640px; }
.pcal-grid > :not(caption) > * > * { padding: .3rem; }
.pcal-grid td { height: 92px; vertical-align: top; overflow: hidden; }
.pcal-grid .pcal-today { background: var(--bs-primary-bg-subtle); }
.pcal-item { font-size: .72rem; border-left: 3px solid; padding: 0 .25rem; margin-top: .15rem; border-radius: 2px; background: var(--bs-tertiary-bg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Sidebar user card + menu search, top bar extras ---------- */
.sb-user { display: flex; gap: .7rem; align-items: center; margin: .75rem .65rem .5rem; padding: .7rem; border-radius: .8rem; background: var(--sb-bg-2); border: 1px solid rgba(148, 163, 184, .1); flex-shrink: 0; }
.sb-user-photo { width: 46px; height: 46px; border-radius: 50%; object-fit: cover; border: 2px solid rgba(255, 255, 255, .15); flex-shrink: 0; }
.sb-user-info { min-width: 0; flex: 1; }
.sb-user-name { color: var(--sb-text-hi); font-weight: 600; font-size: .9rem; }
.sb-user-role { color: var(--sb-text); font-size: .72rem; }
.sb-clock { padding: .1rem .55rem; font-size: .75rem; }
.sb-clock-note { color: var(--sb-text); font-size: .7rem; margin-top: .15rem; }
.sb-search { position: relative; margin: 0 .65rem .25rem; flex-shrink: 0; }
.sb-search .bi { position: absolute; left: .7rem; top: 50%; transform: translateY(-50%); color: var(--sb-text); font-size: .8rem; }
.sb-search .form-control { padding-left: 2rem; background: var(--sb-bg-2); border-color: rgba(148, 163, 184, .15); color: var(--sb-text-hi); }
.sb-search .form-control::placeholder { color: var(--sb-text); }
.sb-search .form-control:focus { border-color: var(--brand); box-shadow: none; }
.nav-sub a.sb-hit span:first-child { color: var(--sb-text-hi); text-decoration: underline; text-decoration-color: var(--brand); }
@media (min-width: 992px) {
    .sb-mini .sb-user { justify-content: center; padding: .5rem; margin: .6rem .4rem; }
    .sb-mini .sb-user-info, .sb-mini .sb-search { display: none; }
    .sb-mini .sb-user-photo { width: 38px; height: 38px; }
    .sb-mini .sidebar:hover .sb-user { justify-content: flex-start; padding: .7rem; margin: .75rem .65rem .5rem; }
    .sb-mini .sidebar:hover .sb-user-info, .sb-mini .sidebar:hover .sb-search { display: block; }
}
.topbar-school { font-weight: 600; font-size: 1rem; max-width: 30vw; color: var(--bs-emphasis-color); }
.session-wrap { gap: .3rem; color: var(--bs-secondary-color); }

/* List table toolbar (table-tools.js) */
.tbl-tools { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; padding: .65rem 1rem; border-bottom: 1px solid var(--card-border); }
.tbl-tools > .btn-group { flex-wrap: wrap; }
.btn-tools { background: var(--bs-primary); color: #fff; border-color: rgba(255, 255, 255, .25); }
.btn-tools:hover, .btn-tools:focus-visible, .btn-tools.show { background: #4338ca; color: #fff; }
.tbl-tools-right { display: flex; align-items: center; gap: .5rem; margin-left: auto; flex-wrap: wrap; }
.tbl-search { display: flex; align-items: center; gap: .4rem; margin: 0; font-size: .85rem; color: var(--bs-secondary-color); }
.tbl-search input { width: 200px; }
.tbl-cols { max-height: 320px; overflow: auto; min-width: 200px; }
@media (max-width: 575.98px) { .tbl-tools-right { margin-left: 0; width: 100%; } .tbl-search { flex: 1; } .tbl-search input { width: 100%; } }
@media print { .tbl-tools { display: none !important; } }

/* Criteria + list cards (list pages) */
.card-title-row { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.card-title-row .card-title { font-size: 1.05rem; font-weight: 600; margin: 0; display: flex; align-items: center; gap: .45rem; }
.card-title-row .card-actions { margin-left: auto; display: flex; flex-wrap: wrap; gap: .4rem; }
.criteria-card .card-header, .list-card > .card-header { background: var(--brand-soft); }

/* Admission form: photo boxes, sub-headings, checkbox grids */
.photo-pick { display: flex; flex-direction: column; align-items: flex-start; gap: .5rem; }
.photo-pick-img { width: 110px; height: 128px; object-fit: cover; border: 1px solid var(--card-border); border-radius: .5rem; background: var(--app-bg); }
.form-subsection { font-size: .9rem; font-weight: 600; background: var(--brand-soft); border-radius: .4rem; padding: .45rem .75rem; margin: 0 0 .9rem; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .35rem 1rem; }

/* General Setting tabs */
.settings-nav .list-group-item { border-color: var(--card-border); font-size: .9rem; }
.settings-nav .list-group-item.active { background: var(--brand); border-color: var(--brand); }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .85rem 0; border-bottom: 1px solid var(--card-border); }
.setting-row:last-child { border-bottom: 0; }
.setting-logo { width: 96px; height: 56px; object-fit: contain; background: var(--app-bg); border-radius: .5rem; padding: .25rem; }
.setting-bg { width: 120px; height: 68px; object-fit: cover; border-radius: .5rem; }
.theme-swatch input { position: absolute; opacity: 0; }
.theme-swatch span { display: block; width: 34px; height: 34px; border-radius: 50%; background: var(--sw); cursor: pointer; box-shadow: 0 0 0 2px var(--card-bg), 0 0 0 3px transparent; }
.theme-swatch input:checked + span, .theme-swatch input:focus-visible + span { box-shadow: 0 0 0 2px var(--card-bg), 0 0 0 4px var(--sw); }
/* Backend Theme: compact page width and bordered cards */
body.layout-boxed .content { max-width: 1320px; margin-inline: auto; width: 100%; }
body.layout-bordered .card { box-shadow: none !important; }
/* WhatsApp button in the panels */
.panel-wa { position: fixed; right: 18px; bottom: 18px; z-index: 1040; width: 52px; height: 52px; border-radius: 50%; background: #25d366; color: #fff;
    display: flex; align-items: center; justify-content: center; font-size: 1.6rem; box-shadow: 0 6px 18px rgba(0, 0, 0, .2); }
.panel-wa:hover { color: #fff; filter: brightness(.95); }
@media print { .panel-wa { display: none; } }

/* Backend Theme tab: clickable options */
.theme-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; }
.theme-option { display: flex; flex-direction: column; align-items: center; gap: .35rem; padding: .9rem .5rem; border: 1px solid var(--card-border); border-radius: .6rem;
    background: var(--card-bg); color: var(--bs-body-color); font-size: .85rem; }
.theme-option i { font-size: 1.35rem; }
.theme-option:hover { border-color: var(--brand); color: var(--brand); }
.btn-check:checked + .theme-option { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); box-shadow: 0 0 0 1px var(--brand); }
.btn-check:focus-visible + .theme-option { outline: 2px solid var(--brand); outline-offset: 2px; }
.theme-swatch-custom span { display: flex; align-items: center; justify-content: center; color: #fff; font-size: .9rem; }
#customPicker { width: 2.4rem; height: 2.2rem; padding: .15rem; }
.theme-swatch, .theme-option, .content, .card { transition: background-color .2s, border-color .2s, color .2s; }

/* Backend Theme: one toggle button per setting */
.theme-toggle { width: 100%; display: flex; flex-direction: column; align-items: center; gap: .3rem; padding: 1rem .75rem; border: 1px solid var(--card-border);
    border-radius: .75rem; background: var(--card-bg); color: var(--bs-body-color); cursor: pointer; transition: border-color .2s, background-color .2s, transform .1s; }
.theme-toggle:hover { border-color: var(--brand); }
.theme-toggle:active { transform: scale(.98); }
.theme-toggle:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.theme-toggle-label { font-size: .8rem; font-weight: 600; color: var(--bs-secondary-color); }
.theme-toggle > i { font-size: 1.7rem; color: var(--brand); }
.theme-toggle-value { font-weight: 600; }
.theme-toggle-next { font-size: .75rem; color: var(--bs-secondary-color); }
.theme-toggle.is-alt { background: var(--brand-soft); border-color: var(--brand); }

/* Academics › Daily Time Table */
.dt-grid th, .dt-grid td { min-width: 150px; }
.dt-grid th:first-child { min-width: 120px; }
.dt-grid thead th { background: var(--bs-tertiary-bg); font-size: .8rem; }
.dt-cell.dt-changed { background: rgba(var(--bs-info-rgb), .07); }
.dt-week td, .dt-week th { min-width: 110px; }
@media print {
    .dt-grid select { appearance: none; -webkit-appearance: none; border: 0; padding: 0; background: none; font-size: .72rem; }
    .dt-grid th, .dt-grid td { min-width: 0; }
    .dt-week-card { break-inside: avoid; }
}

/* Attendance › Attendance Report cards */
.att-report-card { transition: box-shadow .15s, transform .15s; }
.att-report-card:hover, .att-report-card:focus-visible { box-shadow: 0 .4rem 1rem rgba(0, 0, 0, .08); transform: translateY(-1px); }
.att-report-icon { flex: 0 0 auto; width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-size: 1.25rem; }
.att-report-title { letter-spacing: .03em; padding-bottom: .3rem; margin-bottom: .3rem; background: linear-gradient(currentColor, currentColor) left bottom / 28px 1px no-repeat; }
.att-report-tab-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .5rem; }
.att-report-tab-item { min-width: 0; }
.att-report-icon-sm { width: 34px; height: 34px; font-size: 1rem; }
.att-report-tab-title { font-size: .72rem; line-height: 1.25; margin-bottom: 0; }
.att-report-tab { border: 1px solid var(--card-border); }
.att-report-tab.is-active { border: 2px solid var(--tab-colour); background: color-mix(in srgb, var(--tab-colour) 8%, var(--card-bg)); box-shadow: 0 .4rem 1rem rgba(0, 0, 0, .08); }

/* Communicate › Notice Board (like the school's live site) */
.notice-board-head { background: rgba(var(--bs-danger-rgb), .05); }
.notice-board-head .notice-date { width: 11rem; }
.notice-item { border-radius: .6rem; overflow: hidden; background: var(--bs-tertiary-bg); border: 1px solid var(--card-border); }
.notice-item-head { padding: .85rem 1.25rem; background: rgba(var(--bs-primary-rgb), .06); }
.notice-title { font-size: 1.15rem; font-weight: 500; color: var(--bs-body-color); }
.notice-toggle:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.notice-meta { background: rgba(var(--bs-secondary-rgb), .12); }
.notice-meta > div { padding: .75rem 1.25rem; }
.notice-meta-from { border-inline-end: 1px solid var(--card-border); }
.notice-meta-label { font-size: 1.05rem; font-weight: 500; color: var(--bs-primary-text-emphasis); }
.notice-body { padding: 1rem 1.25rem 1.25rem; }
.notice-body .site-prose p:last-child { margin-bottom: 0; }
@media (max-width: 767.98px) { .notice-meta-from { border-inline-end: 0; border-bottom: 1px solid var(--card-border); } .notice-board-head .notice-date { width: 100%; } }

/* Student Information › Link Siblings */
.sibling-group { border: 1px solid var(--card-border); border-radius: .5rem; overflow: hidden; }
.sibling-head { background: var(--bs-tertiary-bg); padding: .8rem 1.1rem; border: 0; border-radius: 0; font-size: 1.02rem; }
.sibling-head:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
.sibling-chevron { transition: transform .2s; }
.sibling-head.collapsed .sibling-chevron { transform: rotate(-90deg); }

/* Question Paper */
.qp-question-text img { max-width: 100%; height: auto; }
.qp-question-text p:last-child { margin-bottom: 0; }
.qp-paper-q { padding: .4rem 0; break-inside: avoid; }
@media print { .qp-paper { border: 0; box-shadow: none; } .qp-paper .card-body { padding: 0 !important; } }

/* Front CMS › Menus: drag-and-drop tree (top level + one level of dropdown sub-items) */
.mi-tree, .mi-children { list-style: none; margin: 0; padding: 0; }
.mi-tree { padding: .5rem; }
.mi-item { margin: .3rem 0; }
.mi-row { display: flex; align-items: center; gap: .5rem; padding: .45rem .6rem; background: var(--bs-body-bg); border: 1px solid var(--bs-border-color); border-radius: .5rem; }
.mi-handle { cursor: grab; color: var(--bs-secondary-color); font-size: 1.15rem; padding: 0 .15rem; touch-action: none; }
.mi-handle:active { cursor: grabbing; }
.mi-children { margin-left: 2.25rem; border-left: 2px solid var(--bs-border-color); padding-left: .6rem; }
.mi-children:empty { min-height: 0; border-left-color: transparent; }
.mi-tree > .mi-item > .mi-children:empty { margin-top: 0; }
.mi-dragging > .mi-item > .mi-children:empty { min-height: 2.2rem; border: 2px dashed var(--bs-border-color); border-radius: .5rem; margin-top: .3rem; }
.mi-dragging > .mi-item > .mi-children:empty::before { content: "↳"; color: var(--bs-secondary-color); padding: .35rem .6rem; display: block; font-size: .8rem; }
.sortable-ghost > .mi-row { background: var(--bs-primary-bg-subtle); border-style: dashed; }
.sortable-chosen > .mi-row { box-shadow: 0 6px 18px rgba(0, 0, 0, .12); }
