/* ==========================================================================
   COMPUTER CARE (ANUBHAV EDUVISTA) - ACADEMY MANAGEMENT SYSTEM
   Centralized Stylesheet - Liquid Glass + Neumorphic Design
   ========================================================================== */

/* 1. CSS VARIABLES & THEMING */
:root {
  color-scheme: dark;
  --primary: #5eead4;
  --primary-glow: rgba(94,234,212,0.36);
  --secondary: #8b9cff;
  --accent: #fbbf24;
  --focus-ring: #fbbf24;
  --success: #34d399;
  --success-glow: rgba(52,211,153,0.3);
  --warning: #fbbf24;
  --warning-glow: rgba(251,191,36,0.28);
  --danger: #fb7185;
  --danger-glow: rgba(251,113,133,0.28);
  --info: #93c5fd;
  --bg-deep-1: #070b12;
  --bg-deep-2: #0d1320;
  --bg-deep-3: #142032;
  --bg-deep-4: #1d2b3d;
  --bg-gradient: linear-gradient(145deg,rgba(94,234,212,0.14),transparent 34%),linear-gradient(35deg,rgba(251,191,36,0.12),transparent 32%),linear-gradient(135deg,#070b12 0%,#101827 48%,#13251f 100%);
  --glass-bg-ultra-light: rgba(255,255,255,0.055);
  --glass-bg-light: rgba(18,28,43,0.68);
  --glass-bg-medium: rgba(28,43,61,0.74);
  --glass-bg-heavy: rgba(11,18,30,0.88);
  --glass-border: rgba(226,232,240,0.16);
  --glass-border-highlight: rgba(255,255,255,0.36);
  --glass-shadow: 18px 18px 44px rgba(0,0,0,0.42),-10px -10px 28px rgba(255,255,255,0.035),inset 0 1px 0 rgba(255,255,255,0.1);
  --glass-blur: blur(18px) saturate(1.35);
  --neo-raised: 12px 12px 28px rgba(0,0,0,0.36),-8px -8px 24px rgba(255,255,255,0.04);
  --neo-pressed: inset 8px 8px 20px rgba(0,0,0,0.34),inset -6px -6px 16px rgba(255,255,255,0.05);
  --text-main: #f8fafc;
  --text-muted: rgba(226,232,240,0.78);
  --text-inverse: #000000;
  --input-bg: rgba(12,18,30,0.76);
  --input-border: rgba(226,232,240,0.18);
  --table-header-bg: rgba(10,17,29,0.92);
  --font-main: 'Inter','Segoe UI',system-ui,-apple-system,sans-serif;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --radius-round: 50%;
  --sidebar-width: 280px;
  --header-height: 70px;
  --transition: all 0.3s cubic-bezier(0.4,0,0.2,1);
  --coral: #ff8a65;
  --violet: #c084fc;
  --sky: #38bdf8;
  --material-elevation-1: 0 1px 3px rgba(0,0,0,0.16), 0 1px 2px rgba(0,0,0,0.22);
  --material-elevation-2: 0 8px 22px rgba(0,0,0,0.22), 0 2px 6px rgba(0,0,0,0.16);
  --material-elevation-3: 0 18px 46px rgba(0,0,0,0.3), 0 8px 18px rgba(0,0,0,0.2);
  --liquid-highlight: linear-gradient(135deg, rgba(255,255,255,0.22), rgba(255,255,255,0.03) 42%, rgba(255,255,255,0));
}

[data-theme="light"] {
  color-scheme: light;
  --primary: #047857;
  --primary-glow: rgba(4,120,87,0.18);
  --secondary: #2563eb;
  --accent: #b45309;
  --bg-deep-1: #ffffff;
  --bg-deep-2: #f6f8fb;
  --bg-deep-3: #e8eef5;
  --bg-deep-4: #dbe6ef;
  --bg-gradient: linear-gradient(145deg,rgba(4,120,87,0.12),transparent 34%),linear-gradient(35deg,rgba(180,83,9,0.1),transparent 32%),linear-gradient(135deg,#ffffff 0%,#f6f8fb 52%,#e9f1ed 100%);
  --glass-bg-ultra-light: rgba(255,255,255,0.58);
  --glass-bg-light: rgba(255,255,255,0.72);
  --glass-bg-medium: rgba(255,255,255,0.86);
  --glass-bg-heavy: rgba(255,255,255,0.94);
  --glass-border: rgba(15,23,42,0.12);
  --glass-border-highlight: rgba(15,23,42,0.24);
  --glass-shadow: 14px 14px 34px rgba(115,131,151,0.2),-10px -10px 28px rgba(255,255,255,0.88),inset 0 1px 0 rgba(255,255,255,0.82);
  --neo-raised: 10px 10px 24px rgba(115,131,151,0.2),-10px -10px 24px rgba(255,255,255,0.9);
  --neo-pressed: inset 7px 7px 18px rgba(115,131,151,0.22),inset -7px -7px 18px rgba(255,255,255,0.9);
  --text-main: #0f172a;
  --text-muted: #334155;
  --text-inverse: #ffffff;
  --input-bg: rgba(255,255,255,0.84);
  --input-border: rgba(15,23,42,0.16);
  --table-header-bg: rgba(248,250,252,0.94);
  --danger: #e11d48;
  --success: #059669;
  --warning: #d97706;
  --info: #2563eb;
}

/* 2. RESET & BASE */
*, *::before, *::after { margin:0; padding:0; box-sizing:border-box; }
html {
  font-size: 15px;
  height: 100%;
  overflow: hidden;     /* prevent outer page scroll */
}
body {
  font-family: var(--font-main);
  background: var(--bg-gradient);
  background-attachment: fixed;
  background-size: cover;
  color: var(--text-main);
  height: 100%;
  max-height: 100vh;
  overflow: hidden;     /* all scrolling happens inside .content-area */
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background 0.3s ease, color 0.3s ease;
}
/* Login page exception — needs full scroll */
body.login-layout {
  height: auto;
  overflow-y: auto;
  overflow-x: hidden;
}

::-webkit-scrollbar { width:7px; height:7px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(150,150,150,0.3); border-radius:4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(150,150,150,0.6); }

h1,h2,h3,h4,h5,h6 { font-weight:600; line-height:1.3; letter-spacing:0; }
h1 { font-size:2.2rem; font-weight:300; }
h2 { font-size:1.7rem; }
h3 { font-size:1.3rem; }
h4 { font-size:1.1rem; }
a { color:inherit; text-decoration:none; }
img { max-width:100%; }
button { cursor:pointer; font-family:inherit; }
input,select,textarea { font-family:inherit; }

/* UTILITY CLASSES */
.text-primary { color:var(--primary); }
.text-success { color:var(--success); }
.text-warning { color:var(--warning); }
.text-danger  { color:var(--danger); }
.text-info    { color:var(--info); }
.text-accent  { color:var(--accent); }
.text-muted   { color:var(--text-muted); font-size:0.88em; }
.text-center  { text-align:center; }
.text-right   { text-align:right; }
.font-bold    { font-weight:700; }
.font-semibold{ font-weight:600; }
.w-full       { width:100%; }
.hidden       { display:none !important; }
.flex         { display:flex; }
.flex-col     { flex-direction:column; }
.items-center { align-items:center; }
.justify-between { justify-content:space-between; }
.gap-1  { gap:8px; }
.gap-2  { gap:16px; }
.gap-3  { gap:24px; }
.flex-wrap    { flex-wrap:wrap; }
.flex-1       { flex:1; }
.mt-1 { margin-top:8px; }
.mt-2 { margin-top:16px; }
.mt-3 { margin-top:24px; }
.mb-1 { margin-bottom:8px; }
.mb-2 { margin-bottom:16px; }
.mb-3 { margin-bottom:24px; }
.p-1  { padding:8px; }
.p-2  { padding:16px; }
.p-3  { padding:24px; }
.rounded { border-radius:var(--radius-sm); }
.rounded-lg { border-radius:var(--radius-md); }
.rounded-xl { border-radius:var(--radius-lg); }

/* 3. LAYOUT */
.app-wrapper {
  display: flex;
  height: 100vh;
  max-height: 100vh;
  width: 100%;
  position: relative;
  z-index: 1;
  overflow: hidden;
}

/* SIDEBAR */
.sidebar {
  width: var(--sidebar-width);
  flex: 0 0 var(--sidebar-width);
  height: 100vh;
  max-height: 100vh;
  position: sticky;
  top: 0;
  background: var(--glass-bg-medium);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-right: 1px solid var(--glass-border);
  display: flex;
  flex-direction: column;
  transition: var(--transition);
  z-index: 100;
  box-shadow: 5px 0 30px rgba(0,0,0,0.12);
  overflow: hidden;
}
.sidebar.collapsed { width: 72px; flex: 0 0 72px; }
.sidebar.collapsed .brand-text,
.sidebar.collapsed .nav-label,
.sidebar.collapsed .nav-badge,
.sidebar.collapsed .sidebar-footer-info { display:none; }
.sidebar.collapsed .nav-item { justify-content:center; padding:14px; }

.sidebar-header {
  padding: 22px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--glass-border);
  background: linear-gradient(to bottom, var(--glass-bg-light), transparent);
  flex-shrink: 0;
}
.brand-icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  display: flex; align-items:center; justify-content:center;
  box-shadow: 0 0 20px var(--primary-glow);
  flex-shrink: 0;
  color: #fff;
  font-size: 1.3rem;
  font-weight: 900;
  letter-spacing: 0;
}
.brand-text h2 {
  font-size: 0.95rem;
  font-weight: 800;
  margin: 0;
  background: linear-gradient(to right, var(--text-main), var(--primary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.2;
}
.brand-text p {
  font-size: 0.65rem;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin: 0;
  font-weight: 600;
}

.nav-menu {
  flex: 1;
  padding: 16px 12px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.nav-section-title {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-muted);
  padding: 10px 12px 4px;
  font-weight: 600;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  color: var(--text-muted);
  text-decoration: none;
  border-radius: 12px;
  cursor: pointer;
  transition: var(--transition);
  border: 1px solid transparent;
  font-weight: 500;
  font-size: 0.9rem;
  position: relative;
  overflow: hidden;
  white-space: nowrap;
}
.nav-item:hover {
  background: var(--glass-bg-light);
  color: var(--text-main);
  border-color: var(--glass-border);
}
.nav-item.active {
  background: linear-gradient(90deg, rgba(94,234,212,0.15), var(--glass-bg-ultra-light));
  border: 1px solid rgba(94,234,212,0.3);
  border-left: 4px solid var(--primary);
  color: var(--text-main);
  font-weight: 600;
}
.nav-item .nav-icon { font-size: 1.1rem; flex-shrink:0; width:20px; text-align:center; }
.nav-item.active .nav-icon { color: var(--primary); }
.nav-badge {
  margin-left: auto;
  background: var(--primary);
  color: #000;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--glass-border);
  background: var(--glass-bg-light);
  flex-shrink: 0;
}
.sidebar-footer-info {
  font-size: 0.7rem;
  color: var(--text-muted);
  line-height: 1.6;
  text-align: center;
  margin-bottom: 10px;
}

/* MAIN CONTENT */
.main-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  max-height: 100vh;
  overflow: hidden;
  position: relative;
}

/* TOP HEADER */
.top-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 0 28px;
  height: var(--header-height);
  position: sticky;
  top: 0;
  z-index: 90;
  background: var(--glass-bg-heavy);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  border-bottom: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  flex-shrink: 0;
}
.header-left { display:flex; align-items:center; gap:14px; }
.header-right { display:flex; align-items:center; gap:10px; flex-wrap:wrap; min-width: 0; }
.page-title { font-size:1.15rem; font-weight:700; }
.page-subtitle { font-size:0.78rem; color:var(--text-muted); }

.toggle-sidebar-btn {
  background: var(--glass-bg-light);
  border: 1px solid var(--glass-border);
  color: var(--text-main);
  width: 36px; height: 36px;
  border-radius: 10px;
  display: flex; align-items:center; justify-content:center;
  cursor: pointer;
  transition: var(--transition);
  font-size: 1.1rem;
}
.toggle-sidebar-btn:hover { background:var(--glass-bg-medium); border-color:var(--primary); }

/* CONTENT AREA */
.content-area {
  flex: 1;
  min-height: 0;          /* critical: allows shrink below natural size */
  overflow-y: auto;
  overflow-x: hidden;     /* page-level, inner scroll containers handle horizontal */
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  scroll-behavior: smooth;
}
/* For attendance/timetable pages: allow horizontal scroll to bubble */
.content-area > .glass-panel,
.content-area > .glass-card { overflow: visible; }
/* Scrollbar — always visible so layout doesn't jump */
.content-area::-webkit-scrollbar { width: 6px; }
.content-area::-webkit-scrollbar-track { background: transparent; }
.content-area::-webkit-scrollbar-thumb {
  background: rgba(94,234,212,0.28);
  border-radius: 4px;
}
.content-area::-webkit-scrollbar-thumb:hover {
  background: rgba(94,234,212,0.55);
}
/* Firefox */
.content-area { scrollbar-width: thin; scrollbar-color: rgba(94,234,212,0.3) transparent; }

/* 4. GLASS COMPONENTS */
.glass-panel {
  background: var(--glass-bg-light);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  box-shadow: var(--glass-shadow);
  padding: 24px;
  position: relative;
  overflow: visible;
}
.glass-panel::before {
  content:'';
  position:absolute;
  top:0; left:0; right:0;
  height:1px;
  background: linear-gradient(90deg, transparent, var(--glass-border-highlight), transparent);
}

.glass-card {
  background: var(--glass-bg-ultra-light);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  padding: 18px;
  transition: var(--transition);
  position: relative;
}
.glass-card:hover {
  background: var(--glass-bg-medium);
  transform: translateY(-3px);
  box-shadow: var(--glass-shadow);
  border-color: var(--glass-border-highlight);
}

/* SECTION HEADER */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
}
.section-title { font-size:1.1rem; font-weight:700; }

/* 5. STATS GRID */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}
.stat-card {
  background: var(--glass-bg-light);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
  overflow: hidden;
  transition: var(--transition);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  min-height: 110px;
  aspect-ratio: unset;
}
.stat-card::before {
  content:'';
  position:absolute;
  top:0; left:0; right:0;
  height:2px;
  background: var(--card-color, var(--primary));
  opacity: 0.7;
}
.stat-card:hover { transform:translateY(-4px); box-shadow:var(--glass-shadow); }
.stat-card-header { display:flex; justify-content:space-between; align-items:flex-start; }
.stat-icon {
  width: 40px;
  height: 40px;
  min-width: 40px;
  min-height: 40px;
  border-radius: 10px;
  background: var(--card-color-light, rgba(94,234,212,0.15));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  color: var(--card-color, var(--primary));
  flex-shrink: 0;
}
.stat-value { font-size: 1.85rem; font-weight: 700; line-height: 1.1; overflow-wrap: break-word; }
.stat-label { font-size: 0.78rem; color: var(--text-muted); font-weight: 500; }
.stat-change { font-size: 0.75rem; }

/* 6. BUTTONS */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 11px 20px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.25;
  min-height: 42px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: var(--transition);
  white-space: normal;
  overflow-wrap: anywhere;
  text-align: center;
  text-decoration: none;
  background: none;
  color: var(--text-main);
}
.btn:active { transform:scale(0.97); }
.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: #000;
  border-color: transparent;
  box-shadow: 0 0 20px var(--primary-glow);
}
.btn-primary:hover { filter:brightness(1.1); box-shadow:0 0 30px var(--primary-glow); }
.btn-secondary {
  background: var(--glass-bg-light);
  border-color: var(--glass-border);
  color: var(--text-main);
  backdrop-filter: var(--glass-blur);
}
.btn-secondary:hover { background:var(--glass-bg-medium); border-color:var(--primary); }
.btn-danger {
  background: linear-gradient(135deg, var(--danger), #c0392b);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 0 15px var(--danger-glow);
}
.btn-danger:hover { filter:brightness(1.1); }
.btn-success {
  background: linear-gradient(135deg, var(--success), #059669);
  color: #000;
  border-color: transparent;
  box-shadow: 0 0 15px var(--success-glow);
}
.btn-success:hover { filter:brightness(1.1); }
.btn-warning {
  background: linear-gradient(135deg, var(--warning), #d97706);
  color: #000;
  border-color: transparent;
}
.btn-sm { padding:7px 14px; font-size:0.8rem; min-height:34px; }
.btn-lg { padding:12px 28px; font-size:1rem; }
.btn-icon { padding:8px; width:36px; height:36px; border-radius:8px; }
.btn-ghost {
  background: transparent;
  border-color: var(--glass-border);
  color: var(--text-muted);
}
.btn-ghost:hover { background:var(--glass-bg-light); color:var(--text-main); }

/* 7. FORM ELEMENTS */
.form-group { display:flex; flex-direction:column; gap:6px; }
.form-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.form-control {
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  padding: 12px 16px;
  font-size: 0.9rem;
  min-height: 44px;
  width: 100%;
  outline: none;
  transition: var(--transition);
  backdrop-filter: blur(8px);
}
.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}
.form-control::placeholder { color:rgba(148,163,184,0.5); }
select.form-control { cursor:pointer; }
textarea.form-control { resize:vertical; min-height:80px; }

.form-grid { display:grid; grid-template-columns:repeat(auto-fill, minmax(220px, 1fr)); gap:16px; }
.form-row { display:flex; gap:16px; flex-wrap:wrap; }
.form-row .form-group { flex:1; min-width:180px; }

/* SEARCH INPUT */
.search-wrapper { position:relative; }
.search-wrapper .form-control { padding-left:38px; }
.search-icon {
  position:absolute; left:12px; top:50%; transform:translateY(-50%);
  color:var(--text-muted); font-size:0.95rem; pointer-events:none;
}

/* 8. TABLE */
.table-container {
  overflow-x: auto;
  overflow-y: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--glass-border);
  max-height: 70vh;
  min-height: 120px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: var(--glass-border) transparent;
}
.table-container::-webkit-scrollbar { width: 6px; height: 6px; }
.table-container::-webkit-scrollbar-track { background: transparent; }
.table-container::-webkit-scrollbar-thumb { background: var(--glass-border); border-radius: 3px; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}
thead th {
  background: var(--table-header-bg);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 12px 16px;
  text-align: left;
  white-space: nowrap;
  border-bottom: 1px solid var(--glass-border);
  position: sticky;
  top: 0;
  z-index: 2;
}
tbody tr {
  border-bottom: 1px solid var(--glass-border);
  transition: var(--transition);
}
tbody tr:hover { background: var(--glass-bg-ultra-light); }
tbody tr:last-child { border-bottom:none; }
td {
  padding: 10px 16px;
  color: var(--text-main);
  vertical-align: middle;
  white-space: nowrap;   /* ← single line by default */
}
/* Allow wrapping only for cells that need it */
td.wrap, td .wrap, .td-wrap { white-space: normal !important; }

/* 9. MODAL */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition);
}
.modal-overlay.active { opacity:1; visibility:visible; }
.modal {
  background: var(--glass-bg-heavy);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--glass-shadow);
  width: 100%;
  max-width: 700px;
  max-height: 90vh;
  overflow-y: auto;
  transform: translateY(20px) scale(0.97);
  transition: var(--transition);
}
.modal-overlay.active .modal { transform:translateY(0) scale(1); }
.modal-lg { max-width:900px; }
.modal-sm { max-width:480px; }
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--glass-border);
  position: sticky;
  top: 0;
  background: var(--glass-bg-heavy);
  backdrop-filter: blur(20px);
  z-index: 1;
}
.modal-title { font-size:1.1rem; font-weight:700; }
.modal-body { padding:24px; }
.modal-footer {
  display:flex; justify-content:flex-end; align-items:center; gap:10px;
  flex-wrap: wrap;
  padding: 16px 24px;
  border-top: 1px solid var(--glass-border);
  background: var(--glass-bg-light);
}
.modal-footer .btn {
  flex: 0 0 auto;
  min-width: max-content;
}
/* Modal close — icon variant (the ✕ button in the header) */
.modal-close {
  background: var(--glass-bg-light);
  border: 1px solid var(--glass-border);
  color: var(--text-muted);
  border-radius:8px;
  display:flex; align-items:center; justify-content:center;
  cursor:pointer;
  transition:var(--transition);
}
/* Icon-only close (✕ in modal header) */
.modal-header .modal-close {
  width:32px; height:32px;
  font-size:1.1rem;
  flex-shrink: 0;
}
/* Cancel button variant — .btn.modal-close in modal-footer */
.modal-footer .modal-close,
.btn.modal-close {
  width: auto !important;
  height: auto !important;
  min-height: 36px;
  padding: 9px 18px;
  font-size: 0.88rem;
  font-weight: 600;
  background: var(--glass-bg-light);
  border-color: var(--glass-border);
  color: var(--text-main);
}
.modal-close:hover { background:var(--danger); color:#fff; border-color:var(--danger); }
.btn.modal-close:hover { background:var(--glass-bg-medium); color:var(--text-main); border-color:var(--primary); }

/* 10. BADGES */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;        /* ← prevent wrapping like "CONTIN/UE" */
  flex-shrink: 0;
}
.badge-success { background:rgba(52,211,153,0.15); color:var(--success); border:1px solid rgba(52,211,153,0.3); }
.badge-warning { background:rgba(251,191,36,0.15); color:var(--warning); border:1px solid rgba(251,191,36,0.3); }
.badge-danger  { background:rgba(251,113,133,0.15); color:var(--danger);  border:1px solid rgba(251,113,133,0.3); }
.badge-info    { background:rgba(147,197,253,0.15); color:var(--info);    border:1px solid rgba(147,197,253,0.3); }
.badge-primary { background:rgba(94,234,212,0.15);  color:var(--primary); border:1px solid rgba(94,234,212,0.3); }
.badge-secondary { background:var(--glass-bg-ultra-light); color:var(--text-muted); border:1px solid var(--glass-border); }

