:root {
  --font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  
  /* Paleta cromática profesional */
  --color-primary: #4f46e5;
  --color-primary-hover: #4338ca;
  --color-primary-light: #eef2ff;
  
  --color-bg-app: #f8fafc;
  --color-surface: #ffffff;
  --color-surface-hover: #f1f5f9;
  --color-border: #e2e8f0;
  
  --color-text-main: #0f172a;
  --color-text-muted: #64748b;
  --color-text-subtle: #94a3b8;

  --color-success: #10b981;
  --color-success-light: #ecfdf5;
  --color-warning: #f59e0b;
  --color-warning-light: #fffbeb;
  --color-danger: #ef4444;
  --color-danger-light: #fef2f2;
  --color-info: #3b82f6;
  --color-info-light: #eff6ff;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.03);
}

/* TEMA OSCURO (MODO DARK PROFESIONAL / OLED-FRIENDLY) */
[data-theme="dark"] {
  --color-primary: #6366f1;
  --color-primary-hover: #4f46e5;
  --color-primary-light: rgba(99, 102, 241, 0.16);

  --color-bg-app: #0b0f19;
  --color-surface: #131b2e;
  --color-surface-hover: #1c2742;
  --color-border: #232e4a;

  --color-text-main: #f8fafc;
  --color-text-muted: #94a3b8;
  --color-text-subtle: #64748b;

  --color-success: #34d399;
  --color-success-light: rgba(16, 185, 129, 0.16);
  --color-warning: #fbbf24;
  --color-warning-light: rgba(245, 158, 11, 0.16);
  --color-danger: #f87171;
  --color-danger-light: rgba(239, 68, 68, 0.16);
  --color-info: #60a5fa;
  --color-info-light: rgba(59, 130, 246, 0.16);

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.4);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.5), 0 2px 4px -2px rgba(0,0,0,0.4);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.6), 0 4px 6px -4px rgba(0,0,0,0.4);
}

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

