/* ==============================================================
   COMPONENTES UI & ERGONOMÍA MÓVIL
   Gimnasia Rítmica Castroviejo PWA
   ============================================================== */

/* Tarjetas (Cards) */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 16px;
  transition: var(--transition);
}

.card:hover {
  box-shadow: var(--shadow-md);
}

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

.card-title {
  font-family: 'Outfit', sans-serif;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Botones con Ergonomía Táctil Móvil */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--touch-target);
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: var(--transition);
  text-decoration: none;
  user-select: none;
}

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

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(254, 107, 35, 0.28);
}

.btn-primary:hover {
  box-shadow: 0 6px 16px rgba(254, 107, 35, 0.38);
}

.btn-secondary {
  background: var(--primary-light);
  color: var(--primary);
  border-color: var(--primary-tint);
}

.btn-secondary:hover {
  background: #FFCCA8;
}

.btn-success {
  background: linear-gradient(135deg, #10B981 0%, #059669 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.28);
}

.btn-outline {
  background: transparent;
  border-color: var(--border-subtle);
  color: var(--text-secondary);
}

.btn-outline:hover {
  background: var(--bg-subtle);
  color: var(--text-primary);
}

.btn-danger {
  background: #FEE2E2;
  color: #DC2626;
  border-color: #FECACA;
}

.btn-danger:hover {
  background: #DC2626;
  color: white;
}

.btn-sm {
  min-height: 36px;
  padding: 6px 12px;
  font-size: 0.82rem;
  border-radius: var(--radius-sm);
}

.btn-lg {
  min-height: 52px;
  padding: 14px 24px;
  font-size: 1rem;
  border-radius: var(--radius-lg);
  font-weight: 700;
}

.btn-block {
  width: 100%;
}

.btn-circle {
  width: 42px;
  height: 42px;
  min-height: 42px;
  padding: 0;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Campos de Formulario */
.form-group {
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

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

.form-control {
  width: 100%;
  min-height: 46px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--text-primary);
  transition: var(--transition);
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(254, 107, 35, 0.18);
}

/* Insignias (Badges) */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

/* ==============================================================
   VISTA PASAR LISTA (MOBILE-FIRST ASISTENCIA)
   ============================================================== */

/* Cabecera de la Clase Activa */
.attendance-header {
  background: linear-gradient(135deg, #FFFFFF 0%, #FFF8F5 100%);
  border: 1px solid var(--primary-tint);
  border-radius: var(--radius-lg);
  padding: 18px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}

.attendance-class-info {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.class-title {
  font-family: 'Outfit', sans-serif;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
}

.class-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.class-meta span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* Selector Rápido de Fecha */
.date-selector-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  background: white;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.date-selector-bar input[type="date"] {
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  outline: none;
  flex: 1;
}

/* Botón Grande "Marcar Todas Presentes" */
.bulk-present-banner {
  margin-bottom: 16px;
}

.btn-bulk-present {
  width: 100%;
  min-height: 52px;
  background: linear-gradient(135deg, #10B981 0%, #059669 100%);
  color: white;
  border: none;
  border-radius: var(--radius-lg);
  font-size: 1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.35);
  cursor: pointer;
  transition: var(--transition);
}

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

/* Barra de Progreso y Estadísticas en Vivo */
.attendance-progress-card {
  background: white;
  border-radius: var(--radius-md);
  padding: 12px 16px;
  border: 1px solid var(--border-subtle);
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}

.progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.progress-bar-container {
  height: 8px;
  width: 100%;
  background: #E2E8F0;
  border-radius: var(--radius-full);
  overflow: hidden;
  display: flex;
}

.progress-segment {
  height: 100%;
  transition: width 0.3s ease;
}

.progress-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 10px;
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

/* Buscador Rápido de Alumnas */
.search-bar {
  position: relative;
  margin-bottom: 14px;
}

.search-input {
  width: 100%;
  height: 44px;
  padding: 10px 14px 10px 40px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle);
  background: white;
  font-size: 0.9rem;
  outline: none;
}

.search-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(254, 107, 35, 0.15);
}

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

/* Barra de Filtro de Secciones (AMPA, Competición, etc.) */
.section-filter-bar {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 2px 10px 2px;
  margin-bottom: 12px;
  -webkit-overflow-scrolling: touch;
}

.section-chip {
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 700;
  border: 1px solid var(--border-subtle);
  background: white;
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: var(--transition);
}

.section-chip:active {
  transform: scale(0.95);
}

.section-chip.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(254, 107, 35, 0.32);
}

/* Tarjeta Individual de Alumna para Pasar Lista */
.student-attendance-card {
  background: white;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  padding: 14px 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.student-attendance-card.has-status {
  border-left-width: 5px;
}

/* Estilo para Alumna dada de Baja (situada al final de la lista) */
.student-attendance-card.is-baja {
  background: #F8FAFC;
  border-color: #CBD5E1;
  border-left: 6px solid #94A3B8;
  opacity: 0.82;
}

.student-attendance-card.is-baja .student-fullname {
  color: #64748B;
}

.baja-info-banner {
  background: #F1F5F9;
  border: 1px dashed #CBD5E1;
  border-radius: var(--radius-md);
  padding: 10px 14px;
  margin-top: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.84rem;
  color: #475569;
}

.student-info-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.student-identity {
  display: flex;
  align-items: center;
  gap: 12px;
}

.student-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, #C084FC 0%, #E879F9 100%);
  color: white;
  font-weight: 700;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(192, 132, 252, 0.3);
}

.student-names {
  display: flex;
  flex-direction: column;
}

.student-fullname {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.25;
}

.student-subinfo {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Fila de Botones de Pasar Lista Táctil (Mobile-First) */
.attendance-btn-row,
.status-pill-group {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-top: 10px;
  width: 100%;
}

@media (min-width: 768px) {
  .attendance-btn-row,
  .status-pill-group {
    grid-template-columns: repeat(auto-fit, minmax(95px, 1fr));
    gap: 8px;
  }
}

@media (max-width: 340px) {
  .attendance-btn-row,
  .status-pill-group {
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
  }
  .status-btn {
    min-height: 48px;
    padding: 4px 2px;
  }
}

.status-btn {
  min-height: 52px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border-subtle);
  background: #FFFFFF;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.70rem;
  font-weight: 700;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
  padding: 6px 3px;
  text-align: center;
  box-sizing: border-box;
  width: 100%;
}

.status-btn .status-icon {
  font-size: 1.15rem;
  line-height: 1;
}

.status-btn .status-label {
  font-size: 0.68rem;
  line-height: 1.15;
  text-align: center;
  word-break: break-word;
  white-space: normal;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.status-btn:hover:not(.selected) {
  background: #F1F5F9;
  border-color: #CBD5E1;
  color: var(--text-primary);
}

.status-btn:active {
  transform: scale(0.94);
}

.status-btn.selected {
  color: white !important;
  border-color: transparent !important;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
  font-weight: 800;
  transform: scale(1.02);
}

/* Botón de Notas por Alumna */
.note-toggle-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.note-toggle-btn:hover, .note-toggle-btn.has-notes {
  background: #FEF3C7;
  color: #B45309;
}

.student-note-preview {
  margin-top: 8px;
  padding: 8px 12px;
  background: #FFFBEB;
  border: 1px dashed #FDE68A;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  color: #92400E;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Modales / Diálogos */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  align-items: flex-end; /* Slide up en móvil */
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.25s ease;
}

@media (min-width: 640px) {
  .modal-overlay {
    align-items: center;
    padding: 20px;
  }
}

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

.modal-sheet {
  background: white;
  width: 100%;
  max-width: 520px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 24px;
  box-shadow: var(--shadow-float);
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  max-height: 90vh;
  overflow-y: auto;
}

@media (min-width: 640px) {
  .modal-sheet {
    border-radius: var(--radius-lg);
    transform: translateY(20px);
  }
}

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

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

.modal-title {
  font-family: 'Outfit', sans-serif;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-primary);
}

.modal-close-btn {
  background: #F1F5F9;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
}

/* Tarjetas de Clases (Dashboard Profesora) */
.class-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

@media (min-width: 640px) {
  .class-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.class-card {
  background: white;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
  transition: var(--transition);
}

.class-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.class-card.is-active-now {
  border: 2px solid var(--primary);
  background: linear-gradient(180deg, #FFF8F5 0%, #FFFFFF 100%);
}

.class-card.is-active-now::before {
  content: 'EN CURSO AHORA';
  position: absolute;
  top: 12px;
  right: 12px;
  background: var(--primary);
  color: white;
  font-size: 0.68rem;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  letter-spacing: 0.05em;
  box-shadow: 0 2px 6px rgba(254, 107, 35, 0.35);
}

/* ==============================================================
   VISTA HISTORIAL DE ASISTENCIA (PREMIUM MOBILE & DESKTOP)
   ============================================================== */

/* Cabecera y botón de exportar */
.history-header-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 12px;
}

.history-title-group h1 {
  font-family: 'Outfit', sans-serif;
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 8px;
  line-height: 1.2;
}

.history-title-group p {
  font-size: 0.84rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

.history-btn-excel {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, #107C41 0%, #0F6A37 100%);
  color: #FFFFFF;
  border: none;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(16, 124, 65, 0.32);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  text-decoration: none;
  flex-shrink: 0;
}

.history-btn-excel:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(16, 124, 65, 0.42);
  background: linear-gradient(135deg, #168a4a 0%, #107C41 100%);
}

.history-btn-excel:active {
  transform: translateY(0) scale(0.97);
}

/* Tarjeta de Filtros */
.history-filter-card {
  background: #FFFFFF;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  padding: 14px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
  width: 100%;
  box-sizing: border-box;
  overflow: hidden;
}

/* Barra de Presets Rápidos */
.history-preset-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 14px;
  overflow-x: auto;
  padding-bottom: 4px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.history-preset-bar::-webkit-scrollbar {
  display: none;
}

.history-preset-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
  margin-right: 4px;
}

.history-preset-btn {
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-radius: var(--radius-full);
  padding: 5px 12px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition);
  flex-shrink: 0;
}

.history-preset-btn:hover {
  background: #FFF7ED;
  border-color: var(--primary-tint);
  color: var(--primary);
}

.history-preset-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #FFFFFF;
  box-shadow: 0 2px 8px rgba(254, 107, 35, 0.35);
}

