/**
 * COBAES Plantel 27 "Lic. Rodolfo Monjaraz Buelna" — SICEE
 * Hoja de Estilos Oficial — Clean Architecture & Academic Design System
 * Inspirado en la identidad oficial de COBAES (cobaes.edu.mx)
 * Sistema Dual: Tema Claro Oficial (Blanco + Verde Institucional) y Tema Oscuro de Alto Contraste
 */

:root {
  /* ==========================================================================
     TEMA CLARO INSTITUCIONAL COBAES (POR DEFECTO)
     Pantone 327 C (Verde Institucional) + Pantone 1245 C (Dorado Institucional)
     ========================================================================== */
  --brand-primary: #007352;
  --brand-primary-hover: #008861;
  --brand-primary-dark: #00593f;
  --brand-primary-light: rgba(0, 115, 82, 0.09);
  
  --brand-secondary: #c59b27;
  --brand-secondary-hover: #b0881d;
  --brand-secondary-light: rgba(197, 155, 39, 0.12);
  --brand-gradient: linear-gradient(135deg, #007352 0%, #00593f 100%);
  --brand-gradient-hover: linear-gradient(135deg, #008861 0%, #006648 100%);

  /* Institutional Aliases */
  --cobaes-verde: var(--brand-primary);
  --cobaes-verde-hover: var(--brand-primary-hover);
  --cobaes-verde-dark: var(--brand-primary-dark);
  --cobaes-verde-light: var(--brand-primary-light);
  --cobaes-dorado: var(--brand-secondary);
  --cobaes-dorado-hover: var(--brand-secondary-hover);
  --cobaes-dorado-light: var(--brand-secondary-light);

  /* Colores Semánticos Normativos (Alta Accesibilidad y Contraste WCAG AAA) */
  --status-approved: #007352;
  --status-approved-bg: rgba(0, 115, 82, 0.1);
  --status-approved-border: rgba(0, 115, 82, 0.3);
  
  --status-warning: #b45309;
  --status-warning-bg: rgba(217, 119, 6, 0.1);
  --status-warning-border: rgba(217, 119, 6, 0.3);

  --status-danger: #dc2626;
  --status-danger-bg: rgba(220, 38, 38, 0.1);
  --status-danger-border: rgba(220, 38, 38, 0.3);

  --status-info: #0284c7;
  --status-info-bg: rgba(2, 132, 199, 0.1);
  --status-info-border: rgba(2, 132, 199, 0.3);

  /* Superficies Tema Claro Oficial */
  --bg-app: #f4f6f8;
  --bg-surface: #ffffff;
  --bg-surface-elevated: #ffffff;
  --bg-surface-glass: rgba(255, 255, 255, 0.95);
  --bg-subtle: #f8fafc;
  --bg-subtle-alt: #f1f5f9;
  --border-subtle: #e2e8f0;
  --border-strong: #cbd5e1;

  --text-primary: #0f172a;
  --text-secondary: #334155;
  --text-muted: #64748b;
  --text-inverted: #ffffff;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 10px 24px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 35px rgba(0, 0, 0, 0.14);
  --shadow-glow: 0 0 20px rgba(0, 115, 82, 0.18);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  --font-main: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ==========================================================================
   TEMA OSCURO ACADÉMICO (ALTO CONTRASTE & OBSIDIANA)
   ========================================================================== */
[data-theme="dark"] {
  --brand-primary: #10b981;
  --brand-primary-hover: #34d399;
  --brand-primary-dark: #059669;
  --brand-primary-light: rgba(16, 185, 129, 0.16);

  --brand-secondary: #fbbf24;
  --brand-secondary-hover: #f59e0b;
  --brand-secondary-light: rgba(251, 191, 36, 0.16);
  --brand-gradient: linear-gradient(135deg, #059669 0%, #007352 100%);
  --brand-gradient-hover: linear-gradient(135deg, #10b981 0%, #059669 100%);

  /* Institutional Aliases */
  --cobaes-verde: var(--brand-primary);
  --cobaes-verde-hover: var(--brand-primary-hover);
  --cobaes-verde-dark: var(--brand-primary-dark);
  --cobaes-verde-light: var(--brand-primary-light);
  --cobaes-dorado: var(--brand-secondary);
  --cobaes-dorado-hover: var(--brand-secondary-hover);
  --cobaes-dorado-light: var(--brand-secondary-light);

  --status-approved: #34d399;
  --status-approved-bg: rgba(16, 185, 129, 0.16);
  --status-approved-border: rgba(16, 185, 129, 0.35);

  --status-warning: #fbbf24;
  --status-warning-bg: rgba(251, 191, 36, 0.16);
  --status-warning-border: rgba(251, 191, 36, 0.35);

  --status-danger: #f87171;
  --status-danger-bg: rgba(248, 113, 113, 0.16);
  --status-danger-border: rgba(248, 113, 113, 0.35);

  --status-info: #38bdf8;
  --status-info-bg: rgba(56, 189, 248, 0.16);
  --status-info-border: rgba(56, 189, 248, 0.35);

  /* Superficies Tema Oscuro */
  --bg-app: #0f141c;
  --bg-surface: #17202e;
  --bg-surface-elevated: #1e2a3c;
  --bg-surface-glass: rgba(23, 32, 46, 0.92);
  --bg-subtle: #131b26;
  --bg-subtle-alt: #1a2433;
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-inverted: #0f172a;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.55);
  --shadow-lg: 0 12px 28px rgba(0, 0, 0, 0.7);
  --shadow-xl: 0 20px 45px rgba(0, 0, 0, 0.85);
  --shadow-glow: 0 0 25px rgba(16, 185, 129, 0.25);
}

/* ==========================================================================
   RESET & TIPOGRAFÍA GENERAL
   ========================================================================== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-main);
  background-color: var(--bg-app);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 0.25s ease, color 0.25s ease;
}

/* Scrollbar estilizado */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-app);
}
::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--brand-primary);
}

/* ==========================================================================
   FRANJA SUPERIOR GUBERNAMENTAL (GOBIERNO DE SINALOA / SEPyC)
   ========================================================================== */
.gov-top-banner {
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: 0.74rem;
  padding: 8px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid var(--border-subtle);
  letter-spacing: 0.03em;
  font-weight: 600;
  flex-wrap: wrap;
  gap: 8px;
  z-index: 100;
}

.gov-branding-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.gov-badge-text {
  color: var(--brand-primary);
  font-weight: 800;
  letter-spacing: 0.04em;
}

.gov-meta-right {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 0.72rem;
  flex-wrap: wrap;
}

/* ==========================================================================
   BARRA INSTITUCIONAL PRINCIPAL (APP HEADER)
   ========================================================================== */
.app-header {
  background: var(--bg-surface-glass);
  border-bottom: 1px solid var(--border-subtle);
  padding: 10px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 90;
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  transition: background-color 0.25s ease, border-color 0.25s ease;
}

.header-brand-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.cobaes-logo-svg {
  filter: drop-shadow(0 2px 6px rgba(0, 115, 82, 0.25));
  flex-shrink: 0;
}

.header-titles {
  display: flex;
  flex-direction: column;
}

.header-title-main {
  font-size: 1.05rem;
  font-weight: 900;
  color: var(--brand-primary);
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.header-subtitle {
  font-size: 0.73rem;
  font-weight: 700;
  color: var(--text-secondary);
}

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

/* Indicador de Red LAN Activa */
.network-sync-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-strong);
  padding: 7px 12px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-primary);
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.network-sync-pill:hover {
  border-color: var(--brand-primary);
  background: var(--brand-primary-light);
  color: var(--brand-primary);
}