body {
  font-family: var(--font-family);
  background-color: var(--color-bg-app);
  color: var(--color-text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* LAYOUT PRINCIPAL */
.app-layout {
  display: flex;
  height: 100vh;
  height: 100dvh;
  min-height: -webkit-fill-available;
  overflow: hidden;
}

/* SIDEBAR NAVEGACIÓN */
.sidebar {
  width: 260px;
  background-color: var(--color-surface);
  border-right: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.brand {
  padding: 24px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--color-border);
}

.brand-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 10px rgba(79, 70, 229, 0.3);
}

.brand-text h2 {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.brand-text span {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  font-weight: 500;
}

.nav-menu {
  padding: 20px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: none;
  background: transparent;
  color: var(--color-text-muted);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
  width: 100%;
}

.nav-item:hover {
  background-color: var(--color-bg-app);
  color: var(--color-text-main);
}

.nav-item.active {
  background-color: var(--color-primary-light);
  color: var(--color-primary);
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--color-border);
}

.teacher-profile {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.teacher-profile:hover {
  background-color: var(--color-surface-hover);
}

.teacher-profile:focus-visible {
  outline: 2px solid var(--color-primary);
}

.teacher-avatar {
  width: 38px;
  height: 38px;
  background-color: #6366f1;
  color: #fff;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
  transition: background-color 0.2s ease;
}

.teacher-info {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.teacher-name {
  font-size: 0.85rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.teacher-role {
  font-size: 0.7rem;
  color: var(--color-text-muted);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.teacher-edit-btn {
  background: transparent;
  border: none;
  color: var(--color-text-subtle);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.teacher-profile:hover .teacher-edit-btn {
  color: var(--color-primary);
  background-color: var(--color-primary-light);
}

/* ÁREA DE CONTENIDO */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  min-width: 0;
}

.top-header {
  padding: 20px 28px;
  background-color: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-width: 0;
  box-sizing: border-box;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1 1 auto;
}

.header-left > div {
  min-width: 0;
  flex: 1;
}

.header-left h1 {
  font-size: clamp(1.2rem, 2vw, 1.6rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.25;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.header-left p {
  color: var(--color-text-muted);
  font-size: 0.85rem;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* BOTONES Y FORMULARIOS */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.2s ease;
}

.btn-primary {
  background-color: var(--color-primary);
  color: #fff;
}

.btn-primary:hover {
  background-color: var(--color-primary-hover);
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.25);
}

.btn-secondary {
  background-color: var(--color-surface);
  border-color: var(--color-border);
  color: var(--color-text-main);
}

.btn-secondary:hover {
  background-color: var(--color-surface-hover);
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

/* Iconos de tema: alternar según [data-theme="dark"] */
.theme-icon-sun {
  display: none;
}
.theme-icon-moon {
  display: inline-block;
}

[data-theme="dark"] .theme-icon-sun {
  display: inline-block;
}
[data-theme="dark"] .theme-icon-moon {
  display: none;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
}

.btn-danger-ghost {
  background: transparent;
  border: none;
  color: var(--color-danger);
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.btn-danger-ghost:hover {
  background-color: var(--color-danger-light);
  transform: scale(1.05);
}

.btn-secondary-ghost {
  background: transparent;
  border: 1px solid transparent;
  color: var(--color-text-muted);
  cursor: pointer;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  transition: all var(--transition-fast);
}

.btn-secondary-ghost:hover {
  background-color: var(--color-surface);
  border-color: var(--color-border);
  color: var(--color-primary);
}

.btn-icon-ghost {
  background: transparent;
  border: none;
  color: var(--color-text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.btn-icon-ghost:hover {
  color: var(--color-primary);
  background-color: var(--color-surface-hover);
  transform: scale(1.05);
}

.actions-cell {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* SELECTOR DE VISTA MÓVIL: TARJETAS VS TABLA */
.mobile-view-selector {
  display: none; /* Por defecto oculto en pantallas de escritorio donde la tabla siempre es espaciosa */
  align-items: center;
  gap: 8px;
}

.mobile-view-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
}

.view-toggle-segmented {
  display: inline-flex;
  align-items: center;
  background-color: var(--color-surface-hover);
  padding: 3px;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  gap: 2px;
}

.view-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: none;
  background: transparent;
  color: var(--color-text-muted);
  font-size: 0.78rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  user-select: none;
}

.view-toggle-btn:hover {
  color: var(--color-text);
}

.view-toggle-btn.active {
  background-color: var(--color-surface);
  color: var(--color-primary);
  box-shadow: var(--shadow-sm);
  font-weight: 700;
}

/* ESTILOS GOOGLE DRIVE SYNC & LOGIN */
.google-drive-sync-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.google-btn {
  position: relative;
  border-color: var(--color-border);
  gap: 8px;
}

.google-btn:hover {
  border-color: #4285F4;
}

.google-icon {
  flex-shrink: 0;
}

.google-sync-indicator {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  display: inline-block;
  background-color: var(--color-text-subtle);
  transition: all var(--transition-fast);
}

.google-sync-indicator.idle {
  background-color: #94A3B8;
}

.google-sync-indicator.syncing {
  background-color: #F59E0B;
  animation: pulse-sync 1s infinite alternate;
}

.google-sync-indicator.synced {
  background-color: #10B981;
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.6);
}

.google-sync-indicator.error {
  background-color: #EF4444;
}

@keyframes pulse-sync {
  from { opacity: 0.4; transform: scale(0.85); }
  to { opacity: 1; transform: scale(1.15); }
}

.google-modal-body {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.google-user-box {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background-color: var(--color-surface-hover);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}

.google-user-avatar {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-full);
  background-color: #4285F4;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.1rem;
  background-size: cover;
  background-position: center;
  flex-shrink: 0;
}

.google-user-details h4 {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 2px;
}

.google-user-details span {
  font-size: 0.78rem;
  color: var(--color-text-muted);
  display: block;
}

.google-status-pill {
  display: inline-flex !important;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  font-size: 0.7rem !important;
  font-weight: 700;
  color: var(--color-success) !important;
}

.google-status-pill .pill-dot {
  width: 6px;
  height: 6px;
  border-radius: var(--radius-full);
  background-color: var(--color-success);
}

.google-login-prompt {
  text-align: center;
  padding: 16px;
  background-color: var(--color-surface-hover);
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.google-login-prompt p {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  line-height: 1.45;
}

.google-sync-actions-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 14px;
}

.sync-status-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.82rem;
}

.sync-status-row .label {
  color: var(--color-text-muted);
  font-weight: 600;
}

.sync-status-row .status-msg {
  font-weight: 700;
  color: var(--color-primary);
}

.google-buttons-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.google-footer-settings {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 4px;
  border-top: 1px solid var(--color-border);
  flex-wrap: wrap;
  gap: 8px;
}

.btn-link {
  background: none;
  border: none;
  color: var(--color-primary);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.btn-link:hover {
  text-decoration: underline;
  background-color: var(--color-surface-hover);
}

.btn-link.text-danger {
  color: var(--color-danger);
}

.btn-link.text-danger:hover {
  color: var(--color-danger);
}

/* ========================================================
   PANTALLA DE INICIO DE SESIÓN / LOGIN CON GOOGLE
   ======================================================== */
.auth-screen {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background-color: var(--color-bg-app);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow-y: auto;
}

.auth-background-effects {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}

.auth-blob {
  position: absolute;
  border-radius: var(--radius-full);
  filter: blur(80px);
  opacity: 0.28;
}

.auth-blob-1 {
  width: 380px;
  height: 380px;
  background: radial-gradient(circle, var(--color-primary), #3b82f6);
  top: -80px;
  left: -80px;
}

.auth-blob-2 {
  width: 420px;
  height: 420px;
  background: radial-gradient(circle, #10b981, #06b6d4);
  bottom: -100px;
  right: -100px;
}

.auth-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 480px;
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 40px 32px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  animation: fadeInAuth 0.35s ease-out;
}

@keyframes fadeInAuth {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.auth-brand {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.auth-logo-badge {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--color-primary), #4338ca);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 20px -4px rgba(79, 70, 229, 0.45);
  margin-bottom: 6px;
}

.auth-brand h1 {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--color-text-main);
}

.auth-tagline {
  font-size: 0.9rem;
  color: var(--color-text-muted);
  font-weight: 500;
}

.auth-features-preview {
  display: flex;
  flex-direction: column;
  gap: 12px;
  background-color: var(--color-surface-hover);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 16px 18px;
}

.feature-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.85rem;
  color: var(--color-text-main);
}

.feature-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  background-color: var(--color-primary);
  flex-shrink: 0;
}

.auth-actions-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.btn-google-login {
  background-color: var(--color-surface);
  color: var(--color-text-main);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
  font-size: 0.95rem;
  font-weight: 700;
  padding: 14px 20px;
  width: 100%;
  justify-content: center;
  gap: 12px;
  transition: all var(--transition-fast);
}

.btn-google-login:hover {
  background-color: var(--color-surface-hover);
  border-color: #4285F4;
  box-shadow: 0 4px 12px rgba(66, 133, 244, 0.18);
  transform: translateY(-1px);
}

.auth-divider {
  display: flex;
  align-items: center;
  text-align: center;
  margin: 4px 0;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid var(--color-border);
}

.auth-divider span {
  padding: 0 12px;
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--color-text-subtle);
  font-weight: 600;
  letter-spacing: 0.04em;
}

.btn-secondary-subtle {
  background-color: transparent;
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 10px 16px;
  width: 100%;
  justify-content: center;
}

.btn-secondary-subtle:hover {
  background-color: var(--color-surface-hover);
  color: var(--color-text-main);
}

.auth-card-footer {
  text-align: center;
  padding-top: 8px;
  border-top: 1px solid var(--color-border);
}

/* PESTAÑAS (TAB PANES) */
.tab-pane {
  display: none;
  padding: 32px;
}

.tab-pane.active {
  display: block;
}

/* GRID DE CLASES */
.classrooms-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 24px;
}

.classroom-card {
  background-color: var(--color-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  display: flex;
  flex-direction: column;
}

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

.classroom-card-banner {
  height: 8px;
}

.classroom-card-body {
  padding: 20px;
  flex: 1;
}

.classroom-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
}

.classroom-card-title {
  font-size: 1.15rem;
  font-weight: 700;
}

.classroom-card-badge {
  font-size: 0.75rem;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  background-color: var(--color-bg-app);
  color: var(--color-text-muted);
  font-weight: 600;
}

.classroom-card-desc {
  font-size: 0.825rem;
  color: var(--color-text-muted);
  margin-bottom: 16px;
}

.classroom-card-meta {
  display: flex;
  gap: 16px;
  font-size: 0.8rem;
  color: var(--color-text-muted);
  border-top: 1px solid var(--color-border);
  padding-top: 12px;
}

.classroom-card-actions {
  padding: 12px 20px;
  background-color: var(--color-surface-hover);
  border-top: 1px solid var(--color-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* FILTROS Y TABLA DE ESTUDIANTES */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
  background-color: var(--color-surface);
  padding: 16px 20px;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
}

.filter-item {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
}

.filter-item label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-text-muted);
  white-space: nowrap;
}

.form-select, .form-input, .form-textarea {
  font-family: inherit;
  font-size: 0.875rem;
  padding: 8px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background-color: var(--color-surface);
  color: var(--color-text-main);
  outline: none;
  transition: border-color 0.15s ease;
  box-sizing: border-box;
  max-width: 100%;
}

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

.search-box {
  flex: 1 1 200px;
  min-width: 180px;
}

.search-box input {
  width: 100%;
}

.students-table-container {
  background-color: var(--color-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.students-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.students-table th {
  background-color: var(--color-surface-hover);
  padding: 14px 20px;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
  color: var(--color-text-muted);
  border-bottom: 1px solid var(--color-border);
}

.students-table td {
  padding: 16px 20px;
  font-size: 0.875rem;
  border-bottom: 1px solid var(--color-border);
  vertical-align: middle;
}

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

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

.student-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 0.85rem;
}

.student-full-name {
  font-weight: 700;
}

/* VISTA: PASAR ASISTENCIA */
.attendance-header-card {
  background-color: var(--color-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  padding: 20px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.attendance-controls {
  display: flex;
  gap: 20px;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.control-group label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--color-text-muted);
  text-transform: uppercase;
}

.attendance-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.attendance-summary {
  display: flex;
  gap: 12px;
}

.stat-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  min-width: 80px;
}

.stat-badge .count {
  font-size: 1.25rem;
  font-weight: 800;
}

.stat-badge .label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
}

.stat-present { background-color: var(--color-success-light); color: var(--color-success); }
.stat-late { background-color: var(--color-warning-light); color: var(--color-warning); }
.stat-absent { background-color: var(--color-danger-light); color: var(--color-danger); }

.attendance-roster {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.roster-card {
  background-color: var(--color-surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
  gap: 12px;
  flex-wrap: wrap;
}

.roster-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.status-btn {
  padding: 8px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  background-color: var(--color-surface);
  color: var(--color-text-main);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.status-btn:hover {
  background-color: var(--color-surface-hover);
}

.status-btn.selected-PRESENT {
  background-color: var(--color-success);
  color: #fff;
  border-color: var(--color-success);
}

.status-btn.selected-LATE {
  background-color: var(--color-warning);
  color: #fff;
  border-color: var(--color-warning);
}

.status-btn.selected-ABSENT {
  background-color: var(--color-danger);
  color: #fff;
  border-color: var(--color-danger);
}

/* VISTA: CUADERNO DE CALIFICACIONES */
.grades-header-card {
  background-color: var(--color-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  padding: 20px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
  flex-wrap: wrap;
}

.grades-controls {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.grades-matrix-card {
  background-color: var(--color-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.grades-table-container {
  overflow-x: auto;
  overflow-y: auto;
  max-height: calc(100vh - 290px);
  min-height: 380px;
  -webkit-overflow-scrolling: touch;
  position: relative;
}

.grades-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  text-align: left;
}

.grades-table th {
  position: sticky;
  top: 0;
  z-index: 20;
  background-color: var(--color-surface);
  box-shadow: 0 1px 0 var(--color-border);
  padding: 12px 16px;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
  color: var(--color-text-muted);
  white-space: nowrap;
}

.grades-table th.grade-col-activity {
  min-width: 130px;
  text-align: center;
  vertical-align: middle;
}

.activity-th-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 100%;
  margin: 0 auto;
  text-align: center;
}

.activity-th-title {
  font-size: 0.8rem;
  color: var(--color-text-main);
  text-transform: none;
  font-weight: 700;
  text-align: center;
  line-height: 1.25;
}

.activity-th-badge {
  font-size: 0.65rem;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background-color: var(--color-primary-light);
  color: var(--color-primary);
  font-weight: 600;
}

.grades-table td {
  padding: 10px 16px;
  height: 58px;
  box-sizing: border-box;
  font-size: 0.875rem;
  border-bottom: 1px solid var(--color-border);
  vertical-align: middle;
}

.grades-table td.grade-cell-activity {
  text-align: center !important;
  vertical-align: middle;
}

.grades-table td.grade-cell-activity .grade-input {
  display: inline-block;
  margin: 0 auto;
}

.grades-table td.grade-cell-average {
  text-align: center !important;
  vertical-align: middle;
}

.grades-table td.grade-cell-average .grade-average-badge {
  display: inline-block;
  margin: 0 auto;
}

.grades-table tr:last-child td {
  border-bottom: 1px solid var(--color-border);
}

.grades-table tr.virtual-row {
  height: 58px;
  box-sizing: border-box;
}

.grades-table tr.virtual-spacer-row td {
  padding: 0 !important;
  margin: 0 !important;
  border: none !important;
  background: transparent !important;
  pointer-events: none;
}

/* BARRA DE HINTS PARA NAVEGACIÓN TIPO EXCEL */
.grades-keyboard-hints {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 18px;
  background-color: var(--color-surface-hover);
  border-bottom: 1px solid var(--color-border);
  font-size: 0.78rem;
  color: var(--color-text-muted);
  flex-wrap: wrap;
  transition: all 0.25s ease;
}

.grades-keyboard-hints.is-hidden {
  display: none !important;
}

.keyboard-hints-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  flex: 1;
}

.keyboard-hints-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.btn-hints-close {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--color-text-muted);
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-hints-close:hover {
  background-color: var(--color-surface-hover);
  color: var(--color-text-main);
  border-color: var(--color-primary);
}

.keyboard-hints-title {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  color: var(--color-primary);
}

.keyboard-keys-group {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.key-hint {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.virtual-stats-badge {
  background-color: var(--color-primary-light);
  color: var(--color-primary);
  font-weight: 700;
  font-size: 0.72rem;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  border: 1px solid rgba(79, 70, 229, 0.2);
}

@media (max-width: 768px) {
  /* En pantallas móviles se permite ocultar cómodamente y se adapta el layout */
  .grades-keyboard-hints {
    padding: 8px 12px;
    gap: 8px;
  }
  .keyboard-hints-left {
    gap: 8px;
  }
  .keyboard-hints-right {
    width: 100%;
    justify-content: space-between;
    padding-top: 4px;
    border-top: 1px dashed var(--color-border);
  }
}

.key-hint kbd {
  display: inline-block;
  padding: 2px 6px;
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--color-text-main);
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 4px;
  box-shadow: 0 1px 0 rgba(0,0,0,0.12);
}

[data-theme="dark"] .key-hint kbd {
  background-color: #1e293b;
  border-color: #334155;
  box-shadow: 0 1px 0 rgba(0,0,0,0.5);
}

.grade-input {
  width: 72px;
  text-align: center;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  padding: 6px 8px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background-color: var(--color-surface);
  color: var(--color-text-main);
  outline: none;
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: all;
}

.grade-input::-webkit-outer-spin-button,
.grade-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.grade-input[type=number] {
  -moz-appearance: textfield;
  appearance: textfield;
}

.grade-input:focus {
  border-color: var(--color-primary);
  background-color: var(--color-surface);
  box-shadow: 0 0 0 3px var(--color-primary-light), inset 0 0 0 1px var(--color-primary);
  transform: scale(1.04);
  z-index: 5;
  position: relative;
}

/* Fila activa resaltada tipo hoja de cálculo al navegar */
.grades-table tr.row-focused {
  background-color: var(--color-primary-light) !important;
}

.grades-table td.grade-cell-activity.cell-focused {
  background-color: rgba(79, 70, 229, 0.08);
}

.grade-average-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-weight: 800;
  font-size: 0.85rem;
  text-align: center;
  min-width: 48px;
}

.grade-average-high {
  background-color: var(--color-success-light);
  color: var(--color-success);
}

.grade-average-medium {
  background-color: var(--color-warning-light);
  color: var(--color-warning);
}

.grade-average-low {
  background-color: var(--color-danger-light);
  color: var(--color-danger);
}

.grade-average-none {
  background-color: var(--color-surface-hover);
  color: var(--color-text-muted);
}

/* MODALES */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background-color: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(4px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal-overlay.active {
  display: flex !important;
}

.modal-card {
  background-color: var(--color-surface);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 480px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.modal-card.modal-lg {
  max-width: 640px;
}

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

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

.modal-close-btn {
  background: transparent;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--color-text-muted);
}

form {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--color-text-main);
}

.form-row {
  display: flex;
  gap: 12px;
}

.form-row .form-group {
  flex: 1;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 8px;
}

/* PALETA DE COLOR */
.color-picker-palette {
  display: flex;
  gap: 12px;
}

.color-choice input {
  display: none;
}

.color-choice span {
  display: block;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  cursor: pointer;
  border: 2px solid transparent;
  transition: transform 0.15s ease;
}

.color-choice input:checked + span {
  transform: scale(1.15);
  box-shadow: 0 0 0 3px #fff, 0 0 0 5px var(--color-primary);
}

/* SELECTOR MULTI-GRUPO PARA ESTUDIANTES */
.classroom-checkbox-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 180px;
  overflow-y: auto;
  padding: 10px 12px;
  background-color: var(--color-bg-app);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}

.classroom-checkbox-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  transition: all var(--transition-fast);
  user-select: none;
}

.classroom-checkbox-item:hover {
  background-color: var(--color-surface-hover);
  border-color: var(--color-primary-light);
}

.classroom-checkbox-item input[type="checkbox"] {
  width: 17px;
  height: 17px;
  accent-color: var(--color-primary);
  cursor: pointer;
}

.classroom-checkbox-color-dot {
  width: 10px;
  height: 10px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
}

.classroom-checkbox-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-text-main);
  flex: 1;
}

.classroom-checkbox-grade {
  font-size: 0.72rem;
  color: var(--color-text-muted);
}

.student-groups-cell {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
}

.group-pill-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.73rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  background-color: var(--color-bg-app);
  border: 1px solid var(--color-border);
  color: var(--color-text-main);
}

.group-pill-dot {
  width: 6px;
  height: 6px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
}

/* MODAL DE INCIDENCIAS */
.modal-tab-content {
  padding: 20px 24px;
}

.student-modal-badge {
  display: flex;
  align-items: center;
  gap: 14px;
}

.student-avatar-lg {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-full);
  background-color: var(--color-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.1rem;
}

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

.new-incident-box {
  background-color: var(--color-bg-app);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 12px;
  margin-bottom: 20px;
}

.incidents-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 240px;
  overflow-y: auto;
}

.incident-item {
  padding: 12px;
  border-radius: var(--radius-sm);
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  display: flex;
  justify-content: space-between;
}

.incident-item.positive { border-left: 4px solid var(--color-success); }
.incident-item.negative { border-left: 4px solid var(--color-danger); }
.incident-item.note { border-left: 4px solid var(--color-info); }

/* ========================================================
   DISEÑO RESPONSIVE Y ADAPTACIÓN MULTIPANTALLA (WEB & ANDROID)
   ======================================================== */

/* Botón de menú hamburguesa móvil (oculto en desktop) */
.btn-icon-mobile {
  display: none;
  background: transparent;
  border: none;
  color: var(--color-text-main);
  cursor: pointer;
  padding: 8px;
  border-radius: var(--radius-sm);
  align-items: center;
  justify-content: center;
  margin-right: 4px;
}

.btn-icon-mobile:hover {
  background-color: var(--color-bg-app);
}

/* Telón de fondo (backdrop) para cerrar el sidebar en móviles */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background-color: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(2px);
  z-index: 45;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.sidebar-backdrop.active {
  display: block;
  opacity: 1;
}

/* Barra de navegación inferior móvil (estilo App nativa) */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60px;
  background-color: var(--color-surface);
  border-top: 1px solid var(--color-border);
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
  z-index: 40;
  justify-content: space-around;
  align-items: center;
  padding: 0 8px;
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--color-text-muted);
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  flex: 1;
  gap: 2px;
  transition: all 0.15s ease;
}

