/* ============================================================
   School Management System — Complete Stylesheet
   Palette: Blue · Yellow · Orange · Pink · Purple · Gray · Gold
   Version: 7.0 (colourful tables + modern UI)
   ============================================================ */

:root {
  /* ---------- Core Palette ---------- */
  --blue:        #1565c0;
  --blue-light:  #e3f2fd;
  --blue-dark:   #0d47a1;

  --yellow:      #fbc02d;
  --yellow-light:#fff9c4;

  --orange:      #ef6c00;
  --orange-light:#fff3e0;

  --pink:        #d81b60;
  --pink-light:  #fce4ec;

  --purple:      #6a1b9a;
  --purple-light:#f3e5f5;

  --gray:        #546e7a;
  --gray-light:  #eceff1;

  --gold:        #ffc107;
  --gold-light:  #fff8e1;

  /* ---------- Aliases (existing code uses these) ---------- */
  --primary:        var(--blue);
  --primary-dark:   var(--blue-dark);
  --primary-light:  var(--blue-light);
  --accent:         var(--orange);
  --accent-light:   var(--gold);
  --bg:             #f5f7fa;
  --card:           #ffffff;
  --text:           #263238;
  --text-light:     var(--gray);
  --border:         #cfd8dc;
  --sidebar-bg:     #0d47a1;
  --sidebar-hover:  #1565c0;
  --success:        #2e7d32;
  --warning:        var(--orange);
  --danger:         var(--pink);
  --info:           var(--blue);
  --radius:         8px;
  --shadow:         0 2px 10px rgba(21,101,192,.08);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }

body {
  font-family: -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}

/* CBC assessment workspace */
.cbc-hero{background:linear-gradient(105deg,#2866db,#119b83);color:#fff;border-radius:8px;padding:28px 32px;margin-bottom:20px;display:flex;justify-content:space-between;align-items:center;gap:18px}.cbc-hero h1{color:#fff;font-size:2rem;margin:5px 0}.cbc-hero p{margin:0;max-width:650px}.cbc-hero small{font-weight:800;letter-spacing:.8px}.cbc-hero.compact{padding:23px 30px}.btn-light{background:#fff;color:#15324d}.btn-outline-light{border:1px solid #fff;color:#fff;background:transparent}.cbc-stat-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:16px;margin:20px 0}.cbc-stat{background:#fff;border:1px solid #d5e0ed;border-left:4px solid #119b83;padding:18px 20px;border-radius:8px}.cbc-stat small,.cbc-score-table small{display:block;color:#64748b;font-size:.76rem;font-weight:600}.cbc-stat strong{font-size:1.65rem;display:block;color:#09284b;margin-top:7px}.cbc-filter,.cbc-item-form,.cbc-create{display:flex;gap:12px;align-items:end;flex-wrap:wrap}.cbc-filter select,.cbc-filter input{min-width:150px;flex:1}.cbc-create label{min-width:220px;flex:1;font-weight:700}.cbc-create input,.cbc-create select{display:block;width:100%;margin-top:5px}.cbc-item-form input{flex:1;min-width:160px}.cbc-register-head,.cbc-report-head{display:flex;justify-content:space-between;align-items:center;gap:15px}.cbc-report-head h1{margin:0;color:#09284b}.cbc-report-head p{margin:4px 0 0;color:#64748b}.cbc-empty{text-align:center;padding:32px!important}.cbc-score-table th{min-width:160px;vertical-align:top}.cbc-score-table td{vertical-align:top}.cbc-score-input{width:65px!important;padding:7px!important}.cbc-remark{width:100%!important;margin-top:5px;padding:6px!important;font-size:.78rem}.cbc-level{font-weight:800}.cbc-level-ee{color:#159947}.cbc-level-me{color:#1769d4}.cbc-level-ae{color:#c46b00}.cbc-level-be{color:#d62525}@media(max-width:800px){.cbc-hero,.cbc-register-head,.cbc-report-head{align-items:flex-start;flex-direction:column}.cbc-stat-grid{grid-template-columns:repeat(2,1fr)}.cbc-filter>*{width:100%}}@media(max-width:430px){.cbc-stat-grid{grid-template-columns:1fr}}

/* ============================================================
   APP LAYOUT
============================================================ */
.app { display: flex; min-height: 100vh; }

/* ---------- SIDEBAR ---------- */
.sidebar {
  width: 250px;
  background: linear-gradient(180deg, #0d47a1 0%, #1565c0 100%);
  color: #ecf0f1;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 200;
  transition: transform .28s cubic-bezier(.4,0,.2,1);
  -webkit-overflow-scrolling: touch;
}
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.3); border-radius: 3px; }

.sidebar .brand {
  padding: 20px 18px;
  font-size: .92rem;
  font-weight: 700;
  letter-spacing: 1.2px;
  color: #fff;
  text-transform: uppercase;
  background: rgba(0,0,0,.15);
  border-bottom: 2px solid var(--gold);
  word-break: break-word;
}

.sidebar nav { padding: 8px 0; }

.sidebar nav > a {
  display: flex;
  align-items: center;
  padding: 11px 18px;
  color: #cfd8dc;
  text-decoration: none;
  font-size: .88rem;
  font-weight: 500;
  border-left: 4px solid transparent;
  transition: all .15s;
  -webkit-tap-highlight-color: transparent;
}
.sidebar nav > a span {
  margin-right: 10px;
  font-size: 1rem;
  width: 20px;
  display: inline-block;
  text-align: center;
  flex-shrink: 0;
}
.sidebar nav > a:hover {
  background: rgba(255,255,255,.1);
  color: #fff;
  border-left-color: var(--gold);
}
.sidebar nav > a.active {
  background: rgba(255,255,255,.15);
  color: #fff;
  border-left-color: var(--gold);
  font-weight: 600;
}

.sidebar .logout-link {
  margin-top: 20px;
  border-top: 1px solid rgba(255,255,255,.1);
  color: var(--yellow);
}

/* Collapsible groups */
.nav-group > .nav-group-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 18px;
  color: #cfd8dc;
  font-size: .88rem;
  font-weight: 500;
  cursor: pointer;
  border-left: 4px solid transparent;
  transition: all .15s;
  text-decoration: none;
}
.nav-group > .nav-group-toggle > span:first-child {
  margin-right: 10px;
  font-size: 1rem;
  width: 20px;
  display: inline-block;
  text-align: center;
}
.nav-group > .nav-group-toggle:hover {
  background: rgba(255,255,255,.1);
  color: #fff;
}
.nav-group.open > .nav-group-toggle {
  background: rgba(0,0,0,.15);
  color: #fff;
  border-left-color: var(--gold);
}
.nav-group .arrow {
  font-size: .7rem;
  transition: transform .2s;
  color: var(--gold);
  margin-left: auto;
}
.nav-group.open .arrow { transform: rotate(180deg); }