.network-pulse-dot {
  width: 8px;
  height: 8px;
  background-color: var(--status-approved);
  border-radius: 50%;
  box-shadow: 0 0 0 rgba(0, 115, 82, 0.4);
  animation: pulseGreen 2s infinite;
}

@keyframes pulseGreen {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(0, 115, 82, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(0, 115, 82, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(0, 115, 82, 0); }
}

/* Selector de Tema */
#themeToggleBtn {
  background: var(--bg-subtle);
  border: 1px solid var(--border-strong);
  color: var(--text-primary);
  padding: 7px 11px;
  border-radius: var(--radius-full);
  font-size: 1rem;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

#themeToggleBtn:hover {
  border-color: var(--brand-primary);
  background: var(--brand-primary-light);
  transform: rotate(15deg);
}

/* Badge de Usuario Activo */
.user-profile-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
}

.user-avatar-circle {
  width: 32px;
  height: 32px;
  background: var(--brand-gradient);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.85rem;
  box-shadow: var(--shadow-sm);
}

.user-meta-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.user-meta-name {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-primary);
}

.user-meta-role {
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--brand-primary);
}

/* ==========================================================================
   PANTALLA DE ACCESO INSTITUCIONAL (LOGIN)
   ========================================================================== */
.login-screen-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 110px);
  padding: 24px 16px;
  background: radial-gradient(circle at 50% 15%, var(--brand-primary-light) 0%, transparent 65%);
}

