/* Zeltria_Gobierno — hoja de estilos. Sin dependencias externas. */
:root {
  --fondo: #f4f6f9; --superficie: #ffffff; --borde: #dde3ea; --texto: #1c2430; --suave: #5b6675;
  --primario: #1f4e8c; --primario-osc: #173b6a; --acento: #0f766e; --peligro: #b42318; --aviso: #b45309; --ok: #15803d;
  --lateral: #14233a; --lateral-txt: #c9d4e3; --lateral-act: #ffffff; --sombra: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.1);
  --radio: 8px; --fuente: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
[data-tema="oscuro"] {
  --fondo: #0f1620; --superficie: #17212e; --borde: #2a3646; --texto: #e5ebf2; --suave: #9aa8b8;
  --primario: #5b9bea; --primario-osc: #3d7fd0; --lateral: #0b121b; --lateral-txt: #aab7c7; --sombra: none;
}
* { box-sizing: border-box; }
html { font-size: 15px; }
body { margin: 0; font-family: var(--fuente); background: var(--fondo); color: var(--texto); line-height: 1.5; }
a { color: var(--primario); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.5rem; margin: .2rem 0 1rem; }
h2 { font-size: 1.1rem; margin: 0 0 .75rem; }
h3 { font-size: 1rem; margin: 1rem 0 .5rem; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.saltar { position: absolute; left: -9999px; }
.saltar:focus { left: 1rem; top: 1rem; z-index: 100; background: #fff; padding: .5rem 1rem; }
:focus-visible { outline: 3px solid #f59e0b; outline-offset: 2px; }

/* Marco */
.marco { display: flex; min-height: 100vh; }
.lateral { width: 260px; background: var(--lateral); color: var(--lateral-txt); flex-shrink: 0; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.marca a { display: flex; gap: .65rem; align-items: center; padding: 1rem; color: #fff; text-decoration: none; border-bottom: 1px solid rgba(255,255,255,.08); }
.marca-logo { width: 36px; height: 36px; border-radius: 8px; background: linear-gradient(135deg, #2f6fbf, #0f766e); display: grid; place-items: center; font-weight: 700; color: #fff; }
.marca-txt { display: flex; flex-direction: column; line-height: 1.2; }
.marca-txt small { color: var(--lateral-txt); font-size: .78rem; }
.menu { padding: .5rem 0; flex: 1; }
.menu-grupo summary { cursor: pointer; padding: .55rem 1rem; font-size: .74rem; letter-spacing: .06em; text-transform: uppercase; color: #8ea0b8; list-style: none; }
.menu-grupo summary::-webkit-details-marker { display: none; }
.menu-grupo summary::after { content: "▸"; float: right; }
.menu-grupo[open] summary::after { content: "▾"; }
.menu ul { list-style: none; margin: 0; padding: 0 0 .4rem; }
.menu li a { display: block; padding: .38rem 1rem .38rem 1.4rem; color: var(--lateral-txt); font-size: .92rem; }
.menu li a:hover { background: rgba(255,255,255,.06); text-decoration: none; color: #fff; }
.menu li a[aria-current="page"] { color: var(--lateral-act); background: rgba(91,155,234,.18); border-left: 3px solid #5b9bea; padding-left: calc(1.4rem - 3px); }
.version { font-size: .75rem; padding: .5rem 1rem; color: #6b7c93; }
.principal { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.superior { display: flex; align-items: center; gap: .75rem; padding: .6rem 1.25rem; background: var(--superficie); border-bottom: 1px solid var(--borde); position: sticky; top: 0; z-index: 10; }
.inst { font-weight: 600; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.buscar-global input { width: 260px; }
.btn-icono { background: none; border: 0; font-size: 1.15rem; cursor: pointer; color: var(--texto); position: relative; padding: .3rem .4rem; text-decoration: none !important; }
#abrir-menu { display: none; }
.globo { position: absolute; top: -4px; right: -6px; background: var(--peligro); color: #fff; font-size: .7rem; border-radius: 10px; padding: 0 .35rem; }
.usuario { position: relative; }
.usuario summary { cursor: pointer; list-style: none; padding: .3rem .6rem; border: 1px solid var(--borde); border-radius: 20px; font-size: .9rem; }
.usuario-menu { position: absolute; right: 0; top: 2.4rem; background: var(--superficie); border: 1px solid var(--borde); border-radius: var(--radio); box-shadow: var(--sombra); min-width: 190px; display: flex; flex-direction: column; padding: .4rem; z-index: 20; }
.usuario-menu a, .usuario-menu .enlace-btn { padding: .4rem .6rem; text-align: left; background: none; border: 0; color: var(--texto); font: inherit; cursor: pointer; width: 100%; }
main { padding: 1.25rem 1.5rem 3rem; max-width: 1400px; width: 100%; }
.pie { padding: 1rem 1.5rem; color: var(--suave); font-size: .8rem; border-top: 1px solid var(--borde); margin-top: auto; }
.migas { font-size: .85rem; color: var(--suave); margin-bottom: .4rem; }
.lead { color: var(--suave); margin-top: -.5rem; max-width: 900px; }

/* Avisos flash */
.flash { padding: .7rem 1rem; border-radius: var(--radio); margin-bottom: 1rem; border: 1px solid; }
.flash-ok { background: #ecfdf3; border-color: #abefc6; color: #05603a; }
.flash-error { background: #fef3f2; border-color: #fecdca; color: #912018; }
.flash-aviso { background: #fffaeb; border-color: #fedf89; color: #93370d; }
[data-tema="oscuro"] .flash { background: transparent; color: var(--texto); }

/* Botones y formularios */
.btn, button.btn { display: inline-flex; align-items: center; gap: .3rem; background: var(--primario); color: #fff; border: 1px solid var(--primario); padding: .45rem .9rem; border-radius: 6px; font: inherit; font-size: .9rem; cursor: pointer; text-decoration: none !important; white-space: nowrap; }
.btn:hover { background: var(--primario-osc); }
.btn.btn-sec { background: var(--superficie); color: var(--texto); border-color: var(--borde); }
.btn.btn-sec:hover { background: var(--fondo); }
.btn.btn-peligro { background: var(--peligro); border-color: var(--peligro); }
.btn.btn-ok { background: var(--ok); border-color: var(--ok); }
.btn.btn-chico { padding: .2rem .55rem; font-size: .82rem; }
.en-linea { display: inline-flex; gap: .4rem; align-items: center; margin: 0; flex-wrap: wrap; }
input[type=text], input[type=search], input[type=email], input[type=password], input[type=number], input[type=date], input[type=url], select, textarea {
  font: inherit; color: var(--texto); background: var(--superficie); border: 1px solid var(--borde); border-radius: 6px; padding: .45rem .6rem; width: 100%; max-width: 100%; }
textarea { resize: vertical; }
.con-error { border-color: var(--peligro) !important; }
.formulario fieldset { border: 1px solid var(--borde); border-radius: var(--radio); background: var(--superficie); margin: 0 0 1rem; padding: 1rem 1.2rem; }
.formulario legend { font-weight: 600; padding: 0 .4rem; }
.rejilla { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: .9rem 1.2rem; }
.campo { display: flex; flex-direction: column; gap: .25rem; }
.campo.completo { grid-column: 1 / -1; }
.campo label { font-weight: 600; font-size: .88rem; }
.campo .req { color: var(--peligro); }
.campo .ayuda { color: var(--suave); font-size: .8rem; }
.campo .error { color: var(--peligro); font-size: .82rem; }
.campo-check { justify-content: flex-end; }
.check { display: flex; gap: .4rem; align-items: center; font-weight: 500 !important; }
.pie-form { display: flex; gap: .6rem; }

/* Tablas y tarjetas */
.barra { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap; }
.filtros { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.filtros input[type=search] { width: 240px; }
.filtros select { width: auto; max-width: 220px; }
.acciones { display: flex; gap: .45rem; flex-wrap: wrap; align-items: center; }
.tabla-cont { overflow-x: auto; background: var(--superficie); border: 1px solid var(--borde); border-radius: var(--radio); box-shadow: var(--sombra); }
.tabla { width: 100%; border-collapse: collapse; font-size: .9rem; }
.tabla th, .tabla td { padding: .55rem .75rem; border-bottom: 1px solid var(--borde); text-align: left; vertical-align: top; }
.tabla th { background: var(--fondo); font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; color: var(--suave); white-space: nowrap; }
.tabla th a { color: inherit; }
.tabla tr:last-child td { border-bottom: 0; }
.tabla tbody tr:hover { background: rgba(31,78,140,.04); }
.tabla .num { text-align: right; font-variant-numeric: tabular-nums; }
.paginacion { display: flex; gap: .6rem; align-items: center; margin-top: .8rem; font-size: .88rem; color: var(--suave); flex-wrap: wrap; }
.paginacion a, .paginacion strong { padding: .2rem .55rem; border: 1px solid var(--borde); border-radius: 5px; }
.paginacion strong { background: var(--primario); color: #fff; border-color: var(--primario); }
.por-pagina select { width: auto; }
.tarjeta { background: var(--superficie); border: 1px solid var(--borde); border-radius: var(--radio); padding: 1rem 1.2rem; margin-bottom: 1rem; box-shadow: var(--sombra); }
.tarjeta h2 { display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.ficha { display: grid; grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); gap: 0 1rem; }
.datos { display: grid; grid-template-columns: minmax(140px, 32%) 1fr; gap: .45rem 1rem; margin: 0; }
.datos dt { color: var(--suave); font-size: .86rem; }
.datos dd { margin: 0; }
.vacio { color: var(--suave); font-style: italic; padding: .6rem 0; }
.lista-simple { margin: 0; padding-left: 1.1rem; }
.lista-simple li { margin: .25rem 0; }
.pie-ficha { font-size: .85rem; }
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .8rem; margin-bottom: 1rem; }
.kpi { background: var(--superficie); border: 1px solid var(--borde); border-radius: var(--radio); padding: .9rem 1rem; box-shadow: var(--sombra); }
.kpi .valor { font-size: 1.7rem; font-weight: 700; line-height: 1.1; }
.kpi .etq { color: var(--suave); font-size: .84rem; }
.kpi.alerta { border-left: 4px solid var(--peligro); }
.kpi.ok { border-left: 4px solid var(--ok); }
.dos-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 1rem; }

/* Insignias */
.nivel { display: inline-block; padding: .1rem .5rem; border-radius: 4px; color: #fff; font-size: .8rem; font-weight: 600; background: #64748b; white-space: nowrap; }
.nivel-vacio { background: transparent; color: var(--suave); border: 1px dashed var(--borde); }
.estado { display: inline-block; padding: .08rem .5rem; border-radius: 12px; font-size: .78rem; background: #e8edf3; color: #344054; white-space: nowrap; }
[data-tema="oscuro"] .estado { background: #263244; color: var(--texto); }
.e-aprobado, .e-vigente, .e-cumple, .e-firmada, .e-cerrada, .e-implementado, .e-completada, .e-aceptada, .e-realizada, .e-dentro { background: #dcfae6; color: #085d3a; }
.e-borrador, .e-pendiente, .e-planificada, .e-en_curso, .e-abierta, .e-parcial, .e-tolerancia, .e-en_revision { background: #fef0c7; color: #93370d; }
.e-no_cumple, .e-vencida, .e-rechazada, .e-excede, .e-descartada, .e-atrasada { background: #fee4e2; color: #912018; }
.semaforo { display: inline-block; padding: .1rem .55rem; border-radius: 12px; font-size: .78rem; font-weight: 600; color: #fff; }
.s-verde { background: #15803d; } .s-amarillo { background: #ca8a04; } .s-rojo { background: #b42318; }
.avance { display: inline-block; width: 90px; height: 8px; background: var(--borde); border-radius: 4px; vertical-align: middle; overflow: hidden; }
.avance span { display: block; height: 100%; background: var(--acento); width: 0; }

/* Mapa de calor */
.mapa { border-collapse: separate; border-spacing: 3px; }
.mapa td, .mapa th { width: 64px; height: 52px; text-align: center; font-size: .8rem; border-radius: 4px; }
.mapa td { color: #fff; font-weight: 700; font-size: 1rem; }
.mapa td a { color: #fff; display: block; }
.mapa th { color: var(--suave); font-weight: 500; }
.mapa .eje-y { writing-mode: vertical-rl; transform: rotate(180deg); width: 24px; }
.mapa td.vacia { opacity: .55; font-weight: 400; }
.leyenda { display: flex; gap: .8rem; flex-wrap: wrap; font-size: .82rem; margin-top: .5rem; }
.leyenda span::before { content: ""; display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: .3rem; vertical-align: -1px; background: var(--c, #888); }

/* Árbol de alineación */
.arbol, .arbol ul { list-style: none; margin: 0; padding-left: 1.2rem; }
.arbol { padding-left: 0; }
.arbol li { position: relative; padding: .3rem 0 .3rem .9rem; border-left: 2px solid var(--borde); }
.arbol li::before { content: ""; position: absolute; left: 0; top: 1.05rem; width: .7rem; border-top: 2px solid var(--borde); }
.arbol .nodo { display: inline-flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.dos-lecturas { font-size: .8rem; color: var(--suave); }
.alerta-txt { color: var(--peligro); font-weight: 600; }

/* Capacidad */
.cap-tabla td.cal select { min-width: 150px; }
.propuesta { font-size: .78rem; color: var(--acento); }
.barra-niveles { display: flex; gap: 3px; }
.barra-niveles span { width: 22px; height: 14px; border-radius: 3px; background: var(--borde); }
.barra-niveles span.lleno { background: var(--acento); }
.barra-niveles span.meta { outline: 2px solid var(--aviso); }

/* FODA */
.foda { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
.foda .cuadro { background: var(--superficie); border: 1px solid var(--borde); border-radius: var(--radio); padding: .8rem 1rem; min-height: 160px; }
.foda .F { border-top: 4px solid #15803d; } .foda .O { border-top: 4px solid #1d4ed8; } .foda .D { border-top: 4px solid #ca8a04; } .foda .A { border-top: 4px solid #b42318; }

/* Acceso e instalador */
.acceso { min-height: 100vh; display: grid; place-items: center; background: linear-gradient(160deg, #14233a 0%, #1f4e8c 60%, #0f766e 100%); padding: 1rem; }
.caja { background: var(--superficie); border-radius: 12px; padding: 2rem; width: 100%; max-width: 420px; box-shadow: 0 20px 40px rgba(0,0,0,.25); }
.caja.ancha { max-width: 760px; }
.caja h1 { font-size: 1.35rem; }
.caja .campo { margin-bottom: .85rem; }
.caja .btn { width: 100%; justify-content: center; padding: .6rem; }
.pasos { display: flex; gap: .3rem; margin-bottom: 1.2rem; flex-wrap: wrap; }
.pasos span { flex: 1; min-width: 70px; text-align: center; font-size: .72rem; padding: .3rem; border-radius: 4px; background: var(--fondo); color: var(--suave); }
.pasos span.act { background: var(--primario); color: #fff; }
.pasos span.hecho { background: #dcfae6; color: #085d3a; }
.verif li { list-style: none; padding: .2rem 0; }
.verif .si::before { content: "✓ "; color: var(--ok); font-weight: 700; }
.verif .no::before { content: "✗ "; color: var(--peligro); font-weight: 700; }
.codigo { font-family: ui-monospace, Menlo, Consolas, monospace; background: var(--fondo); padding: .5rem .7rem; border-radius: 6px; word-break: break-all; display: block; font-size: .85rem; }
.error-pag { text-align: center; padding: 3rem 1rem; }
.error-codigo { font-size: 3.5rem; font-weight: 700; color: var(--peligro); margin: 0; }

@media (max-width: 900px) {
  .lateral { position: fixed; left: -280px; z-index: 50; transition: left .2s; }
  .lateral.abierto { left: 0; }
  #abrir-menu { display: inline-block; }
  .buscar-global { display: none; }
  main { padding: 1rem; }
  .foda { grid-template-columns: 1fr; }
}
@media print {
  .lateral, .superior, .pie, .barra .acciones, .no-imprimir, .filtros { display: none !important; }
  body { background: #fff; color: #000; }
  main { padding: 0; max-width: none; }
  .tarjeta, .tabla-cont { box-shadow: none; border-color: #999; break-inside: avoid; }
  .nivel, .semaforo, .mapa td { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  a { color: #000; }
  .encabezado-informe { display: flex !important; }
}
.encabezado-informe { display: none; justify-content: space-between; border-bottom: 2px solid #000; margin-bottom: 1rem; padding-bottom: .5rem; }
.marca-agua { position: fixed; top: 40%; left: 10%; font-size: 6rem; color: rgba(180,35,24,.08); transform: rotate(-30deg); pointer-events: none; z-index: 0; }

/* Formularios en línea y utilidades de las pantallas de gestión */
.en-linea input:not([type=checkbox]):not([type=radio]):not([type=file]), .en-linea select { width: auto; max-width: 320px; }
.en-linea input.ancho, input.ancho { min-width: 260px; }
.barra form.en-linea { margin-bottom: .3rem; }
input.mini, .mini { width: 70px !important; } input.corto, .corto { width: 120px !important; }
.check { display: flex; gap: .45rem; align-items: flex-start; margin: .3rem 0; font-weight: 400; }
.check input { margin-top: .3rem; width: auto; }
.columnas { columns: 3 260px; column-gap: 1.5rem; }
.columnas .check { break-inside: avoid; }
.chip { display: inline-block; padding: .15rem .6rem; border: 1px solid var(--borde); border-radius: 999px; font-size: .82rem; color: var(--texto); background: var(--superficie); margin: 0 .2rem .3rem 0; }
.chip.activa, .pestanas a.activa { background: var(--primario); border-color: var(--primario); color: #fff; }
.pestanas { display: inline-flex; gap: .3rem; }
.pestanas a { padding: .35rem .8rem; border: 1px solid var(--borde); border-radius: 6px; background: var(--superficie); color: var(--texto); }
.narrativa { white-space: normal; line-height: 1.65; max-width: 900px; }
.pre { white-space: pre-wrap; word-break: break-word; background: var(--fondo); border: 1px solid var(--borde); border-radius: 6px; padding: .7rem; font-size: .85rem; max-height: 480px; overflow: auto; }
.centro { text-align: center; } .tenue { opacity: .55; }
.fila-error td { background: #fef3f2; } [data-tema="oscuro"] .fila-error td { background: rgba(180,35,24,.15); }
tr.grupo th { background: var(--fondo); text-align: left; font-size: .85rem; letter-spacing: .03em; }
.insignia { display: inline-block; padding: .1rem .5rem; border-radius: 4px; color: #fff; font-size: .8rem; font-weight: 600; margin: 0 .2rem .2rem 0; background: #64748b; }
.mapa td.celda { color: #fff; }
.mapa input.mini { width: 56px !important; text-align: center; }
.matriz-permisos th:first-child { position: sticky; left: 0; background: var(--superficie); z-index: 1; min-width: 200px; }
.matriz-permisos td { white-space: nowrap; }
.mini-check { display: inline-flex; align-items: center; gap: 1px; font-size: .75rem; margin: 0 2px; color: var(--suave); }
.mini-check input { width: auto; margin: 0; }
.raci td { font-weight: 700; } .raci th small { font-weight: 400; color: var(--suave); }
.portada-informe { border-bottom: 2px solid var(--primario); margin-bottom: 1rem; padding-bottom: .4rem; }
.portada-informe p { margin: .15rem 0; color: var(--suave); } .portada-informe strong { color: var(--texto); font-size: 1.05rem; }
.pie-informe { margin-top: 1.5rem; color: var(--suave); border-top: 1px solid var(--borde); padding-top: .4rem; }
.proveedor { display: flex; margin: .4rem 0; padding: .5rem 0; border-bottom: 1px dashed var(--borde); }
/* FODA en tarjetas */
.foda > .tarjeta { margin: 0; }
.foda-f { border-top: 4px solid #15803d; } .foda-o { border-top: 4px solid #1d4ed8; } .foda-d { border-top: 4px solid #ca8a04; } .foda-a { border-top: 4px solid #b42318; }
.foda .lista-simple li { padding: .35rem 0; border-bottom: 1px solid var(--borde); }
.foda .lista-simple li .btn { margin-left: .2rem; }
.foda-form { margin-top: .6rem; display: flex; flex-direction: column; gap: .4rem; }
.imp { color: var(--aviso); letter-spacing: -1px; font-size: .75rem; }
.ayuda { color: var(--suave); font-size: .85rem; }
.propuesta-item h2 small { font-weight: 400; }
small.propuesta, p.propuesta { color: var(--acento); }
@media print { .portada-informe { border-color: #000; } }
.o-separador{text-align:center;color:var(--suave);margin:.6rem 0}.btn-bloque{display:block;text-align:center;width:100%}
