/* ==========================================================================
   DOCUEXAMEN PRO - ESTILOS CON DEGRADADOS CRFA Y FORMATO A4 TIPO WORD
   ========================================================================== */

:root {
  /* Variables de la interfaz */
  --bg-app: #cbd5e1;
  --bg-sidebar: #ffffff;
  --text-dark: #0f172a;
  --text-muted: #64748b;
  --border-ui: #cbd5e1;

  /* Variables del Degradado Activo en la Hoja A4 */
  --grad-main: linear-gradient(135deg, #0d7a6e 0%, #0f766e 45%, #047857 100%);
  --grad-solid: #0d7a6e;
  --grad-light: #ecfdf5;
  --grad-border: #a7f3d0;
  --grad-accent: #facc15; /* Amarillo dorado para el Año Escolar */

  /* Dimensiones exactas A4 */
  --a4-w: 210mm;
  --a4-min-h: 297mm;
  --a4-pad: 10mm 14mm 10mm 14mm;
  --font-base: 'Calibri', 'Segoe UI', Arial, sans-serif;
  --font-size-base: 9.5pt;
}

/* ==========================================================================
   VARIACIONES DE DEGRADADO (PERSONALIZABLES)
   ========================================================================== */
/* 1. Verde Turquesa CRFA (Exacto como la imagen del docente) */
.grad-verde {
  --grad-main: linear-gradient(135deg, #0d7a6e 0%, #0f766e 45%, #047857 100%);
  --grad-solid: #0d7a6e;
  --grad-light: #ecfdf5;
  --grad-border: #a7f3d0;
  --grad-accent: #facc15;
}

/* 2. Azul Marino Institucional */
.grad-azul {
  --grad-main: linear-gradient(135deg, #1e3a8a 0%, #2563eb 50%, #1d4ed8 100%);
  --grad-solid: #1e3a8a;
  --grad-light: #eff6ff;
  --grad-border: #bfdbfe;
  --grad-accent: #fde047;
}

/* 3. Granate / Vino Tinto Cusco */
.grad-rojo {
  --grad-main: linear-gradient(135deg, #881337 0%, #be123c 50%, #9f1239 100%);
  --grad-solid: #881337;
  --grad-light: #fff1f2;
  --grad-border: #fecdd3;
  --grad-accent: #fef08a;
}

/* 4. Púrpura Académico */
.grad-morado {
  --grad-main: linear-gradient(135deg, #581c87 0%, #7c3aed 50%, #6d28d9 100%);
  --grad-solid: #581c87;
  --grad-light: #faf5ff;
  --grad-border: #e9d5ff;
  --grad-accent: #fde047;
}

/* 5. Ámbar / Dorado */
.grad-ambar {
  --grad-main: linear-gradient(135deg, #78350f 0%, #d97706 50%, #b45309 100%);
  --grad-solid: #78350f;
  --grad-light: #fffbeb;
  --grad-border: #fde68a;
  --grad-accent: #ffffff;
}

/* 6. Gris Pizarra Formal */
.grad-gris {
  --grad-main: linear-gradient(135deg, #1e293b 0%, #334155 50%, #475569 100%);
  --grad-solid: #1e293b;
  --grad-light: #f8fafc;
  --grad-border: #cbd5e1;
  --grad-accent: #38bdf8;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--bg-app);
  color: var(--text-dark);
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ==========================================================================
   1. BARRA PRINCIPAL SUPERIOR (ESTILO OFFICE)
   ========================================================================== */
.app-header {
  height: 58px;
  background: #ffffff;
  border-bottom: 1px solid var(--border-ui);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  z-index: 50;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-icon {
  font-size: 1.8rem;
}

.brand-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: #0f766e;
  line-height: 1.1;
  display: flex;
  align-items: center;
  gap: 6px;
}

.badge-tag {
  font-size: 0.65rem;
  font-weight: 700;
  background: #ccfbf1;
  color: #0f766e;
  padding: 2px 7px;
  border-radius: 4px;
}

.brand-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  font-size: 0.83rem;
  font-weight: 600;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-word {
  background: #2b579a; /* Azul de Microsoft Word */
  color: #ffffff;
  box-shadow: 0 2px 4px rgba(43, 87, 154, 0.25);
}

.btn-word:hover {
  background: #1e3f6f;
  transform: translateY(-1px);
}

.btn-print {
  background: #0f172a;
  color: #ffffff;
}

.btn-print:hover {
  background: #1e293b;
}

.btn-secondary {
  background: #f1f5f9;
  color: #334155;
  border: 1px solid var(--border-ui);
}

.btn-secondary:hover {
  background: #e2e8f0;
}

/* ==========================================================================
   2. BARRA DE HERRAMIENTAS TIPO WORD (RIBBON TOOLBAR)
   ========================================================================== */
.word-ribbon {
  background: #f8fafc;
  border-bottom: 1px solid var(--border-ui);
  display: flex;
  align-items: center;
  padding: 6px 16px;
  gap: 12px;
  overflow-x: auto;
  white-space: nowrap;
}

.ribbon-group {
  display: flex;
  flex-direction: column;
  gap: 3px;
  align-items: center;
}

.group-title {
  font-size: 0.62rem;
  font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.group-controls {
  display: flex;
  align-items: center;
  gap: 4px;
}

.btn-tool {
  background: #ffffff;
  border: 1px solid var(--border-ui);
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 0.82rem;
  color: #334155;
  cursor: pointer;
  height: 28px;
  min-width: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.btn-tool:hover {
  background: #e2e8f0;
}

.select-tool {
  height: 28px;
  font-size: 0.78rem;
  border: 1px solid var(--border-ui);
  border-radius: 4px;
  padding: 0 6px;
  background: #ffffff;
  color: #334155;
}

/* Botones de Columnas */
.btn-pill-toggle {
  background: #ffffff;
  border: 1px solid var(--border-ui);
  border-radius: 14px;
  padding: 4px 10px;
  font-size: 0.74rem;
  font-weight: 600;
  color: #475569;
  cursor: pointer;
  height: 28px;
  display: inline-flex;
  align-items: center;
  transition: all 0.15s;
}

.btn-pill-toggle.active {
  background: #ccfbf1;
  color: #0f766e;
  border-color: #5eead4;
  font-weight: 700;
}

.btn-insert {
  background: #ffffff;
  border: 1px solid var(--border-ui);
  border-radius: 14px;
  padding: 4px 10px;
  font-size: 0.74rem;
  font-weight: 600;
  color: #0f766e;
  cursor: pointer;
  height: 28px;
  display: inline-flex;
  align-items: center;
  transition: all 0.15s;
}

.btn-insert:hover {
  background: #f0fdfa;
  border-color: #2dd4bf;
  transform: translateY(-1px);
}

.ribbon-sep {
  width: 1px;
  height: 32px;
  background: #e2e8f0;
}

/* Selector de color de texto */
.color-picker-box {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: #ffffff;
  border: 1px solid var(--border-ui);
  border-radius: 4px;
  cursor: pointer;
}

.color-picker-box input[type="color"] {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
}

.color-label-a {
  font-weight: 900;
  font-size: 0.85rem;
  border-bottom: 3px solid #000;
  line-height: 1;
}

/* Píldoras de Degradados */
.theme-pills {
  display: flex;
  gap: 5px;
}

.gradient-dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid #ffffff;
  box-shadow: 0 0 0 1px #cbd5e1;
  cursor: pointer;
  transition: transform 0.15s;
}

.gradient-dot:hover {
  transform: scale(1.15);
}

.gradient-dot.active {
  box-shadow: 0 0 0 2px #0f172a;
}

/* Botón subir escudo */
.btn-upload-logo {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #166534;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
  height: 28px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.btn-upload-logo:hover {
  background: #dcfce7;
}

/* ==========================================================================
   3. CONTENEDOR PRINCIPAL: PANEL LATERAL + DOCUMENTO
   ========================================================================== */
.app-workspace {
  display: flex;
  flex: 1;
  overflow: hidden;
  min-height: 0;
  height: calc(100vh - 105px);
  position: relative;
}

/* PANEL LATERAL */
.side-panel {
  width: 360px;
  min-width: 360px;
  height: 100%;
  max-height: 100%;
  min-height: 0;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-ui);
  display: flex;
  flex-direction: column;
  position: relative;
  transition: margin-left 0.25s ease;
  z-index: 20;
  overflow: hidden;
}

.side-panel.collapsed {
  margin-left: -360px;
}

.side-toggle {
  position: absolute;
  top: 12px;
  right: -24px;
  width: 24px;
  height: 36px;
  background: #ffffff;
  border: 1px solid var(--border-ui);
  border-left: none;
  border-radius: 0 6px 6px 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.7rem;
  color: #475569;
  box-shadow: 2px 0 4px rgba(0,0,0,0.06);
}

.side-inner {
  padding: 16px;
  overflow-y: auto !important;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  gap: 14px;
  height: 100%;
  max-height: 100%;
  min-height: 0;
  flex: 1;
}

/* Scrollbar estilizado y visible */
.side-inner::-webkit-scrollbar {
  width: 8px;
}
.side-inner::-webkit-scrollbar-track {
  background: #f1f5f9;
}
.side-inner::-webkit-scrollbar-thumb {
  background: #0f766e;
  border-radius: 4px;
}
.side-inner::-webkit-scrollbar-thumb:hover {
  background: #0d9488;
}

.panel-box {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.03);
}

.box-header {
  padding: 10px 14px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.box-header h3 {
  font-size: 0.85rem;
  font-weight: 700;
  color: #1e293b;
}

.badge-ia {
  font-size: 0.65rem;
  font-weight: 700;
  background: #ccfbf1;
  color: #0f766e;
  padding: 2px 6px;
  border-radius: 10px;
}

.box-body {
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.field-item {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.field-item label {
  font-size: 0.75rem;
  font-weight: 600;
  color: #475569;
}

.grid-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

input[type="text"],
input[type="password"],
input[type="number"],
select,
textarea {
  width: 100%;
  padding: 7px 10px;
  font-size: 0.82rem;
  border: 1px solid var(--border-ui);
  border-radius: 6px;
  font-family: inherit;
  color: #0f172a;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: #0f766e;
  box-shadow: 0 0 0 2px rgba(15, 118, 110, 0.2);
}

.input-pass-group {
  display: flex;
  gap: 4px;
}

.input-pass-group input {
  flex: 1;
}

.input-pass-group button {
  padding: 0 8px;
  background: #f1f5f9;
  border: 1px solid var(--border-ui);
  border-radius: 6px;
  cursor: pointer;
}

.field-help {
  font-size: 0.69rem;
  color: #64748b;
  line-height: 1.25;
}

.btn-generate-ai {
  background: linear-gradient(135deg, #0d7a6e 0%, #059669 100%);
  color: #ffffff;
  padding: 10px;
  font-size: 0.86rem;
  font-weight: 700;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  box-shadow: 0 3px 8px rgba(13, 122, 110, 0.3);
  transition: all 0.2s;
}

.btn-generate-ai:hover {
  filter: brightness(1.1);
}

.btn-fast-template {
  background: #f8fafc;
  border: 1px solid var(--border-ui);
  color: #334155;
  padding: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-fast-template:hover {
  background: #e2e8f0;
}

.tip-card {
  background: #f0fdfa;
  border: 1px solid #99f6e4;
  border-radius: 6px;
  padding: 10px;
  font-size: 0.74rem;
  color: #0f766e;
  line-height: 1.35;
}

/* ==========================================================================
   4. HOJA A4 CON MÁRGENES Y FORMATO PROFESIONAL
   ========================================================================== */
.page-viewport {
  flex: 1;
  background: #64748b;
  overflow-y: auto;
  padding: 30px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 25px;
}

/* LA HOJA A4 IMPRESA REAL */
.sheet-a4 {
  width: var(--a4-w);
  min-height: var(--a4-min-h);
  background: #ffffff;
  color: #000000;
  padding: var(--a4-pad);
  box-shadow: 0 8px 30px rgba(0,0,0,0.35);
  font-family: var(--font-base);
  font-size: var(--font-size-base);
  line-height: 1.35;
  position: relative;
  display: flex;
  flex-direction: column;
}

/* EDICIÓN DIRECTA EN PANTALLA: Clic para editar cualquier texto */
[contenteditable="true"]:hover {
  outline: 1px dashed rgba(13, 122, 110, 0.4);
  cursor: text;
}

[contenteditable="true"]:focus {
  outline: 2px solid rgba(13, 122, 110, 0.65);
  background-color: rgba(240, 253, 250, 0.4);
}

/* ==========================================================================
   5. ENCABEZADO CON DEGRADADO (DISEÑO EXACTO CRFA - IMAGEN 2)
   ========================================================================== */
.header-crfa-banner {
  margin-bottom: 6px;
}

/* Caja de Degradado */
.banner-gradient-box {
  background: var(--grad-main);
  border-radius: 8px;
  padding: 9px 14px;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.12);
}

.banner-escudo-col {
  width: 52px;
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.banner-escudo-col img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

/* Columna Izquierda */
.banner-left-col {
  flex: 1;
}

.text-jerarquia {
  font-size: 7.2pt;
  font-weight: 800;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.95);
  margin-bottom: 1px;
}

.text-nombre-ie {
  font-size: 13.5pt;
  font-weight: 900;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  line-height: 1.15;
  margin: 1px 0;
  color: #ffffff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.15);
}

.text-subtitulo {
  font-size: 7.8pt;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.92);
}

/* Columna Derecha (Tarjeta Translúcida) */
.banner-right-card {
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.32);
  border-radius: 8px;
  padding: 5px 12px;
  text-align: right;
  min-width: 250px;
  backdrop-filter: blur(2px);
}

.card-area-curric {
  font-size: 8.8pt;
  font-weight: 900;
  color: #ffffff;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.card-modalidad-ciclo {
  font-size: 7.2pt;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.95);
  margin: 1px 0;
}

.card-anio-escolar {
  font-size: 8.5pt;
  font-weight: 900;
  color: var(--grad-accent);
  letter-spacing: 0.5px;
}

/* Fila de Datos del Estudiante (Debajo del Banner) */
.student-info-row {
  margin-top: 5px;
  border: 1.5px solid var(--grad-solid);
  border-radius: 6px;
  padding: 5px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: #ffffff;
  font-size: 8.2pt;
  font-weight: 700;
}

.student-cell {
  display: flex;
  align-items: flex-end;
  gap: 6px;
}

.cell-nombres {
  flex: 1;
}

.cell-grado {
  width: 140px;
}

.cell-fecha {
  width: 140px;
}

.cell-label {
  white-space: nowrap;
  color: var(--grad-solid);
  font-size: 7.8pt;
}

.cell-line {
  flex: 1;
  border-bottom: 1.2px dotted #475569;
  height: 13px;
}

.cell-line-short {
  flex: 1;
  border-bottom: 1.2px dotted #475569;
  height: 13px;
  text-align: center;
}

/* Tira de Instrucciones */
.instrucciones-strip {
  background: var(--grad-light);
  border-left: 3.5px solid var(--grad-solid);
  padding: 4px 8px;
  font-size: 7.8pt;
  line-height: 1.25;
  color: #334155;
  margin-top: 5px;
  margin-bottom: 6px;
  border-radius: 0 4px 4px 0;
}

/* ==========================================================================
   6. CUERPO DEL EXAMEN (1 O 2 COLUMNAS)
   ========================================================================== */
.sheet-body-content {
  flex: 1;
}

/* MODO 2 COLUMNAS: OPTIMIZADO PARA PREGUNTAS DE MARCAR */
.layout-2cols .sheet-body-content {
  column-count: 2;
  column-gap: 8mm;
  column-rule: 1px dashed #cbd5e1;
}

.layout-1col .sheet-body-content {
  column-count: 1;
}

/* Secciones de Preguntas */
.seccion-eval {
  break-inside: avoid;
  page-break-inside: avoid;
  margin-bottom: 9px;
}

.seccion-badge-title {
  font-size: 8.5pt;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--grad-solid);
  border-bottom: 1.5px solid var(--grad-border);
  padding-bottom: 2px;
  margin-bottom: 5px;
  display: flex;
  align-items: center;
  gap: 5px;
}

.roman-pill {
  background: var(--grad-solid);
  color: #ffffff;
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 7.8pt;
  font-weight: 900;
}

/* Pregunta Individual (Tarjeta de Marcar) */
.pregunta-card {
  break-inside: avoid;
  page-break-inside: avoid;
  margin-bottom: 7px;
}

.card-enunciado {
  font-size: 8.8pt;
  font-weight: 600;
  margin-bottom: 3px;
  line-height: 1.25;
}

.card-enunciado .num-p {
  color: var(--grad-solid);
  font-weight: 800;
}

.card-enunciado .pts-p {
  font-size: 7.4pt;
  color: #64748b;
  font-style: italic;
}

/* Alternativas */
.opciones-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-left: 6px;
  font-size: 8.2pt;
}

.opcion-item {
  display: flex;
  align-items: flex-start;
  gap: 4px;
}

.opcion-item b {
  min-width: 16px;
  color: #1e293b;
}

/* Filas para Relacionar Conceptos */
.relacionar-grid {
  display: flex;
  flex-direction: column;
  gap: 3.5px;
  padding: 2px 0;
  font-size: 8.2pt;
}

.rel-row {
  display: grid;
  grid-template-columns: 1fr 34px 1fr;
  align-items: center;
  gap: 6px;
  break-inside: avoid;
}

.rel-left {
  text-align: right;
  font-weight: 600;
  line-height: 1.2;
}

.rel-parens {
  text-align: center;
  font-weight: 800;
  font-size: 9pt;
  letter-spacing: 2px;
  color: var(--grad-solid);
}

.rel-right {
  line-height: 1.2;
}

/* Preguntas Abiertas con Líneas Punteadas */
.lines-container {
  margin-top: 3px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.dot-line {
  width: 100%;
  border-bottom: 1.2px dotted #475569;
  height: 12px;
}

/* ==========================================================================
   7. PIE DE PÁGINA ESCOLAR
   ========================================================================== */
.sheet-footer {
  margin-top: auto;
  padding-top: 5px;
  border-top: 1px solid #cbd5e1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 7.4pt;
  color: #64748b;
  break-inside: avoid;
}

.footer-quote {
  font-style: italic;
}

/* ==========================================================================
   8. HOJA DE SOLUCIONARIO
   ========================================================================== */
.hoja-solucionario {
  border-top: 8px solid var(--grad-solid);
}

.sol-card {
  background: #f8fafc;
  border-left: 3.5px solid var(--grad-solid);
  padding: 6px 10px;
  margin-bottom: 7px;
  font-size: 8.5pt;
}

.sol-card b {
  color: var(--grad-solid);
}

.sol-badge {
  display: inline-block;
  background: #dcfce7;
  color: #166534;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 4px;
  margin-top: 3px;
}

/* ==========================================================================
   9. MODAL DE CARGA INTELIGENTE CON CANCELACIÓN
   ========================================================================== */
.loading-modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(4px);
  z-index: 9999;
  align-items: center;
  justify-content: center;
}

.loading-modal-backdrop.active {
  display: flex;
}

.loading-modal-box {
  background: #ffffff;
  padding: 30px 36px;
  border-radius: 12px;
  text-align: center;
  max-width: 440px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.3);
}

.spinner-modern {
  width: 44px;
  height: 44px;
  border: 4px solid #e2e8f0;
  border-top-color: #0f766e;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 14px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-modal-box h3 {
  font-size: 1.05rem;
  color: #0f172a;
  margin-bottom: 4px;
}

.loading-modal-box p {
  font-size: 0.82rem;
  color: #64748b;
  margin-bottom: 14px;
}

.loading-progress-bar {
  height: 6px;
  background: #f1f5f9;
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 16px;
}

.loading-progress-fill {
  height: 100%;
  width: 35%;
  background: #0f766e;
  border-radius: 3px;
  animation: progressAnim 1.4s ease-in-out infinite alternate;
}

@keyframes progressAnim {
  from { width: 10%; margin-left: 0; }
  to { width: 75%; margin-left: 25%; }
}

.btn-modal-cancel {
  background: #f1f5f9;
  border: 1px solid var(--border-ui);
  color: #334155;
  padding: 8px 14px;
  font-size: 0.78rem;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
}

.btn-modal-cancel:hover {
  background: #e2e8f0;
}

/* ==========================================================================
   10. REGLAS DE IMPRESIÓN Y EXPORTACIÓN A PDF EN A4
   ========================================================================== */
@media print {
  @page {
    size: A4 portrait;
    margin: 8mm 12mm 8mm 12mm;
  }

  body {
    background: #ffffff !important;
    color: #000000 !important;
    height: auto !important;
    overflow: visible !important;
  }

  .no-print,
  .app-header,
  .word-ribbon,
  .side-panel,
  .loading-modal-backdrop {
    display: none !important;
  }

  .app-workspace {
    display: block !important;
    overflow: visible !important;
    height: auto !important;
  }

  .page-viewport {
    background: transparent !important;
    padding: 0 !important;
    margin: 0 !important;
    display: block !important;
    overflow: visible !important;
  }

  .sheet-a4 {
    width: 100% !important;
    min-height: auto !important;
    padding: 0 !important;
    margin: 0 !important;
    box-shadow: none !important;
    border: none !important;
    page-break-after: always;
  }

  /* Encabezado completo SOLO en la primera página */
  .header-crfa-banner {
    page-break-inside: avoid;
  }

  /* Evitar cortes indeseados en preguntas */
  .seccion-eval,
  .pregunta-card,
  .rel-row,
  .sol-card {
    break-inside: avoid !important;
    page-break-inside: avoid !important;
  }

  /* 2 columnas en impresión */
  .layout-2cols .sheet-body-content {
    column-count: 2 !important;
    column-gap: 8mm !important;
    column-rule: 1px dashed #777777 !important;
  }

  [contenteditable="true"] {
    outline: none !important;
  }
}