/* 11. AVATAR */
.avatar {
  width:36px; height:36px;
  border-radius:var(--radius-round);
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  display:flex; align-items:center; justify-content:center;
  font-weight:700; font-size:0.85rem;
  color:#000;
  flex-shrink:0;
  overflow:hidden;
}
.avatar img { width:100%; height:100%; object-fit:cover; }
.avatar-lg { width:56px; height:56px; font-size:1.2rem; }
.avatar-xl { width:80px; height:80px; font-size:1.6rem; }
.profile-image-field {
  display:flex;
  align-items:center;
  gap:16px;
  flex-wrap:wrap;
  padding:14px;
  border:1px solid var(--glass-border);
  border-radius:var(--radius-md);
  background:
    linear-gradient(135deg, rgba(94,234,212,0.12), rgba(139,156,255,0.08)),
    var(--glass-bg-ultra-light);
}
.profile-image-preview {
  width:110px; height:110px;
  border-radius:22px;
  border:1px solid rgba(255,255,255,0.28);
  background:
    linear-gradient(135deg, rgba(255,255,255,0.14), rgba(255,255,255,0.02)),
    var(--glass-bg-ultra-light);
  display:flex; align-items:center; justify-content:center;
  overflow:hidden;
  color:var(--text-muted);
  font-size:0.75rem;
  box-shadow:var(--material-elevation-2), inset 0 1px 0 rgba(255,255,255,0.18);
  position:relative;
  text-align:center;
}
.profile-image-preview img { width:100%; height:100%; object-fit:cover; }
.profile-image-field input[type="file"]::file-selector-button {
  border:0;
  border-radius:8px;
  background:linear-gradient(135deg, var(--primary), var(--secondary));
  color:#000;
  font-weight:700;
  padding:8px 12px;
  margin-right:10px;
  cursor:pointer;
}
.glass-card, .glass-panel, .stat-card { overflow-wrap:anywhere; }

/* 12. TABS */
.tab-nav {
  display: flex;
  gap: 0;
  background: var(--glass-bg-light);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 5px;
  overflow-x: auto;
  flex-wrap: wrap;
}
.tab-btn {
  padding: 9px 18px;
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
  border: none;
  background: none;
  white-space: nowrap;
}
.tab-btn.active {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: #000;
  box-shadow: 0 4px 15px var(--primary-glow);
}
.tab-btn:hover:not(.active) { color:var(--text-main); background:var(--glass-bg-ultra-light); }
.tab-pane { display:none; }
.tab-pane.active { display:block; }

/* 13. CHARTS */
.chart-container {
  position: relative;
  background: var(--glass-bg-light);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 20px;
  backdrop-filter: var(--glass-blur);
}
.charts-grid { display:grid; grid-template-columns:repeat(auto-fill, minmax(300px, 1fr)); gap:20px; }
canvas { max-width:100%; }

/* 14. ATTENDANCE CELLS */
.att-cell {
  padding: 6px 4px;
  text-align: center;
  cursor: pointer;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  transition: var(--transition);
  user-select: none;
  border: 1px solid transparent;
  min-width: 38px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.att-cell[data-status="P"] { background:rgba(52,211,153,0.2); color:var(--success); border-color:rgba(52,211,153,0.4); }
.att-cell[data-status="A"] { background:rgba(251,113,133,0.2); color:var(--danger); border-color:rgba(251,113,133,0.4); }
.att-cell[data-status="L"] { background:rgba(251,191,36,0.2); color:var(--warning); border-color:rgba(251,191,36,0.4); }
.att-cell[data-status=""] { background:var(--glass-bg-ultra-light); color:var(--text-muted); }
.att-cell[data-editable="0"] { opacity: 0.45; cursor: not-allowed; pointer-events: none; }
.att-cell:not([data-editable="0"]):hover { transform:scale(1.12); box-shadow:0 4px 12px rgba(0,0,0,0.2); z-index:1; position:relative; }

/* Sunday column highlight */
th.att-sunday,
td.att-sunday { background: rgba(251,113,133,0.07) !important; }
th.att-sunday { color: var(--danger) !important; }

/* Today column highlight */
th.att-today { background: rgba(94,234,212,0.1) !important; color: var(--primary) !important; }
td.att-today { background: rgba(94,234,212,0.04) !important; }

/* 15. PROGRESS BAR */
.progress-bar-wrap {
  background: var(--glass-bg-ultra-light);
  border-radius:999px;
  height:8px;
  overflow:hidden;
  border:1px solid var(--glass-border);
}
.progress-bar-fill {
  height:100%;
  border-radius:999px;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  transition: width 0.6s cubic-bezier(0.4,0,0.2,1);
  box-shadow: 0 0 8px var(--primary-glow);
}

/* 16. GALLERY */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
}
.gallery-item {
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--glass-border);
  background: var(--glass-bg-light);
  transition: var(--transition);
  position: relative;
  aspect-ratio: 4/3;
  cursor: pointer;
}
.gallery-item:hover { transform:scale(1.03); box-shadow:var(--glass-shadow); }
.gallery-item img { width:100%; height:100%; object-fit:cover; }
.gallery-item-placeholder {
  width:100%; height:100%;
  display:flex; flex-direction:column;
  align-items:center; justify-content:center;
  gap:8px; color:var(--text-muted); font-size:0.82rem;
}
.gallery-overlay {
  position:absolute; inset:0;
  background: linear-gradient(to top, rgba(0,0,0,0.8) 0%, transparent 50%);
  opacity:0; transition:var(--transition);
  display:flex; flex-direction:column; justify-content:flex-end;
  padding:12px;
}
.gallery-item:hover .gallery-overlay { opacity:1; }
.gallery-overlay .item-title { font-size:0.8rem; font-weight:600; color:#fff; }
.gallery-overlay .item-actions { display:flex; gap:6px; margin-top:6px; }

/* 17. TIME TABLE */
.timetable-wrapper { overflow-x:auto; }
.timetable {
  border-collapse: collapse;
  width:100%;
  min-width:600px;
}
.timetable th, .timetable td {
  border: 1px solid var(--glass-border);
  text-align:center;
  font-size:0.82rem;
}
.timetable th {
  background: var(--table-header-bg);
  font-weight:700; font-size:0.75rem;
  text-transform:uppercase; letter-spacing:0.5px;
  color:var(--text-muted);
  padding: 10px 8px;
}
.timetable .time-col { font-weight:700; color:var(--primary); background:var(--glass-bg-light); }

/* Timetable header cells */
.tt-timecol-head {
  position: sticky;
  left: 0;
  top: 0;
  z-index: 5;
  background: var(--table-header-bg) !important;
  min-width: 130px;
  white-space: nowrap;
  padding: 10px 14px;
}
.tt-device-head {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--table-header-bg) !important;
  min-width: 185px;
  white-space: nowrap;
  padding: 10px 12px;
}
.tt-timecol {
  position: sticky;
  left: 0;
  z-index: 1;
  background: var(--glass-bg-heavy) !important;
  font-weight: 700;
  color: var(--primary);
  font-size: 0.82rem;
  padding: 10px 14px;
  white-space: nowrap;
  text-align: left;
  border-right: 2px solid var(--primary);
}
.tt-cell {
  padding: 4px;
  vertical-align: top;
  cursor: pointer;
  transition: background 0.15s;
}
.tt-cell:hover { background: var(--glass-bg-ultra-light); }
.tt-cell-filled { background: rgba(94,234,212,0.04); }
.tt-row:hover .tt-timecol { color: var(--accent); }

/* Cell content */
.timetable-cell-content {
  background: var(--glass-bg-ultra-light);
  border-radius: 6px;
  padding: 7px 8px;
  font-size: 0.78rem;
  line-height: 1.3;
  color: var(--text-main);
  min-height: 64px;
  cursor: pointer;
  transition: box-shadow 0.15s, transform 0.1s;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.timetable-cell-content:hover {
  box-shadow: 0 3px 12px rgba(94,234,212,0.18);
  transform: translateY(-1px);
}
.tt-subject {
  font-weight: 700;
  font-size: 0.83rem;
  color: var(--primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tt-teacher {
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tt-batch-pc {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-top: 2px;
}
.tt-badge-batch {
  font-size: 0.65rem;
  font-weight: 700;
  background: rgba(94,234,212,0.18);
  color: var(--primary);
  border: 1px solid rgba(94,234,212,0.35);
  border-radius: 4px;
  padding: 1px 6px;
  white-space: nowrap;
}
.tt-badge-pc {
  font-size: 0.65rem;
  font-weight: 700;
  background: rgba(147,197,253,0.18);
  color: var(--info);
  border: 1px solid rgba(147,197,253,0.35);
  border-radius: 4px;
  padding: 1px 6px;
  white-space: nowrap;
}
.tt-student-name {
  font-size: 0.72rem;
  color: var(--success);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tt-no-batch {
  font-size: 0.65rem;
  color: var(--text-muted);
  font-weight: 400;
}
.tt-students-list {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  margin-top: 3px;
}
.tt-student-chip {
  font-size: 0.62rem;
  background: rgba(94,234,212,0.1);
  color: var(--primary);
  border-radius: 4px;
  padding: 1px 5px;
  white-space: nowrap;
  border: 1px solid rgba(94,234,212,0.2);
}
.tt-student-chip em {
  font-style: normal;
  color: var(--text-muted);
  font-size: 0.58rem;
}
.tt-chip-more {
  font-size: 0.62rem;
  color: var(--text-muted);
  padding: 1px 4px;
}
.tt-notes {
  font-size: 0.65rem;
  color: var(--text-muted);
  font-style: italic;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tt-empty-cell {
  color: var(--text-muted);
  font-size: 0.73rem;
  text-align: center;
  padding: 10px 4px;
  line-height: 1.6;
  opacity: 0.7;
}

/* 18. LOGIN PAGE */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-gradient);
  background-attachment:fixed;
  padding: 20px;
  position:relative;
  overflow:hidden;
}
.login-page::before {
  content:'';
  position:absolute;
  top:-50%; left:-50%;
  width:200%; height:200%;
  background: radial-gradient(circle at 30% 30%, rgba(94,234,212,0.1) 0%, transparent 50%),
              radial-gradient(circle at 70% 70%, rgba(139,156,255,0.1) 0%, transparent 50%);
  animation: rotate 30s linear infinite;
  pointer-events:none;
}
@keyframes rotate { to { transform:rotate(360deg); } }
.login-container {
  width:100%; max-width:480px;
  background: var(--glass-bg-heavy);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--glass-shadow);
  padding: 48px 40px;
  position:relative;
  z-index:1;
}
.login-logo {
  width:70px; height:70px;
  border-radius:18px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  display:flex; align-items:center; justify-content:center;
  font-size:2rem; font-weight:900; color:#000;
  margin:0 auto 20px;
  box-shadow:0 0 30px var(--primary-glow);
  letter-spacing:0;
}
.login-title { text-align:center; font-size:1.6rem; font-weight:800; margin-bottom:6px; }
.login-subtitle { text-align:center; color:var(--text-muted); font-size:0.85rem; margin-bottom:28px; }
.login-tabs { display:flex; gap:0; background:var(--glass-bg-light); border-radius:10px; padding:4px; margin-bottom:24px; }
.login-tab {
  flex:1; padding:9px; border-radius:8px; text-align:center;
  font-size:0.85rem; font-weight:600; cursor:pointer;
  transition:var(--transition); border:none; background:none; color:var(--text-muted);
}
.login-tab.active { background:linear-gradient(135deg,var(--primary),var(--secondary)); color:#000; }

/* 19. NOTIFICATIONS */
.toast-container {
  position: fixed;
  bottom: 24px; right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.toast {
  background: var(--glass-bg-heavy);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 280px;
  max-width: 400px;
  box-shadow: var(--glass-shadow);
  animation: slideInRight 0.3s ease;
  font-size:0.88rem;
}
.toast.toast-success { border-left:4px solid var(--success); }
.toast.toast-error   { border-left:4px solid var(--danger); }
.toast.toast-warning { border-left:4px solid var(--warning); }
.toast.toast-info    { border-left:4px solid var(--info); }
@keyframes slideInRight {
  from { opacity:0; transform:translateX(100%); }
  to { opacity:1; transform:translateX(0); }
}
@keyframes slideOutRight {
  from { opacity:1; transform:translateX(0); }
  to { opacity:0; transform:translateX(100%); }
}

/* 20. DROPDOWN */
.dropdown { position:relative; }
.dropdown-menu {
  position:absolute; top:calc(100% + 8px); right:0;
  background:var(--glass-bg-heavy);
  backdrop-filter:var(--glass-blur);
  -webkit-backdrop-filter:var(--glass-blur);
  border:1px solid var(--glass-border);
  border-radius:var(--radius-md);
  box-shadow:var(--glass-shadow);
  min-width:180px;
  padding:6px;
  z-index:200;
  opacity:0; visibility:hidden; transform:translateY(-8px);
  transition:var(--transition);
}
.dropdown.open .dropdown-menu { opacity:1; visibility:visible; transform:translateY(0); }
.dropdown-item {
  display:flex; align-items:center; gap:10px;
  padding:10px 12px; border-radius:8px;
  font-size:0.88rem; color:var(--text-muted);
  cursor:pointer; transition:var(--transition);
  border:none; background:none; width:100%; text-align:left;
}
.dropdown-item:hover { background:var(--glass-bg-light); color:var(--text-main); }
.dropdown-divider { height:1px; background:var(--glass-border); margin:4px 0; }

/* 21. THEME TOGGLE */
.theme-toggle {
  background: var(--glass-bg-light);
  border: 1px solid var(--glass-border);
  color: var(--text-main);
  width: 36px; height: 36px;
  border-radius: 10px;
  display:flex; align-items:center; justify-content:center;
  cursor:pointer; font-size:1rem;
  transition:var(--transition);
}
.theme-toggle:hover { background:var(--glass-bg-medium); border-color:var(--accent); color:var(--accent); }

/* 22. UPLOAD AREA */
.upload-area {
  border: 2px dashed var(--glass-border);
  border-radius: var(--radius-md);
  padding: 40px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  background: var(--glass-bg-ultra-light);
}
.upload-area:hover, .upload-area.dragover {
  border-color: var(--primary);
  background: rgba(94,234,212,0.05);
}
.upload-icon { font-size:2.5rem; margin-bottom:12px; color:var(--text-muted); }
.upload-text { font-size:0.88rem; color:var(--text-muted); }

/* 23. FEES LEDGER */
.ledger-row { 
  display:flex; justify-content:space-between; align-items:center;
  padding:12px 16px; border-bottom:1px solid var(--glass-border);
  gap:12px; flex-wrap:wrap;
}
.ledger-row:last-child { border-bottom:none; }
.ledger-row:hover { background:var(--glass-bg-ultra-light); }

/* 24. PROFILE */
.profile-header {
  background: linear-gradient(135deg, rgba(94,234,212,0.15), rgba(139,156,255,0.1));
  border-radius: var(--radius-lg);
  padding: 28px;
  display:flex; gap:20px; align-items:center;
  border: 1px solid var(--glass-border);
  flex-wrap:wrap;
}
.profile-info h3 { font-size:1.3rem; margin-bottom:4px; }
.profile-info .role-badge {
  display:inline-flex; align-items:center; gap:6px;
  background:rgba(94,234,212,0.15);
  color:var(--primary);
  border-radius:999px;
  padding:3px 12px; font-size:0.75rem; font-weight:700;
  text-transform:uppercase; letter-spacing:0.5px;
}
.profile-report-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--glass-border);
}

/* 25. BREADCRUMB */
.breadcrumb {
  display:flex; align-items:center; gap:6px;
  font-size:0.82rem; color:var(--text-muted);
}
.breadcrumb-sep { color:var(--text-muted); opacity:0.5; }
.breadcrumb a { color:var(--primary); transition:var(--transition); }
.breadcrumb a:hover { opacity:0.8; }

/* 26. EMPTY STATE */
.empty-state {
  text-align:center; padding:60px 20px;
  color:var(--text-muted);
}
.empty-state-icon { font-size:3rem; margin-bottom:16px; opacity:0.4; }
.empty-state h3 { font-size:1.1rem; margin-bottom:8px; color:var(--text-main); }

/* 27. MOBILE OVERLAY */
.sidebar-overlay {
  display:none;
  position:fixed; inset:0;
  background:rgba(0,0,0,0.5);
  backdrop-filter:blur(4px);
  z-index:99;
}

/* 28. CERTIFICATE / PRINT STYLES */
.print-preview {
  background: #fff;
  color: #000;
  padding: 40px;
  border-radius: var(--radius-md);
  border: 2px solid var(--glass-border);
  font-family: 'Times New Roman', serif;
  max-width: 800px;
  margin: 0 auto;
}
@media print {
  .sidebar, .top-header, .header-right, .no-print { display:none !important; }
  .main-content { width:100%; }
  body { background:#fff; color:#000; }
}

/* 29. RESPONSIVE */
@media (max-width: 1024px) {
  .stats-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
  .charts-grid { grid-template-columns: 1fr; }
  .content-area { padding:20px; min-height:0; overflow-y:auto; }
}

@media (max-width: 768px) {
  :root { --sidebar-width:0px; }
  .sidebar {
    position:fixed;
    left:-300px;
    width:280px;
    flex:0 0 280px;
    z-index:200;
    transition:left 0.3s ease;
  }
  .sidebar.mobile-open { left:0; }
  .sidebar.mobile-open + .sidebar-overlay { display:block; }
  .sidebar-overlay { display:none; }
  .main-content { width:100%; }
  .stats-grid { grid-template-columns:repeat(2, 1fr); }
  .top-header { padding:0 16px; }
  .content-area { padding:16px; gap:16px; min-height:0; overflow-y:auto; }
  .form-grid { grid-template-columns:1fr; }
  .gallery-grid { grid-template-columns:repeat(2, 1fr); }
  .login-container { padding:32px 22px; }
  .modal { margin:10px; max-width:calc(100vw - 20px); }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns:1fr 1fr; }
  .gallery-grid { grid-template-columns:repeat(2,1fr); }
  h1 { font-size:1.6rem; }
  .tab-btn { padding:8px 12px; font-size:0.8rem; }
}

/* 30. ANIMATIONS */
@keyframes fadeIn { from{opacity:0} to{opacity:1} }
@keyframes fadeInUp { from{opacity:0;transform:translateY(16px)} to{opacity:1;transform:translateY(0)} }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:0.5} }
@keyframes spin { to{transform:rotate(360deg)} }

.fade-in { animation:fadeIn 0.3s ease; }
.fade-in-up { animation:fadeInUp 0.4s ease; }
.animate-pulse { animation:pulse 2s infinite; }
.animate-spin { animation:spin 1s linear infinite; }

/* 31. GLOW EFFECTS */
.glow-primary { box-shadow:0 0 20px var(--primary-glow); }
.glow-success  { box-shadow:0 0 15px var(--success-glow); }
.glow-danger   { box-shadow:0 0 15px var(--danger-glow); }

/* 32. CUSTOM CHECKBOX */
.checkbox-group { display:flex; align-items:center; gap:8px; cursor:pointer; }
.checkbox-group input[type="checkbox"] {
  width:17px; height:17px; accent-color:var(--primary); cursor:pointer;
}

/* 33. LOADER */
.loader {
  width:36px; height:36px;
  border:3px solid var(--glass-border);
  border-top-color:var(--primary);
  border-radius:50%;
  animation:spin 0.8s linear infinite;
  margin:0 auto;
}

/* 34. TOOLTIP */
[data-tooltip] { position:relative; }
[data-tooltip]:hover::after {
  content:attr(data-tooltip);
  position:absolute; bottom:calc(100% + 8px); left:50%; transform:translateX(-50%);
  background:var(--glass-bg-heavy);
  border:1px solid var(--glass-border);
  color:var(--text-main);
  padding:6px 10px; border-radius:6px; font-size:0.75rem;
  white-space:nowrap; pointer-events:none; z-index:999;
  box-shadow:var(--glass-shadow);
}

/* 35. PDF VIEWER */
.pdf-viewer-frame {
  width:100%; min-height:500px;
  border:1px solid var(--glass-border);
  border-radius:var(--radius-md);
  background:#fff;
}

/* 36. MATERIAL + LIQUID GLASS POLISH */
.brand-icon,
.login-logo {
  position: relative;
  isolation: isolate;
  box-shadow: var(--material-elevation-2), 0 0 28px var(--primary-glow);
}
.brand-icon::after,
.login-logo::after {
  content: "✦";
  position: absolute;
  right: -5px;
  bottom: -7px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 0.62rem;
  color: #111827;
  background: linear-gradient(135deg, var(--accent), var(--coral));
  border: 1px solid rgba(255,255,255,0.65);
}
.glass-panel,
.stat-card,
.chart-container,
.login-container {
  box-shadow: var(--material-elevation-2), var(--glass-shadow);
}
.glass-panel::after,
.stat-card::after,
.chart-container::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  background: var(--liquid-highlight);
  opacity: 0.34;
}
.glass-panel > *,
.stat-card > *,
.chart-container > * {
  position: relative;
  z-index: 1;
}
.nav-icon {
  width: 28px !important;
  height: 28px;
  display: inline-grid;
  place-items: center;
  border-radius: 8px;
  background: rgba(255,255,255,0.07);
  border: 1px solid var(--glass-border);
  box-shadow: inset 1px 1px 0 rgba(255,255,255,0.12);
}
.nav-item.active .nav-icon {
  background: linear-gradient(135deg, rgba(94,234,212,0.25), rgba(251,191,36,0.16));
}
.btn {
  min-height: 42px;
  justify-content: center;
  box-shadow: var(--material-elevation-1);
}
.btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--material-elevation-2);
}
.btn:active {
  transform: translateY(0) scale(0.98);
  box-shadow: var(--neo-pressed);
}
.form-control,
.tab-nav,
.theme-toggle,
.toggle-sidebar-btn {
  box-shadow: inset 1px 1px 0 rgba(255,255,255,0.06), var(--material-elevation-1);
}
.readonly-field {
  display: flex;
  align-items: center;
  min-height: 42px;
  background: var(--glass-bg-ultra-light);
  color: var(--primary);
  font-weight: 700;
}
.device-head-icon {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  margin-right: 4px;
  border-radius: 7px;
  background: rgba(56,189,248,0.12);
  border: 1px solid rgba(56,189,248,0.24);
}
.device-chip-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 10px;
  background: var(--glass-bg-ultra-light);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  margin-bottom: 6px;
}
.timetable-cell-content {
  min-height: 58px;
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: inset 1px 1px 0 rgba(255,255,255,0.08);
}
.timetable td:hover .timetable-cell-content {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-glow), var(--material-elevation-1);
}
.backend-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(280px, 0.75fr);
  gap: 20px;
  align-items: start;
}
.backend-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-top: 16px;
}
.backend-note {
  margin-top: 16px;
  line-height: 1.7;
}
.database-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
}
.database-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--glass-bg-ultra-light);
  border: 1px solid var(--glass-border);
}
.database-pill-icon {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: rgba(192,132,252,0.14);
  border: 1px solid rgba(192,132,252,0.24);
}
.database-pill strong {
  margin-left: auto;
  color: var(--primary);
  font-size: 1.05rem;
}
.storage-hub-layout {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
  gap: 20px;
  align-items: start;
}
.storage-action-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 10px;
  margin-top: 14px;
}
.storage-summary-grid,
.backend-adapter-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}
.storage-mini-card {
  display: flex;
  min-height: 74px;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
  padding: 12px 14px;
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  background: var(--glass-bg-ultra-light);
}
.storage-mini-card span {
  color: var(--text-muted);
  font-size: 0.78rem;
}
.storage-mini-card strong {
  color: var(--text-primary);
  font-size: 1.05rem;
}
.storage-adapter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
}
.storage-adapter-card {
  min-height: 188px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 15px;
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  background: var(--glass-bg-ultra-light);
}
.storage-adapter-top,
.storage-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}
.storage-adapter-group,
.storage-meta span,
.storage-state {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--glass-border);
  background: var(--glass-bg-light);
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 700;
}
.storage-adapter-card h4 {
  margin: 0;
  font-size: 1rem;
  color: var(--text-primary);
}
.storage-adapter-card p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.82rem;
  line-height: 1.55;
}
.storage-state.is-live {
  color: var(--success);
  border-color: color-mix(in srgb, var(--success) 42%, transparent);
}
.storage-state.is-ready {
  color: var(--primary);
  border-color: color-mix(in srgb, var(--primary) 42%, transparent);
}
.storage-state.is-credential {
  color: var(--warning);
  border-color: color-mix(in srgb, var(--warning) 42%, transparent);
}
.storage-state.is-blueprint {
  color: var(--secondary);
  border-color: color-mix(in srgb, var(--secondary) 42%, transparent);
}
.storage-scroll-panel {
  max-height: 760px;
  overflow: auto;
  padding-right: 4px;
}

