/* ============================================
   SVM Task Tracker — Design System & Styles
   Dark Glassmorphism · Mobile-First · Premium
   ============================================ */

/* ---------- Google Fonts ---------- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

/* ---------- Design Tokens ---------- */
:root {
  /* Colors */
  --bg-primary: #0a0a1a;
  --bg-secondary: #0f0f23;
  --bg-card: rgba(255, 255, 255, 0.04);
  --bg-card-hover: rgba(255, 255, 255, 0.07);
  --bg-glass: rgba(255, 255, 255, 0.06);
  --border-glass: rgba(255, 255, 255, 0.08);
  --border-glass-active: rgba(255, 255, 255, 0.15);

  --accent-purple: #7c3aed;
  --accent-purple-glow: rgba(124, 58, 237, 0.3);
  --accent-emerald: #10b981;
  --accent-emerald-glow: rgba(16, 185, 129, 0.3);
  --accent-amber: #f59e0b;
  --accent-amber-glow: rgba(245, 158, 11, 0.25);
  --accent-red: #ef4444;
  --accent-red-glow: rgba(239, 68, 68, 0.25);
  --accent-blue: #3b82f6;

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

  /* Gradients */
  --gradient-purple: linear-gradient(135deg, #7c3aed, #a78bfa);
  --gradient-emerald: linear-gradient(135deg, #10b981, #34d399);
  --gradient-amber: linear-gradient(135deg, #f59e0b, #fbbf24);
  --gradient-hero: linear-gradient(135deg, #0f0f23 0%, #1a0a2e 50%, #0f0f23 100%);
  --gradient-card: linear-gradient(145deg, rgba(255,255,255,0.05), rgba(255,255,255,0.01));

  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;

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

  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
  --shadow-glow-purple: 0 0 20px var(--accent-purple-glow);
  --shadow-glow-emerald: 0 0 20px var(--accent-emerald-glow);

  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-spring: 500ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.light-theme {
  --bg-primary: #f8fafc;
  --bg-secondary: #f1f5f9;
  --bg-card: rgba(255, 255, 255, 0.8);
  --bg-card-hover: rgba(255, 255, 255, 1);
  --bg-glass: rgba(255, 255, 255, 0.7);
  --bg-glass-heavy: rgba(255, 255, 255, 0.9);
  --border-glass: rgba(0, 0, 0, 0.08);
  --border-glass-active: rgba(0, 0, 0, 0.15);
  --text-primary: #1e293b;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --text-dim: #94a3b8;
  --gradient-hero: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
}

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Ambient background glow */
body::before {
  content: '';
  position: fixed;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at 30% 20%, rgba(124, 58, 237, 0.08) 0%, transparent 50%),
              radial-gradient(circle at 70% 80%, rgba(16, 185, 129, 0.06) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

/* ---------- App Container ---------- */
#app {
  position: relative;
  z-index: 1;
  max-width: 480px;
  margin: 0 auto;
  padding: var(--space-md);
  padding-top: calc(115px + var(--space-md) + env(safe-area-inset-top, 0px));
  padding-bottom: calc(var(--space-2xl) + env(safe-area-inset-bottom, 20px));
}

/* ---------- Loading Screen (Premium Reveal Splash) ---------- */
.loading-screen {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at center, #0a0718 0%, #030206 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  overflow: hidden;
  transform: translateY(0);
  opacity: 1;
  transition: transform 1.3s cubic-bezier(0.85, 0, 0.15, 1), 
              opacity 1.1s cubic-bezier(0.85, 0, 0.15, 1),
              visibility 1.3s ease;
}

.loading-screen.pull-up-reveal {
  transform: translateY(-100%);
  opacity: 0;
}

/* Double-parallax: Inner logo dissolves downward while screen panel slides up */
.splash-content {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  width: 100%;
  height: 100vh;
  transform: translateY(0) scale(1);
  opacity: 1;
  transition: transform 0.9s cubic-bezier(0.25, 1, 0.5, 1),
              opacity 0.8s ease-out;
}

.loading-screen.pull-up-reveal .splash-content {
  transform: translateY(45px) scale(0.95);
  opacity: 0;
}

.loading-screen.hidden {
  visibility: hidden;
  pointer-events: none;
}

.splash-glow-bg {
  position: absolute;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(124, 58, 237, 0.12) 0%, transparent 70%);
  filter: blur(40px);
  pointer-events: none;
  z-index: -1;
  animation: glowPulseBg 4s ease-in-out infinite alternate;
}

@keyframes glowPulseBg {
  0% { transform: scale(0.9); opacity: 0.7; }
  100% { transform: scale(1.1); opacity: 1; }
}



.splash-logo-assembly {
  display: flex;
  align-items: center;
  justify-content: center;
  position: absolute;
  transform: translateX(0);
  animation: slide-left-assembly 0.7s cubic-bezier(0.77, 0, 0.175, 1) 3.1s forwards;
}

.splash-shape-container {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 90px;
  height: 90px;
  position: relative;
  flex-shrink: 0;
}

.splash-shape {
  width: 90px;
  height: 90px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: spin-round 1.1s cubic-bezier(0.25, 1, 0.5, 1) 1.0s forwards;
}

.splash-shape-inner {
  position: absolute;
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: linear-gradient(135deg, #7c3aed, #c084fc);
  box-shadow: 0 0 40px rgba(124, 58, 237, 0.6);
  transform: translateY(350px) scale(0.1);
  opacity: 0;
  animation: 
    pull-up 0.9s cubic-bezier(0.175, 0.885, 0.32, 1.2) 0.2s forwards,
    shrink-circle 0.6s cubic-bezier(0.25, 1, 0.5, 1) 1.0s forwards;
}

.splash-svg-s {
  position: absolute;
  width: 70px;
  height: 70px;
  opacity: 0;
  filter: drop-shadow(0 0 15px rgba(192, 132, 252, 0.75));
  animation: fade-in-svg 0.3s ease-out 1.0s forwards;
}

.path-s-top,
.path-s-bottom {
  stroke-dasharray: 100;
  stroke-dashoffset: 100;
  transform-origin: 50px 50px;
}

.path-s-top {
  animation: draw-top-path 1.1s cubic-bezier(0.25, 1, 0.5, 1) 1.1s forwards;
}

.path-s-bottom {
  animation: draw-bottom-path 1.1s cubic-bezier(0.25, 1, 0.5, 1) 1.1s forwards;
}

.splash-logo-text {
  display: flex;
  align-items: center;
  gap: 0;
  margin-left: -20px; /* Organic visual bridge with S */
  overflow: hidden;
  height: 90px;
}

.letter-hivang {
  font-family: 'Inter', sans-serif;
  font-size: 3.8rem;
  font-weight: 900;
  letter-spacing: -0.05em;
  background: linear-gradient(135deg, #f1f5f9 0%, #cbd5e1 50%, #94a3b8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  display: inline-block;
  opacity: 0;
  transform: translateX(-30px) scale(0.3);
  filter: blur(8px);
}

.letter-hivang:nth-child(1) { animation: spawn-hivang-letter 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) 2.1s forwards; }
.letter-hivang:nth-child(2) { animation: spawn-hivang-letter 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) 2.2s forwards; }
.letter-hivang:nth-child(3) { animation: spawn-hivang-letter 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) 2.3s forwards; }
.letter-hivang:nth-child(4) { animation: spawn-hivang-letter 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) 2.4s forwards; }
.letter-hivang:nth-child(5) { animation: spawn-hivang-letter 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) 2.5s forwards; }
.letter-hivang:nth-child(6) { animation: spawn-hivang-letter 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) 2.6s forwards; }

.splash-text-container {
  position: absolute;
  left: calc(50% - 80px);
  margin-left: 210px;
  width: 0;
  white-space: nowrap;
  overflow: hidden;
  display: flex;
  align-items: center;
  opacity: 0;
  animation: reveal-container 0.8s cubic-bezier(0.25, 1, 0.5, 1) 3.1s forwards;
}

.splash-title {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  font-family: 'Inter', sans-serif;
  margin: 0;
}

