/* Panel Yondó — base única de habitantes. Identidad de la campaña: rojo, Anton, Public Sans. */
:root {
  color-scheme: light;
  --bg: #f2f2ef;
  --surface: #ffffff;
  --raised: #f8f8f6;
  --sunken: #ebebe6;
  --ink: #111111;
  --ink-2: #3d3d3a;
  --muted: #6b6b66;
  --line: #dadad4;
  --line-soft: #e8e8e3;
  --accent: #e3141b;
  --accent-ink: #ffffff;
  --accent-text: #c8101a;
  --accent-soft: #fde8e8;
  --side: #111111;
  --side-ink: #f3f3f0;
  --side-muted: #9b9b95;
  --ok: #0ca30c; --ok-text: #006300;
  --warn: #fab219;
  --crit: #d03b3b;
  /* Series de datos (paleta validada; el rojo de la marca no se usa como serie) */
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100; --s5: #e87ba4; --s6: #008300; --s7: #6250d6;
  --seq-100: #cde2fb; --seq-200: #9ec5f4; --seq-300: #6da7ec; --seq-400: #3987e5; --seq-500: #256abf; --seq-600: #184f95; --seq-700: #0d366b;
  --grid: #e1e0d9; --axis: #c3c2b7;
  --f-display: "Anton", Impact, "Arial Narrow Bold", sans-serif;
  --f-body: "Public Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
  --r: 14px;
  --r-s: 9px;
  --sombra: 0 18px 44px -24px rgb(0 0 0 / .35), 0 2px 8px rgb(0 0 0 / .06);
  --vidrio: rgb(255 255 255 / .82);
  --side-w: 236px;
  --barra-movil: 60px; /* alto de la barra superior del celular: 40 px del botón del menú + 10 px arriba y abajo */
  --kpi-acento: #111111; /* tarjeta destacada del panel: en claro, la tinta del menú */
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0d0d0d; --surface: #161616; --raised: #1d1d1d; --sunken: #111111; --ink: #f3f3f0; --ink-2: #d4d4ce;
    --muted: #a5a59f; --line: #2e2e2b; --line-soft: #242422; --accent: #ff4545; --accent-text: #ff6b6b;
    --accent-soft: #3a1414; --side: #080808; --ok-text: #0ca30c; --kpi-acento: #2b2b28;
    --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181; --s6: #008300; --s7: #9085e9;
    --grid: #2c2c2a; --axis: #383835; --vidrio: rgb(22 22 22 / .84);
    --sombra: 0 18px 44px -20px rgb(0 0 0 / .8), 0 2px 8px rgb(0 0 0 / .3);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d0d0d; --surface: #161616; --raised: #1d1d1d; --sunken: #111111; --ink: #f3f3f0; --ink-2: #d4d4ce;
  --muted: #a5a59f; --line: #2e2e2b; --line-soft: #242422; --accent: #ff4545; --accent-text: #ff6b6b;
  --accent-soft: #3a1414; --side: #080808; --ok-text: #0ca30c; --kpi-acento: #2b2b28;
  --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181; --s6: #008300; --s7: #9085e9;
  --grid: #2c2c2a; --axis: #383835; --vidrio: rgb(22 22 22 / .84);
  --sombra: 0 18px 44px -20px rgb(0 0 0 / .8), 0 2px 8px rgb(0 0 0 / .3);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--ink); font: 15px/1.5 var(--f-body); -webkit-font-smoothing: antialiased; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; line-height: 1.15; }
.oculto { display: none !important; }
/* `hidden` gana siempre: .campo, .btn o .form tienen su propio display y lo anularían */
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* Utilidades: `.sec` es texto secundario en todo el panel (antes solo en algunos contextos: en Calidad salía en tinta
   plena); `.pila` apila con separación sin un style="" por vista; una fila de tabla que no abre nada no muestra la mano */
.sec { color: var(--muted); }
.pila { display: flex; flex-direction: column; gap: 12px; }
.tabla .sin-clic { cursor: default; }
@media (hover: hover) { .tabla tbody tr.sin-clic:hover { background: none; } }