.login-formal-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-top: 4px solid var(--brand-primary);
  border-radius: var(--radius-lg);
  padding: 32px 28px;
  width: 100%;
  max-width: 490px;
  box-shadow: var(--shadow-xl);
  text-align: center;
  position: relative;
  overflow: hidden;
}

.login-formal-header h2 {
  font-size: 1.25rem;
  font-weight: 900;
  color: var(--brand-primary);
  letter-spacing: -0.01em;
}

.quick-demo-roles {
  margin: 18px 0;
  text-align: left;
  background: var(--bg-subtle);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-md);
  padding: 12px;
}

.quick-demo-title {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--brand-primary);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.demo-pills-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.demo-pill-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 0.74rem;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
  color: var(--text-primary);
  transition: var(--transition);
  display: flex;
  flex-direction: column;
}

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

.demo-pill-btn small {
  font-size: 0.65rem;
  color: var(--text-muted);
  font-weight: 600;
}

.login-form-group {
  margin-bottom: 14px;
  text-align: left;
}

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

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

.input-icon-wrapper span.icon {
  position: absolute;
  left: 12px;
  color: var(--text-muted);
  font-size: 1rem;
}

.login-input {
  width: 100%;
  padding: 11px 12px 11px 38px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  font-family: var(--font-main);
  font-size: 0.92rem;
  color: var(--text-primary);
  transition: var(--transition);
}

.login-input:focus {
  outline: none;
  border-color: var(--brand-primary);
  background: var(--bg-surface);
  box-shadow: 0 0 0 3px var(--brand-primary-light);
}

.btn-primary-institutional {
  width: 100%;
  background: var(--brand-gradient);
  color: #fff;
  border: none;
  padding: 12px;
  border-radius: var(--radius-md);
  font-family: var(--font-main);
  font-size: 0.95rem;
  font-weight: 800;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 14px rgba(0, 115, 82, 0.35);
}

.btn-primary-institutional:hover {
  background: var(--brand-gradient-hover);
  box-shadow: 0 6px 18px rgba(0, 115, 82, 0.45);
  transform: translateY(-1px);
}

/* ==========================================================================
   LAYOUT PRINCIPAL DE APLICACIÓN
   ========================================================================== */
.main-app-container {
  flex: 1;
  max-width: 1560px;
  margin: 0 auto;
  padding: 16px 20px;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Barra de Estado del Acta y Cierre */
.acta-lock-banner {
  border-radius: var(--radius-md);
  padding: 12px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  transition: var(--transition);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-sm);
}