.nav-group .nav-submenu {
  max-height: 0;
  overflow: hidden;
  transition: max-height .3s ease;
  background: rgba(0,0,0,.15);
}
.nav-group.open .nav-submenu { max-height: 1000px; }

.nav-group .nav-submenu a.sub-link {
  display: flex;
  align-items: center;
  padding: 9px 18px 9px 46px;
  color: #90a4ae;
  font-size: .82rem;
  text-decoration: none;
  border-left: 4px solid transparent;
  transition: all .15s;
}
.nav-group .nav-submenu a.sub-link span {
  margin-right: 8px;
  width: 16px;
  text-align: center;
}
.nav-group .nav-submenu a.sub-link:hover {
  background: rgba(255,255,255,.08);
  color: #fff;
}
.nav-group .nav-submenu a.sub-link.active {
  color: #fff;
  border-left-color: var(--gold);
  background: rgba(255,255,255,.1);
  font-weight: 600;
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 190;
  opacity: 0;
  visibility: hidden;
  transition: opacity .25s ease, visibility .25s ease;
}
.sidebar-backdrop.show { opacity: 1; visibility: visible; }

/* ============================================================
   MAIN CONTENT
============================================================ */
.main {
  flex: 1;
  margin-left: 250px;
  min-height: 100vh;
  background: var(--bg);
  transition: margin-left .28s ease;
  display: flex;
  flex-direction: column;
}

.main > *:not(.site-footer):not(.topbar):not(.page-banner) { flex-shrink: 0; }

