/* ==========================================================================
   CRM Rematrícula — Módulo Rematrícula (pipeline)
   Se carga después de dashboard.css, componentes.css y estudiantes.css
   (reutiliza de este último la barra de herramientas, los filtros, las
   fichas de filtros activos y la barra de acciones en bloque).
   ========================================================================== */

.pipeline-card { padding: 0; overflow: hidden; }
.pipeline-card .toolbar { border-bottom: 1px solid var(--border); }
.view-switch { flex-shrink: 0; }
.view-switch .icon { width: 14px; height: 14px; margin-right: 4px; vertical-align: -2px; }

/* ---------- Tablero Kanban ---------- */
.board {
  display: flex;
  gap: 14px;
  padding: 18px 22px 22px;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  background: var(--gray-50);
}
.board-col {
  display: flex;
  flex-direction: column;
  flex: 0 0 290px;
  min-height: 320px;
  max-height: calc(100vh - 300px);
  border-top: 3px solid var(--gray-300);
  border-radius: 12px;
  background: var(--gray-100);
  scroll-snap-align: start;
  transition: background var(--transition), outline-color var(--transition), flex-basis var(--transition);
  outline: 2px dashed transparent;
  outline-offset: -2px;
}
.board-col--validada  { border-top-color: var(--purple-500); }
.board-col--observada { border-top-color: var(--amber-600); }
.board-col--cambio    { border-top-color: var(--blue-600); }
.board-col--confirma  { border-top-color: var(--green-600); }
.board-col--conf-edit { border-top-color: #0d9488; }
.board-col--no-remat  { border-top-color: var(--rose-600); }
.board-col--egresado  { border-top-color: var(--gray-500); }
.board-col--remat     { border-top-color: var(--green-600); background: var(--green-50); }

.board-col.is-drop-ok { outline-color: var(--purple-500); background: var(--purple-50); }
.board-col.is-drop-bad { outline-color: var(--rose-500); background: var(--rose-50); opacity: .75; }

.board-col__head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 12px 10px 14px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .02em;
  color: var(--gray-700);
}
.board-col__title { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.board-col__title .icon { width: 14px; height: 14px; color: var(--green-600); vertical-align: -2px; stroke-width: 2.6; }
.board-col__count {
  min-width: 24px; padding: 1px 8px; border-radius: 999px;
  font-size: 11px; text-align: center; color: var(--gray-700); background: #fff;
}
.board-col__toggle {
  display: grid; place-items: center; width: 26px; height: 26px;
  border: 0; border-radius: 6px; background: transparent; color: var(--gray-500);
}
.board-col__toggle:hover { background: rgba(255, 255, 255, .7); color: var(--gray-900); }
.board-col__toggle .icon { width: 16px; height: 16px; }
.board-col__body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
  padding: 2px 10px 12px;
  overflow-y: auto;
}
/* Tarjeta o fila del estudiante recién trabajado (al cerrar el panel lateral) */
.opp-card.is-reciente, #tableView tr.is-reciente { animation: reciente 2.4s ease-out; }
@keyframes reciente {
  0%, 60% { box-shadow: 0 0 0 3px var(--purple-500); }
  100% { box-shadow: 0 0 0 3px transparent; }
}
@media (prefers-reduced-motion: reduce) { .opp-card.is-reciente, #tableView tr.is-reciente { animation: none; box-shadow: 0 0 0 3px var(--purple-500); } }
.board-col__empty { padding: 18px 8px; text-align: center; font-size: 12px; color: var(--gray-400); }
.board-col__hint { padding: 0 14px 8px; font-size: 11px; color: var(--gray-500); }

/* Columna contraída */
.board-col.is-collapsed { flex-basis: 52px; }
.board-col.is-collapsed .board-col__head { flex-direction: column; gap: 10px; padding: 12px 0; }
.board-col.is-collapsed .board-col__title {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  overflow: visible;
}
.board-col.is-collapsed .board-col__body,
.board-col.is-collapsed .board-col__hint { display: none; }
.board-col.is-collapsed .board-col__toggle .icon { transform: rotate(180deg); }

/* Tarjeta de oportunidad */
.opp-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: box-shadow var(--transition), transform var(--transition), opacity var(--transition);
}
.opp-card[draggable="true"] { cursor: grab; }
.opp-card:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.opp-card:focus-visible { outline: 2px solid var(--purple-500); outline-offset: 2px; }
.opp-card.is-dragging { opacity: .45; transform: rotate(1deg); }
.opp-card__top { display: flex; align-items: flex-start; gap: 10px; }
.opp-card__avatar {
  display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%;
  font-size: 11px; font-weight: 700; color: var(--purple-700); background: var(--purple-100); flex-shrink: 0;
}
.opp-card__name { font-weight: 650; font-size: 13px; line-height: 1.3; color: var(--gray-900); }
.opp-card__meta { font-size: 11px; color: var(--text-muted); margin-top: 1px; }
.opp-card__badges { display: flex; flex-wrap: wrap; gap: 4px 6px; align-items: center; }
.opp-card__foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 11px; color: var(--gray-500); }
.opp-card__attempts { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; }
.opp-card__attempts--fail { color: var(--rose-600); }
.opp-card__attempts--ok { color: var(--green-600); }
.opp-card__stage-note { font-size: 11px; }

