/* ==========================================================================
   CSS CUSTOM VARIABLES & COLOR SCHEME DESIGN
   ========================================================================== */

/* Global base variables */
:root {
  --font-family: 'Outfit', sans-serif;
  --transition-smooth: background 0.12s ease-out, border-color 0.12s ease-out, color 0.12s ease-out, opacity 0.12s ease-out, transform 0.12s ease-out, box-shadow 0.12s ease-out;
  --border-radius-sm: 8px;
  --border-radius-md: 12px;
  --border-radius-lg: 20px;
  --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.15), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.25), 0 10px 10px -5px rgba(0, 0, 0, 0.1);
  --sidebar-width: 280px;

  /* Safe area insets for mobile APK (status bar, notch, nav bar) */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);

  /* Global Success/Warning states */
  --color-success: HSL(142, 70%, 45%);
  --color-warning: HSL(38, 92%, 50%);
  --color-error: HSL(350, 89%, 60%);
  --color-info: HSL(199, 89%, 48%);
}

/* Default / Neutral Portal Theme & Enforced Unified Design System */
.theme-default,
.theme-sch001,
.theme-sch002,
.theme-sch003,
.theme-all,
:root {
  --primary-hue: 220;
  --primary-sat: 76%;
  --primary-lightness: 52%;
  --accent-hue: 195;
  --accent-sat: 90%;
  --accent-lightness: 42%;
  --bg-gradient-start: #0a0e17;
  --bg-gradient-end: #101524;
}

/* Semantic helper properties calculated from dynamic HSL */
body {
  --primary: HSL(var(--primary-hue), var(--primary-sat), var(--primary-lightness));
  --primary-hover: HSL(var(--primary-hue), var(--primary-sat), calc(var(--primary-lightness) - 8%));
  --accent: HSL(var(--accent-hue), var(--accent-sat), var(--accent-lightness));

  /* Glassmorphism Surface Variables (Dark Premium aesthetic) */
  --bg-surface: rgba(17, 24, 39, 0.55);
  --bg-sidebar: rgba(13, 17, 28, 0.75);
  --bg-card: rgba(30, 41, 59, 0.35);
  --bg-modal: rgba(15, 23, 42, 0.85);
  --border-color: rgba(255, 255, 255, 0.06);
  --border-glow: rgba(255, 255, 255, 0.02);
  --text-main: #ffffff;
  --text-muted: #cbd5e1;
  /* Increased contrast from #94a3b8 */
  --text-inverse: #0f172a;
}

/* ==========================================================================
   BASE STYLES & RESET
   ========================================================================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-gradient-end);
  background-image: radial-gradient(circle at 50% 0%, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%);
  background-repeat: no-repeat;
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
  transition: var(--transition-smooth);
}

a {
  text-decoration: none;
  color: inherit;
}

button,
input,
select,
textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  background: transparent;
  border: none;
  outline: none;
}

/* Custom Webkit scrollbar for premium feel */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* ==========================================================================
   UTILITY CLASSES & ANIMATIONS
   ========================================================================== */
.hidden {
  display: none !important;
}

.col-span-2 {
  grid-column: span 2;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.96);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes pulseGlow {

  0%,
  100% {
    opacity: 0.25;
  }

  50% {
    opacity: 0.45;
  }
}

/* ==========================================================================
   BUTTONS
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--border-radius-sm);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: var(--transition-smooth);
  position: relative;
  overflow: hidden;
}

.btn-primary {
  background: var(--primary);
  color: var(--text-inverse);
  box-shadow: 0 4px 14px hsla(var(--primary-hue), var(--primary-sat), var(--primary-lightness), 0.35);
}

.btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-1.5px);
  box-shadow: 0 6px 18px hsla(var(--primary-hue), var(--primary-sat), var(--primary-lightness), 0.45);
}

.btn-outline {
  border: 1px solid var(--border-color);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-main);
}

.btn-outline:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-1.5px);
}

.btn-danger-outline {
  border: 1px solid rgba(239, 68, 68, 0.2);
  background: rgba(239, 68, 68, 0.04);
  color: var(--color-error);
}

.btn-danger-outline:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: var(--color-error);
}

.btn-block {
  display: flex;
  width: 100%;
}

/* ==========================================================================
   LOGIN SCREEN
   ========================================================================== */
#login-container {
  width: 100vw;
  height: 100vh;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 100000;
  background-color: #0b0f19;
  background-image: radial-gradient(circle at 50% 50%, #111827 0%, #030712 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

/* ==========================================================================
   LOGIN SCREEN (SPLIT RESPONSIVE DESIGN)
   ========================================================================== */
.login-split-wrapper {
  display: flex;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background-color: #030712;
}

/* --- PRESENTATION PANEL (Left Desktop, Top Background Mobile) --- */
.login-presentation {
  position: relative;
  flex: 1.2;
  background: linear-gradient(135deg, #1e1b4b 0%, #0f172a 100%);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 60px;
  overflow: hidden;
}

.presentation-bg-animated {
  position: absolute;
  top: -30%;
  left: -20%;
  width: 150%;
  height: 150%;
  background: radial-gradient(circle at 30% 50%, rgba(99, 102, 241, 0.15), transparent 60%),
    radial-gradient(circle at 70% 80%, rgba(168, 85, 247, 0.1), transparent 50%);
  z-index: 0;
  animation: slowPan 15s ease-in-out infinite alternate;
}

@keyframes slowPan {
  0% {
    transform: scale(1) translate(0, 0);
  }

  100% {
    transform: scale(1.1) translate(-2%, 2%);
  }
}

.presentation-shapes .shape {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  z-index: 1;
}

.shape-1 {
  width: 400px;
  height: 400px;
  background: rgba(59, 130, 246, 0.2);
  top: -100px;
  right: -100px;
}

.shape-2 {
  width: 300px;
  height: 300px;
  background: rgba(139, 92, 246, 0.2);
  bottom: -50px;
  left: -50px;
}

.presentation-content {
  position: relative;
  z-index: 5;
  max-width: 480px;
}

.presentation-logo {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-size: 1.8rem;
  font-weight: 800;
  color: #fff;
  margin-bottom: 40px;
  padding: 12px 24px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  backdrop-filter: blur(10px);
}

.presentation-title {
  font-size: 3.5rem;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -1.5px;
  margin-bottom: 20px;
  background: linear-gradient(to right, #ffffff, #94a3b8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.presentation-subtitle {
  font-size: 1.2rem;
  color: #94a3b8;
  line-height: 1.6;
}

/* --- INTERACTION PANEL (Right Desktop, Bottom Sheet Mobile) --- */
.login-interaction {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(20px);
  border-left: 1px solid rgba(255, 255, 255, 0.05);
  position: relative;
  z-index: 10;
}

.interaction-card {
  width: 100%;
  max-width: 440px;
  padding: 40px;
}

.mobile-drag-handle {
  display: none;
}

.interaction-header {
  margin-bottom: 32px;
}

.interaction-heading {
  font-size: 2rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.5px;
  margin-bottom: 8px;
}

.interaction-subheading {
  color: #94a3b8;
  font-size: 1rem;
}

.interaction-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.form-group-modern {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-group-modern label {
  font-size: 0.85rem;
  font-weight: 600;
  color: #cbd5e1;
}

.input-modern-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 16px;
  width: 20px;
  height: 20px;
  color: #64748b;
  pointer-events: none;
  transition: color 0.2s;
}

.input-modern-wrapper input {
  width: 100%;
  height: 52px;
  padding: 0 16px 0 48px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  color: #fff;
  font-size: 1rem;
  transition: all 0.2s;
}

.input-modern-wrapper input:focus {
  background: rgba(255, 255, 255, 0.06);
  border-color: #3b82f6;
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15);
  outline: none;
}

.input-modern-wrapper input:focus~.input-icon {
  color: #3b82f6;
}

.toggle-pwd-btn {
  position: absolute;
  right: 12px;
  background: none;
  border: none;
  color: #64748b;
  cursor: pointer;
  padding: 8px;
}

.btn-modern-primary {
  height: 52px;
  background: linear-gradient(135deg, #3b82f6, #6366f1);
  border: none;
  border-radius: 12px;
  color: #fff;
  font-size: 1.05rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  margin-top: 10px;
  box-shadow: 0 8px 20px rgba(59, 130, 246, 0.3);
  transition: transform 0.2s, box-shadow 0.2s;
}

.btn-modern-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 24px rgba(59, 130, 246, 0.4);
}

.quick-login-divider {
  display: flex;
  align-items: center;
  margin: 30px 0;
  color: #475569;
  font-size: 0.85rem;
  font-weight: 600;
}

.quick-login-divider::before,
.quick-login-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: rgba(255, 255, 255, 0.05);
}

.quick-login-divider span {
  padding: 0 16px;
}

.quick-login-grid-modern {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.quick-login-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  color: #cbd5e1;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.quick-login-btn svg {
  width: 16px;
  height: 16px;
  color: #64748b;
  transition: color 0.2s;
}

.quick-login-btn:hover {
  background: rgba(59, 130, 246, 0.1);
  border-color: rgba(59, 130, 246, 0.4);
  color: #fff;
}

.quick-login-btn:hover svg {
  color: #60a5fa;
}

.interaction-footer {
  margin-top: 32px;
  text-align: center;
  color: #475569;
  font-size: 0.85rem;
}

.modern-install-btn {
  margin: 16px auto 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #94a3b8;
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.modern-install-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
}

.mobile-brand-header {
  display: none;
}

/* ==========================================================================
   MOBILE LOGIN LAYOUT OVERRIDES (MINIMALIST CARD STYLE)
   ========================================================================== */
@media (max-width: 1023px) {
  .login-split-wrapper {
    flex-direction: column;
    justify-content: center;
    background: #030712;
    background-image: radial-gradient(circle at 50% -20%, #1e1b4b 0%, #030712 80%);
    padding: 24px;
  }

  .login-presentation {
    display: none;
    /* Hide desktop presentation for a pure minimal mobile look */
  }

  .login-interaction {
    flex: none;
    width: 100%;
    background: rgba(17, 24, 39, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 24px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.02) inset;
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    margin: 0 auto;
    max-width: 400px;
  }

  .interaction-card {
    padding: 32px 24px;
  }

  .mobile-drag-handle {
    display: none;
  }

  .mobile-brand-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 24px;
  }

  .mobile-logo-circle {
    width: 60px;
    height: 60px;
    border-radius: 18px;
    background: linear-gradient(135deg, var(--primary, #3b82f6), #8b5cf6);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 25px rgba(59, 130, 246, 0.4);
  }

  .mobile-logo-circle svg {
    width: 30px;
    height: 30px;
    stroke: #fff;
  }

  .interaction-header {
    text-align: center;
    margin-bottom: 24px;
  }

  .interaction-heading {
    font-size: 1.8rem;
    margin-bottom: 6px;
  }

  .interaction-subheading {
    font-size: 0.95rem;
  }

  .btn-modern-primary {
    height: 52px;
  }
}

/* Bulk Status Updates */
#upload-logs {
  font-family: monospace;
  font-size: 0.8rem;
  color: #64748b;
}

/* --- ATTENDANCE SEGMENTED CONTROLS --- */
.att-radio-wrapper {
  cursor: pointer;
  display: inline-flex;
}

.hidden-radio {
  display: none;
}

.att-lbl {
  padding: 6px 16px;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  transition: all 0.2s ease;
  user-select: none;
}

.att-radio-wrapper:hover .att-lbl {
  border-color: var(--text-muted);
}

.hidden-radio:checked+.att-present-lbl {
  background: rgba(34, 197, 94, 0.1);
  color: #16a34a;
  border-color: #16a34a;
}

.hidden-radio:checked+.att-absent-lbl {
  background: rgba(239, 68, 68, 0.1);
  color: #dc2626;
  border-color: #dc2626;
}

.hidden-radio:checked+.att-sa-lbl {
  background: rgba(59, 130, 246, 0.1);
  color: #2563eb;
  border-color: #2563eb;
}

/* --- DASHBOARD GRIDS --- */
.dashboard-grid-1-2,
.dashboard-grid-2-1,
.dashboard-grid-3-2 {
  display: grid;
  gap: 24px;
  margin-bottom: 24px;
  grid-template-columns: 1fr;
}

@media (min-width: 992px) {
  .dashboard-grid-1-2 {
    grid-template-columns: 1fr 2fr;
  }

  .dashboard-grid-2-1 {
    grid-template-columns: 2fr 1fr;
  }

  .dashboard-grid-3-2 {
    grid-template-columns: 3fr 2fr;
  }
}

/* ==========================================================================
   MAIN APP GRID LAYOUT
   ========================================================================== */
#app-container {
  display: flex;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  animation: fadeIn 0.4s ease-out;
}

/* Sidebar Navigation */
.sidebar {
  width: var(--sidebar-width);
  height: 100%;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  backdrop-filter: blur(25px);
  display: flex;
  flex-direction: column;
  padding: calc(24px + var(--safe-top)) 24px 24px calc(24px + var(--safe-left));
  z-index: 90000;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-header {
  margin-bottom: 35px;
}

.school-branding {
  display: flex;
  align-items: center;
  gap: 12px;
}

.school-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: var(--border-radius-sm);
  background: hsla(var(--primary-hue), var(--primary-sat), var(--primary-lightness), 0.1);
  color: var(--primary);
  border: 1px solid hsla(var(--primary-hue), var(--primary-sat), var(--primary-lightness), 0.15);
  flex-shrink: 0;
}

.school-info h3 {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 160px;
}

#school-id-badge {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent);
  background: hsla(var(--accent-hue), var(--accent-sat), var(--accent-lightness), 0.1);
  padding: 1px 6px;
  border-radius: 4px;
}

