/* ==========================================================================
   VISTA DETALLADA WORD A4 EN VIVO (SABIATEC)
   Emulación fiel de documento Word A4 (2.54cm / 1" márgenes, APA 7)
   Tablas dinámicas, fórmulas matemáticas en Cambria Math, gestores de citas,
   Modo Estudio (criterios de formulación) y Modo Revisión (dictamen asesor)
   ========================================================================== */

:root {
  --theme-text: var(--text-primary);
  --theme-text-muted: var(--text-secondary);
  --theme-border: var(--border-subtle);
  --theme-border-subtle: var(--border-subtle);
  --theme-card: var(--bg-surface);
  --theme-primary: var(--primary);
  --theme-bg: var(--bg-base);
  --theme-pill-bg: var(--bg-elevated);
}

/* Modal Overlay Especial para la Vista de Word A4 */
.modal-word-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: var(--overlay);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1060;
  padding: 16px;
  box-sizing: border-box;
}

.word-modal-dialog {
  background: var(--theme-card);
  border: 1px solid var(--theme-border);
  border-radius: 16px;
  width: 96vw;
  max-width: 1420px;
  height: 94vh;
  max-height: 94vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.08);
  overflow: hidden;
  position: relative;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Modal en Pantalla Completa Total */
.modal-word-backdrop.modal-is-fullscreen {
  padding: 0 !important;
}

.modal-word-backdrop.modal-is-fullscreen .word-modal-dialog {
  width: 100vw !important;
  max-width: 100vw !important;
  height: 100vh !important;
  max-height: 100vh !important;
  border-radius: 0 !important;
  border: none !important;
  box-shadow: none !important;
}

.modal-word-backdrop.modal-is-fullscreen .word-modal-header {
  display: none !important;
}

.word-modal-header {
  padding: 12px 20px;
  border-bottom: 1px solid var(--theme-border);
  background: var(--theme-card);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-shrink: 0;
}

.word-modal-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.bitacora-pill-fase {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 6px;
  background: linear-gradient(135deg, #0284c7, #2563eb);
  color: #fff;
  letter-spacing: 0.5px;
  flex-shrink: 0;
}

.word-modal-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--theme-text);
  margin: 0;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.word-modal-sub {
  font-size: 11.5px;
  color: var(--theme-text-muted);
  line-height: 1.3;
}

