/* ===== MY-SCHOOL – Main Stylesheet ===== */
:root {
  --fiord:        #002147;
  --java:         #4c7fc3;
  --athens-gray:  #f2f4f8;
  --catskill:     #f8f9fc;
  --abbey:        #6b7280;
  --mischka:      #d1d5e8;
  --white:        #fff;
  --alto:         #d1d5db;
  --zest:         #f59e0b;
  --jungle:       #16a34a;
  --cinnabar:     #ef4444;
  --amethyst:     #9333ea;
  --transparent:  rgba(255,255,255,0.5);

  --header-h:   54px;
  --footer-h:   46px;
  --sidenav-w:  240px;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  font-family: 'Segoe UI', 'Open Sans', Helvetica, Arial, sans-serif;
  background: var(--athens-gray);
  color: var(--fiord);
  font-size: 14px;
}
a { text-decoration: none; color: inherit; }
ul { list-style: none; }

/* ── Grid shell ── */
.grid {
  display: grid;
  grid-template-columns: 100%;
  grid-template-rows: var(--header-h) 1fr var(--footer-h);
  grid-template-areas: 'header' 'main' 'footer';
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── Header ── */
.header {
  grid-area: header;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--fiord);
  padding: 0 16px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}
.header__menu {
  font-size: 18px;
  color: var(--mischka);
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 50%;
  background: rgba(255,255,255,0.1);
  display: none;
}
.header__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--white);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 1px;
}
.header__brand span { color: var(--java); }
.header__school-name {
  font-size: 13px;
  font-weight: 400;
  color: var(--mischka);
  margin-left: 8px;
  letter-spacing: 0.5px;
  display: none;
}
.header__right {
  display: flex;
  align-items: center;
  gap: 18px;
}
.header__notif {
  position: relative;
  display: inline-block;
  color: var(--mischka);
  font-size: 18px;
  cursor: pointer;
}
.header__notif .badge {
  position: absolute;
  top: -6px;
  right: -8px;
  background: var(--cinnabar);
  color: #fff;
  font-size: 9px;
  border-radius: 50%;
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}
.header__avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--java);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: #fff;
  cursor: pointer;
  position: relative;
  border: 2px solid rgba(255,255,255,0.2);
}
.header__avatar-name {
  color: var(--mischka);
  font-size: 13px;
  cursor: pointer;
}

/* ── Dropdown ── */
.user-dropdown {
  position: absolute;
  top: 44px;
  right: 0;
  width: 200px;
  background: var(--fiord);
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
  visibility: hidden;
  opacity: 0;
  transform: translateY(-8px);
  transition: all 0.25s;
  z-index: 200;
}
.user-dropdown.open {
  visibility: visible;
  opacity: 1;
  transform: translateY(0);
}
.user-dropdown li {
  padding: 10px 18px;
  color: var(--mischka);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}
.user-dropdown li:hover { background: rgba(255,255,255,0.08); }
.user-dropdown li i { color: var(--java); width: 14px; }
.user-dropdown li a {
  color: inherit;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  margin: -10px -18px;
  padding: 10px 18px;
}

