/* Levantamiento de Redes · identidad «Alta visibilidad»: grafito, concreto y lima.
   Un solo tema, a propósito: la app se usa bajo el sol. */

:root {
  --grafito: #15171A;
  --grafito-2: #22262B;
  --concreto: #ECEDEA;
  --papel: #FFFFFF;
  --borde: #D6D9D4;
  --borde-fuerte: #C9CDC7;
  --gris: #535962;
  --gris-claro: #8A9097;
  --lima: #CFF23A;
  --lima-suave: #EAF6C4;
  --mt: #D12F2F;
  --bt: #1D5FD0;
  --verde: #146C3C;
  --verde-suave: #E3F4E9;
  --ambar: #8A5300;
  --ambar-suave: #FDF0D9;
  --rojo: #9E1C12;
  --rojo-suave: #FBE4E1;
  --sombra: 0 2px 10px rgba(21, 23, 26, .10);
}

* { box-sizing: border-box; }
/* Va antes que todo: sin esto, un display: flex de clase le gana al hidden del navegador
   y la hoja inferior se queda pegada encima del mapa. */
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--concreto);
  color: var(--grafito);
  font-family: 'Atkinson Hyperlegible Next', 'Atkinson Hyperlegible', system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  -webkit-text-size-adjust: 100%;
}
h1, h2, h3 { margin: 0; font-family: 'Archivo', system-ui, sans-serif; font-stretch: 112%; font-weight: 800; text-wrap: balance; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--bt); outline-offset: 2px; }
.ic { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- estructura ---------- */
.pantalla { display: flex; flex-direction: column; height: 100%; }
.barra {
  flex-shrink: 0;
  display: flex; align-items: center; gap: 12px;
  padding: calc(12px + env(safe-area-inset-top, 0px)) 16px 12px;
  background: var(--concreto);
}
.barra-proyecto { background: var(--papel); border-bottom: 1px solid var(--borde); padding: calc(10px + env(safe-area-inset-top, 0px)) 12px 10px; gap: 8px; }
.barra-textos { flex-grow: 1; min-width: 0; display: flex; flex-direction: column; }
.titulo { font-family: 'Archivo', system-ui, sans-serif; font-stretch: 112%; font-size: 18px; font-weight: 800; line-height: 1.15; }
.codigo, .sub { font-size: 12px; color: var(--gris); }
.codigo { font-family: 'Atkinson Hyperlegible Mono', ui-monospace, monospace; }
.marca {
  width: 44px; height: 44px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  border: 1.5px solid var(--grafito); border-radius: 12px; background: var(--lima);
}
.cuerpo { flex-grow: 1; min-height: 0; overflow: auto; padding: 4px 16px 16px; display: flex; flex-direction: column; gap: 12px; }
.pie { flex-shrink: 0; padding: 12px 16px calc(16px + env(safe-area-inset-bottom, 0px)); background: var(--papel); border-top: 1px solid var(--borde); }

/* ---------- tarjetas de proyecto ---------- */
.tarjeta {
  display: flex; flex-direction: column; gap: 8px;
  padding: 14px; background: var(--papel);
  border: 1px solid var(--borde); border-radius: 16px;
  text-align: left; width: 100%;
}
.tarjeta-cabeza { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.tarjeta h2 { font-size: 17px; }
.tarjeta .detalle { font-size: 13px; color: var(--gris); }
.etiqueta {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 9px; border-radius: 999px;
  font-size: 12px; font-weight: 700; white-space: nowrap;
}
.et-redes { background: var(--rojo-suave); color: var(--rojo); }
.et-solar { background: var(--ambar-suave); color: var(--ambar); }
.et-listo { background: var(--verde-suave); color: var(--verde); }
.cifras { display: flex; flex-wrap: wrap; gap: 6px; }
.cifra {
  padding: 3px 9px; border: 1px solid var(--borde); border-radius: 8px;
  font-size: 12px; color: var(--grafito);
  font-variant-numeric: tabular-nums;
}
.vacio { margin: 0; padding: 32px 8px; text-align: center; color: var(--gris); }

/* ---------- mapa ---------- */
.mapa-caja { position: relative; flex-grow: 1; min-height: 0; background: #FAFAF7; }
#mapa { width: 100%; height: 100%; display: block; touch-action: none; }
.mapa-botones { position: absolute; right: 12px; top: 12px; display: flex; flex-direction: column; gap: 8px; }
.icono {
  width: 44px; height: 44px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  padding: 0; border: 1px solid var(--borde); border-radius: 12px;
  background: var(--papel); color: var(--grafito); box-shadow: var(--sombra);
}
.barra-proyecto .icono { border-color: transparent; box-shadow: none; background: transparent; }
.modo {
  position: absolute; left: 12px; right: 68px; top: 12px; margin: 0;
  padding: 10px 12px; border-radius: 12px;
  background: var(--grafito); color: var(--papel); font-size: 13px; line-height: 1.35;
  box-shadow: var(--sombra);
}
.modo b { color: var(--lima); }
.chip {
  flex-shrink: 0; height: 36px; padding: 0 12px;
  display: flex; align-items: center; gap: 6px;
  border: 0; border-radius: 999px;
  background: var(--grafito); color: var(--papel);
  font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums;
}
.chip-ok { background: var(--verde); }

.herramientas {
  flex-shrink: 0;
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px;
  padding: 8px 10px calc(10px + env(safe-area-inset-bottom, 0px));
  background: var(--papel); border-top: 1px solid var(--borde);
}
.herramientas button {
  min-height: 60px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  padding: 4px 2px; border: 1px solid var(--borde); border-radius: 14px;
  background: #F4F5F2; color: var(--grafito); font-size: 11px; font-weight: 700;
}
.herramientas button[aria-pressed="true"] { background: var(--lima); border: 1.5px solid var(--grafito); }

/* ---------- dibujo del mapa ---------- */
.m-fondo { fill: #FAFAF7; }
.m-rejilla { stroke: #E4E6E1; stroke-width: 1; }
.m-escala { stroke: var(--grafito); stroke-width: 2; }
.m-escala-t { font: 600 11px 'Atkinson Hyperlegible Mono', ui-monospace, monospace; fill: var(--grafito); }
.m-norte { fill: var(--grafito); }
.m-norte-t { font: 700 11px 'Atkinson Hyperlegible Next', system-ui, sans-serif; fill: var(--grafito); text-anchor: middle; }
.l-mt-e { stroke: var(--mt); stroke-width: 3; stroke-dasharray: 9 6; }
.l-mt-p { stroke: var(--mt); stroke-width: 3.5; stroke-linecap: round; }
.l-bt-e { stroke: var(--bt); stroke-width: 2.25; stroke-dasharray: 6 5; }
.l-bt-p { stroke: var(--bt); stroke-width: 2.5; stroke-linecap: round; }
.l-retirar { stroke: var(--gris-claro); stroke-width: 2; stroke-dasharray: 2 4; }
.m-poste-mt { fill: var(--papel); stroke: var(--grafito); stroke-width: 1.75; }
.m-punto-e { fill: var(--grafito); }
.m-punto-p { fill: #1E9E57; }
.m-poste-bt { fill: var(--grafito); stroke: var(--papel); stroke-width: 2; }
.m-poste-bt-p { fill: #1E9E57; stroke: var(--papel); stroke-width: 2; }
.m-equis { stroke: #B42318; stroke-width: 2.5; stroke-linecap: round; fill: none; }
.m-sel { fill: rgba(207, 242, 58, .55); stroke: var(--grafito); stroke-width: 1.5; }
.m-sel-linea { stroke: rgba(207, 242, 58, .85); stroke-width: 11; stroke-linecap: round; }
.m-cod {
  font: 600 11px 'Atkinson Hyperlegible Mono', ui-monospace, monospace; fill: var(--grafito);
  paint-order: stroke; stroke: #FAFAF7; stroke-width: 3.5px; stroke-linejoin: round;
}
.m-vano {
  font: 500 10px 'Atkinson Hyperlegible Mono', ui-monospace, monospace; fill: var(--gris); text-anchor: middle;
  paint-order: stroke; stroke: #FAFAF7; stroke-width: 3px;
}
.m-zona { fill: rgba(207, 242, 58, .30); stroke: #5F7700; stroke-width: 2.5; stroke-linejoin: round; }
.m-dibujo { fill: none; stroke: #5F7700; stroke-width: 2.5; stroke-dasharray: 6 4; }
.m-vertice { fill: var(--papel); stroke: var(--grafito); stroke-width: 2; }
.m-hallazgo { fill: #D98E04; stroke: var(--papel); stroke-width: 2; }
.m-hallazgo-t { font: 700 12px 'Atkinson Hyperlegible Next', system-ui, sans-serif; fill: var(--papel); text-anchor: middle; }
.m-precision { fill: rgba(207, 242, 58, .35); stroke: #8FAE12; stroke-width: 1; }
.m-gps { fill: var(--grafito); stroke: var(--lima); stroke-width: 3; }

/* ---------- hoja inferior ---------- */
.velo { position: fixed; inset: 0; background: rgba(21, 23, 26, .45); z-index: 20; }
.hoja {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 21;
  max-width: 520px; margin: 0 auto; max-height: 86%;
  display: flex; flex-direction: column;
  padding: 14px 16px calc(18px + env(safe-area-inset-bottom, 0px));
  background: var(--papel); border-radius: 20px 20px 0 0;
  box-shadow: 0 -8px 30px rgba(21, 23, 26, .25);
}
.hoja-cabeza { flex-shrink: 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.hoja-cabeza h2 { font-size: 19px; }
.hoja-cuerpo { overflow: auto; display: flex; flex-direction: column; gap: 14px; }
.hoja-cuerpo p { margin: 0; color: #3F444B; }
.nota { font-size: 13px; color: var(--gris); }

/* Separador de bloques dentro de una ficha larga. */
.seccion {
  display: flex; align-items: center; gap: 8px;
  margin-top: 4px; font-size: 12px; font-weight: 700;
  letter-spacing: .06em; text-transform: uppercase; color: var(--gris);
}
.seccion::after { content: ''; flex-grow: 1; height: 1px; background: var(--borde); }
.seccion small { text-transform: none; letter-spacing: 0; font-weight: 500; }

/* Código de armado que la app compone con la regla del operador. */
.armado {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 12px; border-radius: 12px;
  background: var(--grafito); color: var(--papel);
}
.armado span { font-size: 12px; color: #C8CCD2; }
.armado b {
  font-family: 'Atkinson Hyperlegible Mono', ui-monospace, monospace;
  font-size: 17px; color: var(--lima); letter-spacing: .02em;
}

.campo { display: flex; flex-direction: column; gap: 6px; }
.campo > label, .grupo-titulo { font-size: 13px; font-weight: 700; color: #3F444B; }
.campo input, .campo select, .campo textarea {
  width: 100%; min-height: 48px; padding: 10px 12px;
  border: 1px solid var(--borde-fuerte); border-radius: 12px; background: var(--papel);
}
.campo textarea { min-height: 76px; resize: vertical; }
.fila { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.opciones { display: flex; flex-wrap: wrap; gap: 6px; }
.opciones button {
  min-height: 44px; flex: 1 1 auto; padding: 0 12px;
  border: 1px solid var(--borde-fuerte); border-radius: 12px;
  background: var(--papel); font-size: 14px; font-weight: 700;
}
.opciones button[aria-pressed="true"] { border: 1.5px solid var(--grafito); background: var(--lima); }
.datos { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.dato { padding: 8px 10px; border-radius: 12px; background: #F1F2EE; display: flex; flex-direction: column; gap: 2px; }
.dato span { font-size: 12px; color: var(--gris); }
.dato b { font-family: 'Atkinson Hyperlegible Mono', ui-monospace, monospace; font-size: 16px; font-variant-numeric: tabular-nums; }
.miniaturas { display: flex; flex-wrap: wrap; gap: 8px; }
.miniaturas img { width: 84px; height: 84px; object-fit: cover; border-radius: 10px; border: 1px solid var(--borde); }
.btn {
  min-height: 52px; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 0 16px; border: 1px solid var(--borde-fuerte); border-radius: 14px;
  background: var(--papel); font-size: 16px; font-weight: 700; text-decoration: none;
}
.btn-primario { border: 1.5px solid var(--grafito); background: var(--lima); font-family: 'Archivo', system-ui, sans-serif; font-stretch: 112%; font-weight: 800; }
.btn-peligro { border-color: var(--rojo); color: var(--rojo); }
.btn-bloque { width: 100%; }
.botones { display: flex; gap: 10px; }
.lista-descargas { display: flex; flex-direction: column; gap: 8px; }
.descarga {
  display: flex; align-items: center; gap: 12px; min-height: 60px;
  padding: 8px 12px; border: 1px solid var(--borde); border-radius: 14px;
  background: var(--papel); text-align: left; width: 100%;
}
.descarga span { flex-grow: 1; min-width: 0; display: flex; flex-direction: column; }
.descarga b { font-size: 15px; }
.descarga small { font-size: 12px; color: var(--gris); line-height: 1.35; }
.descarga b { display: flex; align-items: center; gap: 8px; }
.formato {
  flex-shrink: 0; padding: 1px 7px; border-radius: 999px;
  background: var(--lima-suave); color: #3B4A00;
  font-family: 'Atkinson Hyperlegible Mono', ui-monospace, monospace;
  font-size: 11px; font-style: normal; font-weight: 700; letter-spacing: .02em;
}
.lista-pendientes { display: flex; flex-direction: column; gap: 6px; }
.lista-pendientes .pendiente {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 12px; border: 1px dashed var(--borde-fuerte); border-radius: 12px;
}
.lista-pendientes .pendiente span { flex-grow: 1; min-width: 0; display: flex; flex-direction: column; }
.lista-pendientes .pendiente b { font-size: 14px; }
.lista-pendientes .pendiente small { font-size: 12px; color: var(--gris); line-height: 1.35; }
.lista-pendientes .pendiente em {
  flex-shrink: 0; padding: 2px 9px; border-radius: 999px;
  background: var(--ambar-suave); color: var(--ambar);
  font-size: 12px; font-style: normal; font-weight: 700; white-space: nowrap;
}

.aviso {
  position: fixed; left: 50%; transform: translateX(-50%); z-index: 30;
  bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  width: max-content; max-width: min(92vw, 420px); margin: 0;
  padding: 12px 16px; border-radius: 14px;
  background: var(--grafito); color: var(--papel); font-size: 15px; line-height: 1.4;
  box-shadow: 0 8px 24px rgba(21, 23, 26, .3); pointer-events: none;
}
.aviso b { color: var(--lima); }

@media (min-width: 720px) {
  .cuerpo { padding-inline: 24px; }
  .herramientas { justify-content: center; }
}

/* ---------- mapa base del proveedor y capas ---------- */
.m-tesela { image-rendering: auto; }
.m-credito {
  font: 500 10px 'Atkinson Hyperlegible Next', system-ui, sans-serif; fill: #3F444B; text-anchor: end;
  paint-order: stroke; stroke: rgba(255, 255, 255, .85); stroke-width: 3px;
}
.bases { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.base-mapa {
  display: flex; flex-direction: column; gap: 4px; padding: 8px;
  border: 1px solid var(--borde); border-radius: 14px; background: var(--papel);
  font-size: 14px; font-weight: 700; text-align: left; line-height: 1.25;
}
.base-mapa svg { width: 100%; height: auto; border-radius: 9px; display: block; }
.base-mapa small { font-size: 12px; font-weight: 500; color: var(--gris); }
.base-mapa[aria-pressed="true"] { border: 2px solid var(--grafito); background: #F7FBE6; }
.fila-capa {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: 48px; padding: 4px 0; border-bottom: 1px solid #ECEDEA;
}
.fila-capa:last-of-type { border-bottom: 0; }
.fila-capa small { display: block; font-size: 13px; color: var(--gris); }
.interruptor { position: relative; width: 52px; height: 30px; flex-shrink: 0; }
.interruptor input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; margin: 0; }
.interruptor span { position: absolute; inset: 0; border-radius: 999px; background: var(--borde-fuerte); transition: background .15s; }
.interruptor span::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px;
  border-radius: 50%; background: var(--papel); box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .15s;
}
.interruptor input:checked + span { background: var(--grafito); }
.interruptor input:checked + span::after { transform: translateX(22px); background: var(--lima); }
.leyenda { display: grid; grid-template-columns: 44px minmax(0, 1fr); align-items: center; column-gap: 10px; row-gap: 8px; font-size: 14px; }
.sub-titulo { margin: 4px 0 0; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--gris); }
.m-trafo-e { fill: var(--papel); stroke: var(--grafito); stroke-width: 1.8; stroke-linejoin: round; }
.m-trafo-p { fill: var(--grafito); stroke: var(--grafito); stroke-width: 1.8; stroke-linejoin: round; }
.m-spt { fill: none; stroke: var(--grafito); stroke-width: 1.8; stroke-linecap: round; }
.m-registro { fill: #F4F5F2; stroke: var(--grafito); stroke-width: 1.8; }
.m-tablero { fill: var(--grafito); stroke: var(--papel); stroke-width: 2; }
.m-prot-e { stroke: var(--grafito); stroke-width: 2.4; stroke-linecap: round; fill: none; }
.m-prot-p { stroke: #1E9E57; stroke-width: 2.4; stroke-linecap: round; fill: none; }
.m-prot-b { fill: var(--papel); stroke: var(--grafito); stroke-width: 1.5; }
.m-medida { fill: var(--papel); stroke: var(--grafito); stroke-width: 1.8; }
.m-medida-c { fill: none; stroke: var(--grafito); stroke-width: 1.5; }
.m-retenida { stroke: var(--grafito); stroke-width: 1.6; }
.m-ancla { fill: var(--papel); stroke: var(--grafito); stroke-width: 1.6; }
.m-acom-a { stroke: #6B3FA0; stroke-width: 2; stroke-dasharray: 2 4; stroke-linecap: round; }
.m-acom-s { stroke: #6B3FA0; stroke-width: 2.2; stroke-dasharray: 10 4 2 4; }
.circuitos { display: flex; flex-direction: column; gap: 10px; }
.circuito { display: flex; flex-direction: column; gap: 6px; padding: 8px; border: 1px solid var(--borde); border-radius: 12px; }
.circuito input, .circuito select { min-height: 44px; padding: 8px 10px; border: 1px solid var(--borde-fuerte); border-radius: 10px; background: var(--papel); width: 100%; }
.circuito-linea { display: grid; grid-template-columns: 1fr 1fr 1fr 44px; gap: 6px; align-items: center; }
.circuito-linea .icono { width: 44px; height: 44px; box-shadow: none; }

.m-sombra { fill: var(--ambar-suave); stroke: var(--ambar); stroke-width: 1.8; }
.m-sombra-p { stroke: var(--ambar); stroke-width: 5; stroke-linecap: round; opacity: .4; }
.m-rec-dc { stroke: var(--mt); stroke-width: 2.4; stroke-dasharray: 7 5; }
.m-rec-ac { stroke: var(--bt); stroke-width: 2.4; }

/* El gráfico de consumo del cliente, mes a mes. */
.grafico { display: flex; align-items: flex-end; gap: 4px; height: 118px; margin-top: 10px; padding-top: 8px; border-bottom: 2px solid var(--grafito); }
.grafico .barra { flex: 1 1 0; border-radius: 3px 3px 0 0; min-height: 4px; }
.meses { display: flex; gap: 4px; margin-top: 4px; }
.meses span { flex: 1 1 0; text-align: center; font-size: 10px; color: var(--gris); }

.m-generacion { fill: var(--ambar-suave); stroke: var(--ambar); stroke-width: 1.6; }
.m-generacion-r { stroke: var(--ambar); stroke-width: 1.6; fill: none; stroke-linecap: round; }

.resta { margin: 8px 0 0; border: 1px solid var(--borde); border-radius: 12px; overflow: hidden; }
.resta div { display: flex; justify-content: space-between; gap: 10px; padding: 9px 12px; font-size: 13px; border-bottom: 1px solid var(--concreto); }
.resta div:last-child { border-bottom: 0; }
.resta span { color: var(--gris); }

/* Aviso dentro de una ficha: lo que hay que mirar antes de seguir. */
.aviso-ficha {
  margin: 8px 0 0;
  padding: 10px 12px;
  border-left: 3px solid var(--ambar);
  background: var(--ambar-suave);
  color: var(--ambar);
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.45;
}
