/* SIGE Agua · sistema visual
   Tinta (pizarra azulada) para estructura, mineral para acciones, bronce para lo que viene del medidor.
   Public Sans (tipografía cívica, alojada en el servidor) con cifras tabulares para importes y lecturas. */

@font-face { font-family: "Public Sans"; font-weight: 400; font-style: normal; font-display: swap; src: url("../fonts/public-sans-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Public Sans"; font-weight: 400; font-style: italic; font-display: swap; src: url("../fonts/public-sans-latin-400-italic.woff2") format("woff2"); }
@font-face { font-family: "Public Sans"; font-weight: 500; font-style: normal; font-display: swap; src: url("../fonts/public-sans-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Public Sans"; font-weight: 600; font-style: normal; font-display: swap; src: url("../fonts/public-sans-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Public Sans"; font-weight: 700; font-style: normal; font-display: swap; src: url("../fonts/public-sans-latin-700-normal.woff2") format("woff2"); }

:root {
  --tinta: #1b2a41;
  --tinta-2: #24364f;
  --tinta-3: #34496a;
  --papel: #f3f5f7;
  --superficie: #ffffff;
  --linea: #d9e0e7;
  --linea-suave: #e8edf2;
  --texto: #1b2a41;
  --texto-2: #55667a;
  --texto-3: #7d8b9b;
  --mineral: #1f5f8b;
  --mineral-osc: #174a6d;
  --mineral-claro: #e7eff6;
  --bronce: #b88a1b;
  --bronce-claro: #f6eed8;
  --exito: #2e7d4f;
  --exito-claro: #e5f2ea;
  --alerta: #b3261e;
  --alerta-claro: #fbe9e7;
  --aviso: #8a5a00;
  --aviso-claro: #fbf1dc;

  --r-1: 3px;
  --r-2: 6px;
  --sombra: 0 1px 2px rgba(27, 42, 65, .06), 0 4px 16px rgba(27, 42, 65, .06);
  --sombra-alta: 0 12px 40px rgba(27, 42, 65, .22);
  --fuente: "Public Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --t-1: 12px; --t-2: 13.5px; --t-3: 15px; --t-4: 18px; --t-5: 23px; --t-6: 30px;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--fuente); font-size: var(--t-2); line-height: 1.5; color: var(--texto); background: var(--papel); -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; font-weight: 600; letter-spacing: -0.01em; }
h1 { font-size: var(--t-5); }
h2 { font-size: var(--t-4); }
h3 { font-size: var(--t-3); }
p { margin: 0 0 .75em; }
a { color: var(--mineral); }
.num, td.num, .monto { font-variant-numeric: tabular-nums; }
.oculto { display: none !important; }
.texto-2 { color: var(--texto-2); }
.texto-3 { color: var(--texto-3); }
.chico { font-size: var(--t-1); }
.fuerte { font-weight: 600; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

:focus-visible { outline: 2px solid var(--mineral); outline-offset: 2px; }
::selection { background: var(--mineral-claro); }

/* ------------------------------------------------------------ iconos */
.ico { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; vertical-align: -4px; }
.ico.g { width: 22px; height: 22px; }

/* ------------------------------------------------------------ botones */
.btn { display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 14px; border: 1px solid var(--linea); border-radius: var(--r-2);
       background: var(--superficie); color: var(--texto); font: 500 var(--t-2)/1 var(--fuente); cursor: pointer; white-space: nowrap; text-decoration: none; }
.btn:hover { border-color: #b8c4d0; background: #fafbfc; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.prim { background: var(--mineral); border-color: var(--mineral); color: #fff; }
.btn.prim:hover { background: var(--mineral-osc); border-color: var(--mineral-osc); }
.btn.peligro { color: var(--alerta); }
.btn.peligro.lleno { background: var(--alerta); border-color: var(--alerta); color: #fff; }
.btn.plano { border-color: transparent; background: transparent; }
.btn.plano:hover { background: var(--mineral-claro); }
.btn.chico { height: 28px; padding: 0 10px; font-size: var(--t-1); }
.btn.solo { width: 34px; padding: 0; justify-content: center; }
.btn.chico.solo { width: 28px; }
.btn.wa { color: #136c3a; }
.grupo-btn { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* ------------------------------------------------------------ formularios */
.campo { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.campo > span { font-size: var(--t-1); font-weight: 500; color: var(--texto-2); }
.campo .ayuda { font-size: var(--t-1); color: var(--texto-3); }
.campo .error { font-size: var(--t-1); color: var(--alerta); }
input, select, textarea { font: inherit; color: inherit; }
.entrada, .campo input:not([type=checkbox]):not([type=radio]), .campo select, .campo textarea {
  height: 36px; padding: 0 10px; border: 1px solid var(--linea); border-radius: var(--r-2); background: var(--superficie); width: 100%; min-width: 0; }
.campo textarea { height: auto; min-height: 72px; padding: 8px 10px; resize: vertical; }
.campo input:focus, .campo select:focus, .campo textarea:focus, .entrada:focus { border-color: var(--mineral); outline: 2px solid var(--mineral-claro); outline-offset: 0; }
.campo.con-error input, .campo.con-error select, .campo.con-error textarea { border-color: var(--alerta); }
.casilla { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: var(--t-2); }
.casilla input { width: 16px; height: 16px; accent-color: var(--mineral); }
.rejilla { display: grid; gap: 14px 16px; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
.rejilla .ancho { grid-column: 1 / -1; }
.rejilla .doble { grid-column: span 2; }
@media (max-width: 560px) { .rejilla .doble { grid-column: 1 / -1; } }

/* ------------------------------------------------------------ superficies */
.panel { background: var(--superficie); border: 1px solid var(--linea); border-radius: var(--r-2); }
.pc { padding: 16px 18px; }
.panel-cab { display: flex; align-items: center; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--linea-suave); }
.panel-cab h2, .panel-cab h3 { flex: 1; }
.seccion-titulo { font-size: var(--t-1); font-weight: 600; color: var(--texto-2); margin: 18px 0 8px; }

/* ------------------------------------------------------------ tablas */
.tabla-env { overflow-x: auto; }
table.tabla { width: 100%; border-collapse: collapse; }
.tabla th { text-align: left; font-size: var(--t-1); font-weight: 600; color: var(--texto-2); padding: 9px 12px; border-bottom: 1px solid var(--linea); background: #fafbfc; white-space: nowrap; position: sticky; top: 0; z-index: 1; }
.tabla td { padding: 9px 12px; border-bottom: 1px solid var(--linea-suave); vertical-align: middle; }
.tabla tr.clic { cursor: pointer; }
.tabla tr.clic:hover td { background: #f7f9fb; }
.tabla td.num, .tabla th.num { text-align: right; white-space: nowrap; }
.tabla tfoot td { font-weight: 600; border-top: 1px solid var(--linea); border-bottom: 0; }
.tabla .tachado td { color: var(--texto-3); text-decoration: line-through; }
.vacio { padding: 36px 18px; text-align: center; color: var(--texto-2); }
.vacio h3 { color: var(--texto); margin-bottom: 4px; }

/* ------------------------------------------------------------ estados */
.etiqueta { display: inline-flex; align-items: center; gap: 5px; height: 21px; padding: 0 8px; border-radius: 11px; font-size: 11.5px; font-weight: 600; background: var(--linea-suave); color: var(--texto-2); white-space: nowrap; }
.etiqueta::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .85; }
.etiqueta.ok { background: var(--exito-claro); color: var(--exito); }
.etiqueta.mal { background: var(--alerta-claro); color: var(--alerta); }
.etiqueta.espera { background: var(--aviso-claro); color: var(--aviso); }
.etiqueta.info { background: var(--mineral-claro); color: var(--mineral); }
.aviso { display: flex; gap: 10px; padding: 10px 14px; border-radius: var(--r-2); background: var(--aviso-claro); color: #5c3d00; border: 1px solid #ecd9ae; }
.aviso.mal { background: var(--alerta-claro); color: #7e1a14; border-color: #f2c9c4; }
.aviso.info { background: var(--mineral-claro); color: var(--mineral-osc); border-color: #c8dbea; }
.aviso.ok { background: var(--exito-claro); color: #1d5636; border-color: #c4e1cf; }

/* ------------------------------------------------------------ odómetro: lo que se lee del medidor */
.odometro { display: inline-flex; gap: 2px; padding: 3px; background: var(--tinta); border-radius: 4px; font-variant-numeric: tabular-nums; vertical-align: middle; }
.odometro span { display: inline-flex; align-items: center; justify-content: center; width: 17px; height: 24px; background: #0f1a2b; color: #f1f4f8;
                 font: 600 15px/1 var(--fuente); border-radius: 2px; box-shadow: inset 0 -6px 8px rgba(0,0,0,.35), inset 0 6px 8px rgba(0,0,0,.35); }
.odometro span.dec { background: var(--bronce); color: #241a00; }
.odometro.g span { width: 26px; height: 36px; font-size: 22px; }
.odometro.vacio span { color: #3c4c63; }

/* ------------------------------------------------------------ modal y avisos flotantes */
.velo { position: fixed; inset: 0; background: rgba(15, 26, 43, .42); display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px 16px; z-index: 900; overflow-y: auto; }
.modal { background: var(--superficie); border-radius: 8px; box-shadow: var(--sombra-alta); width: min(640px, 100%); max-height: none; display: flex; flex-direction: column; }
.modal.ancho { width: min(980px, 100%); }
.modal.angosto { width: min(440px, 100%); }
.modal-cab { display: flex; align-items: center; gap: 10px; padding: 16px 20px 12px; }
.modal-cab h2 { flex: 1; }
.modal-cuerpo { padding: 4px 20px 18px; }
.modal-pie { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px; border-top: 1px solid var(--linea-suave); background: #fafbfc; border-radius: 0 0 8px 8px; }
.notas { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 1000; max-width: min(420px, calc(100vw - 32px)); }
.nota { padding: 11px 14px; border-radius: var(--r-2); background: var(--tinta); color: #fff; box-shadow: var(--sombra-alta); font-size: var(--t-2); }
.nota.mal { background: var(--alerta); }
.nota.ok { background: var(--exito); }
@media (prefers-reduced-motion: no-preference) {
  .velo { animation: aparece .14s ease-out; }
  .modal { animation: sube .16s ease-out; }
  .nota { animation: sube .18s ease-out; }
}
@keyframes aparece { from { opacity: 0; } }
@keyframes sube { from { transform: translateY(8px); opacity: 0; } }

.cargando { display: flex; align-items: center; gap: 10px; padding: 28px; color: var(--texto-2); justify-content: center; }
.cargando::before { content: ""; width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--linea); border-top-color: var(--mineral); animation: gira .8s linear infinite; }
@keyframes gira { to { transform: rotate(360deg); } }

/* mapa */
.mapa { height: 420px; border-radius: var(--r-2); border: 1px solid var(--linea); background: #e9eef2; }
.mapa.alto { height: calc(100vh - 210px); min-height: 420px; }
.leaflet-container { font-family: var(--fuente); }
.pin { width: 14px; height: 14px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.4); background: var(--mineral); }
.pin.mora { background: var(--alerta); }
.pin.cortado { background: #6b7685; }
.pin.propuesta { background: var(--bronce); }