@media (max-width: 900px) {
  .backend-grid,
  .storage-hub-layout,
  .content-area > div[style*="grid-template-columns:280px 1fr"],
  .content-area > div[style*="grid-template-columns:1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }
  .header-right {
    justify-content: flex-start;
  }
}

@media (max-width: 768px) {
  .top-header {
    height: auto;
    min-height: var(--header-height);
    padding: 12px 16px;
    align-items: flex-start;
    flex-wrap: wrap;
  }
  .header-left {
    width: 100%;
    min-width: 0;
  }
  .header-right {
    width: 100%;
    gap: 8px;
  }
  .page-title {
    font-size: 1rem;
    line-height: 1.25;
  }
  .page-subtitle {
    font-size: 0.74rem;
  }
  .glass-panel {
    padding: 18px;
    border-radius: 12px;
  }
  .modal-footer {
    gap: 8px;
  }
  .modal-footer .btn {
    flex: 1 1 auto;
    min-width: max-content;
  }
  .btn {
    white-space: normal;
  }
  .table-container table,
  .timetable {
    font-size: 0.78rem;
  }
}

@media (max-width: 520px) {
  .stats-grid,
  .database-summary,
  .backend-actions,
  .storage-action-grid,
  .storage-summary-grid,
  .backend-adapter-summary,
  .storage-adapter-grid {
    grid-template-columns: 1fr !important;
  }
  .content-area {
    padding: 12px;
  }
  .glass-card,
  .stat-card {
    padding: 14px;
  }
  .toast-container {
    left: 12px;
    right: 12px;
    bottom: 12px;
  }
  .toast {
    min-width: 0;
    max-width: none;
  }
}

/* =========================================================
   UI BUTTON FIXES — Auto-sizing & Container Visibility
   ========================================================= */

/* Ensure buttons in section-header never overflow */
.section-header .btn,
.section-header a.btn {
  flex-shrink: 0;
  white-space: nowrap;
}

/* Filter button rows — allow scroll on tiny screens */
.notif-filter-btn,
.cat-filter-btn,
.task-tab-btn,
.notes-filter-btn,
.s-notes-filter {
  flex-shrink: 0;
  white-space: nowrap;
}

/* Notes/Syllabus filter tabs (teacher + student) — same gradient pill design
   used by the Notes / Syllabus Reviews sub-tabs above, so both rows of tabs
   look identical on the teacher and student side. */
.notes-filter-btn.active,
.s-notes-filter.active {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: #000;
  border-color: transparent;
  box-shadow: 0 0 20px var(--primary-glow);
}
.notes-filter-btn.active:hover,
.s-notes-filter.active:hover {
  filter: brightness(1.1);
}

/* Common filter-row wrapper pattern */
[class*="filter-row"],
[class*="filter-bar"],
.btn-row,
.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

/* Buttons inside any flex/grid container should size to content */
.btn {
  min-width: max-content;
}

/* But full-width buttons stay full width */
.btn.w-full {
  min-width: 0;
  width: 100%;
}

/* Header-right on all screen sizes — scroll horizontally if buttons overflow.
   overflow-y is explicitly "visible" here on purpose: without it, the browser
   silently computes overflow-y:auto too (CSS spec quirk when only one axis is
   set), which showed up as a phantom vertical scrollbar/gutter at the right
   edge of the header whenever its content was even a pixel taller than the row. */
.header-right {
  overflow-x: auto;
  overflow-y: visible;
  padding-bottom: 2px; /* micro gap for scrollbar */
}

/* Ensure the main content area clips horizontally so buttons don't cause page scroll */
.content-area {
  min-width: 0;
  overflow-x: hidden;
}

/* glass-panel and glass-card: allow button children to be fully visible */
.glass-card {
  overflow: visible;
}

/* Restore overflow:hidden only on decorative pseudo-elements' parents via z-index context */
.glass-panel.has-overflow-deco,
.stat-card {
  overflow: hidden;
}

/* section-header wraps gracefully */
.section-header {
  overflow: visible;
  min-width: 0;
}

/* Modal footer on small screens — stack buttons full-width */
@media (max-width: 480px) {
  .modal-footer {
    flex-direction: column-reverse;
    align-items: stretch;
  }
  .modal-footer .btn {
    width: 100%;
    min-width: 0;
    justify-content: center;
  }
  /* Cancel button stays readable */
  .modal-footer .modal-close,
  .modal-footer .btn-secondary {
    order: 1;
  }
  .modal-footer .btn-primary,
  .modal-footer .btn-danger {
    order: 0;
  }
}

/* Tab-nav scrollable on mobile without clipping */
@media (max-width: 600px) {
  .tab-nav {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .tab-nav::-webkit-scrollbar { display: none; }
  .tab-btn {
    flex-shrink: 0;
  }
}

/* Filter buttons in notifications/notes/tasks wrap on small screens */
@media (max-width: 600px) {
  .notif-filter-btn,
  .cat-filter-btn,
  .task-tab-btn,
  .notes-filter-btn,
  .s-notes-filter {
    font-size: 0.75rem;
    padding: 5px 10px;
    min-height: 30px;
  }
}

/* Dropdown triggers — prevent squashing */
[data-dropdown-trigger] {
  flex-shrink: 0;
  white-space: nowrap;
}

/* Ensure all .btn children of .header-right are visible */
.header-right .btn,
.header-right a.btn {
  flex-shrink: 0;
}

/* =========================================================
   ATTENDANCE TABLE SCROLL WRAPPER
   ========================================================= */
.att-scroll-wrap {
  position: relative;
}
/* ══════════════════════════════════════════════════════════
   ATTENDANCE TABLE PANEL
   ══════════════════════════════════════════════════════════ */
.att-table-panel {
  padding: 0 !important;
  overflow: hidden !important;
  display: flex;
  flex-direction: column;
  height: 1000px;
  min-height: 1000px;
  max-height: 1000px;
}
.att-table-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--glass-border);
  flex-shrink: 0;
}
#attendanceTableWrap {
  flex: 1;
  overflow: hidden;
  min-height: 0;
}

/* ── Attendance scroll container ─────────────────────────── */
.att-scroll-wrap {
  position: relative;
  height: 100%;
}
.att-scroll-inner {
  overflow-x: auto;
  overflow-y: auto;
  height: 100%;
  min-height: 0;
  padding: 0;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: var(--primary) transparent;
}
.att-scroll-inner::-webkit-scrollbar { width: 8px; height: 8px; }
.att-scroll-inner::-webkit-scrollbar-track { background: var(--glass-bg-ultra-light); }
.att-scroll-inner::-webkit-scrollbar-thumb {
  background: var(--primary);
  border-radius: 4px;
}
.att-scroll-inner::-webkit-scrollbar-corner { background: transparent; }

/* ── Left/Right scroll buttons ───────────────────────────── */
.att-scroll-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
  width: 28px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--glass-bg-heavy);
  border: 1px solid var(--glass-border);
  cursor: pointer;
  color: var(--text-main);
  font-size: 0.9rem;
  transition: var(--transition);
  opacity: 0.9;
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
}
.att-scroll-btn:hover { background: var(--primary); color: var(--bg-deep-1); opacity: 1; }
.att-scroll-btn.scroll-left  { left: 0;  border-radius: 0 6px 6px 0; }
.att-scroll-btn.scroll-right { right: 0; border-radius: 6px 0 0 6px; }
.att-scroll-btn.hidden { opacity: 0; pointer-events: none; }

/* ══════════════════════════════════════════════════════════
   TIMETABLE GRID PANEL
   ══════════════════════════════════════════════════════════ */
.tt-grid-panel {
  padding: 0 !important;
  overflow: hidden !important;
  display: flex;
  flex-direction: column;
  height: 1000px;
  min-height: 1000px;
  max-height: 1000px;
}
.tt-grid-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--glass-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}
#timetableWrap {
  flex: 1;
  overflow-x: auto;
  overflow-y: auto;
  min-height: 0;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: var(--primary) transparent;
}
#timetableWrap::-webkit-scrollbar { width: 8px; height: 8px; }
#timetableWrap::-webkit-scrollbar-track { background: var(--glass-bg-ultra-light); }
#timetableWrap::-webkit-scrollbar-thumb {
  background: var(--primary);
  border-radius: 4px;
}
#timetableWrap::-webkit-scrollbar-corner { background: transparent; }

.tt-scroll-inner {
  display: inline-block;
  min-width: 100%;
}


/* =========================================================
   DASHBOARD IMPROVEMENTS
   ========================================================= */

/* Quick links grid — uniform card tiles */
.quick-links-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 12px;
}
.quick-link-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 18px 10px 14px;
  text-decoration: none;
  border-radius: var(--radius-md);
  background: var(--glass-bg-light);
  border: 1px solid var(--glass-border);
  transition: var(--transition);
  gap: 8px;
  min-height: 90px;
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
}
.quick-link-card:hover {
  background: var(--glass-bg-medium);
  border-color: var(--primary);
  transform: translateY(-3px);
  box-shadow: 0 8px 24px var(--primary-glow);
}
.quick-link-card .ql-icon { font-size: 1.8rem; line-height: 1; }
.quick-link-card .ql-label { font-size: 0.78rem; font-weight: 600; color: var(--text-main); text-align: center; line-height: 1.3; }

/* Dashboard two-col layout responsive */
.dash-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
@media (max-width: 768px) {
  .dash-two-col { grid-template-columns: 1fr; }
  .quick-links-grid { grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); }
}

/* Stat card on small screens */
@media (max-width: 520px) {
  .stat-card { min-height: 90px; padding: 14px; }
  .stat-value { font-size: 1.5rem; }
  .stat-icon { width: 34px; height: 34px; min-width: 34px; min-height: 34px; font-size: 1rem; }
}

/* =========================================================
   RESPONSIVE BREAKPOINTS + HEADER NOTICE POPUP
   ========================================================= */

.header-notif {
  position: relative;
  flex: 0 0 auto;
}
.header-notif-btn {
  position: relative;
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 10px;
}
.header-notif-badge {
  position: absolute;
  top: -7px;
  right: -7px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  display: none;
  place-items: center;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  border: 2px solid var(--bg-deep-2);
  font-size: 0.66rem;
  line-height: 1;
  font-weight: 800;
}
.header-notif-panel {
  position: fixed;
  top: calc(var(--header-height) + 12px);
  right: 18px;
  width: min(380px, calc(100vw - 24px));
  max-height: min(520px, calc(100vh - 110px));
  overflow-y: auto;
  background: var(--glass-bg-heavy);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  box-shadow: var(--material-elevation-3), var(--glass-shadow);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  z-index: 950;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: var(--transition);
}
.header-notif.open .header-notif-panel {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.header-notif-head {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--glass-bg-heavy);
  border-bottom: 1px solid var(--glass-border);
}
.header-notif-list {
  display: grid;
  gap: 8px;
  padding: 10px;
}
.header-notif-item {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  padding: 11px;
  border-radius: 10px;
  border: 1px solid var(--glass-border);
  background: var(--glass-bg-ultra-light);
}
.header-notif-item.unread {
  border-color: rgba(94,234,212,0.38);
  background: linear-gradient(135deg, rgba(94,234,212,0.13), rgba(251,191,36,0.06));
}
.header-notif-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: rgba(255,255,255,0.08);
  border: 1px solid var(--glass-border);
}
.header-notif-title {
  font-size: 0.86rem;
  font-weight: 800;
  line-height: 1.25;
}
.header-notif-msg {
  color: var(--text-muted);
  font-size: 0.78rem;
  line-height: 1.45;
  margin-top: 3px;
}
.header-notif-foot {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 10px;
  border-top: 1px solid var(--glass-border);
}

