/* ============================================================================
   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;
}

.reunion-icon {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  background: var(--bg-secondary);
  border-radius: 50%;
  margin-right: 12px;
  flex-shrink: 0;
}

/* Reuniones en ficha de alumno */
.ficha-reunion-item {
  display: flex;
  align-items: center;
  padding: 8px;
  background: var(--bg-secondary);
  border-radius: 6px;
  margin-bottom: 6px;
  cursor: pointer;
  transition: background 0.2s;
}

.ficha-reunion-item:hover {
  background: var(--bg-tertiary);
}

.reunion-mini-icon {
  font-size: 1.1rem;
  margin-right: 10px;
}

.reunion-mini-content {
  flex: 1;
  min-width: 0;
}

.reunion-mini-asunto {
  font-size: 0.9rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.reunion-mini-fecha {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Adjuntos de reunión */
.adjuntos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 8px;
  margin-top: 8px;
}

.adjunto-item {
  position: relative;
  aspect-ratio: 1;
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.adjunto-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.adjunto-item .adjunto-icon {
  font-size: 2rem;
  margin-bottom: 4px;
}

.adjunto-item .adjunto-nombre {
  font-size: 0.65rem;
  text-align: center;
  padding: 0 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.adjunto-item .adjunto-delete {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 20px;
  height: 20px;
  background: rgba(0,0,0,0.6);
  color: white;
  border: none;
  border-radius: 50%;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s;
}

.adjunto-item:hover .adjunto-delete {
  opacity: 1;
}

.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-label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.form-label-row .form-label {
  margin-bottom: 0;
}

.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;
}

/* Icono calendario en modo oscuro */
.form-input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(0.8);
  cursor: pointer;
}
[data-theme="light"] .form-input[type="date"]::-webkit-calendar-picker-indicator {
  filter: none;
}

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

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

/* Lista de opciones con iconos (preguntas personalizadas) */
.opciones-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

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

.opcion-icono-btn {
  width: 44px;
  height: 44px;
  min-width: 44px;
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  font-size: 1.4rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.opcion-icono-btn:hover {
  border-color: var(--accent);
  background: var(--bg-card-hover);
}

.opcion-icono-btn.has-icon {
  border-style: solid;
  border-color: var(--accent);
}

.opcion-texto-input {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 1rem;
}

.opcion-texto-input:focus {
  outline: none;
  border-color: var(--accent);
}

.opcion-eliminar-btn {
  width: 36px;
  height: 36px;
  min-width: 36px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

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

/* Picker de emojis simple */
.emoji-picker-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.emoji-picker-content {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 16px;
  max-width: 320px;
  max-height: 400px;
  overflow-y: auto;
}

.emoji-picker-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
}

.emoji-picker-btn {
  width: 44px;
  height: 44px;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  font-size: 1.5rem;
  cursor: pointer;
  transition: all 0.15s;
}

.emoji-picker-btn:hover {
  background: var(--accent);
  transform: scale(1.1);
}

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

.emoji-picker-title {
  font-weight: 600;
  color: var(--text-primary);
}

.emoji-picker-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-secondary);
  cursor: pointer;
}

.emoji-picker-clear {
  width: 100%;
  margin-top: 12px;
  padding: 10px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 0.9rem;
}

.emoji-picker-clear:hover {
  border-color: var(--danger);
  color: var(--danger);
}

.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 {
  position: relative;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  padding: 12px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  border: 2px solid transparent;
}

/* Número de orden en tarjeta de asistencia */
.attendance-orden {
  position: absolute;
  top: 4px;
  left: 4px;
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-secondary);
  padding: 1px 5px;
  border-radius: 8px;
  line-height: 1.2;
}

.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 {
  position: relative;
  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;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

/* Avatar circular para fotos de alumnos */
.control-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border);
  flex-shrink: 0;
  transition: all 0.2s ease;
}

/* Avatar con iniciales (fallback sin foto) */
.control-avatar-iniciales {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
  flex-shrink: 0;
  border: 2px solid var(--border);
  transition: all 0.2s ease;
}

/* Tamaño grande (doble) */
.control-avatar.control-avatar-grande,
.control-avatar-iniciales.control-avatar-grande {
  width: 72px;
  height: 72px;
  font-size: 1.25rem;
}

/* Botones del header de controles */
.controles-header-btns {
  display: flex;
  gap: 8px;
  align-items: center;
}

.btn-icon {
  padding: 6px 10px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 1rem;
}

/* Número de orden en tarjeta de alumno */
.control-orden {
  position: absolute;
  top: 4px;
  left: 4px;
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-secondary);
  padding: 1px 5px;
  border-radius: 8px;
  line-height: 1.2;
}

.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 {
  position: relative;
  padding: 8px;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

/* ============================================================================
   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;
  color: var(--text-primary);
}

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

/* Grupos sin clase hoy: atenuados */
.group-chip.grupo-sin-clase-hoy:not(.active) {
  opacity: 0.5;
}

/* Grupos con clase hoy: resaltados con borde */
.group-chip.grupo-con-clase-hoy:not(.active) {
  border-color: var(--chip-color, var(--accent));
  border-width: 2px;
}

/* Grupos fijados: destacados con chincheta */
.group-chip.grupo-fijado {
  position: relative;
  box-shadow: 0 0 0 2px var(--success), 0 2px 8px rgba(39, 174, 96, 0.3);
}

.group-chip.grupo-fijado::before {
  content: '';
  position: absolute;
  top: -3px;
  right: -3px;
  width: 10px;
  height: 10px;
  background: var(--success);
  border-radius: 50%;
  border: 2px solid var(--bg-card);
}

/* Wrapper para selector de grupos con botón fijar */
.grupo-selector-wrapper {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 12px;
}

.grupo-selector-wrapper .group-selector {
  flex: 1;
  margin-bottom: 0;
}

.btn-fijar-grupo {
  flex-shrink: 0;
  font-size: 1.2em;
  padding: 6px 10px;
  border-radius: 8px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  transition: all 0.2s;
}

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

.btn-fijar-grupo.activo {
  background: var(--success);
  border-color: var(--success);
}

/* ============================================================================
   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 con display directo (sin transición) */
#modal-puntos-controles {
  display: none;
  opacity: 1;
  visibility: visible;
  align-items: center;
  padding: 20px;
}