.sidebar-nav {
  flex-grow: 1;
}

.sidebar-nav ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--border-radius-sm);
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.95rem;
  transition: var(--transition-smooth);
}

.nav-link svg {
  transition: var(--transition-smooth);
}

.nav-link:hover,
.nav-link.active {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.04);
}

.nav-link.active {
  background: hsla(var(--primary-hue), var(--primary-sat), var(--primary-lightness), 0.1);
  color: var(--primary);
  border-left: 3px solid var(--primary);
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
}

.nav-link.active svg {
  color: var(--primary);
}

/* Sidebar Collapsed State (Desktop) */
/* Sidebar Collapsed State (Desktop) */
@media (min-width: 901px) {
  .sidebar {
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1), padding 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    white-space: nowrap;
  }

  .sidebar .school-info,
  .sidebar .nav-link span,
  .sidebar .user-details,
  .sidebar #logout-btn span {
    transition: opacity 0.2s ease, max-width 0.2s ease, margin 0.2s ease;
    opacity: 1;
    max-width: 200px;
    overflow: hidden;
    display: inline-block;
    white-space: nowrap;
    vertical-align: middle;
  }

  .sidebar.collapsed {
    width: 88px;
    padding: 24px 16px;
  }

  .sidebar.collapsed .school-info,
  .sidebar.collapsed .nav-link span,
  .sidebar.collapsed .user-details,
  .sidebar.collapsed #logout-btn span {
    display: none !important;
  }

  .sidebar.collapsed .sidebar-header {
    justify-content: center;
  }

  .sidebar.collapsed .school-logo {
    margin: 0 auto;
    width: 58px !important;
    height: 58px !important;
  }

  .sidebar.collapsed .school-logo img {
    width: 58px !important;
    height: auto !important;
  }

  .sidebar.collapsed .nav-link {
    justify-content: center;
    padding: 12px 0;
    gap: 0;
  }

  .sidebar.collapsed .nav-link svg {
    margin: 0;
  }

  .sidebar.collapsed .user-profile-badge {
    justify-content: center;
  }

  .sidebar.collapsed #logout-btn {
    padding: 10px;
    justify-content: center;
  }


}

/* Floating Desktop Toggle Button */
.sidebar-collapse-toggle {
  position: absolute;
  right: -16px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 100000;
  color: var(--text-muted);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(255, 255, 255, 0.05) inset;
  transition: all 0.2s ease;
  padding: 0;
  outline: none;
}

.sidebar-collapse-toggle:hover {
  color: var(--primary);
  border-color: var(--primary);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2), 0 0 0 1px rgba(255, 255, 255, 0.1) inset;
  transform: translateY(-50%) scale(1.05);
}

.sidebar-collapse-toggle:active {
  transform: translateY(-50%) scale(0.95);
}

.sidebar-collapse-toggle svg {
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: block;
}

.sidebar.collapsed .sidebar-collapse-toggle svg {
  transform: rotate(180deg);
}

@media (max-width: 900px) {
  .sidebar-collapse-toggle {
    display: none !important;
  }
}

.sidebar-footer {
  margin-top: auto;
  border-top: 1px solid var(--border-color);
  padding-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.user-profile-badge {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--primary);
  color: var(--text-inverse);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.95rem;
  box-shadow: 0 0 10px hsla(var(--primary-hue), var(--primary-sat), var(--primary-lightness), 0.3);
}

.user-details h4 {
  font-size: 0.9rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 140px;
}

#user-role-badge {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.5px;
}

/* Main Viewport styling */
.main-content {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow-y: auto;
}

.content-header {
  padding: calc(30px + var(--safe-top)) calc(40px + var(--safe-right)) 30px 40px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
  backdrop-filter: blur(10px);
  background: rgba(15, 23, 42, 0.2);
  flex-shrink: 0;
  width: 100%;
  z-index: 1000;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: 1;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-left: auto;
}

.header-left h2 {
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.header-left p {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.api-status-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 500;
}

.status-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.status-indicator.online {
  background: var(--color-success);
  box-shadow: 0 0 8px var(--color-success);
}

.status-indicator.mock {
  background: var(--color-warning);
  box-shadow: 0 0 8px var(--color-warning);
}

.view-viewport {
  padding: 40px;
  flex-grow: 1;
}

/* view-panel styles are defined in the SMOOTH PAGE TRANSITIONS section below */
/* ==========================================================================
   UNIVERSAL SHARED COMPONENTS (Metric Grid, Section Cards, List Rows)
   — works on ALL screen sizes, not just mobile
   ========================================================================== */

.mobile-metric-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}

.mobile-metric-card {
  background: rgba(22, 30, 50, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 120px;
  position: relative;
  overflow: hidden;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  cursor: default;
  -webkit-tap-highlight-color: transparent;
}

.mobile-metric-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(255, 255, 255, 0.08) inset;
}

.mobile-metric-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent 0%, hsla(var(--primary-hue), var(--primary-sat), var(--primary-lightness), 0.5) 50%, transparent 100%);
  border-radius: 16px 16px 0 0;
}

.mobile-metric-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: hsla(var(--primary-hue), var(--primary-sat), var(--primary-lightness), 0.15);
  border: 1px solid hsla(var(--primary-hue), var(--primary-sat), var(--primary-lightness), 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 10px;
  transition: all 0.2s ease;
}

.mobile-metric-card:hover .mobile-metric-icon {
  background: hsla(var(--primary-hue), var(--primary-sat), var(--primary-lightness), 0.22);
}

.mobile-metric-icon svg {
  width: 22px;
  height: 22px;
  stroke: var(--primary);
  filter: drop-shadow(0 0 6px hsla(var(--primary-hue), var(--primary-sat), var(--primary-lightness), 0.4));
}

.mobile-metric-value {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.5px;
  line-height: 1;
  margin-bottom: 5px;
}

.mobile-metric-label {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

/* Attendance status color variants */
.mobile-metric-card.status-present .mobile-metric-icon {
  background: rgba(16, 185, 129, 0.15);
  border-color: rgba(16, 185, 129, 0.3);
}

.mobile-metric-card.status-present .mobile-metric-icon svg {
  stroke: #10b981;
  filter: drop-shadow(0 0 6px rgba(16, 185, 129, 0.4));
}

.mobile-metric-card.status-present .mobile-metric-value {
  color: #10b981;
}

.mobile-metric-card.status-absent .mobile-metric-icon {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.3);
}

.mobile-metric-card.status-absent .mobile-metric-icon svg {
  stroke: #ef4444;
  filter: drop-shadow(0 0 6px rgba(239, 68, 68, 0.4));
}

.mobile-metric-card.status-absent .mobile-metric-value {
  color: #ef4444;
}

/* Section Cards */
.mobile-section-card {
  background: rgba(22, 30, 50, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 16px;
  overflow: hidden;
  margin-bottom: 18px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.mobile-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.mobile-section-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}

.mobile-section-title svg {
  width: 15px;
  height: 15px;
  stroke: var(--primary);
}

.mobile-section-body {
  padding: 0;
}

.mobile-list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  transition: background 0.15s ease;
  gap: 12px;
}

.mobile-list-row:last-child {
  border-bottom: 0;
}

.mobile-list-row:hover {
  background: rgba(255, 255, 255, 0.03);
}