/* ── Notification dropdown ── */
.notif-dropdown {
  position: absolute;
  top: 44px;
  right: 0;
  width: 300px;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 6px 24px rgba(0,0,0,0.15);
  visibility: hidden;
  opacity: 0;
  transform: translateY(-8px);
  transition: all 0.22s;
  z-index: 500;
  border: 1px solid #eaecf0;
}
.notif-dropdown.open {
  visibility: visible;
  opacity: 1;
  transform: translateY(0);
}
.notif-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 14px;
  text-decoration: none;
  color: #323644;
  border-bottom: 1px solid #f5f6fa;
  transition: background 0.15s;
}
.notif-item:hover { background: #f8f9fc; }
.notif-icon {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  margin-top: 2px;
}
.notif-body { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.notif-text { font-size: 12px; font-weight: 600; color: #323644; line-height: 1.4; }
.notif-sub  { font-size: 11px; color: #888; }

/* ── Sidenav ── */
.sidenav {
  grid-area: sidenav;
  position: fixed;
  top: 0;
  left: 0;
  height: 100%;
  width: var(--sidenav-w);
  background: var(--fiord);
  overflow-y: auto;
  overflow-x: hidden;
  transform: translateX(calc(-1 * var(--sidenav-w)));
  transition: transform 0.3s cubic-bezier(.4,0,.2,1);
  z-index: 10000; /* above impersonation banner (9999) on mobile */
  box-shadow: 2px 0 12px rgba(0,0,0,0.25);
  /* Custom scrollbar */
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.15) transparent;
}
.sidenav::-webkit-scrollbar { width: 4px; }
.sidenav::-webkit-scrollbar-track { background: transparent; }
.sidenav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 4px; }
.sidenav.open { transform: translateX(0); }
.sidenav__brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-h);
  padding: 0 16px;
  background: rgba(0,0,0,0.2);
}
.sidenav__logo {
  font-size: 17px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 1px;
}
.sidenav__logo span { color: var(--java); }
.sidenav__close {
  color: var(--transparent);
  cursor: pointer;
  font-size: 16px;
}
.sidenav__profile {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: rgba(255,255,255,0.06);
  border-bottom: 1px solid rgba(255,255,255,0.07);
}
.sidenav__avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--java);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: #fff;
  flex-shrink: 0;
}
.sidenav__profile-info { flex: 1; }
.sidenav__profile-name {
  color: #fff;
  font-size: 14px;
  font-weight: 600;
}
.sidenav__profile-role {
  color: var(--transparent);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* nav sections */
.nav-section {
  padding: 8px 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.nav-section__label {
  padding: 10px 18px 4px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(255,255,255,0.3);
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 18px;
  color: var(--alto);
  cursor: pointer;
  font-size: 13px;
  transition: background 0.2s;
  position: relative;
}
.nav-item:hover, .nav-item.active {
  background: rgba(255,255,255,0.08);
  color: #fff;
}
.nav-item.active { border-left: 3px solid var(--java); }
.nav-item i { width: 16px; color: rgba(255,255,255,0.5); font-size: 13px; }
.nav-item.active i, .nav-item:hover i { color: var(--java); }
.nav-item__arrow {
  margin-left: auto;
  font-size: 10px;
  transition: transform 0.2s;
  color: rgba(255,255,255,0.3);
}
.nav-item.open .nav-item__arrow { transform: rotate(90deg); }
.nav-sublist {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}
.nav-sublist.open { max-height: 300px; }
.nav-sublist a {
  display: block;
  padding: 8px 18px 8px 46px;
  color: var(--alto);
  font-size: 12.5px;
  transition: background 0.2s;
}
.nav-sublist a:hover { background: rgba(255,255,255,0.05); color: #fff; }
.nav-sublist a.active { color: var(--java); }

/* ── Main content ── */
.main {
  grid-area: main;
  background: var(--athens-gray);
  padding: 0 24px 36px;
  min-height: calc(100vh - var(--header-h) - var(--footer-h));
}
.page-header {
  background: var(--fiord);
  padding: 18px 24px;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  /* Break out of .main's side padding to stay full-width */
  margin: 0 -24px 24px;
}
.page-header h1 {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.5px;
}
.page-header p {
  font-size: 12px;
  color: var(--mischka);
  margin-top: 2px;
}
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--mischka);
}
.breadcrumb a { color: var(--java); }
.breadcrumb span { color: rgba(255,255,255,0.3); }

.page-body { padding: 20px; }

/* ── Alert banner ── */
.alert-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  background: #fffde7;
  border-left: 4px solid #ffc107;
  color: #555;
  font-size: 13px;
  margin-bottom: 18px;
  border-radius: 2px;
}
.alert-banner a { color: var(--java); font-weight: 600; }
.alert-banner i { color: #ffc107; }

/* ── Stat cards ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 22px;
}
.stat-card {
  background: #fff;
  border-radius: 6px;
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.07);
  transition: transform 0.2s, box-shadow 0.2s;
  cursor: pointer;
}
.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 5px 14px rgba(0,0,0,0.1);
}
.stat-icon {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: #fff;
  flex-shrink: 0;
}
.stat-icon--blue   { background: var(--java); }
.stat-icon--orange { background: var(--zest); }
.stat-icon--green  { background: var(--jungle); }
.stat-icon--red    { background: var(--cinnabar); }
.stat-icon--purple { background: var(--amethyst); }
.stat-icon--dark   { background: var(--fiord); }
.stat-info {}
.stat-number {
  font-size: 24px;
  font-weight: 700;
  color: var(--fiord);
  line-height: 1;
}
.stat-label {
  font-size: 12px;
  color: var(--abbey);
  margin-top: 3px;
}

/* ── Cards ── */
.card {
  background: #fff;
  border-radius: 6px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.07);
  margin-bottom: 20px;
  overflow: hidden;
}
.card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--fiord);
  color: #fff;
  padding: 12px 18px;
}
.card__title { font-size: 15px; font-weight: 600; letter-spacing: 0.3px; }
.card__header a { color: var(--java); font-size: 12px; font-weight: 600; }
.card__body { padding: 18px; }
.card__body--no-pad { padding: 0; }

