/* CDMG · Mapa de Círculos de Amistad */
@font-face { font-family: 'Manrope'; font-weight: 400; font-display: swap; src: url(/fonts/manrope-latin-400-normal.woff2) format('woff2'); }
@font-face { font-family: 'Manrope'; font-weight: 500; font-display: swap; src: url(/fonts/manrope-latin-500-normal.woff2) format('woff2'); }
@font-face { font-family: 'Manrope'; font-weight: 600; font-display: swap; src: url(/fonts/manrope-latin-600-normal.woff2) format('woff2'); }
@font-face { font-family: 'Manrope'; font-weight: 700; font-display: swap; src: url(/fonts/manrope-latin-700-normal.woff2) format('woff2'); }
@font-face { font-family: 'Manrope'; font-weight: 800; font-display: swap; src: url(/fonts/manrope-latin-800-normal.woff2) format('woff2'); }
@font-face { font-family: 'Cormorant Garamond'; font-weight: 600; font-display: swap; src: url(/fonts/cormorant-garamond-latin-600-normal.woff2) format('woff2'); }
@font-face { font-family: 'Cormorant Garamond'; font-weight: 700; font-display: swap; src: url(/fonts/cormorant-garamond-latin-700-normal.woff2) format('woff2'); }
@font-face { font-family: 'Cormorant Garamond'; font-weight: 600; font-style: italic; font-display: swap; src: url(/fonts/cormorant-garamond-latin-600-italic.woff2) format('woff2'); }

:root {
  --navy-950: #070D1A;
  --navy-900: #0F172A;
  --navy-800: #1B2540;
  --navy-700: #2A3656;
  --ivory: #FBF8F1;
  --paper: #FFFFFF;
  --line: #E7E0CF;
  --line-strong: #D6CCB2;
  --ink: #141B2D;
  --ink-2: #47506A;
  --ink-3: #6B7389;
  --gold-600: #A87A1F;
  --gold-500: #C9A24A;
  --gold-400: #E0C46E;
  --gold-200: #F4E7BF;
  --gold-grad: linear-gradient(100deg, #C38E2E 0%, #E9DA82 48%, #C9952F 100%);
  --danger: #C62828;
  --ok: #2E7D32;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow-1: 0 1px 2px rgba(15, 23, 42, .06), 0 2px 8px rgba(15, 23, 42, .06);
  --shadow-2: 0 10px 30px rgba(7, 13, 26, .18);
  --focus: 0 0 0 3px #fff, 0 0 0 6px var(--gold-500);
  --serif: 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
  --sans: 'Manrope', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --t-fast: 150ms;
  --t-med: 240ms;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --header-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; font-family: var(--sans); font-size: 16px; line-height: 1.5; color: var(--ink);
  background: var(--ivory); -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
h1, h2, h3 { font-family: var(--serif); font-weight: 700; line-height: 1.15; margin: 0; letter-spacing: .01em; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--gold-600); }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 8px; }
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 8px; top: -60px; z-index: 3000; background: var(--gold-400); color: var(--navy-900); padding: 10px 14px; border-radius: 10px; font-weight: 700; }
.skip:focus { top: 8px; }
[hidden] { display: none !important; }

