/* Aquí Falta — estilos
   Sistema de Pupitre Academia: menú lateral claro + barra superior; contenido en tarjetas blancas
   con bordes finos; Bricolage Grotesque para títulos y cifras, DM Sans para el texto.
   Acento naranja. Rojo, dorado y verde solo dicen cuánto lleva esperando cada reporte. */

:root {
  --bg: #FFFFFF;
  --soft: #F6F5F3;
  --card: #FFFFFF;
  --ink: #1A1613;
  --ink-2: #3A332E;
  --muted: #857B74;
  --line: #ECE7E2;
  --bar: #E8E2DC;

  --accent: #C8490C;
  --accent-2: #A93D09;
  --accent-soft: #FDEEE5;
  --accent-vivo: #EA580C;
  --on-accent: #FFFFFF;

  --pos: #14804A;
  --pos-soft: #E5F4EB;
  --neg: #C9372C;
  --neg-soft: #FCEAE8;
  --gold: #A86F00;
  --gold-pin: #D99A0B;
  --gold-soft: #FFF5D9;
  --info: #2A63D6;
  --info-soft: #EAF0FD;

  --scrim: rgba(26, 22, 19, .3);
  --shadow: 0 18px 50px rgba(26, 22, 19, .16);
  --filtro-mapa: saturate(.85) brightness(1.02); /* colores de OpenStreetMap, un poco suaves para que resalten los puntos */

  --f-head: "Bricolage Grotesque", "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-body: "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --r-lg: 20px; --r: 14px; --r-sm: 10px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #12100E; --soft: #1A1715; --card: #161311; --ink: #F0EBE7; --ink-2: #D2C9C2; --muted: #9A8F87; --line: #2B2522; --bar: #342D29;
    --accent: #FF8A4C; --accent-2: #FFA06B; --accent-soft: #2E1C12; --accent-vivo: #FF8A4C; --on-accent: #1C0C05;
    --pos: #3CCB7F; --pos-soft: #11291C; --neg: #FF6B5E; --neg-soft: #2E1513; --gold: #F0BE45; --gold-pin: #F0BE45; --gold-soft: #2A2210; --info: #6E9BFF; --info-soft: #141F36;
    --scrim: rgba(0, 0, 0, .55); --shadow: 0 18px 50px rgba(0, 0, 0, .5);
    --filtro-mapa: invert(1) hue-rotate(180deg) brightness(.85) contrast(.9) saturate(.7);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #12100E; --soft: #1A1715; --card: #161311; --ink: #F0EBE7; --ink-2: #D2C9C2; --muted: #9A8F87; --line: #2B2522; --bar: #342D29;
  --accent: #FF8A4C; --accent-2: #FFA06B; --accent-soft: #2E1C12; --accent-vivo: #FF8A4C; --on-accent: #1C0C05;
  --pos: #3CCB7F; --pos-soft: #11291C; --neg: #FF6B5E; --neg-soft: #2E1513; --gold: #F0BE45; --gold-pin: #F0BE45; --gold-soft: #2A2210; --info: #6E9BFF; --info-soft: #141F36;
  --scrim: rgba(0, 0, 0, .55); --shadow: 0 18px 50px rgba(0, 0, 0, .5);
  --filtro-mapa: invert(1) hue-rotate(180deg) brightness(.85) contrast(.9) saturate(.7);
  color-scheme: dark;
}

