/* ============================================
   University Dashboard — Modern Design System
   Clean dark theme with violet accent
   ============================================ */

/* Remove scrollbar from native app */
* {
  scrollbar-width: none;
  -ms-overflow-style: none;
}

*::-webkit-scrollbar {
  display: none;
}

/* ---------- Design Tokens ---------- */
:root {
  /* Backgrounds */
  --bg: #0b0f19;
  --bg-elevated: #111827;
  --bg-surface: #1e293b;
  --bg-surface-hover: #27354f;

  /* Text */
  --text: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  /* Accent */
  --accent: #8b5cf6;
  --accent-hover: #7c3aed;
  --accent-soft: rgba(139, 92, 246, 0.12);
  --accent-border: rgba(139, 92, 246, 0.25);

  /* Status */
  --success: #10b981;
  --success-soft: rgba(16, 185, 129, 0.12);
  --warning: #f59e0b;
  --warning-soft: rgba(245, 158, 11, 0.12);
  --danger: #ef4444;
  --danger-soft: rgba(239, 68, 68, 0.12);
  --info: #3b82f6;
  --info-soft: rgba(59, 130, 246, 0.12);

  /* Borders */
  --border: rgba(148, 163, 184, 0.1);
  --border-hover: rgba(148, 163, 184, 0.2);
  --border-strong: rgba(148, 163, 184, 0.25);

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.2), 0 2px 4px -2px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.25), 0 4px 6px -4px rgba(0, 0, 0, 0.2);
  --shadow-glow: 0 0 20px rgba(139, 92, 246, 0.15);

  /* Spacing */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;

  /* Radii */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  /* Typography */
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "JetBrains Mono", "Fira Code", Consolas, monospace;

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 200ms ease;
  --transition-slow: 300ms ease;

  /* Layout */
  --sidebar-width: 280px;
  --header-height: 64px;

  /* Dashboard Card Layout Tokens */
  --card-height-content-desktop: 132px;
  --card-height-content-mobile: 144px;
  --card-height-course-desktop: 104px;
  --card-height-course-mobile: 112px;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;

  /* Radii */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  /* Typography */
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "JetBrains Mono", "Fira Code", Consolas, monospace;

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 200ms ease;
  --transition-slow: 300ms ease;

  /* Layout */
  --sidebar-width: 280px;
  --header-height: 64px;
}

/* Light theme overrides */
[data-theme] {
  --bg: #f8fafc;
  --bg-elevated: #ffffff;
  --bg-surface: #f1f5f9;
  --bg-surface-hover: #e2e8f0;

  --text: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;

  --border: rgba(148, 163, 184, 0.25);
  --border-hover: rgba(148, 163, 184, 0.35);
  --border-strong: rgba(148, 163, 184, 0.45);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
}

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

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  background: var(--bg);
}

body {
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: manipulation;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

/* Subtle ambient background */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 50% at 20% 40%, rgba(139, 92, 246, 0.06), transparent),
    radial-gradient(ellipse 60% 40% at 80% 60%, rgba(59, 130, 246, 0.04), transparent);
  pointer-events: none;
  z-index: 0;
}

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

button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

img,
svg {
  display: block;
  max-width: 100%;
}

/* ---------- Layout ---------- */
.app-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

/* ---------- Sidebar ---------- */
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: min(85vw, var(--sidebar-width));
  background: var(--bg-elevated);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: var(--space-6);
  gap: var(--space-6);
  transform: translateX(-100%);
  transition: transform var(--transition-base), box-shadow var(--transition-base);
  z-index: 50;
  overflow-y: auto;
}

.app-shell.nav-open .sidebar {
  transform: translateX(0);
  box-shadow: var(--shadow-lg), 0 0 0 9999px rgba(0, 0, 0, 0.5);
}

.sidebar-brand {
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--border);
}

.sidebar-brand .eyebrow {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-bottom: var(--space-1);
}

.sidebar-brand h1 {
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.3;
}

.sidebar-copy {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-top: var(--space-2);
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 0.9375rem;
  font-weight: 500;
  transition: all var(--transition-fast);
  position: relative;
}

.nav-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%) scaleY(0);
  width: 3px;
  height: 20px;
  background: var(--accent);
  border-radius: 0 4px 4px 0;
  transition: transform var(--transition-base);
}

.nav-item:hover {
  color: var(--text);
  background: var(--bg-surface);
}

.nav-item.active {
  color: var(--text);
  background: var(--accent-soft);
}

.nav-item.active::before {
  transform: translateY(-50%) scaleY(1);
}

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

/* ---------- Mobile Toggle ---------- */
.mobile-toggle {
  position: fixed;
  top: calc(var(--space-3) + env(safe-area-inset-top, 0px));
  left: var(--space-3);
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text);
  font-size: 0;
  box-shadow: var(--shadow);
  transition: all var(--transition-fast);
}

.mobile-toggle:hover {
  background: var(--bg-surface);
  border-color: var(--border-hover);
}

.mobile-toggle::before {
  content: "";
  width: 18px;
  height: 2px;
  background: currentColor;
  border-radius: 2px;
  box-shadow: 0 -5px 0 currentColor, 0 5px 0 currentColor;
}

/* ---------- Main Content ---------- */
.main-content {
  flex: 1;
  padding: calc(var(--header-height) + var(--space-6) + env(safe-area-inset-top, 0px)) var(--space-4) var(--space-8);
  min-height: 100vh;
  max-width: 100%;
  overflow-x: hidden;
}

/* ---------- Pull-to-Refresh ---------- */
.pull-to-refresh {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10000;
  display: flex;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.pull-to-refresh.is-visible {
  opacity: 1;
}

.ptr-indicator {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25), 0 1px 3px rgba(0, 0, 0, 0.15);
  transform: translateY(-60px); /* start hidden above the screen */
  transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275); /* bounce effect */
  position: relative;
  margin-top: calc(env(safe-area-inset-top, 0px) + 12px);
}

/* Transition should be disabled while dragging for 1:1 tracking */
.pull-to-refresh.is-dragging .ptr-indicator {
  transition: none !important;
}

.ptr-arrow {
  width: 18px;
  height: 18px;
  color: var(--accent);
  transition: transform 0.1s linear, opacity 0.1s ease;
  opacity: 0.6;
}

.pull-to-refresh.is-active-threshold .ptr-arrow {
  opacity: 1;
  color: var(--success);
}

.ptr-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  display: none;
  position: absolute;
  inset: 10px;
}

.pull-to-refresh.is-refreshing .ptr-arrow {
  display: none !important;
}

.pull-to-refresh.is-refreshing .ptr-spinner {
  display: block !important;
  animation: ptr-spin 0.8s linear infinite;
}

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

/* ---------- Dashboard Footer ---------- */
.dashboard-footer {
  background: var(--bg-elevated);
  border-top: 1px solid var(--border);
  padding: var(--space-3) var(--space-4);
  margin-top: auto;
}

.footer-content {
  max-width: 1180px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-1);
}

.footer-actions {
  display: flex;
  gap: var(--space-3);
}

.footer-actions .btn {
  padding: var(--space-2) var(--space-4);
}

.footer-info {
  text-align: center;
}

.footer-credits {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: var(--space-1);
}

.footer-credits .heart {
  color: #ef4444;
  display: inline-block;
  animation: pulse-heart 1.5s ease-in-out infinite;
}

@keyframes pulse-heart {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

.footer-copyright {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.sw-version-badge {
  font-size: 0.72rem;
  padding: 1px 7px;
  border-radius: 12px;
  background: rgba(99, 102, 241, 0.12);
  color: var(--accent, #6366f1);
  border: 1px solid rgba(99, 102, 241, 0.25);
  font-family: var(--font-mono, monospace);
  margin-left: 8px;
  vertical-align: middle;
  display: inline-flex;
  align-items: center;
  font-weight: 500;
}

/* Responsive footer */
@media (min-width: 768px) {
  .footer-content {
    flex-direction: row;
    justify-content: center;
  }

  .footer-info {
    text-align: center;
  }
}

.admin-main {
  padding-top: calc(var(--header-height) + var(--space-4)) !important;
}

/* ---------- Dashboard Header ---------- */
.dashboard-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: calc(var(--header-height) + env(safe-area-inset-top, 0px));
  background: rgba(11, 15, 25, 0.85);
  backdrop-filter: blur(6px) saturate(180%);
  -webkit-backdrop-filter: blur(6px) saturate(180%);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0;
  margin-bottom: 0.25rem;
  padding-top: env(safe-area-inset-top, 0px);
  z-index: 9999;
  transition: background var(--transition-base);
}

/* Header inner container to align content with main column */
.dashboard-header .header-inner {
  width: 100%;
  max-width: 100%;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-4);
}

/* When sidebar is present (admin) slightly offset header inner to align with sidebar */
/* Remove empty rules above and rely on .header-inner for horizontal padding */

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

[data-theme] .dashboard-header {
  background: rgba(248, 250, 252, 0.85);
}

.brand-lockup h1,
.brand-lockup h2,
.header-brand-title {
  font-size: 1.125rem;
  font-weight: 700;
  line-height: 1.2;
  margin: 0;
}

.dashboard-header-meta {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
  position: relative;
}

.dashboard-header-meta .btn {
  padding: var(--space-1) var(--space-3);
  font-size: 0.8125rem;
}

.server-chip,
.header-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 10px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 500;
  white-space: nowrap;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
}

.header-meta-item .meta-label {
  color: var(--text-muted);
  font-weight: 400;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.header-meta-item #last-updated {
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.01em;
  white-space: nowrap;
}

body.is-offline .header-meta-item {
  border-color: rgba(239, 68, 68, 0.28);
  background: var(--danger-soft);
}

body.is-offline .header-meta-item .meta-label {
  display: none;
}

body.is-offline .header-meta-item #last-updated {
  color: var(--danger);
  font-weight: 500;
}

.hold-progress-fill {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  width: 0%;
  background: linear-gradient(90deg, var(--accent) 0%, #a855f7 100%);
  transition: width 0.04s linear;
  pointer-events: none;
  border-radius: 0 2px 2px 0;
}

.header-meta-item.is-holding {
  border-color: var(--accent) !important;
  box-shadow: 0 0 12px rgba(99, 102, 241, 0.45);
}

.menu-actions {
  display: none;
  align-items: center;
  gap: var(--space-2);
}

.menu-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  box-shadow: none;
}

.menu-action-btn:hover {
  background: var(--bg-surface-hover);
  border-color: var(--border-hover);
  color: var(--text);
}

.menu-action-btn svg {
  display: block;
}

/* Menu button */
.menu-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.menu-btn:hover {
  background: var(--bg-surface-hover);
  border-color: var(--border-hover);
  color: var(--text);
}

.menu-btn svg {
  display: block;
}

.timer-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  background: linear-gradient(180deg, rgba(245, 158, 11, 0.16), rgba(255, 255, 255, 0.04));
  border: 1px solid rgba(245, 158, 11, 0.25);
  border-radius: var(--radius-md);
  color: #fbbf24;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.timer-btn:hover {
  background: linear-gradient(180deg, rgba(245, 158, 11, 0.22), rgba(255, 255, 255, 0.06));
  border-color: rgba(245, 158, 11, 0.38);
  color: #fcd34d;
}

.timer-btn svg {
  display: block;
}

/* Menu popup */
.menu-popup {
  position: absolute;
  top: calc(100% + var(--space-2));
  right: 0;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: var(--space-2);
  display: none;
  flex-direction: column;
  gap: var(--space-1);
  min-width: 210px;
  box-shadow: var(--shadow-lg);
  z-index: 200;
  overflow: hidden;
}

.menu-popup.active {
  display: flex;
}

.popup-btn {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: left;
}

.popup-btn:hover {
  background: var(--bg-surface);
  color: var(--text);
}

.popup-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.popup-btn-danger {
  color: var(--danger) !important;
}

.popup-btn-danger:hover {
  background: var(--danger-soft) !important;
  color: var(--danger) !important;
}

.popup-btn svg {
  flex-shrink: 0;
}


/* Student profile chip (login system) — desktop: shown in header top-right; mobile: hidden, shown in hamburger menu */
.student-profile-chip {
  position: relative;
  display: none; /* hidden on mobile by default, shown on desktop via media query */
}

.student-profile-chip.hidden {
  display: none !important;
}

.student-profile-chip-btn {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 4px;
  background: transparent;
  border: none;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.student-profile-chip-btn:hover .student-profile-chip-avatar {
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.student-profile-chip-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--accent) 0%, #a855f7 100%);
  color: #fff;
  font-weight: 700;
  font-size: 0.875rem;
  flex-shrink: 0;
  border: 2px solid rgba(255,255,255,0.15);
  transition: box-shadow var(--transition-fast);
}

.student-profile-chip-text {
  display: none; /* just show avatar, clean icon-only approach */
}

.student-profile-chip-name {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text);
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.student-profile-chip-reg {
  font-size: 0.6875rem;
  color: var(--text-secondary);
}

/* ---- Premium Profile Dropdown Menu ---- */
.student-profile-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 0;
  min-width: 240px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.4), 0 4px 16px rgba(0,0,0,0.2);
  z-index: 10000;
  display: none;
  flex-direction: column;
  gap: 0;
  overflow: hidden;
  animation: profile-menu-in 0.18s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes profile-menu-in {
  from { opacity: 0; transform: scale(0.92) translateY(-8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.student-profile-menu.open {
  display: flex;
}

.student-profile-menu-header {
  padding: 20px 18px 16px;
  background: linear-gradient(135deg, rgba(99,102,241,0.15) 0%, rgba(168,85,247,0.1) 100%);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 14px;
}

.student-profile-menu-avatar {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--accent) 0%, #a855f7 100%);
  color: #fff;
  font-weight: 800;
  font-size: 1.125rem;
  flex-shrink: 0;
  border: 2px solid rgba(255,255,255,0.2);
  box-shadow: 0 4px 12px rgba(99,102,241,0.35);
  overflow: hidden;
}

.student-profile-chip-avatar,
.menu-popup-profile-avatar {
  overflow: hidden;
}

.student-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}

.student-profile-avatar-container {
  position: relative;
  display: inline-flex;
  cursor: pointer;
  flex-shrink: 0;
  border-radius: 50%;
  outline: none;
}

.student-profile-avatar-container:hover .avatar-edit-badge {
  background: var(--accent-hover, #4f46e5);
  transform: scale(1.1);
  box-shadow: 0 0 8px rgba(99,102,241,0.6);
}

.avatar-edit-badge {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--bg-elevated);
  box-shadow: 0 2px 5px rgba(0,0,0,0.4);
  transition: all var(--transition-fast);
  z-index: 2;
}

.avatar-edit-badge svg {
  display: block;
}

/* Avatar Upload Modal Styles */
.avatar-preview-wrapper {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  overflow: hidden;
  margin: 0 auto 16px;
  border: 3px solid var(--accent);
  box-shadow: 0 4px 20px rgba(99,102,241,0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--accent) 0%, #a855f7 100%);
  color: #fff;
  font-size: 2.25rem;
  font-weight: 800;
}

.avatar-preview-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.avatar-upload-zone {
  border: 2px dashed var(--border);
  border-radius: 12px;
  padding: 20px 16px;
  text-align: center;
  cursor: pointer;
  background: var(--bg-surface);
  transition: all var(--transition-fast);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.avatar-upload-zone:hover,
.avatar-upload-zone.dragover {
  border-color: var(--accent);
  background: var(--bg-surface-hover);
}

/* Circular Cropper Modal Styles */
.avatar-cropper-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.avatar-crop-canvas-container {
  position: relative;
  width: 260px;
  height: 260px;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  background: #0b0f19;
  touch-action: none;
  cursor: grab;
  margin: 0 auto;
  user-select: none;
}

.avatar-crop-canvas-container.is-dragging {
  cursor: grabbing;
}

.avatar-crop-canvas {
  width: 260px;
  height: 260px;
  display: block;
}

.cropper-zoom-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 260px;
  margin: 4px auto 0;
  color: var(--text-secondary);
}

.cropper-zoom-controls input[type="range"] {
  flex: 1;
  accent-color: var(--accent);
  cursor: pointer;
  height: 4px;
}

.cropper-hint {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

.student-profile-menu-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
  overflow: hidden;
}

.student-profile-menu-name {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.student-profile-menu-reg {
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.student-profile-menu-body {
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.student-profile-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: none;
  border: none;
  color: var(--text);
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition: background var(--transition-fast), color var(--transition-fast);
  font-family: inherit;
}

.student-profile-menu-item svg {
  flex-shrink: 0;
  opacity: 0.7;
}

button.student-profile-menu-item:hover {
  background: var(--bg-surface);
  color: var(--text);
}

button.student-profile-menu-item:hover svg {
  opacity: 1;
}

.student-profile-menu-item.danger {
  color: var(--danger);
}

.student-profile-menu-item.danger svg {
  color: var(--danger);
}

.student-profile-menu-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 8px;
}

/* ---- Mobile profile section inside hamburger popup ---- */
.menu-popup-profile-slot:empty {
  display: none;
}

.menu-popup-profile-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  margin-bottom: 4px;
  background: linear-gradient(135deg, rgba(99,102,241,0.12) 0%, rgba(168,85,247,0.08) 100%);
  border-radius: 10px;
  border-bottom: 1px solid var(--border);
}

.menu-popup-profile-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--accent) 0%, #a855f7 100%);
  color: #fff;
  font-weight: 800;
  font-size: 1rem;
  flex-shrink: 0;
  border: 2px solid rgba(255,255,255,0.15);
}

.menu-popup-profile-info {
  flex: 1;
  overflow: hidden;
}

.menu-popup-profile-name {
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.menu-popup-profile-reg {
  font-size: 0.6875rem;
  color: var(--text-secondary);
}

.menu-popup-profile-actions {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 6px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.student-modal-input {
  width: 100%;
  padding: 0.6rem 0.75rem;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text);
  font-size: 0.875rem;
  font-family: inherit;
}

.student-modal-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.student-modal-field {
  margin-bottom: var(--space-4);
}

.student-modal-field label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: var(--space-2);
}

.student-modal-error {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  background: var(--danger-soft);
  border: 1px solid var(--danger);
  color: var(--danger);
  border-radius: var(--radius-md);
  padding: 0.6rem 0.75rem;
  font-size: 0.8125rem;
}

.student-modal-error.hidden {
  display: none;
}

@media (max-width: 640px) {
  .student-profile-chip-text {
    display: none;
  }

  .student-profile-menu {
    right: 0;
    left: auto;
  }
}

.popup-btn svg {
  flex-shrink: 0;
}

.header-meta-item:hover {
  border-color: var(--border-hover);
  background: var(--bg-surface-hover);
  cursor: pointer;
}

.server-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  min-width: 6px;
  min-height: 6px;
  border-radius: 50%;
  background: var(--danger);
  box-shadow: 0 0 0 2.5px var(--danger-soft);
  transition: all var(--transition-base);
  animation: pulse-dot 1.5s ease-in-out infinite;
  flex-shrink: 0;
}