.bottom-nav-item.active {
  color: var(--color-primary);
  font-weight: 700;
}

.bottom-nav-item svg {
  transition: transform 0.15s ease;
}

.bottom-nav-item.active svg {
  transform: translateY(-1px);
}

/* ----------------------------------------------------
   LAPTOPS Y PANTALLAS COMPACTAS (<= 1200px)
   ---------------------------------------------------- */
@media (max-width: 1200px) {
  .sidebar {
    width: 220px;
  }

  .top-header {
    padding: 16px 24px;
    gap: 12px;
  }

  /* Compactar botones secundarios con iconos claros */
  #btn-theme-toggle .theme-btn-text,
  #btn-pwa-install .pwa-install-btn-text,
  #btn-header-teacher-profile .teacher-btn-text {
    display: none;
  }

  #btn-theme-toggle,
  #btn-pwa-install,
  #btn-header-teacher-profile {
    padding: 0;
    width: 38px;
    height: 38px;
    min-width: 38px;
    justify-content: center;
    border-radius: var(--radius-md);
  }
}

/* ----------------------------------------------------
   TABLETS (LANDSCAPE & PORTRAIT: 769px <= width <= 1024px)
   ---------------------------------------------------- */
@media (max-width: 1024px) {
  /* Sidebar compacto optimizado para tablets */
  .sidebar {
    width: 200px;
    padding: 16px 10px;
  }

  .brand {
    padding: 0 4px;
    margin-bottom: 20px;
    gap: 8px;
  }

  .brand-icon {
    width: 36px;
    height: 36px;
  }

  .brand-text h2 {
    font-size: 1.1rem;
  }

  .brand-text span {
    font-size: 0.68rem;
  }

  .nav-item {
    padding: 9px 10px;
    font-size: 0.82rem;
    gap: 8px;
    border-radius: var(--radius-md);
  }

  .nav-item svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
  }

  .sidebar-footer {
    padding: 8px 4px 0 4px;
  }

  .teacher-profile {
    padding: 8px 10px;
    gap: 8px;
  }

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

  .teacher-name {
    font-size: 0.8rem;
  }

  .teacher-role {
    font-size: 0.68rem;
  }

  /* Header tablet: sin colisiones, títulos fluidos y botones de acción tipo icono */
  .top-header {
    padding: 12px 18px;
    gap: 10px;
    min-height: 62px;
    box-sizing: border-box;
  }

  .header-left {
    min-width: 0;
    flex: 1 1 auto;
    gap: 8px;
  }

  .header-left > div {
    min-width: 0;
    flex: 1;
  }

  .header-left h1 {
    font-size: clamp(1.1rem, 2.2vw, 1.35rem);
    font-weight: 700;
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .header-left p {
    font-size: 0.78rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 300px;
    margin-top: 1px;
  }

  .header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
  }

  /* Todos los botones secundarios en tablet como iconos elegantes con tooltip */
  #btn-google-drive,
  #btn-pwa-install,
  #btn-header-teacher-profile,
  #btn-header-export-reports,
  #btn-theme-toggle {
    padding: 0;
    width: 38px;
    height: 38px;
    min-width: 38px;
    justify-content: center;
    border-radius: var(--radius-md);
    position: relative;
  }

  #btn-google-drive .google-btn-text,
  #btn-pwa-install .pwa-install-btn-text,
  #btn-header-teacher-profile .teacher-btn-text,
  #btn-header-export-reports .report-btn-text,
  #btn-theme-toggle .theme-btn-text {
    display: none;
  }

  /* Indicador de sincronización como badge en la esquina del botón icono de Drive */
  #btn-google-drive .google-sync-indicator {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 8px;
    height: 8px;
    border: 1.5px solid var(--color-surface);
    margin: 0;
  }

  /* Botón de acción rápida superior en tablet */
  #btn-quick-action {
    padding: 8px 12px;
    font-size: 0.8rem;
    gap: 6px;
    border-radius: var(--radius-md);
    white-space: nowrap;
  }

  /* Pestañas y paneles */
  .tab-pane {
    padding: 18px 16px;
  }

  /* Grid de aulas */
  .classrooms-grid {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
  }

  .classroom-card-actions {
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 16px;
  }

  /* Filtros de estudiantes en tablet */
  .filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding: 14px 16px;
    align-items: center;
  }

  .filter-item {
    flex: 1 1 200px;
    min-width: 160px;
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .filter-item.search-box {
    flex: 2 1 240px;
  }

  .filter-item.filter-action-item {
    flex: 0 0 auto;
  }

  /* Asistencia */
  .attendance-header-card {
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
    padding: 16px;
  }

  .attendance-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
  }

  .attendance-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    gap: 12px;
    flex-wrap: wrap;
  }

  .attendance-summary {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    flex: 1;
  }

  .attendance-summary .stat-badge {
    flex: 1;
    min-width: 90px;
  }

  .attendance-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
  }

  /* Calificaciones */
  .grades-header-card {
    padding: 16px;
    gap: 12px;
    flex-wrap: wrap;
  }

  .grades-controls {
    flex-wrap: wrap;
    gap: 10px;
  }

  .bulk-actions-toolbar {
    flex-wrap: wrap;
    gap: 10px;
    padding: 10px 14px;
  }
}

/* Tablets en modo vertical estrecho (<= 850px) */
@media (max-width: 850px) and (min-width: 769px) {
  #btn-quick-action {
    padding: 0;
    width: 38px;
    height: 38px;
    min-width: 38px;
    justify-content: center;
  }

  #btn-quick-action #quick-action-text {
    display: none;
  }

  .header-left p {
    display: none;
  }
}

/* ----------------------------------------------------
   MÓVILES Y PANTALLAS PEQUEÑAS (<= 768px - ANDROID / SMARTPHONES)
   ---------------------------------------------------- */
