/* ============================================
   AULAPRO - Design System
   Color Palette & Variables
   ============================================ */
:root {
  --primary: #6450E8;
  --primary-light: #7C6CF0;
  --primary-dark: #4F3DD6;
  --primary-bg: #EDE9FF;
  --primary-bg2: #F3F0FF;
  --secondary: #5ECF7B;
  --warning: #F3C94B;
  --danger: #F46D6D;
  --info: #63B3FF;
  --purple-soft: #9D8DF5;

  --bg: #F5F4FA;
  --surface: #FFFFFF;
  --surface2: #F9F8FF;
  --border: #ECECF3;
  --border2: #E0DEF7;

  --text-primary: #1D1B31;
  --text-secondary: #6F7180;
  --text-muted: #A0A3B1;
  --text-white: #FFFFFF;

  --shadow-sm: 0 2px 8px rgba(100,80,232,0.08);
  --shadow-md: 0 4px 20px rgba(100,80,232,0.12);
  --shadow-lg: 0 8px 32px rgba(100,80,232,0.18);

  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --radius-full: 999px;

  --nav-height: 65px;
  --header-height: 60px;
}

/* Dark mode */
.dark-mode {
  --bg: #12131A;
  --surface: #1E1F2B;
  --surface2: #252636;
  --border: #2E2F42;
  --border2: #3A3B55;
  --text-primary: #F0EEFF;
  --text-secondary: #A0A3C0;
  --text-muted: #6B6D85;
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 20px rgba(0,0,0,0.4);
}

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

html {
  height: 100%;
  overscroll-behavior: none;
}

body {
  font-family: 'Poppins', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  height: 100%;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  user-select: none;
  -webkit-user-select: none;
}

#app {
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  max-width: 430px;
  margin: 0 auto;
  position: relative;
  background: var(--bg);
  box-shadow: 0 0 60px rgba(0,0,0,0.15);
}

/* ============================================
   Screen System
   ============================================ */
.screen {
  display: none;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  animation: fadeIn 0.25s ease;
}
.screen.active { display: flex; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes scaleIn {
  from { transform: scale(0.92); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}
@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}
@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

/* ============================================
   Scrollable Content Area
   ============================================ */
.scroll-area {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  padding-bottom: calc(var(--nav-height) + 16px);
}
.scroll-area::-webkit-scrollbar { display: none; }

/* ============================================
   Top Header / App Bar
   ============================================ */
.app-bar {
  background: var(--surface);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border);
  min-height: var(--header-height);
  position: relative;
  z-index: 10;
}
.app-bar-title {
  flex: 1;
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}
.app-bar-subtitle {
  font-size: 12px;
  font-weight: 400;
  color: var(--text-secondary);
  display: block;
  letter-spacing: 0;
}
.back-btn {
  width: 38px; height: 38px;
  border-radius: var(--radius-sm);
  background: var(--primary-bg);
  border: none;
  color: var(--primary);
  font-size: 16px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}
.back-btn:active { transform: scale(0.92); background: var(--primary-bg2); }

.icon-btn {
  width: 38px; height: 38px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 18px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}
.icon-btn:active { transform: scale(0.92); background: var(--primary-bg); color: var(--primary); }
.icon-btn.primary { background: var(--primary-bg); color: var(--primary); }

/* ============================================
   Bottom Navigation
   ============================================ */
.bottom-nav {
  height: var(--nav-height);
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 0 8px;
  flex-shrink: 0;
  position: relative;
  z-index: 100;
}
.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 4px;
  background: none;
  border: none;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all 0.2s;
  color: var(--text-muted);
}
.nav-item i { font-size: 20px; transition: all 0.2s; }
.nav-item span { font-size: 10px; font-weight: 500; }
.nav-item.active { color: var(--primary); }
.nav-item.active i { transform: translateY(-2px); }
.nav-item:active { background: var(--primary-bg); }

/* ============================================
   Tab Bar
   ============================================ */
