/* Atalaya ED. Sin dependencias externas: la CSP solo permite recursos propios. */
:root {
  --fondo: #f4f5f7;
  --superficie: #ffffff;
  --texto: #1d2433;
  --texto-suave: #5b6476;
  --borde: #dde1e8;
  --marca: #1f3a68;
  --marca-fuerte: #142849;
  --acento: #2c6bd6;
  --peligro: #b42318;
  --ok: #1a7f4b;
  --bajo: #d8f0e1;    --bajo-t: #11603a;
  --medio: #fdf0c4;   --medio-t: #7a5a00;
  --alto: #fddcc4;    --alto-t: #9a3d0b;
  --critico: #f9c9c4; --critico-t: #8f1a10;
  --radio: 8px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--fondo);
  color: var(--texto);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
h1, h2, h3 { line-height: 1.25; margin: 0 0 .6em; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.1rem; }
h3 { font-size: 1rem; margin-top: 1em; }
a { color: var(--acento); }
code { background: #eef1f6; padding: 0 .3em; border-radius: 4px; font-size: .9em; }

.oculto { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Cabecera y menú */
.cabecera {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .75rem 1.25rem; background: var(--marca); color: #fff;
}
.marca { color: inherit; text-decoration: none; display: flex; flex-direction: column; }
.marca-nombre { font-weight: 700; font-size: 1.15rem; letter-spacing: .01em; }
.marca-linea { font-size: .8rem; opacity: .8; }
.salir { display: flex; align-items: center; gap: .75rem; margin: 0; }
.usuario { font-size: .875rem; opacity: .9; }
.menu {
  display: flex; gap: .25rem; overflow-x: auto; padding: 0 1rem;
  background: var(--marca-fuerte); scrollbar-width: thin;
}
.menu a {
  color: #cfd8ea; text-decoration: none; padding: .6rem .75rem; white-space: nowrap;
  border-bottom: 3px solid transparent; font-size: .9rem;
}
.menu a:hover { color: #fff; }
.menu a[aria-current="page"] { color: #fff; border-bottom-color: #8fb4ff; }

.contenido { max-width: 1200px; margin: 0 auto; padding: 1.5rem 1rem 3rem; }

.titulo-pagina { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .5rem 1rem; margin-bottom: 1rem; }
.titulo-pagina h1 { margin: 0; }
.nota { color: var(--texto-suave); font-size: .875rem; }
.vacio { color: var(--texto-suave); font-style: italic; }

/* Tarjetas y rejillas */
.tarjeta {
  background: var(--superficie); border: 1px solid var(--borde); border-radius: var(--radio);
  padding: 1.25rem; margin-bottom: 1rem; min-width: 0; overflow-x: auto;
}
.estrecha { max-width: 560px; }
.rejilla-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: 1rem; }

.indicadores { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); gap: 1rem; margin-bottom: 1rem; }
.indicador {
  display: flex; flex-direction: column; text-decoration: none; color: inherit;
  background: var(--superficie); border: 1px solid var(--borde); border-radius: var(--radio); padding: 1rem 1.25rem;
}
.indicador:hover { border-color: var(--acento); }
.cifra { font-size: 2rem; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.rotulo { font-weight: 600; }
.detalle { color: var(--texto-suave); font-size: .85rem; }
.detalle.alerta { color: var(--peligro); font-weight: 600; }

.pendientes { margin: 0; padding-left: 1.1rem; }
.pendientes li { margin: .3rem 0; }

/* Tablas */
.tabla-contenedor { overflow-x: auto; background: var(--superficie); border: 1px solid var(--borde); border-radius: var(--radio); }
.tabla { width: 100%; border-collapse: collapse; font-size: .9rem; }
.tabla th, .tabla td { padding: .55rem .75rem; text-align: left; border-bottom: 1px solid var(--borde); vertical-align: top; }
.tabla thead th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--texto-suave); background: #f8f9fb; }
.tabla tbody tr:last-child td, .tabla tbody tr:last-child th { border-bottom: 0; }
.tabla tbody th { font-weight: 500; }
.tabla.compacta th, .tabla.compacta td { padding: .35rem .5rem; }
.num { text-align: right !important; font-variant-numeric: tabular-nums; }
.acciones { white-space: nowrap; text-align: right !important; }
.acciones a { margin-left: .6rem; font-size: .85rem; }
.acciones a.peligro { color: var(--peligro); }
.codigo { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .85em; color: var(--texto-suave); }
.evidencia { max-width: 28ch; }
.antes { color: var(--texto-suave); text-decoration: line-through; }

.barra { white-space: nowrap; }
meter { width: 110px; height: 12px; vertical-align: middle; }

/* Insignias por valor de choices */
.insignia { display: inline-block; padding: .1rem .5rem; border-radius: 999px; font-size: .78rem; font-weight: 600; background: #eceff4; color: var(--texto-suave); white-space: nowrap; }
.v-bajo, .v-baja, .v-implementado, .v-vigente, .v-cerrado, .v-resuelto, .v-lagoon, .v-lagoon_operativo { background: var(--bajo); color: var(--bajo-t); }
.v-medio, .v-media, .v-parcial, .v-en_revision, .v-en_curso, .v-en_tratamiento, .v-contenido, .v-borrador, .v-seedcloud_anterior, .v-lagoon_sin_datos { background: var(--medio); color: var(--medio-t); }
.v-alto, .v-alta, .v-abierto, .v-identificado, .v-sin_lagoon, .v-legado { background: var(--alto); color: var(--alto-t); }
.v-critico, .v-critica, .v-no_implementado, .v-obsoleta, .v-lagoon_con_falla { background: var(--critico); color: var(--critico-t); }

/* Mapa de calor */
.mapa { border-collapse: separate; border-spacing: 4px; margin: 0 auto; }
.mapa .celda { width: 52px; height: 44px; text-align: center; font-weight: 700; border-radius: 6px; opacity: .55; }
.mapa .celda.con-datos { opacity: 1; outline: 2px solid rgba(0,0,0,.15); }
.mapa .celda.v-bajo { background: var(--bajo); color: var(--bajo-t); }
.mapa .celda.v-medio { background: var(--medio); color: var(--medio-t); }
.mapa .celda.v-alto { background: var(--alto); color: var(--alto-t); }
.mapa .celda.v-critico { background: var(--critico); color: var(--critico-t); }
.mapa .eje { color: var(--texto-suave); font-size: .8rem; font-weight: 500; text-align: center; }
.mapa .eje-x { color: var(--texto-suave); font-size: .8rem; font-weight: 600; text-align: center; }
.mapa .eje-y { color: var(--texto-suave); font-size: .8rem; font-weight: 600; width: 1.5rem; }
.mapa .eje-y span { display: inline-block; transform: rotate(-90deg); white-space: nowrap; }

/* Formularios */
.filtros { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-bottom: 1rem; }
.campo-busqueda { flex: 1 1 220px; }
input[type="text"], input[type="search"], input[type="email"], input[type="url"], input[type="password"],
input[type="number"], input[type="date"], select, textarea {
  width: 100%; padding: .5rem .65rem; border: 1px solid #c4cad5; border-radius: 6px;
  font: inherit; font-size: 16px; background: #fff; color: inherit;
}
.filtros select { width: auto; max-width: 100%; }
textarea { min-height: 6rem; resize: vertical; }
input:focus-visible, select:focus-visible, textarea:focus-visible, .boton:focus-visible, a:focus-visible {
  outline: 3px solid #8fb4ff; outline-offset: 1px;
}
.formulario { max-width: 760px; }
.campo { margin-bottom: 1rem; display: flex; flex-direction: column; gap: .25rem; }
.campo label { font-weight: 600; font-size: .9rem; }
.campo input[type="checkbox"] { width: auto; align-self: flex-start; }
.requerido { color: var(--peligro); }
.ayuda { color: var(--texto-suave); }
.error { color: var(--peligro); }
.con-error input, .con-error select, .con-error textarea { border-color: var(--peligro); }
.errores { background: #fdecea; color: var(--peligro); padding: .6rem .8rem; border-radius: 6px; margin-bottom: 1rem; }
.errores p, .errores ul { margin: 0; }
.botones { display: flex; align-items: center; gap: 1rem; }
.seccion { border: 0; border-top: 1px solid var(--borde); margin: 0 0 1.25rem; padding: 1rem 0 0; min-width: 0; }
.seccion:first-of-type { border-top: 0; padding-top: 0; }
.seccion legend { font-weight: 700; font-size: 1rem; color: var(--marca); padding: 0 .4rem 0 0; }
.ayuda-seccion { margin: 0 0 1rem; color: var(--texto-suave); font-size: .88rem; }
.alta h2 { margin: 0 0 .4rem; font-size: 1.05rem; }
.alta ol { margin: .5rem 0; padding-left: 1.2rem; }
.alta li { margin-bottom: .35rem; }

.boton {
  display: inline-block; padding: .5rem 1rem; border-radius: 6px; border: 1px solid transparent;
  font: inherit; font-weight: 600; font-size: .9rem; text-decoration: none; cursor: pointer; text-align: center;
}
.boton-principal { background: var(--acento); color: #fff; }
.boton-principal:hover { background: #2358b3; }
.boton-secundario { background: #fff; color: var(--marca); border-color: #c4cad5; }
.boton-secundario:hover { border-color: var(--marca); }
.boton-peligro { background: var(--peligro); color: #fff; }
.boton-sutil { background: transparent; color: #fff; border-color: rgba(255,255,255,.4); padding: .3rem .75rem; }
.boton-sutil:hover { border-color: #fff; }
.boton-ancho { display: block; width: 100%; }
.enlace { font-size: .9rem; }

.mensajes { list-style: none; padding: 0; margin: 0 0 1rem; }
.mensaje { padding: .7rem 1rem; border-radius: 6px; margin-bottom: .5rem; background: #e8f0fe; }
.mensaje-success { background: #e3f4ea; color: var(--ok); }
.mensaje-error { background: #fdecea; color: var(--peligro); }
.aviso { background: #eef3fc; border: 1px solid #c9d9f5; border-radius: var(--radio); padding: .9rem 1.1rem; margin-bottom: 1rem; font-size: .9rem; }
.senales { display: grid; grid-template-columns: max-content 1fr; gap: .2rem 1rem; margin: .6rem 0 0; }
.senales dt { color: var(--texto-suave); }
.senales dd { margin: 0; }
.datos { display: grid; grid-template-columns: max-content 1fr; gap: .3rem 1rem; }
.datos dt { color: var(--texto-suave); }
.datos dd { margin: 0; }

.paginacion { display: flex; gap: 1rem; justify-content: center; align-items: center; margin-top: 1rem; font-size: .9rem; }

.historial { list-style: none; padding: 0; }
.historial .meta { margin: 0 0 .5rem; }

/* Ingreso */
.pagina-ingreso { display: grid; min-height: 100vh; min-height: 100dvh; place-items: center; background: var(--marca); }
.pagina-ingreso .contenido { width: 100%; max-width: 420px; padding: 1rem; }
.ingreso { padding: 2rem; }
.ingreso .marca-nombre { color: var(--marca); font-size: 1.6rem; margin-bottom: .1rem; }
.ingreso .marca-linea { color: var(--texto-suave); margin: 0 0 1.5rem; display: block; }
.separador { text-align: center; color: var(--texto-suave); font-size: .85rem; margin: 1rem 0; }

/* Informe */
.informe { background: var(--superficie); border: 1px solid var(--borde); border-radius: var(--radio); padding: 2rem; }
.informe section { margin-top: 2rem; }
.informe-portada { border-bottom: 2px solid var(--marca); padding-bottom: 1.25rem; }
.informe-portada .marca-nombre { color: var(--marca); margin: 0; }

@media (max-width: 640px) {
  .cabecera { flex-wrap: wrap; }
  .marca-linea { display: none; }
  .usuario { display: none; }
  .informe { padding: 1rem; }
  .mapa .celda { width: 40px; height: 36px; }
  meter { width: 60px; }
  .tabla th, .tabla td { padding: .45rem .5rem; }
}

@media print {
  @page { size: A4; margin: 16mm 14mm; }
  body { background: #fff; font-size: 10.5pt; }
  .cabecera, .menu, .mensajes, .no-imprimir { display: none !important; }
  .contenido { max-width: none; padding: 0; }
  .informe { border: 0; padding: 0; }
  .tarjeta, .tabla-contenedor { border: 0; padding: 0; }
  .salto { break-before: page; }
  .tabla tr, .mapa { break-inside: avoid; }
  .insignia, .mapa .celda { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  a { color: inherit; text-decoration: none; }
}
