/* Colores tomados del logo de GR. INGARQ S.A.S */
:root {
  --rojo: #E81C1F;        /* rojo del logo (detalles, bordes) */
  --pri: #D3191C;         /* rojo para botones (mejor contraste con texto blanco) */
  --pri-osc: #A91417;
  --amarillo: #FFD00A;    /* amarillo del logo */
  --amarillo-suave: #FFF6CC;
  --negro: #141414;
  --fondo: #F5F5F3; --borde: #E2E2DE;
  --texto: #1B1B1B; --suave: #66666A;
  --ok: #2E7D32; --aviso: #A86400; --error: #C62828;
  --radio: 12px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--texto); background: var(--fondo); padding-bottom: env(safe-area-inset-bottom); }
body.sin-sesion .interno { display: none; }
body.sin-sesion { background: #fff; }

/* ---------- cabecera ---------- */
header { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 16px; padding-top: max(8px, env(safe-area-inset-top)); background: #fff; border-bottom: 4px solid var(--rojo); }
.marca { display: flex; align-items: center; gap: 12px; font-weight: 800; font-size: 1.1rem; color: var(--negro); }
.marca img { height: 44px; width: auto; }
.cab-der { display: flex; align-items: center; gap: 10px; }
.usuario { font-size: .88rem; color: var(--suave); text-align: right; }
.usuario b { color: var(--texto); display: block; }
.estado { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: .85rem; padding: 6px 16px; background: var(--negro); color: #eee; border-bottom: 3px solid var(--amarillo); }
.punto { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.punto.on { background: #5BD66A; } .punto.off { background: #FF5A52; }
.sep { opacity: .5; }
.lnk { background: none; border: 0; color: inherit; text-decoration: underline; font: inherit; cursor: pointer; padding: 0; }
body.sync .estado::after { content: "  Sincronizando…"; font-weight: 600; color: var(--amarillo); }
nav { display: flex; background: #fff; border-bottom: 1px solid var(--borde); position: sticky; top: 0; z-index: 5; }
nav a { flex: 1; text-align: center; padding: 12px 6px; color: var(--suave); text-decoration: none; font-weight: 600; border-bottom: 3px solid transparent; }
nav a.activo { color: var(--pri); border-bottom-color: var(--pri); }
main { max-width: 1000px; margin: 0 auto; padding: 16px; }
.titulo { margin: 4px 0 14px; font-size: 1.3rem; }

/* ---------- bienvenida y acceso ---------- */
.bienv { min-height: calc(100vh - 32px); min-height: calc(100dvh - 32px); display: flex; flex-direction: column; max-width: 520px; margin: 0 auto; }
.bienv-logo { padding-top: max(8px, env(safe-area-inset-top)); }
.bienv-logo img { width: 150px; height: auto; display: block; }
.bienv-centro { flex: 1; display: flex; flex-direction: column; justify-content: center; text-align: center; padding: 24px 8px; }
.bienv h1 { font-size: 1.9rem; line-height: 1.2; margin: 0 0 12px; color: var(--negro); }
.bienv h1 span { color: var(--rojo); }
.bienv .sub { color: var(--suave); font-size: 1.05rem; margin: 0 auto 36px; max-width: 380px; }
.bienv .botones { display: flex; flex-direction: column; gap: 12px; width: 100%; max-width: 320px; margin: 0 auto; }
.bienv .botones .btn { width: 100%; padding: 14px; font-size: 1.05rem; }
.bienv-pie { text-align: center; font-size: .8rem; color: var(--suave); padding: 14px 0 6px; border-top: 4px solid var(--amarillo); }
.form-acceso { width: 100%; max-width: 360px; margin: 0 auto; text-align: left; display: flex; flex-direction: column; gap: 12px; }
.form-acceso h2 { text-align: center; margin: 0 0 6px; }
.form-acceso .btn { width: 100%; }
.form-acceso .volver { text-align: center; }
.form-acceso a { color: var(--pri); font-weight: 600; }
.nota { font-size: .82rem; color: var(--suave); text-align: center; }
.msg-error { color: var(--error); font-size: .9rem; min-height: 1.2em; text-align: center; }

/* ---------- bienvenida: accesos y perfiles ---------- */
.bienv-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding-top: max(8px, env(safe-area-inset-top)); }
.bienv-top img { width: 150px; height: auto; display: block; }
.acceso-rapido { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; padding-top: 6px; }
.opciones { display: flex; flex-direction: column; gap: 12px; width: 100%; max-width: 420px; margin: 0 auto; }
.opcion { display: flex; align-items: center; gap: 14px; text-align: left; padding: 16px; border: 1px solid var(--borde); border-left: 5px solid var(--rojo); border-radius: var(--radio); background: #fff; color: var(--texto); text-decoration: none; box-shadow: 0 1px 3px rgba(0,0,0,.05); transition: box-shadow .1s, transform .1s; }
.opcion:hover, .opcion:focus-visible { box-shadow: 0 4px 14px rgba(0,0,0,.12); transform: translateY(-1px); outline: none; }
.op-ico { font-size: 1.8rem; }
.op-txt { flex: 1; display: flex; flex-direction: column; }
.op-txt b { font-size: 1.05rem; }
.op-txt small { color: var(--suave); }
.op-fl { font-size: 1.8rem; color: var(--rojo); line-height: 1; }
.separador { display: flex; align-items: center; gap: 12px; margin: 14px 0 2px; color: var(--negro); font-weight: 800; letter-spacing: .18em; font-size: .95rem; }
.separador::before, .separador::after { content: ""; flex: 1; height: 3px; background: var(--amarillo); }
.rol-chip { align-self: center; background: var(--amarillo-suave); border: 1px solid #F0D466; border-radius: 99px; padding: 6px 14px; font-weight: 600; font-size: .9rem; }
.volver.peq { font-size: .85rem; }
.aviso-codigo { background: #fff; border: 2px solid var(--amarillo); border-radius: var(--radio); padding: 14px 16px; margin: 12px 0 16px; display: flex; flex-direction: column; gap: 8px; }
.codigo-grande { font-size: 2rem; font-weight: 800; letter-spacing: .12em; color: var(--pri); font-family: ui-monospace, Consolas, monospace; }
.ficha { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px 16px; margin-bottom: 14px; }
.ficha span { display: block; font-size: .8rem; color: var(--suave); }
.ficha .codigo { font-family: ui-monospace, Consolas, monospace; color: var(--pri); font-size: 1.1rem; letter-spacing: .08em; }
.tabla-eq { min-width: 640px; }
.tabla-eq td { padding: 8px 6px; font-size: .9rem; }
.badge.est-activo { background: #E3F4E4; color: var(--ok); }
.badge.est-pendiente { background: #FFF1CC; color: var(--aviso); }
.badge.est-inactivo { background: #EEE; color: #777; }
button:disabled { opacity: .6; cursor: wait; }

/* ---------- tarjetas de ensayos ---------- */
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.tarjeta { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; text-align: left; padding: 16px; border: 1px solid var(--borde); border-top: 4px solid var(--amarillo); border-radius: var(--radio); background: #fff; cursor: pointer; font: inherit; color: inherit; transition: transform .1s, box-shadow .1s, border-color .1s; }
.tarjeta:hover, .tarjeta:focus-visible { box-shadow: 0 4px 14px rgba(0,0,0,.10); transform: translateY(-1px); border-top-color: var(--rojo); outline: none; }
.tarjeta .ico { font-size: 1.8rem; }
.tarjeta .nom { font-weight: 700; font-size: 1.05rem; }
.norma { font-size: .78rem; color: var(--pri); font-weight: 600; }
.tarjeta .desc { font-size: .88rem; color: var(--suave); }

/* ---------- formularios ---------- */
.card { background: #fff; border: 1px solid var(--borde); border-radius: var(--radio); padding: 14px 16px; margin-bottom: 14px; }
.card h3 { margin: 0 0 12px; font-size: 1rem; color: var(--negro); padding-left: 10px; border-left: 4px solid var(--amarillo); }
.campos { display: grid; gap: 10px 14px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.campo { display: flex; flex-direction: column; gap: 4px; font-size: .88rem; color: var(--suave); }
.campo i { color: var(--error); font-style: normal; }
input, select, textarea { font: inherit; color: var(--texto); padding: 10px 11px; border: 1px solid #D0D0CB; border-radius: 8px; background: #fff; width: 100%; min-height: 44px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--pri); outline-offset: -1px; }
input.err, select.err { border-color: var(--error); background: #FFF2F1; }
textarea { resize: vertical; }
.ubic { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 12px; font-size: .85rem; color: var(--suave); }
.tabla-wrap { overflow-x: auto; margin: 0 -4px 10px; -webkit-overflow-scrolling: touch; }
table { border-collapse: collapse; width: 100%; min-width: 560px; }
th { font-size: .75rem; font-weight: 600; color: var(--suave); text-align: left; padding: 6px 4px; vertical-align: bottom; }
th small { display: block; font-weight: 400; }
th.calc, td.calc { background: var(--amarillo-suave); }
td { padding: 3px 4px; border-top: 1px solid #EEEEEA; }
td input, td select { min-width: 84px; padding: 8px; }
td.calc { font-weight: 700; color: var(--negro); white-space: nowrap; padding: 0 8px; font-variant-numeric: tabular-nums; }
td.n { color: var(--suave); font-size: .8rem; width: 1%; }
.x { border: 0; background: none; color: var(--suave); font-size: 1rem; cursor: pointer; padding: 8px; }
.x:hover { color: var(--error); }
.resultados { border: 2px solid var(--rojo); }
.res { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 8px 0; border-bottom: 1px dashed var(--borde); }
.res:last-child { border-bottom: 0; }
.res b { font-size: 1.1rem; color: var(--pri-osc); font-variant-numeric: tabular-nums; }
.res small { grid-column: 1 / -1; color: var(--suave); }

/* ---------- botones ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-weight: 600; padding: 10px 16px; min-height: 44px; border-radius: 10px; border: 1px solid var(--pri); background: var(--pri); color: #fff; cursor: pointer; text-decoration: none; }
.btn:hover { background: var(--pri-osc); border-color: var(--pri-osc); }
.btn.sec { background: #fff; color: var(--pri); border-color: var(--pri); }
.btn.sec:hover { background: #FFF1F1; }
.btn.peq { padding: 6px 12px; min-height: 36px; font-size: .88rem; }
.btn.grande { padding: 14px 22px; font-size: 1.05rem; flex: 1; }
.btn.peligro { color: var(--error); border-color: #E9B4B0; }
.acciones { display: flex; gap: 10px; flex-wrap: wrap; position: sticky; bottom: 0; padding: 12px 0; background: linear-gradient(transparent, var(--fondo) 30%); }
.cab-form { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.cab-form h2 { margin: 0; font-size: 1.2rem; }
.fila-btn { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.aviso-borrador { background: var(--amarillo-suave); border: 1px solid #F0D466; border-radius: var(--radio); padding: 12px 14px; margin-bottom: 16px; }

/* ---------- registros ---------- */
.barra { display: flex; gap: 8px; flex-wrap: wrap; }
.filtros { display: flex; gap: 8px; margin: 12px 0; }
.filtros select { width: auto; }
.meta { font-size: .82rem; color: var(--suave); margin: 6px 0; }
.lista { display: flex; flex-direction: column; gap: 10px; }
.item { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: start; background: #fff; border: 1px solid var(--borde); border-radius: var(--radio); padding: 12px 14px; }
.item-tit { font-weight: 700; }
.item-acc { grid-column: 1 / -1; display: flex; gap: 8px; }
.badge { font-size: .78rem; font-weight: 700; padding: 4px 10px; border-radius: 99px; white-space: nowrap; }
.badge.pendiente { background: #FFF1CC; color: var(--aviso); }
.badge.sincronizado { background: #E3F4E4; color: var(--ok); }
.vacio { color: var(--suave); text-align: center; padding: 24px 0; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 140%); max-width: 92vw; background: var(--negro); color: #fff; padding: 12px 18px; border-radius: 10px; box-shadow: 0 6px 20px rgba(0,0,0,.25); transition: transform .25s, opacity .25s; z-index: 50; font-size: .92rem; opacity: 0; pointer-events: none; }
.toast.visible { transform: translate(-50%, 0); opacity: 1; }
.toast.ok { background: var(--ok); } .toast.error { background: var(--error); } .toast.aviso { background: var(--aviso); }

@media (max-width: 520px) {
  main { padding: 12px; }
  .grid { grid-template-columns: 1fr 1fr; }
  .tarjeta .desc { display: none; }
  .marca span { display: none; }
  .bienv h1 { font-size: 1.6rem; }
  .bienv-top img { width: 110px; }
  .acceso-rapido .btn { padding: 6px 10px; font-size: .82rem; }
}

/* ---------- menú con muchas pestañas ---------- */
nav { overflow-x: auto; scrollbar-width: none; }
nav::-webkit-scrollbar { display: none; }
nav a { flex: 1 0 auto; padding-left: 14px; padding-right: 14px; white-space: nowrap; }

/* ---------- cotizaciones ---------- */
.cot { display: flex; flex-direction: column; gap: 4px; text-align: left; width: 100%; padding: 14px 16px; border: 1px solid var(--borde); border-left: 5px solid var(--amarillo); border-radius: var(--radio); background: #fff; font: inherit; color: inherit; cursor: pointer; }
.cot:hover, .cot:focus-visible { border-left-color: var(--rojo); box-shadow: 0 4px 14px rgba(0,0,0,.10); outline: none; }
.cot-cab { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.cot-num { font-weight: 800; color: var(--pri); letter-spacing: .03em; }
.cot-cli { font-weight: 700; font-size: 1.05rem; }
.cot-info { border-left: 5px solid var(--rojo); }
.entrega { font-size: .78rem; font-weight: 700; padding: 3px 10px; border-radius: 99px; white-space: nowrap; }
.entrega.ok { background: #E3F4E4; color: var(--ok); }
.entrega.pronto { background: #FFF1CC; color: var(--aviso); }
.entrega.venc { background: #FDE3E1; color: var(--error); }
.cuenta { font-size: .82rem; font-weight: 700; color: var(--aviso); }
.cuenta.lista { color: var(--ok); }
details.otros { margin-top: 18px; }
details.otros summary { cursor: pointer; font-weight: 600; color: var(--pri); margin-bottom: 12px; }
.progreso { height: 8px; background: #EEE; border-radius: 99px; overflow: hidden; margin: 8px 0 2px; }
.progreso div { height: 100%; background: linear-gradient(90deg, var(--amarillo), var(--ok)); }
.ens-cant { display: flex; flex-direction: column; gap: 6px; }
.ens-fila { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 0; border-bottom: 1px dashed var(--borde); }
.ens-fila small { color: var(--suave); }
.ens-fila input { width: 90px; flex: none; text-align: center; }

/* ---------- formato de la empresa ---------- */
.formato { display: grid; grid-template-columns: auto 1fr auto; gap: 6px 14px; align-items: center; background: #fff; border: 2px solid var(--negro); border-radius: 6px; padding: 10px 12px; margin-bottom: 14px; }
.formato img { height: 54px; grid-row: span 2; }
.formato-emp { display: flex; flex-direction: column; font-size: .8rem; }
.formato-tit { font-weight: 800; text-align: center; grid-column: 2; font-size: .95rem; }
.formato-cod { grid-column: 3; grid-row: 1 / span 2; display: flex; flex-direction: column; font-size: .78rem; border-left: 1px solid var(--borde); padding-left: 12px; }
.formato-sub { grid-column: 1 / -1; background: var(--amarillo); text-align: center; font-weight: 700; font-size: .78rem; padding: 4px 8px; border-radius: 3px; }
.tabla-hoja th { background: var(--amarillo); color: var(--negro); text-align: center; }
.tabla-hoja th.calc { background: #FFE57A; }
.tabla-hoja td.fijo { font-size: .8rem; color: var(--suave); white-space: nowrap; padding: 0 8px; }
.tabla-hoja tr.corte td { border-top: 2px solid var(--negro); }
.res-calc { margin-top: 10px; background: var(--amarillo-suave); border-radius: 8px; padding: 2px 12px; }
.res.dest { background: #FFF8DD; margin: 0 -8px; padding: 10px 8px; border-radius: 6px; }
.res.dest b { color: var(--pri); font-size: 1.25rem; }
.grafico { width: 100%; height: auto; font-family: inherit; }
.grafico text { font-size: 11px; fill: var(--suave); }
.grafico .gt { font-size: 13px; font-weight: 700; fill: var(--negro); }
.grafico .ge { font-size: 11.5px; font-weight: 600; fill: var(--texto); }
.grafico .gv { font-size: 13px; }
.grafico .gp { stroke: #BDBDBD; stroke-width: 1; }
.grafico .gs { stroke: #E6E6E6; stroke-width: 1; }
.grafico .gm { fill: none; stroke: #9E9E9E; }

/* ---------- declaración ---------- */
.modal-fondo { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 40; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal { background: #fff; border-radius: 14px; max-width: 560px; width: 100%; max-height: 92vh; overflow: auto; padding: 18px 20px; border-top: 6px solid var(--rojo); display: flex; flex-direction: column; gap: 10px; }
.modal h3 { margin: 0; }
.modal p { margin: 0; }
.opciones-lugar { display: flex; gap: 10px; flex-wrap: wrap; }
.opciones-lugar label { flex: 1; display: flex; align-items: center; gap: 8px; padding: 12px; border: 1px solid var(--borde); border-radius: 10px; cursor: pointer; font-weight: 600; color: var(--texto); }
.opciones-lugar label:has(input:checked) { border-color: var(--pri); background: #FFF1F1; }
.opciones-lugar input, .decl input { width: auto; min-height: 0; accent-color: var(--pri); }
.decl { display: flex; gap: 10px; align-items: flex-start; font-size: .92rem; padding: 8px 10px; background: #FAFAF8; border-radius: 8px; cursor: pointer; }
.decl input { margin-top: 3px; transform: scale(1.25); }

/* ---------- panel ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; margin: 10px 0 16px; }
.kpi { background: #fff; border: 1px solid var(--borde); border-top: 4px solid var(--amarillo); border-radius: var(--radio); padding: 12px 14px; display: flex; flex-direction: column; }
.kpi b { font-size: 1.8rem; color: var(--negro); font-variant-numeric: tabular-nums; }
.kpi span { color: var(--suave); font-size: .85rem; }
.kpi.alerta { border-top-color: var(--rojo); }
.kpi.alerta b { color: var(--pri); }
.tabla-panel { min-width: 680px; }
.tabla-panel td { padding: 8px 6px; font-size: .9rem; vertical-align: top; }
.mini { font-size: .82rem; color: var(--aviso); }
.mini.listo { color: var(--ok); }
@media (max-width: 520px) { .formato { grid-template-columns: auto 1fr; } .formato-cod { grid-column: 1 / -1; grid-row: auto; border-left: 0; padding-left: 0; flex-direction: row; gap: 12px; flex-wrap: wrap; } .formato-tit { grid-column: 1 / -1; } }

/* ---------- vista hoja (réplica del Excel) ---------- */
.barra-hoja { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.selector-vista { display: inline-flex; border: 1px solid var(--pri); border-radius: 10px; overflow: hidden; margin-bottom: 10px; }
.barra-hoja .selector-vista { margin-bottom: 0; }
.selector-vista button { font: inherit; font-weight: 600; font-size: .9rem; padding: 8px 14px; border: 0; background: #fff; color: var(--pri); cursor: pointer; }
.selector-vista button.activo { background: var(--pri); color: #fff; }
.zoom { display: inline-flex; align-items: center; gap: 4px; }
.zoom button { font: inherit; font-weight: 700; min-width: 36px; height: 36px; border: 1px solid var(--borde); border-radius: 8px; background: #fff; cursor: pointer; }
.zoom span { min-width: 52px; text-align: center; font-size: .85rem; color: var(--suave); }
.hoja-marco { overflow: auto; background: #fff; border: 1px solid var(--borde); border-radius: 8px; padding: 12px; margin-bottom: 14px; box-shadow: 0 2px 10px rgba(0,0,0,.06); -webkit-overflow-scrolling: touch; max-height: 78vh; }
.hoja { display: grid; width: max-content; font-family: Arial, Helvetica, sans-serif; font-size: 10.5px; color: #000; background: #fff; }
.hoja .hc { display: flex; flex-direction: column; padding: 1px 3px; overflow: visible; white-space: nowrap; line-height: 1.15; min-width: 0; }
.hoja .hc.wrap { white-space: pre-wrap; overflow: hidden; }
.hoja .hc.rot { writing-mode: vertical-rl; transform: rotate(180deg); align-items: center; justify-content: center !important; white-space: normal; text-align: center; }
.hoja .hl { display: flex; align-items: center; justify-content: center; z-index: 1; padding: 4px; }
.hoja .hl img { max-width: 100%; max-height: 100%; }
.hoja .hg { z-index: 1; background: #fff; padding: 2px 6px; }
.hoja .hg .grafico { width: 100%; height: 100%; }
.hoja .hi { z-index: 2; min-height: 0; height: auto; margin: 2px; padding: 0 4px; border: 0; border-radius: 3px; background: #FFF6C8; font: inherit; font-size: 13px; color: #0B3D91; width: auto; min-width: 0; }
.hoja .hi.num { text-align: center; }
.hoja .hi:focus { outline: 2px solid var(--pri); background: #fff; }
.hoja .hi[readonly] { background: transparent; color: #000; }
.hoja .hk { z-index: 2; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; pointer-events: none; text-align: center; }
.hoja .hk.malo { color: var(--pri); }
.hoja .hx { z-index: 2; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.hoja .hx input { width: 16px; height: 16px; min-height: 0; accent-color: var(--pri); }
.hoja .hg { overflow: hidden; }
.hoja .hg #grafico { height: 100%; }
.hoja .hg .grafico { display: block; }
.hoja-marco { isolation: isolate; position: relative; z-index: 0; }
.acciones { z-index: 6; }
body.vista-ancha main { max-width: 1260px; }
.acciones.compactas { flex-wrap: nowrap; padding: 8px 0; }
.acciones.compactas .btn { padding: 10px 12px; min-height: 42px; white-space: nowrap; }
.acciones.compactas .btn.grande { font-size: 1rem; }
@media (max-width: 520px) { .acciones.compactas .btn { font-size: .85rem; padding: 8px 10px; } .zoom button { min-width: 32px; height: 32px; } }
/* ---------- firmas y revisión ---------- */
.hoja .hf { z-index: 3; display: flex; align-items: flex-end; justify-content: center; pointer-events: none; padding-bottom: 2px; }
.hoja .hf img { max-height: 100%; max-width: 92%; }
.hoja .hn { z-index: 3; display: flex; align-items: flex-end; justify-content: center; font-size: 11px; padding-bottom: 2px; pointer-events: none; }
.firma-prev { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 90px; border: 1px dashed var(--borde); border-radius: 8px; margin: 10px 0; padding: 8px; background: #fff; }
.firma-prev img { max-height: 90px; max-width: 100%; }
.badge.rev-elab { background: #FFF1CC; color: var(--aviso); }
.badge.rev-rev { background: #E3EEFB; color: #1565C0; }
.badge.rev-apr { background: #E3F4E4; color: var(--ok); }
.badge.rev-dev { background: #FDE3E1; color: var(--error); }
.rev-linea { grid-column: 1 / -1; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.nota-dev { font-size: .85rem; color: var(--error); }
.hoja .hk.parrafo { justify-content: flex-start; align-items: flex-start; text-align: left; font-weight: 400; font-size: 11.5px; padding: 3px 6px; white-space: normal; line-height: 1.3; }
.res .res-texto { grid-column: 1 / -1; font-weight: 400; font-size: .95rem; color: var(--texto); }
.hoja .hf { align-items: flex-start; padding: 0; }
.hoja .hf img { max-height: 74%; }
.hoja .hi[data-k="g.laboratorista"] { text-align: center; }
/* firmas grandes que cruzan la línea, sin nombre impreso */
.hoja .hf { align-items: flex-end; padding: 0 0 4px; }
.hoja .hf img { max-height: 60px; max-width: 96%; }

/* ---------- PDF (impresión de la hoja) ---------- */
@page { size: letter portrait; margin: 8mm; }
@media print {
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  body.imprimiendo { background: #fff; }
  body.imprimiendo .interno, body.imprimiendo #toast, body.imprimiendo .modal-fondo,
  body.imprimiendo #app > :not(.hoja-marco) { display: none !important; }
  body.imprimiendo main { max-width: none; padding: 0; margin: 0; }
  body.imprimiendo .hoja-marco { border: 0; padding: 0; margin: 0; box-shadow: none; max-height: none; overflow: visible; border-radius: 0; }
  body.imprimiendo .hoja .hi { background: transparent !important; color: #000 !important; }
  body.imprimiendo input[type=date]::-webkit-calendar-picker-indicator { display: none; }
}
.prep { text-align: center; padding: 32px 20px; margin-top: 20px; }
.prep-ico { font-size: 3rem; }
.prep h2 { margin: 8px 0; }
/* la línea de firma (fin de la fila 52) cruza la firma cerca de su mitad */
.hoja .hf { align-items: flex-end; padding: 0; overflow: visible; }
.hoja .hf img { max-height: 56px; transform: translateY(2px); }
/* PDF de formatos con zona de trabajo: imprimir solo el área del formato */
@media print { body.imprimiendo .hoja-marco[data-clip] { width: var(--w) !important; height: var(--h) !important; overflow: hidden !important; } }
.hoja .hg .graf-gen { height: 100%; }
.hoja .hg .graf-gen .grafico { width: 100%; height: 100%; }
.hoja select.hi { z-index: 2; margin: 2px; padding: 0 2px; border: 0; border-radius: 3px; background: #FFF6C8; font: inherit; font-size: 12px; color: #0B3D91; min-height: 0; height: auto; width: auto; min-width: 0; }
.hoja select.hi:disabled { background: transparent; color: #000; opacity: 1; }
/* ---------- lista compacta de ensayos ---------- */
.lista-ens { display: flex; flex-direction: column; background: #fff; border: 1px solid var(--borde); border-radius: var(--radio); overflow: hidden; }
.fila-ens { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 14px; border: 0; border-bottom: 1px solid #EFEFEC; background: #fff; font: inherit; color: inherit; text-align: left; cursor: pointer; min-height: 56px; }
.fila-ens:last-child { border-bottom: 0; }
.fila-ens:hover, .fila-ens:focus-visible { background: #FFFBEA; outline: none; }
.fe-cod { flex: none; min-width: 68px; text-align: center; font-size: .72rem; font-weight: 800; letter-spacing: .02em; color: var(--pri); background: #FFF1F1; border: 1px solid #F6C9C9; border-radius: 6px; padding: 4px 6px; }
.fe-txt { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.fe-txt b { font-size: .98rem; }
.fe-txt small { color: var(--suave); font-size: .78rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fila-ens .cuenta { flex: none; font-size: .8rem; font-weight: 700; background: #FFF1CC; color: var(--aviso); border-radius: 99px; padding: 2px 9px; }
.fila-ens .cuenta.lista { background: #E3F4E4; color: var(--ok); }
.fe-fl { flex: none; font-size: 1.5rem; color: var(--rojo); line-height: 1; }

.opcion.area { padding: 22px 18px; }
.opcion.area .op-txt b { font-size: 1.15rem; }
.opcion.area.en-prep { border-left-color: var(--amarillo); }

/* resumen mensual */
.resumen-mes h4 { margin: 18px 0 8px; font-size: 1rem; }
.rm-cab { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.rm-cab h3 { margin: 0; }
.rm-nav { display: flex; align-items: center; gap: 10px; }
.rm-nav b { min-width: 150px; text-align: center; }
.rm-nav .btn { min-width: 40px; font-size: 1.2rem; padding: 4px 10px; }
.kpi.km { text-align: left; }
.kpi.km > span { font-size: .85rem; }
.km-vs { margin-top: 2px; font-size: .8rem; }
.km-vs small { color: var(--gris, #666); }
.dl { font-weight: 700; }
.dl.sube { color: #1B7F3B; }
.dl.baja { color: #C62828; }
.rm-barra { position: relative; min-width: 90px; height: 22px; background: #f2f2f2; border-radius: 4px; overflow: hidden; }
.rm-barra::before { content: ""; position: absolute; inset: 0 auto 0 0; width: var(--p); background: var(--rojo, #E81C1F); }
.rm-barra.ant::before { background: #9e9e9e; }
.rm-barra span { position: relative; padding-left: 6px; font-weight: 700; line-height: 22px; font-size: .85rem; color: #111; mix-blend-mode: normal; text-shadow: 0 0 3px #fff; }
.rm-tipos tr.tot td { font-weight: 800; border-top: 2px solid #333; }
.est-ent { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: .8rem; font-weight: 700; white-space: nowrap; }
.est-ent.ok { background: #E3F4E8; color: #1B7F3B; }
.est-ent.tarde { background: #FFF4CC; color: #8A6A00; }
.est-ent.curso { background: #E8EEF9; color: #2D4E8A; }
.est-ent.mal { background: #FDE4E4; color: #C62828; }
.txt-mal { color: #C62828; } .txt-ok { color: #1B7F3B; }
.bienv-centro .opciones + .volver { margin-top: 18px; }

/* formatos de varias hojas */
.hoja-pag + .hoja-pag { margin-top: 28px; }
.hoja-tit { font-weight: 800; background: var(--negro, #111); color: #fff; padding: 6px 12px; border-radius: 6px 6px 0 0; display: inline-block; position: sticky; left: 0; }
@media print {
  body.varias-hojas .hoja-tit { display: none; }
  body.varias-hojas .hoja-pag { break-after: page; page-break-after: always; margin: 0; }
  body.varias-hojas .hoja-pag:last-child { break-after: auto; page-break-after: auto; }
}

.hoja .hl.fig img { width: 100%; height: 100%; object-fit: contain; }

/* avisos de clientes nuevos */
.chip-nuevo { display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: 10px; background: var(--rojo, #E81C1F); color: #fff; font-size: .72rem; font-weight: 800; vertical-align: middle; letter-spacing: .02em; }
.chip-nuevo.cambio { background: #F5A800; color: #111; }
#menu a .contador { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 6px; margin-left: 6px; border-radius: 10px; background: var(--rojo, #E81C1F); color: #fff; font-size: .75rem; font-weight: 800; }
.aviso-nuevos { background: #FFF4CC; border: 1px solid #FFD00A; border-left: 5px solid var(--rojo, #E81C1F); border-radius: 10px; padding: 10px 14px; margin: 0 0 12px; }

/* ensayos en proceso */
.badge.borrador { background: #FFF4CC; color: #7A5A00; border: 1px solid #FFD00A; }
.en-proceso { border-left: 5px solid #FFD00A; }
.en-proceso h3 { margin-top: 0; }

/* bitácora */
.form-bit .campos { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px 14px; }
.form-bit .campo.ancho { grid-column: 1 / -1; }
.svg-comp { width: 100%; height: auto; max-width: 760px; display: block; }
.dia-bit h3 { display: flex; gap: 10px; align-items: baseline; }
.act-bit .cuenta { align-self: center; }
.chip-auto { display: inline-block; padding: 1px 7px; border-radius: 9px; background: #E8EEF9; color: #2D4E8A; font-size: .7rem; font-weight: 700; vertical-align: middle; }
details.hist { margin-top: 10px; }
details.hist summary { cursor: pointer; font-weight: 600; color: var(--pri, #E81C1F); }
.tabla-hist { max-width: 360px; display: inline-table; margin: 8px 16px 8px 0; vertical-align: top; }
.tabla-hist input { width: 80px; min-height: 30px; padding: 2px 6px; }
.kpi b { overflow-wrap: anywhere; }
#lista-bit .kpi b { font-size: 1.45rem; }

/* remisión de muestras */
.tabla-rem { width: 100%; border-collapse: collapse; }
.tabla-rem th { background: var(--amarillo, #FFD00A); padding: 6px; font-size: .85rem; text-align: left; }
.tabla-rem td { padding: 4px; border-bottom: 1px solid #eee; }
.tabla-rem input { width: 100%; min-width: 120px; }
.tabla-rem .cod-m { font-weight: 800; white-space: nowrap; color: var(--pri, #E81C1F); }
.tabla-rem .cod-m small { display: block; font-weight: 400; color: #888; font-size: .7rem; }
.pad-firma { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.pad-firma canvas { width: 100%; max-width: 480px; aspect-ratio: 3 / 1; border: 2px dashed #bbb; border-radius: 10px; background: #fff; touch-action: none; cursor: crosshair; }
.rem-marco { background: #fff; padding: 12px; overflow-x: auto; }
.rem-hoja { width: 760px; margin: 0 auto; font-family: Arial, sans-serif; font-size: 11px; color: #000; border: 1.5px solid #000; }
.rem-hoja table { width: 100%; border-collapse: collapse; }
.rem-hoja td, .rem-hoja th { border: 1px solid #000; padding: 4px 6px; }
.rem-cab td { text-align: center; }
.rem-cab .rem-logo { width: 110px; } .rem-cab .rem-logo img { width: 95px; }
.rem-cab .rem-emp { font-size: 9.5px; } .rem-cab .rem-tit { width: 150px; }
.rem-barra { background: #FFC000; font-weight: 700; text-align: center; padding: 6px; border-top: 1px solid #000; border-bottom: 1px solid #000; }
.rem-sub { text-align: center; padding: 6px; }
.rem-tab th { background: #FFC000; text-align: right; width: 120px; white-space: nowrap; }
.rem-tab tr.amar th { text-align: center; }
.rem-lista td, .rem-ens td { height: 20px; } .rem-lista td:first-child { width: 110px; text-align: center; }
.rem-lista td:nth-child(2) { width: 260px; } .rem-ens td:last-child { width: 130px; text-align: center; }
.rem-obs { padding: 6px; margin: 0; border-bottom: 1px solid #000; }
.rem-firmas .rem-f { width: 230px; text-align: center; } .rem-firmas .rem-f img { max-height: 60px; max-width: 210px; }
.rem-firmas tr.sep td { height: 8px; border-left: 0; border-right: 0; }
/* matriz de facturación */
.barra-sel { position: sticky; top: 0; z-index: 5; display: flex; gap: 10px; align-items: center; background: #FFF4CC; border: 1px solid #FFD00A; border-radius: 10px; padding: 8px 12px; margin: 8px 0; }
.tabla-fac td, .tabla-fac th { font-size: .85rem; }
.sel-todo { font-size: .85rem; display: flex; gap: 6px; align-items: center; }
.sel-todo input, .sel-fac { width: auto; min-height: 0; accent-color: var(--pri, #E81C1F); }
.campo-muestra { max-width: 320px; margin: 0 0 10px; }
.barra-sel[hidden] { display: none; }
@media (max-width: 640px) {
  .tabla-rem thead { display: none; }
  .tabla-rem, .tabla-rem tbody { display: block; }
  .tabla-rem tr { display: grid; grid-template-columns: 1fr auto; gap: 6px; border: 1px solid #e6e6e6; border-left: 4px solid var(--amarillo, #FFD00A); border-radius: 10px; padding: 8px; margin-bottom: 10px; background: #fff; }
  .tabla-rem td { display: block; border: 0; padding: 0; }
  .tabla-rem td:nth-child(2), .tabla-rem td:nth-child(3), .tabla-rem td:nth-child(4) { grid-column: 1 / -1; }
  .tabla-rem td:nth-child(5) { grid-row: 1; grid-column: 2; }
  .tabla-rem input { min-width: 0; }
}

/* ---- clientes agrupados con varias cotizaciones (1.14) */
.cli-grupo { padding: 14px 16px; }
.cli-cab { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.cli-cab h3 { margin: 0 0 2px; }
.cot-fila { border: 1px solid var(--borde); border-left: 4px solid var(--amarillo); border-radius: var(--radio); padding: 10px 12px; margin-top: 10px; display: grid; gap: 4px; background: #fff; }
.cot-fila.cerrada { border-left-color: #2E7D32; background: #FAFAFA; }
.cot-fila .item-acc { flex-wrap: wrap; margin-top: 4px; }
.cot-cerradas { margin-top: 10px; }
.cot-cerradas > summary { cursor: pointer; color: var(--suave); font-weight: 600; }
.badge.est-entregada { background: #E8F5E9; color: #2E7D32; }
.kpi-btn { font: inherit; text-align: left; cursor: pointer; }
.kpi-btn:hover { box-shadow: 0 2px 8px rgba(0,0,0,.08); }
.modal-ancho { max-width: 620px; max-height: 85vh; overflow: auto; }
.ent-fila { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--borde); }
