/* ═══════════════════════════════════════════════════════════
   NTProxy — Global Design System
   QR Attendance Management System
   ═══════════════════════════════════════════════════════════ */

/* Google Fonts loaded via <link> in HTML <head> to avoid @import 4-hop chain */

/* ─── CSS Variables ─────────────────────────────────────── */
:root, [data-theme="dark"] {
  color-scheme: dark;
  --bg-base: #0a0e1a;
  --bg-surface: #111827;
  --bg-card: #1a2235;
  --bg-card-hover: #1e2a40;
  --bg-glass: rgba(26, 34, 53, 0.8);
  --bg-input: #0f1623;

  --accent: #6366f1;
  --accent-light: #818cf8;
  --accent-dark: #4f46e5;
  --accent-glow: rgba(99, 102, 241, 0.3);

  --success: #10b981;
  --success-light: #34d399;
  --success-glow: rgba(16, 185, 129, 0.25);

  --danger: #ef4444;
  --danger-light: #f87171;
  --warning: #f59e0b;
  --warning-light: #fbbf24;

  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --border: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(99, 102, 241, 0.5);

  /* Semantic tints — theme-tuned translucent fills/borders for badges,
     alerts, toasts and chips. Always use these instead of raw rgba(). */
  --accent-tint: rgba(99, 102, 241, 0.14);
  --accent-tint-border: rgba(99, 102, 241, 0.3);
  --success-tint: rgba(16, 185, 129, 0.14);
  --success-tint-border: rgba(16, 185, 129, 0.3);
  --danger-tint: rgba(239, 68, 68, 0.14);
  --danger-tint-border: rgba(239, 68, 68, 0.3);
  --warning-tint: rgba(245, 158, 11, 0.14);
  --warning-tint-border: rgba(245, 158, 11, 0.3);
  --muted-tint: rgba(100, 116, 139, 0.15);
  --muted-tint-border: rgba(100, 116, 139, 0.2);

  --success-hover: #059669;
  --danger-hover: #dc2626;

  --shadow-sm: 0 2px 8px rgba(0,0,0,0.3);
  --shadow-md: 0 8px 30px rgba(0,0,0,0.4);
  --shadow-lg: 0 20px 60px rgba(0,0,0,0.5);
  --shadow-accent: 0 8px 30px rgba(99, 102, 241, 0.25);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.4s cubic-bezier(0.4, 0, 0.2, 1);

  /* Spacing scale (4px base). Prefer these over ad-hoc rem/px values. */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;

  /* Type scale */
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.35rem;
  --text-2xl: 1.75rem;

  --scrollbar-thumb: rgba(255, 255, 255, 0.12);
  --scrollbar-thumb-hover: rgba(255, 255, 255, 0.24);
  --scrollbar-track: transparent;
  --surface-hover-border: rgba(255, 255, 255, 0.15);
  --surface-subtle: rgba(255, 255, 255, 0.06);
  --surface-subtle-border: rgba(255, 255, 255, 0.05);
  --overlay-scrim: rgba(0, 0, 0, 0.6);
  --loading-scrim: rgba(10, 14, 26, 0.7);
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg-base: #f8fafc;
  --bg-surface: #e2e8f0;
  --bg-card: #ffffff;
  --bg-card-hover: #f1f5f9;
  --bg-glass: rgba(255, 255, 255, 0.8);
  --bg-input: #ffffff;

  --accent: #4f46e5;
  --accent-light: #6366f1;
  --accent-dark: #4338ca;
  --accent-glow: rgba(79, 70, 229, 0.2);

  --success: #059669;
  --success-light: #10b981;
  --success-glow: rgba(5, 150, 105, 0.2);

  --danger: #dc2626;
  --danger-light: #ef4444;
  --warning: #d97706;
  --warning-light: #f59e0b;

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;

  --border: rgba(15, 23, 42, 0.18);
  --border-focus: rgba(79, 70, 229, 0.5);

  --accent-tint: rgba(79, 70, 229, 0.09);
  --accent-tint-border: rgba(79, 70, 229, 0.24);
  --success-tint: rgba(5, 150, 105, 0.1);
  --success-tint-border: rgba(5, 150, 105, 0.26);
  --danger-tint: rgba(220, 38, 38, 0.09);
  --danger-tint-border: rgba(220, 38, 38, 0.24);
  --warning-tint: rgba(217, 119, 6, 0.1);
  --warning-tint-border: rgba(217, 119, 6, 0.26);
  --muted-tint: rgba(71, 85, 105, 0.1);
  --muted-tint-border: rgba(71, 85, 105, 0.2);

  --success-hover: #047857;
  --danger-hover: #b91c1c;

  --shadow-sm: 0 2px 8px rgba(0,0,0,0.05);
  --shadow-md: 0 8px 30px rgba(0,0,0,0.08);
  --shadow-lg: 0 20px 60px rgba(0,0,0,0.12);
  --shadow-accent: 0 8px 30px rgba(79, 70, 229, 0.15);

  --scrollbar-thumb: rgba(0, 0, 0, 0.15);
  --scrollbar-thumb-hover: rgba(0, 0, 0, 0.3);
  --scrollbar-track: transparent;
  --surface-hover-border: rgba(15, 23, 42, 0.25);
  --surface-subtle: rgba(15, 23, 42, 0.05);
  --surface-subtle-border: rgba(15, 23, 42, 0.22);
  --overlay-scrim: rgba(15, 23, 42, 0.45);
  --loading-scrim: rgba(226, 232, 240, 0.78);
}

/* ─── Reset & Base ──────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ─── Premium Scrollbars ────────────────────────────────────
   Unified fade-on-idle system: thumbs are invisible until the
   element (or page) is actively scrolling, then fade out again.
   app.js toggles `.nt-scrolling` on scrolled elements (and on
   <html> for window scroll). Hovering the scrollbar gutter also
   reveals the thumb so it stays discoverable. */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--scrollbar-track);
}

:not(html):not(body)::-webkit-scrollbar-track:vertical {
  margin: 12px 0;
}

:not(html):not(body)::-webkit-scrollbar-track:horizontal {
  margin: 0 12px;
}

::-webkit-scrollbar-thumb {
  background-color: transparent;
  border-radius: 9999px;
  border: 2px solid transparent;
  background-clip: padding-box;
  transition: background-color 0.4s ease;
}

.nt-scrolling::-webkit-scrollbar-thumb {
  background-color: var(--scrollbar-thumb);
}

::-webkit-scrollbar-thumb:hover,
::-webkit-scrollbar-thumb:active {
  background-color: var(--scrollbar-thumb-hover) !important;
}

/* Firefox standard scrollbars (no idle-fade support; keep thin + themed) */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}

/* ─── Atomic Theme Surface ──────────────────────────────── */
:root.theme-swap-active body {
  pointer-events: none;
}

:root.theme-swap-freeze *:not(.theme-transition-veil),
:root.theme-swap-freeze *:not(.theme-transition-veil)::before,
:root.theme-swap-freeze *:not(.theme-transition-veil)::after {
  transition: none !important;
  animation-play-state: paused !important;
}

:root.theme-swap-freeze::-webkit-scrollbar-thumb,
:root.theme-swap-freeze *::-webkit-scrollbar-thumb {
  transition: none !important;
}

.theme-transition-veil {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 2147483647;
  opacity: 0;
  pointer-events: auto;
  contain: strict;
  will-change: opacity;
}

.theme-transition-veil[data-target-theme="dark"] {
  background: #0a0e1a;
}

.theme-transition-veil[data-target-theme="light"] {
  background: #f8fafc;
}

.theme-transition-veil-cover {
  animation: themeVeilCover 0.35s cubic-bezier(0.4, 0, 1, 1) both;
}

.theme-transition-veil-reveal {
  animation: themeVeilReveal 0.35s cubic-bezier(0, 0, 0.2, 1) both;
}

@keyframes themeVeilCover {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes themeVeilReveal {
  from { opacity: 1; }
  to { opacity: 0; }
}

::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 0.7s;
  animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
  animation-fill-mode: both;
  mix-blend-mode: normal;
}

::view-transition-old(root) {
  animation-name: themeSurfaceFadeOut;
}

::view-transition-new(root) {
  animation-name: themeSurfaceFadeIn;
}

@keyframes themeSurfaceFadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

@keyframes themeSurfaceFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .theme-transition-veil {
    animation: none !important;
  }
}

.theme-icon-sun,
.theme-icon-moon {
  display: none !important;
}
:root[data-theme="light"] .theme-icon-moon {
  display: block !important;
}
:root:not([data-theme="light"]) .theme-icon-sun {
  display: block !important;
}

html {
  scroll-behavior: smooth;
  background-color: var(--bg-base);
}

body {
  font-family: var(--font);
  background: transparent;
  color: var(--text-primary);
  min-height: 100dvh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

a { color: var(--accent-light); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--accent); }

img { max-width: 100%; }

/* Accessible focus ring — keyboard only, consistent in both themes */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}
.btn:focus-visible, button:focus-visible { border-radius: var(--radius-md); }
.form-control:focus-visible, .otp-input:focus-visible { outline: none; }

/* ─── Icon utility (inline SVG family) ──────────────────── */
.nt-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  vertical-align: -0.15em;
}
.nt-icon svg { display: block; width: 1em; height: 1em; }