/* Extra small mobile phones: less than 576px */
@media (max-width: 575.98px) {
  html { font-size: 14px; }
  h1 { font-size: 1.45rem; }
  h2 { font-size: 1.25rem; }
  .top-header {
    padding: 10px 12px;
    gap: 10px;
  }
  .header-left,
  .header-right {
    width: 100%;
  }
  .header-right {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }
  .content-area {
    padding: 12px;
    gap: 14px;
  }
  .stats-grid,
  .charts-grid,
  .form-grid,
  .database-summary,
  .backend-actions,
  .quick-links-grid,
  .dash-two-col,
  .content-area [style*="grid-template-columns:1fr 1fr"],
  .content-area [style*="grid-template-columns:280px 1fr"],
  .content-area [style*="grid-template-columns:repeat(4,1fr)"],
  .content-area [style*="grid-template-columns:repeat(auto-fill,minmax(320px,1fr))"] {
    grid-template-columns: 1fr !important;
  }
  .profile-header,
  .profile-image-field {
    align-items: stretch;
  }
  .profile-image-preview {
    width: 96px;
    height: 96px;
  }
  .modal-overlay {
    align-items: flex-start;
    padding: 10px;
  }
  .modal {
    max-height: calc(100dvh - 20px);
  }
  .table-container,
  .timetable-wrapper,
  #attendanceTableWrap,
  #timetableWrap {
    max-width: 100%;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
  }
  .att-table-panel,
  .tt-grid-panel {
    height: 700px !important;
    min-height: 700px !important;
    max-height: 700px !important;
  }
  table {
    min-width: 680px;
  }
  .toast {
    width: 100%;
  }
  .header-notif-panel {
    top: 92px;
    right: 12px;
  }
}

/* Small mobile phones: 576px and up */
@media (min-width: 576px) and (max-width: 767.98px) {
  .stats-grid,
  .quick-links-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .content-area [style*="grid-template-columns:1fr 1fr"],
  .content-area [style*="grid-template-columns:280px 1fr"],
  .content-area [style*="grid-template-columns:repeat(4,1fr)"] {
    grid-template-columns: 1fr !important;
  }
}

/* Tablet portrait: 768px to 991px */
@media (min-width: 768px) and (max-width: 991.98px) {
  :root { --sidebar-width: 0px; }
  .sidebar {
    position: fixed;
    left: -300px;
    width: 280px;
    flex: 0 0 280px;
    z-index: 200;
    transition: left 0.3s ease;
  }
  .sidebar.mobile-open { left: 0; }
  .sidebar.mobile-open + .sidebar-overlay { display: block; }
  .main-content { width: 100%; }
  .content-area [style*="grid-template-columns:1fr 1fr"],
  .content-area [style*="grid-template-columns:280px 1fr"],
  .content-area [style*="grid-template-columns:repeat(4,1fr)"] {
    grid-template-columns: 1fr !important;
  }
  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Laptop landscape: 992px and up */
@media (min-width: 992px) {
  .top-header {
    min-height: var(--header-height);
  }
  .content-area {
    gap: 24px;
  }
  .modal-lg {
    max-width: min(1040px, calc(100vw - 52px));
  }
}

/* Desktop: 1200px and up */
@media (min-width: 1200px) {
  .stats-grid {
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  }
  .content-area {
    padding: 30px;
  }
}

/* Extra large desktop: 1400px and up */
@media (min-width: 1400px) {
  .content-area {
    max-width: 1480px;
    width: 100%;
    margin-inline: auto;
  }
  .modal-lg {
    max-width: 1120px;
  }
}

/* Public website and blog responsive polish */
@media (max-width: 991.98px) {
  .blog-main {
    grid-template-columns: 1fr !important;
  }
  .blog-sidebar {
    position: static !important;
  }
}

@media (max-width: 767.98px) {
  .pub-nav {
    height: auto !important;
    min-height: 64px;
    padding: 10px 12px !important;
    flex-wrap: wrap;
    gap: 10px !important;
  }
  .pub-nav-brand {
    min-width: 0;
  }
  .pub-nav-links {
    display: none !important;
  }
  .pub-nav-cta,
  .pub-nav > div:last-child {
    width: 100%;
    display: flex;
    gap: 8px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .hero {
    min-height: auto !important;
    padding: 130px 14px 56px !important;
  }
  .hero-stats {
    gap: 14px !important;
  }
  .hero-stat {
    flex: 1 1 130px;
  }
  .pub-section,
  .blog-hero,
  .blog-main {
    padding-left: 14px !important;
    padding-right: 14px !important;
  }
  .grid-2,
  .grid-3,
  .grid-4,
  .role-grid {
    grid-template-columns: 1fr !important;
  }
  .module-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
  .post-panel {
    padding: 26px 18px !important;
  }
}

/* =========================================================
   FINAL RESPONSIVE CONTRACT
   Breakpoints: <576, >=576, >=768, >=992, >=1200, >=1400
   ========================================================= */
.content-area [style*="grid-template-columns"],
.modal-body [style*="grid-template-columns"],
.backend-grid,
.dash-two-col,
.responsive-grid,
.landscape-layout,
.portrait-stack {
  min-width: 0;
}

.landscape-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 20px;
}

.portrait-stack {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.table-container,
.header-right,
.tab-nav,
.nav-menu,
.modal,
.header-notif-panel {
  scrollbar-gutter: stable;
}

.people-actions .btn {
  min-width: 0;
}

.profile-image-field {
  display: grid;
  grid-template-columns: 118px minmax(0, 1fr);
  align-items: center;
  gap: 18px;
  overflow: hidden;
}

.profile-image-field .form-group {
  min-width: 0 !important;
}

.profile-image-preview {
  justify-self: center;
}

.profile-report-actions .btn {
  min-width: 0;
}

/* Extra small mobile phones: less than 576px */
@media (max-width: 575.98px) {
  .app-wrapper,
  .main-content {
    min-height: 100dvh;
  }

  .top-header {
    position: sticky;
  }

  .header-left {
    align-items: flex-start;
  }

  .header-right {
    max-width: 100%;
    padding-bottom: 4px;
  }

  .header-right > * {
    flex: 0 0 auto;
  }

  .content-area {
    overflow-y: auto;
  }

  .section-header {
    align-items: stretch;
  }

  .section-header .btn,
  .profile-report-actions .btn,
  .people-actions .btn {
    width: 100%;
  }

  .profile-image-field {
    grid-template-columns: 1fr;
    justify-items: stretch;
    text-align: left;
    padding: 12px;
  }

  .profile-image-preview {
    width: 104px;
    height: 104px;
    justify-self: start;
  }

  .profile-header {
    display: grid;
    grid-template-columns: 1fr;
    padding: 18px;
  }

  .profile-header > div[style*="margin-left:auto"] {
    margin-left: 0 !important;
    text-align: left !important;
  }

  .modal-body {
    padding: 16px;
  }

  .modal-body .form-group[style*="grid-column:span"],
  .form-grid .form-group[style*="grid-column:span"] {
    grid-column: auto !important;
  }

  .table-container {
    max-height: calc(100dvh - 240px);
    overflow: auto !important;
  }

  .content-area [style*="display:grid"],
  .content-area [style*="grid-template-columns"],
  .modal-body [style*="grid-template-columns"],
  .landscape-layout,
  .dash-two-col,
  .backend-grid {
    grid-template-columns: 1fr !important;
  }
}

/* Small mobile phones: 576px and up */
@media (min-width: 576px) and (max-width: 767.98px) {
  .content-area [style*="display:grid"],
  .content-area [style*="grid-template-columns"],
  .modal-body [style*="grid-template-columns"],
  .landscape-layout,
  .dash-two-col,
  .backend-grid {
    grid-template-columns: 1fr !important;
  }

  .table-container {
    max-height: calc(100dvh - 230px);
    overflow: auto !important;
  }
}

/* Tablet portrait: 768px to 991px */
@media (min-width: 768px) and (max-width: 991.98px) {
  .content-area [style*="grid-template-columns:1fr 1fr"],
  .content-area [style*="grid-template-columns:280px 1fr"],
  .modal-body [style*="grid-template-columns:1fr 1fr"],
  .landscape-layout,
  .dash-two-col,
  .backend-grid {
    grid-template-columns: 1fr !important;
  }

  .table-container {
    overflow: auto !important;
  }
}

/* Laptop landscape: 992px and up */
@media (min-width: 992px) {
  .landscape-layout {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }

  .top-header {
    flex-direction: row;
  }
}

/* Desktop: 1200px and up */
@media (min-width: 1200px) {
  .landscape-layout {
    gap: 24px;
  }

  .profile-image-field {
    grid-template-columns: 126px minmax(0, 1fr);
  }
}

/* Extra large desktop: 1400px and up */
@media (min-width: 1400px) {
  :root {
    --sidebar-width: 300px;
  }

  .stats-grid {
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  }
}

/* ==========================================================================
   UPGRADE PATCH v2 — Import, Profiles, Canva-style UI, Scroll fixes
   ========================================================================== */

/* ---- ONE SCREEN HEIGHT — handled in core layout above ---- */
/* patch placeholder kept for reference */

/* ---- CANVA-STYLE PANELS (hide/show) ---- */
.canva-panel {
  position: relative;
  background: var(--glass-bg-medium);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: var(--transition);
}
.canva-panel.collapsed { max-height: 52px; overflow: hidden; }
.canva-panel.collapsed .canva-panel-body { display: none; }
.canva-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  cursor: pointer;
  user-select: none;
  gap: 10px;
  border-bottom: 1px solid var(--glass-border);
}
.canva-panel-header:hover { background: var(--glass-bg-ultra-light); }
.canva-toggle-btn {
  background: none; border: none;
  color: var(--text-muted); font-size: 1rem; cursor: pointer;
  padding: 2px 6px; border-radius: 4px; transition: var(--transition);
  line-height: 1;
}
.canva-toggle-btn:hover { background: var(--glass-bg-ultra-light); color: var(--text-main); }
.canva-panel-body { padding: 16px; }

/* ---- COMPACT TABLE ROWS (more data visible) ---- */
.table-compact td, .table-compact th { padding: 5px 10px; font-size: 0.8rem; }
.table-compact tr { line-height: 1.3; }

/* ---- STICKY FILTER BAR ---- */
.sticky-filters {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--glass-bg-heavy);
  backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid var(--glass-border);
  padding: 10px 16px;
  margin: -20px -24px 16px -24px;
}

/* ---- PROFILE PAGE ---- */
.profile-page-wrap { padding-bottom: 32px; }
.profile-hero { margin-bottom: 20px; }

/* ---- STATUS TABS (continuous student selection) ---- */
.status-tab-bar {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  padding: 8px;
  background: var(--glass-bg-ultra-light);
  border-radius: var(--radius-md);
  border: 1px solid var(--glass-border);
}
.status-tab {
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  background: none;
  color: var(--text-muted);
  transition: var(--transition);
  white-space: nowrap;
}
.status-tab:hover { background: var(--glass-bg-ultra-light); color: var(--text-main); }
.status-tab.active { background: var(--primary); color: var(--bg-deep-1); border-color: var(--primary); }
.status-tab.st-pending.active { background: var(--warning); color: var(--bg-deep-1); }
.status-tab.st-continue.active { background: var(--primary); color: var(--bg-deep-1); }
.status-tab.st-complete.active { background: var(--success); color: var(--bg-deep-1); }
.status-tab.st-leave.active { background: var(--accent); color: var(--bg-deep-1); }
.status-tab.st-left.active { background: var(--danger); color: #fff; }

/* ---- IMPORT BUTTON ---- */
.btn-import { background: linear-gradient(135deg, #0f766e, #047857); color: #fff; border: none; }
.btn-import:hover { background: linear-gradient(135deg, #0d9488, #059669); }

/* ---- IMPORT DROP ZONE ---- */
#importDropZone:hover { border-color: var(--accent); background: var(--glass-bg-light) !important; transform: scale(1.01); }

/* ---- RESPONSIVE — FULL WIDTH ON MOBILE ---- */
@media (max-width: 768px) {
  .content-area { padding: 12px 14px; }
  .sticky-filters { margin: -12px -14px 12px -14px; padding: 8px 12px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .profile-hero > div > div:last-child { display: none; }
}

/* ---- MULTI-DASHBOARD SHEET (tabs) ---- */
.dashboard-tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--glass-border);
  margin-bottom: 20px;
  overflow-x: auto;
  scrollbar-width: none;
}
.dashboard-tabs::-webkit-scrollbar { display: none; }
.dashboard-tab {
  padding: 10px 18px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  background: none;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  white-space: nowrap;
  transition: var(--transition);
}
.dashboard-tab:hover { color: var(--text-main); }
.dashboard-tab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ---- EXCEL EXPORT SHEET LABEL ---- */
.sheet-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  background: var(--glass-bg-ultra-light);
  border: 1px solid var(--glass-border);
  color: var(--text-muted);
}

/* ---- STUDENT CONTINUOUS SELECTOR ---- */
.student-selector-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 320px;
  overflow-y: auto;
  padding-right: 4px;
}
.student-selector-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: 1px solid transparent;
  transition: var(--transition);
  font-size: 0.85rem;
}
.student-selector-item:hover { background: var(--glass-bg-ultra-light); border-color: var(--glass-border); }
.student-selector-item.selected { background: rgba(94,234,212,0.1); border-color: var(--primary); }
.student-selector-item .ss-avatar {
  width: 30px; height: 30px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.72rem;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: var(--bg-deep-1); flex-shrink: 0;
}

/* ---- NOTIFICATION BADGE RING ---- */
.nav-badge-ring {
  display: inline-block;
  min-width: 18px; height: 18px;
  background: var(--danger); color: #fff;
  border-radius: 999px; font-size: 0.65rem;
  font-weight: 700; padding: 0 4px;
  line-height: 18px; text-align: center;
}

/* ---- GALLERY GRID ---- */
.gallery-masonry {
  columns: 3;
  column-gap: 12px;
}
@media (max-width: 900px) { .gallery-masonry { columns: 2; } }
@media (max-width: 540px) { .gallery-masonry { columns: 1; } }
.gallery-card {
  break-inside: avoid;
  margin-bottom: 12px;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--glass-border);
  background: var(--glass-bg-ultra-light);
  transition: var(--transition);
}
.gallery-card:hover { transform: scale(1.02); box-shadow: var(--material-elevation-2); }

/* ---- REPORTS EXPORT GRID ---- */
.export-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

/* ---- TASK BOARD ---- */
.task-kanban {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
  align-items: start;
}
.task-column-header {
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ---- INTERNSHIP CARD ---- */
.internship-card {
  background: var(--glass-bg-ultra-light);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  transition: var(--transition);
}
.internship-card:hover { border-color: var(--primary); box-shadow: var(--material-elevation-2); }

/* ---- NOTES CARD ---- */
.note-card {
  background: var(--glass-bg-ultra-light);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 14px;
  position: relative;
  transition: var(--transition);
}
.note-card:hover { border-color: var(--secondary); }
.note-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 4px; height: 100%;
  border-radius: var(--radius-md) 0 0 var(--radius-md);
  background: var(--primary);
}

/* ---- DAILY TOPIC ROW STATUS COLORS ---- */
tr[data-topic-status="Completed"] td:first-child { border-left: 3px solid var(--success); }
tr[data-topic-status="In Progress"] td:first-child { border-left: 3px solid var(--primary); }
tr[data-topic-status="Pending"] td:first-child { border-left: 3px solid var(--warning); }

/* ---- IMPORT MODAL POLISH ---- */
#excelImportModal .modal { border-top: 3px solid var(--primary); }

/* ---- PROFILE MODAL ---- */
#profileViewModal .modal { border-top: 3px solid var(--secondary); }

/* ---- SCROLL POSITION MEMORY ---- */
[data-scroll-restore] { scroll-behavior: smooth; }

/* ---- HOVER TOOLTIP ---- */
[data-tip] { position: relative; cursor: help; }
[data-tip]:hover::after {
  content: attr(data-tip);
  position: absolute; bottom: 110%; left: 50%; transform: translateX(-50%);
  background: var(--bg-deep-1); color: var(--text-main);
  padding: 5px 10px; border-radius: var(--radius-sm);
  font-size: 0.75rem; white-space: nowrap; z-index: 999;
  border: 1px solid var(--glass-border); pointer-events: none;
  box-shadow: var(--material-elevation-2);
}


/* ==========================================================================
   RESPONSIVE ENHANCEMENT v5 — Full Device Support + Liquid Glass
   Mobile ▸ Tablet ▸ Laptop ▸ Desktop ▸ Wide Monitor
   ========================================================================== */

/* ── ROOT RESPONSIVE VARIABLES ─────────────────────────────────────────── */
:root {
  --resp-sidebar: var(--sidebar-width);
  --resp-content-pad: 24px;
  --resp-gap: 20px;
  --resp-font-scale: 1;
  --resp-card-min: 280px;
}

/* ── BODY / HTML FULL RESPONSIVENESS ──────────────────────────────────── */
html {
  font-size: clamp(13px, 1.1vw, 16px);
  overflow: hidden;
  height: 100%;
}
body {
  height: 100%;
  overflow: hidden;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

/* ── MAIN CONTENT AREA: AUTO H+W ───────────────────────────────────────── */
.main-content {
  flex: 1;
  min-width: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.content-area {
  flex: 1;
  overflow-x: hidden;
  overflow-y: auto;
  padding: var(--resp-content-pad);
  display: flex;
  flex-direction: column;
  gap: var(--resp-gap);
  height: auto;
  min-height: 0;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}
/* Horizontal scroll allowed for grid/table sections */
.content-area.allow-x-scroll { overflow-x: auto; }

/* ── SCROLLABLE REGION UTILITY ──────────────────────────────────────────── */
.scroll-region {
  overflow: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: var(--primary) transparent;
  height: auto;
  width: 100%;
  min-height: 0;
  position: relative;
}
.scroll-region-x { overflow-x: auto; overflow-y: hidden; }
.scroll-region-y { overflow-x: hidden; overflow-y: auto; }
.scroll-region::-webkit-scrollbar { width: 7px; height: 7px; }
.scroll-region::-webkit-scrollbar-thumb { background: var(--primary); border-radius: 4px; }
.scroll-region::-webkit-scrollbar-track { background: transparent; }

/* ── LIQUID GLASS ENHANCEMENTS ─────────────────────────────────────────── */
.glass-panel,
.glass-card {
  backdrop-filter: var(--glass-blur) !important;
  -webkit-backdrop-filter: var(--glass-blur) !important;
  border: 1px solid var(--glass-border) !important;
  position: relative;
  overflow: hidden;
}
.glass-panel::before,
.glass-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--liquid-highlight);
  pointer-events: none;
  z-index: 0;
  border-radius: inherit;
}
.glass-panel > *,
.glass-card > * { position: relative; z-index: 1; }

