@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  --fs-bg: #0f172a;
  --fs-panel: #1e293b;
  --fs-panel-deep: #020617;
  --fs-text: #e2e8f0;
  --fs-muted: #94a3b8;
  --fs-border: #334155;
  --fs-primary: #10b981;
  --fs-accent: #22d3ee;
  --fs-danger: #fb7185;
  --fs-radius: 0.75rem;
  --fs-shadow: 0 20px 35px rgba(2, 6, 23, 0.28);
}

/* Fallback local para las utilidades que usa la interfaz. La aplicación no
   depende de que el compilador remoto de Tailwind responda para conservar su
   estructura, legibilidad y controles. */
[hidden], .hidden { display: none !important; }
*, *::before, *::after { box-sizing: border-box; }
html { min-width: 320px; background: var(--fs-bg); }
body { margin: 0; min-width: 320px; background: var(--fs-bg); color: var(--fs-text); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }
.relative { position: relative; }
.absolute { position: absolute; }
.fixed { position: fixed; }
.sticky { position: sticky; }
.inset-0 { inset: 0; }
.top-0 { top: 0; }
.z-20 { z-index: 20; }
.z-50 { z-index: 50; }
.z-\[100\] { z-index: 100; }
.block { display: block; }
.inline-block { display: inline-block; }
.flex { display: flex; }
.inline-flex { display: inline-flex; }
.grid { display: grid; }
.flex-col { flex-direction: column; }
.flex-row { flex-direction: row; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-stretch { align-items: stretch; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.flex-1 { flex: 1 1 0%; }
.grow { flex-grow: 1; }
.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.col-span-2 { grid-column: span 2 / span 2; }
.col-span-full { grid-column: 1 / -1; }
.gap-2 { gap: .5rem; }
.gap-3 { gap: .75rem; }
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }
.space-y-2 > :not([hidden]) ~ :not([hidden]) { margin-top: .5rem; }
.space-y-1 > :not([hidden]) ~ :not([hidden]) { margin-top: .25rem; }
.space-y-1\.5 > :not([hidden]) ~ :not([hidden]) { margin-top: .375rem; }
.space-y-4 > :not([hidden]) ~ :not([hidden]) { margin-top: 1rem; }
.space-y-5 > :not([hidden]) ~ :not([hidden]) { margin-top: 1.25rem; }
.space-y-6 > :not([hidden]) ~ :not([hidden]) { margin-top: 1.5rem; }
.space-y-8 > :not([hidden]) ~ :not([hidden]) { margin-top: 2rem; }
.w-full { width: 100%; }
.w-8 { width: 2rem; }
.w-10 { width: 2.5rem; }
.w-16 { width: 4rem; }
.w-32 { width: 8rem; }
.w-1\/2 { width: 50%; }
.w-1\/3 { width: 33.333333%; }
.max-w-sm { max-width: 24rem; }
.max-w-md { max-width: 28rem; }
.max-w-2xl { max-width: 42rem; }
.max-w-5xl { max-width: 64rem; }
.min-h-screen { min-height: 100vh; }
.min-w-0 { min-width: 0; }
.h-full { height: 100%; }
.h-10 { height: 2.5rem; }
.h-16 { height: 4rem; }
.h-32 { height: 8rem; }
.h-64 { height: 16rem; }
.aspect-square { aspect-ratio: 1 / 1; }
.shrink-0 { flex-shrink: 0; }
.mx-auto { margin-left: auto; margin-right: auto; }
.mt-1 { margin-top: .25rem; }
.mt-2 { margin-top: .5rem; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: .25rem; }
.mb-2 { margin-bottom: .5rem; }
.mb-3 { margin-bottom: .75rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mb-8 { margin-bottom: 2rem; }
.ml-1 { margin-left: .25rem; }
.ml-2 { margin-left: .5rem; }
.mr-1 { margin-right: .25rem; }
.mr-2 { margin-right: .5rem; }
.p-3 { padding: .75rem; }
.p-4 { padding: 1rem; }
.p-5 { padding: 1.25rem; }
.p-6 { padding: 1.5rem; }
.p-8 { padding: 2rem; }
.px-3 { padding-left: .75rem; padding-right: .75rem; }
.px-4 { padding-left: 1rem; padding-right: 1rem; }
.py-1\.5 { padding-top: .375rem; padding-bottom: .375rem; }
.py-2 { padding-top: .5rem; padding-bottom: .5rem; }
.py-2\.5 { padding-top: .625rem; padding-bottom: .625rem; }
.py-3 { padding-top: .75rem; padding-bottom: .75rem; }
.py-4 { padding-top: 1rem; padding-bottom: 1rem; }
.pt-4 { padding-top: 1rem; }
.pt-6 { padding-top: 1.5rem; }
.pl-4 { padding-left: 1rem; }
.pb-2 { padding-bottom: .5rem; }
.pb-12 { padding-bottom: 3rem; }
.text-left { text-align: left; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.whitespace-nowrap { white-space: nowrap; }
.tracking-wider { letter-spacing: .05em; }
.list-disc { list-style-type: disc; }
.font-sans { font-family: 'Inter', sans-serif; }
.font-mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.font-medium { font-weight: 500; }
.font-bold { font-weight: 700; }
.italic { font-style: italic; }
.uppercase { text-transform: uppercase; }
.leading-none { line-height: 1; }
.text-xs, .text-\[11px\], .text-\[10px\] { font-size: .75rem; line-height: 1rem; }
.text-sm { font-size: .875rem; line-height: 1.25rem; }
.text-lg { font-size: 1.125rem; line-height: 1.75rem; }
.text-xl { font-size: 1.25rem; line-height: 1.75rem; }
.text-2xl { font-size: 1.5rem; line-height: 2rem; }
.text-4xl { font-size: 2.25rem; line-height: 2.5rem; }
.text-white { color: #fff; }
.text-slate-200 { color: #e2e8f0; }
.text-slate-300 { color: #cbd5e1; }
.text-slate-400 { color: #94a3b8; }
.text-slate-500 { color: #64748b; }
.text-emerald-200 { color: #a7f3d0; }
.text-emerald-300 { color: #6ee7b7; }
.text-emerald-400 { color: #34d399; }
.text-cyan-200 { color: #a5f3fc; }
.text-cyan-300 { color: #67e8f9; }
.text-cyan-400 { color: #22d3ee; }
.text-indigo-300 { color: #a5b4fc; }
.text-orange-300 { color: #fdba74; }
.text-amber-200 { color: #fde68a; }
.text-amber-400 { color: #fbbf24; }
.text-rose-300 { color: #fda4af; }
.text-transparent { color: transparent; }
.bg-slate-950 { background-color: #020617; }
.bg-slate-900 { background-color: #0f172a; }
.bg-slate-800 { background-color: #1e293b; }
.bg-slate-700 { background-color: #334155; }
.bg-emerald-600 { background-color: #059669; }
.bg-cyan-900 { background-color: #164e63; }
.bg-emerald-950 { background-color: #022c22; }
.bg-slate-900\/80 { background-color: rgba(15,23,42,.8); }
.bg-slate-950\/80 { background-color: rgba(2,6,23,.8); }
.bg-slate-700\/50 { background-color: rgba(51,65,85,.5); }
.bg-slate-800\/50 { background-color: rgba(30,41,59,.5); }
.bg-indigo-600 { background-color: #4f46e5; }
.bg-indigo-900\/40 { background-color: rgba(49,46,129,.4); }
.bg-indigo-950\/20 { background-color: rgba(30,27,75,.2); }
.bg-amber-600 { background-color: #d97706; }
.bg-amber-950\/20 { background-color: rgba(69,26,3,.2); }
.bg-rose-900\/30 { background-color: rgba(136,19,55,.3); }
.bg-emerald-950\/30 { background-color: rgba(2,44,34,.3); }
.bg-cyan-950\/40 { background-color: rgba(8,47,73,.4); }
.bg-emerald-900\/40 { background-color: rgba(6,78,59,.4); }
.bg-amber-900\/40 { background-color: rgba(120,53,15,.4); }
.bg-cyan-900\/10 { background-color: rgba(22,78,99,.1); }
.border { border-width: 1px; border-style: solid; }
.border-t { border-top-width: 1px; border-top-style: solid; }
.border-b { border-bottom-width: 1px; border-bottom-style: solid; }
.border-slate-600 { border-color: #475569; }
.border-slate-700 { border-color: #334155; }
.border-slate-700\/50 { border-color: rgba(51,65,85,.5); }
.border-emerald-500\/30 { border-color: rgba(16,185,129,.3); }
.border-cyan-500\/20 { border-color: rgba(6,182,212,.2); }
.border-cyan-500\/35 { border-color: rgba(6,182,212,.35); }
.border-indigo-500\/30 { border-color: rgba(99,102,241,.3); }
.border-indigo-500\/50 { border-color: rgba(99,102,241,.5); }
.border-emerald-500\/40 { border-color: rgba(16,185,129,.4); }
.border-amber-500\/40 { border-color: rgba(245,158,11,.4); }
.border-rose-500\/40 { border-color: rgba(244,63,94,.4); }
.border-slate-700\/70 { border-color: rgba(51,65,85,.7); }
.border-orange-500\/40 { border-color: rgba(249,115,22,.4); }
.rounded-lg { border-radius: .5rem; }
.rounded-xl { border-radius: .75rem; }
.rounded-2xl { border-radius: 1rem; }
.rounded-full { border-radius: 9999px; }
.shadow-lg { box-shadow: 0 10px 15px -3px rgba(0,0,0,.25); }
.shadow-2xl { box-shadow: var(--fs-shadow); }
.overflow-hidden { overflow: hidden; }
.overflow-x-auto { overflow-x: auto; }
.overflow-y-auto { overflow-y: auto; }
.object-cover { object-fit: cover; }
.cursor-pointer { cursor: pointer; }
.transform { transform: translateZ(0); }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.text-3xl { font-size: 1.875rem; line-height: 2.25rem; }
.text-md { font-size: 1rem; line-height: 1.5rem; }
.transition-colors, .transition-all, .transition-opacity { transition: all .2s ease; }
.outline-none { outline: none; }
.backdrop-blur-sm { backdrop-filter: blur(4px); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
input, select, textarea { max-width: 100%; border-radius: .5rem; }
input:focus, select:focus, textarea:focus, button:focus-visible { outline: 2px solid rgba(52,211,153,.85); outline-offset: 2px; }
input.bg-slate-900, input.bg-slate-950, input.bg-slate-800, select.bg-slate-900, select.bg-slate-800, textarea.bg-slate-900 { color: #f8fafc; }
.hover\:bg-emerald-500:hover { background-color: #10b981; }
.hover\:bg-slate-700:hover { background-color: #334155; }
.hover\:text-white:hover { color: #fff; }
.hover\:text-emerald-300:hover { color: #6ee7b7; }
.hover\:border-indigo-500:hover { border-color: #6366f1; }
.disabled\:opacity-60:disabled { opacity: .6; }
.hover\:bg-indigo-500:hover { background-color: #6366f1; }
.hover\:bg-cyan-500:hover { background-color: #06b6d4; }
.hover\:bg-amber-500:hover { background-color: #f59e0b; }
.hover\:text-indigo-400:hover { color: #818cf8; }
.hover\:text-cyan-400:hover { color: #22d3ee; }
.hover\:border-cyan-400:hover { border-color: #22d3ee; }
.file\:mr-4::file-selector-button { margin-right: 1rem; }
.file\:py-2::file-selector-button { padding-top: .5rem; padding-bottom: .5rem; }
.file\:px-4::file-selector-button { padding-left: 1rem; padding-right: 1rem; }
.file\:border-0::file-selector-button { border: 0; }
.file\:rounded-lg::file-selector-button { border-radius: .5rem; }
.file\:bg-slate-700::file-selector-button { background: #334155; }
.file\:bg-indigo-600::file-selector-button { background: #4f46e5; }
.file\:text-white::file-selector-button { color: #fff; }
.peer:checked + .peer-checked\:border-emerald-400 { border-color: #34d399; }
.peer:checked + .peer-checked\:bg-emerald-950\/40 { background-color: rgba(2,44,34,.4); }

@media (min-width: 640px) {
  .sm\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
  .sm\:grid-cols-5 { grid-template-columns: repeat(5, minmax(0,1fr)); }
  .sm\:inline { display: inline; }
}
@media (min-width: 768px) {
  .md\:flex-row { flex-direction: row; }
  .md\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .md\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
  .md\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
  .md\:grid-cols-5 { grid-template-columns: repeat(5, minmax(0,1fr)); }
  .md\:grid-cols-6 { grid-template-columns: repeat(6, minmax(0,1fr)); }
  .md\:col-span-1 { grid-column: span 1 / span 1; }
  .md\:items-center { align-items: center; }
}
@media (min-width: 1024px) {
  .lg\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .lg\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
  .lg\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
}

body {
  font-family: 'Inter', sans-serif;
}

/* Custom scrollbar */
::-webkit-scrollbar {
  width: 8px;
}
::-webkit-scrollbar-track {
  background: #0f172a; 
}
::-webkit-scrollbar-thumb {
  background: #334155; 
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: #10b981; 
}

/* Chrome, Safari, Edge, Opera - hide arrows on number inputs */
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* Firefox */
input[type=number] {
  -moz-appearance: textfield;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.animate-fade-in {
  animation: fadeIn 0.4s ease-out forwards;
}

/* Trend indicators */
.trend-up { color: #f87171; font-weight: 700; font-size: 0.75rem; }
.trend-down { color: #34d399; font-weight: 700; font-size: 0.75rem; }
.trend-stable { color: #94a3b8; font-weight: 700; font-size: 0.75rem; }

/* Notes textarea */
.eval-notes-area {
  min-height: 60px;
  resize: vertical;
}

/* AI Menu result */
.ai-menu-content {
  white-space: pre-wrap;
  line-height: 1.7;
  font-size: 0.875rem;
}
.ai-menu-content strong,
.ai-menu-content b {
  color: #34d399;
}

/* Patient card action buttons */
.card-actions {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.2s;
}
.group:hover .card-actions {
  opacity: 1;
}

/* Monthly plan details */
#monthly-plan-result details > summary {
  list-style: none;
}
#monthly-plan-result details > summary::-webkit-details-marker {
  display: none;
}
#monthly-plan-result details > summary::after {
  content: '+';
  float: right;
  color: #94a3b8;
  font-weight: 700;
}
#monthly-plan-result details[open] > summary::after {
  content: '−';
  color: #fbbf24;
}
#monthly-plan-result img {
  min-height: 56px;
}

/* Automatic exercise resources */
.exercise-resource-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 0.75rem;
}

.exercise-resource-card {
  overflow: hidden;
  border: 1px solid #334155;
  border-radius: 0.75rem;
  background: rgba(15, 23, 42, 0.78);
}

.exercise-resource-card summary {
  min-height: 56px;
  padding: 0.85rem 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  list-style: none;
}

.exercise-resource-card summary::-webkit-details-marker {
  display: none;
}

.exercise-resource-card summary small {
  display: block;
  color: #94a3b8;
  font-size: 0.7rem;
  margin-top: 0.2rem;
}

.exercise-resource-card[open] summary {
  border-bottom: 1px solid #334155;
  color: #6ee7b7;
}

.exercise-resource-body {
  display: grid;
  grid-template-columns: minmax(110px, 150px) 1fr;
  gap: 0.9rem;
  padding: 0.9rem;
}

.exercise-resource-media,
.exercise-resource-placeholder {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 0.6rem;
  background: #0f172a;
  color: #34d399;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
}

.exercise-resource-copy {
  color: #cbd5e1;
  font-size: 0.75rem;
  line-height: 1.55;
}

.routine-exercise-cell {
  min-width: 170px;
  vertical-align: middle;
  white-space: normal !important;
}

.routine-exercise-cell > span {
  display: inline-block;
  vertical-align: middle;
  max-width: calc(100% - 58px);
  white-space: normal;
}

.routine-exercise-visual {
  width: 48px;
  height: 48px;
  margin-right: 0.55rem;
  border-radius: 0.45rem;
  object-fit: cover;
  display: inline-block;
  vertical-align: middle;
  background: #0f172a;
  border: 1px solid rgba(52, 211, 153, 0.35);
}

@media (max-width: 520px) {
  .exercise-resource-body {
    grid-template-columns: 1fr;
  }

  .exercise-resource-media,
  .exercise-resource-placeholder {
    max-width: 180px;
  }
}

/* PDF: plantilla oficio con márgenes y saltos controlados */
#pdf-wrapper {
  display: none;
  /* Ancho seguro para que la plantilla completa conserve ambos laterales. */
  width: 580px !important;
  max-width: 580px !important;
  box-sizing: border-box !important;
  background: #ffffff !important;
  color: #1e293b !important;
}

#pdf-content {
  width: 580px !important;
  max-width: 580px !important;
  box-sizing: border-box !important;
  overflow-wrap: break-word;
  word-break: normal;
  white-space: normal;
  background: #ffffff !important;
  color: #1e293b !important;
}

#pdf-content h1,
#pdf-content h2,
#pdf-content h3,
#pdf-content h4,
#pdf-content h5,
#pdf-content p,
#pdf-content li,
#pdf-content td,
#pdf-content th,
#pdf-content span,
#pdf-content strong {
  overflow-wrap: break-word;
  word-break: normal;
  white-space: normal;
}

#pdf-content table {
  width: 100%;
  max-width: 100%;
  table-layout: fixed;
}

#pdf-content td,
#pdf-content th {
  overflow-wrap: break-word;
  word-break: normal;
  white-space: normal;
  vertical-align: top;
}

#pdf-content img {
  max-width: 100%;
}

#pdf-content .html2pdf__page-break {
  page-break-before: always;
  break-before: page;
  height: 0;
}

#pdf-content tr,
#pdf-content section,
#pdf-content [style*="page-break-inside"] {
  page-break-inside: avoid;
  break-inside: avoid;
}

/* Mantener cada sesión y cada semana como unidad al exportar. El motor puede
   mover el bloque completo a la página siguiente en lugar de cortarlo. */
#pdf-content #pdf-routine > div,
#pdf-content .pdf-keep-together {
  page-break-inside: avoid;
  break-inside: avoid;
}

/* Una semana completa del calendario puede ser más alta que una página carta.
   No se debe forzar como una sola pieza: se conservan las filas y se permite
   continuar en la página siguiente sin cortar el contenido de una comida. */
#pdf-content #pdf-monthly-content > section {
  page-break-inside: auto;
  break-inside: auto;
}

#pdf-content #pdf-monthly-content tr {
  page-break-inside: avoid;
  break-inside: avoid;
}

#pdf-content table {
  page-break-before: auto;
  page-break-after: auto;
}

/* Captura PDF: el documento completo debe caber, no ser recortado.
   Se usa un ancho de 600px y márgenes iguales en html2pdf. Estas reglas
   neutralizan los mínimos automáticos de flexbox/tablas que podían empujar
   el logo, el borde o la última columna fuera del lienzo. */
#pdf-wrapper.pdf-capture-stage {
  width: 580px !important;
  max-width: 580px !important;
  left: 0 !important;
  right: auto !important;
  transform: none !important;
  overflow: visible !important;
}

#pdf-content.pdf-capture-fit,
#pdf-content.pdf-capture-fit * {
  box-sizing: border-box !important;
  min-width: 0 !important;
  overflow-wrap: anywhere !important;
  word-break: normal !important;
}

#pdf-content.pdf-capture-fit {
  width: 580px !important;
  max-width: 580px !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
  overflow: visible !important;
}

#pdf-content.pdf-capture-fit table,
#pdf-content.pdf-capture-fit img,
#pdf-content.pdf-capture-fit section,
#pdf-content.pdf-capture-fit [style*="width: 100%"] {
  max-width: 100% !important;
}

#pdf-content.pdf-capture-fit table {
  width: 100% !important;
  table-layout: fixed !important;
}

#pdf-content.pdf-capture-fit img {
  height: auto;
  object-fit: contain;
}

#pdf-content.pdf-capture-fit [style*="display: flex"] {
  max-width: 100% !important;
  min-width: 0 !important;
}

#pdf-content.pdf-capture-fit [style*="display: flex"] > * {
  min-width: 0 !important;
  max-width: 100% !important;
}

/* PDF profesional: Times New Roman a 10px, ancho seguro y flujo continuo.
   El tamaño uniforme evita que el motor recorte el extremo derecho; los
   encabezados conservan jerarquía sin aumentar el cuerpo del documento. */
#pdf-content.pdf-type-10,
#pdf-content.pdf-type-10 * {
  font-family: 'Times New Roman', Times, serif !important;
  font-size: 10px !important;
  line-height: 1.25 !important;
  overflow-wrap: anywhere !important;
  word-break: normal !important;
  white-space: normal !important;
}

#pdf-content.pdf-type-10 {
  overflow: visible !important;
}

#pdf-content.pdf-type-10 h1 { font-size: 17px !important; line-height: 1.15 !important; }
#pdf-content.pdf-type-10 h2 { font-size: 14px !important; line-height: 1.2 !important; }
#pdf-content.pdf-type-10 h3 { font-size: 12px !important; line-height: 1.2 !important; }
#pdf-content.pdf-type-10 h4 { font-size: 11px !important; line-height: 1.2 !important; }

#pdf-content.pdf-type-10 table,
#pdf-content.pdf-type-10 img,
#pdf-content.pdf-type-10 section,
#pdf-content.pdf-type-10 div {
  max-width: 100% !important;
  box-sizing: border-box !important;
}

#pdf-content.pdf-type-10 table {
  table-layout: fixed !important;
  border-collapse: collapse !important;
}

/* Nunca se corta una fila ni una imagen; los bloques largos sí pueden
   continuar naturalmente en la página siguiente. */
#pdf-content.pdf-type-10 tr,
#pdf-content.pdf-type-10 img {
  page-break-inside: avoid !important;
  break-inside: avoid !important;
}

#pdf-content.pdf-type-10 .pdf-keep-together {
  page-break-inside: auto !important;
  break-inside: auto !important;
  overflow: visible !important;
}

/* El calendario mensual usa otra raíz de captura, pero debe conservar la
   misma tipografía y el mismo ancho seguro del reporte principal. */
#monthly-plan-result.pdf-monthly-capture,
#monthly-plan-result.pdf-monthly-capture * {
  font-family: 'Times New Roman', Times, serif !important;
  font-size: 10px !important;
  line-height: 1.25 !important;
  overflow-wrap: anywhere !important;
  word-break: normal !important;
  white-space: normal !important;
  box-sizing: border-box !important;
}

#monthly-plan-result.pdf-monthly-capture table {
  width: 100% !important;
  max-width: 100% !important;
  table-layout: fixed !important;
  border-collapse: collapse !important;
}

/* Ningún bloque flex puede empujar texto fuera del lienzo de captura. Si una
   fila es demasiado ancha, sus elementos bajan de línea conservando todo el
   contenido en vez de desaparecer por el borde derecho. */
#pdf-content.pdf-capture-fit [style*="display: flex"] {
  display: flex !important;
  flex-wrap: wrap !important;
  max-width: 100% !important;
  width: 100% !important;
}

#pdf-content.pdf-capture-fit [style*="display: flex"] > * {
  flex: 1 1 auto !important;
  min-width: 0 !important;
  max-width: 100% !important;
  overflow-wrap: anywhere !important;
}

#monthly-plan-result.pdf-monthly-capture [style*="display: flex"] {
  flex-wrap: wrap !important;
  max-width: 100% !important;
}