:root {
  --fondo: #f4f6f9;
  --panel: #ffffff;
  --texto: #1d2733;
  --suave: #5f6b7a;
  --borde: #d5dbe3;
  --primario: #0f5e9c;
  --primario-claro: #e6f0f8;
  --alto: #b42318;
  --alto-fondo: #fde8e6;
  --bajo: #1158b8;
  --bajo-fondo: #e3eefc;
  --anormal: #8a5a00;
  --anormal-fondo: #fff1cc;
  --ok: #1e7b3c;
  --ok-fondo: #e3f4e8;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; font: 15px/1.45 "Segoe UI", system-ui, sans-serif; color: var(--texto); background: var(--fondo); }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0 0 .6rem; line-height: 1.2; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.02rem; }

.barra { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem 1.5rem; padding: .6rem 1.2rem;
  background: var(--primario); color: #fff; position: sticky; top: 0; z-index: 5; }
.marca img { display: block; height: 44px; background: #fff; border-radius: 8px; padding: 3px 8px; }
nav { display: flex; gap: .25rem; flex-wrap: wrap; }
nav button { background: transparent; border: 0; color: #dce9f5; padding: .45rem .8rem; border-radius: 6px; cursor: pointer; }
nav button:hover { background: rgba(255,255,255,.12); color: #fff; }
nav button.activo { background: #fff; color: var(--primario); font-weight: 600; }
.controles { margin-left: auto; display: flex; gap: 1rem; flex-wrap: wrap; }
.controles label { display: flex; align-items: center; gap: .4rem; font-size: .85rem; color: #dce9f5; }
.controles input { padding: .3rem .5rem; border-radius: 5px; border: 1px solid transparent; color: var(--texto); }
.controles input.falta { border-color: #ffb4a8; box-shadow: 0 0 0 2px #ffb4a8; }
/* la franja roja de «otra fecha» baja pegada debajo de la barra azul (su alto lo pone app.js en --alto-barra) */
.aviso-fecha { position: sticky; top: var(--alto-barra, 0px); z-index: 4;
  background: var(--alto); color: #fff; padding: .55rem 1.2rem; font-weight: 600; font-size: 1.02rem;
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.aviso-fecha .btn { background: #fff; color: var(--alto); border-color: #fff; font-weight: 700; }
.campana { position: relative; background: transparent; border: 1px solid rgba(255,255,255,.4); color: #fff; border-radius: 8px;
  font-size: 1.1rem; padding: .25rem .55rem; cursor: pointer; }
.campana.activa, .campana:hover { background: rgba(255,255,255,.18); }
.campana .globo { position: absolute; top: -7px; right: -8px; background: #e11d48; color: #fff; font-size: .7rem; font-weight: 800;
  border-radius: 99px; padding: 1px 6px; border: 2px solid var(--primario); }
.cab-notif { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.notif-lista { list-style: none; padding: 0; margin: 0; }
.notif-lista > li { border: 1px solid var(--borde); border-left: 4px solid var(--borde); border-radius: 8px; padding: .6rem .9rem;
  margin-bottom: .5rem; cursor: pointer; background: #fff; }
.notif-lista > li.nueva { border-left-color: var(--primario); background: var(--primario-claro); }
.notif-lista > li.nueva .titulo { font-weight: 700; }
.notif-lista > li.importante { border-left-color: var(--alto); }
.notif-lista > li.importante .titulo { color: var(--alto); }
.notif-lista > li.media { border-left-color: #e8890c; }
.notif-lista > li.media .titulo { color: #b45f00; }
.filtros-notif { display: flex; flex-wrap: wrap; gap: .35rem; margin: .4rem 0 .8rem; }
.filtros-notif b { background: var(--primario); color: #fff; border-radius: 99px; padding: 0 .4rem; font-size: .75rem; margin-left: .2rem; }
.filtros-notif .activo b { background: #fff; color: var(--primario); }
.notif-cab { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.notif-cab .titulo { flex: 1; }
.notif-cab .quitar-notif { padding: .1rem .45rem; opacity: .55; }
.notif-cab .quitar-notif:hover { opacity: 1; color: var(--alto); }
.notif-lista > li.oculta { opacity: .55; border-style: dashed; }
.notif-detalle { margin: .5rem 0 0; padding-left: 1.2rem; font-size: .9rem; }
.notif-detalle li { margin: .15rem 0; }

main { padding: 1.2rem; max-width: 1400px; margin: 0 auto; }
.columnas { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(280px, .8fr); gap: 1.2rem; align-items: start; }
.columnas.areas { grid-template-columns: minmax(310px, .7fr) minmax(0, 1.6fr); }
@media (max-width: 900px) { .columnas, .columnas.areas { grid-template-columns: minmax(0, 1fr); } }
html[data-dispositivo=movil] .columnas, html[data-dispositivo=movil] .columnas.areas { grid-template-columns: minmax(0, 1fr); gap: .7rem; }
.columnas > * { min-width: 0; }
.panel { background: var(--panel); border: 1px solid var(--borde); border-radius: 10px; padding: 1.1rem 1.2rem; }
.panel + .panel { margin-top: 1rem; }

.campos { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .75rem 1rem; margin-bottom: 1rem; }
.campo { display: flex; flex-direction: column; gap: .25rem; }
.campo > span { font-size: .8rem; font-weight: 600; color: var(--suave); text-transform: uppercase; letter-spacing: .02em; }
.campo.ancho { grid-column: 1 / -1; }
.campo > span.ayuda, .campo > span.error-txt, .campo > span.aviso-txt { text-transform: none; letter-spacing: 0; font-size: .8rem; }
.campo > span.ayuda { font-weight: 400; }
input[type=text], input[type=number], input[type=date], input[type=password], input[type=search], input[type=tel], input[type=email], input:not([type]), select, textarea {
  padding: .45rem .6rem; border: 1px solid var(--borde); border-radius: 6px; background: #fff; min-width: 0; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primario); outline-offset: 0; border-color: var(--primario); }
.fila-inline { display: flex; gap: .5rem; align-items: center; }
.fila-inline > * { flex: 1; }
.radios { display: flex; gap: 1rem; padding: .4rem 0; }
.ayuda { font-size: .82rem; color: var(--suave); }
.error-txt { font-size: .85rem; color: var(--alto); font-weight: 600; }
.ok-txt { font-size: .85rem; color: var(--ok); font-weight: 600; }

.btn { border: 1px solid var(--borde); background: #fff; padding: .5rem 1rem; border-radius: 6px; cursor: pointer; }
.btn:hover { border-color: var(--primario); }
.btn.primario { background: var(--primario); color: #fff; border-color: var(--primario); font-weight: 600; }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn.chico { padding: .25rem .6rem; font-size: .85rem; }
.btn.enlace { border: 0; background: none; color: var(--primario); padding: 0; text-decoration: underline; }
.acciones { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; margin-top: 1rem; }

.examenes fieldset { border: 1px solid var(--borde); border-radius: 8px; margin: 0 0 .7rem; padding: .5rem .8rem .7rem; }
.examenes legend { font-weight: 700; padding: 0 .3rem; color: var(--primario); }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: .2rem .8rem; }
.checks label { display: flex; gap: .4rem; align-items: flex-start; font-size: .92rem; cursor: pointer; }
.perfiles { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .7rem; }
.perfil { display: inline-flex; }
.perfil .btn:first-child { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.perfil .quitar { border-left: 0; border-top-left-radius: 0; border-bottom-left-radius: 0; color: var(--suave); padding-left: .45rem; padding-right: .45rem; }
.perfil .quitar:hover { color: var(--alto); border-color: var(--alto); }
.perfiles .nuevo { border-style: dashed; border-color: var(--primario); color: var(--primario); font-weight: 600; }

.lista { list-style: none; margin: 0; padding: 0; }
.lista li { border-bottom: 1px solid var(--borde); }
.lista li:last-child { border-bottom: 0; }
.lista button { width: 100%; text-align: left; background: none; border: 0; padding: .55rem .4rem; cursor: pointer;
  display: grid; grid-template-columns: 3.6rem 1fr auto; gap: .5rem; align-items: center; border-radius: 6px; }
.lista button:hover { background: var(--primario-claro); }
.celda-cod { display: flex; flex-direction: column; line-height: 1.15; }
.consecutivo { color: #8794a6; font-size: .75rem; font-weight: 600; }
.consecutivo-celda { color: #8794a6; font-weight: 600; text-align: right; width: 2.5rem; }
.lista button.activo { background: var(--primario-claro); outline: 2px solid var(--primario); }
.codigo { font-weight: 800; font-size: 1.05rem; color: var(--primario); }
.sub { font-size: .8rem; color: var(--suave); }
.vacio { color: var(--suave); padding: 1rem 0; }

.chip { display: inline-block; font-size: .75rem; font-weight: 700; padding: .12rem .5rem; border-radius: 99px; white-space: nowrap; }
.chip.pendiente { background: #eef0f3; color: var(--suave); }
.chip.parcial { background: var(--anormal-fondo); color: var(--anormal); }
.chip.completo { background: var(--ok-fondo); color: var(--ok); }
.chip.alerta { background: var(--alto-fondo); color: var(--alto); }

.pestanas { display: flex; flex-wrap: wrap; gap: .35rem; margin-bottom: 1rem; }
.pestanas button { border: 1px solid var(--borde); background: #fff; border-radius: 99px; padding: .35rem .85rem; cursor: pointer; }
.pestanas button.activo { background: var(--primario); color: #fff; border-color: var(--primario); }
.pestanas .n { font-size: .75rem; opacity: .8; margin-left: .25rem; }
.pestanas button.todas { font-weight: 700; border-color: var(--primario); }
/* separador grande de cada área en la pestaña «Todos» */
.area-titulo { background: var(--primario); color: #fff; font-size: 1.15rem; letter-spacing: .03em; text-transform: uppercase;
  padding: .45rem .9rem; border-radius: 8px; margin: 1.6rem 0 .6rem; }
#form-res > .area-titulo:first-child { margin-top: .4rem; }

.cabecera-paciente { display: flex; flex-wrap: wrap; gap: .4rem 1.5rem; align-items: baseline; padding-bottom: .8rem;
  margin-bottom: .8rem; border-bottom: 2px solid var(--primario-claro); }
.cabecera-paciente .codigo { font-size: 1.6rem; }
.cabecera-paciente .nombre { font-size: 1.15rem; font-weight: 700; }

table { border-collapse: collapse; width: 100%; }
.tabla-res th, .tabla-res td { padding: .35rem .5rem; border-bottom: 1px solid #edf0f4; text-align: left; vertical-align: middle; }
.tabla-res th { font-size: .78rem; text-transform: uppercase; color: var(--suave); font-weight: 600; }
.tabla-res td.nombre { width: 34%; }
.tabla-res td.valor { width: 22%; }
.tabla-res td.valor input, .tabla-res td.valor select, .tabla-res td.valor textarea { width: 100%; }
.tabla-res td.unidad { width: 10%; color: var(--suave); font-size: .88rem; }
.tabla-res td.ref { color: var(--suave); font-size: .88rem; }
.tabla-res td.estado { width: 9.5rem; }
.prueba-titulo { margin: 1rem 0 .3rem; color: var(--primario); }
.prueba-titulo:first-of-type { margin-top: 0; }
tr.alto td.valor input, tr.alto td.valor select { background: var(--alto-fondo); border-color: var(--alto); color: var(--alto); font-weight: 700; }
tr.bajo td.valor input, tr.bajo td.valor select { background: var(--bajo-fondo); border-color: var(--bajo); color: var(--bajo); font-weight: 700; }
tr.anormal td.valor input, tr.anormal td.valor select { background: var(--anormal-fondo); border-color: var(--anormal); color: var(--anormal); font-weight: 700; }
tr.invalido td.valor input { border-color: var(--alto); box-shadow: 0 0 0 2px var(--alto-fondo); }
.marca-alerta { font-weight: 800; font-size: .8rem; padding: .15rem .45rem; border-radius: 5px; white-space: nowrap; }
.marca-alerta.alto { background: var(--alto); color: #fff; }
.marca-alerta.bajo { background: var(--bajo); color: #fff; }
.marca-alerta.anormal { background: var(--anormal); color: #fff; }
.marca-alerta.invalido { background: #fff; color: var(--alto); border: 1px solid var(--alto); }
.verificado { font-size: .72rem; color: var(--ok); display: block; margin-top: .15rem; }
.leyenda { display: flex; gap: 1rem; flex-wrap: wrap; font-size: .82rem; color: var(--suave); margin-bottom: .6rem; }

.tabla-dia th, .tabla-dia td { padding: .5rem; border-bottom: 1px solid var(--borde); text-align: left; vertical-align: top; }
.tabla-dia th { background: #f0f3f7; font-size: .8rem; text-transform: uppercase; color: var(--suave); }
.tabla-dia .areas-chips { display: flex; flex-wrap: wrap; gap: .3rem; }
.tabla-dia tr.contacto-entrega td { padding-top: .2rem; color: var(--suave); background: #f8fafc; font-size: .88rem; }
.entrega-nombre-pendiente { color: var(--alto); font-weight: 700; }
.buscar-analito-orden { flex-basis: 100%; display: grid; gap: .3rem; }
.resultados-buscar-analito { display: flex; flex-wrap: wrap; gap: .3rem; }
.desplazar { overflow-x: auto; }

.modal { position: fixed; inset: 0; background: rgba(15, 25, 40, .55); display: flex; align-items: center; justify-content: center; z-index: 20; padding: 1rem; }
.modal[hidden] { display: none; }
.caja { background: #fff; border-radius: 12px; max-width: 640px; width: 100%; max-height: 90vh; overflow: auto; padding: 1.3rem 1.4rem; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.caja h2 { color: var(--alto); }
.verif { list-style: none; padding: 0; margin: 1rem 0; }
.verif li { border: 1px solid var(--borde); border-left: 5px solid var(--alto); border-radius: 8px; padding: .6rem .8rem; margin-bottom: .5rem; }
.verif li.bajo { border-left-color: var(--bajo); }
.verif li.anormal { border-left-color: var(--anormal); }
.verif .valor-grande { font-size: 1.3rem; font-weight: 800; }
.verif label { display: flex; gap: .5rem; margin-top: .4rem; font-weight: 600; cursor: pointer; }

.toast { position: fixed; bottom: 1.2rem; left: 50%; transform: translateX(-50%); background: #1d2733; color: #fff;
  padding: .7rem 1.2rem; border-radius: 8px; z-index: 30; max-width: 90vw; }
.toast.error { background: var(--alto); }

.ref-tabla th, .ref-tabla td { padding: .25rem .35rem; text-align: left; font-size: .88rem; }
.ref-tabla input, .ref-tabla select { width: 100%; padding: .3rem .4rem; }
.ref-tabla { width: 100%; }
.ref-tabla tbody tr:nth-child(even) { background: #f6f8fb; }
.ref-tabla td:first-child { width: 7.5rem; }
.ref-tabla .edad-ref { display: flex; gap: .25rem; }
.ref-tabla .edad-ref input { width: 4rem; flex: none; }
.ref-tabla .edad-ref select { flex: 1; min-width: 4.8rem; }
.sub-editor { margin: 1rem 0 .2rem; color: var(--primario); font-size: 1rem; }
.texto-informe { width: 100%; line-height: 1.5; font-family: inherit; }
.nw { white-space: nowrap; }
.elegir-empresa { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .7rem; margin-top: .8rem; }
.tarjeta-empresa { display: flex; flex-direction: column; gap: .25rem; text-align: left; padding: .9rem 1rem; border: 1px solid var(--borde);
  border-radius: 10px; background: #fff; cursor: pointer; font: inherit; }
.tarjeta-empresa:hover { border-color: var(--primario); background: var(--primario-claro); }
.tarjeta-empresa b { color: var(--primario); font-size: 1rem; }
.tarjeta-empresa.todas { border-style: dashed; }
.empresa-vista { color: var(--primario); }
.resumen-empresa { display: flex; flex-direction: column; gap: .1rem; font-size: .84rem; color: #3d4a5c; margin-top: .2rem; }
.acciones-excel { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin: .2rem 0 .7rem; }
.imp-resumen { display: flex; flex-wrap: wrap; gap: .4rem; margin: .6rem 0; }
.imp-cambios { max-height: 45vh; overflow: auto; border: 1px solid var(--borde); border-radius: 8px; }
.imp-cambios td { vertical-align: top; font-size: .88rem; }
.imp-grupo { margin: .6rem 0; }
.imp-cambios tr.fila-nueva td { background: #eef8ee; }
.imp-grupo summary { cursor: pointer; font-weight: 600; }
.imp-grupo.alerta summary { color: #b3261e; }
.imp-grupo ul { max-height: 25vh; overflow: auto; margin: .3rem 0; font-size: .86rem; }
.check-remitido { display: inline-flex; align-items: center; gap: .2rem; cursor: pointer; color: #56657a; }
.tabla-lineas td.centro { text-align: center; }
.tabla-lineas tr.linea-remitida td:first-child { color: #7a8799; font-style: italic; }
/* preparación, entrega y nota interna debajo de cada examen */
.info-examen { display: flex; flex-direction: column; gap: 1px; margin-top: 3px; font-size: 12px; font-style: normal; line-height: 1.35; }
.info-examen .prep-txt { color: #1f5f99; }
.info-examen .entrega-txt, .entrega-txt { color: #5b6b7f; }
.info-examen .nota-interna { color: #8a5a00; background: #fff6dd; border-radius: 4px; padding: 0 4px; align-self: flex-start; }
.chip.remitido { background: #eceff3; color: #56657a; border: 1px dashed #9aa7b8; }
.prueba-titulo .btn-remitir, .prueba-titulo .btn-traer { margin-left: .6rem; vertical-align: middle; font-weight: 400; }
.bloque-examen .btn-traer, .bloque-examen .nota-remitido { display: none; }
.bloque-examen.es-remitido .btn-traer { display: inline-block; }
.bloque-examen.es-remitido .btn-remitir, .bloque-examen.es-remitido .agregar-analitos,
.bloque-examen.es-remitido .tabla-res { display: none !important; }
.bloque-examen.es-remitido .nota-remitido { display: block; margin: .2rem 0 1rem; padding: .45rem .8rem; border: 1px dashed #9aa7b8; border-radius: 8px; background: #f3f5f8; color: #56657a; }
.bloque-examen.es-remitido .prueba-titulo { color: #7a8799; }
.aviso-validar { background: #fff4e5; border: 1px solid #f0b46a; border-radius: 8px; padding: .4rem .9rem; margin: .6rem 0; }
.aviso-validar ul { margin: .2rem 0; }
.cuenta-pestana { display: inline-block; min-width: 1.4rem; margin-left: .35rem; padding: 0 .4rem; border-radius: 999px; background: #e0e7f1; color: #24405f; font-size: .78rem; font-weight: 700; text-align: center; }
.activo .cuenta-pestana { background: rgba(255,255,255,.25); color: #fff; }
.cuenta-pestana.alerta { background: #c62828; color: #fff; }
.cuenta-pestana.cero { opacity: .55; }
.chip-mas { display: inline-block; margin-left: .3rem; padding: 0 .45rem; border-radius: 999px; background: #e8eef6; color: #4a5b70; font-size: .78rem; white-space: nowrap; }
.tarjeta-analito { border: 1px solid var(--borde); border-radius: 8px; padding: .7rem .9rem; margin-bottom: .7rem; }
.tarjeta-analito .cabeza { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: center; margin-bottom: .5rem; }
.nota { background: var(--anormal-fondo); color: var(--anormal); padding: .4rem .6rem; border-radius: 6px; font-size: .85rem; margin-bottom: .5rem; }

/* Informe */
.informe { background: #fff; max-width: 820px; margin: 0 auto; padding: 2rem 2.2rem; border: 1px solid var(--borde); }
.informe header { display: flex; justify-content: space-between; border-bottom: 3px solid var(--primario); padding-bottom: .6rem; margin-bottom: 1rem; }
.informe .lab { font-size: 1.4rem; font-weight: 800; color: var(--primario); }
.informe .datos { display: grid; grid-template-columns: repeat(3, 1fr); gap: .3rem 1rem; font-size: .9rem; margin-bottom: 1rem; }
.informe .datos b { display: block; font-size: .72rem; text-transform: uppercase; color: var(--suave); }
.informe h3 { background: var(--primario-claro); color: var(--primario); padding: .3rem .6rem; margin-top: 1rem; font-size: .95rem; }
.informe table th, .informe table td { padding: .28rem .5rem; border-bottom: 1px solid #eef1f4; text-align: left; font-size: .9rem; }
.informe table th { font-size: .72rem; text-transform: uppercase; color: var(--suave); }
.informe .fuera { font-weight: 800; }
.informe .pie { margin-top: 2rem; font-size: .8rem; color: var(--suave); border-top: 1px solid var(--borde); padding-top: .6rem; }
.informe .subprueba td { font-weight: 600; color: var(--suave); font-size: .82rem; padding-top: .6rem; }

/* Utilidades */
.mayus { text-transform: uppercase; }
.campo.ancho2 { grid-column: span 2; }
@media (max-width: 600px) { .campo.ancho2 { grid-column: auto; } }
.info-txt { font-size: .85rem; color: var(--primario); font-weight: 600; }
.aviso-txt { color: var(--anormal); font-weight: 600; font-size: .85rem; }
.btn.ancho { width: 100%; }
/* Botones con color para identificarlos rápido: editar azul, agregar verde, eliminar rojo */
.btn.editar { background: #e8f1fb; color: #0b4f86; border: 1.5px solid #5b9bd5; font-weight: 600; }
.btn.editar:hover { background: #d4e6f8; border-color: #0b4f86; }
.btn.agregar { background: #e6f5ea; color: #17643a; border: 1.5px solid #4caf73; font-weight: 600; }
.btn.agregar:hover { background: #d2eedb; border-color: #17643a; }
.btn.peligro { background: #fdecea; color: var(--alto); border: 1.5px solid #e8918a; font-weight: 600; }
.btn.peligro:hover { background: #fbd9d5; border-color: var(--alto); }
td.num .precio { font-weight: 600; }
.lista li.con-eliminar { display: flex; align-items: center; gap: .3rem; }
.lista li.con-eliminar > button[data-orden] { flex: 1; }
.lista .quitar-orden { width: auto; display: inline-block; padding: .2rem .45rem; opacity: .65; }
.quitar-orden:hover { opacity: 1; }
a.btn { display: inline-block; text-decoration: none; color: inherit; }
a.btn.primario { color: #fff; }
.caja h2.ok { color: var(--ok); }
.caja.ancha { max-width: 920px; }
input.falta, select.falta { border-color: var(--anormal); box-shadow: 0 0 0 2px var(--anormal-fondo); background: #fffaf0; }
input:disabled, select:disabled { background: #f3f5f8; color: #3c4653; }
.usuario-actual { font-size: .85rem; color: #dce9f5; align-self: center; }
.salir { background: transparent; color: #fff; border-color: rgba(255,255,255,.4); }
.chip.validado { background: #dff3ff; color: #075985; }

/* Login */
.login { position: fixed; inset: 0; z-index: 1; overflow: auto; display: flex; flex-wrap: wrap; align-items: center;
  justify-content: space-evenly; gap: 2rem; padding: 1.5rem;
  background: linear-gradient(90deg, rgba(8, 40, 75, .25), rgba(8, 40, 75, .05)), url(fondo-login.webp) 70% center / cover no-repeat #dbe9f4; }
.login-marca img { display: block; width: min(340px, 80vw); background: #fff; border-radius: 16px; padding: .8rem 1.2rem;
  box-shadow: 0 12px 32px rgba(0, 0, 0, .2); }
.login-caja { width: 100%; max-width: 420px; filter: drop-shadow(0 14px 30px rgba(0, 0, 0, .22)); }
.login-tabs { display: flex; gap: .3rem; }
.login-tabs button { flex: 1; border: 1px solid var(--borde); border-bottom: 0; background: #eef2f6; padding: .6rem; border-radius: 10px 10px 0 0;
  cursor: pointer; font-weight: 600; color: var(--suave); }
.login-tabs button.activo { background: var(--primario); color: #fff; border-color: var(--primario); }
.login-form { background: #fff; border: 1px solid var(--borde); border-radius: 0 0 12px 12px; padding: 1.3rem 1.4rem; display: grid; gap: .8rem; }
.login-caja > .login-form:first-child { border-radius: 12px; }
.login-form h2 { color: var(--primario); }
.login-contacto { flex: 0 0 100%; align-self: flex-end; display: flex; justify-content: center; align-items: center; flex-wrap: wrap;
  gap: .5rem 1.5rem; margin: auto -1.5rem -1.5rem; padding: .9rem 1.5rem; color: #fff;
  background: rgba(8, 40, 75, .88); text-align: center; font-size: .95rem; }
.login-contacto a { color: #fff; text-decoration: none; }
.login-contacto a:hover, .login-contacto a:focus-visible { text-decoration: underline; }
.login-contacto-wa { font-weight: 700; }
@media (max-width: 600px) {
  .login { align-content: center; gap: 1.25rem; padding-bottom: 0; }
  .login-contacto { margin-top: auto; gap: .4rem .9rem; padding: .8rem 1rem max(.8rem, env(safe-area-inset-bottom)); font-size: .88rem; }
}

/* Portal del paciente */
.portal { max-width: 760px; margin: 0 auto; }
/* fondo del portal del paciente: la foto queda fija detrás, aclarada para que todo se lea bien */
body:has(.portal)::before { content: ""; position: fixed; inset: 0; z-index: -1;
  background: linear-gradient(rgba(244, 246, 249, .55), rgba(244, 246, 249, .75)), url(fondo-portal.webp) center / cover no-repeat; }
body:has(.portal) { background: transparent; }
.portal-marca img { border-radius: 10px; background: #fff; padding: 4px 10px; box-shadow: 0 6px 18px rgba(0, 0, 0, .12); }
.portal-cab { background: rgba(255, 255, 255, .88); backdrop-filter: blur(6px); border-radius: 12px; padding: .9rem 1.1rem;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .08); }
.portal-lista { box-shadow: 0 10px 30px rgba(0, 0, 0, .12); }
.portal-marca { margin-bottom: 1.5rem; }
.portal-marca img { height: 70px; display: block; }
.portal-cab { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: 1rem; }
.portal-lista { list-style: none; padding: 0; margin: 0; background: #fff; border: 1px solid var(--borde); border-radius: 12px; }
.portal-lista li { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .9rem 1.1rem; border-bottom: 1px solid var(--borde); }
.portal-lista li:last-child { border-bottom: 0; }
.portal-acc { display: flex; gap: .6rem; align-items: center; flex-shrink: 0; }

/* Recepción */
.plegable { margin-top: 1rem; border-top: 1px solid var(--borde); padding-top: .7rem; }
.plegable summary { cursor: pointer; font-weight: 600; margin-bottom: .7rem; }
.origen { background: var(--primario-claro); border-radius: 8px; padding: .6rem .8rem 0; margin-bottom: 1rem; }
.entrevista { display: flex; flex-wrap: wrap; gap: .5rem 1.2rem; align-items: center; }
.entrevista label { display: flex; gap: .35rem; align-items: center; cursor: pointer; }
.entrevista input[name=ent_obs] { flex: 1; min-width: 220px; }
.buscador { position: relative; margin-bottom: .7rem; }
.buscador input { width: 100%; }
.sugerencias { position: absolute; z-index: 6; left: 0; right: 0; top: 100%; list-style: none; margin: .2rem 0 0; padding: .3rem;
  background: #fff; border: 1px solid var(--borde); border-radius: 8px; box-shadow: 0 10px 25px rgba(0,0,0,.12); max-height: 22rem; overflow: auto; }
.sugerencias li { padding: .45rem .6rem; border-radius: 6px; cursor: pointer; }
.sugerencias li:hover, .sugerencias li.activo { background: var(--primario-claro); }
.tabla-lineas th, .tabla-lineas td { padding: .35rem .4rem; border-bottom: 1px solid #edf0f4; text-align: left; }
.tabla-lineas th { font-size: .75rem; text-transform: uppercase; color: var(--suave); }
.tabla-lineas .valor-linea { width: 7.5rem; text-align: right; }
.sep-perfiles { flex-basis: 100%; height: 0; }
/* Filtros tipo Excel */
.th-filtro { display: inline-flex; align-items: center; gap: .25rem; white-space: nowrap; }
.btn-filtro { border: 1px solid var(--borde); background: #fff; border-radius: 4px; font-size: .7rem; padding: 0 .3rem; cursor: pointer; color: var(--suave); line-height: 1.4; }
.btn-filtro:hover { border-color: var(--primario); color: var(--primario); }
.btn-filtro.activo { background: var(--primario); color: #fff; border-color: var(--primario); }
.menu-filtro { position: fixed; z-index: 50; width: 290px; background: #fff; border: 1px solid #b9c3cf; border-radius: 8px;
  box-shadow: 0 12px 30px rgba(0,0,0,.18); padding: .4rem; font-size: .85rem; text-transform: none; font-weight: 400; color: var(--texto); }
.menu-filtro > button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: .35rem .5rem; border-radius: 5px; cursor: pointer; }
.menu-filtro > button:hover { background: var(--primario-claro); }
.menu-filtro .buscar-valor { width: 100%; margin: .35rem 0; }
.menu-filtro .valores { max-height: 210px; overflow-y: auto; border: 1px solid var(--borde); border-radius: 6px; padding: .3rem .4rem; }
.menu-filtro .valores label { display: flex; gap: .4rem; align-items: center; padding: .1rem 0; cursor: pointer; white-space: nowrap; }
.menu-filtro .valores label.todos { font-weight: 600; border-bottom: 1px solid var(--borde); margin-bottom: .2rem; padding-bottom: .25rem; }
.menu-filtro .acciones-menu { display: flex; justify-content: flex-end; gap: .4rem; margin-top: .45rem; }
/* la tabla tiene su propio desplazamiento: la barra lateral siempre a la vista y los títulos fijos */
.tabla-excel { max-height: calc(100vh - 300px); min-height: 320px; overflow: auto; border: 1px solid var(--borde); border-radius: 8px; }
.tabla-excel thead th { position: sticky; top: 0; z-index: 2; background: #f0f3f7; }
.tabla-excel::-webkit-scrollbar, .barra-arriba::-webkit-scrollbar { height: 14px; width: 12px; }
.tabla-excel::-webkit-scrollbar-thumb, .barra-arriba::-webkit-scrollbar-thumb { background: #9fb0c3; border-radius: 8px; border: 3px solid #f0f3f7; }
.tabla-excel::-webkit-scrollbar-track, .barra-arriba::-webkit-scrollbar-track { background: #f0f3f7; }
.barra-arriba { overflow-x: auto; overflow-y: hidden; height: 16px; margin-bottom: .3rem; border-radius: 8px; background: #f0f3f7; }
.barra-arriba > div { height: 1px; }
.filtros-rapidos { display: grid; grid-template-columns: auto 1fr; gap: .4rem .8rem; align-items: center; margin: .7rem 0; font-size: .85rem; }
.filtros-rapidos > span { color: var(--suave); font-weight: 600; text-transform: uppercase; font-size: .75rem; }
.filtros-rapidos .grupo { display: flex; flex-wrap: wrap; gap: .3rem; }
.chip-filtro { border: 1px solid var(--borde); background: #fff; border-radius: 99px; padding: .2rem .7rem; cursor: pointer; font-size: .82rem; }
.chip-filtro:hover { border-color: var(--primario); }
.chip-filtro.activo { background: var(--primario); color: #fff; border-color: var(--primario); }
.tabla-examenes tbody tr[data-fila] { cursor: pointer; }
.tabla-examenes tbody tr[data-fila]:hover td { background: var(--primario-claro); }
.lista-examenes button { grid-template-columns: 1fr; }
.lista-examenes { max-height: 65vh; overflow-y: auto; }
.tabla-analitos td { vertical-align: middle; }
.tabla-analitos .mover { display: inline-flex; gap: .15rem; }
.tabla-analitos .mover .btn { padding: .05rem .4rem; }
.tabla-analitos .separador .mover .btn { background: rgba(255,255,255,.2); color: #fff; border-color: rgba(255,255,255,.5); }
.opcionales-pago { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: 1rem; }
.quitar-pago { color: var(--alto); text-decoration: none; font-size: .8rem; margin-left: .3rem; }
.totales { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .6rem; margin-top: 1rem; }
.resumen-pago { display: flex; gap: 2rem; margin-top: .8rem; padding: .7rem 1rem; background: #f0f3f7; border-radius: 8px; }
.resumen-pago div { display: flex; flex-direction: column; }
.resumen-pago b { font-size: 1.25rem; }

/* Búsqueda */
.fila-buscar { display: flex; flex-wrap: wrap; gap: .7rem; align-items: flex-end; }
.fila-buscar > input { flex: 1; min-width: 240px; padding: .6rem .8rem; font-size: 1.05rem; }
.tarjeta-paciente .cab { display: flex; justify-content: space-between; gap: 1rem; align-items: flex-start; margin-bottom: .6rem; }
.tarjeta-paciente h3 { margin-bottom: .2rem; }
td.acc { white-space: nowrap; }
td.acc .btn { margin: .1rem 0; }
tr.anulada td { color: var(--suave); text-decoration: line-through; }
tr.anulada td:last-child, tr.anulada td:nth-child(4) { text-decoration: none; }

/* Resultados */
.tabla-res tr.titulo td { font-size: .75rem; font-weight: 700; color: var(--suave); text-transform: uppercase; background: #f6f8fa; }
.tabla-res td.anterior { font-size: .82rem; width: 7rem; }
/* «marque una sola» (esquema 1-1-3 de la citología): las opciones en una sola fila */
.tabla-res .opciones-unica { display: flex; flex-wrap: wrap; gap: .3rem 1.1rem; }
.tabla-res .opciones-unica label { display: inline-flex; gap: .3rem; align-items: center; cursor: pointer; white-space: nowrap; }
.agregar-analitos .btn.grupo { border-style: dashed; }
/* autocompletar en analitos de texto libre */
.tabla-res td.valor { position: relative; }
.tabla-res .sug-analito { min-width: 18rem; max-height: 16rem; overflow: auto; }
.tabla-res td.anterior .fuera { color: var(--alto); font-weight: 700; }
.tabla-res td.valor textarea { width: 100%; resize: vertical; }
.tabla-res td.quitar { width: 2.2rem; text-align: right; }
.tabla-res td.quitar .btn { padding: .1rem .45rem; opacity: .55; }
.tabla-res tr:hover td.quitar .btn { opacity: 1; }
.agregar-analitos { display: flex; gap: .5rem; align-items: center; margin: .4rem 0 1rem; flex-wrap: wrap; }
.btn.plantilla { background: #eef2fb; color: #2b3f8c; border: 1.5px solid #8ea2e0; font-weight: 600; }
.btn.plantilla:hover { background: #dfe6f8; border-color: #2b3f8c; }
.checks-analitos { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .25rem .8rem; max-height: 50vh; overflow-y: auto; }
.checks-analitos label { display: flex; gap: .4rem; align-items: flex-start; cursor: pointer; }
.checks-analitos .titulo-checks { grid-column: 1 / -1; margin: .5rem 0 0; font-size: .75rem; font-weight: 700; color: var(--suave); text-transform: uppercase; }
.examen-vacio { color: var(--suave); font-size: .9rem; margin: .2rem 0 .3rem; font-style: italic; }
.sel-agregar { border: 1.5px dashed #4caf73; color: #17643a; background: #f3fbf5; font-weight: 600; max-width: 22rem; }

/* Reportes */
.metricas { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; margin: 1rem 0; }
.metricas div { background: #fff; border: 1px solid var(--borde); border-radius: 10px; padding: .9rem 1.1rem; display: flex; flex-direction: column; }
.metricas b { font-size: 1.6rem; color: var(--primario); }
.barras { display: flex; align-items: flex-end; gap: 3px; height: 140px; border-bottom: 1px solid var(--borde); padding-top: .5rem; }
.barras div { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; min-width: 0; }
.barras span { width: 100%; background: var(--primario); border-radius: 3px 3px 0 0; min-height: 2px; }
.barras small { font-size: .6rem; color: var(--suave); }
/* Configuración */
.cab-seccion, .cab-modal { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: .6rem; }
.cab-seccion h2, .cab-modal h2 { margin: 0; }
.acc-edicion { display: inline-flex; gap: .3rem; flex-wrap: wrap; }
.editando { background: #fffbea; }
tr.editando td { background: #fffbea; }
.tabla-cfg td { vertical-align: middle; }
.tabla-cfg td.centro, .tabla-cfg th:nth-last-child(2), .centro { text-align: center; }
.fila-nueva td { background: #f6f9fc; border-top: 2px dashed var(--borde); }
.firma-cfg { display: grid; grid-template-columns: minmax(180px, 260px) 1fr; gap: 1rem; align-items: start; margin-bottom: 1rem; }
@media (max-width: 700px) { .firma-cfg { grid-template-columns: 1fr; } }
.vista-firma { border: 1px dashed var(--borde); border-radius: 8px; padding: .5rem; background: #fff; text-align: center; }
.vista-firma img { max-width: 100%; height: auto; }
.lista-perfiles { list-style: none; padding: 0; margin: 0 0 1rem; }
.lista-perfiles li { display: flex; justify-content: space-between; gap: 1rem; align-items: center; padding: .55rem 0; border-bottom: 1px solid var(--borde); }
.lista-perfiles .acc { white-space: nowrap; }
.editor-perfil { border: 2px solid var(--primario-claro); border-radius: 10px; padding: 1rem; background: #fbfdff; }
.chips-perfil { display: flex; flex-wrap: wrap; gap: .35rem; margin-bottom: .8rem; }
.quitar-chip { border: 0; background: none; cursor: pointer; color: var(--alto); font-weight: 700; padding: 0 0 0 .2rem; }
.filtros-ex { display: grid; grid-template-columns: minmax(220px, 2fr) repeat(5, minmax(120px, 1fr)); gap: .6rem; align-items: end; margin-bottom: .6rem; }
.filtros-ex > input { padding: .55rem .7rem; }
@media (max-width: 1000px) { .filtros-ex { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); } }
.tabla-examenes tr[data-ex] { cursor: pointer; }
.tabla-examenes tr[data-ex]:hover td { background: var(--primario-claro); }
.tabla-examenes td, .tabla-examenes th { padding: .35rem .5rem; font-size: .9rem; vertical-align: middle; }
.tabla-dia tr.separador td, .tabla-examenes tr.separador td { background: var(--primario); color: #fff; font-weight: 700; font-size: .85rem; }
.tabla-dia tr.separador .sub { color: #dce9f5; }
tr.deshabilitado td { color: var(--suave); text-decoration: line-through; }
tr.deshabilitado td:last-child { text-decoration: none; }
td.num, th.num { text-align: right; white-space: nowrap; }
.avanzadas { margin-top: 1rem; }
.avanzadas summary { cursor: pointer; color: var(--suave); font-size: .9rem; }
.lista-todos { max-height: 60vh; overflow-y: auto; overflow-x: hidden; margin-top: .7rem; padding-right: .3rem; }
.examenes .checks label:has(input:checked) { color: var(--primario); font-weight: 600; }
.vista-membrete { border: 1px dashed var(--borde); border-radius: 8px; padding: .6rem; background: #fff; text-align: center; }
.vista-membrete img { max-width: 100%; height: auto; }
.lista-simple { padding-left: 1.1rem; }
.lista-simple li { margin-bottom: .4rem; }

/* Comprobante (impresión) */
#impresion { display: none; }
.comprobante { font-size: 12px; max-width: 80mm; margin: 0 auto; }
.comprobante h2 { font-size: 15px; margin-bottom: 2px; }
.comprobante .grande { font-size: 18px; font-weight: 800; }
.comprobante table { margin: 8px 0; }
.comprobante td { padding: 2px 0; border-bottom: 1px dotted #999; }
.comprobante td:last-child { text-align: right; }
.comprobante .total td { font-weight: 800; }
.comprobante .clave { border: 2px dashed #333; padding: 6px 8px; margin-top: 8px; }
.comprobante .comp-prep { border-top: 1px solid #333; margin-top: 8px; padding-top: 4px; }
.comprobante .comp-prep p { margin: 4px 0; }

@media print {
  @page { margin: 3mm; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }  /* que la franja azul y las alertas salgan con color */
  body { background: #fff; }
  .no-imprimir { display: none !important; }
  main { padding: 0; max-width: none; }
  .informe { border: 0; padding: 0; max-width: none; }
  body.imprimiendo > *:not(#impresion) { display: none !important; }
  body.imprimiendo #impresion { display: block; }
  body.imprimiendo .comprobante { box-sizing: border-box; width: 74mm; max-width: 74mm; margin: 0; }
}
.estado-lista { display: flex; flex-direction: column; align-items: flex-end; gap: .2rem; }

/* Diagnóstico (CIE-10) y bloqueo de exámenes hasta elegirlo */
.bloqueado { opacity: .45; filter: grayscale(.4); pointer-events: none; user-select: none; }
.chip-dx { display: inline-flex; align-items: center; gap: .4rem; background: #eef3fb; border: 1px solid #c9d6ee; border-radius: 8px; padding: .25rem .5rem; margin: .3rem .4rem 0 0; font-size: .85rem; }
.chip-dx .btn { padding: 0 .35rem; line-height: 1.2; }
tr.inactivo td { color: var(--suave); }
/* Modo auditor: la misma interfaz en morado, para que se note que es otra parte del programa */
body.modo-auditor { --primario: #5b2d8e; --primario-claro: #f1e9fb; }
body.modo-auditor .barra { background: linear-gradient(90deg, #4a2275, #6b3aa3); }
.sello-auditor { margin-left: auto; display: flex; align-items: center; gap: .8rem; }
.sello-auditor[hidden] { display: none; }
.sello-auditor span { font-size: 1.5rem; font-weight: 800; letter-spacing: .08em; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.3); }
.salir-auditor { background: #fff; color: #4a2275; border: 0; border-radius: 6px; padding: .45rem .9rem; font-weight: 700; cursor: pointer; }
.salir-auditor:hover { background: #f1e9fb; }
body.modo-auditor .controles { margin-left: 1rem; }
.tarjeta-aud { text-align: left; font: inherit; cursor: pointer; background: #fff; border: 1px solid var(--borde); border-radius: 10px;
  padding: .9rem 1.1rem; display: flex; flex-direction: column; }
.tarjeta-aud b { font-size: 1.6rem; color: var(--primario); }
.tarjeta-aud.alerta { border-color: #f0a35a; background: #fff6ec; }
.tarjeta-aud.alerta b, .tarjeta-aud.alerta .sub:last-child { color: #c25e00; }
.tarjeta-aud:hover { box-shadow: 0 2px 8px rgba(0,0,0,.12); }
.avisos-auditor h4 { margin: .8rem 0 0; color: var(--primario); }
.avisos-auditor .metricas { margin: .5rem 0; }
.lista-avisos { margin: .4rem 0; padding-left: 1.2rem; }
.chip-alerta { display: inline-block; background: #fff1e0; color: #c25e00; border: 1px solid #f0a35a; border-radius: 999px;
  padding: 0 .5rem; font-size: .75rem; font-weight: 600; white-space: nowrap; margin: .1rem 0; }
tr.clic { cursor: pointer; }
tr.clic:hover td { background: var(--primario-claro); }
.titulo-auditor { border-left: 5px solid var(--primario); }
.titulo-auditor h2 { color: var(--primario); margin: 0 0 .2rem; }

/* Búsqueda por tipo */
.chips-busqueda { display: flex; flex-wrap: wrap; gap: .4rem; margin: .4rem 0 .8rem; }
.chip-alcance { border: 1px solid var(--borde, #c9d3e0); background: #fff; border-radius: 99px; padding: .3rem .8rem; cursor: pointer; font: inherit; font-size: .88rem; }
.chip-alcance.activo { background: var(--primario); color: #fff; border-color: var(--primario); font-weight: 700; }
.res-seccion { margin-top: .8rem; }
.enlace-ex { background: none; border: none; color: var(--primario); text-decoration: underline; padding: 0 .2rem; cursor: pointer; text-align: left; }
.res-normal { padding: .4rem 0; border-top: 1px solid #eef0f3; }
.sub-lista { margin: .2rem 0 0 1rem; padding: 0; font-size: .88rem; color: var(--suave); }
.marca-eps b { display: block; padding: .45rem .2rem; color: var(--validado, #1b7a3a); }
.marca-eps input[name=num_copago] { margin-top: .1rem; }
.abonos-orden { margin: .6rem 0; } .abonos-orden summary { cursor: pointer; font-weight: 600; color: var(--primario); }
.historial-paciente { margin: .4rem 0 .8rem; } .historial-paciente summary { cursor: pointer; font-weight: 600; color: var(--primario); }
.campo-doble { display: contents; }
.pendientes-dx { margin-top: 1.2rem; border-top: 2px solid var(--borde); padding-top: .6rem; } .pendientes-dx summary { cursor: pointer; font-weight: 700; color: var(--alto); }
.notas-auditor { list-style: none; padding: 0; margin: .4rem 0; }
.nota-auditor { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem 1rem; padding: .55rem .7rem; border: 1px solid var(--borde); border-left: 4px solid var(--primario); border-radius: 8px; margin-bottom: .4rem; background: #fff; }
.nota-auditor label { flex: 1; display: flex; gap: .5rem; align-items: flex-start; cursor: pointer; }
.nota-auditor .texto-nota { white-space: pre-wrap; }
.nota-auditor.hecha { opacity: .6; border-left-color: var(--borde); }
.nota-auditor.hecha .texto-nota { text-decoration: line-through; }
#nota-form textarea { flex: 1; min-width: 260px; font: inherit; padding: .5rem; border: 1px solid var(--borde); border-radius: 8px; }

/* ===================================================================== TABLET, MÓVIL Y PC
   app.js pone html[data-dispositivo] = "movil" (menos de 700 px), "tablet" (pantalla táctil de hasta 1400 px) o "pc".
   PC queda como estaba; aquí solo se ajusta lo de tablet y celular. */
.btn-menu { display: none; }

/* ---------- tablet y celular: todo un poco más grande para el dedo */
html:is([data-dispositivo=tablet], [data-dispositivo=movil]) .btn { min-height: 40px; }
html:is([data-dispositivo=tablet], [data-dispositivo=movil]) .btn.chico { min-height: 34px; }
html:is([data-dispositivo=tablet], [data-dispositivo=movil]) .btn.enlace { min-height: 0; }
html:is([data-dispositivo=tablet], [data-dispositivo=movil]) :is(.chip-filtro, .chip-alcance, .pestanas button) { padding: .45rem .9rem; }
html:is([data-dispositivo=tablet], [data-dispositivo=movil]) .barra-arriba { display: none; }  /* en pantalla táctil se desliza con el dedo */
html:is([data-dispositivo=tablet], [data-dispositivo=movil]) .tabla-excel { max-height: 70vh; -webkit-overflow-scrolling: touch; }
html:is([data-dispositivo=tablet], [data-dispositivo=movil]) .desplazar { -webkit-overflow-scrolling: touch; }

/* ---------- TABLET: el menú en una sola fila que se desliza de lado */
html:not([data-vista=moderna])[data-dispositivo=tablet] .barra { padding: .5rem 1rem .3rem; gap: .5rem 1rem; }
html:not([data-vista=moderna])[data-dispositivo=tablet] .marca img { height: 40px; }
html:not([data-vista=moderna])[data-dispositivo=tablet] nav#menu { order: 10; flex: 1 0 100%; padding-bottom: .2rem; }
html:not([data-vista=moderna])[data-dispositivo=tablet] nav#menu::-webkit-scrollbar { display: none; }
html:not([data-vista=moderna])[data-dispositivo=tablet] nav button { white-space: nowrap; padding: .55rem 1rem; }
html[data-dispositivo=tablet] .sello-auditor span { font-size: 1.15rem; }
html[data-dispositivo=tablet] main { padding: 1rem; }
@media (min-width: 901px) { html[data-dispositivo=tablet] .columnas.areas { grid-template-columns: minmax(250px, .55fr) minmax(0, 1.6fr); } }
html[data-dispositivo=tablet] .tabla-res td.anterior { width: 5.5rem; }
html[data-dispositivo=tablet] .caja { max-height: 92vh; }

/* ---------- TABLET ACOSTADA (horizontal): poca altura, sobre todo con el teclado afuera.
   Barra delgada en UNA sola fila (el menú se desliza de lado), y las pantallas a dos columnas como en el computador. */
html:not([data-vista=moderna])[data-dispositivo=tablet][data-orientacion=horizontal] .barra { flex-wrap: nowrap; padding: .3rem .8rem; gap: .6rem; }
html:not([data-vista=moderna])[data-dispositivo=tablet][data-orientacion=horizontal] .marca img { height: 32px; padding: 2px 6px; }
html:not([data-vista=moderna])[data-dispositivo=tablet][data-orientacion=horizontal] nav#menu { order: 0; flex: 1 1 auto; min-width: 0; flex-wrap: nowrap;
  overflow-x: auto; scrollbar-width: none; padding-bottom: 0; }
html:not([data-vista=moderna])[data-dispositivo=tablet][data-orientacion=horizontal] nav button { padding: .45rem .8rem; }
html:not([data-vista=moderna])[data-dispositivo=tablet][data-orientacion=horizontal] .controles { flex-wrap: nowrap; gap: .5rem; margin-left: 0; }
html:not([data-vista=moderna])[data-dispositivo=tablet][data-orientacion=horizontal] .usuario-actual { display: none; }  /* el nombre está en «Salir» (title) */
html:not([data-vista=moderna])[data-dispositivo=tablet][data-orientacion=horizontal] #ctl-fecha { font-size: 0; gap: 0; }
html:not([data-vista=moderna])[data-dispositivo=tablet][data-orientacion=horizontal] #ctl-fecha input { font-size: 14px; }
html[data-dispositivo=tablet][data-orientacion=horizontal] .sello-auditor span { font-size: .9rem; }
html[data-dispositivo=tablet][data-orientacion=horizontal] main { padding: .7rem 1rem; }
html[data-dispositivo=tablet][data-orientacion=horizontal] .panel { padding: .9rem 1rem; }
html[data-dispositivo=tablet][data-orientacion=horizontal] .columnas { grid-template-columns: minmax(0, 1.4fr) minmax(260px, .7fr); }
html[data-dispositivo=tablet][data-orientacion=horizontal] .columnas.areas { grid-template-columns: minmax(290px, .6fr) minmax(0, 1.6fr); }
html[data-dispositivo=tablet][data-orientacion=horizontal] .columnas.areas.con-orden > aside { display: block; }  /* hay espacio: la lista sigue al lado */
html[data-dispositivo=tablet][data-orientacion=horizontal] .columnas.areas.con-orden > .volver-lista { display: none; }
html[data-dispositivo=tablet][data-orientacion=horizontal] .columnas > aside { position: sticky; top: 56px; max-height: calc(100vh - 70px); overflow-y: auto; }
html[data-dispositivo=tablet][data-orientacion=horizontal] .columnas:has(> #form-orden) > aside { order: 0; }  /* Recepción: órdenes a la derecha */
html[data-dispositivo=tablet][data-orientacion=horizontal] .tabla-excel { max-height: calc(100vh - 220px); }
html[data-dispositivo=tablet][data-orientacion=horizontal] .caja { max-height: 88vh; }

/* ---------- TECLADO EN PANTALLA (celular y tablet): la barra de arriba deja de ocupar espacio fijo,
   las ventanas caben en lo que queda visible y lo que no sirve mientras se escribe se esconde */
/* (con [data-orientacion] para ganarle a las reglas de celular y tablet que vienen después) */
html.teclado-abierto[data-orientacion] .barra { position: static; }
html.teclado-abierto[data-orientacion] .aviso-fecha { display: none; }
html.teclado-abierto[data-orientacion] .modal { align-items: flex-start; padding-top: 6px; }
html.teclado-abierto[data-orientacion] .caja, html.teclado-abierto[data-orientacion] .caja.ancha { max-height: calc(var(--alto-visible, 60vh) - 12px); border-radius: 12px; }
html.teclado-abierto[data-orientacion] .columnas > aside { position: static; max-height: none; }
html.teclado-abierto[data-orientacion] .tabla-excel { max-height: calc(var(--alto-visible, 60vh) - 60px); }
html.teclado-abierto[data-orientacion] .toast { bottom: auto; top: 8px; }

/* ---------- CELULAR */
html[data-dispositivo=movil] body { font-size: 15px; -webkit-text-size-adjust: 100%; }
/* que el celular no haga zoom al escribir (pasa con letra menor de 16 px) */
html[data-dispositivo=movil] :is(input, select, textarea) { font-size: 16px; }
html[data-dispositivo=movil] main { padding: .6rem .55rem calc(1.5rem + env(safe-area-inset-bottom)); }
html[data-dispositivo=movil] .panel { padding: .85rem .8rem; border-radius: 12px; }
html[data-dispositivo=movil] h2 { font-size: 1.12rem; }
html[data-dispositivo=movil] .acciones { gap: .5rem; }
html[data-dispositivo=movil] .acciones > .btn, html[data-dispositivo=movil] .acciones > a.btn { flex: 1 1 auto; text-align: center; }
html[data-dispositivo=movil] .btn.primario { padding: .65rem 1rem; }

/* barra de arriba: logo, fecha, campana y ☰; lo demás se abre con ☰ */
html:not([data-vista=moderna])[data-dispositivo=movil] .barra { gap: .45rem .5rem; padding: .45rem .6rem; padding-top: calc(.45rem + env(safe-area-inset-top)); }
html:not([data-vista=moderna])[data-dispositivo=movil] .marca { flex: 1; min-width: 0; }
html:not([data-vista=moderna])[data-dispositivo=movil] .marca img { height: 36px; padding: 2px 6px; max-width: 100%; object-fit: contain; }
html:not([data-vista=moderna])[data-dispositivo=movil] .controles { display: contents; }
html:not([data-vista=moderna])[data-dispositivo=movil] #ctl-fecha { order: 2; font-size: 0; gap: 0; }
html:not([data-vista=moderna])[data-dispositivo=movil] #ctl-fecha input { font-size: 14px; padding: .3rem .35rem; width: 8.6rem; }
html:not([data-vista=moderna])[data-dispositivo=movil] .campana { order: 3; }
html:not([data-vista=moderna])[data-dispositivo=movil] .btn-menu { order: 4; display: inline-flex; align-items: center; justify-content: center; width: 42px; height: 40px;
  background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.45); border-radius: 8px; color: #fff; font-size: 1.35rem; cursor: pointer; }
html:not([data-vista=moderna])[data-dispositivo=movil] .btn-menu .icono-cerrar, body.menu-abierto .btn-menu .icono-abrir { display: none; }
html:not([data-vista=moderna])[data-dispositivo=movil] body.menu-abierto .btn-menu .icono-cerrar { display: inline; }
html:not([data-vista=moderna])[data-dispositivo=movil] nav#menu { order: 10; flex: 1 0 100%; display: none; flex-direction: column; gap: .15rem;
  border-top: 1px solid rgba(255,255,255,.25); padding-top: .4rem; max-height: 70vh; overflow-y: auto; }
html:not([data-vista=moderna])[data-dispositivo=movil] body.menu-abierto nav#menu { display: flex; }
html:not([data-vista=moderna])[data-dispositivo=movil] nav button { text-align: left; padding: .75rem .9rem; font-size: 1.05rem; border-radius: 8px; }
html:not([data-vista=moderna])[data-dispositivo=movil] .usuario-actual, html:not([data-vista=moderna])[data-dispositivo=movil] #salir { display: none; }
html:not([data-vista=moderna])[data-dispositivo=movil] body.menu-abierto .usuario-actual { display: block; order: 11; flex: 1; padding: .5rem .2rem; }
html:not([data-vista=moderna])[data-dispositivo=movil] body.menu-abierto #salir { display: inline-block; order: 12; min-height: 38px; }
/* modo auditor en el celular: el sello pequeño en la barra y «Salir del modo auditor» dentro del menú */
html[data-dispositivo=movil] .sello-auditor:not([hidden]) { display: contents; }
html[data-dispositivo=movil] .sello-auditor span { order: 1; font-size: .78rem; letter-spacing: .03em; flex: none; text-align: center;
  background: rgba(255,255,255,.18); border-radius: 6px; padding: .35rem .5rem; white-space: nowrap; }
html:not([data-vista=moderna])[data-dispositivo=movil] .salir-auditor { display: none; }
html:not([data-vista=moderna])[data-dispositivo=movil] body.menu-abierto .salir-auditor { display: block; order: 13; flex: 1 0 100%; padding: .7rem; margin-top: .2rem; }
html:not([data-vista=moderna])[data-dispositivo=movil] body.modo-auditor .marca { flex: 1; }
html[data-dispositivo=movil] .aviso-fecha { padding: .5rem .7rem; font-size: .92rem; gap: .5rem; }

/* ventanas: suben desde abajo y ocupan casi toda la pantalla */
html[data-dispositivo=movil] .modal { padding: 0; align-items: flex-end; }
html[data-dispositivo=movil] .caja, html[data-dispositivo=movil] .caja.ancha { max-width: none; max-height: 94vh; max-height: 94dvh; border-radius: 16px 16px 0 0;
  padding: 1rem .9rem calc(1rem + env(safe-area-inset-bottom)); }
html[data-dispositivo=movil] .cab-modal { position: sticky; top: -1rem; background: #fff; z-index: 3; padding: .4rem 0; margin-top: -.4rem; }
html[data-dispositivo=movil] .toast { bottom: calc(1rem + env(safe-area-inset-bottom)); width: calc(100vw - 1.5rem); text-align: center; }

/* tablas como tarjetas: una tarjeta por fila, cada dato con el título de su columna */
html[data-dispositivo=movil] table.tabla-tarjetas,
html[data-dispositivo=movil] table.tabla-tarjetas > tbody,
html[data-dispositivo=movil] table.tabla-tarjetas > tbody > tr,
html[data-dispositivo=movil] table.tabla-tarjetas > tbody > tr > td { display: block; width: auto; }
html[data-dispositivo=movil] table.tabla-tarjetas > thead { display: none; }
html[data-dispositivo=movil] table.tabla-tarjetas > tbody > tr:not([hidden]) { border: 1px solid var(--borde); border-radius: 10px; padding: .45rem .7rem;
  margin: 0 0 .55rem; background: #fff; }
html[data-dispositivo=movil] table.tabla-tarjetas > tbody > tr:nth-child(even) { background: #fff; }
html[data-dispositivo=movil] table.tabla-tarjetas > tbody > tr > td { display: block; border: 0; padding: .3rem 0; text-align: right; min-height: 0; overflow-wrap: anywhere; }
html[data-dispositivo=movil] table.tabla-tarjetas > tbody > tr > td:has(> :is(input, select, textarea, .edad-ref)) { display: flex; align-items: center; gap: .8rem; }
html[data-dispositivo=movil] table.tabla-tarjetas > tbody > tr > td[data-label="No."], html[data-dispositivo=movil] table.tabla-tarjetas > tbody > tr > td[data-label="#"] { display: none; }
html[data-dispositivo=movil] table.tabla-tarjetas > tbody > tr > td + td { border-top: 1px dashed #edf0f4; }
html[data-dispositivo=movil] table.tabla-tarjetas > tbody > tr > td::before { content: attr(data-label); float: left; flex: none; max-width: 45%; margin-right: .8rem; text-align: left; line-height: 1.9;
  font-size: .72rem; font-weight: 700; color: var(--suave); text-transform: uppercase; letter-spacing: .02em; }
html[data-dispositivo=movil] table.tabla-tarjetas > tbody > tr > td:not([data-label]) { display: flex; justify-content: flex-start; flex-wrap: wrap; gap: .4rem; text-align: left; }
html[data-dispositivo=movil] table.tabla-tarjetas > tbody > tr > td:not([data-label])::before { display: none; }
html[data-dispositivo=movil] table.tabla-tarjetas > tbody > tr > td:empty { display: none; }
html[data-dispositivo=movil] table.tabla-tarjetas > tbody > tr > td > :is(input, select, textarea) { flex: 1; min-width: 0; width: auto; text-align: left; }
html[data-dispositivo=movil] table.tabla-tarjetas td.acc { white-space: normal; }
html[data-dispositivo=movil] table.tabla-tarjetas td.acc, html[data-dispositivo=movil] table.tabla-tarjetas .acc-edicion { gap: .4rem; }
html[data-dispositivo=movil] table.tabla-tarjetas > tbody > tr.fila-ancha { padding: .45rem .7rem; }
html[data-dispositivo=movil] table.tabla-tarjetas > tbody > tr.fila-ancha > td { display: block; text-align: left; }
html[data-dispositivo=movil] table.tabla-tarjetas > tbody > tr.separador { background: var(--primario); border-color: var(--primario); }
html[data-dispositivo=movil] table.tabla-tarjetas tr.anulada td::before { text-decoration: none; }
html[data-dispositivo=movil] .desplazar:has(> table.tabla-tarjetas) { overflow: visible; }
html[data-dispositivo=movil] .ref-tabla td:first-child { width: auto; }
html[data-dispositivo=movil] .ref-tabla .edad-ref { flex: 1; }
html[data-dispositivo=movil] .tabla-cfg input[name=nombre] { min-width: 0 !important; }

/* resultados: cada analito es una tarjeta con el resultado a todo lo ancho */
html[data-dispositivo=movil] .tabla-res, html[data-dispositivo=movil] .tabla-res > tbody { display: block; }
html[data-dispositivo=movil] .tabla-res > thead { display: none; }
html[data-dispositivo=movil] .tabla-res > tbody > tr:not([hidden]):not(.titulo) { border: 1px solid var(--borde); border-radius: 10px; margin: 0 0 .5rem; background: #fff; display: grid; grid-template-columns: 1fr auto;
  grid-template-areas: "nombre quitar" "valor unidad" "ref ref" "anterior estado"; align-items: center; gap: .25rem .5rem; padding: .55rem .7rem; }
html[data-dispositivo=movil] .tabla-res > tbody > tr > td { display: block; width: auto !important; padding: 0; border: 0; text-align: left; }
html[data-dispositivo=movil] .tabla-res > tbody > tr > td::before { display: none; }
html[data-dispositivo=movil] .tabla-res td.nombre { grid-area: nombre; font-weight: 700; }
html[data-dispositivo=movil] .tabla-res td.valor { grid-area: valor; display: flex; gap: .4rem; align-items: center; }
html[data-dispositivo=movil] .tabla-res td.valor > * { flex: 1; }
html[data-dispositivo=movil] .tabla-res td.unidad { grid-area: unidad; font-size: .85rem; }
html[data-dispositivo=movil] .tabla-res td.ref { grid-area: ref; font-size: .82rem; }
html[data-dispositivo=movil] .tabla-res td.ref:not(:empty)::before { display: inline; content: "Normal: "; font-weight: 600; text-transform: none; font-size: .82rem; }
html[data-dispositivo=movil] .tabla-res td.anterior { grid-area: anterior; }
html[data-dispositivo=movil] .tabla-res td.anterior:not(:empty)::before { display: inline; content: "Anterior: "; font-weight: 600; text-transform: none; font-size: .82rem; }
html[data-dispositivo=movil] .tabla-res td.anterior br { display: none; }
html[data-dispositivo=movil] .tabla-res td.anterior .sub { margin-left: .4rem; }
html[data-dispositivo=movil] .tabla-tarjetas .areas-chips { justify-content: flex-end; }
html[data-dispositivo=movil] .tabla-res td.estado { grid-area: estado; text-align: right; }
html[data-dispositivo=movil] .tabla-res td.quitar { grid-area: quitar; }
html[data-dispositivo=movil] .tabla-res tr.titulo { display: block; margin-top: .4rem; }
html[data-dispositivo=movil] .tabla-res tr.titulo td { display: block; }
html[data-dispositivo=movil] .prueba-titulo .btn-remitir, html[data-dispositivo=movil] .prueba-titulo .btn-traer { margin: .3rem 0 0; }
html[data-dispositivo=movil] .sel-agregar { max-width: none; flex: 1 1 100%; }

/* demás pantallas */
html[data-dispositivo=movil] .metricas { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .55rem; }
html[data-dispositivo=movil] .metricas > *, html[data-dispositivo=movil] .tarjeta-aud { padding: .65rem .75rem; }
html[data-dispositivo=movil] .metricas b, html[data-dispositivo=movil] .tarjeta-aud b { font-size: 1.3rem; }
html[data-dispositivo=movil] .filtros-rapidos { grid-template-columns: 1fr; gap: .25rem; }
html[data-dispositivo=movil] .filtros-rapidos .grupo { flex-wrap: nowrap; overflow-x: auto; padding-bottom: .2rem; scrollbar-width: none; }
html[data-dispositivo=movil] .filtros-rapidos .grupo > * { white-space: nowrap; flex: none; }
html[data-dispositivo=movil] .pestanas { flex-wrap: nowrap; overflow-x: auto; padding-bottom: .3rem; scrollbar-width: none; }
html[data-dispositivo=movil] .pestanas button { white-space: nowrap; flex: none; }
html[data-dispositivo=movil] .fila-buscar > input { min-width: 0; flex: 1 1 100%; }
html[data-dispositivo=movil] .fila-buscar > .btn { flex: 1; }
html[data-dispositivo=movil] .campos { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem .7rem; }
html[data-dispositivo=movil] .campo > :is(input, select, textarea) { width: 100%; min-width: 0; }
html[data-dispositivo=movil] .campo.ancho2 { grid-column: 1 / -1; }
html[data-dispositivo=movil] .checks { grid-template-columns: 1fr; }
html[data-dispositivo=movil] .checks label { padding: .3rem 0; font-size: .95rem; }
html[data-dispositivo=movil] .checks label input { width: 20px; height: 20px; flex: none; }
html[data-dispositivo=movil] .entrevista input[name=ent_obs] { min-width: 0; flex: 1 1 100%; }
html[data-dispositivo=movil] .resumen-pago { flex-wrap: wrap; gap: .6rem 1.4rem; }
html[data-dispositivo=movil] .cabecera-paciente .codigo { font-size: 1.35rem; }
html[data-dispositivo=movil] .lista-examenes { max-height: 40vh; }
html[data-dispositivo=movil] .menu-filtro { left: 8px !important; right: 8px; width: auto; max-height: 75vh; overflow-y: auto; }
html[data-dispositivo=movil] .tabla-excel { max-height: 65vh; min-height: 240px; }
html[data-dispositivo=movil] .elegir-empresa { grid-template-columns: 1fr; }
html[data-dispositivo=movil] .firma-cfg { grid-template-columns: 1fr; }
html[data-dispositivo=movil] #nota-form textarea { min-width: 0; flex: 1 1 100%; }
html[data-dispositivo=movil] .tarjeta-paciente .cab { flex-wrap: wrap; }
html[data-dispositivo=movil] .lista-perfiles li { flex-wrap: wrap; }
html[data-dispositivo=movil] .informe { padding: 1rem .8rem; }
html[data-dispositivo=movil] .informe header { flex-wrap: wrap; gap: .5rem; }
html[data-dispositivo=movil] .informe .datos { grid-template-columns: 1fr 1fr; }
/* portal del paciente */
html[data-dispositivo=movil] .portal-marca img { height: 54px; max-width: 100%; object-fit: contain; }
html[data-dispositivo=movil] .portal-cab { flex-wrap: wrap; }
html[data-dispositivo=movil] .portal-lista li { flex-wrap: wrap; padding: .8rem .9rem; }
html[data-dispositivo=movil] .portal-acc { flex: 1 1 100%; }
html[data-dispositivo=movil] .portal-acc .btn { flex: 1; text-align: center; }
html[data-dispositivo=movil] .login { padding: 1rem .8rem; gap: 1.2rem; align-content: flex-start; }
html[data-dispositivo=movil] .login-marca img { width: min(280px, 78vw); }
.solo-movil { display: none; }
@media (max-width: 900px) {  /* celular y tablet vertical: con un paciente abierto se ve solo su formulario */
  .columnas.areas.con-orden > aside { display: none; }
  .columnas.areas.con-orden > .volver-lista { display: block; width: 100%; font-weight: 600; color: var(--primario); }
  /* Recepción en celular y tablet: las órdenes del día arriba (se deslizan solas) y el formulario debajo */
  .columnas:has(> #form-orden) > aside { order: -1; max-height: 42vh; overflow-y: auto; }
}
/* modo auditor · ver como paciente: la pantalla del portal dentro de un marco de celular o de computador */
.marco-portal { --primario: #0f5e9c; --primario-claro: #e6f0f8; margin: 1rem auto 0; border: 10px solid #1d2733; border-radius: 28px; overflow: hidden; background: #fff; box-shadow: 0 14px 34px rgba(0,0,0,.22); }
.marco-portal.marco-movil { width: 390px; max-width: 100%; height: 760px; }
.marco-portal.marco-pc { width: 100%; max-width: 1100px; height: 640px; border-radius: 12px; border-width: 8px; }
.pantalla-portal { height: 100%; overflow-y: auto; padding: 1rem; }
.pantalla-portal.login-fondo { background: linear-gradient(90deg, rgba(8,40,75,.25), rgba(8,40,75,.05)), url(fondo-login.webp) 70% center / cover no-repeat #dbe9f4;
  display: flex; align-items: center; justify-content: center; }
.pantalla-portal.con-fondo { background: linear-gradient(rgba(244,246,249,.55), rgba(244,246,249,.75)), url(fondo-portal.webp) center / cover no-repeat; }
.marco-movil .portal-lista li { flex-wrap: wrap; }
.marco-movil .portal-acc { flex: 1 1 100%; }
/* Orden y resultados guardados: solo lectura hasta tocar «Editar» (evita cambios por un clic equivocado) */
.aviso-bloqueo { display: flex; align-items: center; justify-content: space-between; gap: .6rem 1rem; flex-wrap: wrap; margin: .3rem 0 .8rem;
  padding: .5rem .8rem; border-radius: 8px; background: #eef2f7; border: 1px solid var(--borde); font-size: .9rem; color: #33404f; }
.aviso-bloqueo.editando-orden { background: #fff6e0; border-color: #f0b46a; color: #7a5200; }
.zona-bloqueada { position: relative; }
.zona-bloqueada :is(input, select, textarea):disabled { background: #f6f8fa; color: var(--texto); opacity: 1; }
.zona-bloqueada :is(label, .chip-dx, .perfiles, #frecuentes) { cursor: default; }
.zona-bloqueada a.btn:not([data-sin-bloqueo]), .zona-bloqueada .btn.enlace:not([data-sin-bloqueo]) { pointer-events: none; opacity: .5; }
/* catálogo CUPS: examen del laboratorio con su botón para deshabilitar / volver a habilitar */
.en-lab { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .6rem; padding: .1rem 0; }
/* lista rápida «Exámenes que se remiten» */
.lista-remitidos { max-height: 55vh; overflow-y: auto; border: 1px solid var(--borde); border-radius: 8px; margin-top: .5rem; }
.lista-remitidos label { display: flex; gap: .6rem; align-items: center; padding: .45rem .7rem; border-bottom: 1px solid #edf0f4; cursor: pointer; }
.lista-remitidos label .sub { margin-left: auto; text-align: right; }
.lista-remitidos label.marcado { background: #fff6e0; font-weight: 600; }
.lista-remitidos input[type=checkbox] { width: 18px; height: 18px; flex: none; }
/* Búsqueda: el buscador con sugerencias ocupa el espacio que tenía el campo */
.fila-buscar > .buscador-busq { flex: 1; min-width: 240px; margin: 0; }
.buscador-busq > input { width: 100%; padding: .6rem .8rem; font-size: 1.05rem; }
.buscador-busq .sugerencias li { display: flex; gap: .5rem; align-items: baseline; flex-wrap: wrap; }
.tipo-sug { font-size: .7rem; font-weight: 700; text-transform: uppercase; color: var(--primario); background: var(--primario-claro);
  border-radius: 6px; padding: .05rem .4rem; min-width: 5.5rem; text-align: center; }
html[data-dispositivo=movil] .fila-buscar > .buscador-busq { min-width: 0; flex: 1 1 100%; }
/* Recepción: siguientes códigos disponibles, una empresa por renglón */
.lista-libres { list-style: none; margin: .25rem 0 0; padding: 0; }
.lista-libres li { padding: .12rem 0; }
.lista-libres li .btn.enlace { font-weight: 700; }
/* Ayuda: guías y asistente */
.ayuda-asistente { border-left: 5px solid var(--primario); }
.respuesta-ia { margin-top: .8rem; padding: .8rem 1rem; border-radius: 10px; background: var(--primario-claro); }
.respuesta-ia p { margin: .2rem 0 .5rem; }
.guia { border: 1px solid var(--borde); border-radius: 10px; padding: .6rem .9rem; margin: .5rem 0; background: #fff; }
.guia-cab { display: flex; justify-content: space-between; align-items: center; gap: .8rem; cursor: pointer; list-style: none; }
.guia-cab::-webkit-details-marker { display: none; }
.guia-cab b::before { content: "▸ "; color: var(--suave); }
.guia[open] .guia-cab b::before { content: "▾ "; }
.guia-cab .btn { flex: none; }
.guia ol { margin: .4rem 0 .1rem; padding-left: 1.3rem; font-size: .92rem; color: #33404f; }
.guia ol li { margin: .15rem 0; }
/* recorrido interactivo: lo señalado queda iluminado y el resto oscuro */
.recorrido { position: fixed; inset: 0; z-index: 60; }
.recorrido-foco { position: fixed; border-radius: 10px; box-shadow: 0 0 0 9999px rgba(15, 25, 40, .55), 0 0 0 3px #ffb020;
  transition: all .25s ease; pointer-events: none; }
.recorrido-globo { position: fixed; background: #fff; border-radius: 12px; padding: .8rem 1rem; box-shadow: 0 14px 34px rgba(0,0,0,.3);
  border-top: 4px solid #ffb020; transition: top .25s ease, left .25s ease; }
.recorrido-globo .globo-texto { font-size: 1rem; margin: .3rem 0 .4rem; }
.recorrido-globo .acciones { margin-top: .5rem; }
/* mensajes y pendientes entre usuarios */
.form-mensaje { border: 1px solid var(--borde); border-radius: 10px; padding: .7rem .8rem; background: #f8fafc; margin-bottom: .8rem; }
.form-mensaje .fila-inline { flex-wrap: wrap; margin-bottom: .5rem; }
.form-mensaje .fila-inline .campo { min-width: 200px; }
.form-mensaje textarea { flex: 1; min-width: 0; font: inherit; padding: .5rem; border: 1px solid var(--borde); border-radius: 8px; }
.nota-auditor.nueva { border-left-color: #e8890c; background: #fffaf2; }
.nota-auditor.nueva .texto-nota { font-weight: 600; }
.nota-auditor.es-mensaje { border-left-color: #2b7bb9; }
.icono-nota { font-size: 1.1rem; }
.fila-check { flex-direction: row !important; align-items: center; gap: .5rem; }
.fila-check > span { text-transform: none !important; font-size: .9rem !important; }
html[data-dispositivo=movil] table.tabla-tarjetas > tbody > tr > td > input[type=checkbox] { flex: none; width: 22px; height: 22px; margin-left: auto; }
html[data-dispositivo=movil] .caja .desplazar { max-height: none !important; }

/* ---------------- Clave dinámica (página del paciente y pestaña del personal) */
.btn-wa { background: #1fa855; color: #fff; border-color: #1fa855; font-weight: 600; }
.btn-wa:hover { background: #178a45; }
a.btn-wa { color: #fff; text-align: center; }
.info-clave { background: #effaf3; border: 1px solid #a8e0bd; border-radius: 10px; padding: .8rem 1rem; display: grid; gap: .6rem; font-size: .92rem; }
.info-clave p { margin: 0; }
.pasos-clave { margin: 0; padding-left: 1.2rem; display: grid; gap: .35rem; }
#wa-flotante { position: fixed; right: 18px; bottom: 18px; z-index: 900; width: 58px; height: 58px; border-radius: 50%;
  background: #25d366; color: #fff; display: flex; align-items: center; justify-content: center; box-shadow: 0 6px 18px rgba(0,0,0,.25); }
#wa-flotante:hover { transform: scale(1.06); }
.portal-nota { text-align: center; margin-top: 1rem; }
.fila-clave { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; margin: .8rem 0; }
.fila-clave select { max-width: 280px; }
.fila-clave input { flex: 1; min-width: 200px; padding: .55rem .8rem; font-size: 1.05rem; }
.clave-paciente, .clave-lista { border: 1px solid var(--borde); border-radius: 10px; padding: 1rem 1.1rem; display: grid; gap: .6rem; background: #fff; }
.clave-grande { font-size: 2.6rem; font-weight: 800; letter-spacing: .35rem; color: var(--primario); margin: 0; font-variant-numeric: tabular-nums; }
.globo-menu { background: #e11d48; color: #fff; font-size: .7rem; font-weight: 800; border-radius: 99px; padding: 1px 6px; vertical-align: middle; }

/* ---------------- Chats de WhatsApp */
.chats { display: grid; grid-template-columns: minmax(260px, 340px) 1fr; gap: 1rem; align-items: start; }
.chats-lista { display: grid; gap: .6rem; }
.chats-lista input { padding: .5rem .7rem; }
.lista-chats { list-style: none; margin: 0; padding: 0; max-height: calc(100vh - 230px); overflow-y: auto; }
.lista-chats button { width: 100%; text-align: left; font: inherit; background: #fff; border: 0; border-bottom: 1px solid var(--borde);
  padding: .6rem .5rem; cursor: pointer; display: grid; grid-template-columns: 1fr auto; gap: .1rem .5rem; }
.lista-chats button:hover { background: var(--primario-claro); }
.lista-chats button.activo { background: var(--primario-claro); box-shadow: inset 3px 0 0 var(--primario); }
.chat-nombre { font-weight: 700; }
.chat-ultimo { grid-column: 1 / -1; color: #3d4a5c; font-size: .86rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-hora { grid-row: 1; grid-column: 2; text-align: right; }
.chats-conv { display: flex; flex-direction: column; min-height: 60vh; }
.conv-cab { display: flex; flex-wrap: wrap; gap: .6rem 1rem; align-items: flex-start; justify-content: space-between; border-bottom: 1px solid var(--borde); padding-bottom: .6rem; }
.conv-bot { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.conv-mensajes { flex: 1; overflow-y: auto; max-height: calc(100vh - 330px); min-height: 280px; padding: .8rem .3rem; display: flex; flex-direction: column; gap: .45rem;
  background: #efeae2; border-radius: 8px; margin: .6rem 0; }
.burbuja { max-width: min(78%, 560px); padding: .45rem .65rem .3rem; border-radius: 10px; background: #fff; box-shadow: 0 1px 1px rgba(0,0,0,.08);
  font-size: .93rem; line-height: 1.38; overflow-wrap: anywhere; display: flex; flex-direction: column; gap: .15rem; }
.burbuja.entra { align-self: flex-start; border-top-left-radius: 2px; }
.burbuja.sale { align-self: flex-end; background: #d9fdd3; border-top-right-radius: 2px; }
.burbuja.de-bot { background: #e7f3ff; }
.burbuja-quien { font-size: .74rem; font-weight: 700; color: #4b5b70; }
.burbuja-hora { align-self: flex-end; font-size: .7rem; color: #67768a; }
.chat-foto { max-width: 240px; max-height: 260px; border-radius: 6px; display: block; }
.conv-form { display: flex; gap: .5rem; align-items: flex-end; }
.conv-form textarea { flex: 1; resize: vertical; padding: .5rem .7rem; font: inherit; }
html[data-dispositivo=movil] .chats, html[data-dispositivo=tablet]:not([data-orientacion=horizontal]) .chats { grid-template-columns: 1fr; }
html[data-dispositivo=movil] .chats.con-chat .chats-lista, html[data-dispositivo=tablet]:not([data-orientacion=horizontal]) .chats.con-chat .chats-lista { display: none; }
html[data-dispositivo=movil] .chats:not(.con-chat) .chats-conv, html[data-dispositivo=tablet]:not([data-orientacion=horizontal]) .chats:not(.con-chat) .chats-conv { display: none; }
html[data-dispositivo=movil] .chats .solo-movil, html[data-dispositivo=tablet]:not([data-orientacion=horizontal]) .chats .solo-movil { display: inline-block; }
html[data-dispositivo=movil] .conv-mensajes { max-height: calc(100vh - 300px); }
html[data-dispositivo=movil] .burbuja { max-width: 88%; }

/* ---------------- Modo auditor: bot de WhatsApp */
.interruptores { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: .6rem; margin: .6rem 0 1rem; }
.interruptor { display: flex; gap: .7rem; align-items: center; border: 1px solid var(--borde); border-radius: 10px; padding: .6rem .8rem; cursor: pointer; background: #fff; }
.interruptor.principal { border-color: var(--primario); }
.interruptor input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.perilla { flex: none; width: 42px; height: 24px; border-radius: 99px; background: #c4ccd6; position: relative; transition: background .15s; }
.perilla::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: left .15s; box-shadow: 0 1px 2px rgba(0,0,0,.3); }
.interruptor input:checked + .perilla { background: #1fa855; }
.interruptor input:checked + .perilla::after { left: 21px; }
.interruptor input:focus-visible + .perilla { outline: 2px solid var(--primario); outline-offset: 2px; }
.wa-vista { background: #efeae2; border-radius: 10px; padding: .8rem; display: flex; flex-direction: column; }
.wa-vista .burbuja { max-width: 100%; }
.flujo-bot { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: .8rem; }
.flujo-paso { border: 1px solid var(--borde); border-radius: 10px; padding: .7rem; background: #fafbfd; display: grid; gap: .6rem; align-content: start; }
.flujo-paso h4 { margin: 0; color: var(--primario); }
.flujo-cat { display: flex; flex-wrap: wrap; gap: .35rem; }
.flujo-cat > .sub { width: 100%; font-weight: 700; }
.texto-bot { font: inherit; font-size: .84rem; border: 1px solid var(--borde); background: #fff; border-radius: 99px; padding: .25rem .65rem; cursor: pointer; }
.texto-bot:hover { border-color: var(--primario); background: var(--primario-claro); }
.texto-bot.apagado { color: #8a96a8; text-decoration: line-through; background: #f1f3f6; }
.editor-bot { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.editor-bot textarea { width: 100%; font: inherit; font-size: .92rem; }
html[data-dispositivo=movil] .editor-bot { grid-template-columns: 1fr; }
.historial-bot { margin-top: .8rem; }
.version-bot { border-top: 1px solid var(--borde); padding: .6rem 0; display: grid; gap: .35rem; }
.version-bot .burbuja { max-width: 100%; }
.wa-vista .burbuja, .version-bot .burbuja { display: block; }
.pasos-drive { margin: .4rem 0 .8rem; padding-left: 1.3rem; display: grid; gap: .35rem; }
#dr-cliente { width: 100%; font-family: monospace; font-size: .85rem; }

/* bacterióloga: botón para cambiar entre «vista bacterióloga» y «vista laboratorio» */
.cambiar-vista { background: rgba(255,255,255,.14); color: #fff; border-color: rgba(255,255,255,.5); font-weight: 600; }
.cambiar-vista:hover { background: rgba(255,255,255,.26); }

/* sin conexión: barra fija debajo de la barra azul */
.aviso-conexion { position: sticky; top: var(--alto-barra, 0); z-index: 40; padding: .55rem 1rem; font-size: .92rem; display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.aviso-conexion.sin-conexion { background: #b42318; color: #fff; }
.aviso-conexion.enviando { background: #1f5f99; color: #fff; }
.aviso-conexion.sin-internet { background: #fff1e0; color: #8a4b00; border-bottom: 1px solid #f0a35a; }
.aviso-conexion .btn { background: #fff; color: #222; }
.choques { background: #fff1f0; border: 1px solid #f3b4ae; border-radius: 8px; padding: .6rem .9rem; margin-top: .6rem; }
.lista-pendientes { padding-left: 1.2rem; display: grid; gap: .3rem; }

.ayuda-editor { background: #f6f8fb; border: 1px solid var(--borde); border-radius: 8px; padding: .55rem .75rem; font-size: .86rem; display: grid; gap: .45rem; margin: .4rem 0 .6rem; }
.ayuda-editor p { margin: 0; }
.botones-var { display: flex; flex-wrap: wrap; gap: .35rem; }

.celda-corta { display: inline-block; max-width: 260px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; vertical-align: bottom; }
.info-examen-res { margin: -.2rem 0 .5rem; font-size: .84rem; color: #5b6b7f; display: flex; flex-wrap: wrap; gap: .3rem .8rem; }
.info-examen-res .nota-interna, .tabla-prep .nota-interna { color: #8a5a00; background: #fff6dd; border-radius: 4px; padding: 0 4px; font-size: .82rem; }
.tabla-prep td { vertical-align: top; }

/* Búsqueda: «👁 Ver» abre la ficha (el «✎ Editar» está dentro) */
.btn.btn-ver { background: #1e7b3c; color: #fff; border-color: #1e7b3c; font-weight: 600; }
.btn.btn-ver:hover { background: #17642f; }
/* Pacientes del día (bacterióloga): exámenes de cada paciente y la entrevista */
.examenes-dia { font-size: .85rem; line-height: 1.35; min-width: 20rem; max-width: 34rem; }
.examenes-dia ol { margin: 0; padding-left: 1.3rem; }
.examenes-dia li + li { margin-top: .35rem; }
.valores-rapidos { font-size: .8rem; color: #3b4a5c; }
.lista-valores-rapidos { margin: .2rem 0; padding-left: 1.5rem; }
.lista-valores-rapidos li { padding: .04rem 0; }
.valores-rapidos .res-alto, .valores-rapidos .res-bajo, .valores-rapidos .res-anormal { font-weight: 600; }
.valores-rapidos .res-alto { color: #b42318; }
.valores-rapidos .res-bajo { color: #1158b8; }
.valores-rapidos .res-anormal { color: #8a5a00; }
.tabla-cruce th, .tabla-cruce td { text-align: center; white-space: nowrap; }
.tabla-cruce tbody th { text-align: left; }
.tabla-cruce .diagonal { background: #eef4fb; font-weight: 700; }
.lista-cruce { columns: 2 22rem; max-height: 40vh; overflow: auto; }
.lista-entrevista { list-style: none; padding: 0; margin: .4rem 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: .3rem 1rem; }
.lista-entrevista li { font-weight: 600; }

/* ---- Resultados: examen por examen (todos los analitos a la vista, + para agregar) ---- */
.pasos-examen { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 4px; padding: 6px 0; }
.paso-ex { border: 1px solid var(--borde); background: #f6f8fb; border-radius: 8px; padding: 7px 12px; cursor: pointer; font: inherit; font-size: 14px; color: #1c2733; }
.paso-ex .n { display: inline-block; min-width: 20px; height: 20px; border-radius: 99px; background: var(--borde); text-align: center; font-size: 12px; line-height: 20px; margin-right: 4px; }
.paso-ex.activo { background: var(--primario); color: #fff; border-color: var(--primario); font-weight: 600; }
.paso-ex.activo .n { background: #fff; color: var(--primario); }
.paso-ex .cuenta { font-size: 12px; opacity: .8; margin-left: 4px; }
.paso-ex .cuenta.completo::before { content: "✓ "; }
.paso-de { margin: 0 0 4px; color: var(--suave); font-size: 13px; }
#form-res.examen-por-examen .bloque-examen:not(.activo) { display: none; }
#form-res.examen-por-examen .area-titulo { display: none; }
#form-res.examen-por-examen .agregar-analitos .grupo,
#form-res.examen-por-examen .agregar-analitos .sel-agregar,
#form-res.examen-por-examen .agregar-analitos [data-agregar-coment] { display: none !important; }
#form-res.examen-por-examen table.tabla-res[hidden] { display: table !important; }
#form-res.examen-por-examen tr.titulo[hidden] { display: table-row !important; }
#form-res.examen-por-examen tr[data-fila][hidden]:not([data-miembro]) { display: table-row !important; }
#form-res tr[data-fila][hidden] td { color: #9aa5b1; background: #fafbfc; }
#form-res tr[data-fila][hidden] td.valor > :not(.poner),
#form-res tr[data-fila][hidden] td.opciones-unica > :not(.poner),
#form-res tr[data-fila][hidden] td.quitar > *,
#form-res tr[data-fila][hidden] td.anterior > *,
#form-res tr[data-fila][hidden] td.estado > * { display: none; }
#form-res tr[data-fila]:not([hidden]) .poner { display: none; }
.btn.poner { border: 1px dashed var(--primario); color: var(--primario); background: #fff; font-weight: 600; }
.btn.poner:hover { background: var(--primario-claro); }
#form-res tr.titulo td { font-weight: 700; }
.plegar { border: 0; background: none; cursor: pointer; font-size: 15px; width: 22px; color: var(--primario); transition: transform .15s; }
tr.titulo.plegado .plegar { transform: rotate(-90deg); }
#form-res tr.plegada { display: none !important; }
.btn.grupo-t { margin-left: 10px; font-weight: 500; }
.btn.btn-normal { background: #e8f6ee; border: 1px solid #2e8b57; color: #1f6b41; font-weight: 600; }
.btn.btn-normal:hover { background: #d3efdf; }
html[data-dispositivo=movil] #form-res.examen-por-examen .tabla-res > tbody > tr[data-fila][hidden]:not([data-miembro]) { display: grid !important; grid-template-columns: 1fr auto; align-items: center; border: 1px dashed var(--borde); border-radius: 10px; margin: 0 0 .5rem; padding: .35rem .7rem; }
html[data-dispositivo=movil] #form-res tr[data-fila][hidden] td:not(.nombre):not(.valor):not(.opciones-unica) { display: none; }

/* ---- Recepción: entrevista por examen, edad y sexo ---- */
.lista-ent { list-style: none; margin: .3rem 0 .8rem; padding: 0; }
.preg-ent { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem 1rem; padding: .55rem .2rem; border-bottom: 1px solid var(--borde); }
.preg-ent .preg { flex: 1 1 320px; }
.si-no { display: flex; gap: .4rem; }
.si-no label { border: 1px solid var(--borde); border-radius: 8px; padding: .3rem .8rem; cursor: pointer; background: #fff; }
.si-no label:has(input:checked) { background: var(--primario-claro); border-color: var(--primario); font-weight: 600; }
.detalle-ent { flex: 1 1 100%; }
.preg-texto { display: flex; flex-wrap: wrap; gap: .4rem 1rem; align-items: center; width: 100%; }
.preg-texto span { flex: 1 1 320px; }
.preg-texto input { flex: 1 1 200px; }
.sub-ent { margin: .8rem 0 .2rem; font-size: 15px; color: var(--primario); }
.chip-ent { display: inline-block; background: var(--primario-claro); border-radius: 99px; padding: 2px 10px; margin: 2px 0; font-size: 13px; }
/* ---- No. autorización cerrado (no Colsanitas) ---- */
input.cerrado { background: #f1f3f6; color: #9aa5b1; }
/* ---- pendiente de pago y vueltos ---- */
.chip-pendiente-pago { display: inline-block; background: #fff4e0; border: 1px solid #e3a33b; color: #8a5300; border-radius: 8px; padding: .3rem .7rem; margin: .4rem 0; }
.vueltos { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; margin-top: .6rem; padding: .5rem .7rem; border: 1px dashed var(--borde); border-radius: 10px; background: #fafbfc; }
.vueltos #paga-con { width: 9rem; }
.btn.billete.activo { background: var(--primario); color: #fff; border-color: var(--primario); }
#vueltos-res { font-size: 1.15rem; margin-left: .4rem; }
/* ---- diagnóstico por síntoma y exámenes sugeridos ---- */
.chip-sintoma { display: inline-block; margin-left: .4rem; font-size: 12px; background: #eef7ee; color: #1f6b41; border-radius: 99px; padding: 0 8px; }
.dx-examenes { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; margin: .5rem 0; }
.dx-examenes > .sub, .dx-examenes > .ayuda { flex-basis: 100%; margin: 0; }
.btn.sugerido-dx { border-style: dashed; }
.btn.sugerido-dx.puesto { background: #e8f6ee; border: 1px solid #2e8b57; color: #1f6b41; }
/* ---- confirmar datos guardados sin conexión ---- */
.lista-confirmar { list-style: none; padding: 0; }
.lista-confirmar > li { border: 1px solid var(--borde); border-radius: 10px; padding: .6rem .8rem; margin: .5rem 0; }
.lista-confirmar ul { margin: .3rem 0 0 1.2rem; }

/* ---- entrevista con casillas ---- */
.casilla-ent { display: flex; align-items: center; gap: .6rem; cursor: pointer; flex: 1 1 320px; }
.casilla-ent input { width: 22px; height: 22px; flex: none; }
/* ---- Configuración → Entrevista ---- */
.filtros-ent, .barra-masiva { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; margin: .6rem 0; }
.barra-masiva { background: var(--primario-claro); border: 1px solid var(--primario); border-radius: 10px; padding: .5rem .7rem; }
.edad-masiva input { width: 4.5rem; }
.tabla-ent tr.inactiva td { color: #9aa5b1; }
.grupos-check { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .3rem .8rem; margin: .4rem 0; }
.grupos-check label { display: flex; gap: .4rem; align-items: center; }
/* ---- Resultados por área: lista con exámenes en colores y filtro por examen ---- */
.filtro-ex { display: flex; gap: .4rem; align-items: center; margin-bottom: .4rem; }
.filtro-ex select { flex: 1; min-width: 0; }
.leyenda-ex { margin: .2rem 0 .5rem; font-size: 12px; display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; }
.lista-areas-ex .pac-ex { display: flex; flex-direction: column; gap: .25rem; min-width: 0; text-align: left; }
.chips-ex { display: flex; flex-wrap: wrap; gap: 3px; }
.chip-ex { display: inline-block; font-size: 11.5px; line-height: 1.3; border-radius: 99px; padding: 1px 8px; border: 1px solid transparent; }
.chip-ex.ex-falta { background: #e3efff; color: #0b4f9c; border-color: #9cc3f5; }
.chip-ex.ex-lleno { background: #e3f6e9; color: #1d6b3c; border-color: #8fd1a8; }
.chip-ex.ex-remitido { background: #f1f3f6; color: #7a8592; text-decoration: line-through; }
.chip-ex.filtrado { font-weight: 700; box-shadow: 0 0 0 2px currentColor inset; }
.marca-val { color: #1d6b3c; font-weight: 700; }
.btn.siguiente { font-weight: 600; }
/* ---- Cotización ---- */
.cotizacion .cab-seccion { display: flex; flex-wrap: wrap; gap: .6rem; justify-content: space-between; align-items: end; }
.cotizacion .vueltos label { display: flex; gap: .4rem; align-items: center; }
.cotizacion .vueltos input { width: 9rem; }
.vueltos label { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; }

/* ---- valores uno debajo del otro (Pacientes del día, Exámenes realizados) ---- */
.valores-rapidos .val-linea { display: block; padding: 1px 0; border-bottom: 1px dotted #e2e6ec; }
.valores-rapidos .val-linea:last-child { border-bottom: 0; }
/* ---- confirmar paciente antes de imprimir ---- */
.confirmar-paciente { border: 2px solid var(--primario); border-radius: 10px; padding: .6rem .9rem; margin: .5rem 0; background: var(--primario-claro); }
.confirmar-paciente p { margin: .2rem 0; }
.confirmar-paciente .grande { font-size: 1.25rem; }

/* ---- bot: administradores y comandos ---- */
.fila-bot { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; margin: .5rem 0; }
.fila-bot input { width: 14rem; }

/* ================================================================
   Partes comunes a las dos vistas (clásica y moderna): Configuración → Apariencia, Perfil, Seguridad…
   La VISTA MODERNA está en estilos-moderno.css (solo se carga cuando el usuario la elige).
   ================================================================ */
/* vista clásica: la barra de arriba como siempre; lo nuevo de la vista moderna no se muestra */
html:not([data-vista=moderna]) #estado-local,
html:not([data-vista=moderna]) #btn-config,
html:not([data-vista=moderna]) .avatar-sidebar:not(.con-foto) { display: none !important; }
html:not([data-vista=moderna]) .avatar-sidebar.con-foto { width: 28px; height: 28px; margin-right: .35rem; vertical-align: middle; border: 2px solid rgba(255,255,255,.7); }
.avatar-sidebar.con-foto { object-fit: cover; border-radius: 50%; padding: 0; }
.perfil-foto { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem; margin: .6rem 0; }
.perfil-foto img, .perfil-iniciales { border-radius: 50%; object-fit: cover; border: 3px solid var(--primario-claro); }
.perfil-iniciales { display: grid; place-items: center; background: var(--primario); color: #fff; font-size: 3rem; font-weight: 700; }
.fondos-cfg { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1rem; }
.fondo-cfg img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 10px; border: 1px solid var(--borde); margin: .4rem 0 .6rem; }
html:not([data-vista=moderna]) .datos-sidebar b { font-weight: normal; }
html:not([data-vista=moderna]) .datos-sidebar span::before { content: " · "; }
.config-preferencia { margin: .8rem 0; }
.config-preferencia h3 { margin-bottom: .25rem; }
.config-opciones { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-top: .7rem; }
.config-color { display: inline-flex; align-items: center; gap: .45rem; padding: .4rem .65rem; border: 1px solid var(--borde); border-radius: 8px; background: var(--panel); cursor: pointer; font: inherit; color: inherit; }
.config-color.activo { border-color: var(--primario); box-shadow: 0 0 0 2px var(--primario-claro); }
.muestra-color { width: 1rem; height: 1rem; border-radius: 50%; background: #0f5e9c; }
.color-verde { background: #24735f; } .color-morado { background: #68428f; } .color-vino { background: #9b3e54; } .color-naranja { background: #a65b12; }
.config-vista { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .8rem; margin-top: .7rem; }
.config-vista button { display: grid; gap: .45rem; padding: .7rem; text-align: left; border: 2px solid var(--borde); border-radius: 12px; background: var(--panel); color: var(--texto); font: inherit; cursor: pointer; }
.config-vista button.activo { border-color: var(--primario); box-shadow: 0 0 0 3px var(--primario-claro); }
.config-vista small { color: var(--suave); }
.mini-vista { display: grid; height: 92px; border: 1px solid var(--borde); border-radius: 8px; overflow: hidden; background: #f4f6f9; }
.mini-vista.clasica { grid-template-rows: 22px 1fr; }
.mini-vista.clasica i { background: #0f5e9c; }
.mini-vista.moderna { grid-template-columns: 30% 1fr; background: #faf9f6; }
.mini-vista.moderna i { background: #e3e6e0; border-right: 1px solid #e5e1d8; }
.mini-vista b { margin: 9px; border-radius: 6px; background: #fff; border: 1px solid #e3e7ee; }
.config-clave { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); align-items: end; gap: .7rem; margin-top: .7rem; }
.config-clave label { display: grid; gap: .25rem; font-size: .9rem; }
.config-actividad { margin-top: .7rem; max-width: 100%; overflow-x: auto; }
.config-toggle { display: flex; align-items: center; justify-content: space-between; gap: 1rem; cursor: pointer; }
.config-toggle span { display: grid; gap: .25rem; }
.config-toggle small { color: var(--suave); font-size: .88rem; }
.config-toggle input { width: 1.25rem; height: 1.25rem; flex: none; accent-color: var(--primario); }
.config-sesiones { list-style: none; padding: 0; margin: .7rem 0 0; }
.config-sesiones li { display: flex; flex-direction: column; gap: .15rem; padding: .7rem 0; border-top: 1px solid var(--borde); }
.config-sesiones li span { color: var(--suave); font-size: .9rem; }
html[data-texto=compacto] body { font-size: 14px; }
html[data-texto=grande] body { font-size: 17px; }
html[data-lectura=serif] body { font-family: Georgia, "Times New Roman", serif; }
/* tema oscuro (en las dos vistas) */
html[data-tema=oscuro] { color-scheme: dark; --fondo: #191b1e; --panel: #24272b; --texto: #eceff1; --suave: #b0b8c1; --borde: #444a52; --primario-claro: #293b49; --alto: #ff8a80; --alto-fondo: #492d2c; --bajo: #8bbcff; --anormal: #ffd36b; --ok: #84d6a0; --bajo-fondo: #29384b; --anormal-fondo: #463c2c; --ok-fondo: #293f32; }
html[data-tema=oscuro] body { color: var(--texto); background: var(--fondo); }
html[data-tema=oscuro] .panel, html[data-tema=oscuro] .notif-lista > li, html[data-tema=oscuro] main .btn,
html[data-tema=oscuro] input:not([type=checkbox]):not([type=radio]), html[data-tema=oscuro] select, html[data-tema=oscuro] textarea,
html[data-tema=oscuro] .pestanas button, html[data-tema=oscuro] .tarjeta-empresa, html[data-tema=oscuro] .config-color, html[data-tema=oscuro] .config-vista button,
html[data-tema=oscuro] .lista button, html[data-tema=oscuro] .tabla-dia td, html[data-tema=oscuro] .tabla-examenes td { background-color: var(--panel); color: var(--texto); border-color: var(--borde); }
html[data-tema=oscuro] td, html[data-tema=oscuro] th { border-color: var(--borde); }
html[data-tema=oscuro] .informe, html[data-tema=oscuro] .caja, html[data-tema=oscuro] .login-form { background: var(--panel); color: var(--texto); }
html[data-tema=oscuro] .barra .controles input { background: #fff; color: #1d2733; color-scheme: light; }
html[data-tema=oscuro] :is(.chip-alcance, .chip-filtro, .pestanas button) { background: var(--panel); color: var(--texto); border-color: var(--borde); }
html[data-tema=oscuro] :is(.chip-alcance.activo, .chip-filtro.activo, .pestanas button.activo, .btn.primario) { background: var(--primario); color: #fff; border-color: var(--primario); }
html[data-tema=oscuro] .btn.agregar { background: #244532; color: #c6efd2; border-color: #4c8962; }
html[data-tema=oscuro] .btn.peligro { background: #4a2927; color: #ffd5d1; border-color: #995650; }
html[data-tema=oscuro] .btn.editar { background: #223a4e; color: #c9e5fb; border-color: #4c789a; }
html[data-tema=oscuro] :is(input, textarea)::placeholder { color: #aeb7c2; opacity: 1; }
html[data-tema=oscuro] .tabla-dia th { background: #30363d; color: #e3e7eb; }
html[data-tema=oscuro] .valores-rapidos { color: #d8dee6; }
html[data-tema=oscuro] .valores-rapidos .res-alto { color: #ff9b91; }
html[data-tema=oscuro] .valores-rapidos .res-bajo { color: #8bbcff; }
html[data-tema=oscuro] .valores-rapidos .res-anormal { color: #ffd36b; }
html[data-tema=oscuro] .chip.pendiente { background: #343a40; color: #e3e7eb; }
html[data-tema=oscuro] .chip.completo { background: #244532; color: #c6efd2; }
html[data-tema=oscuro] .chip.validado { background: #183e57; color: #c9eaff; }
html[data-tema=oscuro] .chip.alerta { background: #4a2927; color: #ffd5d1; }
@media screen {
  html[data-tema=oscuro] table thead th { background: #30363d !important; color: #e3e7eb !important; border-color: #444a52 !important; }
  html[data-tema=oscuro] table tbody > tr > td, html[data-tema=oscuro] table tbody > tr > th { background: #24272b !important; color: #eceff1; border-color: #444a52 !important; }
  html[data-tema=oscuro] table tbody > tr:nth-child(even) > td, html[data-tema=oscuro] table tbody > tr:nth-child(even) > th { background: #2b3036 !important; }
  html[data-tema=oscuro] .tarjeta-empresa, html[data-tema=oscuro] .tarjeta-aud, html[data-tema=oscuro] .metricas > div { background: #24272b; color: #eceff1; border-color: #444a52; }
  html[data-tema=oscuro] .editando, html[data-tema=oscuro] tr.editando td { background: #3a3527 !important; color: #f3ead1; }
  html[data-tema=oscuro] a:not(.btn) { color: #8cc5ff; }
}
.autorizacion-datos { display: flex; align-items: flex-start; gap: .5rem; font-size: .82rem; line-height: 1.35; }
.autorizacion-datos input { margin-top: .2rem; flex: none; }
.cfg-seccion + .cfg-seccion { margin-top: 1.6rem; padding-top: 1rem; border-top: 1px solid var(--borde); }