.splash-title .word {
  opacity: 0;
  filter: blur(8px);
  font-weight: 800;
  letter-spacing: -0.01em;
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.splash-title .saraswati {
  font-size: 1.6rem;
  background-image: linear-gradient(90deg, #f1f5f9, #cbd5e1);
  animation: spawn-word 0.8s cubic-bezier(0.25, 1, 0.5, 1) 3.2s forwards;
}

.splash-title .vidyamandir {
  font-size: 1.6rem;
  background-image: linear-gradient(90deg, #cbd5e1, #94a3b8);
  animation: spawn-word 0.8s cubic-bezier(0.25, 1, 0.5, 1) 3.35s forwards;
}

.splash-title .taskmanager {
  font-size: 1.05rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  background-image: linear-gradient(90deg, #c084fc, #7c3aed);
  animation: spawn-word 0.8s cubic-bezier(0.25, 1, 0.5, 1) 3.5s forwards;
}

/* --- Core Reveal Keyframes --- */
@keyframes pull-up {
  0% { transform: translateY(350px) scale(0.1); opacity: 0; border-radius: 50%; }
  50% { opacity: 0.8; }
  100% { transform: translateY(0) scale(1); opacity: 1; border-radius: 50%; }
}

@keyframes shrink-circle {
  0% { transform: scale(1); opacity: 1; }
  100% { transform: scale(0); opacity: 0; }
}

@keyframes spin-round {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(720deg); }
}

@keyframes fade-in-svg {
  0% { opacity: 0; }
  100% { opacity: 1; }
}

@keyframes draw-top-path {
  0% { stroke-dashoffset: 100; transform: translate(0, 0) scale(0.6); }
  30% { opacity: 0.5; }
  100% { stroke-dashoffset: 0; transform: translate(-2px, -2px) scale(1); }
}

@keyframes draw-bottom-path {
  0% { stroke-dashoffset: 100; transform: translate(0, 0) scale(0.6); }
  30% { opacity: 0.5; }
  100% { stroke-dashoffset: 0; transform: translate(2px, 2px) scale(1); }
}

@keyframes spawn-hivang-letter {
  0% { opacity: 0; transform: translateX(-30px) scale(0.3); filter: blur(8px); }
  100% { opacity: 1; transform: translateX(0) scale(1); filter: blur(0); }
}

@keyframes slide-left-assembly {
  0% { transform: translateX(0); }
  100% { transform: translateX(-160px); }
}

@keyframes reveal-container {
  0% { width: 0; opacity: 0; }
  100% { width: 320px; opacity: 1; }
}

@keyframes spawn-word {
  0% { transform: translateX(-240px) scale(0.3); opacity: 0; filter: blur(12px); color: #c084fc; }
  50% { opacity: 0.8; filter: blur(4px); color: #a78bfa; }
  100% { transform: translateX(0) scale(1); opacity: 1; filter: blur(0); }
}

/* ---------- Mobile Phone Optimization for Reveal Splash ---------- */
@media (max-width: 599px) {
  .splash-logo-assembly {
    animation: slide-up-assembly-mobile 0.7s cubic-bezier(0.77, 0, 0.175, 1) 3.1s forwards;
  }

  .splash-shape-container {
    animation: none;
  }

  .splash-logo-text {
    height: 90px;
  }

  .letter-hivang {
    font-size: 2.8rem; /* slightly scaled down on small mobile screens to keep it single-row */
  }

  .splash-text-container {
    left: 0;
    right: 0;
    margin-left: 0;
    width: 100%;
    justify-content: center;
    transform: translateY(65px);
    animation: reveal-container-mobile 0.8s cubic-bezier(0.25, 1, 0.5, 1) 3.1s forwards;
  }

  .splash-title {
    align-items: center;
    text-align: center;
  }

  .splash-title .saraswati {
    font-size: 1.3rem;
    animation: spawn-word-mobile 0.8s cubic-bezier(0.25, 1, 0.5, 1) 3.2s forwards;
  }

  .splash-title .vidyamandir {
    font-size: 1.3rem;
    animation: spawn-word-mobile 0.8s cubic-bezier(0.25, 1, 0.5, 1) 3.35s forwards;
  }

  .splash-title .taskmanager {
    font-size: 0.82rem;
    letter-spacing: 0.12em;
    animation: spawn-word-mobile 0.8s cubic-bezier(0.25, 1, 0.5, 1) 3.5s forwards;
  }

  .splash-title .word {
    transform: translateY(15px);
  }

  @keyframes slide-up-assembly-mobile {
    0% { transform: translateY(0); }
    100% { transform: translateY(-65px); }
  }

  @keyframes reveal-container-mobile {
    0% { width: 100%; opacity: 0; transform: translateY(65px); }
    100% { width: 100%; opacity: 1; transform: translateY(45px); }
  }

  @keyframes spawn-word-mobile {
    0% { transform: translateY(-90px) scale(0.3); opacity: 0; filter: blur(12px); color: #c084fc; }
    50% { opacity: 0.8; filter: blur(4px); color: #a78bfa; }
    100% { transform: translateY(0) scale(1); opacity: 1; filter: blur(0); }
  }
}

/* ---------- Premium Shimmer Skeletal Loading ---------- */
.premium-loader {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  padding: var(--space-md);
  width: 100%;
}

.premium-loader-bar {
  height: 18px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.04) 25%, rgba(255, 255, 255, 0.09) 50%, rgba(255, 255, 255, 0.04) 75%);
  background-size: 200% 100%;
  border-radius: var(--radius-sm);
  animation: shimmer 1.5s infinite;
}

.premium-loader-bar.short {
  width: 60%;
}

.premium-loader-bar.mid {
  width: 80%;
}

/* ---------- Auth Overlay ---------- */
.auth-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 900;
  padding: var(--space-lg);
  animation: fadeIn 0.3s ease;
}

.auth-card {
  background: var(--gradient-card);
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-xl);
  padding: var(--space-xl);
  width: 100%;
  max-width: 400px;
  text-align: center;
  animation: slideUp 0.4s var(--transition-spring);
}

.auth-card h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: var(--space-xs);
}

.auth-card p {
  color: var(--text-secondary);
  font-size: 0.875rem;
  margin-bottom: var(--space-lg);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  text-align: left;
}

.auth-form label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: var(--space-xs);
}

.auth-form input,
.auth-form select {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: var(--space-sm) var(--space-md);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 1rem;
  outline: none;
  transition: all var(--transition-fast);
}

.light-theme .auth-form input,
.light-theme .auth-form select {
  background: #ffffff;
  border-color: rgba(0,0,0,0.1);
}

.auth-form input:focus,
.auth-form select:focus {
  border-color: var(--accent-purple);
  box-shadow: 0 0 0 3px var(--accent-purple-glow);
}

.auth-error {
  color: var(--accent-red);
  font-size: 0.85rem;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  padding: var(--space-sm);
  border-radius: var(--radius-md);
  text-align: center;
  animation: fadeIn 0.3s ease;
}

.auth-submit-btn {
  margin-top: var(--space-sm);
  width: 100%;
  padding: var(--space-md);
  font-size: 1rem;
  font-weight: 600;
  border-radius: var(--radius-md);
}

.auth-footer {
  margin-top: var(--space-lg);
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.btn-link {
  background: none;
  border: none;
  color: var(--accent-purple);
  font-family: inherit;
  font-size: inherit;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  text-decoration: none;
}

.btn-link:hover {
  text-decoration: underline;
}

/* Auth modal buttons (reusing generic button styles later, but btn-sm helper here) */
.btn-sm {
  padding: var(--space-xs) var(--space-md) !important;
  font-size: 0.8rem !important;
  margin-top: 0 !important;
  width: auto !important;
}

/* ---------- Header ---------- */
.app-header {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  z-index: 200;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  padding: calc(env(safe-area-inset-top, 10px) + 10px) var(--space-md) 10px var(--space-md);
  height: auto;
  min-height: 100px; /* Increased to accommodate two rows comfortably */
  background: rgba(10, 10, 20, 0.95);
  border-bottom: 1px solid var(--border-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-sizing: border-box;
  gap: var(--space-xs);
}

/* Force line break for the navigation pill */
.app-header::after {
  content: "";
  flex-basis: 100%;
  order: 2;
}

.header-left, .header-right {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.header-center {
  order: 3;
  width: 100%;
  max-width: 100%;
  display: flex;
  justify-content: safe center; /* Centered when it fits, safe left-aligned when it overflows to prevent clipping */
  gap: var(--space-xs);
  background: var(--bg-card);
  padding: 4px 8px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-glass);
  overflow-x: auto;
  margin-top: var(--space-xs);
  margin-inline: auto;
  z-index: 5;
  scrollbar-width: none; /* Hide scrollbar for Firefox */
  -ms-overflow-style: none;  /* Hide scrollbar for IE/Edge */
}

/* Ensure greeting doesn't overlap or wrap weirdly */
.header-left {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start; /* Fix: ensures left alignment */
}

.greeting {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

@media (min-width: 500px) {
  .app-header {
    padding-top: env(safe-area-inset-top, 10px);
  }
  .greeting {
    max-width: none;
  }
}

.light-theme .app-header {
  background: rgba(248, 250, 252, 0.92);
}

.header-left h1 {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: var(--gradient-purple);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin: 0;
  line-height: 1.2;
}

.header-left h1 {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: var(--gradient-purple);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.header-left .greeting {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.header-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-primary);
  cursor: pointer;
  transition: all var(--transition-base);
  font-size: 1rem;
}

.light-theme .header-btn {
  background: rgba(0, 0, 0, 0.05);
  border-color: rgba(0, 0, 0, 0.1);
  color: #1e293b;
}

.header-btn:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  border-color: var(--border-glass-active);
}

.logout-btn {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: var(--radius-md);
  padding: 0 var(--space-sm);
  height: 32px;
  color: var(--accent-red);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-base);
}

.logout-btn:hover {
  background: rgba(239, 68, 68, 0.2);
  transform: translateY(-1px);
}

.logout-btn span {
  display: none;
}

@media (min-width: 600px) {
  .logout-btn span {
    display: inline;
  }
}

/* Theme Icons Toggle */
.theme-sun { display: block; }
.theme-moon { display: none; }

.light-theme .theme-sun { display: none; }
.light-theme .theme-moon { display: block; }

.user-avatar {
  border-color: var(--accent-purple);
  box-shadow: var(--shadow-glow-purple);
}

.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--gradient-purple);
  color: #ffffff;
  font-weight: 700;
  font-family: inherit;
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  flex-shrink: 0;
  text-transform: uppercase;
}