/* Prevent text selection on interactive elements (mobile fix) */
button, .btn, .role-tab, .subject-card, .nav-link, .hamburger-btn,
.toggle-switch, .att-item, .tab-btn {
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

/* ─── Animated Background ───────────────────────────────── */
.page-bg {
  position: fixed; inset: 0; z-index: -1;
  background: var(--bg-base);
  overflow: hidden;
}
.page-bg::before, .page-bg::after {
  content: '';
  position: absolute;
  inset: -40px;
  will-change: opacity;
  animation: bgFloat 8s ease-in-out infinite alternate;
  filter: blur(30px);
  pointer-events: none;
}

/* Mobile viewports: disable heavy animated background blobs completely to prevent scroll disconnect glitch */
@media (max-width: 768px), (hover: none) {
  .page-bg::before,
  .page-bg::after {
    display: none !important;
  }
}

/* Dark mode blobs configuration (rendered on ::before) */
.page-bg::before {
  background: 
    radial-gradient(circle 250px at 190px 190px, #6366f1 0%, #6366f1 20%, transparent 80%),
    radial-gradient(circle 200px at calc(100% - 140px) calc(100% - 140px), #10b981 0%, #10b981 20%, transparent 80%);
}

/* Light mode blobs configuration (rendered on ::after) */
.page-bg::after {
  background: 
    radial-gradient(circle 250px at 190px 190px, #4f46e5 0%, #4f46e5 20%, transparent 80%),
    radial-gradient(circle 200px at calc(100% - 140px) calc(100% - 140px), #059669 0%, #059669 20%, transparent 80%);
}

/* Theme-dependent opacity controls */
:root:not([data-theme="light"]) .page-bg::before {
  opacity: 0.15;
}
:root:not([data-theme="light"]) .page-bg::after {
  opacity: 0;
}

:root[data-theme="light"] .page-bg::before {
  opacity: 0;
}
:root[data-theme="light"] .page-bg::after {
  opacity: 0.15;
}
@keyframes bgFloat {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(30px, 20px) scale(1.1); }
}

/* ─── Layout ────────────────────────────────────────────── */
.container { width: 100%; max-width: 1248px; margin: 0 auto; padding: 0 1.5rem; }
.container-wide { width: 100%; max-width: 1248px; margin: 0 auto; padding: 0 1.5rem; }
.page-wrap  { min-height: 100dvh; display: flex; flex-direction: column; }
.main-content { flex: 1; padding: 0.75rem 0; }

/* ─── Navbar ────────────────────────────────────────────── */
.navbar {
  height: 64px;
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  position: sticky; top: 0; z-index: 100;
}
.navbar-inner {
  width: 100%; max-width: 1248px; margin: 0 auto;
  padding: 0 1.5rem;
  display: flex; align-items: center; justify-content: space-between;
}
@keyframes brandGradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.navbar-brand {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-weight: 700;
  font-size: 1.25rem;
  line-height: 1;
  text-decoration: none;
  letter-spacing: -0.03em;
  transition: opacity 0.2s ease;
}
.navbar-brand:hover {
  opacity: 1;
}
.navbar-brand #logo-nav,
.navbar-brand .logo-icon {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.navbar-brand #logo-nav svg,
.navbar-brand #logo-nav img,
.navbar-brand .logo-icon svg,
.navbar-brand .logo-icon img {
  width: 38px;
  height: 38px;
  display: block;
}
.navbar-brand .brand-name {
  color: rgba(241, 245, 249, 0.94);
  font-weight: 700;
  letter-spacing: -0.03em;
  font-size: 1.25rem;
  display: inline-flex;
  align-items: center;
  line-height: 1;
  transition: color 0.35s ease, text-shadow 0.35s ease;
}
.navbar-brand:hover .brand-name {
  color: #ffffff;
  text-shadow: 0 0 14px rgba(129, 140, 248, 0.3);
}
.navbar-brand .brand-nt {
  color: var(--accent-light);
  font-weight: 700;
  transition: color 0.35s ease, filter 0.35s ease;
}
.navbar-brand:hover .brand-nt {
  background: linear-gradient(120deg, #38bdf8, #818cf8, #c084fc, #34d399, #38bdf8);
  background-size: 250% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: brandGradientShift 3s ease infinite;
  filter: drop-shadow(0 0 8px rgba(129, 140, 248, 0.45));
}
.navbar-brand .brand-sub { display: none; }

:root[data-theme="light"] .navbar-brand .brand-name {
  color: rgba(15, 23, 42, 0.92);
}
:root[data-theme="light"] .navbar-brand:hover .brand-name {
  color: #0f172a;
  text-shadow: 0 0 12px rgba(99, 102, 241, 0.2);
}

.navbar-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.navbar-user {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  padding: 3px 6px;
  border-radius: 14px;
}
.navbar-user span,
#navbar-name {
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}
.navbar-user .user-role,
.navbar-user-sub,
.navbar-subtext {
  font-weight: 400;
  color: var(--text-muted);
}
.user-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--success));
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem; font-weight: 700; color: white;
  flex-shrink: 0;
}

/* ─── Floating Glass Controls in Navbar ─────────────────── */
.navbar-desktop .btn,
.navbar-right > .btn,
.nt-topbar .btn {
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);
  font-weight: 600;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.navbar-desktop .btn:hover,
.navbar-right > .btn:hover,
.nt-topbar .btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.18);
  color: var(--text-primary);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

:root[data-theme="light"] .navbar-desktop .btn,
:root[data-theme="light"] .navbar-right > .btn,
:root[data-theme="light"] .nt-topbar .btn {
  background: rgba(0, 0, 0, 0.03);
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04), inset 0 1px 0 rgba(255, 255, 255, 0.8);
  color: var(--text-secondary);
}

:root[data-theme="light"] .navbar-desktop .btn:hover,
:root[data-theme="light"] .navbar-right > .btn:hover,
:root[data-theme="light"] .nt-topbar .btn:hover {
  background: rgba(0, 0, 0, 0.06);
  border-color: rgba(0, 0, 0, 0.15);
  color: var(--text-primary);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

/* ─── Visual Hierarchy: Primary Action ("Sessions List") ──── */
.navbar a[href*="/prof/sessions"],
.navbar .btn-nav-primary {
  background: rgba(99, 102, 241, 0.16) !important;
  border: 1px solid rgba(129, 140, 248, 0.35) !important;
  color: #c7d2fe !important;
  box-shadow: 0 2px 10px rgba(99, 102, 241, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.15) !important;
  font-weight: 600 !important;
}

.navbar a[href*="/prof/sessions"]:hover,
.navbar .btn-nav-primary:hover {
  background: rgba(99, 102, 241, 0.28) !important;
  border-color: rgba(129, 140, 248, 0.55) !important;
  color: #ffffff !important;
  transform: translateY(-1px) !important;
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.25) !important;
}

:root[data-theme="light"] .navbar a[href*="/prof/sessions"],
:root[data-theme="light"] .navbar .btn-nav-primary {
  background: rgba(99, 102, 241, 0.1) !important;
  border: 1px solid rgba(99, 102, 241, 0.3) !important;
  color: #4f46e5 !important;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.12) !important;
}

:root[data-theme="light"] .navbar a[href*="/prof/sessions"]:hover,
:root[data-theme="light"] .navbar .btn-nav-primary:hover {
  background: rgba(99, 102, 241, 0.18) !important;
  border-color: rgba(99, 102, 241, 0.45) !important;
  color: #4338ca !important;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.22) !important;
}

/* ─── Visual Hierarchy: Visually Lighter Theme Toggle ────── */
.navbar [data-theme-toggle],
.navbar #theme-toggle-btn,
.navbar #theme-toggle-desktop {
  background: transparent !important;
  border: 1px solid transparent !important;
  color: var(--text-muted) !important;
  box-shadow: none !important;
  opacity: 0.75;
  border-radius: 14px;
}

.navbar [data-theme-toggle]:hover,
.navbar #theme-toggle-btn:hover,
.navbar #theme-toggle-desktop:hover {
  background: rgba(255, 255, 255, 0.06) !important;
  border-color: rgba(255, 255, 255, 0.1) !important;
  color: var(--text-primary) !important;
  opacity: 1;
  transform: translateY(-1px);
}

:root[data-theme="light"] .navbar [data-theme-toggle]:hover,
:root[data-theme="light"] .navbar #theme-toggle-btn:hover,
:root[data-theme="light"] .navbar #theme-toggle-desktop:hover {
  background: rgba(0, 0, 0, 0.04) !important;
  border-color: rgba(0, 0, 0, 0.08) !important;
  color: var(--text-primary) !important;
}

/* ─── Visual Hierarchy: Quieter Sign Out Button ──────────── */
.navbar #logout-btn,
.navbar .logout-btn {
  background: transparent !important;
  border: 1px solid rgba(255, 255, 255, 0.06) !important;
  color: var(--text-muted) !important;
  box-shadow: none !important;
  font-weight: 500 !important;
  opacity: 0.78;
}

.navbar #logout-btn:hover,
.navbar .logout-btn:hover {
  background: rgba(239, 68, 68, 0.08) !important;
  border-color: rgba(239, 68, 68, 0.25) !important;
  color: var(--danger-light) !important;
  opacity: 1;
  transform: translateY(-1px);
  box-shadow: 0 2px 10px rgba(239, 68, 68, 0.15) !important;
}

:root[data-theme="light"] .navbar #logout-btn,
:root[data-theme="light"] .navbar .logout-btn {
  border: 1px solid rgba(0, 0, 0, 0.08) !important;
}

:root[data-theme="light"] .navbar #logout-btn:hover,
:root[data-theme="light"] .navbar .logout-btn:hover {
  background: rgba(239, 68, 68, 0.08) !important;
  border-color: rgba(239, 68, 68, 0.3) !important;
  color: var(--danger) !important;
}

/* ─── Hamburger Menu & Floating Dropdown ────────────────── */
.hamburger-btn {
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 5px;
  width: 38px;
  height: 38px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  padding: 0;
  color: var(--text-primary);
  transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
  z-index: 120;
  position: relative;
  box-shadow: var(--shadow-sm);
}
.hamburger-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent-tint-border);
  color: var(--accent-light);
}
.hamburger-btn:active {
  transform: scale(0.94);
}
.hamburger-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.hamburger-btn span {
  display: block;
  height: 2px;
  width: 18px;
  background: currentColor;
  border-radius: 2px;
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.2s ease;
  transform-origin: center;
}
.hamburger-btn.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger-btn.open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.hamburger-btn.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.hamburger-btn svg {
  display: block;
  overflow: visible;
}
.hamburger-btn svg line {
  transform-box: fill-box;
  transform-origin: center;
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.2s ease, stroke 0.2s ease;
}
.hamburger-btn.open svg .line-top { transform: translateY(6px) rotate(45deg); }
.hamburger-btn.open svg .line-mid { opacity: 0; transform: scaleX(0); }
.hamburger-btn.open svg .line-bot { transform: translateY(-6px) rotate(-45deg); }