.server-dot.live {
  background: var(--success);
  box-shadow: 0 0 0 2.5px var(--success-soft);
  animation: none;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

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

/* ---------- Student Birthday Banner — Compact Animated Card ---------- */
.student-birthday-banner {
  margin-bottom: var(--space-4);
}

/* === CARD SHELL === */
.bday-card {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  background: linear-gradient(130deg,
    #130826 0%,
    #121b36 35%,
    #0d2b50 70%,
    #130826 100%);
  border: 1px solid rgba(180, 130, 255, 0.22);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.05) inset,
    0 12px 32px -8px rgba(0, 0, 0, 0.6),
    0 0 50px -15px rgba(147, 112, 219, 0.2);
  animation: bdayCardIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes bdayCardIn {
  from { opacity: 0; transform: translateY(-10px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* === SHIMMER SWEEP === */
.bday-shimmer-layer {
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg,
    transparent 40%,
    rgba(255, 255, 255, 0.05) 50%,
    transparent 60%);
  background-size: 200% 100%;
  animation: bdayShimmer 4s ease-in-out infinite;
  pointer-events: none;
  z-index: 1;
}

@keyframes bdayShimmer {
  0%   { background-position: -100% 0; }
  100% { background-position: 200% 0; }
}

/* === GLOW ORBS === */
.bday-glow-orb {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  filter: blur(35px);
  opacity: 0.35;
  animation: bdayOrb 6s ease-in-out infinite alternate;
}

.bday-glow-1 {
  width: 130px;
  height: 130px;
  background: radial-gradient(circle, #b06fff, transparent 70%);
  top: -40px;
  left: -30px;
  animation-delay: 0s;
}

.bday-glow-2 {
  width: 120px;
  height: 120px;
  background: radial-gradient(circle, #ff6eb4, transparent 70%);
  bottom: -40px;
  right: -20px;
  animation-delay: -3s;
}

@keyframes bdayOrb {
  from { transform: scale(1) translate(0, 0); }
  to   { transform: scale(1.15) translate(8px, -8px); }
}

/* === FLOATING PARTICLES === */
.bday-particles {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
  overflow: hidden;
}

.bday-particle {
  position: absolute;
  top: 110%;
  animation: bdayFloat linear infinite;
  opacity: 0;
  user-select: none;
}

@keyframes bdayFloat {
  0%   { top: 110%; opacity: 0; transform: translateX(0) rotate(0deg); }
  15%  { opacity: 0.5; }
  80%  { opacity: 0.4; }
  100% { top: -20%; opacity: 0; transform: translateX(14px) rotate(360deg); }
}

/* === INNER LAYOUT === */
.bday-card-inner {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.75rem 1rem;
}

/* === ICON RING === */
.bday-icon-ring {
  flex-shrink: 0;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: conic-gradient(from 0deg, #ff6eb4, #b06fff, #6eb9ff, #6effb4, #ffe06e, #ff6eb4);
  padding: 2px;
  animation: bdayRingSpin 8s linear infinite;
  box-shadow: 0 0 16px rgba(176, 111, 255, 0.4);
}

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

.bday-icon-ring-inner {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: #130826;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: bdayRingSpin 8s linear infinite reverse;
}

.bday-dp-svg {
  color: #c084fc;
  filter: drop-shadow(0 0 6px rgba(192, 132, 252, 0.5));
}

.bday-cake-badge {
  position: absolute;
  right: -5px;
  bottom: -5px;
  font-size: 0.85rem;
  line-height: 1;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.6));
  animation: bdayBadgeBounce 2s ease-in-out infinite;
}

@keyframes bdayBadgeBounce {
  0%, 100% { transform: scale(1) rotate(0deg); }
  50%       { transform: scale(1.15) rotate(10deg); }
}

/* === TEXT CONTENT === */
.bday-content {
  flex: 1;
  min-width: 0;
}

.bday-eyebrow {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(190, 150, 255, 0.9);
  margin-bottom: 2px;
  line-height: 1.1;
}

.bday-headline {
  font-size: 0.95rem;
  font-weight: 800;
  line-height: 1.25;
  color: #fff;
  letter-spacing: -0.015em;
  word-break: break-word;
}

.bday-name {
  background: linear-gradient(90deg, #ffe06e, #ffb347, #ff6eb4);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-weight: 900;
  animation: bdayNameShine 3s linear infinite;
  background-size: 200%;
}

@keyframes bdayNameShine {
  0%   { background-position: 0% center; }
  100% { background-position: 200% center; }
}

.bday-tagline {
  font-size: 0.76rem;
  color: rgba(200, 185, 255, 0.8);
  margin-top: 2px;
  line-height: 1.35;
}

/* === RESPONSIVE FOR NARROW / MOBILE DEVICES === */
@media (max-width: 576px) {
  .bday-card {
    border-radius: 14px;
  }
  .bday-card-inner {
    padding: 0.65rem 0.85rem;
    gap: 0.7rem;
  }
  .bday-icon-ring {
    width: 40px;
    height: 40px;
  }
  .bday-main-emoji {
    font-size: 1.1rem;
  }
  .bday-eyebrow {
    font-size: 0.58rem;
  }
  .bday-headline {
    font-size: 0.88rem;
  }
  .bday-tagline {
    font-size: 0.72rem;
  }
  .bday-glow-1, .bday-glow-2 {
    display: none;
  }
}

@media (max-width: 380px) {
  .bday-card-inner {
    padding: 0.55rem 0.7rem;
    gap: 0.6rem;
  }
  .bday-icon-ring {
    width: 36px;
    height: 36px;
  }
  .bday-main-emoji {
    font-size: 1rem;
  }
  .bday-headline {
    font-size: 0.82rem;
  }
  .bday-tagline {
    font-size: 0.68rem;
  }
}

/* ---------- Stats Bar ---------- */
.count-bar {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-4);
  /*change this to change distance between top bar and stats or count cards*/
  margin-bottom: var(--space-6);
}



.count-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  position: relative;
  overflow: hidden;
  transition: all var(--transition-base);
}

.count-card::after {
  content: "";
  position: absolute;
  top: -40px;
  right: -40px;
  width: 100px;
  height: 100px;
  border-radius: 50%;
  opacity: 0.15;
  transition: opacity var(--transition-base);
}

.count-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.count-card:hover::after {
  opacity: 0.25;
}

/* Stat tone variants */
.stat-champagne::after { background: #fbbf24; }
.stat-champagne .count-value { color: #fbbf24; }

.stat-emerald::after { background: #10b981; }
.stat-emerald .count-value { color: #10b981; }

.stat-ruby::after { background: #ef4444; }
.stat-ruby .count-value { color: #ef4444; }

.stat-ink::after { background: #64748b; }
.stat-ink .count-value { color: #64748b; }

.count-value {
  font-size: 2rem;
  font-weight: 800;
  line-height: 1;
  margin-bottom: var(--space-2);
}

.count-label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
}

/* ---------- Dashboard Grid ---------- */
.dashboard-grid {
  display: grid;
  gap: var(--space-6);
}

/* ---------- Panels & Cards ---------- */
.panel {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  transition: border-color var(--transition-fast);
}

.panel.section-highlight {
  border: 2px solid #8000ff;
  animation: stroke-pulse 3s ease-out forwards;
}

@keyframes stroke-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(128, 0, 255, 0.8); }
  30%  { box-shadow: 0 0 0 4px rgba(128, 0, 255, 0.4); }
  60%  { box-shadow: 0 0 0 8px rgba(128, 0, 255, 0.15); }
  100% { box-shadow: 0 0 0 12px rgba(128, 0, 255, 0); }
}

.panel:hover {
  border-color: var(--border-hover);
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--border, rgba(255, 255, 255, 0.08));
}

.section-heading .eyebrow {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  margin-bottom: var(--space-1);
}

.section-heading h2 {
  font-size: 1.125rem;
  font-weight: 700;
}

.section-heading .view-all-btn {
  position: relative;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  border-radius: var(--radius-md);
  padding: 0.3rem 0.75rem;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.section-heading .view-all-btn:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* Pulsing / Flashing Red Dot on View All button */
.view-all-pulse-dot {
  position: absolute;
  top: -3px;
  right: -3px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--danger, #ef4444);
  box-shadow: 0 0 0 2px var(--bg-surface, #1e293b), 0 0 10px rgba(239, 68, 68, 0.85);
  pointer-events: none;
  z-index: 2;
  animation: viewAllDotFlash 1.6s ease-in-out infinite;
}

.view-all-pulse-dot::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  background: inherit;
  animation: viewAllDotPing 1.6s cubic-bezier(0, 0, 0.2, 1) infinite;
  pointer-events: none;
}

@keyframes viewAllDotFlash {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.75;
    transform: scale(0.92);
  }
}

@keyframes viewAllDotPing {
  0% {
    width: 8px;
    height: 8px;
    opacity: 0.85;
  }
  75%, 100% {
    width: 22px;
    height: 22px;
    opacity: 0;
  }
}

[data-theme] .view-all-pulse-dot {
  box-shadow: 0 0 0 2px #ffffff, 0 0 10px rgba(239, 68, 68, 0.85);
}

@media (prefers-reduced-motion: reduce) {
  .view-all-pulse-dot {
    animation: none;
  }
  .view-all-pulse-dot::before {
    display: none;
  }
}

/* View All Modal */
.view-all-modal {
  max-width: 640px;
  width: min(92vw, 640px);
  max-height: 85vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.view-all-modal .modal-header {
  border-bottom: none;
  padding: var(--space-5) var(--space-6) 0.5rem var(--space-6);
}

.view-all-tabs {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.65rem var(--space-6) 1rem var(--space-6);
  border-bottom: 1px solid var(--border);
  background: var(--bg-elevated);
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 30;
}

.view-all-tabs-group {
  display: flex;
  gap: var(--space-1);
  align-items: center;
}

.view-all-filter-wrap {
  position: relative;
  flex: 0 1 auto;
  min-width: 0;
  max-width: 240px;
  flex-shrink: 0;
}

.view-all-actions-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
  flex-shrink: 0;
}

#view-all-status-wrap,
#view-all-sort-wrap {
  flex-shrink: 0;
}

.view-all-tab {
  padding: var(--space-2) var(--space-4);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
  top: 1px;
}

.view-all-tab:hover {
  color: var(--text);
}

.view-all-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.view-all-filter-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  height: 30px;
  padding: 0 0.8rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  white-space: nowrap;
  max-width: 100%;
}

.view-all-filter-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(99, 102, 241, 0.4);
  box-shadow: 0 0 12px rgba(99, 102, 241, 0.2);
  transform: translateY(-0.5px);
}

.view-all-filter-btn[aria-expanded="true"] {
  border-color: var(--accent);
  background: rgba(99, 102, 241, 0.12);
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.25);
}

.view-all-filter-btn[aria-expanded="true"] .view-all-chevron {
  transform: rotate(180deg);
}

.view-all-btn-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  text-align: left;
  min-width: 0;
  font-size: 0.78rem;
}

.view-all-btn-icon {
  flex-shrink: 0;
  opacity: 0.75;
  color: var(--accent);
}

.view-all-sort-btn {
  padding: 0 0.75rem;
}

.view-all-sort-btn svg {
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.view-all-sort-btn.sort-asc svg {
  transform: rotate(180deg);
}

.view-all-chevron {
  flex-shrink: 0;
  opacity: 0.6;
  transition: transform 0.2s ease;
}

/* Status & Sort toggle button styling */
.view-all-status-btn,
.view-all-sort-btn {
  user-select: none;
}

.view-all-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #8b5cf6;
  box-shadow: 0 0 6px rgba(139, 92, 246, 0.7);
  flex-shrink: 0;
  transition: background-color 0.28s cubic-bezier(0.16, 1, 0.3, 1),
              box-shadow 0.28s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

.view-all-status-btn.is-completed .view-all-status-dot {
  background: #10b981;
  box-shadow: 0 0 7px rgba(16, 185, 129, 0.75);
}

.view-all-status-text {
  display: inline-block;
  min-width: 66px;
  text-align: center;
  font-size: 0.78rem;
  font-weight: 500;
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.12s ease, transform 0.12s ease;
}

.view-all-sort-text {
  display: inline-block;
  min-width: 48px;
  text-align: center;
  font-size: 0.78rem;
  font-weight: 500;
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.12s ease, transform 0.12s ease;
}

.view-all-status-text.is-animating,
.view-all-sort-text.is-animating {
  opacity: 0;
  transform: translateY(3px);
}

/* Double arrow toggle icon (<- ->) */
.view-all-toggle-arrow {
  flex-shrink: 0;
  opacity: 0.65;
  color: var(--text-muted);
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease, color 0.2s ease;
}

.view-all-status-btn:hover .view-all-toggle-arrow {
  opacity: 1;
  color: var(--text);
}

.view-all-status-btn.is-completed .view-all-toggle-arrow {
  transform: rotate(180deg);
  color: #34d399;
}

[data-theme] .view-all-status-btn.is-completed .view-all-toggle-arrow {
  color: #059669;
}

.view-all-subject-menu {
  position: absolute;
  top: calc(100% + 0.55rem);
  left: 0;
  width: min(220px, 80vw);
  max-height: 240px;
  overflow-y: auto;
  padding: 4px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: var(--bg-elevated);
  background: linear-gradient(180deg, rgba(18, 24, 39, 0.96) 0%, rgba(11, 14, 23, 0.98) 100%);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.04);
  z-index: 100;
  animation: v2DropdownFadeIn 150ms cubic-bezier(0.16, 1, 0.3, 1);
}

.view-all-subject-menu::-webkit-scrollbar {
  width: 4px;
}

.view-all-subject-menu::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}

.view-all-subject-option {
  display: flex;
  align-items: center;
  width: 100%;
  text-align: left;
  padding: 0.4rem 0.6rem;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--text);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.view-all-subject-option:hover {
  background: rgba(99, 102, 241, 0.12);
  color: var(--accent);
}

.view-all-subject-option.active {
  background: rgba(99, 102, 241, 0.16);
  color: var(--accent);
  font-weight: 600;
}

.view-all-modal .modal-body {
  padding: var(--space-5) var(--space-6);
}

.view-all-item {
  margin-bottom: var(--space-3);
  cursor: pointer;
  width: 100%;
  text-align: left;
}

.view-all-course-item .view-all-item-header {
  gap: var(--space-3);
}

.view-all-course-item .view-all-item-header h3 {
  min-width: 0;
  overflow-wrap: anywhere;
}

.active-course-credits {
  flex: none;
  white-space: nowrap;
}

.view-all-course-details {
  display: grid;
  gap: var(--space-2);
  margin-top: var(--space-3);
  min-width: 0;
}

.view-all-course-item .view-all-course-details p {
  color: var(--text-secondary);
  font-size: 0.875rem;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.view-all-empty {
  text-align: center;
  padding: var(--space-10) var(--space-6);
  color: var(--text-secondary);
}

.view-all-empty-icon {
  font-size: 2rem;
  margin-bottom: var(--space-3);
  opacity: 0.4;
}

.view-all-empty h4 {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: var(--space-1);
}

.view-all-empty p {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

/* Responsive adjustments */
@media (max-width: 640px) {
  .section-heading h2 {
    font-size: 1rem;
  }

  /* View All Modal body already handled globally above */
  .view-all-tabs {
    padding: 0 var(--space-4);
  }

  .view-all-item {
    padding: var(--space-3);
  }
}

/* Info cards */
.info-card,
.record-card {
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  text-align: left;
  color: var(--text);
  transition: all var(--transition-base);
}

.info-card + .info-card,
.record-card + .record-card {
  margin-top: var(--space-3);
}

.info-card:hover,
.record-card:hover {
  border-color: var(--border-strong);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

/* Delete animation - fade out and collapse */
.record-card.deleting,
tr.deleting {
  animation: fade-out 400ms ease forwards;
  pointer-events: none;
}

.record-card.deleting {
  padding: 0;
  margin: 0;
  overflow: hidden;
}

.info-card.is-urgent {
  border-color: var(--danger);
  background: linear-gradient(135deg, var(--bg-surface), rgba(239, 68, 68, 0.05));
}

.info-card.is-urgent:hover {
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.15);
}

.info-card-top,
.record-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

.info-card-top h3,
.record-card-top h3 {
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.4;
  flex: 1;
}

.active-course-card-top > div {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}

.active-course-card .card-summary {
  overflow-wrap: anywhere;
}

.info-card-middle {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
  flex-wrap: wrap;
}

.info-card-badges {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
}

.announcement-meta {
  display: flex;
  justify-content: flex-end;
  flex-shrink: 0;
}

.announcement-pill {
  text-transform: none;
  white-space: nowrap;
}

.card-summary {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: var(--space-3);
}

.card-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.card-meta.right {
  flex-direction: column;
  align-items: flex-end;
  gap: var(--space-1);
}

.quiz-meta-right {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: var(--space-2);
  text-align: right;
  white-space: nowrap;
}

/* ============================================
   Dashboard Scoped Card System
   Enforces fixed height, clean 3-zone layout,
   ultra-modern dark glassmorphism styling,
   and stable responsive behavior.
   ============================================ */

.dashboard-card {
  height: var(--card-height-content-desktop);
  box-sizing: border-box;
  min-width: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 1.15rem 1.2rem 0.85rem;
  text-align: left;
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(30, 41, 59, 0.6) 0%, rgba(15, 23, 42, 0.75) 100%);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 4px 16px -2px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.22s ease, transform 0.22s ease, box-shadow 0.22s ease, background 0.22s ease;
  position: relative;
}

.dashboard-card:hover {
  border-color: rgba(139, 92, 246, 0.38);
  background: linear-gradient(180deg, rgba(30, 41, 59, 0.85) 0%, rgba(20, 29, 47, 0.9) 100%);
  transform: translateY(-2px);
  box-shadow: 0 10px 24px -4px rgba(0, 0, 0, 0.45), 0 0 18px rgba(139, 92, 246, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.dashboard-card:active {
  transform: translateY(0);
}

.dashboard-card:focus-visible {
  outline: 2px solid var(--accent, #8b5cf6);
  outline-offset: 2px;
}

/* Urgent Announcement Card */
.dashboard-card.is-urgent {
  border-color: rgba(239, 68, 68, 0.32);
  background: linear-gradient(180deg, rgba(239, 68, 68, 0.08) 0%, rgba(15, 23, 42, 0.82) 100%);
  box-shadow: 0 4px 18px -2px rgba(239, 68, 68, 0.12), inset 0 1px 0 rgba(239, 68, 68, 0.2);
}

.dashboard-card.is-urgent:hover {
  border-color: rgba(239, 68, 68, 0.55);
  background: linear-gradient(180deg, rgba(239, 68, 68, 0.12) 0%, rgba(20, 29, 47, 0.92) 100%);
  box-shadow: 0 10px 25px -4px rgba(239, 68, 68, 0.18), 0 0 20px rgba(239, 68, 68, 0.12), inset 0 1px 0 rgba(239, 68, 68, 0.3);
}

.dashboard-card-course {
  height: var(--card-height-course-desktop);
  padding: 1.15rem 1.2rem 0.85rem;
}

/* Header */
.dashboard-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  min-width: 0;
  flex-shrink: 0;
}

.dashboard-card-title {
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: -0.012em;
  line-height: 1.35;
  color: #f8fafc;
  margin: 0;
  min-width: 0;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}

.dashboard-card-badges {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  min-width: 0;
}

.dashboard-card .badge {
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex-shrink: 0;
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.015em;
  padding: 2px 7.5px;
  border-radius: 6px;
  line-height: 1.3;
}

.dashboard-card .badge.badge-subject {
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.08);
  border: 1px solid rgba(56, 189, 248, 0.22);
}

.badge.badge-subject.is-completed,
.dashboard-card .badge.badge-subject.is-completed {
  color: #6ee7b7;
  background: rgba(16, 185, 129, 0.1);
  border-color: rgba(16, 185, 129, 0.28);
}

.badge.badge-subject.is-pending,
.dashboard-card .badge.badge-subject.is-pending {
  color: #f87171;
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.28);
}

.dashboard-card .badge.badge-pending {
  color: #fbbf24;
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.22);
}

.dashboard-card .badge.badge-high {
  color: #f87171;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.25);
}

/* Completed / Passed Card on Home Screen */
.dashboard-card.is-completed {
  opacity: 0.72;
  border-color: rgba(16, 185, 129, 0.22);
  background: linear-gradient(180deg, rgba(16, 185, 129, 0.05) 0%, rgba(15, 23, 42, 0.82) 100%);
  position: relative;
}

.dashboard-card.is-completed:hover {
  opacity: 0.92;
  border-color: rgba(16, 185, 129, 0.45);
  background: linear-gradient(180deg, rgba(16, 185, 129, 0.09) 0%, rgba(20, 29, 47, 0.92) 100%);
  box-shadow: 0 10px 24px -4px rgba(0, 0, 0, 0.45), 0 0 18px rgba(16, 185, 129, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

/* Watermark Stamp (Tilted, Authentic Rubber-Stamp Look) */
.card-completed-stamp {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-14deg);
  border: 2px dashed rgba(16, 185, 129, 0.42);
  color: #34d399;
  font-size: 0.85rem;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  padding: 0.22rem 0.95rem;
  border-radius: 6px;
  background: rgba(16, 185, 129, 0.07);
  box-shadow: 0 0 14px rgba(16, 185, 129, 0.12);
  pointer-events: none;
  user-select: none;
  z-index: 2;
  opacity: 0.85;
}

/* Body */
.dashboard-card-body {
  flex: 1;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  margin: 8px 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.dashboard-card-summary {
  font-size: 0.8125rem;
  line-height: 1.48;
  color: #94a3b8;
  margin: 0;
  min-width: 0;
  width: 100%;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}

.dashboard-card-read-more {
  color: #818cf8;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  margin-left: 4px;
  white-space: nowrap;
  transition: color 0.15s ease, text-decoration 0.15s ease;
}

.dashboard-card:hover .dashboard-card-read-more,
.view-all-item:hover .dashboard-card-read-more {
  color: #a5b4fc;
  text-decoration: underline;
}

/* Footer */
.dashboard-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  min-width: 0;
  flex-shrink: 0;
  font-size: 0.775rem;
  color: #64748b;
  padding-top: 7px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.dashboard-card-time,
.dashboard-card-deadline {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.775rem;
  font-weight: 500;
  color: #94a3b8;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.due-cal-icon {
  flex-shrink: 0;
  opacity: 0.75;
  color: #94a3b8;
  vertical-align: middle;
}

.due-tag-urgent {
  color: #f87171 !important;
  font-weight: 700;
}

.due-tag-warning {
  color: #fbbf24 !important;
  font-weight: 700;
}

.dashboard-card-priority-normal {
  font-size: 0.7rem;
  color: #64748b;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.dashboard-card-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 0.75rem;
  font-weight: 500;
  color: #60a5fa;
  background: transparent;
  border: none;
  padding: 0;
  white-space: nowrap;
  flex-shrink: 0;
  opacity: 0.85;
  transition: all 0.18s ease;
  letter-spacing: 0.01em;
}

.dashboard-card:hover .dashboard-card-action-btn,
.view-all-item:hover .dashboard-card-action-btn {
  opacity: 1;
  color: #93c5fd;
  transform: translateX(3px);
}

.dashboard-card-metrics {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  text-align: right;
  font-size: 0.75rem;
  color: #64748b;
  flex-shrink: 0;
  white-space: nowrap;
}

/* Course Row */
.dashboard-card-course .dashboard-card-header {
  align-items: flex-start;
  margin-bottom: 0;
}

.active-course-main {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.active-course-main .dashboard-card-title {
  -webkit-line-clamp: 1;
  line-clamp: 1;
  white-space: nowrap;
  text-overflow: ellipsis;
  line-height: 1.35;
}

.dashboard-card-subtitle {
  font-size: 0.78rem;
  color: #94a3b8;
  line-height: 1.35;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dashboard-card-credits {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2.5px 8px;
  border-radius: var(--radius-full);
  background: rgba(139, 92, 246, 0.1);
  border: 1px solid rgba(139, 92, 246, 0.25);
  color: #c4b5fd;
  white-space: nowrap;
  flex-shrink: 0;
  margin-top: 1px;
}

.active-course-footer {
  margin-top: auto;
  padding-top: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.active-course-footer .dashboard-card-summary {
  -webkit-line-clamp: 1;
  line-clamp: 1;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 0.775rem;
  color: #64748b;
  margin: 0;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .dashboard-card {
    transition: none !important;
    transform: none !important;
  }
  .dashboard-card:hover,
  .dashboard-card:active {
    transform: none !important;
  }
}

/* ============================================================
   Light Theme Overrides — Dashboard Canvas, Panels, Cards & Modals
   ============================================================ */
[data-theme] body {
  background: #f8fafc;
  color: #0f172a;
}

[data-theme] body::before {
  background:
    radial-gradient(ellipse 75% 50% at 15% 15%, rgba(99, 102, 241, 0.05), transparent 70%),
    radial-gradient(ellipse 65% 45% at 85% 60%, rgba(14, 165, 233, 0.04), transparent 70%),
    radial-gradient(ellipse 55% 40% at 50% 95%, rgba(244, 114, 182, 0.03), transparent 70%);
}

[data-theme] .dashboard-header {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(226, 232, 240, 0.9);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.03);
}

[data-theme] .brand-lockup h1,
[data-theme] .brand-lockup h2,
[data-theme] .header-brand-title {
  color: #0f172a;
}

[data-theme] .server-chip,
[data-theme] .header-meta-item {
  background: #ffffff;
  border-color: rgba(203, 213, 225, 0.8);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  color: #334155;
}

[data-theme] .count-card {
  background: #ffffff;
  border: 1.5px solid rgba(15, 23, 42, 0.12);
  border-radius: var(--radius-xl, 20px);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04), 0 8px 18px -4px rgba(0, 0, 0, 0.05);
}

[data-theme] .count-card:hover {
  border-color: rgba(99, 102, 241, 0.35);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06), 0 14px 28px -4px rgba(99, 102, 241, 0.1);
  transform: translateY(-2px);
}

[data-theme] .count-label {
  color: #64748b;
  font-weight: 500;
}

[data-theme] .panel {
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1.5px solid rgba(226, 232, 240, 0.95);
  border-radius: var(--radius-xl, 20px);
  box-shadow: 0 4px 20px -4px rgba(0, 0, 0, 0.03), 0 1px 3px rgba(0, 0, 0, 0.02);
}

[data-theme] .section-heading h2 {
  color: #0f172a;
  font-weight: 700;
  letter-spacing: -0.02em;
}

[data-theme] .view-all-btn {
  color: #4f46e5;
  background: rgba(79, 70, 229, 0.07);
  border: 1px solid rgba(79, 70, 229, 0.2);
  border-radius: var(--radius-full);
  font-weight: 600;
  font-size: 0.8125rem;
  padding: 0.3rem 0.85rem;
  transition: all 0.18s ease;
}

[data-theme] .view-all-btn:hover {
  background: rgba(79, 70, 229, 0.14);
  border-color: rgba(79, 70, 229, 0.35);
  color: #4338ca;
  transform: translateY(-1px);
}

[data-theme] .dashboard-card,
[data-theme] .view-all-item {
  background: #ffffff;
  border: 1.5px solid rgba(15, 23, 42, 0.16);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04), 0 8px 18px -4px rgba(0, 0, 0, 0.07);
  color: #0f172a;
}

[data-theme] .dashboard-card:hover,
[data-theme] .view-all-item:hover {
  background: #ffffff;
  border-color: rgba(99, 102, 241, 0.65);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08), 0 14px 28px -6px rgba(99, 102, 241, 0.16);
  transform: translateY(-2px);
}

[data-theme] .dashboard-card.is-urgent {
  background: linear-gradient(180deg, #fff5f5 0%, #ffffff 100%);
  border: 1.5px solid rgba(239, 68, 68, 0.38);
  box-shadow: 0 2px 10px rgba(239, 68, 68, 0.08), 0 6px 18px -4px rgba(0, 0, 0, 0.06);
}

[data-theme] .dashboard-card.is-urgent:hover {
  background: linear-gradient(180deg, #fee2e2 0%, #ffffff 100%);
  border-color: rgba(239, 68, 68, 0.6);
  box-shadow: 0 6px 16px rgba(239, 68, 68, 0.16), 0 12px 28px -4px rgba(0, 0, 0, 0.1);
}

[data-theme] .dashboard-card-title {
  color: #0f172a;
  font-weight: 700;
}

[data-theme] .dashboard-card-summary {
  color: #334155;
}

[data-theme] .dashboard-card-footer {
  border-top: 1px solid rgba(15, 23, 42, 0.1);
  color: #64748b;
}

[data-theme] .dashboard-card-time,
[data-theme] .dashboard-card-deadline {
  color: #475569;
}

[data-theme] .due-cal-icon {
  color: #64748b;
  opacity: 0.9;
}

[data-theme] .due-tag-urgent {
  color: #dc2626 !important;
}

[data-theme] .due-tag-warning {
  color: #d97706 !important;
}

[data-theme] .dashboard-card-priority-normal {
  color: #64748b;
}

[data-theme] .dashboard-card-action-btn {
  color: #2563eb;
  font-weight: 600;
}

[data-theme] .dashboard-card:hover .dashboard-card-action-btn,
[data-theme] .view-all-item:hover .dashboard-card-action-btn {
  color: #1d4ed8;
}

[data-theme] .dashboard-card .badge.badge-subject,
[data-theme] .detail-modal .badge.badge-subject,
[data-theme] .view-all-modal .badge.badge-subject {
  color: #0369a1;
  background: rgba(2, 132, 199, 0.1);
  border: 1px solid rgba(2, 132, 199, 0.35);
  font-weight: 600;
}

[data-theme] .badge.badge-subject.is-completed,
[data-theme] .dashboard-card .badge.badge-subject.is-completed,
[data-theme] .detail-modal .badge.badge-subject.is-completed,
[data-theme] .view-all-modal .badge.badge-subject.is-completed {
  color: #059669;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.35);
  font-weight: 600;
}

[data-theme] .badge.badge-subject.is-pending,
[data-theme] .dashboard-card .badge.badge-subject.is-pending,
[data-theme] .detail-modal .badge.badge-subject.is-pending,
[data-theme] .view-all-modal .badge.badge-subject.is-pending {
  color: #dc2626;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  font-weight: 600;
}

[data-theme] .dashboard-card .badge.badge-pending,
[data-theme] .detail-modal .badge.badge-pending,
[data-theme] .view-all-modal .badge.badge-pending {
  color: #b45309;
  background: rgba(217, 119, 6, 0.1);
  border: 1px solid rgba(217, 119, 6, 0.35);
  font-weight: 600;
}

[data-theme] .dashboard-card .badge.badge-high,
[data-theme] .detail-modal .badge.badge-high,
[data-theme] .view-all-modal .badge.badge-high {
  color: #b91c1c;
  background: rgba(220, 38, 38, 0.1);
  border: 1px solid rgba(220, 38, 38, 0.35);
  font-weight: 600;
}

[data-theme] .dashboard-card.is-completed {
  opacity: 0.82;
  background: linear-gradient(180deg, #f0fdf4 0%, #ffffff 100%);
  border: 1.5px solid rgba(16, 185, 129, 0.35);
}

[data-theme] .dashboard-card.is-completed:hover {
  opacity: 0.98;
  background: linear-gradient(180deg, #dcfce7 0%, #ffffff 100%);
  border-color: rgba(16, 185, 129, 0.6);
}

[data-theme] .card-completed-stamp {
  border-color: rgba(5, 150, 105, 0.45);
  color: #059669;
  background: rgba(16, 185, 129, 0.08);
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.15);
}

[data-theme] .dashboard-card-metrics {
  color: #64748b;
}

[data-theme] .active-course-credits {
  color: #6d28d9;
  background: rgba(109, 40, 217, 0.1);
  border: 1px solid rgba(109, 40, 217, 0.3);
  font-weight: 600;
}

[data-theme] .active-course-footer {
  border-top: 1px solid rgba(15, 23, 42, 0.1);
}

/* Modals Light Mode */
[data-theme] .detail-modal,
[data-theme] .view-all-modal,
[data-theme] .modal {
  background: #ffffff;
  border: 1.5px solid rgba(15, 23, 42, 0.2);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.28), 0 8px 24px rgba(0, 0, 0, 0.12);
}

[data-theme] .modal-header {
  border-bottom: 1px solid rgba(15, 23, 42, 0.12);
}

[data-theme] .modal-header h3 {
  color: #0f172a;
}

[data-theme] .modal-close {
  color: #64748b;
}

[data-theme] .modal-close:hover {
  color: #0f172a;
  background: #f1f5f9;
}

[data-theme] .view-all-filter-btn {
  background: rgba(0, 0, 0, 0.04);
  border: 1px solid rgba(0, 0, 0, 0.12);
  color: #1e293b;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

[data-theme] .view-all-filter-btn:hover {
  background: rgba(99, 102, 241, 0.08);
  border-color: rgba(99, 102, 241, 0.4);
}

[data-theme] .view-all-subject-menu {
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.12);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.05);
}

[data-theme] .view-all-subject-option {
  color: #334155;
}

[data-theme] .view-all-subject-option:hover {
  background: rgba(99, 102, 241, 0.08);
  color: #4f46e5;
}

[data-theme] .view-all-subject-option.active {
  background: rgba(99, 102, 241, 0.12);
  color: #4f46e5;
}

[data-theme] .detail-modal-footer {
  border-top: 1px solid rgba(15, 23, 42, 0.12);
  color: #475569;
}

[data-theme] .dashboard-footer {
  border-top: 1px solid rgba(226, 232, 240, 0.9);
  color: #64748b;
}

/* Timeline date (deadlines) */
.timeline-date {
  min-width: 48px;
  text-align: center;
}

.timeline-date strong {
  display: block;
  font-size: 1.5rem;
  font-weight: 800;
  line-height: 1;
  color: var(--text);
}

.timeline-date span {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent);
}

.timeline-copy h3 {
  font-size: 0.9375rem;
  font-weight: 600;
  margin-bottom: var(--space-1);
}

.timeline-copy p {
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

/* Compact card layout */
.compact-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: var(--space-4);
  text-align: left;
}

/* ---------- Badges ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: capitalize;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.badge-high,
.badge-overdue {
  color: #fca5a5;
  background: var(--danger-soft);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.badge-normal,
.badge-pending {
  color: #fcd34d;
  background: var(--warning-soft);
  border: 1px solid rgba(245, 158, 11, 0.2);
}

.badge-low,
.badge-medium,
.badge-completed {
  color: #6ee7b7;
  background: var(--success-soft);
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.badge-subject {
  color: #6ee7b7;
  background: var(--success-soft);
  border: 1px solid rgba(16, 185, 129, 0.2);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-md);
  font-size: 0.9375rem;
  font-weight: 600;
  transition: all var(--transition-fast);
  position: relative;
  overflow: hidden;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--accent);
  color: white;
  box-shadow: 0 1px 3px rgba(139, 92, 246, 0.3);
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(139, 92, 246, 0.35);
}

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

.btn-secondary:hover:not(:disabled) {
  background: var(--bg-surface-hover);
  border-color: var(--border-hover);
  transform: translateY(-1px);
}

.btn-danger {
  background: linear-gradient(135deg, #fca5a5, #ef4444, #dc2626);
  color: white;
  backdrop-filter: blur(8px);
  box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.25), 0 4px 16px rgba(239, 68, 68, 0.35);
}

.btn-danger:hover:not(:disabled) {
  transform: translateY(-1px);
  background: linear-gradient(135deg, #fecaca, #ef4444, #b91c1c);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.35), 0 6px 20px rgba(239, 68, 68, 0.45);
}

.btn-sm {
  padding: var(--space-2) var(--space-3);
  font-size: 0.8125rem;
}

/* ---------- Forms ---------- */
.field {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.field > span {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.form-input,
.form-textarea,
.form-select {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text);
  font-size: 0.9375rem;
  transition: all var(--transition-fast);
}

.form-input:hover,
.form-textarea:hover,
.form-select:hover {
  border-color: var(--border-hover);
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* Date/time input styling */
input[type="datetime-local"],
input[type="date"],
input[type="time"] {
  color-scheme: dark;
  cursor: pointer;
}

input[type="datetime-local"]::-webkit-calendar-picker-indicator,
input[type="date"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator {
  filter: invert(1);
  cursor: pointer;
  padding: 4px;
  opacity: 0.6;
  transition: opacity 0.2s;
}

input[type="datetime-local"]::-webkit-calendar-picker-indicator:hover,
input[type="date"]::-webkit-calendar-picker-indicator:hover,
input[type="time"]::-webkit-calendar-picker-indicator:hover {
  opacity: 1;
}

/* Custom date selects - compact single row */
.date-selects-compact {
  display: flex;
  align-items: center;
  gap: 4px;
}

.date-selects-compact .form-input {
  padding: 6px 4px;
  font-size: 0.85rem;
  text-align: center;
  min-width: 0;
}

.date-selects-compact .form-input option {
  background: var(--bg-elevated);
  color: var(--text);
  font-size: 0.85rem;
}

.date-selects-compact .date-sep {
  color: var(--text-muted);
  font-weight: 600;
  opacity: 0.5;
}

.date-selects-compact .date-colon {
  color: var(--text-muted);
  font-weight: 600;
}

.form-textarea {
  min-height: 120px;
  resize: vertical;
}

.form-select option {
  background: var(--bg-elevated);
  color: var(--text);
}

/* ---------- Tables ---------- */
.table-shell {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.data-table th,
.data-table td {
  padding: var(--space-3) var(--space-4);
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.data-table th {
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--bg-surface);
}

.data-table tbody tr {
  transition: background var(--transition-fast);
}

.data-table tbody tr:hover {
  background: var(--bg-surface);
}

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

/* ---------- Preloader & Load Animations ---------- */
.preloader {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  z-index: 10001;
  transition: opacity 360ms var(--transition-base), visibility 360ms var(--transition-base);
}
.preloader.hidden {
  opacity: 0;
  visibility: hidden;
}

.preloader-text {
  position: absolute;
  top: calc(50% + 4.5em);
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.8125rem;
  color: var(--text-secondary);
  white-space: nowrap;
  animation: fade-in 220ms ease;
}

/* Pencil Loader */
.pencil {
  display: block;
  width: 6em;
  height: 6em;
  color: var(--accent);
}

.pencil__body1,
.pencil__body2,
.pencil__body3,
.pencil__eraser,
.pencil__eraser-skew,
.pencil__point,
.pencil__rotate,
.pencil__stroke {
  animation-duration: 3s;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
}

.pencil__body1,
.pencil__body2,
.pencil__body3 {
  transform: rotate(-90deg);
}

.pencil__body1 {
  animation-name: pencilBody1;
}

.pencil__body2 {
  animation-name: pencilBody2;
}

.pencil__body3 {
  animation-name: pencilBody3;
}

.pencil__eraser {
  animation-name: pencilEraser;
  transform: rotate(-90deg) translate(49px,0);
}

.pencil__eraser-skew {
  animation-name: pencilEraserSkew;
  animation-timing-function: ease-in-out;
}

.pencil__point {
  animation-name: pencilPoint;
  transform: rotate(-90deg) translate(49px,-30px);
}

.pencil__rotate {
  animation-name: pencilRotate;
}

.pencil__stroke {
  animation-name: pencilStroke;
  transform: translate(100px,100px) rotate(-113deg);
}

/* Pencil Animations */
@keyframes pencilBody1 {
  from,
  to {
    stroke-dashoffset: 351.86;
    transform: rotate(-90deg);
  }
  50% {
    stroke-dashoffset: 150.8;
    transform: rotate(-225deg);
  }
}

@keyframes pencilBody2 {
  from,
  to {
    stroke-dashoffset: 406.84;
    transform: rotate(-90deg);
  }
  50% {
    stroke-dashoffset: 174.36;
    transform: rotate(-225deg);
  }
}

@keyframes pencilBody3 {
  from,
  to {
    stroke-dashoffset: 296.88;
    transform: rotate(-90deg);
  }
  50% {
    stroke-dashoffset: 127.23;
    transform: rotate(-225deg);
  }
}

@keyframes pencilEraser {
  from,
  to {
    transform: rotate(-45deg) translate(49px,0);
  }
  50% {
    transform: rotate(0deg) translate(49px,0);
  }
}

@keyframes pencilEraserSkew {
  from,
  32.5%,
  67.5%,
  to {
    transform: skewX(0);
  }
  35%,
  65% {
    transform: skewX(-4deg);
  }
  37.5%,
  62.5% {
    transform: skewX(8deg);
  }
  40%,
  45%,
  50%,
  55%,
  60% {
    transform: skewX(-15deg);
  }
  42.5%,
  47.5%,
  52.5%,
  57.5% {
    transform: skewX(15deg);
  }
}

@keyframes pencilPoint {
  from,
  to {
    transform: rotate(-90deg) translate(49px,-30px);
  }
  50% {
    transform: rotate(-225deg) translate(49px,-30px);
  }
}

@keyframes pencilRotate {
  from {
    transform: translate(100px,100px) rotate(0);
  }
  to {
    transform: translate(100px,100px) rotate(720deg);
  }
}

@keyframes pencilStroke {
  from {
    stroke-dashoffset: 439.82;
    transform: translate(100px,100px) rotate(-113deg);
  }
  50% {
    stroke-dashoffset: 164.93;
    transform: translate(100px,100px) rotate(-113deg);
  }
  75%,
  to {
    stroke-dashoffset: 439.82;
    transform: translate(100px,100px) rotate(112deg);
  }
}

/* Stepper */
.preloader-steps { margin-top: 6px; }
.step-list { list-style: none; display: grid; gap: 8px; font-size: 0.85rem; color: var(--text-secondary); }
.step-list li { display:flex; justify-content:space-between; align-items:center; padding: 8px 12px; border-radius: 999px; background: linear-gradient(90deg, rgba(255,255,255,0.01), rgba(255,255,255,0.02)); border: 1px solid rgba(255,255,255,0.02); box-shadow: 0 4px 14px rgba(0,0,0,0.25); }
.step-list li strong { font-weight: 600; font-size: 0.9rem; color: var(--text); }
.step-status { min-width: 90px; text-align: right; font-weight:700; color: var(--text-muted); }
.step-list li.is-inprogress { box-shadow: 0 6px 18px rgba(139,92,246,0.12); border-color: var(--accent-border); }
.step-list li.is-inprogress .step-status { color: var(--accent); }
.step-list li.is-done { border-color: rgba(16,185,129,0.18); box-shadow: 0 6px 18px rgba(16,185,129,0.06); }
.step-list li.is-done .step-status { color: var(--success); }
.step-list li.is-error { border-color: rgba(239,68,68,0.18); box-shadow: 0 6px 18px rgba(239,68,68,0.06); }
.step-list li.is-error .step-status { color: var(--danger); }

/* Slightly reduce spinner size on small screens */
@media (max-width: 480px) {
  .preloader-spinner { width: 40px; height: 40px; }
  .step-status { min-width: 70px; }
}

/* Dashboard entrance animations */
.dashboard-ready .count-card,
.dashboard-ready .info-card,
.dashboard-ready .panel { 
  animation: popIn 420ms var(--transition-base) both; 
}
.dashboard-ready .count-card { animation-duration: 340ms; }
.dashboard-ready .info-card { animation-duration: 420ms; }
.dashboard-ready .panel { animation-duration: 360ms; }

@keyframes popIn {
  from { opacity: 0; transform: translateY(8px) scale(0.995); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Stagger children for nicer feeling */
.dashboard-grid .panel:nth-child(1) { animation-delay: 80ms; }
.dashboard-grid .panel:nth-child(2) { animation-delay: 160ms; }
.dashboard-grid .panel:nth-child(3) { animation-delay: 240ms; }
.dashboard-grid .panel:nth-child(4) { animation-delay: 320ms; }

/* Hide sidebar for client dashboard */
body.client-dashboard .sidebar,
body.client-dashboard .mobile-toggle {
  display: none !important;
}

body.client-dashboard .main-content {
  padding-left: var(--space-4);
}

/* When sidebar is removed, center and constrain content for better alignment */
body.client-dashboard .app-shell {
  justify-content: flex-start;
}

body.client-dashboard .main-content {
  /* keep header-space on top, starts from very top */
  padding: calc(var(--header-height) + env(safe-area-inset-top, 20px) + var(--space-6)) var(--space-4) var(--space-8);
  margin: 0 auto;
  max-width: 1180px;
  width: 100%;
}

body.client-dashboard .dashboard-header {
  padding-left: var(--space-4);
}

/* Small screens: ensure full-bleed layout with normal insets */
@media (max-width: 980px) {
  body.client-dashboard .main-content {
    padding-left: var(--space-4);
    padding-right: var(--space-4);
    max-width: 100%;
  }
  body.client-dashboard .dashboard-header {
    padding-left: var(--space-4);
    padding-right: var(--space-4);
  }
}

.desktop-table {
  display: none;
}

/* Show desktop views only on ≥980px */
@media (min-width: 980px) {
  .desktop-table,
  [data-desktop-only] {
    display: table;
    display: block\9; /* IE fallback */
  }
  [data-mobile-only] {
    display: none;
  }
}

/* Show mobile views only on <980px */
@media (max-width: 979px) {
  .desktop-table {
    display: none !important;
  }
  [data-mobile-only] {
    display: flex;
    display: block\9;
  }
  [data-desktop-only] {
    display: none !important;
  }
}

/* ---------- Tabs ---------- */
.tabs {
  display: flex;
  gap: var(--space-1);
  flex-wrap: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding: var(--space-1);
  margin-bottom: var(--space-4);
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}

.tabs::-webkit-scrollbar {
  display: none;
}

.tab {
  flex-shrink: 0;
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  white-space: nowrap;
  transition: all var(--transition-fast);
}

.tab:hover {
  color: var(--text);
  background: var(--bg-surface-hover);
}

.tab.active {
  color: var(--text);
  background: var(--accent);
  box-shadow: 0 1px 3px rgba(139, 92, 246, 0.3);
}

/* Lock background viewport scrolling when modals are open */
html.modal-open,
body.modal-open {
  overflow: hidden !important;
}

/* ---------- Modals ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: var(--space-4);
  background: rgba(2, 4, 10, 0.7);
  backdrop-filter: blur(4px);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition-base), visibility var(--transition-base);
  z-index: 100;
  overscroll-behavior: contain;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

#detail-modal.modal-overlay {
  z-index: 200;
}

.modal {
  width: min(92vw, 600px);
  max-height: 85vh;
  overflow-y: auto;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  transform: scale(0.96) translateY(10px);
  transition: transform var(--transition-slow), opacity var(--transition-slow);
  overscroll-behavior: contain;
}

.modal-overlay.active .modal {
  transform: scale(1) translateY(0);
}

.process-modal-overlay {
  z-index: 1100;
}

.process-modal {
  width: min(92vw, 420px);
  padding: var(--space-7) var(--space-6);
}

.process-modal-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
  text-align: center;
}

.process-modal-spinner {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  border: 4px solid rgba(148, 163, 184, 0.16);
  border-top-color: var(--accent);
  box-shadow: 0 0 0 6px rgba(139, 92, 246, 0.06);
  animation: process-spin 0.9s linear infinite;
}

.process-modal-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
}

.process-modal-message {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

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

/* View All — slides up from bottom into a fixed height shell */
.view-all-modal {
  position: relative;
  height: 90vh;
  transform: translateY(100%);
  transition: transform 560ms cubic-bezier(0.34, 1.05, 0.64, 1);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  align-self: flex-end;
  width: min(92vw, 640px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.modal-overlay.active .view-all-modal {
  transform: translateY(0);
}

.view-all-modal .modal-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: var(--space-5) var(--space-6);
}

.view-all-modal .modal-body.scrollable {
  overflow-y: auto;
}

/* Skeleton loading — pulsing bars shown while data loads */
.view-all-skeleton {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-2) 0;
}

.skeleton-item {
  height: 72px;
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  position: relative;
  overflow: hidden;
}

.skeleton-item::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.04) 40%,
    rgba(255, 255, 255, 0.08) 50%,
    rgba(255, 255, 255, 0.04) 60%,
    transparent 100%
  );
  animation: shimmer 1.4s ease-in-out infinite;
}

@keyframes shimmer {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* Content fade-in after loading — smooth and subtle */
.view-all-content {
  opacity: 0;
  animation: contentReveal 1000ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

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

.detail-modal {
  width: min(94vw, 70vw);
  max-width: 900px;
  height: 70vh;
  min-height: 480px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.detail-modal .modal-header {
  flex-shrink: 0;
}

.detail-modal .modal-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  padding: var(--space-5) var(--space-6);
}

.detail-modal .detail-modal-body-scroll,
.detail-modal .detail-stack {
  flex: 1;
  min-height: 0;
  height: 100%;
  max-height: none;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
}

.detail-modal .markdown-body {
  flex: 1 0 auto;
}

.detail-modal-footer {
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--border);
}

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

.timers-modal {
  /* Narrower modal for web view */
  width: min(80vw, 520px);
  max-width: 520px;
  height: auto;
  max-height: min(90vh, 720px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(circle at top right, rgba(245, 158, 11, 0.09), transparent 28%),
    linear-gradient(180deg, rgba(15, 23, 42, 0.98), rgba(15, 23, 42, 0.94));
}

.timers-modal .modal-header {
  align-items: flex-start;
  padding-bottom: var(--space-4);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent);
}

.timers-modal .eyebrow {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent);
  margin-bottom: var(--space-1);
}

.timers-modal-subtitle {
  margin-top: var(--space-1);
  color: var(--text-secondary);
  font-size: 0.875rem;
  max-width: 56ch;
}

.timers-modal-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-3);
  padding: var(--space-5) var(--space-6) var(--space-6);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.timer-simple-card {
  display: grid;
  gap: var(--space-1);
  padding: var(--space-4);
  border-radius: 18px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  text-align: left;
  transition: border-color var(--transition-fast), background var(--transition-fast);
}

.timer-simple-card:hover {
  border-color: var(--border-hover);
  background: var(--bg-surface-hover);
}

.timer-simple-card h4,
.timer-card-title {
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.25;
  margin: 0;
}

.timer-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  width: 100%;
}

.timer-pill {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 9999px;
  white-space: nowrap;
  flex-shrink: 0;
  line-height: 1.3;
}

.timer-simple-card strong {
  font-size: clamp(1.35rem, 4vw, 2rem);
  font-weight: 900;
  letter-spacing: -0.04em;
}

.timer-simple-card small {
  color: var(--text-muted);
  font-size: 0.82rem;
  line-height: 1.4;
}

.timer-simple-card-warning strong {
  color: #fbbf24;
}

.timer-simple-card-normal strong {
  color: #dbeafe;
}

.timer-simple-card-high strong {
  color: #fca5a5;
}

.timer-settings-form {
  display: grid;
  gap: var(--space-4);
}

.timer-preview-card {
  display: grid;
  gap: var(--space-2);
  padding: var(--space-4);
  border-radius: var(--radius-lg);
  background: var(--bg-surface);
  border: 1px solid var(--border);
}

.timer-preview-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  font-weight: 700;
}

.timer-preview-card strong {
  color: var(--text);
  font-size: 0.95rem;
  line-height: 1.5;
}

.timer-preview-card strong a,
.timer-preview-card strong span {
  color: inherit;
}

.timer-actions {
  display: flex;
  gap: var(--space-3);
  justify-content: flex-end;
  flex-wrap: wrap;
}

.modal-body {
  padding: var(--space-5) var(--space-6);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--border);
}

/* Ensure timers modal footer matches other modals and uses token colors */
.timers-modal .modal-footer {
  background: transparent;
  border-top: 1px solid var(--border);
  padding-top: var(--space-3);
  padding-bottom: var(--space-4);
}

.timers-modal .btn {
  min-width: 160px;
}

.timers-modal .btn.btn-secondary {
  background: var(--bg-surface);
  color: var(--text);
  border: 1px solid var(--border);
}

.timers-modal .btn.btn-secondary:hover:not(:disabled) {
  background: var(--bg-surface-hover);
  border-color: var(--border-hover);
}

/* Load-more / collapse button shown below timer cards */
.timer-load-more-wrap {
  display: flex;
  justify-content: center;
  padding: var(--space-2) 0 var(--space-4);
}

.timer-load-more {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-weight: 700;
  cursor: pointer;
}

.timer-load-more:hover {
  background: var(--bg-surface-hover);
  color: var(--text);
  border-color: var(--border-hover);
}

.modal-close {
  padding: var(--space-2);
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-size: 0.875rem;
  transition: all var(--transition-fast);
}

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

/* ---------- Detail Stack ---------- */
.detail-stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.detail-stack .badge {
  align-self: flex-start;
}

.detail-stack p {
  line-height: 1.7;
  color: var(--text-secondary);
}

.detail-stack small {
  color: var(--text-muted);
  font-size: 0.8125rem;
}

/* ---------- Toasts ---------- */
.toast-container {
  position: fixed;
  top: calc(var(--header-height) + 20px + env(safe-area-inset-top, 0px));
  right: 20px;
  left: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 99999;
  pointer-events: none;
  max-width: 380px;
  width: 100%;
  margin: 0 auto;
  align-items: center;
}

@media (min-width: 640px) {
  .toast-container {
    top: calc(var(--header-height) + 20px);
    left: auto;
    margin: 0;
    align-items: flex-end;
  }
}

.files-standalone .toast-container {
  top: calc(env(safe-area-inset-top, 0px) + 8px);
}

.toast {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-4);
  background: var(--bg-elevated);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg), 0 0 0 1px var(--toast-border, var(--border));
  font-size: 0.875rem;
  font-weight: 500;
  pointer-events: all;
  animation: toast-in 350ms cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  overflow: hidden;
}