#modal-puntos-controles .modal-content {
  background: var(--bg-secondary);
  border-radius: var(--radius);
  padding: 20px;
  width: 100%;
  animation: modalSlideUp 0.3s ease;
}

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

#modal-puntos-controles table {
  background: var(--bg-card);
  border-radius: var(--radius-sm);
}

#modal-puntos-controles table tr:nth-child(even) {
  background: var(--bg-card-hover);
}

/* Fila de alumno seleccionado/expandido */
#modal-puntos-controles .fila-alumno-expandida {
  background: var(--accent) !important;
  color: white;
}

#modal-puntos-controles .fila-alumno-expandida td {
  color: white !important;
}

/* Detalle expandido */
#modal-puntos-controles .fila-detalle-visible td {
  border-left: 3px solid var(--accent);
  background: var(--bg-card);
}

.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 tareas mini horario */
#modal-mh-tareas .modal {
  display: flex;
  flex-direction: column;
  max-height: 70vh !important;
  overflow: hidden !important;
}

#modal-mh-tareas-content {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
  min-height: 0;
}

#modal-mh-tareas-content .mh-tareas-header {
  flex-shrink: 0;
}

#modal-mh-tareas-content .mh-tareas-list {
  flex: 1;
  overflow-y: auto !important;
  min-height: 0;
  max-height: 40vh;
  -webkit-overflow-scrolling: touch;
}

#modal-mh-tareas-content .mh-tareas-buttons {
  flex-shrink: 0;
  padding-top: 12px;
}

.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);
}

/* Reordenar tareas con drag & drop */
.reorden-handle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  color: var(--text-muted);
  font-size: 1.1rem;
  cursor: grab;
  user-select: none;
  flex-shrink: 0;
  opacity: 0.5;
  transition: opacity 0.15s;
}

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

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

.reorden-item.reorden-dragging {
  opacity: 0.4;
  background: var(--bg-card-hover);
}

.reorden-item.drag-insert-before {
  border-top: 2px solid var(--accent) !important;
}

.reorden-item.drag-insert-after {
  border-bottom: 2px solid var(--accent) !important;
}

/* 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;
  background: none; /* Permitir que el style inline tome precedencia */
}

.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;
}

.dia-mini.tiene-sa {
  background: none; /* Permitir que el style inline tome precedencia */
  color: white;
}

/* 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;
  position: relative;
}

.provider-btn:hover:not(.disabled) {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.provider-btn.active {
  border-color: var(--accent);
  background: linear-gradient(135deg, rgba(78, 205, 196, 0.25), rgba(78, 205, 196, 0.1));
  box-shadow: 0 0 0 3px rgba(78, 205, 196, 0.2), 0 4px 12px rgba(78, 205, 196, 0.15);
}

.provider-btn.active::before {
  content: '✓';
  position: absolute;
  top: -8px;
  right: -8px;
  width: 22px;
  height: 22px;
  background: var(--accent);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: bold;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

.provider-btn.active .provider-name {
  color: var(--accent);
}

.provider-btn.disabled {
  opacity: 0.4;
  cursor: not-allowed;
  filter: grayscale(1);
}

.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);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.eval-tabs::-webkit-scrollbar { display: none; }

.eval-tab {
  flex: 0 0 auto;
  padding: 12px 16px;
  white-space: nowrap;
  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;
}

/* El contenido expandido debe tener su propio fondo */
.sesion-hoy .eval-sesion-detalle,
.sesion-hoy .sa-sesion-tareas-list {
  background: var(--bg-secondary);
}

.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;
  flex-wrap: wrap;
  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-hint {
  width: 100%;
  font-size: 0.75rem;
  color: var(--text-muted);
  font-style: italic;
}

.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;
}

.mh-tareas-buttons {
  display: flex;
  gap: 8px;
}

.mh-tareas-buttons .btn {
  flex: 1;
}

/* ============================================================================
   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;
}

/* Contenedor de sesión expandida en Evaluar */
.eval-sesion-wrapper {
  margin-bottom: 0.25rem;
}

.eval-sesion-detalle {
  padding: 0.75rem;
  background: var(--bg-secondary);
  border-radius: 0 0 var(--radius) var(--radius);
  margin-top: -2px;
  border: 1px solid var(--border-color);
  border-top: none;
}

.eval-sesion-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-color);
}

.eval-sesion-info {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.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: rgba(79, 140, 255, 0.15) !important;
}

.eval-tarea-item.selected .eval-tarea-nombre {
  color: var(--text-primary) !important;
}

/* Asegurar colores correctos en tema oscuro */
.eval-tarea-nombre {
  font-weight: 500;
  flex: 1;
  min-width: 100px;
  color: var(--text-primary);
}

/* También para sa-tarea en Planificar */
.sa-tarea-item.selected {
  border-color: var(--accent);
  background: rgba(79, 140, 255, 0.15) !important;
}
}

.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-num-col {
  width: 28px;
  min-width: 28px;
  text-align: center;
}

.mh-eval-num {
  text-align: center !important;
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
}

.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;
  }
}

/* ============================================================================
   ANOTACIONES
   ============================================================================ */