.hamburger-menu {
  display: flex;
  position: fixed;
  top: 56px;
  right: 0.5rem;
  width: min(260px, calc(100vw - 2rem));
  max-height: calc(100dvh - 72px);
  overflow-y: auto;
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--accent-tint-border);
  border-radius: var(--radius-xl);
  box-shadow: 0 16px 40px -8px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.06);
  padding: 0.65rem;
  z-index: 1100;
  flex-direction: column;
  gap: 0.25rem;
  transform-origin: top right;
  opacity: 0;
  visibility: hidden;
  transform: scale(0.92) translateY(-10px);
  transition: opacity 0.2s cubic-bezier(0.16, 1, 0.3, 1), transform 0.22s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.2s ease;
  pointer-events: none;
}

[data-theme="light"] .hamburger-menu {
  background: rgba(255, 255, 255, 0.94);
  border-color: rgba(15, 23, 42, 0.12);
  box-shadow: 0 16px 40px -8px rgba(15, 23, 42, 0.18), 0 0 0 1px rgba(0, 0, 0, 0.04);
}

.hamburger-menu.open {
  opacity: 1;
  visibility: visible;
  transform: scale(1) translateY(0);
  pointer-events: auto;
}

.hamburger-menu .menu-user {
  padding: 0.6rem 0.75rem;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.25rem;
  padding-bottom: 0.75rem;
}
.hamburger-menu .menu-user .user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--accent-tint);
  border: 1px solid var(--accent-tint-border);
  color: var(--accent-light);
  font-weight: 700;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.hamburger-menu .menu-user-name {
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--text-primary);
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hamburger-menu .menu-user-email {
  font-size: 0.73rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}

.hamburger-menu .menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 0.86rem;
  font-weight: 600;
  transition: background-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
  cursor: pointer;
  text-decoration: none;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-family: var(--font);
  box-sizing: border-box;
}
.hamburger-menu .menu-item svg {
  flex-shrink: 0;
  color: var(--text-muted);
  transition: color 0.15s ease, transform 0.15s ease;
}
.hamburger-menu .menu-item:hover,
.hamburger-menu .menu-item:focus-visible {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  transform: translateX(2px);
  outline: none;
}
.hamburger-menu .menu-item:hover svg,
.hamburger-menu .menu-item:focus-visible svg {
  color: var(--accent-light);
}
.hamburger-menu .menu-item.logout-btn {
  color: var(--danger-light);
}
.hamburger-menu .menu-item.logout-btn svg {
  color: var(--danger-light);
}
.hamburger-menu .menu-item.logout-btn:hover {
  background: var(--danger-tint);
  color: var(--danger-light);
}

.hamburger-menu .menu-divider {
  height: 1px;
  background: var(--border);
  margin: 0.35rem 0;
  opacity: 0.6;
}

.navbar-desktop { display: flex; align-items: center; gap: 1rem; }

@media (max-width: 768px) {
  .hamburger-btn { display: flex; }
  .navbar-desktop { display: none; }
}

/* ─── Cards ─────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  transition: var(--transition);
}
.card:hover { border-color: var(--surface-hover-border); transform: translateY(-1px); }
.card-glass {
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
}

/* ─── Buttons ───────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 0.65rem 1.4rem;
  border-radius: var(--radius-md);
  border: none; cursor: pointer;
  font-family: var(--font); font-size: 0.9rem; font-weight: 600;
  transition: var(--transition);
  text-decoration: none;
  white-space: nowrap;
  min-height: 44px; /* Touch-friendly */
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; pointer-events: none; }

.btn-primary {
  background: var(--accent);
  color: white;
  box-shadow: 0 4px 15px var(--accent-glow);
}
.btn-primary:hover { background: var(--accent-dark); transform: translateY(-1px); box-shadow: 0 6px 20px var(--accent-glow); }

.btn-success {
  background: var(--success);
  color: white;
  box-shadow: 0 4px 15px var(--success-glow);
}
.btn-success:hover { background: var(--success-hover); transform: translateY(-1px); }

.btn-outline-success {
  background: transparent;
  color: var(--success-light);
  border: 1.5px solid var(--success);
  box-shadow: none;
}
.btn-outline-success:hover {
  background: var(--success-tint);
  border-color: var(--success-light);
  color: var(--success-light);
  transform: translateY(-1px);
  box-shadow: 0 4px 15px var(--success-glow);
}
:root[data-theme="light"] .btn-outline-success {
  color: var(--success);
  border-color: var(--success);
}
:root[data-theme="light"] .btn-outline-success:hover {
  background: rgba(16, 185, 129, 0.1);
  border-color: var(--success-hover);
  color: var(--success-hover);
}

.btn-danger {
  background: var(--danger);
  color: white;
}
.btn-danger:hover { background: var(--danger-hover); transform: translateY(-1px); }

.btn-urgent {
  animation: urgentGlow 1.5s ease-in-out infinite;
  transition: var(--transition);
}
@keyframes urgentGlow {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 rgba(239, 68, 68, 0); }
  50% { transform: scale(1.02); box-shadow: 0 0 16px rgba(239, 68, 68, 0.5); }
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--bg-card); color: var(--text-primary); border-color: var(--surface-hover-border); }

.btn-sm { padding: 0.4rem 0.9rem; font-size: 0.8rem; min-height: 36px; }
.btn-lg { padding: 0.9rem 2rem; font-size: 1rem; border-radius: var(--radius-lg); }
.btn-full { width: 100%; }
.btn-icon { padding: 0.55rem; border-radius: var(--radius-sm); min-height: 36px; }

/* ─── Session Ended Modal & Tick Animation ────────────────── */
.ended-card {
  animation: endedCardPop 0.35s cubic-bezier(0.16, 1, 0.3, 1) ease-out;
}

.ended-icon-wrap {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-full);
  background: var(--success-tint);
  border: 2px solid var(--success);
  color: var(--success-light);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.25rem;
  box-shadow: 0 0 25px var(--success-glow);
  animation: endedIconPop 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.ended-icon-wrap svg path {
  stroke-dasharray: 30;
  stroke-dashoffset: 30;
  animation: drawEndedTick 0.5s cubic-bezier(0.65, 0, 0.45, 1) 0.15s forwards;
}