/* ── ATTENDANCE TABLE PANEL — AUTO HEIGHT + FULL SCROLL ─────────────────── */
.att-table-panel {
  height: auto !important;
  min-height: 320px !important;
  max-height: 72vh !important;
  flex: 1 1 auto !important;
  display: flex;
  flex-direction: column;
  overflow: hidden !important;
}
#attendanceTableWrap {
  flex: 1 1 auto;
  overflow: hidden;
  min-height: 0;
  position: relative;
}
.att-scroll-wrap {
  position: relative;
  height: 100%;
  display: flex;
  flex-direction: column;
}
.att-scroll-inner {
  flex: 1 1 auto;
  overflow-x: auto;
  overflow-y: auto;
  height: 100%;
  min-height: 200px;
  max-height: 64vh;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--primary) transparent;
  scroll-behavior: smooth;
}
.att-scroll-inner::-webkit-scrollbar { width: 8px; height: 8px; }
.att-scroll-inner::-webkit-scrollbar-track { background: var(--glass-bg-ultra-light); border-radius: 4px; }
.att-scroll-inner::-webkit-scrollbar-thumb { background: var(--primary); border-radius: 4px; }
.att-scroll-inner::-webkit-scrollbar-corner { background: transparent; }

/* Attendance cells — auto size */
.att-cell {
  width: auto !important;
  height: auto !important;
  min-width: 32px;
  min-height: 32px;
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  font-size: 0.73rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  border: 1px solid transparent;
  user-select: none;
  -webkit-user-select: none;
}

/* ── TIMETABLE GRID PANEL — AUTO HEIGHT + SCROLL ────────────────────────── */
.tt-grid-panel {
  height: auto !important;
  min-height: 320px !important;
  max-height: 72vh !important;
  flex: 1 1 auto !important;
  display: flex;
  flex-direction: column;
  overflow: hidden !important;
}
#timetableWrap {
  flex: 1 1 auto;
  overflow-x: auto;
  overflow-y: auto;
  min-height: 0;
  height: 100%;
  max-height: 64vh;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--primary) transparent;
}
#timetableWrap::-webkit-scrollbar { width: 8px; height: 8px; }
#timetableWrap::-webkit-scrollbar-track { background: var(--glass-bg-ultra-light); }
#timetableWrap::-webkit-scrollbar-thumb { background: var(--primary); border-radius: 4px; }

/* Timetable cells: auto sizing */
.timetable th,
.timetable td {
  height: auto !important;
  padding: 10px 8px !important;
  vertical-align: middle;
  white-space: nowrap;
}
.timetable-cell-content {
  width: auto !important;
  height: auto !important;
  min-height: 60px;
  padding: 8px !important;
}

/* ── SECTION TOGGLE (Modular enable/disable) ──────────────────────────── */
.section-module {
  transition: all 0.35s cubic-bezier(0.4,0,0.2,1);
  transform-origin: top;
}
.section-module.module-collapsed {
  max-height: 0 !important;
  overflow: hidden !important;
  padding: 0 !important;
  margin: 0 !important;
  opacity: 0;
  pointer-events: none;
}
.module-toggle-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: var(--glass-bg-ultra-light);
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: 1px solid var(--glass-border);
  transition: var(--transition);
  user-select: none;
  -webkit-user-select: none;
  gap: 8px;
}
.module-toggle-bar:hover { background: var(--glass-bg-light); }
.module-toggle-bar .mtb-title { font-size: 0.85rem; font-weight: 600; }
.module-toggle-btn {
  width: 32px; height: 18px;
  background: var(--glass-bg-heavy);
  border-radius: 9px;
  border: 1px solid var(--glass-border);
  position: relative;
  transition: var(--transition);
  flex-shrink: 0;
  cursor: pointer;
}
.module-toggle-btn::after {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 12px; height: 12px;
  background: var(--text-muted);
  border-radius: 50%;
  transition: var(--transition);
}
.module-toggle-btn.active { background: var(--primary); border-color: var(--primary); }
.module-toggle-btn.active::after { left: 16px; background: #000; }

/* ── FORMATTING TOOLBAR ────────────────────────────────────────────────── */
.format-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 8px 10px;
  background: var(--glass-bg-ultra-light);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
}
.fmt-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px; height: 30px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 0.82rem;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
}
.fmt-btn:hover, .fmt-btn.active {
  background: var(--glass-bg-light);
  border-color: var(--glass-border);
  color: var(--text-main);
}
.fmt-btn.active { border-color: var(--primary); color: var(--primary); }
.fmt-divider { width: 1px; height: 20px; background: var(--glass-border); margin: 0 2px; align-self: center; }
.fmt-select {
  height: 30px;
  background: var(--glass-bg-ultra-light);
  border: 1px solid var(--glass-border);
  border-radius: 6px;
  color: var(--text-main);
  font-size: 0.78rem;
  padding: 0 6px;
  cursor: pointer;
}

/* ── EXPORT CONTROLS ────────────────────────────────────────────────────── */
.export-controls-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 12px 16px;
  background: var(--glass-bg-ultra-light);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
}
.export-btn-group {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.export-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--glass-border);
  background: var(--glass-bg-light);
  color: var(--text-main);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
}
.export-btn:hover { transform: translateY(-1px); box-shadow: var(--material-elevation-2); }
.export-btn.pdf { border-color: rgba(251,113,133,0.4); color: var(--danger); }
.export-btn.excel { border-color: rgba(52,211,153,0.4); color: var(--success); }
.export-btn.word { border-color: rgba(147,197,253,0.4); color: var(--info); }
.export-btn.csv { border-color: rgba(251,191,36,0.4); color: var(--accent); }
.export-btn.pdf:hover { background: rgba(251,113,133,0.12); }
.export-btn.excel:hover { background: rgba(52,211,153,0.12); }
.export-btn.word:hover { background: rgba(147,197,253,0.12); }

/* Export preview panel */
.export-preview {
  background: var(--glass-bg-ultra-light);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  overflow: auto;
  position: relative;
  min-height: 120px;
  transition: var(--transition);
}
.export-preview-inner {
  padding: 20px;
  transform-origin: top left;
  transition: transform 0.3s ease;
}
.export-preview-toolbar {
  display: flex;
  gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--glass-border);
  align-items: center;
  flex-wrap: wrap;
}
.orient-btn {
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--glass-border);
  background: var(--glass-bg-ultra-light);
  color: var(--text-muted);
  font-size: 0.75rem;
  cursor: pointer;
  transition: var(--transition);
}
.orient-btn.active { background: var(--primary); color: #000; border-color: var(--primary); }
.scale-range {
  -webkit-appearance: none;
  height: 4px;
  background: var(--glass-border);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}
.scale-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px; height: 14px;
  background: var(--primary);
  border-radius: 50%;
  cursor: pointer;
}

/* ── STATS GRID — RESPONSIVE ────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px;
  width: 100%;
}
.stat-card {
  min-height: auto !important;
  height: auto !important;
  padding: 18px 16px;
}

/* ── FORM GRID — RESPONSIVE ─────────────────────────────────────────────── */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}

/* ── SIDEBAR RESPONSIVE ─────────────────────────────────────────────────── */
@media (max-width: 1280px) {
  :root { --resp-content-pad: 20px; --resp-gap: 16px; }
}
@media (max-width: 1024px) {
  :root { --resp-content-pad: 16px; --resp-gap: 14px; }
  .stats-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .form-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
}
@media (max-width: 768px) {
  :root { --resp-content-pad: 14px; --resp-gap: 12px; }
  .sidebar { position: fixed; left: -100%; z-index: 200; transition: left 0.3s ease; }
  .sidebar.open, .sidebar.mobile-open { left: 0; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .form-grid { grid-template-columns: 1fr; }
  .att-table-panel, .tt-grid-panel { max-height: 65vh !important; }
  .att-scroll-inner, #timetableWrap { max-height: 58vh; }
  .export-controls-bar { flex-direction: column; align-items: stretch; }
  .export-btn-group { justify-content: center; }
}
@media (max-width: 480px) {
  :root { --resp-content-pad: 10px; --resp-gap: 10px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat-card { padding: 12px 10px; }
  .stat-value { font-size: 1.4rem; }
  .att-cell { min-width: 28px; min-height: 28px; font-size: 0.65rem; }
  .att-table-panel, .tt-grid-panel { max-height: 55vh !important; }
  .top-header { flex-wrap: wrap; gap: 6px; min-height: auto; padding: 10px 12px; }
  .header-right { flex-wrap: wrap; gap: 6px; }
  .btn { font-size: 0.8rem; padding: 6px 10px; }
}
@media (max-width: 360px) {
  :root { --resp-content-pad: 8px; }
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .nav-section-title { display: none; }
}

/* ── WIDE MONITOR (2K/4K/ultrawide) ─────────────────────────────────────── */
@media (min-width: 1600px) {
  :root { --resp-content-pad: 32px; --resp-gap: 24px; }
  html { font-size: 15.5px; }
  .stats-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
  .att-table-panel, .tt-grid-panel { max-height: 75vh !important; }
  .att-scroll-inner, #timetableWrap { max-height: 68vh; }
}
@media (min-width: 2560px) {
  :root { --resp-content-pad: 48px; }
  html { font-size: 17px; }
  .stats-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
}

/* ── TOP HEADER STICKY RESPONSIVE ─────────────────────────────────────── */
.top-header {
  min-height: var(--header-height);
  height: auto;
  flex-shrink: 0;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.header-left, .header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* ── STICKY FILTERS BAR ──────────────────────────────────────────────────── */
.sticky-filters {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--glass-bg-heavy);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-radius: var(--radius-md);
  border: 1px solid var(--glass-border);
  padding: 12px 16px;
}

/* ── TABLE WRAPPER — UNIVERSAL HORIZONTAL SCROLL ─────────────────────────── */
.table-scroll-x {
  overflow-x: auto;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: var(--primary) transparent;
  border-radius: var(--radius-md);
}
.table-scroll-x::-webkit-scrollbar { height: 7px; }
.table-scroll-x::-webkit-scrollbar-thumb { background: var(--primary); border-radius: 4px; }

/* ── DASHBOARD SECTION ROLLING AREAS ───────────────────────────────────── */
.dashboard-rolling-area {
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: var(--primary) transparent;
  border-radius: var(--radius-md);
  height: auto;
}
.dashboard-rolling-area::-webkit-scrollbar { width: 5px; }
.dashboard-rolling-area::-webkit-scrollbar-thumb { background: var(--primary); border-radius: 4px; }

/* ── MOBILE TOUCH SCROLL INDICATOR ─────────────────────────────────────── */
.scroll-hint {
  position: absolute;
  right: 8px;
  bottom: 8px;
  font-size: 0.7rem;
  color: var(--text-muted);
  background: var(--glass-bg-heavy);
  padding: 3px 8px;
  border-radius: 999px;
  pointer-events: none;
  opacity: 0.7;
  animation: fadeHint 2s 1s ease forwards;
  display: none;
}
@media (max-width: 768px) { .scroll-hint { display: block; } }
@keyframes fadeHint { 0%{opacity:0.7} 100%{opacity:0} }

/* ── GLASS CARD HEIGHT AUTO ENFORCEMENT ──────────────────────────────────── */
.glass-panel, .glass-card {
  height: auto !important;
  width: auto;
}

/* ── ATTENDANCE PAGE SPECIFIC ───────────────────────────────────────────── */
.att-table-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

/* Attendance mobile row label */
@media (max-width: 600px) {
  #attendanceTableWrap table thead th:first-child,
  #attendanceTableWrap table tbody td:first-child {
    min-width: 120px !important;
    font-size: 0.75rem;
  }
  .att-cell { min-width: 26px; min-height: 26px; font-size: 0.62rem; }
}

/* ── PRINT STYLES ───────────────────────────────────────────────────────── */
@media print {
  .sidebar, .top-header, .sticky-filters, .att-scroll-btn,
  .export-controls-bar, .format-toolbar, .module-toggle-bar,
  .btn-ghost, .theme-toggle, .toggle-sidebar-btn { display: none !important; }
  .main-content { margin: 0; padding: 0; }
  .content-area { overflow: visible !important; height: auto !important; }
  .att-table-panel, .tt-grid-panel {
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
  }
  .att-scroll-inner, #timetableWrap {
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
  }
  .glass-panel, .glass-card {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    background: #fff !important;
    color: #000 !important;
    border: 1px solid #ccc !important;
  }
  .timetable, .timetable th, .timetable td {
    border: 1px solid #ccc !important;
    color: #000 !important;
    background: #fff !important;
  }
}

/* ── SECTION HEADER MODULE BAR ─────────────────────────────────────────── */
.section-title-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: space-between;
  flex-wrap: wrap;
  margin-bottom: 2px;
}
.section-title-bar .section-title { margin: 0; }

/* ── SCROLLABLE FORM CONTAINER ──────────────────────────────────────────── */
.scrollable-form {
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: var(--primary) transparent;
  height: auto;
  max-height: 70vh;
}
.scrollable-form::-webkit-scrollbar { width: 5px; }
.scrollable-form::-webkit-scrollbar-thumb { background: var(--primary); border-radius: 4px; }

/* ── LOADING SKELETON ──────────────────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--glass-bg-ultra-light) 25%, var(--glass-bg-light) 50%, var(--glass-bg-ultra-light) 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}
@keyframes skeleton-shimmer { 0%{background-position:200% 0} 100%{background-position:-200% 0} }

/* Academy management controls: filters, views, and inquiry UI */
.smart-filter-bar,
.academy-filter-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 14px;
  margin-bottom: 12px;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--glass-bg-heavy), var(--glass-bg-light));
  box-shadow: var(--material-elevation-1);
}
.smart-filter-main,
.academy-filter-grid {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  flex: 1;
  min-width: 240px;
}
.academy-filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  width: 100%;
}
.academy-filter-grid .search-wrapper,
.smart-search {
  min-width: 220px;
}
.academy-filter-grid .search-wrapper {
  grid-column: span 2;
}
.smart-mini-filter {
  max-width: 180px;
}
.smart-filter-count,
.academy-record-count {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--glass-border);
  background: var(--glass-bg-ultra-light);
  color: var(--text-muted);
  font-size: 0.76rem;
  font-weight: 700;
  white-space: nowrap;
}
.view-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--glass-border);
  border-radius: 999px;
  background: var(--glass-bg-ultra-light);
  white-space: nowrap;
}
.view-toggle-btn {
  min-height: 30px;
  padding: 5px 10px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 800;
  transition: var(--transition);
}
.view-toggle-btn.active {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #07111d;
  box-shadow: 0 6px 16px var(--primary-glow);
}
.auto-grid-cards,
.people-card-grid,
.fee-card-grid,
.attendance-card-grid,
.inquiry-card-grid,
.tt-list-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}
.auto-grid-card,
.person-card,
.fee-student-card,
.attendance-person-card,
.inquiry-card,
.tt-list-card {
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  background: var(--glass-bg-light);
  box-shadow: var(--material-elevation-1);
  padding: 14px;
  min-width: 0;
}
.auto-card-row,
.detail-row {
  display: grid;
  grid-template-columns: minmax(86px, 0.75fr) minmax(0, 1.25fr);
  gap: 8px;
  padding: 7px 0;
  border-bottom: 1px solid var(--glass-border);
}
.auto-card-row:last-child,
.detail-row:last-child {
  border-bottom: 0;
}
.auto-card-row span,
.detail-row span {
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
}
.auto-card-row strong,
.detail-row strong {
  min-width: 0;
  color: var(--text-main);
  font-size: 0.84rem;
  font-weight: 700;
  overflow-wrap: anywhere;
}
.person-card-top,
.inquiry-card-top,
.fee-card-top,
.attendance-card-top {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  justify-content: space-between;
}
.person-title,
.inquiry-title {
  font-size: 0.96rem;
  font-weight: 850;
  color: var(--text-main);
}
.card-meta-line {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  color: var(--text-muted);
  font-size: 0.76rem;
  margin-top: 4px;
}
.card-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 12px;
}
.filter-clear-btn {
  min-height: 34px;
}
.inquiry-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  flex: 0 0 42px;
  border-radius: 12px;
  border: 1px solid var(--glass-border);
  background: linear-gradient(135deg, rgba(94,234,212,0.18), rgba(251,191,36,0.16));
  color: var(--primary);
  font-size: 1.25rem;
  font-weight: 900;
}
.inquiry-status-strip {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 10px;
}
.follow-up-due {
  border-color: rgba(251,191,36,0.45);
  box-shadow: 0 0 0 1px rgba(251,191,36,0.12), var(--material-elevation-1);
}
.converted-inquiry {
  opacity: 0.82;
}
.progress-mini {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--glass-bg-ultra-light);
  border: 1px solid var(--glass-border);
}
.progress-mini > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--success), var(--primary));
}
.attendance-day-strip {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(30px, 1fr));
  gap: 5px;
  margin-top: 10px;
}
.attendance-day-chip {
  min-height: 28px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  border: 1px solid var(--glass-border);
  background: var(--glass-bg-ultra-light);
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 800;
}
.attendance-day-chip.is-p { color: var(--success); background: rgba(52,211,153,0.12); }
.attendance-day-chip.is-a { color: var(--danger); background: rgba(251,113,133,0.12); }
.attendance-day-chip.is-l { color: var(--warning); background: rgba(251,191,36,0.12); }
.tt-grid-panel {
  min-height: 540px !important;
  max-height: 82vh !important;
}
#timetableWrap {
  max-height: 74vh;
}
.timetable-cell-content {
  min-height: 92px;
}
.tt-students-list {
  max-height: 92px;
  overflow: auto;
}
.tt-list-grid {
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}
.tt-list-card.is-empty {
  border-style: dashed;
  opacity: 0.78;
}

@media (max-width: 700px) {
  .academy-filter-grid {
    grid-template-columns: 1fr;
  }
  .academy-filter-grid .search-wrapper {
    grid-column: auto;
  }
  .smart-filter-main,
  .smart-search,
  .academy-filter-grid .search-wrapper {
    min-width: 0;
    width: 100%;
  }
  .view-toggle {
    width: 100%;
  }
  .view-toggle-btn {
    flex: 1;
  }
  .auto-grid-cards,
  .people-card-grid,
  .fee-card-grid,
  .attendance-card-grid,
  .inquiry-card-grid,
  .tt-list-grid {
    grid-template-columns: 1fr;
  }
}