.anot-toolbar {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

.anot-search {
  flex: 1;
}

.anot-search input {
  width: 100%;
  padding: 8px 12px;
  border-radius: 8px;
}

.anot-filtros {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.anot-filtro-btn {
  padding: 4px 10px;
  border-radius: 16px;
  border: 1px solid var(--tag-color, var(--border));
  background: var(--bg-card);
  color: var(--tag-color, var(--text-secondary));
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.15s;
}

.anot-filtro-btn:hover {
  border-color: var(--tag-color, var(--accent));
  background: color-mix(in srgb, var(--tag-color, var(--accent)) 15%, transparent);
}

.anot-filtro-btn.active {
  background: var(--tag-color, var(--accent));
  color: white;
  border-color: var(--tag-color, var(--accent));
}

.anot-lista {
  max-height: 400px;
  overflow-y: auto;
}

.anot-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: all 0.15s;
}

.anot-card:hover {
  border-color: var(--accent);
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.anot-card.fijada {
  border-left: 3px solid var(--accent);
  background: var(--bg-card-hover);
}

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

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

.anot-pin {
  font-size: 0.9rem;
}

.anot-texto {
  font-size: 0.9rem;
  color: var(--text-primary);
  line-height: 1.4;
  margin-bottom: 8px;
  white-space: pre-wrap;
  word-break: break-word;
  /* Limitar a 3 líneas */
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.anot-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.anot-vinculo {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.75rem;
  color: var(--text-secondary);
  background: var(--bg-secondary);
  padding: 2px 8px;
  border-radius: 12px;
}

.anot-vinculo-icon {
  font-size: 0.7rem;
}

.anot-tags {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.anot-tag {
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 10px;
  white-space: nowrap;
}

/* Selector de etiquetas en modal */
.anot-etiquetas-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.anot-etiqueta-check {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 16px;
  border: 1px solid var(--tag-color, var(--border));
  background: transparent;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.15s;
}

.anot-etiqueta-check:has(input:checked) {
  background: var(--tag-color, var(--accent));
  color: white;
}

.anot-etiqueta-check input {
  display: none;
}

/* Lista de etiquetas en gestión */
.etiquetas-lista {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.etiqueta-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--bg-secondary);
  border-radius: 8px;
}

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

.etiqueta-nombre {
  flex: 1;
}

#btn-solo-fijadas.active {
  background: var(--accent);
  color: white;
}

/* Anotaciones en ficha de alumno */
.ficha-anotacion-item {
  background: var(--bg-secondary);
  border-radius: 8px;
  padding: 10px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: all 0.15s;
}

.ficha-anotacion-item:hover {
  background: var(--bg-card-hover);
}

.ficha-anotacion-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.ficha-anotacion-fecha {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.ficha-anotacion-texto {
  font-size: 0.85rem;
  line-height: 1.3;
  color: var(--text-primary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.ficha-anotacion-tags {
  display: flex;
  gap: 4px;
  margin-top: 6px;
  flex-wrap: wrap;
}

.anot-tag-mini {
  font-size: 0.65rem;
  padding: 1px 6px;
  border-radius: 8px;
}

/* ============================================================================
   URLs DE INICIO Y COMANDOS RECURRENTES
   ============================================================================ */

.urls-section,
.comandos-section {
  margin-bottom: 16px;
}

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

.urls-header h5 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
}

.urls-lista,
.comandos-lista {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.url-item-editable,
.comando-item-editable {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-secondary);
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.url-item-editable:hover,
.comando-item-editable:hover {
  background: var(--bg-card-hover);
}

.url-item-editable:active,
.comando-item-editable:active {
  transform: scale(0.98);
}

.url-icono,
.comando-icono {
  font-size: 1.3em;
  flex-shrink: 0;
}

.url-info,
.comando-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.url-nombre,
.comando-nombre {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-primary);
}

.url-valor,
.comando-valor {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: monospace;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn-icon-sm {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 8px;
  font-size: 0.9em;
  opacity: 0.6;
  transition: opacity 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.btn-icon-sm:hover {
  opacity: 1;
}

/* Modal URL/Comando - icono input */
#url-comando-icono {
  font-size: 1.5em;
  padding: 6px;
}

/* ============================================================================
   ESTADÍSTICAS COMPARATIVAS EN FICHA ALUMNO
   ============================================================================ */

.ficha-comparativa {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
}

.comparativa-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 70px;
}

.comparativa-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

.comparativa-valor {
  font-size: 1rem;
  font-weight: 600;
}

.ficha-evolucion {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
}

.evolucion-titulo {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 8px;
}

.evolucion-barras {
  display: flex;
  justify-content: center;
  gap: 16px;
  height: 60px;
  align-items: flex-end;
}

.evolucion-barra-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 40px;
}

.evolucion-barra {
  width: 100%;
  border-radius: 4px 4px 0 0;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  min-height: 20px;
  transition: height 0.3s ease;
}

.evolucion-valor {
  font-size: 0.7rem;
  font-weight: 600;
  color: white;
  padding-top: 2px;
}

.evolucion-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Evolución trimestral mejorada con punto de nota trimestral */
.evolucion-leyenda {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-bottom: 8px;
  font-size: 0.65rem;
  color: var(--text-muted);
}

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

.leyenda-barra {
  width: 12px;
  height: 8px;
  background: var(--success);
  border-radius: 2px;
}

.leyenda-barra-azul {
  background: #3b82f6;
}

.evolucion-trim-container {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.evolucion-barras-doble {
  display: flex;
  gap: 3px;
  height: 50px;
  align-items: flex-end;
}

.evolucion-barra-doble {
  width: 18px;
  border-radius: 3px 3px 0 0;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  min-height: 16px;
  transition: height 0.3s ease;
}

.evolucion-valor-doble {
  font-size: 0.6rem;
  font-weight: 600;
  color: white;
  padding-top: 2px;
}

/* Colores de fondo según género en lista de alumnos */
.alumno-item.genero-m {
  background: rgba(255, 200, 150, 0.08); /* naranja sutil */
}

.alumno-item.genero-f {
  background: rgba(150, 255, 150, 0.08); /* verde sutil */
}

/* Mantener el hover visible */
.alumno-item.genero-m:hover {
  background: rgba(255, 200, 150, 0.18);
}

.alumno-item.genero-f:hover {
  background: rgba(150, 255, 150, 0.18);
}

/* ============================================================================
   ETIQUETAS DE ALUMNO EN FICHA
   ============================================================================ */

.ficha-etiquetas-wrapper {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  margin-bottom: 8px;
}

.ficha-etiqueta-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 500;
}

.ficha-etiqueta-remove {
  background: none;
  border: none;
  color: inherit;
  font-size: 1rem;
  cursor: pointer;
  padding: 0 0 0 4px;
  line-height: 1;
  opacity: 0.6;
}

.ficha-etiqueta-remove:hover {
  opacity: 1;
}

.ficha-etiqueta-add {
  background: none;
  border: 1px dashed var(--border);
  color: var(--text-muted);
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s;
}

.ficha-etiqueta-add:hover {
  border-color: var(--primary);
  color: var(--primary);
}

/* Modal asignar etiquetas */
.asignar-etiquetas-container {
  max-height: 300px;
  overflow-y: auto;
}

.asignar-etiqueta-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.2s;
}

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

.asignar-etiqueta-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.asignar-etiqueta-icono {
  font-size: 1.2rem;
}

.asignar-etiqueta-nombre {
  flex: 1;
  font-weight: 500;
}

.asignar-etiqueta-ia {
  font-size: 0.8rem;
  opacity: 0.7;
}

/* ============================================================================
   TIMER DE SESIÓN
   ============================================================================ */

.timer-sesion {
  position: fixed;
  bottom: 85px; /* Más separado del tab bar */
  right: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.85), rgba(99, 102, 241, 0.85));
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: 24px;
  box-shadow: 0 4px 20px rgba(59, 130, 246, 0.35), 0 2px 8px rgba(0,0,0,0.1);
  font-size: 0.9rem;
  font-weight: 600;
  z-index: 999;
  cursor: pointer;
  transition: all 0.3s ease;
  border: 1px solid rgba(255,255,255,0.2);
}

