/* Portal de clientes ISCOM — misma paleta que la app (p1_head.html de la v1). */
:root {
  --azul: #0d3b66;
  --azul2: #144e88;
  --azul-claro: #e7eef7;
  --acento: #be1e2d;   /* rojo del logotipo de ISCOM */
  --fondo: #f2f5f9;
  --tarjeta: #ffffff;
  --borde: #dbe2ea;
  --texto: #1c2733;
  --gris: #5c6b7a;
  --ok: #1e7a46;
  --ok-f: #e2f3e9;
  --warn: #b26a00;
  --warn-f: #fff3dc;
  --rojo: #b3372f;
  --rojo-f: #fbe9e7;
  --radio: 10px;
  --sombra: 0 1px 2px rgba(13, 59, 102, .06), 0 4px 14px rgba(13, 59, 102, .06);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--fondo); color: var(--texto);
  font: 15px/1.45 "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
h1 { font-size: 22px; margin: 0 0 8px; color: var(--azul); line-height: 1.25; }
h2 { font-size: 16px; margin: 0 0 12px; color: var(--azul); }
a { color: var(--azul2); }
.tenue { color: var(--gris); }
.chico { font-size: 13px; }
.der { text-align: right; }
.noscript { padding: 20px; background: var(--rojo-f); color: var(--rojo); text-align: center; }

