/* ═══════════════════════════════════════════════════════════════
   ILMGAH — School Management System
   public/css/app.css  |  Complete Design System
   Dynamic CSS Variables · Professional · Trust-inspiring
═══════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:ital,wght@0,300;0,400;0,500;0,600;0,700;1,400&family=Lora:ital,wght@0,400;0,500;1,400&family=JetBrains+Mono:wght@400;500&display=swap');

/* ── DESIGN TOKENS ─────────────────────────────────────────── */
:root {
  /* Core Brand */
  --navy:       #1B3A6B;
  --navy-lt:    #2952A3;
  --navy-dk:    #102448;
  --navy-bg:    rgba(27,58,107,.08);
  --navy-bg2:   rgba(27,58,107,.14);

  --emerald:    #1A7A4A;
  --emerald-lt: #25A865;
  --emerald-dk: #115533;
  --emerald-bg: rgba(26,122,74,.08);
  --emerald-bg2:rgba(26,122,74,.15);

  --amber:      #C47A1A;
  --amber-lt:   #E59C30;
  --amber-dk:   #8A5510;
  --amber-bg:   rgba(196,122,26,.10);

  --ruby:       #B52A2A;
  --ruby-lt:    #D44040;
  --ruby-bg:    rgba(181,42,42,.09);

  --sky:        #1E72B8;
  --sky-bg:     rgba(30,114,184,.09);

  --violet:     #5B3FA0;
  --violet-bg:  rgba(91,63,160,.09);

  /* Surfaces */
  --bg:         #F5F7FA;
  --surface:    #FFFFFF;
  --surface-2:  #F0F3F8;
  --surface-3:  #E8EDF5;

  /* Text */
  --text-1:     #0D1B2E;
  --text-2:     #3D5066;
  --text-3:     #7A90AA;
  --text-4:     #B0C0D0;

  /* Borders */
  --border:     #DDE3ED;
  --border-2:   #C8D2E0;

  /* Dynamic theme colors (overridden by inline <style> from DB settings) */
  --primary:    #1B3A6B;
  --accent:     #1A7A4A;

  /* Sidebar (overridden in blade inline style — derived from --primary) */
  --sidebar-bg: color-mix(in srgb, #1B3A6B 78%, #000);

  /* Semantic */
  --success:    #1A7A4A;
  --success-bg: rgba(26,122,74,.10);
  --warning:    #C47A1A;
  --warning-bg: rgba(196,122,26,.10);
  --danger:     #B52A2A;
  --danger-bg:  rgba(181,42,42,.09);
  --info:       #1E72B8;
  --info-bg:    rgba(30,114,184,.09);

  /* Layout */
  --sidebar-w:  272px;
  --sidebar-collapsed: 68px;
  --header-h:   60px;
  --radius:     10px;
  --radius-lg:  14px;
  --radius-xl:  20px;
  --radius-pill:100px;

  /* Shadows */
  --shadow-xs:  0 1px 3px rgba(13,27,46,.06);
  --shadow-sm:  0 2px 8px rgba(13,27,46,.08);
  --shadow-md:  0 4px 20px rgba(13,27,46,.10);
  --shadow-lg:  0 8px 40px rgba(13,27,46,.12);

  /* Overlay */
  --overlay-bg: rgba(13,27,46,.55);

  /* Motion */
  --t:          0.18s cubic-bezier(.4,0,.2,1);
  --t-spring:   0.28s cubic-bezier(.34,1.56,.64,1);
  --t-slow:     0.32s ease;

  /* Typography */
  --font:       'Plus Jakarta Sans', sans-serif;
  --serif:      'Lora', serif;
  --mono:       'JetBrains Mono', monospace;
}

/* ── DARK MODE ───────────────────────────────────────────────── */
[data-theme="dark"] {
  --bg:         #0D1117;
  --surface:    #161B22;
  --surface-2:  #21262D;
  --surface-3:  #30363D;
  --text-1:     #F0F6FC;
  --text-2:     #C9D1D9;
  --text-3:     #8B949E;
  --text-4:     #484F58;
  --border:     #30363D;
  --border-2:   #21262D;
  --overlay-bg: rgba(0,0,0,.75);
}

/* ── RESET ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text-1);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
a { text-decoration: none; color: inherit; }
button { cursor: pointer; font-family: var(--font); }
input, select, textarea, button { font-family: var(--font); }
img { max-width: 100%; display: block; }
ul { list-style: none; }
::selection { background: var(--navy-bg2); color: var(--navy-dk); }
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--surface-2); }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-3); }

/* ── APP SHELL ──────────────────────────────────────────────── */
/* .app-shell { display: flex; min-height: 100vh; } */

/* ── SIDEBAR ────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  height: 100vh;
  position: fixed;
  top: 0; left: 0;
  z-index: 100;
  transition: width var(--t), transform var(--t);
  overflow: hidden;
  box-shadow: 2px 0 20px rgba(0,0,0,.18);
}

/* ── Mobile sidebar overlay ───────────────────────────────── */
.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: var(--overlay-bg);
  z-index: 99;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--t), visibility var(--t);
  backdrop-filter: blur(2px);
}
.sidebar-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* ── Mobile close button ───────────────────────────────────── */
.sb-mobile-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--sidebar-border);
  background: rgba(255,255,255,.1);
  color: var(--sidebar-text);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  cursor: pointer;
  transition: all var(--t);
  z-index: 10;
}
.sb-mobile-close:hover {
  background: rgba(255,255,255,.2);
  transform: scale(1.05);
}
.sb-mobile-close:active {
  transform: scale(0.95);
}