/* ── Two-col layout ── */
.cols-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}
.cols-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 20px;
}

/* ── Tables ── */
.table-wrap { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
thead { background: var(--catskill); }
th {
  padding: 10px 14px;
  text-align: left;
  font-weight: 600;
  color: var(--abbey);
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.5px;
  border-bottom: 2px solid var(--athens-gray);
}
td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--athens-gray);
  color: var(--fiord);
}
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--catskill); }
.table-action {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 11px;
  cursor: pointer;
  border: none;
  font-weight: 600;
}
.table-action--view   { background: #e3f2fd; color: #1565c0; }
.table-action--edit   { background: #e8f5e9; color: #2e7d32; }
.table-action--delete { background: #fce4ec; color: #c62828; }

/* ── Badges / Pills ── */
.badge-pill {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}
.badge-pill--green  { background: #e8f5e9; color: #2e7d32; }
.badge-pill--red    { background: #fce4ec; color: #c62828; }
.badge-pill--blue   { background: #e3f2fd; color: #1565c0; }
.badge-pill--orange { background: #fff3e0; color: #e65100; }
.badge-pill--gray   { background: #f5f5f5; color: #616161; }

/* ── Forms ── */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--abbey);
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.form-control {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid #e0e0e0;
  border-radius: 5px;
  font-size: 13px;
  color: var(--fiord);
  background: #fff;
  outline: none;
  transition: border-color 0.2s;
}
.form-control:focus { border-color: var(--java); }
select.form-control { cursor: pointer; }
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.form-row-3 {
  display: grid;
  grid-template-columns: repeat(3,1fr);
  gap: 14px;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 20px;
  border-radius: 5px;
  font-size: 13px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.1s;
  letter-spacing: 0.3px;
}
.btn:active { transform: scale(0.97); }
.btn--primary { background: var(--java); color: #fff; }
.btn--primary:hover { opacity: 0.88; }
.btn--dark    { background: var(--fiord); color: #fff; }
.btn--dark:hover { opacity: 0.85; }
.btn--success { background: var(--jungle); color: #fff; }
.btn--danger  { background: var(--cinnabar); color: #fff; }
.btn--outline {
  background: transparent;
  border: 1.5px solid var(--java);
  color: var(--java);
}
.btn--outline:hover { background: var(--java); color: #fff; }
.btn--sm { padding: 6px 13px; font-size: 12px; }

/* ── Search bar ── */
.search-bar {
  display: flex;
  align-items: center;
  gap: 0;
  background: #fff;
  border: 1.5px solid #e0e0e0;
  border-radius: 5px;
  overflow: hidden;
  max-width: 300px;
}
.search-bar input {
  flex: 1;
  padding: 8px 12px;
  border: none;
  font-size: 13px;
  outline: none;
}
.search-bar button {
  padding: 8px 14px;
  background: var(--java);
  border: none;
  color: #fff;
  cursor: pointer;
  font-size: 13px;
}

/* ── Filter row ── */
.filter-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.filter-row .form-control { width: auto; min-width: 130px; }

/* ── Feature list ── */
.feature-list { margin-bottom: 12px; }
.feature-list__heading {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--abbey);
  padding: 6px 12px;
  background: var(--catskill);
  border-bottom: 1px solid var(--athens-gray);
}
.feature-list a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 14px;
  border-bottom: 1px solid var(--athens-gray);
  color: var(--java);
  font-size: 13px;
  transition: background 0.15s;
}
.feature-list a:hover {
  background: var(--catskill);
  padding-left: 18px;
}
.feature-list a.active {
  background: #e3f7fd;
  border-left: 3px solid var(--java);
  font-weight: 600;
}
.feature-list a i { color: var(--abbey); font-size: 11px; }

/* ── Dashboard tiles ── */
.tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 18px;
  padding: 28px 24px;
}
.tile {
  background: #fff;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 28px 12px 20px;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0,0,0,0.07);
  transition: transform 0.22s, box-shadow 0.22s;
  text-align: center;
  gap: 14px;
  text-decoration: none;
  color: var(--fiord);
}
.tile:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 20px rgba(0,0,0,0.12);
}
.tile__icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  color: #fff;
}
.tile__label {
  font-size: 13px;
  font-weight: 600;
  color: var(--fiord);
  letter-spacing: 0.3px;
}

/* ── Footer ── */
.footer {
  grid-area: footer;
  display: flex;
  align-items: center;
  justify-content: center;
  height: var(--footer-h);
  background: #fff;
  color: var(--abbey);
  font-size: 12px;
  border-top: 1px solid var(--athens-gray);
}
.footer a { color: var(--java); font-weight: 600; }

/* ── Overlay ── */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 9999; /* just below sidenav */
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
.overlay.show { opacity: 1; pointer-events: auto; }

/* ── Timeline ── */
.timeline { padding: 4px 0; }
.timeline-item {
  display: flex;
  gap: 14px;
  padding: 10px 0;
  border-bottom: 1px solid var(--athens-gray);
  position: relative;
}
.timeline-item:last-child { border-bottom: none; }
.tl-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--java);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  flex-shrink: 0;
  margin-top: 2px;
}
.tl-icon--orange { background: var(--zest); }
.tl-icon--red    { background: var(--cinnabar); }
.tl-icon--green  { background: var(--jungle); }
.tl-tl-icon--purple { background: var(--amethyst); }
.tl-body {}
.tl-title { font-size: 13px; font-weight: 600; color: var(--fiord); }
.tl-desc  { font-size: 12px; color: var(--abbey); margin-top: 2px; }
.tl-meta  { font-size: 11px; color: var(--mischka); margin-top: 3px; }

/* ── Pagination ── */
.pagination {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 16px;
  flex-wrap: wrap;
}
.page-btn {
  width: 32px;
  height: 32px;
  border-radius: 5px;
  border: 1.5px solid var(--athens-gray);
  background: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--fiord);
  transition: all 0.15s;
}
.page-btn:hover, .page-btn.active {
  background: var(--java);
  border-color: var(--java);
  color: #fff;
}

/* ── Progress bar ── */
.progress-bar-wrap {
  background: var(--athens-gray);
  border-radius: 20px;
  height: 8px;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  border-radius: 20px;
  background: var(--java);
  transition: width 0.5s ease;
}
.progress-bar-fill--green  { background: var(--jungle); }
.progress-bar-fill--orange { background: var(--zest); }
.progress-bar-fill--red    { background: var(--cinnabar); }

/* ── Modal ── */
.modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 300;
  align-items: center;
  justify-content: center;
}
.modal-backdrop.show { display: flex; }
.modal {
  background: #fff;
  border-radius: 8px;
  width: 90%;
  max-width: 520px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.2);
  overflow: hidden;
  animation: fadeInUp 0.25s ease;
}
@keyframes fadeInUp {
  from { opacity:0; transform:translateY(20px); }
  to   { opacity:1; transform:translateY(0); }
}
.modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--fiord);
  color: #fff;
  padding: 14px 18px;
}
.modal__title { font-size: 15px; font-weight: 600; }
.modal__close { cursor: pointer; color: var(--mischka); font-size: 18px; }
.modal__body { padding: 20px 18px; }
.modal__footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 18px;
  border-top: 1px solid var(--athens-gray);
}

