body {
    background-color: #f1f5f9;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.resultado-md h1, .resultado-md h2, .resultado-md h3 {
    color: #1a3a52;
    margin-top: 1rem;
}

.resultado-md h1 { font-size: 1.3rem; }
.resultado-md h2 { font-size: 1.15rem; }
.resultado-md h3 { font-size: 1rem; }

.resultado-md table {
    width: 100%;
    border-collapse: collapse;
    margin: 0.5rem 0;
    font-size: 0.875rem;
}

.resultado-md table th,
.resultado-md table td {
    border: 1px solid #e2e8f0;
    padding: 0.4rem 0.6rem;
}

.resultado-md table th {
    background-color: #f1f5f9;
    color: #1a3a52;
    font-weight: 600;
}

.resultado-md blockquote {
    border-left: 3px solid #2c5f7f;
    padding-left: 1rem;
    color: #64748b;
    font-style: italic;
    margin: 0.5rem 0;
}

.resultado-md ul, .resultado-md ol {
    padding-left: 1.5rem;
}

.resultado-md li {
    margin-bottom: 0.25rem;
}

.justificacion blockquote {
    border-left-color: #d97706;
    background-color: #fffbeb;
    padding: 0.5rem 1rem;
    border-radius: 0 4px 4px 0;
}

.card-header {
    font-size: 0.9rem;
}

.detail-header {
    margin-left: -12px;
    margin-right: -12px;
    padding-left: 12px;
    padding-right: 12px;
}

.nav-tabs .nav-link {
    font-weight: 500;
    font-size: 0.9rem;
}

.nav-tabs .nav-link.active {
    border-bottom: 2px solid currentColor;
}