/* ---------- Vista de tabla ---------- */
.table--pipeline td { vertical-align: middle; }
.table--pipeline tbody tr { cursor: pointer; }
.table--pipeline tbody tr.is-selected { background: var(--purple-50); }
.table--pipeline .cell-check { width: 44px; }
.table--pipeline input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--purple-600); cursor: pointer; }

/* ---------- Panel lateral de detalle ---------- */
.drawer-backdrop { position: fixed; inset: 0; z-index: 45; background: rgba(21, 24, 33, .4); }
.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  width: min(580px, 100%);
  background: #fff;
  box-shadow: var(--shadow-lg);
  transform: translateX(100%);
  transition: transform .25s ease;
}
.drawer.is-open { transform: none; }
.drawer__head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
}
.drawer__avatar {
  display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px;
  font-weight: 700; color: #fff; background: linear-gradient(135deg, var(--purple-400), var(--purple-700)); flex-shrink: 0;
}
.drawer__title { font-size: 17px; font-weight: 700; line-height: 1.25; }
.drawer__title a:hover { color: var(--purple-700); text-decoration: underline; }
.drawer__meta { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.drawer__close { margin-left: auto; flex-shrink: 0; }
.drawer__body { flex: 1; overflow-y: auto; padding: 4px 20px 24px; }
.drawer__foot { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }

.d-section { padding: 18px 0; }
.d-section + .d-section { border-top: 1px solid var(--gray-100); }
.d-section__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.d-section__title { font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--gray-500); }
.d-section .notice { margin-bottom: 12px; }
.projection-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
/* "Ejecutado en Banner" (Registros Académicos) */
.banner-col { text-align: center; white-space: nowrap; }
.banner-check { width: 16px; height: 16px; accent-color: var(--purple-500); cursor: pointer; }
.banner-check:disabled { cursor: default; }
.banner-dot { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 999px; font-size: 11px; font-weight: 700; line-height: 1; color: #fff; }
.banner-dot--ok { background: #16a34a; }
.banner-dot--fail { background: #dc2626; }
/* Agregar curso al verificar en Banner (2026-10-08) */
.add-course { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--border); display: grid; gap: 8px; }
.add-course__fila { display: flex; gap: 8px; }
.add-course__fila .field__input { flex: 1; min-width: 0; }
.add-course__res { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 13px; }
.add-course__res .field__input { flex: 1 1 120px; min-width: 0; }
.add-course__res select { max-width: 100%; }
.add-course__nota { font-size: 12px; margin: 0; }
.banner-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-top: 10px; font-size: 13px; }
.d-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; align-items: end; }
.d-grid .btn { grid-column: 1 / -1; justify-self: end; }
.d-list { display: flex; flex-direction: column; gap: 10px; margin: 0; padding: 0; list-style: none; }
.d-item { padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; font-size: 13px; }
.d-item__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.d-item__title { font-weight: 600; }
.d-item__text { margin-top: 4px; color: var(--gray-600); }
.d-item__meta { margin-top: 6px; font-size: 11px; color: var(--gray-400); display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* Barra de etapas */
.stagebar { display: flex; flex-wrap: wrap; gap: 6px; }
.stage-step {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fff;
  font-size: 11px;
  font-weight: 700;
  color: var(--gray-600);
  transition: all var(--transition);
}
.stage-step:not(:disabled):hover { border-color: var(--purple-400); color: var(--purple-700); background: var(--purple-50); }
.stage-step:disabled { opacity: .4; cursor: not-allowed; }
.stage-step[aria-current="step"] { opacity: 1; color: #fff; background: var(--purple-600); border-color: var(--purple-600); cursor: default; }
.stage-step__dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.stagebar__legend { margin-top: 8px; font-size: 11px; color: var(--gray-400); }

.remat-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: 14px; padding: 10px 12px; border-radius: 10px; background: var(--gray-50); font-size: 13px; }

.send-status { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; }
.send-status .icon { width: 12px; height: 12px; }
.send-status--PENDIENTE { color: var(--amber-600); background: var(--amber-50); }
.send-status--ENVIADO { color: var(--green-600); background: var(--green-50); }
.send-status--ERROR { color: var(--rose-600); background: var(--rose-50); }

/* Interacción obligatoria dentro de la ventana de cambio de etapa */
.inter-box {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 0;
  padding: 14px;
  border: 1px solid var(--purple-200);
  border-radius: var(--radius);
  background: var(--purple-50);
}
.inter-box__title { display: flex; align-items: center; gap: 6px; padding: 0 6px; font-size: 13px; font-weight: 700; color: var(--purple-700); }
.inter-box__title .icon { width: 16px; height: 16px; }
.inter-box__row { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 12px; }
@media (max-width: 767px) { .inter-box__row { grid-template-columns: minmax(0, 1fr); } }

/* Ventana de cambio de etapa */
.stage-flow { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; }
.stage-flow .icon { width: 16px; height: 16px; color: var(--gray-400); }

/* ---------- Responsive ---------- */
@media (max-width: 767px) {
  .board { padding: 14px 16px 18px; gap: 12px; }
  .board-col { flex-basis: 82vw; max-height: none; }
  .board-col.is-collapsed { flex-basis: 52px; }
  .drawer__head { padding: 14px 16px; }
  .drawer__body { padding: 4px 16px 20px; }
  .drawer__foot { padding: 12px 16px; }
  .d-grid { grid-template-columns: minmax(0, 1fr); }
  .d-grid .btn { justify-self: stretch; }
  .col-sm-hide { display: none; }
}
@media (max-width: 1099px) {
  .col-md-hide-p { display: none; }
}

/* Filtros de selección múltiple (Nivel, Etapa de gestión) — 2026-10-19 */
.multi-select { position: relative; }
.multi-select__summary {
  list-style: none; display: flex; align-items: center; height: 38px; padding: 0 30px 0 10px;
  border: 1px solid var(--border); border-radius: 8px; background: #fff; font-size: 13px; color: var(--gray-900);
  cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; position: relative;
}
.multi-select__summary::-webkit-details-marker { display: none; }
.multi-select__summary::after {
  content: ''; position: absolute; right: 12px; top: 50%; width: 7px; height: 7px; margin-top: -5px;
  border-right: 1.6px solid var(--gray-700); border-bottom: 1.6px solid var(--gray-700); transform: rotate(45deg);
}
.multi-select[open] .multi-select__summary { border-color: var(--purple-400); box-shadow: 0 0 0 3px var(--purple-100); }
.multi-select__menu {
  position: absolute; z-index: 30; top: calc(100% + 4px); left: 0; right: 0; max-height: 260px; overflow-y: auto;
  padding: 6px; background: #fff; border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 8px 24px rgba(17, 12, 46, .12);
}
.multi-select__opt { display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: 6px; font-size: 13px; color: var(--gray-900); cursor: pointer; }
.multi-select__opt:hover { background: var(--purple-50); }
.multi-select__opt input { accent-color: var(--purple-600); width: 15px; height: 15px; margin: 0; }