.word-modal-header-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.bitacora-status-chip {
  font-size: 11.5px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 6px;
  background: var(--theme-card);
  border: 1px solid var(--theme-border);
  color: var(--theme-text-muted);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.bitacora-status-chip.aprobado {
  background: rgba(16, 185, 129, 0.12);
  color: #10b981;
  border-color: rgba(16, 185, 129, 0.25);
}

.btn-word-sync {
  height: 32px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid var(--theme-border);
  background: var(--theme-card);
  color: var(--theme-text-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  transition: all 0.15s ease;
}

.btn-word-sync:hover {
  background: rgba(2, 132, 199, 0.12);
  color: var(--theme-primary);
  border-color: rgba(2, 132, 199, 0.35);
}

.btn-word-sync.is-syncing svg {
  animation: wordSpin 0.75s linear infinite;
}

@keyframes wordSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.btn-word-fs, .btn-word-close {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--theme-border);
  background: var(--theme-card);
  color: var(--theme-text-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.btn-word-fs:hover {
  background: rgba(2, 132, 199, 0.12);
  color: var(--theme-primary);
  border-color: rgba(2, 132, 199, 0.35);
}

.btn-word-close:hover {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.3);
}

.word-modal-body {
  flex: 1 1 0%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  background: var(--theme-bg);
}


    /* ==========================================================================
       TIPOGRAFÍA EDITORIAL UNIVERSITARIA (DISEÑO WORD / TESIS)
       ========================================================================== */
    .bitacora-editorial-h1-block {
      margin: 24px 0 16px 0;
      text-align: center;
    }
    .doc-editorial-h1 {
      font-size: 1.25rem;
      font-weight: 800;
      text-transform: uppercase;
      text-align: center;
      color: var(--theme-text);
      letter-spacing: 0.5px;
      line-height: 1.4;
      margin: 0;
      padding: 6px 0;
    }
    .bitacora-editorial-h2-block {
      margin: 22px 0 10px 0;
    }
    .doc-editorial-h2 {
      font-size: 1.08rem;
      font-weight: 700;
      color: var(--theme-text);
      line-height: 1.45;
      margin: 0;
      padding-bottom: 6px;
      border-bottom: 1px solid var(--theme-border);
    }
    .bitacora-editorial-h3-block {
      margin: 16px 0 8px 0;
    }
    .doc-editorial-h3 {
      font-size: 1rem;
      font-weight: 700;
      color: var(--theme-text);
      line-height: 1.4;
      margin: 0;
    }
    .bitacora-editorial-separator {
      margin: 18px 0;
    }
    .doc-editorial-hr {
      border: 0;
      height: 1px;
      background: var(--theme-border);
      margin: 0;
    }
    .bitacora-editorial-li-block {
      display: flex;
      align-items: baseline;
      gap: 12px;
      margin-bottom: 14px;
      line-height: 1.68;
      font-size: 0.96rem;
      color: var(--theme-text);
    }
    .doc-editorial-li-content {
      display: flex;
      align-items: baseline;
      gap: 10px;
      flex: 1;
    }
    .doc-editorial-bullet {
      color: var(--cyan, #06b6d4);
      font-size: 1.2rem;
      line-height: 1;
      user-select: none;
    }
    .doc-editorial-paragraph {
      font-size: 0.96rem;
      line-height: 1.75;
      color: var(--theme-text);
      text-align: justify;
      margin-bottom: 18px;
    }
    .doc-editorial-text strong,
    .doc-editorial-li-content strong {
      font-weight: 700;
      color: var(--theme-text);
    }
    .doc-editorial-text em,
    .doc-editorial-li-content em {
      font-style: italic;
    }
    .doc-citation-chip {
      background: rgba(6, 182, 212, 0.12);
      color: var(--cyan, #06b6d4);
      border: 1px solid rgba(6, 182, 212, 0.28);
      border-radius: 4px;
      padding: 1px 6px;
      font-size: 0.85em;
      font-weight: 700;
      font-family: var(--font-mono, monospace);
      display: inline-block;
      margin: 0 2px;
      vertical-align: baseline;
    }
    /* La hoja imita a Word: sin «text-wrap: pretty» global, que con texto justificado hace que Chrome estire la última línea */
    .word-sheet-paper p, .word-sheet-paper li { text-wrap: wrap; }
    .word-titulo-pendiente {
      font-size: 0.8em;
      font-style: italic;
      font-weight: 600;
      color: var(--wv-cita-huerfana);
      text-transform: none;
    }
    /* Cita APA como saldrá en el Word: mismo texto del párrafo, sin cajas que deformen el justificado */
    .doc-cita-apa {
      text-decoration: underline dotted;
      text-decoration-color: var(--primary);
      text-underline-offset: 3px;
      cursor: help;
    }
    :root { --wv-cita-huerfana: #b91c1c; }      /* 6,5:1 sobre el papel blanco */
    :root[data-theme="dark"] { --wv-cita-huerfana: #fca5a5; }
    @media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --wv-cita-huerfana: #fca5a5; } }
    .doc-cita-huerfana {
      color: var(--wv-cita-huerfana);
      text-decoration: underline wavy var(--wv-cita-huerfana);
      text-underline-offset: 3px;
      font-weight: 700;
      cursor: help;
    }
    :root[data-theme="dark"] .doc-citation-chip, body.theme-dark .doc-citation-chip,
    html.theme-dark .doc-citation-chip,
    .theme-dark .doc-citation-chip {
      background: rgba(6, 182, 212, 0.2) !important;
      color: #22d3ee !important;
      border: 1px solid rgba(34, 211, 238, 0.35) !important;
    }

    /* =========================================================================
       MAQUETA OFICIAL DE HOJA DE WORD A4 (VISTA EDITORIAL UNIVERSITARIA)
       ========================================================================= */
    .word-sheet-desk {
      background: #e2e8f0;
      border: 1px solid var(--theme-border);
      border-radius: 12px;
      padding: 16px;
      overflow-x: auto;
      transition: background 0.2s ease;
    }
    :root[data-theme="dark"] .word-sheet-desk , body.theme-dark .word-sheet-desk {
      background: var(--bg-base) !important;
      border-color: rgba(67, 160, 185, 0.25) !important;
    }

    /* Barra Superior de Herramientas de Word */
    .word-doc-toolbar {
      background: var(--theme-card, #ffffff);
      border: 1px solid var(--theme-border, #cbd5e1);
      border-radius: 9px;
      padding: 8px 14px;
      margin-bottom: 16px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      flex-wrap: wrap;
      box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
    }
    .wdt-left {
      display: flex;
      align-items: center;
      gap: 12px;
      flex: 1;
      min-width: 0;
    }
    .wdt-chapter-label {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      font-size: 11.5px;
      font-weight: 700;
      color: var(--theme-primary, #0284c7);
      text-transform: uppercase;
      letter-spacing: 0.5px;
      flex-shrink: 0;
    }
    .wdt-chapters-scroll {
      display: flex;
      align-items: center;
      gap: 6px;
      overflow-x: auto;
      scrollbar-width: thin;
      padding-bottom: 2px;
    }
    .wdt-cap-pill {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      padding: 4px 10px;
      font-size: 11.5px;
      font-weight: 600;
      border-radius: 6px;
      background: rgba(0, 0, 0, 0.03);
      color: var(--theme-text-muted);
      border: 1px solid var(--theme-border);
      cursor: pointer;
      white-space: nowrap;
      transition: all 0.15s ease;
    }
    .wdt-cap-pill:hover {
      background: var(--theme-card);
      color: var(--theme-text);
      border-color: var(--theme-primary);
    }
    .wdt-cap-pill.active {
      background: #0284c7;
      color: #ffffff;
      border-color: #0284c7;
      font-weight: 700;
      box-shadow: 0 2px 6px rgba(2, 132, 199, 0.3);
    }
    .wdt-cap-dot {
      width: 6px;
      height: 6px;
      border-radius: 50%;
      background: currentColor;
      opacity: 0.7;
    }
    .wdt-cap-active-badge {
      font-size: 9.5px;
      text-transform: uppercase;
      letter-spacing: 0.3px;
      background: rgba(255, 255, 255, 0.25);
      padding: 1px 5px;
      border-radius: 4px;
      margin-left: 2px;
    }
    .wdt-center {
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 12px;
      flex: 1;
      min-width: 0;
    }
    .wdt-right {
      display: flex;
      align-items: center;
      gap: 8px;
      flex-shrink: 0;
    }

    /* Control de Zoom Estilo Office / Google Docs */
    .wdt-zoom-control {
      display: inline-flex;
      align-items: center;
      background: var(--theme-pill-bg, #f1f5f9);
      border: 1px solid var(--theme-border, #cbd5e1);
      border-radius: 7px;
      padding: 1px 3px;
      user-select: none;
    }
    :root[data-theme="dark"] .wdt-zoom-control , body.theme-dark .wdt-zoom-control {
      background: rgba(255, 255, 255, 0.05);
      border-color: rgba(67, 160, 185, 0.25);
    }
    .wdt-zoom-btn {
      width: 24px;
      height: 24px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      border: none;
      background: transparent;
      color: var(--theme-text, #334155);
      font-size: 14px;
      font-weight: 700;
      border-radius: 4px;
      cursor: pointer;
      transition: all 0.12s ease;
      padding: 0;
    }
    .wdt-zoom-btn:hover {
      background: var(--theme-card, #ffffff);
      color: var(--theme-primary, #0284c7);
      box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    }
    :root[data-theme="dark"] .wdt-zoom-btn:hover , body.theme-dark .wdt-zoom-btn:hover {
      background: rgba(255, 255, 255, 0.12);
      color: #38bdf8;
    }
    .wdt-zoom-label {
      font-size: 11px;
      font-weight: 700;
      min-width: 38px;
      text-align: center;
      color: var(--theme-text, #1e293b);
      cursor: pointer;
      padding: 2px 4px;
      border-radius: 4px;
      transition: background 0.12s ease;
    }
    .wdt-zoom-label:hover {
      background: rgba(2, 132, 199, 0.08);
      color: var(--theme-primary, #0284c7);
    }
    :root[data-theme="dark"] .wdt-zoom-label , body.theme-dark .wdt-zoom-label {
      color: #e2e8f0;
    }

    /* Botón de Modo Estudio (Icon-only) */
    .wdt-study-toggle-btn {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: 32px;
      height: 32px;
      min-width: 32px;
      padding: 0;
      border-radius: 7px;
      border: 1px solid var(--theme-border, #cbd5e1);
      background: var(--theme-pill-bg, #f8fafc);
      color: #92400e;
      cursor: pointer;
      transition: all 0.16s ease;
      user-select: none;
    }
    .wdt-study-toggle-btn:hover {
      background: #fef3c7;
      border-color: #f59e0b;
      color: #78350f;
      transform: translateY(-1px);
    }
    .wdt-study-toggle-btn.active {
      background: #f59e0b;
      border-color: #d97706;
      color: #ffffff;
      box-shadow: 0 0 10px rgba(245, 158, 11, 0.4);
    }
    :root[data-theme="dark"] .wdt-study-toggle-btn, body.theme-dark .wdt-study-toggle-btn {
      background: rgba(245, 158, 11, 0.12);
      border-color: rgba(245, 158, 11, 0.3);
      color: #fbbf24;
    }
    :root[data-theme="dark"] .wdt-study-toggle-btn:hover, body.theme-dark .wdt-study-toggle-btn:hover {
      background: rgba(245, 158, 11, 0.22);
    }
    :root[data-theme="dark"] .wdt-study-toggle-btn.active, body.theme-dark .wdt-study-toggle-btn.active {
      background: #f59e0b;
      color: #ffffff;
      box-shadow: 0 0 12px rgba(245, 158, 11, 0.6);
    }

    /* Botón de Modo Revisión (Icon-only) */
    .wdt-revision-toggle-btn {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: 32px;
      height: 32px;
      min-width: 32px;
      padding: 0;
      border-radius: 7px;
      border: 1px solid rgba(16, 185, 129, 0.35);
      background: var(--theme-pill-bg, #f8fafc);
      color: #065f46;
      cursor: pointer;
      transition: all 0.16s ease;
      user-select: none;
    }
    .wdt-revision-toggle-btn:hover {
      background: #d1fae5;
      border-color: #10b981;
      color: #047857;
      transform: translateY(-1px);
    }
    .wdt-revision-toggle-btn.active {
      background: #10b981;
      border-color: #059669;
      color: #ffffff;
      box-shadow: 0 0 10px rgba(16, 185, 129, 0.45);
    }
    :root[data-theme="dark"] .wdt-revision-toggle-btn, body.theme-dark .wdt-revision-toggle-btn {
      background: rgba(16, 185, 129, 0.12);
      border-color: rgba(16, 185, 129, 0.3);
      color: #34d399;
    }
    :root[data-theme="dark"] .wdt-revision-toggle-btn:hover, body.theme-dark .wdt-revision-toggle-btn:hover {
      background: rgba(16, 185, 129, 0.22);
      border-color: #34d399;
    }
    :root[data-theme="dark"] .wdt-revision-toggle-btn.active, body.theme-dark .wdt-revision-toggle-btn.active {
      background: #10b981;
      color: #ffffff;
      box-shadow: 0 0 12px rgba(16, 185, 129, 0.65);
    }

    .wdt-action-ghost {
      background: rgba(2, 132, 199, 0.08) !important;
      color: var(--theme-primary, #0284c7) !important;
      border-color: rgba(2, 132, 199, 0.25) !important;
    }
    .wdt-action-ghost:hover {
      background: var(--theme-primary, #0284c7) !important;
      color: #ffffff !important;
    }

    /* Botón de Pantalla Completa (Icon-only) */
    .wdt-fullscreen-btn {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: 32px;
      height: 32px;
      min-width: 32px;
      padding: 0;
      color: var(--theme-primary, #0284c7);
      background: rgba(2, 132, 199, 0.08);
      border: 1px solid rgba(2, 132, 199, 0.25);
      border-radius: 7px;
      cursor: pointer;
      transition: all 0.15s ease;
      user-select: none;
    }
    .wdt-fullscreen-btn:hover {
      background: #0284c7;
      color: #ffffff;
      border-color: #0284c7;
      transform: translateY(-1px);
      box-shadow: 0 2px 6px rgba(2, 132, 199, 0.3);
    }
    .wdt-action-btn {
      display: inline-flex;
      align-items: center;
      gap: 5px;
      padding: 4px 10px;
      font-size: 11px;
      font-weight: 700;
      color: #ffffff;
      background: var(--theme-primary, #0284c7);
      border: 1px solid var(--theme-primary, #0284c7);
      border-radius: 6px;
      cursor: pointer;
      transition: all 0.15s ease;
    }
    .wdt-action-btn:hover {
      background: #0369a1;
      border-color: #0369a1;
      box-shadow: 0 2px 6px rgba(2, 132, 199, 0.3);
    }
    .wdt-close-btn {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: 32px;
      height: 32px;
      min-width: 32px;
      padding: 0;
      font-size: 14px;
      font-weight: 700;
      color: var(--theme-text-muted, #64748b);
      background: rgba(0, 0, 0, 0.05);
      border: 1px solid var(--theme-border, #cbd5e1);
      border-radius: 7px;
      cursor: pointer;
      transition: all 0.15s ease;
      user-select: none;
    }
    .wdt-close-btn:hover {
      background: #ef4444;
      color: #ffffff;
      border-color: #ef4444;
      box-shadow: 0 2px 6px rgba(239, 68, 68, 0.3);
    }

    /* =========================================================================
       SISTEMA DE TOOLTIPS INTELIGENTES FLOTANTES (ESTILO FIGMA / LINEAR / GOOGLE WORKSPACE)
       ========================================================================= */
    .wdt-smart-tooltip {
      position: fixed;
      z-index: 999999;
      pointer-events: none;
      background: #0f172a;
      color: #f8fafc;
      border: 1px solid rgba(255, 255, 255, 0.16);
      border-radius: 8px;
      padding: 7px 11px;
      max-width: 260px;
      min-width: 140px;
      box-shadow: 0 10px 25px -4px rgba(0, 0, 0, 0.5), 0 4px 10px -2px rgba(0, 0, 0, 0.3);
      font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
      opacity: 0;
      transform: translateY(-4px) scale(0.97);
      transition: opacity 0.12s cubic-bezier(0.16, 1, 0.3, 1), transform 0.12s cubic-bezier(0.16, 1, 0.3, 1);
      display: none;
      box-sizing: border-box;
    }
    .wdt-smart-tooltip.visible {
      opacity: 1;
      transform: translateY(0) scale(1);
    }
    .wdt-st-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
      margin-bottom: 3px;
    }
    .wdt-st-title {
      font-size: 11.5px;
      font-weight: 700;
      color: #ffffff;
      letter-spacing: -0.1px;
    }
    .wdt-st-badge {
      font-size: 9px;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 0.4px;
      padding: 1px 5px;
      border-radius: 4px;
      background: rgba(255, 255, 255, 0.12);
      color: #38bdf8;
      white-space: nowrap;
    }
    .wdt-st-badge.badge-active {
      background: rgba(16, 185, 129, 0.25);
      color: #34d399;
      border: 1px solid rgba(16, 185, 129, 0.4);
    }
    .wdt-st-badge.badge-inactive {
      background: rgba(148, 163, 184, 0.18);
      color: #cbd5e1;
    }
    .wdt-st-desc {
      font-size: 10.5px;
      font-weight: 400;
      color: #94a3b8;
      line-height: 1.35;
    }
    .wdt-st-arrow {
      position: absolute;
      width: 8px;
      height: 8px;
      background: #0f172a;
      border: 1px solid rgba(255, 255, 255, 0.16);
      transform: rotate(45deg);
      pointer-events: none;
    }
    .wdt-st-arrow.arrow-top {
      top: -5px;
      border-bottom: none;
      border-right: none;
    }
    .wdt-st-arrow.arrow-bottom {
      bottom: -5px;
      border-top: none;
      border-left: none;
    }
    .wdt-font-toggle {
      display: inline-flex;
      background: rgba(0, 0, 0, 0.04);
      padding: 2px;
      border-radius: 6px;
      border: 1px solid var(--theme-border);
    }
    :root[data-theme="dark"] .wdt-font-toggle , body.theme-dark .wdt-font-toggle {
      background: rgba(255, 255, 255, 0.04);
    }
    .wdt-font-btn {
      padding: 3px 9px;
      font-size: 11px;
      font-weight: 600;
      background: transparent;
      color: var(--theme-text-muted);
      border: none;
      border-radius: 4px;
      cursor: pointer;
      transition: all 0.15s ease;
    }
    .wdt-font-btn.active {
      background: var(--theme-card);
      color: var(--theme-text);
      box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
      font-weight: 700;
    }
    .wdt-page-badge {
      font-size: 11px;
      font-weight: 700;
      color: var(--theme-text-muted);
      background: rgba(0, 0, 0, 0.04);
      border: 1px solid var(--theme-border);
      padding: 3px 8px;
      border-radius: 6px;
      letter-spacing: 0.3px;
    }

    /* La Hoja de Papel A4 Flotante */
    .word-sheet-paper {
      background: #ffffff !important;
      color: #1e293b !important;
      max-width: 816px;
      margin: 18px auto 24px auto;
      padding: 54px 64px 60px 64px;
      border-radius: 3px;
      box-shadow: 0 6px 24px rgba(0, 0, 0, 0.12), 0 2px 6px rgba(0, 0, 0, 0.08), 0 0 0 1px rgba(0, 0, 0, 0.06);
      position: relative;
      min-height: 1056px;
      box-sizing: border-box;
      display: flex;
      flex-direction: column;
    }
    .word-chapter-container {
      flex: 1 0 auto;
      margin-bottom: 24px;
    }
    .word-chapter-separator {
      margin: 48px 0 36px 0;
      display: flex;
      align-items: center;
      gap: 14px;
      user-select: none;
    }
    .word-chapter-separator .wcs-line {
      flex: 1;
      height: 1px;
      background: transparent;
      border-top: 1px dashed #cbd5e1;
    }
    .word-chapter-separator .wcs-tag {
      font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
      font-size: 11px;
      font-weight: 600;
      color: #64748b;
      letter-spacing: 0.5px;
      text-transform: uppercase;
      background: #f8fafc;
      border: 1px solid #e2e8f0;
      padding: 3px 12px;
      border-radius: 9999px;
      display: inline-flex;
      align-items: center;
      gap: 6px;
    }
    @media (max-width: 768px) {
      .word-sheet-paper {
        padding: 32px 24px;
      }
    }

    /* Tipografías de la Hoja Word */
    .word-sheet-paper.font-times {
      font-family: "Times New Roman", Times, "Liberation Serif", serif;
      font-size: 15.5px;
      line-height: 1.65;
    }
    .word-sheet-paper.font-calibri {
      font-family: "Calibri", "Aptos", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
      font-size: 14.5px;
      line-height: 1.55;
    }
    .word-sheet-paper.font-arial {
      font-family: "Arial", Helvetica, sans-serif;
      font-size: 14px;
      line-height: 1.55;
    }

    /* Encabezado Minimalista y Limpio: Solo Título */
    .word-paper-header-clean {
      text-align: center;
      margin-bottom: 22px;
      padding-bottom: 12px;
      border-bottom: none;
    }
    .word-thesis-title-tag {
      font-size: 9.5px;
      font-weight: 700;
      letter-spacing: 1.2px;
      text-transform: uppercase;
      color: #64748b;
      margin-bottom: 5px;
    }
    .word-project-thesis-title-clean {
      font-size: 14px;
      font-weight: 800;
      color: #0f172a;
      max-width: 660px;
      margin: 0 auto;
      line-height: 1.45;
      letter-spacing: 0.3px;
      text-transform: uppercase;
    }
    .word-paper-header {
      text-align: center;
      margin-bottom: 28px;
    }
    .word-logo-wrap {
      display: flex;
      justify-content: center;
      align-items: center;
      margin-bottom: 12px;
      min-height: 72px;
    }
    .word-uni-logo {
      max-height: 84px;
      max-width: 160px;
      object-fit: contain;
      filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.06));
    }
    .word-uni-logo-fallback {
      width: 72px;
      height: 72px;
      border-radius: 12px;
      background: #f0f9ff;
      border: 1px solid #bae6fd;
      display: flex;
      align-items: center;
      justify-content: center;
    }
    .word-header-meta {
      margin-bottom: 14px;
    }
    .word-univ-title {
      font-size: 15px;
      font-weight: 800;
      color: #0f172a;
      letter-spacing: 0.6px;
      margin: 0 0 4px 0;
      line-height: 1.35;
    }
    .word-fac-title {
      font-size: 13px;
      font-weight: 700;
      color: #334155;
      margin: 0 0 2px 0;
      line-height: 1.3;
    }
    .word-school-title {
      font-size: 12px;
      font-weight: 600;
      color: #475569;
      margin: 0 0 14px 0;
      line-height: 1.3;
    }
    .word-project-thesis-title {
      font-size: 13px;
      font-weight: 800;
      color: #0f172a;
      max-width: 580px;
      margin: 0 auto;
      line-height: 1.45;
      padding: 0 10px;
    }
    .word-header-divider {
      height: 2px;
      background: #0f172a;
      margin: 14px 0 6px 0;
    }
    .word-format-caption {
      display: flex;
      justify-content: space-between;
      align-items: center;
      font-size: 9.5px;
      color: #64748b;
      font-weight: 600;
      text-transform: uppercase;
      letter-spacing: 0.5px;
      padding: 0 2px;
    }

    /* Banner de Selección de Capítulo */
    .word-chapter-focus-banner {
      background: #f8fafc;
      border: 1px solid #e2e8f0;
      border-left: 4px solid #0284c7;
      border-radius: 6px;
      padding: 8px 12px;
      margin: 20px 0 24px 0;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 10px;
      flex-wrap: wrap;
    }
    .wcfb-left {
      display: flex;
      align-items: center;
      gap: 8px;
      flex-wrap: wrap;
    }
    .wcfb-badge-selected {
      background: #0284c7;
      color: #ffffff;
      font-size: 10.5px;
      font-weight: 800;
      padding: 2px 7px;
      border-radius: 4px;
      letter-spacing: 0.5px;
    }
    .wcfb-chapter-title {
      font-size: 12.5px;
      font-weight: 700;
      color: #0f172a;
    }
    .wcfb-synced-pill {
      font-size: 11px;
      font-weight: 700;
      color: #047857;
      background: #ecfdf5;
      border: 1px solid #a7f3d0;
      padding: 2px 8px;
      border-radius: 4px;
    }
    .wcfb-pending-pill {
      font-size: 11px;
      font-weight: 600;
      color: #64748b;
      background: #f1f5f9;
      border: 1px solid #cbd5e1;
      padding: 2px 8px;
      border-radius: 4px;
    }

    /* Título Formal de Capítulo de Word */
    .word-formal-chapter-header {
      text-align: center;
      margin: 16px 0 28px 0;
    }
    .word-chapter-number {
      font-size: 16px;
      font-weight: 800;
      color: #0f172a;
      letter-spacing: 1px;
      margin: 0 0 4px 0;
    }
    .word-chapter-name {
      font-size: 14.5px;
      font-weight: 800;
      color: #0f172a;
      letter-spacing: 0.4px;
      margin: 0;
    }

    /* Párrafos Académicos con Sangría APA 7 Reglamentaria */
    .word-chapter-body {
      margin-top: 14px;
    }
    .word-heading-block {
      margin: 22px 0 10px 0;
    }
    .word-heading-h2 {
      font-size: 14px;
      font-weight: 800;
      color: #0f172a;
      margin: 0;
      line-height: 1.4;
      text-align: left;
    }
    .word-academic-p {
      text-align: justify;
      margin-bottom: 14px;
      text-indent: 1.27cm; /* Sangría formal APA 7 Word (0.5 pulgada) */
      color: #1e293b;
      line-height: 1.68;
      position: relative;
      transition: background 0.3s ease, outline 0.3s ease;
      border-radius: 4px;
      padding: 2px 4px;
    }
    .word-parr-tag {
      font-family: monospace;
      font-size: 9.5px;
      font-weight: 700;
      color: #0284c7;
      background: rgba(2, 132, 199, 0.08);
      border: 1px solid rgba(2, 132, 199, 0.2);
      padding: 1px 4px;
      border-radius: 3px;
      margin-right: 6px;
      text-indent: 0;
      display: inline-block;
      user-select: none;
    }
    .word-parr-highlight {
      background: #f0fdf4 !important;
      outline: 2px solid #10b981 !important;
      border-radius: 4px;
      animation: wordPulseHighlight 2.4s ease-out forwards;
    }
    @keyframes wordPulseHighlight {
      0% { background: #dcfce7; outline-color: #22c55e; }
      70% { background: #f0fdf4; outline-color: #10b981; }
      100% { background: transparent; outline-color: transparent; }
    }

    /* Estado de Capítulo en Blanco */
    .word-empty-chapter-sheet {
      padding: 48px 24px;
      text-align: center;
      background: #f8fafc;
      border: 1px dashed #cbd5e1;
      border-radius: 8px;
      margin: 24px 0;
    }
    .wec-icon {
      display: flex;
      justify-content: center;
      margin-bottom: 12px;
    }
    .wec-title {
      font-size: 15px;
      font-weight: 700;
      color: #334155;
      margin: 0 0 6px 0;
    }
    .wec-desc {
      font-size: 13px;
      color: #64748b;
      max-width: 480px;
      margin: 0 auto;
      line-height: 1.55;
    }

    /* Pie de Página Institucional Word */
    .word-paper-footer {
      border-top: 1px solid #cbd5e1;
      padding-top: 12px;
      margin-top: auto;
      display: flex;
      justify-content: space-between;
      align-items: center;
      font-size: 10.5px;
      color: #64748b;
      font-weight: 600;
      text-transform: uppercase;
      letter-spacing: 0.5px;
    }
    .wpf-page-number {
      font-variant-numeric: tabular-nums;
    }

    /* =========================================================================
       LAYOUT DE 2 COLUMNAS: HOJA A4 (IZQ/CENTRO) + ÍNDICE LATERAL DERECHO
       SCROLL 100% INDEPENDIENTE PARA EL DOCUMENTO Y PARA EL ÍNDICE
       ========================================================================= */
    .bitacora-modal-backdrop:has(.word-sheet-desk) .bitacora-modal-dialog {
      max-width: 1400px !important;
      width: 96vw !important;
      height: 92vh !important;
      max-height: 92vh !important;
    }

    /* MODO PANTALLA COMPLETA TOTAL (DISTRACTION-FREE):
       Ocultar todas las barras superiores administrativas (header, tabs, meta toolbar)
       para que el documento Word empiece directamente desde arriba con el 100% de la pantalla */
    .bitacora-modal-backdrop.modal-is-fullscreen:has(.word-sheet-desk) .bitacora-modal-header,
    .bitacora-modal-backdrop.modal-is-fullscreen:has(.word-sheet-desk) .bitacora-nav-tabs,
    .bitacora-modal-backdrop.modal-is-fullscreen:has(.word-sheet-desk) .bitacora-doc-toolbar,
    .bitacora-modal-backdrop.modal-is-fullscreen:has(.word-sheet-desk) #bitacora-progress-summary-card {
      display: none !important;
    }

    .bitacora-modal-backdrop.modal-is-fullscreen:has(.word-sheet-desk) .bitacora-modal-dialog {
      max-width: 100vw !important;
      width: 100vw !important;
      height: 100vh !important;
      max-height: 100vh !important;
      border-radius: 0 !important;
      border: none !important;
      margin: 0 !important;
      box-shadow: none !important;
    }

    .bitacora-modal-body:has(.word-sheet-desk) {
      padding: 6px 14px 10px 14px !important;
      overflow: hidden !important;
      display: flex !important;
      flex-direction: column !important;
      flex: 1 1 0% !important;
      min-height: 0 !important;
      height: 100% !important;
      box-sizing: border-box !important;
    }
    .bitacora-modal-backdrop.modal-is-fullscreen .bitacora-modal-body:has(.word-sheet-desk) {
      height: 100vh !important;
      max-height: 100vh !important;
      padding: 0 !important;
      margin: 0 !important;
    }
    .bitacora-modal-backdrop.modal-is-fullscreen .word-sheet-desk {
      border-radius: 0 !important;
      border: none !important;
      height: 100vh !important;
      max-height: 100vh !important;
      padding: 6px 12px !important;
    }
    .bitacora-modal-body:has(.word-sheet-desk) .bitacora-academic-reading,
    .bitacora-modal-body:has(.word-sheet-desk) #panel-capitulo-doc {
      height: 100% !important;
      display: flex !important;
      flex-direction: column !important;
      flex: 1 1 0% !important;
      min-height: 0 !important;
      overflow: hidden !important;
    }

    .word-sheet-desk {
      background: #e2e8f0;
      border: 1px solid var(--theme-border);
      border-radius: 12px;
      padding: 8px 12px !important;
      transition: background 0.2s ease;
      display: flex !important;
      flex-direction: column !important;
      flex: 1 1 0% !important;
      min-height: 0 !important;
      height: 100% !important;
      overflow: hidden !important;
      box-sizing: border-box !important;
      position: relative !important;
    }
    :root[data-theme="dark"] .word-sheet-desk , body.theme-dark .word-sheet-desk {
      background: var(--bg-base) !important;
      border-color: rgba(67, 160, 185, 0.25) !important;
    }

    .word-doc-toolbar {
      flex-shrink: 0 !important;
      margin-bottom: 8px !important;
    }

    .word-sheet-layout {
      display: flex !important;
      flex-direction: row !important;
      align-items: stretch !important;
      justify-content: center !important;
      gap: 16px !important;
      width: 100% !important;
      flex: 1 1 0% !important;
      min-height: 0 !important;
      height: 100% !important;
      overflow: hidden !important;
      position: relative !important;
    }

    /* Columna Izquierda/Centro: Scroll Independiente de la Hoja A4 */
    .word-paper-col {
      flex: 1 1 0% !important;
      min-width: 0 !important;
      height: 100% !important;
      max-height: 100% !important;
      overflow-y: auto !important; /* Scroll independiente para la hoja Word */
      overflow-x: hidden !important;
      -webkit-overflow-scrolling: touch !important;
      overscroll-behavior: contain !important;
      padding: 6px 14px 60px 14px !important;
      scrollbar-width: thin;
      box-sizing: border-box !important;
      display: flex !important;
      flex-direction: column !important;
      align-items: center !important;
    }
    .word-sheet-paper {
      margin: 0 auto 30px auto !important;
      flex-shrink: 0 !important;
    }

    /* Columna Derecha: Panel de Navegación Fijo con Scroll Independiente */
    .word-sidebar-col {
      width: 380px !important;
      flex-shrink: 0 !important;
      height: 100% !important;
      display: flex !important;
      flex-direction: column !important;
      overflow: hidden !important;
      position: static !important;
      transition: width 0.24s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease, margin 0.24s ease !important;
    }
    @media (min-width: 1440px) {
      .word-sidebar-col {
        width: 410px !important;
      }
    }
    .word-sidebar-col.is-collapsed {
      width: 0 !important;
      min-width: 0 !important;
      max-width: 0 !important;
      padding: 0 !important;
      margin: 0 !important;
      opacity: 0 !important;
      pointer-events: none !important;
      overflow: hidden !important;
    }
    /* =========================================================================
       RESPONSIVE DESIGN: TABLETS (769px a 1120px)
       ========================================================================= */
    @media (min-width: 769px) and (max-width: 1120px) {
      .bitacora-modal-backdrop:has(.word-sheet-desk) .bitacora-modal-dialog {
        width: 98vw !important;
        max-width: 98vw !important;
        height: 96vh !important;
        height: 96dvh !important;
        border-radius: 12px !important;
      }
      .word-sheet-desk {
        padding: 6px 10px !important;
      }
      .word-sheet-layout {
        gap: 12px !important;
      }
      .word-paper-col {
        padding: 6px 8px 50px 8px !important;
        width: 100% !important;
      }
      .word-sheet-paper {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        padding: 38px 32px 50px 32px !important;
        margin: 0 auto 24px auto !important;
        box-sizing: border-box !important;
      }
      .word-sidebar-col {
        width: 300px !important;
        flex-shrink: 0 !important;
      }
      .word-doc-toolbar {
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        scrollbar-width: thin !important;
        gap: 8px !important;
        padding: 6px 12px !important;
      }
      .wdt-left, .wdt-center, .wdt-right {
        flex-shrink: 0 !important;
      }
    }

    /* =========================================================================
       TARJETA DE RESTRICCIÓN PARA MÓVILES (< 768px) - EXCLUSIVO PC Y TABLET
       ========================================================================= */
    .word-mobile-restriction-card {
      display: none;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      text-align: center;
      padding: 32px 20px;
      background: var(--theme-card, #ffffff);
      border-radius: 14px;
      border: 1px solid var(--theme-border, #cbd5e1);
      box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.08);
      margin: auto;
      max-width: 460px;
      width: 100%;
      box-sizing: border-box;
    }
    :root[data-theme="dark"] .word-mobile-restriction-card,
    body.theme-dark .word-mobile-restriction-card {
      background: #0f172a;
      border-color: rgba(255, 255, 255, 0.12);
      box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
    }
    .wmr-icon-wrap {
      width: 68px;
      height: 68px;
      border-radius: 50%;
      background: rgba(2, 132, 199, 0.1);
      color: var(--theme-primary, #0284c7);
      display: flex;
      align-items: center;
      justify-content: center;
      margin-bottom: 14px;
    }
    .wmr-badge {
      font-size: 10px;
      font-weight: 800;
      letter-spacing: 0.8px;
      text-transform: uppercase;
      color: var(--theme-primary, #0284c7);
      background: rgba(2, 132, 199, 0.12);
      padding: 3px 10px;
      border-radius: 999px;
      margin-bottom: 12px;
    }
    .wmr-title {
      font-size: 17px;
      font-weight: 700;
      color: var(--theme-text, #0f172a);
      margin: 0 0 8px 0;
      line-height: 1.3;
    }
    :root[data-theme="dark"] .wmr-title,
    body.theme-dark .wmr-title {
      color: #f8fafc;
    }
    .wmr-desc {
      font-size: 12.5px;
      color: var(--theme-text-muted, #64748b);
      line-height: 1.5;
      margin: 0 0 18px 0;
    }
    :root[data-theme="dark"] .wmr-desc,
    body.theme-dark .wmr-desc {
      color: #94a3b8;
    }
    .wmr-tips {
      display: flex;
      flex-direction: column;
      gap: 10px;
      text-align: left;
      background: var(--theme-pill-bg, #f8fafc);
      border: 1px solid var(--theme-border, #e2e8f0);
      border-radius: 10px;
      padding: 12px 14px;
      margin-bottom: 20px;
      width: 100%;
      box-sizing: border-box;
    }
    :root[data-theme="dark"] .wmr-tips,
    body.theme-dark .wmr-tips {
      background: rgba(255, 255, 255, 0.04);
      border-color: rgba(255, 255, 255, 0.08);
    }
    .wmr-tip-item {
      display: flex;
      align-items: flex-start;
      gap: 10px;
      font-size: 11.5px;
      color: var(--theme-text, #334155);
      line-height: 1.45;
    }
    :root[data-theme="dark"] .wmr-tip-item,
    body.theme-dark .wmr-tip-item {
      color: #cbd5e1;
    }
    .wmr-tip-icon {
      font-size: 14px;
      flex-shrink: 0;
      line-height: 1.2;
    }
    .wmr-btn-close {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: 100%;
      padding: 10px 18px;
      background: var(--theme-primary, #0284c7);
      color: #ffffff;
      font-size: 12.5px;
      font-weight: 700;
      border-radius: 8px;
      border: none;
      cursor: pointer;
      transition: all 0.15s ease;
      box-shadow: 0 2px 6px rgba(2, 132, 199, 0.3);
    }
    .wmr-btn-close:hover {
      background: #0369a1;
      transform: translateY(-1px);
    }

    /* =========================================================================
       RESPONSIVE DESIGN: MÓVILES (< 768px) - RESTRICCIÓN ACTIVA
       ========================================================================= */
    @media (max-width: 767px) {
      .word-sheet-desk {
        display: none !important;
      }
      .word-mobile-restriction-card {
        display: flex !important;
      }
      .bitacora-modal-backdrop:has(.word-mobile-restriction-card),
      .modal-word-backdrop {
        padding: 12px !important;
        align-items: center !important;
        justify-content: center !important;
      }
      .bitacora-modal-backdrop:has(.word-mobile-restriction-card) .bitacora-modal-dialog,
      .word-modal-dialog {
        width: 95vw !important;
        max-width: 480px !important;
        height: auto !important;
        max-height: 92vh !important;
        border-radius: 14px !important;
      }
    }

    /* Botón flotante para reabrir el índice cuando está colapsado (recuadro de 3 barritas horizontales) */
    .wsi-floating-reopen-btn {
      display: none;
      position: absolute;
      top: 14px;
      right: 18px;
      z-index: 45;
      width: 36px;
      height: 36px;
      padding: 0;
      align-items: center;
      justify-content: center;
      background: var(--theme-card, #ffffff);
      color: var(--theme-primary, #0284c7);
      border: 1px solid var(--theme-border, #cbd5e1);
      border-radius: 8px;
      cursor: pointer;
      box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
      transition: all 0.16s ease;
      user-select: none;
    }
    .wsi-floating-reopen-btn svg {
      display: block;
      pointer-events: none;
    }
    .wsi-floating-reopen-btn:hover {
      background: rgba(2, 132, 199, 0.08);
      border-color: var(--theme-primary, #0284c7);
      transform: translateY(-1px);
      box-shadow: 0 6px 18px rgba(2, 132, 199, 0.18);
    }
    :root[data-theme="dark"] .wsi-floating-reopen-btn,
    body.theme-dark .wsi-floating-reopen-btn {
      background: #0f1c2e;
      border-color: rgba(67, 160, 185, 0.3);
      color: #38bdf8;
    }
    .word-sheet-layout.sidebar-collapsed .wsi-floating-reopen-btn {
      display: inline-flex !important;
      animation: fadeInRight 0.2s ease forwards;
    }

    /* Tarjeta del Panel de Navegación Derecho */
    .word-sidebar-inner {
      background: var(--theme-card, #ffffff);
      border: 1px solid var(--theme-border, #cbd5e1);
      border-radius: 12px;
      padding: 14px !important;
      box-shadow: 0 4px 16px rgba(0, 0, 0, 0.05);
      display: flex !important;
      flex-direction: column !important;
      gap: 10px;
      height: 100% !important;
      box-sizing: border-box;
      overflow: hidden !important;
    }
    :root[data-theme="dark"] .word-sidebar-inner , body.theme-dark .word-sidebar-inner {
      background: #0f1c2e;
      border-color: rgba(67, 160, 185, 0.25);
    }
    .wsi-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
      padding-bottom: 8px;
      border-bottom: 1px solid var(--theme-border-subtle, #e2e8f0);
      flex-shrink: 0 !important;
    }
    .wsi-title-row {
      display: flex;
      align-items: center;
      gap: 8px;
      color: var(--theme-primary, #0284c7);
    }
    .wsi-collapse-btn {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: 24px;
      height: 24px;
      border-radius: 6px;
      border: 1px solid var(--theme-border-subtle, #cbd5e1);
      background: transparent;
      color: var(--theme-text-muted, #64748b);
      cursor: pointer;
      transition: all 0.15s ease;
      padding: 0;
    }
    .wsi-collapse-btn:hover {
      background: rgba(2, 132, 199, 0.1);
      color: var(--theme-primary, #0284c7);
      border-color: var(--theme-primary, #0284c7);
    }
    .wsi-title {
      font-size: 13px;
      font-weight: 700;
      color: var(--theme-text, #0f172a);
      letter-spacing: -0.2px;
    }
    .wsi-badge-count {
      font-size: 10.5px;
      font-weight: 700;
      background: rgba(2, 132, 199, 0.1);
      color: var(--theme-primary, #0284c7);
      padding: 2px 7px;
      border-radius: 9999px;
      border: 1px solid rgba(2, 132, 199, 0.2);
    }
    .wsi-filter-wrap {
      width: 100%;
      flex-shrink: 0 !important;
    }
    .wsi-filter-input {
      width: 100%;
      padding: 7px 12px;
      font-size: 12px;
      border: 1px solid var(--theme-border, #cbd5e1);
      border-radius: 7px;
      background: var(--theme-bg, #f8fafc);
      color: var(--theme-text, #0f172a);
      box-sizing: border-box;
      outline: none;
      transition: all 0.15s ease;
    }
    .wsi-filter-input:focus {
      border-color: var(--theme-primary, #0284c7);
      box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
      background: var(--theme-card, #ffffff);
    }
    /* Scroll Independiente de la lista de acápites */
    .wsi-items-list {
      display: flex;
      flex-direction: column;
      gap: 5px;
      overflow-y: auto !important; /* Scroll independiente para el índice */
      overflow-x: hidden !important;
      overscroll-behavior: contain !important;
      -webkit-overflow-scrolling: touch !important;
      flex: 1 1 0% !important;
      min-height: 0 !important;
      max-height: 100% !important;
      padding-right: 4px;
      scrollbar-width: thin;
    }
    .wsi-footer-tip {
      font-size: 12px;
      font-weight: 500;
      color: var(--theme-text, #334155);
      padding: 9px 10px;
      background: var(--theme-pill-bg, #f8fafc);
      border-radius: 7px;
      border: 1px solid var(--theme-border-subtle, #e2e8f0);
      line-height: 1.45;
      flex-shrink: 0 !important;
      display: flex;
      align-items: flex-start;
      gap: 7px;
    }
    :root[data-theme="dark"] .wsi-footer-tip , body.theme-dark .wsi-footer-tip {
      background: rgba(255, 255, 255, 0.03);
      border-color: rgba(67, 160, 185, 0.2);
      color: #cbd5e1;
    }

    /* Badge compacto de avance en toolbar */
    .bpsc-mini-badge {
      font-size: 11px;
      font-weight: 700;
      padding: 3px 8px;
      border-radius: 9999px;
      display: inline-flex;
      align-items: center;
      gap: 4px;
      line-height: 1.2;
    }
    .bpsc-mini-badge.high {
      background: rgba(16, 185, 129, 0.14);
      color: #059669;
      border: 1px solid rgba(16, 185, 129, 0.25);
    }
    .bpsc-mini-badge.med {
      background: rgba(2, 132, 199, 0.14);
      color: #0284c7;
      border: 1px solid rgba(2, 132, 199, 0.25);
    }
    .bpsc-mini-badge.low {
      background: rgba(245, 158, 11, 0.14);
      color: #d97706;
      border: 1px solid rgba(245, 158, 11, 0.25);
    }

    /* Fila del Índice con Foquito */
    .wsi-item-row {
      display: flex;
      align-items: flex-start;
      gap: 6px;
      width: 100%;
      box-sizing: border-box;
      transition: opacity 0.15s ease;
    }
    .wsi-item-btn {
      display: flex !important;
      align-items: flex-start !important;
      gap: 7px !important;
      flex: 1 1 auto !important;
      min-width: 0 !important;
      padding: 5px 8px !important;
      border-radius: 5px;
      border: 1px solid transparent;
      background: transparent;
      color: var(--theme-text, #334155);
      cursor: pointer;
      text-align: left !important;
      font-family: inherit;
      transition: all 0.12s ease;
      font-size: 11.8px;
      line-height: 1.35 !important;
    }
    .wsi-item-btn:hover {
      background: rgba(2, 132, 199, 0.06);
      border-color: rgba(2, 132, 199, 0.15);
      color: var(--theme-primary, #0284c7);
    }
    .wsi-item-btn.active {
      background: rgba(2, 132, 199, 0.12);
      border-color: rgba(2, 132, 199, 0.35);
      color: var(--theme-primary, #0284c7);
      font-weight: 700;
    }
    .wsi-code {
      font-family: var(--font-mono, 'SFMono-Regular', Consolas, monospace) !important;
      font-size: 11px !important;
      font-weight: 700 !important;
      color: #0284c7 !important;
      background: rgba(2, 132, 199, 0.08) !important;
      padding: 1.5px 6px !important;
      border-radius: 4px !important;
      flex-shrink: 0 !important;
      min-width: 26px !important;
      text-align: center !important;
      margin-top: 1px !important;
      line-height: 1.25 !important;
      font-variant-numeric: tabular-nums !important;
      letter-spacing: -0.2px !important;
    }
    .wsi-item-btn.active .wsi-code {
      background: #0284c7;
      color: #ffffff;
    }
    .wsi-name {
      overflow: visible !important;
      text-overflow: clip !important;
      white-space: normal !important;
      word-break: normal !important;
      overflow-wrap: break-word !important;
      hyphens: none !important;
      line-height: 1.35 !important;
      font-size: 12.2px !important;
      color: var(--theme-text, #1e293b);
      flex: 1 1 auto !important;
      display: block !important;
    }

    /* 1. SECCIÓN ELABORADA: Texto nítido y FOCO PRENDIDO (Brillante, dorado) */
    .wsi-item-row.is-elaborado .wsi-name {
      color: var(--theme-text, #0f172a) !important;
      font-weight: 600 !important;
    }
    :root[data-theme="dark"] .wsi-item-row.is-elaborado .wsi-name , body.theme-dark .wsi-item-row.is-elaborado .wsi-name {
      color: #f8fafc !important;
    }
    .wsi-item-pins-group {
      display: flex;
      align-items: center;
      gap: 3px;
      flex-shrink: 0;
      margin-left: auto;
      padding-right: 2px;
    }
    .wsi-action-pin {
      width: 20px;
      height: 20px;
      min-width: 20px;
      border-radius: 5px;
      cursor: pointer;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      flex-shrink: 0;
      transition: all 0.15s ease;
      border: 1px solid transparent;
      padding: 0;
    }
    .wsi-action-pin.pin-criterion {
      color: #d97706;
      background: #fef3c7;
      border-color: #fcd34d;
    }
    .wsi-action-pin.pin-criterion:hover {
      background: #fde68a;
      border-color: #f59e0b;
      transform: scale(1.08);
      box-shadow: 0 1px 4px rgba(245, 158, 11, 0.25);
    }
    .wsi-action-pin.pin-revision {
      color: #047857;
      background: #d1fae5;
      border-color: #6ee7b7;
    }
    .wsi-action-pin.pin-revision:hover {
      background: #a7f3d0;
      border-color: #10b981;
      transform: scale(1.08);
      box-shadow: 0 1px 4px rgba(16, 185, 129, 0.25);
    }
    .wsi-action-pin.pin-pending {
      color: #b45309;
      background: #fef3c7;
      border-color: #fcd34d;
    }
    .wsi-action-pin.pin-pending:hover {
      background: #fde68a;
      border-color: #f59e0b;
      transform: scale(1.08);
      box-shadow: 0 1px 4px rgba(245, 158, 11, 0.25);
    }
    :root[data-theme="dark"] .wsi-action-pin.pin-criterion,
    body.theme-dark .wsi-action-pin.pin-criterion {
      background: rgba(245, 158, 11, 0.16);
      border-color: rgba(245, 158, 11, 0.32);
      color: #fbbf24;
    }
    :root[data-theme="dark"] .wsi-action-pin.pin-revision,
    body.theme-dark .wsi-action-pin.pin-revision {
      background: rgba(16, 185, 129, 0.16);
      border-color: rgba(52, 211, 153, 0.32);
      color: #34d399;
    }
    :root[data-theme="dark"] .wsi-action-pin.pin-pending,
    body.theme-dark .wsi-action-pin.pin-pending {
      background: rgba(245, 158, 11, 0.16);
      border-color: rgba(245, 158, 11, 0.32);
      color: #fbbf24;
    }

    /* 2. SECCIÓN PENDIENTE: TEXTO DEL ÍNDICE NÍTIDO Y LEGIBLE (Gris oscuro accesible) */
    .wsi-item-row.is-pendiente .wsi-item-btn {
      opacity: 0.95 !important;
    }
    .wsi-item-row.is-pendiente .wsi-name {
      color: #475569 !important;
      font-weight: 500 !important;
      font-style: normal !important;
    }
    :root[data-theme="dark"] .wsi-item-row.is-pendiente .wsi-name , body.theme-dark .wsi-item-row.is-pendiente .wsi-name {
      color: #94a3b8 !important;
    }
    .wsi-item-row.is-pendiente .wsi-code {
      background: rgba(148, 163, 184, 0.12) !important;
      color: #64748b !important;
      border: 1px solid rgba(148, 163, 184, 0.22) !important;
    }
    :root[data-theme="dark"] .wsi-item-row.is-pendiente .wsi-code , body.theme-dark .wsi-item-row.is-pendiente .wsi-code {
      color: #94a3b8 !important;
      background: rgba(148, 163, 184, 0.1) !important;
    }
    .wsi-pending-pill {
      display: none !important;
    }

    /* Pines en la Hoja A4 */
    .word-heading-row {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      position: relative;
    }
    /* =========================================================================
       PIN / BOTÓN DE CRITERIO METODOLÓGICO (SOLO ICONO CON TOOLTIP INTELIGENTE)
       ========================================================================= */
    .word-study-pin {
      display: none;
      align-items: center;
      justify-content: center;
      width: 24px;
      height: 24px;
      min-width: 24px;
      padding: 0;
      border-radius: 6px;
      cursor: pointer;
      box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
      transition: all 0.16s ease;
      flex-shrink: 0;
      user-select: none;
      color: #92400e;
      background: #fef3c7;
      border: 1px solid #fcd34d;
    }
    .word-sheet-desk.study-mode-active .word-study-pin {
      display: inline-flex;
      animation: pinAppear 0.22s ease-out;
    }
    .word-study-pin.pin-on {
      color: #92400e;
      background: #fef3c7;
      border: 1px solid #fcd34d;
    }
    .word-study-pin.pin-on:hover {
      background: #fde68a;
      border-color: #f59e0b;
      transform: translateY(-1px);
      box-shadow: 0 2px 6px rgba(245, 158, 11, 0.25);
    }
    .word-study-pin.pin-off {
      color: #64748b !important;
      background: #f1f5f9 !important;
      border: 1px solid #cbd5e1 !important;
      opacity: 0.8 !important;
    }
    .word-study-pin.pin-off:hover {
      opacity: 1 !important;
      border-color: #94a3b8 !important;
    }
    :root[data-theme="dark"] .word-study-pin.pin-on,
    body.theme-dark .word-study-pin.pin-on {
      background: rgba(245, 158, 11, 0.16);
      border-color: rgba(245, 158, 11, 0.35);
      color: #fbbf24;
    }
    :root[data-theme="dark"] .word-study-pin.pin-on:hover,
    body.theme-dark .word-study-pin.pin-on:hover {
      background: rgba(245, 158, 11, 0.28);
      border-color: #f59e0b;
    }

    /* Resaltado del texto seleccionado al pulsar el foquito */
    .word-heading-block.word-section-focused,
    .word-heading-h2.word-section-focused,
    .word-academic-p.word-section-focused {
      background: rgba(245, 158, 11, 0.14) !important;
      border-left: 4px solid #f59e0b !important;
      padding-left: 12px !important;
      border-radius: 4px !important;
      transition: background 0.25s ease, border-color 0.25s ease !important;
    }
    :root[data-theme="dark"] .word-heading-block.word-section-focused, body.theme-dark .word-heading-block.word-section-focused,
    :root[data-theme="dark"] .word-heading-h2.word-section-focused, body.theme-dark .word-heading-h2.word-section-focused,
    :root[data-theme="dark"] .word-academic-p.word-section-focused , body.theme-dark .word-academic-p.word-section-focused {
      background: rgba(245, 158, 11, 0.22) !important;
      border-left-color: #fbbf24 !important;
    }

    /* Grupos de botones de acción en títulos y encabezados */
    .word-title-pins-group,
    .word-heading-pins-wrap {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      flex-shrink: 0;
    }

    /* =========================================================================
       PIN / BOTÓN DE OBSERVACIÓN DEL ASESOR (SOLO ICONO CON TOOLTIP INTELIGENTE)
       ========================================================================= */
    .word-revision-pin {
      display: none;
      align-items: center;
      justify-content: center;
      width: 24px;
      height: 24px;
      min-width: 24px;
      padding: 0;
      border-radius: 6px;
      cursor: pointer;
      box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
      transition: all 0.16s ease;
      flex-shrink: 0;
      user-select: none;
      color: #047857;
      background: #d1fae5;
      border: 1px solid #6ee7b7;
    }
    .word-sheet-desk.revision-mode-active .word-revision-pin {
      display: inline-flex;
      animation: pinAppear 0.22s ease-out;
    }
    .word-revision-pin:hover {
      background: #a7f3d0;
      border-color: #10b981;
      transform: translateY(-1px);
      box-shadow: 0 2px 6px rgba(16, 185, 129, 0.25);
    }
    :root[data-theme="dark"] .word-revision-pin,
    body.theme-dark .word-revision-pin {
      background: rgba(16, 185, 129, 0.16);
      border-color: rgba(52, 211, 153, 0.35);
      color: #34d399;
    }
    .word-revision-pin.pin-pending {
      color: #b45309;
      background: #fef3c7;
      border-color: #fcd34d;
    }
    .word-revision-pin.pin-pending:hover {
      background: #fde68a;
      border-color: #f59e0b;
      box-shadow: 0 2px 6px rgba(245, 158, 11, 0.25);
    }
    :root[data-theme="dark"] .word-revision-pin.pin-pending,
    body.theme-dark .word-revision-pin.pin-pending {
      background: rgba(245, 158, 11, 0.16);
      border-color: rgba(245, 158, 11, 0.35);
      color: #fbbf24;
    }
    :root[data-theme="dark"] .word-revision-pin.pin-pending:hover,
    body.theme-dark .word-revision-pin.pin-pending:hover {
      background: rgba(245, 158, 11, 0.28);
      border-color: #fbbf24;
    }

    /* =========================================================================
       PÁRRAFO MODIFICADO POR ASESOR: SIMPLE MARKUP (LÍNEA MARGINAL VERDE)
       ========================================================================= */
    .word-sheet-desk.revision-mode-active .word-academic-p.has-revision {
      border-left: 3.5px solid #10b981 !important;
      padding-left: 10px !important;
      background: rgba(16, 185, 129, 0.035) !important;
      cursor: pointer;
      border-radius: 0 4px 4px 0 !important;
      transition: all 0.2s ease !important;
    }
    .word-sheet-desk.revision-mode-active .word-academic-p.has-revision:hover {
      background: rgba(16, 185, 129, 0.08) !important;
      border-left-color: #059669 !important;
    }
    :root[data-theme="dark"] .word-sheet-desk.revision-mode-active .word-academic-p.has-revision , body.theme-dark .word-sheet-desk.revision-mode-active .word-academic-p.has-revision {
      border-left-color: #34d399 !important;
      background: rgba(16, 185, 129, 0.07) !important;
    }
    :root[data-theme="dark"] .word-sheet-desk.revision-mode-active .word-academic-p.has-revision:hover , body.theme-dark .word-sheet-desk.revision-mode-active .word-academic-p.has-revision:hover {
      background: rgba(16, 185, 129, 0.14) !important;
    }

    /* =========================================================================
       ÍNDICE LATERAL CONTINUO: ESQUEMA ARBÓREO EDITORIAL (SIN BLOQUES NI TARJETAS)
       ========================================================================= */
    .wsi-cap-group {
      display: flex;
      flex-direction: column;
      border: none !important;
      border-bottom: 1px solid var(--theme-border-subtle, rgba(226, 232, 240, 0.7)) !important;
      border-radius: 0 !important;
      background: transparent !important;
      box-shadow: none !important;
      margin-bottom: 0 !important;
      padding: 0 !important;
      transition: background 0.15s ease;
    }
    :root[data-theme="dark"] .wsi-cap-group , body.theme-dark .wsi-cap-group {
      background: transparent !important;
      border-bottom-color: rgba(67, 160, 185, 0.15) !important;
    }
    .wsi-cap-group.is-current-cap-group {
      border-color: transparent !important;
      box-shadow: none !important;
      background: rgba(2, 132, 199, 0.02) !important;
    }
    :root[data-theme="dark"] .wsi-cap-group.is-current-cap-group , body.theme-dark .wsi-cap-group.is-current-cap-group {
      background: rgba(56, 189, 248, 0.03) !important;
    }

    .wsi-cap-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
      padding: 8px 6px 8px 4px;
      background: transparent !important;
      cursor: pointer;
      user-select: none;
      transition: all 0.15s ease;
      border-radius: 6px;
      min-height: 38px;
      box-sizing: border-box;
      border: 1px solid transparent;
    }
    .wsi-cap-header:hover {
      background: rgba(2, 132, 199, 0.05) !important;
      border-color: rgba(2, 132, 199, 0.12);
    }
    .wsi-cap-header.active-cap {
      background: rgba(2, 132, 199, 0.07) !important;
      border-color: rgba(2, 132, 199, 0.18);
    }
    :root[data-theme="dark"] .wsi-cap-header , body.theme-dark .wsi-cap-header {
      background: transparent !important;
    }
    :root[data-theme="dark"] .wsi-cap-header:hover , body.theme-dark .wsi-cap-header:hover {
      background: rgba(56, 189, 248, 0.08) !important;
      border-color: rgba(56, 189, 248, 0.2);
    }
    :root[data-theme="dark"] .wsi-cap-header.active-cap , body.theme-dark .wsi-cap-header.active-cap {
      background: rgba(56, 189, 248, 0.12) !important;
      border-color: rgba(56, 189, 248, 0.28);
    }

    .wsi-cap-header-left {
      display: flex;
      align-items: flex-start;
      gap: 8px;
      min-width: 0;
      flex: 1;
      padding-top: 1px;
    }
    .wsi-cap-chevron {
      font-size: 10px;
      color: var(--theme-text-muted, #64748b);
      transition: transform 0.2s ease;
      display: inline-block;
      flex-shrink: 0;
      margin-top: 3px;
    }
    .wsi-cap-chevron.open {
      transform: rotate(90deg);
      color: var(--theme-primary, #0284c7);
    }

    .wsi-cap-title-col {
      display: flex;
      flex-direction: column;
      min-width: 0;
      flex: 1;
      gap: 1px;
    }
    .wsi-cap-num {
      font-size: 9.5px;
      font-weight: 800;
      text-transform: uppercase;
      letter-spacing: 0.6px;
      color: var(--theme-primary, #0284c7);
      line-height: 1.2;
    }
    .wsi-cap-name {
      font-size: 11.5px;
      font-weight: 700;
      color: var(--theme-text, #1e293b);
      line-height: 1.35;
      white-space: normal;
      display: -webkit-box;
      -webkit-line-clamp: 2;
      -webkit-box-orient: vertical;
      overflow: hidden;
      word-break: break-word;
    }
    :root[data-theme="dark"] .wsi-cap-name , body.theme-dark .wsi-cap-name {
      color: #e2e8f0;
    }

    .wsi-cap-header-right {
      display: flex;
      align-items: center;
      gap: 6px;
      flex-shrink: 0;
      align-self: center;
    }
    /* % DE AVANCE EN CAPÍTULOS: SOLO EN TEXTO */
    .wsi-cap-pct {
      font-size: 12px;
      font-weight: 700;
      font-family: inherit;
      color: var(--theme-primary, #0284c7);
      letter-spacing: 0.2px;
      white-space: nowrap;
    }
    .wsi-cap-pct.is-zero {
      color: var(--theme-text-muted, #94a3b8);
      font-weight: 600;
      opacity: 0.85;
    }
    .wsi-cap-pct.is-complete {
      color: #059669;
      font-weight: 800;
    }
    :root[data-theme="dark"] .wsi-cap-pct , body.theme-dark .wsi-cap-pct {
      color: #38bdf8;
    }
    :root[data-theme="dark"] .wsi-cap-pct.is-zero , body.theme-dark .wsi-cap-pct.is-zero {
      color: #64748b;
    }
    :root[data-theme="dark"] .wsi-cap-pct.is-complete , body.theme-dark .wsi-cap-pct.is-complete {
      color: #34d399;
    }

    .wsi-global-pct {
      font-size: 11px;
      font-weight: 700;
      color: var(--theme-primary, #0284c7);
      background: rgba(2, 132, 199, 0.08);
      border: 1px solid rgba(2, 132, 199, 0.18);
      border-radius: 6px;
      padding: 2px 7px;
      white-space: nowrap;
    }
    :root[data-theme="dark"] .wsi-global-pct , body.theme-dark .wsi-global-pct {
      color: #38bdf8;
      background: rgba(56, 189, 248, 0.12);
      border-color: rgba(56, 189, 248, 0.25);
    }

    /* Sublista de acápites conectada por guía arbórea vertical */
    .wsi-cap-items {
      display: flex !important;
      flex-direction: column !important;
      gap: 2px !important;
      padding: 3px 0 6px 10px !important;
      margin-left: 14px !important;
      border-left: 2px solid rgba(2, 132, 199, 0.18) !important;
      border-top: none !important;
      background: transparent !important;
    }
    :root[data-theme="dark"] .wsi-cap-items , body.theme-dark .wsi-cap-items {
      background: transparent !important;
      border-left-color: rgba(56, 189, 248, 0.22) !important;
    }
    .wsi-cap-items.collapsed {
      display: none !important;
    }
    .wsi-cap-items.open {
      display: flex !important;
    }

    /* =========================================================================
       PANEL INFERIOR DE EXPLICACIÓN (BOTTOM DRAWER): MENÚ SUPERIOR & 3 COLUMNAS CONTINUAS
       ========================================================================= */
    .word-study-bottom-drawer {
      position: absolute;
      bottom: 0;
      left: 0;
      right: 0;
      z-index: 120;
      background: var(--theme-card, #ffffff);
      border-top: 2px solid var(--theme-primary, #0284c7);
      box-shadow: 0 -14px 40px rgba(15, 23, 42, 0.18);
      border-radius: 14px 14px 0 0;
      display: flex;
      flex-direction: column;
      height: var(--wsbd-drawer-height, 360px);
      min-height: 150px;
      max-height: 85vh;
      overflow: hidden;
      animation: slideUpDrawer 0.22s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    }
    :root[data-theme="dark"] .word-study-bottom-drawer , body.theme-dark .word-study-bottom-drawer {
      background: #0b1523;
      border-top-color: #38bdf8;
      box-shadow: 0 -16px 45px rgba(0, 0, 0, 0.6);
    }

    /* Manija de arrastre manual para regular altura (Resizer) */
    .wsbd-resizer {
      width: 100%;
      height: 14px;
      cursor: ns-resize;
      display: flex;
      align-items: center;
      justify-content: center;
      background: transparent;
      user-select: none;
      touch-action: none;
      flex-shrink: 0;
      padding-top: 2px;
      transition: background 0.18s ease;
    }
    .wsbd-resizer-handle {
      width: 44px;
      height: 4px;
      border-radius: 9999px;
      background: rgba(148, 163, 184, 0.45);
      transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    }
    .wsbd-resizer:hover .wsbd-resizer-handle,
    .wsbd-resizer.is-dragging .wsbd-resizer-handle {
      width: 68px;
      height: 5px;
      background: var(--theme-primary, #0284c7);
      box-shadow: 0 0 8px rgba(2, 132, 199, 0.5);
    }
    :root[data-theme="dark"] .wsbd-resizer-handle , body.theme-dark .wsbd-resizer-handle {
      background: rgba(148, 163, 184, 0.3);
    }
    :root[data-theme="dark"] .wsbd-resizer:hover .wsbd-resizer-handle, body.theme-dark .wsbd-resizer:hover .wsbd-resizer-handle,
    :root[data-theme="dark"] .wsbd-resizer.is-dragging .wsbd-resizer-handle , body.theme-dark .wsbd-resizer.is-dragging .wsbd-resizer-handle {
      background: #38bdf8;
      box-shadow: 0 0 10px rgba(56, 189, 248, 0.5);
    }

    .wsbd-nav-center-badge {
      display: flex;
      align-items: center;
      justify-content: center;
    }
    .wsbd-crit-badge {
      font-size: 11px;
      font-weight: 700;
      padding: 3px 10px;
      border-radius: 9999px;
      background: rgba(2, 132, 199, 0.1);
      color: var(--theme-primary, #0284c7);
      border: 1px solid rgba(2, 132, 199, 0.2);
      letter-spacing: -0.1px;
    }
    :root[data-theme="dark"] .wsbd-crit-badge , body.theme-dark .wsbd-crit-badge {
      background: rgba(56, 189, 248, 0.15);
      color: #38bdf8;
      border-color: rgba(56, 189, 248, 0.3);
    }

    @keyframes slideUpDrawer {
      from {
        transform: translateY(100%);
        opacity: 0;
      }
      to {
        transform: translateY(0);
        opacity: 1;
      }
    }

    /* 1. MENÚ Y NAVBAR SUPERIOR COMPACTO (STUDIO DOCK TOP BAR) */
    .wsbd-top-navbar {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      padding: 9px 20px;
      background: var(--theme-pill-bg, #f8fafc);
      border-bottom: 1px solid var(--theme-border-subtle, #e2e8f0);
      flex-shrink: 0;
    }
    :root[data-theme="dark"] .wsbd-top-navbar , body.theme-dark .wsbd-top-navbar {
      background: #08111c;
      border-bottom-color: rgba(67, 160, 185, 0.2);
    }

    .wsbd-nav-identity {
      display: flex;
      align-items: center;
      gap: 9px;
      min-width: 0;
      flex: 1 1 auto;
    }
    .wsbd-status-bullet {
      width: 8px;
      height: 8px;
      border-radius: 9999px;
      flex-shrink: 0;
    }
    .wsbd-status-bullet.bullet-on {
      background: #10b981;
      box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.25);
    }
    .wsbd-status-bullet.bullet-off {
      background: #f59e0b;
      box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.25);
    }
    .wsbd-sec-code {
      font-family: monospace;
      font-size: 11px;
      font-weight: 800;
      color: #0284c7;
      background: rgba(2, 132, 199, 0.1);
      border: 1px solid rgba(2, 132, 199, 0.2);
      padding: 1.5px 6px;
      border-radius: 4px;
      flex-shrink: 0;
      line-height: 1.2;
    }
    :root[data-theme="dark"] .wsbd-sec-code , body.theme-dark .wsbd-sec-code {
      color: #38bdf8;
      background: rgba(56, 189, 248, 0.12);
      border-color: rgba(56, 189, 248, 0.25);
    }

    .wsbd-sec-title {
      font-size: 13px;
      font-weight: 700;
      color: var(--theme-text, #0f172a);
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      max-width: 340px;
      letter-spacing: -0.15px;
    }
    :root[data-theme="dark"] .wsbd-sec-title , body.theme-dark .wsbd-sec-title {
      color: #f1f5f9;
    }

    /* MENÚ SUPERIOR (SEGMENTED CONTROL TABS) */
    .wsbd-nav-menu {
      display: flex;
      align-items: center;
      gap: 3px;
      background: rgba(148, 163, 184, 0.12);
      padding: 3px;
      border-radius: 8px;
      border: 1px solid var(--theme-border-subtle, #e2e8f0);
      flex-shrink: 0;
    }
    :root[data-theme="dark"] .wsbd-nav-menu , body.theme-dark .wsbd-nav-menu {
      background: #0f1c2e;
      border-color: rgba(67, 160, 185, 0.25);
    }

    .wsbd-menu-link {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      font-size: 11.5px;
      font-weight: 600;
      padding: 5px 12px;
      border-radius: 6px;
      border: none;
      background: transparent;
      color: var(--theme-text-muted, #64748b);
      cursor: pointer;
      transition: all 0.18s ease;
      font-family: inherit;
      white-space: nowrap;
    }
    .wsbd-menu-link:hover {
      color: var(--theme-primary, #0284c7);
      background: rgba(2, 132, 199, 0.06);
    }
    .wsbd-menu-link.is-active {
      background: var(--theme-card, #ffffff);
      color: var(--theme-primary, #0284c7);
      font-weight: 700;
      box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
    }
    :root[data-theme="dark"] .wsbd-menu-link.is-active , body.theme-dark .wsbd-menu-link.is-active {
      background: #0284c7;
      color: #ffffff;
      box-shadow: 0 1px 6px rgba(0, 0, 0, 0.35);
    }

    .wsbd-tab-badge {
      font-size: 10px;
      font-weight: 800;
      padding: 1px 5.5px;
      border-radius: 9999px;
      background: rgba(2, 132, 199, 0.12);
      color: var(--theme-primary, #0284c7);
    }
    .wsbd-menu-link.is-active .wsbd-tab-badge {
      background: var(--theme-primary, #0284c7);
      color: #ffffff;
    }
    :root[data-theme="dark"] .wsbd-menu-link.is-active .wsbd-tab-badge , body.theme-dark .wsbd-menu-link.is-active .wsbd-tab-badge {
      background: rgba(255, 255, 255, 0.25);
      color: #ffffff;
    }

    /* ACCIONES DE NAVEGACIÓN Y CIERRE */
    .wsbd-nav-actions {
      display: flex;
      align-items: center;
      gap: 10px;
      flex-shrink: 0;
    }

    .wsbd-pager-minimal {
      display: inline-flex;
      align-items: center;
      gap: 3px;
      background: var(--theme-card, #ffffff);
      border: 1px solid var(--theme-border-subtle, #cbd5e1);
      border-radius: 6px;
      padding: 2px 4px;
    }
    :root[data-theme="dark"] .wsbd-pager-minimal , body.theme-dark .wsbd-pager-minimal {
      background: #0f1c2e;
      border-color: rgba(67, 160, 185, 0.3);
    }

    .wsbd-pager-btn {
      width: 24px;
      height: 24px;
      display: flex;
      align-items: center;
      justify-content: center;
      background: transparent;
      border: none;
      border-radius: 4px;
      color: var(--theme-text, #1e293b);
      cursor: pointer;
      font-size: 14px;
      font-weight: 800;
      transition: all 0.15s ease;
    }
    .wsbd-pager-btn:hover {
      background: rgba(2, 132, 199, 0.1);
      color: #0284c7;
    }
    .wsbd-pager-label {
      font-size: 11.5px;
      font-weight: 700;
      color: var(--theme-text-muted, #64748b);
      padding: 0 6px;
      white-space: nowrap;
    }

    .wsbd-dismiss-btn {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: 28px;
      height: 28px;
      border-radius: 6px;
      border: 1px solid var(--theme-border-subtle, #cbd5e1);
      background: var(--theme-card, #ffffff);
      color: var(--theme-text-muted, #64748b);
      cursor: pointer;
      font-size: 13px;
      font-weight: 700;
      transition: all 0.15s ease;
    }
    :root[data-theme="dark"] .wsbd-dismiss-btn , body.theme-dark .wsbd-dismiss-btn {
      background: #0f1c2e;
      border-color: rgba(67, 160, 185, 0.3);
    }
    .wsbd-dismiss-btn:hover {
      background: #ef4444;
      color: #ffffff;
      border-color: #ef4444;
      transform: scale(1.05);
    }

    /* 2. FRANJA EDITORIAL DISCRETA PARA LA PREGUNTA DEL JURADO (TRIBUNAL CALLOUT) */
    .wsbd-strip-question {
      display: flex;
      align-items: center;
      gap: 14px;
      padding: 11px 24px;
      background: rgba(2, 132, 199, 0.04);
      border-left: 4px solid #0284c7;
      border-bottom: 1px solid rgba(2, 132, 199, 0.12);
      flex-shrink: 0;
    }
    :root[data-theme="dark"] .wsbd-strip-question , body.theme-dark .wsbd-strip-question {
      background: rgba(2, 132, 199, 0.08);
      border-left-color: #38bdf8;
      border-bottom-color: rgba(56, 189, 248, 0.15);
    }
    .wsbd-strip-badge {
      font-size: 10px;
      font-weight: 800;
      text-transform: uppercase;
      letter-spacing: 0.6px;
      color: var(--theme-primary, #0284c7);
      background: rgba(2, 132, 199, 0.1);
      padding: 3px 8px;
      border-radius: 4px;
      flex-shrink: 0;
    }
    :root[data-theme="dark"] .wsbd-strip-badge , body.theme-dark .wsbd-strip-badge {
      color: #38bdf8;
      background: rgba(56, 189, 248, 0.15);
    }
    .wsbd-strip-text {
      font-size: 14.5px;
      font-weight: 700;
      color: var(--theme-text, #0f172a);
      font-style: italic;
      line-height: 1.45;
      display: -webkit-box;
      -webkit-line-clamp: 2;
      -webkit-box-orient: vertical;
      overflow: hidden;
      flex: 1;
    }
    :root[data-theme="dark"] .wsbd-strip-text , body.theme-dark .wsbd-strip-text {
      color: #f1f5f9;
    }

    /* 3. CONTENIDO EN 3 COLUMNAS CONTINUAS (TEXTO CORRIDO Y RIGOR EDITORIAL) */
    .wsbd-content-flow {
      padding: 18px 24px 22px 24px;
      overflow-y: auto;
      flex: 1;
      min-height: 0;
      box-sizing: border-box;
      scrollbar-width: thin;
    }

    .wsbd-columns-grid {
      display: grid;
      grid-template-columns: 1fr 1.35fr 1fr;
      gap: 28px;
      height: 100%;
    }
    @media (max-width: 960px) {
      .wsbd-columns-grid {
        grid-template-columns: 1fr;
        gap: 18px;
      }
    }

    .wsbd-col {
      display: flex;
      flex-direction: column;
      gap: 8px;
      border-right: 1px solid var(--theme-border-subtle, #e2e8f0);
      padding-right: 26px;
    }
    :root[data-theme="dark"] .wsbd-col , body.theme-dark .wsbd-col {
      border-right-color: rgba(67, 160, 185, 0.18);
    }
    .wsbd-col:last-child {
      border-right: none;
      padding-right: 0;
    }

    .wsbd-col-header {
      display: flex;
      align-items: center;
      gap: 8px;
      margin-bottom: 2px;
    }
    .wsbd-col-dot {
      width: 7.5px;
      height: 7.5px;
      border-radius: 9999px;
      flex-shrink: 0;
    }
    .wsbd-col-dot.dot-intent {
      background: #0284c7;
    }
    .wsbd-col-dot.dot-model {
      background: #10b981;
    }
    .wsbd-col-dot.dot-fatal {
      background: #ef4444;
    }

    .wsbd-col-title {
      font-size: 11px;
      font-weight: 800;
      text-transform: uppercase;
      letter-spacing: 0.5px;
      color: var(--theme-text-muted, #64748b);
      line-height: 1.2;
    }
    .wsbd-col.wsbd-col-center .wsbd-col-title {
      color: #059669;
    }
    :root[data-theme="dark"] .wsbd-col.wsbd-col-center .wsbd-col-title , body.theme-dark .wsbd-col.wsbd-col-center .wsbd-col-title {
      color: #34d399;
    }
    .wsbd-col-fatal-title {
      color: #dc2626 !important;
    }
    :root[data-theme="dark"] .wsbd-col-fatal-title , body.theme-dark .wsbd-col-fatal-title {
      color: #f87171 !important;
    }

    .wsbd-col-text {
      font-size: 13px;
      line-height: 1.65;
      color: var(--theme-text, #334155);
      margin: 0;
      font-weight: 400;
    }
    .wsbd-col-text.text-model {
      color: var(--theme-text, #0f172a);
      font-weight: 500;
    }
    :root[data-theme="dark"] .wsbd-col-text.text-model , body.theme-dark .wsbd-col-text.text-model {
      color: #f1f5f9;
    }

    /* Caja de Advertencia Crítica con estilo callout sutil */
    .wsbd-alert-card {
      background: rgba(239, 68, 68, 0.04);
      border: 1px solid rgba(239, 68, 68, 0.18);
      border-radius: 7px;
      padding: 10px 12px;
      margin-top: 2px;
    }
    :root[data-theme="dark"] .wsbd-alert-card , body.theme-dark .wsbd-alert-card {
      background: rgba(239, 68, 68, 0.08);
      border-color: rgba(239, 68, 68, 0.28);
    }
    .wsbd-col-text.text-fatal {
      color: #991b1b;
      font-weight: 500;
      line-height: 1.6;
    }
    :root[data-theme="dark"] .wsbd-col-text.text-fatal , body.theme-dark .wsbd-col-text.text-fatal {
      color: #fca5a5;
    }

    .wsbd-formula-pill {
      font-family: monospace;
      font-size: 12px;
      font-weight: 700;
      color: #0284c7;
      background: rgba(2, 132, 199, 0.08);
      border: 1px dashed rgba(2, 132, 199, 0.35);
      border-radius: 6px;
      padding: 6px 11px;
      line-height: 1.4;
      display: inline-block;
    }
    :root[data-theme="dark"] .wsbd-formula-pill , body.theme-dark .wsbd-formula-pill {
      color: #38bdf8;
      background: rgba(56, 189, 248, 0.1);
      border-color: rgba(56, 189, 248, 0.3);
    }

    /* 4. BARRA DE PIE INFERIOR (BOTTOM FOOTER & BOTÓN SIGUIENTE) */
    .wsbd-bottom-footer {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 16px;
      padding: 8px 24px 10px 24px;
      background: var(--theme-pill-bg, #f8fafc);
      border-top: 1px solid var(--theme-border-subtle, #e2e8f0);
      flex-shrink: 0;
      box-sizing: border-box;
    }
    :root[data-theme="dark"] .wsbd-bottom-footer , body.theme-dark .wsbd-bottom-footer {
      background: #08111c;
      border-top-color: rgba(67, 160, 185, 0.2);
    }
    .wsbd-footer-meta {
      display: flex;
      align-items: center;
      gap: 8px;
    }
    .wsbd-footer-counter {
      font-size: 11.5px;
      font-weight: 700;
      color: var(--theme-text-muted, #64748b);
      letter-spacing: 0.2px;
    }
    :root[data-theme="dark"] .wsbd-footer-counter , body.theme-dark .wsbd-footer-counter {
      color: #94a3b8;
    }
    .wsbd-footer-actions {
      display: flex;
      align-items: center;
      gap: 10px;
    }
    .wsbd-next-btn {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      padding: 6px 16px;
      border-radius: 7px;
      border: 1px solid var(--theme-primary, #0284c7);
      background: var(--theme-primary, #0284c7);
      color: #ffffff;
      font-family: inherit;
      font-size: 12px;
      font-weight: 700;
      cursor: pointer;
      transition: all 0.16s ease;
      box-shadow: 0 1px 4px rgba(2, 132, 199, 0.25);
      user-select: none;
    }
    .wsbd-next-btn:hover {
      background: #0369a1;
      border-color: #0369a1;
      transform: translateY(-1px);
      box-shadow: 0 3px 8px rgba(2, 132, 199, 0.35);
    }
    .wsbd-next-btn:active {
      transform: translateY(0);
    }
    :root[data-theme="dark"] .wsbd-next-btn , body.theme-dark .wsbd-next-btn {
      background: #0284c7;
      border-color: #38bdf8;
      color: #ffffff;
    }
    :root[data-theme="dark"] .wsbd-next-btn:hover , body.theme-dark .wsbd-next-btn:hover {
      background: #0369a1;
    }

    /* =========================================================================
       PANEL INFERIOR: VISTA DE LEVANTAMIENTO DE OBSERVACIONES DEL ASESOR
       ========================================================================= */
    .wsbd-revision-container {
      display: flex;
      flex-direction: column;
      gap: 14px;
      height: 100%;
    }

    .wsbd-revision-header-row {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 16px;
      padding-bottom: 10px;
      border-bottom: 1px solid var(--theme-border-subtle, #e2e8f0);
    }
    :root[data-theme="dark"] .wsbd-revision-header-row , body.theme-dark .wsbd-revision-header-row {
      border-bottom-color: rgba(67, 160, 185, 0.2);
    }

    .wsbd-revision-status-badge {
      display: inline-flex;
      align-items: center;
      gap: 7px;
      padding: 3.5px 12px;
      border-radius: 9999px;
      font-size: 11.5px;
      font-weight: 700;
      color: #065f46;
      background: #d1fae5;
      border: 1px solid #6ee7b7;
    }
    :root[data-theme="dark"] .wsbd-revision-status-badge , body.theme-dark .wsbd-revision-status-badge {
      color: #34d399;
      background: rgba(16, 185, 129, 0.16);
      border-color: rgba(52, 211, 153, 0.4);
    }

    .wsbd-rev-pulse-dot {
      width: 7px;
      height: 7px;
      border-radius: 9999px;
      background: #10b981;
      box-shadow: 0 0 6px rgba(16, 185, 129, 0.8);
      animation: pulseRev 1.8s infinite;
    }
    @keyframes pulseRev {
      0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
      70% { transform: scale(1.1); box-shadow: 0 0 0 5px rgba(16, 185, 129, 0); }
      100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
    }

    .wsbd-revision-source {
      font-size: 12px;
      color: var(--theme-text-muted, #64748b);
    }
    :root[data-theme="dark"] .wsbd-revision-source , body.theme-dark .wsbd-revision-source {
      color: #94a3b8;
    }

    .wsbd-revision-grid {
      display: grid;
      grid-template-columns: 1fr 1.35fr;
      gap: 20px;
      flex: 1;
      min-height: 0;
    }
    @media (max-width: 900px) {
      .wsbd-revision-grid {
        grid-template-columns: 1fr;
      }
    }

    .wsbd-rev-card {
      display: flex;
      flex-direction: column;
      gap: 10px;
      padding: 14px 18px;
      border-radius: 10px;
      border: 1px solid var(--theme-border-subtle, #e2e8f0);
      background: var(--theme-pill-bg, #f8fafc);
      overflow-y: auto;
      scrollbar-width: thin;
    }
    :root[data-theme="dark"] .wsbd-rev-card , body.theme-dark .wsbd-rev-card {
      background: #0d1b2d;
      border-color: rgba(67, 160, 185, 0.25);
    }

    .wsbd-rev-card.card-asesor {
      border-left: 4px solid #f59e0b;
      background: rgba(245, 158, 11, 0.035);
    }
    :root[data-theme="dark"] .wsbd-rev-card.card-asesor , body.theme-dark .wsbd-rev-card.card-asesor {
      border-left-color: #fbbf24;
      background: rgba(245, 158, 11, 0.08);
    }

    .wsbd-rev-card.card-subsanacion {
      border-left: 4px solid #10b981;
      background: rgba(16, 185, 129, 0.035);
    }
    :root[data-theme="dark"] .wsbd-rev-card.card-subsanacion , body.theme-dark .wsbd-rev-card.card-subsanacion {
      border-left-color: #34d399;
      background: rgba(16, 185, 129, 0.08);
    }

    .wsbd-rev-card-title {
      display: flex;
      align-items: center;
      gap: 8px;
      font-size: 11.5px;
      font-weight: 800;
      text-transform: uppercase;
      letter-spacing: 0.5px;
      color: var(--theme-text-muted, #64748b);
    }
    .card-asesor .wsbd-rev-card-title {
      color: #b45309;
    }
    :root[data-theme="dark"] .card-asesor .wsbd-rev-card-title , body.theme-dark .card-asesor .wsbd-rev-card-title {
      color: #fbbf24;
    }
    .card-subsanacion .wsbd-rev-card-title {
      color: #065f46;
    }
    :root[data-theme="dark"] .card-subsanacion .wsbd-rev-card-title , body.theme-dark .card-subsanacion .wsbd-rev-card-title {
      color: #34d399;
    }

    .wsbd-rev-icon {
      font-size: 14px;
    }

    .wsbd-rev-quote {
      font-size: 13.5px;
      line-height: 1.6;
      font-style: italic;
      color: var(--theme-text, #1e293b);
      padding: 10px 14px;
      background: var(--theme-card, #ffffff);
      border-radius: 7px;
      border: 1px dashed rgba(245, 158, 11, 0.35);
    }
    :root[data-theme="dark"] .wsbd-rev-quote , body.theme-dark .wsbd-rev-quote {
      background: #08111c;
      color: #f1f5f9;
      border-color: rgba(251, 191, 36, 0.35);
    }

    .wsbd-rev-meta {
      font-size: 12px;
      color: var(--theme-text-muted, #64748b);
      margin-top: auto;
    }
    .wsbd-rev-meta-label {
      font-weight: 600;
    }
    .wsbd-rev-meta-val {
      font-weight: 700;
      color: var(--theme-text, #0f172a);
    }
    :root[data-theme="dark"] .wsbd-rev-meta-val , body.theme-dark .wsbd-rev-meta-val {
      color: #f1f5f9;
    }

    .wsbd-rev-text {
      font-size: 13.5px;
      line-height: 1.65;
      color: var(--theme-text, #1e293b);
      font-weight: 500;
    }
    :root[data-theme="dark"] .wsbd-rev-text , body.theme-dark .wsbd-rev-text {
      color: #f1f5f9;
    }

    .wsbd-rev-justificacion {
      font-size: 12.5px;
      line-height: 1.55;
      color: var(--theme-text-muted, #475569);
      padding: 8px 12px;
      background: var(--theme-card, #ffffff);
      border-radius: 6px;
      border: 1px solid rgba(16, 185, 129, 0.25);
    }
    :root[data-theme="dark"] .wsbd-rev-justificacion , body.theme-dark .wsbd-rev-justificacion {
      background: #08111c;
      color: #cbd5e1;
      border-color: rgba(52, 211, 153, 0.25);
    }

    .wsbd-rev-actions-row {
      margin-top: auto;
      display: flex;
      justify-content: flex-end;
      padding-top: 6px;
    }

    .wsbd-jump-to-paper-btn {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      padding: 5px 14px;
      font-size: 12px;
      font-weight: 700;
      border-radius: 6px;
      border: 1px solid #10b981;
      background: #10b981;
      color: #ffffff;
      cursor: pointer;
      transition: all 0.16s ease;
      font-family: inherit;
      user-select: none;
    }
    .wsbd-jump-to-paper-btn:hover {
      background: #059669;
      border-color: #059669;
      transform: translateY(-1px);
      box-shadow: 0 2px 6px rgba(16, 185, 129, 0.35);
    }

    .wsbd-rev-empty {
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      text-align: center;
      padding: 24px;
      gap: 8px;
      height: 100%;
    }
    .wsbd-rev-empty-icon {
      width: 40px;
      height: 40px;
      border-radius: 9999px;
      background: #d1fae5;
      color: #065f46;
      font-size: 20px;
      font-weight: 800;
      display: flex;
      align-items: center;
      justify-content: center;
    }
    :root[data-theme="dark"] .wsbd-rev-empty-icon , body.theme-dark .wsbd-rev-empty-icon {
      background: rgba(16, 185, 129, 0.2);
      color: #34d399;
    }
    .wsbd-rev-empty-title {
      font-size: 14.5px;
      font-weight: 700;
      color: var(--theme-text, #0f172a);
      margin: 0;
    }
    :root[data-theme="dark"] .wsbd-rev-empty-title , body.theme-dark .wsbd-rev-empty-title {
      color: #f1f5f9;
    }
    .wsbd-rev-empty-desc {
      font-size: 12.5px;
      color: var(--theme-text-muted, #64748b);
      max-width: 520px;
      line-height: 1.55;
      margin: 0;
    }
    :root[data-theme="dark"] .wsbd-rev-empty-desc , body.theme-dark .wsbd-rev-empty-desc {
      color: #94a3b8;
    }



/* Tablas estilo APA 7 en hoja Word */
    .word-table-wrap {
      margin: 22px 0 24px 0;
      width: 100%;
      box-sizing: border-box;
    }
    .word-table-caption {
      margin-bottom: 6px;
      line-height: 1.35;
    }
    .word-table-num {
      font-family: 'Times New Roman', Times, serif;
      font-size: 11pt;
      font-weight: 700;
      color: #0f172a;
      display: block;
    }
    :root[data-theme="dark"] .word-table-num , body.theme-dark .word-table-num {
      color: #f1f5f9;
    }
    .word-table-title {
      font-family: 'Times New Roman', Times, serif;
      font-size: 11pt;
      font-style: italic;
      color: #1e293b;
      display: block;
      margin-top: 1px;
    }
    :root[data-theme="dark"] .word-table-title , body.theme-dark .word-table-title {
      color: #cbd5e1;
    }
    .word-table-scroll {
      width: 100%;
      overflow-x: auto;
      -webkit-overflow-scrolling: touch;
      margin-bottom: 4px;
    }
    .word-academic-table {
      width: 100%;
      border-collapse: collapse;
      font-family: 'Times New Roman', Times, serif;
      font-size: 10pt;
      border-top: 2px solid #0f172a;
      border-bottom: 2px solid #0f172a;
      background: transparent;
    }
    :root[data-theme="dark"] .word-academic-table , body.theme-dark .word-academic-table {
      border-top-color: #94a3b8;
      border-bottom-color: #94a3b8;
    }
    .word-academic-table thead th {
      border-bottom: 1px solid #0f172a;
      padding: 7px 10px;
      font-weight: 700;
      text-align: left;
      color: #0f172a;
      background: rgba(0, 0, 0, 0.02);
    }
    :root[data-theme="dark"] .word-academic-table thead th , body.theme-dark .word-academic-table thead th {
      border-bottom-color: #94a3b8;
      color: #f8fafc;
      background: rgba(255, 255, 255, 0.04);
    }
    .word-academic-table tbody td {
      padding: 6px 10px;
      border: none;
      border-bottom: 1px solid rgba(0, 0, 0, 0.07);
      color: #1e293b;
      line-height: 1.35;
    }
    :root[data-theme="dark"] .word-academic-table tbody td , body.theme-dark .word-academic-table tbody td {
      border-bottom-color: rgba(255, 255, 255, 0.08);
      color: #cbd5e1;
    }
    .word-academic-table tbody tr:last-child td {
      border-bottom: none;
    }
    .word-table-note {
      font-family: 'Times New Roman', Times, serif;
      font-size: 9.5pt;
      color: #475569;
      line-height: 1.4;
      margin-top: 4px;
    }
    :root[data-theme="dark"] .word-table-note , body.theme-dark .word-table-note {
      color: #94a3b8;
    }

    /* Fórmulas matemáticas académicas en hoja Word */
    .word-academic-formula {
      display: flex;
      align-items: center;
      justify-content: space-between;
      margin: 16px 0;
      padding: 10px 20px;
      background: rgba(2, 132, 199, 0.035);
      border-radius: 6px;
      border-left: 3px solid var(--theme-primary, #0284c7);
      box-sizing: border-box;
    }
    :root[data-theme="dark"] .word-academic-formula , body.theme-dark .word-academic-formula {
      background: rgba(56, 189, 248, 0.06);
      border-left-color: #38bdf8;
    }
    .word-formula-expr {
      flex: 1 1 auto;
      text-align: center;
      font-family: 'Cambria Math', 'Times New Roman', Times, serif;
      font-size: 12pt;
      font-style: italic;
      color: #0f172a;
      letter-spacing: 0.2px;
    }
    :root[data-theme="dark"] .word-formula-expr , body.theme-dark .word-formula-expr {
      color: #f1f5f9;
    }
    .word-formula-num {
      flex-shrink: 0;
      font-family: 'Times New Roman', Times, serif;
      font-size: 11pt;
      font-weight: 600;
      color: #64748b;
      padding-left: 14px;
    }
    :root[data-theme="dark"] .word-formula-num , body.theme-dark .word-formula-num {
      color: #94a3b8;
    }

/* =========================================================================
   FIGURAS E IMÁGENES ACADÉMICAS ESTÁNDAR APA 7 (WORD VIVO)
   ========================================================================= */
.word-academic-figure {
  margin: 22px 0;
  display: flex;
  flex-direction: column;
  width: 100%;
  break-inside: avoid;
  page-break-inside: avoid;
}

.word-figure-caption {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 10px;
  text-align: left;
}

.word-figure-num {
  font-family: inherit;
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--text-main, #0f172a);
  letter-spacing: -0.01em;
}

:root[data-theme="dark"] .word-figure-num,
body.theme-dark .word-figure-num {
  color: #f1f5f9;
}

.word-figure-title {
  font-family: inherit;
  font-size: 0.98rem;
  font-style: italic;
  font-weight: 400;
  color: var(--text-main, #0f172a);
  line-height: 1.35;
}

:root[data-theme="dark"] .word-figure-title,
body.theme-dark .word-figure-title {
  color: #cbd5e1;
}

.word-figure-img-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 14px;
  overflow: hidden;
  max-width: 100%;
}

:root[data-theme="dark"] .word-figure-img-wrap,
body.theme-dark .word-figure-img-wrap {
  background: #1e293b;
  border-color: #334155;
}

.word-figure-img {
  max-width: 100%;
  max-height: 520px;
  height: auto;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
  cursor: zoom-in;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.word-figure-img:hover {
  transform: scale(1.01);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.word-figure-note {
  margin-top: 8px;
  font-family: inherit;
  font-size: 0.88rem;
  line-height: 1.4;
  color: #475569;
  text-align: left;
}

:root[data-theme="dark"] .word-figure-note,
body.theme-dark .word-figure-note {
  color: #94a3b8;
}

/* Hoja Word en tema oscuro: papel y tinta con los colores de la plataforma */
:root[data-theme="dark"] .word-sheet-paper {
  background: var(--bg-surface) !important;
  color: var(--text-primary) !important;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.35), 0 0 0 1px var(--border-subtle);
}
:root[data-theme="dark"] .word-sheet-paper .word-univ-title,
:root[data-theme="dark"] .word-sheet-paper .word-fac-title,
:root[data-theme="dark"] .word-sheet-paper .word-school-title,
:root[data-theme="dark"] .word-sheet-paper .word-project-thesis-title,
:root[data-theme="dark"] .word-sheet-paper .word-project-thesis-title-clean,
:root[data-theme="dark"] .word-sheet-paper .word-chapter-number,
:root[data-theme="dark"] .word-sheet-paper .word-chapter-name,
:root[data-theme="dark"] .word-sheet-paper .word-heading-h2,
:root[data-theme="dark"] .word-sheet-paper .word-academic-p,
:root[data-theme="dark"] .word-sheet-paper .wec-title,
:root[data-theme="dark"] .word-sheet-paper .word-table-num,
:root[data-theme="dark"] .word-sheet-paper .word-table-title,
:root[data-theme="dark"] .word-sheet-paper .word-formula-expr,
:root[data-theme="dark"] .word-sheet-paper .wcfb-chapter-title {
  color: var(--text-primary);
}
:root[data-theme="dark"] .word-sheet-paper .word-table-note,
:root[data-theme="dark"] .word-sheet-paper .word-figure-note,
:root[data-theme="dark"] .word-sheet-paper .wec-desc,
:root[data-theme="dark"] .word-sheet-paper .word-chapter-separator .wcs-tag {
  color: var(--text-secondary);
}
:root[data-theme="dark"] .word-sheet-paper .word-chapter-focus-banner,
:root[data-theme="dark"] .word-sheet-paper .word-empty-chapter-sheet,
:root[data-theme="dark"] .word-sheet-paper .word-figure-img-wrap,
:root[data-theme="dark"] .word-sheet-paper .word-chapter-separator .wcs-tag {
  background: var(--bg-elevated);
  border-color: var(--border-subtle);
}

/* ---- Criterio del catálogo de SabiaTec en el panel inferior: metodología con citas, cómo lo cumple el texto y respaldo ---- */
.wsbd-lista { margin: 0; padding-left: 1.2em; display: grid; gap: 4px; font-size: 13px; line-height: 1.55; color: var(--theme-text); }
.wsbd-nota { margin: 0; font-size: 12px; line-height: 1.5; color: var(--theme-text-muted); }
.wsbd-nota strong { color: var(--theme-text); font-weight: 600; }
.wsbd-guia { padding: 6px 10px; border-left: 3px solid var(--primary); background: var(--primary-soft); border-radius: 4px; }
.wsbd-parte-titulo { margin-top: 4px; font-size: 11px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--theme-text-muted); }
.wsbd-cita { font-style: normal; font-size: 0.92em; color: var(--primary); }
.wsbd-elementos { margin: 0; display: grid; grid-template-columns: max-content 1fr; gap: 4px 10px; font-size: 12.5px; }
.wsbd-elementos dt { font-weight: 600; color: var(--theme-text-muted); }
.wsbd-elementos dd { margin: 0; color: var(--theme-text); }
.wsbd-refs { margin: 0; padding-left: 1.1em; display: grid; gap: 6px; font-size: 12px; line-height: 1.5; color: var(--theme-text); }
.wsbd-vacio { color: var(--theme-text-muted); font-style: italic; }