.mobile-list-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.mobile-list-primary {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mobile-list-secondary {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.mobile-list-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

/* Quick Action Buttons */
.mobile-quick-actions {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}

.mobile-action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 12px;
  border-radius: 12px;
  background: hsla(var(--primary-hue), var(--primary-sat), var(--primary-lightness), 0.1);
  border: 1px solid hsla(var(--primary-hue), var(--primary-sat), var(--primary-lightness), 0.18);
  color: var(--primary);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

.mobile-action-btn:hover {
  background: hsla(var(--primary-hue), var(--primary-sat), var(--primary-lightness), 0.2);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
}

.mobile-action-btn svg {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
}

/* Status Pills */
.att-pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.att-pill.present {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.att-pill.absent {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.att-pill.late {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

/* Tablet: 2-column metric grid */
@media (max-width: 1024px) {
  .mobile-metric-grid {
    grid-template-columns: 1fr 1fr;
  }

  .mobile-quick-actions {
    grid-template-columns: 1fr 1fr;
  }
}

/* ==========================================================================
   PANEL LAYOUTS AND CONTAINER CARDS
   ========================================================================== */
.panel-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  box-shadow: var(--shadow-md);
  padding: 24px;
  margin-bottom: 24px;
  overflow: hidden;
  transition: var(--transition-smooth);
}

.panel-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(255, 255, 255, 0.1) inset;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.panel-header h3 {
  font-size: 1.25rem;
  font-weight: 700;
}

/* Grids and Stats Panels */
.grid-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  padding: 24px;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

.stat-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--primary);
}

.stat-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.stat-value {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.2;
}

.stat-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ==========================================================================
   ROLE-SPECIFIC COMPONENT LAYOUTS
   ========================================================================== */

/* 1. Student Dashboard Progress Rings / SVG Charts */
.student-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

@media (max-width: 900px) {
  .student-grid {
    grid-template-columns: 1fr;
  }
}

.gpa-card {
  background: linear-gradient(135deg, hsla(var(--primary-hue), var(--primary-sat), var(--primary-lightness), 0.12) 0%, rgba(255, 255, 255, 0.01) 100%);
  border: 1px solid hsla(var(--primary-hue), var(--primary-sat), var(--primary-lightness), 0.15);
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  padding: 30px;
}

.gpa-radial {
  position: relative;
  width: 120px;
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gpa-radial svg {
  transform: rotate(-90deg);
}

.gpa-radial circle {
  fill: none;
  stroke-width: 8;
}

.gpa-radial .bg {
  stroke: rgba(255, 255, 255, 0.05);
}

.gpa-radial .progress {
  stroke: var(--primary);
  stroke-dasharray: 251.2;
  stroke-dashoffset: calc(251.2 - (251.2 * var(--percent)) / 100);
  stroke-linecap: round;
  transition: stroke-dashoffset 0.8s ease-in-out;
}

.gpa-radial .gpa-val {
  position: absolute;
  font-size: 1.5rem;
  font-weight: 800;
}

.gpa-info h3 {
  font-size: 1.4rem;
  margin-bottom: 8px;
}

/* GPA Calculator Component */
.calc-card h4 {
  margin-bottom: 12px;
  font-size: 1rem;
}

.calc-slider-group {
  margin-top: 15px;
}

.calc-slider-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  margin-bottom: 12px;
}

.calc-slider-item label {
  font-size: 0.85rem;
  width: 120px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.calc-slider-item input[type="range"] {
  flex-grow: 1;
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.1);
  accent-color: var(--primary);
  cursor: pointer;
}

.calc-result-pill {
  background: rgba(255, 255, 255, 0.03);
  padding: 10px 15px;
  border-radius: var(--border-radius-sm);
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 18px;
  font-weight: 600;
  border: 1px solid var(--border-color);
}

/* 2. Parent view Children Feed & Timeline */
.parent-container {
  display: flex;
  flex-direction: column;
  gap: 30px;
}

.child-section-header {
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 10px;
  margin-bottom: 15px;
}

.timeline-feed {
  position: relative;
  padding-left: 24px;
  margin-top: 20px;
}

.timeline-feed::before {
  content: '';
  position: absolute;
  top: 5px;
  left: 5px;
  width: 2px;
  height: calc(100% - 20px);
  background: rgba(255, 255, 255, 0.08);
}

.timeline-item {
  position: relative;
  margin-bottom: 24px;
}

.timeline-marker {
  position: absolute;
  top: 6px;
  left: -24px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg-gradient-end);
  box-shadow: 0 0 8px var(--accent);
}

.timeline-item.excellent .timeline-marker {
  background: var(--color-success);
  box-shadow: 0 0 8px var(--color-success);
}

.timeline-content {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  padding: 16px 20px;
}

.timeline-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.timeline-subject {
  font-size: 0.95rem;
  font-weight: 700;
}

.timeline-score {
  font-weight: 800;
  background: rgba(255, 255, 255, 0.03);
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid var(--border-color);
}

.timeline-body {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.timeline-date {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: block;
  margin-top: 10px;
  text-align: right;
}

/* ==========================================================================
   TABLE GRID CONTAINERS
   ========================================================================== */
.table-container {
  width: 100%;
  overflow-x: auto;
  margin-top: 10px;
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

th,
td {
  padding: 16px 20px;
  font-size: 0.9rem;
  border-bottom: 1px solid var(--border-color);
}

th {
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  font-size: 0.78rem;
  letter-spacing: 0.5px;
  background: rgba(255, 255, 255, 0.01);
}

tr {
  transition: background var(--transition-smooth);
}

tr:hover td {
  background: rgba(255, 255, 255, 0.04);
}

/* Badges inside tables */
.badge {
  display: inline-flex;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}

.badge-active,
.badge-admin {
  background: rgba(34, 197, 94, 0.1);
  color: var(--color-success);
}

.badge-suspended,
.badge-teacher {
  background: rgba(239, 68, 68, 0.1);
  color: var(--color-error);
}

.badge-graduated,
.badge-parent {
  background: rgba(59, 130, 246, 0.1);
  color: var(--color-info);
}

.badge-student {
  background: rgba(234, 179, 8, 0.1);
  color: var(--color-warning);
}

/* Action controls in table rows */
.table-actions {
  display: flex;
  gap: 8px;
}

.btn-icon {
  width: 32px;
  height: 32px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  cursor: pointer;
  transition: var(--transition-smooth);
}

.btn-icon:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-icon-edit {
  color: var(--color-info);
}

.btn-icon-delete {
  color: var(--color-error);
}

/* Spinner and Loaders */
.spinner-container {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 50px 0;
  width: 100%;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(255, 255, 255, 0.06);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s infinite linear;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ==========================================================================
   MODAL WINDOWS
   ========================================================================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(3, 7, 18, 0.7);
  backdrop-filter: blur(8px);
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-smooth);
  opacity: 1;
}

.modal-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.modal-card {
  background: var(--bg-modal);
  backdrop-filter: blur(25px);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-lg), 0 0 50px hsla(var(--primary-hue), var(--primary-sat), var(--primary-lightness), 0.1);
  border-radius: var(--border-radius-md);
  width: 100%;
  max-width: 600px;
  padding: 30px;
  animation: scaleIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 15px;
}

.modal-header h3 {
  font-size: 1.25rem;
  font-weight: 700;
}

.modal-close-btn {
  font-size: 1.8rem;
  font-weight: 300;
  cursor: pointer;
  color: var(--text-muted);
  transition: var(--transition-smooth);
}

.modal-close-btn:hover {
  color: var(--text-main);
}

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

@media (max-width: 600px) {
  .form-grid {
    grid-template-columns: 1fr;
  }
}

.col-span-2 {
  grid-column: span 2;
}

@media (max-width: 600px) {
  .col-span-2 {
    grid-column: span 1;
  }
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  border-top: 1px solid var(--border-color);
  padding-top: 20px;
}

.label-note {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: none;
  font-weight: normal;
}

/* ==========================================================================
   RESPONSIVE DESIGN (GLOBAL)
   ========================================================================== */
@media (max-width: 768px) {
  #app-container {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--border-color);
    padding: 15px 20px;
  }

  .sidebar-header {
    margin-bottom: 15px;
  }

  .sidebar-nav ul {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 5px;
  }

  .nav-link {
    padding: 8px 12px;
    font-size: 0.85rem;
  }

  .nav-link.active {
    border-left: none;
    border-bottom: 3px solid var(--primary);
    border-radius: var(--border-radius-sm);
  }

  .sidebar-footer {
    display: none;
    /* simple mobile design */
  }

  .content-header {
    padding: 20px;
  }

  .view-viewport {
    padding: 20px;
  }

  .panel-card {
    padding: 20px;
  }

  th,
  td {
    padding: 12px 14px;
  }
}

/* ==========================================================================
   ACADEMIC SETUP & IMPORT STYLE ADDITIONS
   ========================================================================== */
.setup-tabs-header .btn-outline {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
}

.setup-tabs-header .btn-outline:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
}

.setup-tabs-header .btn-outline.active-tab {
  background: hsla(var(--primary-hue), var(--primary-sat), var(--primary-lightness), 0.15) !important;
  border-color: var(--primary) !important;
  color: var(--primary) !important;
  box-shadow: 0 0 10px hsla(var(--primary-hue), var(--primary-sat), var(--primary-lightness), 0.15);
}

.setup-tab-panel {
  animation: fadeIn 0.35s ease-out;
}

.setup-tab-panel.hidden {
  display: none !important;
}

.import-upload-zone:hover {
  border-color: var(--primary) !important;
  background: rgba(255, 255, 255, 0.03) !important;
  box-shadow: 0 0 20px hsla(var(--primary-hue), var(--primary-sat), var(--primary-lightness), 0.1);
}

.import-upload-zone svg {
  transition: var(--transition-smooth);
}

.import-upload-zone:hover svg {
  transform: translateY(-2px);
  color: var(--primary-hover);
}

#import-error-console {
  background: rgba(0, 0, 0, 0.2);
  padding: 15px;
  border-radius: var(--border-radius-sm);
  border: 1px solid rgba(239, 68, 68, 0.1);
}

.badge-sa {
  background: rgba(234, 88, 12, 0.1) !important;
  color: var(--color-warning) !important;
}

/* ==========================================================================
   ADVANCED SAAS & ERP DESIGN ADDITIONS
   ========================================================================== */

/* Universal Search & Command Palette */
.header-center {
  flex: 1;
  max-width: 420px;
  margin: 0 24px;
}

.universal-search-container {
  position: relative;
  width: 100%;
}

#universal-search-input {
  width: 100%;
  padding: 10px 60px 10px 45px !important;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-color);
  border-radius: 9999px;
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.88rem;
  transition: all 0.25s ease;
}

#universal-search-input:focus {
  outline: none;
  background: rgba(15, 23, 42, 0.8);
  border-color: var(--primary);
  box-shadow: 0 0 0 3px hsla(var(--primary-hue), var(--primary-sat), var(--primary-lightness), 0.15);
}

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
  transition: color 0.25s ease;
}

#universal-search-input:focus+.search-icon {
  color: var(--primary);
}

.search-kbd {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.72rem;
  background: rgba(255, 255, 255, 0.08);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--text-muted);
  border: 1px solid rgba(255, 255, 255, 0.05);
  pointer-events: none;
  text-transform: uppercase;
  font-weight: 700;
}

.search-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  width: 100%;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.5);
  max-height: 320px;
  overflow-y: auto;
  z-index: 1000;
  animation: slideDown 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.search-result-item:hover {
  background: rgba(255, 255, 255, 0.03);
}

.search-result-item:hover .search-item-title {
  color: var(--primary) !important;
}

/* Step-by-Step Wizard */
.wizard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-color);
}

.wizard-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  opacity: 0.4;
  transition: opacity 0.3s ease;
}

.wizard-step.active {
  opacity: 1;
}

.wizard-step .step-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  border: 2px solid var(--border-color);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
  transition: all 0.3s ease;
}

.wizard-step.active .step-icon {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--text-inverse);
  box-shadow: 0 0 12px hsla(var(--primary-hue), var(--primary-sat), var(--primary-lightness), 0.4);
}

.wizard-step .step-title {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.wizard-step.active .step-title {
  color: var(--primary);
}

.wizard-connector {
  flex-grow: 1;
  height: 2px;
  background: var(--border-color);
  margin: 0 12px;
  transform: translateY(-12px);
}

.wizard-section {
  display: none;
}

.wizard-section.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

.review-panel-summary {
  background: rgba(255, 255, 255, 0.01);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  padding: 20px;
}

.review-table {
  width: 100%;
  border-collapse: collapse;
}

.review-table td {
  padding: 10px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.02);
  font-size: 0.88rem;
}

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

/* Animations */
@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ==========================================================================
   18. NEW ER-LEVEL COMPONENT STYLING (TEACHERS DIRECTORY & CLASS HUB)
   ========================================================================== */

/* Badge categories */
.badge-grade {
  background: rgba(14, 165, 233, 0.15);
  color: #0ea5e9;
  border: 1px solid rgba(14, 165, 233, 0.3);
  padding: 4px 8px;
  font-size: 0.75rem;
  border-radius: var(--border-radius-sm);
  font-weight: 600;
}

/* Modal form assignment containers */
#hire-teacher-assignments-container span {
  animation: fadeIn 0.25s ease;
}

/* Table overrides and spacing inside modals */
#class-hub-students-body tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

#class-hub-teachers-list div {
  animation: fadeIn 0.25s ease;
  transition: var(--transition-smooth);
}

#class-hub-teachers-list div:hover {
  border-color: var(--primary) !important;
  box-shadow: 0 0 8px rgba(99, 102, 241, 0.15);
}

/* ==========================================================================
   19. RESPONSIVENESS & UI POLISH (PHASE 3)
   ========================================================================== */

/* Clickable Table Rows */
.clickable-row {
  transition: var(--transition-smooth);
}

.clickable-row:hover {
  background-color: rgba(255, 255, 255, 0.04);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

/* Responsive Grid / Flex Adjustments */
@media screen and (max-width: 1024px) {
  .page-container {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    height: auto;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    border-right: none;
    border-bottom: 1px solid var(--border-color);
  }

  .sidebar-header {
    margin-bottom: 0;
  }

  .sidebar-nav ul {
    display: flex;
    gap: 10px;
    overflow-x: auto;
  }

  .sidebar-nav li {
    margin-bottom: 0;
    white-space: nowrap;
  }

  .sidebar-footer {
    border-top: none;
    margin-top: 0;
    padding-top: 0;
  }
}

@media screen and (max-width: 768px) {
  .student-profile-info {
    grid-template-columns: 1fr !important;
  }

  .universal-search-container {
    display: flex;
    margin-top: 8px;
    width: 100%;
  }

  .header-center {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .content-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

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

  /* Modals should take full width */
  .modal-content {
    width: 95%;
    margin: 2% auto;
    padding: 1.5rem;
  }

  .wizard-steps {
    flex-direction: column;
    gap: 10px;
  }

  .login-card-wrapper {
    padding: 10px;
  }

  .login-card {
    padding: 24px;
  }

  .login-title {
    font-size: 1.8rem;
  }
}

/* ==========================================================================
   14. MASTER GLOBAL DASHBOARD DESIGN SYSTEM
   ========================================================================== */

/* Progress Bar container for average grades */
.progress-bar-container {
  display: flex;
  align-items: center;
  gap: 8px;
}

.progress-bar-outer {
  flex: 1;
  background: rgba(255, 255, 255, 0.08);
  height: 6px;
  border-radius: 3px;
  overflow: hidden;
}

.progress-bar-inner {
  height: 100%;
  border-radius: 3px;
  transition: width 0.4s ease;
}

/* Color codes based on averages */
.avg-excellent {
  background: linear-gradient(90deg, #10b981, #34d399);
}

.avg-good {
  background: linear-gradient(90deg, #3b82f6, #60a5fa);
}

.avg-warning {
  background: linear-gradient(90deg, #f59e0b, #fbbf24);
}

.avg-danger {
  background: linear-gradient(90deg, #ef4444, #f87171);
}

.avg-text {
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.school-summary-card {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.school-summary-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
}

.btn-manage-context {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-manage-context:hover {
  background: var(--primary);
  color: white !important;
  border-color: var(--primary);
}

/* Grid layout for Dashboard logs and stats */
.global-dashboard-layout {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
  margin-top: 20px;
}

@media (max-width: 1024px) {
  .global-dashboard-layout {
    grid-template-columns: 1fr;
  }
}

.audit-stream-item {
  padding: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 0.8rem;
  transition: background 0.2s;
}

.audit-stream-item:hover {
  background: rgba(255, 255, 255, 0.02);
}

.audit-stream-item:last-child {
  border-bottom: none;
}

.badge-school-tag {
  background: rgba(255, 255, 255, 0.1);
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 0.7rem;
  text-transform: uppercase;
  color: var(--accent);
}

/* Custom Styles for Form Controls & Badges in Centralized Views */
.form-control {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  color: var(--text-main);
  transition: var(--transition-smooth);
}

@media (max-width: 900px) {
  .sidebar {
    position: fixed;
    transform: translateX(-100%);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.5);
  }

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

  .content-header {
    padding: 20px;
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }

  .header-center,
  .header-right {
    width: 100%;
    justify-content: flex-start;
  }

  .universal-search-container {
    width: 100%;
  }

  .universal-search-container input {
    width: 100%;
  }

  .dashboard-grid,
  .global-dashboard-layout {
    grid-template-columns: 1fr !important;
  }
}

/* ==========================================================================
   PREMIUM TOAST NOTIFICATION SYSTEM
   ========================================================================== */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 2147483647 !important;
  display: flex;
  flex-direction: column;
  gap: 12px;
  pointer-events: none;
  max-width: 420px;
  width: 100%;
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-radius: 12px;
  color: #fff;
  font-weight: 500;
  font-size: 0.88rem;
  box-shadow: 0 12px 32px -4px rgba(0, 0, 0, 0.4), 0 4px 12px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(20px);
  transform: translateX(120%);
  opacity: 0;
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  overflow: hidden;
  pointer-events: auto;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.toast-visible {
  transform: translateX(0);
  opacity: 1;
}

.toast-exit {
  transform: translateX(120%) !important;
  opacity: 0 !important;
}

.toast-success {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.92), rgba(5, 150, 105, 0.92));
}

.toast-error {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.92), rgba(220, 38, 38, 0.92));
}

.toast-info {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.92), rgba(37, 99, 235, 0.92));
}

.toast-warning {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.92), rgba(217, 119, 6, 0.92));
}