.timer-sesion:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(59, 130, 246, 0.45), 0 4px 12px rgba(0,0,0,0.15);
}

.timer-sesion:active {
  transform: scale(0.95);
}

.timer-sesion .timer-grupo {
  color: rgba(255,255,255,0.85);
  font-size: 0.8rem;
  font-weight: 500;
}

.timer-sesion .timer-tiempo {
  font-family: 'SF Mono', 'Menlo', 'Consolas', monospace;
  font-size: 1.2rem;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.timer-sesion .timer-modo {
  color: rgba(255,255,255,0.7);
  font-size: 0.75rem;
}

/* Estados de alerta */
.timer-sesion.timer-warning {
  background: linear-gradient(135deg, rgba(249, 115, 22, 0.9), rgba(234, 88, 12, 0.9));
  box-shadow: 0 4px 20px rgba(249, 115, 22, 0.4), 0 2px 8px rgba(0,0,0,0.1);
  animation: timer-pulse 1.5s ease-in-out infinite;
}

.timer-sesion.timer-warning .timer-tiempo {
  color: #fff;
}

.timer-sesion.timer-danger {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.95), rgba(220, 38, 38, 0.95));
  box-shadow: 0 4px 20px rgba(239, 68, 68, 0.5), 0 2px 8px rgba(0,0,0,0.15);
  animation: timer-pulse 0.8s ease-in-out infinite;
}

.timer-sesion.timer-danger .timer-tiempo {
  color: #fff;
  font-weight: 700;
}

@keyframes timer-pulse {
  0%, 100% { 
    opacity: 1;
    transform: scale(1);
  }
  50% { 
    opacity: 0.85;
    transform: scale(1.02);
  }
}

/* Tema oscuro - más sutil */
[data-theme="dark"] .timer-sesion {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.75), rgba(99, 102, 241, 0.75));
  border: 1px solid rgba(255,255,255,0.1);
}

/* iPhone ajuste */
.is-iphone .timer-sesion {
  bottom: 110px;
}

/* Ocultar timer temporalmente */
.timer-sesion.oculto-temp {
  opacity: 0;
  pointer-events: none;
  transform: translateX(100px);
}

/* ==========================================================================
   TIMER ALERTAS PERSONALIZABLES
   ========================================================================== */

.timer-alertas-lista {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.timer-alerta-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-secondary, #f5f5f5);
  border-radius: 8px;
  padding: 10px 12px;
}

.timer-alerta-item .alerta-tiempo {
  font-weight: 500;
  font-size: 15px;
}