/* ───────── Estructura ───────── */
.app { display: grid; grid-template-columns: var(--side-w) 1fr; min-height: 100vh; }
.lateral {
  position: sticky; top: 0; height: 100vh; height: 100dvh; background: var(--side); color: var(--side-ink); display: flex;
  flex-direction: column; padding: 22px 14px max(16px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left)); gap: 6px; z-index: 30;
  /* En una pantalla baja (celular en horizontal, iPhone SE con las barras de Safari) el menú no cabe: se desplaza solo
     él, sin arrastrar la página, y «Cerrar sesión» siempre se alcanza */
  overflow-y: auto; overscroll-behavior: contain;
}
.marca { display: flex; align-items: center; gap: 10px; padding: 0 8px 18px; text-decoration: none; }
.marca .sello { width: 38px; height: 38px; border-radius: 10px; background: var(--accent); display: grid; place-items: center;
  font: 22px/1 var(--f-display); color: #fff; letter-spacing: .02em; }
.marca b { font: 21px/1 var(--f-display); letter-spacing: .02em; text-transform: uppercase; display: block; }
.marca small { color: var(--side-muted); font-size: 11.5px; letter-spacing: .04em; text-transform: uppercase; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 9px 11px; border-radius: 10px; text-decoration: none;
  color: var(--side-muted); font-weight: 600; font-size: 14.5px; position: relative; }
@media (hover: hover) { .nav a:hover { color: var(--side-ink); background: rgb(255 255 255 / .06); } }
.nav a[aria-current="page"] { color: #fff; background: rgb(255 255 255 / .09); }
.nav a[aria-current="page"]::before { content: ""; position: absolute; left: -14px; top: 8px; bottom: 8px; width: 4px;
  border-radius: 0 4px 4px 0; background: var(--accent); }
.nav svg { width: 19px; height: 19px; flex: none; }
.nav .insignia { margin-left: auto; background: var(--accent); color: #fff; font-size: 11px; font-weight: 800;
  border-radius: 99px; padding: 1px 7px; }
.lateral .pie { margin-top: auto; display: flex; flex-direction: column; gap: 8px; padding: 12px 8px 0;
  border-top: 1px solid rgb(255 255 255 / .08); font-size: 13px; color: var(--side-muted); }
.lateral .pie button { background: none; border: 1px solid rgb(255 255 255 / .14); color: var(--side-ink); border-radius: 9px;
  padding: 7px 10px; cursor: pointer; text-align: left; display: flex; gap: 8px; align-items: center; }
@media (hover: hover) { .lateral .pie button:hover { background: rgb(255 255 255 / .06); } }
.lateral .pie svg { width: 16px; height: 16px; flex: none; }

.contenido { min-width: 0; padding: 26px max(clamp(16px, 3vw, 40px), env(safe-area-inset-right)) 60px clamp(16px, 3vw, 40px); }
.contenido.lleno { padding: 0; height: 100vh; height: 100dvh; position: relative; overflow: hidden; }
.cabecera { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.cabecera h1 { font: 38px/1 var(--f-display); text-transform: uppercase; letter-spacing: .01em; }
.cabecera .sub { color: var(--muted); margin-top: 6px; font-size: 14.5px; }
.cabecera .acciones { display: flex; gap: 8px; flex-wrap: wrap; }
.miga { font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.miga a { text-decoration: none; color: var(--muted); }
@media (hover: hover) { .miga a:hover { color: var(--ink); } }

.barra-movil, .velo { display: none; }
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .lateral { position: fixed; inset: 0 auto 0 0; height: auto; width: calc(270px + env(safe-area-inset-left)); transform: translateX(-100%); transition: transform .25s; }
  .app.menu-abierto .lateral { transform: none; box-shadow: var(--sombra); }
  .barra-movil { display: flex; align-items: center; gap: 12px; position: sticky; top: 0; z-index: 25; background: var(--side);
    color: #fff; padding: 10px max(16px, env(safe-area-inset-right)) 10px max(16px, env(safe-area-inset-left)); height: var(--barra-movil); }
  .barra-movil b { font: 19px/1 var(--f-display); text-transform: uppercase; }
  .barra-movil button { background: none; border: 0; color: #fff; padding: 4px; cursor: pointer; min-width: 40px; min-height: 40px;
    display: grid; place-items: center; }
  .barra-movil svg { width: 24px; height: 24px; display: block; }
  .app.menu-abierto .velo { display: block; position: fixed; inset: 0; z-index: 29; background: rgb(0 0 0 / .45); }
  .contenido { padding: 18px max(16px, env(safe-area-inset-right)) 50px max(16px, env(safe-area-inset-left)); }
  /* La vista del mapa ocupa lo que deja la barra. dvh cuenta la barra de direcciones visible del navegador del celular;
     la línea con vh queda para los navegadores sin dvh */
  .contenido.lleno { height: calc(100vh - var(--barra-movil)); height: calc(100dvh - var(--barra-movil)); }
  .cabecera h1 { font-size: 30px; }
}
/* «Cerrar menú», dentro del menú y solo en el celular: con el menú abierto la barra de arriba (y su botón «Menú») queda
   inerte bajo el velo y sin teclado no hay Escape, así que un lector de pantalla táctil necesita aquí un control con
   nombre para cerrarlo. Arriba a la derecha, a la altura de la marca, que le deja su sitio para no montarse con ella */
.cerrar-menu { display: none; }
@media (max-width: 900px) {
  .cerrar-menu { display: grid; place-items: center; position: absolute; top: 19px; right: 8px; width: 44px; height: 44px;
    padding: 0; background: none; border: 0; border-radius: 10px; color: var(--side-ink); cursor: pointer; }
  .cerrar-menu svg { width: 22px; height: 22px; display: block; }
  .lateral .marca { margin-right: 44px; }
}
@media (hover: hover) { .cerrar-menu:hover { background: rgb(255 255 255 / .06); } }

/* ───────── Piezas ───────── */
.tarjeta { background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--r); padding: 18px 20px; min-width: 0; }
.tarjeta > h2, .tarjeta > header h2 { font-size: 15px; font-weight: 750; letter-spacing: -.005em; }
.tarjeta > header { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 14px; }
.tarjeta > h2 { margin-bottom: 14px; }
.tarjeta .nota { color: var(--muted); font-size: 12.5px; }
.rejilla { display: grid; gap: 16px; }
.r-12 { grid-template-columns: repeat(12, minmax(0, 1fr)); }
.c-3 { grid-column: span 3; } .c-4 { grid-column: span 4; } .c-5 { grid-column: span 5; } .c-6 { grid-column: span 6; }
.c-7 { grid-column: span 7; } .c-8 { grid-column: span 8; } .c-12 { grid-column: span 12; }
@media (max-width: 1200px) { .c-3 { grid-column: span 6; } .c-4, .c-5, .c-7, .c-8 { grid-column: span 12; } .c-6 { grid-column: span 12; } }
@media (max-width: 640px) { .c-3 { grid-column: span 12; } }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 16px; }
.kpi { background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--r); padding: 16px 18px 14px; position: relative;
  overflow: hidden; text-decoration: none; display: block; }
@media (hover: hover) { a.kpi:hover { border-color: var(--line); box-shadow: var(--sombra); } }
.kpi .t { color: var(--muted); font-size: 12.5px; font-weight: 650; letter-spacing: .02em; text-transform: uppercase; }
.kpi .v { font-size: 34px; font-weight: 800; letter-spacing: -.025em; line-height: 1.1; margin-top: 6px; }
.kpi .d { font-size: 13px; color: var(--muted); margin-top: 2px; }
.kpi .medidor { height: 6px; border-radius: 99px; background: var(--sunken); margin-top: 12px; overflow: hidden; }
.kpi .medidor i { display: block; height: 100%; border-radius: 99px; background: var(--s1); }
.kpi.acento { background: var(--kpi-acento); color: #fff; border-color: transparent; }
.kpi.acento .t, .kpi.acento .d { color: #b5b5ae; }
.kpi.acento .medidor { background: rgb(255 255 255 / .12); }
.kpi.acento .medidor i { background: var(--accent); }
.kpi.alerta .v { color: var(--accent-text); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; border-radius: 10px; padding: 8px 14px;
  border: 1px solid var(--line); background: var(--surface); font-weight: 650; font-size: 14px; cursor: pointer; text-decoration: none;
  white-space: nowrap; line-height: 1.3; }
@media (hover: hover) { .btn:hover { background: var(--raised); border-color: var(--axis); } }
.btn.primario { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
@media (hover: hover) { .btn.primario:hover { filter: brightness(1.06); } }
.btn.oscuro { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.btn.fantasma { border-color: transparent; background: transparent; }
@media (hover: hover) { .btn.fantasma:hover { background: var(--sunken); } }
.btn.peligro { color: var(--crit); }
.btn.chico { padding: 5px 10px; font-size: 13px; border-radius: 8px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn svg { width: 16px; height: 16px; }

.chip { display: inline-flex; align-items: center; gap: 5px; border-radius: 99px; padding: 2px 9px; font-size: 12.5px; font-weight: 650;
  background: var(--sunken); color: var(--ink-2); border: 1px solid transparent; white-space: nowrap; }
.chip.azul { background: color-mix(in srgb, var(--s1) 14%, transparent); color: var(--s1); }
.chip.verde { background: color-mix(in srgb, var(--ok) 14%, transparent); color: var(--ok-text); }
.chip.ambar { background: color-mix(in srgb, var(--warn) 22%, transparent); color: color-mix(in srgb, var(--warn) 50%, var(--ink)); }
.chip.rojo { background: var(--accent-soft); color: var(--accent-text); }
.chip.borde { background: transparent; border-color: var(--line); }
button.chip { cursor: pointer; }
button.chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }

.campo { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.campo > span { font-size: 12.5px; font-weight: 650; color: var(--muted); }
.campo input, .campo select, .campo textarea, .entrada {
  width: 100%; border: 1px solid var(--line); background: var(--surface); border-radius: 9px; padding: 8px 11px; min-height: 38px; }
.campo textarea { min-height: 84px; resize: vertical; }
.campo input:focus, .campo select:focus, .campo textarea:focus, .entrada:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ink) 10%, transparent); }
.form { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px 14px; }
.form .ancho { grid-column: 1 / -1; }
.buscador { position: relative; }
.buscador svg { position: absolute; left: 12px; top: 50%; translate: 0 -50%; width: 17px; height: 17px; color: var(--muted); pointer-events: none; }
.buscador input { padding-left: 38px; }
.buscador.grande input { min-height: 52px; font-size: 17px; border-radius: 12px; }

.filtros { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.filtros .buscador { flex: 1 1 280px; }
.filtros select { width: auto; min-width: 140px; }

table.tabla { width: 100%; border-collapse: collapse; font-size: 14px; }
.tabla th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700;
  padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; position: sticky; top: 0; background: var(--surface); }
.tabla td { padding: 10px 12px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.tabla tbody tr { cursor: pointer; }
@media (hover: hover) { .tabla tbody tr:hover { background: var(--raised); } }
.tabla .num { text-align: right; font-variant-numeric: tabular-nums; }
.tabla .nombre { font-weight: 650; }
.tabla a.nombre { display: block; color: inherit; text-decoration: none; }
@media (hover: hover) { .tabla a.nombre:hover { text-decoration: underline; } }
.tabla .sec { color: var(--muted); font-size: 12.5px; }
.envoltura-tabla { overflow-x: auto; border-radius: var(--r); border: 1px solid var(--line-soft); background: var(--surface); }
.paginacion { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 4px; color: var(--muted); font-size: 13.5px; }

.barra-comp { display: inline-flex; align-items: center; gap: 8px; font-variant-numeric: tabular-nums; font-size: 13px; white-space: nowrap; }
.barra-comp i { width: 54px; height: 6px; border-radius: 99px; background: var(--sunken); position: relative; overflow: hidden; }
.barra-comp i b { position: absolute; inset: 0 auto 0 0; border-radius: 99px; background: var(--s1); }

.vacio { text-align: center; color: var(--muted); padding: 40px 16px; }
.vacio b { display: block; color: var(--ink); font-size: 16px; margin-bottom: 4px; }
.cargando { display: grid; place-items: center; min-height: 200px; color: var(--muted); }
.giro { width: 26px; height: 26px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--accent); animation: giro .8s linear infinite; }
@keyframes giro { to { transform: rotate(360deg); } }
.esqueleto { background: linear-gradient(90deg, var(--sunken), var(--raised), var(--sunken)); background-size: 200% 100%;
  animation: brillo 1.2s infinite; border-radius: 8px; }
@keyframes brillo { to { background-position: -200% 0; } }

/* Avisos */
.avisos { position: fixed; right: max(18px, env(safe-area-inset-right)); bottom: calc(18px + env(safe-area-inset-bottom)); display: flex;
  flex-direction: column; gap: 8px; z-index: 200; }
.aviso { background: var(--ink); color: var(--bg); padding: 11px 16px; border-radius: 11px; box-shadow: var(--sombra); font-weight: 600;
  font-size: 14px; max-width: 380px; animation: entra .2s ease-out; display: flex; gap: 10px; align-items: flex-start; }
.aviso.error { background: var(--crit); color: #fff; }
@keyframes entra { from { opacity: 0; transform: translateY(8px); } }

/* Diálogos y paneles laterales */
dialog { border: 0; padding: 0; border-radius: 18px; background: var(--surface); color: var(--ink); box-shadow: var(--sombra);
  width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 40px); }
dialog.ancho { width: min(980px, calc(100vw - 32px)); }
dialog::backdrop { background: rgb(0 0 0 / .45); backdrop-filter: blur(2px); }
dialog .cab { display: flex; justify-content: space-between; align-items: center; padding: 18px 22px 0; }
dialog .cab h2 { font-size: 18px; }
dialog .cuerpo { padding: 16px 22px; overflow: auto; max-height: calc(100vh - 170px); max-height: calc(100dvh - 150px); }
dialog .pie { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 22px 18px; border-top: 1px solid var(--line-soft); }

/* ───────── Login ───────── */
.login { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login .lienzo { position: relative; background: #0b0b0b; color: #fff; overflow: hidden; display: flex; flex-direction: column;
  justify-content: flex-end; padding: 48px; }
.login .lienzo canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.login .lienzo h1 { position: relative; font: clamp(44px, 6vw, 84px)/.92 var(--f-display); text-transform: uppercase; }
.login .lienzo h1 em { font-style: normal; color: var(--accent); }
.login .lienzo p { position: relative; color: #bdbdb6; max-width: 440px; }
.login .caja { display: grid; place-items: center; padding: 32px 16px; background: var(--bg); }
.login form { width: min(380px, 100%); display: flex; flex-direction: column; gap: 14px; }
.login form h2 { font: 30px/1 var(--f-display); text-transform: uppercase; }
.login .error { color: var(--crit); font-weight: 650; font-size: 14px; min-height: 20px; }
.login .legal { color: var(--muted); font-size: 12.5px; }
@media (max-width: 860px) { .login { grid-template-columns: 1fr; } .login .lienzo { min-height: 240px; padding: 28px 20px; } }

/* ───────── Gráficos ───────── */
.grafico { position: relative; }
.grafico svg { display: block; width: 100%; height: auto; overflow: visible; }
.grafico text { fill: var(--muted); font-size: 11.5px; font-family: var(--f-body); }
.grafico .rotulo { fill: var(--ink); font-weight: 650; font-size: 12.5px; }
.grafico .valor { fill: var(--ink-2); font-variant-numeric: tabular-nums; font-size: 12px; }
.grafico .rejilla-l { stroke: var(--grid); stroke-width: 1; }
.grafico .eje { stroke: var(--axis); stroke-width: 1; }
.grafico .golpe { fill: transparent; cursor: pointer; }
@media (hover: hover) { .grafico .marca-h:hover, .grafico .golpe:hover + .marca-h { opacity: .82; } }
.leyenda { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12.5px; color: var(--ink-2); margin-top: 10px; }
.leyenda i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.globo { position: fixed; pointer-events: none; z-index: 300; background: var(--ink); color: var(--bg); border-radius: 9px;
  padding: 7px 10px; font-size: 12.5px; box-shadow: var(--sombra); max-width: 260px; line-height: 1.35; }
.globo b { font-size: 14px; }
.apilada { display: flex; height: 14px; border-radius: 7px; overflow: hidden; gap: 2px; background: var(--surface); }
.apilada span { display: block; height: 100%; min-width: 3px; }
.lista-barras { display: flex; flex-direction: column; gap: 9px; }
.lista-barras .f { display: grid; grid-template-columns: minmax(110px, 38%) 1fr auto; gap: 10px; align-items: center; font-size: 13.5px;
  text-decoration: none; }
.lista-barras .f > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lista-barras .f > span:nth-child(2) { display: block; min-width: 0; }
.lista-barras .f .b { display: block; height: 10px; border-radius: 0 4px 4px 0; background: var(--s1); min-width: 2px; }
.lista-barras .f .n { font-variant-numeric: tabular-nums; font-weight: 650; min-width: 40px; text-align: right; }
@media (hover: hover) { .lista-barras a.f:hover .b { filter: brightness(1.12); } }

/* ───────── Mapa ───────── */
.mapa { position: absolute; inset: 0; }
.panel-mapa { position: absolute; z-index: 5; background: var(--vidrio); backdrop-filter: blur(14px) saturate(1.4);
  -webkit-backdrop-filter: blur(14px) saturate(1.4); border: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
  border-radius: 16px; box-shadow: var(--sombra); }
.panel-mapa.izq { top: 16px; left: 16px; width: 300px; max-height: calc(100% - 32px); overflow: auto; padding: 16px; }
.panel-mapa.der { top: 16px; right: 16px; width: 290px; padding: 16px; max-height: calc(100% - 120px); overflow: auto; }
.panel-mapa.abajo { left: 50%; bottom: 18px; translate: -50% 0; padding: 8px; display: flex; gap: 4px; flex-wrap: wrap; justify-content: center; }
.panel-mapa h1 { font: 26px/1 var(--f-display); text-transform: uppercase; }
.panel-mapa h3 { font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 16px 0 8px; }
.panel-mapa .gran-cifra { font-size: 40px; font-weight: 800; letter-spacing: -.03em; line-height: 1; }
.interruptor { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 5px 0; font-size: 14px; cursor: pointer; }
.interruptor input { appearance: none; width: 34px; height: 20px; border-radius: 99px; background: var(--line); position: relative;
  cursor: pointer; transition: background .15s; flex: none; margin: 0; }
.interruptor input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%;
  background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgb(0 0 0 / .3); }
.interruptor input:checked { background: var(--accent); }
.interruptor input:checked::after { transform: translateX(14px); }
.segmentado { display: flex; background: var(--sunken); border-radius: 10px; padding: 3px; gap: 2px; }
.segmentado button { flex: 1; border: 0; background: transparent; border-radius: 8px; padding: 5px 8px; font-size: 12.5px; font-weight: 650;
  cursor: pointer; color: var(--muted); white-space: nowrap; }
.segmentado button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgb(0 0 0 / .12); }
.rampa { height: 10px; border-radius: 5px; margin: 6px 0 4px; }
.rampa-et { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--muted); }
.maplibregl-popup-content { background: var(--surface); color: var(--ink); border-radius: 12px; padding: 12px 14px; box-shadow: var(--sombra);
  font: 13.5px/1.4 var(--f-body); }
.maplibregl-popup-tip { border-top-color: var(--surface) !important; border-bottom-color: var(--surface) !important; }
.maplibregl-popup-close-button { font-size: 18px; padding: 2px 8px; color: var(--muted); }
.maplibregl-ctrl-group { background: var(--surface) !important; border-radius: 10px !important; }
.maplibregl-ctrl-attrib { font-size: 10.5px; }
.cargador-mapa { position: absolute; inset: 0; display: grid; place-items: center; z-index: 4; background: var(--bg); transition: opacity .4s; }
@media (max-width: 900px) {
  .panel-mapa.izq { width: auto; right: 16px; max-height: 42%; }
  .panel-mapa.der { display: none; }
  .panel-mapa.abajo { width: calc(100% - 32px); }
}

/* ───────── Ficha ───────── */
.ficha { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 16px; align-items: start; }
@media (max-width: 1100px) { .ficha { grid-template-columns: 1fr; } }
.perfil { display: flex; gap: 18px; align-items: center; }
.avatar { width: 64px; height: 64px; border-radius: 18px; background: var(--side); color: #fff; display: grid; place-items: center;
  font: 26px/1 var(--f-display); flex: none; }
.anillo { --p: 0; width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: conic-gradient(var(--s1) calc(var(--p) * 1%), var(--sunken) 0); }
.anillo span { width: 50px; height: 50px; border-radius: 50%; background: var(--surface); display: grid; place-items: center; font-weight: 800; font-size: 14px; }
.datos { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px 18px; }
.datos div span { display: block; font-size: 12px; color: var(--muted); font-weight: 650; }
.datos div b { font-weight: 600; word-break: break-word; }
.linea-tiempo { display: flex; flex-direction: column; gap: 0; }
.linea-tiempo .ev { display: grid; grid-template-columns: 14px 1fr; gap: 12px; padding-bottom: 14px; position: relative; }
.linea-tiempo .ev::before { content: ""; position: absolute; left: 6px; top: 16px; bottom: 0; width: 2px; background: var(--line-soft); }
.linea-tiempo .ev:last-child::before { display: none; }
.linea-tiempo .punto { width: 14px; height: 14px; border-radius: 50%; border: 3px solid var(--surface); background: var(--s1); margin-top: 3px;
  box-shadow: 0 0 0 1px var(--line); }
.linea-tiempo .punto.reunion { background: var(--accent); }
.linea-tiempo .punto.nota { background: var(--s3); }
.linea-tiempo .punto.tramite { background: var(--s7); }
.linea-tiempo .t { font-weight: 650; font-size: 14px; }
.linea-tiempo .m { color: var(--muted); font-size: 12.5px; }
.minimapa { height: 240px; border-radius: 12px; overflow: hidden; position: relative; background: var(--sunken); }
.pestanas { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.pestanas button { border: 0; background: none; padding: 10px 14px; font-weight: 650; color: var(--muted); cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.pestanas button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }

/* ───────── Reuniones ───────── */
.reuniones { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.reunion-t { text-decoration: none; display: flex; flex-direction: column; gap: 10px; }
@media (hover: hover) { .reunion-t:hover { border-color: var(--line); box-shadow: var(--sombra); } }
.fecha-bloque { display: inline-flex; flex-direction: column; align-items: center; justify-content: center; width: 54px; height: 58px;
  border-radius: 12px; background: var(--side); color: #fff; flex: none; }
.fecha-bloque b { font: 24px/1 var(--f-display); }
.fecha-bloque small { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: #c9c9c2; }
.registro { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 1000px) { .registro { grid-template-columns: 1fr; } }
.resultados { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.resultado { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 11px; border: 1px solid var(--line-soft);
  background: var(--raised); }
.resultado .q { flex: 1; min-width: 0; }
.resultado .q b { display: block; }
.resultado .q small { color: var(--muted); }
.asistente { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-bottom: 1px solid var(--line-soft); }
.asistente:last-child { border-bottom: 0; }
.asistente .q { flex: 1; min-width: 0; }
.asistente .q a { font-weight: 700; text-decoration: none; }
@media (hover: hover) { .asistente .q a:hover { text-decoration: underline; } }

/* ───────── Calidad ───────── */
.par { display: grid; grid-template-columns: 1fr auto 1fr; gap: 12px; align-items: stretch; }
.par .lado { background: var(--raised); border-radius: 12px; padding: 12px 14px; font-size: 13.5px; }
.par .lado b { display: block; font-size: 15px; margin-bottom: 4px; }
.par .lado dl { display: grid; grid-template-columns: auto 1fr; gap: 3px 10px; margin: 6px 0 0; }
.par .lado dt { color: var(--muted); }
.par .lado dd { margin: 0; word-break: break-word; }
.par .medio { display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 6px; }
.puntaje { font-size: 22px; font-weight: 800; }
.igual { background: color-mix(in srgb, var(--ok) 16%, transparent); border-radius: 4px; padding: 0 3px; }
@media (max-width: 760px) { .par { grid-template-columns: 1fr; } }
.zona-subida { border: 2px dashed var(--line); border-radius: 16px; padding: 38px 20px; text-align: center; cursor: pointer; transition: .15s; }
.zona-subida.encima { border-color: var(--accent); background: var(--accent-soft); }
.zona-subida b { display: block; font-size: 17px; margin-bottom: 4px; }
.aviso-legal { border-left: 4px solid var(--accent); background: var(--surface); border-radius: 0 12px 12px 0; padding: 12px 16px; font-size: 13.5px; color: var(--ink-2); }
.vista.lleno { position: relative; height: 100%; }

/* ═════════ Trabajo de campo en el celular (7.1, grupo 4) ═════════ */

/* 1. iOS amplía la página si un campo tiene menos de 16 px */
@media (max-width: 900px) { input, select, textarea { font-size: 16px; } }
/* 2. Dedo: blancos de 44 px o más */
@media (pointer: coarse) {
  .btn.chico, .chip[data-et], button.chip, label.chip.opcion, .segmentado button, .pestanas button { min-height: 44px; }
  .btn.chico { padding: 8px 12px; }
  .casilla { min-height: 44px; }
}
/* 3. Pestañas desplazables, con un degradado que avisa que hay más */
.pestanas { scrollbar-width: none; -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent);
  mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent); scroll-snap-type: x proximity; padding-right: 24px; }
.pestanas::-webkit-scrollbar { display: none; }
.pestanas button { scroll-snap-align: start; flex: none; }
.pestanas .n { color: var(--muted); font-weight: 600; font-size: 12.5px; }
/* 4. Diálogos que caben con el teclado abierto; en el celular, hoja que sube desde abajo */
dialog { max-height: 100dvh; }
@media (max-width: 640px) {
  dialog, dialog.ancho { width: 100vw; max-width: 100vw; margin: auto 0 0; border-radius: 18px 18px 0 0; }
  dialog .cab { padding: 14px 16px 0; }
  dialog .cuerpo { padding: 12px 16px; max-height: calc(100dvh - 130px); }
  dialog .pie { padding: 10px 16px calc(12px + env(safe-area-inset-bottom)); flex-wrap: wrap; }
  dialog .pie .btn { flex: 1 1 auto; min-height: 44px; }
}
/* 8. Chips de listas: el texto largo baja de línea */
.chips .chip { white-space: normal; text-align: left; }

.casilla { display: flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
.casilla input { width: 18px; height: 18px; flex: none; accent-color: var(--accent); }
label.chip.opcion { cursor: pointer; gap: 6px; padding: 4px 11px; }
label.chip.opcion input { margin: 0; accent-color: var(--accent); }
label.chip.opcion:has(input:checked) { background: var(--ink); color: var(--bg); }
.fila-botones { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.sub-tarjeta { font-size: 15px; margin: 22px 0 12px; }
.una-columna { grid-template-columns: 1fr; }
.grupo-campo { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.titulo-campo { font-size: 12.5px; font-weight: 650; color: var(--muted); }
.fila-campos { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; }
.fila-campos input, .fila-campos select, .no-sabe select, .selector-usuario select { width: 100%; border: 1px solid var(--line); background: var(--surface);
  border-radius: 9px; padding: 8px 11px; min-height: 38px; }
.no-sabe select { width: auto; min-height: 32px; padding: 4px 8px; font-size: 13px; color: var(--muted); }
/* La edad calculada con la fecha de nacimiento (enlazarEdad): se ve que no se escribe */
.fila-campos input[data-calculada], .campo input[data-calculada] { background: var(--sunken); color: var(--ink-2); border-style: dashed; }
.opciones-radio { display: flex; flex-wrap: wrap; gap: 6px; }
.nota-sensibles { color: var(--muted); font-size: 12px; }
.campo small.nota, .campo .nota { color: var(--muted); font-size: 12px; }

/* Autorización y aviso de privacidad */
.bloque-autorizacion-ficha { border: 1px solid var(--line-soft); border-radius: var(--r-s); padding: 12px 14px; margin: 0; display: flex;
  flex-direction: column; gap: 10px; min-width: 0; }
.bloque-autorizacion-ficha legend { font-weight: 700; padding: 0 6px; }
.recuadro-aviso { background: var(--raised); border: 1px dashed var(--line); border-radius: var(--r-s); padding: 10px 12px; font-size: 13px;
  max-height: 160px; overflow: auto; }
.recuadro-aviso p { margin: 4px 0; white-space: pre-line; }

/* Franja «Llamada sin registrar» (7.0) y «Deshacer» (7.5) */
.franja-pendiente { position: fixed; z-index: 150; top: 0; left: var(--side-w); right: 0; display: flex; align-items: center; gap: 10px;
  padding: 8px 16px; background: var(--warn); color: #1b1300; box-shadow: var(--sombra); font-size: 14px; }
.franja-pendiente svg { width: 20px; height: 20px; flex: none; }
.franja-pendiente span { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.franja-pendiente small { opacity: .8; }
.franja-pendiente .btn.fantasma { color: inherit; }
@media (max-width: 900px) { .franja-pendiente { left: 0; top: var(--barra-movil); } }
body:has(#franja-llamada) .contenido:not(.lleno) { padding-top: 76px; }
.barra-deshacer { position: fixed; z-index: 210; left: 50%; translate: -50% 0; bottom: calc(88px + env(safe-area-inset-bottom)); display: flex;
  align-items: center; gap: 14px; background: var(--ink); color: var(--bg); padding: 10px 12px 10px 18px; border-radius: 12px;
  box-shadow: var(--sombra); font-weight: 600; max-width: calc(100vw - 32px); animation: entra .2s ease-out; }
.barra-deshacer .btn { background: transparent; color: var(--warn); border-color: transparent; font-weight: 800; }
@media (min-width: 901px) { .barra-deshacer { bottom: 24px; } }
/* Con el menú abierto en el celular, la franja y «Deshacer» (fijas en document.body, sobre la vista) quedan debajo del
   velo (29) y del menú (30), como lo demás que el velo tapa; app.js (taparConElMenu) las vuelve inertes. Al cerrarlo
   vuelven a su capa. Los avisos no bajan: son solo texto, no atajan el toque ni se enfocan */
@media (max-width: 900px) {
  body:has(.app.menu-abierto) :is(.franja-pendiente, .barra-deshacer) { z-index: 28; }
}

/* Diálogo de acercamiento (7.5) */
.acercamiento { display: flex; flex-direction: column; gap: 14px; }
.segmentado.canales button { display: inline-flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 8px; min-height: 52px; }
.segmentado.canales svg { width: 20px; height: 20px; }
.rejilla-resultados { display: flex; flex-direction: column; gap: 12px; }
.grupo-resultados h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 0 0 6px; }
.botones-resultado { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.resultado-btn { min-height: 48px; border-radius: 11px; border: 1px solid var(--line); background: var(--surface); font-weight: 650;
  font-size: 14px; padding: 8px 10px; cursor: pointer; text-align: center; line-height: 1.2; }
.resultado-btn.rapido { background: var(--raised); }
@media (hover: hover) { .resultado-btn:hover { border-color: var(--axis); } }
.resultado-btn[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.resultado-btn:disabled { opacity: .5; }
.ayuda-rapido { margin: 0; font-size: 12.5px; color: var(--muted); }
.detalle-resultado { display: flex; flex-direction: column; gap: 12px; border-top: 1px solid var(--line-soft); padding-top: 12px; }
.bloque-autorizacion, .bloque-dictados, details.bloque, .mas-datos { border: 1px solid var(--line-soft); border-radius: var(--r-s); padding: 10px 14px; }
.bloque-autorizacion[open], .bloque-dictados[open], .mas-datos[open] { display: flex; flex-direction: column; gap: 10px; }
.bloque-autorizacion summary, .bloque-dictados summary, details.bloque > summary, .mas-datos > summary { font-weight: 700; cursor: pointer;
  display: flex; align-items: center; gap: 8px; min-height: 32px; }
.guion { background: var(--raised); border-radius: var(--r-s); padding: 10px 12px; margin: 0; font-size: 14px; font-style: italic; }
.aviso-privacidad summary { font-size: 13px; color: var(--muted); cursor: pointer; }
.aviso-privacidad p { white-space: pre-line; font-size: 13px; }
.avisos-acercamiento:empty { display: none; }
.avisos-acercamiento .aviso-legal { margin: 0 0 6px; }

/* Ficha (7.4): contacto primero en el celular, bloques plegables y barra de acciones por rol */
.nombre-ficha, .cabecera h1.nombre-ficha { font-size: 32px; overflow-wrap: anywhere; }
@media (max-width: 900px) { .cabecera h1.nombre-ficha { font-size: 28px; } }
@media (max-width: 640px) { .cabecera h1.nombre-ficha { font-size: 24px; } .perfil { gap: 12px; } .perfil .avatar { width: 48px; height: 48px; font-size: 20px; border-radius: 14px; } }
.lateral-ficha { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
@media (max-width: 1100px) { .ficha > .lateral-ficha { order: -1; } }
details.bloque { margin-bottom: 12px; }
details.bloque > .form, details.bloque > .datos { margin-top: 12px; }
details.bloque > summary .chip { font-weight: 650; }
.guardar-ficha { display: flex; gap: 8px; justify-content: flex-end; align-items: center; margin-top: 18px; position: sticky; bottom: 0;
  background: var(--surface); padding: 10px 0; z-index: 2; }
.guardar-ficha .sec { margin-right: auto; color: var(--muted); font-size: 13px; }
.barra-acciones { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 16px; }
.barra-acciones .btn svg { width: 18px; height: 18px; }
@media (max-width: 900px) {
  .barra-acciones { position: fixed; z-index: 27; left: 0; right: 0; bottom: 0; margin: 0; flex-wrap: nowrap; overflow-x: auto; gap: 6px;
    padding: 8px max(10px, env(safe-area-inset-right)) calc(8px + env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
    background: var(--vidrio); backdrop-filter: blur(14px) saturate(1.4);
    -webkit-backdrop-filter: blur(14px) saturate(1.4); border-top: 1px solid var(--line); scrollbar-width: none; }
  .barra-acciones .btn { flex: 1 0 auto; flex-direction: column; gap: 2px; padding: 6px; min-height: 54px; font-size: 12px; min-width: 64px; }
  .contenido:has(.barra-acciones) { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
  .contenido:has(.barra-acciones) .guardar-ficha { bottom: calc(70px + env(safe-area-inset-bottom)); }
}
.pendiente-actualizar { margin-bottom: 14px; display: flex; flex-direction: column; gap: 6px; border-left-color: var(--warn); }
.nota-consultor { margin: 0; font-size: 15px; color: var(--ink); }
.avisos-ficha { margin-bottom: 14px; display: flex; flex-direction: column; gap: 4px; border-left-color: var(--s1); }
.faltan-ficha { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 14px; }
.faltan { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.faltan .chip { font-size: 11.5px; padding: 1px 7px; }
.no-disponible { align-self: center; }
.alterno { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; font-size: 12.5px; color: var(--ink-2); background: color-mix(in srgb, var(--s1) 8%, transparent);
  border-radius: 8px; padding: 2px 4px 2px 8px; }
.alterno .btn { padding: 2px 8px; }
.registrar-autorizacion { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; align-items: flex-start; }
.registrar-autorizacion .bloque-autorizacion-ficha { align-self: stretch; }
.sub-origen { font-size: 14px; margin: 18px 0 10px; }
.sub-origen:first-child { margin-top: 4px; }
.detalle-cambio { white-space: pre-wrap; font: 12px/1.4 var(--f-mono); color: var(--muted); margin: 4px 0 0; }
.nota-interna { display: flex; gap: 8px; margin-bottom: 18px; }
.nota-interna[hidden] { display: none; }
.linea-tiempo .punto.acercamiento { background: var(--s4); }
.linea-tiempo .ev.anulado .t { text-decoration: line-through; color: var(--muted); }
.minimapa.vacio-mapa { height: 120px; }
.minimapa.vacio-mapa .vacio { padding: 40px 10px; }
.telefonos { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.tel { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 11px;
  border: 1px solid var(--line-soft); background: var(--raised); }
.tel.no-usable { opacity: .7; }
.tel.no-usable .tel-num b { text-decoration: line-through; }
.tel-num { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; min-width: 0; }
.tel-num b { font-variant-numeric: tabular-nums; font-size: 15px; margin-right: 2px; }
.tel-num small { flex-basis: 100%; }
.tel-acciones { display: flex; gap: 4px; flex: none; }
.tel-acciones .btn svg { width: 18px; height: 18px; }
.tel-estado.estado-confirmado { background: color-mix(in srgb, var(--ok) 14%, transparent); color: var(--ok-text); }
.tel-estado.estado-equivocado, .tel-estado.estado-inexistente, .tel-estado.estado-retirado { background: var(--accent-soft); color: var(--accent-text); }
.tel-estado.estado-no_usa { background: color-mix(in srgb, var(--warn) 22%, transparent); }
.lista-acciones-tel { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.lista-acciones-tel .btn { min-height: 44px; }

/* Habitantes (7.3): filtros plegables y filas que pasan a tarjetas */
.boton-filtros { display: none; }
.mas-filtros { display: contents; }
@media (max-width: 900px) {
  .filtros.plegables .buscador { flex: 1 1 200px; }
  .boton-filtros { display: inline-flex; min-height: 40px; }
  .mas-filtros { display: none; width: 100%; grid-template-columns: 1fr 1fr; gap: 8px; }
  .filtros.plegables.abiertos .mas-filtros { display: grid; }
  .mas-filtros select { width: 100%; min-width: 0; }
}
#chips-ocultos:empty { display: none; }
.chips-fila { margin-top: 4px; }
.chips-fila:empty { display: none; }
.tabla-personas td { vertical-align: top; }
.tabla-personas .celda-acciones { text-align: right; white-space: nowrap; }
.tabla-personas tr.recien td { background: color-mix(in srgb, var(--ok) 10%, transparent); transition: background 1s; }
.aviso-tope { color: var(--accent-text); font-weight: 650; }
.botones-pagina { display: flex; gap: 6px; }
@media (max-width: 640px) { .paginacion { flex-wrap: wrap; } }
@media (max-width: 1260px) {
  /* 5. Filas como tarjetas: cada celda lleva su título encima. Hasta 1260 px: con el menú fijo, la tableta y el portátil
     chico tampoco tienen lugar para las columnas (medido: aun sin las secundarias la tabla pide unos 920 px) */
  .tabla-tarjetas, .tabla-tarjetas tbody { display: block; width: 100%; }
  .tabla-tarjetas thead { display: none; }
  .tabla-tarjetas tr { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
  .tabla-tarjetas td { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; border: 0; padding: 0; min-width: 0; white-space: normal; }
  .tabla-tarjetas td[data-titulo]::before { content: attr(data-titulo); color: var(--muted); font-size: 11.5px; font-weight: 650;
    text-transform: uppercase; letter-spacing: .03em; }
  .tabla-tarjetas td:first-child, .tabla-tarjetas td.celda-acciones, .tabla-tarjetas td[data-titulo="Faltan"], .tabla-tarjetas td[colspan] { grid-column: 1 / -1; }
  .tabla-tarjetas td:first-child::before { content: none; }
  .tabla-tarjetas td:first-child .nombre { font-size: 16px; }
  .tabla-tarjetas td.celda-acciones { align-items: stretch; }
  .tabla-tarjetas td.celda-acciones:empty { display: none; }
  .tabla-tarjetas tr.esqueleto-fila { display: block; }
}

/* Mi trabajo (7.7) */
.selector-usuario { min-width: 220px; }
.kpis-trabajo .kpi.en-cero .v { color: var(--muted); }
.resumen-dia { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: baseline; font-size: 14px; margin: 0 0 12px; }
.resumen-dia > b { text-transform: uppercase; font-size: 12px; letter-spacing: .05em; color: var(--muted); }
#alcance { margin-bottom: 16px; }
.indicadores-trabajo { margin-top: 16px; }
.persona-actual { margin-bottom: 16px; border: 2px solid var(--ink); }
.persona-actual .etiqueta-actual { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; }
.nombre-actual { font-size: 24px; margin: 4px 0 2px; }
.nombre-actual a { text-decoration: none; }
.numero-actual { font: 700 26px/1.2 var(--f-body); font-variant-numeric: tabular-nums; letter-spacing: .02em; margin: 6px 0 12px; }
.numero-actual small { display: block; font-size: 13px; font-weight: 500; letter-spacing: 0; }
.mas-datos .grupo-campo { margin-bottom: 8px; }
.botones-actual .btn { min-height: 48px; }
.sin-actual { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.sin-actual p { margin: 2px 0 0; }
.btn.grande { min-height: 52px; padding: 10px 22px; font-size: 16px; }
.buscador-trabajo { display: block; margin-bottom: 6px; }
.filas-cola { display: flex; flex-direction: column; gap: 10px; }
.fila-cola { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 14px; }
.fila-cola .q { min-width: 0; flex: 1 1 220px; }
.fila-cola .q b { font-size: 15.5px; }
.cola-vacia { background: var(--surface); border-radius: var(--r); }
#mas-cola { margin-top: 12px; width: 100%; }
@media (max-width: 640px) { .fila-cola .fila-botones { width: 100%; } .fila-cola .fila-botones .btn { flex: 1 1 auto; min-height: 46px; } }

/* Tablero (7.10): pirámide con barras enlazadas */
.piramide { display: grid; grid-template-columns: 1fr 58px 1fr; gap: 6px 8px; align-items: center; font-size: 12.5px; }
.piramide.con-gris { grid-template-columns: 1fr 58px 1fr minmax(60px, .45fr); }
.celda-p { display: flex; align-items: center; gap: 6px; text-decoration: none; min-width: 0; }
.celda-p.mujeres { flex-direction: row-reverse; }
.barra-p { display: block; height: 14px; min-width: 2px; }
.mujeres .barra-p { background: var(--s2); border-radius: 4px 0 0 4px; }
.hombres .barra-p { background: var(--s1); border-radius: 0 4px 4px 0; }
.sin-sexo .barra-p { background: var(--axis); border-radius: 4px; }
@media (hover: hover) { a.celda-p:hover .barra-p { filter: brightness(1.12); } }
.celda-p.cero .barra-p { min-width: 0; }
.celda-p.cero .sec { visibility: hidden; }
.rango-p { text-align: center; font-weight: 650; }
.actividad { display: flex; flex-direction: column; gap: 6px; font-size: 13px; }

/* Reunión */
.acciones-asistente { display: flex; flex-wrap: wrap; gap: 4px; justify-content: flex-end; }

/* Ajustes → Asistente: qué modelo usa y la conexión con Mnemo (vistas/ajustes.js) */
.asistente-cabeza { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; }
.mnemo-rige { margin: 0; font-size: 13.5px; color: var(--ink-2); }
.mnemo-conexion { display: flex; flex-direction: column; gap: 8px; border: 1px solid var(--line-soft); border-radius: 12px;
  padding: 14px 16px; background: var(--raised); min-width: 0; }
.mnemo-conexion h3 { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 14px; font-weight: 750; margin: 0; }
.mnemo-conexion p { margin: 0; font-size: 13.5px; color: var(--ink-2); overflow-wrap: anywhere; }
.mnemo-conexion .mnemo-aviso, .mnemo-conexion .mnemo-ayuda { color: var(--muted); font-size: 12.5px; }
.mnemo-conexion .form { margin-top: 4px; }
.mnemo-botones { display: flex; gap: 8px; flex-wrap: wrap; }
.mnemo-conexion .mnemo-nota { border-radius: 8px; padding: 8px 10px; color: var(--ink); }
.mnemo-nota.ok { background: color-mix(in srgb, var(--ok) 12%, transparent); }
.mnemo-nota.alerta { background: color-mix(in srgb, var(--warn) 18%, transparent); }
.mnemo-nota.error { background: color-mix(in srgb, var(--crit) 12%, transparent); }

/* ═════════ Cualquier dispositivo: celular, tableta, portátil y escritorio ═════════
   Fronteras: ≤640 celular, 641–900 tableta vertical, 901–1260 tableta horizontal o portátil chico (menú fijo), >1260. */

/* Tema en el pie del menú: Sistema, Claro u Oscuro (sobre el menú, que es oscuro en los dos temas) */
.lateral .pie .tema { display: flex; flex-direction: column; gap: 6px; }
.lateral .pie .tema > span { display: flex; align-items: center; gap: 8px; }
.lateral .pie .tema .segmentado { background: rgb(255 255 255 / .07); }
.lateral .pie .tema button { border: 0; justify-content: center; padding: 5px 6px; color: var(--side-muted); font-size: 12.5px; }
.lateral .pie .tema button[aria-pressed="true"] { background: rgb(255 255 255 / .16); color: #fff; box-shadow: none; }

/* Habitantes (P3): los chips de una fila no se parten en dos líneas (el ancho automático de la tabla encogía Nombre a
   108 px y cada fila llegaba a 222 px) y Nombre tiene un mínimo. Las 9 columnas piden unos 1 150 px: entre 1261 y
   1520 px, con el menú fijo, se ocultan las secundarias (la edad y el puesto siguen en la ficha y en los filtros).
   Hasta 1260, tarjetas (de tres columnas desde 641) */
.chips-fila .chip, .faltan .chip { white-space: nowrap; }
@media (min-width: 1261px) {
  .tabla-personas th, .tabla-personas td { padding-left: 10px; padding-right: 10px; }
  .tabla-personas td:first-child { min-width: 200px; }
}
@media (min-width: 1261px) and (max-width: 1520px) {
  .tabla-personas th:nth-child(4), .tabla-personas td[data-titulo="Edad y sexo"],
  .tabla-personas th:nth-child(6), .tabla-personas td[data-titulo="Puesto y mesa"] { display: none; }
  /* Con la letra de respaldo del sistema (más ancha que Public Sans) las 7 columnas pedían 6 px más que la caja a
     1280: «Faltan» envuelve sus chips en un ancho fijo y las celdas pierden un poco de relleno, un margen para cualquier
     letra */
  .tabla-personas th, .tabla-personas td { padding-left: 8px; padding-right: 8px; }
  .tabla-personas td[data-titulo="Faltan"] { width: 136px; max-width: 136px; }
}
@media (min-width: 641px) and (max-width: 1260px) { .tabla-tarjetas tr { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

/* Los bloques plegables de la ficha: el chip del título («Sí autoriza (por confirmar)») baja de línea en vez de
   ensanchar la página en 320 px */
details.bloque > summary, .mas-datos > summary { flex-wrap: wrap; }
details.bloque > summary .chip { white-space: normal; }

/* Pestañas (P4): con ratón no hay cómo desplazarlas de costado (sin rueda horizontal «Lugares sin reconocer» nunca se
   veía entera): se envuelven en dos filas, sin el degradado. En pantalla táctil siguen desplazables */
@media (hover: hover) and (pointer: fine) {
  .pestanas { flex-wrap: wrap; overflow-x: visible; -webkit-mask-image: none; mask-image: none; padding-right: 0; scroll-snap-type: none; }
}

/* Diálogos (P5): el botón de cerrar es un ícono de 44 × 44 en la esquina; el título largo baja de línea */
dialog .cab { gap: 8px; }
dialog .cab h2 { min-width: 0; overflow-wrap: anywhere; }
dialog .cab .cerrar-dialogo { width: 44px; height: 44px; padding: 0; margin: -10px -14px -10px 0; flex: none; border-radius: 12px; color: var(--muted); }
dialog .cab .cerrar-dialogo svg { width: 20px; height: 20px; }
/* «No lo tiene / No sabe» de «Completar»: a 13 px iOS ampliaba la página al tocarlo */
@media (max-width: 900px) { .no-sabe select { font-size: 16px; min-height: 44px; } }
/* Sin pie, lo último es el cuerpo: deja el margen de la barra de inicio del iPhone */
@media (max-width: 640px) { dialog.sin-pie .cuerpo { padding-bottom: calc(16px + env(safe-area-inset-bottom)); } }

/* Ficha (P6): en el celular «Unir» y «Suprimir» van en el menú ⋯ de la cabecera; las acciones que no caben en la barra
   de abajo, en «Más» (ficha.js las mide) */
.cabecera .mas-ficha { display: none; }
@media (max-width: 640px) {
  .cabecera .acciones .en-menu { display: none; }
  .cabecera .mas-ficha { display: inline-flex; }
}
.lista-mas-acciones { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 8px; }
.lista-mas-acciones .btn { min-height: 48px; justify-content: flex-start; white-space: normal; text-align: left; }
.lista-mas-acciones .btn svg { width: 18px; height: 18px; flex: none; }

/* Los avisos son solo texto: no atajan el toque ni el clic a lo que tapan mientras se ven («Guardar cambios», el pie
   del menú abierto) */
.avisos { pointer-events: none; }
/* Avisos (P9): en la ficha del celular van encima de la barra de acciones, no sobre ella. agente.css los baja a 18 px
   cuando su botón sube a la barra de arriba: esta regla le gana (con el panel del asistente abierto manda la suya) */
@media (max-width: 900px) {
  body:has(#vista .barra-acciones):not(:has(#agente-panel:not([hidden]))) #avisos.avisos { bottom: calc(84px + env(safe-area-inset-bottom)); }
}

/* Dedo (P7): todo lo que se toca mide 44 px o más en una pantalla táctil (los botones chicos, los chips, las pestañas y
   las casillas ya lo tenían, arriba) */
@media (pointer: coarse) {
  :where(input:not([type=checkbox], [type=radio], [type=range], [type=color], [type=hidden], [type=file]), select) { min-height: 44px; }
  .btn, .campo input, .campo select, .entrada, .fila-campos input, .fila-campos select, .selector-usuario select, .no-sabe select,
  .boton-filtros, details.bloque > summary, .mas-datos > summary, .bloque-autorizacion summary, .bloque-dictados summary,
  .interruptor, .nav a, .lateral .pie button { min-height: 44px; }
  .btn, button.chip { min-width: 44px; }
  button.chip { justify-content: center; }
  .barra-movil button { min-width: 44px; min-height: 44px; }
  .leyenda a, .tarjeta > header a { display: inline-flex; align-items: center; min-height: 44px; }
  .tarjeta > header a { margin-block: -12px; }
  /* La miga de pan y el nombre de cada fila crecen hacia arriba y abajo sin mover lo demás */
  .miga a { display: inline-flex; align-items: center; min-height: 44px; margin-block: -12px; }
  .tabla a.nombre { padding-block: 10px; margin-block: -10px; }
  .lista-barras { gap: 0; }
  .lista-barras .f, .celda-p { min-height: 44px; }
}

/* Movimiento reducido (P11): sin deslizar el menú ni los avisos; la rueda de carga gira lenta */
@media (prefers-reduced-motion: reduce) {
  .lateral, .tabla-personas tr.recien td, .interruptor input, .interruptor input::after, .zona-subida, .cargador-mapa { transition: none; }
  .aviso, .barra-deshacer, .esqueleto { animation: none; }
  .giro { animation-duration: 2.4s; }
}