/* ── Tabs ── */
.tab-bar {
  display: flex;
  gap: 2px;
  border-bottom: 2px solid var(--athens-gray);
  flex-wrap: wrap;
}
.tab-btn {
  padding: 10px 18px;
  border: none;
  background: none;
  font-size: 13px;
  font-weight: 600;
  color: var(--abbey);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color .15s, border-color .15s;
  white-space: nowrap;
}
.tab-btn:hover { color: var(--java); }
.tab-btn.active { color: var(--java); border-bottom-color: var(--java); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ═══════════════════════════════════════════
   RESPONSIVE
   Breakpoints:
     769 +  → desktop (sidenav pinned)
     481–768 → tablet
     ≤ 480   → mobile
   ═══════════════════════════════════════════ */

/* ── System Admin school banner ── */
.sa-school-banner {
  background: var(--fiord);
  border-bottom: 2px solid var(--java);
  color: rgba(255,255,255,0.9);
  padding: 9px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .3px;
  position: sticky;
  top: 0;
  z-index: 9999;
  gap: 12px;
}

/* ── Desktop: pin sidenav ── */
@media (min-width: 769px) {
  .grid {
    grid-template-columns: var(--sidenav-w) 1fr;
    grid-template-rows: var(--header-h) 1fr var(--footer-h);
    grid-template-areas:
      'sidenav header'
      'sidenav main'
      'sidenav footer';
  }
  .sidenav {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    transform: translateX(0) !important;
  }
  .sidenav__close  { display: none; }
  .overlay         { display: none !important; }
  .header__school-name { display: block; }
  .header__menu    { display: none !important; }
  /* Banner sits outside the grid — shift it past the fixed sidebar */
  .sa-school-banner { margin-left: var(--sidenav-w); }
}

/* ── Tablet (≤ 768px): overlay sidenav ── */
@media (max-width: 768px) {
  /* Header */
  .header__menu      { display: flex !important; }
  .header__avatar-name { display: none; }

  /* Reduce main padding on tablet */
  .main { padding: 0 16px 24px; }
  .page-header { margin: 0 -16px 18px; }
  .setup-alert { margin: 0 -16px 16px !important; padding-left: 16px !important; padding-right: 16px !important; }
  .sa-school-banner { margin-left: 0; }

  /* Page header wraps on tablet */
  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    padding: 14px 16px;
  }
  .page-header > div:last-child {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }

  /* Layout grids collapse to single column */
  .cols-2, .cols-3 { grid-template-columns: 1fr; }

  /* Form rows collapse */
  .form-row, .form-row-3 { grid-template-columns: 1fr; }

  /* Tiles: 2-up */
  .tile-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }

  /* Search bar stretches full width */
  .search-bar { max-width: 100%; }

  /* Filter row scrolls horizontally */
  .filter-row { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 4px; }

  /* Superadmin two-col show pages */
  .sa-detail-grid { grid-template-columns: 1fr !important; }

  /* Card bodies have reduced padding */
  .card__body { padding: 14px; }
  .page-body  { padding: 14px; }
}

