/* ── Reset & Base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800;900&family=DM+Sans:ital,wght@0,400;0,500;0,600;1,400&display=swap');

:root {
  --primary:      #1a5276;
  --primary-dark: #154360;
  --primary-light:#2980b9;
  --accent:       #f39c12;
  --accent-dark:  #d68910;
  --success:      #27ae60;
  --danger:       #e74c3c;
  --warning:      #f39c12;
  --info:         #2980b9;
  --white:        #ffffff;
  --light:        #f4f6f9;
  --grey:         #95a5a6;
  --dark:         #2c3e50;
  --border:       #e8ecf0;
  --surface:      #fafbfc;
  --sidebar-w:    260px;
  --header-h:     65px;
  --radius:       10px;
  --shadow:       0 4px 20px rgba(0,0,0,0.08);
  --shadow-md:    0 8px 28px rgba(0,0,0,0.12);
  --transition:   all 0.2s ease;
}

html { -webkit-font-smoothing: antialiased; }

body {
  font-family: 'DM Sans', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: var(--light);
  color: var(--dark);
  font-size: 14px;
  line-height: 1.6;
}

h1, h2, h3, h4, h5 {
  font-family: 'Plus Jakarta Sans', 'Segoe UI', sans-serif;
  line-height: 1.25;
}

a { color: var(--primary-light); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── LOGIN PAGE ───────────────────────────────────────────── */
.login-page { background: var(--light); min-height: 100vh; }

.login-wrapper {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 100vh;
}

.login-left {
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary-light) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  position: relative;
  overflow: hidden;
}

/* subtle grid overlay */
.login-left::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
}

.school-brand { color: var(--white); text-align: center; position: relative; z-index: 1; }

.brand-icon { font-size: 70px; margin-bottom: 20px; opacity: 0.9; }

.school-brand h1 {
  font-size: 30px;
  font-weight: 800;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
  color: var(--white);
  font-family: 'Plus Jakarta Sans', sans-serif;
}

.brand-sub {
  font-size: 13px;
  opacity: 0.75;
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 30px;
}

.brand-divider {
  width: 60px;
  height: 3px;
  background: var(--accent);
  margin: 20px auto;
  border-radius: 2px;
}

.brand-desc { font-size: 13px; opacity: 0.75; line-height: 1.8; }

.login-right {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  background: #f0f3f7;
}

.login-box {
  width: 100%;
  max-width: 420px;
  background: var(--white);
  padding: 48px 44px;
  border-radius: 16px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.1);
}

.login-box h2 {
  font-size: 26px;
  font-weight: 900;
  color: var(--primary);
  margin-bottom: 6px;
  font-family: 'Plus Jakarta Sans', sans-serif;
}

.login-subtitle { color: var(--grey); margin-bottom: 28px; font-size: 13px; }

.password-wrap { position: relative; }

.toggle-password {
  position: absolute;
  right: 14px; top: 50%;
  transform: translateY(-50%);
  cursor: pointer;
  color: var(--grey);
  transition: color 0.15s;
}
.toggle-password:hover { color: var(--primary); }

.btn-login {
  width: 100%;
  padding: 13px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: var(--white);
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  margin-top: 10px;
  font-family: 'Plus Jakarta Sans', sans-serif;
}

.btn-login:hover {
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(26,82,118,0.3);
}

.login-footer {
  text-align: center;
  margin-top: 24px;
  font-size: 12px;
  color: var(--grey);
}

/* ── LOGOS — LOGIN ────────────────────────────────────────── */
.logos-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  margin-bottom: 20px;
  position: relative;
  z-index: 1;
}

.logo-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.logo-wrap img {
  width: 110px;
  height: 110px;
  object-fit: contain;
  filter: drop-shadow(0 4px 12px rgba(0,0,0,0.3));
  transition: transform 0.25s ease;
}

.logo-wrap img:hover { transform: scale(1.05); }