.avatar-sm {
  width: 32px;
  height: 32px;
  font-size: 0.8rem;
}

/* Navigation Tabs */

.header-center::-webkit-scrollbar {
  display: none; /* Hide scrollbar for Chrome/Safari/Opera */
}

.nav-tab {
  background: none;
  border: none;
  padding: 8px 16px;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-base);
  white-space: nowrap;
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}

.nav-tab.active {
  background: var(--accent-purple);
  color: white;
  box-shadow: var(--shadow-glow-purple);
  animation: activeTabPulse 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.nav-tab:hover:not(.active) {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.nav-tab::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.12), transparent);
  transition: all 0.6s ease;
}

.nav-tab:hover::before {
  left: 100%;
}

@keyframes activeTabPulse {
  0% { transform: scale(0.9); }
  100% { transform: scale(1); }
}

/* ── Inline delete pill on custom FMS tabs (admin only) ── */
.nav-tab-delete-btn {
  background: none;
  border: none;
  color: rgba(248, 113, 113, 0.6);
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0 8px 0 4px;
  height: 100%;
  line-height: 1;
  transition: color 0.2s, background 0.2s;
  display: inline-flex;
  align-items: center;
  border-radius: 0 var(--radius-full) var(--radius-full) 0;
  flex-shrink: 0;
}

.nav-tab-delete-btn:hover {
  color: #f87171;
  background: rgba(239, 68, 68, 0.15);
}

/* The whole compound pill inherits active background when tab is active */
.nav-tab-group .nav-tab.active + .nav-tab-delete-btn {
  background: rgba(239, 68, 68, 0.15);
}

/* FMS delete confirm banner slide-up entry animation */
@keyframes slideUpIn {
  0% { transform: translateX(-50%) translateY(20px); opacity: 0; }
  100% { transform: translateX(-50%) translateY(0); opacity: 1; }
}



/* ---------- AI Briefing Card ---------- */
.briefing-card {
  background: var(--gradient-card);
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  margin-bottom: var(--space-lg);
  position: relative;
  overflow: hidden;
  animation: slideUp 0.5s ease;
}

.briefing-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--gradient-purple);
}

.briefing-header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
}

.briefing-icon {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  background: var(--accent-purple-glow);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
}

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

.briefing-text {
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--text-secondary);
}

.briefing-text strong {
  color: var(--text-primary);
  font-weight: 600;
}

.briefing-skeleton {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.skeleton-line {
  height: 14px;
  background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-card-hover) 50%, var(--bg-card) 75%);
  background-size: 200% 100%;
  border-radius: var(--radius-sm);
  animation: shimmer 1.5s infinite;
}

.skeleton-line:nth-child(2) { width: 85%; }
.skeleton-line:nth-child(3) { width: 60%; }

/* ---------- Section ---------- */
.task-section {
  margin-bottom: var(--space-lg);
  animation: slideUp 0.5s ease;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-md);
  padding: 0 var(--space-xs);
}

.section-title {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.section-title .icon {
  font-size: 1rem;
}

.section-count {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-dim);
  background: var(--bg-card);
  padding: 2px 10px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-glass);
}

/* ---------- Task Card ---------- */
.task-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.task-card {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  display: flex;
  align-items: center;
  gap: var(--space-md);
  cursor: pointer;
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  flex-shrink: 0;
}

.task-card:hover {
  background: var(--bg-card-hover);
  border-color: rgba(124, 58, 237, 0.35);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35), 0 0 15px rgba(124, 58, 237, 0.12);
  transform: translateY(-2px);
}

.task-card:active {
  transform: scale(0.995) translateY(0);
}

.task-card.overdue {
  border-left: 3px solid var(--accent-red);
}

.task-card.overdue:hover {
  border-color: rgba(239, 68, 68, 0.4);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35), 0 0 15px rgba(239, 68, 68, 0.12);
}

.task-card.overdue::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 3px;
  background: var(--accent-red);
  animation: pulse-opacity 2s ease-in-out infinite;
}

.task-card.completing {
  animation: taskComplete 0.6s ease forwards;
}

.task-card.done {
  opacity: 0.6;
  background: rgba(16, 185, 129, 0.03);
  border-color: rgba(16, 185, 129, 0.15);
}

.task-card.done:hover {
  transform: none;
  box-shadow: none;
  border-color: rgba(16, 185, 129, 0.25);
  background: rgba(16, 185, 129, 0.05);
}

.task-card.done .task-name {
  text-decoration: line-through;
  color: var(--text-muted);
}

/* Checkbox */
.task-checkbox {
  width: 26px;
  height: 26px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--text-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all var(--transition-base);
  position: relative;
}

.task-card:hover .task-checkbox {
  border-color: var(--accent-emerald);
}

.task-card.done .task-checkbox {
  background: var(--accent-emerald);
  border-color: var(--accent-emerald);
  box-shadow: var(--shadow-glow-emerald);
}

.task-card.done .task-checkbox::after {
  content: '';
  position: absolute;
  inset: -12px;
  border: 2px solid var(--accent-emerald);
  border-radius: 50%;
  opacity: 0;
  transform: scale(0.7);
  animation: checkboxBurst 0.5s cubic-bezier(0.1, 0.8, 0.3, 1) forwards;
}

@keyframes checkboxBurst {
  0% {
    opacity: 0.85;
    transform: scale(0.6);
  }
  100% {
    opacity: 0;
    transform: scale(1.6);
  }
}

.task-checkbox .check-icon {
  opacity: 0;
  transform: scale(0);
  transition: all var(--transition-spring);
  color: white;
  font-size: 0.8rem;
  font-weight: 700;
}

.task-card.done .task-checkbox .check-icon {
  opacity: 1;
  transform: scale(1);
}

/* Task info */
.task-info {
  flex: 1;
  min-width: 0;
}

.task-name {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-primary);
  transition: all var(--transition-base);
  line-height: 1.4;
}

.task-meta {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-top: 6px;
  font-size: 0.75rem;
  color: var(--text-dim);
  flex-wrap: wrap; /* Allow wrapping */
}

.task-badge {
  padding: 1px 8px;
  border-radius: var(--radius-full);
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge-daily {
  background: rgba(124, 58, 237, 0.15);
  color: var(--accent-purple);
}

.badge-weekly {
  background: rgba(59, 130, 246, 0.15);
  color: var(--accent-blue);
}

.badge-one-time {
  background: rgba(245, 158, 11, 0.15);
  color: var(--accent-amber);
}

.badge-fms {
  background: rgba(167, 139, 250, 0.15);
  color: #c084fc;
}

.badge-overdue {
  background: rgba(239, 68, 68, 0.15);
  color: var(--accent-red);
  animation: pulse-opacity 2s ease-in-out infinite;
}

.badge-in-progress {
  background: rgba(59, 130, 246, 0.15);
  color: var(--accent-blue);
}

.badge-stuck {
  background: rgba(245, 158, 11, 0.15);
  color: var(--accent-amber);
}

.task-nudge-btn:hover {
  background: var(--bg-card);
  color: var(--accent-purple);
}

.workflow-health-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  margin-bottom: var(--space-xl);
}

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

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

.health-label {
  font-size: 0.9rem;
  font-weight: 500;
}

.health-value {
  font-weight: 700;
  padding: 2px 10px;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
}

.health-value.danger {
  background: rgba(239, 68, 68, 0.15);
  color: var(--accent-red);
}

.health-value.warning {
  background: rgba(245, 158, 11, 0.15);
  color: var(--accent-amber);
}

.health-value.good {
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-emerald);
}

/* Clickable health item row */
.health-item-clickable {
  cursor: pointer;
  border-radius: var(--radius-sm);
  margin: 0 -6px;
  padding-left: 6px;
  padding-right: 6px;
  transition: background var(--transition-fast);
}

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

/* Expandable task detail panel */
.health-task-detail {
  margin: 4px 0 8px 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  animation: slideUp 0.2s ease;
}

/* Individual task row inside the detail panel */
.health-task-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.health-task-item:hover {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(124, 58, 237, 0.3);
  transform: translateX(3px);
}

.health-task-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.health-task-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
  font-size: 0.72rem;
  color: var(--text-muted);
  flex-wrap: wrap;
}

.health-detail-empty {
  font-size: 0.8rem;
  color: var(--text-dim);
  text-align: center;
  padding: 12px;
  font-style: italic;
}

/* ---------- Task Type Tab Bar ---------- */
.task-type-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: var(--space-md);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: 2px;
}

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

.task-type-tab {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-glass);
  background: var(--bg-card);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-base);
  white-space: nowrap;
  position: relative;
  -webkit-tap-highlight-color: transparent;
}

.task-type-tab:hover:not(.active) {
  background: var(--bg-card-hover);
  color: var(--text-secondary);
  border-color: var(--border-glass-active);
}

.task-type-tab.active {
  background: var(--gradient-purple);
  color: white;
  border-color: transparent;
  box-shadow: 0 2px 12px var(--accent-purple-glow);
}