.toast-icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.15);
}

.toast-body {
  flex: 1;
  min-width: 0;
}

.toast-message {
  line-height: 1.4;
  display: block;
}

.toast-close {
  flex-shrink: 0;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: #fff;
  padding: 6px;
  border-radius: 50%;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: auto;
  pointer-events: auto;
}

.toast-close:hover {
  background: rgba(255, 255, 255, 0.4);
  transform: scale(1.1);
}

.toast-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: rgba(255, 255, 255, 0.15);
}

.toast-progress-bar {
  height: 100%;
  background: rgba(255, 255, 255, 0.45);
  border-radius: 0 0 12px 12px;
  animation: toastCountdown 5s linear forwards;
}

@keyframes toastCountdown {
  from {
    width: 100%;
  }

  to {
    width: 0%;
  }
}

/* ==========================================================================
   LOADING OVERLAY
   ========================================================================== */
#loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(3, 7, 18, 0.6);
  backdrop-filter: blur(6px);
  z-index: 2147483646 !important;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.3s ease;
}

#loading-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.loading-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
}

.premium-spinner {
  position: relative;
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pulse-ring {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border: 2px solid var(--primary);
  border-radius: 50%;
  animation: pulse-ring-anim 2s cubic-bezier(0.215, 0.61, 0.355, 1) infinite;
  opacity: 0;
}

.pulse-ring.delay-1 {
  animation-delay: 1s;
}

.pulse-core {
  width: 48px;
  height: 48px;
  background: hsla(var(--primary-hue), var(--primary-sat), var(--primary-lightness), 0.15);
  border: 1px solid hsla(var(--primary-hue), var(--primary-sat), var(--primary-lightness), 0.3);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  box-shadow: 0 0 20px hsla(var(--primary-hue), var(--primary-sat), var(--primary-lightness), 0.3);
  z-index: 2;
  animation: pulse-core-anim 2s ease-in-out infinite alternate;
}

.pulse-core svg {
  width: 24px;
  height: 24px;
}

@keyframes pulse-ring-anim {
  0% {
    transform: scale(0.6);
    opacity: 0.8;
  }

  100% {
    transform: scale(1.6);
    opacity: 0;
  }
}

/* ==========================================================================
   SKELETON LOADERS
   ========================================================================== */
.skeleton {
  background: linear-gradient(90deg,
      rgba(255, 255, 255, 0.03) 25%,
      rgba(255, 255, 255, 0.08) 50%,
      rgba(255, 255, 255, 0.03) 75%);
  background-size: 400% 100%;
  animation: skeleton-loading 1.5s ease-in-out infinite;
  border-radius: 4px;
}

.skeleton-text {
  height: 20px;
  width: 100%;
  margin-bottom: 8px;
  border-radius: 4px;
}

.skeleton-title {
  height: 32px;
  width: 50%;
  margin-bottom: 16px;
  border-radius: 6px;
}

.skeleton-card {
  height: 120px;
  width: 100%;
  border-radius: 12px;
}

@keyframes skeleton-loading {
  0% {
    background-position: 200% 0;
  }

  100% {
    background-position: -200% 0;
  }
}

@keyframes pulse-core-anim {
  0% {
    transform: scale(0.95);
    box-shadow: 0 0 10px hsla(var(--primary-hue), var(--primary-sat), var(--primary-lightness), 0.2);
  }

  100% {
    transform: scale(1.05);
    box-shadow: 0 0 25px hsla(var(--primary-hue), var(--primary-sat), var(--primary-lightness), 0.5);
  }
}

.loading-text {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-main);
  letter-spacing: 0.5px;
  animation: fadeInOut 2s ease-in-out infinite alternate;
}

@keyframes fadeInOut {
  0% {
    opacity: 0.6;
  }

  100% {
    opacity: 1;
  }
}

/* ==========================================================================
   SMOOTH PAGE TRANSITIONS
   ========================================================================== */
.view-panel {
  display: none;
  animation: viewSlideIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.view-panel.active {
  display: block;
}

@keyframes viewSlideIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ==========================================================================
   EMPTY STATE PLACEHOLDERS
   ========================================================================== */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
  color: var(--text-muted);
}

.empty-state svg {
  margin-bottom: 16px;
  opacity: 0.4;
}

.empty-state h4 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 6px;
}

.empty-state p {
  font-size: 0.88rem;
  max-width: 360px;
  line-height: 1.5;
}

/* ==========================================================================
   TABLE ROW HOVER ANIMATION (Smoother)
   ========================================================================== */
tbody tr {
  transition: background 0.2s ease, transform 0.15s ease;
}

tbody tr:hover {
  background: rgba(255, 255, 255, 0.03);
}

/* ==========================================================================
   BUTTON LOADING STATE
   ========================================================================== */
.btn.btn-loading {
  position: relative;
  pointer-events: none;
  color: transparent !important;
}

.btn.btn-loading::after {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

/* ==========================================================================
   MOBILE TOAST RESPONSIVE
   ========================================================================== */
/* ==========================================================================
   MOBILE TOAST RESPONSIVE
   ========================================================================== */
@media (max-width: 480px) {
  #toast-container {
    left: 12px;
    right: 12px;
    bottom: calc(80px + var(--safe-bottom));
    max-width: 100%;
  }
}

/* ==========================================================================
   UTILITY CLASSES
   ========================================================================== */
.text-xs {
  font-size: 0.75rem;
}

.text-sm {
  font-size: 0.85rem;
}

.text-md {
  font-size: 1rem;
}

.text-lg {
  font-size: 1.25rem;
}

.text-xl {
  font-size: 1.5rem;
}

.text-2xl {
  font-size: 2rem;
}

.font-normal {
  font-weight: 400;
}

.font-semibold {
  font-weight: 600;
}

.font-bold {
  font-weight: 700;
}

.font-extrabold {
  font-weight: 800;
}

.text-primary {
  color: var(--primary);
}

.text-muted {
  color: var(--text-muted);
}

.text-main {
  color: var(--text-main);
}

.text-white {
  color: #fff;
}

.text-error {
  color: var(--color-error);
}

.uppercase {
  text-transform: uppercase;
}

.italic {
  font-style: italic;
}

.block {
  display: block;
}

.inline-block {
  display: inline-block;
}

.mb-1 {
  margin-bottom: 4px;
}

.mb-2 {
  margin-bottom: 8px;
}

.mb-3 {
  margin-bottom: 12px;
}

.mb-4 {
  margin-bottom: 16px;
}

.mt-1 {
  margin-top: 4px;
}

.mt-2 {
  margin-top: 8px;
}

.mt-3 {
  margin-top: 12px;
}

.mt-4 {
  margin-top: 16px;
}

.btn-error {
  color: var(--color-error);
  border-color: rgba(239, 68, 68, 0.3);
}

.btn-error:hover {
  background: rgba(239, 68, 68, 0.1);
  border-color: var(--color-error);
}

/* ==========================================================================
   NOTIFICATIONS DRAWER
   ========================================================================== */
.notifications-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: 320px;
  height: 100vh;
  background: var(--bg-modal);
  backdrop-filter: blur(25px);
  border-left: 1px solid var(--border-color);
  z-index: 100000;
  box-shadow: var(--shadow-lg);
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.notifications-drawer:not(.hidden) {
  transform: translateX(0);
}

.notifications-drawer.hidden {
  display: block !important;
  transform: translateX(100%);
}

.notification-item {
  padding: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  transition: background 0.2s;
}

.notification-item:hover {
  background: rgba(255, 255, 255, 0.03);
}

.notification-item.unread {
  background: rgba(var(--primary-hue), var(--primary-sat), var(--primary-lightness), 0.05);
  border-left: 3px solid var(--primary);
}

.notification-item.master-admin-alert {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.1), rgba(245, 158, 11, 0.1));
  border-left: 4px solid var(--color-danger);
  box-shadow: 0 4px 15px rgba(239, 68, 68, 0.2);
  animation: pulse-border 2s infinite;
}

@keyframes pulse-border {
  0% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4);
  }

  70% {
    box-shadow: 0 0 0 10px rgba(239, 68, 68, 0);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
  }
}

.notification-title {
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 4px;
}