@keyframes endedCardPop {
  from { transform: scale(0.92); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

@keyframes endedIconPop {
  0%   { transform: scale(0.3); opacity: 0; }
  70%  { transform: scale(1.08); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes drawEndedTick {
  to { stroke-dashoffset: 0; }
}

/* ─── Forms ─────────────────────────────────────────────── */
.form-group { margin-bottom: 1.2rem; }
.form-label {
  display: block; margin-bottom: 0.5rem;
  font-size: 0.85rem; font-weight: 500; color: var(--text-secondary);
}
.form-control {
  width: 100%; padding: 0.75rem 1rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font); font-size: 0.9rem;
  transition: var(--transition);
  outline: none;
  min-height: 44px;
}
.form-control:focus { border-color: var(--border-focus); box-shadow: 0 0 0 3px var(--accent-glow); }
.form-control::placeholder { color: var(--text-muted); }

select.form-control { cursor: pointer; }
select.form-control option { background: var(--bg-surface); }

.form-error { font-size: 0.8rem; color: var(--danger-light); margin-top: 0.4rem; display: flex; align-items: center; gap: 4px; }

/* ─── OTP Input ─────────────────────────────────────────── */
.otp-input-group {
  display: flex; gap: 10px; justify-content: center;
  margin: 1.5rem 0;
}
.otp-input {
  width: 56px; height: 64px;
  background: var(--bg-input);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 1.8rem;
  font-weight: 700;
  text-align: center;
  outline: none;
  transition: var(--transition);
  caret-color: var(--accent);
}
.otp-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.otp-input.filled { border-color: var(--accent); background: rgba(99,102,241,0.08); }

/* ─── Badges ────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem; font-weight: 600;
  white-space: nowrap;
}
.badge-accent { background: var(--accent-tint); color: var(--accent-light); border: 1px solid var(--accent-tint-border); }
.badge-success { background: var(--success-tint); color: var(--success-light); border: 1px solid var(--success-tint-border); }
.badge-danger { background: var(--danger-tint); color: var(--danger-light); border: 1px solid var(--danger-tint-border); }
.badge-warning { background: var(--warning-tint); color: var(--warning-light); border: 1px solid var(--warning-tint-border); }
.badge-muted { background: var(--muted-tint); color: var(--text-muted); border: 1px solid var(--muted-tint-border); }

/* ─── Alert / Toast ─────────────────────────────────────── */
.alert {
  padding: 0.85rem 1.1rem;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 1rem;
}
.alert-error { background: var(--danger-tint); border: 1px solid var(--danger-tint-border); color: var(--danger-light); }
.alert-success { background: var(--success-tint); border: 1px solid var(--success-tint-border); color: var(--success-light); }
.alert-info { background: var(--accent-tint); border: 1px solid var(--accent-tint-border); color: var(--accent-light); }
.alert-warning { background: var(--warning-tint); border: 1px solid var(--warning-tint-border); color: var(--warning-light); }

/* ─── Toast Notification ────────────────────────────────── */
.toast-container {
  position: fixed; top: 80px; right: 1.5rem; z-index: 999;
  display: flex; flex-direction: column; gap: 8px;
}
.toast {
  padding: 0.85rem 1.1rem;
  border-radius: var(--radius-md);
  font-size: 0.875rem; font-weight: 500;
  display: flex; align-items: center; gap: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-primary);
  box-shadow: var(--shadow-md);
  animation: slideInRight 0.3s ease, fadeOut 0.3s ease 2.7s forwards;
  min-width: 280px;
  max-width: min(360px, calc(100vw - 2rem));
}
.toast-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; flex-shrink: 0;
  border-radius: var(--radius-full);
}
.toast-icon svg { width: 15px; height: 15px; }
.toast-success .toast-icon { background: var(--success-tint); color: var(--success-light); }
.toast-error   .toast-icon { background: var(--danger-tint);  color: var(--danger-light); }
.toast-info    .toast-icon { background: var(--accent-tint);  color: var(--accent-light); }
.toast-success { border-color: var(--success-tint-border); }
.toast-error   { border-color: var(--danger-tint-border); }
.toast-info    { border-color: var(--accent-tint-border); }
@keyframes slideInRight { from { transform: translateX(110%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes fadeOut { from { opacity: 1; } to { opacity: 0; transform: translateX(110%); } }

/* ─── Tables ────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; border-radius: var(--radius-lg); border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; }
thead th {
  background: var(--bg-surface);
  padding: 0.9rem 1rem;
  text-align: left; font-size: 0.8rem; font-weight: 600;
  color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody tr { border-bottom: 1px solid var(--border); transition: background var(--transition); }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--bg-card-hover); }
tbody td { padding: 0.85rem 1rem; font-size: 0.875rem; color: var(--text-primary); }

/* ─── Progress Rings ────────────────────────────────────── */
.progress-ring { position: relative; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.progress-ring svg { transform: rotate(-90deg); display: block; }
.progress-ring circle { fill: none; stroke-width: 6; transition: stroke-dashoffset 0.8s ease, fill 0.4s ease; }
.progress-ring .track { stroke: var(--bg-surface); }
.progress-ring .fill { stroke: var(--accent-light); stroke-linecap: round; }
.progress-ring .fill.good { stroke: var(--success-light); }
.progress-ring .fill.warn { stroke: var(--warning-light); }
.progress-ring .fill.bad  { stroke: var(--danger-light); }
.progress-ring .pct-100-bg {
  fill: var(--success-tint);
  transition: fill 0.4s ease, opacity 0.4s ease;
}
.progress-ring-label {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-weight: 800;
  color: var(--text-primary);
  text-align: center;
  line-height: 1;
  white-space: nowrap;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}
.progress-ring.is-100 .progress-ring-label {
  color: var(--success-light);
}

/* ─── Stat Cards ────────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1rem; }
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.2rem;
  display: flex; flex-direction: column; gap: 0.4rem;
}
.stat-value { font-size: 2rem; font-weight: 800; line-height: 1; }
.stat-label { font-size: 0.8rem; color: var(--text-secondary); font-weight: 500; }

/* ─── Section Headers ───────────────────────────────────── */
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.2rem; flex-wrap: wrap; gap: 0.5rem; }
.section-title { font-size: 1.1rem; font-weight: 700; color: var(--text-primary); }
.section-subtitle { font-size: 0.875rem; color: var(--text-secondary); margin-top: 0.25rem; }

/* ─── Page Header ───────────────────────────────────────── */
.page-header {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  padding: 0.85rem 0;
  margin-bottom: 0.75rem;
}
.page-header h1 { font-size: 1.5rem; font-weight: 800; color: var(--text-primary); }
.page-header p  { color: var(--text-secondary); margin-top: 0.2rem; font-size: 0.875rem; }

/* ─── QR Container ──────────────────────────────────────── */
.qr-container {
  display: flex; flex-direction: column; align-items: center; gap: 1.5rem;
  padding: 2rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
}
.qr-frame {
  padding: 16px;
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: 0 0 40px var(--accent-glow), var(--shadow-lg);
}
.qr-frame img { display: block; width: 250px; height: 250px; border-radius: var(--radius-sm); }
.qr-timer {
  display: flex; align-items: center; gap: 8px;
  font-size: 0.85rem; color: var(--text-secondary);
}
.qr-timer .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--success);
  animation: pulse 1s infinite;
}
@keyframes pulse { 0%,100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.5; transform: scale(0.8); } }

/* ─── Toggle Switch ─────────────────────────────────────── */
.toggle-switch { position: relative; display: inline-block; width: 44px; height: 24px; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; inset: 0;
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: var(--radius-full); cursor: pointer;
  transition: var(--transition);
}
.toggle-slider::before {
  content: ''; position: absolute;
  height: 16px; width: 16px; border-radius: 50%;
  left: 3px; top: 3px;
  background: var(--text-muted);
  transition: var(--transition);
}
.toggle-switch input:checked + .toggle-slider { background: var(--success); border-color: var(--success); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(20px); background: white; }

/* ─── Loading ───────────────────────────────────────────── */

.loader {
  --color-one: var(--accent-light);
  --color-two: var(--accent-dark);
  --color-three: rgba(99, 102, 241, 0.5);
  --color-four: rgba(79, 70, 229, 0.5);
  --color-five: rgba(129, 140, 248, 0.25);
  --time-animation: 1.5s;
  
  font-size: var(--loader-size, 40px);
  width: 1em;
  height: 1em;
  position: relative;
  border-radius: 50%;
  box-shadow:
    0 0 0.25em 0 var(--color-three),
    0 0.2em 0.5em 0 var(--color-four);
  animation: colorize calc(var(--time-animation) * 3) ease-in-out infinite;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  vertical-align: middle;
}

.loader::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 1em;
  height: 1em;
  border-radius: 50%;
  border-top: solid 1px var(--color-one);
  border-bottom: solid 1px var(--color-two);
  background: linear-gradient(180deg, var(--color-five), var(--color-four));
  box-shadow:
    inset 0 0.1em 0.1em 0 var(--color-three),
    inset 0 -0.1em 0.1em 0 var(--color-four);
}

.loader .box {
  width: 1em;
  height: 1em;
  background: linear-gradient(
    180deg,
    var(--color-one) 30%,
    var(--color-two) 70%
  );
  mask: url(#clipping);
  -webkit-mask: url(#clipping);
}

.loader svg {
  position: absolute;
  width: 1em;
  height: 1em;
  top: 0;
  left: 0;
}

.loader svg [id^="clipping"] {
  filter: contrast(15);
  animation: roundness calc(var(--time-animation) / 2) linear infinite;
}

.loader svg [id^="clipping"] polygon {
  filter: blur(7px);
}

.loader svg [id^="clipping"] polygon:nth-child(1) {
  transform-origin: 75% 25%;
  transform: rotate(90deg);
}

.loader svg [id^="clipping"] polygon:nth-child(2) {
  transform-origin: 50% 50%;
  animation: rotation var(--time-animation) linear infinite reverse;
}

.loader svg [id^="clipping"] polygon:nth-child(3) {
  transform-origin: 50% 60%;
  animation: rotation var(--time-animation) linear infinite;
  animation-delay: calc(var(--time-animation) / -3);
}

.loader svg [id^="clipping"] polygon:nth-child(4) {
  transform-origin: 40% 40%;
  animation: rotation var(--time-animation) linear infinite reverse;
}

.loader svg [id^="clipping"] polygon:nth-child(5) {
  transform-origin: 40% 40%;
  animation: rotation var(--time-animation) linear infinite reverse;
  animation-delay: calc(var(--time-animation) / -2);
}

.loader svg [id^="clipping"] polygon:nth-child(6) {
  transform-origin: 60% 40%;
  animation: rotation var(--time-animation) linear infinite;
}

.loader svg [id^="clipping"] polygon:nth-child(7) {
  transform-origin: 60% 40%;
  animation: rotation var(--time-animation) linear infinite;
  animation-delay: calc(var(--time-animation) / -1.5);
}

@keyframes rotation {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes roundness {
  0%, 60%, 100% { filter: contrast(15); }
  20%, 40% { filter: contrast(3); }
}

@keyframes colorize {
  0%, 100% { filter: hue-rotate(0deg); }
  20% { filter: hue-rotate(-30deg); }
  40% { filter: hue-rotate(-60deg); }
  60% { filter: hue-rotate(-90deg); }
  80% { filter: hue-rotate(-45deg); }
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: var(--loading-scrim);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
}
.loading-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 2rem 3rem;
  display: flex; flex-direction: column; align-items: center; gap: 1rem;
}


/* ─── Empty State ───────────────────────────────────────── */
.empty-state {
  text-align: center; padding: 4rem 2rem;
  color: var(--text-muted);
}
.empty-state .empty-icon { font-size: 3rem; margin-bottom: 1rem; opacity: 0.4; }
.empty-state h3 { font-size: 1.1rem; color: var(--text-secondary); margin-bottom: 0.5rem; }
.empty-state p  { font-size: 0.875rem; }

/* ─── Canonical Subject Card ─────────────────────────────────
   The one recognizable subject card used across professor and
   student surfaces. Each card sets a per-subject hue via the
   --h custom property; role-specific pages extend the base
   (layout modes, attendance meters) without redesigning it. */
.subj-card {
  --h: 0;
  position: relative;
  background: linear-gradient(135deg, hsla(var(--h), 20%, 12%, 0.95) 0%, rgba(20, 26, 40, 0.9) 100%);
  border: 1px solid hsla(var(--h), 16%, 22%, 0.6);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.2s cubic-bezier(0.4, 0, 0.2, 1), background 0.2s cubic-bezier(0.4, 0, 0.2, 1), border-color 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
  -webkit-user-select: none; user-select: none;
  -webkit-tap-highlight-color: transparent;
}
[data-theme="light"] .subj-card {
  background: linear-gradient(135deg, hsla(var(--h), 24%, 95%, 0.98) 0%, rgba(255, 255, 255, 0.95) 100%);
  border-color: hsla(var(--h), 20%, 84%, 0.8);
}
.subj-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 30px hsla(var(--h), 24%, 6%, 0.6), 0 0 1px 1px hsla(var(--h), 24%, 40%, 0.2);
  background: linear-gradient(135deg, hsla(var(--h), 20%, 16%, 0.98) 0%, rgba(20, 26, 40, 0.95) 100%);
  border-color: hsla(var(--h), 20%, 30%, 0.8);
}
[data-theme="light"] .subj-card:hover {
  background: linear-gradient(135deg, hsla(var(--h), 28%, 92%, 1) 0%, rgba(255, 255, 255, 1) 100%);
  border-color: hsla(var(--h), 24%, 74%, 0.9);
  box-shadow: 0 12px 24px hsla(var(--h), 24%, 40%, 0.12), 0 0 1px 1px hsla(var(--h), 24%, 60%, 0.1);
}
/* Touch devices: no lift (hover is sticky on touch) */
@media (hover: none) {
  .subj-card:hover { transform: none; }
  .subj-card:active { transform: scale(0.99); }
}

.subj-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.3rem;
}
.subj-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
  flex: 1;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
}
.subj-code {
  font-size: 0.72rem;
  font-weight: 600;
  color: hsl(var(--h), 44%, 75%);
  background: hsla(var(--h), 16%, 18%, 0.6);
  border: 1px solid hsla(var(--h), 16%, 28%, 0.6);
  border-radius: var(--radius-sm);
  padding: 2px 7px;
  white-space: nowrap;
  flex-shrink: 0;
  font-family: ui-monospace, monospace;
  letter-spacing: 0.02em;
}
[data-theme="light"] .subj-code {
  color: hsl(var(--h), 32%, 35%);
  background: hsla(var(--h), 24%, 92%, 0.7);
  border-color: hsla(var(--h), 20%, 82%, 0.7);
}
.subj-elective {
  font-size: 0.65rem;
  font-weight: 600;
  color: #fadb8e;
  background: rgba(245, 197, 115, 0.2);
  border: 1px solid rgba(245, 158, 11, 0.4);
  border-radius: var(--radius-sm);
  padding: 2px 7px;
  white-space: nowrap;
  flex-shrink: 0;
  font-family: ui-monospace, monospace;
  letter-spacing: 0.02em;
}
[data-theme="light"] .subj-elective {
  color: #b45309;
  background: #fef3c7;
  border-color: #fde68a;
}
.subj-academic {
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.subj-prof {
  font-size: 0.73rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.subj-chips {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}
.subj-chip {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 0.72rem; font-weight: 600;
  padding: 3px 9px;
  border-radius: var(--radius-full);
  background: hsla(var(--h), 16%, 18%, 0.6);
  border: 1px solid hsla(var(--h), 16%, 28%, 0.6);
  color: hsl(var(--h), 40%, 75%);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
  -webkit-tap-highlight-color: transparent;
}
[data-theme="light"] .subj-chip {
  background: hsla(var(--h), 24%, 92%, 0.7);
  border-color: hsla(var(--h), 20%, 82%, 0.7);
  color: hsl(var(--h), 32%, 35%);
}
.subj-chip:hover {
  background: hsla(var(--h), 20%, 24%, 0.85);
  border-color: hsla(var(--h), 20%, 36%, 0.8);
  transform: translateY(-1px);
}
[data-theme="light"] .subj-chip:hover {
  background: hsla(var(--h), 28%, 88%, 0.9);
}
.subj-chip svg { opacity: 0.8; }

.live-badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 0.65rem; font-weight: 700; letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  background: var(--success-tint);
  border: 1px solid rgba(16,185,129,0.4);
  color: var(--success-light);
  flex-shrink: 0;
}
.live-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--success);
  animation: pulse 1s infinite;
  flex-shrink: 0;
}

