/* ============================================================================
   AULA EF - Estilos CSS
   Optimizado para móvil (iPhone) con soporte multi-tema
   ============================================================================ */

/* TEMA OSCURO (por defecto) */
:root, [data-theme="dark"] {
  --bg-primary: #0f0f1a;
  --bg-secondary: #1a1a2e;
  --bg-card: #16213e;
  --bg-card-hover: #1f2b47;
  --text-primary: #eaeaea;
  --text-secondary: #a0a0a0;
  --text-muted: #666;
  --accent: #4f8cff;
  --accent-hover: #6ba3ff;
  --success: #00d26a;
  --warning: #ffc107;
  --danger: #ff4757;
  --border: #2a2a4a;
  --shadow: 0 4px 20px rgba(0,0,0,0.3);
  --radius: 12px;
  --radius-sm: 8px;
}

/* TEMA CLARO */
[data-theme="light"] {
  --bg-primary: #f5f5f7;
  --bg-secondary: #e8e8ed;
  --bg-card: #ffffff;
  --bg-card-hover: #f0f0f5;
  --text-primary: #1a1a1a;
  --text-secondary: #555555;
  --text-muted: #888888;
  --accent: #0066cc;
  --accent-hover: #0055aa;
  --success: #28a745;
  --warning: #e6a800;
  --danger: #dc3545;
  --border: #d0d0d5;
  --shadow: 0 4px 20px rgba(0,0,0,0.1);
}

/* TEMA AUTO (sigue preferencia del sistema) */
@media (prefers-color-scheme: light) {
  [data-theme="auto"] {
    --bg-primary: #f5f5f7;
    --bg-secondary: #e8e8ed;
    --bg-card: #ffffff;
    --bg-card-hover: #f0f0f5;
    --text-primary: #1a1a1a;
    --text-secondary: #555555;
    --text-muted: #888888;
    --accent: #0066cc;
    --accent-hover: #0055aa;
    --success: #28a745;
    --warning: #e6a800;
    --danger: #dc3545;
    --border: #d0d0d5;
    --shadow: 0 4px 20px rgba(0,0,0,0.1);
  }
}

@media (prefers-color-scheme: dark) {
  [data-theme="auto"] {
    --bg-primary: #0f0f1a;
    --bg-secondary: #1a1a2e;
    --bg-card: #16213e;
    --bg-card-hover: #1f2b47;
    --text-primary: #eaeaea;
    --text-secondary: #a0a0a0;
    --text-muted: #666;
    --accent: #4f8cff;
    --accent-hover: #6ba3ff;
    --success: #00d26a;
    --warning: #ffc107;
    --danger: #ff4757;
    --border: #2a2a4a;
    --shadow: 0 4px 20px rgba(0,0,0,0.3);
  }
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.5;
  padding-bottom: calc(70px + env(safe-area-inset-bottom));
}

/* ============================================================================
   HEADER
   ============================================================================ */

.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-secondary);
  padding: 16px 20px;
  padding-top: calc(16px + env(safe-area-inset-top));
  border-bottom: 1px solid var(--border);
}

.header h1 {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-primary);
}

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

/* ============================================================================
   NAVEGACIÓN INFERIOR (TAB BAR)
   ============================================================================ */

.tab-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-secondary);
  display: flex;
  justify-content: space-around;
  padding: 8px 12px;
  padding-bottom: calc(8px + env(safe-area-inset-bottom));
  padding-left: calc(12px + env(safe-area-inset-left));
  padding-right: calc(12px + env(safe-area-inset-right));
  border-top: 1px solid var(--border);
  z-index: 100;
}

.tab-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 6px 8px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.65rem;
  transition: color 0.2s;
  cursor: pointer;
  background: none;
  border: none;
  min-width: 0;
}

.tab-item.active {
  color: var(--accent);
}

.tab-item svg {
  width: 24px;
  height: 24px;
  margin-bottom: 4px;
}

/* ============================================================================
   CONTENEDOR PRINCIPAL
   ============================================================================ */

.main-content {
  padding: 16px;
}

.section {
  display: none;
}

.section.active {
  display: block;
}

/* ============================================================================
   CARDS
   ============================================================================ */

.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}

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

.card-title {
  font-size: 1.1rem;
  font-weight: 600;
}

.card-badge {
  background: var(--accent);
  color: white;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 500;
}

/* ============================================================================
   LISTAS
   ============================================================================ */

.list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.list-item {
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  transition: background 0.2s;
}

.list-item:active {
  background: var(--bg-card-hover);
}

.list-item.active {
  border-left: 4px solid var(--accent);
  background: var(--bg-card-hover);
}

.list-item-content {
  flex: 1;
}

.list-item-title {
  font-weight: 500;
  margin-bottom: 2px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.list-item-subtitle {
  font-size: 0.85rem;
  color: var(--text-secondary);
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
}

.list-item-compact {
  padding: 8px 12px;
}

.list-item-compact .list-item-title {
  font-size: 0.9rem;
  margin-bottom: 0;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  background: var(--accent);
  color: white;
  font-size: 0.75rem;
  font-weight: 600;
}

.sa-filtros {
  display: flex;
  gap: 8px;
  padding: 8px 0;
  margin-bottom: 8px;
}

.sa-filtros .form-select-sm {
  flex: 1;
  padding: 6px 32px 6px 8px;
  font-size: 0.75rem;
  background-position: right 4px center;
  background-size: 14px;
  text-overflow: ellipsis;
}

.sa-trimestre-header {
  padding: 8px 12px;
  background: var(--bg-secondary);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
}

.sa-asignatura-header {
  padding: 10px 12px;
  background: var(--accent);
  color: white;
  font-size: 0.9rem;
  font-weight: 600;
  margin-top: 12px;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}

.sa-asignatura-header:first-child {
  margin-top: 0;
}

.sa-trimestre-sub {
  padding-left: 20px;
  background: var(--bg-card);
}

.grupo-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.7rem;
  font-weight: 500;
  color: white;
  text-shadow: 0 1px 1px rgba(0,0,0,0.2);
}

.grupo-tag-flex {
  border: 1px dashed rgba(255,255,255,0.5);
}

.notas-medicas {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-style: italic;
}

.list-item-action {
  color: var(--text-muted);
}

/* ============================================================================
   FORMULARIOS
   ============================================================================ */

.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 12px 14px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 1rem;
  transition: border-color 0.2s;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--accent);
}

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

.form-select {
  /* Usar estilo nativo del sistema para compatibilidad macOS/Safari */
  cursor: pointer;
}

/* Select de tipo de festivo con colores */
.festivo-tipo-select.tipo-nacional {
  border-left: 4px solid #e74c3c;
  background-color: rgba(231, 76, 60, 0.1);
}
.festivo-tipo-select.tipo-autonomico {
  border-left: 4px solid #f39c12;
  background-color: rgba(243, 156, 18, 0.1);
}
.festivo-tipo-select.tipo-local {
  border-left: 4px solid #3498db;
  background-color: rgba(52, 152, 219, 0.1);
}
.festivo-tipo-select.tipo-vacaciones {
  border-left: 4px solid #9b59b6;
  background-color: rgba(155, 89, 182, 0.1);
}

/* ============================================================================
   MODAL INFO DÍA
   ============================================================================ */

.info-dia-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}