.toast::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--toast-accent, var(--accent));
  border-radius: var(--radius-lg) 0 0 var(--radius-lg);
}

/* Toast type accents */
.toast.success {
  --toast-accent: var(--success);
  --toast-border: rgba(16, 185, 129, 0.3);
  --toast-color: #6ee7b7;
}
.toast.success .toast-icon { color: var(--success); }

.toast.error {
  --toast-accent: var(--danger);
  --toast-border: rgba(239, 68, 68, 0.3);
  --toast-color: #fca5a5;
}
.toast.error .toast-icon { color: var(--danger); }

.toast.warning {
  --toast-accent: var(--warning);
  --toast-border: rgba(245, 158, 11, 0.3);
  --toast-color: #fcd34d;
}
.toast.warning .toast-icon { color: var(--warning); }

.toast.info {
  --toast-accent: var(--accent);
  --toast-border: var(--accent-border);
  --toast-color: #c4b5fd;
}
.toast.info .toast-icon { color: var(--accent); }

/* Icon */
.toast-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 22px;
  height: 22px;
}
.toast-icon svg {
  width: 100%;
  height: 100%;
}

/* Message */
.toast-msg {
  flex: 1;
  line-height: 1.5;
  color: var(--text);
}

/* Close button */
.toast-close {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  transition: color var(--transition-fast), background var(--transition-fast);
  padding: 0;
  background: transparent;
  border: none;
}
.toast-close:hover {
  color: var(--text);
  background: var(--bg-surface);
}
.toast-close svg {
  width: 14px;
  height: 14px;
  display: block;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateX(20px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

.toast-exit {
  opacity: 0;
  transform: translateX(20px) scale(0.96);
  transition: opacity 220ms ease, transform 220ms ease;
}

/* ---------- Loading & Empty States ---------- */
.panel-loading,
.empty-state {
  padding: var(--space-8) var(--space-4);
  text-align: center;
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
}

/* ---------- Maintenance Screen ---------- */
html.page-locked,
html.page-locked body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}

html.page-locked body {
  position: fixed;
  inset: 0;
  touch-action: none;
}

html.pwa-install-locked,
html.pwa-install-locked body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}