/* ---------- Encabezado ---------- */
.topbar {
  height: var(--header-h); display: flex; align-items: center; gap: 12px; padding: 0 16px;
  background: radial-gradient(120% 140% at 0% 0%, #1E2A4A 0%, var(--navy-900) 55%, var(--navy-950) 100%);
  color: #fff; position: relative; z-index: 1001; border-bottom: 1px solid rgba(224, 196, 110, .25);
}
.topbar .marca { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; min-width: 0; }
.topbar .marca img { width: 38px; height: 38px; object-fit: contain; flex: none; }
.topbar .marca b { display: block; font-family: var(--serif); font-size: 22px; font-weight: 700; line-height: 1; letter-spacing: .02em;
  background: var(--gold-grad); -webkit-background-clip: text; background-clip: text; color: transparent; white-space: nowrap; }
.topbar .marca small { display: block; font-size: 12px; color: #C8CEDD; letter-spacing: .14em; text-transform: uppercase; margin-top: 3px; white-space: nowrap; }
.topbar .espacio { flex: 1; }
.version { font-size: 12px; color: #9AA3B8; white-space: nowrap; }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 16px;
  border-radius: 12px; border: 1px solid transparent; cursor: pointer; font-weight: 700; font-size: 15px; text-decoration: none;
  transition: transform var(--t-fast) var(--ease), background-color var(--t-fast), border-color var(--t-fast), box-shadow var(--t-fast);
  white-space: nowrap; user-select: none;
}
.btn:active { transform: scale(.98); }
.btn svg { width: 20px; height: 20px; flex: none; }
.btn-oro { background: var(--gold-grad); color: var(--navy-900); box-shadow: 0 2px 10px rgba(201, 162, 74, .35); }
.btn-oro:hover { box-shadow: 0 4px 16px rgba(201, 162, 74, .5); }
.btn-navy { background: var(--navy-900); color: #fff; }
.btn-navy:hover { background: var(--navy-800); }
.btn-borde { background: var(--paper); border-color: var(--line-strong); color: var(--ink); }
.btn-borde:hover { border-color: var(--gold-500); }
.btn-fantasma { background: transparent; color: var(--ink-2); }
.btn-fantasma:hover { background: rgba(15, 23, 42, .05); }
.btn-wa { background: #128C4B; color: #fff; }
.btn-wa:hover { background: #0F7A41; }
.btn-peligro { background: var(--danger); color: #fff; }
.btn-chico { min-height: 36px; padding: 0 12px; font-size: 14px; border-radius: 10px; }
.btn-icono { width: 44px; padding: 0; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn-bloque { width: 100%; }
@media (pointer: fine) { .btn { min-height: 38px; } .btn-icono { width: 38px; } .btn-chico { min-height: 32px; } }

/* ---------- Campos ---------- */
.campo { display: grid; gap: 6px; margin-bottom: 14px; }
.campo label, .campo .etq { font-size: 14px; font-weight: 700; color: var(--ink-2); }
.campo .ayuda { font-size: 13px; color: var(--ink-3); }
.input, select.input, textarea.input {
  width: 100%; min-height: 46px; padding: 10px 14px; font-size: 16px; /* 16px: sin zoom en iOS */
  border: 1px solid var(--line-strong); border-radius: 12px; background: var(--paper); color: var(--ink);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
textarea.input { min-height: 88px; resize: vertical; }
.input:focus { outline: none; border-color: var(--gold-500); box-shadow: 0 0 0 3px rgba(201, 162, 74, .25); }
.input[aria-invalid="true"] { border-color: var(--danger); }
.error-campo { color: var(--danger); font-size: 13px; font-weight: 600; }
.tel { display: grid; grid-template-columns: 112px 1fr; gap: 8px; }
.fila2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.segmentado { display: flex; flex-wrap: wrap; gap: 6px; }
.segmentado button { min-height: 40px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--paper); cursor: pointer; font-weight: 600; font-size: 14px; }
.segmentado button[aria-pressed="true"] { background: var(--navy-900); color: #fff; border-color: var(--navy-900); }

/* ---------- Diseño público ---------- */
.app { display: grid; grid-template-columns: 420px 1fr; height: calc(100% - var(--header-h)); }
.panel { background: var(--ivory); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; position: relative; z-index: 2; }
.panel-cabeza { padding: 16px 16px 10px; border-bottom: 1px solid var(--line); background: linear-gradient(180deg, #fff 0%, var(--ivory) 100%); }
.panel-cuerpo { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 12px 16px calc(24px + var(--safe-b)); }
.mapa { position: relative; min-height: 0; }
#mapa { position: absolute; inset: 0; background: #E9E6DD; }

.saludo { font-family: var(--serif); font-size: 28px; color: var(--navy-900); }
.saludo em { font-style: italic; background: var(--gold-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.sub { color: var(--ink-2); font-size: 15px; margin: 4px 0 12px; }

/* Buscador */
.buscador { position: relative; }
.buscador .input { padding-left: 46px; padding-right: 46px; min-height: 52px; border-radius: 14px; box-shadow: var(--shadow-1); }
.buscador .lupa { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 22px; height: 22px; color: var(--gold-600); pointer-events: none; }
.buscador .limpiar { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); }
.sugerencias { position: absolute; left: 0; right: 0; top: calc(100% + 6px); background: var(--paper); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: var(--shadow-2); max-height: min(60vh, 460px); overflow-y: auto; z-index: 1200; padding: 6px; }
.sug-grupo { font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); padding: 10px 10px 4px; font-weight: 700; }
.sug { display: flex; align-items: center; gap: 12px; padding: 10px; min-height: 48px; border-radius: 10px; cursor: pointer; }
.sug[aria-selected="true"], .sug:hover { background: var(--gold-200); }
.sug .ico { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex: none; background: #F3EEDF; color: var(--navy-800); }
.sug .ico svg { width: 18px; height: 18px; }
.sug .t { font-weight: 700; line-height: 1.25; }
.sug .d { font-size: 13px; color: var(--ink-3); line-height: 1.3; }
.sug mark { background: transparent; color: var(--gold-600); font-weight: 800; }
.sug-vacio { padding: 14px; color: var(--ink-2); font-size: 15px; }

.acciones-rapidas { display: flex; gap: 8px; margin-top: 10px; }

/* Chips de zonas */
.zonas { display: flex; gap: 8px; overflow-x: auto; padding: 10px 0 4px; scrollbar-width: none; }
.zonas::-webkit-scrollbar { display: none; }
.chip-zona { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 14px 0 10px; border-radius: 999px; border: 1px solid var(--line-strong);
  background: var(--paper); cursor: pointer; font-weight: 700; font-size: 14px; white-space: nowrap; transition: all var(--t-fast); }
.chip-zona .punto { width: 14px; height: 14px; border-radius: 50%; background: var(--c); box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .6); }
.chip-zona[aria-pressed="true"] { background: var(--c); border-color: var(--c); color: #fff; }
.chip-zona[aria-pressed="true"] .punto { background: #fff; }

/* Migas */
.migas { font-size: 14px; color: var(--ink-3); margin: 4px 0 12px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.migas a, .migas button { color: var(--ink-2); text-decoration: none; background: none; border: 0; padding: 4px 0; cursor: pointer; font: inherit; }
.migas a:hover, .migas button:hover { color: var(--gold-600); text-decoration: underline; }
.migas .sep { color: #B3B8C6; }
.migas b { color: var(--ink); }

/* Tarjetas */
.tarjeta { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow-1); margin-bottom: 12px; }
.tarjeta h2 { font-size: 28px; color: var(--navy-900); }
.tarjeta h3 { font-size: 22px; color: var(--navy-900); }
.meta { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 0; }
.pastilla { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; background: #F3EEDF; color: var(--ink-2); font-size: 13px; font-weight: 700; }
.pastilla.zona { background: var(--c); color: #fff; }
.pastilla svg { width: 14px; height: 14px; }
.banda-zona { height: 6px; border-radius: 6px; background: var(--c); margin: -4px 0 12px; }
.ca-card { border: 1px solid var(--line); border-left: 5px solid var(--c, var(--gold-500)); border-radius: 12px; padding: 14px; background: #FFFDF8; margin-top: 12px; }
.ca-card .ca-nombre { font-family: var(--serif); font-size: 24px; font-weight: 700; color: var(--navy-900); }
.ca-card .ca-etq { font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--gold-600); font-weight: 800; }
.dato { display: flex; gap: 10px; align-items: flex-start; margin-top: 8px; color: var(--ink-2); }
.dato svg { width: 18px; height: 18px; flex: none; margin-top: 3px; color: var(--gold-600); }
.incluye { margin-top: 12px; }
.incluye .etq { font-size: 13px; font-weight: 800; color: var(--ink-2); margin-bottom: 6px; }
.lista-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-barrio { min-height: 34px; padding: 4px 12px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--paper); cursor: pointer; font-size: 14px; font-weight: 600; color: var(--ink); }
.chip-barrio:hover { border-color: var(--gold-500); background: #FFF9EA; }
.chip-barrio.actual { background: var(--navy-900); color: #fff; border-color: var(--navy-900); }
.aviso { border-radius: 12px; padding: 12px 14px; background: #FFF7E2; border: 1px solid #F0DFAE; color: #5B4510; font-size: 15px; margin-top: 12px; }
.aviso.gris { background: #F2F4F8; border-color: #E1E5EE; color: var(--ink-2); }
.vacio { text-align: center; color: var(--ink-2); padding: 28px 12px; }
.vacio svg { width: 44px; height: 44px; color: var(--gold-500); }

.resumen-zonas { display: grid; gap: 10px; }
.zona-fila { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 12px; background: var(--paper); border: 1px solid var(--line); cursor: pointer; text-align: left; width: 100%; min-height: 64px; }
.zona-fila:hover { border-color: var(--c); }
.zona-fila .barra { width: 6px; align-self: stretch; border-radius: 6px; background: var(--c); }
.zona-fila .n { font-weight: 800; font-size: 16px; }
.zona-fila .d { font-size: 13px; color: var(--ink-3); }
.zona-fila svg { width: 20px; height: 20px; margin-left: auto; color: var(--ink-3); }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.stat { background: #FFFDF8; border: 1px solid var(--line); border-radius: 12px; padding: 10px; text-align: center; }
.stat b { display: block; font-family: var(--serif); font-size: 28px; line-height: 1; color: var(--navy-900); }
.stat span { font-size: 12px; color: var(--ink-3); font-weight: 700; }

.pie { font-size: 12px; color: var(--ink-3); margin-top: 18px; line-height: 1.5; }

/* Controles del mapa */
.mapa-ctrl { position: absolute; z-index: 800; right: 12px; top: 12px; display: grid; gap: 8px; }
.mapa-ctrl .btn { box-shadow: var(--shadow-1); }
.leyenda { position: absolute; z-index: 800; left: 12px; bottom: 24px; background: rgba(255, 255, 255, .94); border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; font-size: 13px; box-shadow: var(--shadow-1); display: grid; gap: 4px; }
.leyenda span { display: flex; align-items: center; gap: 8px; }
.leyenda i { width: 14px; height: 14px; border-radius: 4px; background: var(--c); display: inline-block; opacity: .85; }
.leaflet-container { font-family: var(--sans); }
.leaflet-tooltip.tt { font-family: var(--sans); font-weight: 700; font-size: 13px; border-radius: 8px; border: 0; box-shadow: var(--shadow-1); padding: 4px 8px; }
.etq-distrito { font-family: var(--serif); font-weight: 700; font-size: 18px; color: rgba(15, 23, 42, .55); text-shadow: 0 1px 0 #fff, 0 0 6px #fff; white-space: nowrap; pointer-events: none; }
.yo-punto { width: 18px; height: 18px; border-radius: 50%; background: #1D4ED8; border: 3px solid #fff; box-shadow: 0 0 0 6px rgba(29, 78, 216, .25); }

/* Toast */
.toast { position: fixed; left: 50%; bottom: calc(20px + var(--safe-b)); transform: translateX(-50%) translateY(20px); opacity: 0; z-index: 4000;
  background: var(--navy-900); color: #fff; padding: 12px 18px; border-radius: 12px; box-shadow: var(--shadow-2); font-weight: 600; max-width: calc(100% - 32px);
  transition: opacity var(--t-med), transform var(--t-med) var(--ease); pointer-events: none; }
.toast.ver { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.error { background: var(--danger); }

/* Pull to refresh */
.ptr { height: 0; overflow: hidden; display: grid; place-items: center; color: var(--gold-600); transition: height var(--t-med) var(--ease); }
.ptr .anillo { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--gold-200); border-top-color: var(--gold-500); }
.ptr.cargando .anillo { animation: girar .8s linear infinite; }
.ptr .llama { width: 22px; height: 22px; position: absolute; }
@keyframes girar { to { transform: rotate(360deg); } }

/* Hoja inferior (móvil) */
.asa { display: none; }

@media (max-width: 899px) {
  :root { --header-h: 58px; }
  .topbar .marca b { font-size: 20px; }
  .topbar .marca small { font-size: 11px; letter-spacing: .1em; }
  .app { display: block; position: relative; }
  .mapa { position: absolute; inset: 0; }
  .panel {
    position: absolute; left: 0; right: 0; bottom: 0; height: 46%; border-right: 0; border-radius: 22px 22px 0 0;
    box-shadow: 0 -10px 30px rgba(7, 13, 26, .18); transition: height var(--t-med) var(--ease); z-index: 900;
  }
  .panel[data-estado="min"] { height: 196px; }
  .panel[data-estado="max"] { height: calc(100% - 8px); }
  .asa { display: grid; place-items: center; height: 26px; cursor: grab; border: 0; background: transparent; width: 100%; }
  .asa span { width: 44px; height: 5px; border-radius: 5px; background: #CFC6AF; }
  .panel-cabeza { padding: 0 14px 8px; border-radius: 22px 22px 0 0; background: var(--paper); }
  .saludo { font-size: 24px; }
  .sub { display: none; }
  .panel-cuerpo { padding: 10px 14px calc(24px + var(--safe-b)); }
  .mapa-ctrl { top: 10px; right: 10px; }
  .leyenda { display: none; }
  .sugerencias { max-height: 50vh; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition-duration: 0ms !important; animation-duration: 0ms !important; } }

/* =================== Panel de coordinadores =================== */
.admin-body { background: var(--ivory); }
.usuario { display: flex; align-items: center; gap: 8px; color: #fff; font-size: 14px; min-width: 0; }
.usuario img { width: 32px; height: 32px; border-radius: 50%; }
.usuario .nom { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.topbar .btn-fantasma { color: #E6E9F2; }
.topbar .btn-fantasma:hover { background: rgba(255, 255, 255, .08); }
.trabajo { display: flex; align-items: center; gap: 8px; }
.trabajo select { min-height: 38px; font-size: 16px; border-radius: 10px; border: 1px solid rgba(224, 196, 110, .5); background: var(--navy-800); color: #fff; padding: 0 10px; }

.login { min-height: calc(100% - var(--header-h)); display: grid; place-items: center; padding: 24px; }
.login .caja { width: min(420px, 100%); background: var(--navy-900); color: #fff; border-radius: 22px; padding: 28px 24px; text-align: center; box-shadow: var(--shadow-2);
  border: 1px solid rgba(224, 196, 110, .3); background-image: radial-gradient(120% 80% at 50% 0%, #22305A 0%, var(--navy-900) 60%); }
.login img { width: 180px; height: auto; }
.login h1 { font-size: 30px; margin: 10px 0 6px; background: var(--gold-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.login p { color: #C8CEDD; margin: 0 0 18px; font-size: 15px; }
.login .gbtn { display: flex; justify-content: center; min-height: 44px; }
.login .msg { margin-top: 14px; color: #FFD27A; font-size: 14px; }

.contenedor { max-width: 1200px; margin: 0 auto; padding: 14px 16px calc(96px + var(--safe-b)); }
.pestanas { display: flex; gap: 4px; padding: 0 16px; background: var(--paper); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 1000; overflow-x: auto; }
.pestanas button { display: inline-flex; align-items: center; gap: 8px; min-height: 52px; padding: 0 14px; border: 0; background: none; cursor: pointer; font-weight: 700; color: var(--ink-3); border-bottom: 3px solid transparent; white-space: nowrap; }
.pestanas button svg { width: 20px; height: 20px; }
.pestanas button[aria-selected="true"] { color: var(--navy-900); border-bottom-color: var(--gold-500); }
.titulo-seccion { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.titulo-seccion h2 { font-size: 30px; color: var(--navy-900); margin-right: auto; }

.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.kpi { background: var(--paper); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; }
.kpi b { font-family: var(--serif); font-size: 30px; line-height: 1; display: block; color: var(--navy-900); }
.kpi span { font-size: 13px; color: var(--ink-3); font-weight: 700; }

.filtros { display: grid; grid-template-columns: 2fr repeat(3, 1fr); gap: 8px; margin-bottom: 10px; }
.contador { font-size: 14px; color: var(--ink-3); margin: 4px 0 8px; display: flex; align-items: center; gap: 10px; }

/* Lista de barrios (filas que se vuelven tarjetas) */
.lista { display: grid; gap: 6px; }
.fila { position: relative; overflow: hidden; border-radius: 12px; background: var(--danger); touch-action: pan-y; }
.fila .acciones-swipe { position: absolute; inset: 0 0 0 auto; display: flex; }
.fila .acciones-swipe button { width: 84px; border: 0; color: #fff; font-weight: 700; font-size: 13px; display: grid; place-items: center; gap: 2px; cursor: pointer; }
.fila .acciones-swipe button svg { width: 20px; height: 20px; }
.fila .acciones-swipe .gris { background: #6B7389; }
.fila .acciones-swipe .rojo { background: var(--danger); }
.fila .frente { position: relative; display: grid; grid-template-columns: 44px 1fr auto; align-items: center; gap: 8px; padding: 8px 10px; min-height: 60px;
  background: var(--paper); border: 1px solid var(--line); border-radius: 12px; transition: transform var(--t-med) var(--ease); }
.fila .frente.arrastrando { transition: none; }
.fila.sel .frente { background: #FFF6DC; border-color: var(--gold-400); }
.fila .chk { width: 44px; height: 44px; display: grid; place-items: center; }
.fila .chk input { width: 22px; height: 22px; accent-color: var(--navy-900); cursor: pointer; }
.fila .nb { font-weight: 800; line-height: 1.25; }
.fila .ds { font-size: 13px; color: var(--ink-3); display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; margin-top: 2px; }
.fila .ds .pastilla { font-size: 12px; padding: 2px 8px; }
.fila .der { display: flex; gap: 4px; }
.mas-filas { text-align: center; margin-top: 10px; }

.barra-lote { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(16px + var(--safe-b)); z-index: 1500; width: min(760px, calc(100% - 24px));
  background: var(--navy-900); color: #fff; border-radius: 16px; padding: 10px 12px; box-shadow: var(--shadow-2); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.barra-lote .n { font-weight: 800; margin-right: auto; padding-left: 4px; }
.barra-lote select { min-height: 44px; border-radius: 10px; font-size: 16px; padding: 0 8px; max-width: 220px; }

/* Distritos */
.distritos { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.dist { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.dist b { font-family: var(--serif); font-size: 22px; color: var(--navy-900); }
.dist .barrita { display: flex; height: 8px; border-radius: 8px; overflow: hidden; background: #ECE7D8; margin: 8px 0; }
.dist .barrita i { display: block; height: 100%; }
.dist .ds { font-size: 13px; color: var(--ink-3); margin-bottom: 8px; }
details.plegable { background: var(--paper); border: 1px solid var(--line); border-radius: 14px; padding: 4px 14px; margin-bottom: 12px; }
details.plegable summary { cursor: pointer; min-height: 48px; display: flex; align-items: center; font-weight: 800; }
details.plegable[open] { padding-bottom: 14px; }

/* Mapa del panel */
.admin-mapa { position: relative; height: calc(100vh - var(--header-h) - 53px - 140px); min-height: 420px; border-radius: 16px; overflow: hidden; border: 1px solid var(--line); }
#mapaAdmin { position: absolute; inset: 0; }
.herramientas { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 10px; }
.herramientas .ayuda { font-size: 14px; color: var(--ink-2); }
.modo-pin { position: absolute; z-index: 900; left: 50%; top: 12px; transform: translateX(-50%); background: var(--navy-900); color: #fff; border-radius: 12px; padding: 8px 12px; display: flex; gap: 10px; align-items: center; box-shadow: var(--shadow-2); font-weight: 600; }

/* CA */
.grid-cas { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }
.grid-cas .ca-card { margin: 0; }
.ca-card .pie-ca { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.inactivo { opacity: .6; }

/* Diálogos */
dialog.hoja { border: 0; padding: 0; border-radius: 20px; width: min(560px, calc(100% - 24px)); max-height: calc(100% - 40px); box-shadow: var(--shadow-2); background: var(--ivory); color: var(--ink); }
dialog.hoja::backdrop { background: rgba(7, 13, 26, .55); backdrop-filter: blur(2px); }
dialog.hoja .cab { display: flex; align-items: center; gap: 8px; padding: 16px 16px 8px; position: sticky; top: 0; background: var(--ivory); z-index: 1; }
dialog.hoja .cab h2 { font-size: 26px; margin-right: auto; color: var(--navy-900); }
dialog.hoja form, dialog.hoja .contenido { padding: 4px 16px 16px; }
dialog.hoja .pie-dialogo { display: flex; gap: 8px; justify-content: flex-end; padding-top: 6px; flex-wrap: wrap; }
.zona-edit { display: grid; grid-template-columns: 52px 1fr; gap: 10px; align-items: center; }
.zona-edit input[type=color] { width: 52px; height: 46px; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--paper); padding: 4px; }

.tabla-simple { width: 100%; border-collapse: collapse; font-size: 14px; }
.tabla-simple th, .tabla-simple td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tabla-simple th { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3); }
.bitacora { display: grid; gap: 6px; }
.bitacora .reg { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; font-size: 14px; }
.bitacora .reg .f { color: var(--ink-3); font-size: 12px; }
.bitacora .reg code { font-size: 12px; color: var(--ink-2); word-break: break-word; }

.nav-inferior { display: none; }
@media (max-width: 899px) {
  .pestanas { display: none; }
  .nav-inferior { display: grid; grid-template-columns: repeat(var(--n, 5), 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 1400;
    background: var(--paper); border-top: 1px solid var(--line); padding-bottom: var(--safe-b); box-shadow: 0 -4px 20px rgba(7, 13, 26, .08); }
  .nav-inferior button { min-height: 60px; border: 0; background: none; display: grid; place-items: center; gap: 2px; font-size: 12px; font-weight: 700; color: var(--ink-3); cursor: pointer; padding: 6px 0; }
  .nav-inferior button svg { width: 22px; height: 22px; }
  .nav-inferior button[aria-selected="true"] { color: var(--navy-900); }
  .nav-inferior button[aria-selected="true"] svg { color: var(--gold-600); }
  .barra-lote { bottom: calc(72px + var(--safe-b)); }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filtros { grid-template-columns: 1fr 1fr; }
  .filtros .busq { grid-column: 1 / -1; }
  .admin-mapa { height: calc(100vh - var(--header-h) - 230px); }
  .usuario .nom, .version { display: none; }
  dialog.hoja { width: 100%; max-width: none; margin: auto 0 0; border-radius: 20px 20px 0 0; max-height: 92%; }
  .trabajo .etq { display: none; }
}
@media (min-width: 900px) {
  .fila .frente { grid-template-columns: 44px 1fr auto; }
}

input[type=search]::-webkit-search-cancel-button, input[type=search]::-webkit-search-decoration { -webkit-appearance: none; appearance: none; display: none; }
@media (max-width: 899px) {
  .mapa .leaflet-control-zoom { display: none; }
  .panel.detalle .saludo { display: none; }
  .panel.detalle .panel-cabeza { padding-top: 0; }
}
.fila { background: transparent; }
.fila .acciones-swipe { border-radius: 12px; overflow: hidden; opacity: 0; transition: opacity var(--t-fast); }
.fila.moviendo .acciones-swipe, .fila[data-abierta] .acciones-swipe { opacity: 1; }
.barra-lote select { color: var(--ink); background: #fff; border: 0; }
@media (max-width: 520px) {
  .admin-body .topbar .marca span { display: none; }
}

/* Mapa base más sobrio para que resalten los colores de las zonas */
.mapa-base { filter: grayscale(.75) contrast(.92) brightness(1.06); }

/* Asignar por distancia */
.pin-ca { width: 26px; height: 26px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); background: var(--c, #0F172A); border: 3px solid #fff; box-shadow: 0 2px 8px rgba(7, 13, 26, .45); cursor: grab; }
.admin-mapa.con-lista { height: min(56vh, 520px); min-height: 340px; }
.radio-lista { margin-top: 12px; }
.radio-lista .frente { grid-template-columns: 44px 1fr 0; }
.barra-radio { position: sticky; bottom: calc(12px + var(--safe-b)); display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; padding: 10px; margin-top: 8px;
  background: rgba(251, 248, 241, .96); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-1); z-index: 5; }
@media (max-width: 899px) {
  .barra-radio { bottom: calc(72px + var(--safe-b)); }
  .admin-mapa.con-lista { height: 48vh; }
  .herramientas .segmentado { overflow-x: auto; flex-wrap: nowrap; max-width: 100%; }
}