.timer-alerta-item .alerta-eliminar {
  background: none;
  border: none;
  color: var(--text-muted, #888);
  font-size: 18px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: all 0.2s;
}

.timer-alerta-item .alerta-eliminar:hover {
  background: var(--danger, #e74c3c);
  color: white;
}

.timer-nueva-alerta .input-group-inline {
  display: flex;
  align-items: center;
  gap: 8px;
}

.timer-nueva-alerta .form-input {
  text-align: center;
}

@media (max-width: 480px) {
  .timer-alerta-item {
    padding: 12px;
  }
  
  .timer-alerta-item .alerta-tiempo {
    font-size: 16px;
  }
}

/* Estadísticas PR - filas clickables */
.pr-sesion-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

[data-theme="dark"] .pr-sesion-item,
:root .pr-sesion-item {
  background: var(--bg-card-hover);
  border: 1px solid var(--accent);
  border-opacity: 0.3;
  border-color: rgba(79, 140, 255, 0.3);
}

.pr-sesion-item:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent);
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

[data-theme="dark"] .pr-sesion-item:hover,
:root .pr-sesion-item:hover {
  background: var(--bg-secondary);
  border-color: var(--accent);
}

.pr-sesion-item:active {
  background: var(--bg-secondary);
}

.pr-sesion-item[style*="cursor:default"],
.pr-sesion-item[style*="cursor: default"] {
  cursor: default;
}

.pr-sesion-item[style*="cursor:default"]:hover,
.pr-sesion-item[style*="cursor: default"]:hover {
  background: var(--bg-card);
  border-color: var(--border);
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

[data-theme="dark"] .pr-sesion-item[style*="cursor:default"]:hover,
:root .pr-sesion-item[style*="cursor:default"]:hover {
  background: var(--bg-card-hover);
  border-color: rgba(79, 140, 255, 0.3);
}

.pr-sesion-fecha {
  color: var(--text-secondary);
  font-size: 0.9em;
  min-width: 80px;
}

.pr-sesion-grupo {
  font-weight: 500;
}

.pr-sesion-resp {
  color: var(--text-muted);
  font-size: 0.85em;
  background: var(--bg-secondary);
  padding: 4px 8px;
  border-radius: 12px;
}

.pr-sesion-estado {
  font-size: 1.1em;
}

/* Detalle de preguntas en conjunto */
.pr-detalle-pregunta {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
  border: 1px solid var(--border);
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

[data-theme="dark"] .pr-detalle-pregunta,
:root .pr-detalle-pregunta {
  background: var(--bg-card-hover);
  border-color: rgba(79, 140, 255, 0.2);
}

.pr-detalle-num {
  color: var(--accent);
  font-weight: 600;
  min-width: 24px;
}

.pr-detalle-texto {
  flex: 1;
}

/* ============================================================================
   EXENCIONES (No participa por lesión/molestia)
   ============================================================================ */

.btn-exencion {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: 2px solid var(--border);
  border-radius: 50%;
  width: 32px;
  height: 32px;
  font-size: 16px;
  cursor: pointer;
  opacity: 0.5;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.btn-exencion:hover {
  opacity: 1;
  border-color: var(--warning);
  background: rgba(245, 158, 11, 0.1);
}

.btn-exencion.activo {
  opacity: 1;
  background: var(--warning);
  border-color: var(--warning);
  color: white;
}

.attendance-item {
  position: relative;
  padding-right: 48px !important; /* Espacio para el botón */
}

.attendance-item.exento {
  border-left: 4px solid var(--warning) !important;
}

.attendance-item.exento .attendance-name {
  color: var(--warning);
}

.exento-tag {
  opacity: 0.7;
  font-size: 0.85em;
}

/* ============================================================================
   CONTROLES RÁPIDOS EN FICHA DE ALUMNO
   ============================================================================ */

.form-select-mini {
  padding: 4px 8px;
  font-size: 0.8rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.ficha-control-item {
  background: var(--bg-secondary);
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: all 0.2s;
}

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

.ficha-control-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.ficha-control-icono {
  font-size: 1.2rem;
}

.ficha-control-nombre {
  flex: 1;
  font-weight: 500;
}

.ficha-control-puntos {
  font-weight: 700;
  font-size: 0.95rem;
}

.ficha-control-barra {
  height: 8px;
  background: var(--bg-tertiary);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 6px;
}

.ficha-control-progreso {
  height: 100%;
  border-radius: 4px;
  transition: width 0.4s ease;
}

.ficha-control-progreso.success {
  background: var(--success);
}

.ficha-control-progreso.warning {
  background: var(--warning);
}

.ficha-control-progreso.danger {
  background: var(--danger);
}

.ficha-control-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.ficha-control-resumen {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px;
  background: var(--primary-light);
  border-radius: 8px;
  font-size: 0.85rem;
  margin-top: 8px;
}

/* Detalle expandible */
.ficha-control-detalle {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
}

.ficha-control-desglose {
  max-height: 250px;
  overflow-y: auto;
}

.ficha-control-dia {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border-light);
}

.ficha-control-dia:last-child {
  border-bottom: none;
}

.ficha-control-fecha {
  font-size: 0.8rem;
  color: var(--text-muted);
  min-width: 70px;
}

.ficha-control-aspectos {
  display: flex;
  gap: 4px;
  flex: 1;
  flex-wrap: wrap;
}

.ficha-aspecto {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  font-size: 0.85rem;
}

.ficha-aspecto.ok {
  background: rgba(34, 197, 94, 0.15);
  color: var(--success);
}

.ficha-aspecto.no {
  background: rgba(239, 68, 68, 0.15);
  color: var(--danger);
}

.ficha-control-dia-puntos {
  font-size: 0.8rem;
  font-weight: 600;
  min-width: 40px;
  text-align: right;
}

/* ==========================================
   TAREAS EN PLANIFICAR - SA Sessions
   ========================================== */

.sa-sesion-tareas-list {
  padding: 0.5rem 0.75rem 0.75rem 1.5rem;
  background: var(--bg-secondary);
  border-radius: 0 0 var(--radius) var(--radius);
  margin-top: -2px;
}

.sa-tareas-lista {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.sa-tarea-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 0.75rem;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  gap: 0.5rem;
}

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

.sa-tarea-item.sa-tarea-compartida {
  border-left: 3px solid var(--accent);
}

.sa-tarea-nombre {
  flex: 1;
  font-size: 0.9rem;
  color: var(--text-primary) !important;
}

.sa-tarea-acciones {
  display: flex;
  gap: 0.25rem;
}

.sa-tarea-acciones .btn-icon-sm {
  padding: 0.25rem;
  font-size: 0.85rem;
  opacity: 0.7;
  background: transparent;
  border: none;
  cursor: pointer;
}

.sa-tarea-acciones .btn-icon-sm:hover {
  opacity: 1;
}

.sa-tarea-ir {
  color: var(--text-muted);
  font-size: 1.1rem;
}

.sa-tareas-empty {
  padding: 0.75rem;
  text-align: center;
}

.sa-tareas-empty p {
  margin-bottom: 0.5rem;
  font-size: 0.85rem;
}

/* Header del grupo dentro de tareas */
.sa-grupo-header {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  padding-bottom: 0.25rem;
  border-bottom: 1px solid var(--border-color);
}

/* Botón añadir tarea */
.sa-tareas-add {
  margin-top: 0.5rem;
  text-align: center;
}

/* ==========================================
   CALIFICACIONES INLINE EN EVALUAR
   ========================================== */

.eval-panel-inline {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 0.75rem;
  border: 1px solid var(--border-color);
}

.calif-grid {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.calif-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.4rem 0.5rem;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  gap: 0.5rem;
}

.calif-row:nth-child(odd) {
  background: var(--bg-tertiary, var(--bg-secondary));
}

.calif-header {
  font-weight: 600;
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
  padding: 0.25rem;
}

.calif-alumno {
  font-size: 0.85rem;
  color: var(--text-primary);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.calif-cell {
  display: flex;
  justify-content: center;
}

.calif-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid var(--border-color);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-weight: 600;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.15s;
}

.calif-btn:hover {
  border-color: var(--accent);
  background: rgba(79, 140, 255, 0.1);
}

.calif-btn.selected {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.calif-input {
  width: 55px;
  padding: 0.35rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text-primary);
  text-align: center;
  font-size: 0.9rem;
}

.calif-input:focus {
  outline: none;
  border-color: var(--accent);
}

/* ==========================================
   SESIONES PENDIENTES DE REGISTRO
   ========================================== */

.pendientes-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--warning, #f39c12);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 12px;
}

.pendientes-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  padding: 2px 0;
}

.pendientes-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pendientes-header-right {
  display: flex;
  align-items: center;
}

.pendientes-toggle {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.pendientes-titulo {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-primary);
}

.pendientes-body {
  margin-top: 10px;
}

.pendientes-badge {
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: 600;
}

.pendientes-badge.warning {
  background: var(--warning, #f39c12);
  color: white;
}

.pendientes-badge.danger {
  background: var(--danger, #e74c3c);
  color: white;
}

.pendientes-progress {
  height: 6px;
  background: var(--bg-tertiary, #2a2a3a);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 6px;
}

.pendientes-bar {
  height: 100%;
  background: var(--success, #27ae60);
  border-radius: 3px;
  transition: width 0.3s;
}

.pendientes-stats {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.pendientes-lista {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.pendientes-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  transition: background 0.15s;
}

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

.pendientes-item-main {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  cursor: pointer;
}

.pendientes-fecha {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  min-width: 70px;
}

.pendientes-grupo {
  flex: 1;
  font-size: 0.9rem;
  color: var(--text-primary);
}

.pendientes-arrow {
  color: var(--accent);
  font-size: 1rem;
  margin-right: 8px;
}

.pendientes-no-realizada-btn {
  background: var(--bg-tertiary, #eee);
  border: none;
  color: var(--text-muted);
  font-size: 0.75rem;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
}

.pendientes-no-realizada-btn:hover {
  background: var(--danger, #e74c3c);
  color: white;
}

.pendientes-more {
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
  padding: 4px;
}

/* Modal sesión no realizada */
#modal-no-realizada {
  display: flex;
  opacity: 1;
  visibility: visible;
}

#modal-no-realizada .modal-content {
  background: var(--bg-secondary);
  border-radius: var(--radius);
  padding: 0;
  width: 90%;
  max-width: 340px;
  margin: auto;
  box-shadow: 0 10px 40px rgba(0,0,0,0.3);
}

#modal-no-realizada .modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  border-bottom: 1px solid var(--border-color);
}

#modal-no-realizada .modal-header h3 {
  margin: 0;
  font-size: 1.1rem;
  color: var(--text-primary);
}

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

#modal-no-realizada .modal-body {
  padding: 16px;
}

.no-realizada-motivos {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.motivo-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.95rem;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  text-align: left;
}

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

/* ============================================================================
   DRAG & DROP TAREAS
   ============================================================================ */

.sa-tarea-item[draggable="true"] {
  cursor: grab;
}

.sa-tarea-item[draggable="true"]:active {
  cursor: grabbing;
}

.sa-tarea-item.dragging {
  opacity: 0.5;
  background: var(--bg-card-hover);
}

.sa-tareas-lista.drop-target {
  border: 2px dashed var(--accent);
  border-radius: var(--radius-sm);
  min-height: 40px;
}

.sa-tareas-lista.drop-hover {
  background: rgba(var(--accent-rgb, 59, 130, 246), 0.1);
  border-color: var(--accent);
}

.sa-tareas-vacia {
  padding: 12px;
  text-align: center;
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
}

.sa-tareas-vacia span {
  font-size: 0.85rem;
}


/* ============================================================================
   PANEL DE INSIGHTS IA
   ============================================================================ */

.insights-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 9998;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s;
}

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

.insights-panel {
  position: fixed;
  top: 0;
  right: -400px;
  width: 400px;
  max-width: 100vw;
  height: 100vh;
  background: var(--bg-primary);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
  transition: right 0.3s ease;
}

.insights-panel.open {
  right: 0;
}

.insights-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.insights-panel-header h3 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
}

.insights-panel-close {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 1.2rem;
  cursor: pointer;
  transition: background 0.2s;
}

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

.insights-panel-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
}

.insights-panel-info span {
  font-weight: 600;
  color: var(--text-primary);
}

.insights-panel-info select {
  width: auto;
  padding: 6px 12px;
  font-size: 0.85rem;
}

.insights-panel-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
}