html.pwa-install-locked body {
  position: fixed;
  inset: 0;
  touch-action: none;
}

html.pwa-install-locked body > :not(.pwa-install-banner) {
  display: none !important;
}

.page-maintenance {
  display: none;
  position: fixed;
  inset: 0;
  min-height: 100dvh;
  padding: clamp(1rem, 4vw, 2.5rem);
  padding-bottom: calc(clamp(1rem, 4vw, 2.5rem) + env(safe-area-inset-bottom, 0px));
  align-items: center;
  justify-content: center;
  overflow-y: auto;
  background:
    radial-gradient(circle at 12% 10%, rgba(0,245,255,0.10), transparent 14%),
    radial-gradient(circle at 92% 20%, rgba(255,62,197,0.08), transparent 14%),
    radial-gradient(circle at 75% 88%, rgba(124,58,237,0.06), transparent 16%),
    linear-gradient(180deg, #06050a 0%, #0b0710 100%);
}

.page-maintenance-card {
  width: min(100%, 720px);
  max-height: calc(100dvh - clamp(2rem, 8vw, 5rem));
  padding: clamp(1rem, 3vw, 2rem);
  border-radius: 14px;
  /* Remove the extra “back pane” feel so text sits on top of the card only */
  background: rgba(14, 10, 22, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.05);
  box-shadow: 0 40px 80px rgba(6, 8, 20, 0.8);
  backdrop-filter: blur(16px) saturate(150%);
  -webkit-backdrop-filter: blur(16px) saturate(150%);
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  align-items: center;
  justify-items: center;
  text-align: center;
  padding-top: 2rem;
  padding-bottom: 2.2rem;
  overflow: hidden;
}

/* Keep the monolith visual from creating a “pane behind text” layer */
.page-maintenance-card .monolith-visual {
  z-index: 0;
}

.page-maintenance-card h1,
.page-maintenance-card p {
  position: relative;
  z-index: 1;
}

/* Visual: concentric rings + star particles */
.monolith-visual, .maintenance-visual {
  width: 360px;
  height: 210px;
  display: grid;
  place-items: center;
  overflow: hidden;
}
.monolith-visual svg, .maintenance-visual svg {
  width: 100%;
  height: 100%;
  display: block;
}


.page-maintenance h1 {
  margin: 0;
  font-size: clamp(2rem, 6vw, 3.4rem);
  color: #bffcff; /* brighter neon */
  font-weight: 900;
  letter-spacing: -0.02em;
  line-height: 1;
  text-transform: uppercase;
  text-shadow: 0 8px 34px rgba(0,245,255,0.08), 0 4px 14px rgba(124,58,237,0.06);
}
.page-maintenance p {
  margin: 0;
  color: rgba(190, 245, 255, 0.9);
  font-size: 0.95rem;
  max-width: 56ch;
  opacity: 0.9;
}

/* Actions */
.page-maintenance .actions { display: flex; gap: 0.75rem; margin-top: 8px; }
.page-maintenance .btn { display: none !important; }

/* Ensure page-lock behavior remains */
html.page-locked body > :not(.page-maintenance) { display: none !important; }
html.page-locked .page-maintenance { display: flex; }

@media (min-width: 900px) {
  .page-maintenance-card { width: 680px; }
  .maintenance-visual { width: 360px; height: 220px; }
}

@media (max-width: 520px) {
  .page-maintenance {
    padding: 1rem;
    padding-bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
    align-items: flex-start;
  }

  .page-maintenance-card {
    width: 100%;
    padding: 1rem;
    border-radius: 12px;
    max-height: calc(100dvh - 2rem - env(safe-area-inset-bottom, 0px));
    overflow-y: auto;
  }

  .maintenance-visual { width: 240px; height: 160px; }
  .page-maintenance h1 { font-size: 1.25rem; }
}

/* Stronger mobile-specific adjustments for the neon monolith design */
@media (max-width: 520px) {
  .page-maintenance {
    padding-top: calc(env(safe-area-inset-top, 12px) + 12px);
    padding-right: calc(env(safe-area-inset-right, 12px) + 12px);
    padding-bottom: calc(env(safe-area-inset-bottom, 12px) + 12px);
    padding-left: calc(env(safe-area-inset-left, 12px) + 12px);
    align-items: center;
    justify-content: center;
  }

  .page-maintenance-card {
    width: calc(100% - 28px);
    margin: 0 auto;
    padding: 14px;
    border-radius: 12px;
    box-shadow: 0 20px 50px rgba(6,8,20,0.65);
  }

  .monolith-visual, .maintenance-visual {
    width: 250px;
    height: 160px;
    transform: translateY(0) scale(0.95);
  }

  .page-maintenance h1 {
    font-size: 1.35rem;
    line-height: 1.05;
    text-align: center;
    margin-top: 6px;
  }

  .page-maintenance p {
    font-size: 0.95rem;
    padding: 0 6px;
    text-align: center;
  }

  /* Ensure SVG strokes remain crisp on small devices */
  .monolith-visual svg rect,
  .maintenance-visual svg circle { shape-rendering: geometricPrecision; }
}

@media (max-width: 360px) {
  .page-maintenance-card { width: calc(100% - 20px); padding: 12px; }
  .monolith-visual, .maintenance-visual { width: 210px; height: 140px; }
  .page-maintenance h1 { font-size: 1.1rem; }
  .page-maintenance p { font-size: 0.9rem; }
}

@keyframes maintenance-orbit {
  0% { transform: rotate(0deg) scale(1); }
  50% { transform: rotate(2deg) scale(1.02); }
  100% { transform: rotate(0deg) scale(1); }
}

.maintenance-visual svg { animation: maintenance-orbit 8s ease-in-out infinite; transform-origin: 50% 50%; }
.maintenance-visual circle { stroke-linecap: round; }

/* Neon pulse for inner ring */
.maintenance-visual circle:nth-child(1) {
  stroke: rgba(126,252,255,0.96);
  stroke-width: 2.8;
  filter: drop-shadow(0 6px 18px rgba(126,252,255,0.12));
  animation: neon-pulse 2.6s ease-in-out infinite;
}
.maintenance-visual circle:nth-child(2) { stroke: rgba(255,62,197,0.18); stroke-width: 2; }
.maintenance-visual circle:nth-child(3) { stroke: rgba(124,58,237,0.10); stroke-width: 1.6; }

@keyframes neon-pulse {
  0% { opacity: 0.9; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.03); }
  100% { opacity: 0.9; transform: scale(1); }
}