.notification-message {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.notification-time {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 6px;
  opacity: 0.7;
}

.user-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-weight: 700;
  color: #fff;
  background: var(--primary);
  user-select: none;
  overflow: hidden;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

/* ==========================================================================
   MOBILE BOTTOM NAVIGATION — FULL REDESIGN FROM SCRATCH
   ========================================================================== */

/* Hidden by default on desktop */
.mobile-bottom-nav {
  display: none;
}

/* Mobile-only/desktop-only utilities hidden by default */
.mobile-only {
  display: none;
}

/* ============================================================
   MOBILE BREAKPOINT — Everything below 900px
   ============================================================ */
@media (max-width: 900px) {

  /* ---- Layout Shell ---- */
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100%;
    z-index: 99980;
    transform: translateX(-110%);
    box-shadow: 8px 0 40px rgba(0, 0, 0, 0.6);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  }

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

  .desktop-only {
    display: none !important;
  }

  .mobile-only {
    display: block !important;
  }

  /* ---- App Content Area ---- */
  .main-content {
    padding-bottom: calc(76px + var(--safe-bottom));
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* ---- Top Header (Slim Mobile Header) ---- */
  .content-header {
    display: flex;
    padding: calc(16px + var(--safe-top)) 16px 14px 16px;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 0;
    border-bottom: 1px solid var(--border-color);
    background: rgba(10, 14, 26, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    position: sticky;
    top: 0;
    z-index: 500;
  }

  .header-left {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    flex: 0 1 auto !important;
  }

  .header-left h2 {
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.3px;
  }

  .header-left p {
    display: none;
    /* hide subtitle on mobile to save space */
  }

  .header-center {
    display: none !important;
  }

  .header-right {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    position: static !important;
    width: auto !important;
    margin-left: auto !important;
    justify-content: flex-end !important;
    transform: none !important;
  }

  .notification-container {
    order: 2 !important;
  }

  .profile-dropdown-container {
    order: 1 !important;
  }

  /* ---- View Viewport Padding ---- */
  .view-viewport {
    padding: 16px;
  }

  /* ---- Panel Cards ---- */
  .panel-card {
    border-radius: 16px;
    padding: 18px;
    margin-bottom: 14px;
    background: rgba(22, 30, 50, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.07);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
  }

  .panel-card:hover {
    transform: none;
    /* disable hover lift on touch to avoid stuck states */
  }

  /* ---- Panel Header ---- */
  .panel-header {
    margin-bottom: 16px;
  }

  .panel-header h3 {
    font-size: 1rem;
    font-weight: 700;
  }

  /* ---- Buttons ---- */
  .btn {
    padding: 13px 18px;
    font-size: 0.92rem;
    min-height: 48px;
    border-radius: 12px;
    font-weight: 600;
  }

  .btn-xs {
    padding: 8px 12px;
    font-size: 0.78rem;
    min-height: 36px;
    border-radius: 8px;
  }

  .btn-sm {
    padding: 10px 14px;
    font-size: 0.85rem;
    min-height: 42px;
  }

  /* ---- Form Controls ---- */
  .form-control,
  input,
  select,
  textarea {
    min-height: 52px;
    font-size: 1rem;
    border-radius: 12px;
    padding: 14px 16px;
  }

  .form-group {
    margin-bottom: 16px;
  }

  .form-group label {
    font-size: 0.78rem;
    margin-bottom: 6px;
  }

  /* ---- Tables → Stacked Cards ---- */
  table {
    border: 0;
    width: 100%;
  }

  table thead {
    display: none;
  }

  table tr {
    display: block;
    background: rgba(22, 30, 50, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 14px;
    margin-bottom: 12px;
    padding: 14px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
    transition: box-shadow 0.2s ease;
  }

  table tr:hover {
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
  }

  table td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding: 10px 0;
    font-size: 0.88rem;
    gap: 8px;
  }

  table td:last-child {
    border-bottom: 0;
    padding-bottom: 0;
  }

  table td::before {
    content: attr(data-label);
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    flex-shrink: 0;
    max-width: 45%;
  }

  /* ---- Modal as Bottom Sheet ---- */
  .modal-overlay {
    align-items: flex-end;
  }

  .modal-card,
  .modal-content {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    border-radius: 24px 24px 0 0 !important;
    max-height: 92vh;
    overflow-y: auto;
    padding: 24px 20px;
    padding-bottom: calc(24px + var(--safe-bottom));
    animation: slideUpSheet 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  }

  @keyframes slideUpSheet {
    from {
      transform: translateY(100%);
      opacity: 0;
    }

    to {
      transform: translateY(0);
      opacity: 1;
    }
  }

  /* ---- Login Screen Mobile ---- */
  .login-card-wrapper {
    padding: 16px;
    align-items: flex-end;
  }

  .login-card {
    border-radius: 24px 24px 0 0;
    padding: 28px 24px;
    padding-bottom: calc(28px + var(--safe-bottom));
    min-height: 60vh;
    margin-bottom: 0;
  }

  .login-title {
    font-size: 2rem;
  }

  /* ---- Attendance Segmented Controls ---- */
  .att-lbl {
    font-size: 0.78rem;
    padding: 10px 8px;
    min-height: 48px;
    border-radius: 10px;
  }

  /* ---- Wizard Steps ---- */
  .wizard-steps {
    gap: 6px;
  }

  .wizard-step .step-title {
    display: none;
  }

  /* ---- Gradebook ---- */
  .gb-marks,
  .gb-remarks {
    text-align: right;
  }

  /* ---- Dashboard grids collapse ---- */
  .dashboard-grid-1-2,
  .dashboard-grid-2-1,
  .dashboard-grid-3-2 {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  /* ---- Student profile grid ---- */
  .student-profile-info {
    grid-template-columns: 1fr !important;
  }

  /* ---- Stat cards go full width ---- */
  .grid-stats {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }

  .stat-card {
    padding: 18px 16px;
    border-radius: 14px;
  }

  .stat-value {
    font-size: 1.5rem;
  }
}

/* ==========================================================================
   MOBILE BOTTOM NAVIGATION BAR — Premium Redesign
   ========================================================================== */
.mobile-bottom-nav {
  display: none;
  /* hidden by default on desktop */
}

@media (max-width: 900px) {
  .mobile-bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100vw;
    height: calc(68px + var(--safe-bottom, 0px));
    padding: 0 8px;
    padding-bottom: var(--safe-bottom, 0px);
    background: #0b0f19;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    z-index: 99990;
    align-items: center;
    justify-content: space-around;
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.4);
  }

  .mobile-nav-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    color: rgba(148, 163, 184, 0.7);
    font-size: 0.62rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    flex: 1;
    height: 100%;
    position: relative;
    padding: 8px 4px 4px 4px;
    border-radius: 0;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
    cursor: pointer;
  }

  /* Icon wrapper — the pill that lights up */
  .mobile-nav-link .nav-icon-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 30px;
    border-radius: 15px;
    background: transparent;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
  }

  .mobile-nav-link svg {
    width: 22px;
    height: 22px;
    stroke-width: 1.8px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }

  /* Active State — glowing pill + colored icon */
  .mobile-nav-link.active {
    color: var(--primary);
  }

  .mobile-nav-link.active .nav-icon-wrap {
    background: hsla(var(--primary-hue), var(--primary-sat), var(--primary-lightness), 0.18);
    box-shadow: 0 0 14px hsla(var(--primary-hue), var(--primary-sat), var(--primary-lightness), 0.35),
      inset 0 0 0 1px hsla(var(--primary-hue), var(--primary-sat), var(--primary-lightness), 0.25);
  }

  .mobile-nav-link.active svg {
    stroke: var(--primary);
    filter: drop-shadow(0 0 5px hsla(var(--primary-hue), var(--primary-sat), var(--primary-lightness), 0.5));
  }

  /* Tap animation */
  .mobile-nav-link:active {
    transform: scale(0.92);
  }

  .mobile-nav-link:active .nav-icon-wrap {
    background: hsla(var(--primary-hue), var(--primary-sat), var(--primary-lightness), 0.25);
    transform: scale(1.05);
  }

  /* Top indicator bar on active item */
  .mobile-nav-link.active::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 28px;
    height: 3px;
    background: var(--primary);
    border-radius: 0 0 4px 4px;
    box-shadow: 0 0 8px hsla(var(--primary-hue), var(--primary-sat), var(--primary-lightness), 0.6);
    animation: indicatorIn 0.25s ease;
  }

  @keyframes indicatorIn {
    from {
      width: 0;
      opacity: 0;
    }

    to {
      width: 28px;
      opacity: 1;
    }
  }
}

/* ==========================================================================
   MOBILE STUDENT DASHBOARD CARDS — Premium Grid Design
   ========================================================================== */
@media (max-width: 900px) {

  /* Hero welcome card */
  .mobile-hero-card {
    background: linear-gradient(135deg,
        hsla(var(--primary-hue), var(--primary-sat), var(--primary-lightness), 0.25) 0%,
        hsla(var(--accent-hue), var(--accent-sat), var(--accent-lightness), 0.12) 100%);
    border: 1px solid hsla(var(--primary-hue), var(--primary-sat), var(--primary-lightness), 0.25);
    border-radius: 20px;
    padding: 22px 20px;
    margin-bottom: 16px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  }

  .mobile-hero-card::after {
    content: '';
    position: absolute;
    top: -50%;
    right: -30%;
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: hsla(var(--primary-hue), var(--primary-sat), var(--primary-lightness), 0.06);
    pointer-events: none;
  }

  .mobile-hero-name {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--text-main);
    letter-spacing: -0.3px;
    margin-bottom: 4px;
  }

  .mobile-hero-sub {
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-muted);
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
  }

  .mobile-hero-sub span {
    display: flex;
    align-items: center;
    gap: 4px;
  }

  .mobile-hero-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: hsla(var(--primary-hue), var(--primary-sat), var(--primary-lightness), 0.18);
    color: var(--primary);
    border: 1px solid hsla(var(--primary-hue), var(--primary-sat), var(--primary-lightness), 0.3);
    margin-top: 10px;
  }

  /* 2-column metric grid */
  .mobile-metric-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 16px;
  }

  .mobile-metric-card {
    background: rgba(22, 30, 50, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 18px;
    padding: 20px 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-height: 130px;
    position: relative;
    overflow: hidden;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    cursor: default;
    -webkit-tap-highlight-color: transparent;
  }

  .mobile-metric-card:active {
    transform: scale(0.97);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  }

  /* Subtle gradient corner glow on metric card */
  .mobile-metric-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg,
        transparent 0%,
        hsla(var(--primary-hue), var(--primary-sat), var(--primary-lightness), 0.5) 50%,
        transparent 100%);
    border-radius: 18px 18px 0 0;
  }

  .mobile-metric-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: hsla(var(--primary-hue), var(--primary-sat), var(--primary-lightness), 0.15);
    border: 1px solid hsla(var(--primary-hue), var(--primary-sat), var(--primary-lightness), 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
  }

  .mobile-metric-icon svg {
    width: 22px;
    height: 22px;
    stroke: var(--primary);
    filter: drop-shadow(0 0 6px hsla(var(--primary-hue), var(--primary-sat), var(--primary-lightness), 0.4));
  }

  .mobile-metric-value {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--text-main);
    letter-spacing: -0.5px;
    line-height: 1;
    margin-bottom: 4px;
  }

  .mobile-metric-label {
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.6px;
  }

  /* Attendance status colors */
  .mobile-metric-card.status-present .mobile-metric-icon {
    background: rgba(16, 185, 129, 0.15);
    border-color: rgba(16, 185, 129, 0.3);
  }

  .mobile-metric-card.status-present .mobile-metric-icon svg {
    stroke: #10b981;
    filter: drop-shadow(0 0 6px rgba(16, 185, 129, 0.4));
  }

  .mobile-metric-card.status-present .mobile-metric-value {
    color: #10b981;
  }

  .mobile-metric-card.status-absent .mobile-metric-icon {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.3);
  }

  .mobile-metric-card.status-absent .mobile-metric-icon svg {
    stroke: #ef4444;
    filter: drop-shadow(0 0 6px rgba(239, 68, 68, 0.4));
  }

  .mobile-metric-card.status-absent .mobile-metric-value {
    color: #ef4444;
  }

  /* Full-width section card (for content lists) */
  .mobile-section-card {
    background: rgba(22, 30, 50, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 18px;
    overflow: hidden;
    margin-bottom: 16px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
  }

  .mobile-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  }

  .mobile-section-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .mobile-section-title svg {
    width: 16px;
    height: 16px;
    stroke: var(--primary);
  }

  .mobile-section-body {
    padding: 0;
  }

  /* List rows inside section cards */
  .mobile-list-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    transition: background 0.2s ease;
    gap: 12px;
  }

  .mobile-list-row:last-child {
    border-bottom: 0;
  }

  .mobile-list-row:active {
    background: rgba(255, 255, 255, 0.04);
  }

  .mobile-list-left {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
  }

  .mobile-list-primary {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .mobile-list-secondary {
    font-size: 0.75rem;
    color: var(--text-muted);
  }

  .mobile-list-right {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
  }

  /* Quick action buttons row */
  .mobile-quick-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 16px;
  }

  .mobile-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px 12px;
    border-radius: 14px;
    background: hsla(var(--primary-hue), var(--primary-sat), var(--primary-lightness), 0.12);
    border: 1px solid hsla(var(--primary-hue), var(--primary-sat), var(--primary-lightness), 0.2);
    color: var(--primary);
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent;
  }

  .mobile-action-btn:active {
    transform: scale(0.95);
    background: hsla(var(--primary-hue), var(--primary-sat), var(--primary-lightness), 0.22);
  }

  .mobile-action-btn svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
  }

  /* Announcement/notification banner strip */
  .mobile-announcement-strip {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-radius: 14px;
    background: linear-gradient(135deg,
        hsla(var(--accent-hue), var(--accent-sat), var(--accent-lightness), 0.18),
        hsla(var(--primary-hue), var(--primary-sat), var(--primary-lightness), 0.12));
    border: 1px solid hsla(var(--accent-hue), var(--accent-sat), var(--accent-lightness), 0.25);
    margin-bottom: 16px;
    font-size: 0.82rem;
    color: var(--text-main);
    font-weight: 500;
  }

  .mobile-announcement-strip svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    stroke: var(--accent);
  }

  /* Attendance status pill */
  .att-pill {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
  }

  .att-pill.present {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.3);
  }

  .att-pill.absent {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
  }

  .att-pill.late {
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
    border: 1px solid rgba(245, 158, 11, 0.3);
  }
}

/* ==========================================================================
   ATTENDANCE BUTTON CONTROLS (mobile-enhanced)
   ========================================================================== */
.att-radio-wrapper {
  position: relative;
  display: inline-block;
  flex: 1;
}