.logo-label {
  color: rgba(255,255,255,0.85);
  font-size: 10px;
  text-align: center;
  font-weight: 700;
  line-height: 1.4;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.logo-divider {
  width: 2px;
  height: 90px;
  background: rgba(255,255,255,0.2);
  border-radius: 2px;
}

.mottos { margin-top: 16px; display: flex; flex-direction: column; gap: 8px; }

.motto { color: rgba(255,255,255,0.7); font-size: 12px; font-style: italic; }

.motto i { font-size: 10px; margin-right: 6px; color: var(--accent); }

/* ── FORMS ────────────────────────────────────────────────── */
.form-group { margin-bottom: 18px; }

.form-group label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: var(--dark);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  font-family: 'Plus Jakarta Sans', sans-serif;
}

.form-group label i { margin-right: 5px; color: var(--primary-light); }

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 13px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  color: var(--dark);
  background: var(--surface);
  font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--primary-light);
  background: var(--white);
  box-shadow: 0 0 0 3px rgba(41,128,185,0.1);
}

.form-group input::placeholder { color: #bdc3cb; }

/* ── BUTTONS ──────────────────────────────────────────────── */
.btn {
  padding: 9px 20px;
  border: 1.5px solid transparent;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 7px;
  text-decoration: none;
  white-space: nowrap;
  line-height: 1;
  font-family: 'Plus Jakarta Sans', sans-serif;
}

.btn:hover { transform: translateY(-1px); text-decoration: none; }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: var(--white);
  box-shadow: 0 2px 8px rgba(26,82,118,0.2);
}
.btn-primary:hover {
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  color: var(--white);
  box-shadow: 0 4px 14px rgba(26,82,118,0.3);
}

