/* ============================================================
   SISTEMA ACADÉMICO - IEENSIU
   Paleta: Verde institucional + Crema/Dorado
   ============================================================ */

:root {
  --verde:          #1C6430;
  --verde-oscuro:   #134722;
  --verde-sidebar:  #0E3A1A;
  --verde-claro:    #D6EAD9;
  --dorado:         #C9A030;
  --dorado-claro:   #F5EDD3;
  --crema:          #F4EDDA;
  --gris-oscuro:    #1E2D1F;
  --gris-medio:     #5C6B5E;
  --bg-light:       #EFF5F0;
  --sidebar-w:      260px;
  --header-h:       60px;
  --border-r:       10px;
  --shadow:         0 2px 12px rgba(0,0,0,.08);
}

* { box-sizing: border-box; }

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: var(--bg-light);
  color: var(--gris-oscuro);
  margin: 0;
}

/* ── TIPOGRAFÍA ── */
.text-naranja  { color: var(--verde); }
.text-amarillo { color: var(--dorado); }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.fw-800 { font-weight: 800; }

/* ── BOTONES PRINCIPALES ── */
.btn-naranja {
  background: var(--verde);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 10px 22px;
  font-weight: 600;
  transition: background .2s;
}
.btn-naranja:hover { background: var(--verde-oscuro); color: #fff; }
.bg-naranja { background-color: var(--verde) !important; }

.btn-amarillo {
  background: var(--dorado);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 10px 22px;
  font-weight: 600;
  transition: background .2s;
}
.btn-amarillo:hover { background: #a07c20; color: #fff; }

/* ============================================================
   LOGIN
   ============================================================ */
.login-wrapper {
  min-height: 100vh;
  background: linear-gradient(150deg, var(--verde-sidebar) 0%, var(--verde) 55%, #2E8B4A 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-card {
  background: #fff;
  border-radius: 18px;
  padding: 48px 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
}

.login-logo {
  width: 96px;
  height: 96px;
  background: var(--dorado-claro);
  border: 3px solid var(--dorado);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  margin: 0 auto 20px;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0,0,0,.15);
}

.login-title {
  text-align: center;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--verde);
  margin-bottom: 4px;
}

.login-subtitle {
  text-align: center;
  color: var(--gris-medio);
  font-size: .9rem;
  margin-bottom: 32px;
}

.login-card .form-control {
  border-radius: 10px;
  border: 2px solid #dce8dc;
  padding: 12px 16px;
  font-size: 1rem;
  transition: border-color .2s;
}
.login-card .form-control:focus {
  border-color: var(--verde);
  box-shadow: 0 0 0 3px rgba(28,100,48,.12);
}

.login-card label {
  font-weight: 600;
  font-size: .88rem;
  color: var(--gris-oscuro);
  margin-bottom: 6px;
}

.btn-login {
  width: 100%;
  padding: 14px;
  background: var(--verde);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: .3px;
  transition: background .2s, transform .1s;
  margin-top: 8px;
}
.btn-login:hover { background: var(--verde-oscuro); transform: translateY(-1px); }
.btn-login:active { transform: translateY(0); }

.rol-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: .78rem;
  font-weight: 600;
  margin: 2px;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all .2s;
}
.rol-badge.admin-b    { background: #F5EDD3; color: #7A5C10; border-color: #e8d8a0; }
.rol-badge.docente-b  { background: #D6EAD9; color: #134722; border-color: #a8cead; }
.rol-badge.estud-b    { background: #DBEAFE; color: #1E40AF; border-color: #BFDBFE; }
.rol-badge.padre-b    { background: #EDE9FE; color: #5B21B6; border-color: #DDD6FE; }

/* ============================================================
   LAYOUT PRINCIPAL
   ============================================================ */

/* Sidebar */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--verde-sidebar);
  display: flex;
  flex-direction: column;
  z-index: 1000;
  transition: transform .3s;
  overflow-y: auto;
}

.sidebar-brand {
  background: var(--verde-oscuro);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: var(--header-h);
  border-bottom: 2px solid var(--dorado);
}

.sidebar-brand .brand-icon {
  width: 36px;
  height: 36px;
  background: var(--dorado);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.sidebar-brand .brand-text {
  color: #fff;
  font-weight: 700;
  font-size: .95rem;
  line-height: 1.2;
}

.sidebar-brand .brand-text small {
  display: block;
  font-size: .68rem;
  font-weight: 400;
  opacity: .75;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: #b8d4bc;
}

.sidebar-user {
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--verde);
  border: 2px solid var(--dorado);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #fff;
  font-size: 1rem;
  flex-shrink: 0;
  overflow: hidden;
  object-fit: cover;
}
.user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

/* Avatar con opción de carga de foto */
.avatar-upload-wrap {
  position: relative;
  display: inline-block;
  cursor: pointer;
  flex-shrink: 0;
}
.avatar-upload-wrap .avatar-overlay {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: rgba(0,0,0,.45);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity .2s;
  font-size: .9rem;
  color: #fff;
  flex-direction: column;
  gap: 2px;
}
.avatar-upload-wrap .avatar-overlay span {
  font-size: .6rem;
  font-weight: 700;
  letter-spacing: .3px;
}
.avatar-upload-wrap:hover .avatar-overlay { opacity: 1; }

.user-info .user-name {
  color: #fff;
  font-weight: 600;
  font-size: .88rem;
  line-height: 1.2;
}
.user-info .user-rol {
  color: var(--dorado);
  font-size: .73rem;
  text-transform: uppercase;
  letter-spacing: .5px;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 0;
}

.nav-section {
  padding: 10px 20px 4px;
  color: rgba(255,255,255,.3);
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 600;
}

.nav-item { margin: 2px 12px; }

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  color: rgba(255,255,255,.75);
  text-decoration: none;
  border-radius: 8px;
  font-size: .9rem;
  transition: all .2s;
}
.nav-link:hover {
  background: rgba(255,255,255,.08);
  color: #fff;
}
.nav-link.active {
  background: var(--verde);
  color: #fff;
  border-left: 3px solid var(--dorado);
}
.nav-link .nav-icon {
  width: 20px;
  text-align: center;
  font-size: 1.05rem;
  flex-shrink: 0;
}

.sidebar-footer {
  padding: 16px 12px;
  border-top: 1px solid rgba(255,255,255,.08);
}

/* Topbar */
.topbar {
  position: fixed;
  top: 0;
  left: var(--sidebar-w);
  right: 0;
  height: var(--header-h);
  background: #fff;
  display: flex;
  align-items: center;
  padding: 0 24px;
  z-index: 900;
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
  gap: 12px;
  border-bottom: 3px solid var(--verde-claro);
}

.topbar-title {
  flex: 1;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--gris-oscuro);
}