.hidden-radio {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.att-lbl {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
  min-height: 48px;
}

.hidden-radio:checked+.att-present-lbl {
  background: rgba(34, 197, 94, 0.2);
  border-color: var(--color-success);
  color: var(--color-success);
  box-shadow: 0 0 12px rgba(34, 197, 94, 0.25);
}

.hidden-radio:checked+.att-absent-lbl {
  background: rgba(239, 68, 68, 0.2);
  border-color: var(--color-error);
  color: var(--color-error);
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.25);
}

.hidden-radio:checked+.att-sa-lbl {
  background: rgba(59, 130, 246, 0.2);
  border-color: var(--color-info);
  color: var(--color-info);
  box-shadow: 0 0 12px rgba(59, 130, 246, 0.25);
}


/* ==========================================================================
   UTILITY CLASSES
   ========================================================================== */
.text-xs {
  font-size: 0.75rem;
}

.text-sm {
  font-size: 0.85rem;
}

.text-md {
  font-size: 1rem;
}

.text-lg {
  font-size: 1.25rem;
}

.text-xl {
  font-size: 1.5rem;
}

.text-2xl {
  font-size: 2rem;
}

.font-normal {
  font-weight: 400;
}

.font-semibold {
  font-weight: 600;
}

.font-bold {
  font-weight: 700;
}

.font-extrabold {
  font-weight: 800;
}

.text-primary {
  color: var(--primary);
}

.text-muted {
  color: var(--text-muted);
}

.text-main {
  color: var(--text-main);
}

.text-white {
  color: #fff;
}

.text-error {
  color: var(--color-error);
}

.uppercase {
  text-transform: uppercase;
}

.italic {
  font-style: italic;
}

.block {
  display: block;
}

.inline-block {
  display: inline-block;
}

.mb-1 {
  margin-bottom: 4px;
}

.mb-2 {
  margin-bottom: 8px;
}

.mb-3 {
  margin-bottom: 12px;
}

.mb-4 {
  margin-bottom: 16px;
}

.mt-1 {
  margin-top: 4px;
}

.mt-2 {
  margin-top: 8px;
}

.mt-3 {
  margin-top: 12px;
}

.mt-4 {
  margin-top: 16px;
}

.btn-error {
  color: var(--color-error);
  border-color: rgba(239, 68, 68, 0.3);
}

.btn-error:hover {
  background: rgba(239, 68, 68, 0.1);
  border-color: var(--color-error);
}

/* ==========================================================================
   NOTIFICATIONS DRAWER
   ========================================================================== */
.notifications-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: 320px;
  height: 100vh;
  background: var(--bg-modal);
  backdrop-filter: blur(25px);
  border-left: 1px solid var(--border-color);
  z-index: 100000;
  box-shadow: var(--shadow-lg);
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.notifications-drawer:not(.hidden) {
  transform: translateX(0);
}

.notifications-drawer.hidden {
  display: block !important;
  /* Override .hidden display:none to allow animation */
  transform: translateX(100%);
}

.notification-item {
  padding: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  transition: background 0.2s;
}

.notification-item:hover {
  background: rgba(255, 255, 255, 0.03);
}

.notification-item.unread {
  background: rgba(var(--primary-hue), var(--primary-sat), var(--primary-lightness), 0.05);
  border-left: 3px solid var(--primary);
}

.notification-item.master-admin-alert {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.1), rgba(245, 158, 11, 0.1));
  border-left: 4px solid var(--color-danger);
  box-shadow: 0 4px 15px rgba(239, 68, 68, 0.2);
  animation: pulse-border 2s infinite;
}

@keyframes pulse-border {
  0% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4);
  }

  70% {
    box-shadow: 0 0 0 10px rgba(239, 68, 68, 0);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
  }
}

.notification-title {
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 4px;
}

.notification-message {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.notification-time {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 6px;
  opacity: 0.7;
}

/* ==========================================================================
   MOBILE BOTTOM NAVIGATION & RESPONSIVE TWEAKS
   ========================================================================== */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100vw;
  height: calc(65px + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: var(--bg-modal);
  backdrop-filter: blur(20px);
  border-top: 1px solid var(--border-color);
  z-index: 99990;
  align-items: center;
  justify-content: space-around;
}

.mobile-nav-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  gap: 4px;
  font-size: 0.7rem;
  font-weight: 500;
  transition: var(--transition-smooth);
  width: 25%;
  height: 100%;
}

.mobile-nav-link svg {
  width: 20px;
  height: 20px;
}

.mobile-nav-link.active {
  color: var(--primary);
}

/* Mobile-only elements — hidden on desktop by default */
.mobile-only {
  display: none;
}

@media (max-width: 900px) {

  /* Hide desktop sidebar */
  .sidebar {
    position: fixed;
    transform: translateX(-100%);
  }

  .sidebar.active,
  .sidebar.sidebar-open {
    transform: translateX(0);
  }

  /* Show mobile bottom nav */
  .mobile-bottom-nav {
    display: flex;
  }

  /* Adjust main content for bottom nav */
  .main-content {
    padding-bottom: calc(65px + var(--safe-bottom));
  }

  /* Make tap targets bigger */
  .btn,
  .form-control,
  select {
    min-height: 48px;
  }

  .content-header {
    padding: calc(15px + var(--safe-top)) 15px 15px 15px;
  }

  .header-left h2 {
    font-size: 1.2rem;
  }

  /* Search bar mobile display */
  .universal-search-container {
    display: flex;
    margin: 8px 0;
  }

  /* Desktop Only Elements */
  .desktop-only {
    display: none !important;
  }

  /* Mobile Only Elements - shown only on mobile */
  .mobile-only {
    display: block !important;
  }

  /* =======================================================
     MOBILE CARDS (Transform LOGS Table into Stacked Cards)
     ======================================================= */
  #logs-table {
    border: 0;
  }

  #logs-table thead {
    display: none;
  }

  #logs-table tr {
    display: block;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    margin-bottom: 12px;
    padding: 12px;
  }

  #logs-table td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding: 10px 0;
  }

  #logs-table td:last-child {
    border-bottom: 0;
  }

  #logs-table td::before {
    content: attr(data-label);
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
  }

  /* Make non-logs tables responsive and keep their header layout */
  table:not(#logs-table) {
    min-width: 600px;
  }

  /* Better inputs for Gradebook on Mobile */
  .gb-marks,
  .gb-remarks {
    text-align: right;
  }
}

/* =======================================================
   PREMIUM ATTENDANCE UI (Progress Rings, Timelines, Toggles)
   ======================================================= */
/* Teacher Roster Toggles */
.att-toggle-group {
  display: flex;
  gap: 8px;
  background: rgba(0, 0, 0, 0.2);
  padding: 6px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.att-radio-wrapper {
  position: relative;
  display: flex;
  flex: 1;
}

.hidden-radio {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.att-lbl {
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
  background: transparent;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  user-select: none;
}

.hidden-radio:checked+.att-present-lbl {
  background: var(--color-success);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(34, 197, 94, 0.3);
  transform: scale(1.05);
}

.hidden-radio:checked+.att-absent-lbl {
  background: var(--color-error);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
  transform: scale(1.05);
}

.hidden-radio:checked+.att-late-lbl,
.hidden-radio:checked+.att-sa-lbl {
  background: var(--color-warning);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
  transform: scale(1.05);
}

/* Dashboard Progress Rings */
.progress-ring-container {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 120px;
  height: 120px;
}

.progress-ring {
  transform: rotate(-90deg);
  width: 100%;
  height: 100%;
}

.progress-ring-bg {
  fill: none;
  stroke: rgba(255, 255, 255, 0.05);
  stroke-width: 8;
}

.progress-ring-circle {
  fill: none;
  stroke: var(--primary);
  stroke-width: 8;
  stroke-linecap: round;
  transition: stroke-dashoffset 1s ease-out;
}

.progress-ring-circle.success {
  stroke: var(--color-success);
}

.progress-ring-circle.warning {
  stroke: var(--color-warning);
}

.progress-ring-circle.danger {
  stroke: var(--color-error);
}

.progress-ring-text {
  position: absolute;
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--text-main);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.progress-ring-text span {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* Yearly Calendar View */
.yearly-calendar-container {
  display: flex;
  overflow-x: auto;
  gap: 16px;
  padding: 8px 4px 16px 4px;
  scrollbar-width: thin;
  scrollbar-color: var(--primary) transparent;
}

.yearly-calendar-container::-webkit-scrollbar {
  height: 6px;
}

.yearly-calendar-container::-webkit-scrollbar-thumb {
  background-color: var(--primary);
  border-radius: 4px;
}

.mini-calendar {
  flex: 0 0 auto;
  width: 180px;
  background: rgba(0, 0, 0, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  padding: 12px;
}

.mini-calendar-title {
  text-align: center;
  font-weight: 800;
  font-size: 0.9rem;
  color: var(--text-main);
  margin-bottom: 8px;
}

.mini-calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.mini-calendar-dow {
  font-size: 0.6rem;
  font-weight: 700;
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 4px;
}

.mini-calendar-cell {
  width: 100%;
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--text-muted);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.03);
  cursor: default;
}

.mini-calendar-cell.empty {
  background: transparent;
}

.mini-calendar-cell.present {
  background: rgba(34, 197, 94, 0.2);
  color: #4ade80;
  font-weight: 800;
}

.mini-calendar-cell.absent {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
  font-weight: 800;
}

.mini-calendar-cell.late {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
  font-weight: 800;
}

.mini-calendar-cell.today {
  border: 1px solid var(--primary);
  color: var(--text-main);
}

/* Dashboard Visual Timeline */
.timeline-container {
  position: relative;
  padding-left: 20px;
  margin-top: 10px;
}

.timeline-container::before {
  content: '';
  position: absolute;
  top: 0;
  left: 6px;
  height: 100%;
  width: 2px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 2px;
}

.timeline-item {
  position: relative;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.02);
  border-radius: var(--border-radius-sm);
  margin-bottom: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background 0.2s ease;
}

.timeline-item:hover {
  background: rgba(255, 255, 255, 0.04);
}

.timeline-icon {
  position: absolute;
  left: -24px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--bg-card);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--bg-card);
}

.timeline-icon svg {
  width: 12px;
  height: 12px;
}

.timeline-icon.present {
  color: var(--color-success);
  background: rgba(34, 197, 94, 0.1);
}

.timeline-icon.absent {
  color: var(--color-error);
  background: rgba(239, 68, 68, 0.1);
}

.timeline-icon.late {
  color: var(--color-warning);
  background: rgba(245, 158, 11, 0.1);
}

.timeline-content {
  display: flex;
  flex-direction: column;
}

.timeline-date {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-main);
}

.timeline-remarks {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.mobile-only {
  display: none;
}

/* =======================================================
   HEADER POPUP MENU & DRAWER TABS
   ======================================================= */
.popup-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 220px;
  background: var(--bg-modal);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.05) inset;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  z-index: 10000;
  transform-origin: top right;
  animation: scaleFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.popup-menu.hidden {
  display: none !important;
}

@keyframes scaleFadeIn {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(-5px);
  }

  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.popup-menu-item a:hover {
  background: rgba(255, 255, 255, 0.05);
}

.drawer-tab:hover {
  color: var(--text-main) !important;
}

/* Profile Dropdown Z-Index Fix */
.popup-menu {
  z-index: 1000000 !important;
}

.profile-dropdown-container {
  z-index: 1000000 !important;
}

/* Custom Select Dropdown Styling */
select.form-control,
select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 16px;
  padding-right: 40px !important;
}

/* Smooth Transitions for Popup Menus & Drawers */
.popup-menu,
.search-dropdown,
.notifications-drawer {
  transition: opacity 0.25s ease, transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.25s ease;
}

/* Notifications Drawer Specific Styles */
.notifications-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: 360px;
  max-width: 100vw;
  height: 100vh;
  background: var(--bg-modal);
  backdrop-filter: blur(25px);
  -webkit-backdrop-filter: blur(25px);
  border-left: 1px solid var(--border-color);
  z-index: 10000000 !important;
  /* Extremely high z-index to stay above sidebars & modall overlays */
  box-shadow: var(--shadow-lg);
  transform: translateX(100%);
}

.notifications-drawer:not(.hidden) {
  transform: translateX(0);
}

.notifications-drawer.hidden {
  display: block !important;
  /* Keep block display to allow transition animations */
  transform: translateX(100%);
  pointer-events: none;
}

/* Logs Table Layout Optimization (Auto-fit & Truncation) */
#logs-table.logs-table-full {
  table-layout: fixed;
  width: 100%;
}