/* Responsive polish pass: independent scroll areas and compact filter rows */
.sticky-filters {
  display: grid !important;
  grid-auto-rows: max-content;
  align-content: start;
  flex: 0 0 auto !important;
  gap: 12px;
  width: 100%;
  max-width: 100%;
  height: auto !important;
  min-height: 0 !important;
  margin: 0 0 14px 0 !important;
  padding: 12px 14px !important;
  overflow: auto !important;
  max-height: clamp(260px, 52vh, 480px) !important;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--primary) transparent;
}
.sticky-filters::-webkit-scrollbar,
.academy-filter-panel::-webkit-scrollbar,
.academy-view-toolbar::-webkit-scrollbar,
.academy-filter-grid::-webkit-scrollbar,
.table-container::-webkit-scrollbar,
.people-card-grid::-webkit-scrollbar,
.fee-card-grid::-webkit-scrollbar,
.attendance-card-grid::-webkit-scrollbar,
.inquiry-card-grid::-webkit-scrollbar,
.tt-list-grid::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
.sticky-filters::-webkit-scrollbar-thumb,
.academy-filter-panel::-webkit-scrollbar-thumb,
.academy-view-toolbar::-webkit-scrollbar-thumb,
.academy-filter-grid::-webkit-scrollbar-thumb,
.table-container::-webkit-scrollbar-thumb,
.people-card-grid::-webkit-scrollbar-thumb,
.fee-card-grid::-webkit-scrollbar-thumb,
.attendance-card-grid::-webkit-scrollbar-thumb,
.inquiry-card-grid::-webkit-scrollbar-thumb,
.tt-list-grid::-webkit-scrollbar-thumb {
  background: var(--primary);
  border-radius: 999px;
}
.sticky-filters.has-attendance-filters {
  height: auto !important;
  min-height: 0 !important;
  max-height: clamp(260px, 52vh, 480px) !important;
}
.att-controls-row {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start !important;
  gap: 12px !important;
  width: 100%;
}
.att-controls-row > div:first-child {
  min-width: 0;
  max-width: 100%;
  display: flex !important;
  flex-wrap: wrap !important;
  align-items: center;
}
.att-controls-row > div:last-child {
  justify-self: end;
  align-self: start;
}
.status-tab-bar,
.tab-nav {
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
  overscroll-behavior-inline: contain;
}
.attendance-filter-panel {
  width: 100%;
  margin: 12px 0 0 !important;
  padding: 10px !important;
  display: grid;
  grid-template-columns: minmax(0, 1fr) !important;
  align-items: stretch;
  gap: 8px;
}
.attendance-filter-panel > div:last-child {
  justify-content: flex-end;
  min-width: 0;
}
.academy-filter-panel {
  width: 100%;
  max-width: 100%;
  overflow: auto;
  overscroll-behavior: contain;
}
.academy-filter-grid {
  width: 100%;
  min-width: 0;
  align-items: stretch;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}
.academy-filter-grid .search-wrapper {
  grid-column: span 2;
  min-width: 0;
}
.academy-filter-grid .form-control,
.academy-filter-grid .btn {
  width: 100%;
  min-width: 0;
  min-height: 44px;
}
.academy-record-count,
.smart-filter-count {
  min-height: 38px;
}
.academy-view-toolbar {
  display: flex;
  flex: 0 0 auto !important;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  margin: 8px 0 12px;
  min-height: 60px;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--glass-bg-heavy), var(--glass-bg-ultra-light));
  box-shadow: var(--material-elevation-1);
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
  overscroll-behavior-inline: contain;
}
.academy-view-meta,
.academy-view-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  white-space: nowrap;
}
.academy-view-actions {
  margin-left: auto;
}
.academy-view-label {
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.table-container {
  max-height: min(72vh, 650px);
  overflow: auto;
  overscroll-behavior: contain;
}
#studentSection .table-container,
#teacherSection .table-container,
#allFeesTableBody.closest-table-container {
  max-height: min(72vh, 650px);
}
.people-card-grid,
.fee-card-grid,
.inquiry-card-grid,
.tt-list-grid {
  max-height: min(74vh, 760px);
  overflow: auto;
  padding-right: 4px;
  overscroll-behavior: contain;
}
.attendance-card-grid {
  max-height: 100%;
  overflow: auto;
  padding-right: 4px;
  overscroll-behavior: contain;
}
.att-table-panel {
  height: clamp(560px, calc(100vh - 250px), 920px) !important;
  min-height: 560px !important;
  max-height: none !important;
}
#attendanceTableWrap {
  min-height: 0 !important;
  overflow: hidden !important;
}
.att-scroll-inner {
  min-height: 0 !important;
  max-height: none !important;
  height: 100% !important;
}
.tt-grid-panel {
  height: clamp(560px, calc(100vh - 250px), 920px) !important;
  min-height: 560px !important;
  max-height: none !important;
}
#timetableWrap {
  max-height: none !important;
  height: 100%;
}

@media (min-width: 1440px) {
  .sticky-filters {
    max-height: clamp(210px, 30vh, 420px);
  }
  .sticky-filters.has-attendance-filters {
    height: auto !important;
    min-height: 0 !important;
    max-height: clamp(230px, 34vh, 420px) !important;
  }
  .table-container {
    max-height: min(76vh, 720px);
  }
  .att-table-panel,
  .tt-grid-panel {
    height: clamp(640px, calc(100vh - 240px), 980px) !important;
  }
}

@media (max-width: 900px) {
  .att-controls-row {
    grid-template-columns: 1fr !important;
  }
  .att-controls-row > div:last-child {
    justify-self: start;
    width: 100%;
    overflow-x: auto;
    flex-wrap: nowrap !important;
    padding-bottom: 2px;
  }
  .att-controls-row > div:last-child .btn {
    flex: 0 0 auto;
  }
  .attendance-filter-panel {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 700px) {
  .sticky-filters {
    max-height: 42vh;
  }
  .sticky-filters.has-attendance-filters {
    height: auto !important;
    min-height: 0 !important;
    max-height: 42vh !important;
  }
  .academy-filter-panel {
    max-height: 34vh;
  }
  .academy-filter-grid {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    gap: 8px;
    padding-bottom: 4px;
  }
  .academy-filter-grid > * {
    flex: 0 0 min(82vw, 280px);
  }
  .academy-filter-grid .search-wrapper {
    grid-column: auto;
  }
  .view-toggle {
    overflow-x: auto;
  }
  .table-container,
  .people-card-grid,
  .fee-card-grid,
  .inquiry-card-grid,
  .tt-list-grid {
    max-height: 64vh;
  }
  .att-table-panel,
  .tt-grid-panel {
    height: 68vh !important;
    min-height: 420px !important;
  }
}

/* Final responsive pass: all filter groups stay in one horizontal row */
.smart-filter-bar,
.academy-filter-panel {
  flex-wrap: nowrap !important;
  justify-content: flex-start !important;
  align-items: center !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  max-height: none !important;
  gap: 10px !important;
  scrollbar-width: thin;
  overscroll-behavior-inline: contain;
  scroll-snap-type: x proximity;
}
.smart-filter-main,
.academy-filter-grid {
  display: flex !important;
  flex: 0 0 auto !important;
  flex-wrap: nowrap !important;
  align-items: center !important;
  gap: 8px !important;
  width: max-content !important;
  min-width: max-content !important;
  overflow: visible !important;
}
.smart-filter-main > *,
.academy-filter-grid > *,
.academy-filter-panel > div:last-child {
  flex: 0 0 auto !important;
  scroll-snap-align: start;
}
.smart-search,
.academy-filter-grid .search-wrapper {
  grid-column: auto !important;
  flex: 0 0 clamp(260px, 28vw, 430px) !important;
  min-width: 260px !important;
}
.smart-filter-main .form-control,
.academy-filter-grid .form-control,
.academy-filter-grid .btn {
  width: clamp(170px, 16vw, 240px) !important;
  min-width: 170px !important;
}
.academy-filter-grid .filter-clear-btn {
  width: 170px !important;
}

.sticky-filters.has-attendance-filters {
  display: flex !important;
  flex-direction: column !important;
  gap: 8px !important;
  padding: 10px 12px !important;
  max-height: clamp(150px, 28vh, 230px) !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
}
.sticky-filters.has-attendance-filters .att-controls-row {
  display: flex !important;
  flex-wrap: nowrap !important;
  align-items: center !important;
  gap: 10px !important;
  width: 100% !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  padding-bottom: 4px;
  scrollbar-width: thin;
  overscroll-behavior-inline: contain;
  scroll-snap-type: x proximity;
}
.sticky-filters.has-attendance-filters .att-controls-row > div:first-child,
.sticky-filters.has-attendance-filters .att-controls-row > div:last-child {
  display: flex !important;
  flex: 0 0 auto !important;
  flex-wrap: nowrap !important;
  align-items: center !important;
  width: max-content !important;
  max-width: none !important;
  min-width: 0 !important;
  gap: 8px !important;
}
.sticky-filters.has-attendance-filters .tab-nav,
.sticky-filters.has-attendance-filters .status-tab-bar {
  flex: 0 0 auto !important;
  flex-wrap: nowrap !important;
  overflow: visible !important;
}
.sticky-filters.has-attendance-filters .form-control {
  flex: 0 0 auto !important;
  min-width: 190px;
}
.sticky-filters.has-attendance-filters .attendance-filter-panel {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  align-items: center !important;
  width: 100% !important;
  margin: 0 !important;
  padding: 8px 10px !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  max-height: none !important;
  gap: 10px !important;
}
.sticky-filters.has-attendance-filters #attAdvancedFilters .academy-filter-grid {
  flex: 0 0 auto !important;
}
.sticky-filters.has-attendance-filters #attAdvancedFilters > div:last-child {
  flex: 0 0 auto !important;
  flex-wrap: nowrap !important;
}

.tt-grid-panel {
  height: var(--tt-panel-height, clamp(760px, 84vh, 1280px)) !important;
  min-height: 720px !important;
  max-height: none !important;
  flex: 0 0 auto !important;
}
#timetableWrap {
  max-height: none !important;
  height: 100% !important;
}
.tt-scroll-inner {
  min-height: 100%;
}

:where(.glass-panel, .glass-card, .smart-filter-bar, .academy-filter-panel, .academy-view-toolbar, .sticky-filters, .table-container, .att-table-panel, .tt-grid-panel, .person-card, .fee-student-card, .attendance-person-card, .inquiry-card, .tt-list-card) {
  transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease, background 180ms ease, opacity 180ms ease;
}
:where(.person-card, .fee-student-card, .attendance-person-card, .inquiry-card, .tt-list-card):hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18), 0 0 18px var(--primary-glow);
}

@media (max-width: 900px) {
  .sticky-filters.has-attendance-filters {
    max-height: 34vh !important;
  }
  .smart-search,
  .academy-filter-grid .search-wrapper {
    flex-basis: min(78vw, 360px) !important;
  }
  .academy-view-toolbar {
    align-items: center;
  }
}

@media (max-width: 700px) {
  .smart-filter-bar,
  .academy-filter-panel {
    max-height: none !important;
  }
  .sticky-filters.has-attendance-filters {
    max-height: 40vh !important;
  }
  .tt-grid-panel {
    height: var(--tt-panel-height, 78vh) !important;
    min-height: 520px !important;
  }
  .academy-view-toolbar {
    padding: 8px;
  }
}

/* Dashboard, attendance grid, and internship view polish */
.dashboard-card-grid,
.internship-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
  max-height: min(74vh, 760px);
  overflow: auto;
  padding-right: 4px;
  overscroll-behavior: contain;
}
.dashboard-info-card,
.internship-card {
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  background: var(--glass-bg-light);
  box-shadow: var(--material-elevation-1);
  padding: 14px;
  min-width: 0;
  transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease, background 180ms ease;
}
.dashboard-info-card:hover,
.internship-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(0,0,0,0.18), 0 0 18px var(--primary-glow);
}
.quick-links-grid.is-list-view {
  display: grid;
  grid-template-columns: 1fr;
  max-height: min(58vh, 620px);
  overflow: auto;
}
.quick-links-grid.is-list-view .quick-link-card {
  min-height: 58px;
  flex-direction: row;
  justify-content: flex-start;
  padding: 12px 16px;
}
.quick-links-grid.is-list-view .ql-icon {
  width: 36px;
  text-align: center;
}
#attendanceTableWrap.is-grid-view {
  overflow: auto !important;
  min-height: 0 !important;
  height: 100% !important;
}
#attendanceTableWrap.is-grid-view .attendance-card-grid {
  max-height: none;
  min-height: 100%;
}
.internship-table-panel {
  min-height: 520px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.internship-table-scroll {
  flex: 1 1 auto;
  min-height: 0;
  max-height: min(76vh, 760px) !important;
  overflow: auto !important;
}
.internship-table-scroll table {
  min-width: 1180px;
}
.fee-view-panel {
  overflow: hidden;
}
.fee-table-scroll {
  max-height: min(72vh, 680px) !important;
  overflow: auto !important;
}
.fee-table-scroll table {
  min-width: 980px;
}
.fee-view-grid {
  padding: 12px;
  min-height: 220px;
  max-height: min(74vh, 760px) !important;
  overflow: auto !important;
}

@media (max-width: 700px) {
  .dashboard-card-grid,
  .internship-card-grid {
    grid-template-columns: 1fr;
    max-height: 66vh;
  }
  .internship-table-panel {
    min-height: 460px;
  }
}

/* Final portal completion pass: public scrolling, large record scrollbars, student read-only views */
:root {
  --bg-main: var(--bg-gradient);
  --glass-bg: var(--glass-bg-light);
}

html.public-document {
  height: auto;
  min-height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
}

html.public-document body.public-wrapper,
html.public-document body.blog-wrapper {
  height: auto;
  min-height: 100vh;
  max-height: none;
  overflow: visible;
  background: var(--bg-gradient);
}

html.public-document ::-webkit-scrollbar,
#inquiryGrid::-webkit-scrollbar,
#inquiryListPanel .table-container::-webkit-scrollbar,
#internshipCardGrid::-webkit-scrollbar,
.internship-table-scroll::-webkit-scrollbar,
.student-big-scroll::-webkit-scrollbar,
.student-readonly-grid::-webkit-scrollbar {
  width: 14px;
  height: 14px;
}

html.public-document ::-webkit-scrollbar-thumb,
#inquiryGrid::-webkit-scrollbar-thumb,
#inquiryListPanel .table-container::-webkit-scrollbar-thumb,
#internshipCardGrid::-webkit-scrollbar-thumb,
.internship-table-scroll::-webkit-scrollbar-thumb,
.student-big-scroll::-webkit-scrollbar-thumb,
.student-readonly-grid::-webkit-scrollbar-thumb {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border: 3px solid rgba(7, 11, 18, 0.22);
  border-radius: 999px;
}

html.public-document ::-webkit-scrollbar-track,
#inquiryGrid::-webkit-scrollbar-track,
#inquiryListPanel .table-container::-webkit-scrollbar-track,
#internshipCardGrid::-webkit-scrollbar-track,
.internship-table-scroll::-webkit-scrollbar-track,
.student-big-scroll::-webkit-scrollbar-track,
.student-readonly-grid::-webkit-scrollbar-track {
  background: var(--glass-bg-ultra-light);
  border-radius: 999px;
}

#inquiryGrid,
#inquiryListPanel .table-container,
#internshipCardGrid,
.internship-table-scroll,
.student-big-scroll,
.student-readonly-grid {
  scrollbar-width: auto;
  scrollbar-color: var(--primary) var(--glass-bg-ultra-light);
}

#inquiryGrid,
#internshipCardGrid,
.student-readonly-grid {
  max-height: min(78vh, 860px);
  overflow: auto;
  padding-right: 6px;
}

#inquiryListPanel .table-container,
.student-big-scroll {
  max-height: min(78vh, 860px) !important;
  overflow: auto !important;
}

.student-big-scroll table {
  min-width: 900px;
}

.student-detail-grid {
  display: grid;
  gap: 2px;
}

.student-detail-grid .detail-row {
  grid-template-columns: minmax(120px, 0.8fr) minmax(0, 1.2fr);
}

.attendance-notes-meta {
  display: grid;
  grid-template-columns: minmax(240px, 2fr) minmax(160px, 1fr) minmax(150px, 1fr);
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--glass-border);
  background: var(--glass-bg-ultra-light);
}

.attendance-notes-meta .form-group {
  margin: 0;
  min-width: 0;
}

.attendance-notes-meta .form-control {
  min-height: 42px;
}

@media (max-width: 700px) {
  html.public-document .pub-nav {
    height: auto;
    min-height: 64px;
    flex-wrap: wrap;
    padding: 10px 14px;
  }
  html.public-document .pub-nav-cta,
  html.public-document .pub-nav > div:last-child {
    width: 100%;
    justify-content: flex-start;
    overflow-x: auto;
  }
  html.public-document .hero {
    min-height: auto;
    padding: 110px 14px 48px;
  }
  html.public-document .pub-section,
  html.public-document section[style*="padding:80px"] {
    padding: 48px 14px !important;
  }
  html.public-document .role-grid,
  html.public-document .blog-main,
  .attendance-notes-meta {
    grid-template-columns: 1fr !important;
  }
  .student-big-scroll table {
    min-width: 760px;
  }
  .student-detail-grid .detail-row {
    grid-template-columns: 1fr;
  }
}

/* Final polish pass: demo tools, fast navigation, student settings, readable light theme */
.demo-creds-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.page-load-bar {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 99999;
  width: 0;
  height: 4px;
  opacity: 0;
  pointer-events: none;
  background: linear-gradient(90deg, var(--primary), var(--accent), var(--secondary));
  box-shadow: 0 0 18px var(--primary-glow);
  transition: width 160ms ease, opacity 120ms ease;
}

html.is-navigating .page-load-bar {
  width: 78%;
  opacity: 1;
  animation: pageLoadPulse 900ms ease-in-out infinite alternate;
}

@keyframes pageLoadPulse {
  from { filter: brightness(1); }
  to { filter: brightness(1.35); }
}

.student-settings-layout {
  display: grid;
  grid-template-columns: minmax(280px, 1.35fr) minmax(240px, 0.85fr);
  gap: 14px;
  align-items: stretch;
}

.student-settings-card {
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  background: var(--glass-bg-light);
  box-shadow: var(--material-elevation-1);
  padding: 16px;
  min-width: 0;
}

.student-settings-card:nth-child(3) {
  grid-column: 1 / -1;
}

.student-batch-card {
  min-height: 280px;
}

.settings-card-kicker {
  color: var(--text-muted);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
  margin-bottom: 12px;
}

.student-profile-quick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}

.student-profile-quick-grid > div {
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  background: var(--glass-bg-ultra-light);
  padding: 10px 12px;
  min-width: 0;
}

.student-profile-quick-grid span {
  display: block;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 700;
  margin-bottom: 2px;
}

.student-profile-quick-grid strong {
  display: block;
  color: var(--text-main);
  font-size: 0.9rem;
  overflow-wrap: anywhere;
}

.settings-action-list {
  display: grid;
  gap: 10px;
}

.settings-action-list .btn {
  justify-content: space-between;
  min-height: 44px;
  width: 100%;
  white-space: normal;
  text-align: left;
}

#studentTTMini,
#studentTTPanel,
#studentCoursesPanel,
#studentTopicsPanel,
#studentTasksPanel {
  min-height: 220px;
}

#studentTTMini,
#studentTTPanel {
  max-height: min(74vh, 760px);
  overflow: auto !important;
  scrollbar-width: auto;
  scrollbar-color: var(--primary) var(--glass-bg-ultra-light);
}