/* Pending count badge inside tab */
.ttab-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: var(--radius-full);
  background: rgba(239, 68, 68, 0.85);
  color: white;
  font-size: 0.6rem;
  font-weight: 800;
  line-height: 1;
}

.task-type-tab.active .ttab-badge {
  background: rgba(255, 255, 255, 0.25);
}

/* ---------- Stats Card ---------- */
.stats-card {
  background: var(--gradient-card);
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  margin-bottom: var(--space-lg);
  animation: slideUp 0.6s ease;
}

.stats-header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-md);
}

.stat-item {
  text-align: center;
}

.stat-item-interactive {
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), filter 0.2s ease;
}

.stat-item-interactive:hover {
  transform: translateY(-3px) scale(1.05);
  filter: brightness(1.2);
}

.stat-item-interactive:active {
  transform: translateY(-1px) scale(0.98);
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1;
  margin-bottom: 4px;
}

.stat-value.purple { color: var(--accent-purple); }
.stat-value.emerald { color: var(--accent-emerald); }
.stat-value.amber { color: var(--accent-amber); }

.stat-label {
  font-size: 0.7rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 500;
}

/* ---------- Progress Bar ---------- */
.progress-section {
  margin-top: var(--space-md);
  padding-top: var(--space-md);
  border-top: 1px solid var(--border-glass);
}

.progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  margin-bottom: var(--space-sm);
}

.progress-label span:first-child { color: var(--text-secondary); }
.progress-label span:last-child { color: var(--accent-emerald); font-weight: 600; }

.progress-bar {
  height: 8px;
  background: var(--bg-card);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--gradient-emerald);
  border-radius: var(--radius-full);
  transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.progress-fill::after {
  content: '';
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 20px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3));
  border-radius: var(--radius-full);
}

/* ---------- Empty State ---------- */
.empty-state {
  text-align: center;
  padding: var(--space-2xl) var(--space-lg);
  color: var(--text-dim);
}

.empty-icon {
  font-size: 3rem;
  margin-bottom: var(--space-md);
  opacity: 0.5;
}

.empty-state h3 {
  font-size: 1.1rem;
  color: var(--text-secondary);
  margin-bottom: var(--space-xs);
}

.empty-state p {
  font-size: 0.85rem;
}

/* ---------- All Done Celebration ---------- */
.all-done {
  text-align: center;
  padding: var(--space-xl);
  animation: slideUp 0.5s var(--transition-spring);
}

.all-done .trophy {
  font-size: 3.5rem;
  animation: bounce 1s ease infinite;
  margin-bottom: var(--space-md);
}

.all-done h3 {
  font-size: 1.3rem;
  font-weight: 700;
  background: var(--gradient-emerald);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: var(--space-xs);
}

.all-done p {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* ---------- Confetti Canvas ---------- */
#confetti-canvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 999;
}

/* ---------- Toast Notification ---------- */
.toast {
  position: fixed;
  bottom: calc(var(--space-xl) + env(safe-area-inset-bottom, 20px));
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--bg-secondary);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: var(--space-sm) var(--space-lg);
  font-size: 0.85rem;
  color: var(--text-primary);
  box-shadow: var(--shadow-lg);
  z-index: 800;
  transition: transform var(--transition-spring);
  white-space: nowrap;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.toast.show {
  transform: translateX(-50%) translateY(0);
}

.toast.success { border-color: var(--accent-emerald); }
.toast.error { border-color: var(--accent-red); }

/* ---------- Error Banner ---------- */
.error-banner {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  margin-bottom: var(--space-lg);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 0.85rem;
  color: var(--accent-red);
  animation: slideUp 0.3s ease;
}

.error-banner .retry-btn {
  margin-left: auto;
  background: rgba(239, 68, 68, 0.15);
  border: none;
  border-radius: var(--radius-sm);
  padding: 4px 12px;
  color: var(--accent-red);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition-fast);
}

.error-banner .retry-btn:hover {
  background: rgba(239, 68, 68, 0.25);
}

/* ---------- Floating Action Button ---------- */
.fab {
  position: fixed;
  bottom: calc(var(--space-xl) + env(safe-area-inset-bottom, 20px));
  right: var(--space-lg);
  width: 56px;
  height: 56px;
  border-radius: var(--radius-full);
  background: var(--gradient-purple);
  border: none;
  color: white;
  font-size: 1.8rem;
  font-weight: 300;
  cursor: pointer;
  box-shadow: var(--shadow-lg), var(--shadow-glow-purple);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-base);
  -webkit-tap-highlight-color: transparent;
  line-height: 1;
}

.fab:hover {
  transform: scale(1.1);
  box-shadow: var(--shadow-lg), 0 0 30px var(--accent-purple-glow);
}

.fab:active {
  transform: scale(0.95);
}

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 950;
  padding: var(--space-md);
  animation: fadeIn 0.2s ease;
  overflow-y: auto;
}

.modal-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-xl);
  padding: var(--space-lg);
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  overflow-x: hidden;
  animation: slideUp 0.3s var(--transition-spring);
  scrollbar-width: thin;
  scrollbar-color: rgba(139,92,246,0.3) transparent;
}

.modal-card::-webkit-scrollbar {
  width: 4px;
}
.modal-card::-webkit-scrollbar-thumb {
  background: rgba(139,92,246,0.4);
  border-radius: 2px;
}

.modal-card-sm {
  max-width: 400px;
}

.modal-card-lg {
  max-width: 800px;
  width: 95%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}

.dashboard-content {
  overflow-y: auto;
  padding: var(--space-md) 0;
}

/* ---------- KPI Summary Cards ---------- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-md);
  margin-bottom: var(--space-xl);
}

.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  box-shadow: var(--shadow-sm);
  animation: slideUp 0.4s ease backwards;
}

.kpi-card:nth-child(1) { animation-delay: 0.1s; }
.kpi-card:nth-child(2) { animation-delay: 0.2s; }
.kpi-card:nth-child(3) { animation-delay: 0.3s; }

.kpi-value {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
  margin-bottom: var(--space-xs);
}

.kpi-value.purple { color: var(--accent-purple); }
.kpi-value.emerald { color: var(--accent-emerald); }
.kpi-value.amber { color: var(--accent-amber); }

.kpi-label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  font-weight: 600;
}

/* ---------- Leaderboard Top 3 ---------- */
.leaderboard-top3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--space-md);
  margin-bottom: var(--space-xl);
}

/* Base Dashboard Card Enhancements */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--space-md);
}

.dashboard-card {
  background: var(--bg-glass-heavy);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease;
  animation: slideUp 0.5s ease backwards;
}

.dashboard-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: rgba(255, 255, 255, 0.15);
}

/* Top 3 Special Styles */
.dashboard-card.rank-1-card {
  border: 1px solid rgba(255, 215, 0, 0.4);
  box-shadow: 0 0 20px rgba(255, 215, 0, 0.1);
}
.dashboard-card.rank-2-card {
  border: 1px solid rgba(192, 192, 192, 0.4);
}
.dashboard-card.rank-3-card {
  border: 1px solid rgba(205, 127, 50, 0.4);
}

.dashboard-card-header {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-xs);
}

.dashboard-card-name {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text-primary);
  flex: 1;
}

.dashboard-card-score {
  font-weight: 800;
  font-size: 1.2rem;
  color: var(--accent-purple);
  text-align: right;
}

.dashboard-rank {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  background: var(--bg-glass-heavy);
  border: 1px solid var(--border-glass);
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--text-secondary);
}

.dashboard-rank.rank-1 { background: rgba(255, 215, 0, 0.2); border-color: #ffd700; color: #ffd700; text-shadow: 0 0 8px rgba(255, 215, 0, 0.5); }
.dashboard-rank.rank-2 { background: rgba(192, 192, 192, 0.2); border-color: #c0c0c0; color: #c0c0c0; }
.dashboard-rank.rank-3 { background: rgba(205, 127, 50, 0.2); border-color: #cd7f32; color: #cd7f32; }

/* Circular Progress Charts */
.circular-chart-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: var(--space-sm) 0 var(--space-md) 0;
  padding: var(--space-sm);
  background: rgba(0,0,0,0.1);
  border-radius: var(--radius-md);
}

.circular-chart {
  width: 60px;
  height: 60px;
}
.circular-bg {
  fill: none;
  stroke: rgba(255, 255, 255, 0.05);
  stroke-width: 3.8;
}
.circular-fill {
  fill: none;
  stroke: var(--accent-emerald);
  stroke-width: 2.8;
  stroke-linecap: round;
  transition: stroke-dasharray 1s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.circular-text {
  fill: var(--text-primary);
  font-size: 8px;
  font-weight: 700;
  text-anchor: middle;
  dominant-baseline: central;
}

.chart-stats-info {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding-left: var(--space-md);
  gap: 4px;
}

.dashboard-stats-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--text-secondary);
  padding: var(--space-xs) 0;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

.dashboard-stats-row:last-child {
  border-bottom: none;
}

.dashboard-stat-val {
  font-weight: 600;
  color: var(--text-primary);
}

.dashboard-stat-val.missed { color: var(--accent-red); }
.dashboard-stat-val.late { color: var(--accent-amber); }
.dashboard-stat-val.completed { color: var(--accent-emerald); }

.btn-export {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 6px 12px;
  color: var(--accent-emerald);
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: all var(--transition-base);
  margin-right: var(--space-sm);
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-export:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent-emerald);
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.2);
}