@media (max-width: 768px) {
  /* Layout fluído para móvil */
  .app-layout {
    position: relative;
    overflow-x: hidden;
  }

  /* Sidebar flotante tipo drawer off-canvas */
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 280px;
    z-index: 50;
    transform: translateX(-100%);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15);
  }

  .sidebar.mobile-open {
    transform: translateX(0);
  }

  /* Mostrar botón menú */
  .btn-icon-mobile {
    display: inline-flex;
  }

  /* Barra de navegación inferior móvil visible */
  .bottom-nav {
    display: flex;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    height: calc(60px + env(safe-area-inset-bottom, 0px));
  }

  /* Margen inferior amplio para no tapar el último elemento ni la última tarjeta de notas con la barra inferior */
  .main-content {
    padding-bottom: calc(95px + env(safe-area-inset-bottom, 0px));
  }

  /* Header compacto sin desbordamientos */
  .top-header {
    padding: 10px 12px;
    gap: 8px;
    flex-wrap: nowrap;
  }

  .header-left {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    flex: 1 1 auto;
  }

  .header-left > div {
    min-width: 0;
    flex: 1;
  }

  .header-left h1 {
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: -0.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .header-left p {
    display: none; /* Ocultar subtítulo para ganar espacio en pantalla vertical */
  }

  .header-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
  }

  .header-actions .btn {
    padding: 6px 8px;
    font-size: 0.8rem;
    white-space: nowrap;
  }

  /* Ocultar texto en todos los botones secundarios y de acción rápida en móvil */
  #btn-theme-toggle,
  #btn-pwa-install,
  #btn-header-teacher-profile,
  #btn-header-export-reports,
  #btn-google-drive,
  #btn-quick-action {
    padding: 0;
    width: 36px;
    height: 36px;
    min-width: 36px;
    justify-content: center;
    border-radius: var(--radius-md);
    position: relative;
  }

  #btn-theme-toggle .theme-btn-text,
  #btn-pwa-install .pwa-install-btn-text,
  #btn-header-teacher-profile .teacher-btn-text,
  #btn-header-export-reports .report-btn-text,
  #btn-google-drive .google-btn-text,
  #btn-quick-action #quick-action-text {
    display: none;
  }

  /* Ocultar en móvil botones de cabecera redundantes ya accesibles en el menú lateral para dejar espacio al título */
  #btn-header-teacher-profile,
  #btn-header-export-reports {
    display: none !important;
  }

  #btn-google-drive .google-sync-indicator {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 8px;
    height: 8px;
    border: 1.5px solid var(--color-surface);
    margin: 0;
  }

  /* Área de pestañas */
  .tab-pane {
    padding: 14px 12px;
  }

  /* Vista de Calificaciones responsive */
  .grades-header-card {
    padding: 14px;
    gap: 12px;
  }

  .grades-controls {
    display: flex;
    flex-direction: column;
    width: 100%;
    gap: 10px;
  }

  .grades-controls .control-group {
    width: 100%;
    flex: 0 0 auto !important;
    min-height: auto !important;
    display: flex;
    flex-direction: column;
    gap: 5px;
  }

  .grades-controls .control-group label {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--color-text-muted);
  }

  .grades-controls .form-select {
    width: 100%;
    height: 42px;
    box-sizing: border-box;
    font-size: 0.875rem;
  }

  #btn-toggle-keyboard-hints {
    display: none !important; /* Ocultar guía de teclas en móviles al tratarse de dispositivos táctiles */
  }

  .grades-actions {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  .grades-actions .btn {
    width: 100%;
    justify-content: center;
    height: 40px;
  }

  /* Grid de aulas a 1 columna en móviles */
  .classrooms-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  /* Barra de filtros de estudiantes compacta y adaptada a móvil */
  .filter-bar {
    display: flex;
    flex-direction: column;
    padding: 14px;
    gap: 10px;
    margin-bottom: 16px;
    border-radius: var(--radius-md);
  }

  .filter-item {
    flex: 0 0 auto !important;
    width: 100%;
    min-height: auto !important;
    height: auto !important;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 5px;
    box-sizing: border-box;
  }

  .filter-item label {
    min-width: 0;
    width: auto;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--color-text-muted);
    margin: 0;
  }

  .filter-item select,
  .filter-item input {
    width: 100%;
    height: 42px;
    box-sizing: border-box;
    font-size: 0.875rem;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
  }

  .filter-item.filter-action-item {
    margin-top: 4px;
  }

  .filter-item.filter-action-item .btn {
    width: 100%;
    justify-content: center;
    height: 40px;
  }

  /* Mostrar selector de vista en móvil con separador limpio */
  .mobile-view-selector {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    margin-top: 4px;
    padding-top: 10px;
    border-top: 1px dashed var(--color-border);
    box-sizing: border-box;
  }

  /* --- MODO TARJETAS EN MÓVILES (POR DEFECTO O data-view-mode="cards") --- */
  html:not([data-view-mode="table"]) .students-table-container {
    background: transparent;
    border: none;
    box-shadow: none;
    overflow: visible;
  }

  html:not([data-view-mode="table"]) .students-table {
    display: block;
    width: 100%;
  }

  html:not([data-view-mode="table"]) .students-table thead {
    display: none; /* Ocultar cabecera tabular rígida */
  }

  html:not([data-view-mode="table"]) .students-table tbody {
    display: flex;
    flex-direction: column;
    gap: 14px;
    width: 100%;
    padding-bottom: 24px;
  }

  html:not([data-view-mode="table"]) .students-table tr {
    display: flex;
    flex-direction: column;
    height: auto !important;
    min-height: auto !important;
    max-height: none !important;
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 16px;
    gap: 12px;
    box-sizing: border-box;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
    position: relative;
  }

  html:not([data-view-mode="table"]) .students-table tr:last-child {
    margin-bottom: 16px;
  }

  html:not([data-view-mode="table"]) .students-table tr:hover {
    box-shadow: var(--shadow-md);
  }

  html:not([data-view-mode="table"]) .students-table td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0;
    height: auto !important;
    border-bottom: 1px dashed var(--color-border);
    padding-bottom: 10px;
    font-size: 0.85rem;
    white-space: normal;
    box-sizing: border-box;
  }

  html:not([data-view-mode="table"]) .students-table td:last-child {
    border-bottom: none;
    padding-bottom: 0;
    padding-top: 4px;
    justify-content: flex-end;
  }

  /* Celda de selección en tarjeta móvil: ubicada a la izquierda, a la misma altura del avatar y nombre */
  html:not([data-view-mode="table"]) .students-table td.student-select-cell,
  html:not([data-view-mode="table"]) .students-table td:has(.student-row-checkbox),
  html:not([data-view-mode="table"]) .students-table td:first-child:not([data-label]) {
    position: absolute;
    top: 16px;
    left: 16px;
    width: 24px !important;
    height: 38px !important;
    border-bottom: none !important;
    padding: 0 !important;
    margin: 0 !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    z-index: 2;
    cursor: pointer;
  }

  html:not([data-view-mode="table"]) .students-table td.student-select-cell::before,
  html:not([data-view-mode="table"]) .students-table td:has(.student-row-checkbox)::before,
  html:not([data-view-mode="table"]) .students-table td:first-child:not([data-label])::before {
    display: none !important;
    content: none !important;
    margin: 0 !important;
  }

  /* Cabecera de la tarjeta: Nombre y avatar del estudiante alineado con el checkbox a la izquierda */
  html:not([data-view-mode="table"]) .students-table td[data-label="Estudiante"],
  html:not([data-view-mode="table"]) .students-table td[data-label="Alumno"] {
    justify-content: flex-start;
    border-bottom: 1px solid var(--color-border);
    padding-bottom: 12px;
    padding-left: 34px;
    margin-bottom: 2px;
    min-height: 38px;
    box-sizing: border-box;
  }

  html:not([data-view-mode="table"]) .students-table td[data-label="Estudiante"]::before,
  html:not([data-view-mode="table"]) .students-table td[data-label="Alumno"]::before {
    display: none !important;
  }

  /* Etiquetas descriptoras antes de cada dato */
  html:not([data-view-mode="table"]) .students-table td:not([data-label="Estudiante"]):not([data-label="Alumno"]):not(.student-select-cell):not(:has(.student-row-checkbox))::before {
    content: attr(data-label);
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-muted);
    flex-shrink: 0;
    margin-right: 12px;
  }

  html:not([data-view-mode="table"]) .students-table td[data-label="Acciones"] .actions-cell {
    gap: 10px;
  }

  /* Cuaderno de Calificaciones transformado a tarjetas */
  html:not([data-view-mode="table"]) .grades-matrix-card {
    background: transparent;
    border: none;
    box-shadow: none;
    overflow: visible;
  }

  html:not([data-view-mode="table"]) .grades-table-container {
    overflow: visible !important;
    max-height: none !important;
    min-height: auto !important;
    height: auto !important;
  }

  html:not([data-view-mode="table"]) .grades-table {
    display: block !important;
    width: 100% !important;
  }

  html:not([data-view-mode="table"]) .grades-table thead {
    display: none !important; /* Ocultar cabecera tabular rígida */
  }

  html:not([data-view-mode="table"]) .grades-table tbody {
    display: flex !important;
    flex-direction: column !important;
    gap: 16px !important;
    width: 100% !important;
    padding-bottom: 30px !important; /* Margen extra para asegurar que la última tarjeta y su promedio queden 100% visibles */
  }

  html:not([data-view-mode="table"]) .grades-table tr,
  html:not([data-view-mode="table"]) .grades-table tr.virtual-row {
    display: flex !important;
    flex-direction: column !important;
    height: auto !important;
    min-height: auto !important;
    max-height: none !important;
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 16px;
    gap: 10px;
    box-sizing: border-box;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
  }

  html:not([data-view-mode="table"]) .grades-table tr.virtual-spacer-row {
    display: none !important;
    height: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
  }

  html:not([data-view-mode="table"]) .grades-table tr:last-child {
    margin-bottom: 20px;
  }

  html:not([data-view-mode="table"]) .grades-table td {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding: 8px 0 !important;
    height: auto !important;
    min-height: 40px !important;
    border-bottom: 1px dashed var(--color-border);
    font-size: 0.85rem;
    white-space: normal;
    text-align: left !important;
    box-sizing: border-box;
  }

  html:not([data-view-mode="table"]) .grades-table td:last-child {
    border-bottom: none;
    padding-bottom: 2px;
    padding-top: 10px;
  }

  html:not([data-view-mode="table"]) .grades-table td[data-label="Estudiante"],
  html:not([data-view-mode="table"]) .grades-table td[data-label="Alumno"] {
    justify-content: flex-start;
    border-bottom: 1px solid var(--color-border);
    padding-bottom: 12px;
    margin-bottom: 4px;
  }

  html:not([data-view-mode="table"]) .grades-table td[data-label="Estudiante"]::before,
  html:not([data-view-mode="table"]) .grades-table td[data-label="Alumno"]::before {
    display: none;
  }

  html:not([data-view-mode="table"]) .grades-table td.grade-cell-average {
    background-color: var(--color-surface-hover);
    margin: 8px -16px -16px -16px;
    padding: 14px 16px;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    border-top: 1px solid var(--color-border);
    border-bottom: none;
  }

  html:not([data-view-mode="table"]) .grades-table td:not([data-label="Estudiante"]):not([data-label="Alumno"])::before {
    content: attr(data-label);
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-text-muted);
    margin-right: 12px;
    flex: 1 1 auto;
    max-width: 65%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  html:not([data-view-mode="table"]) .grades-table .grade-input {
    width: 68px;
    height: 38px;
    font-size: 0.95rem;
    text-align: center;
    border-radius: var(--radius-md);
    margin: 0 !important;
  }

  /* --- MODO TABLA CLÁSICA EN MÓVILES (data-view-mode="table") --- */
  html[data-view-mode="table"] .students-table-container,
  html[data-view-mode="table"] .grades-table-container {
    overflow-x: auto !important;
    overflow-y: auto !important;
    max-height: calc(100vh - 280px) !important;
    min-height: 320px !important;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius-md);
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
  }

  html[data-view-mode="table"] .students-table,
  html[data-view-mode="table"] .grades-table {
    display: table;
    width: 100%;
    min-width: 580px;
  }

  html[data-view-mode="table"] .students-table thead,
  html[data-view-mode="table"] .grades-table thead {
    display: table-header-group;
  }

  html[data-view-mode="table"] .students-table tbody,
  html[data-view-mode="table"] .grades-table tbody {
    display: table-row-group;
  }

  html[data-view-mode="table"] .students-table tr,
  html[data-view-mode="table"] .grades-table tr {
    display: table-row;
    background: transparent;
    box-shadow: none;
    border: none;
    padding: 0;
  }

  html[data-view-mode="table"] .students-table th,
  html[data-view-mode="table"] .grades-table th {
    padding: 10px 14px;
    font-size: 0.75rem;
    white-space: nowrap;
  }

  html[data-view-mode="table"] .students-table td,
  html[data-view-mode="table"] .grades-table td {
    display: table-cell;
    padding: 12px 14px;
    font-size: 0.8rem;
    white-space: nowrap;
    border-bottom: 1px solid var(--color-border);
  }

  html[data-view-mode="table"] .students-table td.student-select-cell {
    position: static !important;
    width: 44px !important;
    height: auto !important;
    padding: 12px 14px !important;
    border-bottom: 1px solid var(--color-border) !important;
    display: table-cell !important;
  }

  html[data-view-mode="table"] .students-table td[data-label="Estudiante"],
  html[data-view-mode="table"] .students-table td[data-label="Alumno"] {
    padding-left: 14px !important;
  }

  html[data-view-mode="table"] .students-table td::before,
  html[data-view-mode="table"] .grades-table td::before {
    display: none !important;
  }

  html[data-view-mode="table"] .grade-input {
    width: 54px;
    height: 32px;
    font-size: 0.85rem;
    text-align: center;
  }

  /* Tarjeta y controles de asistencia */
  .attendance-header-card {
    padding: 14px;
    gap: 14px;
    border-radius: var(--radius-md);
  }

  .attendance-controls {
    flex-direction: column;
    width: 100%;
    gap: 10px;
  }

  .attendance-controls .control-group {
    width: 100%;
    flex: 0 0 auto !important;
    min-height: auto !important;
    display: flex;
    flex-direction: column;
    gap: 5px;
  }

  .attendance-controls .control-group label {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--color-text-muted);
  }

  .attendance-controls .form-select,
  .attendance-controls .form-input {
    width: 100%;
    height: 42px;
    box-sizing: border-box;
    font-size: 0.875rem;
  }

  .attendance-meta {
    display: flex;
    flex-direction: column;
    width: 100%;
    gap: 12px;
  }

  .attendance-summary {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
    gap: 8px;
  }

  .stat-badge {
    min-width: 0;
    width: 100%;
    padding: 8px 4px;
    text-align: center;
    box-sizing: border-box;
  }

  .stat-badge .count {
    font-size: 1.15rem;
    line-height: 1.2;
  }

  .stat-badge .label {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
    width: 100%;
  }

  .attendance-actions {
    width: 100%;
    max-width: 100%;
    display: flex;
    box-sizing: border-box;
  }

  /* Lista de asistencia (roster cards) vertical y táctil */
  .roster-card {
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
    padding: 14px;
  }

  .roster-actions {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    width: 100%;
  }

  .status-btn {
    padding: 10px 4px;
    text-align: center;
    font-size: 0.75rem;
  }

  /* Modales optimizados para móvil / pantalla táctil */
  .modal-card {
    width: 95%;
    max-width: 480px;
    max-height: min(90vh, 90dvh);
    overflow-y: auto;
    margin: auto;
    box-sizing: border-box;
  }

  .modal-card.modal-lg,
  .import-modal-card,
  .export-reports-modal-card {
    width: 95%;
    max-width: 100%;
    box-sizing: border-box;
  }

  .modal-header {
    padding: 16px 18px;
    box-sizing: border-box;
  }

  .modal-header > div:first-child {
    min-width: 0;
    flex: 1;
  }

  .modal-header h3 {
    word-break: break-word;
  }

  form {
    padding: 18px;
    gap: 14px;
  }

  .form-row {
    flex-direction: column;
    gap: 14px;
  }

  .modal-tab-content {
    padding: 16px 18px;
  }

  .color-picker-palette {
    justify-content: space-around;
  }

  /* Tips y badges en modales móvil: apilamiento vertical para evitar desborde de texto */
  .format-tip-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    width: 100%;
    box-sizing: border-box;
  }

  .format-tip-item > span:not(.tip-badge) {
    width: 100%;
    min-width: 0;
    word-break: break-word;
    font-size: 0.8rem;
    line-height: 1.45;
  }

  .import-format-tips {
    padding: 10px 12px;
    gap: 10px;
  }

  .import-order-options {
    flex-direction: column;
    gap: 6px;
    width: 100%;
  }

  .import-order-chip {
    width: 100%;
    box-sizing: border-box;
    justify-content: flex-start;
    padding: 8px 12px;
    font-size: 0.78rem;
  }

  .import-method-tabs {
    flex-direction: column;
    gap: 6px;
  }

  .import-tab-btn {
    width: 100%;
    justify-content: center;
    padding: 8px 10px;
    font-size: 0.8rem;
  }

  .import-template-actions button {
    width: 100%;
    justify-content: center;
  }

  .import-step-card {
    padding: 12px 14px;
  }

  .import-modal-body {
    padding: 14px 12px;
    gap: 12px;
  }

  .modal-actions {
    flex-direction: column-reverse;
    width: 100%;
    gap: 8px;
  }

  .modal-actions .btn {
    width: 100%;
    justify-content: center;
  }
}