/* ─── Subject Cards Grid ────────────────────────────────── */
.subjects-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; }
.subject-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.4rem;
  display: flex; flex-direction: column; gap: 1rem;
  transition: var(--transition);
  cursor: pointer;
}
.subject-card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow-accent); }
.subject-card-header { display: flex; align-items: flex-start; justify-content: space-between; }
.subject-card-name { font-size: 1rem; font-weight: 700; }
.subject-card-prof { font-size: 0.8rem; color: var(--text-muted); margin-top: 2px; }
.subject-card-stats { display: flex; align-items: center; gap: 1rem; }
.subject-card-pct { font-size: 1.5rem; font-weight: 800; }

/* ─── Modal ─────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 150;
  background: var(--overlay-scrim);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
  animation: fadeIn 0.15s ease;
}
.modal-overlay.hidden { display: none; }
.modal-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 2rem;
  width: 100%; max-width: 500px;
  box-shadow: var(--shadow-lg);
  animation: scaleIn 0.2s ease;
  max-height: 90vh;
  overflow-y: auto;
}
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.5rem; }
.modal-title { font-size: 1.1rem; font-weight: 700; }
.modal-close { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 1.2rem; padding: 4px; }
.modal-close:hover { color: var(--text-primary); }
@keyframes fadeIn  { from { opacity: 0; } to { opacity: 1; } }
@keyframes scaleIn { from { transform: scale(0.95); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* ─── Admin Tabs ────────────────────────────────────────── */
.admin-tabs {
  display: flex; gap: 4px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 4px;
  margin-bottom: 1.5rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.admin-tabs::-webkit-scrollbar { display: none; width: 0; height: 0; }
.tab-btn {
  padding: 0.6rem 1.2rem;
  border: none;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  min-height: 40px;
}
.tab-btn:hover { color: var(--text-primary); background: var(--bg-card); }
.tab-btn.active {
  background: var(--accent);
  color: white;
  box-shadow: 0 2px 10px var(--accent-glow);
}

/* ─── Mobile Bottom Navigation ───────────────────────────────
   Primary navigation for student and professor mobile surfaces.
   Injected by initBottomNav() in app.js; visible ≤768px. The
   center action (Scan) is elevated as the most prominent item. */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 140;
  display: none;
  background: var(--bg-glass);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
  border-top: 1px solid var(--border);
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom, 0px));
}
.bottom-nav-inner {
  display: flex;
  align-items: stretch;
  justify-content: space-around;
  max-width: 480px;
  margin: 0 auto;
}
.bottom-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 6px 4px;
  min-height: 52px;
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-decoration: none;
  border: none;
  background: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: color var(--transition);
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none; user-select: none;
}
.bottom-nav-item .nt-icon { font-size: 21px; }
.bottom-nav-item:hover { color: var(--text-secondary); }
.bottom-nav-item.active { color: var(--accent-light); }
.bottom-nav-item.active .nt-icon { filter: drop-shadow(0 0 6px var(--accent-glow)); }

/* Elevated center action */
.bottom-nav-item.primary {
  flex: 0 0 auto;
  width: 76px;
  position: relative;
  color: var(--text-secondary);
}
.bottom-nav-item.primary .bottom-nav-fab {
  width: 46px; height: 46px;
  margin-top: -22px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 18px var(--accent-glow), 0 0 0 4px var(--bg-base);
  transition: transform 0.15s ease, box-shadow var(--transition);
}
.bottom-nav-item.primary .bottom-nav-fab .nt-icon { font-size: 22px; }
.bottom-nav-item.primary:active .bottom-nav-fab { transform: scale(0.94); }
.bottom-nav-item.primary.active { color: var(--accent-light); }

@media (max-width: 768px) {
  .bottom-nav { display: block; }
  body.has-bottom-nav .main-content { padding-bottom: 92px; }
  body.has-bottom-nav .footer { padding-bottom: 96px; }
}

/* ─── Mobile Bottom Sheets ───────────────────────────────────
   On small screens, standard modals present as bottom sheets:
   anchored to the bottom edge, rounded top, grab handle, and
   safe-area padding. Fullscreen takeover modals keep their own
   explicit sizing. */
@media (max-width: 640px) {
  .modal-overlay {
    align-items: flex-end;
    padding: 0;
  }
  .modal-box {
    width: 100%;
    max-width: 100%;
    border-radius: 20px 20px 0 0;
    border-bottom: none;
    max-height: 88dvh;
    padding-bottom: max(1.5rem, env(safe-area-inset-bottom, 0px));
    animation: sheetUp 0.28s cubic-bezier(0.32, 0.72, 0, 1);
  }
  .modal-box::before {
    content: '';
    display: block;
    width: 36px; height: 4px;
    border-radius: 999px;
    background: var(--border);
    margin: -6px auto 14px;
  }
}
@keyframes sheetUp {
  from { transform: translateY(40%); opacity: 0.6; }
  to   { transform: translateY(0); opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .modal-box { animation: none; }
}

/* ─── Footer ────────────────────────────────────────────── */
.footer {
  padding: 1.25rem 0;
  text-align: center;
  border-top: 1px solid var(--border);
  margin-top: auto;
}
.footer-text {
  font-size: 0.62rem;
  color: var(--text-muted);
  line-height: 1.4;
}
.footer-heart {
  width: 0.85em; height: 0.85em;
  display: inline-block; vertical-align: -0.08em;
  fill: none; stroke: #64748b;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.footer-copy {
  white-space: nowrap;
}

/* ─── Responsive ────────────────────────────────────────── */
@media (max-width: 768px) {
  .page-header { padding: 1.25rem 0; margin-bottom: 1rem; }
  .page-header h1 { font-size: 1.35rem; }
  .main-content { padding: 1rem 0; }
  .subjects-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .modal-box { padding: 1.5rem; }
  .otp-input { width: 48px; height: 56px; font-size: 1.5rem; }
  .toast-container { left: 1rem; right: 1rem; }
  .toast { min-width: auto; }
}
@media (max-width: 480px) {
  .page-header { padding: 1rem 0; margin-bottom: 0.75rem; }
  .main-content { padding: 0.75rem 0; }
  .container { padding: 0 1rem; }
  .btn-lg { padding: 0.75rem 1.5rem; }
  .qr-frame img { width: 200px; height: 200px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .otp-input { width: 44px; height: 52px; font-size: 1.3rem; }
  .admin-tabs { gap: 2px; padding: 3px; }
  .tab-btn { padding: 0.5rem 0.8rem; font-size: 0.78rem; }
  .select-trigger { font-size: 0.78rem; padding: 0.5rem 2rem 0.5rem 0.75rem; }
  .select-option { font-size: 0.78rem; padding: 0.55rem 0.75rem; }
}

/* ─── Workspace Tabs System ───────────────────────────── */
.workspace-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  width: 100%;
  border-bottom: 2px solid var(--border);
  margin-bottom: 0.75rem;
  position: relative;
  background: transparent;
  padding: 0;
  gap: 0;
  border-radius: 0;
}

.workspace-tab-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 0.6rem 0.5rem;
  font-family: var(--font);
  font-size: 0.9rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  text-align: center;
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: none !important;
  border-radius: 0 !important;
}

.workspace-tab-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.02);
}

.workspace-tab-btn::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--accent-light);
  transform: scaleX(0);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0 12px var(--accent-glow);
}

.workspace-tab-btn.active {
  color: var(--accent-light);
  background: transparent !important;
  font-weight: 700;
}

.workspace-tab-btn.active::after {
  transform: scaleX(1);
}
/* ─── Table Sorting ─────────────────────────────────────── */
th.sortable { cursor: pointer; user-select: none; position: relative; padding-right: 1.6rem; transition: background 0.2s; }
th.sortable:hover { background: var(--accent-tint); }
th.sortable::after {
  content: '';
  position: absolute; right: 8px; top: 50%;
  width: 12px; height: 12px;
  transform: translateY(-50%);
  opacity: 0.35;
  background-color: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m7 15 5 5 5-5'/%3E%3Cpath d='m7 9 5-5 5 5'/%3E%3C/svg%3E") no-repeat center / contain;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m7 15 5 5 5-5'/%3E%3Cpath d='m7 9 5-5 5 5'/%3E%3C/svg%3E") no-repeat center / contain;
}
th.sortable.asc::after,
th.sortable.desc::after {
  opacity: 1;
  background-color: var(--accent);
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12 7-7 7 7'/%3E%3Cpath d='M12 19V5'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12 7-7 7 7'/%3E%3Cpath d='M12 19V5'/%3E%3C/svg%3E");
}
th.sortable.desc::after { transform: translateY(-50%) rotate(180deg); }