/* ── Collapsed state ───────────────────────────────────────── */
.sidebar.collapsed { width: var(--sidebar-collapsed); }
.sidebar.collapsed .nav-label,
.sidebar.collapsed .nav-section-title-text,
.sidebar.collapsed .nav-section-chevron,
.sidebar.collapsed .sb-brand-name,
.sidebar.collapsed .sb-brand-tag,
.sidebar.collapsed .user-details,
.sidebar.collapsed .nav-badge { display: none; }
.sidebar.collapsed .sb-logo-wrap { justify-content: center; padding: 0; }
.sidebar.collapsed .sb-header { padding: 0; justify-content: center; }
.sidebar.collapsed .nav-item { padding: 0; width: 44px; height: 44px; border-radius: 12px; justify-content: center; margin: 0 auto; }
.sidebar.collapsed .nav-item .nav-icon { margin: 0; font-size: 20px; }
.sidebar.collapsed .sb-nav { padding: 10px 0; align-items: center; gap: 2px; }
.sidebar.collapsed .sb-user { padding: 12px 0; flex-direction: column; align-items: center; justify-content: center; }
.sidebar.collapsed .sb-collapse-btn { margin-left: 0; }
/* In collapsed mode, show all nav items regardless of accordion state */
.sidebar.collapsed .nav-section-body { max-height: 2000px !important; opacity: 1 !important; pointer-events: auto !important; }
.sidebar.collapsed .nav-section-header { display: none; }
.sidebar.collapsed .nav-section-item { width: 100%; display: flex; flex-direction: column; align-items: center; }

/* ── Header (brand) ────────────────────────────────────────── */
.sb-header {
  display: flex;
  align-items: center;
  height: 70px;
  padding: 0 18px;
  border-bottom: 1px solid var(--sidebar-border);
  flex-shrink: 0;
  gap: 12px;
}
.sb-logo-wrap { display: flex; align-items: center; gap: 12px; overflow: hidden; }
.sb-logo {
  width: 40px; height: 40px;
  background: linear-gradient(135deg, var(--emerald) 0%, var(--emerald-lt) 100%);
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  font-size: 20px; font-weight: 800; color: #fff;
  font-family: var(--serif); letter-spacing: -.5px;
  box-shadow: 0 4px 12px rgba(26,122,74,.35);
}
.sb-brand-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--sidebar-text);
  letter-spacing: .01em;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sb-brand-tag  {
  font-size: 10px;
  color: var(--sidebar-text-2);
  letter-spacing: .06em;
  text-transform: uppercase;
  white-space: nowrap;
}

/* ── Nav scroll area ───────────────────────────────────────── */
.sb-nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 10px 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 0;
}
.sb-nav::-webkit-scrollbar { width: 3px; }
.sb-nav::-webkit-scrollbar-thumb { background: var(--sidebar-border); border-radius: 3px; }

/* ── SECTION ACCORDION ─────────────────────────────────────── */
.nav-section-item {
  margin-bottom: 2px;
}

.nav-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px 9px;
  cursor: pointer;
  border-radius: 8px;
  transition: background var(--t);
  user-select: none;
  gap: 6px;
  margin-top: 6px;
}
.nav-section-header:hover { background: var(--sidebar-hover); }
.nav-section-item:first-child .nav-section-header { margin-top: 0; }

.nav-section-title-text {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .11em;
  color: var(--sidebar-text-2);
  text-transform: uppercase;
  white-space: nowrap;
  flex: 1;
}

.nav-section-chevron {
  font-size: 12px;
  color: var(--sidebar-text-3);
  transition: transform 0.24s cubic-bezier(.4,0,.2,1);
  flex-shrink: 0;
  opacity: .7;
}
.nav-section-item.is-open .nav-section-chevron { transform: rotate(180deg); opacity: 1; }
.nav-section-item.is-open .nav-section-title-text { color: var(--sidebar-text); }

.nav-section-body {
  overflow: hidden;
  transition: max-height 0.3s cubic-bezier(.4,0,.2,1), opacity 0.22s ease;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 2px 0 4px;
  max-height: 0;
  opacity: 0;
  pointer-events: none;
}
.nav-section-item.is-open > .nav-section-body {
  max-height: 1200px;
  opacity: 1;
  pointer-events: auto;
}

/* ── Individual nav items ──────────────────────────────────── */
.nav-section-title { display: none; } /* legacy — replaced by accordion header */

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 14px;
  border-radius: 10px;
  cursor: pointer;
  color: var(--sidebar-text-2);
  font-size: 13.5px;
  font-weight: 450;
  text-decoration: none;
  transition: background var(--t), color var(--t), transform 0.12s;
  white-space: nowrap;
  position: relative;
  overflow: hidden;
  letter-spacing: .01em;
}
.nav-item:hover {
  background: var(--sidebar-hover);
  color: var(--sidebar-text);
  transform: translateX(2px);
}
.nav-item.active {
  background: var(--nav-active-bg);
  color: var(--nav-active-text);
  font-weight: 600;
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 8px; bottom: 8px;
  width: 3px;
  background: var(--primary);
  border-radius: 0 3px 3px 0;
}
.nav-icon {
  font-size: 18px;
  flex-shrink: 0;
  width: 22px;
  text-align: center;
  opacity: .85;
}
.nav-item.active .nav-icon { opacity: 1; }
.nav-item:hover .nav-icon { opacity: 1; }

.nav-badge {
  margin-left: auto;
  background: var(--emerald);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
  min-width: 20px;
  text-align: center;
  flex-shrink: 0;
}
.nav-badge.amber { background: var(--amber); }
.nav-badge.ruby  { background: var(--ruby);  }

/* ── User info strip ───────────────────────────────────────── */
.sb-user {
  padding: 12px 14px;
  border-top: 1px solid var(--sidebar-border);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  background: rgba(0,0,0,.08);
}
.user-av {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--emerald-dk) 0%, var(--emerald) 100%);
  border: 2px solid rgba(255,255,255,.2);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; color: #fff;
  flex-shrink: 0;
  letter-spacing: -.5px;
}
.user-details { overflow: hidden; flex: 1; min-width: 0; }
.user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--sidebar-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-role {
  font-size: 10.5px;
  color: var(--sidebar-text-3);
  text-transform: capitalize;
  letter-spacing: .03em;
}