.insights-panel-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border-color);
  background: var(--bg-secondary);
}

/* Loading state */
.insights-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  text-align: center;
}

.spinner-lg {
  width: 48px;
  height: 48px;
  border: 4px solid var(--border-color);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 16px;
}

/* Empty state */
.insights-empty {
  text-align: center;
  padding: 40px 20px;
}

.insights-empty-icon {
  font-size: 3rem;
  margin-bottom: 12px;
}

/* Error state */
.insights-error {
  text-align: center;
  padding: 40px 20px;
  color: var(--color-error);
}

/* Resumen */
.insights-resumen {
  background: var(--bg-secondary);
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  font-size: 0.95rem;
  line-height: 1.5;
  border-left: 3px solid var(--accent);
}

/* Lista de insights */
.insights-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.insights-card {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  padding: 14px 16px;
  transition: box-shadow 0.2s;
}

.insights-card:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.insights-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.insights-card-icon {
  font-size: 1.2rem;
}

.insights-card-titulo {
  flex: 1;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-primary);
}

.insights-badge {
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
}

.insights-badge-alerta {
  background: rgba(239, 68, 68, 0.15);
  color: #dc2626;
}

.insights-badge-aviso {
  background: rgba(245, 158, 11, 0.15);
  color: #d97706;
}