/* ----------------------------------------------------
   PANTALLAS INTERMEDIAS / MÓVILES HORIZONTALES (480px - 768px)
   ---------------------------------------------------- */
@media (min-width: 480px) and (max-width: 768px) {
  .filter-bar {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }

  .filter-item:first-child {
    grid-column: 1 / -1;
  }

  .filter-item.search-box {
    grid-column: 1 / -1;
  }

  .filter-item.filter-action-item {
    grid-column: 1 / 2;
    margin-top: 0;
  }

  .filter-item.mobile-view-selector {
    grid-column: 2 / 3;
    margin-top: 0;
    padding-top: 0;
    border-top: none;
    height: 100%;
    justify-content: flex-end;
  }

  .attendance-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .grades-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .grades-controls .control-group:first-child {
    grid-column: 1 / -1;
  }

  .grades-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
}

/* ----------------------------------------------------
   PANTALLAS MUY PEQUEÑAS (<= 480px)
   ---------------------------------------------------- */
@media (max-width: 480px) {
  .top-header {
    padding: 8px 10px;
    gap: 6px;
  }

  .header-left {
    gap: 6px;
  }

  .header-left h1 {
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1.2;
    max-width: 180px;
  }

  .header-actions {
    gap: 4px;
  }

  #btn-pwa-install {
    display: none !important;
  }

  #btn-theme-toggle,
  #btn-google-drive,
  #btn-quick-action {
    width: 34px;
    height: 34px;
    min-width: 34px;
    padding: 0;
  }

  #btn-theme-toggle svg,
  #btn-quick-action svg {
    width: 16px;
    height: 16px;
  }

  .google-icon {
    width: 16px;
    height: 16px;
  }

  .bottom-nav-item {
    font-size: 0.68rem;
    padding: 4px 6px;
  }

  .bottom-nav-item svg {
    width: 20px;
    height: 20px;
  }

  /* Ajustes para pantalla de inicio / auth en móviles */
  .auth-screen {
    padding: 12px;
  }

  .auth-card {
    padding: 24px 16px;
    gap: 16px;
  }

  .auth-brand h1 {
    font-size: 1.5rem;
  }

  .auth-tagline {
    font-size: 0.8rem;
  }

  /* Modales en móviles pequeños */
  .modal-card {
    width: 98%;
    border-radius: var(--radius-md);
  }

  .modal-header {
    padding: 14px 16px;
  }

  form {
    padding: 14px;
    gap: 12px;
  }
}

@media (max-width: 360px) {
  .header-left h1 {
    font-size: 0.84rem;
    max-width: 140px;
  }

  .top-header {
    padding: 6px 8px;
    gap: 4px;
  }

  .tab-pane {
    padding: 10px 8px;
  }

  .filter-bar {
    padding: 10px 8px;
    gap: 8px;
  }

  .filter-item select,
  .filter-item input {
    height: 38px;
    font-size: 0.82rem;
    padding: 6px 8px;
  }

  #btn-theme-toggle,
  #btn-google-drive,
  #btn-quick-action {
    width: 30px;
    height: 30px;
    min-width: 30px;
  }
}

/* ----------------------------------------------------
   NOTIFICACIÓN FLOTANTE DE RENOVACIÓN DE SESIÓN GOOGLE
   ---------------------------------------------------- */
.session-expired-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  max-width: 460px;
  width: calc(100vw - 32px);
  background: var(--color-surface);
  border: 1px solid var(--color-warning);
  border-left: 5px solid var(--color-warning);
  border-radius: var(--radius-lg);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.18), 0 4px 10px rgba(0, 0, 0, 0.08);
  padding: 16px 18px;
  z-index: 10000;
  animation: slideInUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideInUp {
  from {
    transform: translateY(100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.session-toast-content {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.session-toast-icon {
  color: var(--color-warning);
  display: flex;
  align-items: center;
}

.session-toast-info h4 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--color-text-main);
  margin-bottom: 4px;
}

.session-toast-info p {
  font-size: 0.83rem;
  color: var(--color-text-muted);
  line-height: 1.4;
}

.session-toast-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 4px;
}

.session-toast-actions .btn-sm {
  padding: 6px 14px;
  font-size: 0.82rem;
  font-weight: 600;
}

/* Indicador de estado expirado para el badge del header */
.google-sync-indicator.expired {
  background-color: var(--color-warning);
  box-shadow: 0 0 0 2px var(--color-warning-light);
  animation: pulse-warn 2s infinite;
}

@keyframes pulse-warn {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(245, 158, 11, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(245, 158, 11, 0); }
}

/* Indicador de estado offline */
.google-sync-indicator.offline {
  background-color: var(--color-text-subtle);
  box-shadow: 0 0 0 2px rgba(148, 163, 184, 0.2);
}

/* Indicador de conflicto de sincronización */
.google-sync-indicator.conflict {
  background-color: var(--color-warning);
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.4);
  animation: pulse-conflict 1.2s infinite;
}

@keyframes pulse-conflict {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.85); }
  70% { transform: scale(1.15); box-shadow: 0 0 0 7px rgba(245, 158, 11, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(245, 158, 11, 0); }
}

/* Toasts de red (Offline / Online) */
.network-status-toast {
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10001;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 18px;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  max-width: 90vw;
  box-shadow: var(--shadow-lg);
  animation: slideDownFade 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideDownFade {
  from {
    transform: translate(-50%, -100%);
    opacity: 0;
  }
  to {
    transform: translate(-50%, 0);
    opacity: 1;
  }
}

.network-status-toast.network-offline {
  background-color: #1e293b;
  color: #f1f5f9;
  border: 1px solid #334155;
}

.network-status-toast.network-offline svg {
  color: var(--color-warning);
  flex-shrink: 0;
}

.network-status-toast.network-online {
  background-color: #064e3b;
  color: #ecfdf5;
  border: 1px solid #059669;
}

.network-status-toast.network-online svg {
  color: var(--color-success);
  flex-shrink: 0;
}

/* ========================================================
   MODAL DE RESOLUCIÓN DE CONFLICTOS & FUSIÓN (MERGING)
   ======================================================== */
.conflict-modal-card {
  max-width: 620px;
  width: 94vw;
  border-top: 4px solid var(--color-warning);
  max-height: 90vh;
  overflow-y: auto;
}

.conflict-banner-alert {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  background-color: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: var(--radius-md);
  color: var(--color-warning);
  font-size: 0.85rem;
  line-height: 1.45;
  margin-bottom: 16px;
}

.conflict-banner-alert svg {
  flex-shrink: 0;
  margin-top: 2px;
  color: var(--color-warning);
}

.conflict-compare-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 18px;
}

@media (max-width: 580px) {
  .conflict-compare-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }
}

.conflict-source-card {
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: var(--shadow-sm);
}

.conflict-source-card.remote-card {
  border-left: 4px solid #3b82f6;
}

.conflict-source-card.local-card {
  border-left: 4px solid #10b981;
}

.conflict-source-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.conflict-source-header h4 {
  font-size: 0.92rem;
  font-weight: 700;
  margin: 0;
  color: var(--color-text-main);
}

.conflict-source-header .source-tag {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  letter-spacing: 0.3px;
}

.source-tag.tag-newer {
  background-color: rgba(59, 130, 246, 0.12);
  color: #2563eb;
}

.source-tag.tag-local {
  background-color: rgba(16, 185, 129, 0.12);
  color: #059669;
}