.info-dia-fecha {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.info-dia-section {
  margin-bottom: 16px;
}

.info-dia-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.info-dia-festivo {
  padding: 10px 12px;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.info-dia-sa {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.info-dia-franjas {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.info-dia-franja {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
}

.franja-hora {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  min-width: 100px;
}

.franja-asig {
  font-weight: 500;
  color: var(--text-primary);
}

.info-dia-grupo {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
}

.grupo-color {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.trim-badge-1 { background: var(--trim-1-color); color: white; padding: 4px 8px; border-radius: 4px; font-size: 0.8rem; }
.trim-badge-2 { background: var(--trim-2-color); color: white; padding: 4px 8px; border-radius: 4px; font-size: 0.8rem; }
.trim-badge-3 { background: var(--trim-3-color); color: white; padding: 4px 8px; border-radius: 4px; font-size: 0.8rem; }

/* ============================================================================
   BOTONES
   ============================================================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
  text-decoration: none;
}

.btn-primary {
  background: var(--accent);
  color: white;
}

.btn-primary:active {
  background: var(--accent-hover);
}

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

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

.btn-danger-outline {
  background: transparent;
  color: var(--danger);
  border: 1px solid var(--danger);
}
.btn-danger-outline:hover {
  background: var(--danger);
  color: white;
}

.btn-success {
  background: var(--success);
  color: white;
}

.btn-outline {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.btn-outline:hover,
.btn-outline:active {
  background: var(--bg-card-hover);
  border-color: var(--accent);
  color: var(--accent);
}

/* Tema claro: ajuste para btn-outline */
[data-theme="light"] .btn-outline {
  background: var(--bg-card);
  border-color: var(--border);
}

[data-theme="light"] .btn-outline:hover,
[data-theme="light"] .btn-outline:active {
  background: var(--bg-secondary);
  border-color: var(--accent);
}

@media (prefers-color-scheme: light) {
  [data-theme="auto"] .btn-outline {
    background: var(--bg-card);
    border-color: var(--border);
  }
  [data-theme="auto"] .btn-outline:hover,
  [data-theme="auto"] .btn-outline:active {
    background: var(--bg-secondary);
    border-color: var(--accent);
  }
}

.btn-ia {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  box-shadow: 0 2px 4px rgba(102, 126, 234, 0.3);
}

.btn-ia:hover, .btn-ia:active {
  background: linear-gradient(135deg, #5a6fd6 0%, #6a4190 100%);
  box-shadow: 0 3px 8px rgba(102, 126, 234, 0.4);
}

.btn-block {
  width: 100%;
}

.btn-sm {
  padding: 8px 14px;
  font-size: 0.9rem;
}

.btn-icon {
  padding: 10px;
  border-radius: 50%;
}

.btn-delete-tarea {
  background: transparent;
  border: none;
  padding: 4px 8px;
  font-size: 0.9rem;
  cursor: pointer;
  opacity: 0.5;
  transition: opacity 0.2s;
}

.btn-delete-tarea:hover {
  opacity: 1;
}

.btn-edit-tarea {
  background: transparent;
  border: none;
  padding: 4px 8px;
  font-size: 0.85rem;
  cursor: pointer;
  opacity: 0.5;
  transition: opacity 0.2s;
}

.btn-edit-tarea:hover {
  opacity: 1;
}

/* ============================================================================
   ASISTENCIA - GRID
   ============================================================================ */

.attendance-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}

.attendance-item {
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  padding: 12px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  border: 2px solid transparent;
}

.attendance-item.presente {
  border-color: var(--success);
  background: rgba(0, 210, 106, 0.1);
}

.attendance-item.ausente {
  border-color: var(--danger);
  background: rgba(255, 71, 87, 0.1);
}

.attendance-item.justificada {
  border-color: #3498db;
  background: rgba(52, 152, 219, 0.1);
}

.attendance-item.retraso {
  border-color: var(--warning);
  background: rgba(255, 193, 7, 0.1);
}

.attendance-item.sin-registrar {
  border-color: var(--border-color);
  background: var(--bg-secondary);
  opacity: 0.7;
}

.attendance-name {
  font-weight: 500;
  font-size: 0.9rem;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.attendance-status {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* Controles rápidos en asistencia */
.controles-header {
  font-weight: 600;
  font-size: 0.9rem;
  padding: 12px 0 8px;
  margin-top: 16px;
  border-top: 1px solid var(--border);
  color: var(--text-secondary);
}

.controles-asistencia-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.control-section {
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  padding: 12px;
}

.control-section-header {
  font-weight: 500;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.control-alumnos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 6px;
  padding: 8px;
  border-radius: var(--radius-sm);
  margin: 0 -12px -12px -12px;
  border-bottom-left-radius: var(--radius-sm);
  border-bottom-right-radius: var(--radius-sm);
}

.control-alumno-item {
  padding: 10px 8px;
  border-radius: var(--radius-sm);
  text-align: center;
  cursor: pointer;
  font-size: 0.85rem;
  border: 2px solid transparent;
  background: var(--bg-card);
  color: var(--text);
  transition: all 0.2s;
}

.control-alumno-item.cumple {
  border-color: var(--success);
  background: rgba(0, 210, 106, 0.15);
}

.control-alumno-item.no-cumple {
  border-color: var(--danger);
  background: rgba(255, 71, 87, 0.15);
}

.control-alumno-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Items de control en el modal */
.control-item-row {
  display: flex;
  gap: 8px;
  margin-bottom: 6px;
}

.control-item-row input {
  flex: 1;
}

.control-item-row .btn-remove {
  padding: 4px 8px;
  background: var(--danger);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

/* Grid de items en asistencia */
.control-items-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}

.control-item-badge {
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  cursor: pointer;
  border: 1px solid #5a5a7a;
  background: #2a2a4a;
  color: #e0e0e0;
}

.control-item-badge.cumple {
  background: rgba(0, 210, 106, 0.2);
  border-color: var(--success);
  color: var(--success);
}

.control-item-badge.no-cumple {
  background: rgba(255, 71, 87, 0.2);
  border-color: var(--danger);
  color: var(--danger);
}

.control-alumno-item-multi {
  padding: 8px;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  border: 1px solid var(--border);
}

/* ============================================================================
   TABS SIMPLES
   ============================================================================ */

.tabs-simple {
  display: flex;
  gap: 0;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  padding: 4px;
}

.tab-simple {
  flex: 1;
  padding: 8px 12px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all 0.2s;
}

.tab-simple.active {
  background: var(--bg-card);
  color: var(--text-primary);
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* ============================================================================
   EVALUACIÓN - NOTAS
   ============================================================================ */

.grade-input {
  width: 60px;
  text-align: center;
  font-size: 1.1rem;
  font-weight: 600;
}

.grade-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

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

.grade-name {
  flex: 1;
  font-weight: 500;
}

/* ============================================================================
   SELECTOR DE GRUPO
   ============================================================================ */

.group-selector {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 0;
  margin-bottom: 16px;
  -webkit-overflow-scrolling: touch;
}

.group-selector::-webkit-scrollbar {
  display: none;
}

.group-chip {
  flex-shrink: 0;
  padding: 8px 16px;
  background: var(--bg-card);
  border-radius: 20px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s;
  border: 1px solid var(--border);
  white-space: nowrap;
}

.group-chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

/* ============================================================================
   FECHA SELECTOR
   ============================================================================ */

.date-selector {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.date-nav-btn {
  background: var(--bg-card);
  border: none;
  color: var(--text-primary);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.date-display {
  flex: 1;
  text-align: center;
  font-weight: 500;
}

/* ============================================================================
   MODAL
   ============================================================================ */

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 200;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s;
}

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

.modal {
  background: var(--bg-secondary);
  width: 100%;
  max-height: 90vh;
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 20px;
  padding-bottom: calc(20px + env(safe-area-inset-bottom));
  transform: translateY(100%);
  transition: transform 0.3s;
  overflow-y: auto;
}

.modal-sm {
  max-height: 70vh;
}

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

/* Estilos para modal info día */
.info-dia-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.info-dia-fecha {
  font-size: 1.1rem;
  font-weight: 600;
}

.info-dia-section {
  margin-bottom: 16px;
}

.info-dia-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.info-dia-festivo {
  padding: 12px;
  background: var(--bg-primary);
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.info-dia-sa {
  padding: 12px;
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.info-dia-franjas {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.info-dia-franja {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  background: var(--bg-primary);
  border-radius: var(--radius-sm);
}

.franja-hora {
  font-size: 0.85rem;
  color: var(--text-secondary);
  min-width: 100px;
}

.franja-asig {
  font-weight: 500;
}

.info-dia-grupo {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--bg-primary);
  border-radius: var(--radius-sm);
}

.grupo-color {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.trim-badge-1 {
  background: var(--trim-1-color);
  color: white;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
}

.trim-badge-2 {
  background: var(--trim-2-color);
  color: white;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
}

.trim-badge-3 {
  background: var(--trim-3-color);
  color: white;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
}

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

.modal-title {
  font-size: 1.2rem;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

/* ============================================================================
   ESTADÍSTICAS / DASHBOARD
   ============================================================================ */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 6px;
}

/* ============================================================================
   INCIDENCIAS
   ============================================================================ */

.incident-type {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 500;
}

.incident-type.positivo {
  background: rgba(0, 210, 106, 0.2);
  color: var(--success);
}

.incident-type.negativo {
  background: rgba(255, 71, 87, 0.2);
  color: var(--danger);
}

/* ============================================================================
   BÚSQUEDA
   ============================================================================ */

.search-box {
  position: relative;
  margin-bottom: 16px;
}

.search-box input {
  width: 100%;
  padding: 12px 14px 12px 44px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 1rem;
}

.search-box svg {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  width: 20px;
  height: 20px;
}

/* ============================================================================
   VACÍO
   ============================================================================ */

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-secondary);
}

.empty-state svg {
  width: 64px;
  height: 64px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-state p {
  margin-bottom: 16px;
}

/* ============================================================================
   TOAST / NOTIFICACIONES
   ============================================================================ */

.toast {
  position: fixed;
  bottom: calc(80px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--bg-card);
  color: var(--text-primary);
  padding: 12px 24px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  z-index: 300;
  opacity: 0;
  transition: all 0.3s;
}

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

.toast.success {
  background: var(--success);
}

.toast.error {
  background: var(--danger);
}

/* ============================================================================
   LOADER
   ============================================================================ */

.loader {
  display: flex;
  justify-content: center;
  padding: 40px;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* ============================================================================
   UTILIDADES
   ============================================================================ */

.hidden {
  display: none !important;
}

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

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

.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
}

.alert-warning {
  background: #fff3cd;
  color: #856404;
  border: 1px solid #ffc107;
}

.alert-info {
  background: #d1ecf1;
  color: #0c5460;
  border: 1px solid #17a2b8;
}

.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }

.flex {
  display: flex;
}

.flex-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.gap-2 { gap: 8px; }
.gap-4 { gap: 16px; }

/* Checkbox items */
.checkbox-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  cursor: pointer;
}

.checkbox-item input {
  width: 20px;
  height: 20px;
  accent-color: var(--accent);
}

.checkbox-item span {
  flex: 1;
}

/* Text success */
.text-success {
  color: var(--success);
}

/* Incident type inline */
.incident-type {
  margin-right: 8px;
}

/* Color input fix */
input[type="color"] {
  padding: 4px;
  cursor: pointer;
}

/* ============================================================================
   CALIFICACIONES CUALITATIVAS
   ============================================================================ */

.calif-row {
  display: flex;
  flex-direction: column;
  padding: 12px;
  border-bottom: 1px solid var(--border);
  gap: 8px;
}

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

.calif-nombre {
  font-weight: 500;
  font-size: 0.95rem;
}

.calif-niveles {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.calif-btn {
  padding: 6px 10px;
  font-size: 0.75rem;
  border-radius: 4px;
  border: 2px solid var(--btn-color, #7f8c8d);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.calif-btn:hover {
  background: var(--btn-color);
  color: white;
}

.calif-btn.active {
  background: var(--btn-color);
  color: white;
}

/* Nivel badge */
.nivel-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  color: white;
  white-space: nowrap;
}

/* Tabla resumen */
.resumen-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.resumen-table th,
.resumen-table td {
  padding: 8px 4px;
  text-align: center;
  border-bottom: 1px solid var(--border);
}

.resumen-table th {
  background: var(--bg-card);
  font-weight: 600;
  font-size: 0.75rem;
}

.resumen-table td:first-child,
.resumen-table th:first-child {
  text-align: left;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Escala editor */
.escala-item {
  padding: 12px;
  margin-bottom: 8px;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
}

.escala-item .form-label {
  font-weight: 600;
  margin-bottom: 8px;
}

.escala-item .flex {
  align-items: center;
}

.escala-item span {
  color: var(--text-muted);
}

/* Padding en contenedor */
.p-2 {
  padding: 8px;
}

/* Checkbox grid */
.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 8px;
  padding: 8px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.checkbox-grid .checkbox-item {
  border: none;
  padding: 8px;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
}

/* Tarea activa */
.tarea-item {
  cursor: pointer;
  transition: all 0.2s;
}

.tarea-item:hover {
  background: var(--bg);
}

.tarea-item.active {
  background: var(--accent);
  color: white;
}

.tarea-item.active .list-item-subtitle {
  color: rgba(255,255,255,0.8);
}

/* ============================================================================
   PANTALLA INICIO - ACCESOS RÁPIDOS
   ============================================================================ */

.quick-access-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.quick-access-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 20px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text);
}

.quick-access-btn:hover {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.quick-access-btn:active {
  transform: scale(0.98);
}

.quick-icon {
  font-size: 1.8rem;
}

/* Mini horario semanal */
.mini-horario-tabs {
  display: flex;
  gap: 2px;
  margin-bottom: 8px;
}

.mini-tab {
  flex: 1;
  padding: 6px 2px;
  border: none;
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.2s;
}

.mini-tab.active {
  background: var(--accent);
  color: white;
}

.mini-tab.hoy {
  border: 2px solid var(--accent);
}

.mh-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 6px;
  margin-bottom: 3px;
  border-radius: 4px;
  font-size: 0.8rem;
  border: 1px solid var(--mh-color, var(--accent));
}

/* Docencia: fondo sólido con color + efecto 3D */
.mh-row.mh-docencia {
  background: linear-gradient(135deg, var(--mh-color, var(--accent)) 0%, color-mix(in srgb, var(--mh-color, var(--accent)) 70%, black) 100%);
  color: white;
  border: none;
  box-shadow: 
    2px 2px 4px rgba(0,0,0,0.4),
    inset 1px 1px 2px rgba(255,255,255,0.3);
}

.mh-row.mh-docencia .mh-hora,
.mh-row.mh-docencia .mh-grupo {
  color: rgba(255,255,255,0.85);
}

/* Apoyo: fondo claro con efecto 3D sutil */
.mh-row.mh-apoyo {
  background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
  border: 2px solid var(--mh-color, var(--accent));
  box-shadow: 
    2px 2px 3px rgba(0,0,0,0.15),
    inset 1px 1px 2px rgba(255,255,255,0.5);
}

.mh-hora {
  color: var(--text-secondary);
  font-size: 0.7rem;
  min-width: 36px;
}

.mh-asig {
  font-weight: 500;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mh-grupo {
  font-size: 0.7rem;
  color: var(--text-secondary);
  white-space: nowrap;
}

.mh-tareas-badge {
  background: rgba(255,255,255,0.3);
  color: white;
  font-size: 0.65rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
}

.mh-tareas-badge.mh-tareas-heredado {
  background: rgba(0,0,0,0.55);
  color: rgba(255,255,255,0.35);
  opacity: 0.5;
}

/* Stats compactos */
.stats-grid-compact {
  display: flex;
  justify-content: space-around;
  padding: 12px;
  background: var(--bg-card);
  border-radius: var(--radius);
  margin-bottom: 16px;
  border: 1px solid var(--border);
}

.stat-mini {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.stat-value-mini {
  font-weight: 700;
  color: var(--accent);
}

/* Grupos flexibles en inicio */
/* Chips de grupos (base y flexibles) */
#grupos-base-inicio .gf-chip,
#grupos-flexibles-inicio .gf-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 14px 20px;
  margin: 4px;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
  color: white;
  min-width: 70px;
  min-height: 48px;
  text-align: center;
}

#grupos-base-inicio .gf-chip:hover,
#grupos-base-inicio .gf-chip:active,
#grupos-flexibles-inicio .gf-chip:hover,
#grupos-flexibles-inicio .gf-chip:active {
  transform: scale(1.03);
  box-shadow: 0 3px 10px rgba(0,0,0,0.25);
}

/* Contenedores de chips */
#grupos-base-inicio,
#grupos-flexibles-inicio {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 0;
}

/* Botones de ordenar alumnos */
.alumno-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.alumno-num {
  min-width: 24px;
  text-align: center;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
}

/* Drag & Drop para reordenar */
.drag-handle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 36px;
  color: var(--text-muted);
  font-size: 1rem;
  cursor: grab;
  touch-action: none;
  user-select: none;
  flex-shrink: 0;
}

.drag-handle:active {
  cursor: grabbing;
}

.draggable-item {
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}

.draggable-item.dragging {
  opacity: 0.9;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  background: var(--bg-secondary);
  z-index: 100;
  transform: scale(1.02);
}

.drag-active .draggable-item:not(.dragging) {
  opacity: 0.7;
}

.draggable-item.drag-target {
  border-top: 2px dashed var(--accent);
}

/* Horario */
.horario-grid {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE/Edge */
  padding-bottom: 4px;
  min-width: 100%;
}

.horario-grid::-webkit-scrollbar {
  height: 0;
  background: transparent;
}

.horario-grid:hover::-webkit-scrollbar,
.horario-grid:active::-webkit-scrollbar {
  height: 6px;
}

.horario-grid:hover::-webkit-scrollbar-thumb,
.horario-grid:active::-webkit-scrollbar-thumb {
  background: var(--text-muted);
  border-radius: 3px;
}

.horario-grid:hover,
.horario-grid:active {
  scrollbar-width: thin; /* Firefox */
}

.horario-dia {
  flex: 1 1 0;
  min-width: 0;
  text-align: center;
  display: flex;
  flex-direction: column;
}

.horario-dia strong {
  display: block;
  padding: 4px 0;
  font-size: 0.7rem;
  color: var(--text-muted);
  flex-shrink: 0;
}

.horario-dia-content {
  position: relative;
  flex: 1;
  background: var(--bg);
  border-radius: 4px;
  min-height: 250px;
}

.horario-franja {
  position: absolute;
  left: 1px;
  right: 1px;
  border-radius: 4px;
  padding: 2px 4px;
  font-size: 0.65rem;
  border: 1px solid var(--franja-color, #ccc);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
  box-sizing: border-box;
  cursor: pointer;
}

/* Docencia: fondo sólido con color + efecto 3D */
.horario-franja.franja-docencia {
  background: linear-gradient(135deg, var(--franja-color, #ccc) 0%, color-mix(in srgb, var(--franja-color, #ccc) 70%, black) 100%);
  color: white;
  border: none;
  box-shadow: 
    3px 3px 6px rgba(0,0,0,0.4),
    inset 1px 1px 2px rgba(255,255,255,0.3),
    inset -1px -1px 2px rgba(0,0,0,0.2);
}

.horario-franja.franja-docencia small {
  color: rgba(255,255,255,0.8);
}

/* Apoyo: fondo claro con efecto 3D sutil */
.horario-franja.franja-apoyo {
  background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-secondary) 100%);
  border: 2px solid var(--franja-color, #ccc);
  box-shadow: 
    2px 2px 4px rgba(0,0,0,0.2),
    inset 1px 1px 2px rgba(255,255,255,0.5);
}

.horario-franja small {
  display: block;
  font-size: 0.6rem;
}

.horario-franja:not(.franja-docencia) small {
  color: var(--text-muted);
}

.horario-franja span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.franja-desdoble {
  opacity: 0.7;
}

.mh-row.mh-flex {
  opacity: 0.7;
}

.asig-color {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Modal fullscreen */
.modal-fullscreen {
  max-width: 100%;
  width: 100%;
  height: 100%;
  max-height: 100%;
  border-radius: 0;
  display: flex;
  flex-direction: column;
}

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

/* Calendario SA */
.calendario-nav {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  margin-bottom: 12px;
}

.calendario-nav span {
  font-weight: 600;
  min-width: 150px;
  text-align: center;
}

/* Label del mes con color de trimestre (vista móvil) */
.calendario-mes-label {
  font-weight: 600;
  min-width: 150px;
  text-align: center;
  padding: 6px 16px;
  border-radius: var(--radius);
}

.calendario-mes-label.titulo-trim-1 { background: var(--trim-1-color); color: white; }
.calendario-mes-label.titulo-trim-2 { background: var(--trim-2-color); color: white; }
.calendario-mes-label.titulo-trim-3 { background: var(--trim-3-color); color: white; }
.calendario-mes-label.titulo-trim-mixto-1-2 { 
  background: linear-gradient(90deg, var(--trim-1-color) 0%, var(--trim-2-color) 100%);
  color: white;
}
.calendario-mes-label.titulo-trim-mixto-2-3 { 
  background: linear-gradient(90deg, var(--trim-2-color) 0%, var(--trim-3-color) 100%);
  color: white;
}

.calendario-anual {
  flex: 1;
  overflow-y: auto;
}

.calendario-mes {
  margin-bottom: 16px;
}

.calendario-mes-titulo {
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-muted);
}

.calendario-semana {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 2px;
  margin-bottom: 2px;
}

.calendario-dia-header {
  text-align: center;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  padding: 4px;
}

.calendario-dia {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.15s;
  border: 1px solid var(--border);
  background: var(--bg-card);
  position: relative;
}

.calendario-dia:hover {
  transform: scale(1.1);
  z-index: 1;
}

.calendario-dia.festivo-nacional {
  background: repeating-linear-gradient(
    -45deg,
    #e0e0e0,
    #e0e0e0 4px,
    #d0d0d0 4px,
    #d0d0d0 8px
  ) !important;
  color: #666;
  cursor: not-allowed;
  border-left: 4px solid #e74c3c !important;
}

.calendario-dia.festivo-autonomico {
  background: repeating-linear-gradient(
    -45deg,
    #e0e0e0,
    #e0e0e0 4px,
    #d0d0d0 4px,
    #d0d0d0 8px
  ) !important;
  color: #666;
  cursor: not-allowed;
  border-left: 4px solid #f39c12 !important;
}

.calendario-dia.festivo-local {
  background: repeating-linear-gradient(
    -45deg,
    #e0e0e0,
    #e0e0e0 4px,
    #d0d0d0 4px,
    #d0d0d0 8px
  ) !important;
  color: #666;
  cursor: not-allowed;
  border-left: 4px solid #3498db !important;
}

.calendario-dia.festivo-vacaciones {
  background: repeating-linear-gradient(
    -45deg,
    #e0e0e0,
    #e0e0e0 4px,
    #d0d0d0 4px,
    #d0d0d0 8px
  ) !important;
  color: #666;
  cursor: not-allowed;
  border-left: 4px solid #9b59b6 !important;
}

.calendario-dia.tiene-sa {
  border-width: 2px;
}

.calendario-dia.fuera-mes {
  opacity: 0.3;
  pointer-events: none;
}

.calendario-dia .dia-num {
  font-weight: 600;
}

.calendario-dia .dia-sa {
  font-size: 0.6rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  padding: 0 2px;
}

/* Día actual */
.calendario-dia.dia-hoy,
.dia-mini.dia-hoy {
  outline: 3px solid var(--accent);
  outline-offset: -3px;
  font-weight: bold;
}

.dia-mini.dia-hoy {
  outline-width: 2px;
  outline-offset: -2px;
}

/* Indicador de scroll */
.scroll-container {
  position: relative;
}

.scroll-indicator {
  text-align: center;
  padding: 8px;
  background: linear-gradient(transparent, var(--bg-card));
  color: var(--accent);
  font-size: 0.85rem;
  animation: bounce 1s infinite;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(4px); }
}

.calendario-leyenda {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 12px;
  background: var(--bg);
  border-radius: var(--radius);
  margin-top: 8px;
  font-size: 0.75rem;
}

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

.leyenda-color {
  width: 12px;
  height: 12px;
  border-radius: 2px;
  flex-shrink: 0;
}

/* Leyenda con secciones */
.leyenda-sections {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.leyenda-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 12px;
  background: var(--bg-secondary);
  border-radius: var(--radius);
}

.leyenda-section-title {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.leyenda-items {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.leyenda-section .btn {
  margin-top: 4px;
  align-self: flex-start;
}

.leyenda-trim {
  width: 16px;
  height: 4px;
  border-radius: 1px;
}

.leyenda-trim.trim-1 { background: #27ae60; }
.leyenda-trim.trim-2 { background: #3498db; }
.leyenda-trim.trim-3 { background: #9b59b6; }

.leyenda-sep {
  width: 1px;
  background: var(--border);
  margin: 0 4px;
}

/* Barra de trimestres */
.trimestres-bar {
  margin-bottom: 12px;
  display: none;
}

.trimestres-track {
  position: relative;
  height: 24px;
  background: var(--bg-secondary);
  border-radius: var(--radius);
  overflow: hidden;
}

.trim-segment {
  position: absolute;
  top: 0;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
  color: white;
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
  cursor: default;
}

.trim-segment.trim-1 { background: #27ae60; }
.trim-segment.trim-2 { background: #3498db; }
.trim-segment.trim-3 { background: #9b59b6; }

.trimestres-warning {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px;
  background: var(--bg-secondary);
  border-radius: var(--radius);
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* Tabs asignaturas */
.tabs-container {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  padding-bottom: 8px;
  margin-bottom: 12px;
}

.tab-asig {
  padding: 8px 16px;
  border: none;
  background: var(--bg);
  border-radius: var(--radius);
  cursor: pointer;
  white-space: nowrap;
  font-size: 0.85rem;
}

.tab-asig.active {
  background: var(--accent);
  color: white;
}

/* Modo pintar/borrar */
#btn-modo-pintar.active,
#btn-modo-borrar.active {
  background: var(--accent);
  color: white;
}

/* Vista anual calendario (desktop) */
.calendario-anual-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
}

.calendario-mes-mini {
  background: var(--bg);
  border-radius: var(--radius);
  padding: 8px;
}

.mes-mini-titulo {
  font-weight: 600;
  text-align: center;
  margin-bottom: 6px;
  font-size: 0.8rem;
  color: var(--text-muted);
  padding: 4px 6px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.mes-mini-dias {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 2px;
}

.mes-mini-header {
  text-align: center;
  font-size: 0.6rem;
  color: var(--text-muted);
  font-weight: 600;
}

.dia-mini {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  border-radius: 3px;
  cursor: pointer;
  background: var(--bg-card);
  transition: transform 0.1s;
}

.dia-mini:hover {
  transform: scale(1.2);
  z-index: 1;
}

.dia-mini.vacio {
  background: transparent;
  cursor: default;
}

.dia-mini.festivo-nacional { 
  background: repeating-linear-gradient(-45deg, #e0e0e0, #e0e0e0 2px, #d0d0d0 2px, #d0d0d0 4px); 
  color: #666;
  border-left: 2px solid #e74c3c;
}
.dia-mini.festivo-autonomico { 
  background: repeating-linear-gradient(-45deg, #e0e0e0, #e0e0e0 2px, #d0d0d0 2px, #d0d0d0 4px); 
  color: #666;
  border-left: 2px solid #f39c12;
}
.dia-mini.festivo-local { 
  background: repeating-linear-gradient(-45deg, #e0e0e0, #e0e0e0 2px, #d0d0d0 2px, #d0d0d0 4px); 
  color: #666;
  border-left: 2px solid #3498db;
}
.dia-mini.festivo-vacaciones { 
  background: repeating-linear-gradient(-45deg, #e0e0e0, #e0e0e0 2px, #d0d0d0 2px, #d0d0d0 4px); 
  color: #666;
  border-left: 2px solid #9b59b6;
}

/* Marcado sutil de trimestres en calendario - por día (desactivado) */
/*
.dia-mini.trim-1 { border-bottom: 2px solid #27ae60; }
.dia-mini.trim-2 { border-bottom: 2px solid #3498db; }
.dia-mini.trim-3 { border-bottom: 2px solid #9b59b6; }
*/

/* Variables de colores de trimestre */
:root {
  --trim-1-color: #27ae60;
  --trim-2-color: #3498db;
  --trim-3-color: #9b59b6;
}

/* Trimestres en meses: cabecera con fondo */
.mes-mini-titulo.titulo-trim-1 { background: var(--trim-1-color); color: white; }
.mes-mini-titulo.titulo-trim-2 { background: var(--trim-2-color); color: white; }
.mes-mini-titulo.titulo-trim-3 { background: var(--trim-3-color); color: white; }

/* Meses mixtos: gradiente entre dos trimestres */
.mes-mini-titulo.titulo-trim-mixto-1-2 { 
  background: linear-gradient(90deg, var(--trim-1-color) 0%, var(--trim-2-color) 100%);
  color: white;
}
.mes-mini-titulo.titulo-trim-mixto-2-3 { 
  background: linear-gradient(90deg, var(--trim-2-color) 0%, var(--trim-3-color) 100%);
  color: white;
}

/* Responsive: 2 columnas en tablet */
@media (max-width: 1024px) and (min-width: 768px) {
  .calendario-anual-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (max-width: 900px) and (min-width: 768px) {
  .calendario-anual-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ============================================================================
   LOGIN SCREEN
   ============================================================================ */

.login-screen {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.login-container {
  background: var(--card-bg);
  padding: 40px;
  border-radius: 16px;
  text-align: center;
  max-width: 320px;
  width: 90%;
  box-shadow: 0 10px 40px rgba(0,0,0,0.3);
}

.login-container h1 {
  font-size: 2rem;
  margin-bottom: 8px;
}

.pin-input {
  text-align: center;
  font-size: 1.5rem;
  letter-spacing: 8px;
  padding: 16px;
}

.text-danger {
  color: #e74c3c;
}

.text-sm {
  font-size: 0.85rem;
}

/* Popup info franja */
.franja-popup {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
}

.franja-popup-content {
  background: var(--bg-card);
  border-radius: 12px;
  max-width: 300px;
  width: 100%;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

.franja-popup-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: var(--bg);
}

.franja-popup-header strong {
  font-size: 1rem;
}

.franja-popup-header button {
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  color: var(--text-muted);
  padding: 0;
  line-height: 1;
}

.franja-popup-body {
  padding: 16px;
}

.franja-popup-body p {
  margin: 8px 0;
  font-size: 0.9rem;
}

.horario-franja {
  cursor: pointer;
}

/* Color picker mini en listas */
.color-picker-mini {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  padding: 0;
  background: none;
  flex-shrink: 0;
}

.color-picker-mini::-webkit-color-swatch-wrapper {
  padding: 2px;
}

.color-picker-mini::-webkit-color-swatch {
  border-radius: 6px;
  border: 2px solid rgba(255,255,255,0.3);
}

/* Color input en formularios */
.color-input {
  height: 50px;
  padding: 4px;
  cursor: pointer;
}

.color-input::-webkit-color-swatch-wrapper {
  padding: 4px;
}

.color-input::-webkit-color-swatch {
  border-radius: 6px;
  border: none;
}

/* ============================================================================
   INFORMES
   ============================================================================ */

.informe-table-wrapper {
  overflow-x: auto;
  margin-top: 12px;
}

.informe-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.informe-table th,
.informe-table td {
  padding: 8px 10px;
  text-align: center;
  border-bottom: 1px solid var(--border);
}

.informe-table th {
  background: var(--bg-secondary);
  font-weight: 600;
  font-size: 0.75rem;
  white-space: nowrap;
}

.informe-table th:first-child,
.informe-table td.alumno-cell {
  text-align: left;
  position: sticky;
  left: 0;
  background: var(--bg-card);
  z-index: 1;
}

.informe-table td.alumno-cell {
  font-weight: 500;
  white-space: nowrap;
}

.informe-table .nota-cell {
  font-weight: 600;
  min-width: 50px;
}

.informe-table .media-cell {
  background: var(--bg-secondary);
}

.nota-excelente { color: #27ae60; }
.nota-bien { color: #3498db; }
.nota-suficiente { color: #f39c12; }
.nota-insuficiente { color: #e74c3c; }

/* ============================================================================
   SELECTOR DE IDIOMA
   ============================================================================ */

.lang-selector {
  display: flex;
  gap: 8px;
}

.lang-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px 8px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-secondary);
  cursor: pointer;
  transition: all 0.2s;
}

.lang-btn:hover {
  border-color: var(--accent);
}

.lang-btn.active {
  border-color: var(--accent);
  background: rgba(78, 205, 196, 0.15);
}

.lang-btn .flag {
  font-size: 1.5rem;
}

.lang-btn .name {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* Selector de tema */
.theme-selector {
  display: flex;
  gap: 8px;
}

.theme-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px 8px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-secondary);
  cursor: pointer;
  transition: all 0.2s;
}

.theme-btn:hover {
  border-color: var(--accent);
}

.theme-btn.active {
  border-color: var(--accent);
  background: rgba(79, 140, 255, 0.15);
}

.theme-btn .theme-icon {
  font-size: 1.5rem;
}

.theme-btn .theme-name {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* Selector de proveedor IA */
.provider-selector {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.provider-btn {
  flex: 1;
  min-width: 90px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px 8px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-secondary);
  cursor: pointer;
  transition: all 0.2s;
}

.provider-btn:hover {
  border-color: var(--accent);
}

.provider-btn.active {
  border-color: var(--accent);
  background: rgba(78, 205, 196, 0.15);
}

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

.provider-btn .provider-icon {
  font-size: 1.5rem;
}

.provider-btn .provider-name {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-primary);
}

.provider-btn .provider-tag {
  font-size: 0.65rem;
  padding: 2px 6px;
  border-radius: 10px;
  background: var(--success);
  color: white;
}

.provider-btn .provider-tag.paid {
  background: var(--warning);
}

/* ============================================================================
   EDITOR DE TRADUCCIONES
   ============================================================================ */

.trad-list {
  max-height: calc(100vh - 280px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.trad-section {
  margin-bottom: 16px;
}

.trad-section-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
}

.trad-section-header:hover {
  background: var(--bg-card-hover);
}

.trad-section-header .arrow {
  transition: transform 0.2s;
}

.trad-section.open .trad-section-header .arrow {
  transform: rotate(90deg);
}

.trad-section-content {
  display: none;
  padding: 8px 0;
}

.trad-section.open .trad-section-content {
  display: block;
}

.trad-item {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}

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

.trad-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.trad-item-original {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.trad-item-edit {
  display: flex;
  gap: 8px;
  align-items: center;
}

.trad-input {
  flex: 1;
  padding: 10px 12px;
  border: 2px dashed var(--border) !important;
  border-radius: var(--radius-sm);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 0.95rem;
}

.trad-input:focus {
  outline: none;
  border: 2px solid var(--accent) !important;
  background: var(--bg-card);
}

.trad-item.trad-customized .trad-input {
  border: 2px solid var(--accent) !important;
  background: rgba(79, 140, 255, 0.08);
}

.trad-item.trad-customized {
  background: rgba(79, 140, 255, 0.05);
  border-left: 3px solid var(--accent);
}

.btn-trad {
  padding: 8px 12px;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 1rem;
  background: var(--bg-secondary);
  flex-shrink: 0;
}

.btn-trad:hover {
  background: var(--bg-card-hover);
}

.btn-trad-save:hover {
  background: var(--success);
}

.btn-trad-reset:hover {
  background: var(--danger);
}

.trad-counter {
  font-size: 0.8rem;
  color: var(--accent);
  margin-left: auto;
  margin-right: 1rem;
}

.trad-key {
  font-family: monospace;
  font-size: 0.75rem;
  color: var(--text-muted);
  background: var(--bg-secondary);
  padding: 2px 6px;
  border-radius: 4px;
}

.trad-badge {
  font-size: 0.75rem;
}

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

.trad-value-original {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.trad-section-toggle {
  font-size: 0.7rem;
  transition: transform 0.2s;
}

.trad-section-name {
  flex: 1;
}

.trad-section-count {
  font-size: 0.75rem;
  color: var(--text-muted);
  background: var(--bg-card);
  padding: 2px 8px;
  border-radius: 10px;
}

.trad-cat-badge {
  font-size: 0.7rem;
  color: white;
  background: var(--accent);
  padding: 2px 6px;
  border-radius: 10px;
  margin-left: 4px;
}

.trad-empty {
  text-align: center;
  padding: 2rem;
  color: var(--text-muted);
}

.trad-count {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-left: auto;
}

.trad-count-modified {
  color: var(--warning);
  font-weight: 600;
}

/* Pestañas de evaluación */
.eval-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 16px;
  border-bottom: 2px solid var(--border);
}

.eval-tab {
  flex: 1;
  padding: 12px 16px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.2s;
}

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

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

.eval-content {
  animation: fadeIn 0.2s ease;
}

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

/* Drag & Drop */
.list-item-draggable {
  display: flex;
  align-items: center;
  cursor: default;
}

.drag-handle {
  cursor: grab;
  padding: 8px 4px 8px 8px;
  color: var(--text-muted);
  font-size: 14px;
  user-select: none;
  opacity: 0.5;
  transition: opacity 0.2s;
}

.drag-handle:hover {
  opacity: 1;
}

.drag-handle:active {
  cursor: grabbing;
}

.list-item-draggable.dragging {
  opacity: 0.5;
  background: var(--bg-hover);
}

.list-item-draggable.drag-over {
  border-top: 2px solid var(--accent);
  margin-top: -2px;
}

.list-item-content-grow {
  flex: 1;
}

/* Leyenda SA colapsable */
.btn-leyenda-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 8px;
}

#leyenda-sa-icon {
  font-size: 10px;
}

.leyenda-sa-collapsed {
  display: none;
}

.leyenda-sa-expanded {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  width: 100%;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

/* Input color */
.form-color {
  height: 40px;
  padding: 4px;
  cursor: pointer;
}

/* Date Picker personalizado */
.date-picker-wrapper {
  position: relative;
}

.date-picker-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 1000;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  min-width: 280px;
}

.date-picker-dropdown.show {
  display: block;
}

.date-picker-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.date-picker-header button {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  padding: 4px 8px;
  color: var(--text);
}

.date-picker-header span {
  font-weight: 600;
}

.date-picker-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.date-picker-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.date-picker-day {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  cursor: pointer;
  font-size: 14px;
  transition: background 0.2s;
}

.date-picker-day:hover {
  background: var(--primary-light);
}

.date-picker-day.other-month {
  color: var(--text-muted);
  opacity: 0.5;
}

.date-picker-day.today {
  border: 2px solid var(--primary);
}

.date-picker-day.selected {
  background: var(--primary);
  color: white;
}

/* Tag grupo base en asistencia GF */
.grupo-base-tag {
  display: inline-block;
  font-size: 10px;
  background: var(--primary-light);
  color: var(--primary);
  padding: 1px 6px;
  border-radius: 10px;
  margin-left: 6px;
  font-weight: 500;
}

/* Tag grupo base en controles */
.control-grupo-tag {
  display: inline-block;
  font-size: 8px;
  background: var(--border);
  color: var(--text-muted);
  padding: 0 4px;
  border-radius: 6px;
  margin-left: 2px;
  vertical-align: middle;
}

/* Calendario SA responsive para móvil */
@media (max-width: 480px) {
  .calendario-mes {
    padding: 0 4px;
  }
  
  .calendario-semana {
    gap: 1px;
  }
  
  .calendario-dia-header {
    font-size: 0.6rem;
    padding: 2px;
  }
  
  .calendario-dia {
    aspect-ratio: auto;
    min-height: 36px;
    font-size: 0.65rem;
    padding: 2px;
  }
  
  .calendario-dia .dia-num {
    font-size: 0.7rem;
  }
  
  .calendario-dia .dia-sa {
    font-size: 0.5rem;
    display: none; /* Ocultar nombre SA en móvil para ahorrar espacio */
  }
  
  .calendario-dia:hover {
    transform: none; /* Desactivar zoom en móvil */
  }
  
  .calendario-nav {
    padding: 8px;
  }
  
  .calendario-nav span {
    font-size: 0.9rem;
  }
  
  .calendario-anual {
    flex: none;
    overflow-y: visible;
  }
  
  .calendario-leyenda {
    margin-top: 8px;
  }
}

/* ============================================================================
   CALIFICACIONES - NUEVOS ESTILOS
   ============================================================================ */

.calif-grid-simple {
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.calif-grid-simple .calif-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 8px;
}

.calif-grid-simple .calif-row:last-child {
  border-bottom: none;
}

.calif-grid-simple .calif-nombre {
  flex: 1;
  min-width: 120px;
  font-size: 0.9rem;
}

.calif-btns {
  display: flex;
  gap: 4px;
}

.calif-btns .calif-btn {
  padding: 6px 10px;
  font-size: 0.75rem;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  cursor: pointer;
}

.calif-btns .calif-btn:hover {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.calif-btns .calif-btn.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

/* Tabla rúbrica */
.calif-grid-rubrica {
  overflow-x: auto;
  max-width: 100%;
}

.calif-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.85rem;
}

.calif-table th,
.calif-table td {
  padding: 8px 6px;
  border: 1px solid var(--border);
  text-align: center;
}

.calif-table th {
  background: var(--bg-card);
  font-weight: 600;
  font-size: 0.75rem;
}

/* Columna de nombres fija */
.calif-table th:first-child,
.calif-table .calif-nombre {
  position: sticky;
  left: 0;
  background: var(--bg-card);
  z-index: 1;
  min-width: 120px;
  max-width: 150px;
  box-shadow: 2px 0 4px rgba(0,0,0,0.1);
}

.calif-table .calif-nombre {
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.calif-select {
  padding: 4px;
  font-size: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg);
  color: var(--text);
  width: 50px;
}

/* Botón cíclico de calificación */
.calif-ciclo {
  padding: 6px 10px;
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: 4px;
  border: none;
  cursor: pointer;
  min-width: 36px;
  transition: background 0.15s;
}

.calif-ciclo[data-nivel="muy_alto"] { background: #27ae60; color: white; }
.calif-ciclo[data-nivel="alto"] { background: #2ecc71; color: white; }
.calif-ciclo[data-nivel="medio"] { background: #f39c12; color: white; }
.calif-ciclo[data-nivel="bajo"] { background: #e67e22; color: white; }
.calif-ciclo[data-nivel="no_conseguido"] { background: #e74c3c; color: white; }

/* Indicadores en modal rúbrica */
.indicador-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.indicador-row .indicador-nombre {
  flex: 1;
}

.indicador-row .btn-icon {
  padding: 4px 8px;
}

/* Sub-navegación en header (Planificar) */
.header-subnav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
  padding: 12px;
  background: var(--bg-secondary);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.subnav-btn {
  flex: 1 1 auto;
  max-width: calc(50% - 4px);
  padding: 10px 12px;
  border: 1px solid var(--border);
  background: var(--bg-primary);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  color: var(--text-primary);
  min-height: 40px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
  text-align: center;
  white-space: nowrap;
}

.subnav-btn:hover,
.subnav-btn:active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Efecto highlight para sección activa */
.card.plan-highlight {
  animation: highlightPulse 1.5s ease-out;
  box-shadow: 0 0 0 3px var(--accent);
}

@keyframes highlightPulse {
  0% { box-shadow: 0 0 0 3px var(--accent); }
  100% { box-shadow: none; }
}


/* Configuración Curso Preview */
.curso-preview {
  padding: 8px 0;
}

.curso-nombre {
  font-size: 0.95rem;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.trim-list {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.trim-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
}

/* Colores de trimestre */
.trim-item.trim-color-1 { border-left: 3px solid var(--trim-1-color); }
.trim-item.trim-color-2 { border-left: 3px solid var(--trim-2-color); }
.trim-item.trim-color-3 { border-left: 3px solid var(--trim-3-color); }

.trim-item.trim-actual.trim-color-1 { background: var(--trim-1-color); color: white; }
.trim-item.trim-actual.trim-color-2 { background: var(--trim-2-color); color: white; }
.trim-item.trim-actual.trim-color-3 { background: var(--trim-3-color); color: white; }

.trim-num {
  font-weight: 600;
}

.trim-fechas {
  color: var(--text-secondary);
  font-size: 0.75rem;
}

.trim-item.trim-actual .trim-fechas {
  color: rgba(255,255,255,0.85);
}

.trim-config {
  margin-bottom: 16px;
  padding: 12px;
  background: var(--bg-secondary);
  border-radius: var(--radius);
}

.trim-config h4 {
  margin-bottom: 8px;
  font-size: 0.9rem;
}

/* Colores de borde para cada trimestre en config */
.trim-config-1 { border-left: 4px solid var(--trim-1-color); }
.trim-config-2 { border-left: 4px solid var(--trim-2-color); }
.trim-config-3 { border-left: 4px solid var(--trim-3-color); }

.trim-config-1 h4 { color: var(--trim-1-color); }
.trim-config-2 h4 { color: var(--trim-2-color); }
.trim-config-3 h4 { color: var(--trim-3-color); }

/* Grid para fechas de trimestre */
.trim-fechas-grid {
  display: flex;
  gap: 12px;
}

.trim-fechas-grid .form-group {
  margin-bottom: 0;
}

.trim-fechas-grid .form-input[type="date"] {
  width: auto;
  min-width: 0;
}

.badge-accent {
  background: var(--accent);
  color: white;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.75rem;
}


/* Panel detalle estadísticas */
.stat-mini {
  cursor: pointer;
  transition: transform 0.2s;
}

.stat-mini:active {
  transform: scale(0.95);
}

.stat-detail-panel {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 12px;
  margin-top: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.stat-detail-title {
  font-weight: 600;
  margin-bottom: 8px;
  font-size: 0.9rem;
}

.stat-detail-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.stat-detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 8px;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
}

.stat-detail-row.stat-highlight {
  background: var(--accent);
  color: white;
}

/* Colores de trimestre en stats */
.stat-detail-row.stat-trim-1 {
  background: var(--trim-1-color);
  color: white;
  border-radius: var(--radius-sm);
}

.stat-detail-row.stat-trim-2 {
  background: var(--trim-2-color);
  color: white;
  border-radius: var(--radius-sm);
}

.stat-detail-row.stat-trim-3 {
  background: var(--trim-3-color);
  color: white;
  border-radius: var(--radius-sm);
}

.stat-detail-row.stat-trim-1 .stat-detail-label,
.stat-detail-row.stat-trim-2 .stat-detail-label,
.stat-detail-row.stat-trim-3 .stat-detail-label {
  color: rgba(255,255,255,0.9);
}

.stat-detail-label {
  color: var(--text-secondary);
}

.stat-detail-row.stat-highlight .stat-detail-label {
  color: rgba(255,255,255,0.85);
}

.stat-detail-value {
  font-weight: 600;
}

/* ============================================================================
   EDITOR DE TRADUCCIONES PERSONALIZADAS
   ============================================================================ */

/* Cabecera del modal con selector de idioma y contador */
.trad-header {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-color);
}

.trad-lang-select {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--card-bg);
  font-size: 0.95rem;
  min-width: 140px;
}

.trad-custom-count {
  font-size: 0.85rem;
  color: var(--primary-color);
  font-weight: 500;
}

/* Barra de búsqueda y filtros */
.trad-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 1rem;
}

.trad-search-wrapper {
  flex: 1;
  min-width: 200px;
}

.trad-search {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  background: var(--card-bg);
}

.trad-search:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px rgba(var(--primary-rgb), 0.15);
}

.trad-filter-checkbox {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
}

.trad-filter-checkbox input {
  width: 16px;
  height: 16px;
  cursor: pointer;
}


/* ============================================================================
   DESTACADO DE SESIÓN ACTUAL (HOY)
   ============================================================================ */

.sesion-hoy {
  position: relative;
  background: linear-gradient(90deg, rgba(79, 140, 255, 0.15) 0%, rgba(79, 140, 255, 0.05) 100%);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  margin: 2px 0;
}

.sesion-hoy .eval-sesion-item,
.sesion-hoy .sa-sesion-item {
  font-weight: 600;
}

.sesion-hoy .eval-sesion-fecha,
.sesion-hoy .sa-sesion-fecha {
  color: var(--accent);
}

/* Animación sutil de pulso para llamar la atención */
@keyframes sesion-hoy-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.8; }
}

.sesion-hoy {
  animation: sesion-hoy-pulse 2s ease-in-out 3;
}

/* Tema claro */
[data-theme="light"] .sesion-hoy {
  background: linear-gradient(90deg, rgba(0, 102, 204, 0.12) 0%, rgba(0, 102, 204, 0.04) 100%);
}

/* ============================================================================
   MINI HORARIO - PANEL DE TAREAS
   ============================================================================ */

.mh-tareas-header {
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.mh-tareas-sa {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 0.25rem;
}

.mh-tareas-titulo {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--accent);
  line-height: 1.3;
}

/* Hacer las tareas clicables */
.mh-tarea-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  margin-bottom: 0.5rem;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}

.mh-tarea-item:hover {
  background: var(--bg-card-hover);
}

.mh-tarea-item:active {
  transform: scale(0.98);
}

.mh-tarea-info {
  flex: 1;
  min-width: 0;
}

.mh-tarea-nombre {
  font-weight: 500;
  margin-bottom: 0.2rem;
}

.mh-tarea-rubrica {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.mh-tarea-actions {
  display: flex;
  gap: 0.4rem;
  flex-shrink: 0;
  margin-left: 0.5rem;
}

/* Estilos para D2 (tareas heredadas) */
.mh-d2-aviso {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: rgba(156, 163, 175, 0.15);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 0.5rem;
}

.mh-d2-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.15rem 0.4rem;
  background: #6b7280;
  color: white;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
}

.mh-tarea-heredada {
  border-left: 3px solid #6b7280;
  opacity: 0.9;
}

.mh-tarea-heredada .mh-tarea-nombre::after {
  content: ' (D1)';
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: normal;
}

.mh-tareas-empty {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--text-secondary);
}

.mh-tareas-empty p {
  margin: 0.5rem 0;
}

/* ============================================================================
   EVALUACIÓN DESDE MINI HORARIO
   ============================================================================ */

.mh-eval-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.mh-eval-tarea-nombre {
  font-weight: 600;
  font-size: 1rem;
  flex: 1;
}

.mh-info-btn {
  flex-shrink: 0;
  font-size: 1.1rem;
  padding: 0.25rem 0.5rem;
}

.mh-tarea-info-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  animation: slideDown 0.2s ease-out;
}

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

.mh-tarea-info-content {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ============================================================================
   EVALUAR - LISTA DE TAREAS
   ============================================================================ */

.eval-tareas-lista {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.eval-tarea-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 0.75rem;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s;
  border: 2px solid transparent;
}

.eval-tarea-item:hover {
  background: var(--bg-card-hover);
}

.eval-tarea-item.selected {
  border-color: var(--accent);
  background: var(--bg-card-hover);
}

.eval-tarea-nombre {
  font-weight: 500;
  flex: 1;
  min-width: 100px;
}

.eval-tarea-subtipo {
  font-size: 0.75rem;
  color: var(--text-muted);
  background: var(--bg-secondary);
  padding: 0.15rem 0.5rem;
  border-radius: 10px;
}

.eval-tarea-actions {
  display: flex;
  gap: 0.25rem;
  margin-left: auto;
}

.eval-tareas-empty {
  padding: 1rem;
  text-align: center;
  color: var(--text-muted);
  font-style: italic;
}

/* Info de tarea en Evaluar */
.tarea-info-descripcion {
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--text-primary);
  margin-bottom: 1rem;
}

.tarea-info-rubrica {
  font-size: 0.85rem;
  color: var(--text-secondary);
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

/* ============================================================================
   CABECERA INFO TAREA (encima del grid de calificaciones)
   ============================================================================ */

#tarea-info-header {
  margin-bottom: 0.75rem;
}

.tarea-header-info {
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  border-left: 3px solid var(--accent);
}

.tarea-header-nombre {
  font-weight: 600;
  font-size: 1rem;
  color: var(--text-primary);
}

.tarea-header-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.4;
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
}

.tarea-header-rubrica {
  font-size: 0.8rem;
  color: var(--accent);
  margin-top: 0.5rem;
}

.mh-eval-simple,
.mh-eval-rubrica {
  max-height: 55vh;
  overflow-y: auto;
  margin: 0 -1rem;
  padding: 0 1rem;
}

.mh-eval-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.mh-eval-table th {
  position: sticky;
  top: 0;
  background: var(--bg-secondary);
  padding: 0.5rem 0.3rem;
  text-align: center;
  font-weight: 600;
  font-size: 0.75rem;
  color: var(--text-secondary);
  z-index: 1;
}

.mh-eval-table th.mh-eval-alumno-col {
  text-align: left;
  padding-left: 0.5rem;
  min-width: 120px;
}

.mh-eval-table th.mh-eval-ind-col {
  min-width: 36px;
  max-width: 44px;
}

.mh-eval-table th.mh-eval-nota-col {
  width: 60px;
}

.mh-eval-table td {
  padding: 0.4rem 0.3rem;
  text-align: center;
  border-bottom: 1px solid var(--border);
}

.mh-eval-nombre {
  text-align: left !important;
  padding-left: 0.5rem !important;
  font-size: 0.85rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 140px;
}

.mh-eval-btn {
  width: 32px;
  height: 28px;
  border: none;
  border-radius: 4px;
  color: white;
  font-weight: 600;
  font-size: 0.7rem;
  cursor: pointer;
  transition: transform 0.1s, opacity 0.1s;
}

.mh-eval-btn:active {
  transform: scale(0.9);
  opacity: 0.8;
}

/* Responsive para móvil pequeño */
@media (max-width: 380px) {
  .mh-eval-nombre {
    max-width: 100px;
    font-size: 0.8rem;
  }
  
  .mh-eval-btn {
    width: 28px;
    height: 24px;
    font-size: 0.65rem;
  }
  
  .mh-eval-table th.mh-eval-ind-col {
    min-width: 30px;
    font-size: 0.7rem;
  }
}

/* ============================================================================
   TOGGLE SWITCH
   ============================================================================ */

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  padding: 8px 0;
  user-select: none;
  -webkit-user-select: none;
}

.toggle-row input[type="checkbox"] {
  display: none;
}

.toggle-slider {
  position: relative;
  width: 50px;
  height: 28px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 28px;
  transition: all 0.3s;
  flex-shrink: 0;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  background: var(--text-muted);
  border-radius: 50%;
  transition: all 0.3s;
}

.toggle-row input[type="checkbox"]:checked + .toggle-slider {
  background: var(--accent);
  border-color: var(--accent);
}

.toggle-row input[type="checkbox"]:checked + .toggle-slider::before {
  transform: translateX(22px);
  background: white;
}

/* Tema claro */
[data-theme="light"] .toggle-slider {
  background: var(--bg-secondary);
}

[data-theme="light"] .toggle-slider::before {
  background: var(--text-muted);
}

@media (prefers-color-scheme: light) {
  [data-theme="auto"] .toggle-slider {
    background: var(--bg-secondary);
  }
  [data-theme="auto"] .toggle-slider::before {
    background: var(--text-muted);
  }
}

/* ============================================================================
   SISTEMA DE VINCULACIÓN QR
   ============================================================================ */

/* Opciones QR en login */
.login-qr-options {
  margin-top: 24px;
}

.login-divider {
  display: flex;
  align-items: center;
  margin: 16px 0;
}

.login-divider::before,
.login-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-color, #ddd);
}

.login-divider span {
  padding: 0 12px;
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* Contenedor QR */
.qr-display {
  text-align: center;
  padding: 20px 0;
}

.qr-instruccion {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 16px;
}

.qr-code-box {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 16px auto;
  padding: 16px;
  background: white;
  border-radius: 12px;
  width: fit-content;
}

.qr-code-box canvas,
.qr-code-box img {
  display: block;
}

.qr-fallback {
  font-family: 'Courier New', monospace;
  font-size: 2rem;
  font-weight: bold;
  letter-spacing: 4px;
  padding: 20px;
  color: #1a1a2e;
}

.qr-codigo-manual {
  font-family: 'Courier New', monospace;
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: 2px;
  color: var(--text-primary);
  margin: 8px 0;
}

.codigo-grande {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', monospace;
  font-size: 3rem;
  font-weight: 700;
  letter-spacing: 8px;
  color: var(--text-primary);
  padding: 20px;
  text-align: center;
}

.qr-timer {
  font-size: 1.5rem;
  font-weight: bold;
  color: var(--primary);
  margin: 12px 0;
}

.qr-timer span {
  display: inline-block;
  min-width: 40px;
}

.qr-loading,
.qr-error,
.qr-expired {
  text-align: center;
  padding: 40px 20px;
}

.qr-loading .spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border-color);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 16px;
}

/* Escáner de cámara */
.qr-scanner-container {
  position: relative;
  width: 100%;
  max-width: 300px;
  margin: 0 auto;
  border-radius: 12px;
  overflow: hidden;
  background: #000;
}

.qr-scanner-container video {
  width: 100%;
  height: auto;
  display: block;
}

.qr-scanner-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.qr-scanner-frame {
  width: 200px;
  height: 200px;
  border: 3px solid var(--primary);
  border-radius: 12px;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.5);
  position: relative;
}

.qr-scanner-frame::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--primary);
  animation: scanLine 2s linear infinite;
}

@keyframes scanLine {
  0%, 100% { top: 0; }
  50% { top: calc(100% - 3px); }
}

/* Ajustes QR */
#ajustes-qr-container {
  min-height: 280px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

#ajustes-qr-container .qr-code-box {
  background: white;
  padding: 20px;
  border-radius: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Responsive */
@media (max-width: 400px) {
  .qr-fallback {
    font-size: 1.5rem;
  }
  
  .qr-scanner-frame {
    width: 160px;
    height: 160px;
  }
}