/* ─── Modern Search Input ───────────────────────────────── */
.search-wrapper { position: relative; width: 100%; max-width: 320px; }
.search-input,
.att-search-field,
.ws-search,
.searchable-select-search,
#att-search-input,
input[type="search"]:not(.cmd-input),
input[placeholder*="Search" i]:not(.cmd-input),
input[placeholder*="search" i]:not(.cmd-input) {
  width: 100%;
  background-color: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0.6rem 1rem 0.6rem 2.5rem !important;
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 0.875rem;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'%3E%3C/circle%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'%3E%3C/line%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: 12px center !important;
  box-shadow: var(--shadow-sm);
}
.search-input:focus,
.att-search-field:focus,
.ws-search:focus,
.searchable-select-search:focus,
#att-search-input:focus,
input[type="search"]:not(.cmd-input):focus,
input[placeholder*="Search" i]:not(.cmd-input):focus {
  outline: none;
  border-color: var(--accent);
  background-color: var(--bg-card);
  box-shadow: 0 0 0 3px var(--accent-glow), var(--shadow-md);
  transform: translateY(-1px);
}
.search-input::placeholder,
.att-search-field::placeholder,
.ws-search::placeholder,
.searchable-select-search::placeholder,
#att-search-input::placeholder,
input[placeholder*="Search" i]::placeholder { color: var(--text-muted); opacity: 0.7; }

input[type="search"]::-webkit-search-decoration,
input[type="search"]::-webkit-search-cancel-button {
  -webkit-appearance: none;
}

/* Responsive adjustments */
@media (max-width: 480px) {
  .search-wrapper { max-width: 100%; }
}

/* Light mode explicit input & box border visibility */
:root[data-theme="light"] .search-input,
:root[data-theme="light"] .form-control,
:root[data-theme="light"] .select-trigger,
:root[data-theme="light"] .session-name-field,
:root[data-theme="light"] .att-search-field,
:root[data-theme="light"] .ws-search,
:root[data-theme="light"] .filter-sel,
:root[data-theme="light"] .nt-input,
:root[data-theme="light"] .nt-select,
:root[data-theme="light"] .cmd-input-wrap,
:root[data-theme="light"] .inspector-inp,
:root[data-theme="light"] input[type="text"],
:root[data-theme="light"] input[type="search"],
:root[data-theme="light"] input[type="email"],
:root[data-theme="light"] input[type="number"],
:root[data-theme="light"] input[type="password"],
:root[data-theme="light"] select,
:root[data-theme="light"] textarea {
  border-color: rgba(15, 23, 42, 0.25);
}

/* ─── Custom Select Dropdown ────────────────────────────── */
.custom-select {
  position: relative;
  font-family: var(--font);
  min-width: 160px;
  max-width: 220px;
}

.select-trigger {
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0.55rem 2.25rem 0.55rem 0.85rem;
  color: var(--text-primary);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  white-space: normal;
  word-break: break-word;
  line-height: 1.35;
  position: relative;
  box-sizing: border-box;
}

.select-trigger::after {
  content: '';
  width: 16px;
  height: 16px;
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5' 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;
  transition: transform 0.2s;
  pointer-events: none;
}

.custom-select.open .select-trigger {
  border-color: var(--accent);
  background-color: var(--bg-card);
  box-shadow: 0 0 0 3px var(--accent-glow);
  transform: translateY(-1px);
}

.custom-select.open .select-trigger::after {
  transform: translateY(-50%) rotate(180deg);
}

.select-options {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: min(280px, calc(100dvh - 180px));
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: opacity 0.2s, transform 0.2s, visibility 0.2s;
  padding: 4px;
}

.custom-select.open .select-options {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.select-option {
  padding: 0.6rem 0.85rem;
  font-size: 0.82rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  border-radius: var(--radius-sm);
  white-space: normal;
  word-break: break-word;
  line-height: 1.35;
}

.select-option:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.select-option.selected {
  background: rgba(99, 102, 241, 0.1);
  color: var(--accent-light);
  font-weight: 600;
}

/* ─── Toggle Choice Group & Numeric Stepper ──────────────── */
.toggle-choice-group {
  display: flex;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 4px;
  gap: 4px;
}
.toggle-choice-btn {
  flex: 1;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  color: var(--text-secondary);
  font-family: var(--font);
  font-weight: 500;
  font-size: 0.88rem;
  cursor: pointer;
  transition: var(--transition);
}
.toggle-choice-btn:hover {
  color: var(--text-primary);
  background: rgba(255,255,255,0.03);
}
:root[data-theme="light"] .toggle-choice-btn:hover {
  background: rgba(0,0,0,0.02);
}
.toggle-choice-btn.active {
  background: var(--accent);
  color: #ffffff;
  box-shadow: var(--shadow-sm);
}

.numeric-stepper {
  display: inline-flex;
  align-items: center;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 4px;
  gap: 8px;
}
.stepper-btn {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-primary);
  font-size: 1.1rem;
  font-weight: bold;
  cursor: pointer;
  transition: var(--transition);
}
.stepper-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-focus);
}
.stepper-value {
  width: 40px;
  text-align: center;
  font-weight: 600;
  font-size: 1rem;
  color: var(--text-primary);
  user-select: none;
}

/* Compact form utility */
.compact-form .form-group {
  margin-bottom: 0.6rem;
}
.compact-form .form-label {
  margin-bottom: 0.2rem;
  font-size: 0.8rem;
}
.compact-form .form-control {
  padding: 0.4rem 0.6rem;
  font-size: 0.84rem;
  height: 34px;
}
.compact-form .toggle-choice-btn {
  padding: 6px 10px;
  font-size: 0.82rem;
}
.compact-form .stepper-btn {
  width: 28px;
  height: 28px;
  font-size: 1rem;
}
.compact-form .stepper-value {
  width: 32px;
  font-size: 0.9rem;
}

/* Compact square modal wrapper */
.modal-box.compact-modal-box {
  max-width: 360px;
  padding: 1.25rem;
  border-radius: var(--radius-lg);
}
.modal-box.compact-modal-box .modal-header {
  margin-bottom: 0.8rem;
}
.modal-box.compact-modal-box .modal-body {
  padding: 0 !important;
}
.modal-box.compact-modal-box .modal-footer {
  padding: 0.5rem 0 0 0 !important;
  margin-top: 0.5rem;
}

/* ─── Premium Students Table Redesign ─── */
.premium-table-wrap {
  overflow-x: auto;
  overflow: visible;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: var(--shadow-md);
  margin-bottom: 1.5rem;
}
.premium-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}
.premium-table thead th {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg-surface);
  padding: 1.1rem 1.25rem;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.premium-table tbody tr {
  transition: background-color 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  background: transparent;
}
.premium-table tbody tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.015);
}
:root[data-theme="light"] .premium-table tbody tr:nth-child(even) {
  background: rgba(0, 0, 0, 0.01);
}
.premium-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.035);
}
:root[data-theme="light"] .premium-table tbody tr:hover {
  background: rgba(0, 0, 0, 0.02);
}
.premium-table tbody tr.row-selected {
  background: rgba(99, 102, 241, 0.06);
}
.premium-table tbody td {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.875rem;
  color: var(--text-primary);
  vertical-align: middle;
}
.premium-table tbody tr:last-child td {
  border-bottom: none;
}

/* Sticky first column */
.premium-table th:first-child,
.premium-table td:first-child {
  position: sticky;
  left: 0;
  z-index: 2;
  background: inherit;
}
.premium-table th:first-child {
  z-index: 12;
}