/* ---------- Botones y campos ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid transparent; border-radius: 7px; padding: 9px 16px; font: inherit; font-weight: 600;
  cursor: pointer; text-decoration: none; white-space: nowrap; transition: background .15s, border-color .15s;
}
.btn:focus-visible, .lnk:focus-visible, input:focus-visible, select:focus-visible, [role=tab]:focus-visible {
  outline: 3px solid rgba(244, 163, 0, .55); outline-offset: 1px;
}
.btn-pri { background: var(--azul); color: #fff; }
.btn-pri:hover { background: var(--azul2); }
.btn-sec { background: #fff; color: var(--azul); border-color: var(--borde); }
.btn-sec:hover { border-color: var(--azul2); background: var(--azul-claro); }
.btn-chico { padding: 6px 11px; font-size: 13px; }
.btn-blk { width: 100%; margin-top: 14px; padding: 11px; }
.btn[disabled], .btn[aria-disabled=true] { opacity: .45; cursor: not-allowed; pointer-events: none; }
.lnk { background: none; border: 0; color: var(--azul2); font: inherit; cursor: pointer; padding: 4px 0; text-decoration: underline; }
.lnk[disabled] { color: var(--gris); text-decoration: none; cursor: default; }
label { display: block; font-size: 13px; font-weight: 600; color: var(--gris); margin: 0 0 4px; }
input[type=email], input[type=text], input[type=search], input[type=date], select {
  width: 100%; font: inherit; color: var(--texto); background: #fff;
  border: 1px solid var(--borde); border-radius: 7px; padding: 9px 11px; min-height: 40px;
}
input:focus, select:focus { border-color: var(--azul2); }

.sello {
  display: inline-block; font-size: 12px; font-weight: 700; letter-spacing: .3px; text-transform: uppercase;
  color: var(--azul); background: #fff4dc; border: 1px solid #f2d18a; border-radius: 999px; padding: 2px 10px;
}
.aviso { margin: 12px 0 0; padding: 10px 12px; border-radius: 7px; background: var(--rojo-f); color: var(--rojo); font-size: 14px; }
.aviso.ok { background: var(--ok-f); color: var(--ok); }

/* ---------- Entrada ---------- */
.entrada {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px;
  background: linear-gradient(160deg, #13233a 0, #13233a 34%, var(--fondo) 34.1%);
}
.entrada-caja {
  width: 100%; max-width: 420px; background: #fff; border-radius: 14px; padding: 28px;
  box-shadow: 0 10px 40px rgba(13, 59, 102, .18); border-top: 4px solid var(--acento);
}
.marca-entrada { flex-direction: column; align-items: flex-start; gap: 6px; margin-bottom: 26px; }
.marca-logo { height: 38px; width: auto; display: block; }
.marca-entrada .marca-sub { font-weight: 600; }
.marca { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.marca-nombre { font-weight: 800; letter-spacing: 1px; color: var(--azul); font-size: 18px; line-height: 1.1; }
.marca-sub { color: var(--gris); font-size: 13px; }
.paso p { margin: 0 0 16px; }
.codigo { display: flex; gap: 8px; justify-content: space-between; border: 0; padding: 0; margin: 6px 0 0; }
.codigo input {
  width: 100%; max-width: 52px; height: 56px; text-align: center; font-size: 26px; font-weight: 700;
  border: 1px solid var(--borde); border-radius: 8px; color: var(--azul); font-family: Consolas, Menlo, monospace;
}
.codigo input:focus { border-color: var(--azul2); box-shadow: 0 0 0 3px rgba(20, 78, 136, .15); outline: none; }
.fila-links { display: flex; justify-content: space-between; gap: 12px; margin: 14px 0 6px; flex-wrap: wrap; font-size: 14px; }
.pie-entrada { margin: 22px 0 0; padding-top: 14px; border-top: 1px solid var(--borde); font-size: 13px; color: var(--gris); display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ---------- Barra superior ---------- */
.barra { background: #0b2a48; color: #fff; position: sticky; top: 0; z-index: 20; }
/* misma franja azul→ámbar que la app de los ingenieros y que el encabezado de cada responsiva */
.barra::after { content: ""; display: block; height: 3px; background: linear-gradient(90deg, #0d3b66 0%, #1a5591 55%, #f4a300 100%); }
.barra-in { max-width: 1240px; margin: 0 auto; padding: 12px 20px 6px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.marca-barra { margin: 0; min-width: 0; }
.marca-barra img { background: #fff; border-radius: 8px; padding: 2px; flex: none; }
.marca-barra .marca-nombre { color: #fff; letter-spacing: .2px; font-size: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.marca-barra .marca-sub { color: #c9d7e6; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.marca-barra > div { min-width: 0; }
.barra-der { display: flex; align-items: center; gap: 12px; flex: none; }
.usuario { color: #c9d7e6; font-size: 13px; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pestanas { max-width: 1240px; margin: 0 auto; padding: 0 12px; display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.pestanas::-webkit-scrollbar { display: none; }
.pestanas button {
  background: none; border: 0; color: #c9d7e6; font: inherit; font-weight: 600; padding: 10px 12px 9px; cursor: pointer;
  border-bottom: 3px solid transparent; margin-bottom: -3px; white-space: nowrap;
}
.pestanas button[aria-selected=true] { color: #fff; border-bottom-color: var(--acento); }
.pestanas button:hover { color: #fff; }

/* ---------- Contenido ---------- */
.contenido { max-width: 1240px; margin: 0 auto; padding: 20px; }
.caja { background: var(--tarjeta); border: 1px solid var(--borde); border-radius: var(--radio); padding: 18px; box-shadow: var(--sombra); margin-bottom: 16px; }
.tarjetas { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-bottom: 16px; }
.tarjeta { background: var(--tarjeta); border: 1px solid var(--borde); border-radius: var(--radio); padding: 16px 18px; box-shadow: var(--sombra); border-left: 4px solid var(--azul2); }
.tarjeta.t-ok { border-left-color: var(--ok); }
.tarjeta.t-warn { border-left-color: var(--warn); }
.tarjeta .n { font-size: 30px; font-weight: 800; color: var(--azul); line-height: 1.1; }
.tarjeta .l { color: var(--gris); font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .3px; }
.tarjeta .s { color: var(--gris); font-size: 13px; margin-top: 4px; }
.barra-prog { height: 7px; background: #e7edf4; border-radius: 999px; overflow: hidden; margin-top: 8px; }
.barra-prog > i { display: block; height: 100%; background: var(--ok); border-radius: 999px; }
.dos-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.dos-col .caja { margin-bottom: 16px; }
.lista-simple { list-style: none; margin: 0; padding: 0; }
.lista-simple li { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid #eef2f7; }
.lista-simple li:last-child { border-bottom: 0; }
.vacio { color: var(--gris); padding: 18px 4px; text-align: center; font-size: 14px; }
.cols-personas { columns: 3 240px; column-gap: 24px; }
.cols-personas li { break-inside: avoid; }

/* ---------- Filtros y tablas ---------- */
.filtros { display: flex; flex-wrap: wrap; gap: 10px 12px; align-items: flex-end; background: #fff; border: 1px solid var(--borde); border-radius: var(--radio); padding: 14px; margin-bottom: 10px; box-shadow: var(--sombra); }
.campo { flex: 1 1 150px; min-width: 130px; }
/* Campos al ancho de su columna. Safari (iPhone) le da a los campos de fecha un ancho
   propio que se salia del recuadro; sin su apariencia nativa obedece al ancho. */
.campo input, .campo select { width: 100%; min-width: 0; max-width: 100%; box-sizing: border-box; }
.campo input[type=date] { -webkit-appearance: none; appearance: none; min-height: 42px; background: #fff; }
.logo-barra { height: 26px; width: auto; filter: brightness(0) invert(1); flex: none; background: none !important; padding: 0 !important; }
.campo-ancho { flex: 3 1 260px; }
.campo-btn { flex: 0 0 auto; min-width: 0; }
.campo-chk { display: flex; gap: 18px; flex-wrap: wrap; align-items: center; min-height: 40px; }
.campo-chk label { display: inline-flex; align-items: center; gap: 6px; margin: 0; color: var(--texto); font-weight: 500; font-size: 14px; cursor: pointer; }
.conteo { margin: 6px 2px 10px; color: var(--gris); font-size: 13px; }
.tabla-env { background: #fff; border: 1px solid var(--borde); border-radius: var(--radio); overflow: auto; box-shadow: var(--sombra); }
.tabla { width: 100%; border-collapse: collapse; font-size: 14px; }
.tabla th { text-align: left; background: #f7f9fc; color: var(--gris); font-size: 12px; text-transform: uppercase; letter-spacing: .3px; padding: 10px 12px; border-bottom: 1px solid var(--borde); white-space: nowrap; position: sticky; top: 0; }
.tabla td { padding: 10px 12px; border-bottom: 1px solid #eef2f7; vertical-align: top; }
.tabla tr:last-child td { border-bottom: 0; }
.tabla tbody tr:hover { background: #fafcfe; }
.tabla tr.resaltado { background: #fff8e6; }
.folio { font-weight: 700; color: var(--azul); font-family: Consolas, Menlo, monospace; font-size: 13px; white-space: nowrap; }
.tags { display: flex; flex-wrap: wrap; gap: 4px; }
.tag { font-family: Consolas, Menlo, monospace; font-size: 12px; background: var(--azul-claro); color: var(--azul); border-radius: 4px; padding: 1px 6px; white-space: nowrap; }
.acciones { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.chip { display: inline-block; font-size: 12px; font-weight: 600; border-radius: 999px; padding: 2px 9px; white-space: nowrap; margin: 0 4px 3px 0; }
.chip-vigente { background: var(--ok-f); color: var(--ok); }
.chip-reemplazado { background: var(--warn-f); color: var(--warn); }
.chip-cerrado { background: #edf1f6; color: var(--gris); }
.chip-anulado { background: var(--rojo-f); color: var(--rojo); }
.chip-firmada { background: var(--azul-claro); color: var(--azul); }
.chip-sinfirma { background: #f4f4f4; color: var(--gris); }
.chip-no { background: var(--warn-f); color: var(--warn); }
.mini { font-size: 12px; color: var(--gris); }
.alerta-dif { color: var(--warn); font-size: 12px; }

/* ---------- Verificar ---------- */
.verif { max-width: 760px; }
.soltar {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; text-align: center;
  border: 2px dashed #a9bccf; border-radius: var(--radio); padding: 30px 16px; margin: 14px 0; cursor: pointer;
  background: #f7f9fc; color: var(--azul); font-weight: 600; transition: background .15s, border-color .15s;
}
.soltar:hover, .soltar.sobre { background: var(--azul-claro); border-color: var(--azul2); }
.soltar input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.soltar-t { font-size: 16px; }
.fila-huella { display: flex; gap: 8px; margin-top: 8px; }
.fila-huella input { font-family: Consolas, Menlo, monospace; font-size: 13px; }
details summary { cursor: pointer; color: var(--azul2); }
.resultado { margin-top: 16px; border-radius: var(--radio); padding: 14px 16px; border: 1px solid; }
.resultado.r-ok { background: var(--ok-f); border-color: #b8dfc7; }
.resultado.r-no { background: var(--rojo-f); border-color: #f0c4be; }
.resultado.r-warn { background: var(--warn-f); border-color: #f2d18a; }
.resultado h3 { margin: 0 0 6px; font-size: 16px; }
.hash { font-family: Consolas, Menlo, monospace; font-size: 12px; word-break: break-all; color: var(--gris); }

/* ---------- Visor ---------- */
.visor { position: fixed; inset: 0; background: rgba(12, 24, 38, .62); z-index: 50; display: flex; padding: 18px; }
.visor-caja { background: #fff; border-radius: 12px; flex: 1; display: flex; flex-direction: column; overflow: hidden; max-width: 1100px; margin: 0 auto; box-shadow: 0 20px 60px rgba(0, 0, 0, .3); }
.visor-barra { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--borde); flex-wrap: wrap; }
.visor-t { display: flex; flex-direction: column; min-width: 0; }
.visor-acc { display: flex; gap: 6px; flex-wrap: wrap; }
.visor iframe { flex: 1; border: 0; width: 100%; background: #525659; }
.visor-pie { padding: 6px 14px; border-top: 1px solid var(--borde); word-break: break-all; }

.cargando { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(242, 245, 249, .6); z-index: 60; }
.giro { width: 38px; height: 38px; border: 4px solid #cfdbe8; border-top-color: var(--azul); border-radius: 50%; animation: giro .8s linear infinite; }
@keyframes giro { to { transform: rotate(360deg); } }
.toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); background: var(--texto); color: #fff; padding: 10px 16px; border-radius: 8px; z-index: 70; font-size: 14px; max-width: calc(100% - 32px); box-shadow: 0 6px 20px rgba(0, 0, 0, .25); }
.pie { max-width: 1240px; margin: 0 auto; padding: 8px 20px 30px; color: var(--gris); font-size: 13px; text-align: center; }

/* ---------- Pantallas chicas: tablas como tarjetas ---------- */
@media (max-width: 820px) {
  .dos-col { grid-template-columns: 1fr; }
  .usuario { display: none; }
  .barra-in { padding: 10px 14px 4px; }
  .contenido { padding: 14px; }
  .tabla-env { background: none; border: 0; box-shadow: none; overflow: visible; }
  .tabla thead { display: none; }
  .tabla, .tabla tbody, .tabla tr, .tabla td { display: block; width: 100%; }
  .tabla tr { background: #fff; border: 1px solid var(--borde); border-radius: var(--radio); margin-bottom: 10px; padding: 8px 12px; box-shadow: var(--sombra); }
  .tabla td { border: 0; padding: 5px 0; display: flex; gap: 10px; justify-content: space-between; text-align: right; }
  .tabla td::before { content: attr(data-l); color: var(--gris); font-size: 12px; font-weight: 600; text-transform: uppercase; text-align: left; flex: none; padding-top: 2px; }
  .tabla td.td-pri { font-size: 15px; }
  .tabla td.td-acc { justify-content: flex-start; padding-top: 8px; }
  .tabla td.td-acc::before { display: none; }
  .acciones { justify-content: flex-start; }
  .tags { justify-content: flex-end; }
  .visor { padding: 0; }
  .visor-caja { border-radius: 0; }
}
@media (max-width: 560px) {
  /* filtros en dos columnas parejas; Limpiar a todo el ancho */
  .filtros { display: grid; grid-template-columns: 1fr 1fr; }
  .filtros .campo { min-width: 0; }
  .filtros .campo-ancho, .filtros .campo-btn { grid-column: 1 / -1; }
  .filtros .campo-btn .btn { width: 100%; }
  .logo-barra { height: 22px; }
}
@media (max-width: 480px) {
  .barra-der .sello { display: none; }
  .entrada-caja { padding: 22px 18px; }
  .codigo { gap: 5px; }
  .codigo input { height: 50px; font-size: 22px; }
}

@media print {
  .barra, .pestanas, .filtros, .pie, .acciones, .td-acc, .visor, .toast { display: none !important; }
  body { background: #fff; }
  .caja, .tarjeta, .tabla-env { box-shadow: none; }
}
@media (prefers-reduced-motion: reduce) { .giro { animation-duration: 2s; } * { transition: none !important; } }
