/* =========================================================
   CRM Dental - 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;
}

/* ---------- Odontograma ---------- */
.odontograma-wrap {
  overflow-x: auto;
}
.odontograma-svg {
  min-width: 640px;
  max-width: 980px;
  display: block;
  margin: 0 auto;
}
.odontograma-svg .odo-clic {
  cursor: pointer;
}
.odontograma-svg polygon.odo-clic:hover {
  filter: brightness(0.9);
  stroke: var(--tc-primary, #1769AA);
  stroke-width: 2;
}
.odo-leyenda {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  font-size: 0.8125rem;
}
.odo-leyenda-item {
  display: inline-flex;
  align-items: center;
}
.odo-leyenda-color {
  display: inline-block;
  width: 0.85rem;
  height: 0.85rem;
  border-radius: 3px;
  border: 1px solid rgba(0, 0, 0, 0.2);
  margin-right: 0.35rem;
  vertical-align: -0.1rem;
}

/* ---------- Archivos del paciente ---------- */
.archivo-card .archivo-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 160px;
  background: var(--bs-tertiary-bg, #f3f5f6);
  border-top-left-radius: inherit;
  border-top-right-radius: inherit;
  overflow: hidden;
  font-size: 3rem;
  color: #C92A2A;
}
.archivo-card .archivo-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ---------- Agenda (FullCalendar con el estilo del tema) ---------- */
#calendario {
  --fc-border-color: var(--tc-border, #e5e9ea);
  --fc-today-bg-color: rgba(23, 105, 170, 0.06);
  --fc-button-bg-color: var(--tc-primary, #1769AA);
  --fc-button-border-color: var(--tc-primary, #1769AA);
  --fc-button-hover-bg-color: color-mix(in srgb, var(--tc-primary) 85%, #000);
  --fc-button-hover-border-color: color-mix(in srgb, var(--tc-primary) 85%, #000);
  --fc-button-active-bg-color: color-mix(in srgb, var(--tc-primary) 72%, #000);
  --fc-button-active-border-color: color-mix(in srgb, var(--tc-primary) 72%, #000);
  font-size: 0.875rem;
}
#calendario .fc-toolbar-title {
  font-size: 1.15rem;
  text-transform: capitalize;
}
#calendario .fc-event {
  cursor: pointer;
}
#calendario .cita-cancelada .fc-event-title,
#calendario .cita-no-asistio .fc-event-title {
  text-decoration: line-through;
}

/* ---------- 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;
  }
  .odontograma-svg {
    min-width: 0;
  }
}

/* Enlaces de días en la agenda sin subrayado */
#calendario a {
  text-decoration: none;
}
.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;
}
.paso-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 50%;
  background: var(--tc-primary, #1769AA);
  color: #fff;
  font-size: 0.85rem;
  margin-right: 0.5rem;
}
.paso-bloqueado {
  opacity: 0.45;
  pointer-events: none;
}
.opciones-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.75rem;
}
.opcion-card,
.dia-chip,
.hora-chip {
  border: 1px solid var(--tc-border, #dfe5e6);
  background: var(--bs-body-bg, #fff);
  border-radius: 0.75rem;
  text-align: left;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
.opcion-card {
  padding: 0.85rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.opcion-titulo {
  font-weight: 600;
}
.opcion-sub {
  font-size: 0.8125rem;
  color: var(--tc-muted, #6c7a7f);
}
.opcion-card:hover,
.dia-chip:hover,
.hora-chip:hover {
  border-color: var(--tc-primary, #1769AA);
}
.opcion-card.activo,
.dia-chip.activo,
.hora-chip.activo {
  border-color: var(--tc-primary, #1769AA);
  background: rgba(23, 105, 170, 0.08);
  box-shadow: 0 0 0 2px rgba(23, 105, 170, 0.25);
}
.dias-scroll {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding-bottom: 0.25rem;
}
.dia-chip {
  flex: 0 0 auto;
  width: 4.25rem;
  padding: 0.5rem 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.2;
}
.dia-chip strong {
  font-size: 1.2rem;
}
.horas-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 0.5rem;
}
.hora-chip {
  padding: 0.55rem 0;
  text-align: center;
  font-weight: 600;
}
.resumen-reserva {
  position: sticky;
  bottom: 0.75rem;
  z-index: 5;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.08);
}

/* Citas en línea por confirmar en la agenda */
#calendario .cita-por-confirmar {
  background-image: repeating-linear-gradient(45deg, rgba(255,255,255,0.25) 0 6px, transparent 6px 12px);
  border-style: dashed !important;
}

/* 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 Dent — 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;
  }
}
