/* =========================================================
   Kernel Escolar - estilos propios (se carga después de main.css)
   ========================================================= */

/* Tablas dentro de cards: solo scroll horizontal, nunca vertical */
.card > .table-responsive {
  overflow-y: hidden;
}

/* ---------- Pestañas con muchas opciones: scroll horizontal ---------- */
.tc-tabs-scroll {
  flex-wrap: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
}
.tc-tabs-scroll .nav-link {
  white-space: nowrap;
}

/* ---------- Hojas de impresión ---------- */
.hoja-impresion {
  max-width: 900px;
  margin: 0 auto;
}
.hoja-encabezado {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 2px solid var(--tc-primary, #1769AA);
  padding-bottom: 0.75rem;
  margin-bottom: 1rem;
  font-size: 0.8125rem;
}
.hoja-clinica {
  font-size: 1.35rem;
  margin: 0 0 0.25rem;
}
.hoja-titulo {
  font-size: 1.1rem;
  margin: 0 0 0.25rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.hoja-seccion {
  margin-bottom: 1.25rem;
}
.hoja-seccion h3 {
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--tc-border, #e5e9ea);
  padding-bottom: 0.25rem;
  margin-bottom: 0.75rem;
}
.hoja-datos {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 2rem;
  margin-bottom: 0.75rem;
}
.hoja-datos dt {
  font-size: 0.7rem;
  text-transform: uppercase;
  color: var(--tc-muted, #6c7a7f);
  margin: 0;
}
.hoja-datos dd {
  margin: 0;
  font-weight: 600;
}
.hoja-kv {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 0.35rem 1rem;
}
.hoja-kv dt {
  font-weight: 600;
}
.hoja-kv dd {
  margin: 0;
}
.hoja-alerta {
  border: 1px solid #E03131;
  color: #C92A2A;
  border-radius: 6px;
  padding: 0.4rem 0.6rem;
}
.hoja-nota {
  border-left: 3px solid var(--tc-primary, #1769AA);
  padding-left: 0.75rem;
  margin-bottom: 0.75rem;
  break-inside: avoid;
}
.hoja-receta {
  font-size: 1.05rem;
  line-height: 1.8;
  min-height: 180px;
}
.hoja-tabla th,
.hoja-tabla td {
  padding: 0.4rem 0.5rem;
}
.hoja-firma {
  margin: 3rem auto 0;
  max-width: 320px;
  text-align: center;
}
.hoja-firmas {
  display: flex;
  justify-content: space-around;
  gap: 2rem;
  margin-top: 3.5rem;
  text-align: center;
}
.hoja-firmas > div {
  flex: 1;
  max-width: 300px;
}
.hoja-linea {
  border-top: 1px solid #333;
  margin-bottom: 0.35rem;
}

@media print {
  @page { margin: 12mm; }
  .tc-sidebar,
  .tc-topbar,
  .tc-footer,
  .tc-backdrop,
  .tc-skip-link,
  .no-imprimir,
  .swal2-container {
    display: none !important;
  }
  html, body, .tc-app, .tc-main, .tc-content {
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
    background: #fff !important;
    min-height: 0 !important;
  }
  .hoja-impresion {
    border: 0 !important;
    box-shadow: none !important;
    max-width: none;
  }
  .hoja-impresion .card-body {
    padding: 0 !important;
  }
}

.cuenta-resumen {
  grid-template-columns: 1fr auto;
}

/* ---------- Páginas públicas (agenda en línea y portal) ---------- */
body.publico {
  background: var(--tc-bg, #f5f4f0);
  min-height: 100vh;
}
.publico-contenedor {
  max-width: 980px;
  margin: 0 auto;
  padding-left: 1rem;
  padding-right: 1rem;
}
.publico-cabecera {
  background: var(--bs-body-bg, #fff);
  border-bottom: 1px solid var(--tc-border, #e5e9ea);
  padding: 0.85rem 0;
}
/* Pie de las hojas de impresión */
.hoja-pie {
  margin: 2rem 0 0;
  font-size: 0.7rem;
  color: var(--tc-muted, #6c7a7f);
  text-align: center;
}

/* =====================================================================
   Identidad Kernel Escolar — paleta y tipografía
   Azul profundo #102B46 · Azul tecnológico #1769AA · Turquesa #20B7B0
   Gris hielo #F3F6FA · Blanco #FFFFFF · Firma ámbar #F59E0B
   Sobrescribe los tokens del tema (main.css) sin modificarlo.
   ===================================================================== */
@font-face { font-family: "Manrope"; font-style: normal; font-weight: 600; font-display: swap; src: url("../fonts/manrope-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Manrope"; font-style: normal; font-weight: 700; font-display: swap; src: url("../fonts/manrope-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Manrope"; font-style: normal; font-weight: 800; font-display: swap; src: url("../fonts/manrope-latin-800-normal.woff2") format("woff2"); }

:root {
  --kd-navy: #102B46;
  --kd-blue: #1769AA;
  --kd-teal: #20B7B0;
  --kd-ice: #F3F6FA;
  --kd-amber: #F59E0B;
  --tc-font-ui: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --tc-font-display: "Manrope", "Inter", system-ui, sans-serif;
}

:root,
[data-bs-theme=light] {
  --tc-bg: #F3F6FA;
  --tc-bg-rgb: 243, 246, 250;
  --tc-surface: #FFFFFF;
  --tc-surface-rgb: 255, 255, 255;
  --tc-surface-2: #EEF2F7;
  --tc-surface-3: #E2E8F0;
  --tc-border: #E3E8EF;
  --tc-border-strong: #CBD5E1;
  --tc-input-border: #7E8B9C;
  --tc-heading: #102B46;
  --tc-heading-rgb: 16, 43, 70;
  --tc-body: #3A4B5E;
  --tc-body-rgb: 58, 75, 94;
  --tc-muted: #5B6B7D;
  --tc-muted-rgb: 91, 107, 125;
  --tc-primary: #1769AA;
  --tc-primary-rgb: 23, 105, 170;
  --tc-primary-contrast: #FFFFFF;
  --tc-accent: #20B7B0;
  --tc-accent-contrast: #06302E;
  --tc-accent-text: #0E7C77;
  --tc-accent-ui: #13918B;
  --tc-info: #0E7C77;
  --tc-info-rgb: 14, 124, 119;
  --tc-scrim: #07131F;
  --tc-brand-ink: #102B46;
  --tc-brand-ink-fg: #E8F1F8;
  --tc-shadow-1: 0 1px 2px rgb(16 43 70 / 6%);
  --tc-shadow-2: 0 8px 20px -6px rgb(16 43 70 / 16%), 0 2px 4px rgb(16 43 70 / 4%);
  --tc-shadow-3: 0 24px 48px -12px rgb(16 43 70 / 26%), 0 4px 8px rgb(16 43 70 / 6%);
  --tc-glyph-knob: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%235B6B7D'/%3e%3c/svg%3e");
  --tc-glyph-knob-focus: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%231769AA'/%3e%3c/svg%3e");
  --tc-glyph-select: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%235B6B7D' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
}

[data-bs-theme=dark] {
  --tc-bg: #0A1521;
  --tc-bg-rgb: 10, 21, 33;
  --tc-surface: #10202F;
  --tc-surface-rgb: 16, 32, 47;
  --tc-surface-2: #152839;
  --tc-surface-3: #1D3448;
  --tc-border: #1D3245;
  --tc-border-strong: #2B4660;
  --tc-input-border: #5E7690;
  --tc-heading: #EAF2FA;
  --tc-heading-rgb: 234, 242, 250;
  --tc-body: #B4C3D3;
  --tc-body-rgb: 180, 195, 211;
  --tc-muted: #8A9BB0;
  --tc-muted-rgb: 138, 155, 176;
  --tc-primary: #5AAEEB;
  --tc-primary-rgb: 90, 174, 235;
  --tc-primary-contrast: #04182A;
  --tc-accent: #3DD6CE;
  --tc-accent-contrast: #04211F;
  --tc-accent-text: #3DD6CE;
  --tc-accent-ui: #3DD6CE;
  --tc-info: #3DD6CE;
  --tc-info-rgb: 61, 214, 206;
  --tc-brand-ink: #0B1E31;
  --tc-brand-ink-fg: #E8F1F8;
  --tc-glyph-check: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3e%3cpath fill='none' stroke='%2304182A' stroke-linecap='round' stroke-linejoin='round' stroke-width='3' d='m6 10 3 3 6-6'/%3e%3c/svg%3e");
  --tc-glyph-dash: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3e%3cpath fill='none' stroke='%2304182A' stroke-linecap='round' stroke-width='3' d='M6 10h8'/%3e%3c/svg%3e");
  --tc-glyph-radio: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='2' fill='%2304182A'/%3e%3c/svg%3e");
  --tc-glyph-knob: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%238A9BB0'/%3e%3c/svg%3e");
  --tc-glyph-knob-focus: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%235AAEEB'/%3e%3c/svg%3e");
  --tc-glyph-knob-on: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%2304182A'/%3e%3c/svg%3e");
  --tc-glyph-select: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%238A9BB0' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
}

/* Menú lateral en azul profundo (los colores del menú se reasignan solo dentro de él) */
.tc-sidebar {
  --tc-surface: #102B46;
  --tc-surface-rgb: 16, 43, 70;
  --tc-border: rgba(255, 255, 255, 0.08);
  --tc-heading: #FFFFFF;
  --tc-heading-rgb: 255, 255, 255;
  --tc-body: #C9D6E3;
  --tc-muted: #8FA6BD;
  --tc-primary: #5AAEEB;
  --tc-primary-text: #7CC4F2;
  --tc-active-bg: rgba(90, 174, 235, 0.16);
  --tc-hover: rgba(255, 255, 255, 0.07);
  --tc-pressed: rgba(255, 255, 255, 0.10);
  --tc-accent: #20B7B0;
  background: linear-gradient(180deg, #12304E 0%, #102B46 55%, #0D243B 100%);
  border-color: transparent;
  color: var(--tc-body);
}
[data-bs-theme=dark] .tc-sidebar {
  --tc-surface: #0B1E31;
  background: linear-gradient(180deg, #0D2238 0%, #0B1E31 100%);
  border-color: var(--tc-border);
}
.tc-sidebar .tc-brand .text-primary { color: #3DD6CE !important; }
.tc-sidebar .tc-drawer-close { color: #C9D6E3; }

/* Tipografía de marca */
.tc-brand { font-family: var(--tc-font-display); font-weight: 800; letter-spacing: -0.02em; }
h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6,
.tc-page-title, .modal-title { font-family: var(--tc-font-display); letter-spacing: -0.01em; }

/* Impresión: los documentos salen con la paleta de la marca */
@media print {
  :root, [data-bs-theme] {
    --tc-primary: #1769AA;
    --tc-primary-rgb: 23, 105, 170;
    --tc-heading: #102B46;
  }
}

/* ---------- Kernel Escolar ---------- */
@media print {
  /* Cada boleta o recibo en su propia hoja */
  .hoja-impresion + .hoja-impresion { break-before: page; margin-top: 0 !important; }
  .hoja-tabla { font-size: 0.8rem; }
}
.hoja-tabla thead th { background: var(--tc-surface-2, #EEF2F7); }
.inp-calif { font-weight: 600; }
.demo-accesos { border-style: dashed; }

/* ---------- Fase 2: tablero de admisiones ---------- */
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(230px, 1fr); gap: 0.75rem; overflow-x: auto; padding-bottom: 0.5rem; }
.kanban-col { background: var(--tc-surface-2); border: 1px solid var(--tc-border); border-radius: var(--tc-radius-lg); display: flex; flex-direction: column; min-height: 320px; transition: background .15s var(--tc-ease, ease); }
.kanban-col.sobre { background: var(--tc-active-bg, var(--tc-surface-3)); outline: 2px dashed var(--tc-primary); outline-offset: -4px; }
.kanban-head { display: flex; justify-content: space-between; align-items: center; padding: 0.75rem 0.9rem; font-weight: 600; color: var(--tc-heading); border-bottom: 1px solid var(--tc-border); }
.kanban-body { padding: 0.6rem; display: flex; flex-direction: column; gap: 0.5rem; max-height: 560px; overflow-y: auto; }
.kanban-card { position: relative; background: var(--tc-surface); border: 1px solid var(--tc-border); border-radius: var(--tc-radius); padding: 0.65rem 0.75rem; display: flex; flex-direction: column; gap: 0.15rem; box-shadow: var(--tc-shadow-1, 0 1px 2px rgba(16,43,70,.06)); }
.kanban-card[draggable="true"] { cursor: grab; }
.kanban-card.arrastrando { opacity: .45; }
.kanban-card:hover { border-color: var(--tc-border-strong); }
.kanban-title { font-weight: 600; color: var(--tc-heading); text-decoration: none; }
.kanban-sub { font-size: .8rem; color: var(--tc-muted); }
.kanban-meta { display: flex; flex-wrap: wrap; gap: .25rem; margin-top: .35rem; position: relative; z-index: 2; }
.kanban-vacio { font-size: .85rem; color: var(--tc-muted); text-align: center; margin: 1rem 0; }

/* Etapas del prospecto */
.etapas-prospecto { list-style: none; display: flex; flex-wrap: wrap; gap: .5rem; margin: 0; padding: 0; }
.etapas-prospecto li { flex: 1 1 120px; }
.etapas-prospecto li > button, .etapas-prospecto li > span { width: 100%; display: flex; align-items: center; gap: .5rem; padding: .55rem .75rem; border-radius: var(--tc-radius); border: 1px solid var(--tc-border); background: var(--tc-surface); color: var(--tc-body); font-weight: 600; font-size: .9rem; text-align: left; }
.etapas-prospecto li > button:hover { border-color: var(--tc-primary); color: var(--tc-primary); }
.etapas-prospecto .etapa-num { display: inline-grid; place-items: center; width: 1.6rem; height: 1.6rem; border-radius: 50%; background: var(--tc-surface-2); font-size: .8rem; flex: none; }
.etapas-prospecto li.hecha > * { color: var(--tc-success); }
.etapas-prospecto li.hecha .etapa-num { background: var(--tc-success); color: #fff; }
.etapas-prospecto li.actual > * { border-color: var(--tc-primary); background: var(--tc-primary); color: #fff; }
.etapas-prospecto li.actual .etapa-num { background: rgba(255,255,255,.25); color: #fff; }

/* Línea de tiempo del seguimiento */
.timeline-seg { list-style: none; margin: 0; padding: 0; }
.timeline-seg li { display: flex; gap: .75rem; padding: .6rem 0; border-bottom: 1px solid var(--tc-border); }
.timeline-seg li:last-child { border-bottom: 0; }

/* Calendario de avisos */
.calendario-mes { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-top: 1px solid var(--tc-border); }
.cal-dia-semana { padding: .5rem; font-size: .75rem; font-weight: 600; text-transform: uppercase; color: var(--tc-muted); border-bottom: 1px solid var(--tc-border); }
.cal-dia { min-height: 96px; padding: .35rem; border-right: 1px solid var(--tc-border); border-bottom: 1px solid var(--tc-border); display: flex; flex-direction: column; gap: .2rem; }
.cal-dia:nth-child(7n) { border-right: 0; }
.cal-dia.otro-mes { background: var(--tc-surface-2); color: var(--tc-muted); }
.cal-dia.fin { background: var(--tc-surface-2); }
.cal-dia.hoy .cal-num { background: var(--tc-primary); color: #fff; border-radius: 50%; width: 1.6rem; height: 1.6rem; display: inline-grid; place-items: center; }
.cal-num { font-size: .8rem; font-weight: 600; }
.cal-evento { display: block; font-size: .72rem; line-height: 1.25; padding: .15rem .35rem; border-radius: 4px; text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #fff; background: var(--tc-info); }
.cal-evento.success { background: var(--tc-success); }
.cal-evento.danger { background: var(--tc-danger); }
.cal-evento.primary { background: var(--tc-primary); }
@media (max-width: 767.98px) { .cal-dia { min-height: 64px; } .cal-evento { font-size: .62rem; } }

/* Portal: fecha de evento */
.fecha-chip { display: inline-flex; flex-direction: column; align-items: center; justify-content: center; min-width: 3rem; padding: .3rem; border-radius: var(--tc-radius); background: var(--tc-surface-2); font-size: .7rem; text-transform: uppercase; line-height: 1.1; }
.fecha-chip strong { font-size: 1.2rem; }
.fecha-chip.danger { background: rgba(220, 53, 69, .12); color: var(--tc-danger); }
.fecha-chip.success { background: rgba(25, 135, 84, .12); color: var(--tc-success); }

/* Pase de lista */
.asistencia-opciones .btn { min-width: 2.4rem; }
.reporte-asistencia td, .reporte-asistencia th { font-size: .78rem; padding: .25rem .3rem; }
.aviso-extracto { color: var(--tc-muted); }
body.embebido main { padding-top: 0 !important; }
@media print {
  .reporte-asistencia td, .reporte-asistencia th { font-size: .62rem; padding: .1rem; }
}