.insights-badge-info {
  background: rgba(59, 130, 246, 0.15);
  color: #2563eb;
}

.insights-card-desc {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 0 0 10px 0;
}

.insights-card-alumnos {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.insights-card-alumnos .tag {
  background: var(--bg-secondary);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.8rem;
  font-family: monospace;
}

.insights-card-recomendacion {
  background: rgba(16, 185, 129, 0.1);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  line-height: 1.4;
}

.insights-card-recomendacion strong {
  color: #059669;
}

/* Responsive */
@media (max-width: 480px) {
  .insights-panel {
    width: 100vw;
    right: -100vw;
  }
}

/* ============================================
   EVALUACIÓN RÁPIDA - Panel lateral
   ============================================ */

.eval-rapida-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 9998;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease;
}

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

.eval-rapida-panel {
  position: fixed;
  top: 0;
  right: -420px;
  width: 420px;
  max-width: 100vw;
  height: 100vh;
  background: var(--bg-primary);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
  transition: right 0.3s ease;
}

.eval-rapida-panel.open {
  right: 0;
}

.eval-rapida-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
}

.eval-rapida-header h3 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
}

.eval-rapida-close {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 1.2rem;
  cursor: pointer;
  transition: background 0.2s;
}

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

/* Tabs */
.eval-rapida-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-secondary);
}

.eval-tab {
  flex: 0 0 auto;
  padding: 12px 16px;
  white-space: nowrap;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--text-secondary);
  transition: all 0.2s;
  border-bottom: 3px solid transparent;
}

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

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

/* Tab content */
.eval-tab-content {
  display: none;
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
}

.eval-tab-content.active {
  display: flex;
  flex-direction: column;
}

/* Texto input */
.eval-texto-input {
  margin-bottom: 16px;
}

.eval-texto-input textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  font-size: 0.95rem;
  resize: vertical;
  min-height: 100px;
  background: var(--bg-primary);
  color: var(--text-primary);
}

.eval-texto-input textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

/* Resultado de evaluaciones */
.eval-resultado {
  flex: 1;
  overflow-y: auto;
}

.eval-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--bg-secondary);
  border-radius: var(--radius);
  margin-bottom: 8px;
  border: 1px solid var(--border-color);
}

.eval-item.selected {
  border-color: var(--accent);
  background: rgba(16, 185, 129, 0.05);
}

.eval-item-check {
  width: 20px;
  height: 20px;
  cursor: pointer;
}

.eval-item-info {
  flex: 1;
  min-width: 0;
}

