/* =====================================================================
   Vecino Centenario · Sistema visual base (compartido por sitio y panel)
   ---------------------------------------------------------------------
   Todos los colores salen de la línea gráfica oficial «Vecino
   Centenario · Historias que hacen Coyhaique» (docs/linea-grafica):
     Azul Centenario  #042A3D   logo, títulos, fondos oscuros, botones
     Crema            #EADCCA   fondo del logo, contorno "troquel"
     Pergamino        #F0DFCC   papel rasgado
     Terracota        #A14026   círculos de fecha/ubicación, acentos
     Azul acero       #5C8295   pincelada de los generadores de caracteres
   Los colores de estado (éxito, aviso, error) vienen del escudo municipal:
     verde #16924E · amarillo #FFCD01 · rojo #C8133A
   Tipografía: Poppins (la del logo) en títulos, botones y etiquetas;
   Public Sans en los textos largos, por legibilidad.
   ===================================================================== */

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

:root {
  /* ── 1. Línea gráfica oficial «Vecino Centenario» ───────────────── */
  --centenario: #042a3d;   /* Azul Centenario: logo, títulos, fondos oscuros */
  --crema:      #eadcca;   /* fondo del logo y contorno "troquel" */
  --pergamino:  #f0dfcc;   /* papel rasgado */
  --terracota:  #a14026;   /* círculos de fecha/ubicación, acentos */
  --acero:      #5c8295;   /* pincelada de los generadores de caracteres */

  /* ── 2. Escudo municipal (base de los colores de estado) ─────────── */
  --escudo-amarillo: #ffcd01;
  --escudo-verde:    #16924e;
  --escudo-rojo:     #c8133a;
  --escudo-azul:     #0971b7;

  /* ── 3. Escalas derivadas ──────────────────────────────────────── */
  /* Azul Centenario */
  --azul-950: #021c29;
  --azul-900: #042a3d;
  --azul-800: #0a3a53;
  --azul-700: #134a66;
  --azul-600: #2b6180;
  /* Azul acero */
  --acero-700: #3f6477;
  --acero-500: #5c8295;
  --acero-400: #8fa7b4;
  --acero-300: #a9bdc8;
  --acero-200: #c4d3dc;
  --acero-100: #e3ebef;
  --acero-50:  #f1f5f7;
  /* Terracota */
  --terra-700: #7c2f1a;
  --terra-600: #a14026;
  --terra-500: #b4553a;
  --terra-300: #d9a38c;
  --terra-100: #f6e5dc;
  /* Crema / pergamino (fondos y líneas) */
  --arena-50:  #faf6f0;
  --arena-100: #f3ebe0;
  --arena-200: #eadcca;
  --arena-300: #dccbb4;
  --arena-400: #cdb99c;
  --linea:     #e5dbcd;
  --borde-campo:       #9a8c78;  /* contraste 3:1 con blanco (campos visibles) */
  --borde-campo-hover: #76695a;
  /* Textos (grises con matiz del azul Centenario) */
  --tinta-900: #14222d;
  --tinta-700: #364450;
  --tinta-500: #5d6a76;
  --tinta-400: #7e8993;
  --blanco:    #ffffff;
  /* Textos sobre fondo azul */
  --sobre-azul:       #efe7dc;
  --sobre-azul-suave: #a9bdc8;

  /* ── 4. Estados (tonos del escudo municipal) ───────────────────── */
  --verde-800: #0b5c31;
  --verde-700: #0f7a40;
  --verde-600: #16924e;
  --verde-200: #b5dcc3;
  --verde-100: #e2f3e8;
  --amarillo-800: #5c4400;
  --amarillo-300: #f3d56b;
  --amarillo-100: #fff4cc;
  --rojo-800: #860c25;
  --rojo-700: #a8102f;
  --rojo-200: #f1b9c5;
  --rojo-100: #fbe6ea;
  --rojo-50:  #fff8f9;
  --neutro-700: #4a5561;
  --neutro-100: #ece6dd;

  --fuente: "Public Sans", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --fuente-titulo: "Poppins", var(--fuente);

  --radio-s: 6px;
  --radio: 10px;
  --radio-l: 16px;
  --sombra-s: 0 1px 2px rgba(4, 42, 61, .06), 0 1px 3px rgba(4, 42, 61, .08);
  --sombra:   0 2px 4px rgba(4, 42, 61, .05), 0 8px 24px rgba(4, 42, 61, .08);
  --sombra-l: 0 12px 40px rgba(4, 42, 61, .16);
  --foco: 0 0 0 3px var(--blanco), 0 0 0 5px var(--acero-500);
  --transicion: 160ms cubic-bezier(.2, .7, .3, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0s !important; transition-duration: 0s !important; }
}
body {
  margin: 0;
  font-family: var(--fuente);
  font-size: 1.0625rem;
  line-height: 1.6;
  color: var(--tinta-900);
  background: var(--arena-50);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, svg { display: block; max-width: 100%; }
img { height: auto; }
a { color: var(--azul-600); text-underline-offset: .18em; text-decoration-thickness: 1px; }
a:hover { color: var(--azul-800); }
:focus-visible { outline: none; box-shadow: var(--foco); border-radius: 4px; }
h1, h2, h3, h4 { margin: 0 0 .5em; line-height: 1.2; color: var(--azul-900); }
h1, h2 { font-family: var(--fuente-titulo); font-weight: 700; letter-spacing: -.015em; }
h2 { font-weight: 600; }
h3, h4 { font-weight: 700; }
p { margin: 0 0 1em; }
hr { border: 0; border-top: 1px solid var(--linea); margin: 1.5rem 0; }
.ico { width: 1.25em; height: 1.25em; flex: none; fill: none; stroke: currentColor; }
.ico-s { width: 1em; height: 1em; flex: none; fill: none; stroke: currentColor; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.muted { color: var(--tinta-500); }
.pequeno { font-size: .875rem; }
.num { font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
[hidden] { display: none !important; }

/* ---------- Botones ---------- */
.btn {
  --b-bg: var(--centenario); --b-fg: var(--blanco); --b-bd: var(--centenario);
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: 44px; padding: .6rem 1.15rem;
  font: 600 .975rem/1.2 var(--fuente-titulo); letter-spacing: .01em;
  color: var(--b-fg); background: var(--b-bg); border: 1.5px solid var(--b-bd);
  border-radius: var(--radio-s); cursor: pointer; text-decoration: none;
  transition: background var(--transicion), border-color var(--transicion), transform var(--transicion), box-shadow var(--transicion);
}
.btn:hover { --b-bg: var(--azul-700); --b-bd: var(--azul-700); color: var(--b-fg); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn-terra { --b-bg: var(--terra-600); --b-fg: var(--blanco); --b-bd: var(--terra-600); }
.btn-terra:hover { --b-bg: var(--terra-700); --b-bd: var(--terra-700); --b-fg: var(--blanco); }
.btn-borde { --b-bg: transparent; --b-fg: var(--azul-700); --b-bd: var(--acero-200); }
.btn-borde:hover { --b-bg: var(--acero-50); --b-fg: var(--azul-800); --b-bd: var(--acero-500); }
.btn-claro { --b-bg: rgba(255,255,255,.08); --b-fg: var(--blanco); --b-bd: rgba(255,255,255,.35); }
.btn-claro:hover { --b-bg: rgba(255,255,255,.16); --b-bd: rgba(255,255,255,.6); --b-fg: var(--blanco); }
.btn-texto { --b-bg: transparent; --b-bd: transparent; --b-fg: var(--azul-700); padding-inline: .5rem; }
.btn-texto:hover { --b-bg: var(--acero-50); --b-bd: transparent; --b-fg: var(--azul-800); }
.btn-peligro { --b-bg: var(--rojo-700); --b-bd: var(--rojo-700); }
.btn-peligro:hover { --b-bg: var(--rojo-800); --b-bd: var(--rojo-800); }
.btn-grande { min-height: 52px; padding: .8rem 1.5rem; font-size: 1.0625rem; }
.btn-s { min-height: 36px; padding: .35rem .8rem; font-size: .9rem; }

/* ---------- Formularios ---------- */
.campo { display: grid; gap: .35rem; margin-bottom: 1.1rem; align-content: start; }
.campo > label, .etiqueta { font-weight: 600; font-size: .95rem; color: var(--tinta-900); }
.opcional { font-weight: 400; color: var(--tinta-500); font-size: .85rem; margin-left: .25rem; }
.ayuda { font-size: .875rem; color: var(--tinta-500); margin: 0; }
.input, select.input, textarea.input {
  width: 100%; min-height: 46px; padding: .6rem .8rem;
  font: 400 1rem/1.4 var(--fuente); color: var(--tinta-900);
  background: var(--blanco); border: 1.5px solid var(--borde-campo); border-radius: var(--radio-s);
  transition: border-color var(--transicion), box-shadow var(--transicion);
  appearance: none;
}
select.input {
  padding-right: 2.4rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23364450' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right .7rem center; background-size: 1.1rem;
}
textarea.input { min-height: 140px; resize: vertical; line-height: 1.55; }
.input::placeholder { color: var(--tinta-400); }
.input:hover { border-color: var(--borde-campo-hover); }
.input:focus { outline: none; border-color: var(--acero-500); box-shadow: 0 0 0 3px rgba(92, 130, 149, .25); }
.campo.con-error .input, .input[aria-invalid="true"] { border-color: var(--rojo-700); background: var(--rojo-50); }
.error-campo { display: flex; gap: .35rem; align-items: flex-start; font-size: .875rem; font-weight: 500; color: var(--rojo-700); margin: 0; }
.error-campo .ico-s { margin-top: .2em; }
.fila { display: grid; gap: 0 1rem; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.fila-3 { display: grid; gap: .6rem; grid-template-columns: 1fr 1.6fr 1.2fr; }

.check { display: flex; gap: .7rem; align-items: flex-start; cursor: pointer; line-height: 1.45; }
.check input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.check .caja {
  flex: none; width: 22px; height: 22px; margin-top: 1px; display: grid; place-items: center;
  border: 1.5px solid var(--borde-campo); border-radius: 5px; background: var(--blanco); color: transparent;
  transition: all var(--transicion);
}
.check .caja svg { width: 15px; height: 15px; stroke-width: 3; }
.check input:checked + .caja { background: var(--centenario); border-color: var(--centenario); color: var(--blanco); }
.check input:focus-visible + .caja { box-shadow: var(--foco); }
.check.con-error .caja { border-color: var(--rojo-700); }
.interruptor { display: inline-flex; gap: .7rem; align-items: center; cursor: pointer; }
.interruptor input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.interruptor .riel { position: relative; width: 42px; height: 24px; border-radius: 99px; background: var(--arena-400); transition: background var(--transicion); flex: none; }
.interruptor .riel::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--blanco); box-shadow: var(--sombra-s); transition: transform var(--transicion); }
.interruptor input:checked + .riel { background: var(--verde-600); }
.interruptor input:checked + .riel::after { transform: translateX(18px); }
.interruptor input:focus-visible + .riel { box-shadow: var(--foco); }

/* ---------- Avisos ---------- */
.aviso {
  display: flex; gap: .75rem; align-items: flex-start;
  padding: .9rem 1rem; border-radius: var(--radio); border: 1px solid; font-size: .95rem; line-height: 1.5;
}
.aviso .ico { margin-top: .1em; }
.aviso p:last-child { margin-bottom: 0; }
.aviso-info { background: var(--acero-50); border-color: var(--acero-200); color: var(--azul-900); }
.aviso-exito { background: var(--verde-100); border-color: var(--verde-200); color: var(--verde-800); }
.aviso-error { background: var(--rojo-100); border-color: var(--rojo-200); color: var(--rojo-800); }
.aviso-aviso { background: var(--amarillo-100); border-color: var(--amarillo-300); color: var(--amarillo-800); }

/* ---------- Etiquetas de estado ---------- */
.estado {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .2rem .6rem .2rem .5rem; border-radius: 99px;
  font-family: var(--fuente-titulo); font-size: .78rem; font-weight: 600; line-height: 1.5; white-space: nowrap;
  background: var(--arena-100); color: var(--tinta-700);
}
.estado::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: .85; }
/* Recibida · En revisión · Requiere antecedentes · Admisible · No admisible · Finalista · Vecino/a Centenario */
.estado-info    { background: var(--acero-100);   color: var(--azul-800); }
.estado-aviso   { background: var(--amarillo-100); color: var(--amarillo-800); }
.estado-alerta  { background: var(--terra-100);   color: var(--terra-700); }
.estado-exito   { background: var(--verde-100);   color: var(--verde-800); }
.estado-neutro  { background: var(--neutro-100); color: var(--neutro-700); }
.estado-destaca { background: var(--acero-700);   color: var(--blanco); }
.estado-oro     { background: var(--centenario);  color: var(--crema); }
/* Punto de color por estado (listas y gráficos del panel) */
.punto-estado { flex: none; width: 9px; height: 9px; border-radius: 50%; background: var(--tinta-400); }
.punto-info    { background: var(--acero-500); }
.punto-aviso   { background: var(--escudo-amarillo); box-shadow: inset 0 0 0 1px rgba(92, 68, 0, .25); }
.punto-alerta  { background: var(--terracota); }
.punto-exito   { background: var(--escudo-verde); }
.punto-neutro  { background: var(--tinta-400); }
.punto-destaca { background: var(--acero-700); }
.punto-oro     { background: var(--centenario); }
.chip { display: inline-flex; align-items: center; gap: .3rem; padding: .15rem .55rem; border-radius: 99px; font-size: .8rem; font-weight: 500; background: var(--arena-100); color: var(--tinta-700); border: 1px solid var(--linea); }
.chip-demo { background: var(--amarillo-100); border-color: var(--amarillo-300); color: var(--amarillo-800); font-size: .7rem; padding: .05rem .45rem; vertical-align: middle; }

/* ---------- Tarjetas ---------- */
.tarjeta { background: var(--blanco); border: 1px solid var(--linea); border-radius: var(--radio-l); box-shadow: var(--sombra-s); }
.tarjeta-cuerpo { padding: clamp(1.1rem, 3vw, 1.75rem); }

/* ---------- Error / depuración ---------- */
.error-detalle { white-space: pre-wrap; font-size: .8rem; background: var(--azul-950); color: var(--sobre-azul); padding: 1rem; border-radius: var(--radio); overflow: auto; text-align: left; max-height: 50vh; }