.conflict-source-time {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.conflict-source-time strong {
  color: var(--color-text-main);
  font-size: 0.82rem;
}

.conflict-metrics-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.metric-badge {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 8px;
  background-color: var(--color-surface-hover);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  color: var(--color-text-main);
}

.conflict-options-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
}

.conflict-option-card {
  padding: 14px 16px;
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
}

.conflict-option-card:hover {
  transform: translateY(-2px);
  border-color: var(--color-primary);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.conflict-option-card.highlight {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.06), rgba(168, 85, 247, 0.06));
  border: 2px solid var(--color-primary);
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.12);
}

.conflict-option-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.conflict-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--color-text-main);
}

.conflict-card-header h4 {
  font-size: 0.96rem;
  font-weight: 700;
  margin: 0;
  color: var(--color-text-main);
}

.conflict-option-subtitle {
  font-size: 0.78rem;
  color: var(--color-text-muted);
  display: block;
  margin-top: 2px;
}

.option-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.option-icon.merge-icon {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.18), rgba(168, 85, 247, 0.18));
  color: var(--color-primary);
}

.option-icon.download-icon {
  background-color: rgba(59, 130, 246, 0.14);
  color: #2563eb;
}

.option-icon.overwrite-icon {
  background-color: rgba(245, 158, 11, 0.14);
  color: var(--color-warning);
}

.conflict-badge-recommended {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(99, 102, 241, 0.35);
}

.conflict-option-card p {
  font-size: 0.83rem;
  color: var(--color-text-muted);
  line-height: 1.45;
  margin: 0;
  padding-left: 50px;
}

@media (max-width: 580px) {
  .conflict-option-card p {
    padding-left: 0;
  }
}

.conflict-modal-footer {
  display: flex;
  justify-content: flex-end;
  border-top: 1px solid var(--color-border);
  padding-top: 14px;
}

/* Banner de conflicto en el modal principal de Google Sync */
.google-sync-conflict-box {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.12), rgba(245, 158, 11, 0.05));
  border: 1px solid var(--color-warning);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.conflict-box-content {
  display: flex;
  align-items: center;
  gap: 10px;
}

.conflict-box-content svg {
  color: var(--color-warning);
  flex-shrink: 0;
}

.conflict-box-content h4 {
  font-size: 0.88rem;
  font-weight: 700;
  margin: 0 0 2px 0;
  color: var(--color-text-main);
}

.conflict-box-content p {
  font-size: 0.78rem;
  color: var(--color-text-muted);
  margin: 0;
}

/* ========================================================
   ESTILOS DE EXPORTACIÓN A EXCEL (.XLSX) Y REPORTES
   ======================================================== */
.btn-excel {
  background: linear-gradient(135deg, #107C41, #0b6a37);
  color: #ffffff !important;
  border: 1px solid #0b6a37;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-weight: 600;
  border-radius: var(--radius-md);
  box-shadow: 0 2px 6px rgba(16, 124, 65, 0.25);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  white-space: nowrap;
}

.btn-excel:hover {
  background: linear-gradient(135deg, #138a49, #0e7b40);
  box-shadow: 0 4px 14px rgba(16, 124, 65, 0.38);
  transform: translateY(-1px);
  color: #ffffff !important;
}

.btn-excel:active {
  transform: translateY(0);
  box-shadow: 0 1px 4px rgba(16, 124, 65, 0.25);
}

.btn-excel svg {
  flex-shrink: 0;
}

.attendance-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Botón Central de Exportación de Reportes en Header */
#btn-header-export-reports.btn-header-export {
  color: #107C41;
  background-color: rgba(16, 124, 65, 0.08);
  border: 1px solid rgba(16, 124, 65, 0.35);
  font-weight: 600;
  transition: all var(--transition-fast);
}

#btn-header-export-reports.btn-header-export:hover {
  background-color: #107C41;
  border-color: #0b6a37;
  color: #ffffff !important;
  box-shadow: 0 4px 12px rgba(16, 124, 65, 0.28);
  transform: translateY(-1px);
}

[data-theme="dark"] #btn-header-export-reports.btn-header-export {
  color: #34d399;
  background-color: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.3);
}

[data-theme="dark"] #btn-header-export-reports.btn-header-export:hover {
  background-color: #107C41;
  border-color: #107C41;
  color: #ffffff !important;
}

/* Botón de Exportación en Barra Lateral (Sidebar) */
#sidebar-btn-export-reports {
  color: #107C41;
  font-weight: 600;
}

#sidebar-btn-export-reports:hover {
  background-color: rgba(16, 124, 65, 0.1);
  color: #0b6a37;
}

[data-theme="dark"] #sidebar-btn-export-reports {
  color: #34d399;
}

[data-theme="dark"] #sidebar-btn-export-reports:hover {
  background-color: rgba(16, 185, 129, 0.15);
  color: #6ee7b7;
}

/* Modal de Exportación de Reportes */
.export-reports-modal-card {
  max-width: 580px;
  width: 92vw;
}

.export-modal-description {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  line-height: 1.45;
  margin-bottom: 6px;
}

.export-options-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 16px 0;
}

.export-option-card {
  padding: 14px 16px;
  background-color: var(--color-surface-hover);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  gap: 14px;
  align-items: flex-start;
  user-select: none;
}

.export-option-card:hover {
  border-color: #107C41;
  background-color: var(--color-surface);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.export-option-card.selected {
  border-color: #107C41;
  background-color: rgba(16, 124, 65, 0.06);
  box-shadow: 0 0 0 2px rgba(16, 124, 65, 0.2);
}

.export-option-card input[type="radio"] {
  width: 18px;
  height: 18px;
  accent-color: #107C41;
  margin-top: 3px;
  cursor: pointer;
  flex-shrink: 0;
}

.export-option-body {
  flex: 1;
}

.export-option-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}

.export-option-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--color-text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}

.export-option-badge {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background-color: rgba(16, 124, 65, 0.12);
  color: #107C41;
}

[data-theme="dark"] .export-option-badge {
  background-color: rgba(16, 185, 129, 0.2);
  color: #34d399;
}

.export-option-desc {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  line-height: 1.4;
  margin: 0;
}

/* Toast de Descarga Exitosa */
.export-excel-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1000;
  background-color: var(--color-surface);
  border: 1px solid #107C41;
  border-left: 5px solid #107C41;
  border-radius: var(--radius-md);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  max-width: 420px;
}

.export-excel-toast.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.export-toast-content {
  display: flex;
  align-items: center;
  gap: 12px;
}

.export-toast-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  background: rgba(16, 124, 65, 0.12);
  color: #107C41;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

[data-theme="dark"] .export-toast-icon {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
}

.export-toast-info h4 {
  font-size: 0.88rem;
  font-weight: 700;
  margin: 0 0 2px 0;
  color: var(--color-text-main);
}

.export-toast-info p {
  font-size: 0.78rem;
  color: var(--color-text-muted);
  margin: 0;
  line-height: 1.35;
}

@media (max-width: 768px) {
  .attendance-header-card {
    gap: 16px;
  }

  .attendance-actions {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  #form-export-report {
    padding: 14px 16px !important;
  }

  .export-option-card {
    padding: 10px 12px;
    gap: 10px;
  }

  .export-option-title {
    font-size: 0.88rem;
  }

  .export-option-desc {
    font-size: 0.76rem;
  }

  .export-excel-toast {
    left: 16px;
    right: 16px;
    bottom: 80px;
    max-width: none;
  }
}

/* ========================================================
   ESTILOS PWA, INSTALACIÓN Y SOPORTE OFFLINE TOTAL
   ======================================================== */

.pwa-install-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  color: var(--color-text-main);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.pwa-install-btn:hover {
  background-color: var(--color-primary-light);
  border-color: var(--color-primary);
  color: var(--color-primary);
  transform: translateY(-1px);
}

.pwa-install-btn.installed {
  display: none !important;
}

/* Modal y Banner de Instalación PWA */
.pwa-install-banner {
  position: fixed;
  bottom: 24px;
  right: 24px;
  max-width: 420px;
  width: calc(100% - 48px);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-lg), 0 20px 25px -5px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  gap: 14px;
  z-index: 99999;
  animation: pwaSlideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  backdrop-filter: blur(12px);
}

@keyframes pwaSlideUp {
  from {
    opacity: 0;
    transform: translateY(30px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.pwa-banner-header {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.pwa-banner-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #4f46e5 0%, #4338ca 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  flex-shrink: 0;
  box-shadow: 0 4px 10px rgba(79, 70, 229, 0.35);
}

.pwa-banner-info {
  flex: 1;
}

.pwa-banner-info h4 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--color-text-main);
  margin-bottom: 2px;
}

.pwa-banner-info p {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  line-height: 1.4;
  margin: 0;
}

.pwa-banner-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.pwa-banner-actions .btn {
  padding: 8px 14px;
  font-size: 0.82rem;
}

/* Indicador visual de modo offline permanente */
.offline-mode-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background-color: var(--color-warning-light);
  color: #b45309;
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: var(--radius-full);
  font-size: 0.76rem;
  font-weight: 600;
}

[data-theme="dark"] .offline-mode-badge {
  color: #fbbf24;
}

@media (max-width: 600px) {
  .pwa-install-banner {
    left: 14px;
    right: 14px;
    bottom: 20px;
    width: auto;
  }
  .pwa-install-btn-text {
    display: none;
  }
}

/* ==========================================================================
   OPERACIONES EN LOTE / BULK ACTIONS
   ========================================================================== */

/* Grupo de botones para marcar asistencia en lote en cabecera */
.bulk-attendance-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background-color: var(--color-surface);
  padding: 3px;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
}

.bulk-attendance-group .btn-secondary {
  border: none;
  background-color: transparent;
  padding: 6px 10px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-text-main);
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.bulk-attendance-group .btn-secondary:hover {
  background-color: var(--color-surface-hover);
  color: var(--color-primary);
}

#btn-bulk-attend-present:hover {
  background-color: rgba(16, 185, 129, 0.15);
  color: #059669;
}

#btn-bulk-attend-late:hover {
  background-color: rgba(245, 158, 11, 0.15);
  color: #d97706;
}

#btn-bulk-attend-absent:hover {
  background-color: rgba(239, 68, 68, 0.15);
  color: #dc2626;
}

/* Barra flotante de acciones masivas en directorio de estudiantes */
.bulk-actions-toolbar {
  position: sticky;
  top: 10px;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 18px;
  margin-bottom: 16px;
  background: linear-gradient(135deg, rgba(79, 70, 229, 0.95), rgba(67, 56, 202, 0.95));
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: #ffffff;
  border-radius: var(--radius-lg);
  box-shadow: 0 10px 25px -5px rgba(79, 70, 229, 0.4), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  animation: slideDownFade 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.bulk-bar-info {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 0.9rem;
}

.bulk-count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 24px;
  padding: 0 7px;
  border-radius: var(--radius-full);
  background-color: #ffffff;
  color: var(--color-primary);
  font-size: 0.85rem;
  font-weight: 800;
}

.bulk-bar-buttons {
  display: flex;
  align-items: center;
  gap: 8px;
}

.bulk-bar-buttons .btn {
  font-weight: 600;
  border-radius: var(--radius-md);
}

#btn-bulk-incident {
  background-color: #ffffff;
  color: var(--color-primary);
  border: none;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