.btn-success {
  background: linear-gradient(135deg, #1e8449, var(--success));
  color: var(--white);
  box-shadow: 0 2px 8px rgba(39,174,96,0.2);
}

.btn-danger {
  background: linear-gradient(135deg, #c0392b, var(--danger));
  color: var(--white);
}

.btn-warning {
  background: linear-gradient(135deg, var(--accent-dark), var(--accent));
  color: var(--white);
}

.btn-outline {
  background: var(--white);
  border-color: var(--border);
  color: var(--dark);
}
.btn-outline:hover {
  border-color: var(--primary-light);
  color: var(--primary);
  background: #eaf4fb;
}

/* ── ALERTS ───────────────────────────────────────────────── */
.alert {
  padding: 11px 15px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1.5px solid transparent;
  font-weight: 500;
}

.alert-error   { background: #fdecea; color: var(--danger);  border-color: #f5b7b1; }
.alert-success { background: #eafaf1; color: var(--success); border-color: #a9dfbf; }
.alert-warning { background: #fef9e7; color: #d68910;        border-color: #f8c471; }
.alert-info    { background: #eaf4fb; color: var(--info);    border-color: #aed6f1; }

/* ── DASHBOARD LAYOUT ─────────────────────────────────────── */
.dashboard-page { display: flex; min-height: 100vh; }

/* ── SIDEBAR ──────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: #0f2540;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 100;
  transition: var(--transition);
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.1) transparent;
}

/* LOGOS — SIDEBAR */
.sidebar-logo {
  padding: 20px 18px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  text-align: center;
}

.sidebar-logos {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 10px;
}

.sidebar-logo-img {
  width: 48px;
  height: 48px;
  object-fit: contain;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.4));
  transition: transform 0.25s ease;
}

.sidebar-logo-img:hover { transform: scale(1.08); }

.sidebar-logo h3 {
  color: var(--white);
  font-size: 13px;
  font-weight: 800;
  text-align: center;
  font-family: 'Plus Jakarta Sans', sans-serif;
  margin-bottom: 2px;
}

.sidebar-logo span {
  color: rgba(255,255,255,0.4);
  font-size: 9.5px;
  text-align: center;
  display: block;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

/* Sidebar nav */
.sidebar-menu { padding: 10px 0 20px; }

.menu-section-title,
.sidebar-section {
  padding: 12px 20px 5px;
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 1.4px;
  color: rgba(255,255,255,0.28);
  font-weight: 700;
  font-family: 'Plus Jakarta Sans', sans-serif;
}

/* ── Collapsible sidebar sections ─────────────────────── */
.menu-section-header {
  display:        flex;
  align-items:    center;
  justify-content:space-between;
  padding:        10px 16px 5px 20px;
  cursor:         pointer;
  user-select:    none;
  border-radius:  6px;
  margin:         0 6px;
  transition:     background 0.12s;
}
.menu-section-header:hover { background: rgba(255,255,255,0.05); }

.menu-section-title-text {
  font-size:      9.5px;
  text-transform: uppercase;
  letter-spacing: 1.4px;
  color:          rgba(255,255,255,0.32);
  font-weight:    700;
}
.menu-section-arrow {
  font-size:   9px;
  color:       rgba(255,255,255,0.25);
  transition:  transform 0.2s ease, color 0.12s;
  flex-shrink: 0;
}
.menu-section-header:hover .menu-section-arrow {
  color: rgba(255,255,255,0.55);
}
.menu-section-body {
  overflow: hidden;
  transition: none;
}

.sidebar-menu a,
.sidebar-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 14px 9px 20px;
  margin: 1px 10px;
  border-radius: 8px;
  color: rgba(255,255,255,0.68);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.12s, color 0.12s, transform 0.12s;
  position: relative;
  white-space: nowrap;
  border-left: none;  /* override old border-left style */
}

.sidebar-menu a i,
.sidebar-item i {
  width: 18px;
  text-align: center;
  font-size: 14px;
  opacity: 0.7;
  flex-shrink: 0;
  transition: opacity 0.12s;
}

.sidebar-menu a:hover,
.sidebar-item:hover {
  background: rgba(255,255,255,0.07);
  color: var(--white);
  transform: translateX(2px);
  text-decoration: none;
  border-left-color: transparent;
}

.sidebar-menu a:hover i,
.sidebar-item:hover i { opacity: 1; }

.sidebar-menu a.active,
.sidebar-item.active {
  background: rgba(255,255,255,0.11);
  color: var(--white);
  font-weight: 700;
}

/* left accent line for active item */
.sidebar-menu a.active::before,
.sidebar-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 50%;
  transform: translateY(-50%);
  width: 3px; height: 20px;
  background: var(--primary-light);
  border-radius: 0 3px 3px 0;
}

.sidebar-menu a.active i,
.sidebar-item.active i { opacity: 1; }

/* Sidebar notification badge */
.sidebar-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 20px;
  background: var(--danger);
  color: white;
  font-size: 10px;
  font-weight: 800;
  margin-left: 6px;
  vertical-align: middle;
  font-family: 'Plus Jakarta Sans', sans-serif;
}

/* ── HEADER ───────────────────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.top-header {
  height: var(--header-h);
  background: var(--white);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 99;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
  flex-shrink: 0;
}

/* LOGOS — HEADER */
.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.header-logos {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-right: 16px;
  border-right: 2px solid var(--border);
}

.header-logo-img {
  width: 38px;
  height: 38px;
  object-fit: contain;
  transition: transform 0.25s ease;
}

.header-logo-img:hover { transform: scale(1.1); }

.header-title h2 {
  font-size: 17px;
  font-weight: 800;
  color: var(--primary);
  font-family: 'Plus Jakarta Sans', sans-serif;
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-title p { font-size: 11px; color: var(--grey); margin: 0; }

.header-right { display: flex; align-items: center; gap: 16px; }

.user-info { text-align: right; }
.user-info .name { font-size: 13px; font-weight: 700; color: var(--dark); line-height: 1.2; }
.user-info .role { font-size: 11px; color: var(--grey); }

.user-avatar {
  width: 38px; height: 38px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--white);
  font-weight: 800;
  cursor: pointer;
  font-size: 13px;
  box-shadow: 0 2px 8px rgba(26,82,118,0.3);
  font-family: 'Plus Jakarta Sans', sans-serif;
  flex-shrink: 0;
}

/* ── PAGE CONTENT ─────────────────────────────────────────── */
.page-content {
  padding: 28px;
  flex: 1;
  animation: fadeUp 0.25s ease both;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── STAT CARDS ───────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 18px;
  margin-bottom: 26px;
}

.stat-card {
  background: var(--white);
  border-radius: 14px;
  padding: 20px 22px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 16px;
  border: 1px solid #edf0f4;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

/* bottom accent strip on hover */
.stat-card::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 3px;
  background: transparent;
  transition: background 0.2s;
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.stat-card:hover::after { background: var(--primary-light); }

.stat-icon {
  width: 50px; height: 50px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  color: var(--white);
  flex-shrink: 0;
}

.stat-icon.blue   { background: linear-gradient(135deg, #2471a3, #2980b9); }
.stat-icon.green  { background: linear-gradient(135deg, #1e8449, #27ae60); }
.stat-icon.orange { background: linear-gradient(135deg, #d68910, #f39c12); }
.stat-icon.purple { background: linear-gradient(135deg, #6c3483, #8e44ad); }
.stat-icon.red    { background: linear-gradient(135deg, #c0392b, #e74c3c); }
.stat-icon.teal   { background: linear-gradient(135deg, #0e6655, #17a589); }

.stat-info .value {
  font-size: 26px;
  font-weight: 900;
  color: var(--dark);
  line-height: 1;
  font-family: 'Plus Jakarta Sans', sans-serif;
}

.stat-info .label { font-size: 12px; color: var(--grey); margin-top: 3px; font-weight: 500; }

/* ── TABLES ───────────────────────────────────────────────── */
.table-card {
  background: var(--white);
  border-radius: 14px;
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 22px;
  border: 1px solid #edf0f4;
}

.table-header {
  padding: 16px 20px;
  border-bottom: 1px solid #eef0f3;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.table-header h3 {
  font-size: 14px;
  font-weight: 800;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: 'Plus Jakarta Sans', sans-serif;
}

table { width: 100%; border-collapse: collapse; }

thead th {
  background: #f7f9fb;
  padding: 11px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--grey);
  border-bottom: 1px solid #edf0f4;
  white-space: nowrap;
  font-family: 'Plus Jakarta Sans', sans-serif;
}

tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid #f0f2f5;
  font-size: 13px;
  color: var(--dark);
  vertical-align: middle;
}

tbody tr:last-child td { border-bottom: none; }
tbody tr { transition: background 0.1s; }
tbody tr:hover td { background: #f4f8fd; }

/* ── BADGES ───────────────────────────────────────────────── */
.badge {
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  font-family: 'Plus Jakarta Sans', sans-serif;
}

.badge-success { background: #eafaf1; color: #1a7a5e; }
.badge-danger  { background: #fdecea; color: #922b21; }
.badge-warning { background: #fef9e7; color: #7d5a00; }
.badge-info    { background: #eaf4fb; color: #1a5f8a; }
.badge-primary { background: #eaf0fb; color: var(--primary); }

/* ── CARDS ────────────────────────────────────────────────── */
.card {
  background: var(--white);
  border-radius: 14px;
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 22px;
  border: 1px solid #edf0f4;
  transition: box-shadow 0.2s;
}

.card:hover { box-shadow: var(--shadow-md); }

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 20px;
  border-bottom: 1px solid #eef0f3;
}

.card-header h3 {
  font-size: 14px;
  font-weight: 800;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: 'Plus Jakarta Sans', sans-serif;
}

.card-header h3 i { color: var(--primary-light); }

/* ── MODALS ───────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10,25,47,0.52);
  backdrop-filter: blur(3px);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay.active { display: flex; }

.modal {
  background: var(--white);
  border-radius: 18px;
  width: 95%;
  max-width: 680px;
  max-height: 90vh;
  overflow-y: auto;
  overflow-x: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
  animation: slideUp 0.22s cubic-bezier(0.34,1.56,0.64,1);
}

/* Wide modal — student detail, user edit, large forms */
.modal.wide {
  max-width: 900px;
  width: 95%;
}

/* All content inside modals wraps, never bleeds outside */
.modal-body,
.modal > div:not(.modal-header) {
  overflow-x: hidden;
  word-break: break-word;
}

/* Tables inside modals scroll horizontally instead of clipping */
.modal table,
.modal .table-scroll {
  overflow-x: auto;
  display: block;
  width: 100%;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(14px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid #eef0f3;
}

.modal-header h3 {
  font-size: 16px;
  font-weight: 800;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 9px;
  font-family: 'Plus Jakarta Sans', sans-serif;
}

.modal-header h3 i { color: var(--primary-light); }

.modal-close {
  width: 30px; height: 30px;
  border-radius: 50%;
  border: none;
  background: #f4f6f9;
  color: var(--grey);
  font-size: 18px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: var(--transition);
  line-height: 1;
}

.modal-close:hover { background: #fdecea; color: var(--danger); }

.modal-body { padding: 20px 24px 24px; }

/* ── LOADER ───────────────────────────────────────────────── */
.loader {
  display: flex; align-items: center; justify-content: center;
  padding: 40px;
  color: var(--grey);
  font-size: 14px;
  gap: 10px;
}

/* ── FILTER BAR ───────────────────────────────────────────── */
.filter-bar {
  display: flex; gap: 10px; flex-wrap: wrap; align-items: center;
  margin-bottom: 18px;
}

.filter-bar input,
.filter-bar select {
  padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  background: var(--white);
  color: var(--dark);
  transition: border-color 0.15s;
}

.filter-bar input:focus,
.filter-bar select:focus { border-color: var(--primary-light); }

/* ── TAB BAR ──────────────────────────────────────────────── */
.tab-bar {
  display: flex;
  gap: 2px;
  background: #edf0f4;
  border: 1px solid #e0e4ea;
  border-radius: 10px;
  padding: 4px;
  width: fit-content;
  margin-bottom: 18px;
}

.tab-btn {
  padding: 8px 18px;
  border-radius: 7px;
  border: none;
  background: none;
  font-size: 13px;
  font-weight: 600;
  color: var(--grey);
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  font-family: 'Plus Jakarta Sans', sans-serif;
}

.tab-btn.active {
  background: var(--white);
  color: var(--primary);
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  font-weight: 700;
}

.tab-btn:hover:not(.active) { color: var(--dark); }

/* ── GRADE BADGES ─────────────────────────────────────────── */
.g-a, .g-b, .g-c, .g-d, .g-f {
  padding: 2px 9px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  font-family: 'Plus Jakarta Sans', sans-serif;
}
.g-a { background: #dcfce7; color: #15803d; }
.g-b { background: #dbeafe; color: #1d4ed8; }
.g-c { background: #fef9c3; color: #854d0e; }
.g-d { background: #ffedd5; color: #c2410c; }
.g-f { background: #fee2e2; color: #b91c1c; }

/* ── PROGRESS ─────────────────────────────────────────────── */
.progress-track {
  height: 7px;
  background: #eef0f3;
  border-radius: 10px;
  overflow: hidden;
  flex: 1;
}

.progress-fill { height: 100%; border-radius: 10px; transition: width 0.5s ease; }

/* ── SAVE BAR ─────────────────────────────────────────────── */
.save-bar {
  position: sticky;
  bottom: 0;
  background: var(--white);
  border-top: 1px solid var(--border);
  padding: 12px 28px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 -4px 16px rgba(0,0,0,0.06);
  z-index: 20;
  margin: 0 -28px;
}

/* ── MARKS TABLE INPUT ────────────────────────────────────── */
.marks-table input[type="number"] {
  width: 70px;
  padding: 6px 8px;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.marks-table input:focus {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(41,128,185,0.1);
}

.marks-table input.over-max  { border-color: var(--danger);  background: #fdecea; }
.marks-table input.has-value { border-color: var(--success); background: #eafaf1; }

/* ── ROLE CHECKBOX LABELS ─────────────────────────────────── */
.role-check-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 13px;
  color: var(--dark);
  padding: 6px 10px;
  border-radius: 6px;
  transition: var(--transition);
}

.role-check-label:hover { background: rgba(0,0,0,0.04); }

.role-check-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  cursor: pointer;
}

/* ── EMPTY STATE ──────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 24px;
  color: var(--grey);
  text-align: center;
  gap: 12px;
}

.empty-state i { font-size: 38px; color: #d5dbe2; display: block; }
.empty-state strong { font-size: 14px; color: var(--dark); font-family: 'Plus Jakarta Sans', sans-serif; }
.empty-state span { font-size: 13px; }

/* ── UTILITIES ────────────────────────────────────────────── */
.num { text-align: center !important; }
.text-muted   { color: var(--grey)    !important; }
.text-success { color: var(--success) !important; }
.text-danger  { color: var(--danger)  !important; }
.text-primary { color: var(--primary) !important; }
.font-bold    { font-weight: 700 !important; }
.mt-16 { margin-top: 16px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }

/* ── SCROLLBAR ────────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d0d7de; border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: var(--grey); }

/* ── PRINT ────────────────────────────────────────────────── */
@media print {
  .sidebar, .top-header, .save-bar, .btn, button,
  .modal-overlay, #sidebar-toggle-btn { display: none !important; }
  .main-content { margin-left: 0 !important; }
  .page-content { padding: 0 !important; }
  body { background: white !important; }
}

/* ═══════════════════════════════════════════════════════════
   MOBILE RESPONSIVE
   ═══════════════════════════════════════════════════════════ */

/* ── Tablet & Phone (≤ 768px) ─────────────────────────────── */
@media (max-width: 768px) {

  /* ── No horizontal scroll on body ───────────────────────── */
  body { overflow-x: hidden; }

  /* ── Login ───────────────────────────────────────────────── */
  .login-wrapper { grid-template-columns: 1fr; }
  .login-left    { display: none; }

  /* ── Sidebar: slide in from left ─────────────────────────── */
  .sidebar {
    position: fixed !important;
    left: -280px !important;
    top: 0; bottom: 0;
    width: 260px !important;
    z-index: 1000;
    transition: left 0.25s ease;
    box-shadow: 4px 0 20px rgba(0,0,0,0.2);
  }
  .sidebar.mobile-open,
  .sidebar.open { left: 0 !important; }

  /* Overlay behind open sidebar */
  .sidebar-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 999;
  }
  .sidebar-overlay.active,
  #sidebar-overlay.visible { display: block !important; }

  /* ── Main content takes full width ───────────────────────── */
  .main-content { margin-left: 0 !important; width: 100% !important; }

  /* ── Top header ──────────────────────────────────────────── */
  .top-header   { padding: 0 12px 0 58px !important; height: 54px !important; }
  .header-logos { display: none !important; }
  .header-title p { display: none !important; }  /* hide subtitle line */
  .header-title h2 { font-size: 15px !important; }
  .header-right { gap: 8px !important; }
  /* In-header sidebar-toggle buttons (hardcoded on some pages):
     layout.js injects the proper fixed button — hide the duplicate */
  .sidebar-toggle { display: none !important; }
  /* Injected hamburger — always show on mobile */
  #sidebar-toggle-btn { display: flex !important; }

  /* ── Page content padding ────────────────────────────────── */
  .page-content { padding: 12px !important; }

  /* ── Page header row ─────────────────────────────────────── */
  .page-header { flex-direction: column !important; align-items: flex-start !important; gap: 10px !important; }
  .page-header .header-actions { flex-wrap: wrap !important; }

  /* ── Dashboard grids ─────────────────────────────────────── */
  .g1, .g2, .g3, .g31, .g13 { grid-template-columns: 1fr !important; gap: 12px !important; }
  .g4, .g5                   { grid-template-columns: 1fr 1fr !important; gap: 10px !important; }

  /* Inline grid overrides (JS-rendered cards) */
  [style*="grid-template-columns"] { grid-template-columns: 1fr !important; }

  /* Fixed-width inline panels */
  [style*="width:420px"],[style*="width:380px"],
  [style*="width:360px"],[style*="width:480px"],
  [style*="width:500px"] { width: 100% !important; max-width: 100% !important; }
  [style*="position:fixed"][style*="width:"] { width: 100% !important; right: 0 !important; left: 0 !important; }

  /* Inline min-width → allow shrink */
  div[style*="min-width:"],section[style*="min-width:"] { min-width: 0 !important; }

  /* ── Hero banner ─────────────────────────────────────────── */
  .hero { flex-direction: column !important; align-items: flex-start !important; padding: 16px !important; gap: 8px !important; }
  .hero-emoji { display: none !important; }
  .hero-actions { flex-wrap: wrap !important; width: 100% !important; gap: 6px !important; }
  .hbtn { font-size: 11px !important; padding: 7px 10px !important; flex: 1 1 calc(50% - 6px) !important; justify-content: center !important; }

  /* ── Quick actions ───────────────────────────────────────── */
  .qa-strip { gap: 7px !important; flex-wrap: wrap !important; }
  .qa { font-size: 12px !important; padding: 8px 10px !important; flex: 1 1 calc(50% - 7px) !important; justify-content: center !important; }

  /* ── Stat cards ──────────────────────────────────────────── */
  .stat    { padding: 14px 16px !important; }
  .stat-val { font-size: 22px !important; }
  .stat-ic  { width: 42px !important; height: 42px !important; font-size: 17px !important; }
  .stat-card { padding: 14px 16px !important; }
  .stat-info .value { font-size: 22px !important; }

  /* ── Cards & activities ──────────────────────────────────── */
  .card { padding: 14px !important; }
  .cb   { padding: 10px 14px !important; }
  .ch   { padding: 10px 14px !important; }
  .al   { padding: 9px 12px !important; }
  .act  { padding: 8px 14px !important; }
  .tk   { padding: 10px 14px !important; }
  .sc   { padding: 8px 14px !important; }

  /* ── Performance bars ────────────────────────────────────── */
  .pr-name { width: 80px !important; font-size: 11px !important; }
  .pr-pct  { font-size: 11px !important; }

  /* ── Tables: scroll horizontally ────────────────────────── */
  .table-card { overflow-x: auto !important; -webkit-overflow-scrolling: touch; }
  table { min-width: 480px; }
  .table-card.no-scroll table { min-width: unset !important; }
  thead th, tbody td { padding: 8px 10px !important; font-size: 12px !important; }

  /* ── Table header bar ────────────────────────────────────── */
  .table-header { flex-direction: column !important; align-items: flex-start !important; gap: 10px !important; padding: 14px 16px 10px !important; }
  .table-header h3 { font-size: 14px !important; }
  .table-header > div { flex-wrap: wrap !important; }

  /* ── Filter bars ─────────────────────────────────────────── */
  .filter-bar { flex-wrap: wrap !important; gap: 8px !important; }
  .filter-bar input, .filter-bar select { flex: 1 1 calc(50% - 8px) !important; min-width: 120px; font-size: 13px !important; }
  .filter-bar .filter-group { min-width: calc(50% - 8px); flex: 1 1 140px; }

  /* ── Modals: slide up from bottom ────────────────────────── */
  .modal-overlay { padding: 0 !important; align-items: flex-end !important; }
  .modal { width: 100% !important; max-width: 100% !important; max-height: 92vh !important; border-radius: 16px 16px 0 0 !important; margin: 0 !important; }
  .modal-body { padding: 16px !important; }
  .modal-header h3 { font-size: 14px !important; }

  /* ── Forms ───────────────────────────────────────────────── */
  .form-grid-2, .finance-form-grid { grid-template-columns: 1fr !important; }
  .btn { padding: 8px 12px !important; font-size: 12px !important; }

  /* ── Marks ───────────────────────────────────────────────── */
  .marks-selector { grid-template-columns: 1fr 1fr !important; gap: 10px !important; padding: 14px 16px !important; }
  .marks-selector .sel-group:last-child { grid-column: span 2; }
  .marks-toolbar { flex-wrap: wrap !important; gap: 6px !important; padding: 10px 12px !important; }
  .marks-toolbar .btn, .marks-toolbar button { font-size: 11px !important; padding: 6px 10px !important; }
  .marks-toolbar .max-score-group { margin-left: 0 !important; }
  .marks-table input[type="number"] { width: 58px !important; }

  /* ── Save bar ────────────────────────────────────────────── */
  .save-bar { flex-wrap: wrap !important; gap: 8px !important; padding: 10px 12px !important; }

  /* ── Tabs ────────────────────────────────────────────────── */
  .tab-bar  { width: 100% !important; overflow-x: auto !important; flex-wrap: nowrap !important; }
  .tab-btn  { flex-shrink: 0 !important; font-size: 12px !important; }
  .fin-tabs { overflow-x: auto !important; flex-wrap: nowrap !important; padding: 0 12px !important; }
  .fin-tab  { padding: 10px 12px !important; font-size: 11px !important; white-space: nowrap; }

  /* ── Timetable ───────────────────────────────────────────── */
  .tt-layout { flex-direction: column !important; }
  #tt-grid-container { overflow-x: auto !important; }
  .tt-grid { min-width: 560px; }
  .tt-palette { width: 100% !important; max-width: 100% !important; }

  /* ── Results ─────────────────────────────────────────────── */
  #exam-classes-container table { min-width: 480px; }
  #results-panel { margin-top: 16px !important; }
  #filter-bar-row, #results-search-row { flex-wrap: wrap !important; gap: 8px !important; }

  /* ── Audit log ───────────────────────────────────────────── */
  .log-table { min-width: 600px; }

  /* ── Notifications ───────────────────────────────────────── */
  #notif-toast { bottom: 12px !important; right: 12px !important; left: 12px !important; max-width: none !important; }
  .notif-panel { width: calc(100vw - 20px) !important; right: 10px !important; left: 10px !important; }

  /* ── Parent portal ───────────────────────────────────────── */
  .child-tabs { gap: 6px !important; }
  .child-tab  { padding: 8px 12px !important; font-size: 12px !important; }
  .child-card { flex-direction: column !important; align-items: flex-start !important; }

  /* ── Attendance ──────────────────────────────────────────── */
  .att-dot { width: 22px !important; height: 22px !important; font-size: 8px !important; }

  /* ── Users/KPI grids ─────────────────────────────────────── */
  #users-grid { grid-template-columns: 1fr !important; }
  #kpi-cards-row { grid-template-columns: 1fr 1fr !important; gap: 10px !important; }
}

/* ── Phone only (≤ 480px) ─────────────────────────────────── */
@media (max-width: 480px) {
  /* Even tighter padding */
  .page-content { padding: 8px !important; }

  /* Header: hide name/role text — avatar + bell is enough */
  .top-header { padding: 0 8px 0 52px !important; }
  .user-info  { display: none !important; }

  /* Stats: single column */
  .g4, .g5 { grid-template-columns: 1fr !important; }
  [style*="grid-template-columns:1fr 1fr"],
  [style*="grid-template-columns: 1fr 1fr"] { grid-template-columns: 1fr !important; }

  /* Stat value font */
  .stat-val { font-size: 18px !important; }
  .stat::after { display: none !important; }

  /* Quick actions: full width */
  .qa, .hbtn { flex: 1 1 100% !important; }

  /* Save bar: stack vertically */
  .save-bar { flex-direction: column !important; }
  .save-bar .btn, .save-bar button { width: 100% !important; justify-content: center !important; }

  /* Marks: single column */
  .marks-selector { grid-template-columns: 1fr !important; }
  .marks-selector .sel-group:last-child { grid-column: span 1 !important; }

  /* Filter bar: single column */
  .filter-bar .filter-group { min-width: 100% !important; }

  /* Results: hide less-important column */
  #exam-classes-container th:nth-child(4),
  #exam-classes-container td:nth-child(4) { display: none !important; }

  /* Finance tabs: tighter */
  .fin-tab { padding: 9px 10px !important; font-size: 11px !important; }

  /* Schedule time pill */
  .sc-time { width: 44px !important; font-size: 9px !important; }

  /* Inline flex rows: wrap to avoid overflow */
  div[style*="display:flex"]:not([style*="flex-direction:column"]):not([style*="flex-direction: column"]),
  div[style*="display: flex"]:not([style*="flex-direction:column"]):not([style*="flex-direction: column"]) {
    flex-wrap: wrap !important;
  }
}