.tab-bar {
  background: var(--surface);
  padding: 0 16px;
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  flex-shrink: 0;
}
.tab-bar::-webkit-scrollbar { display: none; }
.tab-item {
  padding: 12px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  background: none;
  border: none;
  border-bottom: 2.5px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
}
.tab-item.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 600;
}
.tab-item:active { background: var(--primary-bg); }

/* ============================================
   Cards
   ============================================ */
.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}
.card-purple {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: white;
  border: none;
}
.card-soft {
  background: var(--primary-bg2);
  border-color: var(--border2);
}

/* ============================================
   Buttons
   ============================================ */
.btn {
  border: none;
  border-radius: var(--radius-full);
  padding: 14px 24px;
  font-family: 'Poppins', sans-serif;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(0.96); }

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: white;
  box-shadow: 0 4px 16px rgba(100,80,232,0.35);
}
.btn-primary:active { box-shadow: 0 2px 8px rgba(100,80,232,0.25); }

.btn-secondary {
  background: var(--primary-bg);
  color: var(--primary);
}

.btn-ghost {
  background: transparent;
  color: var(--primary);
  border: 1.5px solid var(--primary);
}

.btn-danger {
  background: #FFF0F0;
  color: var(--danger);
}

.btn-success {
  background: #EDFAF3;
  color: var(--secondary);
}

.btn-full { width: 100%; }

.btn-sm {
  padding: 8px 16px;
  font-size: 13px;
}
.btn-xs {
  padding: 6px 12px;
  font-size: 12px;
}

.fab {
  width: 52px; height: 52px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: white;
  border: none;
  font-size: 20px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-lg);
  transition: all 0.2s;
}
.fab:active { transform: scale(0.92); }

/* ============================================
   Badges / Chips
   ============================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
}
.badge-purple { background: var(--primary-bg); color: var(--primary); }
.badge-green { background: #EDFAF3; color: #27AE60; }
.badge-yellow { background: #FFFBEC; color: #D4920A; }
.badge-red { background: #FFF0F0; color: #E03E3E; }
.badge-blue { background: #EBF4FF; color: #2563EB; }
.badge-gray { background: var(--bg); color: var(--text-secondary); }

/* ============================================
   Stat Cards Row
   ============================================ */
.stats-row {
  display: flex;
  gap: 10px;
  padding: 14px 16px 0;
}
.stat-card {
  flex: 1;
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 12px 10px;
  text-align: center;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.stat-card .stat-num {
  font-size: 22px;
  font-weight: 800;
  line-height: 1;
  margin-bottom: 3px;
}
.stat-card .stat-label {
  font-size: 10px;
  color: var(--text-secondary);
  font-weight: 500;
}
.stat-present { color: var(--secondary); }
.stat-absent { color: var(--danger); }
.stat-late { color: var(--warning); }

/* ============================================
   Section Headers
   ============================================ */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 16px 8px;
}
.section-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.2px;
}
.section-action {
  font-size: 12px;
  color: var(--primary);
  font-weight: 600;
  background: none;
  border: none;
  cursor: pointer;
}

/* ============================================
   Student List Items
   ============================================ */
.student-list { padding: 0 16px; }

.student-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--surface);
  border-radius: var(--radius-md);
  margin-bottom: 8px;
  border: 1px solid var(--border);
  transition: all 0.2s;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}
.student-item:active { transform: scale(0.98); background: var(--surface2); }

.student-avatar {
  width: 40px; height: 40px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--primary-bg), var(--primary-bg2));
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: var(--primary);
  flex-shrink: 0;
  overflow: hidden;
}
.student-avatar img { width: 100%; height: 100%; object-fit: cover; }

.student-num {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  min-width: 20px;
  flex-shrink: 0;
}

.student-info { flex: 1; min-width: 0; }
.student-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.student-meta {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 1px;
}

.student-action { flex-shrink: 0; }