#logs-table.logs-table-full th:nth-child(1),
#logs-table.logs-table-full td:nth-child(1) {
  width: 15%;
}

/* Timestamp */
#logs-table.logs-table-full th:nth-child(2),
#logs-table.logs-table-full td:nth-child(2) {
  width: 13%;
}

/* Performed By */
#logs-table.logs-table-full th:nth-child(3),
#logs-table.logs-table-full td:nth-child(3) {
  width: 10%;
}

/* User Role */
#logs-table.logs-table-full th:nth-child(4),
#logs-table.logs-table-full td:nth-child(4) {
  width: 8%;
}

/* School */
#logs-table.logs-table-full th:nth-child(5),
#logs-table.logs-table-full td:nth-child(5) {
  width: 9%;
}

/* Action */
#logs-table.logs-table-full th:nth-child(6),
#logs-table.logs-table-full td:nth-child(6) {
  width: 11%;
}

/* Target Table */
#logs-table.logs-table-full th:nth-child(7),
#logs-table.logs-table-full td:nth-child(7) {
  width: 9%;
}

/* Record ID */
#logs-table.logs-table-full th:nth-child(8),
#logs-table.logs-table-full td:nth-child(8) {
  width: 25%;
}

/* Details */

#logs-table {
  width: 100%;
}

#logs-table td {
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
  vertical-align: middle;
  padding: 12px 14px;
}

#logs-table td span.log-details-span {
  display: inline-block;
  max-width: 100%;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
  cursor: pointer;
}

#logs-table td span.log-details-span:hover {
  white-space: normal;
  word-break: break-all;
  background: rgba(255, 255, 255, 0.08);
  padding: 6px 10px;
  border-radius: 8px;
  position: absolute;
  z-index: 100;
  max-width: 340px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-color);
  backdrop-filter: blur(10px);
}

/* Hide non-critical columns on medium screen sizes for full logs table */
@media (max-width: 1200px) {
  #logs-table.logs-table-full th:nth-child(4),
  #logs-table.logs-table-full td:nth-child(4),
  /* School */
  #logs-table.logs-table-full th:nth-child(7),
  #logs-table.logs-table-full td:nth-child(7)

  /* Record ID */
    {
    display: none !important;
  }

  #logs-table.logs-table-full th:nth-child(1),
  #logs-table.logs-table-full td:nth-child(1) {
    width: 20%;
  }

  #logs-table.logs-table-full th:nth-child(2),
  #logs-table.logs-table-full td:nth-child(2) {
    width: 16%;
  }

  #logs-table.logs-table-full th:nth-child(3),
  #logs-table.logs-table-full td:nth-child(3) {
    width: 14%;
  }

  #logs-table.logs-table-full th:nth-child(5),
  #logs-table.logs-table-full td:nth-child(5) {
    width: 12%;
  }

  #logs-table.logs-table-full th:nth-child(6),
  #logs-table.logs-table-full td:nth-child(6) {
    width: 16%;
  }

  #logs-table.logs-table-full th:nth-child(8),
  #logs-table.logs-table-full td:nth-child(8) {
    width: 22%;
  }
}

@media (max-width: 900px) {

  /* On mobile stacked view, let details flow normally */
  #logs-table td {
    white-space: normal !important;
    text-overflow: clip !important;
    overflow: visible !important;
  }

  #logs-table td span.log-details-span {
    white-space: normal !important;
    text-overflow: clip !important;
    overflow: visible !important;
  }
}

/* ==========================================================================
   GLOBAL FORM FIELDS & DROPDOWNS LAYOUT FIXES
   ========================================================================== */
.form-group {
  display: flex !important;
  flex-direction: column !important;
  gap: 6px !important;
  margin-bottom: 20px !important;
  width: 100% !important;
  align-items: stretch !important;
}

.form-group label {
  font-size: 0.82rem !important;
  font-weight: 600 !important;
  color: var(--text-muted) !important;
  display: block !important;
  margin-bottom: 0 !important;
  text-align: left !important;
}

.form-control,
select,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="time"],
input[type="tel"],
textarea {
  display: block !important;
  width: 100% !important;
  height: 48px !important;
  padding: 10px 16px !important;
  font-size: 0.9rem !important;
  font-weight: 500 !important;
  color: var(--text-main) !important;
  background: rgba(15, 23, 42, 0.6) !important;
  border: 1px solid var(--border-color) !important;
  border-radius: var(--border-radius-sm) !important;
  transition: all 0.2s ease !important;
  box-sizing: border-box !important;
}

.form-control:focus,
select:focus,
input:focus,
textarea:focus {
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 3px hsla(var(--primary-hue), var(--primary-sat), var(--primary-lightness), 0.15) !important;
  background: rgba(15, 23, 42, 0.8) !important;
  outline: none !important;
}

textarea.form-control,
textarea {
  height: auto !important;
  min-height: 100px !important;
}

/* ==========================================================================
   DATE & TIME PICKERS & CONTRAST WIDGET OPTIMIZATIONS
   ========================================================================== */
input[type="date"],
input[type="time"] {
  color-scheme: dark !important;
  /* Tells browser to natively render light icons and text for dark background */
}

input[type="date"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator,
.form-control::-webkit-calendar-picker-indicator,
input::-webkit-calendar-picker-indicator {
  filter: invert(1) !important;
  /* Forces dark icons to white for dark backgrounds */
  cursor: pointer !important;
  opacity: 1 !important;
  transition: transform 0.2s ease;
}

input[type="date"]::-webkit-calendar-picker-indicator:hover,
input[type="time"]::-webkit-calendar-picker-indicator:hover,
input::-webkit-calendar-picker-indicator:hover {
  transform: scale(1.1) !important;
}

/* SVG & Lucide Icon Visibility Enhancements */
.input-modern-wrapper i[data-lucide],
.input-modern-wrapper svg,
.input-icon,
.universal-search-container .search-icon,
.notification-container svg {
  color: #94a3b8 !important;
  /* Make sure icons aren't too dark */
  stroke-width: 2.2px !important;
  opacity: 0.85;
  transition: color 0.2s ease, opacity 0.2s ease;
}

.input-modern-wrapper input:focus~i[data-lucide],
.input-modern-wrapper input:focus~svg,
#universal-search-input:focus+.search-icon {
  color: var(--primary) !important;
  opacity: 1;
}

/* Sidebar and general layout SVGs */
.nav-link svg,
.sidebar-collapse-toggle svg,
.panel-header svg,
.modal-header svg {
  color: #94a3b8;
  opacity: 0.9;
}

.nav-link:hover svg,
.nav-link.active svg {
  color: var(--primary) !important;
  opacity: 1;
}

/* ==========================================================================
   UI FIXES & PATCHES (ATTENDANCE, LOGIN ICONS, PICKER BACKGROUNDS)
   ========================================================================== */
/* Fix Attendance Circle Text Overlap */
.progress-ring-text {
  /* Scale down the entire container to prevent overlapping the circle */
  transform: scale(0.65);
}

.progress-ring-text span {
  font-size: 0.65rem;
  letter-spacing: 0.5px;
  margin-top: 4px;
}

/* Fix Login Icons Overlapping Text */
.input-modern-wrapper input {
  padding-left: 2.5rem !important;
}

/* Provide missing surface variables for custom pickers */
:root,
body {
  --surface-2: var(--bg-modal);
  --surface-3: rgba(255, 255, 255, 0.1);
  --text-primary: var(--text-main);
  --text-secondary: var(--text-muted);
}

/* Ensure picker dropdowns stay on top of everything */
.custom-picker-dropdown {
  z-index: 999999 !important;
}

/* ==========================================================================
   CUSTOM DATE & TIME PICKERS
   ========================================================================== */

/* Hide native inputs that are wrapped */
.custom-picker-wrapper input[type="date"],
.custom-picker-wrapper input[type="time"] {
  display: none !important;
}

/* Wrapper to hold trigger and dropdown */
.custom-picker-wrapper {
  position: relative;
  display: block;
  width: 100%;
}

/* Trigger button imitating an input field */
.custom-picker-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0.75rem 1rem;
  font-family: var(--font-family);
  font-size: 0.95rem;
  color: var(--text-primary);
  background: var(--surface-2);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  cursor: pointer;
  transition: var(--transition-smooth);
}

.custom-picker-trigger:hover {
  border-color: var(--primary);
  background: var(--surface-3);
}

.custom-picker-trigger:focus,
.custom-picker-trigger.active {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px hsla(var(--primary-hue), var(--primary-sat), var(--primary-lit), 0.15);
  background: var(--surface-2);
}

.custom-picker-trigger .picker-value {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.custom-picker-trigger .picker-placeholder {
  color: var(--text-muted);
}

.custom-picker-trigger svg {
  width: 18px;
  height: 18px;
  color: var(--text-secondary);
  flex-shrink: 0;
  margin-left: 0.5rem;
  transition: transform 0.3s ease;
}

.custom-picker-trigger.active svg {
  color: var(--primary);
  transform: rotate(180deg);
}

/* Common Dropdown Container */
.custom-picker-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 9999;
  background: var(--surface-2);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4), 0 0 0 1px inset rgba(255, 255, 255, 0.05);
  padding: 1rem;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  pointer-events: none;
  min-width: min(320px, 90vw);
  max-width: 90vw;
}

.custom-picker-dropdown.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}

/* Date Picker Layout */
.custom-date-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.custom-date-header .month-year-display {
  font-weight: 600;
  font-size: 1.1rem;
  color: var(--text-primary);
}

.custom-date-header button {
  background: var(--surface-3);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  width: 32px;
  height: 32px;
  border-radius: var(--border-radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}

.custom-date-header button:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--text-on-primary);
}

.custom-date-header button svg {
  width: 16px;
  height: 16px;
}

.custom-date-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.custom-date-day-name {
  text-align: center;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  padding-bottom: 0.5rem;
  text-transform: uppercase;
}

.custom-date-day {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  color: var(--text-primary);
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  transition: all 0.2s;
  background: transparent;
  border: 1px solid transparent;
}

.custom-date-day:hover:not(.empty) {
  background: var(--surface-3);
  border-color: var(--border-color);
}

.custom-date-day.today {
  color: var(--primary);
  font-weight: 600;
  border-color: var(--primary);
}

.custom-date-day.selected {
  background: var(--primary);
  color: var(--text-on-primary);
  border-color: var(--primary);
  font-weight: 600;
  box-shadow: 0 4px 12px hsla(var(--primary-hue), var(--primary-sat), var(--primary-lit), 0.4);
}

.custom-date-day.empty {
  cursor: default;
}

/* Time Picker Layout */
.custom-time-layout {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  height: 200px;
}

.custom-time-column {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  border-right: 1px solid var(--border-color);
  padding-right: 0.5rem;
  scrollbar-width: thin;
  scrollbar-color: var(--border-color) transparent;
}

.custom-time-column::-webkit-scrollbar {
  width: 4px;
}

.custom-time-column::-webkit-scrollbar-track {
  background: transparent;
}

.custom-time-column::-webkit-scrollbar-thumb {
  background-color: var(--border-color);
  border-radius: 4px;
}

.custom-time-column:last-child {
  border-right: none;
  padding-right: 0;
}

.custom-time-item {
  padding: 0.5rem;
  text-align: center;
  cursor: pointer;
  border-radius: var(--border-radius-sm);
  font-size: 0.95rem;
  color: var(--text-secondary);
  transition: all 0.2s;
  margin-bottom: 2px;
}

.custom-time-item:hover {
  background: var(--surface-3);
  color: var(--text-primary);
}

.custom-time-item.selected {
  background: var(--primary);
  color: var(--text-on-primary);
  font-weight: 600;
}

.custom-time-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
}

.custom-picker-btn {
  background: var(--primary);
  color: var(--text-on-primary);
  border: none;
  padding: 0.5rem 1.25rem;
  border-radius: var(--border-radius-sm);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.custom-picker-btn:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

/* Mobile Responsiveness for Bottom Sheet & Dropdowns */
@media (max-width: 768px) {
  .custom-picker-dropdown {
    position: fixed !important;
    top: auto !important;
    bottom: 0 !important;
    left: 0 !important;
    width: 100% !important;
    min-width: 100% !important;
    max-height: 85vh !important;
    overflow-y: auto !important;
    border-radius: var(--border-radius-md) var(--border-radius-md) 0 0 !important;
    padding: 1.5rem !important;
    transform: translateY(100%) !important;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.5) !important;
    backdrop-filter: blur(30px) !important;
    -webkit-backdrop-filter: blur(30px) !important;
    background: rgba(15, 23, 42, 0.96) !important;
  }

  .custom-picker-dropdown.show {
    transform: translateY(0) !important;
  }

  /* Overlay backdrop for mobile */
  .custom-picker-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(2px);
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
  }

  .custom-picker-overlay.show {
    opacity: 1;
    visibility: visible;
  }
}