#studentTTMini::-webkit-scrollbar,
#studentTTPanel::-webkit-scrollbar {
  width: 14px;
  height: 14px;
}

#studentTTMini::-webkit-scrollbar-thumb,
#studentTTPanel::-webkit-scrollbar-thumb {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border: 3px solid rgba(7, 11, 18, 0.22);
  border-radius: 999px;
}

[data-theme="light"] body,
[data-theme="light"] .main-content,
[data-theme="light"] .glass-panel,
[data-theme="light"] .glass-card,
[data-theme="light"] .stat-card,
[data-theme="light"] .table-container,
[data-theme="light"] .student-settings-card,
[data-theme="light"] .dashboard-info-card,
[data-theme="light"] .inquiry-card,
[data-theme="light"] .internship-card {
  color: #020617;
}

input,
select,
textarea,
.form-control {
  color: var(--text-main);
}

[data-theme="light"] input,
[data-theme="light"] select,
[data-theme="light"] textarea,
[data-theme="light"] .form-control {
  color: #020617;
}

[data-theme="light"] table td,
[data-theme="light"] table th {
  color: #020617;
}

@media (max-width: 820px) {
  .student-settings-layout {
    grid-template-columns: 1fr;
  }
  .student-settings-card:nth-child(3) {
    grid-column: auto;
  }
}

@media (max-width: 520px) {
  .demo-creds-head,
  .settings-action-list .btn,
  .section-header {
    align-items: stretch;
  }
  .student-profile-quick-grid {
    grid-template-columns: 1fr;
  }
  .student-batch-card {
    min-height: 240px;
  }
  #studentTTMini,
  #studentTTPanel,
  #studentCoursesPanel,
  #studentTopicsPanel,
  #studentTasksPanel {
    min-height: 180px;
  }
}

/* Portal-wide design settings: old/new design, surfaces, density, responsive chrome */
:root {
  --touch-target: 46px;
  --surface-speed: 0.22s;
}

[data-ui-mode="classic"] {
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --glass-blur: blur(8px) saturate(1.05);
  --glass-shadow: var(--material-elevation-1);
  --neo-raised: var(--material-elevation-1);
  --neo-pressed: inset 0 1px 4px rgba(0,0,0,0.18);
}

[data-theme="dark"][data-ui-mode="classic"] {
  --bg-gradient: linear-gradient(135deg,#101827 0%,#152033 48%,#17251f 100%);
  --glass-bg-light: rgba(20,31,47,0.9);
  --glass-bg-medium: rgba(24,37,55,0.94);
  --glass-bg-heavy: rgba(9,14,24,0.96);
}

[data-theme="light"][data-ui-mode="classic"] {
  --bg-gradient: linear-gradient(135deg,#ffffff 0%,#f4f7fb 54%,#edf4f0 100%);
  --glass-bg-light: rgba(255,255,255,0.92);
  --glass-bg-medium: rgba(255,255,255,0.96);
  --glass-bg-heavy: rgba(255,255,255,0.98);
}

[data-surface-style="flat"] {
  --glass-bg-ultra-light: rgba(255,255,255,0.08);
  --glass-shadow: var(--material-elevation-1);
  --neo-raised: var(--material-elevation-1);
  --neo-pressed: inset 0 1px 5px rgba(0,0,0,0.18);
}

[data-theme="light"][data-surface-style="flat"] {
  --glass-bg-ultra-light: rgba(15,23,42,0.04);
  --glass-shadow: var(--material-elevation-1);
}

[data-surface-style="neumorphic"] {
  --glass-shadow: var(--neo-raised);
}

[data-surface-style="flat"] :where(.glass-panel,.glass-card,.stat-card,.chart-container,.table-container,.modal,.student-settings-card,.dashboard-info-card,.inquiry-card,.internship-card,.fee-student-card,.attendance-person-card,.tt-list-card) {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  box-shadow: var(--material-elevation-1) !important;
}

[data-surface-style="neumorphic"] :where(.glass-panel,.glass-card,.stat-card,.chart-container,.student-settings-card,.dashboard-info-card,.inquiry-card,.internship-card,.fee-student-card,.attendance-person-card,.tt-list-card,.btn,.form-control) {
  box-shadow: var(--neo-raised);
}

[data-surface-style="neumorphic"] :where(.btn:active,.view-toggle-btn.active,.dashboard-tab.active,.tab-btn.active) {
  box-shadow: var(--neo-pressed);
}

[data-density="compact"] {
  --header-height: 60px;
  --touch-target: 36px;
}

[data-density="compact"] body {
  font-size: 14px;
}

[data-density="compact"] :where(.content-area,.modal-body) {
  padding: 14px;
}

[data-density="compact"] :where(.glass-panel,.glass-card,.stat-card,.chart-container,.student-settings-card) {
  padding: 14px;
}

[data-density="compact"] :where(.btn,.form-control,.dropdown-item) {
  min-height: var(--touch-target);
  padding-top: 8px;
  padding-bottom: 8px;
}

.reduce-motion *,
.reduce-motion *::before,
.reduce-motion *::after {
  animation-duration: 0.001ms !important;
  animation-iteration-count: 1 !important;
  scroll-behavior: auto !important;
  transition-duration: 0.001ms !important;
}

.wide-tables .table-container {
  overflow-x: auto;
}

.wide-tables .table-container table {
  min-width: max-content;
}

.academy-design-fab {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 650;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  border: 1px solid var(--glass-border-highlight);
  background: linear-gradient(135deg,var(--primary),var(--secondary));
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 1.15rem;
  box-shadow: var(--material-elevation-3);
  transition: transform var(--surface-speed) ease, filter var(--surface-speed) ease;
}

.academy-design-fab:hover {
  transform: translateY(-2px);
  filter: brightness(1.08);
}

.academy-design-fab[data-mode="classic"] {
  border-radius: 8px;
  background: var(--glass-bg-heavy);
  color: var(--primary);
}

.design-settings-dialog {
  max-width: min(620px, calc(100vw - 24px));
}

.design-settings-stack {
  display: grid;
  gap: 16px;
}

.design-settings-section {
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  background: var(--glass-bg-ultra-light);
  padding: 14px;
}

.design-choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.design-choice-grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.design-choice {
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  background: var(--glass-bg-light);
  color: var(--text-main);
  min-height: 78px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  text-align: left;
  transition: border-color var(--surface-speed) ease, background var(--surface-speed) ease, transform var(--surface-speed) ease;
}

.design-choice strong {
  font-size: 0.94rem;
}

.design-choice span {
  color: var(--text-muted);
  font-size: 0.76rem;
  line-height: 1.35;
}

.design-choice:hover,
.design-choice.active {
  border-color: var(--primary);
  background: color-mix(in srgb, var(--primary) 14%, var(--glass-bg-light));
}

.design-choice.active {
  box-shadow: 0 0 0 2px var(--primary-glow);
}

.design-toggle-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  border-top: 1px solid var(--glass-border);
  padding: 12px 0;
}

.design-toggle-row:first-of-type {
  border-top: 0;
}

.design-toggle-row span {
  min-width: 0;
}

.design-toggle-row strong,
.design-toggle-row em {
  display: block;
}

.design-toggle-row em {
  color: var(--text-muted);
  font-size: 0.74rem;
  font-style: normal;
}

.design-toggle-row input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.design-toggle-row i {
  width: 42px;
  height: 24px;
  border: 1px solid var(--glass-border);
  border-radius: 999px;
  background: var(--glass-bg-heavy);
  position: relative;
  transition: background var(--surface-speed) ease, border-color var(--surface-speed) ease;
}

.design-toggle-row i::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: left var(--surface-speed) ease, background var(--surface-speed) ease;
}

.design-toggle-row input:checked + i {
  background: var(--primary);
  border-color: var(--primary);
}

.design-toggle-row input:checked + i::after {
  left: 21px;
  background: #00110f;
}

.portal-quick-menu {
  position: relative;
}

.portal-quick-trigger {
  width: 36px;
  min-width: 36px;
  height: 36px;
  padding: 0;
  justify-content: center;
}

.portal-quick-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 680;
  width: min(320px, calc(100vw - 24px));
  max-height: min(70vh, 520px);
  overflow: auto;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  background: var(--glass-bg-heavy);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  box-shadow: var(--material-elevation-3);
  padding: 8px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: var(--transition);
}

.portal-quick-menu.open .portal-quick-panel {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.portal-quick-item {
  width: 100%;
  min-height: 42px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  text-align: left;
  font-size: 0.86rem;
}

.portal-quick-item:hover,
.portal-quick-item.active {
  background: var(--glass-bg-light);
  color: var(--primary);
}

.mobile-bottom-nav {
  position: fixed;
  left: max(10px, env(safe-area-inset-left));
  right: max(10px, env(safe-area-inset-right));
  bottom: max(10px, env(safe-area-inset-bottom));
  z-index: 620;
  display: none;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
  border: 1px solid var(--glass-border);
  border-radius: 18px;
  background: var(--glass-bg-heavy);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  box-shadow: var(--material-elevation-3);
  padding: 8px;
}

.mobile-bottom-link {
  min-width: 0;
  min-height: 50px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-size: 0.68rem;
  line-height: 1.1;
  overflow: hidden;
}

.mobile-bottom-link .nav-icon {
  font-size: 1rem;
  line-height: 1;
}

.mobile-bottom-link span:last-child {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mobile-bottom-link.active,
.mobile-bottom-link:hover {
  background: color-mix(in srgb, var(--primary) 16%, transparent);
  color: var(--primary);
}

:where(.btn,button,.nav-item,.dropdown-item,.view-toggle-btn,.tab-btn,.dashboard-tab,.form-control):focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
}

:where(.btn,button,.nav-item,.dropdown-item,.view-toggle-btn,.tab-btn,.dashboard-tab) {
  min-height: var(--touch-target);
}

.top-header,
.header-left,
.header-right,
.section-header,
.academy-view-toolbar,
.academy-filter-grid {
  min-width: 0;
}

.header-left > div,
.page-title,
.page-subtitle {
  min-width: 0;
}

.page-title,
.page-subtitle,
.nav-label,
.btn,
.badge,
.dropdown-item,
.portal-quick-item,
.mobile-bottom-link {
  overflow-wrap: anywhere;
}

@media (max-width: 980px) {
  .top-header {
    height: auto;
    min-height: var(--header-height);
    padding-top: 10px;
    padding-bottom: 10px;
    gap: 10px;
  }
  .header-right {
    gap: 8px;
    justify-content: flex-end;
  }
}

@media (max-width: 860px) {
  body.has-bottom-nav .content-area {
    padding-bottom: 104px !important;
  }
  body.has-bottom-nav .academy-design-fab {
    bottom: 92px;
  }
  body.has-bottom-nav .mobile-bottom-nav {
    display: grid;
  }
  .portal-quick-menu {
    display: block;
  }
  .top-header {
    align-items: flex-start;
  }
  .header-left {
    flex: 1 1 220px;
  }
  .header-right {
    flex: 0 1 auto;
  }
}

@media (max-width: 620px) {
  .design-choice-grid,
  .design-choice-grid.three {
    grid-template-columns: 1fr;
  }
  .academy-design-fab {
    width: 44px;
    height: 44px;
    right: 12px;
  }
  .header-right .btn:not(.portal-quick-trigger):not(.theme-toggle) {
    padding-left: 10px;
    padding-right: 10px;
  }
  #headerUser > div:not(.avatar) {
    display: none !important;
  }
}

@media (max-width: 430px) {
  .mobile-bottom-nav {
    left: 6px;
    right: 6px;
    bottom: 6px;
    border-radius: 14px;
    padding: 6px;
  }
  .mobile-bottom-link {
    min-height: 46px;
    font-size: 0.62rem;
  }
  .portal-quick-panel {
    right: -48px;
  }
}

/* Extended customization controls: color, font, contrast, nav, scrolling, effects */
html {
  font-size: var(--ui-font-size, 15px);
}

body,
.app-wrapper,
.login-page,
.public-wrapper,
.blog-wrapper {
  filter: brightness(var(--ui-brightness, 1)) saturate(var(--ui-saturation, 1));
}

[data-bg-style="aurora"] {
  --bg-gradient: linear-gradient(145deg,var(--primary-glow),transparent 34%),linear-gradient(35deg,rgba(251,191,36,0.12),transparent 32%),linear-gradient(135deg,var(--bg-deep-1) 0%,var(--bg-deep-2) 48%,var(--bg-deep-3) 100%);
}