/* Attendance status indicators */
.status-dot {
  width: 32px; height: 32px;
  border-radius: var(--radius-full);
  display: flex; align-items: center; justify-content: center;
  font-size: 15px;
  cursor: pointer;
  transition: all 0.15s;
}
.status-dot:active { transform: scale(0.88); }
.status-present { background: #EDFAF3; color: #27AE60; }
.status-absent { background: #FFF0F0; color: var(--danger); }
.status-late { background: #FFFBEC; color: #D4920A; }
.status-none { background: var(--bg); color: var(--text-muted); }

/* Swipe reveal */
.swipe-container {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-md);
  margin-bottom: 8px;
}
.swipe-behind {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  display: flex;
  align-items: center;
  border-radius: var(--radius-md);
}
.swipe-left {
  background: var(--danger);
  justify-content: flex-end;
  padding-right: 20px;
}
.swipe-right {
  background: var(--warning);
  justify-content: flex-start;
  padding-left: 20px;
}
.swipe-label {
  font-size: 12px;
  font-weight: 700;
  color: white;
  display: flex;
  align-items: center;
  gap: 6px;
}
.swipe-front {
  position: relative;
  z-index: 1;
  transform: translateX(0);
  transition: transform 0.15s ease;
  will-change: transform;
}

/* ============================================
   Participation Buttons
   ============================================ */
.part-buttons {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}
.part-btn {
  width: 32px; height: 32px;
  border-radius: var(--radius-full);
  border: none;
  font-size: 14px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
  position: relative;
}
.part-btn:active { transform: scale(0.85); }
.part-btn-excellent { background: #F0EDFF; color: var(--primary); }
.part-btn-good { background: #EDFAF3; color: #27AE60; }
.part-btn-regular { background: #FFFBEC; color: #D4920A; }
.part-btn-bad { background: #FFF0F0; color: var(--danger); }

.part-points {
  font-size: 13px;
  font-weight: 700;
  color: var(--primary);
  min-width: 36px;
  text-align: right;
}

/* ============================================
   Group Cards (Home Screen)
   ============================================ */
.group-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin: 0 16px 10px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  transition: all 0.2s;
  animation: fadeInUp 0.3s ease both;
}
.group-card:active { transform: scale(0.98); box-shadow: none; }

.group-icon {
  width: 48px; height: 48px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--primary-bg), var(--border2));
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.group-info { flex: 1; min-width: 0; }
.group-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.2px;
}
.group-meta {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
  display: flex;
  gap: 8px;
  align-items: center;
}
.group-stats { text-align: right; flex-shrink: 0; }
.group-percent {
  font-size: 18px;
  font-weight: 800;
  color: var(--primary);
}
.group-today {
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 500;
}

/* Home card: day pills row */
.home-schedule-row {
  display: flex;
  align-items: center;
  gap: 3px;
  margin-top: 5px;
  flex-wrap: wrap;
}
.home-day-pill {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  font-size: 9px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--border);
  color: var(--text-muted);
  flex-shrink: 0;
  font-family: 'Poppins', sans-serif;
}
.home-day-pill.active {
  font-weight: 800;
}
.home-sched-time {
  font-size: 10px;
  font-weight: 600;
  margin-left: 4px;
  white-space: nowrap;
}

/* ============================================
   Progress Bars
   ============================================ */
.progress-bar {
  height: 6px;
  background: var(--border);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-top: 4px;
}
.progress-fill {
  height: 100%;
  border-radius: var(--radius-full);
  background: linear-gradient(90deg, var(--primary), var(--primary-light));
  transition: width 0.5s ease;
}
.progress-green .progress-fill { background: linear-gradient(90deg, #27AE60, var(--secondary)); }
.progress-yellow .progress-fill { background: linear-gradient(90deg, #D4920A, var(--warning)); }
.progress-red .progress-fill { background: linear-gradient(90deg, #E03E3E, var(--danger)); }

/* ============================================
   Task Cards
   ============================================ */
.task-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin: 0 16px 10px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: all 0.2s;
}
.task-card:active { transform: scale(0.98); }
.task-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}
.task-due {
  font-size: 11px;
  color: var(--text-secondary);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 4px;
}
.task-progress-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.task-progress-label {
  font-size: 12px;
  color: var(--text-secondary);
}
.task-progress-count {
  font-size: 13px;
  font-weight: 700;
  color: var(--primary);
}

/* Task status badges */
.task-status {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: var(--radius-full);
}
.task-entregada { background: #EDFAF3; color: #27AE60; }
.task-incompleta { background: #FFFBEC; color: #D4920A; }
.task-no-entregada { background: #FFF0F0; color: var(--danger); }

/* ============================================
   Grade Distribution
   ============================================ */
.grade-dist {
  padding: 0 16px;
}
.grade-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.grade-range {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  min-width: 42px;
}
.grade-bar-wrap {
  flex: 1;
  height: 10px;
  background: var(--border);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.grade-bar {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 0.6s ease;
}
.grade-count {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
  min-width: 20px;
  text-align: right;
}

/* Big score display */
.score-display {
  text-align: center;
  padding: 20px;
}
.score-big {
  font-size: 64px;
  font-weight: 800;
  color: var(--primary);
  line-height: 1;
  letter-spacing: -3px;
}
.score-label {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* ============================================
   Home Screen Specific
   ============================================ */
.home-header {
  background: linear-gradient(160deg, var(--primary) 0%, #8B6EFF 100%);
  padding: 20px 20px 24px;
  color: white;
}
.home-greeting {
  font-size: 22px;
  font-weight: 800;
  margin-bottom: 3px;
  letter-spacing: -0.5px;
}
.home-subtitle {
  font-size: 13px;
  opacity: 0.8;
  font-weight: 400;
}
.home-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.notif-btn {
  width: 40px; height: 40px;
  border-radius: var(--radius-full);
  background: rgba(255,255,255,0.2);
  border: none;
  color: white;
  font-size: 18px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  backdrop-filter: blur(8px);
  transition: all 0.2s;
}
.notif-btn:active { background: rgba(255,255,255,0.3); }

.new-group-btn {
  background: rgba(255,255,255,0.15);
  border: 1.5px solid rgba(255,255,255,0.4);
  color: white;
  border-radius: var(--radius-lg);
  padding: 12px 20px;
  font-family: 'Poppins', sans-serif;
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  backdrop-filter: blur(8px);
  transition: all 0.2s;
  width: 100%;
  justify-content: center;
}
.new-group-btn:active { background: rgba(255,255,255,0.25); }

/* ============================================
   Participation Legend
   ============================================ */
.part-legend {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  flex-wrap: wrap;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 500;
}
.legend-dot {
  width: 8px; height: 8px;
  border-radius: var(--radius-full);
}

/* ============================================
   Random Student Screen
   ============================================ */
.dice-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  gap: 20px;
}
.dice-icon {
  font-size: 80px;
  color: var(--primary);
  animation: none;
}
.dice-icon.rolling {
  animation: spin 0.6s ease;
}
.selected-student {
  background: var(--primary-bg);
  border-radius: var(--radius-xl);
  padding: 20px 32px;
  text-align: center;
  border: 2px solid var(--primary);
  animation: scaleIn 0.3s ease;
}
.selected-name {
  font-size: 20px;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: -0.5px;
}
.selected-sub {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.recent-picks {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}
.recent-chip {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
}

/* ============================================
   Grade Configuration
   ============================================ */
.config-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--surface);
  border-radius: var(--radius-md);
  margin: 0 16px 8px;
  border: 1px solid var(--border);
}
.config-icon {
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  background: var(--primary-bg);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  color: var(--primary);
  flex-shrink: 0;
}
.config-name {
  flex: 1;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}
.config-pct {
  font-size: 18px;
  font-weight: 800;
  color: var(--primary);
  min-width: 48px;
  text-align: right;
}
.config-drag {
  color: var(--text-muted);
  font-size: 16px;
}
.config-total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: var(--primary-bg);
  margin: 0 16px 8px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border2);
}
.config-total-label {
  font-size: 14px;
  font-weight: 700;
  color: var(--primary);
}
.config-total-num {
  font-size: 20px;
  font-weight: 800;
  color: var(--primary);
}

/* ============================================
   Reports Screen
   ============================================ */
.reports-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 14px 16px 0;
}
.report-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 14px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.report-metric {
  font-size: 24px;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: -1px;
}
.report-label {
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 500;
  margin-top: 2px;
}
.mini-chart {
  margin-top: 8px;
}

/* ============================================
   Student Profile
   ============================================ */
.profile-header {
  background: linear-gradient(135deg, var(--primary) 0%, #8B6EFF 100%);
  padding: 24px 20px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  color: white;
}
.profile-avatar-large {
  width: 64px; height: 64px;
  border-radius: var(--radius-full);
  background: rgba(255,255,255,0.25);
  display: flex; align-items: center; justify-content: center;
  font-size: 24px;
  font-weight: 800;
  border: 3px solid rgba(255,255,255,0.5);
  flex-shrink: 0;
}
.profile-name {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.3px;
}
.profile-group {
  font-size: 12px;
  opacity: 0.8;
  margin-top: 2px;
}
.profile-avg {
  margin-left: auto;
  text-align: center;
  flex-shrink: 0;
}
.profile-avg-num {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -1px;
}
.profile-avg-label {
  font-size: 11px;
  opacity: 0.8;
}

.mini-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 14px 16px 0;
}
.mini-stat {
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 12px;
  border: 1px solid var(--border);
}
.mini-stat-num {
  font-size: 20px;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: -0.5px;
}
.mini-stat-label {
  font-size: 10px;
  color: var(--text-secondary);
  font-weight: 500;
  margin-top: 2px;
}

/* ============================================
   Notes
   ============================================ */
.notes-card {
  background: #FFFDF0;
  border: 1.5px solid #F5E472;
  border-radius: var(--radius-lg);
  padding: 14px;
  margin: 12px 16px 0;
}
.notes-header {
  font-size: 12px;
  font-weight: 700;
  color: #B8940A;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.notes-text {
  font-size: 13px;
  color: var(--text-primary);
  line-height: 1.5;
  font-style: italic;
}

/* ============================================
   Settings / Menu
   ============================================ */
.settings-profile {
  background: linear-gradient(135deg, #1E1F2B 0%, #2D2E45 100%);
  padding: 24px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  color: white;
}
.settings-avatar {
  width: 54px; height: 54px;
  border-radius: var(--radius-full);
  background: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  font-weight: 800;
  flex-shrink: 0;
}
.settings-name { font-size: 16px; font-weight: 700; }
.settings-email { font-size: 12px; opacity: 0.6; margin-top: 2px; }

.settings-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.2s;
}
.settings-item:active { background: var(--primary-bg); }
.settings-item-icon {
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  background: var(--primary-bg);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  color: var(--primary);
  flex-shrink: 0;
}
.settings-item-name {
  flex: 1;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
}
.settings-item-right {
  font-size: 14px;
  color: var(--text-muted);
}

/* Toggle switch */
.toggle {
  position: relative;
  width: 48px; height: 26px;
  cursor: pointer;
}
.toggle input { display: none; }
.toggle-track {
  width: 100%; height: 100%;
  background: var(--border);
  border-radius: var(--radius-full);
  transition: all 0.25s;
}
.toggle input:checked + .toggle-track { background: var(--primary); }
.toggle-thumb {
  position: absolute;
  top: 3px; left: 3px;
  width: 20px; height: 20px;
  background: white;
  border-radius: var(--radius-full);
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
  transition: all 0.25s;
}
.toggle input:checked ~ .toggle-thumb { left: calc(100% - 23px); }

/* ============================================
   Date header
   ============================================ */
.date-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.date-text {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}
.date-icon {
  color: var(--text-secondary);
  font-size: 16px;
  cursor: pointer;
}

/* ============================================
   Toast / Snackbar
   ============================================ */
.toast {
  position: fixed;
  bottom: calc(var(--nav-height) + 12px);
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--text-primary);
  color: white;
  padding: 10px 20px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 500;
  z-index: 9999;
  opacity: 0;
  transition: all 0.3s;
  white-space: nowrap;
  pointer-events: none;
  max-width: 320px;
  text-align: center;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ============================================
   Modal / Bottom Sheet
   ============================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
  display: none;
  align-items: flex-end;
  animation: fadeIn 0.2s ease;
  backdrop-filter: blur(4px);
}
.modal-overlay.open { display: flex; }
.bottom-sheet {
  background: var(--surface);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  padding: 20px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  animation: slideUp 0.3s ease;
}
@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}
.sheet-handle {
  width: 40px; height: 4px;
  background: var(--border);
  border-radius: var(--radius-full);
  margin: 0 auto 16px;
}
.sheet-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  text-align: center;
  margin-bottom: 16px;
}

/* ============================================
   Form Elements
   ============================================ */
.input-group {
  margin-bottom: 14px;
}
.input-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
  display: block;
}
.input-field {
  width: 100%;
  padding: 13px 16px;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  font-family: 'Poppins', sans-serif;
  font-size: 14px;
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.2s;
}
.input-field:focus { border-color: var(--primary); background: var(--surface); }
.input-field::placeholder { color: var(--text-muted); }

/* ============================================
   Empty State
   ============================================ */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  text-align: center;
  flex: 1;
}
.empty-icon {
  font-size: 56px;
  color: var(--primary-bg2);
  margin-bottom: 16px;
}
.empty-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}
.empty-text {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ============================================
   Utility
   ============================================ */
.p-16 { padding: 16px; }
.px-16 { padding-left: 16px; padding-right: 16px; }
.py-8 { padding-top: 8px; padding-bottom: 8px; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mb-8 { margin-bottom: 8px; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.text-center { text-align: center; }
.font-bold { font-weight: 700; }
.text-sm { font-size: 12px; }
.text-xs { font-size: 11px; }
.color-primary { color: var(--primary); }
.color-muted { color: var(--text-muted); }
.w-full { width: 100%; }
.divider { height: 1px; background: var(--border); margin: 8px 0; }

/* ============================================
   Loading spinner
   ============================================ */
.spinner {
  width: 24px; height: 24px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: var(--radius-full);
  animation: spin 0.7s linear infinite;
  display: inline-block;
}

/* ============================================
   Floating Action Button (positioned)
   ============================================ */
.fab-fixed {
  position: absolute;
  bottom: calc(var(--nav-height) + 16px);
  right: 20px;
  z-index: 50;
  box-shadow: 0 6px 20px rgba(100,80,232,0.40);
}
.fab-fixed:active { transform: scale(0.90); }

/* ============================================
   Group card with delete button
   ============================================ */
.group-card-wrap {
  position: relative;
  margin: 0 16px 10px;
}
.group-card-wrap .group-card {
  margin: 0;
}
.group-delete-btn {
  position: absolute;
  top: 50%;
  right: 10px;
  transform: translateY(-50%);
  width: 32px; height: 32px;
  border-radius: var(--radius-full);
  background: #FFF0F0;
  border: none;
  color: var(--danger);
  font-size: 13px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  opacity: 0;
  transition: opacity 0.2s;
  z-index: 5;
  pointer-events: none;
}
.group-card-wrap:hover .group-delete-btn,
.group-card-wrap:active .group-delete-btn {
  opacity: 1;
  pointer-events: auto;
}
/* Always visible on touch devices */
@media (hover: none) {
  .group-delete-btn {
    opacity: 1;
    pointer-events: auto;
  }
  .group-card .group-stats {
    margin-right: 36px;
  }
}

/* ============================================
   Exam score input (remove spinners)
   ============================================ */
.exam-score-input { -moz-appearance: textfield; }
.exam-score-input::-webkit-outer-spin-button,
.exam-score-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* ============================================
   Collapsible toggle button (tasks / exams)
   ============================================ */
.collapse-toggle {
  display: flex;
  align-items: center;
  gap: 7px;
  background: var(--primary-bg);
  border: none;
  border-radius: var(--radius-full);
  padding: 7px 14px;
  font-family: 'Poppins', sans-serif;
  font-size: 12px;
  font-weight: 600;
  color: var(--primary);
  cursor: pointer;
  transition: all 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.collapse-toggle:active { background: var(--primary-bg2); transform: scale(0.96); }
.collapse-toggle i { font-size: 11px; }

.collapse-body { animation: fadeInUp 0.2s ease; }

/* ============================================
   Notification badge on bell button
   ============================================ */
.notif-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 16px;
  height: 16px;
  border-radius: var(--radius-full);
  background: var(--danger);
  color: white;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
  pointer-events: none;
  line-height: 1;
}

/* ============================================
   Grade config editable row adjustments
   ============================================ */
.cfg-name-input {
  padding: 8px 10px !important;
  font-size: 13px !important;
  height: 36px;
}
.cfg-icon-select:focus {
  border-color: var(--primary);
  outline: none;
}

/* ============================================
   Calendar Screen
   ============================================ */
.cal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px 10px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.cal-month-title {
  font-size: 17px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.3px;
  text-transform: capitalize;
}
.cal-nav-btn {
  width: 34px; height: 34px;
  border-radius: var(--radius-sm);
  background: var(--primary-bg);
  border: none;
  color: var(--primary);
  font-size: 14px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
}
.cal-nav-btn:active { transform: scale(0.90); background: var(--primary-bg2); }

/* Day-of-week header row */
.cal-dow-row {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  background: var(--surface);
  padding: 4px 8px 6px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.cal-dow {
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.cal-dow.weekend { color: var(--danger); opacity: 0.7; }

/* Calendar grid */
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  padding: 6px 8px;
  flex-shrink: 0;
}
.cal-cell {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding-top: 6px;
  gap: 3px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s;
  position: relative;
  min-height: 44px;
}
.cal-cell:active { background: var(--primary-bg); }
.cal-cell.other-month .cal-day-num { color: var(--text-muted); opacity: 0.4; }
.cal-cell.today { background: var(--primary-bg); }
.cal-cell.today .cal-day-num {
  background: var(--primary);
  color: white;
  border-radius: var(--radius-full);
  width: 26px; height: 26px;
  display: flex; align-items: center; justify-content: center;
}
.cal-cell.selected { background: var(--primary-bg2); outline: 2px solid var(--primary); outline-offset: -2px; }
.cal-cell.has-class { background: rgba(100,80,232,0.06); }
.cal-day-num {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  width: 26px; height: 26px;
  display: flex; align-items: center; justify-content: center;
}
.cal-cell .weekend-num { color: var(--danger); opacity: 0.75; }

/* Event dots below day number */
.cal-dots {
  display: flex;
  gap: 2px;
  flex-wrap: wrap;
  justify-content: center;
  max-width: 100%;
}
.cal-dot {
  width: 5px; height: 5px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
}
/* Group class pill in day cell */
.cal-class-pill {
  width: calc(100% - 4px);
  height: 4px;
  border-radius: 2px;
  margin: 0 2px;
}

/* Day detail panel */
.day-detail-panel {
  background: var(--surface);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  overflow-y: auto;
  max-height: 260px;
}
.day-detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px 8px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 1;
}
.day-detail-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}
.day-class-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s;
}
.day-class-item:active { background: var(--primary-bg); }
.day-class-item:last-child { border-bottom: none; }
.day-class-time {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  min-width: 52px;
  text-align: right;
}
.day-class-color {
  width: 4px;
  border-radius: 2px;
  align-self: stretch;
  flex-shrink: 0;
}
.day-event-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  cursor: default;
}
.day-event-item:last-child { border-bottom: none; }
.day-event-dot {
  width: 10px; height: 10px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
}

/* ============================================
   Schedule / Horario screen
   ============================================ */
.schedule-tabs {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  flex-shrink: 0;
}
.schedule-tabs::-webkit-scrollbar { display: none; }
.sched-day-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 14px 10px;
  background: none;
  border: none;
  border-bottom: 2.5px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
  min-width: 52px;
  flex-shrink: 0;
}
.sched-day-tab .dow { font-size: 11px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; }
.sched-day-tab .dom { font-size: 16px; font-weight: 800; color: var(--text-secondary); line-height: 1; }
.sched-day-tab.active { border-bottom-color: var(--primary); }
.sched-day-tab.active .dow, .sched-day-tab.active .dom { color: var(--primary); }
.sched-day-tab.today-tab .dom {
  background: var(--primary);
  color: white;
  width: 28px; height: 28px;
  border-radius: var(--radius-full);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
}