.btn-sidebar-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.4rem;
  cursor: pointer;
  color: var(--verde);
  padding: 4px 8px;
}

/* Contenido principal */
.main-content {
  margin-left: var(--sidebar-w);
  margin-top: var(--header-h);
  padding: 28px;
  min-height: calc(100vh - var(--header-h));
}

/* ============================================================
   CARDS / STAT CARDS
   ============================================================ */
.card {
  border: none;
  border-radius: var(--border-r);
  box-shadow: var(--shadow);
}

.stat-card {
  background: #fff;
  border-radius: var(--border-r);
  padding: 22px 24px;
  display: flex;
  align-items: center;
  gap: 18px;
  box-shadow: var(--shadow);
}

.stat-icon {
  width: 54px;
  height: 54px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  flex-shrink: 0;
}

.stat-icon.naranja  { background: #D6EAD9; color: var(--verde); }
.stat-icon.amarillo { background: #F5EDD3; color: #8B6010; }
.stat-icon.verde    { background: #DCFCE7; color: #15803D; }
.stat-icon.azul     { background: #EFF6FF; color: #2563EB; }
.stat-icon.morado   { background: #F5F3FF; color: #7C3AED; }

.stat-value {
  font-size: 1.9rem;
  font-weight: 800;
  line-height: 1;
  color: var(--gris-oscuro);
}
.stat-label {
  font-size: .82rem;
  color: var(--gris-medio);
  margin-top: 3px;
}

/* ============================================================
   TABLA DE NOTAS (planilla académica)
   ============================================================ */
.planilla-wrapper {
  overflow-x: auto;
  border-radius: var(--border-r);
  box-shadow: var(--shadow);
}

.planilla {
  border-collapse: collapse;
  min-width: 900px;
  width: 100%;
  background: #fff;
  font-size: .82rem;
}

.planilla th {
  background: var(--verde);
  color: #fff;
  padding: 8px 10px;
  text-align: center;
  font-weight: 700;
  border: 1px solid rgba(255,255,255,.2);
  white-space: nowrap;
}

.planilla th.th-grado {
  background: var(--verde-sidebar);
  font-size: .95rem;
  letter-spacing: .5px;
  border-bottom: 2px solid var(--dorado);
}

.planilla th.th-seccion {
  background: var(--verde-oscuro);
}

.planilla td {
  padding: 7px 10px;
  text-align: center;
  border: 1px solid #dce8dc;
}

.planilla tbody tr:nth-child(even) { background: #f7fbf7; }
.planilla tbody tr:hover { background: #ECF5EC; }

.td-nombre {
  text-align: left !important;
  font-weight: 600;
  min-width: 180px;
}

.nota-aprobado  { color: #15803D; font-weight: 700; }
.nota-reprobado { color: #DC2626; font-weight: 700; }

.asist-p  { color: #15803D; font-weight: 700; }
.asist-a  { color: #DC2626; font-weight: 700; }
.asist-t  { color: #D97706; font-weight: 700; }
.asist-ex { color: #2563EB; font-weight: 700; }

/* ============================================================
   TABLAS CRUD
   ============================================================ */
/* ── Tabs de contenido (no sidebar) ──────────────────────────── */
.nav-tabs {
  border-bottom: 2px solid #dee2e6;
  gap: 4px;
  padding: 0 4px;
}
.nav-tabs .nav-item { margin: 0; }
.nav-tabs .nav-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  color: var(--gris-medio);
  background: #f4f6f4;
  border: 1px solid transparent;
  border-bottom: none;
  border-radius: 8px 8px 0 0;
  font-size: .88rem;
  font-weight: 600;
  text-decoration: none;
  transition: all .18s;
  border-left: none;
}
.nav-tabs .nav-link:hover {
  color: var(--verde);
  background: #e8f0e8;
}
.nav-tabs .nav-link.active {
  color: var(--verde-oscuro);
  background: #fff;
  border-color: #dee2e6 #dee2e6 #fff;
  border-left: none;
}
.nav-tabs .nav-link .badge {
  font-size: .7rem;
  padding: 2px 7px;
  border-radius: 20px;
}

.table-card {
  background: #fff;
  border-radius: var(--border-r);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.nav-tabs + .table-card {
  border-radius: 0 var(--border-r) var(--border-r) var(--border-r);
  border-top: none;
  box-shadow: 0 4px 14px rgba(0,0,0,.07);
}

.table-card-header {
  padding: 18px 24px;
  border-bottom: 1px solid #e8f0e8;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  background: linear-gradient(to right, #f7fbf7, #fff);
}

.table-card-header h5 {
  margin: 0;
  font-weight: 700;
  font-size: 1rem;
  color: var(--verde-oscuro);
}

.table-crud {
  width: 100%;
  border-collapse: collapse;
  font-size: .88rem;
}
.table-crud th {
  background: #f0f7f0;
  color: var(--verde-oscuro);
  font-weight: 700;
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .5px;
  padding: 12px 16px;
  border-bottom: 2px solid #d6e8d6;
  white-space: nowrap;
}
.table-crud td {
  padding: 13px 16px;
  border-bottom: 1px solid #f0f5f0;
  vertical-align: middle;
}
.table-crud tbody tr:last-child td { border-bottom: none; }
.table-crud tbody tr:hover { background: #f4faf4; }

/* Badges de rol */
.badge-rol {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: .73rem;
  font-weight: 700;
}
.badge-admin      { background: #F5EDD3; color: #7A5C10; }
.badge-docente    { background: #D6EAD9; color: #134722; }
.badge-estudiante { background: #DBEAFE; color: #1E40AF; }
.badge-padre      { background: #EDE9FE; color: #5B21B6; }
.badge-activo     { background: #DCFCE7; color: #15803D; }
.badge-inactivo   { background: #FEE2E2; color: #991B1B; }

/* Acciones de tabla */
.btn-accion {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 7px;
  border: none;
  cursor: pointer;
  font-size: .9rem;
  transition: all .2s;
  text-decoration: none;
}
.btn-editar   { background: #D6EAD9; color: #134722; }
.btn-editar:hover  { background: #b8d8bc; }
.btn-eliminar { background: #FEE2E2; color: #991B1B; }
.btn-eliminar:hover { background: #FECACA; }
.btn-ver      { background: #F5EDD3; color: #7A5C10; }
.btn-ver:hover { background: #ead5a0; }

/* ============================================================
   FORMULARIOS / MODALES
   ============================================================ */
.form-label {
  font-weight: 600;
  font-size: .85rem;
  color: var(--gris-oscuro);
  margin-bottom: 5px;
}
.form-control, .form-select {
  border-radius: 8px;
  border: 2px solid #dce8dc;
  padding: 10px 14px;
  font-size: .9rem;
  transition: border-color .2s;
}
.form-control:focus, .form-select:focus {
  border-color: var(--verde);
  box-shadow: 0 0 0 3px rgba(28,100,48,.1);
}

.modal-header {
  background: var(--verde);
  color: #fff;
  border-radius: 10px 10px 0 0 !important;
}
.modal-header .btn-close { filter: invert(1) brightness(2); }
.modal-title { font-weight: 700; }

/* ============================================================
   ALERTAS FLASH
   ============================================================ */
.alert { border-radius: 10px; border: none; padding: 14px 18px; }
.alert-success { background: #DCFCE7; color: #15803D; }
.alert-danger  { background: #FEE2E2; color: #991B1B; }
.alert-warning { background: #FEF3C7; color: #92400E; }
.alert-info    { background: #DBEAFE; color: #1E40AF; }

/* ============================================================
   CABECERA DE PLANILLA
   ============================================================ */
.planilla-header {
  background: #fff;
  border-radius: var(--border-r);
  padding: 18px 24px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  border-left: 4px solid var(--verde);
}

.planilla-header .grado-titulo {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--verde);
}

.planilla-header .info-chip,
.info-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--verde-claro);
  border-radius: 20px;
  padding: 5px 14px;
  font-size: .82rem;
  font-weight: 600;
  color: var(--verde-oscuro);
}

/* ============================================================
   PLANILLA EDITABLE (docente)
   ============================================================ */
.nota-input {
  width: 58px;
  border: none;
  border-bottom: 2px solid #cce0cc;
  border-radius: 0;
  background: transparent;
  text-align: center;
  font-size: .88rem;
  font-weight: 600;
  padding: 3px 4px;
  outline: none;
  color: var(--gris-oscuro);
  transition: border-color .15s;
}
.nota-input:focus {
  border-bottom-color: var(--verde);
  background: #EFF7EF;
  border-radius: 4px;
}
.nota-input:disabled {
  color: #aaa;
  border-bottom-color: transparent;
  cursor: not-allowed;
}
.nota-input.nota-aprobado  { color: #15803D; }
.nota-input.nota-reprobado { color: #DC2626; }

.btn-rep-nota {
  display: block;
  width: 100%;
  background: none;
  border: none;
  font-size: .65rem;
  color: #bbb;
  cursor: pointer;
  padding: 1px 0;
  line-height: 1;
  text-align: center;
  transition: color .15s;
}
.btn-rep-nota:hover { color: var(--naranja); }

.td-calc {
  font-weight: 700;
  font-size: .88rem;
  min-width: 54px;
}

.save-indicator {
  font-size: .7rem;
  font-weight: 700;
  min-width: 18px;
  display: inline-block;
  transition: all .2s;
}
.save-indicator.saving { color: var(--dorado); }
.save-indicator.saved  { color: #15803D; }
.save-indicator.error  { color: #DC2626; }

/* Tarjetas de asignación en dashboard docente */
.asig-card {
  background: #fff;
  border-radius: var(--border-r);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: transform .2s, box-shadow .2s;
  cursor: pointer;
  text-decoration: none;
  display: block;
  color: inherit;
}
.asig-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0,0,0,.12);
  color: inherit;
}
.asig-card-header {
  background: var(--verde);
  color: #fff;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 3px solid var(--dorado);
}
.asig-card-materia {
  font-weight: 800;
  font-size: 1rem;
  line-height: 1.2;
}
.asig-card-codigo {
  background: rgba(255,255,255,.2);
  border-radius: 6px;
  padding: 3px 10px;
  font-size: .75rem;
  font-weight: 700;
}
.asig-card-body    { padding: 16px 20px; }
.asig-card-grado   { font-size: 1.3rem; font-weight: 800; color: var(--gris-oscuro); }
.asig-card-spec    { font-size: .8rem; color: var(--gris-medio); margin-top: 2px; }
.asig-card-stats {
  display: flex;
  gap: 16px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #e8f0e8;
  font-size: .82rem;
}
.asig-stat-val   { font-weight: 700; font-size: 1.1rem; color: var(--verde); }
.asig-stat-label { color: var(--gris-medio); font-size: .75rem; }

/* ============================================================
   ASISTENCIA
   ============================================================ */
.asist-btn-group { display: flex; gap: 4px; flex-wrap: wrap; }
.asist-btn {
  padding: 5px 10px;
  border-radius: 6px;
  border: 2px solid transparent;
  font-size: .78rem;
  font-weight: 700;
  cursor: pointer;
  transition: all .15s;
  background: #f0f0f0;
  color: #666;
  white-space: nowrap;
}
.asist-btn.selected-P  { background: #DCFCE7; color: #15803D; border-color: #15803D; }
.asist-btn.selected-A  { background: #FEE2E2; color: #DC2626; border-color: #DC2626; }
.asist-btn.selected-T  { background: #FEF3C7; color: #D97706; border-color: #D97706; }
.asist-btn.selected-EX { background: #DBEAFE; color: #2563EB; border-color: #2563EB; }
.asist-btn:hover { opacity: .85; }
.asist-lbl-short { display: none; }

@media (max-width: 600px) {
  .asist-lbl-full  { display: none; }
  .asist-lbl-short { display: inline; }
  .asist-btn { padding: 6px 10px; font-size: .8rem; }
}

.asist-mini {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 5px;
  font-size: .7rem;
  font-weight: 700;
  margin: 1px;
}
.asist-mini.P  { background: #DCFCE7; color: #15803D; }
.asist-mini.A  { background: #FEE2E2; color: #DC2626; }
.asist-mini.T  { background: #FEF3C7; color: #D97706; }
.asist-mini.EX { background: #DBEAFE; color: #2563EB; }
.asist-mini.SIN{ background: #f0f0f0; color: #aaa; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .main-content {
    margin-left: 0;
    padding: 16px;
  }
  .topbar {
    left: 0;
  }
  .btn-sidebar-toggle {
    display: block;
  }
  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 999;
  }
  .sidebar-overlay.open { display: block; }

  .stat-card { padding: 16px; }
  .stat-value { font-size: 1.5rem; }

  .planilla-header { flex-direction: column; align-items: flex-start; gap: 10px; }
  .planilla-header .grado-titulo { font-size: 1.1rem; }

  /* Modales — ocupar más ancho en móvil */
  .modal-dialog { margin: 8px; max-width: calc(100% - 16px); }

  /* Tabla de reportes del docente */
  .rep-tabla td, .rep-tabla th { padding: 6px 8px; }
  .rep-est-header { flex-wrap: wrap; gap: 6px; }

  /* Acordeón de asignaciones */
  .asig-doc-header { flex-wrap: wrap; gap: 6px; }

  /* Perfil del padre — botones en fila compacta */
  .info-chip { font-size: .75rem; padding: 3px 8px; }

  .table-card-header { flex-direction: column; align-items: flex-start; }

  .login-card { padding: 32px 24px; }
}

@media (max-width: 480px) {
  .main-content { padding: 12px; }
  .stat-card { gap: 12px; }
  .stat-icon { width: 44px; height: 44px; font-size: 1.3rem; }
}

/* ============================================================
   PANEL PADRE — TARJETA DE NOTAS RESPONSIVE (.pnc)
   ============================================================ */
.pnc-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.pnc-info    { min-width: 130px; flex-shrink: 0; }
.pnc-parciales {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  flex: 1;
  min-width: 0;
}
.pnc-celda   { min-width: 46px; }
.pnc-finals  { display: flex; gap: 0; flex-shrink: 0; }
.pnc-fin     { padding: 0 8px; border-left: 2px solid #f0f0f0; }
.pnc-fin:first-child { border-left: none; }
.pnc-periodo { min-width: 52px; }

@media (max-width: 600px) {
  .pnc-info { flex: 1 1 100%; min-width: 0; }

  .pnc-parciales {
    flex: 1 1 100%;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }

  .pnc-finals {
    flex: 1 1 100%;
    justify-content: space-around;
    border-top: 1px solid #f0f0f0;
    padding-top: 6px;
    margin-top: 2px;
  }
  .pnc-fin { border-left: none; flex: 1; padding: 0 4px; }
}

/* ============================================================
   ACORDEÓN DE ASIGNACIONES POR DOCENTE
   ============================================================ */
.asig-accordion { display: flex; flex-direction: column; gap: 8px; }

.asig-doc-card {
  background: #fff;
  border-radius: var(--border-r);
  box-shadow: var(--shadow);
  overflow: hidden;
  border: 1px solid #e8f0e8;
  transition: box-shadow .18s;
}
.asig-doc-card.open {
  box-shadow: 0 4px 18px rgba(28,100,48,.13);
  border-color: var(--verde-claro);
}

.asig-doc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  cursor: pointer;
  user-select: none;
  transition: background .15s;
}
.asig-doc-header:hover { background: #f4fbf4; }
.asig-doc-card.open .asig-doc-header { background: linear-gradient(to right, #e8f3e8, #f7fbf7); }

.asig-chevron {
  font-size: .75rem;
  color: var(--gris-medio);
  transition: transform .2s;
  display: inline-block;
}
.asig-doc-card.open .asig-chevron { transform: rotate(180deg); }

.asig-count-badge {
  background: var(--verde-claro);
  color: var(--verde-oscuro);
  font-size: .74rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
}

.asig-doc-body {
  display: none;
  border-top: 1px solid #e8f0e8;
}
.asig-doc-card.open .asig-doc-body { display: block; }

.asig-inner-table { margin: 0; }
.asig-inner-table thead th {
  background: #f4f6f4;
  color: var(--gris-medio);
  font-size: .75rem;
  padding: 8px 14px;
}
.asig-inner-table tbody td { padding: 9px 14px; font-size: .86rem; }
.asig-inner-table tbody tr:last-child td { border-bottom: none; }

/* ============================================================
   REPORTES POR GRADO Y ESTUDIANTE (docente/reportes.php)
   ============================================================ */
.rep-grado-list { display: flex; flex-direction: column; gap: 10px; }

/* Tarjeta de grado (nivel 1) */
.rep-grado-card {
  background: #fff;
  border-radius: var(--border-r);
  box-shadow: var(--shadow);
  border: 1px solid #e8f0e8;
  overflow: hidden;
  transition: box-shadow .18s;
}
.rep-grado-card.open { box-shadow: 0 4px 18px rgba(28,100,48,.12); border-color: var(--verde-claro); }

.rep-grado-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 20px;
  cursor: pointer;
  user-select: none;
  transition: background .15s;
}
.rep-grado-header:hover { background: #f4fbf4; }
.rep-grado-card.open .rep-grado-header { background: linear-gradient(to right, #e8f3e8, #f7fbf7); }
.rep-grado-card.open .rep-grado-header .asig-chevron { transform: rotate(180deg); }

.rep-grado-body { display: none; border-top: 1px solid #e8f0e8; }
.rep-grado-card.open .rep-grado-body { display: block; }

/* Sub-sección de estudiante (nivel 2) */
.rep-est-block { border-bottom: 1px solid #f0f4f0; }
.rep-est-block:last-child { border-bottom: none; }

.rep-est-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  background: #fafcfa;
  gap: 8px;
}
.rep-est-header.collapsible { cursor: pointer; }
.rep-est-header.collapsible:hover { background: #f0f7f0; }
.rep-est-block.est-open .rep-est-header { background: #edf5ed; }
.rep-est-block.est-open .rep-est-header .asig-chevron { transform: rotate(180deg); }

.rep-est-count {
  font-size: .72rem;
  font-weight: 700;
  background: #fff3cd;
  color: #856404;
  padding: 2px 8px;
  border-radius: 20px;
}

/* Lista de reportes del estudiante */
.rep-est-reportes { background: #fff; }
.rep-est-reportes.collapsible { display: none; }
.rep-est-reportes.collapsible.open { display: block; }

/* ============================================================
   TABLA DE REPORTES (docente/reportes.php)
   ============================================================ */
.rep-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: .75rem;
  font-weight: 600;
  white-space: nowrap;
}
.rep-asistencia { background: #fef9c3; color: #854d0e; }
.rep-nota       { background: #dbeafe; color: #1e40af; }
.rep-comportam  { background: #fee2e2; color: #991b1b; }
.rep-logro      { background: #dcfce7; color: #166534; }
.rep-otro       { background: #f3f4f6; color: #374151; }

.rep-tabla tbody tr.rep-row:hover { background: #f0f7f0; }
.rep-tabla tbody tr.rep-row.expanded { background: #e8f3e8; }
.rep-tabla tbody tr.rep-row { transition: background .15s; }

.rep-asunto-preview {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
}

/* Fila de detalle */
.rep-detalle { display: none; }
.rep-detalle.open { display: table-row; }
.rep-detalle > td {
  padding: 0 !important;
  border-bottom: 2px solid var(--verde-claro) !important;
}
.rep-detalle-inner {
  display: flex;
  gap: 20px;
  padding: 16px 24px;
  background: #f7fbf7;
  animation: repSlide .18s ease;
}
@keyframes repSlide {
  from { opacity:0; transform: translateY(-6px); }
  to   { opacity:1; transform: translateY(0); }
}
.rep-detalle-contenido {
  flex: 1;
  font-size: .85rem;
  line-height: 1.6;
  color: #333;
}
.rep-det-label {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--gris-medio);
  margin-bottom: 6px;
}
.rep-det-acudiente {
  margin-top: 10px;
  padding: 8px 12px;
  background: var(--verde-claro);
  border-radius: 8px;
  font-size: .8rem;
  color: var(--verde-oscuro);
}
.rep-detalle-img {
  flex-shrink: 0;
  width: 140px;
}
.rep-detalle-img img {
  width: 100%;
  border-radius: 8px;
  object-fit: cover;
  max-height: 110px;
  border: 1px solid #d0e8d0;
}

.rep-btn-wa {
  background: #d1fae5;
  color: #059669;
}
.rep-btn-wa:hover { background: #a7f3d0; }

.rep-ya-leido { opacity: .5; }
.rep-ya-leido:hover { opacity: .75; }

/* ============================================================
   DRAG & DROP ZONA DE IMAGEN (modal reporte)
   ============================================================ */
.rep-drop-zone {
  border: 2px dashed #d0d0d0;
  border-radius: 12px;
  padding: 22px 16px;
  text-align: center;
  cursor: pointer;
  transition: border-color .2s, background .2s;
  background: #fafafa;
  min-height: 80px;
}
.rep-drop-zone:hover {
  border-color: var(--naranja);
  background: #fff8f0;
}
.rep-drop-zone.drag-over {
  border-color: var(--naranja);
  background: #fff3e0;
  transform: scale(1.01);
}

/* ============================================================
   PRINT
   ============================================================ */
@media print {
  .sidebar, .topbar, .btn, .btn-accion, .no-print { display: none !important; }
  .main-content { margin: 0; padding: 0; }
  .planilla th { background: var(--verde) !important; -webkit-print-color-adjust: exact; }
}