.acta-lock-banner.open {
  background: var(--status-approved-bg);
  border: 1px solid var(--status-approved-border);
  color: var(--status-approved);
}

.acta-lock-banner.closed {
  background: var(--status-danger-bg);
  border: 1px solid var(--status-danger-border);
  color: var(--status-danger);
}

.acta-lock-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.acta-lock-title {
  font-weight: 800;
  font-size: 0.88rem;
}

.acta-lock-desc {
  font-size: 0.76rem;
  opacity: 0.9;
}

/* Selector de Salones y Grupos (Chips Rápidos) */
.group-chips-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 6px;
  -webkit-overflow-scrolling: touch;
}

.group-chip-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  padding: 7px 15px;
  border-radius: var(--radius-full);
  font-family: var(--font-main);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}

.group-chip-btn:hover {
  border-color: var(--brand-primary);
  color: var(--brand-primary);
  background: var(--brand-primary-light);
}

.group-chip-btn.active {
  background: var(--brand-primary);
  color: #fff;
  border-color: var(--brand-primary);
  box-shadow: 0 2px 8px rgba(0, 115, 82, 0.4);
}

.matrix-open-btn {
  background: var(--brand-secondary-light);
  color: var(--brand-secondary);
  border: 1px solid var(--brand-secondary);
  padding: 7px 15px;
  border-radius: var(--radius-full);
  font-family: var(--font-main);
  font-size: 0.82rem;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: var(--transition);
}

.matrix-open-btn:hover {
  background: var(--brand-secondary);
  color: #fff;
  box-shadow: 0 2px 8px rgba(197, 155, 39, 0.4);
}

/* ==========================================================================
   TABLERO DEL GRUPO ACTIVO & HERRAMIENTAS (HERO CARD)
   ========================================================================== */
.group-hero-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-left: 5px solid var(--brand-primary);
  border-radius: var(--radius-lg);
  padding: 18px 22px;
  box-shadow: var(--shadow-sm);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.group-hero-info {
  display: flex;
  flex-direction: column;
}

.group-tag-badge {
  font-size: 0.72rem;
  font-weight: 800;
  background: var(--brand-primary-light);
  color: var(--brand-primary);
  border: 1px solid var(--status-approved-border);
  padding: 3px 10px;
  border-radius: var(--radius-full);
  width: fit-content;
  margin-bottom: 6px;
  letter-spacing: 0.02em;
}

.group-subject-title {
  font-size: 1.35rem;
  font-weight: 900;
  color: var(--text-primary);
  line-height: 1.25;
}

.group-meta-sub {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

.group-kpis-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
}

.kpi-stat-box {
  text-align: center;
  padding: 8px 16px;
  background: var(--bg-subtle);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  min-width: 85px;
}

.kpi-stat-number {
  font-size: 1.3rem;
  font-weight: 900;
  color: var(--brand-primary);
}

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

/* ==========================================================================
   BARRA DE ACCIONES Y PESTAÑAS (TOOLBAR)
   ========================================================================== */
.table-toolbar-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

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

.segmented-control {
  display: inline-flex;
  background: var(--bg-subtle);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-full);
  padding: 3px;
  gap: 2px;
}

.segmented-btn {
  background: transparent;
  border: none;
  padding: 7px 16px;
  border-radius: var(--radius-full);
  font-family: var(--font-main);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: var(--transition);
  white-space: nowrap;
}

.segmented-btn.active {
  background: var(--bg-surface);
  color: var(--brand-primary);
  box-shadow: var(--shadow-sm);
  font-weight: 800;
}

.search-input-field {
  padding: 8px 12px 8px 34px;
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  font-family: var(--font-main);
  font-size: 0.85rem;
  color: var(--text-primary);
  width: 240px;
  transition: var(--transition);
}

.search-input-field:focus {
  outline: none;
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px var(--brand-primary-light);
}