/* Checkbox Style */
.custom-checkbox {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
}
.custom-checkbox input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.checkbox-box {
  width: 18px;
  height: 18px;
  border: 1px solid var(--text-muted);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  background: rgba(255, 255, 255, 0.02);
}
.custom-checkbox:hover .checkbox-box {
  border-color: var(--accent);
}
.custom-checkbox input:checked + .checkbox-box {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 8px var(--accent-glow);
}
.checkbox-icon {
  width: 12px;
  height: 12px;
  color: white;
  stroke: currentColor;
  stroke-dasharray: 24;
  stroke-dashoffset: 24;
  transition: stroke-dashoffset 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.custom-checkbox input:checked + .checkbox-box .checkbox-icon {
  stroke-dashoffset: 0;
}

/* Student & Info stack */
.student-cell {
  display: flex;
  align-items: center;
  gap: 12px;
}
.student-info {
  display: flex;
  flex-direction: column;
}
.student-name {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.9rem;
}
.student-id {
  font-family: monospace;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Academic stack */
.academic-stack {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.academic-branch {
  font-weight: 500;
  color: var(--text-primary);
  font-size: 0.85rem;
  white-space: nowrap;
}
.academic-term-details {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
}

/* Status Chips */
.premium-status-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 600;
  transition: all 0.2s;
  border: 1px solid transparent;
}
.premium-status-chip.online {
  background: rgba(16, 185, 129, 0.08);
  color: var(--success-light);
  border-color: rgba(16, 185, 129, 0.15);
  cursor: pointer;
}
.premium-status-chip.online:hover {
  background: rgba(16, 185, 129, 0.16);
}
.premium-status-chip.idle {
  background: rgba(245, 158, 11, 0.08);
  color: var(--warning-light);
  border-color: rgba(245, 158, 11, 0.15);
  cursor: pointer;
}
.premium-status-chip.idle:hover {
  background: rgba(245, 158, 11, 0.16);
}
.premium-status-chip.offline {
  background: rgba(100, 116, 139, 0.08);
  color: var(--text-muted);
  border-color: rgba(100, 116, 139, 0.12);
}
.status-dot-glow {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}
.premium-status-chip.online .status-dot-glow {
  background: var(--success);
  box-shadow: 0 0 6px var(--success);
}
.premium-status-chip.idle .status-dot-glow {
  background: var(--warning);
  box-shadow: 0 0 6px var(--warning);
}
.premium-status-chip.offline .status-dot-glow {
  background: var(--text-muted);
}

/* Security chip */
.premium-passkey-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: var(--radius-md);
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  border: 1px solid transparent;
}
.premium-passkey-chip.registered {
  background: rgba(99, 102, 241, 0.06);
  color: var(--accent-light);
  border-color: rgba(99, 102, 241, 0.12);
}
.premium-passkey-chip.registered:hover {
  background: rgba(99, 102, 241, 0.12);
  box-shadow: 0 0 10px var(--accent-glow);
}
.premium-passkey-chip.not-registered {
  background: rgba(239, 68, 68, 0.04);
  color: var(--danger-light);
  border-color: rgba(239, 68, 68, 0.08);
}
.premium-passkey-chip.not-registered:hover {
  background: rgba(239, 68, 68, 0.08);
}
.passkey-icon {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
}

/* Dropdown styling */
.premium-dropdown {
  position: relative;
  display: inline-block;
}
.premium-dropdown-trigger {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.premium-dropdown-trigger:hover {
  color: var(--text-primary);
  background: var(--border);
}
.premium-dropdown-menu {
  display: none;
  position: absolute;
  right: 0;
  top: 100%;
  background: #0d1220 !important; /* Fully opaque solid dark background to block elements below */
  border: 1px solid rgba(255, 255, 255, 0.14); /* Opaque high-contrast border */
  border-radius: var(--radius-md);
  box-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(99, 102, 241, 0.1);
  z-index: 1000; /* Higher z-index to guarantee it sits above all other cells/checkboxes */
  min-width: 160px;
  padding: 6px;
  margin-top: 6px;
  animation: fadeIn 0.12s ease;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}
:root[data-theme="light"] .premium-dropdown-menu {
  background: #ffffff !important;
  border: 1px solid rgba(0, 0, 0, 0.12);
  box-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.15);
}
.premium-dropdown-menu.show {
  display: block;
}
.premium-dropdown-menu button {
  width: 100%;
  padding: 8px 12px;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-family: var(--font);
  font-size: 0.8rem;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.15s;
}
.premium-dropdown-menu button:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}
.premium-dropdown-menu button svg {
  opacity: 0.7;
  flex-shrink: 0;
}
.premium-dropdown-menu button:hover svg {
  opacity: 1;
}
.premium-dropdown-menu .dropdown-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}
.premium-dropdown-menu button.danger-action {
  color: var(--danger-light);
}
.premium-dropdown-menu button.danger-action:hover {
  background: rgba(239, 68, 68, 0.08);
  color: #ff8a8a;
}

/* Tooltip */
[data-tooltip] {
  position: relative;
}
[data-tooltip]::before {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 125%;
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  background: #0f172a;
  color: #f8fafc;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.7rem;
  font-weight: 500;
  white-space: nowrap;
  box-shadow: var(--shadow-lg);
  border: 1px solid rgba(255, 255, 255, 0.08);
  opacity: 0;
  visibility: hidden;
  transition: all 0.12s ease;
  z-index: 100;
  pointer-events: none;
}
[data-tooltip]:hover::before {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

/* Floating Bulk Actions Bar */
.bulk-actions-toolbar {
  position: fixed;
  bottom: -100px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-card);
  border: 1px solid var(--accent);
  border-radius: var(--radius-lg);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
  padding: 8px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  z-index: 1000;
  transition: bottom 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  width: min(450px, calc(100vw - 24px));
  max-width: calc(100vw - 24px);
  box-sizing: border-box;
}
.bulk-actions-toolbar.show {
  bottom: 24px;
}
.bulk-toolbar-info {
  font-size: 0.82rem;
  color: var(--text-primary);
  font-weight: 500;
  white-space: nowrap;
}
.bulk-selected-count {
  background: var(--accent);
  color: white;
  padding: 2px 8px;
  border-radius: 9999px;
  font-weight: 700;
  margin-right: 4px;
}
.bulk-toolbar-buttons {
  display: flex;
  align-items: center;
  gap: 8px;
}
.btn-close-toolbar {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s;
}
.btn-close-toolbar:hover {
  color: var(--text-primary);
}

/* Search Term Highlighting */
.search-highlight {
  background: rgba(253, 224, 71, 0.2);
  color: #fbbf24;
  border-radius: 2px;
  padding: 0 2px;
}

/* Skeletons */
.skeleton {
  background: linear-gradient(90deg, var(--bg-surface) 25%, var(--bg-card-hover) 50%, var(--bg-surface) 75%);
  background-size: 200% 100%;
  animation: loadingSkeleton 1.4s infinite;
}
@keyframes loadingSkeleton {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Pagination Redesign */
.premium-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 0.5rem;
  font-size: 0.8rem;
  color: var(--text-secondary);
}
.pagination-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}
.pagination-pill {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  font-weight: 600;
  font-size: 0.8rem;
}
.pagination-pill:hover:not([disabled]) {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  border-color: var(--accent);
}
.pagination-pill.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
  box-shadow: 0 0 8px var(--accent-glow);
}
.pagination-pill[disabled] {
  opacity: 0.4;
  cursor: not-allowed;
}
.pagination-ellipsis {
  padding: 0 4px;
  color: var(--text-muted);
}

/* Responsive Table Column Collapsing */
@media (max-width: 768px) {
  .premium-table th:nth-child(3),
  .premium-table td:nth-child(3),
  .premium-table th:nth-child(5),
  .premium-table td:nth-child(5) {
    display: none;
  }
}

/* --- Add Student Modal Redesign CSS --- */
.student-modal-box {
  max-width: 600px !important;
  padding: 2.25rem !important;
  background: var(--bg-glass) !important;
  backdrop-filter: blur(24px) !important;
  -webkit-backdrop-filter: blur(24px) !important;
  border: 1px solid var(--border) !important;
  box-shadow: var(--shadow-lg), 0 0 40px rgba(99, 102, 241, 0.05) !important;
  border-radius: var(--radius-xl) !important;
  overflow: visible !important;
  max-height: none !important;
}


.student-modal-header-left {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.student-modal-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-primary);
  background: linear-gradient(135deg, var(--text-primary), var(--text-secondary));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.student-modal-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Segmented Control */
.segmented-control {
  display: flex;
  background: var(--bg-input);
  border: 1px solid var(--border);
  padding: 4px;
  border-radius: var(--radius-md);
  margin-bottom: 1.5rem;
  position: relative;
  gap: 4px;
}

.segment-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-family: var(--font);
  font-size: 0.875rem;
  font-weight: 600;
  padding: 0.6rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  text-align: center;
  z-index: 1;
}

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

.segment-btn.active {
  background: var(--accent);
  color: white;
  box-shadow: 0 4px 12px var(--accent-glow);
}

/* Modal Tabs Content Animation */
.student-modal-box {
  width: 100vw !important;
  max-width: 900px !important;
  height: 85vh !important;
  max-height: 85vh !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
}

.student-modal-box .bulk-step.active {
  display: flex !important;
  flex-direction: column !important;
  flex: 1 !important;
  min-height: 0 !important;
}

.student-modal-box .upload-dropzone {
  flex: 1 !important;
  display: flex !important;
  flex-direction: column !important;
  justify-content: center !important;
  align-items: center !important;
  margin: 0 !important;
  padding: 2.5rem 1.5rem;
}

.student-modal-box .preview-table-container {
  flex: 1 !important;
  max-height: none !important;
  min-height: 120px !important;
}

.student-modal-tabs-container {
  position: relative;
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.student-modal-tab-content {
  display: none;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.student-modal-tab-content.active {
  display: flex;
  flex-direction: column;
  flex: 1;
  opacity: 1;
  transform: translateY(0);
  animation: tabSlideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

#indiv-form-fields, #bulk-form-fields {
  display: flex;
  flex-direction: column;
  flex: 1;
}

@keyframes tabSlideIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}


/* Searchable Dropdown Select styling */
.searchable-select {
  position: relative;
  width: 100%;
}

.searchable-select-trigger {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  color: var(--text-primary);
  font-size: 0.875rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: border-color 0.2s;
}

.searchable-select-trigger:hover {
  border-color: var(--border-focus);
}

.searchable-select.open .searchable-select-trigger {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.searchable-select-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-top: 6px;
  box-shadow: var(--shadow-lg);
  z-index: 100;
  max-height: 200px;
  overflow-y: auto;
}

.searchable-select.open .searchable-select-dropdown {
  display: block;
}

.searchable-select-search-container {
  padding: 8px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg-card);
  z-index: 1;
}

.searchable-select-search {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.75rem;
  color: var(--text-primary);
  font-size: 0.82rem;
  outline: none;
}

.searchable-select-search:focus {
  border-color: var(--accent);
}

.searchable-select-options {
  padding: 4px;
}

.searchable-select-option {
  padding: 0.6rem 0.75rem;
  color: var(--text-secondary);
  font-size: 0.85rem;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all 0.15s;
}

.searchable-select-option:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.searchable-select-option.selected {
  background: var(--accent);
  color: white;
}

/* Upload Dropzone styling */
.upload-dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 2.5rem 1.5rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  background: rgba(255, 255, 255, 0.01);
  transition: all 0.25s ease;
  cursor: pointer;
}

.upload-dropzone:hover, .upload-dropzone.dragover {
  border-color: var(--accent);
  background: rgba(99, 102, 241, 0.03);
}

.upload-icon {
  width: 48px;
  height: 48px;
  color: var(--text-muted);
  transition: color 0.2s;
}

.upload-dropzone:hover .upload-icon, .upload-dropzone.dragover .upload-icon {
  color: var(--accent-light);
  transform: translateY(-2px);
  transition: transform 0.2s;
}

.upload-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.upload-main {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.upload-or {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

.upload-browse {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--accent-light);
  cursor: pointer;
  text-decoration: underline;
}

.upload-browse:hover {
  color: var(--accent);
}

.upload-helper {
  font-size: 0.78rem;
  color: var(--text-muted);
  max-width: 320px;
}

/* Loading state */
.bulk-loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 3rem 1.5rem;
}