[data-bg-style="clean"][data-theme="dark"] {
  --bg-gradient: linear-gradient(135deg,#08111f 0%,#101827 100%);
}

[data-bg-style="clean"][data-theme="light"] {
  --bg-gradient: linear-gradient(135deg,#ffffff 0%,#f6f8fb 100%);
}

[data-bg-style="mesh"] {
  --bg-gradient:
    radial-gradient(circle at 16% 12%, var(--primary-glow), transparent 28%),
    radial-gradient(circle at 86% 18%, color-mix(in srgb, var(--secondary) 22%, transparent), transparent 30%),
    radial-gradient(circle at 50% 90%, color-mix(in srgb, var(--accent) 18%, transparent), transparent 32%),
    linear-gradient(135deg,var(--bg-deep-1),var(--bg-deep-2) 52%,var(--bg-deep-3));
}

[data-contrast="high"] :where(.glass-panel,.glass-card,.stat-card,.chart-container,.table-container,.modal,.sidebar,.top-header,.student-settings-card) {
  border-color: var(--glass-border-highlight) !important;
}

[data-contrast="high"] :where(.page-title,.section-title,h1,h2,h3,h4,h5,h6,strong,label,th,td,.btn,.nav-item) {
  text-shadow: none;
}

[data-contrast="soft"] :where(.glass-panel,.glass-card,.stat-card,.chart-container,.table-container,.modal,.sidebar,.top-header,.student-settings-card) {
  box-shadow: 0 8px 24px rgba(0,0,0,0.14);
}

:where(.glass-panel,.glass-card,.stat-card,.chart-container,.table-container,.modal,.sidebar,.top-header,.student-settings-card,.dashboard-info-card,.inquiry-card,.internship-card,.fee-student-card) {
  position: relative;
}

:where(.glass-panel,.glass-card,.stat-card,.chart-container,.table-container,.modal,.sidebar,.top-header,.student-settings-card,.dashboard-info-card,.inquiry-card,.internship-card,.fee-student-card)::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(135deg, color-mix(in srgb, var(--primary) 18%, transparent), transparent 42%);
  opacity: var(--ui-highlight-opacity, 0.14);
}

[data-highlight-level="0"] :where(.glass-panel,.glass-card,.stat-card,.chart-container,.table-container,.modal,.sidebar,.top-header,.student-settings-card)::before {
  display: none;
}

.design-range-row {
  display: grid;
  grid-template-columns: minmax(170px, 0.65fr) minmax(160px, 1fr);
  gap: 14px;
  align-items: center;
  border-top: 1px solid var(--glass-border);
  padding: 12px 0;
}

.design-range-row span {
  min-width: 0;
}

.design-range-row strong,
.design-range-row em {
  display: block;
}

.design-range-row em {
  color: var(--primary);
  font-size: 0.76rem;
  font-style: normal;
  font-weight: 800;
}

.design-range-row input[type="range"] {
  width: 100%;
  accent-color: var(--primary);
}

.design-choice-grid.four,
.design-choice-grid.five {
  grid-template-columns: repeat(auto-fit, minmax(115px, 1fr));
}

.design-choice[data-design-setting="uiPalette"]::before {
  content: "";
  display: block;
  width: 100%;
  height: 8px;
  border-radius: 999px;
  margin-bottom: 8px;
  background: linear-gradient(90deg,var(--primary),var(--secondary),var(--accent));
}

.design-choice[data-design-value="teal"]::before { background: linear-gradient(90deg,#5eead4,#8b9cff,#fbbf24); }
.design-choice[data-design-value="blue"]::before { background: linear-gradient(90deg,#60a5fa,#22d3ee,#f59e0b); }
.design-choice[data-design-value="emerald"]::before { background: linear-gradient(90deg,#34d399,#2dd4bf,#facc15); }
.design-choice[data-design-value="violet"]::before { background: linear-gradient(90deg,#c084fc,#60a5fa,#fb7185); }
.design-choice[data-design-value="gold"]::before { background: linear-gradient(90deg,#fbbf24,#38bdf8,#34d399); }

[data-nav-style="pills"] .nav-item {
  border-radius: 999px;
  border: 1px solid transparent;
}

[data-nav-style="pills"] .nav-item.active,
[data-nav-style="pills"] .nav-item:hover {
  border-color: var(--primary);
  background: color-mix(in srgb, var(--primary) 16%, var(--glass-bg-light));
}

[data-nav-style="minimal"] .nav-item {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}

[data-nav-style="minimal"] .nav-item.active {
  color: var(--primary);
  background: transparent;
  border-left: 3px solid var(--primary);
}

[data-icon-style="badge"] .nav-icon,
[data-icon-style="badge"] .stat-icon,
[data-icon-style="badge"] .mobile-bottom-link .nav-icon {
  border: 1px solid var(--glass-border);
  background: color-mix(in srgb, var(--primary) 14%, var(--glass-bg-light));
  border-radius: 10px;
  min-width: 30px;
  min-height: 30px;
  display: inline-grid;
  place-items: center;
}

[data-icon-style="plain"] .nav-icon,
[data-icon-style="plain"] .stat-icon {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
}

[data-icon-style="mono"] .nav-icon,
[data-icon-style="mono"] .stat-icon,
[data-icon-style="mono"] .mobile-bottom-link .nav-icon {
  filter: grayscale(1);
  color: var(--text-main);
}

[data-scroll-style="thin"] ::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

[data-scroll-style="bold"] ::-webkit-scrollbar {
  width: 16px;
  height: 16px;
}

[data-scroll-style="color"] ::-webkit-scrollbar-thumb,
[data-scroll-style="bold"] ::-webkit-scrollbar-thumb {
  background: linear-gradient(135deg,var(--primary),var(--secondary),var(--accent));
  border: 3px solid rgba(7,11,18,0.2);
}

[data-scroll-style="thin"] ::-webkit-scrollbar-thumb {
  background: var(--text-muted);
}

[data-scroll-style="bold"] {
  scrollbar-width: auto;
  scrollbar-color: var(--primary) var(--glass-bg-ultra-light);
}

:where(.btn,button,.nav-item,.dropdown-item,.view-toggle-btn,.tab-btn,.dashboard-tab,.form-control):focus-visible {
  outline-width: var(--ui-outline-size, 2px);
  outline-color: var(--focus-ring);
}

[data-sidebar-size="compact"] .sidebar .brand-text p {
  display: none;
}

[data-sidebar-size="wide"] .nav-label {
  white-space: normal;
}

@media (max-width: 620px) {
  .design-range-row {
    grid-template-columns: 1fr;
  }
}


/* Customization: shared filters, grid/list views, syllabus reviews */
html,body{max-width:100%;}
.academy-global-bar,.notes-subnav,.syllabus-toolbar{display:flex;gap:10px;align-items:center;flex-wrap:wrap;position:relative;z-index:1;background:var(--glass-bg-heavy);border:1px solid var(--glass-border);border-radius:var(--radius-md);padding:12px;backdrop-filter:var(--glass-blur);box-shadow:var(--glass-shadow);margin-bottom:16px}
.academy-global-search,.syllabus-toolbar .search-wrapper{flex:1 1 260px;min-width:220px}.academy-global-bar .form-control,.syllabus-toolbar .form-control{min-height:46px}.view-toggle{display:inline-flex;gap:4px;padding:4px;border:1px solid var(--glass-border);border-radius:var(--radius-md);background:var(--glass-bg-light)}.view-toggle-btn,.notes-subtab{min-width:44px;min-height:48px;border:none;outline:none;border-radius:var(--radius-sm);background:transparent;color:var(--text-main);font-weight:700;font-size:0.95rem}.notes-subtab{padding:12px 22px}.view-toggle-btn.active,.notes-subtab.active{background:linear-gradient(135deg,var(--primary),var(--secondary));color:#000;box-shadow:0 0 20px var(--primary-glow)}.academy-filter-hidden{display:none!important}.content-area{overflow-y:scroll;scrollbar-gutter:stable both-edges}.content-area::-webkit-scrollbar,.nav-menu::-webkit-scrollbar{width:8px;height:8px}.content-area::-webkit-scrollbar-thumb,.nav-menu::-webkit-scrollbar-thumb{background:rgba(94,234,212,.42);border-radius:8px}.content-area::-webkit-scrollbar-track,.nav-menu::-webkit-scrollbar-track{background:rgba(255,255,255,.03)}
body[data-academy-view="grid"] .academy-grid-view:not(table):not(tbody){display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,280px),1fr));gap:16px;align-items:start}body[data-academy-view="grid"] .academy-grid-view>.glass-card{height:100%;margin:0!important}.syllabus-review-wrap{display:flex;flex-direction:column;gap:16px;min-width:0}.syllabus-form-grid{grid-template-columns:repeat(auto-fit,minmax(180px,1fr));gap:12px}.syllabus-editor h4{margin:0 0 14px;color:var(--primary);font-size:1.05rem}.syllabus-list{display:flex;flex-direction:column;gap:16px;min-width:0}.syllabus-card{padding:clamp(16px,2vw,24px);overflow:hidden;border-radius:var(--radius-lg)}.syllabus-card-head{display:flex;justify-content:space-between;gap:14px;align-items:flex-start;flex-wrap:wrap;margin-bottom:14px}.syllabus-card-head h3{margin:0 0 5px;font-size:clamp(1.05rem,2vw,1.22rem);line-height:1.35}.syllabus-card-head p{margin:0;color:var(--text-muted);font-size:.82rem;line-height:1.5}.syllabus-actions{display:flex;gap:8px;align-items:center;flex-wrap:wrap}.syllabus-actions .form-control{width:auto;min-width:130px}.syllabus-topic-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,240px),1fr));gap:12px}.syllabus-topic{display:flex;flex-direction:column;gap:12px;border:1px solid var(--glass-border);background:var(--glass-bg-ultra-light);border-radius:var(--radius-lg);padding:18px;min-height:210px;min-width:0;transition:transform .15s ease,box-shadow .15s ease}.syllabus-topic:hover{box-shadow:var(--glass-shadow)}.topic-title{display:flex;justify-content:space-between;align-items:flex-start;gap:8px;font-weight:700;line-height:1.35;font-size:1.02rem}.syllabus-topic ul{display:flex;flex-direction:column;gap:8px;margin:0;padding:0;list-style:none;color:var(--text-muted);font-size:.92rem;line-height:1.55}.syllabus-topic li{display:flex;justify-content:space-between;gap:8px;align-items:flex-start;border-bottom:1px solid var(--glass-border);padding-bottom:7px}.syllabus-topic li span{min-width:0;overflow-wrap:anywhere}.icon-btn{width:26px;height:26px;min-width:26px;border-radius:var(--radius-sm);border:1px solid var(--glass-border);background:var(--glass-bg-light);color:var(--text-main);line-height:1}.icon-btn.danger{color:var(--danger)}.topic-edit-row{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin-top:auto}.topic-edit-row select,.topic-edit-row input{width:100%;min-width:0;border-radius:var(--radius-sm)}.student-review-form{display:grid;grid-template-columns:90px minmax(0,1fr) auto;gap:8px;align-items:center;margin-top:auto}.review-list{margin-top:14px;display:flex;flex-direction:column;gap:8px}.review-row{display:grid;grid-template-columns:minmax(110px,150px) 80px minmax(160px,1fr) minmax(120px,150px);gap:10px;align-items:center;padding:10px;border:1px solid var(--glass-border);border-radius:var(--radius-md);background:var(--glass-bg-ultra-light);font-size:.88rem;line-height:1.45}.review-row>*{min-width:0;overflow-wrap:anywhere}

/* Syllabus card Layout 2 (alternate style): accent left border by status, pill sub-topics */
#syllabusList.layout-2 .syllabus-topic{border-left:4px solid var(--primary);background:linear-gradient(160deg,var(--glass-bg-light),var(--glass-bg-ultra-light));border-radius:var(--radius-lg)}
#syllabusList.layout-2 .syllabus-topic[data-status="Pending"]{border-left-color:#f5a623}
#syllabusList.layout-2 .syllabus-topic[data-status="Continue"]{border-left-color:var(--primary)}
#syllabusList.layout-2 .syllabus-topic[data-status="Complete"]{border-left-color:var(--success)}
#syllabusList.layout-2 .syllabus-topic[data-status="Leave"],#syllabusList.layout-2 .syllabus-topic[data-status="Left"]{border-left-color:var(--danger)}
#syllabusList.layout-2 .topic-title{text-transform:uppercase;letter-spacing:.03em;font-size:.92rem}
#syllabusList.layout-2 .syllabus-topic ul{display:flex;flex-wrap:wrap;gap:8px}
#syllabusList.layout-2 .syllabus-topic li{border:1px solid var(--glass-border);border-radius:999px;padding:6px 12px;background:var(--glass-bg-light);border-bottom:1px solid var(--glass-border)}
#syllabusList.layout-2 .syllabus-card{border-radius:var(--radius-xl)}
.student-picker{position:relative;min-width:0}
.student-picker-btn{width:100%;text-align:left;cursor:pointer;color:var(--text-main);background:var(--glass-bg-light);display:flex;align-items:center;justify-content:space-between}
.student-picker-panel{position:absolute;top:calc(100% + 6px);left:0;right:0;z-index:20;max-height:220px;overflow-y:auto;background:var(--glass-bg-heavy);border:1px solid var(--glass-border);border-radius:var(--radius-md);box-shadow:var(--glass-shadow);backdrop-filter:var(--glass-blur);padding:6px}
.student-picker-panel.hidden{display:none}
.student-picker-option{display:flex;align-items:center;gap:10px;padding:8px 10px;border-radius:var(--radius-sm);cursor:pointer;font-size:.9rem;color:var(--text-main)}
.student-picker-option:hover{background:var(--glass-bg-light)}
.student-picker-option input[type="checkbox"]{width:16px;height:16px;accent-color:var(--primary);flex-shrink:0}
select[multiple].form-control{background:var(--glass-bg-light);border-radius:var(--radius-md);padding:6px}
select[multiple].form-control option{padding:6px 8px}
@media(max-width:900px){.student-picker-panel{max-height:180px}}
@media(max-width:900px){.top-header{height:auto;min-height:var(--header-height);padding:12px 16px;align-items:flex-start}.header-left,.header-right{width:100%;min-width:0}.header-right{justify-content:flex-start}.academy-global-bar,.syllabus-toolbar{position:relative}.topic-edit-row,.student-review-form,.review-row{grid-template-columns:1fr}.syllabus-actions,.syllabus-actions .form-control,.academy-global-bar>*,.syllabus-toolbar>*{width:100%!important}.notes-subnav{position:relative}.notes-subtab{flex:1 1 150px}}
@media(max-width:560px){.content-area{padding:12px;gap:12px}.glass-panel{padding:14px}.page-title{font-size:1rem}.page-subtitle{font-size:.74rem}.syllabus-topic{padding:14px;min-height:180px}.btn{width:100%;min-height:40px}.view-toggle .btn,.view-toggle-btn{width:auto}.syllabus-topic-grid{grid-template-columns:1fr}}


/* Final portal polish: one-line filters and syllabus buttons.
   NOTE: this "compact one-line" treatment is intentionally scoped to
   min-width:901px only. It previously applied with !important at every
   screen size, which fought the stacked/wrapped mobile layout above
   (900px/560px breakpoints) and forced horizontal scrolling of filter
   bars on tablets and phones. Fixed. */
@media (min-width: 901px) {
  .academy-global-bar,
  .syllabus-toolbar {
    flex-wrap: nowrap;
    align-items: center;
    gap: 10px;
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    padding: 10px 12px;
  }
  .academy-global-bar > *,
  .syllabus-toolbar > * {
    width: auto;
    max-width: none;
    flex-shrink: 0;
  }
  .academy-global-search,
  .syllabus-toolbar .search-wrapper {
    flex: 1 0 360px;
    min-width: 260px;
    max-width: none;
  }
  .academy-global-bar > select.form-control,
  .academy-global-bar-field,
  .syllabus-toolbar > select.form-control {
    flex: 0 0 180px;
    width: 180px;
    min-width: 180px;
  }
  .academy-global-bar .view-toggle {
    flex: 0 0 auto;
    min-width: 106px;
  }
  .notes-subnav {
    flex-wrap: nowrap;
    overflow-x: hidden;
    width: 100%;
    box-sizing: border-box;
  }
  .notes-subtab {
    flex: 1 1 0;
    min-width: 150px;
    width: 50%;
    text-align: center;
  }
  .syllabus-topic-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .syllabus-topic ul {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px 16px;
  }
  #syllabusList[data-view="list"] .syllabus-topic-grid {
    grid-template-columns: 1fr;
  }
  #syllabusList[data-view="list"] .syllabus-topic ul {
    display: flex;
    flex-direction: column;
    gap: 6px;
  }
}
.student-review-form .btn,
.syllabus-actions .btn {
  width: auto;
  white-space: nowrap;
}
.topic-edit-row .btn {
  width: 100%;
  min-width: 0;
  white-space: nowrap;
}
@media (max-width: 560px) {
  .student-review-form .btn,
  .syllabus-actions .btn {
    width: auto !important;
  }
  .topic-edit-row .btn {
    width: 100% !important;
  }
}

/* ============================================================
   33. MOBILE PHONE NAV BAR — sidebar → horizontal scroll nav
   Converts the .sidebar aside into an always-visible horizontal
   navigation bar (left/right scrolling only) for ALL phone sizes,
   from the smallest phones up to the largest phones/phablets.
   Placed last on purpose so it overrides the earlier off-canvas
   (slide-in) sidebar rules for this range.
   ============================================================ */
@media (max-width: 767.98px) {
  .app-wrapper {
    flex-direction: column;
  }

  /* Sidebar becomes a horizontal strip pinned to the top */
  .sidebar {
    position: sticky !important;
    top: 0 !important;
    left: 0 !important;
    right: auto !important;
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    max-height: none !important;
    flex: 0 0 auto !important;
    flex-direction: row !important;
    border-right: none;
    border-bottom: 1px solid var(--glass-border);
    box-shadow: 0 4px 18px rgba(0,0,0,0.14);
    transition: none !important;
    z-index: 150;
    overflow: hidden;
  }
  /* Neutralize desktop collapsed / off-canvas open states on phones */
  .sidebar.mobile-open,
  .sidebar.open,
  .sidebar.collapsed {
    left: 0 !important;
    width: 100% !important;
    flex: 0 0 auto !important;
  }
  .sidebar.collapsed .nav-label,
  .sidebar.collapsed .sidebar-footer-info { display: none; }

  /* No overlay / hamburger needed — the bar is always visible */
  .sidebar-overlay { display: none !important; }
  .toggle-sidebar-btn { display: none !important; }
  .scroll-hint { display: none !important; }

  /* Compact brand mark on the left, fixed (doesn't scroll) */
  .sidebar-header {
    padding: 8px 10px;
    gap: 8px;
    border-bottom: none;
    border-right: 1px solid var(--glass-border);
    flex-shrink: 0;
    background: none;
  }
  .sidebar-header .brand-text { display: none; }
  .sidebar .brand-icon { width: 32px; height: 32px; font-size: 0.95rem; border-radius: 9px; }

  /* Scrollable nav strip — left/right scroll only, no wrapping */
  .nav-menu {
    flex: 1 1 auto;
    flex-direction: row !important;
    align-items: center;
    min-width: 0;
    padding: 6px 8px;
    gap: 4px;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: var(--primary) transparent;
    white-space: nowrap;
  }
  .nav-menu::-webkit-scrollbar { height: 5px; }
  .nav-menu::-webkit-scrollbar-thumb { background: var(--primary); border-radius: 4px; }
  .nav-menu::-webkit-scrollbar-track { background: transparent; }

  /* Section labels don't fit a horizontal bar */
  .nav-section-title { display: none; }

  .nav-item {
    flex: 0 0 auto;
    flex-direction: column;
    justify-content: center;
    gap: 2px;
    padding: 6px 12px;
    font-size: 0.66rem;
    border-radius: 10px;
    white-space: nowrap;
    text-align: center;
  }
  .nav-item .nav-icon { font-size: 1.15rem; }
  .nav-item.active { border-left: none; border: 1px solid rgba(94,234,212,0.3); }
  .nav-item .nav-label { font-size: 0.62rem; line-height: 1.1; white-space: nowrap !important; }
  .nav-badge {
    margin-left: 0;
    display: inline-block;
    transform: translateY(-1px);
  }

  /* Footer collapses to just the logout icon, fixed at the right */
  .sidebar-footer {
    display: flex;
    align-items: center;
    padding: 6px 8px;
    border-top: none;
    border-left: 1px solid var(--glass-border);
    background: none;
    flex-shrink: 0;
  }
  .sidebar-footer-info { display: none; }
  .sidebar-footer .btn.w-full {
    width: auto !important;
    padding: 8px 10px;
    font-size: 0.72rem;
    white-space: nowrap;
  }
}

/* Extra breathing room on the very smallest phones so the bar
   still scrolls smoothly without items feeling too cramped */
@media (max-width: 360px) {
  .nav-item { padding: 5px 9px; }
  .nav-item .nav-icon { font-size: 1.05rem; }
  .nav-item .nav-label { font-size: 0.58rem; }
  .sidebar-header { padding: 6px 8px; }
  .sidebar .brand-icon { width: 28px; height: 28px; font-size: 0.85rem; }
}

/* ============================================================
   34. NOTES & SYLLABUS SUB-TABS — bigger, more professional,
   and horizontally scrollable on small screens.
   Covers both:
   - .notes-subtab   (the "Notes" / "Syllabus Reviews" toggle,
                       teacher-notes.html + student-portal.html)
   - .notes-filter-row .notes-filter-btn / .s-notes-filter
     (the All / Notes / Syllabus / Assignment / ... filter chips)
   Appended last so it wins over the earlier, smaller sizing.
   ============================================================ */

/* ---- Main Notes / Syllabus Reviews toggle ---- */
.notes-subnav {
  gap: 10px;
  padding: 10px;
}
.notes-subtab {
  min-height: 56px;
  padding: 15px 30px;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.2px;
  border-radius: var(--radius-md);
  flex-shrink: 0;
  transition: var(--transition);
}
.notes-subtab:hover:not(.active) {
  background: var(--glass-bg-light);
  color: var(--text-main);
}

/* ---- Filter chip row (All / Notes / Syllabus / Assignment ...) ---- */
.notes-filter-row {
  align-items: center;
}
.notes-filter-btn,
.s-notes-filter {
  min-height: 44px;
  padding: 11px 20px;
  font-size: 0.92rem;
  font-weight: 600;
  border-radius: var(--radius-md);
}

/* ---- Scrollable, no-wrap layout from tablet width down ---- */
@media (max-width: 900px) {
  .notes-subnav {
    flex-wrap: nowrap !important;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: var(--primary) transparent;
  }
  .notes-subnav::-webkit-scrollbar { height: 6px; }
  .notes-subnav::-webkit-scrollbar-thumb { background: var(--primary); border-radius: 4px; }
  .notes-subnav::-webkit-scrollbar-track { background: transparent; }
  .notes-subtab {
    flex: 0 0 auto !important;
    width: auto !important;
    min-width: 180px;
    white-space: nowrap;
  }

  .notes-filter-row {
    flex-wrap: nowrap !important;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: var(--primary) transparent;
    padding-bottom: 4px;
  }
  .notes-filter-row::-webkit-scrollbar { height: 6px; }
  .notes-filter-row::-webkit-scrollbar-thumb { background: var(--primary); border-radius: 4px; }
  .notes-filter-row::-webkit-scrollbar-track { background: transparent; }
  .notes-filter-btn,
  .s-notes-filter {
    flex-shrink: 0;
    white-space: nowrap;
  }
}

/* ---- Tablet / large phone tightening ---- */
@media (max-width: 600px) {
  .notes-subtab {
    min-height: 52px;
    padding: 13px 26px;
    font-size: 0.98rem;
    min-width: 160px;
  }
  .notes-filter-btn,
  .s-notes-filter {
    min-height: 42px;
    padding: 10px 18px;
    font-size: 0.88rem;
  }
}

/* ---- Standard phones ---- */
@media (max-width: 480px) {
  .notes-subtab {
    min-height: 48px;
    padding: 12px 22px;
    font-size: 0.92rem;
    min-width: 150px;
  }
  .notes-filter-btn,
  .s-notes-filter {
    min-height: 40px;
    padding: 9px 16px;
    font-size: 0.84rem;
  }
}

/* ---- Smallest phones — keep touch targets usable, still scrollable ---- */
@media (max-width: 360px) {
  .notes-subtab {
    min-height: 46px;
    padding: 11px 18px;
    font-size: 0.86rem;
    min-width: 138px;
  }
  .notes-filter-btn,
  .s-notes-filter {
    min-height: 38px;
    padding: 8px 14px;
    font-size: 0.8rem;
  }
}

/* ============================================================
   35. STAT CARD VALUES — auto-shrink to fit, never wrap
   Large currency/number values (e.g. "₹11,13,19,900") used to
   wrap onto two lines inside narrow stat cards. Each .stat-card
   now measures its own rendered width (container query) and the
   .stat-value font-size steps down automatically so the number
   always fits on a single line, on any screen size or grid
   column count, without needing per-page tweaks.
   ============================================================ */
@supports (container-type: inline-size) {
  .stat-card {
    container-type: inline-size;
    container-name: stat-card;
  }
  .stat-value {
    white-space: nowrap;
    overflow-wrap: normal;
  }
  @container stat-card (max-width: 280px) {
    .stat-value { font-size: 1.6rem; }
  }
  @container stat-card (max-width: 240px) {
    .stat-value { font-size: 1.4rem; }
  }
  @container stat-card (max-width: 200px) {
    .stat-value { font-size: 1.2rem; }
  }
  @container stat-card (max-width: 170px) {
    .stat-value { font-size: 1.05rem; }
  }
  @container stat-card (max-width: 140px) {
    .stat-value { font-size: 0.92rem; }
  }
}