/* Timeline slots */
.schedule-timeline {
  padding: 12px 0 80px;
}
.sched-slot {
  display: flex;
  gap: 0;
  margin: 0 16px 10px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: var(--shadow-sm);
}
.sched-slot:active { transform: scale(0.98); }
.sched-slot-accent {
  width: 5px;
  flex-shrink: 0;
}
.sched-slot-body {
  flex: 1;
  padding: 12px 14px;
}
.sched-slot-time {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.sched-slot-group {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 2px;
}
.sched-slot-meta {
  font-size: 12px;
  color: var(--text-secondary);
}
.sched-slot-icon {
  width: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}
.sched-slot-actions {
  display: flex;
  align-items: center;
  padding: 0 8px;
}

/* FAB for adding schedule slot */
.sched-fab {
  position: absolute;
  bottom: calc(var(--nav-height) + 16px);
  right: 20px;
  z-index: 50;
}

/* ============================================
   Day Picker (Horario tab inside group screen)
   ============================================ */
.day-picker-row {
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px 14px;
}
.day-circle {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--bg);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.18s ease;
  font-family: 'Poppins', sans-serif;
  flex-shrink: 0;
}
.day-circle:active { transform: scale(0.88); }
.day-circle.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 3px 10px rgba(100,80,232,0.40);
}