.toolbar-right-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.action-btn-secondary {
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  color: var(--text-primary);
  padding: 8px 14px;
  border-radius: var(--radius-md);
  font-family: var(--font-main);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
  white-space: nowrap;
}

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

.action-btn-cobaes {
  background: var(--brand-gradient);
  color: #fff;
  border: none;
  padding: 8px 15px;
  border-radius: var(--radius-md);
  font-family: var(--font-main);
  font-size: 0.78rem;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 2px 8px rgba(0, 115, 82, 0.35);
  transition: var(--transition);
  white-space: nowrap;
}

.action-btn-cobaes:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 115, 82, 0.45);
}

/* ==========================================================================
   TABLA DE CALIFICACIONES INSTITUCIONAL (ACTA ORDINARIA)
   ========================================================================== */
.table-responsive-container {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow-x: auto;
  box-shadow: var(--shadow-sm);
  -webkit-overflow-scrolling: touch;
}

.cobaes-official-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
  text-align: left;
}

.cobaes-official-table thead th {
  background: var(--bg-subtle);
  color: var(--text-secondary);
  font-weight: 800;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 12px 14px;
  border-bottom: 2px solid var(--border-subtle);
  white-space: nowrap;
}

.cobaes-official-table tbody td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-primary);
  vertical-align: middle;
}

.cobaes-official-table tbody tr:hover {
  background: var(--brand-primary-light);
}

/* Celdas Interactivas */
.student-name-cell {
  display: flex;
  flex-direction: column;
}

.student-name-bold {
  font-weight: 700;
  color: var(--text-primary);
  font-size: 0.86rem;
}

.student-sub-info {
  font-size: 0.71rem;
  color: var(--text-muted);
}

/* Control de Participación */
.participation-control-box {
  display: inline-flex;
  align-items: center;
  background: var(--bg-subtle);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.part-btn {
  background: transparent;
  border: none;
  width: 28px;
  height: 28px;
  font-weight: 900;
  font-size: 0.9rem;
  color: var(--brand-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.part-btn:hover:not(:disabled) {
  background: var(--brand-primary);
  color: #fff;
}

.part-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.part-val {
  min-width: 26px;
  text-align: center;
  font-weight: 800;
  font-size: 0.82rem;
  color: var(--text-primary);
}

/* Input Numérico de Calificación */
.grade-num-input {
  width: 54px;
  height: 34px;
  padding: 4px 6px;
  text-align: center;
  font-family: var(--font-main);
  font-size: 0.92rem;
  font-weight: 800;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg-subtle);
  color: var(--text-primary);
  transition: var(--transition);
}

.grade-num-input:focus {
  outline: none;
  border-color: var(--brand-primary);
  background: var(--bg-surface);
  box-shadow: 0 0 0 2px var(--brand-primary-light);
}

.grade-num-input:disabled {
  background: transparent;
  border-color: transparent;
  cursor: default;
}

/* Insignias de Estatus Normativo COBAES */
.normative-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 800;
  white-space: nowrap;
}

.normative-badge.approved {
  background: var(--status-approved-bg);
  color: var(--status-approved);
  border: 1px solid var(--status-approved-border);
}

.normative-badge.warning {
  background: var(--status-warning-bg);
  color: var(--status-warning);
  border: 1px solid var(--status-warning-border);
}

.normative-badge.danger {
  background: var(--status-danger-bg);
  color: var(--status-danger);
  border: 1px solid var(--status-danger-border);
}

/* Botón de Bitácora / Notas */
.notes-trigger-btn {
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  padding: 4px 12px;
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--text-secondary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: var(--transition);
}

.notes-trigger-btn:hover {
  border-color: var(--brand-primary);
  color: var(--brand-primary);
  background: var(--brand-primary-light);
}

.notes-trigger-btn.has-notes {
  background: var(--brand-primary-light);
  border-color: var(--brand-primary);
  color: var(--brand-primary);
}

/* ==========================================================================
   MÓDULO INTERACTIVO DE ASISTENCIAS
   ========================================================================== */
.attendance-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border-subtle);
}

