
:root {
  --maroon: #800000; --maroon-dark: #5c0000; --maroon-deep: #3d0000; --rail: #4a0000;
  --yellow: #F4B400; --yellow-soft: #fff4cc; --bg: #f4f5f7; --panel: #ffffff;
  --ink: #1e293b; --muted: #64748b; --line: #e2e8f0; --danger: #dc2626; --danger-bg: #fef2f2;
  --warn: #b45309; --sidebar-w: 248px; --rail-w: 68px; --top-h: 52px;
  --font: Inter, system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { font-family: var(--font); color: var(--ink); background: var(--bg); }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; border: 0; background: none; }
.topbar { height: var(--top-h); background: var(--maroon); color: #fff; display: flex; align-items: center; gap: .75rem; padding: 0 .85rem; position: sticky; top: 0; z-index: 40; box-shadow: 0 1px 0 rgba(0,0,0,.15); }
.brand { display: flex; align-items: center; gap: .45rem; font-weight: 700; white-space: nowrap; }
.brand i { color: var(--yellow); }
.badge-v2 { background: var(--yellow); color: var(--maroon-dark); font-size: .62rem; font-weight: 800; padding: .12rem .35rem; border-radius: 4px; text-transform: uppercase; }
.school-pill { display: flex; align-items: center; gap: .45rem; background: rgba(0,0,0,.22); border: 1px solid rgba(244,180,0,.25); border-radius: 8px; padding: .2rem .55rem .2rem .25rem; margin-left: .35rem; }
.school-pill .mark { width: 1.55rem; height: 1.55rem; border-radius: 6px; background: var(--maroon-deep); color: var(--yellow); display: grid; place-items: center; font-weight: 800; font-size: .75rem; border: 1px solid rgba(244,180,0,.35); }
.school-pill .meta { line-height: 1.1; }
.school-pill .meta b { display: block; font-size: .72rem; color: var(--yellow); }
.school-pill .meta span { display: block; font-size: .58rem; color: rgba(255,255,255,.65); }
.module-chip { display: inline-flex; align-items: center; gap: .4rem; background: rgba(0,0,0,.28); color: var(--yellow); border: 1px solid rgba(244,180,0,.3); border-radius: 8px; padding: .35rem .75rem; font-size: .8rem; font-weight: 600; margin-left: .5rem; }
.search { flex: 1; max-width: 420px; margin: 0 auto; position: relative; }
.search input { width: 100%; background: rgba(0,0,0,.28); border: 1px solid rgba(255,255,255,.12); color: #fff; border-radius: 8px; padding: .45rem 2rem .45rem .75rem; font-size: .85rem; }
.search input::placeholder { color: rgba(255,255,255,.45); }
.search input:focus { outline: none; border-color: var(--yellow); }
.search i { position: absolute; right: .7rem; top: 50%; transform: translateY(-50%); color: var(--yellow); font-size: .75rem; }
.top-actions { display: flex; align-items: center; gap: .35rem; margin-left: auto; }
.top-actions button, .top-actions .avatar { width: 2rem; height: 2rem; border-radius: 999px; display: grid; place-items: center; color: rgba(255,255,255,.85); }
.top-actions button:hover { color: var(--yellow); background: rgba(255,255,255,.08); }
.bell-wrap { position: relative; }
.bell-dot { position: absolute; top: 0; right: 0; background: var(--yellow); color: var(--maroon-dark); font-size: .55rem; font-weight: 800; min-width: .9rem; height: .9rem; border-radius: 999px; display: grid; place-items: center; }
.avatar { background: var(--yellow) !important; color: var(--maroon-dark) !important; font-weight: 800; font-size: .7rem; border: 2px solid rgba(255,255,255,.25); }
.shell { display: grid; grid-template-columns: var(--rail-w) var(--sidebar-w) 1fr; min-height: calc(100vh - var(--top-h)); }
.rail { background: var(--rail); color: rgba(255,255,255,.7); display: flex; flex-direction: column; align-items: center; padding: .55rem .3rem; gap: .2rem; }
.rail .launcher { width: 2.4rem; height: 2.4rem; border-radius: 10px; display: grid; place-items: center; color: var(--yellow); margin-bottom: .35rem; }
.rail .launcher:hover, .rail .launcher.open { background: rgba(244,180,0,.18); color: #fff; }
.rail .sep { width: 60%; height: 1px; background: rgba(255,255,255,.12); margin: .25rem 0 .45rem; }
.rail a { width: 100%; display: flex; flex-direction: column; align-items: center; gap: .15rem; padding: .45rem .15rem; border-radius: 10px; font-size: .55rem; font-weight: 600; color: rgba(255,255,255,.72); }
.rail a i { font-size: 1rem; }
.rail a:hover, .rail a.active { background: rgba(244,180,0,.15); color: #fff; }
.rail a.active { color: var(--yellow); }
/* App Launcher modal */
.launcher-backdrop {
  position: fixed; inset: 0; background: rgba(15, 23, 42, 0.45);
  z-index: 80; display: none; align-items: flex-start; justify-content: flex-start;
  padding: calc(var(--top-h) + 0.75rem) 0 1.5rem calc(var(--rail-w) + 0.5rem);
}
.launcher-backdrop.open { display: flex; }
.launcher-modal {
  width: min(640px, calc(100vw - 5rem));
  background: #fff; border-radius: 14px;
  box-shadow: 0 24px 60px rgba(0,0,0,.28);
  border: 1px solid var(--line);
  overflow: hidden;
  animation: launcherIn .16s ease-out;
}
@keyframes launcherIn {
  from { opacity: 0; transform: translateY(-6px) scale(.98); }
  to { opacity: 1; transform: none; }
}
.launcher-head { padding: 1.15rem 1.25rem 0.75rem; }
.launcher-head h2 { margin: 0; font-size: 1.15rem; font-weight: 800; color: var(--ink); letter-spacing: -.02em; }
.launcher-head p { margin: .25rem 0 0; font-size: .85rem; color: var(--muted); }
.launcher-search { padding: 0 1.25rem 0.85rem; position: relative; }
.launcher-search input {
  width: 100%; border: 1px solid var(--line); border-radius: 10px;
  padding: .7rem .85rem .7rem 2.25rem; font-size: .9rem; background: #fff;
}
.launcher-search input:focus { outline: none; border-color: var(--maroon); box-shadow: 0 0 0 3px rgba(128,0,0,.1); }
.launcher-search i { position: absolute; left: 1.9rem; top: 50%; transform: translateY(-50%); color: #94a3b8; font-size: .85rem; }
.launcher-grid {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .55rem; padding: 0 1.15rem 1.25rem; max-height: min(58vh, 420px); overflow-y: auto;
}
.launcher-tile {
  display: flex; flex-direction: column; align-items: flex-start; gap: .45rem;
  text-align: left; padding: .75rem .7rem; border-radius: 12px;
  border: 1px solid transparent; background: transparent; color: inherit;
  transition: background .12s ease, border-color .12s ease;
}
.launcher-tile:hover { background: #f8fafc; border-color: var(--line); }
.launcher-tile.active {
  background: #fdf2f2; border-color: rgba(128,0,0,.35);
  box-shadow: 0 0 0 1px rgba(128,0,0,.08);
}
.launcher-tile .ico {
  width: 2.35rem; height: 2.35rem; border-radius: 10px;
  display: grid; place-items: center; color: #fff; font-size: 1rem;
}
.launcher-tile .name { font-size: .88rem; font-weight: 700; color: var(--ink); }
.launcher-tile .blurb { font-size: .7rem; line-height: 1.35; color: var(--muted); }
.launcher-empty { display: none; padding: 1rem 1.25rem 1.35rem; color: var(--muted); font-size: .9rem; }
@media (max-width: 900px) {
  .launcher-backdrop { padding: 4.5rem 1rem 1rem; justify-content: center; }
  .launcher-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.sidebar { background: var(--panel); border-right: 1px solid var(--line); overflow-y: auto; padding: .85rem .65rem 1.25rem; }
.nav-sec { font-size: .68rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: #94a3b8; padding: .65rem .65rem .35rem; display: flex; justify-content: space-between; align-items: center; }
.sidebar nav a, .qa a { display: flex; align-items: center; gap: .65rem; padding: .5rem .65rem; border-radius: 8px; font-size: .875rem; font-weight: 500; color: #475569; margin-bottom: .1rem; }
.sidebar nav a i, .qa a i { width: 1.1rem; text-align: center; color: #94a3b8; font-size: .9rem; }
.sidebar nav a:hover, .qa a:hover { background: #f8fafc; color: var(--maroon); }
.sidebar nav a:hover i, .qa a:hover i { color: var(--maroon); }
.sidebar nav a.active { background: #fdf2f2; color: var(--maroon); font-weight: 700; border-left: 3px solid var(--maroon); padding-left: calc(.65rem - 3px); }
.sidebar nav a.active i { color: var(--maroon); }
.qa a { font-size: .82rem; }
.qa a i { color: var(--maroon); font-size: .7rem; }
.main { overflow-y: auto; padding: 1.35rem 1.5rem 2.5rem; background: var(--bg); }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; }
.page-head h1 { margin: 0; font-size: 1.75rem; font-weight: 800; letter-spacing: -.03em; }
.page-head .sub { margin: .2rem 0 0; font-size: .85rem; color: var(--muted); font-weight: 500; }
.btn { display: inline-flex; align-items: center; gap: .4rem; border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: .45rem .85rem; font-size: .85rem; font-weight: 600; color: #334155; box-shadow: 0 1px 2px rgba(0,0,0,.04); }
.btn:hover { border-color: var(--maroon); color: var(--maroon); }
.sec-h { display: flex; align-items: center; gap: .45rem; font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 1.15rem 0 .65rem; }
.sec-h.alarm { color: var(--danger); }
.attn-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: .85rem; }
.attn { background: var(--panel); border: 1px solid #fecaca; border-left: 4px solid var(--danger); border-radius: 12px; padding: 1rem 1.15rem; box-shadow: 0 1px 2px rgba(0,0,0,.04); }
.attn .n { font-size: 2rem; font-weight: 800; color: var(--danger); line-height: 1; }
.attn .t { margin-top: .35rem; font-size: .95rem; font-weight: 700; }
.attn .s { margin-top: .2rem; font-size: .8rem; color: var(--muted); }
.tiles { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: .75rem; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: .95rem 1rem; box-shadow: 0 1px 2px rgba(0,0,0,.03); }
.tile .n { font-size: 1.55rem; font-weight: 800; color: var(--maroon); letter-spacing: -.03em; }
.tile .l { margin-top: .3rem; font-size: .8rem; font-weight: 600; color: #475569; }
.tile .x { margin-top: .15rem; font-size: .72rem; color: var(--muted); }
.tile .x.warn { color: var(--danger); font-weight: 600; }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: .85rem; margin-top: 1rem; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: .95rem 1.05rem .85rem; box-shadow: 0 1px 2px rgba(0,0,0,.03); }
.panel-h { display: flex; align-items: center; justify-content: space-between; margin-bottom: .65rem; font-size: .9rem; font-weight: 700; }
.panel-h .more { font-size: .78rem; font-weight: 600; color: var(--maroon); }
.line { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .55rem 0; border-top: 1px solid #f1f5f9; }
.line:first-of-type { border-top: 0; }
.line-t { font-size: .88rem; font-weight: 600; }
.line-s { font-size: .75rem; color: var(--muted); margin-top: .15rem; }
.badge { display: inline-flex; align-items: center; font-size: .7rem; font-weight: 700; padding: .2rem .5rem; border-radius: 999px; white-space: nowrap; background: var(--yellow-soft); color: #92400e; }
.badge.danger { background: var(--danger-bg); color: var(--danger); }
.note { margin: 1rem 0 0; font-size: .8rem; color: var(--muted); }
@media (max-width: 1100px) {
  .shell { grid-template-columns: var(--rail-w) 1fr; }
  .sidebar { display: none; }
  .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .cols { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .shell { grid-template-columns: 1fr; }
  .rail, .search, .school-pill, .module-chip { display: none; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}


/* Students module */
.table-wrap { overflow:auto; border:1px solid var(--line); border-radius:12px; background:#fff; }
table.data { width:100%; border-collapse:collapse; font-size:.875rem; }
table.data th, table.data td { padding:.7rem .85rem; border-bottom:1px solid var(--line); text-align:left; }
table.data th { font-size:.72rem; text-transform:uppercase; letter-spacing:.04em; color:var(--muted); background:#fafafa; }
table.data tr:hover td { background:#fffdf8; }
.filters { display:flex; flex-wrap:wrap; gap:.65rem; margin-bottom:1rem; align-items:center; }
.filters input, .filters select {
  border:1.5px solid var(--line); border-radius:8px; padding:.55rem .75rem; font:inherit; min-width:140px; background:#fff;
}
.filters input:focus, .filters select:focus { outline:none; border-color:var(--maroon); }
.form-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:.85rem 1rem; }
.form-grid .full { grid-column:1 / -1; }
.form-card { background:#fff; border:1px solid var(--line); border-radius:12px; padding:1.25rem; }
.form-card label { display:block; font-size:.78rem; font-weight:700; color:var(--muted); margin-bottom:.35rem; text-transform:uppercase; letter-spacing:.04em; }
.form-card input, .form-card select, .form-card textarea {
  width:100%; border:1.5px solid var(--line); border-radius:8px; padding:.65rem .75rem; font:inherit;
}
.form-card input:focus, .form-card select:focus, .form-card textarea:focus {
  outline:none; border-color:var(--maroon); box-shadow:0 0 0 3px rgba(128,0,0,.1);
}
.btn-primary { background:var(--maroon); color:#fff; border-color:var(--maroon); }
.btn-primary:hover { background:var(--maroon-dark); color:#fff; }
.muted { color:var(--muted); font-size:.85rem; }
.pill { display:inline-flex; padding:.15rem .5rem; border-radius:999px; font-size:.7rem; font-weight:700; background:#fff4cc; color:#92400e; }
.pill.ok { background:#ecfdf5; color:#047857; }
.pill.warn { background:#fef2f2; color:#b91c1c; }
.toast {
  position:fixed; bottom:1.25rem; right:1.25rem; background:var(--maroon); color:#fff;
  padding:.75rem 1rem; border-radius:10px; box-shadow:0 10px 30px rgba(0,0,0,.2); z-index:100; display:none;
}
.toast.show { display:block; }
@media (max-width:720px){ .form-grid{ grid-template-columns:1fr; } }

/* Form validation */
.sls-val-error {
  background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; border-radius: 8px;
  padding: .65rem .85rem; margin-bottom: .85rem; font-size: .875rem; font-weight: 600;
}
.sls-val-error[hidden] { display: none !important; }
.mobile-prefix-wrap {
  display: flex; align-items: stretch; border: 1.5px solid var(--line); border-radius: 8px;
  overflow: hidden; background: #fff;
}
.mobile-prefix-wrap:focus-within { border-color: var(--maroon); box-shadow: 0 0 0 3px rgba(128,0,0,.1); }
.mobile-prefix {
  display: grid; place-items: center; padding: 0 .75rem; background: #f8fafc;
  border-right: 1px solid var(--line); font-weight: 800; color: var(--maroon); font-size: .95rem;
  letter-spacing: .02em; user-select: none;
}
.mobile-prefix-wrap input {
  border: 0 !important; box-shadow: none !important; border-radius: 0 !important; flex: 1;
}

/* Students dashboard (Slsschool-style, maroon/yellow) */
.dash-head { display:flex; flex-wrap:wrap; gap:1rem; justify-content:space-between; align-items:flex-start; margin-bottom:1rem; }
.dash-head h1 { margin:0; font-size:1.45rem; font-weight:800; color:#0f172a; letter-spacing:-.02em; }
.dash-head .sub { margin:.25rem 0 0; color:var(--muted); font-size:.88rem; }
.dash-actions { display:flex; flex-wrap:wrap; gap:.5rem; align-items:center; }
.dash-actions select {
  border:1.5px solid var(--line); border-radius:8px; padding:.5rem .7rem; font:inherit; background:#fff; min-width:120px;
}
.kpi-row { display:grid; grid-template-columns:repeat(5,minmax(0,1fr)); gap:.75rem; margin-bottom:.85rem; }
.kpi-card {
  background:#fff; border:1px solid var(--line); border-radius:12px; padding:.85rem 1rem .55rem;
  box-shadow:0 1px 2px rgba(0,0,0,.03); display:flex; flex-direction:column; min-height:7.5rem;
  transition: box-shadow .18s ease, border-color .18s ease, transform .18s ease;
}
a.kpi-card, a.kpi-card:link, a.kpi-card:visited {
  text-decoration: none; color: inherit; cursor: pointer;
}
a.kpi-card:hover, a.kpi-card:focus-visible {
  border-color: var(--maroon);
  box-shadow: 0 6px 18px rgba(128,0,0,.12);
  transform: translateY(-2px);
  outline: none;
}
a.kpi-card:active { transform: translateY(0); box-shadow: 0 2px 8px rgba(128,0,0,.1); }
a.kpi-card .kpi-label {
  display: flex; align-items: center; justify-content: space-between; gap: .35rem;
}
a.kpi-card .kpi-label::after {
  content: "\f054"; font-family: "Font Awesome 6 Free"; font-weight: 900;
  font-size: .65rem; opacity: 0; color: var(--maroon); transition: opacity .15s ease;
}
a.kpi-card:hover .kpi-label::after, a.kpi-card:focus-visible .kpi-label::after { opacity: .7; }
.kpi-card .kpi-label { font-size:.72rem; font-weight:700; text-transform:uppercase; letter-spacing:.04em; color:var(--muted); }
.kpi-card .kpi-value { font-size:1.7rem; font-weight:800; color:var(--maroon); letter-spacing:-.03em; margin-top:.15rem; line-height:1.1; }
.kpi-card .kpi-sub { font-size:.75rem; color:var(--muted); margin-top:.2rem; flex:1; }
.kpi-card .kpi-spark { height:2.1rem; margin-top:.35rem; pointer-events: none; }
.stats-strip {
  display:flex; flex-wrap:wrap; gap:.35rem 1.25rem; align-items:center;
  background:#f1f5f9; border:1px solid var(--line); border-radius:10px; padding:.65rem 1rem; margin-bottom:.75rem;
  font-size:.8rem; color:#334155;
}
.stats-strip .ss-item b { color:#0f172a; font-weight:700; }
.stats-strip .ss-item.amber b { color:#b45309; }
.warn-row { display:flex; flex-wrap:wrap; gap:.5rem; margin-bottom:1rem; }
.warn-tag {
  display:inline-flex; align-items:center; gap:.4rem; background:#fff7ed; color:#9a3412;
  border:1px solid #fdba74; border-radius:8px; padding:.4rem .7rem; font-size:.78rem; font-weight:600;
}
.chart-grid { display:grid; grid-template-columns:2fr 1fr; gap:.85rem; margin-bottom:.85rem; }
.chart-grid-2 { display:grid; grid-template-columns:1fr 1fr; gap:.85rem; margin-bottom:.85rem; }
.chart-grid-3 { display:grid; grid-template-columns:1fr 1fr 1fr; gap:.85rem; margin-bottom:.85rem; }
.chart-panel {
  background:#fff; border:1px solid var(--line); border-radius:12px; padding:1rem 1.1rem 1.15rem;
  box-shadow:0 1px 2px rgba(0,0,0,.03);
}
.chart-panel h3 { margin:0 0 .15rem; font-size:.95rem; font-weight:700; color:#0f172a; }
.chart-panel .chart-sub { margin:0 0 .75rem; font-size:.78rem; color:var(--muted); }
.chart-box { position:relative; height:260px; width:100%; }
.chart-box.tall { height:320px; }
.kpi-card .kpi-spark { width:100%; }
.custom-range { display:inline-flex; align-items:center; gap:.35rem; flex-wrap:wrap; }
.custom-range input[type="date"] {
  border:1px solid var(--line); border-radius:8px; padding:.35rem .5rem; font:inherit; font-size:.8rem;
}
.warn-tag.ok { background:#ecfdf5; color:#047857; border-color:#6ee7b7; }
.recent-list { max-height:260px; overflow:auto; }
.filters { display:flex; flex-wrap:wrap; gap:.5rem; align-items:center; margin-bottom:.85rem; }
.filters select, .filters input[type="search"], .filters input[type="text"] {
  border:1px solid var(--line); border-radius:8px; padding:.45rem .65rem; font:inherit; font-size:.85rem; background:#fff;
}
.filters input[type="search"] { min-width:14rem; flex:1; }
.table-wrap { overflow:auto; background:#fff; border:1px solid var(--line); border-radius:12px; }
table.data { width:100%; border-collapse:collapse; font-size:.85rem; }
table.data th {
  text-align:left; padding:.65rem .75rem; background:#f8fafc; color:#64748b; font-size:.72rem;
  letter-spacing:.04em; text-transform:uppercase; border-bottom:1px solid var(--line); white-space:nowrap;
}
table.data td { padding:.65rem .75rem; border-bottom:1px solid #f1f5f9; vertical-align:middle; }
table.data tr:hover td { background:#fafafa; }
table.data .actions { display:flex; gap:.35rem; white-space:nowrap; }
.pill { display:inline-block; padding:.15rem .45rem; border-radius:999px; font-size:.72rem; font-weight:600; }
.pill.ok { background:#ecfdf5; color:#047857; }
.pill.warn { background:#fff7ed; color:#c2410c; }
.pill.muted { background:#f1f5f9; color:#64748b; }
.section-combo { display:flex; flex-direction:column; gap:.35rem; }
.section-combo .hint { font-size:.72rem; color:var(--muted); }
.form-sec { margin:1.25rem 0 .65rem; font-size:.9rem; font-weight:700; color:var(--maroon); border-bottom:1px solid var(--line); padding-bottom:.35rem; }
.form-sec:first-child { margin-top:0; }
.dash-actions { display:flex; flex-wrap:wrap; gap:.45rem; align-items:center; }
@media (max-width:1100px){
  .kpi-row { grid-template-columns:repeat(3,minmax(0,1fr)); }
  .chart-grid, .chart-grid-2, .chart-grid-3 { grid-template-columns:1fr; }
}
@media (max-width:720px){
  .kpi-row { grid-template-columns:repeat(2,minmax(0,1fr)); }
}