.light-theme .btn-export {
  background: #ffffff;
  border-color: rgba(0,0,0,0.1);
}

/* ---------- Controls Section ---------- */
.controls-section {
  display: flex;
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
  animation: slideDown 0.4s ease-out;
}

.search-box {
  flex: 1;
}

.search-box input {
  width: 100%;
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 10px var(--space-md);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.9rem;
  transition: all var(--transition-base);
}

.search-box input:focus {
  outline: none;
  border-color: var(--accent-purple);
  background: var(--bg-card);
}

.filter-box select {
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 10px var(--space-md);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all var(--transition-base);
}

.filter-box select option {
  background-color: var(--bg-secondary);
  color: var(--text-primary);
}

.light-theme .filter-box select {
  background: #ffffff;
}

.light-theme .filter-box select option {
  background-color: #ffffff;
  color: #1e293b;
}

/* ---------- Priority Badges ---------- */
.priority-badge {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 4px;
  letter-spacing: 0.05em;
}

.priority-high { background: var(--accent-red-glow); color: var(--accent-red); }
.priority-medium { background: var(--accent-amber-glow); color: var(--accent-amber); }
.priority-low { background: rgba(59, 130, 246, 0.2); color: var(--accent-blue); }

/* ---------- Theme Toggle Icon ---------- */
.theme-sun { display: block; }
.light-theme .theme-sun { display: none; }
.theme-moon { display: none; }
.light-theme .theme-moon { display: block; }

/* ---------- Task Card Action Buttons ---------- */
.task-actions {
  display: flex;
  flex-direction: row; /* Changed to row */
  flex-wrap: wrap;    /* Allow wrapping */
  gap: 4px;
  margin-left: var(--space-sm);
  align-items: center;
  justify-content: flex-end;
  min-width: 60px;
  max-width: 110px; /* Prevents pushing too far left */
}

.task-edit-btn, .task-shift-btn, .task-comment-btn {
  background: transparent !important;
  border: none !important;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
}

.task-edit-btn:hover {
  background: var(--bg-card);
  color: var(--accent-purple);
}

.task-shift-btn:hover {
  background: var(--bg-card);
  color: var(--accent-amber);
}

.task-comment-btn:hover {
  background: var(--bg-card);
  color: var(--accent-emerald);
}

/* ---------- Broadcast Banner ---------- */
.broadcast-banner {
  margin: var(--space-md);
  padding: var(--space-sm) var(--space-md);
  background: var(--gradient-purple);
  color: white;
  border-radius: var(--radius-md);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-sm);
  box-shadow: var(--shadow-glow-purple);
  animation: slideUp 0.5s ease-out;
  position: relative;
  z-index: 100;
}

.broadcast-content {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.85rem;
  font-weight: 500;
  line-height: 1.4;
}

.broadcast-icon {
  font-size: 1.2rem;
}

.broadcast-close {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  flex-shrink: 0;
  transition: background 0.2s;
}

.broadcast-close:hover {
  background: rgba(255, 255, 255, 0.3);
}

.comment-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.7rem;
  color: var(--accent-emerald);
  background: rgba(16, 185, 129, 0.1);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  margin-left: 4px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-lg);
}

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

.modal-close {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 0.9rem;
  transition: all var(--transition-fast);
}

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

.modal-body-text {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: var(--space-lg);
  line-height: 1.5;
}

.modal-actions {
  display: flex;
  gap: var(--space-sm);
}

/* ---------- Form Elements ---------- */
.form-group {
  margin-bottom: 12px;
}

.form-group label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: var(--space-xs);
}

.form-group input,
.form-group select {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 7px var(--space-md);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.88rem;
  transition: border-color var(--transition-fast);
  outline: none;
}

.form-group input:focus,
.form-group select:focus {
  border-color: var(--accent-purple);
  box-shadow: 0 0 0 3px var(--accent-purple-glow);
}

.form-group input::placeholder {
  color: var(--text-dim);
}

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

.form-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-md);
}

@media (min-width: 480px) {
  .form-row {
    grid-template-columns: 1fr 1fr;
  }
}

.btn-primary {
  width: 100%;
  padding: var(--space-sm) var(--space-lg);
  background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 50%, #6d28d9 100%);
  border: none;
  border-radius: var(--radius-md);
  color: white;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-spring);
  margin-top: var(--space-sm);
  position: relative;
  overflow: hidden;
}

.btn-primary:hover {
  box-shadow: 0 0 25px var(--accent-purple-glow), 0 4px 12px rgba(124, 58, 237, 0.3);
  transform: translateY(-2px);
}

.btn-primary:active {
  transform: scale(0.96) translateY(0);
  box-shadow: 0 0 10px var(--accent-purple-glow);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-secondary {
  flex: 1;
  padding: var(--space-sm) var(--space-lg);
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-base);
}

.btn-secondary:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  border-color: var(--border-glass-active);
  transform: translateY(-1px);
}

.btn-secondary:active {
  transform: scale(0.97);
}

.btn-danger {
  flex: 1;
  padding: var(--space-sm) var(--space-lg);
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: var(--radius-md);
  color: var(--accent-red);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-base);
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.25);
  border-color: rgba(239, 68, 68, 0.5);
}

.btn-success {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  border: none;
  border-radius: var(--radius-md);
  color: white;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-base);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.2);
}

.btn-success:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(16, 185, 129, 0.3);
  filter: brightness(1.1);
}
/* ---------- Task Delete Button ---------- */
.task-delete-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.25);
  color: var(--accent-red);
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all var(--transition-fast);
  opacity: 1;
  -webkit-tap-highlight-color: transparent;
}

.task-card:hover .task-delete-btn {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.4);
}

/* Always show on touch devices */
@media (hover: none) {
  .task-delete-btn {
    opacity: 0.6;
  }
}

.task-delete-btn:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.3);
  color: var(--accent-red);
}

/* ---------- Footer ---------- */
.app-footer {
  text-align: center;
  padding: var(--space-lg) 0;
  padding-bottom: calc(var(--space-lg) + 70px);
  color: var(--text-dim);
  font-size: 0.7rem;
  letter-spacing: 0.05em;
}

/* ---------- Animations ---------- */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

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

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

@keyframes pulse-scale {
  0% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.2); opacity: 0.7; }
  100% { transform: scale(1); opacity: 1; }
}

.badge-count {
  background: var(--accent-red);
  color: white;
  font-size: 0.7rem;
  padding: 2px 6px;
  border-radius: 10px;
  font-weight: 700;
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.4);
}

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

@keyframes taskComplete {
  0% { transform: scale(1); }
  30% { transform: scale(1.02); }
  100% { transform: scale(1); opacity: 0.5; }
}

@keyframes bounce {
  0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
  40% { transform: translateY(-15px); }
  60% { transform: translateY(-7px); }
}

@keyframes confettiFall {
  0% { transform: translateY(-100vh) rotate(0deg); opacity: 1; }
  100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}

/* Stagger animation delays for task cards */
.task-card:nth-child(1) { animation-delay: 0ms; }
.task-card:nth-child(2) { animation-delay: 50ms; }
.task-card:nth-child(3) { animation-delay: 100ms; }
.task-card:nth-child(4) { animation-delay: 150ms; }
.task-card:nth-child(5) { animation-delay: 200ms; }
.task-card:nth-child(6) { animation-delay: 250ms; }

.task-card {
  animation: slideUp 0.4s ease backwards;
}

.member-remove-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
  transition: all var(--transition-base);
  display: flex;
  align-items: center;
  justify-content: center;
}

.member-remove-btn:hover {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
}

/* ---------- Responsive ---------- */
@media (min-width: 480px) {
  #app {
    padding: var(--space-xl);
  }

  .user-picker-grid {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  }

  .stats-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 768px) {
  .stats-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (min-width: 900px) {
  #app {
    max-width: 560px;
  }
  .app-header {
    max-width: 560px;
  }
}

/* Very small phones */
@media (max-width: 360px) {
  :root {
    --space-lg: 16px;
    --space-xl: 24px;
  }

  html {
    font-size: 14px;
  }

  .header-left h1 {
    font-size: 1rem;
  }

  .user-picker-grid {
    grid-template-columns: 1fr;
  }

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

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar {
  width: 4px;
}

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

::-webkit-scrollbar-thumb {
  background: var(--border-glass);
  border-radius: var(--radius-full);
}

/* ---------- Selection ---------- */
::selection {
  background: var(--accent-purple);
  color: white;
}

/* ---------- Safe area for notched phones ---------- */
@supports (padding: env(safe-area-inset-top)) {
  body {
    padding-top: env(safe-area-inset-top);
  }
}
/* Voice Input */
.input-with-icon {
  position: relative;
  display: flex;
  align-items: center;
}

.input-with-icon input {
  padding-right: 40px !important;
}

.voice-btn {
  position: absolute;
  right: 8px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  border-radius: 50%;
}

.voice-btn:hover {
  color: var(--accent-blue);
  background: rgba(59, 130, 246, 0.1);
}

.voice-btn.listening {
  color: #ef4444;
  animation: pulse-red 1.5s infinite;
}

@keyframes pulse-red {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
  70% { transform: scale(1.1); box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

/* ---------- Test FMS ---------- */
#test-tracker-container {
  animation: fadeIn 0.4s ease;
}

/* Section Header */
.test-fms-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-md) var(--space-md) var(--space-sm);
  margin-bottom: var(--space-xs);
  gap: 10px;
  flex-wrap: wrap;
}