/* ---------- TOPBAR ---------- */
.topbar {
  background: linear-gradient(90deg, #0d47a1 0%, #1565c0 50%, #6a1b9a 100%);
  padding: 14px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 4px 12px rgba(13,71,161,.15);
  position: sticky;
  top: 0;
  z-index: 100;
}
.topbar h2 {
  color: #fff;
  font-size: 1.05rem;
  font-weight: 600;
  margin: 0;
  flex: 1;
  margin-left: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.topbar .user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  font-size: .9rem;
}
.topbar .user-info .badge {
  background: rgba(255,255,255,.2);
  color: #fff;
  border: 1px solid rgba(255,255,255,.3);
}

.menu-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.6rem;
  color: #fff;
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
  border-radius: 4px;
}
.menu-toggle:hover,
.menu-toggle:active { background: rgba(255,255,255,.15); }

.page-banner {
  background: linear-gradient(90deg, var(--gold) 0%, var(--yellow) 100%);
  color: #4a3800;
  text-align: center;
  font-weight: 700;
  font-size: 1rem;
  padding: 14px;
  margin: 20px 24px 0;
  border-radius: 4px;
  letter-spacing: 1px;
  text-transform: uppercase;
  box-shadow: 0 2px 8px rgba(255,193,7,.3);
}

/* ============================================================
   CARDS
============================================================ */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: 0 2px 10px rgba(21,101,192,.08);
  padding: 20px;
  margin: 20px 24px;
  border-top: 3px solid var(--blue);
}
.card h3 {
  color: var(--blue-dark);
  font-size: 1rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .6px;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--blue-light);
  display: flex;
  align-items: center;
  gap: 8px;
}
.card h3::before {
  content: '';
  width: 4px;
  height: 18px;
  background: var(--blue);
  border-radius: 2px;
  display: inline-block;
}

/* Colour variants */
.card.purple { border-top-color: var(--purple); }
.card.purple h3 { color: var(--purple); border-bottom-color: var(--purple-light); }
.card.purple h3::before { background: var(--purple); }

.card.orange { border-top-color: var(--orange); }
.card.orange h3 { color: var(--orange); border-bottom-color: var(--orange-light); }
.card.orange h3::before { background: var(--orange); }

.card.pink { border-top-color: var(--pink); }
.card.pink h3 { color: var(--pink); border-bottom-color: var(--pink-light); }
.card.pink h3::before { background: var(--pink); }

.card.gold { border-top-color: var(--gold); }
.card.gold h3 { color: #b58a00; border-bottom-color: var(--gold-light); }
.card.gold h3::before { background: var(--gold); }

/* ============================================================
   GRIDS
============================================================ */
.grid { display: grid; gap: 16px; margin: 20px 24px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }

.stat-card {
  background: #fff;
  border-left: 5px solid var(--blue);
  padding: 18px;
  border-radius: var(--radius);
  box-shadow: 0 2px 8px rgba(21,101,192,.08);
  transition: transform .15s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(21,101,192,.12); }

.stat-card .label {
  color: var(--gray);
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 600;
}
.stat-card .value {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--blue);
  margin-top: 4px;
}