.maintenance-subtext {
  margin-top: 8px;
  color: rgba(190, 245, 255, 0.9);
  font-size: 0.95rem;
  text-align: center;
}

@media screen and (max-width: 400px) {
  .page-maintenance .btn { min-width: 140px; padding: 12px 18px; }
  .page-maintenance h1 { font-size: 1.35rem; }
  .page-maintenance p { font-size: 0.96rem; }
}

/* ---------- Status Toggles ---------- */
.status-toggle-list {
  display: grid;
  gap: var(--space-3);
}

.status-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-4);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(148, 163, 184, 0.14);
}

.status-toggle-copy {
  display: grid;
  gap: 0.35rem;
  min-width: 0;
}

.status-toggle-copy strong {
  font-size: 0.98rem;
  color: var(--text);
}

.status-toggle-copy span,
.status-helper-text {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.status-switch {
  position: relative;
  flex: 0 0 auto;
  width: 56px;
  height: 32px;
}

.status-switch input {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.status-switch-track {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: rgba(71, 85, 105, 0.7);
  border: 1px solid rgba(148, 163, 184, 0.2);
  transition: background var(--transition-base), border-color var(--transition-base), box-shadow var(--transition-base);
}

.status-switch-track::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.24);
  transform: translateX(0);
  transition: transform var(--transition-base), background var(--transition-base);
}

.status-switch input:checked + .status-switch-track {
  background: rgba(99, 102, 241, 0.28);
  border-color: rgba(99, 102, 241, 0.42);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.12);
}

.status-switch input:checked + .status-switch-track::after {
  transform: translateX(24px);
  background: #eef2ff;
}

.status-helper-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-top: var(--space-3);
}

.panel-loading.error {
  color: var(--danger);
}

.empty-state h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: var(--space-2);
}

.dashboard-section {
  display: flex;
  flex-direction: column;
}

.dashboard-section > div[id$="-list"] {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.dashboard-section .empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: var(--card-height-content-desktop, 132px);
  padding: var(--space-6) var(--space-4);
  margin: 0;
}


.empty-state p {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.empty-state-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  margin-top: 0.55rem;
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  padding: 0.22rem 0.6rem;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.empty-state-btn:hover {
  background: var(--accent-soft);
  border-color: var(--accent-border);
  color: var(--accent);
}

.empty-state-btn:active {
  transform: scale(0.98);
}

[data-theme] .empty-state-btn {
  color: var(--text-muted);
  background: rgba(0, 0, 0, 0.03);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 6px;
}

[data-theme] .empty-state-btn:hover {
  background: rgba(79, 70, 229, 0.08);
  border-color: rgba(79, 70, 229, 0.25);
  color: #4f46e5;
}

/* ---------- Student Files Page ---------- */
.files-body {
  --bg: #0f1115;
  --bg-elevated: rgba(255, 255, 255, 0.08);
  --bg-surface: rgba(255, 255, 255, 0.1);
  --bg-surface-hover: rgba(255, 255, 255, 0.14);
  --text: #f4f5f7;
  --text-secondary: rgba(244, 245, 247, 0.72);
  --text-muted: rgba(244, 245, 247, 0.5);
  --accent: #f4f5f7;
  --accent-hover: #ffffff;
  --accent-soft: rgba(255, 255, 255, 0.08);
  --accent-border: rgba(255, 255, 255, 0.16);
  --border: rgba(255, 255, 255, 0.1);
  --border-hover: rgba(255, 255, 255, 0.18);
  --border-strong: rgba(255, 255, 255, 0.2);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.16);
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.32);
  --shadow-lg: 0 36px 100px rgba(0, 0, 0, 0.42);
  background: #0b0d11;
}

.files-body::before {
  display: none;
}

.files-page {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100vh;
  padding: 80px 16px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.files-page::before {
  display: none;
}

.files-page::after {
  display: none;
}

.files-page-bg {
  display: none;
  height: 38vw;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.08), transparent 70%);
  filter: blur(26px);
  pointer-events: none;
  z-index: 0;
}

.files-page-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: calc(var(--header-height) + env(safe-area-inset-top, 0px));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 16px;
  padding-top: env(safe-area-inset-top, 0px);
  border-radius: 0;
  background: var(--bg);
  overflow: hidden;
  z-index: 9999;
}

.files-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.files-brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: transparent;
  color: white;
  font-weight: 800;
  letter-spacing: -0.04em;
  font-size: 0.95rem;
  box-shadow: none;
  flex-shrink: 0;
}

.files-brand-copy {
  min-width: 0;
}

.files-brand-kicker {
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.65rem;
  margin-bottom: 2px;
}

.files-brand-copy h1 {
  font-size: clamp(0.88rem, 1.35vw, 1.05rem);
  line-height: 1.05;
  letter-spacing: -0.05em;
}

.files-header-link {
  flex-shrink: 0;
  color: var(--text);
  font-size: 0.76rem;
  font-weight: 600;
  padding: 0.5rem 0.7rem;
  border-radius: var(--radius-full);
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
  transition: transform var(--transition-fast), background var(--transition-fast), border-color var(--transition-fast);
}

.files-header-link:hover,
.files-header-link:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(255, 255, 255, 0.24);
  background: rgba(255, 255, 255, 0.1);
}

.files-stage {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  width: 100%;
  min-height: calc(100vh - 80px);
  z-index: 1;
  padding-bottom: 80px;
  box-sizing: border-box;
}

.files-view-btn {
  min-width: 110px;
  z-index: 3;
  margin-top: 0;
  position: absolute;
  left: calc(50% - 55px);
  bottom: 15%;
  transition: box-shadow 1s ease, transform 1s ease;
}

.files-view-btn:hover {
  transform: translateY(-5px);
  box-shadow: 0 0 20px rgba(255, 255, 255, 0.4), inset 0 0 15px rgba(255, 255, 255, 0.2);
}

.files-stage.is-revealed .files-view-btn {
  display: none;
}

.files-orb {
  position: relative;
  z-index: 2;
  width: min(55vw, 300px);
  aspect-ratio: 1;
  border-radius: 50%;
  border: 0;
  background: transparent;
  display: grid;
  place-items: center;
  cursor: pointer;
  isolation: isolate;
  transition: transform 520ms cubic-bezier(.2,.8,.2,1), width 520ms cubic-bezier(.2,.8,.2,1), opacity 360ms ease;
}

.files-orb-echo,
.files-orb-ring,
.files-orb-ring::before,
.files-orb-ring::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  transform-origin: center;
}

.files-orb-echo {
  inset: 0;
  background: radial-gradient(circle at center, rgba(255, 255, 255, 0.12), transparent 65%);
  filter: blur(6px);
  opacity: 0.5;
  animation: none;
  transform-origin: center;
}

.files-orb-ring {
  background: radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0.08) 38%, rgba(255, 255, 255, 0.02) 68%, transparent 74%);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.15), 0 0 15px rgba(255, 255, 255, 0.1), 0 8px 32px rgba(0, 0, 0, 0.25);
  border: 2px dashed rgba(255, 255, 255, 0.35);
  transform-origin: center;
}

.files-orb-ring::before {
  inset: 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  transform-origin: center;
}

.files-orb-ring::after {
  inset: 22px;
  background: radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.04));
  filter: none;
  transform-origin: center;
}

.files-orb-core {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  height: 100%;
  padding: 20px;
  text-align: center;
  border-radius: 50%;
}

.files-orb-core strong {
  max-width: 18ch;
  font-size: clamp(1rem, 2.5vw, 1.25rem);
  line-height: 1.2;
  letter-spacing: -0.02em;
  font-weight: 700;
}

.files-orb-core small {
  font-size: 0.75rem;
  color: var(--text-secondary);
  opacity: 0.8;
}

.files-orb.has-file .files-orb-ring {
  animation: orbBlast 900ms ease-out 1;
}

.files-orb.has-file .files-orb-core {
  animation: orbSpin 900ms ease-out 1;
}

/* Orb upload spinner state */
.files-orb.is-uploading .files-orb-ring {
  animation: orbSpinRing 0.3s linear infinite;
}

.files-orb.is-uploading .files-orb-core {
  animation: none;
}

.files-orb.is-uploading .files-orb-ring::before {
  border-style: dashed;
  border-color: rgba(99, 102, 241, 0.5);
  animation: orbSpinRing 0.3s linear infinite reverse;
}

.files-orb.is-uploading .files-orb-ring::after {
  border-style: dashed;
  border-color: rgba(139, 92, 246, 0.4);
  animation: orbSpinRing 0.3s linear infinite;
}

.files-orb.is-uploading {
  border: 2px dashed rgba(99, 102, 241, 0.3);
  animation: orbSpinRing 0.3s linear infinite reverse;
}

.files-orb.is-uploading .files-orb-echo {
  animation: none;
  opacity: 0;
}

/* Orb success state (green) */
.files-orb.is-success .files-orb-ring {
  animation: orbSuccess 600ms ease-out forwards;
  background: radial-gradient(circle at 50% 50%, rgba(126, 240, 168, 0.4), rgba(126, 240, 168, 0.15) 38%, rgba(126, 240, 168, 0.05) 68%, transparent 74%);
  box-shadow: 0 0 30px rgba(126, 240, 168, 0.4), 0 0 60px rgba(126, 240, 168, 0.2);
}

.files-orb.is-success .files-orb-core {
  animation: orbSpin 600ms ease-out forwards;
}

.files-orb.is-success .files-orb-ring::after {
  background: linear-gradient(145deg, rgba(126, 240, 168, 0.4), rgba(126, 240, 168, 0.1));
}

/* Orb error state (red) */
.files-orb.is-error .files-orb-ring {
  animation: orbError 600ms ease-out forwards;
  background: radial-gradient(circle at 50% 50%, rgba(255, 143, 143, 0.4), rgba(255, 143, 143, 0.15) 38%, rgba(255, 143, 143, 0.05) 68%, transparent 74%);
  box-shadow: 0 0 30px rgba(255, 143, 143, 0.4), 0 0 60px rgba(255, 143, 143, 0.2);
}

.files-orb.is-error .files-orb-core {
  animation: orbSpin 600ms ease-out forwards;
}

.files-orb.is-error .files-orb-ring::after {
  background: linear-gradient(145deg, rgba(255, 143, 143, 0.4), rgba(255, 143, 143, 0.1));
}

.files-orb-reveal {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  width: calc(100vw - 32px);
  max-width: 380px;
  padding: 24px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  opacity: 0;
  transition: opacity 300ms ease, transform 300ms ease;
  z-index: 10;
}

.files-orb-close {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font-size: 1.4rem;
  line-height: 1;
  display: grid;
  place-items: center;
  z-index: 4;
  transition: transform 180ms ease, background 180ms ease, border-color 180ms ease;
}

.files-orb-close:hover,
.files-orb-close:focus-visible {
  transform: scale(1.05);
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.24);
}

.files-stage.is-revealed .files-orb {
  opacity: 0;
  pointer-events: none;
}

.files-stage.is-revealed .files-orb-core,
.files-stage.is-revealed .files-orb-ring,
.files-stage.is-revealed .files-orb-echo {
  opacity: 0;
}

.files-stage.is-revealed::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 150vmax;
  aspect-ratio: 1;
  border-radius: 50%;
  transform: translate(-50%, -50%) scale(0.08);
  background: radial-gradient(circle at center, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.07) 36%, rgba(255, 255, 255, 0.02) 58%, rgba(255, 255, 255, 0.01) 72%, transparent 78%);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08), 0 0 120px rgba(255, 255, 255, 0.08);
  animation: fullBloom 900ms cubic-bezier(.12,.82,.14,1) forwards;
  z-index: 1;
  pointer-events: none;
}

.files-stage.is-revealed .files-orb-reveal {
  display: flex;
  opacity: 1;
  pointer-events: auto;
}

.files-orb-reveal .selected-file,
.files-orb-reveal .files-form,
.files-orb-reveal .files-status {
  width: 100%;
}

.files-form {
  display: none;
  gap: 7px;
  padding: 9px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.files-form.is-visible {
  display: grid;
  animation: formRise 420ms ease-out both;
}

.files-form .field span {
  display: block;
  margin-bottom: var(--space-2);
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.files-submit {
  margin-top: 4px;
  width: 100%;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: white;
  font-weight: 600;
  border: 1px solid rgba(139, 92, 246, 0.3);
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.files-submit:hover {
  background: linear-gradient(135deg, #818cf8, #a78bfa);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}

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

.password-wrapper input {
  padding-right: 44px;
  width: 100%;
}

.password-toggle {
  position: absolute;
  right: 8px;
  padding: 6px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 150ms ease;
}

.password-toggle:hover {
  color: var(--text);
}

.password-toggle svg {
  display: block;
}

.files-hero-actions {
  flex-shrink: 0;
  padding-bottom: 6px;
}

.selected-file {
  width: min(100%, 220px);
  display: grid;
  gap: 4px;
  padding: 7px 9px;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text);
  text-align: center;
}

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

.selected-file-label {
  font-size: 0.58rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--text-muted);
}

.selected-file strong {
  font-size: 0.7rem;
  letter-spacing: -0.01em;
}

.selected-file small {
  color: var(--text-secondary);
  font-size: 0.64rem;
}

.files-status {
  min-height: 0.6rem;
  color: var(--text-secondary);
  font-size: 0.64rem;
  text-align: center;
}

.files-status[data-type="success"] { color: #7ef0a8; }
.files-status[data-type="error"] { color: #ff8f8f; }
.files-status[data-type="info"] { color: #8cbcff; }

.files-orb-reveal .files-status {
  min-height: 1.2rem;
}

.file-access-status {
  margin-top: var(--space-4);
}

.files-view-modal {
  position: relative;
  transition: transform 560ms cubic-bezier(0.34, 1.05, 0.64, 1);
  border-radius: var(--radius-xl);
  align-self: center;
  width: min(92vw, 720px);
  max-width: 640px;
  max-height: 85vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: rgba(15, 17, 25, 0.96);
  backdrop-filter: blur(24px) saturate(170%);
  -webkit-backdrop-filter: blur(24px) saturate(170%);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.5);
}

.modal-overlay.active .files-view-modal {
  transform: scale(1) translateY(0);
}

/* Files view modal overlay - centered modal */
#files-view-modal {
  align-items: center;
  padding: var(--space-4);
  background: rgba(11, 13, 17, 0.82);
}

.files-view-summary {
  display: none;
}

.files-view-search {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  margin-bottom: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
}

.files-view-search svg {
  color: var(--text-muted);
  flex-shrink: 0;
}

.files-view-search input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 0.9rem;
  outline: none;
}

.files-view-search input::placeholder {
  color: var(--text-muted);
}

.files-view-modal .modal-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.files-view-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding-right: 4px;
}

.files-view-list {
  display: grid;
  gap: 12px;
  padding-top: 4px;
}

.file-view-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  border-radius: 20px;
  background:
    linear-gradient(135deg, rgba(99, 102, 241, 0.08), rgba(255, 255, 255, 0.03) 44%, rgba(255, 255, 255, 0.02)),
    rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.09);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.18);
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease, box-shadow 180ms ease;
}

.file-view-row:hover {
  transform: translateY(-1px);
  border-color: rgba(99, 102, 241, 0.28);
  background:
    linear-gradient(135deg, rgba(99, 102, 241, 0.12), rgba(255, 255, 255, 0.04) 42%, rgba(255, 255, 255, 0.03)),
    rgba(255, 255, 255, 0.04);
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.24);
}

.file-view-main {
  min-width: 0;
  flex: 1;
  display: grid;
  gap: 7px;
}

.file-view-main h4 {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.25;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-view-main p {
  color: var(--text-secondary);
  font-size: 0.88rem;
  word-break: break-word;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
}

.file-view-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--text-muted);
  font-size: 0.8rem;
}

.file-view-meta span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.file-view-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.files-view-modal .btn {
  color: #0f1115;
}

.files-view-modal .btn-primary {
  background: #6366f1;
  color: white;
  box-shadow: 0 1px 3px rgba(99, 102, 241, 0.3);
}

.files-view-modal .btn-primary:hover:not(:disabled) {
  background: #818cf8;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.35);
}

.files-view-modal .btn-secondary {
  background: rgba(255, 255, 255, 0.09);
  color: #f4f5f7;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.files-view-modal .btn-secondary:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.28);
}

@media (max-width: 640px) {
  .file-view-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .files-view-modal {
    width: min(96vw, 640px);
    height: min(88vh, 760px);
    transform: translateY(calc(100% - 24px));
    border-radius: 22px 22px 0 0;
  }

  .files-view-modal .modal-header {
    padding: var(--space-3) var(--space-4);
  }

  .files-view-modal .modal-body {
    min-height: 0;
    overflow: hidden;
    padding: var(--space-3) var(--space-4) var(--space-4);
    overscroll-behavior: contain;
  }

  .files-view-modal .modal-footer {
    padding: var(--space-3) var(--space-4);
  }

  .files-view-search {
    flex-shrink: 0;
    padding: 10px 12px;
    margin-bottom: 10px;
    border-radius: 11px;
    gap: 8px;
  }

  .files-view-scroll {
    padding-right: 0;
  }

  .files-view-search input {
    font-size: 0.85rem;
  }

  .files-view-list {
    max-height: none;
    overflow: visible;
    gap: 10px;
  }

  .file-view-row {
    gap: 10px;
    padding: 12px 14px;
    border-radius: 16px;
  }

  .file-view-main {
    gap: 4px;
  }

  .file-view-main h4 {
    font-size: 0.95rem;
  }

  .file-view-main p {
    font-size: 0.8rem;
    -webkit-line-clamp: 1;
    line-clamp: 1;
  }

  .file-view-meta {
    gap: 6px;
    font-size: 0.72rem;
  }

  .file-view-meta span {
    padding: 4px 8px;
  }

  .file-view-actions {
    width: 100%;
    gap: 8px;
  }

  .file-view-actions .btn {
    flex: 1;
    justify-content: center;
    min-height: 38px;
    padding-inline: 12px;
  }
}