.test-fms-title {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.test-fms-title-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgba(124,58,237,0.2), rgba(167,139,250,0.1));
  border: 1px solid rgba(124,58,237,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.test-fms-title h2 {
  font-size: 1.25rem;
  font-weight: 800;
  background: linear-gradient(135deg, #c4b5fd, #7c3aed);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.test-fms-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
}

@media (max-width: 400px) {
  .test-fms-actions {
    width: 100%;
    justify-content: flex-end;
  }
}

/* Search & Sort Bar */
.test-fms-toolbar {
  display: flex;
  gap: 10px;
  padding: 0 var(--space-md);
  margin-bottom: var(--space-sm);
  align-items: center;
}

.test-fms-search-wrap {
  position: relative;
  flex: 2;
  min-width: 0;
}

.test-fms-search-wrap svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.test-fms-search-input {
  width: 100%;
  padding: 9px 12px 9px 36px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.85rem;
  outline: none;
  transition: all var(--transition-base);
  font-family: inherit;
}

.test-fms-search-input:focus {
  border-color: rgba(124,58,237,0.4);
  background: rgba(124,58,237,0.05);
  box-shadow: 0 0 0 3px rgba(124,58,237,0.08);
}

.test-fms-search-input::placeholder { color: var(--text-muted); }

.test-fms-sort-wrap {
  position: relative;
  flex: 1;
  min-width: 150px;
}

/* Filter Tabs — pill style */
.test-fms-tabs {
  display: flex;
  gap: var(--space-xs);
  padding: var(--space-xs) var(--space-md);
  margin-bottom: var(--space-md);
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

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

.test-fms-tabs .tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border-glass);
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--transition-base);
  white-space: nowrap;
  flex-shrink: 0;
  font-family: inherit;
}

.test-fms-tabs .tab-btn:hover {
  background: rgba(255,255,255,0.08);
  color: var(--text-secondary);
  border-color: var(--border-glass-active);
}

.test-fms-tabs .tab-btn.active {
  background: linear-gradient(135deg, rgba(124,58,237,0.2), rgba(167,139,250,0.1));
  border-color: rgba(124,58,237,0.4);
  color: #c4b5fd;
  box-shadow: 0 0 12px rgba(124,58,237,0.15);
}

/* Premium Subject Badges */
.subject-badge {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  font-size: 0.65rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  margin-bottom: var(--space-xs);
  transition: all var(--transition-base);
}

.subject-badge.subject-science {
  background: rgba(16, 185, 129, 0.12);
  color: var(--accent-emerald);
  border: 1px solid rgba(16, 185, 129, 0.25);
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.05);
}

.subject-badge.subject-math {
  background: rgba(99, 102, 241, 0.12);
  color: var(--accent-indigo);
  border: 1px solid rgba(99, 102, 241, 0.25);
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.05);
}

/* Type pill (App / Sheet) on test card */
.test-type-pill {
  display: inline-flex;
  align-items: center;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  color: var(--text-muted);
}

/* Status badges on test cards */
.test-status-badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.test-status-badge.status-complete {
  background: rgba(16,185,129,0.12);
  color: var(--accent-emerald);
  border: 1px solid rgba(16,185,129,0.25);
}

.test-status-badge.status-overdue {
  background: rgba(239,68,68,0.12);
  color: var(--accent-red);
  border: 1px solid rgba(239,68,68,0.25);
  animation: pulse-opacity 2s ease-in-out infinite;
}

.test-status-badge.status-progress {
  background: rgba(124,58,237,0.12);
  color: #c4b5fd;
  border: 1px solid rgba(124,58,237,0.25);
}

/* Completed card — subtle green tint */
.test-card.complete {
  border-color: rgba(16,185,129,0.15);
}
.test-card.complete::after {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 3px;
  height: 100%;
  background: var(--accent-emerald);
  border-radius: 0 var(--radius-xl) var(--radius-xl) 0;
  opacity: 0.6;
}

/* Staggered entrance for test cards */
.test-card { animation: slideUp 0.35s ease backwards; }
.test-card:nth-child(1) { animation-delay: 0ms; }
.test-card:nth-child(2) { animation-delay: 40ms; }
.test-card:nth-child(3) { animation-delay: 80ms; }
.test-card:nth-child(4) { animation-delay: 120ms; }
.test-card:nth-child(5) { animation-delay: 160ms; }
.test-card:nth-child(6) { animation-delay: 200ms; }
.test-card:nth-child(7) { animation-delay: 240ms; }
.test-card:nth-child(8) { animation-delay: 280ms; }

/* 2-column meta grid inside test cards */
.test-meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 16px;
  margin-bottom: 8px;
}

.meta-col {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.meta-kv {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px;
}

.meta-k {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-dim);
  font-weight: 700;
  flex-shrink: 0;
}

.meta-v {
  font-size: 0.82rem;
  color: var(--text-secondary);
  font-weight: 600;
  text-align: right;
}

.meta-v.meta-bold {
  color: var(--text-primary);
  font-weight: 800;
}

/* Drag and Drop list styling in Settings */
.setting-row {
  transition: transform var(--transition-base), box-shadow var(--transition-base), opacity var(--transition-base);
}

.setting-row:active {
  cursor: grabbing !important;
  transform: scale(0.985);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.drag-handle {
  user-select: none;
  cursor: grab;
  transition: color var(--transition-base);
}

/* =============================================
   Dark Theme Select / Dropdown Fix
============================================= */
select {
  background-color: #12121f;
  color: var(--text-normal);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
}

select option {
  background-color: #12121f;
  color: var(--text-normal);
  padding: 6px 12px;
}

select option:checked,
select option:hover {
  background-color: #2d2d4e;
  color: #fff;
}

/* =============================================
   Unified Custom Dropdown Menu & Options
   (sort dropdown, chapter dropdown, etc.)
   ============================================= */
.custom-dropdown-menu {
  background: #0f0f23;
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  box-shadow: 0 12px 40px rgba(0,0,0,0.7);
  overflow: hidden;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

/* Shared option style for ALL custom dropdowns */
.sort-option,
.chapter-option,
.class-option,
.subject-option {
  padding: 9px 14px;
  font-size: 0.82rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.13s ease, color 0.13s ease, border-left-color 0.13s ease;
  border-left: 2px solid transparent;
  white-space: nowrap;
  line-height: 1.4;
  font-family: inherit;
}

.sort-option:hover,
.chapter-option:hover,
.class-option:hover,
.subject-option:hover {
  background: rgba(124, 58, 237, 0.1);
  color: var(--text-primary);
  border-left-color: rgba(124, 58, 237, 0.5);
}

.sort-option.active-sort,
.chapter-option.selected,
.class-option.selected,
.subject-option.selected {
  background: rgba(124, 58, 237, 0.12);
  color: var(--accent-purple);
  font-weight: 600;
  border-left-color: var(--accent-purple);
}

.chapter-option.custom-option {
  color: var(--accent-purple);
  border-top: 1px solid var(--border-glass);
}

.chapter-option.chapter-placeholder {
  color: var(--text-dim);
  font-style: italic;
}

/* Trigger button shared style for custom dropdowns */
.custom-dropdown-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 0.82rem;
  cursor: pointer;
  outline: none;
  transition: all var(--transition-base);
  font-family: inherit;
  text-align: left;
}

.custom-dropdown-btn:hover,
.custom-dropdown-btn:focus {
  border-color: rgba(124,58,237,0.35);
  background: rgba(124,58,237,0.05);
  color: var(--text-primary);
}

/* Test FMS Premium Tabs */
.test-fms-tabs {
  margin-bottom: var(--space-md);
  overflow-x: auto;
  overflow-y: hidden;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  white-space: nowrap;
  scrollbar-width: none;
}

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

.test-fms-tabs .tab-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 600;
  padding: var(--space-xs) var(--space-md);
  cursor: pointer;
  position: relative;
  transition: all var(--transition-base);
  border-bottom: 2px solid transparent;
  display: inline-block;
  white-space: nowrap;
  flex-shrink: 0;
}

.test-fms-tabs .tab-btn:hover {
  color: var(--text-normal);
}

.test-fms-tabs .tab-btn.active {
  color: var(--accent-purple);
  border-bottom-color: var(--accent-purple);
  text-shadow: 0 0 10px rgba(139, 92, 246, 0.15);
}

/* Settings Modal Premium Segmented Tabs */
.test-settings-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  background: rgba(255, 255, 255, 0.02) !important;
  padding: 4px !important;
  border-radius: var(--radius-lg) !important;
  border: 1px solid var(--border-glass) !important;
  overflow-x: auto;
  scrollbar-width: none;
}

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