#btn-bulk-incident:hover {
  background-color: #f8fafc;
  transform: translateY(-1px);
}

#btn-bulk-clear-selection {
  background-color: rgba(255, 255, 255, 0.15);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

#btn-bulk-clear-selection:hover {
  background-color: rgba(255, 255, 255, 0.25);
}

/* Checkbox estilizado para tablas */
.student-row-checkbox {
  width: 18px;
  height: 18px;
  accent-color: var(--color-primary);
  cursor: pointer;
  margin: 0;
  vertical-align: middle;
}

#students-select-all {
  width: 18px;
  height: 18px;
  accent-color: var(--color-primary);
  cursor: pointer;
  margin: 0;
  vertical-align: middle;
}

/* Fila seleccionada en tabla de estudiantes */
.students-table tr.row-selected {
  background-color: rgba(79, 70, 229, 0.08) !important;
}

[data-theme="dark"] .students-table tr.row-selected {
  background-color: rgba(99, 102, 241, 0.15) !important;
}

@media (max-width: 768px) {
  .bulk-actions-toolbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 14px;
  }
  .bulk-bar-buttons {
    width: 100%;
    justify-content: flex-end;
  }
  .bulk-attendance-group {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    display: flex;
    justify-content: space-between;
    gap: 4px;
    padding: 3px;
  }
  .bulk-attendance-group .btn-secondary {
    flex: 1;
    min-width: 0;
    text-align: center;
    padding: 8px 4px;
    font-size: 0.74rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
  }
  .bulk-attendance-group .btn-secondary svg {
    flex-shrink: 0;
  }
}

@media (max-width: 380px) {
  .bulk-attendance-group .btn-secondary {
    font-size: 0.68rem;
    padding: 6px 2px;
    gap: 2px;
  }
  .bulk-attendance-group .btn-secondary svg {
    width: 13px;
    height: 13px;
  }
}

/* ==========================================================================
   MODAL DE IMPORTACIÓN MASIVA DE ESTUDIANTES (.XLSX / .CSV / COPIAR-PEGAR)
   ========================================================================== */

/* Acceso rápido dentro del modal de estudiante individual */
.modal-import-shortcut {
  background: rgba(79, 70, 229, 0.08);
  border-left: 3px solid var(--color-primary);
  padding: 10px 14px;
  margin: 0 24px 16px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  gap: 12px;
}

[data-theme="dark"] .modal-import-shortcut {
  background: rgba(99, 102, 241, 0.12);
  border-left-color: #818cf8;
}

.modal-import-shortcut .shortcut-icon {
  color: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.modal-import-shortcut .shortcut-text {
  font-size: 0.82rem;
  color: var(--color-text);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  flex: 1;
}

.modal-import-shortcut .btn-text-link {
  background: none;
  border: none;
  color: var(--color-primary);
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  font-size: 0.82rem;
  padding: 0;
  transition: opacity var(--transition-fast);
}

.modal-import-shortcut .btn-text-link:hover {
  opacity: 0.8;
}

/* Modal de Importación */
.import-modal-card {
  max-width: 740px;
  width: 94vw;
  max-height: 90vh;
  max-height: 90dvh;
  display: flex;
  flex-direction: column;
  margin: auto;
  box-sizing: border-box;
}

.import-modal-body {
  overflow-y: auto;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.import-step-card {
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
  transition: border-color var(--transition-fast);
}

.import-step-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.import-step-title .step-number {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--color-primary), #6366f1);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.82rem;
  font-weight: 700;
  flex-shrink: 0;
}

.import-step-title h4 {
  margin: 0;
  font-size: 0.98rem;
  font-weight: 600;
  color: var(--color-text);
}

.import-step-desc {
  font-size: 0.84rem;
  color: var(--color-text-muted);
  margin: 0 0 12px 0;
  line-height: 1.45;
}

.import-template-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.btn-outline-success {
  border: 1.5px solid #10b981;
  color: #059669;
  background: rgba(16, 185, 129, 0.06);
  padding: 9px 15px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.85rem;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-outline-success:hover {
  background: #10b981;
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 3px 10px rgba(16, 185, 129, 0.25);
}

[data-theme="dark"] .btn-outline-success {
  color: #34d399;
  border-color: #059669;
  background: rgba(16, 185, 129, 0.12);
}

[data-theme="dark"] .btn-outline-success:hover {
  background: #059669;
  color: #ffffff;
}

.btn-outline-secondary {
  border: 1.5px solid var(--color-border);
  color: var(--color-text-muted);
  background: var(--color-surface);
  padding: 9px 15px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.85rem;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-outline-secondary:hover {
  border-color: var(--color-text-muted);
  color: var(--color-text);
  background: var(--color-surface-hover);
  transform: translateY(-1px);
}

.import-format-tips {
  background: var(--color-surface-hover);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 0.82rem;
}

.format-tip-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  line-height: 1.4;
  color: var(--color-text);
  min-width: 0;
}

.format-tip-item > span:not(.tip-badge) {
  flex: 1;
  min-width: 0;
  word-break: break-word;
}

.tip-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(79, 70, 229, 0.12);
  color: var(--color-primary);
  flex-shrink: 0;
}

.tip-badge-smart {
  background: rgba(139, 92, 246, 0.15);
  color: #8b5cf6;
}

[data-theme="dark"] .tip-badge-smart {
  color: #c4b5fd;
  background: rgba(139, 92, 246, 0.25);
}

/* Pestañas de Métodos de Importación */
.import-method-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--color-border);
  padding-bottom: 8px;
}

.import-tab-btn {
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  padding: 8px 14px;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--color-text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.import-tab-btn:hover {
  color: var(--color-text);
  background: var(--color-surface-hover);
}

.import-tab-btn.active {
  background: var(--color-surface-hover);
  color: var(--color-primary);
  border-color: var(--color-border);
}

/* Dropzone de archivo */
.file-dropzone {
  border: 2px dashed var(--color-border);
  border-radius: var(--radius-lg);
  padding: 28px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.25s ease;
  background-color: var(--color-surface-hover);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  outline: none;
}

.file-dropzone:hover,
.file-dropzone.drag-over,
.file-dropzone:focus-visible {
  border-color: var(--color-primary);
  background-color: rgba(79, 70, 229, 0.05);
  transform: translateY(-1px);
}

[data-theme="dark"] .file-dropzone:hover,
[data-theme="dark"] .file-dropzone.drag-over {
  background-color: rgba(99, 102, 241, 0.08);
}

.dropzone-icon {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: rgba(79, 70, 229, 0.1);
  color: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform var(--transition-fast);
}

.file-dropzone:hover .dropzone-icon {
  transform: scale(1.08);
}

.dropzone-main-text {
  margin: 0;
  font-size: 0.94rem;
  color: var(--color-text);
  font-weight: 500;
}

.dropzone-sub-text {
  margin: 4px 0 0 0;
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

.dropzone-badge {
  font-size: 0.74rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  padding: 4px 10px;
  border-radius: 999px;
  color: var(--color-text-muted);
  margin-top: 4px;
}

/* Archivo Cargado */
.loaded-file-badge {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: var(--radius-md);
  margin-top: 10px;
  animation: fadeIn 0.2s ease;
}

.loaded-file-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-icon-subtle {
  background: transparent;
  border: none;
  font-size: 1.3rem;
  line-height: 1;
  color: var(--color-text-muted);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

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

/* Textarea para Pegar */
.import-textarea {
  width: 100%;
  box-sizing: border-box;
  font-family: var(--font-mono, monospace);
  font-size: 0.82rem;
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text);
  resize: vertical;
  min-height: 100px;
}

/* Previsualización */
.import-preview-section {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-top: 4px;
  animation: fadeIn 0.25s ease;
}

.preview-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  flex-wrap: wrap;
  gap: 8px;
}

.preview-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.preview-count-chip {
  background: #10b981;
  color: #ffffff;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
}

.preview-target-badge {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--color-primary);
  background: rgba(79, 70, 229, 0.1);
  padding: 3px 10px;
  border-radius: var(--radius-md);
}

[data-theme="dark"] .preview-target-badge {
  background: rgba(99, 102, 241, 0.2);
  color: #a5b4fc;
}

.import-warnings-box {
  background: rgba(245, 158, 11, 0.1);
  border-left: 3px solid #f59e0b;
  padding: 8px 12px;
  font-size: 0.8rem;
  color: #b45309;
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
}

[data-theme="dark"] .import-warnings-box {
  color: #fbbf24;
}

.import-preview-table-container {
  max-height: 240px;
  overflow-y: auto;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  width: 100%;
  box-sizing: border-box;
}

.import-preview-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  text-align: left;
}

.import-preview-table th {
  background: var(--color-surface-hover);
  padding: 8px 10px;
  border-bottom: 1px solid var(--color-border);
  font-weight: 600;
  color: var(--color-text);
  position: sticky;
  top: 0;
  z-index: 1;
}

.import-preview-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text);
  vertical-align: middle;
}

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

.badge-valid-student {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  font-weight: 600;
  color: #059669;
  background: rgba(16, 185, 129, 0.12);
  padding: 2px 8px;
  border-radius: 999px;
}

[data-theme="dark"] .badge-valid-student {
  color: #34d399;
  background: rgba(16, 185, 129, 0.2);
}

@media (max-width: 640px) {
  .import-modal-card {
    width: 96vw;
    margin: auto;
  }

  .import-modal-body {
    padding: 14px 12px;
    gap: 12px;
  }

  .import-step-card {
    padding: 12px 12px;
  }

  .import-template-actions button {
    width: 100%;
    justify-content: center;
  }

  /* Formato y tips de columnas en móvil: apilado vertical para evitar desbordes */
  .import-format-tips {
    padding: 10px 12px;
    gap: 12px;
  }

  .format-tip-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 5px;
    width: 100%;
    box-sizing: border-box;
  }

  .format-tip-item > span:not(.tip-badge) {
    width: 100%;
    min-width: 0;
    word-break: break-word;
    font-size: 0.8rem;
    line-height: 1.45;
  }

  .tip-badge {
    margin-bottom: 2px;
  }

  /* Selector de orden de nombres en móvil: ancho completo tipo lista táctil */
  .import-order-options {
    flex-direction: column;
    gap: 6px;
    width: 100%;
  }

  .import-order-chip {
    width: 100%;
    box-sizing: border-box;
    padding: 8px 12px;
    font-size: 0.78rem;
    justify-content: flex-start;
  }

  /* Pestañas de método de importación en móvil */
  .import-method-tabs {
    flex-direction: column;
    gap: 6px;
  }

  .import-tab-btn {
    width: 100%;
    justify-content: center;
    padding: 8px 10px;
    font-size: 0.8rem;
  }

  .file-dropzone {
    padding: 18px 12px;
    gap: 8px;
  }

  .dropzone-main-text {
    font-size: 0.85rem;
  }

  .dropzone-badge {
    font-size: 0.7rem;
    padding: 3px 8px;
  }

  /* Barra de previsualización */
  .preview-header-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .preview-actions-group {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
  }

  .btn-swap-names {
    flex: 1;
    justify-content: center;
    padding: 6px 10px;
    font-size: 0.75rem;
  }

  .import-preview-table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
    box-sizing: border-box;
    max-height: 240px;
  }

  .import-preview-table {
    min-width: 480px;
  }
}