.files-access-modal {
  max-width: 620px;
  width: min(92vw, 720px);
  max-height: 85vh;
  align-self: center;
  transition: transform 560ms cubic-bezier(0.34, 1.05, 0.64, 1);
  border-radius: var(--radius-xl);
  background: rgba(15, 17, 25, 0.96);
  backdrop-filter: blur(24px) saturate(170%);
  -webkit-backdrop-filter: blur(24px) saturate(170%);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.5);
}

.modal-overlay.active .files-access-modal {
  transform: scale(1) translateY(0);
}

.files-access-modal .modal-header {
  padding-bottom: 18px;
  margin-bottom: 0;
}

.files-access-modal .modal-body,
.files-action-modal .modal-body {
  padding-top: 15px;
  padding-bottom: 15px;
  display: grid;
  gap: 18px;
}

.files-access-summary {
  position: relative;
  display: grid;
  gap: 8px;
  padding: 22px 24px;
  border-radius: 24px;
  background:
    radial-gradient(circle at top right, rgba(99, 102, 241, 0.18), transparent 42%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.03));
  border: 1px solid rgba(99, 102, 241, 0.16);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.files-access-summary p {
  font-size: 1.08rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.files-access-summary small,
.files-access-hint {
  color: var(--text-muted);
  font-size: 0.875rem;
}

.files-access-details {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 0;
}

.files-access-detail {
  display: grid;
  gap: 6px;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.files-access-detail span {
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.files-access-detail strong {
  color: var(--text-primary);
  font-size: 0.96rem;
  font-weight: 700;
  line-height: 1.35;
  word-break: break-word;
}

.files-action-summary {
  position: relative;
  display: grid;
  gap: 8px;
  padding: 22px 24px;
  border-radius: 24px;
  background:
    radial-gradient(circle at top right, rgba(244, 114, 182, 0.14), transparent 42%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.03));
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.files-action-summary p {
  font-size: 1.08rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.files-action-summary small {
  color: var(--text-muted);
  font-size: 0.875rem;
  line-height: 1.45;
}

.files-access-summary small {
  line-height: 1.45;
}

.files-access-field {
  margin-bottom: 0;
  display: grid;
  gap: 8px;
  padding: 18px 20px 20px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.files-access-footer {
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.files-access-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  justify-content: flex-end;
}

.files-access-back,
.files-access-confirm {
  min-width: 124px;
}

.files-access-modal .btn,
.files-action-modal .btn {
  color: #0f1115;
}

.files-access-modal .btn-primary,
.files-action-modal .btn-primary {
  background: #6366f1;
  color: white;
  box-shadow: 0 1px 3px rgba(99, 102, 241, 0.35);
}

.files-access-modal .btn-primary:hover:not(:disabled),
.files-action-modal .btn-primary:hover:not(:disabled) {
  background: #818cf8;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.35);
}

.files-access-modal .btn-secondary,
.files-action-modal .btn-secondary {
  background: rgba(255, 255, 255, 0.1);
  color: #f4f5f7;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.files-access-modal .btn-secondary:hover:not(:disabled),
.files-action-modal .btn-secondary:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.3);
}

.files-access-modal .btn-danger,
.files-action-modal .btn-danger {
  opacity: 1;
  box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.2), 0 4px 16px rgba(239, 68, 68, 0.28);
}

.files-access-modal .btn[hidden],
.files-action-modal .btn[hidden] {
  display: none !important;
}

.files-action-modal {
  max-width: 420px;
  width: min(92vw, 420px);
  align-self: center;
  max-height: 64vh;
  transform: translateY(48px);
  transition: transform 520ms cubic-bezier(0.34, 1.05, 0.64, 1), opacity 520ms cubic-bezier(0.34, 1.05, 0.64, 1);
  background: rgba(15, 17, 25, 0.995);
  backdrop-filter: blur(22px) saturate(170%);
  -webkit-backdrop-filter: blur(22px) saturate(170%);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.55);
}

.modal-overlay.active .files-action-modal {
  transform: translateY(0);
}

.files-action-modal .modal-body {
  padding-top: 14px;
  padding-bottom: 10px;
  gap: 10px;
}

.files-action-modal .files-action-password {
  width: 100%;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: none;
}

.files-action-modal .files-access-footer {
  padding-top: 10px;
  border-top: 0;
}

#file-action-modal.modal-overlay {
  backdrop-filter: blur(22px) saturate(175%);
  -webkit-backdrop-filter: blur(22px) saturate(175%);
}

#file-action-modal.modal-overlay.active {
  backdrop-filter: blur(22px) saturate(175%);
  -webkit-backdrop-filter: blur(22px) saturate(175%);
}

@media (max-width: 640px) {
  .files-access-details {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .files-access-modal {
    width: min(96vw, 620px);
    max-width: 620px;
    max-height: 84vh;
    transform: translateY(calc(100% - 24px));
    border-radius: 18px 18px 0 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }

  .files-action-modal {
    width: min(94vw, 420px);
    max-height: 76vh;
    border-radius: 18px;
  }

  .files-access-modal .modal-header {
    padding: var(--space-3) var(--space-4) 12px;
  }

  .files-access-modal .modal-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 12px 14px 14px;
    gap: 12px;
  }

  .files-access-detail {
    padding: 11px 12px;
    gap: 4px;
    border-radius: 14px;
  }

  .files-access-detail span {
    font-size: 0.66rem;
  }

  .files-access-detail strong {
    font-size: 0.9rem;
    line-height: 1.3;
  }

  .files-access-footer {
    flex-direction: column-reverse;
    align-items: stretch;
    padding-top: 12px;
  }

  .files-access-actions {
    width: 100%;
    justify-content: stretch;
    flex-direction: column;
  }

  .files-access-footer .btn {
    width: 100%;
    min-width: 0;
    min-height: 40px;
  }

  .files-action-modal .modal-header {
    padding: var(--space-3) var(--space-4) 12px;
  }

  .files-action-modal .modal-body {
    padding: 12px 14px 10px;
    gap: 10px;
  }

  .files-action-modal .files-access-footer {
    flex-direction: column-reverse;
    align-items: stretch;
  }

  .files-action-modal .files-access-footer .btn {
    width: 100%;
    min-width: 0;
  }

  .files-access-back,
  .files-access-confirm {
    width: 100%;
  }
}

@keyframes orbFloat {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-8px) scale(1.01); }
}

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

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

@keyframes orbPulse {
  0%, 100% { transform: scale(0.94); opacity: 0.42; }
  50% { transform: scale(1.04); opacity: 0.68; }
}

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

@keyframes orbBlast {
  0% { transform: scale(1); filter: blur(0); opacity: 1; }
  55% { transform: scale(1.16); filter: blur(0.2px); opacity: 1; }
  100% { transform: scale(1.34); filter: blur(1px); opacity: 0; }
}

@keyframes orbSuccess {
  0% { transform: scale(1); }
  50% { transform: scale(1.1); }
  100% { transform: scale(1); }
}

@keyframes orbError {
  0% { transform: scale(1); }
  20% { transform: scale(0.95) rotate(-2deg); }
  40% { transform: scale(1.05) rotate(2deg); }
  60% { transform: scale(0.98) rotate(-1deg); }
  80% { transform: scale(1.02) rotate(1deg); }
  100% { transform: scale(1) rotate(0deg); }
}

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

@keyframes formRise {
  from { opacity: 0; transform: translateY(18px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes fullBloom {
  0% { transform: translate(-50%, -50%) scale(0.08); opacity: 0; }
  35% { opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(1); opacity: 0.96; }
}

@media (max-width: 640px) {
  .files-page {
    padding: 70px 12px 20px;
  }

  .files-page-header {
    flex-direction: row;
    padding: 0 12px;
    padding-top: env(safe-area-inset-top, 0px);
    height: calc(56px + env(safe-area-inset-top, 0px));
  }

  .files-glass-bar {
    width: 100%;
  }

  .files-brand-mark {
    width: 28px;
    height: 28px;
    border-radius: 8px;
  }

  .files-orb {
    width: min(75vw, 240px);
  }

  .files-stage {
    min-height: calc(100vh - 70px);
    gap: 16px;
  }

  .files-stage.is-revealed::before {
    display: none;
  }

  .files-stage.is-revealed .files-orb {
    opacity: 0;
    pointer-events: none;
  }

  .files-orb-reveal {
    width: calc(100vw - 32px);
    max-width: none;
    padding: 20px;
    max-height: 80vh;
    overflow-y: auto;
  }

  .files-orb-close {
    top: 10px;
    right: 10px;
    width: 32px;
    height: 32px;
  }

  .files-bottom-actions {
    bottom: 18px;
  }
}

/* ---------- Settings ---------- */
.settings-grid {
  display: grid;
  gap: var(--space-6);
}

.settings-note {
  padding: var(--space-4);
  background: var(--bg-surface);
  border-radius: var(--radius-md);
  font-size: 0.9375rem;
  color: var(--text-secondary);
  line-height: 1.7;
}

.danger-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
}

/* ---------- Pagination ---------- */
.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding-top: var(--space-4);
  margin-top: var(--space-4);
  border-top: 1px solid var(--border);
}

/* ---------- Panel Header ---------- */
.panel-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-5);
}

.panel-header .eyebrow {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  margin-bottom: var(--space-1);
}

.panel-header h2 {
  font-size: 1.125rem;
  font-weight: 700;
}

/* ---------- Search ---------- */
.search-shell {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  min-width: 240px;
}

.search-shell span {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
}

/* ---------- Status Pills ---------- */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  font-size: 0.8125rem;
}

.status-pill strong {
  font-weight: 600;
  color: var(--text);
}

.status-pill.compact {
  justify-content: center;
  width: 100%;
}

/* ---------- Record Cards ---------- */
.record-card-actions {
  display: flex;
  gap: var(--space-2);
  margin-top: var(--space-4);
}

.mobile-record-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

/* ---------- File Trigger ---------- */
.file-trigger {
  position: relative;
  overflow: hidden;
  cursor: pointer;
}

.file-trigger input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

/* ---------- Editor Form ---------- */
.editor-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

/* ---------- Table Actions ---------- */
.table-actions {
  display: flex;
  gap: var(--space-2);
}

/* ---------- Files Actions Menu ---------- */
.files-actions-shell {
  position: relative;
}

.files-actions-toggle {
  min-width: 96px;
}

.files-actions-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: min(92vw, 320px);
  padding: var(--space-4);
  background:
    linear-gradient(180deg, rgba(10, 14, 24, 0.98), rgba(15, 20, 33, 0.96));
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: var(--radius-xl);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.36), 0 0 0 1px rgba(255, 255, 255, 0.03) inset;
  backdrop-filter: blur(18px) saturate(150%);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  transform: translateY(-6px) scale(0.98);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity var(--transition-base), transform var(--transition-base), visibility var(--transition-base);
  z-index: 40;
}

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

.files-actions-menu-header {
  padding-bottom: var(--space-3);
  margin-bottom: var(--space-3);
  border-bottom: 1px solid rgba(148, 163, 184, 0.12);
}

.files-actions-menu-header .eyebrow {
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  color: var(--accent);
  margin-bottom: 0.35rem;
}

.files-actions-menu-header h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}

.files-actions-group {
  display: grid;
  gap: var(--space-2);
}

.files-action-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  padding: var(--space-3);
  text-align: left;
  border: 1px solid transparent;
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  transition: transform var(--transition-fast), background var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.files-action-item:hover,
.files-action-item:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(148, 163, 184, 0.18);
  background: rgba(255, 255, 255, 0.06);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.18);
}

.files-action-icon {
  width: 2rem;
  height: 2rem;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  font-size: 1rem;
  font-weight: 800;
}

.files-action-upload .files-action-icon {
  background: rgba(16, 185, 129, 0.16);
  color: #86efac;
}

.files-action-download .files-action-icon {
  background: rgba(59, 130, 246, 0.16);
  color: #93c5fd;
}

.files-action-delete .files-action-icon {
  background: rgba(239, 68, 68, 0.16);
  color: #fca5a5;
}

.files-action-copy {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.files-action-copy strong {
  font-size: 0.92rem;
  font-weight: 700;
}

.files-action-copy small {
  color: var(--text-secondary);
  font-size: 0.76rem;
  line-height: 1.3;
}

.files-selection-shell {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 0.4rem;
  flex-wrap: nowrap;
  flex: 0 0 auto;
  width: max-content;
}

.files-select-all-btn,
.files-selection-count,
.files-actions-toggle {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  box-sizing: border-box;
  flex: 0 0 auto;
  justify-content: center;
  min-height: 2.4rem;
  min-width: 6.8rem;
  width: 6.8rem;
  padding: 0.55rem 0.85rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.05));
  color: var(--text);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-fast), border-color var(--transition-fast), background var(--transition-fast), box-shadow var(--transition-fast);
}

.files-actions-toggle {
  min-width: 5.8rem;
  width: 5.8rem;
}

.files-selection-count {
  min-width: 8.2rem;
  width: 8.2rem;
  text-align: center;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  overflow: hidden;
  text-overflow: ellipsis;
}

.files-select-all-btn:hover,
.files-select-all-btn:focus-visible,
.files-selection-count:hover,
.files-selection-count:focus-visible,
.files-actions-toggle:hover,
.files-actions-toggle:focus-visible {
  transform: translateY(-1px);
  border-color: var(--border-hover);
  background: rgba(255, 255, 255, 0.1);
  box-shadow: 0 8px 20px rgba(99, 102, 241, 0.14);
}

.files-header-controls {
  display: grid;
  flex: 1 1 auto;
  min-width: 0;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  grid-template-columns: minmax(0, 1fr) max-content max-content max-content;
}

.files-search-shell {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1 1 340px;
  min-width: 0;
}

.files-search-toggle {
  display: none;
  align-items: center;
  gap: 0.45rem;
  padding: 0.55rem 0.85rem;
  border-radius: var(--radius-full);
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font-size: 0.8rem;
  font-weight: 700;
  box-shadow: var(--shadow-sm);
}

.files-search-toggle svg {
  flex-shrink: 0;
}

.files-search-field {
  flex: 1 1 340px;
  min-width: 0;
}

.files-search-field .form-input {
  width: 100%;
  min-width: 0;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.files-select-box {
  appearance: none;
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  display: inline-grid;
  place-items: center;
  border-radius: 7px;
  border: 1.5px solid rgba(148, 163, 184, 0.36);
  background: rgba(255, 255, 255, 0.04);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
  cursor: pointer;
  transition: transform var(--transition-fast), border-color var(--transition-fast), background var(--transition-fast), box-shadow var(--transition-fast);
}

.files-select-box::before {
  content: '';
  width: 9px;
  height: 5px;
  border-left: 2px solid transparent;
  border-bottom: 2px solid transparent;
  transform: rotate(-45deg) scale(0.2);
  opacity: 0;
  transition: transform var(--transition-fast), opacity var(--transition-fast), border-color var(--transition-fast);
}

.files-select-box:hover {
  transform: translateY(-1px);
  border-color: rgba(99, 102, 241, 0.45);
}

.files-select-box:checked {
  background: linear-gradient(180deg, rgba(99, 102, 241, 0.95), rgba(56, 189, 248, 0.85));
  border-color: rgba(99, 102, 241, 0.65);
  box-shadow: 0 8px 16px rgba(99, 102, 241, 0.22);
}

.files-select-box:checked::before {
  opacity: 1;
  border-color: #fff;
  transform: rotate(-45deg) scale(1);
}

.files-select-box:focus-visible {
  outline: 2px solid rgba(99, 102, 241, 0.35);
  outline-offset: 2px;
}

.files-record-card.is-selected,
.data-table tr.is-selected {
  background: rgba(99, 102, 241, 0.08);
  box-shadow: inset 0 0 0 1px rgba(99, 102, 241, 0.16);
}

.files-card-select {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}

.files-card-select .files-select-box {
  margin-right: 0.35rem;
}

.files-record-card .record-card-top {
  align-items: center;
}

.files-record-card .record-card-top h3 {
  flex: 1;
  min-width: 0;
}

.files-record-card.is-selected {
  border-color: rgba(99, 102, 241, 0.2);
}

.files-action-delete:hover,
.files-action-delete:focus-visible {
  border-color: rgba(239, 68, 68, 0.22);
  background: rgba(239, 68, 68, 0.08);
}

.files-action-delete:hover .files-action-icon,
.files-action-delete:focus-visible .files-action-icon {
  background: rgba(239, 68, 68, 0.22);
}



@media (max-width: 720px) {
  .files-header-controls {
    width: 100%;
    justify-content: flex-end;
    gap: 0.35rem;
    grid-template-columns: minmax(0, 1fr) max-content max-content max-content;
  }

  .files-search-shell {
    margin-left: 0;
    flex: 1 1 0;
    min-width: 0;
    width: auto;
    order: 0;
  }

  .files-search-toggle {
    display: none;
  }

  .files-search-field {
    position: static;
    width: 100%;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: none;
    z-index: auto;
  }

  .files-search-field .form-input {
    min-width: 0;
    width: 100%;
    padding-left: var(--space-3);
    padding-right: var(--space-3);
    font-size: 0.86rem;
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.24);
  }

  .files-select-all-btn {
    min-width: 6rem;
    width: 6rem;
    padding-left: 0.6rem;
    padding-right: 0.6rem;
    font-size: 0.68rem;
  }

  .files-actions-toggle {
    min-width: 5.2rem;
    width: 5.2rem;
    padding-left: 0.5rem;
    padding-right: 0.5rem;
    font-size: 0.68rem;
  }

  .files-selection-shell {
    flex-wrap: nowrap;
    gap: 0.35rem;
    min-width: 0;
    order: 1;
  }

  .files-actions-shell {
    order: 2;
  }

  .files-selection-count {
    display: inline-flex;
    flex: 0 0 auto;
    min-width: 2rem;
    width: 2rem;
    padding: 0.3rem 0.4rem;
    border-radius: var(--radius-md);
    font-size: 0.68rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-variant-numeric: tabular-nums;
  }
}

/* ---------- Confirm Dropdown ---------- */
.confirm-dropdown {
  position: relative;
}

.confirm-dropdown .dropdown-toggle::after {
  content: '';
  display: inline-block;
  margin-left: 4px;
  vertical-align: middle;
  border: 4px solid transparent;
  border-bottom-color: currentColor;
  border-top: none;
}

.confirm-dropdown-menu {
  display: none;
  position: absolute;
  right: 0;
  bottom: 100%;
  margin-bottom: 4px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  min-width: 140px;
}

.confirm-dropdown-menu.open {
  display: block;
  animation: fade-in 200ms ease;
}

.confirm-dropdown-menu .btn {
  width: 100%;
  justify-content: center;
  border-radius: var(--radius-md);
}

/* ---------- Update Prompt Modal ---------- */
.update-modal-overlay {
  position: fixed;
  inset: 0;
  display: none;
  place-items: center;
  padding: var(--space-4);
  background: rgba(2, 4, 10, 0.75);
  backdrop-filter: blur(6px);
  z-index: 1000;
}

.update-modal-overlay.active {
  display: grid;
}

.update-modal {
  width: min(92vw, 400px);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.update-modal-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-5) var(--space-5) var(--space-4);
  border-bottom: 1px solid var(--border);
}

.update-modal-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-soft);
  border-radius: var(--radius-md);
  flex-shrink: 0;
}

.update-modal-icon svg {
  width: 20px;
  height: 20px;
  color: var(--accent);
}

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