.test-settings-tabs .tab-btn {
  flex: 1;
  background: transparent !important;
  border: 1px solid transparent !important;
  color: var(--text-muted) !important;
  font-size: 0.8rem !important;
  font-weight: 600 !important;
  padding: 10px 14px !important;
  border-radius: var(--radius-md) !important;
  cursor: pointer !important;
  transition: all var(--transition-base) !important;
  display: inline-flex;
  align-items: center !important;
  justify-content: center !important;
  gap: 6px !important;
  font-family: inherit !important;
  box-shadow: none !important;
  white-space: nowrap;
  flex-shrink: 0;
}

.test-settings-tabs .tab-btn:hover {
  color: var(--text-normal) !important;
  background: rgba(255, 255, 255, 0.04) !important;
  border-color: rgba(255, 255, 255, 0.05) !important;
}

.test-settings-tabs .tab-btn.active {
  background: var(--gradient-purple) !important;
  color: white !important;
  border-color: rgba(255, 255, 255, 0.1) !important;
  box-shadow: var(--shadow-glow-purple) !important;
  font-weight: 700 !important;
}
/* =============================================
   Test Cards
   ============================================= */
.test-card {
  background: linear-gradient(145deg, rgba(255,255,255,0.045), rgba(255,255,255,0.015));
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-xl);
  padding: var(--space-md) var(--space-md) var(--space-sm);
  margin-bottom: var(--space-md);
  display: flex;
  flex-direction: column;
  gap: 0;
  transition: all var(--transition-slow) ease, gap var(--transition-base) ease;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.test-card:hover {
  border-color: rgba(124,58,237,0.2);
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(0,0,0,0.3), 0 0 0 1px rgba(124,58,237,0.08);
}

/* Expand / Collapse pipeline animations */
.test-card .test-pipeline {
  max-height: 0;
  opacity: 0;
  margin-top: 0;
  padding-bottom: 0;
  overflow: hidden;
  transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1), 
              opacity 0.25s ease, 
              margin-top 0.3s ease, 
              padding-bottom 0.3s ease;
  pointer-events: none;
}

.test-card.expanded {
  gap: var(--space-md);
}

.test-card.expanded .test-pipeline {
  max-height: 2000px; /* high enough for all vertical steps to display without cutoff */
  opacity: 1;
  margin-top: var(--space-md);
  padding-bottom: var(--space-sm);
  pointer-events: auto;
}

.test-card.expanded .expand-chevron {
  transform: rotate(180deg);
  color: var(--accent-purple) !important;
}


.test-card.overdue {
  border-left: 3px solid rgba(239,68,68,0.7);
  background: linear-gradient(145deg, rgba(239,68,68,0.04), rgba(255,255,255,0.01));
}

.test-card.overdue::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at left center, rgba(239,68,68,0.06), transparent 60%);
  pointer-events: none;
  border-radius: inherit;
}

.test-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-md);
}

.test-title-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-width: 0;
}

.test-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.test-meta-info {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  margin-top: 2px;
  align-items: center;
}

.meta-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

.meta-item .label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-dim);
  font-weight: 700;
}

.meta-item .val {
  font-size: 0.78rem;
  color: var(--text-secondary);
  font-weight: 600;
  background: rgba(255,255,255,0.05);
  padding: 1px 7px;
  border-radius: var(--radius-full);
  border: 1px solid rgba(255,255,255,0.06);
}

.test-pipeline {
  display: flex;
  flex-direction: column;
  position: relative;
  gap: 6px;
  padding-top: var(--space-sm);
  padding-bottom: var(--space-xs);
}

.pipeline-step {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 10px;
  width: 100%;
  position: relative;
  z-index: 1;
}

.pipeline-step-left {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  flex-shrink: 0;
  width: 28px;
}

/* Connecting line */
.pipeline-step-left::after {
  content: '';
  flex: 1;
  width: 2px;
  background: var(--border-glass);
  margin-top: 4px;
  border-radius: 1px;
  min-height: 8px;
}

.pipeline-step:last-child .pipeline-step-left::after {
  display: none;
}

.step-indicator {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bg-secondary);
  border: 2px solid var(--border-glass);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  transition: all var(--transition-base);
  flex-shrink: 0;
}

.step-details {
  flex: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 12px;
  background: rgba(255,255,255,0.025);
  border: 1px solid var(--border-glass);
  padding: 8px 12px;
  border-radius: var(--radius-md);
  transition: all var(--transition-base);
  margin-bottom: 6px;
  cursor: pointer;
}

.pipeline-step:hover .step-details {
  background: rgba(255,255,255,0.05);
  border-color: var(--border-glass-active);
}

.pipeline-step.done .step-details {
  background: rgba(16,185,129,0.05);
  border-color: rgba(16,185,129,0.15);
}

.pipeline-step.delayed .step-details {
  background: rgba(239,68,68,0.05);
  border-color: rgba(239,68,68,0.15);
}

.step-main-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.step-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
}

.step-date {
  font-size: 0.72rem;
  color: var(--text-dim);
}

.step-meta-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 0.72rem;
  color: var(--text-secondary);
  text-align: right;
}

.step-meta-info strong {
  color: var(--text-dim);
  font-weight: 500;
}

.pipeline-step.done .step-label { color: var(--accent-emerald); }
.pipeline-step.current .step-label { color: var(--text-primary); }
.pipeline-step.delayed .step-label { color: var(--accent-red); }

.pipeline-step.done .step-indicator {
  background: var(--accent-emerald);
  border-color: var(--accent-emerald);
  color: white;
  box-shadow: var(--shadow-glow-emerald);
}

.pipeline-step.current .step-indicator {
  background: var(--bg-secondary);
  border-color: var(--accent-purple);
  color: var(--accent-purple);
  box-shadow: var(--shadow-glow-purple);
}

.pipeline-step.delayed .step-indicator {
  background: rgba(239,68,68,0.15);
  border-color: var(--accent-red);
  color: var(--accent-red);
  box-shadow: 0 0 10px var(--accent-red-glow);
  animation: pulse-opacity 2s ease-in-out infinite;
}

/* Button Enhancements */
.btn-ghost {
  background: transparent;
  border: 1px solid var(--border-glass);
  color: var(--text-secondary);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-base);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-ghost:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-glass-active);
  color: var(--text-primary);
  transform: translateY(-1px);
}

.btn-ghost.btn-sm {
  padding: 4px 10px;
  font-size: 0.7rem;
}

.btn-primary.btn-sm {
  padding: 6px 14px;
  font-size: 0.8rem;
  box-shadow: 0 4px 12px var(--accent-purple-glow);
}

.btn-secondary.btn-sm {
  padding: 6px 14px;
  font-size: 0.8rem;
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  color: var(--text-primary);
}

.btn-secondary.btn-sm:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-glass-active);
}

/* ---------- iOS Install Prompt ---------- */
.ios-install-prompt {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 32px);
  max-width: 400px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: var(--space-md);
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: var(--space-md);
  animation: iosSlideUp 0.5s var(--transition-spring) forwards;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

@keyframes iosSlideUp {
  from { opacity: 0; transform: translate(-50%, 40px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

.ios-install-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  flex-shrink: 0;
  object-fit: cover;
}

.ios-install-content {
  flex: 1;
}

.ios-install-content h4 {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 4px;
  color: var(--text-primary);
}

.ios-install-content p {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.ios-install-close {
  background: rgba(255, 255, 255, 0.05);
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 10px;
  margin: -10px;
  font-size: 1.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all var(--transition-fast);
  z-index: 1001;
  touch-action: manipulation;
}

.ios-install-close:active {
  background: rgba(255, 255, 255, 0.1);
  transform: scale(0.9);
}

.ios-share-icon {
  display: inline-block;
  vertical-align: middle;
  width: 20px;
  height: 20px;
  margin: 0 4px;
}

/* ============================================
   Desktop Layout — PC / Wide Screen Fix
   ============================================ */
@media (min-width: 768px) {

  /* Expand the main app content area */
  #app {
    max-width: 860px;
    padding-left: var(--space-xl);
    padding-right: var(--space-xl);
    /* Single-row header is ~64px tall on desktop */
    padding-top: calc(72px + var(--space-md));
  }

  /* Header spans full viewport width, single row */
  .app-header {
    left: 0;
    transform: none;
    max-width: 100%;
    width: 100%;
    flex-wrap: nowrap;
    min-height: 64px;
    padding: 0 var(--space-xl);
    gap: var(--space-md);
    align-items: center;
  }

  /* Remove the forced line-break pseudo-element */
  .app-header::after {
    display: none;
  }

  /* Logo + greeting side-by-side on desktop */
  .header-left {
    flex-direction: row;
    align-items: center;
    gap: var(--space-sm);
    flex: 0 0 auto;
  }

  .header-left .greeting {
    margin-top: 0;
    white-space: nowrap;
  }

  /* Nav pill stays centered using margin auto */
  .header-center {
    order: 0;
    flex: 1;
    justify-content: safe center;
    margin-top: 0;
    overflow-x: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.25) transparent;
    cursor: grab;
  }

  .header-center:active {
    cursor: grabbing;
  }

  .header-center::-webkit-scrollbar {
    display: block !important;
    height: 4px;
  }

  .header-center::-webkit-scrollbar-track {
    background: transparent;
  }

  .header-center::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 99px;
  }

  .header-center::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.35);
  }

  /* Right controls */
  .header-right {
    flex: 0 0 auto;
  }

  /* Show logout label text on desktop */
  .logout-btn span {
    display: inline;
  }

  /* Widen task cards slightly for better readability */
  .task-card:hover {
    transform: translateX(6px);
  }

  /* Test FMS section header spacing */
  #test-tracker-container .section-header {
    padding: 0;
  }

  /* Broadcast + error banners full width */
  .broadcast-banner,
  .error-banner {
    max-width: 860px;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
  }
}