/* ── Collapse button ───────────────────────────────────────── */
.sb-collapse-btn {
  width: 28px; height: 28px;
  border-radius: 8px;
  border: 1px solid var(--sidebar-border);
  background: transparent;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--sidebar-text-3);
  font-size: 13px;
  transition: all var(--t);
  margin-left: auto;
  flex-shrink: 0;
}
.sb-collapse-btn:hover { background: var(--sidebar-hover); color: var(--sidebar-text); }
.sidebar.collapsed .sb-collapse-btn { transform: rotate(180deg); margin-left: 0; }

/* ── MAIN AREA ──────────────────────────────────────────────── */
.main-area {
  flex: 1;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left var(--t);
}
.main-area.collapsed { margin-left: var(--sidebar-collapsed); }

/* ── TOP HEADER ─────────────────────────────────────────────── */
.top-header {
  height: var(--header-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 14px;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-xs);
}
.header-breadcrumb { display: flex; align-items: center; gap: 6px; flex: 1; }
.hb-item { font-size: 13px; color: var(--text-3); }
.hb-item.active { color: var(--text-1); font-weight: 600; }
.hb-sep { color: var(--text-4); font-size: 10px; }

.search-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 6px 14px;
  width: 260px;
  transition: all var(--t);
}
.search-wrap:focus-within {
  border-color: var(--primary);
  background: var(--surface);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 12%, transparent);
}
.search-wrap input {
  border: none;
  background: transparent;
  outline: none;
  font-size: 13px;
  color: var(--text-1);
  width: 100%;
}
.search-wrap input::placeholder { color: var(--text-3); }
.search-icon { color: var(--text-3); font-size: 14px; }

.header-right { display: flex; align-items: center; gap: 8px; }
.header-btn {
  width: 36px; height: 36px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: transparent;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-2);
  font-size: 16px;
  cursor: pointer;
  transition: all var(--t);
  position: relative;
}
.header-btn:hover { background: var(--surface-2); color: var(--primary); border-color: var(--border-2); }
.notif-dot {
  position: absolute; top: 5px; right: 5px;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--danger);
  border: 1.5px solid var(--surface);
}
.session-info {
  display: flex; align-items: center; gap: 6px;
  padding: 5px 12px;
  background: var(--emerald-bg);
  border: 1px solid rgba(26,122,74,.2);
  border-radius: var(--radius-pill);
  font-size: 12.5px;
  color: var(--emerald-dk);
  font-weight: 500;
}
.session-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--emerald);
  animation: pulse 2s ease infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: .5; transform: scale(.85); }
}

/* ── PAGE CONTENT ───────────────────────────────────────────── */
.page-content {
  flex: 1;
  padding: 24px;
  animation: pageIn .3s ease both;
}
@keyframes pageIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}
.page-title { font-size: 20px; font-weight: 700; color: var(--text-1); }
.page-subtitle { font-size: 13px; color: var(--text-3); margin-top: 2px; }

/* ── STAT CARDS ─────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  transition: all var(--t);
  animation: cardIn .4s ease both;
}
@keyframes cardIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.stat-card:nth-child(1) { animation-delay: .05s; }
.stat-card:nth-child(2) { animation-delay: .10s; }
.stat-card:nth-child(3) { animation-delay: .15s; }
.stat-card:nth-child(4) { animation-delay: .20s; }
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }

.stat-icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.si-primary { background: color-mix(in srgb, var(--primary) 12%, transparent); color: var(--primary); }
.si-navy    { background: color-mix(in srgb, var(--primary) 12%, transparent); color: var(--primary); }
.si-emerald { background: var(--emerald-bg2); color: var(--emerald); }
.si-amber   { background: var(--amber-bg);    color: var(--amber);   }
.si-ruby    { background: var(--ruby-bg);     color: var(--ruby);    }
.si-sky     { background: var(--sky-bg);      color: var(--sky);     }
.si-violet  { background: var(--violet-bg);   color: var(--violet);  }

.stat-label { font-size: 12px; color: var(--text-3); margin-bottom: 4px; font-weight: 500; letter-spacing: .02em; }
.stat-value { font-size: 26px; font-weight: 700; color: var(--text-1); font-family: var(--mono); letter-spacing: -.5px; line-height: 1; }
.stat-change { font-size: 12px; margin-top: 5px; display: flex; align-items: center; gap: 3px; }
.sc-up   { color: var(--success); }
.sc-dn   { color: var(--danger); }
.sc-same { color: var(--text-3); }

/* ── CARDS ──────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.card-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}
.card-title { font-size: 14px; font-weight: 600; color: var(--text-1); flex: 1; }
.card-body { padding: 18px; }
.card-footer {
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

/* ── BUTTONS ────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: var(--radius);
  font-size: 13.5px;
  font-weight: 500;
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: all var(--t);
  white-space: nowrap;
  line-height: 1;
}
.btn:active { transform: scale(.97); }
.btn-primary  { background: var(--primary);  color: #fff; border-color: var(--primary);  }
.btn-primary:hover  { background: color-mix(in srgb, var(--primary) 85%, #000); border-color: color-mix(in srgb, var(--primary) 85%, #000); }
.btn-success  { background: var(--success);  color: #fff; border-color: var(--success);  }
.btn-success:hover  { background: color-mix(in srgb, var(--success) 85%, #000); }
.btn-warning  { background: var(--warning);  color: #fff; border-color: var(--warning);  }
.btn-danger   { background: var(--danger);   color: #fff; border-color: var(--danger);   }
.btn-outline  { background: transparent; color: var(--primary); border-color: var(--primary); }
.btn-outline:hover  { background: color-mix(in srgb, var(--primary) 12%, transparent); }
.btn-ghost    { background: transparent; color: var(--text-2);  border-color: var(--border);  }
.btn-ghost:hover    { background: var(--surface-2); color: var(--text-1); border-color: var(--border-2); }
.btn-sm  { padding: 6px 12px; font-size: 12.5px; border-radius: 7px; }
.btn-lg  { padding: 11px 24px; font-size: 14.5px; border-radius: 12px; }
.btn-xl  { padding: 13px 28px; font-size: 15px;   border-radius: var(--radius-lg); }
.btn-icon { width: 36px; height: 36px; padding: 0; border-radius: 9px; }
.btn-icon-sm { width: 30px; height: 30px; padding: 0; border-radius: 7px; }
.btn-full { width: 100%; }

/* ── BADGES ─────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .02em;
  gap: 4px;
}
.badge::before { content: ''; width: 5px; height: 5px; border-radius: 50%; flex-shrink: 0; }
.badge-navy    { background: var(--navy-bg2);    color: var(--navy-dk);    }
.badge-navy::before    { background: var(--navy);    }
.badge-emerald { background: var(--emerald-bg2); color: var(--emerald-dk); }
.badge-emerald::before { background: var(--emerald); }
.badge-amber   { background: var(--amber-bg);    color: var(--amber-dk);   }
.badge-amber::before   { background: var(--amber);   }
.badge-ruby    { background: var(--ruby-bg);     color: var(--ruby);       }
.badge-ruby::before    { background: var(--ruby);    }
.badge-sky     { background: var(--sky-bg);      color: var(--sky);        }
.badge-sky::before     { background: var(--sky);     }
.badge-violet  { background: var(--violet-bg);   color: var(--violet);     }
.badge-violet::before  { background: var(--violet);  }
.badge-gray    { background: var(--surface-3);   color: var(--text-2);     }
.badge-gray::before    { background: var(--text-3);  }

/* ── FORMS ──────────────────────────────────────────────────── */
.form-section { margin-bottom: 28px; }
.form-section-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: .08em;
  padding-bottom: 10px;
  border-bottom: 2px solid color-mix(in srgb, var(--primary) 15%, transparent);
  margin-bottom: 16px;
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
}
.form-grid-2 { grid-template-columns: repeat(2, 1fr); }
.form-grid-3 { grid-template-columns: repeat(3, 1fr); }
.form-grid-4 { grid-template-columns: repeat(4, 1fr); }