.attendance-date-selector {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-primary);
}

.attendance-date-input {
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg-surface);
  font-family: var(--font-main);
  font-size: 0.84rem;
  color: var(--text-primary);
}

.attendance-date-input:focus {
  outline: none;
  border-color: var(--brand-primary);
}

/* Botonera de Estado de Asistencia */
.att-buttons-group {
  display: inline-flex;
  gap: 5px;
}

.att-status-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg-surface);
  font-weight: 800;
  font-size: 0.8rem;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
}

.att-status-btn:hover:not(:disabled) {
  border-color: var(--brand-primary);
  transform: scale(1.05);
}

.att-status-btn[data-type="PRESENTE"].selected {
  background: var(--status-approved);
  color: #fff;
  border-color: var(--status-approved);
}

.att-status-btn[data-type="FALTA"].selected {
  background: var(--status-danger);
  color: #fff;
  border-color: var(--status-danger);
}

.att-status-btn[data-type="RETARDO"].selected {
  background: var(--status-warning);
  color: #fff;
  border-color: var(--status-warning);
}

.att-status-btn[data-type="JUSTIFICADO"].selected {
  background: var(--status-info);
  color: #fff;
  border-color: var(--status-info);
}

/* ==========================================================================
   PORTAL DEL ALUMNO Y TUTORES (ZERO-TRUST ISOLATED BOLETA)
   ========================================================================== */
.boleta-container-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 32px 28px;
  box-shadow: var(--shadow-md);
  max-width: 960px;
  margin: 0 auto;
  position: relative;
}

.boleta-seal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 2px solid var(--brand-primary);
  padding-bottom: 16px;
  margin-bottom: 20px;
  gap: 16px;
  flex-wrap: wrap;
}

.boleta-student-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  background: var(--bg-subtle);
  padding: 16px;
  border-radius: var(--radius-md);
  margin-bottom: 20px;
  border: 1px solid var(--border-subtle);
}

.summary-item-label {
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.03em;
}

.summary-item-val {
  font-size: 0.94rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-top: 2px;
}

.boleta-final-kpi-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--brand-primary-light);
  border: 1px solid var(--status-approved-border);
  box-shadow: var(--shadow-sm);
  border-radius: var(--radius-md);
  padding: 18px 24px;
  margin-bottom: 24px;
}

.boleta-notes-timeline {
  margin-top: 24px;
}

.tutor-note-card {
  background: var(--bg-subtle);
  border-left: 4px solid var(--brand-secondary);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  padding: 14px 16px;
  margin-bottom: 10px;
  border-top: 1px solid var(--border-subtle);
  border-right: 1px solid var(--border-subtle);
  border-bottom: 1px solid var(--border-subtle);
}

/* ==========================================================================
   MODALES (DIALOGS ACCESIBLES)
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-content-card {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 680px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: scale(0.96);
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-backdrop.open .modal-content-card {
  transform: scale(1);
}

.modal-header-bar {
  padding: 16px 22px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-subtle);
}

.modal-header-bar h3 {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--brand-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-close-icon {
  background: transparent;
  border: none;
  font-size: 1.2rem;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close-icon:hover {
  color: var(--text-primary);
  background: var(--border-subtle);
}

.modal-body-scroll {
  padding: 22px;
  overflow-y: auto;
  flex: 1;
  -webkit-overflow-scrolling: touch;
}

.modal-footer-bar {
  padding: 14px 22px;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-subtle);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ==========================================================================
   MATRIZ DE 30 SALONES (101 AL 605)
   ========================================================================== */
.matrix-grid-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.matrix-semester-block {
  background: var(--bg-subtle);
  border-radius: var(--radius-md);
  padding: 14px;
  border: 1px solid var(--border-subtle);
}

.matrix-semester-title {
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--brand-primary);
  margin-bottom: 10px;
}

