@font-face { font-family: "Eurostile"; src: url("../fonts/Eurostile-Regular.otf") format("opentype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Eurostile"; src: url("../fonts/Eurostile-Demi.otf") format("opentype"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Eurostile"; src: url("../fonts/Eurostile-Bold.otf") format("opentype"); font-weight: 700; font-display: swap; }

:root {
  --azul: #003760;
  --azul-2: #0a5591;
  --verde: #9aca3c;
  --verde-osc: #6f9a1f;
  --tinta: #1d1d1b;
  --texto: #25303b;
  --sutil: #62707d;
  --borde: #d5dde5;
  --fondo: #eef2f6;
  --blanco: #fff;
  --rojo: #b3151b;
  --ok: #2e7d32;
  --radio: 12px;
  --sombra: 0 1px 2px rgba(0, 30, 60, .06), 0 4px 16px rgba(0, 30, 60, .06);
  --titulos: "Eurostile", "Segoe UI", system-ui, sans-serif;
  --cuerpo: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--fondo); color: var(--texto); font: 16px/1.5 var(--cuerpo); }
h1, h2, legend { font-family: var(--titulos); color: var(--azul); letter-spacing: .01em; }
h1 { font-size: 1.6rem; margin: .1em 0; font-weight: 700; display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
h2 { font-size: 1.15rem; margin: 0 0 .75rem; font-weight: 600; }
a { color: var(--azul-2); }
img { max-width: 100%; }
small { font-size: .82em; }
.sutil { color: var(--sutil); margin: 0; font-size: .92rem; }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: .85rem; }

/* ---------- Barra superior ---------- */
.barra { background: var(--azul); display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .6rem max(1rem, env(safe-area-inset-left)); }
.barra__marca img { display: block; height: 38px; width: auto; }
.barra__nav { display: flex; align-items: center; gap: .9rem; }
.barra__nav > a:not(.boton) { color: #dce9f5; text-decoration: none; font-weight: 500; }
.barra__menu { position: relative; }
.barra__menu summary { list-style: none; cursor: pointer; width: 36px; height: 36px; border-radius: 50%; background: var(--verde); color: var(--azul); font-weight: 700; display: grid; place-items: center; }
.barra__menu summary::-webkit-details-marker { display: none; }
.barra__menu-panel { position: absolute; right: 0; top: 44px; background: var(--blanco); border-radius: 10px; box-shadow: var(--sombra); min-width: 200px; padding: .5rem; z-index: 20; display: grid; }
.barra__menu-panel > * { padding: .55rem .7rem; text-align: left; color: var(--texto); text-decoration: none; font: inherit; border: 0; background: none; border-radius: 6px; cursor: pointer; width: 100%; }
.barra__menu-panel a:hover, .barra__menu-panel button:hover { background: var(--fondo); }
.barra__menu-nombre { color: var(--sutil); font-size: .85rem; border-bottom: 1px solid var(--borde); border-radius: 0 !important; margin-bottom: .3rem; }
.franja { height: 5px; background: linear-gradient(90deg, #1b4f7a 0%, #0a5591 25%, #5a9a8a 55%, #a8cf7a 75%, var(--verde) 100%); }

.contenido { max-width: 1040px; margin: 0 auto; padding: 1.25rem 1rem 7rem; }

/* ---------- Componentes ---------- */
.tarjeta { background: var(--blanco); border-radius: var(--radio); box-shadow: var(--sombra); padding: 1.1rem; }
.encabezado { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.enlace { color: var(--azul-2); background: none; border: 0; padding: 0; font: inherit; cursor: pointer; text-decoration: none; font-size: .92rem; }
.enlace:hover { text-decoration: underline; }

.boton { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; min-height: 44px; padding: .55rem 1.1rem; border-radius: 10px; border: 1px solid var(--borde); background: var(--blanco); color: var(--azul); font: 600 .95rem var(--cuerpo); text-decoration: none; cursor: pointer; transition: background .15s, transform .05s; }
.boton:hover { background: #f4f7fa; }
.boton:active { transform: translateY(1px); }
.boton:disabled { opacity: .55; cursor: progress; }
.boton--primario { background: var(--azul); border-color: var(--azul); color: #fff; }
.boton--primario:hover { background: #00497f; }
.boton--claro { background: var(--verde); border-color: var(--verde); color: var(--azul); }
.boton--claro:hover { background: #abd658; }
.boton--peligro { color: var(--rojo); }
.boton--chico { min-height: 34px; padding: .3rem .75rem; font-size: .85rem; }
.boton--bloque { width: 100%; }

.aviso { border-radius: 10px; padding: .75rem 1rem; margin-bottom: .75rem; border: 1px solid; }
.aviso--ok { background: #eef7e4; border-color: #b9dc86; color: #2f5210; }
.aviso--error { background: #fdecec; border-color: #f2b8b8; color: #8a1016; }
.aviso--info { background: #e8f1fa; border-color: #b6cfe6; color: #0e3d66; }

.chip { display: inline-block; font: 600 .75rem var(--cuerpo); padding: .15rem .55rem; border-radius: 99px; background: #e5eaf0; color: #3b4a58; vertical-align: middle; white-space: nowrap; }
.chip--ok { background: #e3f1cf; color: #3f6a0e; }
.chip--alerta { background: #fdebd2; color: #8a4b00; }
.chip--suave { background: #eef2f6; color: var(--sutil); font-weight: 500; }
.chip--borrador { background: #e5eaf0; color: #3b4a58; }
.chip--pendiente { background: #ffe8b3; color: #7a4a00; font-weight: 700; border: 1px solid #f0b43a; }
.chip--rol-admin { background: #003760; color: #fff; }
.chip--rol-tecnico { background: #e3edf7; color: var(--azul); }
.chip--rol-cliente { background: #eef7e0; color: #3f6a0e; }
.chip--servicio { background: #e3edf7; color: var(--azul); font-weight: 500; }

/* ---------- Campos ---------- */
.campo { display: flex; flex-direction: column; gap: .3rem; font-size: .88rem; color: var(--sutil); font-weight: 500; }
.campo > span { display: block; }
input[type=text], input[type=email], input[type=tel], input[type=password], input[type=search], input[type=number], input[type=date], input[type=time], select, textarea {
  width: 100%; font: 16px/1.4 var(--cuerpo); color: var(--texto); background: var(--blanco); border: 1px solid var(--borde); border-radius: 9px; padding: .62rem .75rem; min-height: 44px;
}
textarea { resize: vertical; line-height: 1.55; }
input:focus, select:focus, textarea:focus, .boton:focus-visible { outline: 3px solid rgba(154, 202, 60, .55); outline-offset: 1px; border-color: var(--verde-osc); }
.invalido { border-color: var(--rojo) !important; box-shadow: 0 0 0 3px rgba(179, 21, 27, .12); }
.campo__calculado { min-height: 44px; display: flex; align-items: center; padding: 0 .75rem; border-radius: 9px; background: var(--fondo); color: var(--azul); font-weight: 600; }
.campos { display: grid; grid-template-columns: repeat(2, 1fr); gap: .8rem; }
.campo--ancho { grid-column: 1 / -1; }

.opciones { display: flex; flex-wrap: wrap; gap: .5rem; }
.opcion { position: relative; }
.opcion input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.opcion span { display: inline-flex; align-items: center; gap: .45rem; min-height: 42px; padding: .4rem .85rem; border: 1px solid var(--borde); border-radius: 99px; background: var(--blanco); font-size: .92rem; cursor: pointer; user-select: none; }
.opcion span::before { content: ""; width: 16px; height: 16px; border: 2px solid #9aa8b5; border-radius: 4px; flex: none; }
.opcion input[type=radio] + span::before { border-radius: 50%; }
.opcion input:checked + span { border-color: var(--azul); background: #e8f0f8; color: var(--azul); font-weight: 600; }
.opcion input:checked + span::before { background: var(--azul) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3.5 8.5l3 3 6-7' fill='none' stroke='%23fff' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/12px no-repeat; border-color: var(--azul); }
.opcion input:focus-visible + span { outline: 3px solid rgba(154, 202, 60, .55); }

/* ---------- Formato (orden) ---------- */
.formato { display: grid; gap: 1rem; }
.formato__cabecera { background: var(--blanco); border-radius: var(--radio); box-shadow: var(--sombra); padding: 1rem 1.1rem; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 1rem; border-top: 5px solid var(--azul); }
.formato__cabecera img { width: 180px; height: auto; }
.formato__empresa { display: grid; font-size: .9rem; color: var(--sutil); }
.formato__empresa strong { color: var(--tinta); font-family: var(--titulos); font-size: 1.05rem; }
.formato__titulo { text-align: center; font: 600 .8rem/1.3 var(--titulos); text-transform: uppercase; color: var(--tinta); display: grid; gap: .4rem; justify-items: center; }
.formato__numero { border: 2px solid var(--tinta); border-radius: 9px; padding: .3rem 1rem; font: 700 1.3rem var(--titulos); color: var(--rojo); min-width: 150px; }

.seccion { margin: 0; border: 0; background: var(--blanco); border-radius: var(--radio); box-shadow: var(--sombra); padding: 0 1.1rem 1.1rem; min-width: 0; }
.seccion legend { float: left; width: calc(100% + 2.2rem); margin: 0 -1.1rem 1rem; padding: .55rem 1.1rem; font-size: .95rem; font-weight: 700; text-transform: uppercase; background: #e8eef4; color: var(--azul); border-radius: var(--radio) var(--radio) 0 0; }
.seccion legend + * { clear: both; }
.seccion legend small { text-transform: none; font-weight: 400; }
.seccion--oscura legend { background: var(--tinta); color: #fff; }
.seccion__sub { margin: 1rem 0 .5rem; font: 700 .85rem var(--titulos); text-transform: uppercase; color: var(--azul); }
.rejilla-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; align-items: start; }

.autorizacion { margin: 0 0 1rem; padding: .75rem 1rem; background: #f5f8fb; border-left: 4px solid var(--verde); border-radius: 6px; font-size: .95rem; }
.firmas { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: 1rem; }
.firma__cabecera { display: flex; justify-content: space-between; align-items: baseline; font-size: .88rem; color: var(--sutil); font-weight: 600; margin-bottom: .35rem; }
.firma canvas { display: block; width: 100%; aspect-ratio: 3 / 1; min-height: 140px; border: 2px dashed #a9b7c4; border-radius: 10px; background: #fcfdfe linear-gradient(transparent calc(78% - 1px), #c7d2dc calc(78% - 1px), #c7d2dc 78%, transparent 78%); touch-action: none; cursor: crosshair; }

.galeria { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: .6rem; margin-bottom: .8rem; }
.galeria img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; border: 1px solid var(--borde); display: block; }
.galeria figure { margin: 0; display: grid; gap: .3rem; }
.galeria--previa:empty { display: none; }

.acciones-fijas { position: sticky; bottom: 0; z-index: 10; display: flex; justify-content: flex-end; gap: .6rem; padding: .8rem 1rem calc(.8rem + env(safe-area-inset-bottom)); margin: 0 -1rem; background: rgba(238, 242, 246, .92); backdrop-filter: blur(6px); border-top: 1px solid var(--borde); }
.formato.enviando { opacity: .7; pointer-events: none; }

.dialogo { border: 0; border-radius: 14px; padding: 1.4rem; max-width: 420px; width: calc(100% - 2rem); box-shadow: 0 20px 60px rgba(0, 0, 0, .25); }
.dialogo::backdrop { background: rgba(0, 25, 50, .45); }
.dialogo h2 { margin-top: 0; }
.dialogo__acciones { display: flex; justify-content: flex-end; gap: .5rem; margin-top: 1rem; }

/* ---------- Paneles desplegables del formulario ---------- */
.panel { background: var(--blanco); border-radius: var(--radio); box-shadow: var(--sombra); border-left: 6px solid var(--azul-2); overflow: hidden; }
.panel--completo { border-left-color: var(--verde); }
.panel > summary { list-style: none; display: flex; align-items: center; gap: .8rem; padding: .9rem 1.1rem; cursor: pointer; background: linear-gradient(90deg, #eaf1f8, #f6f9fc); user-select: none; }
.panel > summary::-webkit-details-marker { display: none; }
.panel > summary::after { content: ""; margin-left: auto; width: 10px; height: 10px; border-right: 2.5px solid var(--azul); border-bottom: 2.5px solid var(--azul); transform: rotate(45deg); transition: transform .2s; flex: none; }
.panel[open] > summary::after { transform: rotate(-135deg); }
.panel[open] > summary { background: var(--azul); }
.panel[open] > summary .panel__titulo { color: #fff; }
.panel[open] > summary::after { border-color: #fff; }
.panel[open] > summary .panel__estado { color: #cfe3f5; }
.panel[open] > summary .panel__estado--falta { color: #ffd59a; }
.panel__num { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--azul); color: #fff; font: 700 .95rem var(--titulos); flex: none; }
.panel[open] .panel__num { background: var(--verde); color: var(--azul); }
.panel--completo .panel__num { background: var(--verde); color: var(--azul); }
.panel__titulo { font: 700 1.02rem var(--titulos); color: var(--azul); text-transform: uppercase; letter-spacing: .02em; }
.panel__estado { font-size: .82rem; color: var(--sutil); margin-left: .4rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.panel__estado--falta { color: #a4570a; font-weight: 600; }
.panel__cuerpo { padding: 1.1rem; display: grid; gap: .9rem; }
.panel__sub { margin: .3rem 0 0; font: 700 .85rem var(--titulos); text-transform: uppercase; color: var(--azul); }
.panel__siguiente { justify-self: end; color: var(--azul); border-color: var(--azul); }
.campos--espacio { margin-top: .4rem; }
.campo--texto { color: var(--texto); }
.barra-seccion { display: block; background: var(--azul); color: #fff !important; font: 700 .85rem var(--titulos); text-transform: uppercase; letter-spacing: .03em; padding: .45rem .8rem; border-radius: 8px 8px 0 0; margin-bottom: -.3rem; }
.barra-seccion small { text-transform: none; font-weight: 400; color: #cfe3f5; }
.campo--texto textarea { border-top-left-radius: 0; border-top-right-radius: 0; }
.opciones--servicios .opcion input:checked + span { background: #eef7e0; border-color: var(--verde-osc); color: #3f6a0e; }
.opciones--servicios .opcion input:checked + span::before { background-color: var(--verde-osc); border-color: var(--verde-osc); }
.con-boton { display: flex; gap: .4rem; }
.con-boton input { flex: 1; min-width: 0; }
.con-boton .boton { min-height: 44px; color: var(--azul-2); }

.autocompletar { position: relative; }
.autocompletar__lista { position: absolute; top: 100%; left: 0; right: 0; z-index: 30; margin: 4px 0 0; padding: .3rem; list-style: none; background: var(--blanco); border: 1px solid var(--borde); border-radius: 10px; box-shadow: 0 12px 30px rgba(0, 30, 60, .18); max-height: 320px; overflow: auto; }
.autocompletar__lista li { display: grid; gap: .1rem; padding: .6rem .75rem; border-radius: 8px; cursor: pointer; }
.autocompletar__lista li strong { color: var(--azul); }
.autocompletar__lista li span { font-size: .82rem; color: var(--sutil); }
.autocompletar__lista li:hover, .autocompletar__lista li.activo { background: #eaf1f8; }
.cliente-info { margin: .2rem 0 0; font-size: .85rem; color: #3f6a0e; background: #eef7e0; border-radius: 8px; padding: .45rem .7rem; }

.atajos { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; margin-top: -.3rem; }
.atajos__titulo { font-size: .78rem; color: var(--sutil); font-weight: 600; }
.atajo { border: 1px dashed var(--azul-2); background: #f3f8fd; color: var(--azul-2); border-radius: 99px; padding: .3rem .7rem; font: .8rem var(--cuerpo); cursor: pointer; }
.atajo:hover { background: #e3eef9; }
.atajo--usado { border-style: solid; background: #eef7e0; border-color: var(--verde-osc); color: #3f6a0e; }

/* ---------- Listado ---------- */
.filtros { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr 1fr auto; gap: .8rem; align-items: end; margin-bottom: 1rem; }
.filtros .campo--ancho { grid-column: auto; }
.filtros__acciones { display: flex; gap: .8rem; align-items: center; }
.lista { list-style: none; margin: 0; padding: 0; display: grid; gap: .55rem; }
.fila { display: grid; grid-template-columns: 110px 1fr auto auto; align-items: center; gap: 1rem; text-decoration: none; color: inherit; padding: .85rem 1.1rem; transition: box-shadow .15s, transform .1s; border-left: 6px solid #9aa8b5; }
.fila--firmada { border-left-color: var(--verde); }
.fila--pendiente { border-left-color: #e8a317; background: #fff8e6; }
.fila--pendiente:hover { background: #fff3d6; }
.fila--sin-enviar { border-left-color: var(--rojo); }
.fila:hover { box-shadow: 0 2px 4px rgba(0, 30, 60, .08), 0 8px 24px rgba(0, 30, 60, .1); }
.fila__numero { font: 700 1.05rem var(--titulos); color: var(--rojo); }
.fila__principal { display: grid; min-width: 0; }
.fila__principal strong, .fila__principal .sutil { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fila__fecha { color: var(--sutil); font-size: .9rem; }
.fila__estado { display: flex; gap: .3rem; flex-wrap: wrap; justify-content: flex-end; }
.vacio { text-align: center; padding: 2.5rem 1rem; }
.paginacion { display: flex; justify-content: center; align-items: center; gap: 1rem; margin-top: 1.2rem; }

/* ---------- Vista de orden firmada ---------- */
.datos { display: grid; grid-template-columns: max-content 1fr; gap: .45rem 1rem; margin: 0; font-size: .95rem; }
.datos dt { color: var(--sutil); }
.datos dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
.envios { list-style: none; padding: 0; margin: 0 0 1rem; display: grid; gap: .5rem; font-size: .92rem; }
.envios li { padding: .55rem .75rem; border-radius: 8px; background: var(--fondo); border-left: 4px solid var(--borde); }
.envios li.ok { border-left-color: var(--verde-osc); }
.envios li.falla { border-left-color: var(--rojo); }
.reenviar { display: grid; gap: .7rem; }
section.tarjeta + section.tarjeta, .rejilla-2 + section.tarjeta { margin-top: 1rem; }

/* ---------- Correcciones ---------- */
.encabezado__acciones { display: flex; gap: .5rem; flex-wrap: wrap; }
.historial { list-style: none; margin: 0; padding: 0; display: grid; gap: 1rem; }
.historial > li { border-left: 4px solid var(--verde); padding: .2rem 0 .2rem 1rem; }
.historial__cabecera { display: flex; flex-wrap: wrap; gap: .4rem .9rem; align-items: baseline; }
.historial__motivo { margin: .35rem 0 .6rem; font-style: italic; }
.cambios { width: 100%; border-collapse: collapse; font-size: .88rem; }
.cambios th { text-align: left; color: var(--sutil); font-weight: 600; padding: .35rem .6rem .35rem 0; vertical-align: top; width: 22%; }
.cambios td { padding: .35rem .4rem; vertical-align: top; border-top: 1px solid #eef2f6; overflow-wrap: anywhere; }
.cambios__antes { color: #8a1016; text-decoration: line-through; text-decoration-color: rgba(138, 16, 22, .45); }
.cambios__despues { color: #2f5210; font-weight: 500; }
.cambios__flecha { color: var(--sutil); width: 1.2rem; }
.quitar-foto { display: flex; align-items: center; gap: .35rem; font-size: .85rem; color: var(--rojo); cursor: pointer; }
.firma--guardada { margin: 0; display: grid; gap: .35rem; }
.firma--guardada figcaption { font-size: .88rem; color: var(--sutil); font-weight: 600; }
.firma--guardada img { width: 100%; aspect-ratio: 3 / 1; object-fit: contain; border: 1px solid var(--borde); border-radius: 10px; background: #fcfdfe; }

/* ---------- Casos pendientes ---------- */
.banda-pendientes { display: flex; align-items: center; gap: .7rem; margin-bottom: 1rem; padding: .8rem 1.1rem; background: #fff3d6; border: 1px solid #f0c060; border-left: 6px solid #e8a317; border-radius: var(--radio); color: #6a4000; text-decoration: none; }
.banda-pendientes:hover { background: #ffecc0; }
.banda-pendientes__icono { font-size: 1.3rem; }
.banda-pendientes__ver { margin-left: auto; font-weight: 700; }
.banda-pendientes--quieta:hover { background: #fff3d6; }
.opcion input[value="pendiente"]:checked + span { background: #fff3d6; border-color: #e8a317; color: #7a4a00; }
.opcion input[value="pendiente"]:checked + span::before { background-color: #e8a317; border-color: #e8a317; }

/* ---------- Fotos: botones y cámara ---------- */
.subir { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.galeria--previa figure { margin: 0; display: grid; gap: .3rem; }
.camara { border: 0; padding: 0; margin: 0; width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; background: #000; color: #fff; display: none; flex-direction: column; }
.camara[open] { display: flex; }
.camara::backdrop { background: #000; }
.camara__visor { position: relative; flex: 1; min-height: 0; display: grid; place-items: center; overflow: hidden; }
.camara__visor video { width: 100%; height: 100%; object-fit: contain; background: #000; }
.camara__flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; }
.camara__flash.activo { animation: flash .35s ease-out; }
@keyframes flash { from { opacity: .85; } to { opacity: 0; } }
.camara__aviso { position: absolute; inset: auto 1rem 1rem; margin: 0; padding: .8rem 1rem; background: rgba(0, 0, 0, .75); border-radius: 10px; text-align: center; }
.camara__tiras { display: flex; gap: .4rem; padding: .5rem .8rem 0; min-height: 56px; overflow-x: auto; }
.camara__tiras img { width: 48px; height: 48px; object-fit: cover; border-radius: 6px; border: 2px solid #fff; flex: none; }
.camara__controles { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 1rem; padding: 1rem 1rem calc(1rem + env(safe-area-inset-bottom)); }
.camara__disparo { width: 74px; height: 74px; border-radius: 50%; border: 5px solid #fff; background: var(--verde); cursor: pointer; box-shadow: 0 0 0 3px rgba(0, 0, 0, .4); }
.camara__disparo:active { transform: scale(.92); }
.camara__secundario { background: rgba(255, 255, 255, .12); color: #fff; border-color: rgba(255, 255, 255, .35); }
.camara__secundario:first-child { justify-self: start; font-weight: 700; }
.camara__controles > :last-child { justify-self: end; }

/* ---------- WhatsApp ---------- */
.whatsapp { display: grid; grid-template-columns: 1fr auto; gap: .6rem 1.2rem; align-items: end; margin-bottom: 1rem; border-left: 6px solid #25d366; }
.whatsapp h2 { margin-bottom: .2rem; }
.whatsapp--destacado { background: #effcf3; box-shadow: 0 0 0 3px rgba(37, 211, 102, .35), var(--sombra); }
.whatsapp__acciones { display: flex; gap: .5rem; align-items: end; flex-wrap: wrap; }
.whatsapp__acciones .campo { min-width: 170px; }
.whatsapp__enlace { grid-column: 1 / -1; font-size: .85rem; color: var(--sutil); }
.whatsapp__enlace summary { cursor: pointer; }
.whatsapp__enlace input { margin-top: .4rem; font-size: .85rem; }
.boton--whatsapp { background: #25d366; border-color: #25d366; color: #fff; }
.boton--whatsapp:hover { background: #1ebe5b; }
.boton--whatsapp::before { content: ""; width: 18px; height: 18px; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23fff'%3E%3Cpath d='M12 2a10 10 0 0 0-8.6 15.1L2 22l5-1.3A10 10 0 1 0 12 2zm0 18.2a8.2 8.2 0 0 1-4.2-1.2l-.3-.2-3 .8.8-2.9-.2-.3A8.2 8.2 0 1 1 12 20.2zm4.5-6.1c-.2-.1-1.5-.7-1.7-.8s-.4-.1-.6.1-.7.8-.8 1-.3.2-.5.1a6.7 6.7 0 0 1-3.3-2.9c-.3-.4.2-.4.7-1.3.1-.2 0-.3 0-.4l-.8-1.8c-.2-.5-.4-.4-.6-.4h-.5a1 1 0 0 0-.7.3 3 3 0 0 0-.9 2.2 5.2 5.2 0 0 0 1.1 2.8 11.9 11.9 0 0 0 4.6 4c1.7.7 2.4.8 3.2.7a2.8 2.8 0 0 0 1.8-1.3 2.3 2.3 0 0 0 .2-1.3c-.1-.1-.3-.2-.5-.3z'/%3E%3C/svg%3E") center/contain no-repeat; }

/* ---------- Usuarios y portal ---------- */
.rejilla-usuarios { display: grid; grid-template-columns: minmax(280px, 380px) 1fr; gap: 1rem; align-items: start; }
.form-usuario { display: grid; gap: .8rem; }
.campos-dobles { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
.usuarios { list-style: none; margin: 0; padding: 0; display: grid; gap: .6rem; }
.usuario { border: 1px solid var(--borde); border-radius: 10px; padding: .8rem; }
.usuario--inactivo { opacity: .6; }
.usuario__cabecera { display: flex; align-items: center; gap: .7rem; flex-wrap: wrap; }
.usuario__datos { display: grid; flex: 1; min-width: 160px; }
.usuario__avatar { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; color: #fff; background: var(--azul-2); flex: none; }
.usuario__avatar--admin { background: var(--azul); }
.usuario__avatar--cliente { background: var(--verde-osc); }
.usuario__ingreso { margin: .4rem 0 0 calc(38px + .7rem); font-size: .8rem; }
.usuario__acciones { margin-top: .6rem; }
.usuario__acciones > summary { cursor: pointer; color: var(--azul-2); font-weight: 600; font-size: .9rem; }
.usuario__acciones[open] { display: grid; gap: .9rem; }
.usuario__acciones .form-usuario { padding-top: .8rem; border-top: 1px solid #eef2f6; }
.usuario__botones { display: flex; gap: .5rem; padding-top: .8rem; border-top: 1px solid #eef2f6; }
.portal-buscar input { min-width: min(320px, 80vw); }

/* ---------- Pestaña activa e Inicio ---------- */
.barra__nav > a.activo:not(.boton) { color: #fff; box-shadow: inset 0 -3px 0 var(--verde); padding-bottom: .35rem; }
.kpis.kpis--inicio { grid-template-columns: repeat(auto-fit, minmax(125px, 1fr)); }
.rejilla-2.rejilla-inicio > section.tarjeta { margin-top: 0; }
.kpi--enlace { text-decoration: none; color: inherit; transition: box-shadow .15s, transform .1s; }
.kpi--enlace:hover { box-shadow: 0 2px 4px rgba(0, 30, 60, .08), 0 8px 24px rgba(0, 30, 60, .12); transform: translateY(-1px); }
.kpi__extra { font-size: .78rem; color: var(--sutil); margin-top: .2rem; }
.kpi__extra--sube { color: var(--verde-osc); font-weight: 600; }
.kpi__extra--baja { color: #a4570a; font-weight: 600; }
.kpi--pendiente { border-top-color: #e8a317; background: #fff8e6; }
.kpi--nit { border-top-color: var(--azul-2); background: #eef4fa; }
.kpi--alerta { border-top-color: var(--rojo); background: #fdf1f1; }
.kpi--cero { background: var(--blanco); }
.kpi--cero .kpi__valor { color: var(--verde-osc); }
.alertas-inicio { margin-bottom: 1rem; border-left: 6px solid var(--rojo); }
.alertas { list-style: none; margin: 0; padding: 0; display: grid; gap: .4rem; }
.alertas a { display: flex; gap: .7rem; align-items: center; padding: .55rem .7rem; border-radius: 8px; background: #f7f9fb; color: inherit; text-decoration: none; font-size: .92rem; }
.alertas a:hover { background: #eef2f6; }
.alertas__icono { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: #e5eaf0; flex: none; }
.alertas__icono--rojo { background: #fdecec; color: var(--rojo); }
.rejilla-inicio { margin-bottom: 1rem; }
.tarjeta__cabecera { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; margin-bottom: .6rem; }
.tarjeta__cabecera h2 { margin: 0; }
.mini-lista { list-style: none; margin: 0; padding: 0; display: grid; }
.mini-lista a { display: flex; align-items: center; gap: .8rem; padding: .55rem .2rem; border-bottom: 1px solid #eef2f6; color: inherit; text-decoration: none; }
.mini-lista li:last-child a { border-bottom: 0; }
.mini-lista a:hover { background: #f7f9fb; }
.mini-lista__numero { font: 700 .9rem var(--titulos); color: var(--rojo); width: 78px; flex: none; }
.mini-lista__texto { display: grid; flex: 1; min-width: 0; }
.mini-lista__texto strong, .mini-lista__texto .sutil { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .9rem; }
.dias { font-size: .8rem; font-weight: 700; padding: .15rem .55rem; border-radius: 99px; background: #e5eaf0; color: #3b4a58; white-space: nowrap; }
.dias--medio { background: #ffe8b3; color: #7a4a00; }
.dias--alto { background: #fdecec; color: #8a1016; }
.separado { margin-top: 1.2rem; }
.solo-movil { display: none !important; }
@media (max-width: 760px) { .barra__menu-panel .solo-movil { display: block !important; } }

/* ---------- Asignar NIT o cédula ---------- */
.banda-nit { display: flex; align-items: center; gap: .7rem; margin-bottom: .7rem; padding: .7rem 1.1rem; background: #e8f0f8; border: 1px solid #b6cfe6; border-left: 6px solid var(--azul-2); border-radius: var(--radio); color: #0e3d66; text-decoration: none; }
.banda-nit:hover { background: #dbe8f5; }
.kpis.kpis--3 { grid-template-columns: repeat(3, 1fr); }
.filtro-grupos { display: flex; gap: 1rem; align-items: end; flex-wrap: wrap; margin-bottom: 1rem; }
.filtro-grupos .campo { flex: 1; min-width: 220px; }
.grupos-nit { display: grid; gap: .6rem; }
.masivo { display: grid; gap: .8rem; margin-bottom: 1rem; border-left: 6px solid var(--azul-2); }
.masivo__texto { display: grid; gap: .2rem; }
.grupo-nit { background: var(--blanco); border-radius: var(--radio); box-shadow: var(--sombra); border-left: 6px solid #e8a317; overflow: hidden; }
.grupo-nit--completo { border-left-color: var(--verde); }
.grupo-nit > summary { list-style: none; display: flex; gap: .8rem; align-items: center; flex-wrap: wrap; padding: .85rem 1.1rem; cursor: pointer; }
.grupo-nit > summary::-webkit-details-marker { display: none; }
.grupo-nit[open] > summary { background: #f3f7fb; border-bottom: 1px solid var(--borde); }
.grupo-nit__nombre { display: grid; flex: 1; min-width: 200px; }
.grupo-nit__estado { display: flex; gap: .35rem; flex-wrap: wrap; justify-content: flex-end; }
.grupo-nit__form { padding: 1rem 1.1rem 1.1rem; display: grid; gap: .8rem; }
.grupo-nit__fila { display: flex; gap: .8rem; align-items: end; flex-wrap: wrap; }
.grupo-nit__fila .campo { flex: 1; min-width: 220px; }
.grupo-nit__acceso { margin: 0; padding: .6rem .8rem; background: #eef7e0; border-radius: 8px; font-size: .9rem; }
.tabla-ordenes-nit { width: 100%; border-collapse: collapse; font-size: .88rem; }
.tabla-ordenes-nit th { text-align: left; color: var(--sutil); font-weight: 600; padding: .4rem .5rem; border-bottom: 1px solid var(--borde); }
.tabla-ordenes-nit td { padding: .45rem .5rem; border-bottom: 1px solid #eef2f6; vertical-align: middle; }
.tabla-ordenes-nit input[type=checkbox] { width: 18px; height: 18px; }
.tabla-ordenes-nit tr.con-nit td { color: var(--sutil); }
@media (max-width: 760px) {
  .kpis.kpis--3 { grid-template-columns: 1fr 1fr 1fr; }
  .tabla-ordenes-nit th:nth-child(5), .tabla-ordenes-nit td:nth-child(5), .tabla-ordenes-nit th:nth-child(3), .tabla-ordenes-nit td:nth-child(3) { display: none; }
}

/* ---------- Análisis ---------- */
.periodo .campo { min-width: 200px; }
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-bottom: 1rem; }
.kpi { display: grid; gap: .15rem; border-top: 4px solid var(--azul-2); }
.kpi__valor { font: 700 1.9rem/1.1 var(--titulos); color: var(--azul); }
.kpi__nombre { color: var(--sutil); font-size: .88rem; }
.destacado { border-left: 6px solid var(--verde); margin-bottom: 1rem; }
.subtitulo { font: 700 .85rem var(--titulos); text-transform: uppercase; color: var(--azul); margin: 0 0 .5rem; }
.rejilla-2--compacta { gap: 1.2rem 2rem; }
.rejilla-2 > .tarjeta { margin-bottom: 0; }
.rejilla-2 + .tarjeta, .tarjeta + .rejilla-2 { margin-top: 1rem; }
.barras { list-style: none; margin: 0; padding: 0; display: grid; gap: .55rem; }
.barras li { display: grid; grid-template-columns: minmax(90px, 38%) 1fr 2.5rem; align-items: center; gap: .6rem; font-size: .88rem; }
.barras__etiqueta { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--texto); }
.barras__pista { height: 14px; background: #eef2f6; border-radius: 4px; overflow: hidden; }
.barras__valor { display: block; height: 100%; background: var(--azul-2); border-radius: 0 4px 4px 0; }
.barras li:hover .barras__valor { background: var(--azul); }
.barras__numero { text-align: right; font-weight: 700; color: var(--texto); font-variant-numeric: tabular-nums; }
.columnas { display: flex; align-items: flex-end; gap: .5rem; height: 180px; padding-top: 1.2rem; border-bottom: 1px solid var(--borde); }
.columnas__item { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: .2rem; min-width: 0; }
.columnas__barra { width: min(38px, 70%); background: var(--azul-2); border-radius: 4px 4px 0 0; min-height: 0; }
.columnas__item:hover .columnas__barra { background: var(--azul); }
.columnas__numero { font-size: .78rem; font-weight: 700; color: var(--texto); }
.columnas__mes { font-size: .75rem; color: var(--sutil); transform: translateY(1.3rem); height: 0; }
.columnas + * { margin-top: 1.6rem; }
section.tarjeta:has(.columnas) { padding-bottom: 2.2rem; margin-top: 1rem; }
.repetidos { list-style: none; margin: .8rem 0 0; padding: 0; display: grid; gap: .45rem; }
.repetidos li { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; padding: .55rem .8rem; background: #f5f9ee; border-radius: 8px; }
.repetidos__n { margin-left: auto; font-weight: 700; color: #3f6a0e; }

/* ---------- Login / instalación ---------- */
.pantalla-login { background: #002a4a url("../img/fondo-tecnologia.svg") center / cover no-repeat fixed; min-height: 100vh; }
.pantalla-login .contenido { padding-bottom: 2rem; }
.login { min-height: calc(100vh - 3rem); display: grid; place-content: center; justify-items: center; gap: 1.6rem; }
.login__logo { width: min(300px, 75vw); height: auto; filter: drop-shadow(0 6px 18px rgba(0, 0, 0, .35)); }
.login__lema { margin: -.6rem 0 0; color: #cfe3f5; font: 600 .8rem var(--titulos); letter-spacing: .25em; text-transform: uppercase; text-align: center; }
.login__lema span { color: var(--verde); }
.login__form { box-shadow: 0 24px 60px rgba(0, 12, 30, .45); }
.login__pie { color: #9fc3e6; font-size: .8rem; text-align: center; margin: 0; }
.login > * { max-width: calc(100vw - 2rem); }
@media (max-width: 520px) {
  .login__lema { font-size: .68rem; letter-spacing: .1em; }
  .login__logo { width: min(240px, 70vw); }
}
.login__form { width: min(380px, calc(100vw - 2rem)); display: grid; gap: .9rem; border-top: 5px solid var(--verde); }
.login__form h1 { font-size: 1.3rem; justify-content: center; }
.checklist { list-style: none; padding: 0; margin: 0; font-size: .9rem; display: grid; gap: .2rem; }
.checklist .ok { color: var(--ok); }
.checklist .falla { color: var(--rojo); }
.formulario-angosto { max-width: 480px; display: grid; gap: .9rem; }

/* ---------- Pantallas pequeñas ---------- */
@media (max-width: 760px) {
  h1 { font-size: 1.35rem; }
  .barra__nav > a:not(.boton) { display: none; }
  .barra__marca img { height: 32px; }
  .rejilla-2, .firmas { grid-template-columns: 1fr; }
  .formato__cabecera { grid-template-columns: 1fr auto; }
  .formato__cabecera img { width: 150px; }
  .formato__empresa { display: none; }
  .formato__numero { font-size: 1.1rem; min-width: 0; }
  .filtros { grid-template-columns: 1fr 1fr; }
  .filtros .campo:first-child { grid-column: 1 / -1; }
  .fila { grid-template-columns: 1fr auto; gap: .3rem .8rem; }
  .fila__principal { grid-column: 1 / -1; grid-row: 2; }
  .fila__estado { grid-column: 1 / -1; justify-content: flex-start; }
  .acciones-fijas .boton { flex: 1; padding-inline: .6rem; }
  .kpis, .kpis.kpis--inicio { grid-template-columns: 1fr 1fr; }
  .rejilla-usuarios, .whatsapp { grid-template-columns: 1fr; }
  .whatsapp__acciones .boton { flex: 1; }
  .panel__estado { display: none; }
}
@media (max-width: 420px) {
  .campos { grid-template-columns: 1fr; }
  .datos { grid-template-columns: 1fr; gap: .1rem; }
  .datos dd { margin-bottom: .5rem; }
}