.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-2);
  letter-spacing: .02em;
}
.form-label .req { color: var(--ruby); }
.form-control {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 13.5px;
  color: var(--text-1);
  background: var(--surface);
  outline: none;
  transition: border-color var(--t), box-shadow var(--t);
  appearance: none;
  height: 38px;
}
.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 15%, transparent);
}
.form-control::placeholder { color: var(--text-4); }
.form-control.has-error { border-color: var(--danger); }
.form-control.has-error:focus { box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 15%, transparent); }
textarea.form-control { height: auto; resize: vertical; min-height: 80px; }
select.form-control {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%237A90AA' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
  cursor: pointer;
}
.form-hint  { font-size: 11.5px; color: var(--text-3); }
.form-error { font-size: 11.5px; color: var(--danger); display: none; }
.has-error + .form-error { display: block; }
.form-check { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.form-check input[type="checkbox"],
.form-check input[type="radio"] {
  width: 16px; height: 16px;
  accent-color: var(--primary);
  cursor: pointer;
}

/* Input Group */
.input-group { position: relative; }
.input-group-prefix,
.input-group-suffix {
  position: absolute;
  top: 50%; transform: translateY(-50%);
  font-size: 13px;
  color: var(--text-3);
  pointer-events: none;
}
.input-group-prefix { left: 12px; }
.input-group-suffix { right: 12px; }
.input-group .form-control.has-prefix { padding-left: 34px; }
.input-group .form-control.has-suffix { padding-right: 34px; }

/* ── TABLES ─────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table thead th {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .07em;
  padding: 11px 14px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  text-align: left;
}
.data-table tbody td {
  padding: 12px 14px;
  font-size: 13.5px;
  border-bottom: 1px solid var(--border);
  color: var(--text-1);
  vertical-align: middle;
}
.data-table tbody tr { transition: background var(--t); }
.data-table tbody tr:hover { background: var(--surface-2); }
.data-table tbody tr:last-child td { border-bottom: none; }
.table-checkbox { width: 16px; height: 16px; accent-color: var(--primary); cursor: pointer; }

/* Avatar in table */
.avatar-cell { display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
  flex-shrink: 0;
  border: 2px solid var(--border);
}
.av-navy    { background: var(--navy-bg2);    color: var(--navy-dk);    border-color: var(--navy-bg2);    }
.av-emerald { background: var(--emerald-bg2); color: var(--emerald-dk); border-color: var(--emerald-bg2); }
.av-amber   { background: var(--amber-bg);    color: var(--amber-dk);   border-color: var(--amber-bg);    }
.av-ruby    { background: var(--ruby-bg);     color: var(--ruby);       border-color: var(--ruby-bg);     }
.av-violet  { background: var(--violet-bg);   color: var(--violet);     border-color: var(--violet-bg);   }
.av-sky     { background: var(--sky-bg);      color: var(--sky);        border-color: var(--sky-bg);      }
.cell-name  { font-size: 13.5px; font-weight: 600; color: var(--text-1); }
.cell-sub   { font-size: 11.5px; color: var(--text-3); }

/* ── TABS ────────────────────────────────────────────────────── */
.tabs-bar {
  display: flex;
  border-bottom: 1.5px solid var(--border);
  gap: 0;
  overflow-x: auto;
}
.tabs-bar::-webkit-scrollbar { height: 0; }
.tab-btn {
  padding: 10px 18px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-3);
  border: none;
  background: none;
  cursor: pointer;
  border-bottom: 2.5px solid transparent;
  margin-bottom: -1.5px;
  transition: all var(--t);
  white-space: nowrap;
}
.tab-btn:hover { color: var(--primary); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
.tab-panel { display: none; }
.tab-panel.active { display: block; animation: fadeIn .2s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ── PROGRESS / ATTENDANCE BAR ───────────────────────────────── */
.progress-bar { height: 8px; background: var(--surface-3); border-radius: 4px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 4px; transition: width .6s ease; }
.pf-primary { background: var(--primary); }
.pf-navy    { background: var(--primary); }
.pf-emerald { background: var(--success); }
.pf-amber   { background: var(--warning); }
.pf-ruby    { background: var(--danger);  }

/* Attendance color dots */
.att-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  display: inline-block;
}
.att-present  { background: var(--emerald); }
.att-absent   { background: var(--ruby); }
.att-leave    { background: var(--amber); }
.att-late     { background: var(--sky); }

/* ── MODAL ──────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: var(--navy-bg);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-box{
    background: var(--surface);
}
.modal-overlay.open { display: flex; animation: fadeIn .2s ease; }
.modal {
  background: var(--surface);
  border-radius: var(--radius-xl);
  max-width: 640px;
  width: 100%;
  max-height: 92vh;
  overflow-y: auto;
  animation: slideUp .25s ease;
  box-shadow: var(--shadow-lg);
}
.modal-lg { max-width: 860px; }
.modal-sm { max-width: 440px; }
@keyframes slideUp {
  from { transform: translateY(14px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}
.modal-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
}
.modal-title { font-size: 16px; font-weight: 700; flex: 1; color: var(--text-1); }
.modal-close {
  width: 32px; height: 32px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  font-size: 16px;
  color: var(--text-3);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: all var(--t);
}
.modal-close:hover { background: var(--surface-2); color: var(--text-1); }
.modal-body   { padding: 22px; }
.modal-footer { padding: 16px 22px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }

/* ── TOAST ──────────────────────────────────────────────────── */
.toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 9999; display: flex; flex-direction: column; gap: 10px; pointer-events: none; }
.toast {
  background: var(--text-1);
  color: #fff;
  padding: 12px 16px;
  border-radius: var(--radius-lg);
  font-size: 13.5px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow-lg);
  min-width: 250px;
  max-width: 380px;
  pointer-events: all;
  animation: toastIn .25s var(--t-spring) both;
}
@keyframes toastIn { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: translateX(0); } }