/* ── Mobile (≤ 480px) ── */
@media (max-width: 480px) {
  /* Stats: 2-up on small screens */
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; }

  /* Tiles: 2-up */
  .tile-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .tile { padding: 20px 8px 14px; gap: 10px; }
  .tile__icon { width: 48px; height: 48px; font-size: 20px; }

  /* Buttons shrink */
  .btn { padding: 8px 14px; font-size: 12px; }
  .btn--sm { padding: 5px 10px; font-size: 11px; }

  /* Page body minimal padding */
  .page-body { padding: 10px; }
  .card__body { padding: 12px; }

  /* Tab bar scrolls */
  .tab-bar { overflow-x: auto; flex-wrap: nowrap; gap: 0; }
  .tab-btn  { padding: 8px 14px; font-size: 12px; flex-shrink: 0; }

  /* Modal full-width */
  .modal { width: 96%; }
}

/* ═══════════════════════════════════════════
   RESPONSIVE TABLES  (CSS-tricks card flip)
   JS in main.js auto-injects data-label attrs
   from <thead> so no view changes needed.
   ═══════════════════════════════════════════ */
@media (max-width: 640px) {
  /* Stop horizontal scroll; switch to card layout */
  .table-wrap { overflow-x: visible; }

  /* Scope to .table-wrap for specificity — forces block on every table element */
  .table-wrap table,
  .table-wrap thead,
  .table-wrap tbody,
  .table-wrap tfoot,
  .table-wrap tr,
  .table-wrap th,
  .table-wrap td { display: block; }

  /* Hide column headers visually */
  .table-wrap thead tr { position: absolute; top: -9999px; left: -9999px; }

  /* Each row = a card */
  .table-wrap tbody tr {
    background: #fff;
    border: 1px solid var(--athens-gray);
    border-radius: 8px;
    margin-bottom: 12px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    overflow: hidden;
  }
  .table-wrap tbody tr:hover { background: #fff; }

  /* Each cell: label left, value right */
  .table-wrap td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-bottom: 1px solid var(--athens-gray);
    border-right: none;
    text-align: right;
    gap: 8px;
    min-height: 42px;
  }
  .table-wrap td:last-child { border-bottom: none; }
  .table-wrap tr:last-child td { border-bottom: none; }

  /* Label from data-label attribute */
  .table-wrap td::before {
    content: attr(data-label);
    font-weight: 600;
    font-size: 11px;
    color: var(--abbey);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    flex-shrink: 0;
    text-align: left;
    max-width: 45%;
  }

  /* Action columns: no label, right-align */
  .table-wrap td:not([data-label]) {
    justify-content: flex-end;
  }
  .table-wrap td:not([data-label])::before { display: none; }

  /* Action buttons: don't wrap text */
  .table-wrap td .table-action,
  .table-wrap td .btn,
  .table-wrap td a.btn {
    white-space: nowrap;
    margin: 2px 0;
  }

  /* tfoot totals row stays as a row */
  .table-wrap tfoot { display: table; width: 100%; }
  .table-wrap tfoot tr { display: table-row; }
  .table-wrap tfoot td { display: table-cell; text-align: right; }
}