.stat-card.yellow  { border-left-color: var(--yellow); }
.stat-card.yellow .value  { color: #b58a00; }
.stat-card.orange  { border-left-color: var(--orange); }
.stat-card.orange .value  { color: var(--orange); }
.stat-card.pink    { border-left-color: var(--pink); }
.stat-card.pink .value    { color: var(--pink); }
.stat-card.purple  { border-left-color: var(--purple); }
.stat-card.purple .value  { color: var(--purple); }
.stat-card.gold    { border-left-color: var(--gold); }
.stat-card.gold .value    { color: #b58a00; }

/* ============================================================
   FORMS
============================================================ */
label {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
  font-size: .82rem;
  color: var(--gray);
}
input, select, textarea {
  width: 100%;
  padding: 9px 12px;
  border: 2px solid var(--border);
  border-radius: 4px;
  font-size: .9rem;
  font-family: inherit;
  background: #fff;
  transition: all .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(21,101,192,.12);
}
input[readonly] { background: var(--gray-light); color: var(--gray); }
.form-row { margin-bottom: 14px; }

/* ============================================================
   BUTTONS
============================================================ */
.btn {
  display: inline-block;
  padding: 9px 16px;
  background: var(--blue);
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: .85rem;
  font-weight: 600;
  text-decoration: none;
  text-align: center;
  transition: all .15s;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { background: var(--blue-dark); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(21,101,192,.25); }
.btn-sm { padding: 5px 10px; font-size: .75rem; }
.btn-lg { padding: 12px 24px; font-size: 1rem; }

.btn-primary   { background: var(--blue); }
.btn-primary:hover   { background: var(--blue-dark); }
.btn-secondary { background: var(--gray); }
.btn-secondary:hover { background: #37474f; }
.btn-success   { background: var(--orange); }
.btn-success:hover   { background: #e65100; }
.btn-warning   { background: var(--yellow); color: #4a3800; }
.btn-warning:hover   { background: #f9a825; }
.btn-danger    { background: var(--pink); }
.btn-danger:hover    { background: #ad1457; }
.btn-info      { background: var(--purple); }
.btn-info:hover      { background: #4a148c; }

/* ============================================================
   TABLES — Colourful, modern design
============================================================ */
.table-wrap {
  overflow-x: auto;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
  box-shadow: 0 2px 8px rgba(21,101,192,.06);
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: .88rem;
}

/* Header — deep blue gradient */
table thead {
  background: linear-gradient(135deg, #0d47a1 0%, #1565c0 100%);
  color: #fff;
}
table thead th {
  padding: 13px 14px;
  text-align: left;
  font-weight: 700;
  font-size: .76rem;
  letter-spacing: 1px;
  text-transform: uppercase;
  white-space: nowrap;
  color: #fff;
  border-bottom: 3px solid var(--gold);
  position: relative;
}
table thead th:first-child { border-top-left-radius: 8px; }
table thead th:last-child  { border-top-right-radius: 8px; }

/* Rows — alternating, colourful */
table tbody td {
  padding: 11px 14px;
  border-bottom: 1px solid #eceff1;
  color: var(--text);
}
table tbody tr:nth-child(odd) td  { background: #ffffff; }
table tbody tr:nth-child(even) td { background: var(--blue-light); }

table tbody tr:hover td {
  background: var(--gold-light) !important;
  transition: background .15s;
}

table tbody tr:last-child td {
  border-bottom: none;
}

/* Coloured borders for specific columns */
table tbody td:first-child {
  border-left: 4px solid transparent;
}
table tbody tr:nth-child(odd) td:first-child  { border-left-color: var(--blue); }
table tbody tr:nth-child(even) td:first-child { border-left-color: var(--purple); }

/* Table footnote */
table tfoot {
  background: linear-gradient(135deg, var(--yellow-light) 0%, var(--gold-light) 100%);
}
table tfoot td {
  padding: 12px 14px;
  font-weight: 700;
  color: var(--blue-dark);
  border-top: 2px solid var(--gold);
}

/* Special: rank #1 row */
table tbody tr.top-row td {
  background: linear-gradient(135deg, var(--gold-light) 0%, var(--yellow-light) 100%) !important;
  font-weight: 600;
  color: #4a3800;
}

/* Special: cleared/success row */
table tbody tr.success-row td {
  background: linear-gradient(135deg, #e8f5e9 0%, var(--yellow-light) 100%) !important;
}

/* Special: warning row */
table tbody tr.warning-row td {
  background: linear-gradient(135deg, var(--orange-light) 0%, var(--yellow-light) 100%) !important;
}

/* Special: danger row */
table tbody tr.danger-row td {
  background: linear-gradient(135deg, var(--pink-light) 0%, #fff0f6 100%) !important;
}

/* ============================================================
   BADGES — colourful pills
============================================================ */
.badge {
  display: inline-block;
  padding: 4px 11px;
  border-radius: 14px;
  font-size: .72rem;
  font-weight: 700;
  white-space: nowrap;
  letter-spacing: .3px;
}
.badge-success { background: var(--orange-light);  color: var(--orange);   border: 1px solid rgba(239,108,0,.2); }
.badge-warning { background: var(--yellow-light);  color: #7a5c00;         border: 1px solid rgba(251,192,45,.4); }
.badge-danger  { background: var(--pink-light);    color: var(--pink);     border: 1px solid rgba(216,27,96,.2); }
.badge-info    { background: var(--blue-light);    color: var(--blue-dark);border: 1px solid rgba(21,101,192,.2); }
.badge-purple  { background: var(--purple-light);  color: var(--purple);   border: 1px solid rgba(106,27,154,.2); }
.badge-gold    { background: var(--gold-light);    color: #7a5c00;         border: 1px solid rgba(255,193,7,.4); }
.badge-gray    { background: var(--gray-light);    color: var(--gray);     border: 1px solid rgba(84,110,122,.2); }

/* ============================================================
   ALERTS
============================================================ */
.alert-success, .alert-error, .alert-info, .alert-warning {
  padding: 12px 16px;
  border-radius: 6px;
  margin: 16px 24px;
  font-size: .9rem;
  border-left: 5px solid;
  font-weight: 500;
}
.alert-success { background: var(--orange-light); color: #a84b00; border-color: var(--orange); }
.alert-error   { background: var(--pink-light);   color: #8e0044; border-color: var(--pink); }
.alert-info    { background: var(--blue-light);   color: var(--blue-dark); border-color: var(--blue); }
.alert-warning { background: var(--yellow-light); color: #7a5c00; border-color: var(--yellow); }

.muted { color: var(--gray); font-size: .85rem; }

/* ============================================================
   LOGIN
============================================================ */
.login-body {
  background: linear-gradient(135deg, #0d47a1 0%, #1565c0 50%, #6a1b9a 100%);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.login-card {
  background: #fff;
  padding: 40px;
  border-radius: 12px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
  border-top: 5px solid var(--gold);
}
.login-card h1 { color: var(--blue-dark); margin-bottom: 8px; font-size: 1.4rem; }
.login-card label { margin-top: 16px; font-size: .85rem; }
.login-card input { margin-top: 6px; }
.login-card .btn-primary {
  width: 100%;
  margin-top: 22px;
  padding: 13px;
  font-size: 1rem;
}

/* ============================================================
   OFFLINE BANNER
============================================================ */
#offline-banner {
  display: none;
  background: var(--orange);
  color: #fff;
  text-align: center;
  padding: 8px;
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 999;
  font-weight: 600;
}

/* ============================================================
   PAGE TOOLBARS
============================================================ */
.fin-toolbar,
.exam-toolbar,
.stu-toolbar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(105px, 1fr));
  gap: 10px;
  margin: 16px 24px;
  padding: 14px;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(21,101,192,.08);
}
.fin-tool-btn,
.exam-tool-btn,
.stu-tool-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 12px 6px;
  background: var(--blue-light);
  border: 1px solid rgba(21,101,192,.15);
  border-radius: 6px;
  text-decoration: none;
  color: var(--blue-dark);
  font-size: .74rem;
  font-weight: 700;
  text-align: center;
  transition: all .15s;
  min-height: 78px;
  line-height: 1.3;
}
.fin-tool-btn span,
.exam-tool-btn span,
.stu-tool-btn span {
  font-size: 1.4rem;
  margin-bottom: 4px;
  line-height: 1;
}
.fin-tool-btn  { border-left: 4px solid var(--blue); }
.exam-tool-btn { border-left: 4px solid var(--purple); }
.stu-tool-btn  { border-left: 4px solid var(--orange); }

.fin-tool-btn:hover  { background: var(--blue); color: #fff; border-color: var(--blue); transform: translateY(-2px); }
.exam-tool-btn:hover { background: var(--purple); color: #fff; border-color: var(--purple); transform: translateY(-2px); }
.stu-tool-btn:hover  { background: var(--orange); color: #fff; border-color: var(--orange); transform: translateY(-2px); }

/* ============================================================
   STUDENTS PAGE
============================================================ */
.stu-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin: 16px 24px;
}
.stu-kpi {
  border-radius: 8px;
  padding: 16px;
  color: #fff;
  box-shadow: 0 4px 12px rgba(0,0,0,.1);
  position: relative;
  overflow: hidden;
}
.stu-kpi::after {
  content: '';
  position: absolute;
  right: -20px;
  bottom: -20px;
  width: 100px;
  height: 100px;
  background: rgba(255,255,255,.1);
  border-radius: 50%;
}
.stu-kpi .k-label {
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  opacity: .95;
  font-weight: 700;
}
.stu-kpi .k-value {
  font-size: 1.4rem;
  font-weight: 700;
  margin-top: 6px;
}
.stu-kpi.blue   { background: linear-gradient(135deg,#0d47a1,#1565c0); }
.stu-kpi.green  { background: linear-gradient(135deg,#ef6c00,#f57c00); }
.stu-kpi.orange { background: linear-gradient(135deg,#f9a825,#fbc02d); color: #4a3800; }
.stu-kpi.purple { background: linear-gradient(135deg,#6a1b9a,#8e24aa); }
.stu-kpi.pink   { background: linear-gradient(135deg,#d81b60,#ec407a); }
.stu-kpi.gold   { background: linear-gradient(135deg,#ffc107,#ffd54f); color: #4a3800; }

.stu-panel {
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(21,101,192,.08);
  margin: 0 24px 16px;
  overflow: hidden;
}
.stu-panel > summary {
  padding: 13px 18px;
  cursor: pointer;
  font-weight: 700;
  font-size: .95rem;
  color: #fff;
  background: linear-gradient(90deg, var(--blue-dark), var(--blue));
  list-style: none;
  user-select: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  letter-spacing: .5px;
}
.stu-panel > summary::-webkit-details-marker { display: none; }
.stu-panel > summary::after {
  content: '▾';
  font-size: 1.1rem;
  transition: transform .2s;
}
.stu-panel[open] > summary::after { transform: rotate(180deg); }
.stu-panel.blue  > summary { background: linear-gradient(90deg, #0d47a1, #1565c0); }
.stu-panel.green > summary { background: linear-gradient(90deg, #ef6c00, #f57c00); }
.stu-panel.purple > summary { background: linear-gradient(90deg, #4a148c, #6a1b9a); }
.stu-panel.pink > summary { background: linear-gradient(90deg, #ad1457, #d81b60); }
.stu-panel .panel-body {
  padding: 18px;
  border-top: 1px solid var(--gray-light);
  background: #fafcff;
}

.stu-filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
}
.stu-filter-grid .wide { grid-column: span 2; }
.stu-filter-grid label {
  font-size: .7rem;
  text-transform: uppercase;
  color: var(--gray);
  letter-spacing: .5px;
  font-weight: 700;
  display: block;
  margin-bottom: 4px;
}
.stu-filter-grid input,
.stu-filter-grid select {
  padding: 8px 10px;
  font-size: .85rem;
  width: 100%;
  border: 2px solid var(--border);
  border-radius: 4px;
  background: #fff;
}

.stu-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--gray-light);
}
.stu-actions .left  { display: flex; gap: 8px; flex-wrap: wrap; }
.stu-actions .right { display: flex; gap: 8px; flex-wrap: wrap; }

.stu-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 14px;
}
.stu-form-grid .full { grid-column: 1 / -1; }

.stu-table tbody tr { cursor: pointer; }
.stu-table tbody tr:hover td { background: var(--gold-light) !important; }

.stu-name-link { text-decoration: none; color: inherit; display: block; }
.stu-name-link:hover strong { color: var(--blue); }
.stu-name-link small { display: block; color: var(--gray); font-size: .72rem; margin-top: 2px; }

.stu-avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--purple), var(--pink));
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: .8rem;
  margin-right: 10px;
  flex-shrink: 0;
  overflow: hidden;
}
.stu-avatar img {
  width: 100%; height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

.stu-actions-cell {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

/* ============================================================
   TABS
============================================================ */
.tab-bar {
  display: flex;
  gap: 4px;
  margin: 16px 24px 0;
  background: var(--gray-light);
  border-radius: 8px;
  padding: 5px;
  flex-wrap: wrap;
}
.tab-bar a {
  padding: 10px 18px;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 700;
  font-size: .88rem;
  color: var(--gray);
  transition: .15s;
}
.tab-bar a:hover { background: #fff; color: var(--blue); }
.tab-bar a.active {
  background: linear-gradient(135deg, var(--blue-dark), var(--blue));
  color: #fff;
  box-shadow: 0 2px 8px rgba(21,101,192,.35);
}

/* ============================================================
   SITE FOOTER
============================================================ */
.site-footer {
  margin-top: auto;
  flex-shrink: 0;
  width: 100%;
  background: linear-gradient(90deg, #0d47a1 0%, #1565c0 100%);
  color: #cfd8dc;
  padding: 14px 24px;
  font-size: .82rem;
  border-top: 3px solid var(--gold);
  box-sizing: border-box;
}
.site-footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}
.site-footer-left { color: #fff; white-space: nowrap; flex-shrink: 0; }
.site-footer-left strong { color: var(--gold); font-weight: 700; }
.site-footer-right {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
}
.site-footer-right span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  color: #cfd8dc;
}
.site-footer a { color: var(--yellow); text-decoration: none; transition: color .15s; }
.site-footer a:hover { color: var(--gold); text-decoration: underline; }

/* ============================================================
   MOBILE
============================================================ */
@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-100%);
    width: 260px;
    z-index: 200;
    box-shadow: 4px 0 24px rgba(0,0,0,.25);
  }
  .sidebar.open { transform: translateX(0); }
  .menu-toggle { display: inline-block; }
  .sidebar-backdrop.show { display: block; }
  .main { margin-left: 0 !important; width: 100%; }

  .topbar { padding: 12px 14px; gap: 10px; }
  .topbar h2 { font-size: .95rem; margin-left: 6px; }
  .topbar .user-info { font-size: .8rem; gap: 6px; }
  .topbar .user-info .badge { display: none; }

  .card, .grid,
  .alert-success, .alert-error, .alert-info, .alert-warning,
  .stu-panel, .stu-kpi-grid,
  .fin-toolbar, .exam-toolbar, .stu-toolbar {
    margin-left: 12px;
    margin-right: 12px;
  }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }

  .page-banner { margin: 12px; font-size: .88rem; padding: 12px; }

  .sidebar nav > a,
  .nav-group > .nav-group-toggle { padding: 13px 18px; font-size: .92rem; }
  .nav-group .nav-submenu a.sub-link { padding: 11px 18px 11px 46px; font-size: .86rem; }

  body.sidebar-open { overflow: hidden; }

  .fin-toolbar, .exam-toolbar, .stu-toolbar {
    grid-template-columns: repeat(3, 1fr);
    padding: 10px;
    gap: 8px;
  }
  .fin-tool-btn, .exam-tool-btn, .stu-tool-btn {
    padding: 10px 4px;
    font-size: .68rem;
    min-height: 68px;
  }
  .fin-tool-btn span, .exam-tool-btn span, .stu-tool-btn span { font-size: 1.2rem; }

  table { font-size: .82rem; }
  table thead th { padding: 10px 10px; font-size: .68rem; }
  table tbody td { padding: 9px 10px; }

  .site-footer { padding: 12px 14px; font-size: .78rem; text-align: center; }
  .site-footer-inner { flex-direction: column; gap: 8px; }
  .site-footer-left { white-space: normal; }
  .site-footer-right { flex-direction: column; gap: 4px; justify-content: center; align-items: center; }
}

@media (min-width: 901px) {
  .sidebar { transform: translateX(0) !important; }
  .sidebar-backdrop { display: none !important; }
  .menu-toggle { display: none !important; }
}

/* ============================================================
   PRINT
============================================================ */
@media print {
  @page { size: A4 portrait; margin: 12mm; }
  html, body { background: #fff !important; margin: 0 !important; padding: 0 !important; font-size: 11px; }

  .sidebar, .sidebar-backdrop, .topbar, .menu-toggle,
  .no-print, #offline-banner, .receipt-actions,
  .stu-actions, .fin-toolbar, .exam-toolbar, .stu-toolbar,
  .tab-bar, .filter-actions, .pagination,
  .site-footer { display: none !important; }

  .main { margin-left: 0 !important; padding: 0 !important; background: #fff !important; display: block !important; }
  .card { box-shadow: none !important; border: none !important; padding: 0 !important; margin: 0 0 8mm 0 !important; page-break-inside: avoid; }

  table { font-size: 10.5px; }
  table thead {
    background: #1565c0 !important;
    color: #fff !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  table thead th { color: #fff !important; border-bottom-color: #ffc107 !important; }
  table tbody tr { page-break-inside: avoid; }
  table tbody tr:nth-child(even) td {
    background: #e3f2fd !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .badge, .alert-success, .alert-error, .alert-info, .alert-warning {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  a { color: #263238 !important; text-decoration: none !important; }
  .a4-sheet { width: 186mm !important; min-height: auto !important; padding: 0 !important; margin: 0 !important; box-shadow: none !important; page-break-inside: avoid; }
}

/* ============================================================
   ACCESSIBILITY
============================================================ */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* CBC performance badges: text and colour communicate the level together. */
.cbc-level{display:inline-block;border:1px solid currentColor;border-radius:999px;padding:3px 8px;font-weight:800}
.cbc-level-ee{color:#137333;background:#e6f4ea}.cbc-level-me{color:#185abc;background:#e8f0fe}.cbc-level-ae{color:#9a5800;background:#fef7e0}.cbc-level-be{color:#b3261e;background:#fce8e6}
.cbc-level-legend{display:flex;gap:8px;flex-wrap:wrap;margin:10px 0}.cbc-level-legend .cbc-level{font-size:.82rem}
.cbc-eyebrow{display:block;color:#1769d4;font-size:.75rem;font-weight:800;letter-spacing:.08em;margin-bottom:6px}.cbc-report-head{border-top:3px solid #1769d4;padding:26px 28px!important}.cbc-report-head h1{font-size:1.7rem;letter-spacing:-.02em}.cbc-report-controls{display:grid;grid-template-columns:minmax(190px,.7fr) minmax(340px,1.3fr);gap:24px;align-items:end;padding:22px 28px!important}.cbc-report-controls__copy h2,.cbc-level-guide h2{font-size:1rem;margin:0 0 5px;color:#09284b}.cbc-report-controls__copy p,.cbc-level-guide p{margin:0;color:#64748b;font-size:.88rem}.cbc-report-controls .cbc-filter{justify-content:flex-end;flex-wrap:nowrap}.cbc-report-select{display:block;flex:1;min-width:0}.cbc-report-select span{display:block;font-size:.76rem;font-weight:800;color:#334155;margin:0 0 6px}.cbc-report-select select{width:100%;min-width:0;border:2px solid #1769d4;min-height:46px}.cbc-report-controls .btn{min-height:46px;white-space:nowrap}.cbc-level-guide{display:flex;justify-content:space-between;align-items:center;gap:20px;padding:19px 28px!important}.cbc-level-guide .cbc-level-legend{margin:0;justify-content:flex-end}.cbc-level-guide .cbc-level{padding:7px 10px}.cbc-level-guide .cbc-level small{font-size:.74rem;font-weight:700;margin-left:4px}.cbc-report-placeholder{text-align:center;padding:64px 24px!important;border:1px dashed #b8c8dc!important;box-shadow:none!important;background:linear-gradient(135deg,#fff,#f7faff)}.cbc-report-placeholder__icon{width:48px;height:48px;display:grid;place-items:center;margin:0 auto 12px;border-radius:50%;background:#e8f0fe;color:#1769d4;font-size:1.4rem}.cbc-report-placeholder h2{margin:0 0 7px;color:#09284b;font-size:1.12rem}.cbc-report-placeholder p{margin:0;color:#64748b}@media(max-width:800px){.cbc-report-controls{grid-template-columns:1fr}.cbc-report-controls .cbc-filter{width:100%;flex-wrap:wrap;justify-content:stretch}.cbc-report-controls .btn{width:100%}.cbc-level-guide{align-items:flex-start;flex-direction:column}.cbc-level-guide .cbc-level-legend{justify-content:flex-start}}@media(max-width:480px){.cbc-report-head,.cbc-report-controls,.cbc-level-guide{padding:20px!important}.cbc-report-head h1{font-size:1.4rem}.cbc-level-guide .cbc-level{width:100%}}
.cbc-centre-intro{display:flex;align-items:center;justify-content:space-between;gap:18px;margin:25px 0 13px}.cbc-centre-intro h2{margin:0;color:#09284b;font-size:1.25rem}.cbc-centre-intro p{margin:4px 0 0;color:#64748b}.cbc-centre-intro .cbc-level-legend{margin:0}.cbc-tool-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:16px;margin-bottom:26px}.cbc-tool-card{background:#fff;border:1px solid #d7e3f0;border-radius:10px;padding:19px;min-height:212px;display:flex;flex-direction:column;gap:12px;box-shadow:0 3px 12px rgba(15,43,76,.05);transition:transform .16s ease,box-shadow .16s ease}.cbc-tool-card:hover{transform:translateY(-3px);box-shadow:0 8px 20px rgba(15,43,76,.12)}.cbc-tool-icon{display:grid;place-items:center;width:42px;height:42px;border-radius:10px;background:#edf4ff;font-size:1.25rem}.cbc-tool-card h3{margin:0;color:#09284b;font-size:1.04rem}.cbc-tool-card p{margin:6px 0 0;color:#64748b;font-size:.88rem;line-height:1.5}.cbc-tool-card .btn{margin-top:auto;align-self:flex-start}.cbc-tool-card .btn span{margin-left:5px}@media(max-width:950px){.cbc-tool-grid{grid-template-columns:repeat(2,minmax(0,1fr))}}@media(max-width:600px){.cbc-centre-intro{align-items:flex-start;flex-direction:column}.cbc-tool-grid{grid-template-columns:1fr}.cbc-tool-card{min-height:0}}