/* Day names row (labels below day circles) */
.day-names-row {
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 2px 16px 8px;
}
.day-name-label {
  width: 38px;
  text-align: center;
  font-size: 9px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  flex-shrink: 0;
}
.day-name-label.active {
  color: var(--primary);
  font-weight: 700;
}

/* Horario summary card (top of Horario screen) */
.horario-summary-card {
  margin: 12px 16px 4px;
  padding: 14px 16px;
  border-radius: 14px;
}

/* Horario week preview cards */
.sched-preview-card {
  background: var(--surface);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 8px;
}

/* ============================================
   Stagger animations for list items
   ============================================ */
.student-item:nth-child(1) { animation-delay: 0.04s; }
.student-item:nth-child(2) { animation-delay: 0.08s; }
.student-item:nth-child(3) { animation-delay: 0.12s; }
.student-item:nth-child(4) { animation-delay: 0.16s; }
.student-item:nth-child(5) { animation-delay: 0.20s; }
.student-item:nth-child(6) { animation-delay: 0.24s; }
.student-item:nth-child(7) { animation-delay: 0.28s; }
.student-item:nth-child(8) { animation-delay: 0.32s; }
.student-item:nth-child(9) { animation-delay: 0.36s; }
.student-item:nth-child(10) { animation-delay: 0.40s; }

.student-item { animation: fadeInUp 0.3s ease both; }
.group-card:nth-child(1) { animation-delay: 0.05s; }
.group-card:nth-child(2) { animation-delay: 0.10s; }
.group-card:nth-child(3) { animation-delay: 0.15s; }
.group-card:nth-child(4) { animation-delay: 0.20s; }

/* Responsive – slightly larger screens */
@media (min-width: 431px) {
  #app {
    border-radius: var(--radius-xl);
    height: min(100vh, 900px);
    margin-top: max(0px, calc((100vh - 900px) / 2));
    box-shadow: 0 20px 80px rgba(0,0,0,0.25);
  }
}