@media (min-width: 1100px) {
  #app {
    max-width: 1000px;
  }
  .broadcast-banner,
  .error-banner {
    max-width: 1000px;
  }
}

/* Parents Checklist Interactive Row Styles */
.parents-checklist-row {
  transition: all var(--transition-base) !important;
}
.parents-checklist-row:hover {
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.04) !important;
  border-color: rgba(255, 255, 255, 0.18) !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
}
.parents-checklist-row:active {
  transform: translateY(0);
}

/* Custom coloring for Before Fee and After Fee pills & tabs */
.test-type-pill.type-beforefee,
.test-fms-tabs .tab-btn[data-filter="beforefee"].active {
  color: var(--accent-amber) !important;
  border-bottom-color: var(--accent-amber) !important;
  text-shadow: 0 0 10px rgba(245, 158, 11, 0.2) !important;
}

.test-fms-tabs .tab-btn[data-filter="beforefee"] {
  transition: all var(--transition-base);
}
.test-fms-tabs .tab-btn[data-filter="beforefee"]:hover {
  color: var(--accent-amber) !important;
  opacity: 0.85;
}

.test-type-pill.type-afterfee,
.test-fms-tabs .tab-btn[data-filter="afterfee"].active {
  color: var(--accent-emerald) !important;
  border-bottom-color: var(--accent-emerald) !important;
  text-shadow: 0 0 10px rgba(16, 185, 129, 0.2) !important;
}

.test-fms-tabs .tab-btn[data-filter="afterfee"] {
  transition: all var(--transition-base);
}
.test-fms-tabs .tab-btn[data-filter="afterfee"]:hover {
  color: var(--accent-emerald) !important;
  opacity: 0.85;
}

/* Card type pill distinct styles */
.test-type-pill.type-beforefee {
  background: rgba(245, 158, 11, 0.1) !important;
  border: 1px solid rgba(245, 158, 11, 0.25) !important;
  color: var(--accent-amber) !important;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-weight: 700;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.test-type-pill.type-afterfee {
  background: rgba(16, 185, 129, 0.1) !important;
  border: 1px solid rgba(16, 185, 129, 0.25) !important;
  color: var(--accent-emerald) !important;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-weight: 700;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* Segmented Control Scrollable Support */
.segmented-control {
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.segmented-control::-webkit-scrollbar {
  display: none;
}
.segmented-control .segment-btn {
  flex-shrink: 0 !important;
  white-space: nowrap !important;
}

/* Student Tab Webhook Styles */
.pulse-indicator {
  animation: pulseGlow 2s infinite;
}
@keyframes pulseGlow {
  0% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  }
  70% {
    transform: scale(1);
    box-shadow: 0 0 0 6px rgba(16, 185, 129, 0);
  }
  100% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
  }
}

/* =============================================
   CALENDAR VIEW STYLING
   ============================================= */
.calendar-container {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: var(--space-md);
  margin-bottom: var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.calendar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-glass);
  padding-bottom: 12px;
}

.calendar-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.calendar-nav {
  display: flex;
  gap: 8px;
}

.calendar-nav-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-glass);
  color: var(--text-primary);
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  transition: all 0.2s ease;
}

.calendar-nav-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.2);
}

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

.calendar-day-label {
  text-align: center;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 4px 0;
  border-bottom: 1px solid var(--border-glass);
}

.calendar-cell {
  min-height: 95px;
  background: rgba(255, 255, 255, 0.01);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: background 0.2s, border-color 0.2s;
  overflow: hidden;
}

.calendar-cell:hover {
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(255, 255, 255, 0.15);
}

.calendar-cell.today {
  background: rgba(124, 58, 237, 0.08);
  border-color: rgba(124, 58, 237, 0.35);
  box-shadow: inset 0 0 10px rgba(124, 58, 237, 0.05);
}

.calendar-cell.other-month {
  opacity: 0.25;
}

.calendar-day-num {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  align-self: flex-end;
  line-height: 1;
}

.calendar-cell.today .calendar-day-num {
  color: var(--accent-purple);
  background: rgba(124, 58, 237, 0.2);
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 0.7rem;
}

.calendar-task-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
  overflow-y: auto;
  flex: 1;
  max-height: 70px;
}

/* Hide scrollbars inside cells */
.calendar-task-list::-webkit-scrollbar {
  display: none;
}
.calendar-task-list {
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.calendar-task-item {
  font-size: 0.65rem;
  padding: 3px 5px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  font-weight: 600;
  transition: transform 0.1s ease, filter 0.1s ease;
  line-height: 1.2;
}

.calendar-task-item:hover {
  transform: translateY(-1px);
  filter: brightness(1.15);
}

.calendar-task-item.status-done {
  background: rgba(16, 185, 129, 0.12);
  color: var(--accent-emerald);
  border-left: 2px solid var(--accent-emerald);
  text-decoration: line-through;
}

.calendar-task-item.status-pending {
  background: rgba(59, 130, 246, 0.12);
  color: #3b82f6;
  border-left: 2px solid #3b82f6;
}

.calendar-task-item.status-in-progress {
  background: rgba(124, 58, 237, 0.12);
  color: var(--accent-purple);
  border-left: 2px solid var(--accent-purple);
}

.calendar-task-item.status-stuck {
  background: rgba(245, 158, 11, 0.12);
  color: var(--accent-amber);
  border-left: 2px solid var(--accent-amber);
}

.calendar-task-item.status-overdue,
.calendar-task-item.status-missed {
  background: rgba(239, 68, 68, 0.12);
  color: var(--accent-red);
  border-left: 2px solid var(--accent-red);
}

@media (max-width: 600px) {
  .calendar-cell {
    min-height: 70px;
    padding: 3px;
  }
  .calendar-task-item {
    font-size: 0.55rem;
    padding: 2px;
  }
  .calendar-day-label {
    font-size: 0.6rem;
  }
}

/* Voice Search Mic Pulse Animation */
.mic-listening {
  color: #ef4444 !important; /* var(--accent-red) */
  animation: mic-pulse 1.2s infinite ease-in-out;
}

@keyframes mic-pulse {
  0% {
    transform: translateY(-50%) scale(1);
    opacity: 1;
  }
  50% {
    transform: translateY(-50%) scale(1.25);
    opacity: 0.6;
  }
  100% {
    transform: translateY(-50%) scale(1);
    opacity: 1;
  }
}

/* ============================================
   Weekly Review Ritual & Task Completion Styles
   ============================================ */
.leaderboard-table th {
  font-weight: 700;
  font-size: 0.8rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border-glass);
}
.leaderboard-table td {
  padding: 16px var(--space-md);
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-glass);
  vertical-align: middle;
}
.leaderboard-table tr:hover {
  background: rgba(255, 255, 255, 0.015);
}

/* Light theme overrides */
.light-theme .leaderboard-table th {
  color: var(--text-secondary);
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}
.light-theme .leaderboard-table td {
  color: var(--text-primary);
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}
.light-theme .leaderboard-table tr:hover {
  background: rgba(0, 0, 0, 0.01);
}
.light-theme #weekly-review-container .kpi-card {
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.08);
}
.light-theme #task-completion-modal .modal-card {
  background: #ffffff;
}
.light-theme #task-completion-modal textarea {
  background: #f1f5f9;
  color: #1e293b;
  border-color: rgba(0, 0, 0, 0.1);
}
.light-theme #task-completion-modal div {
  background: #f8fafc;
  border-color: rgba(0, 0, 0, 0.05);
}

/* ---------- Student Report & Loading Spinner ---------- */
.loading-spinner {
  width: 28px;
  height: 28px;
  border: 3px solid rgba(255, 255, 255, 0.08);
  border-top-color: var(--accent-purple);
  border-radius: 50%;
  animation: loading-spin 0.8s linear infinite;
}
.light-theme .loading-spinner {
  border-color: rgba(0, 0, 0, 0.06);
  border-top-color: var(--accent-purple);
}
@keyframes loading-spin {
  to { transform: rotate(360deg); }
}

.iframe-container {
  position: relative;
  width: 100%;
  height: 650px;
  background: rgba(255, 255, 255, 0.015);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(10px);
}
.light-theme .iframe-container {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.08);
}
.iframe-loader {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-md);
  background: var(--bg-secondary);
  z-index: 5;
  transition: opacity var(--transition-base);
}
.light-theme .iframe-loader {
  background: var(--bg-primary);
}

@media (max-width: 600px) {
  .iframe-container {
    height: 500px;
  }
}