.eval-item-nombre {
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.eval-item-obs {
  font-size: 0.85rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.eval-item-nivel {
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
}

.eval-item-nivel.muy_alto { background: #dcfce7; color: #166534; }
.eval-item-nivel.alto { background: #dbeafe; color: #1e40af; }
.eval-item-nivel.medio { background: #fef9c3; color: #854d0e; }
.eval-item-nivel.bajo { background: #fed7aa; color: #c2410c; }
.eval-item-nivel.no_conseguido { background: #fecaca; color: #991b1b; }

/* Lista rápida */
/* Buscador de alumnos en evaluación rápida */
.eval-buscar-container {
  padding: 0 0 12px 0;
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--bg-primary);
}

.eval-buscar-input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s;
}

.eval-buscar-input:focus {
  border-color: var(--accent);
}

.eval-buscar-input::placeholder {
  color: var(--text-muted);
}

.eval-lista-alumnos {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.eval-lista-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--bg-secondary);
  border-radius: var(--radius);
  border: 1px solid var(--border-color);
}

.eval-lista-nombre {
  flex: 1;
  font-weight: 500;
  color: var(--text-primary);
}

.eval-lista-btns {
  display: flex;
  gap: 8px;
}

.eval-btn-nivel {
  width: 44px;
  height: 44px;
  border: 2px solid var(--border-color);
  border-radius: var(--radius);
  background: var(--bg-primary);
  cursor: pointer;
  font-size: 1.2rem;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.eval-btn-nivel:hover {
  transform: scale(1.05);
}

.eval-btn-nivel.bajo {
  border-color: #ef4444;
  background: #fef2f2;
}

.eval-btn-nivel.bajo.active {
  background: #ef4444;
  color: white;
}

.eval-btn-nivel.medio {
  border-color: #eab308;
  background: #fefce8;
}

.eval-btn-nivel.medio.active {
  background: #eab308;
  color: white;
}

.eval-btn-nivel.alto {
  border-color: #22c55e;
  background: #f0fdf4;
}

.eval-btn-nivel.alto.active {
  background: #22c55e;
  color: white;
}

/* Footer */
.eval-rapida-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border-color);
  background: var(--bg-secondary);
}

/* Loading */
.eval-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  text-align: center;
}

/* Responsive */
@media (max-width: 480px) {
  .eval-rapida-panel {
    width: 100vw;
    right: -100vw;
  }
}

/* ============================================
   PLANTILLA DE OBSERVACIÓN
   ============================================ */

.plantilla-definicion {
  padding: 8px 0;
}

.plantilla-definicion .form-input {
  width: 100%;
  padding: 12px;
  font-size: 1rem;
}

.plantilla-marcado {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.plantilla-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--border-color);
}

.plantilla-titulo {
  font-weight: 600;
  font-size: 1.1rem;
  color: var(--text-primary);
}

.plantilla-leyenda {
  display: flex;
  justify-content: center;
  gap: 16px;
  padding: 8px;
  background: var(--bg-secondary);
  border-radius: var(--radius);
  margin-bottom: 12px;
  font-size: 0.85rem;
}

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

.leyenda-item.logra { color: #16a34a; }
.leyenda-item.proceso { color: #ca8a04; }
.leyenda-item.no_logra { color: #dc2626; }

.plantilla-alumnos {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.plantilla-alumno {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: var(--bg-secondary);
  border-radius: var(--radius);
  border: 1px solid var(--border-color);
}

.plantilla-alumno-nombre {
  font-weight: 500;
  color: var(--text-primary);
}

.plantilla-btns {
  display: flex;
  gap: 8px;
}

.plantilla-btn {
  width: 42px;
  height: 42px;
  border: 2px solid var(--border-color);
  border-radius: var(--radius);
  background: var(--bg-primary);
  cursor: pointer;
  font-size: 1.3rem;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.plantilla-btn:hover {
  transform: scale(1.05);
}

.plantilla-btn.logra {
  border-color: #22c55e;
}
.plantilla-btn.logra.active {
  background: #22c55e;
  border-color: #16a34a;
}

.plantilla-btn.proceso {
  border-color: #eab308;
}
.plantilla-btn.proceso.active {
  background: #eab308;
  border-color: #ca8a04;
}

.plantilla-btn.no_logra {
  border-color: #ef4444;
}
.plantilla-btn.no_logra.active {
  background: #ef4444;
  border-color: #dc2626;
}

.plantilla-resumen {
  display: flex;
  justify-content: center;
  gap: 20px;
  padding: 12px;
  margin-top: 12px;
  background: var(--bg-secondary);
  border-radius: var(--radius);
  font-weight: 600;
}

.resumen-logra { color: #16a34a; }
.resumen-proceso { color: #ca8a04; }
.resumen-no-logra { color: #dc2626; }
.resumen-sin { color: var(--text-muted); }

/* ============================================
   GRABACIÓN DE VOZ
   ============================================ */

.voz-grabador {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 30px 20px;
  gap: 16px;
}

.voz-estado {
  font-size: 0.95rem;
  color: var(--text-secondary);
  text-align: center;
}

.voz-btn {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: 3px solid var(--accent);
  background: var(--bg-primary);
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.voz-btn:hover {
  transform: scale(1.05);
  background: rgba(16, 185, 129, 0.1);
}

.voz-btn-icon {
  font-size: 2rem;
}

.voz-btn.recording {
  background: #ef4444;
  border-color: #dc2626;
  animation: pulse-recording 1.5s ease-in-out infinite;
}

.voz-btn.recording .voz-btn-icon::after {
  content: "⏹";
}

.voz-btn.recording .voz-btn-icon {
  font-size: 1.8rem;
}

.voz-btn.processing {
  opacity: 0.7;
  cursor: wait;
}

@keyframes pulse-recording {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
  50% { transform: scale(1.05); box-shadow: 0 0 0 15px rgba(239, 68, 68, 0); }
}

.voz-tiempo {
  font-size: 1.5rem;
  font-weight: 600;
  font-family: monospace;
  color: var(--text-primary);
}

.voz-transcripcion {
  padding: 16px 0;
  border-top: 1px solid var(--border-color);
  margin-top: 16px;
}

.voz-transcripcion textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  font-size: 0.95rem;
  resize: vertical;
  background: var(--bg-primary);
  color: var(--text-primary);
}

/* =====================================================
   PWA - OFFLINE & INSTALL
   ===================================================== */

/* Banner offline (arriba de todo) */
.offline-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10000;
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: white;
  padding: 8px 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 0.9rem;
  font-weight: 500;
  transform: translateY(-100%);
  transition: transform 0.3s ease;
  box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

.offline-banner.show {
  transform: translateY(0);
}

/* Ajustar safe area en iOS */
@supports (padding-top: env(safe-area-inset-top)) {
  .offline-banner.show {
    padding-top: calc(8px + env(safe-area-inset-top));
  }
}

.offline-icon {
  font-size: 1.1rem;
  animation: pulse-offline 2s infinite;
}

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

.offline-badge {
  background: white;
  color: #dc2626;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  min-width: 20px;
  text-align: center;
}

.offline-sync-btn {
  background: rgba(255,255,255,0.2);
  border: 1px solid rgba(255,255,255,0.4);
  color: white;
  padding: 4px 12px;
  border-radius: 6px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: background 0.2s;
}

.offline-sync-btn:hover {
  background: rgba(255,255,255,0.3);
}

.offline-sync-btn:disabled {
  opacity: 0.7;
  cursor: wait;
}

/* Ajustar body cuando offline */
body.is-offline .header {
  margin-top: 40px;
}

@supports (padding-top: env(safe-area-inset-top)) {
  body.is-offline .header {
    margin-top: calc(40px + env(safe-area-inset-top));
  }
}

/* Indicador pequeño de estado offline (en header) */
.offline-indicator {
  display: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #22c55e;
}

.offline-indicator.offline {
  display: inline-block;
  background: #ef4444;
  animation: pulse-offline 1.5s infinite;
}