.loading-text {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

/* Step 3 layout */
.auto-detected-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(16, 185, 129, 0.08);
  color: var(--success-light);
  border: 1px solid rgba(16, 185, 129, 0.15);
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 1rem;
  animation: fadeIn 0.3s ease;
}

.mapping-controls-row {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
  animation: fadeIn 0.3s ease;
}

.bulk-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin: 1.25rem 0;
}

.bulk-summary-card {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.summary-val {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-primary);
}

.summary-lbl {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.preview-table-container {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--bg-input);
  margin-bottom: 0.75rem;
  max-height: 180px;
  overflow-y: auto;
}

.bulk-preview-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.bulk-preview-table th {
  background: var(--bg-card);
  color: var(--text-muted);
  font-weight: 600;
  text-align: left;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 2;
}

.bulk-preview-table td {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
}

.bulk-preview-table tr.duplicate-row {
  background: rgba(245, 158, 11, 0.12) !important;
}

.bulk-preview-table tr.duplicate-row td {
  color: var(--warning-light);
}

.bulk-preview-table tr.duplicate-row td:first-child::after {
  content: ' (exists)';
  font-size: 0.7rem;
  color: var(--text-muted);
  font-style: italic;
  margin-left: 6px;
}

.bulk-step {
  display: none;
}

.bulk-step.active {
  display: block;
}


.preview-footer {
  padding: 0.5rem 0.75rem;
  background: var(--bg-card);
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
  border-top: 1px solid var(--border);
}

.student-modal-footer {
  display: flex;
  gap: 0.75rem;
  margin-top: auto;
  padding-top: 1rem;
}

/* Bulk Import / Unenroll Progress Bar */
.import-progress-container {
  width: 100%;
  height: 8px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  overflow: hidden;
  position: relative;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2);
  display: block;
}

[data-theme="light"] .import-progress-container {
  background: rgba(0, 0, 0, 0.06);
}

.import-progress-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent-light), var(--accent));
  border-radius: var(--radius-full);
  box-shadow: 0 0 8px var(--accent-glow);
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- Redesigned Select Subject Modal CSS --- */
.select-subject-modal-box {
  width: 98vw !important;
  max-width: 1500px !important;
  height: 95vh !important;
  max-height: 900px !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
  padding: 1.75rem !important;
  background: var(--bg-glass) !important;
  backdrop-filter: blur(24px) !important;
  -webkit-backdrop-filter: blur(24px) !important;
  border: 1px solid var(--border) !important;
  box-shadow: var(--shadow-lg), 0 0 40px rgba(99, 102, 241, 0.05) !important;
  border-radius: var(--radius-xl) !important;
}

.modal-subjects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.25rem;
  padding: 0.5rem 0.25rem;
  overflow-y: auto;
  flex: 1;
}

/* Custom interactive styles for available subjects cards */
.modal-subjects-grid .subj-card {
  transition: transform 0.22s cubic-bezier(0.4, 0, 0.2, 1), 
              box-shadow 0.22s cubic-bezier(0.4, 0, 0.2, 1), 
              border-color 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  height: 190px;
  padding: 1.1rem 1.15rem 0.85rem;
}

.modal-subjects-grid .subj-card:hover {
  transform: translateY(-4px) scale(1.02);
  border-color: var(--success) !important;
  box-shadow: 0 12px 30px hsla(var(--h), 24%, 6%, 0.65), 0 0 15px rgba(16, 185, 129, 0.25) !important;
}

.modal-subjects-grid .subj-card:active {
  transform: translateY(-2px) scale(1.01);
}

.modal-subjects-grid .subj-card .select-hint-text {
  opacity: 0;
  transition: opacity 0.2s ease;
}

.modal-subjects-grid .subj-card:hover .select-hint-text {
  opacity: 1 !important;
}

/* Touch devices have no hover — keep the selection hint visible */
@media (hover: none) {
  .modal-subjects-grid .subj-card .select-hint-text { opacity: 0.85; }
}

.modal-search-wrapper {
  max-width: 100% !important;
  width: 100% !important;
  margin-top: 0.5rem;
  margin-bottom: 1rem;
}

/* ─── Futuristic Auth Loader ─────────────────────────────── */
.auth-futuristic-loader {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--loader-size, 18px);
  height: var(--loader-size, 18px);
  position: relative;
  vertical-align: middle;
  flex-shrink: 0;
}

.auth-loader-svg {
  width: 100%;
  height: 100%;
  overflow: visible;
  display: block;
}

.auth-loader-track {
  fill: none;
  stroke: rgba(255, 255, 255, 0.15);
  stroke-width: 3.5;
}

:root[data-theme="light"] .auth-loader-track {
  stroke: rgba(15, 23, 42, 0.15);
}

.auth-loader-orbit-outer {
  fill: none;
  stroke-width: 4;
  stroke-linecap: round;
  stroke-dasharray: 75 50;
  transform-origin: 25px 25px;
  animation: authSpinOuter 1.1s linear infinite;
  filter: drop-shadow(0 0 5px rgba(129, 140, 248, 0.75));
}

.auth-loader-orbit-inner {
  fill: none;
  stroke-width: 3.5;
  stroke-linecap: round;
  stroke-dasharray: 45 30;
  transform-origin: 25px 25px;
  animation: authSpinInner 0.75s linear infinite reverse;
  filter: drop-shadow(0 0 4px rgba(56, 189, 248, 0.65));
}

.auth-loader-core {
  fill: var(--accent-light, #818cf8);
  transform-origin: 25px 25px;
  animation: authPulseCore 1s ease-in-out infinite alternate;
  filter: drop-shadow(0 0 6px rgba(99, 102, 241, 0.85));
}

/* ─── PWA Mobile Install Banner & iOS Guide ────────────────── */
.pwa-install-banner {
  position: fixed;
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  left: 12px;
  right: 12px;
  margin: 0 auto;
  max-width: 440px;
  z-index: 180;
  pointer-events: auto;
  animation: pwaBannerIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

body.has-bottom-nav .pwa-install-banner {
  bottom: calc(74px + env(safe-area-inset-bottom, 0px));
}

.pwa-banner-leaving {
  animation: pwaBannerOut 0.3s cubic-bezier(0.4, 0, 1, 1) forwards;
}

@keyframes pwaBannerIn {
  from {
    opacity: 0;
    transform: translateY(24px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes pwaBannerOut {
  from {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  to {
    opacity: 0;
    transform: translateY(20px) scale(0.96);
  }
}

.pwa-banner-card {
  position: relative;
  background: var(--bg-card);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  border: 1px solid var(--accent-tint-border);
  border-radius: var(--radius-xl);
  padding: 14px 16px;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.45), 0 0 20px var(--accent-glow);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

[data-theme="light"] .pwa-banner-card {
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 16px 36px rgba(15, 23, 42, 0.15), 0 0 20px rgba(99, 102, 241, 0.15);
}

.pwa-banner-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  background: transparent;
  border: none;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  padding: 0;
}

.pwa-banner-close:hover {
  background: var(--surface-subtle);
  color: var(--text-primary);
}

.pwa-banner-main {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-right: 24px;
}

.pwa-banner-icon-wrap {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: var(--accent-tint);
  border: 1px solid var(--accent-tint-border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
  box-shadow: 0 4px 12px var(--accent-glow);
}

.pwa-banner-logo {
  width: 32px;
  height: 32px;
  object-fit: contain;
}

.pwa-banner-text {
  flex: 1;
  min-width: 0;
}

.pwa-banner-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.25;
  margin-bottom: 2px;
}

.pwa-banner-desc {
  font-size: 0.76rem;
  color: var(--text-secondary);
  line-height: 1.35;
}

.pwa-banner-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.pwa-btn-dismiss {
  font-size: 0.8rem;
  padding: 6px 12px;
  height: 32px;
  color: var(--text-secondary);
}

.pwa-btn-install {
  font-size: 0.8rem;
  padding: 6px 14px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
}

/* ─── iOS Step-by-Step Modal ────────────────────────────── */
.pwa-ios-modal {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.pwa-ios-modal.pwa-modal-open {
  opacity: 1;
  pointer-events: auto;
}

.pwa-modal-backdrop {
  position: absolute;
  inset: 0;
  background: var(--overlay-scrim, rgba(0, 0, 0, 0.65));
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

.pwa-modal-sheet {
  position: relative;
  z-index: 1;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  border-top-left-radius: var(--radius-xl);
  border-top-right-radius: var(--radius-xl);
  padding: 16px 20px calc(24px + env(safe-area-inset-bottom, 0px));
  max-width: 500px;
  width: 100%;
  margin: 0 auto;
  box-shadow: var(--shadow-lg);
  transform: translateY(100%);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

[data-theme="light"] .pwa-modal-sheet {
  background: #ffffff;
}

.pwa-ios-modal.pwa-modal-open .pwa-modal-sheet {
  transform: translateY(0);
}

.pwa-modal-handle {
  width: 36px;
  height: 4px;
  background: var(--text-muted);
  opacity: 0.4;
  border-radius: var(--radius-full);
  margin: 0 auto 16px;
}

.pwa-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.pwa-modal-app-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.pwa-app-badge-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  box-shadow: 0 4px 12px var(--accent-glow);
}

.pwa-modal-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.2;
}

.pwa-modal-subtitle {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-top: 3px;
}

.pwa-modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}

.pwa-modal-close:hover {
  background: var(--surface-subtle);
  color: var(--text-primary);
}

.pwa-ios-steps {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 22px;
}

.pwa-step-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface-subtle);
  border: 1px solid var(--surface-subtle-border);
  padding: 12px 14px;
  border-radius: var(--radius-lg);
}

.pwa-step-num {
  width: 26px;
  height: 26px;
  border-radius: var(--radius-full);
  background: var(--accent);
  color: #ffffff;
  font-weight: 700;
  font-size: 0.78rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.pwa-step-text {
  font-size: 0.84rem;
  color: var(--text-primary);
  line-height: 1.45;
  flex: 1;
}

.pwa-icon-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  padding: 2px 5px;
  border-radius: var(--radius-sm);
  background: var(--accent-tint);
  border: 1px solid var(--accent-tint-border);
  color: var(--accent-light);
  margin: 0 2px;
}

.pwa-modal-done-btn {
  font-weight: 600;
}