/* --- Inventario (móvil primero) --- */
.inv-card { background: #fff; border: 1px solid #e2e8f0; border-radius: 8px; padding: .75rem .9rem; margin-bottom: .5rem; display: block; color: inherit; text-decoration: none; }
.inv-card:hover { border-color: #2c5f7f; color: inherit; }
.inv-folio { font-weight: 700; color: #1a3a52; font-size: 1.05rem; letter-spacing: .02em; }
a.inv-folio, a.inv-folio:hover { color: #1a3a52; }
.inv-badge { font-size: .72rem; padding: .25em .55em; border-radius: 999px; color: #fff; white-space: nowrap; }
.inv-chip { display: inline-block; border: 1px solid #cbd5e1; border-radius: 999px; padding: .2rem .7rem; font-size: .82rem; color: #334155; text-decoration: none; margin: 0 .3rem .4rem 0; background: #fff; }
.inv-chip.active { background: #1a3a52; color: #fff; border-color: #1a3a52; }
.inv-chip.rojo { border-color: #dc2626; color: #dc2626; }
.inv-chip.rojo.active { background: #dc2626; color: #fff; }
.inv-progress { height: 6px; background: #e2e8f0; border-radius: 3px; overflow: hidden; }
.inv-progress > div { height: 100%; background: #2c5f7f; }
.inv-vencido { color: #dc2626; font-weight: 600; }
.inv-pronto { color: #d97706; font-weight: 600; }
.paso { border: 1px solid #e2e8f0; border-radius: 8px; background: #fff; margin-bottom: .5rem; }
.paso .paso-head { display: flex; align-items: center; gap: .75rem; padding: .7rem .9rem; }
.paso-num { width: 28px; height: 28px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: .8rem; font-weight: 700; flex-shrink: 0; background: #e2e8f0; color: #475569; }
.paso.hecho .paso-num { background: #16a34a; color: #fff; }
.paso.na .paso-num { background: #94a3b8; color: #fff; }
.paso.siguiente { border-color: #2c5f7f; box-shadow: 0 0 0 2px rgba(44,95,127,.15); }
.paso.siguiente .paso-num { background: #2c5f7f; color: #fff; }
.paso-body { padding: 0 .9rem .9rem 3.4rem; }
@media (max-width: 575px) { .paso-body { padding-left: .9rem; } }
.btn-navy { background: #1a3a52; color: #fff; }
.btn-navy:hover { background: #2c5f7f; color: #fff; }
.bitacora li { border-left: 2px solid #e2e8f0; padding: .3rem 0 .3rem .8rem; margin-left: .3rem; }
.bitacora li.sistema { color: #64748b; font-size: .85rem; }
.bitacora-caja { max-height: 46vh; overflow-y: auto; overscroll-behavior: contain; padding-right: .3rem; }  /* la bitácora no hace la página infinita */
.form-control, .form-select { font-size: 16px; } /* iOS no hace zoom */
.btn-lg-touch { min-height: 44px; }
.stamp { font-size: .78rem; color: #64748b; }
@media print {
  nav, .alert, .no-print { display: none !important; }
  body { background: #fff; }
  .container-fluid { max-width: none !important; padding: 0 !important; }
}
.inv-nombre { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inv-empresa { font-size: .9rem; font-weight: 600; color: #2c5f7f; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Copiar con un clic: el texto se corta con «…» y los dos cuadritos quedan siempre a la vista, encima del enlace del renglón */
.inv-nombre:has(.inv-copiar), .inv-empresa:has(.inv-copiar) { display: flex; align-items: center; gap: .25rem; }
.inv-texto { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.inv-copiar { position: relative; z-index: 2; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; width: 1.9rem; height: 1.9rem; margin: -.3rem 0; border-radius: 6px; color: #64748b; cursor: pointer; }
.inv-copiar:hover, .inv-copiar:focus-visible { background: #e2e8f0; color: #1a3a52; outline: none; }
.inv-copiar.copiado, .inv-copiar.copiado:hover { color: #16a34a; background: #dcfce7; }
.min-w-0 { min-width: 0; }

/* --- Diseño: secciones con identidad, visor lado a lado --- */
.sec { border: 1px solid #e2e8f0; border-left: 5px solid var(--sec, #1a3a52); border-radius: 8px; background: #fff; margin-bottom: 1rem; }
.sec > .sec-head { display: flex; align-items: center; gap: .6rem; padding: .7rem 1rem; border-bottom: 1px solid #f1f5f9; }
.sec > .sec-head .num { width: 26px; height: 26px; border-radius: 50%; background: var(--sec, #1a3a52); color: #fff; font-size: .8rem; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.sec > .sec-head h6 { margin: 0; color: var(--sec, #1a3a52); }
.sec > .sec-body { padding: .9rem 1rem; }
.sec.fuente { --sec: #1a3a52; } .sec.datos { --sec: #2c5f7f; } .sec.generar { --sec: #0f766e; } .sec.lista { --sec: #b45309; }
.hoja { --h: #64748b; border-left: 4px solid var(--h); padding-left: .75rem; margin-bottom: 1rem; }
.hoja .hoja-titulo { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--h); font-weight: 700; margin-bottom: .35rem; }
.hoja.certificacion { --h: #1a3a52; } .hoja.apostilla { --h: #0f766e; } .hoja.poder { --h: #6d28d9; } .hoja.acta { --h: #b45309; }
.hoja.licencia { --h: #15803d; } .hoja.estatutos { --h: #475569; } .hoja.perito { --h: #9f1239; }
.campo-src { font-size: .75rem; color: #64748b; }
.btn-pag { font-size: .72rem; padding: .05rem .45rem; border-radius: 999px; border: 1px solid #cbd5e1; background: #fff; color: #334155; text-decoration: none; }
.btn-pag:hover { border-color: #1a3a52; color: #1a3a52; }
.visor { position: sticky; top: .5rem; height: calc(100vh - 1.5rem); border: 1px solid #cbd5e1; border-radius: 8px; overflow: hidden; background: #e2e8f0; display: flex; flex-direction: column; }
.visor .visor-bar { display: flex; align-items: center; gap: .5rem; padding: .35rem .6rem; background: #1a3a52; color: #fff; font-size: .8rem; }
.visor .visor-bar a { color: #fff; }
.visor iframe { flex: 1; width: 100%; border: 0; background: #fff; }
@media (max-width: 991px) { .visor { position: static; height: 70vh; margin-bottom: 1rem; } }
.pag-nav { display: flex; flex-wrap: wrap; gap: .25rem; margin-bottom: .5rem; }
.pag-nav .btn-pag.activa { background: #1a3a52; color: #fff; border-color: #1a3a52; }
.pag-card { border: 1px solid #e2e8f0; border-radius: 8px; margin-bottom: .6rem; background: #fff; }
.pag-card .pag-head { display: flex; justify-content: space-between; align-items: center; padding: .4rem .7rem; background: #f8fafc; border-bottom: 1px solid #e2e8f0; font-size: .82rem; }
.pag-card textarea { border: 0; border-radius: 0 0 8px 8px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; line-height: 1.35; }
.duda { display: inline-block; background: #fef3c7; border: 1px solid #f59e0b; color: #78350f; border-radius: 4px; padding: 0 .35rem; font-size: .75rem; margin: .1rem .2rem .1rem 0; cursor: pointer; }
.duda.vista { background: #dcfce7; border-color: #16a34a; color: #14532d; }
.check { display: flex; gap: .6rem; padding: .5rem 0; border-bottom: 1px solid #f1f5f9; }
.check .check-estado { width: 76px; flex-shrink: 0; text-align: center; }
.check .check-cuerpo { flex: 1 1 auto; min-width: 0; }  /* sin min-width:0 el cuerpo se ensancha con la tabla y se corta a la derecha (celular) */
.check .tabla-apoderados td { white-space: normal; }
.check.ok .inv-badge { background: #16a34a; } .check.aviso .inv-badge { background: #d97706; } .check.falla .inv-badge { background: #dc2626; } .check.pendiente .inv-badge { background: #94a3b8; }
.check.aviso { background: #fffbeb; } .check.falla { background: #fef2f2; } .check.info { background: #f0f9ff; } .check.info .inv-badge { background: #0369a1; }
.sticky-acciones { position: sticky; bottom: 0; background: #fff; border-top: 1px solid #e2e8f0; padding: .6rem 0; z-index: 5; }
.visor-cuerpo { flex: 1; overflow: auto; background: #cbd5e1; position: relative; }
.visor-marco { position: relative; margin: 0 auto; background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.25); }
.visor-marco canvas { display: block; }
.visor-capa { position: absolute; inset: 0; pointer-events: none; }
.visor-marca { position: absolute; background: rgba(250, 204, 21, .45); border: 2px solid #eab308; border-radius: 3px; box-shadow: 0 0 0 3px rgba(250, 204, 21, .25); }
.visor-marca.aprox { background: rgba(249, 115, 22, .3); border-color: #ea580c; box-shadow: 0 0 0 3px rgba(249, 115, 22, .2); }  /* parecido, NO textual */
.visor-aviso { position: absolute; left: 0; right: 0; bottom: 0; background: #fffbeb; color: #78350f; font-size: .78rem; padding: .25rem .6rem; }
.visor-aviso:empty { display: none; }
.visor-zona { position: absolute; background: rgba(220, 38, 38, .10); border: 1px dashed rgba(220, 38, 38, .7); border-radius: 3px; }  /* zona del sello: aqui el OCR puede comerse una palabra */
.duda.sello { display: block; background: #fef2f2; border-left: 3px solid #dc2626; padding: .1rem .4rem; margin: .15rem 0; color: #7f1d1d; cursor: pointer; }

.pag-nav .btn-pag.revisada { border-color: #0f766e; color: #0f766e; background: #ecfdf5; }

.visor-zoom { display: inline-flex; align-items: center; gap: .25rem; font-size: .75rem; }
.visor-zoom button { border: 1px solid rgba(255,255,255,.5); background: transparent; color: #fff; border-radius: 4px; padding: 0 .45rem; line-height: 1.4; font-size: .8rem; cursor: pointer; }
.visor-zoom button:hover { background: rgba(255,255,255,.15); }
.visor-cuerpo { overscroll-behavior: contain; }
input.con-origen:focus, textarea.con-origen:focus { box-shadow: 0 0 0 .2rem rgba(250, 204, 21, .45); border-color: #eab308; }
/* Editor del proyecto en pantalla: se ve como el documento, se edita como texto */
.doc-editor { background: #fff; border: 1px solid #cbd5e1; padding: 1.5rem 2rem; font-family: Arial, Helvetica, sans-serif; font-size: 12.5px; line-height: 1.35; max-width: 820px; }
.col-lg-7 .doc-editor { max-width: none; }
.editor-completo #col-visor, .editor-completo #panel-puntos, .editor-completo .alert-primary { display: none !important; }
.editor-completo .col-lg-7 { flex: 0 0 100%; max-width: 100%; }
.editor-completo .doc-scroll { max-height: calc(100vh - 130px); }
.doc-scroll { max-height: calc(100vh - 300px); min-height: 320px; overflow-y: auto; overscroll-behavior: contain; border-radius: 4px; }  /* el proyecto se desplaza dentro de su cuadro: lista y original quedan a la vista */
.doc-par { position: relative; margin: 0; padding: .1rem .4rem; border-left: 3px solid transparent; }
.doc-par.cambiado { border-left-color: #eab308; background: #fffbeb; }
.doc-par.objetivo { border-left-color: #2563eb; background: #eff6ff; }
#panel-puntos .punto.hecho { opacity: .75; }
#panel-puntos .punto-detalle { font-size: .78rem; line-height: 1.25; margin-top: .1rem; }
#panel-puntos .punto-quien { font-size: .75rem; }
.tabla-scroll { max-height: 230px; overflow: auto; }
.tabla-apoderados { font-size: .78rem; } .tabla-apoderados td, .tabla-apoderados th { padding: .15rem .4rem; }
.check.revisado { opacity: .8; }
/* Fiel a la hoja: guiones hasta el margen (tabulador derecho con relleno) y titulos entre guiones (tab centrado).
   El relleno son guiones de verdad, en el mismo color del texto; el editor los pone, no se editan. */
.doc-par.titulo { display: flex; align-items: baseline; }
.doc-par.titulo::before, .doc-par.titulo::after { content: "------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------"; flex: 1 1 0; min-width: 1.6em; overflow: hidden; white-space: nowrap; }  /* min-width: un titulo largo que se parte en dos lineas conserva sus guiones a los lados */
.doc-par.titulo .doc-texto { flex: 0 1 auto; min-width: 0; text-align: center; padding: 0 .1em; }
.doc-par.centrado .doc-texto { text-align: center; }
.doc-par.parrafo .doc-texto, .doc-par.parrafo_izq .doc-texto, .doc-par.encabezado .doc-texto { text-align: justify; overflow: hidden; }
.doc-par.parrafo .doc-texto::after, .doc-par.parrafo_izq .doc-texto::after, .doc-par.encabezado .doc-texto::after {
  content: "------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------";
  display: inline-block; width: 100%; margin-right: -100%; white-space: nowrap; vertical-align: baseline; }  /* sin overflow propio: conserva la linea base del texto; lo recorta el parrafo */
.doc-texto { outline: none; min-height: 1.2em; }
.doc-texto:focus { background: #f8fafc; }
.doc-vacio { height: .9em; }

/* Revision guiada: una tarjeta por duda, dos columnas, tres botones */
.tarjeta { border: 1px solid #e2e8f0; border-left: 5px solid #94a3b8; border-radius: 6px; padding: .6rem .8rem; margin-bottom: .6rem; background: #fff; cursor: pointer; }
.tarjeta.corregir { border-left-color: #dc2626; } .tarjeta.confirmar { border-left-color: #d97706; } .tarjeta.validado { border-left-color: #15803d; background: #f8fafc; }
.tarjeta.activa { box-shadow: 0 0 0 3px rgba(29, 78, 216, .25); }
.tarjeta .pregunta { font-weight: 600; }
.tarjeta .lado { background: #f8fafc; border-radius: 4px; padding: .4rem .6rem; font-size: .9rem; min-height: 100%; }
.tarjeta .lado-titulo { font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: #64748b; margin-bottom: .15rem; }
.tarjeta .recorte img { max-width: 100%; max-height: 190px; border: 1px solid #cbd5e1; border-radius: 4px; background: #fff; }

/* destello del visor al pedir «ver en el original» (revision guiada): que se note que respondio */
.visor.parpadea { box-shadow: 0 0 0 4px #f59e0b; transition: box-shadow .15s; }
.avisos-fijos { position: fixed; top: .75rem; right: .75rem; z-index: 1080; max-width: 520px; }

/* Revisión guiada en T: arriba el punto, abajo traducción y proyecto */
.t-arriba { border: 1px solid #cbd5e1; border-radius: 8px; background: #f8fafc; padding: .5rem .75rem; margin-bottom: .5rem; }
.t-arriba .tarjeta { margin: .5rem 0 0; }
.t-nav { border-bottom: 1px solid #e2e8f0; padding-bottom: .35rem; }
.t-lista { max-height: 32vh; overflow-y: auto; margin-top: .4rem; border: 1px solid #e2e8f0; border-radius: 6px; background: #fff; }
.t-lista .t-item { display: block; padding: .25rem .5rem; font-size: .85rem; color: #1a3a52; text-decoration: none; border-bottom: 1px solid #f1f5f9; }
.t-lista .t-item.activo { background: #e0f2fe; }
.t-lista .t-item .dot { display: inline-block; width: .6rem; height: .6rem; border-radius: 50%; margin-right: .4rem; background: #d97706; }
.t-lista .t-item.corregir .dot { background: #dc2626; }
.t-lista .t-item.validado .dot { background: #15803d; }
.t-abajo .visor { height: 62vh; position: relative; }
.t-proyecto { height: 62vh; border: 1px solid #cbd5e1; border-radius: 8px; overflow: hidden; display: flex; flex-direction: column; background: #fff; }
.t-proyecto .visor-bar { background: #2c5f7f; }
.t-proyecto iframe { flex: 1; width: 100%; border: 0; }
@media (max-width: 991px) { .t-abajo .visor, .t-proyecto { height: 60vh; } }

/* Visor: manita, asas para redimensionar y zoom donde se hace doble clic (15-sep-2026) */
.visor-cuerpo.mano { cursor: grab; }
.visor-cuerpo.mano.arrastrando { cursor: grabbing; user-select: none; }
.visor-zoom button.activo { background: #f59e0b; border-color: #f59e0b; color: #1a3a52; }
.visor-asa { position: absolute; z-index: 3; background: transparent; }
.visor-asa.asa-x { top: 0; bottom: 0; right: -5px; width: 12px; cursor: col-resize; }
.visor-asa.asa-y { left: 0; right: 0; bottom: -5px; height: 12px; cursor: row-resize; }
.visor-asa:hover { background: rgba(245, 158, 11, .45); }
body.visor-redimensionando { cursor: col-resize; user-select: none; }
body.visor-redimensionando iframe, body.visor-redimensionando canvas { pointer-events: none; }
@media (max-width: 991px) { .visor-asa.asa-x { display: none; } }

/* Pantalla del texto: la columna del texto es un panel con su propio desplazamiento, del alto de la ventana igual que el visor;
   las instrucciones y las pestañas de hojas quedan fijas arriba del panel (15-sep-2026: antes había que recorrer el documento entero) */
.t-texto { height: calc(100vh - 1.5rem); overflow: auto; overscroll-behavior: contain; padding-right: .25rem; }
.t-texto-cabeza { position: sticky; top: 0; z-index: 4; background: #f1f5f9; padding: 1px 0 .35rem; margin-bottom: .35rem; border-bottom: 1px solid #e2e8f0; }  /* el padding evita que el margen del primer hijo deje una rendija arriba */
.t-texto .sticky-acciones { background: #f1f5f9; }
@media (max-width: 991px) { .t-texto { height: auto; overflow: visible; } .t-texto-cabeza { position: static; } }