/* Selector de Orden de Nombres y Apellidos en Importación */
.import-name-order-card {
  background: var(--color-surface-hover);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin-bottom: 12px;
}

.import-order-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  color: var(--color-text);
}

.import-order-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: var(--radius-sm);
  background: rgba(79, 70, 229, 0.12);
  color: var(--color-primary);
}

[data-theme="dark"] .import-order-icon {
  background: rgba(99, 102, 241, 0.2);
  color: #a5b4fc;
}

.import-order-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.import-order-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1.5px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text-muted);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.import-order-chip input[type="radio"] {
  display: none;
}

.import-order-chip:hover {
  border-color: var(--color-primary);
  color: var(--color-text);
  background: var(--color-surface-hover);
}

.import-order-chip.active {
  background: rgba(79, 70, 229, 0.12);
  border-color: var(--color-primary);
  color: var(--color-primary);
}

[data-theme="dark"] .import-order-chip.active {
  background: rgba(99, 102, 241, 0.2);
  border-color: #818cf8;
  color: #c7d2fe;
}

/* Grupo de Acciones en Previsualización */
.preview-actions-group {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.btn-swap-names {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--color-surface-hover);
  border: 1px solid var(--color-border);
  color: var(--color-text);
  font-weight: 600;
  font-size: 0.8rem;
  padding: 5px 12px;
  border-radius: var(--radius-md);
  transition: all 0.2s ease;
  cursor: pointer;
}

.btn-swap-names:hover {
  background: rgba(79, 70, 229, 0.12);
  border-color: var(--color-primary);
  color: var(--color-primary);
  transform: translateY(-1px);
}

[data-theme="dark"] .btn-swap-names {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.16);
  color: #e2e8f0;
}

[data-theme="dark"] .btn-swap-names:hover {
  background: rgba(99, 102, 241, 0.2);
  border-color: #818cf8;
  color: #c7d2fe;
}

/* Encabezados con botón swap inline */
.th-swap-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.btn-th-swap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 4px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text-muted);
  font-size: 0.85rem;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.15s ease;
  padding: 0;
  line-height: 1;
}

.btn-th-swap:hover {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #ffffff;
}

/* Botón swap en cada fila */
.btn-swap-row-inline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 4px;
  border: 1px solid var(--color-border);
  background: transparent;
  color: var(--color-text-muted);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
  padding: 0;
}

.btn-swap-row-inline:hover {
  background: rgba(79, 70, 229, 0.12);
  border-color: var(--color-primary);
  color: var(--color-primary);
}

[data-theme="dark"] .btn-swap-row-inline:hover {
  background: rgba(99, 102, 241, 0.2);
  border-color: #818cf8;
  color: #c7d2fe;
}

.btn-import-students {
  cursor: pointer;
  user-select: none;
}

.btn-import-students * {
  pointer-events: none;
}

#modal-import-students {
  z-index: 1050;
}

/* Botón de alternar formato de nombre en encabezado de tablas */
.th-student-col {
  min-width: 220px;
}

.th-student-header-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.btn-toggle-name-order {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  color: var(--color-text-muted);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
  white-space: nowrap;
  text-transform: none;
  letter-spacing: normal;
}

.btn-toggle-name-order:hover {
  background: rgba(79, 70, 229, 0.12);
  border-color: var(--color-primary);
  color: var(--color-primary);
  transform: translateY(-1px);
}

[data-theme="dark"] .btn-toggle-name-order {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.15);
  color: #cbd5e1;
}

[data-theme="dark"] .btn-toggle-name-order:hover {
  background: rgba(99, 102, 241, 0.2);
  border-color: #818cf8;
  color: #c7d2fe;
}

.lbl-name-order-badge {
  font-size: 0.7rem;
  font-weight: 600;
}

/* ========================================================
   SOPORTE OFFLINE ROBUSTO & EXPERIENCIA UX DE ASISTENCIA (v1.0.8)
   Distingue con total claridad los cambios guardados localmente
   en el dispositivo vs los sincronizados con Google Drive.
   ======================================================== */

/* BADGE FLOTANTE DE CAMBIOS PENDIENTES EN EL BOTÓN GOOGLE DRIVE */
.google-pending-count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 800;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: var(--radius-full);
  background-color: var(--color-warning);
  color: #1e1b4b;
  position: absolute;
  top: -5px;
  right: -5px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.28);
  border: 1.5px solid var(--color-surface);
  z-index: 5;
  line-height: 1;
}

.google-pending-count-badge.active {
  animation: pulse-pending-badge 2s infinite ease-in-out;
}

@keyframes pulse-pending-badge {
  0% { transform: scale(1); }
  50% { transform: scale(1.12); box-shadow: 0 2px 8px rgba(245, 158, 11, 0.6); }
  100% { transform: scale(1); }
}

/* BARRA DE ESTADO DE ASISTENCIA (SINCRONIZACIÓN Y REASEGURO OFFLINE) */
.attendance-sync-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 16px;
  border-radius: var(--radius-lg);
  margin-bottom: 16px;
  border: 1px solid var(--color-border);
  background-color: var(--color-surface);
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-fast);
}

.attendance-sync-banner.sync-state-synced {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.08), rgba(16, 185, 129, 0.02));
  border-color: rgba(16, 185, 129, 0.35);
}

.attendance-sync-banner.sync-state-offline {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.12), rgba(245, 158, 11, 0.04));
  border-color: rgba(245, 158, 11, 0.45);
}

.attendance-sync-banner.sync-state-syncing {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(99, 102, 241, 0.03));
  border-color: rgba(99, 102, 241, 0.35);
}

.attendance-sync-banner.sync-state-conflict {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.1), rgba(245, 158, 11, 0.1));
  border-color: var(--color-warning);
}

.attendance-sync-banner.sync-state-local {
  background: linear-gradient(135deg, rgba(100, 116, 139, 0.08), rgba(100, 116, 139, 0.02));
  border-color: var(--color-border);
}

.sync-banner-icon-col {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.sync-banner-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sync-state-synced .sync-banner-icon {
  background-color: rgba(16, 185, 129, 0.15);
  color: #059669;
}

.sync-state-offline .sync-banner-icon {
  background-color: rgba(245, 158, 11, 0.2);
  color: #d97706;
}

.sync-state-syncing .sync-banner-icon {
  background-color: rgba(99, 102, 241, 0.18);
  color: #4f46e5;
}

.sync-state-conflict .sync-banner-icon {
  background-color: rgba(239, 68, 68, 0.18);
  color: #dc2626;
}

.sync-state-local .sync-banner-icon {
  background-color: rgba(100, 116, 139, 0.15);
  color: #475569;
}

.sync-banner-info {
  flex: 1;
  min-width: 0;
}

.sync-banner-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 3px;
}

.sync-banner-title-row h4 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--color-text-main);
}

.sync-banner-info p {
  margin: 0;
  font-size: 0.8rem;
  color: var(--color-text-muted);
  line-height: 1.4;
}

.sync-status-pill {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  letter-spacing: 0.02em;
}

.sync-status-pill.pill-synced {
  background-color: rgba(16, 185, 129, 0.15);
  color: #059669;
}

.sync-status-pill.pill-warning {
  background-color: rgba(245, 158, 11, 0.2);
  color: #b45309;
}

.sync-status-pill.pill-syncing {
  background-color: rgba(99, 102, 241, 0.15);
  color: #4338ca;
}

.sync-status-pill.pill-neutral {
  background-color: rgba(100, 116, 139, 0.15);
  color: #475569;
}

.sync-banner-actions {
  flex-shrink: 0;
}

.sync-banner-actions .btn-xs {
  padding: 5px 12px;
  font-size: 0.78rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  background-color: var(--color-surface);
  color: var(--color-text-main);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.sync-banner-actions .btn-xs:hover {
  background-color: var(--color-surface-hover);
  border-color: var(--color-primary);
  color: var(--color-primary);
}

@media (max-width: 680px) {
  .attendance-sync-banner {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 14px;
  }
  .sync-banner-actions {
    width: 100%;
    display: flex;
    justify-content: flex-end;
  }
}

/* INDICADOR LOCAL EN CADA TARJETA DE ALUMNO EN ASISTENCIA */
.student-name-group {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.roster-local-indicator {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.68rem;
  font-weight: 600;
  color: #059669;
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.22);
  padding: 2px 7px;
  border-radius: var(--radius-full);
  width: fit-content;
  letter-spacing: 0.02em;
}

[data-theme="dark"] .roster-local-indicator {
  background: rgba(16, 185, 129, 0.15);
  border-color: rgba(16, 185, 129, 0.35);
  color: #34d399;
}

/* MICRO-TOAST DE CONFIRMACIÓN INMEDIATA DE GUARDADO */
.educap-save-microtoast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10003;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-full);
  font-size: 0.84rem;
  font-weight: 600;
  color: #ffffff;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.28);
  pointer-events: none;
  animation: saveToastSlideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  max-width: 90vw;
  text-align: center;
}

.educap-save-microtoast.cloud {
  background-color: #065f46;
  border: 1px solid #10b981;
}

.educap-save-microtoast.local {
  background-color: #1e293b;
  border: 1px solid #334155;
}

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

/* TARJETA DE REASEGURO DE ALMACENAMIENTO EN MODAL GOOGLE SYNC */
.device-storage-reassurance-card {
  background-color: var(--color-surface-hover);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.storage-reassurance-header {
  display: flex;
  align-items: center;
  gap: 12px;
}

.storage-icon-wrap {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: rgba(79, 70, 229, 0.12);
  color: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.device-safe-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 4px 10px;
  background-color: rgba(16, 185, 129, 0.15);
  color: #059669;
  border-radius: var(--radius-full);
  border: 1px solid rgba(16, 185, 129, 0.3);
  white-space: nowrap;
}

.device-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

@media (max-width: 480px) {
  .device-stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.device-stat-chip {
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 8px 10px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.device-stat-chip .stat-number {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--color-text-main);
  line-height: 1.1;
}

.device-stat-chip .stat-label {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--color-text-muted);
  letter-spacing: 0.03em;
}

.device-pending-sync-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--color-text-main);
  background-color: var(--color-surface);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
}

.pending-status-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  background-color: #10b981;
  flex-shrink: 0;
}

.google-pending-count-badge.active ~ * .pending-status-dot,
.attendance-sync-banner.sync-state-offline .pending-status-dot {
  background-color: var(--color-warning);
}

.storage-reassurance-note {
  margin: 0;
  font-size: 0.78rem;
  color: var(--color-text-muted);
  line-height: 1.45;
}

/* ENLACES Y MEJORAS DE ACCESIBILIDAD */
[data-theme="dark"] .sync-status-pill.pill-synced {
  background-color: rgba(16, 185, 129, 0.2);
  color: #34d399;
}

[data-theme="dark"] .sync-status-pill.pill-warning {
  background-color: rgba(245, 158, 11, 0.25);
  color: #fbbf24;
}

[data-theme="dark"] .device-safe-badge {
  background-color: rgba(16, 185, 129, 0.2);
  color: #34d399;
}