/* ── MOBILE SIDEBAR DRAWER ───────────────────────────────────── */
@media (max-width: 1024px) {
  /* Show mobile menu button */
  #mobileMenuBtn {
    display: flex !important;
  }

  .sidebar {
    transform: translateX(-100%) !important;
    width: 280px !important;
    max-width: 85vw !important;
  }

  .sidebar.mobile-open {
    transform: translateX(0) !important;
  }

  .main-area {
    margin-left: 0 !important;
  }

  .main-area.collapsed {
    margin-left: 0 !important;
  }

  .sb-mobile-close {
    display: none;
  }

  .sidebar.mobile-open .sb-mobile-close {
    display: flex !important;
  }

  /* Hide collapse button on mobile */
  .sb-collapse-btn {
    display: none !important;
  }

  /* Ensure all nav sections are expanded on mobile */
  .sidebar.mobile-open .nav-section-body {
    max-height: 2000px !important;
    opacity: 1 !important;
    pointer-events: auto !important;
  }

  .sidebar.mobile-open .nav-section-item {
    margin-bottom: 4px;
  }

  .sidebar.mobile-open .nav-section-header {
    pointer-events: none;
    opacity: 0.7;
  }

  .sidebar.mobile-open .nav-section-chevron {
    display: none;
  }
}

@media (min-width: 1025px) {
  /* Hide mobile menu button on desktop */
  #mobileMenuBtn {
    display: none !important;
  }

  .sidebar {
    transform: translateX(0) !important;
  }

  .sb-mobile-close {
    display: none !important;
  }
}
.toast.success { background: var(--success); }
.toast.warning { background: var(--warning); }
.toast.danger  { background: var(--danger);  }
.toast.info    { background: var(--primary); }
.toast-icon { font-size: 18px; flex-shrink: 0; }

/* ── FILTER ROW ─────────────────────────────────────────────── */
.filter-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.filter-row .form-control { height: 34px; font-size: 13px; }
.filter-row .btn { height: 34px; font-size: 13px; }