/* Grid de Filtros */
.history-filter-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  width: 100%;
  box-sizing: border-box;
}

@media (min-width: 640px) {
  .history-filter-grid {
    grid-template-columns: 1.3fr 1fr;
  }
}

.history-filter-grid select {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  min-width: 0;
}

.history-date-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-top: 12px;
  width: 100%;
  box-sizing: border-box;
}

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

.history-date-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.history-date-input {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  height: 44px;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: #FAF8F5;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-primary);
  outline: none;
  transition: var(--transition);
}

.history-date-input:focus {
  background: #FFFFFF;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(254, 107, 35, 0.15);
}

/* Grid de Métricas / KPIs */
.history-kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

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

.history-kpi-card {
  background: #FFFFFF;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  padding: 12px 14px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.history-kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.history-kpi-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.history-kpi-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  white-space: nowrap;
}

.history-kpi-icon {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
}

.history-kpi-value {
  font-family: 'Outfit', sans-serif;
  font-size: 1.55rem;
  font-weight: 800;
  line-height: 1.1;
  color: var(--text-primary);
}

.history-kpi-sub {
  font-size: 0.72rem;
  color: var(--text-secondary);
  margin-top: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kpi-mini-bar {
  width: 100%;
  height: 5px;
  background: #F1F5F9;
  border-radius: 10px;
  overflow: hidden;
  margin-top: 8px;
}

.kpi-mini-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #10B981 0%, #fe6b23 100%);
  border-radius: 10px;
  transition: width 0.4s ease;
}