.matrix-groups-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}

.matrix-group-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 12px 8px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}

.matrix-group-card:hover {
  border-color: var(--brand-primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.matrix-group-card.active {
  background: var(--brand-primary);
  color: #fff;
  border-color: var(--brand-primary);
  box-shadow: 0 4px 12px rgba(0, 115, 82, 0.45);
}

.matrix-group-card.active span {
  color: rgba(255, 255, 255, 0.95);
}

/* ==========================================================================
   TOAST NOTIFICATIONS
   ========================================================================== */
#toastContainer {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 2000;
  pointer-events: none;
}

.toast {
  background: var(--text-primary);
  color: var(--text-inverted);
  padding: 12px 18px;
  border-radius: var(--radius-md);
  font-size: 0.84rem;
  font-weight: 700;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: auto;
  transition: opacity 0.3s ease;
  animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  max-width: 90vw;
}

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

/* ==========================================================================
   RESPONSIVIDAD INTEGRAL (MÓVILES Y TABLETS)
   ========================================================================== */
@media (max-width: 900px) {
  .group-hero-card {
    flex-direction: column;
    align-items: stretch;
  }
  .group-kpis-wrapper {
    width: 100%;
    justify-content: space-between;
  }
}

@media (max-width: 768px) {
  .gov-top-banner {
    padding: 6px 14px;
    font-size: 0.68rem;
    justify-content: center;
    text-align: center;
  }
  .gov-meta-right {
    display: none;
  }

  .app-header {
    padding: 8px 14px;
  }
  .header-subtitle {
    display: none;
  }
  .header-title-main {
    font-size: 0.92rem;
  }

  .main-app-container {
    padding: 12px 10px;
    gap: 12px;
  }

  .group-hero-card {
    padding: 14px;
  }
  .group-subject-title {
    font-size: 1.15rem;
  }

  .group-kpis-wrapper {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }
  .kpi-stat-box {
    min-width: unset;
    padding: 6px 10px;
  }
  .kpi-stat-number {
    font-size: 1.15rem;
  }

  .table-toolbar-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .toolbar-left-group {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
  }
  .segmented-control {
    width: 100%;
    justify-content: stretch;
  }
  .segmented-btn {
    flex: 1;
    justify-content: center;
    padding: 8px 10px;
    font-size: 0.75rem;
  }
  .search-input-field {
    width: 100%;
    font-size: 16px; /* Previene auto-zoom en iOS */
  }

  .toolbar-right-actions {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
    width: 100%;
  }
  .action-btn-secondary, .action-btn-cobaes {
    justify-content: center;
    padding: 8px 10px;
    font-size: 0.74rem;
  }

  .matrix-groups-row {
    grid-template-columns: repeat(3, 1fr);
  }

  .modal-content-card {
    max-width: 95vw;
    margin: 8px;
    max-height: 92vh;
  }
  .modal-body-scroll {
    padding: 16px;
  }

  .boleta-container-card {
    padding: 18px 14px;
  }

  .boleta-student-summary {
    grid-template-columns: 1fr;
  }

  .login-formal-box {
    padding: 24px 18px;
  }

  .demo-pills-grid {
    grid-template-columns: 1fr;
  }

  .login-input {
    font-size: 16px; /* Previene zoom indeseado en móviles */
  }

  /* Tabla táctil en móviles */
  .grade-num-input {
    width: 50px;
    height: 38px;
    font-size: 16px;
  }
  .att-status-btn {
    width: 36px;
    height: 36px;
    font-size: 0.85rem;
  }
  .part-btn {
    width: 32px;
    height: 32px;
  }
}

@media (max-width: 480px) {
  .header-actions-group .network-sync-pill span {
    display: none;
  }
  .header-actions-group .user-meta-text {
    display: none;
  }
  .matrix-groups-row {
    grid-template-columns: repeat(2, 1fr);
  }
}