/* ==========================================================================
   GLOBAL UX POLISH & CONTRAST PATCHES
   ========================================================================== */

/* High contrast primary buttons */
.btn-primary {
  color: #ffffff !important;
}

/* High contrast input placeholder styling */
::placeholder,
.form-control::placeholder,
input::placeholder,
textarea::placeholder {
  color: #94a3b8 !important;
  opacity: 0.8 !important;
}

/* Scrollable Modal Overlays (No Top/Bottom Clipping) */
.modal-overlay {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  background: rgba(3, 7, 18, 0.75) !important;
  backdrop-filter: blur(12px) !important;
  -webkit-backdrop-filter: blur(12px) !important;
  z-index: 999999 !important;
  display: flex !important;
  align-items: flex-start !important;
  justify-content: center !important;
  overflow-y: auto !important;
  padding: 40px 20px !important;
}

.modal-card {
  margin: auto !important;
  max-height: none !important;
  height: auto !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: visible !important;
}

/* Universal Header Grid Layout for Mobile & Tablet Views */
@media (max-width: 900px) {
  .content-header {
    display: grid !important;
    grid-template-columns: 1fr auto !important;
    grid-template-rows: auto auto !important;
    gap: 12px !important;
    padding: calc(15px + var(--safe-top)) 15px 15px 15px !important;
  }

  .header-left {
    grid-column: 1 !important;
    grid-row: 1 !important;
  }

  .header-right {
    grid-column: 2 !important;
    grid-row: 1 !important;
    width: auto !important;
    margin-left: auto !important;
    gap: 12px !important;
    justify-content: flex-end !important;
  }

  .header-center {
    grid-column: 1 / span 2 !important;
    grid-row: 2 !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
  }

  /* Hide Ctrl K Badge on mobile inputs */
  .search-kbd {
    display: none !important;
  }

  #universal-search-input {
    padding-right: 20px !important;
  }

  .search-dropdown {
    max-height: 280px !important;
    overflow-y: auto !important;
  }
}

/* ==========================================================================
   PERFORMANCE & RENDERING OPTIMIZATIONS
   ========================================================================== */
/* Hardware accelerate animated presentation background */
.presentation-bg-animated {
  will-change: transform;
  transform: translate3d(0, 0, 0);
}

/* Optimize blur filters and backdrop filters for rendering performance */
.presentation-shapes .shape {
  filter: blur(20px) !important;
  opacity: 0.08 !important;
}

/* Disable or reduce backdrop filters globally to prevent CPU/GPU repaint lag */
.sidebar,
.content-header,
.popup-menu,
.search-dropdown,
.notifications-drawer,
.custom-picker-dropdown,
.panel-card,
.toast,
.modal-overlay,
.login-interaction {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

/* Adjust background opacities to maintain premium contrast without blur */
.sidebar {
  background: rgba(13, 17, 28, 0.96) !important;
}

.content-header {
  background: rgba(15, 23, 42, 0.96) !important;
}

.popup-menu,
.search-dropdown,
.notifications-drawer {
  background: rgba(15, 23, 42, 0.98) !important;
}

.panel-card {
  background: rgba(23, 31, 48, 0.85) !important;
}

.custom-picker-dropdown {
  background: rgba(15, 23, 42, 0.99) !important;
}

.toast {
  background: rgba(30, 41, 59, 0.98) !important;
}

.login-interaction {
  background: rgba(15, 23, 42, 0.98) !important;
}

/* Simplify expensive transitions and shadow effects */
.btn,
.nav-link,
.nav-link svg,
.form-control,
.quick-login-btn,
.modern-install-btn {
  transition: background-color 0.1s ease-out, border-color 0.1s ease-out, color 0.1s ease-out, opacity 0.1s ease-out !important;
}

.btn:hover,
.btn:active,
.quick-login-btn:hover,
.modern-install-btn:hover {
  transform: none !important;
}

/* Optimize shadows to single layer for faster rasterization */
:root {
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.15) !important;
  --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.2) !important;
  --shadow-lg: 0 8px 16px rgba(0, 0, 0, 0.25) !important;
}

.btn-primary {
  box-shadow: 0 3px 8px hsla(var(--primary-hue), var(--primary-sat), var(--primary-lightness), 0.25) !important;
}

.btn-primary:hover {
  box-shadow: 0 5px 12px hsla(var(--primary-hue), var(--primary-sat), var(--primary-lightness), 0.35) !important;
}

.btn-modern-primary {
  box-shadow: 0 4px 10px rgba(59, 130, 246, 0.25) !important;
}

.btn-modern-primary:hover {
  box-shadow: 0 6px 14px rgba(59, 130, 246, 0.35) !important;
}

/* Force hide all text labels and branding details in collapsed sidebar mode */
.sidebar.collapsed .school-info,
.sidebar.collapsed .nav-link span,
.sidebar.collapsed .user-details,
.sidebar.collapsed #logout-btn span,
.sidebar.collapsed h3,
.sidebar.collapsed h4,
.sidebar.collapsed span {
  display: none !important;
  opacity: 0 !important;
  width: 0 !important;
  max-width: 0 !important;
  visibility: hidden !important;
  overflow: hidden !important;
}

/* ==========================================================================
   MOBILE STUDENT PROFILE & DETAILS RESPONSIVENESS
   ========================================================================== */
@media (max-width: 768px) {

  /* Student profile overview responsiveness */
  .student-profile-info {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 1rem !important;
    padding: 1rem !important;
  }

  .student-profile-info>div[style*="display: grid"] {
    grid-template-columns: 1fr !important;
    gap: 0.75rem !important;
    width: 100% !important;
  }

  /* Make setup/hub tabs stack nicely or look like standard mobile pills */
  .setup-tabs-header {
    flex-wrap: wrap !important;
    gap: 6px !important;
  }

  .setup-tabs-header .btn {
    flex: 1 1 calc(50% - 6px) !important;
    padding: 8px 12px !important;
    font-size: 0.82rem !important;
    white-space: nowrap !important;
  }

  /* Tables layout collapse for mobile (Grades and Attendance history) */
  #grades-table,
  #attendance-table {
    display: block !important;
    width: 100% !important;
  }

  #grades-table thead,
  #attendance-table thead {
    display: none !important;
    /* Hide column headers in card mode */
  }

  #grades-table tbody,
  #attendance-table tbody {
    display: block !important;
    width: 100% !important;
  }

  #grades-table tr {
    display: block !important;
    background: rgba(255, 255, 255, 0.02) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 12px !important;
    margin-bottom: 12px !important;
    padding: 12px 16px !important;
  }

  #grades-table td {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04) !important;
    padding: 8px 0 !important;
    font-size: 0.85rem !important;
    text-align: right !important;
  }

  #grades-table td:last-child {
    border-bottom: none !important;
  }

  /* Construct custom labels for mobile card layout */
  #grades-table td::before {
    font-weight: 700 !important;
    color: var(--text-muted) !important;
    content: attr(data-label) !important;
    text-align: left !important;
    font-size: 0.8rem !important;
    margin-right: 12px !important;
  }

  #attendance-table tr {
    display: block !important;
    background: rgba(255, 255, 255, 0.02) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 12px !important;
    margin-bottom: 10px !important;
    padding: 12px 16px !important;
  }

  #attendance-table td {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04) !important;
    padding: 8px 0 !important;
    font-size: 0.85rem !important;
  }

  #attendance-table td:last-child {
    border-bottom: none !important;
  }

  #attendance-table td::before {
    font-weight: 700 !important;
    color: var(--text-muted) !important;
    content: attr(data-label) !important;
    font-size: 0.8rem !important;
  }

  /* Make actions wrapper mobile-friendly */
  #grades-table td.admin-only,
  #grades-table td.teacher-only,
  #attendance-table td.admin-only,
  #attendance-table td.teacher-only {
    display: flex !important;
    gap: 8px !important;
    justify-content: flex-end !important;
  }

  #attendance-status-banner {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 8px !important;
    padding: 12px !important;
    font-size: 0.85rem !important;
  }

  #attendance-status-banner span {
    margin-left: 0 !important;
    display: block !important;
  }
}

/* ==========================================
   SPLASH SCREEN & VERSIONING (PBeta v1.0.0)
   ========================================== */
#splash-screen {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: radial-gradient(circle at center, #1e293b 0%, #0f172a 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  transition: opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

#splash-screen::before {
  content: '';
  position: absolute;
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, rgba(37, 99, 235, 0.15) 0%, transparent 70%);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  filter: blur(30px);
  animation: glowPulse 4s infinite alternate ease-in-out;
}

@keyframes glowPulse {
  0% { opacity: 0.6; transform: translate(-50%, -50%) scale(0.9); }
  100% { opacity: 1; transform: translate(-50%, -50%) scale(1.1); }
}

#splash-screen.fade-out {
  opacity: 0;
  visibility: hidden;
}

.splash-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 20px;
  animation: splashEnter 1.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes splashEnter {
  0% {
    opacity: 0;
    transform: translateY(20px) scale(0.97);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.splash-logo {
  width: 140px;
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 0 25px rgba(37, 99, 235, 0.3));
  margin-bottom: 8px;
  animation: logoGlow 3s infinite alternate ease-in-out;
}

@keyframes logoGlow {
  0% { filter: drop-shadow(0 0 15px rgba(37, 99, 235, 0.2)); transform: scale(0.98); }
  100% { filter: drop-shadow(0 0 30px rgba(37, 99, 235, 0.5)); transform: scale(1.02); }
}

.splash-title {
  font-family: 'Outfit', sans-serif;
  font-size: 2.2rem;
  font-weight: 800;
  color: #ffffff;
  margin: 12px 0 4px 0;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, #ffffff 30%, #93c5fd 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.splash-subtitle {
  font-family: 'Outfit', sans-serif;
  font-size: 0.95rem;
  font-weight: 400;
  color: #94a3b8;
  margin: 0 0 24px 0;
  letter-spacing: 0.5px;
}

.splash-loader-bar {
  width: 140px;
  height: 4px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  overflow: hidden;
  position: relative;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.2);
}

.splash-loader-bar::after {
  content: '';
  position: absolute;
  top: 0; left: 0; bottom: 0;
  width: 40%;
  background: linear-gradient(90deg, #3b82f6, #60a5fa);
  border-radius: 10px;
  animation: slideLoader 1.5s infinite cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideLoader {
  0% { left: -40%; }
  100% { left: 100%; }
}

.splash-footer {
  position: absolute;
  bottom: 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  animation: fadeInFooter 1.5s ease-out forwards;
}

@keyframes fadeInFooter {
  0% { opacity: 0; }
  100% { opacity: 0.6; }
}

.splash-attribution {
  font-size: 0.75rem;
  color: #cbd5e1;
  font-weight: 500;
  letter-spacing: 0.5px;
}

.splash-version {
  font-size: 0.65rem;
  color: #64748b;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
}

/* Version Badge on Login Screen */
.version-badge {
  position: absolute;
  top: 20px;
  right: 24px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  backdrop-filter: blur(8px);
  z-index: 10;
}

@media (max-width: 768px) {
  .version-badge {
    top: 16px;
    right: 16px;
  }
}

/* Sidebar Footer */
.sidebar-footer {
  padding: 16px 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
  opacity: 0.7;
}

/* TensorHub attribution link styling */
.attribution a {
  color: var(--primary-light);
  text-decoration: none;
  font-weight: 600;
  transition: var(--transition-smooth);
}

.attribution a:hover {
  color: var(--primary);
  text-decoration: underline;
}

/* ==========================================
   NOTIFICATION BELL ANIMATION
   ========================================== */
.bell-ringing {
  animation: ringBell 2s cubic-bezier(0.36, 0.07, 0.19, 0.97) infinite;
  transform-origin: top center;
  color: var(--color-error) !important;
}

@keyframes ringBell {
  0%, 100% { transform: rotate(0); }
  10% { transform: rotate(15deg); }
  20% { transform: rotate(-10deg); }
  30% { transform: rotate(10deg); }
  40% { transform: rotate(-5deg); }
  50% { transform: rotate(2deg); }
  60% { transform: rotate(0); }
}