/* ── QUICK ACTION GRID ──────────────────────────────────────── */
.quick-actions {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 12px;
}
.quick-action {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 9px;
  padding: 18px 12px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--t);
  text-decoration: none;
  color: var(--text-2);
  font-size: 12.5px;
  font-weight: 500;
  text-align: center;
}
.quick-action:hover { border-color: var(--navy); color: var(--navy); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.qa-icon { font-size: 26px; }

/* ── TIMELINE ───────────────────────────────────────────────── */
.timeline { display: flex; flex-direction: column; gap: 0; }
.timeline-item { display: flex; gap: 14px; padding-bottom: 18px; position: relative; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-dot {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}
.timeline-item:not(:last-child) .timeline-dot::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  width: 2px;
  height: calc(100% + 18px);
  background: var(--border);
}
.timeline-content { flex: 1; padding-top: 4px; }
.timeline-title { font-size: 13.5px; font-weight: 600; color: var(--text-1); }
.timeline-time  { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.timeline-desc  { font-size: 13px; color: var(--text-2); margin-top: 4px; line-height: 1.5; }

/* ── CHART WRAPPER ──────────────────────────────────────────── */
.chart-wrap { position: relative; }

/* ── FEE RECEIPT STYLE ──────────────────────────────────────── */
.receipt {
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.receipt-header {
  background: var(--navy-dk);
  color: #fff;
  padding: 20px 24px;
  text-align: center;
}
.receipt-school-name { font-family: var(--serif); font-size: 22px; margin-bottom: 4px; }
.receipt-row { display: flex; justify-content: space-between; padding: 10px 20px; border-bottom: 1px solid var(--border); font-size: 13.5px; }
.receipt-row:last-child { border-bottom: none; }
.receipt-row.total { font-weight: 700; font-size: 15px; background: var(--navy-bg); color: var(--navy-dk); }
.receipt-label { color: var(--text-2); }
.receipt-value { font-family: var(--mono); font-weight: 600; }

/* ── ATTENDANCE GRID ────────────────────────────────────────── */
.att-calendar { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.att-day-header { font-size: 10.5px; font-weight: 700; text-align: center; color: var(--text-3); padding: 4px 0; text-transform: uppercase; letter-spacing: .05em; }
.att-day {
  aspect-ratio: 1;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--t);
  border: 1px solid transparent;
}
.att-day:hover { border-color: var(--border-2); }
.att-day.present { background: var(--emerald-bg2); color: var(--emerald-dk); }
.att-day.absent  { background: var(--ruby-bg);     color: var(--ruby);       }
.att-day.leave   { background: var(--amber-bg);    color: var(--amber-dk);   }
.att-day.holiday { background: var(--surface-3);   color: var(--text-3);     }
.att-day.today   { border-color: var(--navy);      font-weight: 700;         }
.att-day.empty   { background: transparent;        cursor: default;          }

/* ── RESULT CARD ────────────────────────────────────────────── */
.result-subject-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.result-subject-row:last-child { border-bottom: none; }
.result-sub-name { font-size: 13.5px; font-weight: 500; flex: 1; }
.result-marks { font-family: var(--mono); font-size: 14px; font-weight: 700; min-width: 80px; text-align: right; }
.result-grade { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 6px; min-width: 32px; text-align: center; }
.grade-a-plus { background: var(--emerald-bg2); color: var(--emerald-dk); }
.grade-a      { background: var(--emerald-bg);  color: var(--emerald-dk); }
.grade-b      { background: var(--sky-bg);      color: var(--sky);        }
.grade-c      { background: var(--amber-bg);    color: var(--amber-dk);   }
.grade-d      { background: var(--ruby-bg);     color: var(--ruby);       }
.grade-f      { background: var(--ruby-bg);     color: var(--ruby);       }

/* ── NOTICE BOARD ───────────────────────────────────────────── */
.notice-item {
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.notice-item:last-child { border-bottom: none; }
.notice-icon {
  width: 36px; height: 36px;
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}
.notice-title { font-size: 13.5px; font-weight: 600; color: var(--text-1); margin-bottom: 3px; }
.notice-date  { font-size: 12px; color: var(--text-3); }
.notice-body  { font-size: 13px; color: var(--text-2); margin-top: 5px; line-height: 1.5; }

/* ── ID CARD ────────────────────────────────────────────────── */
.id-card {
  width: 300px;
  background: var(--surface);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}
.id-card-top { background: var(--navy-dk); padding: 20px; text-align: center; color: #fff; }
.id-card-body { padding: 16px 18px; }
.id-photo { width: 70px; height: 70px; border-radius: 50%; border: 3px solid rgba(255,255,255,.3); background: var(--navy); margin: 0 auto 10px; display: flex; align-items: center; justify-content: center; font-size: 28px; font-weight: 700; font-family: var(--serif); color: rgba(255,255,255,.8); }
.id-name { font-family: var(--serif); font-size: 18px; font-weight: 500; margin-bottom: 4px; }
.id-role { font-size: 12px; opacity: .6; text-transform: uppercase; letter-spacing: .1em; }

/* ── TIMETABLE ──────────────────────────────────────────────── */
.timetable { border-collapse: collapse; width: 100%; font-size: 13px; }
.timetable th {
  background: var(--navy);
  color: #fff;
  padding: 10px 12px;
  font-weight: 600;
  font-size: 12px;
  text-align: center;
  letter-spacing: .03em;
}
.timetable td {
  border: 1px solid var(--border);
  padding: 10px 12px;
  text-align: center;
  vertical-align: middle;
  color: var(--text-2);
  font-size: 12.5px;
}
.timetable .period-cell {
  background: var(--surface-2);
  font-size: 11px;
  color: var(--text-3);
  font-weight: 600;
  white-space: nowrap;
}
.tt-subject {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 2px;
}
.tt-teacher { font-size: 11px; color: var(--text-3); }
.tt-highlight { background: var(--emerald-bg); }
.tt-break { background: var(--amber-bg); color: var(--amber-dk); font-weight: 600; font-size: 12px; }
.tt-free { background: var(--surface-2); color: var(--text-4); }

/* ── RESPONSIVE ─────────────────────────────────────────────── */

/* Large desktops (1280px and below) */
@media (max-width: 1280px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

/* Tablet landscape + small laptops (1024px and below) */
@media (max-width: 1024px) {
  /* Search bar shrinks */
  .search-wrap { width: 200px; }

  /* Header right — hide low-priority buttons */
  .header-btn[title="Toggle fullscreen"],
  .header-btn[title="Print current page"] { display: none; }
}

/* Tablet portrait (768px and below) */
@media (max-width: 768px) {
  /* Stats */
  .stats-grid { grid-template-columns: 1fr 1fr; }

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

  /* Content padding */
  .page-content { padding: 14px; }

  /* Header */
  .top-header {
    padding: 0 12px;
    gap: 8px;
    flex-wrap: nowrap;
  }

  /* Hide search on mobile — too cramped */
  .search-wrap { display: none; }

  /* Header breadcrumb — truncate */
  .header-breadcrumb { flex: 1; overflow: hidden; min-width: 0; }
  .hb-item { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 140px; }

  /* Header right — reduce gaps */
  .header-right { gap: 4px; }
  .header-btn { width: 32px; height: 32px; font-size: 14px; }

  /* Session info — hide label text, show dot only */
  .session-info { padding: 4px 8px; font-size: 11px; }

  /* Page header */
  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 16px;
  }
  .page-title { font-size: 17px; }
  .page-header > * { width: 100%; }

  /* Cards */
  .card-body { padding: 14px; }
  .card-header { padding: 12px 14px; }

  /* Filter row wraps */
  .filter-row { gap: 8px; padding: 12px 14px; }
  .filter-row .form-control,
  .filter-row .btn { height: 36px; }

  /* Modal full-width on mobile */
  .modal-overlay { padding: 12px; }
  .modal, .modal-lg, .modal-sm { max-width: 100%; border-radius: var(--radius-lg); }
  .modal-body { padding: 16px; }
  .modal-footer { padding: 12px 16px; flex-wrap: wrap; gap: 8px; }
  .modal-footer .btn { flex: 1; min-width: 100px; }

  /* Tables — horizontal scroll */
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .data-table tbody td,
  .data-table thead th { padding: 10px 10px; font-size: 12.5px; }

  /* DataTables */
  .dataTables_wrapper .dataTables_length,
  .dataTables_wrapper .dataTables_filter { float: none; text-align: left; margin-bottom: 8px; }
  .dataTables_wrapper .dataTables_paginate { float: none; }

  /* Quick actions */
  .quick-actions { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 8px; }
  .quick-action { padding: 14px 8px; }
  .qa-icon { font-size: 22px; }

  /* Toast — full width bottom */
  .toast-container { bottom: 12px; right: 12px; left: 12px; }
  .toast { min-width: unset; max-width: 100%; }

  /* Stat cards */
  .stat-card { padding: 14px 16px; gap: 10px; }
  .stat-value { font-size: 22px; }
  .stat-icon { width: 38px; height: 38px; font-size: 18px; }

  /* Footer */
  footer {
    flex-direction: column !important;
    gap: 4px !important;
    padding: 10px 14px !important;
    text-align: center !important;
    font-size: 11px !important;
  }
  footer span:last-child { display: none !important; }

  /* Tabs scroll horizontally */
  .tabs-bar { overflow-x: auto; flex-wrap: nowrap; }
  .tab-btn { padding: 10px 14px; font-size: 13px; }

  /* Pagination */
  .sms-pagination { flex-direction: column; align-items: flex-start; gap: 6px; }

  /* Receipt */
  .receipt-school-name { font-size: 18px; }
  .receipt-row { font-size: 12.5px; padding: 8px 14px; }

  /* Attendance calendar — smaller cells */
  .att-calendar { gap: 3px; }
  .att-day { font-size: 11px; border-radius: 5px; }
  .att-day-header { font-size: 9.5px; }

  /* ID card */
  .id-card { width: 100%; max-width: 300px; margin: 0 auto; }

  /* Timetable scroll */
  .timetable { font-size: 11.5px; }

  /* Buttons in groups */
  .page-header .btn + .btn { margin-top: 0; }
}

/* Small phones (480px and below) */
@media (max-width: 480px) {
  /* Stats — single column */
  .stats-grid { grid-template-columns: 1fr; }

  /* Forms — single column */
  .form-grid-2, .form-grid-3, .form-grid-4 { grid-template-columns: 1fr; }

  /* Content */
  .page-content { padding: 12px; }
  .top-header { padding: 0 10px; gap: 6px; }

  /* Session info — very compact */
  .session-info { padding: 3px 7px; font-size: 10.5px; }
  .session-dot { width: 6px; height: 6px; }

  /* Breadcrumb — hide on very small */
  .header-breadcrumb { display: none; }

  /* Header buttons — tightest */
  .header-btn { width: 30px; height: 30px; font-size: 13px; border-radius: 7px; }

  /* Stat cards */
  .stat-card { padding: 12px 14px; }
  .stat-value { font-size: 20px; }

  /* Card */
  .card-body { padding: 12px; }
  .card-header { padding: 10px 12px; flex-wrap: wrap; gap: 6px; }

  /* Quick actions */
  .quick-actions { grid-template-columns: repeat(3, 1fr); }

  /* Filter row stacks */
  .filter-row { flex-direction: column; align-items: stretch; }
  .filter-row .form-control,
  .filter-row .btn,
  .filter-row select { width: 100%; }

  /* Modal */
  .modal-overlay { padding: 8px; align-items: flex-end; }
  .modal, .modal-lg, .modal-sm {
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    max-height: 95vh;
  }

  /* Table cells shrink more */
  .data-table tbody td,
  .data-table thead th { padding: 8px 8px; font-size: 12px; }

  /* Tabs */
  .tab-btn { padding: 8px 12px; font-size: 12.5px; }
}
@media print {
  /* Hide non-printable elements */
  .sidebar, .top-header, .no-print, .btn, .btn-primary, .btn-ghost, .btn-danger,
  .filter-row, .pagination, .sms-pagination, .dataTables_length, .dataTables_filter,
  .dataTables_paginate, .toast-container, .modal-overlay, .dropdown-menu,
  #toast-container, .page-header button, .card-header button { display: none !important; }

  /* Reset layout for print */
  .main-area { margin-left: 0 !important; padding: 0 !important; }
  .page-content { padding: 0 !important; max-width: none !important; }
  .app-shell { display: block !important; }
  body { background: #fff !important; color: #000 !important; font-size: 12pt; }

  /* Cards and containers */
  .card { border: none !important; box-shadow: none !important; margin: 0 !important; padding: 0 !important; }
  .card-body { padding: 0 !important; }
  .card-header { border-bottom: 1px solid #000 !important; margin-bottom: 10px !important; }

  /* Tables */
  table { border-collapse: collapse !important; width: 100% !important; }
  th, td { border: 1px solid #000 !important; padding: 6px 8px !important; }
  .data-table { border: 1px solid #000 !important; }
  .data-table th { background: #f0f0f0 !important; color: #000 !important; }

  /* Text colors */
  * { color: #000 !important; }
  .text-primary, .text-success, .text-danger, .text-warning, .text-info { color: #000 !important; }

  /* Links */
  a { text-decoration: none !important; color: #000 !important; }

  /* Forms and inputs */
  input, select, textarea { border: 1px solid #000 !important; }

  /* Backgrounds */
  .badge, .stat-card { background: #fff !important; border: 1px solid #000 !important; }
  .stat-icon { background: #f0f0f0 !important; color: #000 !important; }

  /* Ensure page breaks */
  .page-break { page-break-before: always; }
  .avoid-break { page-break-inside: avoid; }

  /* Print-specific receipt styling */
  .receipt-container { border: 2px solid #000; padding: 20px; max-width: 800px; margin: 0 auto; }
  .receipt-header { text-align: center; border-bottom: 2px solid #000; padding-bottom: 15px; margin-bottom: 15px; }
  .receipt-footer { border-top: 2px solid #000; padding-top: 15px; margin-top: 20px; text-align: center; }

  /* Report card specific */
  .report-card { border: 2px solid #000; padding: 20px; }
  .report-card-header { text-align: center; margin-bottom: 20px; }
  .grade-table { border: 1px solid #000; width: 100%; margin: 10px 0; }
  .grade-table th, .grade-table td { border: 1px solid #000; padding: 8px; text-align: center; }

  /* Payslip specific */
  .payslip { border: 2px solid #000; padding: 20px; max-width: 700px; margin: 0 auto; }
  .payslip-header { text-align: center; border-bottom: 2px solid #000; padding-bottom: 10px; margin-bottom: 15px; }
  .payslip-table { width: 100%; border-collapse: collapse; margin: 10px 0; }
  .payslip-table th, .payslip-table td { border: 1px solid #000; padding: 6px; }
  .payslip-signature { display: flex; justify-content: space-between; margin-top: 30px; padding-top: 20px; }
  .signature-line { border-top: 1px solid #000; width: 200px; text-align: center; padding-top: 5px; }
}

/* ── SMS PAGINATION ─────────────────────────────────────────── */
.sms-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 4px;
  flex-wrap: wrap;
  gap: 8px;
}
.sms-pagination-info {
  font-size: 12.5px;
  color: var(--text-3);
}
.sms-pagination-links {
  display: flex;
  align-items: center;
  gap: 4px;
}
.sms-page-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text-2);
  font-size: 13px;
  cursor: pointer;
  transition: all var(--t);
  text-decoration: none;
  font-family: var(--font);
}
.sms-page-btn:hover:not(.disabled):not(.active) {
  background: var(--surface-2);
  border-color: var(--border-2);
  color: var(--text-1);
}
.sms-page-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  font-weight: 600;
}
.sms-page-btn.disabled {
  opacity: .4;
  cursor: not-allowed;
}
.sms-page-btn.dots {
  border: none;
  background: transparent;
  cursor: default;
  color: var(--text-3);
}

/* ── DATATABLES THEME OVERRIDES ─────────────────────────────── */
table.dataTable { border-collapse: collapse !important; width: 100% !important; }
table.dataTable thead th,
table.dataTable thead td {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .07em;
  padding: 11px 14px !important;
  background: var(--surface-2) !important;
  border-bottom: 1px solid var(--border) !important;
  white-space: nowrap;
}
table.dataTable thead th.sorting,
table.dataTable thead th.sorting_asc,
table.dataTable thead th.sorting_desc { background: var(--surface-2) !important; }
table.dataTable thead th.sorting_asc::after  { color: var(--primary) !important; }
table.dataTable thead th.sorting_desc::after { color: var(--primary) !important; }
table.dataTable tbody td {
  padding: 11px 14px !important;
  font-size: 13.5px;
  border-bottom: 1px solid var(--border) !important;
  color: var(--text-1);
  vertical-align: middle;
  background: transparent !important;
}
table.dataTable tbody tr:hover > td { background: var(--surface-2) !important; }
table.dataTable tbody tr.odd  > td  { background: transparent !important; }
table.dataTable tbody tr.even > td  { background: transparent !important; }

/* Wrapper */
.dataTables_wrapper { color: var(--text-1); font-size: 13px; }
.dataTables_wrapper .dataTables_length label,
.dataTables_wrapper .dataTables_filter label { color: var(--text-2); font-size: 13px; }
.dataTables_wrapper .dataTables_length select,
.dataTables_wrapper .dataTables_filter input {
  background: var(--surface) !important;
  border: 1px solid var(--border) !important;
  border-radius: 8px !important;
  color: var(--text-1) !important;
  padding: 6px 10px !important;
  font-size: 13px !important;
  outline: none !important;
}
.dataTables_wrapper .dataTables_filter input:focus {
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 15%, transparent) !important;
}

/* Info text */
.dataTables_wrapper .dataTables_info { color: var(--text-3); font-size: 12.5px; padding-top: 10px; }

/* Pagination */
.dataTables_wrapper .dataTables_paginate { padding-top: 10px; }
.dataTables_wrapper .dataTables_paginate .paginate_button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  padding: 0 10px !important;
  margin: 0 2px !important;
  border: 1px solid var(--border) !important;
  border-radius: 7px !important;
  background: var(--surface) !important;
  color: var(--text-2) !important;
  font-size: 13px !important;
  cursor: pointer;
  transition: all var(--t);
  text-decoration: none !important;
  box-shadow: none !important;
}
.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
  background: var(--surface-2) !important;
  border-color: var(--border-2) !important;
  color: var(--text-1) !important;
}
.dataTables_wrapper .dataTables_paginate .paginate_button.current,
.dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
  background: var(--primary) !important;
  border-color: var(--primary) !important;
  color: #fff !important;
  font-weight: 600;
}
.dataTables_wrapper .dataTables_paginate .paginate_button.disabled,
.dataTables_wrapper .dataTables_paginate .paginate_button.disabled:hover {
  opacity: .4;
  cursor: not-allowed;
  background: var(--surface) !important;
  color: var(--text-4) !important;
}

/* Top/Bottom layout */
.dataTables_wrapper .dataTables_length { float: left; }
.dataTables_wrapper .dataTables_filter { float: right; text-align: right; }
.dataTables_wrapper .dataTables_paginate { float: right; }
.dataTables_wrapper::after { content: ''; display: table; clear: both; }