.update-modal-body {
  padding: var(--space-4) var(--space-5);
}

.update-modal-body p {
  font-size: 0.9375rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.update-modal-footer {
  padding: var(--space-4) var(--space-5);
  border-top: 1px solid var(--border);
}

.update-modal-footer .btn {
  width: 100%;
  justify-content: center;
}

/* ---------- Offline Banner ---------- */
.offline-banner {
  position: fixed;
  top: calc(var(--header-height) + 20px);
  left: 20px;
  right: 20px;
  max-width: 380px;
  margin: 0 auto;
  background: var(--warning-soft);
  border: 1px solid rgba(245, 158, 11, 0.3);
  padding: var(--space-2) var(--space-4);
  text-align: center;
  font-size: 0.8125rem;
  font-weight: 600;
  color: #fbbf24;
  z-index: 45;
  display: none;
  border-radius: var(--radius-md);
}

.offline-banner.is-visible {
  display: block;
}

/* ---------- Banned Screen ---------- */
.banned-screen {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: var(--space-4);
}

.banned-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-8);
  text-align: center;
  max-width: 400px;
  width: 100%;
}

.banned-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto var(--space-4);
  color: var(--danger);
}

.banned-icon svg {
  width: 100%;
  height: 100%;
}

.banned-card h1 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: var(--space-2);
}

.banned-message {
  color: var(--text-secondary);
  margin-bottom: var(--space-6);
}

.banned-reason-box {
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.25);
  border-radius: var(--radius-lg, 12px);
  padding: 0.875rem 1rem;
  margin: 1rem 0 0.875rem 0;
  text-align: center;
}

.banned-reason-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--danger, #ef4444);
  margin-bottom: 4px;
}

.banned-reason-text {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text, #f8fafc);
  line-height: 1.4;
}

.banned-timer-box {
  background: var(--bg-surface-2, rgba(255, 255, 255, 0.03));
  border: 1px solid var(--border, rgba(255, 255, 255, 0.08));
  border-radius: var(--radius-lg, 12px);
  padding: 0.875rem 1rem;
  margin-bottom: 1rem;
}

.banned-timer-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary, #94a3b8);
  margin-bottom: 8px;
}

.banned-timer-display {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.timer-unit {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 6px 10px;
  min-width: 44px;
}

.timer-unit span {
  font-size: 1.25rem;
  font-weight: 800;
  font-family: var(--font-mono, monospace);
  color: var(--accent, #6366f1);
  line-height: 1;
}

.timer-unit label {
  font-size: 0.65rem;
  text-transform: uppercase;
  color: var(--text-secondary, #94a3b8);
  margin-top: 2px;
  font-weight: 600;
}

.timer-colon {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-secondary, #94a3b8);
  line-height: 1;
  margin-bottom: 10px;
}

.banned-until-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 20px;
  background: rgba(239, 68, 68, 0.12);
  color: var(--danger, #ef4444);
  font-size: 0.8125rem;
  font-weight: 600;
  margin-top: 4px;
}

.banned-until-badge .badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--danger, #ef4444);
  box-shadow: 0 0 6px var(--danger, #ef4444);
}

/* ---------- PWA Install Banner ---------- */
.pwa-install-banner {
  position: fixed;
  bottom: var(--space-4);
  left: var(--space-4);
  right: var(--space-4);
  width: min(100%, 560px);
  margin: 0 auto;
  padding: 0;
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: none;
}

html.pwa-install-mobile .pwa-install-banner {
  inset: 0;
  width: auto;
  margin: 0;
  padding: clamp(1rem, 4vw, 2rem);
  background: linear-gradient(180deg, rgba(9, 13, 21, 0.94), rgba(5, 8, 14, 0.98));
}

.pwa-install-banner-card {
  position: relative;
  width: 100%;
  max-height: none;
  padding: clamp(1rem, 2.5vw, 1.5rem);
  border-radius: 18px;
  background: rgba(12, 16, 24, 0.96);
  border: 1px solid rgba(148, 163, 184, 0.12);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.26);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  display: grid;
  gap: var(--space-3);
  align-items: center;
  justify-items: center;
  text-align: center;
  overflow-y: auto;
}

.pwa-install-view {
  width: 100%;
  display: grid;
  gap: var(--space-3);
  align-items: center;
  justify-items: center;
}

html.pwa-install-mobile .pwa-install-banner-card {
  width: min(100%, 560px);
  max-height: calc(100dvh - clamp(2rem, 8vw, 4rem));
  padding: clamp(1.25rem, 3vw, 2rem);
}

.pwa-install-banner-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.10), transparent 55%, rgba(16, 185, 129, 0.06));
  pointer-events: none;
}

.pwa-install-banner-card > * {
  position: relative;
  z-index: 1;
}

.pwa-install-banner-heading {
  margin: 0;
  color: var(--text);
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.pwa-install-banner.is-visible,
html.pwa-install-locked .pwa-install-banner {
  display: flex;
}

.pwa-install-banner-title {
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.pwa-install-banner-title svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: var(--accent);
}

.pwa-ios-share-icon {
  width: 31px;
  height: 30px;
  margin-top: 0.25rem;
}

.pwa-ios-share-icon svg {
  width: 100%;
  height: 100%;
  display: block;
}

.pwa-install-banner p {
  margin: 0;
  max-width: 40ch;
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.pwa-install-steps {
  width: min(100%, 28rem);
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.6rem;
  text-align: left;
  counter-reset: step;
}

.pwa-install-steps li {
  position: relative;
  padding: 0.75rem 0.9rem 0.75rem 2.8rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(148, 163, 184, 0.10);
  color: var(--text-secondary);
}

.pwa-install-steps li::before {
  content: counter(step);
  counter-increment: step;
  position: absolute;
  top: 50%;
  left: 0.9rem;
  transform: translateY(-50%);
  width: 1.55rem;
  height: 1.55rem;
  border-radius: 9999px;
  display: grid;
  place-items: center;
  background: rgba(99, 102, 241, 0.14);
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 800;
}

.pwa-install-banner-actions {
  display: flex;
  gap: var(--space-2);
  justify-content: center;
  flex-wrap: wrap;
}

.pwa-install-banner-actions .btn {
  min-width: 128px;
}

.pwa-install-banner-actions .btn-secondary {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(148, 163, 184, 0.16);
}

.pwa-install-banner-actions .btn-secondary:hover {
  background: rgba(255, 255, 255, 0.08);
}

/* ---------- Utilities ---------- */
.hidden {
  display: none !important;
}

/* ---------- Animations ---------- */
@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fade-out {
  from { opacity: 1; max-height: 200px; padding: var(--space-4); margin: var(--space-3) 0; }
  to { opacity: 0; max-height: 0; padding: 0; margin: 0; overflow: hidden; }
}

@keyframes slide-up {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Apply subtle entrance to cards */
.info-card,
.record-card,
.count-card,
.panel {
  animation: fade-in 400ms ease;
}

/* ---------- Responsive ---------- */
@media (min-width: 768px) {
  .count-bar {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (min-width: 1024px) {
  .sidebar {
    position: fixed;
    transform: none;
    width: var(--sidebar-width);
  }

  .mobile-toggle {
    display: none;
  }

  .main-content {
    margin-left: 0;
    padding: calc(var(--header-height) + var(--space-8)) var(--space-8) var(--space-12);
  }

  /* Admin panel has no sidebar — full width on desktop */
  .admin-main {
    margin: 0 auto;
    max-width: 1300px;
    width: 100%;
  }

  .dashboard-header,
  .admin-header {
    left: 0;
  }

  /* Admin panel has no sidebar — restore full-width header */
  .admin-header {
    left: 0;
  }

/* ── Modern V2 Switch Slider ────────────────── */
.v2-switch-wrapper {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
  cursor: pointer;
}

.v2-switch-wrapper input {
  opacity: 0;
  width: 0;
  height: 0;
}

.v2-switch-slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: rgba(255, 255, 255, 0.12);
  border: 1px solid var(--border);
  transition: background-color 0.25s ease, border-color 0.25s ease;
  border-radius: 24px;
}

.v2-switch-slider::before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 2px;
  bottom: 2px;
  background-color: #ffffff;
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.v2-switch-wrapper input:checked + .v2-switch-slider {
  background-color: var(--accent);
  border-color: var(--accent);
}

.v2-switch-wrapper input:checked + .v2-switch-slider::before {
  transform: translateX(20px);
}

  .dashboard-header {
    padding: 0 var(--space-8);
  }

  .dashboard-header-meta {
    flex-wrap: nowrap;
    justify-content: flex-end;
  }

  .menu-actions {
    display: flex;
  }

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

  /* Show profile chip in the header top-right on desktop */
  .student-profile-chip:not(.hidden) {
    display: flex;
    align-items: center;
  }

  /* Hide mobile popup profile slot on desktop (irrelevant since menu-popup is hidden) */
  .menu-popup-profile-slot {
    display: none;
  }


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

  .section-wide {
    grid-column: 1 / -1;
  }

  .desktop-table {
    display: table;
  }

  .mobile-record-list {
    display: none;
  }

  .settings-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .danger-panel {
    grid-column: 1 / -1;
  }
}

/* ---------- User Profile ---------- */
.user-profile {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.profile-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--border);
}

.profile-row:last-of-type {
  border-bottom: none;
  margin-bottom: var(--space-3);
}

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

.profile-value {
  font-weight: 500;
}

/* ---------- Hero Panel ---------- */
.hero-panel {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.hero-panel .hero-meta {
  margin-top: 0;
}

/* ---------- Noscript Fallback ---------- */
.noscript-fallback {
  padding: var(--space-8);
  text-align: center;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin: var(--space-6);
}

.noscript-fallback h2 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: var(--space-3);
}

.noscript-fallback p {
  font-size: 0.9375rem;
  color: var(--text-secondary);
  line-height: 1.7;
}

/* Extra-small screens — keep only non-redundant overrides */
@media (max-width: 640px) {
  .search-shell {
    width: 100%;
    min-width: auto;
  }
}

/* ---------- Mobile-First Layout (< 1024px) ---------- */
@media (max-width: 1023px) {
  /* Root — no horizontal scroll anywhere */
  html,
  body {
    overflow-x: hidden;
    max-width: 100vw;
  }

  .app-shell {
    max-width: 100vw;
    overflow-x: hidden;
  }

  /* Main content — full bleed with safe padding */
  .main-content,
  .admin-main {
    max-width: 100%;
    overflow-x: hidden;
    padding-left: var(--space-4) !important;
    padding-right: var(--space-4) !important;
    padding-bottom: var(--space-10) !important;
    /* Safe area for notched phones - starts from very top */
    padding-top: calc(var(--header-height) + env(safe-area-inset-top, 20px) + var(--space-4)) !important;
  }

  /* Hero panel — stacks vertically */
  .hero-panel {
    flex-direction: column;
    gap: var(--space-4);
    padding: var(--space-4);
  }
  .hero-meta { margin-top: 0; }
  .hero-meta .btn-primary { width: 100%; margin-top: var(--space-2); }

  /* Panel header — stacks */
  .panel-header {
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-3);
  }

  /* Search — full width */
  .search-shell {
    width: 100%;
    min-width: 0;
  }

  /* Tabs — keep horizontal scrolling enabled */
  .tabs {
    padding-bottom: var(--space-2);
  }

  /* Dashboard grid — single column */
  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  /* Count bar — 2×2 */
  .count-bar {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-3);
  }

  /* All cards — text wrapping */
  .info-card,
  .record-card {
    word-break: break-word;
    overflow-wrap: break-word;
  }
  .info-card-top,
  .record-card-top { flex-wrap: wrap; gap: var(--space-2); }
  .info-card-top h3,
  .record-card-top h3 { word-break: break-word; overflow-wrap: break-word; min-width: 0; }
  .info-card p,
  .record-card p { word-break: break-word; overflow-wrap: break-word; }

  /* Badges — no overflow */
  .badge { max-width: 100%; white-space: normal; text-align: center; line-height: 1.3; }

  /* Status pills — no overflow */
  .status-pill { max-width: 100%; white-space: normal; text-align: center; }

  /* Scoped Dashboard Cards — Stable mobile layout */
  .dashboard-card {
    height: var(--card-height-content-mobile);
    padding: 0.85rem 1rem;
  }
  .dashboard-card-course {
    height: var(--card-height-course-mobile);
    padding: 0.8rem 1rem;
  }
  .dashboard-card .dashboard-card-header {
    display: flex;
    flex-wrap: nowrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-2);
  }
  .dashboard-card .dashboard-card-badges {
    display: flex;
    flex-wrap: nowrap;
    flex-shrink: 0;
    gap: var(--space-1);
  }
  .dashboard-card .badge {
    max-width: 95px;
    white-space: nowrap !important;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.25;
    text-align: left;
  }

  /* Data table — card view on mobile, no overflow */
  .table-shell {
    overflow-x: visible;
    border: none;
  }

  .desktop-table { display: none; }

  .data-table {
    display: block;
  }

  .data-table thead { display: none; }

  .data-table tbody,
  .data-table tr,
  .data-table td { display: block; width: 100%; }

  .data-table tr {
    margin-bottom: var(--space-3);
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: var(--space-3) var(--space-4);
  }

  .data-table td {
    border: none;
    padding: var(--space-1) 0;
    max-width: none;
    word-break: break-word;
    overflow-wrap: break-word;
  }

  .data-table td::before {
    content: attr(data-label);
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    margin-bottom: 2px;
  }

  /* Mobile record list — no overflow */
  .mobile-record-list { overflow-x: hidden; }
  .mobile-record-list .record-card { word-break: break-word; }

  /* View All Modal — bottom sheet, slides up from bottom, 10% top padding shows bg */
  .view-all-modal {
    align-self: flex-end;
    height: 90vh;
  }

  /* Files View Modal — same bottom sheet behavior */
  .files-view-modal {
    align-self: flex-end;
    height: 80vh;
    transform: translateY(calc(100% - 40px));
  }

  /* Files view modal overlay - bottom aligned with files theme */
  #files-view-modal {
    align-items: flex-end;
    padding: 0;
    background: rgba(11, 13, 17, 0.85);
  }

  /* Mobile: view-all is a bottom sheet anchored to bottom, slides up */
  .modal-overlay {
    align-items: flex-end;
    padding: 10vh var(--space-4) 0;
    justify-content: center;
  }

  /* Modal base reset — used by view-all, overridden for detail/feedback below */
  .modal {
    width: min(92vw, 640px);
    max-height: 85vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  }

  .modal-header {
    flex-shrink: 0;
    position: sticky;
    top: 0;
    background: var(--bg-elevated);
    z-index: 10;
  }

  .view-all-modal .modal-header {
    border-bottom: none;
    padding-bottom: 0.25rem;
  }

  .view-all-tabs {
    flex-wrap: nowrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.45rem var(--space-6) 0.85rem;
    overflow: visible;
  }

  .view-all-filter-wrap {
    flex: 0 1 auto;
    min-width: 0;
    max-width: none;
    position: relative;
    z-index: 21;
  }

  .view-all-actions-right {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    margin-left: auto;
    flex-shrink: 0;
  }

  .view-all-sort-btn {
    width: 30px;
    height: 30px;
    padding: 0;
    justify-content: center;
    flex-shrink: 0;
    border-radius: 999px;
  }

  .view-all-sort-btn .view-all-sort-text {
    display: none;
  }


  .view-all-modal .modal-body {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: var(--space-5) var(--space-6);
  }

  .timers-modal {
    /* Responsive cap for smaller viewports */
    width: min(92vw, 520px);
    height: auto;
    max-height: calc(100vh - 24px);
    border-radius: 24px;
  }

  .timers-modal-overlay {
    align-items: center;
    padding: var(--space-3);
  }

  .timers-modal .modal-header {
    padding: var(--space-4) var(--space-4) var(--space-3);
  }

  .timers-modal-subtitle {
    max-width: none;
    font-size: 0.82rem;
  }

  .timers-modal-grid {
    padding: var(--space-4);
    gap: var(--space-3);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .detail-modal,
  .feedback-modal {
    align-self: center;
    width: min(94vw, 700px);
    height: 75vh;
    max-height: 88vh;
    border-radius: var(--radius-xl);
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }

  .detail-modal .modal-body,
  .feedback-modal .modal-body {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 0;
  }

  .detail-modal .detail-modal-body-scroll {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }

  .modal-footer { flex-shrink: 0; }
  .modal-header h3 { font-size: 1rem; }

  /* Settings — single column */
  .settings-grid { grid-template-columns: 1fr; }

  .timer-actions {
    flex-direction: column-reverse;
  }

  .timer-actions .btn {
    width: 100%;
  }

  /* Danger actions — stack */
  .danger-actions { flex-direction: column; }
  .danger-actions .btn,
  .danger-actions .file-trigger { width: 100%; justify-content: center; }

  /* Login card */
  .login-shell { padding: var(--space-3); }
  .login-card {
    width: min(100%, 520px);
    padding: var(--space-5);
    gap: var(--space-4);
  }
  .login-terminal-top {
    font-size: 0.68rem;
    gap: 0.4rem;
  }
  .login-hero {
    gap: var(--space-2);
  }
  .login-card h1 {
    font-size: clamp(1.55rem, 8vw, 2.2rem);
    letter-spacing: 0.09em;
  }
  .login-copy {
    font-size: 0.875rem;
  }
  .login-options {
    flex-direction: column;
    align-items: stretch;
  }
  .remember-toggle,
  .login-options a {
    justify-content: center;
    text-align: center;
  }
  .login-footer {
    padding-top: var(--space-3);
  }

  /* Compact card */
  .compact-card { grid-template-columns: 1fr; gap: var(--space-2); text-align: center; }

  /* Timeline date */
  .timeline-date { min-width: auto; }

  /* Forms */
  .form-input,
  .form-textarea,
  .form-select { min-width: 0; }
  .editor-form { gap: var(--space-4); }

  /* Panels */
  .panel { padding: var(--space-4); }
  .section-heading h2 { font-size: 1rem; }

  /* Count card */
  .count-card { padding: var(--space-4); }
  .count-value { font-size: 1.5rem; }

  /* Dashboard header */
  .dashboard-header { padding-left: 0; padding-right: 0; }
  .brand-lockup h1,
  .brand-lockup h2,
  .header-brand-title { font-size: 1rem; }
  .dashboard-header-meta { gap: var(--space-2); flex-wrap: nowrap; align-items: center; }
  .server-chip,
  .header-meta-item {
    height: 28px;
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    padding: 0 8px;
    font-size: 0.72rem;
    gap: 5px;
    white-space: nowrap;
    flex-shrink: 0;
  }
  .menu-btn {
    height: 30px;
    width: 30px;
  }

  /* Admin header */
  .admin-header { padding: 0 var(--space-4); gap: var(--space-3); padding-top: env(safe-area-inset-top); height: calc(var(--header-height) + env(safe-area-inset-top)); }
  .admin-header-left { width: auto; flex: 1; }
  .admin-header-left h1 { font-size: 1.125rem; }
  .admin-header-actions { width: auto; justify-content: flex-end; gap: var(--space-2); }
  .icon-btn { width: 36px; height: 36px; }
  .icon-btn svg { width: 16px; height: 16px; }
  .theme-toggle-btn { width: 36px; height: 36px; }
  .theme-toggle-btn svg { width: 16px; height: 16px; }

  /* Sidebar */
  .sidebar { width: min(80vw, var(--sidebar-width)); padding: var(--space-4); }
  .mobile-toggle { width: 36px; height: 36px; }

  /* Pagination */
  .pagination-bar { flex-wrap: wrap; justify-content: center; gap: var(--space-3); }

  /* Record card actions */
  .record-card-actions { flex-wrap: wrap; gap: var(--space-2); }
  .record-card-actions .btn { flex: 1; min-width: 80px; }

  /* Table actions */
  .table-actions { flex-wrap: wrap; gap: var(--space-2); }

  /* Toast — top-right, constrained */
  .toast-container {
    max-width: min(380px, calc(100vw - var(--space-6)));
  }
  .toast { width: 100%; }

  /* Feedback table rating — compact */
  .feedback-preview { max-width: 100%; white-space: normal; }
}