/* Barra de Herramientas de Registros (Búsqueda + Filtro Estado + Vista) */
.history-toolbar {
  background: #FFFFFF;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  padding: 12px 14px;
  margin-bottom: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

@media (min-width: 640px) {
  .history-toolbar {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

.history-search-box {
  position: relative;
  flex: 1;
  max-width: 320px;
}

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

.history-search-input {
  width: 100%;
  height: 38px;
  padding: 6px 12px 6px 36px;
  border-radius: var(--radius-full);
  border: 1px solid #E2E8F0;
  background: #F8FAFC;
  font-family: inherit;
  font-size: 0.85rem;
  color: var(--text-primary);
  transition: var(--transition);
}

.history-search-input:focus {
  outline: none;
  background: #FFFFFF;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(254, 107, 35, 0.15);
}

.history-status-pills {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 2px;
}

.history-status-pill {
  border: 1px solid #E2E8F0;
  background: #F8FAFC;
  padding: 5px 10px;
  border-radius: var(--radius-full);
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.history-status-pill:hover {
  background: #F1F5F9;
  border-color: #CBD5E1;
}

.history-status-pill.active {
  background: #18181B;
  color: #FFFFFF;
  border-color: #18181B;
}

.history-view-toggle {
  display: inline-flex;
  background: #F1F5F9;
  border-radius: var(--radius-sm);
  padding: 2px;
  gap: 2px;
  margin-left: auto;
}

.history-view-btn {
  background: transparent;
  border: none;
  padding: 5px 8px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.8rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 4px;
  transition: var(--transition);
}

.history-view-btn.active {
  background: #FFFFFF;
  color: var(--text-primary);
  font-weight: 700;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Agrupación de Sesiones por Fecha (Vista Fichas Móviles) */
.history-sessions-container {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.history-date-group {
  background: #FFFFFF;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.history-date-header {
  background: #F8FAFC;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.history-date-title {
  font-family: 'Outfit', sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.history-date-stats {
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.history-record-card {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: #FFFFFF;
  transition: background 0.15s ease;
  width: 100%;
  box-sizing: border-box;
}

.history-record-card:last-child {
  border-bottom: none;
}

.history-record-card:hover {
  background: #FAF8F5;
}

/* Fila Superior: Alumna y Estado */
.history-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
}

.history-card-student {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.history-avatar {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.84rem;
  font-weight: 800;
  border: 1.5px solid;
  flex-shrink: 0;
}

.history-avatar.present {
  border-color: #10B981;
  background: #ECFDF5;
  color: #065F46;
}

.history-avatar.absent {
  border-color: #EF4444;
  background: #FEF2F2;
  color: #991B1B;
}

.history-name-col {
  flex: 1;
  min-width: 0;
}

.history-student-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.25;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  word-break: break-word;
}

.history-baja-tag {
  background: #F1F5F9;
  color: #64748B;
  border: 1px solid #CBD5E1;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.history-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border-radius: var(--radius-full);
  font-size: 0.76rem;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
}

/* Fila Inferior: Sección, Notas y Botón Editar */
.history-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding-left: 46px; /* Sangría alineada debajo del nombre */
}

@media (max-width: 380px) {
  .history-card-footer {
    padding-left: 0;
  }
}

.history-card-tags {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  flex: 1;
  min-width: 0;
}

.history-sec-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  white-space: nowrap;
}

.history-note-chip {
  font-size: 0.74rem;
  font-weight: 500;
  color: #92400E;
  background: #FEF3C7;
  border: 1px solid #FDE68A;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 100%;
  word-break: break-word;
}

.history-btn-mod {
  background: #F8FAFC;
  border: 1px solid #CBD5E1;
  color: var(--text-secondary);
  border-radius: 8px;
  padding: 5px 10px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: var(--transition);
  flex-shrink: 0;
}

.history-btn-mod:hover {
  background: var(--primary-light);
  border-color: var(--primary-tint);
  color: var(--primary);
}

/* Estado Vacío */
.history-empty-state {
  background: #FFFFFF;
  border-radius: var(--radius-lg);
  border: 1px dashed #CBD5E1;
  padding: 40px 20px;
  text-align: center;
  margin: 16px 0;
}

.history-empty-icon {
  font-size: 2.5rem;
  margin-bottom: 12px;
}

.history-empty-title {
  font-family: 'Outfit', sans-serif;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.history-empty-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
  max-width: 360px;
  margin: 0 auto 16px;
}

/* Tablas Históricas (Mejoradas) */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  background: white;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  margin-top: 14px;
}

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

.data-table th {
  background: #F8FAFC;
  color: var(--text-secondary);
  font-weight: 700;
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}

.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-primary);
}

.data-table tr:hover td {
  background: #FAF8F5;
}

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

/* ==============================================================
   PANTALLA DE INICIO DE SESIÓN (LOGIN PREMIUM)
   ============================================================== */
.login-wrapper {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 32px 16px;
  position: relative;
  background: radial-gradient(circle at 50% 15%, rgba(254, 107, 35, 0.08) 0%, rgba(250, 248, 245, 0) 65%), var(--bg-page);
}

.login-card {
  width: 100%;
  max-width: 430px;
  background: #FFFFFF;
  border-radius: 28px;
  border: 1px solid rgba(254, 107, 35, 0.15);
  box-shadow: 0 20px 50px -10px rgba(254, 107, 35, 0.16), 0 8px 24px -4px rgba(0, 0, 0, 0.05);
  padding: 36px 28px 28px;
  position: relative;
  overflow: hidden;
  animation: fadeInLogin 0.4s ease-out;
}

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

/* Efecto de luz decorativa superior */
.login-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 6px;
  background: linear-gradient(90deg, #fe6b23 0%, #f59e0b 50%, #fe6b23 100%);
}

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

.login-logo-badge {
  width: 88px;
  height: 88px;
  margin: 0 auto 16px;
  background: linear-gradient(135deg, #fe6b23 0%, #ea580c 100%);
  border-radius: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
  box-shadow: 0 10px 25px rgba(254, 107, 35, 0.35);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.login-logo-badge:hover {
  transform: scale(1.05);
  box-shadow: 0 14px 30px rgba(254, 107, 35, 0.45);
}

.login-logo-badge img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.15));
}

.login-title {
  font-family: 'Outfit', sans-serif;
  font-size: 1.65rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin-bottom: 6px;
}

.login-subtitle {
  font-size: 0.88rem;
  color: var(--text-secondary);
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.login-input-group {
  margin-bottom: 18px;
}

.login-input-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
}

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

.login-input-icon {
  position: absolute;
  left: 14px;
  color: #94A3B8;
  pointer-events: none;
  display: flex;
  align-items: center;
  transition: color 0.2s;
}

.login-input-field {
  width: 100%;
  height: 48px;
  padding: 10px 42px 10px 44px;
  border-radius: 14px;
  border: 1.5px solid #E2E8F0;
  background: #FAF8F5;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-primary);
  transition: all 0.2s ease;
}

.login-input-field:focus {
  outline: none;
  background: #FFFFFF;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(254, 107, 35, 0.14);
}

.login-input-wrapper:focus-within .login-input-icon {
  color: var(--primary);
}

.login-toggle-pwd {
  position: absolute;
  right: 10px;
  background: none;
  border: none;
  color: #94A3B8;
  cursor: pointer;
  padding: 8px;
  display: flex;
  align-items: center;
  border-radius: 8px;
  transition: color 0.2s;
}

.login-toggle-pwd:hover {
  color: var(--primary);
}

.login-btn-submit {
  width: 100%;
  height: 50px;
  background: linear-gradient(135deg, #fe6b23 0%, #ea580c 100%);
  color: white;
  border: none;
  border-radius: 14px;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: 0 8px 22px rgba(254, 107, 35, 0.38);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  margin-top: 20px;
}

.login-btn-submit:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(254, 107, 35, 0.48);
}

.login-btn-submit:active:not(:disabled) {
  transform: translateY(0) scale(0.98);
}

.login-btn-submit:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

/* Sección de Accesos Rápidos de Prueba */
.login-quick-section {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px dashed #E2E8F0;
}

.login-quick-title {
  font-size: 0.72rem;
  font-weight: 800;
  color: #94A3B8;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  text-align: center;
  margin-bottom: 10px;
}

.login-quick-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.login-quick-pill {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  background: #F8FAFC;
  border: 1.5px solid #E2E8F0;
  border-radius: 14px;
  cursor: pointer;
  text-align: left;
  transition: all 0.2s ease;
  width: 100%;
}

.login-quick-pill:hover {
  background: #FFF7ED;
  border-color: var(--primary-tint);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(254, 107, 35, 0.12);
}

.login-quick-pill:active {
  transform: scale(0.98);
}

.login-quick-avatar {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
  flex-shrink: 0;
}

.login-quick-info {
  flex: 1;
  min-width: 0;
}

.login-quick-name {
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.login-quick-days {
  font-size: 0.72rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.login-quick-badge {
  font-size: 0.66rem;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}

.login-footer-hint {
  margin-top: 18px;
  text-align: center;
  font-size: 0.78rem;
  color: #94A3B8;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

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