/* ---------- base */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { min-height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--f-body); font-size: 14.5px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  padding-top: env(safe-area-inset-top, 0px);
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); }
img { max-width: 100%; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.sp { flex: 1; }
.ico { width: 18px; height: 18px; flex: none; }
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.saltar { position: absolute; left: 12px; top: -60px; z-index: 100; background: var(--ink); color: var(--card); padding: 10px 14px; border-radius: 12px; font-weight: 700; }
.saltar:focus { top: 12px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.grid { display: grid; gap: 12px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

/* ---------- armazón: menú lateral + barra superior */
.app { display: grid; grid-template-columns: 252px minmax(0, 1fr); min-height: 100dvh; }
.side {
  display: flex; flex-direction: column; gap: 2px;
  padding: 20px 16px; position: sticky; top: 0; height: 100dvh; overflow-y: auto;
  border-right: 1px solid var(--line); background: var(--card);
}
.logo { display: flex; align-items: center; gap: 10px; padding: 2px 8px 16px; color: var(--ink); text-decoration: none; }
.logo .mark { width: 40px; height: 40px; border-radius: 12px; background: var(--accent-vivo); display: grid; place-items: center; color: #fff; flex: none; }
.logo .mark .ico { width: 22px; height: 22px; }
.logo b { font-family: var(--f-head); font-size: 18px; line-height: 1; letter-spacing: -.01em; display: block; }
.logo small { display: block; color: var(--muted); font-size: 12px; font-weight: 500; margin-top: 3px; }
.side > .btn { margin: 4px 0 10px; }
.side .lbl { font-size: 11.5px; color: var(--muted); padding: 12px 12px 6px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
.side-nav { display: grid; gap: 2px; }
.nav-i { display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 12px; font-weight: 600; font-size: 14px; color: var(--ink); opacity: .8; text-decoration: none; }
.nav-i:hover { opacity: 1; background: var(--soft); }
.nav-i[aria-current="page"] { background: var(--accent-soft); opacity: 1; color: var(--accent); }
.nav-i .badge { margin-left: auto; min-width: 22px; height: 20px; padding: 0 7px; border-radius: 999px; background: var(--soft); color: var(--ink-2); font-size: 11.5px; font-weight: 700; display: grid; place-items: center; }
.nav-i[aria-current="page"] .badge { background: var(--accent); color: var(--on-accent); }
.nav-i .badge:empty { display: none; }
.side-nota { margin: 14px 4px 0; }
.side-nota .banner { font-size: 13px; }
.me { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 14px; border: 1px solid var(--line); background: var(--card); text-align: left; width: 100%; }
.me:hover { background: var(--soft); }
.me > div { min-width: 0; flex: 1; }
.me b { font-size: 13.5px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me small { color: var(--muted); font-size: 12px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.av { width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; flex: none; background: var(--soft); color: var(--ink-2); }
.me.is-equipo .av { background: var(--accent); color: var(--on-accent); }

.main { background: var(--bg); min-width: 0; display: flex; flex-direction: column; }
.top {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 24px; background: var(--card); border-bottom: 1px solid var(--line);
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 600;
}
.logo-m { display: none; padding: 0; }
.solo-m { display: none; }
.crumbs { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13.5px; min-width: 0; flex: 1; overflow: hidden; white-space: nowrap; }
.crumbs a { color: var(--muted); text-decoration: none; padding: 2px 4px; border-radius: 6px; font-weight: 500; }
.crumbs a:hover { color: var(--ink); background: var(--soft); }
.crumbs b { color: var(--ink); font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.crumbs .sep { opacity: .5; }
.pill { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); font-weight: 700; font-size: 13.5px; white-space: nowrap; }
.pill.bad { color: var(--neg); }
button.pill:hover { background: var(--soft); }
.icon-btn { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line); background: var(--card); display: grid; place-items: center; color: var(--ink); flex: none; }
.icon-btn:hover { background: var(--soft); }
.icon-btn.is-equipo { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }

.content { padding: 24px 24px 48px; display: flex; flex-direction: column; gap: 20px; max-width: 1320px; width: 100%; margin: 0 auto; }
.vista { display: flex; flex-direction: column; gap: 18px; min-width: 0; }

/* ---------- tipografía de página */
.title { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.title h1 { font-family: var(--f-head); font-weight: 700; font-size: 28px; line-height: 1.1; margin: 0; letter-spacing: -.02em; text-wrap: balance; }
.title p { margin: 6px 0 0; color: var(--muted); max-width: 68ch; }
.eyebrow { margin: 0; font-size: 11.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.sec-h { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.sec-h h2 { font-family: var(--f-head); font-size: 17px; font-weight: 600; margin: 0; letter-spacing: -.01em; }
.sec-h p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.orden .input { min-height: 40px; padding: 6px 12px; font-weight: 600; font-size: 13.5px; width: auto; }

/* ---------- botones */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 12px; padding: 10px 16px; font-weight: 700; font-size: 14px; min-height: 42px; background: var(--accent); color: var(--on-accent); white-space: nowrap; text-decoration: none; }
.btn:hover { background: var(--accent-2); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.ghost { background: var(--card); color: var(--ink); border: 1px solid var(--line); }
.btn.ghost:hover { background: var(--soft); }
.btn.soft { background: var(--accent-soft); color: var(--accent); }
.btn.soft:hover { filter: brightness(.97); }
.btn.ok { background: var(--pos-soft); color: var(--pos); }
.btn.sm { min-height: 34px; padding: 6px 12px; font-size: 13px; border-radius: 10px; }
.btn.lg { min-height: 50px; padding: 12px 22px; font-size: 15.5px; border-radius: 14px; }
.btn.block { width: 100%; }
.link { border: 0; background: none; font-weight: 700; font-size: 13px; color: var(--accent); padding: 4px 0; white-space: nowrap; }
.link:hover { text-decoration: underline; }

/* ---------- tarjetas y piezas */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); }
.pad { padding: 18px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.stat { border-radius: 16px; border: 1px solid var(--line); background: var(--card); padding: 14px 16px; display: flex; align-items: center; gap: 14px; min-width: 0; }
.stat .ic { width: 42px; height: 42px; border-radius: 50%; background: var(--soft); display: grid; place-items: center; flex: none; color: var(--accent); }
.stat .ic.bad { background: var(--neg-soft); color: var(--neg); }
.stat .ic.ok { background: var(--pos-soft); color: var(--pos); }
.stat .ic.acc { background: var(--accent-soft); color: var(--accent); }
.stat .v { font-family: var(--f-head); font-weight: 700; font-size: 22px; line-height: 1.15; letter-spacing: -.01em; }
.stat .v small { font-family: var(--f-body); font-size: 13px; font-weight: 600; color: var(--muted); margin-left: 4px; letter-spacing: 0; }
.stat .l { font-size: 12.5px; color: var(--muted); }
.stat > div { min-width: 0; }
.tag { font-size: 11.5px; font-weight: 700; padding: 3px 9px; border-radius: 999px; white-space: nowrap; display: inline-flex; align-items: center; gap: 5px; background: var(--soft); color: var(--muted); }
.tag.acc { background: var(--accent-soft); color: var(--accent); }
.tag.ok { background: var(--pos-soft); color: var(--pos); }
.tag.bad { background: var(--neg-soft); color: var(--neg); }
.tag.gold { background: var(--gold-soft); color: var(--gold); }
.tag.info { background: var(--info-soft); color: var(--info); }
.tag .ico { width: 13px; height: 13px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 6px 14px 6px 10px; font-weight: 600; font-size: 13px; min-height: 36px; display: inline-flex; align-items: center; gap: 6px; color: var(--ink); }
.chip .ico { width: 16px; height: 16px; color: var(--muted); }
.chip small { color: var(--muted); font-weight: 600; font-variant-numeric: tabular-nums; }
.chip:hover { background: var(--soft); }
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.chip[aria-pressed="true"] .ico, .chip[aria-pressed="true"] small { color: inherit; }
.ic-tile { width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center; flex: none; background: var(--soft); color: var(--accent); }
.ic-tile .ico { width: 22px; height: 22px; }
.banner { padding: 11px 14px; border-radius: 12px; background: var(--accent-soft); color: var(--ink); font-size: 13.5px; display: flex; gap: 10px; align-items: center; }
.banner > .ico { color: var(--accent); }
.banner[data-kind="warn"] { background: var(--gold-soft); }
.banner[data-kind="warn"] > .ico { color: var(--gold); }
.banner[data-kind="bad"] { background: var(--neg-soft); }
.banner[data-kind="bad"] > .ico { color: var(--neg); }
.banner[data-kind="soft"] { background: var(--soft); }
.empty { padding: 28px 18px; text-align: center; color: var(--muted); }
.empty b { display: block; color: var(--ink); margin-bottom: 4px; font-weight: 600; font-family: var(--f-head); font-size: 16px; }
.prog { height: 6px; border-radius: 999px; background: var(--soft); overflow: hidden; border: 1px solid var(--line); min-width: 60px; }
.prog i { display: block; height: 100%; border-radius: inherit; background: var(--accent); }
.prog i.bad { background: var(--neg); }

/* Urgencia: cuánto lleva esperando */
[data-nivel="reciente"] { --niv: var(--ink-2); --niv-soft: var(--soft); }
[data-nivel="viejo"] { --niv: var(--gold); --niv-soft: var(--gold-soft); }
[data-nivel="critico"] { --niv: var(--neg); --niv-soft: var(--neg-soft); }
[data-nivel="resuelto"] { --niv: var(--pos); --niv-soft: var(--pos-soft); }

/* ---------- filtros */
.filtros { display: grid; gap: 12px; }
.filtros-panel { display: grid; gap: 12px; }
.filtros-abrir { display: none; }
.f-cuenta:not(:empty) { margin-left: 2px; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--accent); color: var(--on-accent); font-size: 11.5px; display: inline-grid; place-items: center; }
.zonas-rapidas { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.zonas-rapidas::-webkit-scrollbar { display: none; }
.zonas-rapidas .chip { flex: none; }
.buscar { flex: 1 1 280px; min-width: 0; display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 12px; background: var(--card); color: var(--muted); border: 1px solid var(--line); border-radius: 12px; }
.buscar:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.buscar input[type="search"] { flex: 1; min-width: 0; height: 42px; border: 0; outline: 0; background: transparent; color: var(--ink); padding: 0; }
.seg { display: inline-grid; grid-auto-flow: column; gap: 4px; background: var(--soft); border: 1px solid var(--line); border-radius: 12px; padding: 4px; max-width: 100%; overflow-x: auto; }
.seg button { border: 0; background: none; border-radius: 9px; padding: 7px 12px; font-weight: 600; font-size: 13.5px; color: var(--muted); white-space: nowrap; }
.seg button:hover { color: var(--ink); }
.seg button[aria-pressed="true"] { background: var(--card); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .08); }

/* ---------- vista mapa */
.mapa-card { display: grid; grid-template-columns: 360px minmax(0, 1fr); height: clamp(480px, calc(100dvh - 230px), 820px); overflow: hidden; }
.lateral { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--line); }
.lateral-cab { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); font-size: 13px; }
.lateral-cab b { font-family: var(--f-head); font-weight: 600; font-size: 15px; }
.lateral-lista { flex: 1; overflow-y: auto; min-height: 0; }
.lateral-lista > * + * { border-top: 1px solid var(--line); }
.mapa-wrap { position: relative; min-height: 0; min-width: 0; }
#mapa { position: absolute; inset: 0; background: var(--soft); }
.leyenda {
  position: absolute; left: 12px; bottom: 12px; z-index: 500; max-width: calc(100% - 24px);
  display: flex; flex-wrap: wrap; gap: 6px 14px; padding: 8px 12px; border-radius: 12px;
  background: var(--card); border: 1px solid var(--line); color: var(--ink-2);
  font-size: 12px; font-weight: 600; box-shadow: 0 6px 18px rgba(0, 0, 0, .08);
}
.leyenda span { display: inline-flex; align-items: center; gap: 6px; }
.pt { width: 10px; height: 10px; border-radius: 50%; display: inline-block; border: 2.5px solid; }
.pt--reciente { border-color: var(--ink-2); }
.pt--viejo { border-color: var(--gold-pin); }
.pt--critico { border-color: var(--neg); }
.pt--resuelto { border-color: var(--pos); }
.pt--zona { border-radius: 3px; border: 1.5px dashed var(--accent); background: var(--accent-soft); }

/* Zonas con reportes de otros vecinos: cuadro aproximado y cuántos hay, sin puntos exactos */
.zona-celda { stroke: var(--accent); stroke-width: 1.5; stroke-dasharray: 5 4; fill: var(--accent); fill-opacity: .1; }
.zona-cuenta {
  width: 34px; height: 34px; border-radius: 10px;
  display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent); border: 1.5px solid var(--accent);
  font-family: var(--f-head); font-weight: 700; font-size: 14px; font-variant-numeric: tabular-nums;
  box-shadow: 0 3px 10px rgba(0, 0, 0, .12);
}

/* pines: círculo blanco con aro e ícono del color de la urgencia */
.pin {
  width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--card); color: var(--niv); border: 2.5px solid var(--niv);
  box-shadow: 0 4px 12px rgba(0, 0, 0, .22);
  transition: transform .15s ease;
}
.pin[data-nivel="viejo"] { --niv: var(--gold-pin); }
.pin .ico { width: 17px; height: 17px; stroke-width: 2.2; }
.pin:hover { transform: scale(1.12); }
.pin.is-activo { background: var(--accent-vivo); border-color: var(--accent-vivo); color: #fff; transform: scale(1.2); }
.grupo {
  width: 42px; height: 42px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--card); color: var(--ink); border: 3px solid var(--ink-2);
  box-shadow: 0 4px 12px rgba(0, 0, 0, .22);
  font-family: var(--f-head); font-weight: 700; font-size: 15px; font-variant-numeric: tabular-nums;
}
.grupo--critico { border-color: var(--neg); color: var(--neg); }
.leaflet-container { font-family: var(--f-body); background: var(--soft); }
.capa-calles { filter: var(--filtro-mapa); }
.leaflet-control-attribution { background: color-mix(in srgb, var(--card) 85%, transparent) !important; color: var(--muted) !important; font-size: 10.5px; }
.leaflet-control-attribution a { color: var(--ink-2) !important; }
.leaflet-bar { border: 1px solid var(--line) !important; border-radius: 12px !important; overflow: hidden; box-shadow: 0 6px 18px rgba(0, 0, 0, .08) !important; }
.leaflet-bar a { background: var(--card) !important; color: var(--ink) !important; border-color: var(--line) !important; width: 36px !important; height: 36px !important; line-height: 36px !important; }
.leaflet-tooltip.punta { background: var(--ink); color: var(--card); border: 0; border-radius: 10px; font-weight: 600; font-size: 13px; padding: 6px 10px; box-shadow: var(--shadow); }
.leaflet-tooltip.punta::before { border-top-color: var(--ink); }
.mapa-capas { display: inline-grid; grid-auto-flow: column; gap: 4px; padding: 4px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 6px 18px rgba(0, 0, 0, .12); }
.mapa-capas button { border: 0; background: none; border-radius: 9px; padding: 7px 12px; min-height: 34px; font-weight: 600; font-size: 13px; color: var(--ink-2); white-space: nowrap; }
.mapa-capas button:hover { background: var(--soft); color: var(--ink); }
.mapa-capas button[aria-pressed="true"] { background: var(--ink); color: var(--card); }

/* ---------- filas de lista */
.li { display: flex; align-items: center; gap: 12px; padding: 12px 14px; width: 100%; border: 0; background: none; text-align: left; min-width: 0; color: inherit; }
button.li:hover { background: var(--soft); }
.li.is-activo { background: var(--accent-soft); }
.li .ic { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--niv-soft, var(--soft)); color: var(--niv, var(--accent)); }
.li .ic .ico { width: 19px; height: 19px; }
.li .tx { min-width: 0; flex: 1; display: grid; gap: 2px; }
.li .tx b { font-weight: 600; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.li .tx small { color: var(--muted); font-size: 12.5px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.li .tags { margin-top: 4px; }
.li .end { flex: none; text-align: right; color: var(--muted); }
.dias b { display: block; font-family: var(--f-head); font-weight: 700; font-size: 20px; line-height: 1; color: var(--niv, var(--ink)); font-variant-numeric: tabular-nums; }
.dias small { display: block; margin-top: 3px; font-size: 11.5px; color: var(--muted); }
.dias[data-nivel="reciente"] b { color: var(--ink); }
.list { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.list > * + * { border-top: 1px solid var(--line); }

/* ---------- vista lista: tarjetas */
.tarjetas { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 14px; }
.tarjeta { display: flex; flex-direction: column; text-align: left; padding: 0; overflow: hidden; color: inherit; }
.tarjeta:hover { border-color: var(--bar); box-shadow: 0 8px 24px rgba(0, 0, 0, .06); }
.tarjeta-foto { position: relative; aspect-ratio: 16 / 9; max-width: 100%; overflow: hidden; background: var(--soft); border-bottom: 1px solid var(--line); }
.tarjeta-foto img { width: 100%; height: 100%; object-fit: cover; display: block; }
.foto-ph { width: 100%; height: 100%; display: grid; place-items: center; align-content: center; gap: 6px; color: var(--muted); }
.foto-ph .ico { width: 36px; height: 36px; stroke-width: 1.5; opacity: .7; }
.foto-ph small { font-size: 12px; font-weight: 500; }
.tarjeta-cuerpo { display: grid; gap: 6px; padding: 14px 16px 16px; }
.tarjeta-tit { display: flex; align-items: center; gap: 12px; }
.tarjeta-tit .t { flex: 1; min-width: 0; }
.tarjeta-tit .ic-tile { width: 40px; height: 40px; border-radius: 12px; background: var(--niv-soft); color: var(--niv); }
.tarjeta-tit .t { font-family: var(--f-head); font-weight: 600; font-size: 16.5px; letter-spacing: -.01em; }
.tarjeta-tit .dias { text-align: right; }
.tarjeta .lugar { display: block; font-size: 13px; color: var(--ink-2); }
.tarjeta .desc { margin: 0; font-size: 13.5px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tarjeta .pie { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 4px; font-size: 12.5px; color: var(--muted); }
.herramientas-equipo { flex-wrap: wrap; }

/* ---------- formularios */
.form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field label { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.input { width: 100%; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; min-height: 44px; color: var(--ink); }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea.input { resize: vertical; min-height: 90px; line-height: 1.5; }
.check { display: flex; align-items: center; gap: 10px; font-weight: 500; font-size: 14px; color: var(--ink); cursor: pointer; }
.check input { width: 19px; height: 19px; accent-color: var(--accent); flex: none; margin: 0; }
.opc { font-weight: 400; color: var(--muted); }
.ayuda { margin: 0; font-size: 13px; color: var(--muted); }
.msg { margin: 0; font-size: 13px; color: var(--neg); font-weight: 600; }
.msg:empty { display: none; }
.contador { align-self: flex-end; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* ---------- hoja de detalle (entra por la derecha; en celular sube desde abajo) */
.scrim { position: fixed; inset: 0; background: var(--scrim); z-index: 1250; }
.sheet {
  position: fixed; z-index: 1300; top: 14px; right: 14px; bottom: 14px;
  width: min(540px, calc(100% - 28px));
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg);
  display: flex; flex-direction: column; box-shadow: var(--shadow); outline: 0;
  animation: hojaIn .22s ease-out;
}
@keyframes hojaIn { from { opacity: 0; transform: translateX(30px); } to { opacity: 1; transform: none; } }
.sheet-h { padding: 16px 16px 10px 18px; display: flex; align-items: center; gap: 12px; flex: none; }
.sheet-h h2 { font-family: var(--f-head); font-weight: 600; font-size: 19px; margin: 0; flex: 1; min-width: 0; line-height: 1.2; }
.sheet-h h2 small { display: block; font-family: var(--f-body); font-size: 12.5px; font-weight: 500; color: var(--muted); margin-top: 2px; }
.sheet-b { padding: 6px 18px 22px; overflow-y: auto; flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 16px; overscroll-behavior: contain; }

.d-fotos { display: grid; gap: 8px; }
.d-fotos.is-doble { grid-template-columns: 1fr 1fr; }
.d-foto { position: relative; margin: 0; aspect-ratio: 4 / 3; max-width: 100%; overflow: hidden; border-radius: var(--r); border: 1px solid var(--line); background: var(--soft); }
.d-foto.is-vacia { aspect-ratio: 16 / 6; }
.d-foto img { width: 100%; height: 100%; object-fit: cover; display: block; }
.d-foto figcaption { position: absolute; left: 8px; bottom: 8px; }
.d-hero { display: flex; align-items: center; gap: 16px; padding: 16px 18px; border-radius: 18px; border: 1px solid var(--line); background: var(--niv-soft, var(--soft)); }
.d-hero .big { font-family: var(--f-head); font-weight: 700; font-size: 50px; line-height: 1; letter-spacing: -.03em; color: var(--niv, var(--ink)); font-variant-numeric: tabular-nums; }
.d-hero[data-nivel="reciente"] .big { color: var(--ink); }
.d-hero .k { display: grid; gap: 6px; min-width: 0; }
.d-hero .k b { font-weight: 600; font-size: 15px; }
.d-desc { margin: 0; font-size: 15px; line-height: 1.65; color: var(--ink-2); }
.datos { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 0; }
.datos > div { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; min-width: 0; }
.datos dt { font-size: 12px; font-weight: 600; color: var(--muted); }
.datos dd { margin: 2px 0 0; font-weight: 600; font-size: 14px; overflow-wrap: anywhere; }
.apoyo { display: grid; gap: 12px; }
.apoyo-n { display: flex; align-items: center; gap: 12px; }
.apoyo-n .v { font-family: var(--f-head); font-weight: 700; font-size: 26px; line-height: 1; }
.apoyo-n .l { color: var(--muted); font-size: 13px; }
.apoyo-pie { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 6px 12px; font-size: 12.5px; color: var(--muted); }
.acciones-d { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.acciones-d .btn { padding: 10px 8px; }

/* seguimiento */
.seguimiento { list-style: none; margin: 0; padding: 0; display: grid; }
.paso { position: relative; display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 12px; padding-bottom: 16px; }
.paso:last-child { padding-bottom: 0; }
.paso::before { content: ""; position: absolute; left: 13px; top: 26px; bottom: 0; width: 2px; background: var(--line); }
.paso:last-child::before { display: none; }
.paso.is-hecho::before { background: var(--accent); }
.paso.is-actual::before { background: var(--line); }
.paso-punto { width: 28px; height: 28px; border-radius: 9px; border: 1px solid var(--line); background: var(--soft); display: grid; place-items: center; color: var(--muted); position: relative; z-index: 1; font-weight: 700; font-size: 12.5px; }
.paso-punto .ico { width: 15px; height: 15px; stroke-width: 2.8; }
.paso.is-hecho .paso-punto { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.paso.is-actual .paso-punto { box-shadow: 0 0 0 4px var(--accent-soft); }
.paso.is-vencido .paso-punto { background: var(--neg); border-color: var(--neg); color: #fff; box-shadow: 0 0 0 4px var(--neg-soft); }
.paso-tit { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; font-weight: 600; padding-top: 3px; }
.paso-tit time { font-weight: 500; font-size: 12.5px; color: var(--muted); }
.paso p { margin: 2px 0 0; font-size: 13.5px; color: var(--ink-2); }
.paso:not(.is-hecho) .paso-tit { color: var(--muted); }
.paso .banner { margin-top: 8px; }
.paso .nota { font-style: italic; }

.admin { display: grid; gap: 12px; padding: 16px; border: 1px dashed var(--bar); border-radius: var(--r); background: var(--soft); }
.admin .sec-h h2 { display: flex; align-items: center; gap: 8px; }
.admin .input { background: var(--card); }
.admin-eliminar { display: grid; gap: 8px; margin-top: 4px; padding-top: 14px; border-top: 1px dashed var(--bar); }
.admin-eliminar p { margin: 0; font-size: 13px; color: var(--muted); }
.btn.peligro { color: var(--neg); border-color: color-mix(in srgb, var(--neg) 35%, var(--line)); white-space: normal; }
.btn.peligro:hover { background: var(--neg-soft); }
.btn.peligro[data-confirmar] { background: var(--neg); color: #fff; border-color: var(--neg); }

/* ---------- diálogos (como la hoja centrada de Pupitre) */
.dlg {
  width: min(680px, calc(100% - 28px)); max-height: calc(100dvh - 40px);
  padding: 0; border: 1px solid var(--line); border-radius: var(--r-lg);
  background: var(--card); color: var(--ink); box-shadow: var(--shadow); overflow: hidden;
}
.dlg[open] { animation: dlgIn .2s ease-out; }
@keyframes dlgIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.dlg::backdrop { background: var(--scrim); }
.dlg > form, .dlg > .rep-listo { display: flex; flex-direction: column; max-height: calc(100dvh - 40px); }
.dlg-cartel[open] { display: flex; flex-direction: column; }
.dlg-cuerpo { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 4px 18px 18px; }
.dlg-chico { width: min(440px, calc(100% - 28px)); }
.dlg-pie { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 18px calc(14px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--line); flex: none; }

.pasos-barra { display: flex; align-items: center; gap: 12px; padding: 0 18px 12px; font-size: 12.5px; font-weight: 600; color: var(--muted); flex: none; }
.pasos-barra .prog { flex: 1; }
.pasos-barra .prog i { transition: width .25s ease; }
.paso-form { border: 0; margin: 0; padding: 4px 0 14px; min-width: 0; }
.paso-form > * + * { margin-top: 12px; }
.paso-form legend { float: left; width: 100%; display: flex; align-items: center; gap: 10px; padding: 0; font-family: var(--f-head); font-size: 16px; font-weight: 600; color: var(--ink); }
.paso-form legend + * { clear: both; }
.lt { width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; font-family: var(--f-body); font-weight: 700; font-size: 13px; background: var(--soft); border: 1px solid var(--line); flex: none; }
.cats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.cat-op { display: flex; align-items: center; gap: 10px; padding: 10px; border: 1.5px solid var(--line); border-radius: 14px; background: var(--card); text-align: left; font-weight: 600; font-size: 13.5px; line-height: 1.25; color: var(--ink); }
.cat-op .ic-tile { width: 36px; height: 36px; border-radius: 11px; }
.cat-op .ic-tile .ico { width: 19px; height: 19px; }
.cat-op:hover { border-color: var(--accent); background: var(--soft); }
.cat-op[aria-checked="true"] { border-color: var(--accent); background: var(--accent-soft); }
.cat-op[aria-checked="true"] .ic-tile { background: var(--accent); color: var(--on-accent); }
.dir-buscar .buscar-dir { flex: 1 1 220px; }
.resultados .li { font-size: 14px; }
.resultados .empty { padding: 12px 14px; text-align: left; }
.mini-mapa-wrap { position: relative; height: 280px; max-width: 100%; border-radius: var(--r); overflow: hidden; border: 1px solid var(--line); }
#mini-mapa { position: absolute; inset: 0; }
.mira { position: absolute; left: 50%; top: 50%; z-index: 600; pointer-events: none; transform: translate(-50%, -100%); filter: drop-shadow(0 4px 6px rgba(0, 0, 0, .3)); transition: transform .12s ease; }
.mira-pin, .mira-pin svg { display: block; width: 34px; height: 46px; }
.mini-mapa-wrap.is-moviendo .mira { transform: translate(-50%, calc(-100% - 8px)); }
#rep-duplicados { display: grid; gap: 10px; }
#rep-duplicados[hidden] { display: none !important; }
.dup { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; }
.foto-drop { position: relative; display: grid; place-items: center; min-height: 150px; border: 1.5px dashed var(--bar); border-radius: var(--r); overflow: hidden; cursor: pointer; background: var(--soft); }
.foto-drop:hover { border-color: var(--accent); }
.foto-drop:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.foto-vacia { display: grid; justify-items: center; gap: 6px; padding: 20px; text-align: center; }
.foto-vacia b { font-size: 14.5px; }
.foto-vacia small { font-size: 12.5px; color: var(--muted); }
.foto-drop img { width: 100%; max-height: 320px; object-fit: cover; display: block; }
.foto-drop.tiene-foto .foto-vacia { display: none; }

.listo-cuerpo { display: grid; gap: 12px; justify-items: start; padding-top: 6px; padding-bottom: 22px; }
.listo-cuerpo p { margin: 0; }
.listo-check { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; background: var(--pos-soft); color: var(--pos); }
.listo-check .ico { width: 26px; height: 26px; stroke-width: 2.6; }
.listo-codigo { font-family: var(--f-head); font-weight: 700; font-size: 52px; line-height: 1; letter-spacing: -.02em; }
.cartel-cuerpo { display: grid; gap: 14px; justify-items: center; }
#cartel-canvas { display: block; width: auto; height: auto; max-width: 100%; max-height: 56dvh; aspect-ratio: 1275 / 1650; border-radius: 10px; border: 1px solid var(--line); background: #fff; }

/* ---------- barrios */
.barrios { display: grid; gap: 14px; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); align-items: start; }
.bloque { display: grid; gap: 14px; min-width: 0; }
.tabla-wrap { overflow-x: auto; }
.tabla { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tabla th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); padding: 8px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tabla td { padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tabla tr:last-child td { border-bottom: 0; }
.tabla .n { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.tabla .n.bad { color: var(--neg); }
.tabla .nombre button { border: 0; background: none; padding: 0; font-weight: 600; text-align: left; color: var(--ink); }
.tabla .nombre button:hover { color: var(--accent); text-decoration: underline; }

.filas-cifras { display: grid; gap: 16px; }
.fila-cifra { display: grid; gap: 6px; min-width: 0; }
.fc-cab { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.fc-cab b, .fc-cab button { font-weight: 600; font-size: 14.5px; }
.fc-cab button { border: 0; background: none; padding: 0; color: var(--ink); text-align: left; text-decoration: underline; text-decoration-color: var(--bar); text-underline-offset: 3px; }
.fc-n { font-family: var(--f-head); font-weight: 700; font-size: 18px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.fc-n small { font-family: var(--f-body); font-size: 12px; font-weight: 500; color: var(--muted); margin-left: 4px; }
.fc-pie { font-size: 12.5px; color: var(--muted); }
.fc-pie .bad { color: var(--neg); font-weight: 600; }

/* ---------- instalar la app */
.instalar { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 14px; align-items: center; padding: 16px; margin-bottom: 18px; max-width: 620px; }
.instalar img { width: 52px; height: 52px; border-radius: 14px; }
.instalar h2 { margin: 0; font-family: var(--f-head); font-size: 16px; font-weight: 600; }
.instalar p { margin: 2px 0 0; font-size: 13px; color: var(--muted); }
.instalar .btn { grid-column: 1 / -1; }

/* ---------- mis reportes */
.seguir { max-width: 620px; }
.seguir .row .input { flex: 1 1 200px; text-transform: uppercase; font-weight: 600; letter-spacing: .02em; }
.mios { display: grid; gap: 18px; }
.mios-sec { display: grid; gap: 10px; }

/* ---------- avisos */
.toasts { position: fixed; right: 18px; bottom: calc(18px + env(safe-area-inset-bottom, 0px)); z-index: 2000; display: flex; flex-direction: column; align-items: flex-end; pointer-events: none; max-width: calc(100% - 36px); }
.toast.simple { pointer-events: auto; background: var(--ink); color: var(--card); padding: 12px 16px; border-radius: 16px; font-weight: 600; box-shadow: var(--shadow); animation: tIn .25s ease-out; }
@keyframes tIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* ---------- barra inferior (celular) */
.tabbar { display: none; }

@media (max-width: 1080px) {
  .barrios { grid-template-columns: minmax(0, 1fr); }
  .mapa-card { grid-template-columns: 300px minmax(0, 1fr); }
}
@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .side { display: none; }
  .main { padding-bottom: calc(84px + env(safe-area-inset-bottom, 0px)); }
  .top { padding: 10px 16px; }
  .logo-m { display: flex; }
  .logo-m .mark { width: 34px; height: 34px; border-radius: 10px; }
  .logo-m .mark .ico { width: 19px; height: 19px; }
  .logo-m b { font-size: 16px; }
  .crumbs { visibility: hidden; }
  .hide-m { display: none; }
  .solo-m { display: grid; }
  .content { padding: 16px 16px 28px; gap: 16px; }
  .title h1 { font-size: 24px; }
  /* En celular las cifras van en una fila deslizable para que el mapa quede a la vista. */
  .stats { display: flex; gap: 8px; overflow-x: auto; margin: 0 -16px; padding: 0 16px 2px; scrollbar-width: none; }
  .stats::-webkit-scrollbar { display: none; }
  .stat { flex: 0 0 auto; padding: 10px 14px 10px 10px; gap: 10px; }
  body[data-vista="mapa"] #title-acc { display: none; }
  .stat .ic { width: 36px; height: 36px; }
  .stat .v { font-size: 19px; }
  .mapa-card { grid-template-columns: minmax(0, 1fr); height: calc(100dvh - 262px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)); min-height: 360px; }
  .lateral { display: none; }
  .tabbar {
    display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr);
    position: fixed; left: 12px; right: 12px; bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 6px; z-index: 1100;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .1);
  }
  .tabbar a, .tabbar button { border: 0; background: none; display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 10.5px; font-weight: 600; color: var(--muted); padding: 6px 2px; border-radius: 14px; text-decoration: none; }
  .tabbar .ico { width: 20px; height: 20px; }
  .tabbar a[aria-current="page"] { color: var(--accent); background: var(--accent-soft); }
  .tabbar .tab-reportar { color: var(--on-accent); background: var(--accent); }
  .sheet { top: auto; left: 0; right: 0; bottom: 0; width: 100%; max-height: 92%; border-radius: 22px 22px 0 0; padding-bottom: env(safe-area-inset-bottom, 0px); animation-name: hojaArriba; }
  .sheet::before, .dlg::before { content: ""; display: block; width: 40px; height: 4px; border-radius: 2px; background: var(--bar); margin: 8px auto 0; flex: none; }

  /* El mapa ocupa casi toda la pantalla: el título y las cifras quedan en "Barrios" */
  body[data-vista="mapa"] .title, body[data-vista="mapa"] #tablero { display: none; }
  body[data-vista="mapa"] .content { padding-top: 12px; gap: 10px; }
  body[data-vista="mapa"] .vista { gap: 10px; }
  .filtros-abrir { display: inline-flex; justify-self: start; min-height: 40px; }
  .filtros:not(.abierto) .filtros-panel { display: none; }
  .input, .buscar input[type="search"], textarea.input { font-size: 16px; }
  .mini-mapa-wrap { height: 44dvh; min-height: 240px; }
  .cats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cat-op { min-height: 60px; }
  body[data-vista="mapa"] .content { padding-bottom: 4px; }
  #rep-gps { order: -1; flex: 1 1 100%; min-height: 48px; }
  .listo-cuerpo .acciones { display: grid; width: 100%; }
  @keyframes hojaArriba { from { opacity: 0; transform: translateY(40px); } to { opacity: 1; transform: none; } }
  .dlg { width: 100%; max-width: 100%; max-height: 94dvh; margin: auto 0 0; border-radius: 22px 22px 0 0; }
  .dlg > form, .dlg > .rep-listo { max-height: 94dvh; }
  .toasts { left: 16px; right: 16px; align-items: stretch; bottom: calc(92px + env(safe-area-inset-bottom, 0px)); }
}
@media (max-width: 560px) {
  .g2 { grid-template-columns: minmax(0, 1fr); }
  .seg { width: 100%; grid-auto-columns: 1fr; }
  .seg button { padding: 7px 6px; }
  .chips { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
  .chip { flex: none; }
  .leyenda { font-size: 11px; gap: 4px 10px; padding: 6px 10px; }
  .acciones-d { grid-template-columns: minmax(0, 1fr); }
  .d-hero .big { font-size: 42px; }
  .listo-codigo { font-size: 44px; }
  .dlg-pie .btn { flex: 1; }
  .tarjetas { grid-template-columns: minmax(0, 1fr); }
  .orden .input { min-height: 38px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