/* ---------- Tablet (768–1023px) ---------- */
@media (min-width: 768px) and (max-width: 1023px) {
  .count-bar {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ---------- Drive page ---------- */
body.drive-body {
  min-height: 100vh;
  background: #020617; /* Very deep blue-black */
  position: relative;
  overflow-x: hidden;
}

/* Ambient glow & grid background */
.drive-grid-bg {
  position: fixed;
  inset: 0;
  background-image: 
    linear-gradient(rgba(99, 102, 241, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(99, 102, 241, 0.04) 1px, transparent 1px);
  background-size: 40px 40px;
  background-position: center top;
  z-index: 0;
  pointer-events: none;
}

.drive-glow {
  position: fixed;
  width: min(600px, 90vw);
  height: min(600px, 90vw);
  border-radius: 50%;
  filter: blur(140px);
  opacity: 0.15;
  z-index: 0;
  pointer-events: none;
}

.drive-glow-1 {
  background: radial-gradient(circle, #8b5cf6 0%, transparent 70%);
  top: -10%;
  right: -5%;
}

.drive-glow-2 {
  background: radial-gradient(circle, #06b6d4 0%, transparent 70%);
  bottom: 10%;
  left: -5%;
}

.drive-page {
  position: relative;
  z-index: 1;
  width: min(1200px, calc(100vw - 2rem));
  margin: 0 auto;
  padding: 1.5rem 0 4rem;
}

.drive-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 0.75rem 1.5rem;
  border-radius: 20px;
  background: rgba(15, 23, 42, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  margin-bottom: 2.5rem;
}

.drive-brand {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-width: 0;
}

.drive-brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.drive-brand-copy {
  min-width: 0;
}

.drive-brand-copy .eyebrow {
  margin-bottom: 0.1rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #8b5cf6;
}

.drive-brand-copy h1 {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  color: #fff;
}

.drive-nav {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.drive-nav a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.5rem 1rem;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  background: rgba(30, 41, 59, 0.3);
  transition: all var(--transition-fast);
}

.drive-nav a:hover {
  color: #fff;
  border-color: rgba(99, 102, 241, 0.3);
  background: rgba(99, 102, 241, 0.12);
  transform: translateY(-1px);
}

/* Intro header */
.drive-intro {
  margin-bottom: 2rem;
  padding: 0 0.5rem;
}

.drive-intro .eyebrow {
  font-size: 0.8rem;
  font-weight: 700;
  color: #06b6d4;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
}

.drive-intro h2 {
  font-size: 1.85rem;
  font-weight: 800;
  color: #fff;
  line-height: 1.3;
  margin-bottom: 0.75rem;
}

.drive-intro p {
  color: var(--text-secondary);
  max-width: 65ch;
  font-size: 0.95rem;
  line-height: 1.6;
}

/* Stats Row */
.drive-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
  margin-bottom: 3rem;
  padding: 0 0.5rem;
}

.drive-stat-card {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 1.25rem 1.5rem;
  border-radius: 20px;
  background: rgba(15, 23, 42, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  transition: border-color var(--transition-smooth), transform var(--transition-smooth);
}

.drive-stat-card:hover {
  border-color: rgba(99, 102, 241, 0.25);
  transform: translateY(-2px);
}

.drive-stat-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: rgba(99, 102, 241, 0.1);
  color: #8b5cf6;
  border: 1px solid rgba(99, 102, 241, 0.2);
  flex-shrink: 0;
}

.drive-stat-card:nth-child(2) .drive-stat-icon {
  background: rgba(6, 182, 212, 0.1);
  color: #06b6d4;
  border: 1px solid rgba(6, 182, 212, 0.2);
}

.drive-stat-card:nth-child(3) .drive-stat-icon {
  background: rgba(236, 72, 153, 0.1);
  color: #ec4899;
  border: 1px solid rgba(236, 72, 153, 0.2);
}

.drive-stat-icon svg {
  width: 24px;
  height: 24px;
}

.drive-stat-content {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.drive-stat-value {
  font-size: 1.5rem;
  font-weight: 800;
  color: #fff;
  line-height: 1.2;
}

.drive-stat-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 0.2rem;
}

/* Course folder grid */
.drive-course-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
  padding: 0 0.5rem;
}

/* Futuristic course card folders */
.drive-course-card {
  position: relative;
  width: 100%;
  text-align: left;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 20px;
  padding: 1.5rem;
  background: rgba(15, 23, 42, 0.5);
  color: var(--text);
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  cursor: pointer;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  transition: 
    transform var(--transition-smooth), 
    border-color var(--transition-smooth), 
    background-color var(--transition-smooth),
    box-shadow var(--transition-smooth);
  overflow: hidden;
}

/* Neon glow background on cards */
.drive-course-card-glow {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 80% 20%, rgba(139, 92, 246, 0.15) 0%, transparent 50%);
  opacity: 0;
  transition: opacity var(--transition-smooth);
  pointer-events: none;
}

.drive-course-card:nth-child(2n) .drive-course-card-glow {
  background: radial-gradient(circle at 80% 20%, rgba(6, 182, 212, 0.15) 0%, transparent 50%);
}

/* High-tech top line accent on folder hover */
.drive-course-card-folder-accent {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #8b5cf6, #06b6d4);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--transition-smooth);
}

.drive-course-card:hover {
  transform: translateY(-4px);
  border-color: rgba(99, 102, 241, 0.35);
  background: rgba(20, 30, 54, 0.6);
  box-shadow: 
    0 12px 30px rgba(0, 0, 0, 0.3),
    0 0 15px rgba(99, 102, 241, 0.1);
}

.drive-course-card:hover .drive-course-card-glow {
  opacity: 1;
}

.drive-course-card:hover .drive-course-card-folder-accent {
  transform: scaleX(1);
}

.drive-course-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.drive-course-icon-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #8b5cf6;
  transition: transform var(--transition-smooth), color var(--transition-smooth);
  flex-shrink: 0;
}

.drive-course-card:hover .drive-course-icon-wrap {
  transform: scale(1.08) rotate(-5deg);
  color: #06b6d4;
  background: rgba(6, 182, 212, 0.1);
  border-color: rgba(6, 182, 212, 0.2);
}

.drive-course-icon-wrap svg {
  width: 20px;
  height: 20px;
}

.drive-course-count-badge {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.3rem 0.7rem;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-secondary);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.drive-course-card:hover .drive-course-count-badge {
  background: rgba(99, 102, 241, 0.15);
  color: #8b5cf6;
  border-color: rgba(99, 102, 241, 0.25);
}

.drive-course-card-body {
  flex-grow: 1;
}

.drive-course-kicker {
  color: #06b6d4;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 0.35rem;
}

.drive-course-card h3 {
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.35;
  margin-bottom: 0.5rem;
}

.drive-course-meta {
  color: var(--text-secondary);
  font-size: 0.85rem;
  line-height: 1.5;
}

.drive-course-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  margin-top: 0.25rem;
}

.drive-course-action-label {
  font-size: 0.825rem;
  font-weight: 700;
  color: var(--text-secondary);
  transition: color var(--transition-fast);
}

.drive-course-card-footer svg {
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  transform: translateX(0);
  transition: transform var(--transition-smooth), color var(--transition-smooth);
}

.drive-course-card:hover .drive-course-action-label {
  color: #fff;
}

.drive-course-card:hover .drive-course-card-footer svg {
  transform: translateX(4px);
  color: #06b6d4;
}

/* Beautiful slide-up resource modal */
.modal-overlay.active .drive-modal {
  transform: translateY(0);
  opacity: 1;
}

.drive-modal {
  width: min(95vw, 680px);
  height: min(85vh, 660px);
  max-height: 85vh;
  border-radius: 24px;
  background: rgba(13, 20, 35, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 
    0 24px 60px rgba(0, 0, 0, 0.6),
    0 0 32px rgba(139, 92, 246, 0.1);
  backdrop-filter: blur(24px) saturate(130%);
  -webkit-backdrop-filter: blur(24px) saturate(130%);
  transform: scale(0.96) translateY(30px);
  opacity: 0;
  transition: 
    transform 400ms cubic-bezier(0.34, 1.3, 0.64, 1), 
    opacity 400ms ease;
  align-self: center;
  margin: 0 auto;
}

.drive-modal .modal-header {
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  padding: 1.5rem;
}

.drive-modal-course .drive-modal-kicker {
  color: #8b5cf6;
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 0.25rem;
}

.drive-modal-meta {
  color: var(--text-secondary);
  font-size: 0.825rem;
  margin-top: 0.35rem;
}

.drive-modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  flex-grow: 1;
}

/* Redesigned drive material list */
.drive-material-list {
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
  margin-top: 1.25rem;
}

.drive-material-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  border-radius: 16px;
  background: rgba(30, 41, 59, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.04);
  transition: 
    background-color var(--transition-fast), 
    border-color var(--transition-fast),
    transform var(--transition-fast);
}

.drive-material-item:hover {
  background: rgba(30, 41, 59, 0.45);
  border-color: rgba(255, 255, 255, 0.08);
  transform: scale(1.01);
}

.drive-material-icon-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 10px;
  flex-shrink: 0;
}

/* File type icon theme custom colors */
.drive-material-item.type-pdf .drive-material-icon-wrap {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.2);
}
.drive-material-item.type-sheets .drive-material-icon-wrap {
  background: rgba(16, 185, 129, 0.1);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.2);
}
.drive-material-item.type-slides .drive-material-icon-wrap {
  background: rgba(245, 158, 11, 0.1);
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, 0.2);
}
.drive-material-item.type-docs .drive-material-icon-wrap {
  background: rgba(59, 130, 246, 0.1);
  color: #3b82f6;
  border: 1px solid rgba(59, 130, 246, 0.2);
}
.drive-material-item.type-link .drive-material-icon-wrap {
  background: rgba(167, 139, 250, 0.1);
  color: #a78bfa;
  border: 1px solid rgba(167, 139, 250, 0.2);
}

.drive-material-icon-wrap svg {
  width: 22px;
  height: 22px;
}

.drive-material-info {
  flex-grow: 1;
  min-width: 0;
}

.drive-material-info h4 {
  font-size: 0.95rem;
  font-weight: 600;
  color: #fff;
  line-height: 1.35;
  margin-bottom: 0.25rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.drive-material-meta-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.775rem;
}

.drive-material-badge {
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  font-size: 0.7rem;
}

.drive-material-item.type-pdf .drive-material-badge { color: #f87171; }
.drive-material-item.type-sheets .drive-material-badge { color: #34d399; }
.drive-material-item.type-slides .drive-material-badge { color: #fbbf24; }
.drive-material-item.type-docs .drive-material-badge { color: #60a5fa; }
.drive-material-item.type-link .drive-material-badge { color: #c084fc; }

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

.drive-material-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

.drive-material-time {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.drive-material-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.85rem;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.06);
  color: #fff;
  text-decoration: none;
  font-size: 0.825rem;
  font-weight: 700;
  transition: all var(--transition-fast);
}

.drive-material-btn:hover {
  background: rgba(99, 102, 241, 0.15);
  border-color: rgba(99, 102, 241, 0.25);
  color: #8b5cf6;
}

.drive-material-btn svg {
  width: 14px;
  height: 14px;
  transition: transform var(--transition-fast);
}

.drive-material-btn:hover svg {
  transform: translate(1px, -1px);
}

/* Redesigned drive empty states */
.drive-empty-state {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 3rem 1.5rem;
  border-radius: 20px;
  background: rgba(15, 23, 42, 0.35);
  border: 1px dashed rgba(255, 255, 255, 0.08);
  grid-column: 1 / -1;
  overflow: hidden;
}

.empty-glow {
  position: absolute;
  width: 250px;
  height: 250px;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.08) 0%, transparent 70%);
  filter: blur(40px);
  z-index: 0;
  pointer-events: none;
}

.drive-empty-state svg.empty-icon {
  position: relative;
  z-index: 1;
  width: 48px;
  height: 48px;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.drive-empty-state h3 {
  position: relative;
  z-index: 1;
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 0.5rem;
}

.drive-empty-state p {
  position: relative;
  z-index: 1;
  color: var(--text-secondary);
  font-size: 0.875rem;
  max-width: 40ch;
}

.files-view-header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.files-view-drive-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.8rem;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.12);
  background: rgba(15, 23, 42, 0.38);
  color: var(--text);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
}

.files-view-drive-link:hover {
  border-color: rgba(125, 211, 252, 0.25);
  background: rgba(125, 211, 252, 0.1);
}

@media (max-width: 920px) {
  .drive-stats-grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .drive-topbar {
    align-items: flex-start;
    flex-direction: column;
    padding: 1.25rem;
  }

  .drive-nav {
    width: 100%;
    justify-content: flex-start;
  }

  .drive-intro h2 {
    font-size: 1.5rem;
  }
}

@media (max-width: 640px) {
  .drive-page {
    width: min(100vw - 1rem, 1200px);
    padding-top: 0.75rem;
  }

  .drive-topbar {
    margin-bottom: 1.5rem;
  }

  .drive-stats-grid {
    margin-bottom: 2rem;
  }

  .drive-course-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .drive-modal {
    width: 96vw;
    height: 90vh;
    max-height: 90vh;
    border-radius: 20px;
  }

  .drive-material-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  .drive-material-actions {
    width: 100%;
    justify-content: space-between;
    border-top: 1px solid rgba(255, 255, 255, 0.03);
    padding-top: 0.5rem;
  }
}




/* ---------- Feedback ---------- */
.feedback-button {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  border-radius: var(--radius-md);
  color: var(--accent);
  font-size: 0.9375rem;
  font-weight: 600;
  transition: all var(--transition-fast);
  cursor: pointer;
}

.feedback-button:hover {
  background: var(--accent);
  color: white;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(139, 92, 246, 0.25);
}

.star-rating {
  display: flex;
  gap: var(--space-2);
}

.star-rating .star {
  font-size: 1.75rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: color var(--transition-fast);
  line-height: 1;
  user-select: none;
}

.star-rating .star.is-filled {
  color: #fbbf24;
}

.star-rating.is-readonly .star {
  cursor: default;
}

.star-rating-input {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.feedback-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

.feedback-meta {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.feedback-meta-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.feedback-meta-label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  min-width: 80px;
}

.feedback-suggestion-text {
  line-height: 1.7;
  color: var(--text-secondary);
  white-space: pre-wrap;
}

.feedback-table-rating {
  display: flex;
  gap: var(--space-1);
}

.feedback-table-rating .star {
  font-size: 1rem;
  color: #fbbf24;
}

.feedback-table-rating .star.is-empty {
  color: var(--text-muted);
}

.feedback-preview {
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-secondary);
}

/* ---------- Admin Compact Header ---------- */

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: 0 var(--space-5);
  padding-top: env(safe-area-inset-top);
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  height: calc(var(--header-height) + env(safe-area-inset-top));
  z-index: 9999;
  backdrop-filter: blur(12px) saturate(180%);
  -webkit-backdrop-filter: blur(12px) saturate(180%);
  flex-wrap: nowrap;
}


.admin-header-left {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.admin-header-left h1 {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.02em;
}

.connection-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--danger);
  box-shadow: 0 0 0 3px var(--danger-soft);
  transition: all var(--transition-base);
  flex-shrink: 0;
}

.connection-dot.is-online {
  background: var(--success);
  box-shadow: 0 0 0 3px var(--success-soft), 0 0 12px var(--success);
  animation: pulse-green 2s ease-in-out infinite;
}

.connection-dot.is-offline {
  background: var(--danger);
  box-shadow: 0 0 0 3px var(--danger-soft), 0 0 12px var(--danger);
  animation: pulse-red 2s ease-in-out infinite;
}

@keyframes pulse-green {
  0%, 100% { box-shadow: 0 0 0 3px var(--success-soft), 0 0 8px var(--success); }
  50% { box-shadow: 0 0 0 5px var(--success-soft), 0 0 16px var(--success); }
}

@keyframes pulse-red {
  0%, 100% { box-shadow: 0 0 0 3px var(--danger-soft), 0 0 8px var(--danger); }
  50% { box-shadow: 0 0 0 5px var(--danger-soft), 0 0 16px var(--danger); }
}

.admin-header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}

/* Theme toggle button */
.theme-toggle-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text);
  cursor: pointer;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.theme-toggle-btn:hover {
  background: var(--bg-surface-hover);
  border-color: var(--border-hover);
}

.theme-toggle-btn svg {
  width: 18px;
  height: 18px;
  display: none;
}

.theme-toggle-btn .theme-icon-sun {
  display: block;
}

.theme-toggle-btn .theme-icon-moon {
  display: none;
}

.theme-toggle-btn.is-light .theme-icon-sun {
  display: none;
}

.theme-toggle-btn.is-light .theme-icon-moon {
  display: block;
}

/* ---------- Icon Buttons ---------- */
.icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  padding: 0;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.icon-btn:hover {
  background: var(--bg-surface-hover);
  border-color: var(--border-hover);
  color: var(--text);
  transform: translateY(-1px);
}

.icon-btn svg {
  width: 18px;
  height: 18px;
  display: block;
}

.icon-btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.icon-btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  box-shadow: 0 4px 12px rgba(139, 92, 246, 0.35);
}

.icon-btn-danger {
  background: var(--danger-soft);
  border-color: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
}

.icon-btn-danger:hover {
  background: var(--danger);
  border-color: var(--danger);
  color: white;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.icon-btn-danger .spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  animation: spin 0.8s linear infinite;
  transform-origin: center;
}

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

/* Mobile admin header — already covered in max-width:1023px block above */

/* Push Notifications Status Indicators */
.noti-icon-container {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.noti-dot {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  border: 1px solid var(--bg-surface, #fff);
  display: none;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.1);
}

.noti-icon-container.sys-off .noti-dot {
  display: block;
  background-color: #ef4444; /* Red for system notification disabled/blocked */
}

.noti-icon-container.app-off .noti-dot {
  display: block;
  background-color: #fbbf24; /* Amber/Yellow for app environment notification disabled */
}

.noti-icon-container.active .noti-dot {
  display: block;
  background-color: #10b981; /* Green for active push notifications */
}

@media (max-width: 365px) {
  /* Shrink outer container paddings to reclaim horizontal space */
  .dashboard-header .header-inner {
    padding: 0 var(--space-2) !important;
  }
  
  /* Shrink brand logo gap and text size */
  .brand-lockup {
    gap: 0.25rem !important;
  }
  .brand-lockup h1,
  .brand-lockup h2 {
    font-size: 0.9rem !important;
  }
  
  /* Shrink gap between status chip and menu button */
  .dashboard-header-meta {
    gap: var(--space-1.5) !important;
  }
  
  /* Shrink padding and text size of the status chip */
  .header-meta-item {
    height: 26px !important;
    padding: 0 7px !important;
    font-size: 0.68rem !important;
    gap: 4px !important;
    white-space: nowrap !important;
  }
}

@media (max-width: 640px) {
  .course-view-all .view-all-modal .modal-body {
    padding: var(--space-4);
  }
}

@media (max-width: 380px) {
  .dashboard-card {
    padding: var(--space-3);
  }
  .dashboard-card-title {
    font-size: 0.875rem;
  }
  .dashboard-card .badge {
    max-width: 75px;
    font-size: 0.6875rem;
    padding: 2px 6px;
  }
  .dashboard-card-credits {
    font-size: 0.6875rem;
    padding: 2px 6px;
  }
  .dashboard-card-time,
  .dashboard-card-deadline,
  .dashboard-card-metrics {
    font-size: 0.75rem;
  }
}
