/* Presente (app de registro de jornada) · tokens de marca y componentes
   Tema por defecto: Ecosistémica. Cada organización podrá cambiar --verde con config.color_primario (HU-11). */

/* ---------- Fuentes locales (SIL OFL, ver fonts/OFL.txt) ---------- */
@font-face { font-family: 'IBM Plex Sans'; font-style: normal; font-weight: 400; font-display: swap; src: url('../fonts/ibm-plex-sans-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'IBM Plex Sans'; font-style: normal; font-weight: 500; font-display: swap; src: url('../fonts/ibm-plex-sans-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'IBM Plex Sans'; font-style: normal; font-weight: 600; font-display: swap; src: url('../fonts/ibm-plex-sans-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'IBM Plex Mono'; font-style: normal; font-weight: 400; font-display: swap; src: url('../fonts/ibm-plex-mono-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'IBM Plex Mono'; font-style: normal; font-weight: 500; font-display: swap; src: url('../fonts/ibm-plex-mono-latin-500-normal.woff2') format('woff2'); }

/* ---------- Tokens ---------- */
:root {
  --verde: #14503A;     /* primario, botones · cada organización puede cambiarlo (HU-11, js/marca.js) */
  --verde-oscuro: #0E3D2C;   /* al presionar; se calcula del primario */
  --follaje: #3F6B57;   /* texto secundario */
  --grafito: #191D1B;   /* texto */
  --hueso: #F4F2EC;     /* fondo */
  --salvia: #7E9A76;    /* gráficos, no texto */
  --arena: #C2A167;     /* acento, no texto */
  --agua: #2A7377;      /* series de datos */
  --tierra: #9A5836;    /* acción secundaria */
  --blanco: #FFFFFF;
  --linea: #E2DED3;

  /* Estados (excepción a la paleta) */
  --ok: #43A047;  --aviso: #F4B400;  --critico: #E53935;
  --ok-fondo: #E3F1E4;  --ok-texto: #1E5E22;
  --aviso-fondo: #FDF1CC;  --aviso-texto: #6B4E00;
  --critico-fondo: #FBE3E2;  --critico-texto: #9B1C19;
  --neutro-fondo: #ECE7DA;  --neutro-texto: #5A4A2E;
  /* Estados en gráficas: versiones más firmes de ok/aviso/crítico, validadas para distinguirse con daltonismo
     (el amarillo #F4B400 no alcanza sobre blanco). Siempre con leyenda y etiquetas de texto. */
  --serie-ok: #3F8F44;  --serie-aviso: #D49A00;  --serie-critico: #C62828;

  --sans: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;

  --radio: 16px;
  --radio-chico: 10px;
  --sombra: 0 1px 2px rgb(25 29 27 / 6%), 0 2px 8px rgb(25 29 27 / 5%);
  --tactil: 44px;      /* área táctil mínima */
  --alto-nav: 64px;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.4;
  color: var(--grafito);
  background: var(--hueso);
  -webkit-tap-highlight-color: transparent;
}
h1, h2, h3, p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--agua); outline-offset: 2px; }
[hidden] { display: none !important; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.secundario { color: var(--follaje); }
.chico { font-size: 13px; }
.solo-lector { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Estructura ---------- */
.app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}
.pantalla-app { flex: 1; display: flex; flex-direction: column; padding-bottom: calc(var(--alto-nav) + env(safe-area-inset-bottom)); }
.pantalla-app[hidden], .pantalla-centrada[hidden], .pantalla-checada[hidden] { display: none; }
.pantalla-checada { flex: 1; display: flex; flex-direction: column; }
textarea.campo__entrada { resize: vertical; min-height: 88px; }

/* Mapa esquemático (SVG propio, sin teselas: funciona sin señal) */
.mapa { margin: 0; padding: 0; overflow: hidden; }
.mapa svg { display: block; width: 100%; height: auto; background: #E9EEE6; }
.mapa__pie { padding: 8px 14px; font-size: 13px; color: var(--follaje); }
.mapa .m-zona { fill: rgb(126 154 118 / 45%); stroke: var(--verde); stroke-width: 2; stroke-dasharray: 6 4; }
.mapa .m-precision { fill: rgb(42 115 119 / 16%); stroke: var(--agua); stroke-width: 1; }
.mapa .m-punto { fill: var(--verde); stroke: #FFFFFF; stroke-width: 3; }
.mapa .m-escala { stroke: var(--grafito); stroke-width: 2; }
.mapa .m-texto { font: 500 11px var(--mono); fill: var(--grafito); }

/* Selfie (sin reconocimiento facial) */
.selfie { display: flex; flex-direction: column; gap: 10px; }
.selfie__marco { position: relative; width: 100%; aspect-ratio: 4 / 3; border-radius: var(--radio-chico); overflow: hidden; background: #2B302D; }
.selfie__video, .selfie__foto { width: 100%; height: 100%; object-fit: cover; display: block; }
.selfie__video { transform: scaleX(-1); }   /* espejo solo en la vista previa en vivo */
.selfie__botones { display: flex; flex-wrap: wrap; gap: 8px; }
.selfie__botones > * { flex: 1 1 140px; }

.resultado { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; }
.resultado__icono { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; font-size: 34px; font-weight: 600; background: var(--ok-fondo); color: var(--ok-texto); }
.resultado__icono[data-tipo="guardado"] { background: var(--aviso-fondo); color: var(--aviso-texto); }
.resultado__icono[data-tipo="error"] { background: var(--critico-fondo); color: var(--critico-texto); }
.resultado__titulo { font-size: 22px; font-weight: 600; }
.resultado__lista { width: 100%; text-align: left; }
.pantalla-centrada {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px;
  padding: calc(24px + env(safe-area-inset-top)) 16px calc(24px + env(safe-area-inset-bottom));
  text-align: center;
}
.pantalla-centrada > .tarjeta, .pantalla-centrada > .lista-opciones, .pantalla-centrada > .boton { width: 100%; }
.logo { width: 96px; height: 96px; border-radius: 24px; box-shadow: var(--sombra); }
/* Nombre de la app en la pantalla de acceso */
.marca { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.marca__nombre { font-size: 30px; font-weight: 600; line-height: 1.1; color: var(--verde); letter-spacing: -.01em; }
.marca__sub { font-size: 15px; color: var(--follaje); }
.centrado { text-align: center; }
.encabezado {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: calc(16px + env(safe-area-inset-top)) 20px 12px;
}
.encabezado__org { font-size: 13px; color: var(--follaje); }
.encabezado__titulo { font-size: 22px; font-weight: 600; line-height: 1.2; }
.encabezado__envio { margin-top: 6px; }
.avatar {
  flex: none;
  width: var(--tactil); height: var(--tactil);
  border-radius: 50%;
  display: grid; place-items: center;
  background: var(--salvia); color: var(--blanco);
  font-weight: 600; font-size: 15px;
  border: 0;
}
.contenido { flex: 1; padding: 4px 16px 24px; display: flex; flex-direction: column; gap: 12px; }
.vista { display: flex; flex-direction: column; gap: 12px; }

/* ---------- Tarjetas ---------- */
.tarjeta {
  background: var(--blanco);
  border-radius: var(--radio);
  box-shadow: var(--sombra);
  padding: 16px;
}
.tarjeta__etiqueta { font-size: 13px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--follaje); }
.horas { display: flex; align-items: baseline; gap: 6px; margin-top: 6px; }
.horas__valor { font-size: 44px; font-weight: 600; line-height: 1; color: var(--verde); font-variant-numeric: tabular-nums; }
.horas__unidad { font-size: 18px; color: var(--follaje); }
.horas__chip { margin-left: auto; align-self: center; }
.acciones-secundarias { display: flex; flex-direction: column; gap: 8px; }
.acciones-secundarias:empty { display: none; }
#alertas-jornada:empty { display: none; }
.barra { height: 8px; border-radius: 4px; background: var(--neutro-fondo); margin: 12px 0 8px; overflow: hidden; }
.barra__relleno { height: 100%; width: 0; background: var(--salvia); border-radius: 4px; transition: width .3s; }

.lista { list-style: none; margin: 0; padding: 0; }
.lista__fila { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; min-height: var(--tactil); }
.lista__fila + .lista__fila { border-top: 1px solid var(--linea); }
.lista__titulo { font-weight: 500; }
.lista__detalle { font-size: 13px; color: var(--follaje); }

.lista__valor { text-align: right; overflow-wrap: anywhere; color: var(--follaje); }

/* ---------- Formularios ---------- */
.formulario { display: flex; flex-direction: column; gap: 16px; text-align: left; }
.campo { display: flex; flex-direction: column; gap: 6px; }
.campo__etiqueta { font-size: 14px; font-weight: 500; }
.campo__fila { display: flex; gap: 8px; }
.campo__entrada {
  flex: 1; min-width: 0;
  min-height: var(--tactil); padding: 10px 12px;
  border: 1.5px solid #B9B3A3; border-radius: var(--radio-chico);
  background: var(--blanco); font-size: 16px;   /* 16 px evita el zoom automático en iOS */
}
.campo__entrada:focus { border-color: var(--verde); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--verde) 18%, transparent); }

.lista-opciones { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.opcion {
  width: 100%; min-height: 64px; padding: 12px 16px;
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  border: 1.5px solid var(--linea); border-radius: var(--radio);
  background: var(--blanco); text-align: left; box-shadow: var(--sombra);
}
.opcion__titulo { font-weight: 600; font-size: 17px; }
.opcion__detalle { font-size: 13px; color: var(--follaje); }
/* Opciones con radio (formulario de corrección): toda la tarjeta es el área táctil */
.campo--grupo { border: 0; margin: 0; padding: 0; min-width: 0; }
.campo--grupo > legend { padding: 0; margin-bottom: 6px; }
.opcion--radio { position: relative; min-height: 56px; cursor: pointer; padding-left: 48px; }
.opcion--radio input { position: absolute; left: 16px; top: 50%; translate: 0 -50%; width: 20px; height: 20px; margin: 0; accent-color: var(--verde); }
.opcion--radio:has(input:checked) { border-color: var(--verde); box-shadow: 0 0 0 2px color-mix(in srgb, var(--verde) 25%, transparent); }
.opcion--radio:has(input:focus-visible) { outline: 3px solid color-mix(in srgb, var(--verde) 35%, transparent); outline-offset: 2px; }
.opcion--radio .opcion__titulo { font-size: 16px; }
.solicitud__comentario { font-size: 13px; color: var(--grafito); margin-top: 4px; }

/* ---------- Mis horas (semana) ---------- */
.dia__derecha { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.dia__horas { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 15px; min-width: 3.2em; text-align: right; }
.dia--hoy .lista__titulo { color: var(--verde); }
/* Días por venir: en tono secundario (antes con transparencia, no alcanzaba el contraste mínimo) */
.dia--futuro .lista__titulo, .dia--futuro .dia__horas { color: var(--follaje); font-weight: 400; }

/* ---------- Catálogo de parques ---------- */
.catalogo { display: flex; flex-direction: column; gap: 12px; }
.catalogo__cabecera { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.sitio__clave { font-family: var(--mono); font-size: 13px; color: var(--follaje); white-space: nowrap; }

/* ---------- Chips de estado ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 999px;
  font-size: 13px; font-weight: 500; white-space: nowrap;
  background: var(--neutro-fondo); color: var(--neutro-texto);
}
.chip--ok      { background: var(--ok-fondo);      color: var(--ok-texto); }
.chip--aviso   { background: var(--aviso-fondo);   color: var(--aviso-texto); }
.chip--critico { background: var(--critico-fondo); color: var(--critico-texto); }
.chip--ok::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }

/* ---------- Botones ---------- */
.boton {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--tactil); padding: 10px 18px;
  border-radius: var(--radio-chico);
  border: 2px solid var(--verde);
  background: transparent; color: var(--verde);
  font-weight: 600; font-size: 16px; text-decoration: none;
}
.boton--lleno { background: var(--verde); color: var(--blanco); }
.boton--tierra { background: var(--tierra); border-color: var(--tierra); color: var(--blanco); }
.boton--ancho { width: 100%; }
.boton--chico { min-width: var(--tactil); padding: 6px 12px; font-size: 14px; }
.boton:disabled { opacity: .5; cursor: not-allowed; }
/* Acciones delicadas (dar de baja, cerrar sesión, rechazar): contorno, nunca el botón más llamativo */
.boton--delicado { border-color: var(--tierra); color: var(--tierra); background: transparent; }
/* Acción de salida sin peso visual (Cancelar) */
.boton--texto { border-color: transparent; background: transparent; color: var(--verde); text-decoration: underline; text-underline-offset: 3px; }
/* Efecto al tocar: el botón "se hunde" un poco (se desactiva con «reducir movimiento») */
.boton, .boton-principal, .opcion, .nav__boton, .avatar { transition: transform .12s ease-out, background-color .15s ease-out, box-shadow .15s ease-out; }
.boton:not(:disabled):active, .boton-principal:not(:disabled):active, .opcion:active, .nav__boton:active { transform: scale(.97); }
.boton:not(:disabled):active { background-color: color-mix(in srgb, var(--verde) 10%, transparent); }
.boton--lleno:not(:disabled):active { background-color: var(--verde-oscuro); }

.boton-principal {
  width: 100%;
  min-height: 88px;
  padding: 16px 20px;
  border: 0;
  border-radius: 20px;
  background: var(--verde);
  color: var(--blanco);
  box-shadow: 0 6px 16px color-mix(in srgb, var(--verde) 25%, transparent);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  text-align: center;
}
.boton-principal__texto { font-size: 21px; font-weight: 600; line-height: 1.2; }
.boton-principal__detalle { font-size: 14px; opacity: .92; }
.boton-principal:not(:disabled):active { background: var(--verde-oscuro); }
/* Apagado se ve apagado (antes parecía activo); el motivo se explica en texto junto al botón */
.boton-principal:disabled { background: var(--neutro-fondo); color: var(--follaje); box-shadow: none; cursor: not-allowed; }
.boton-principal--pie { min-height: 64px; border-radius: 16px; }
.boton-principal[aria-busy="true"] { cursor: progress; }

/* ---------- Pantalla de checada ---------- */
/* Estado de la ubicación: arriba, con un indicador que gira mientras busca */
.estado-gps { display: flex; align-items: center; gap: 10px; min-height: 24px; font-size: 14px; font-weight: 500; color: var(--follaje); }
.estado-gps:empty { display: none; }
.estado-gps::before { content: ''; flex: none; width: 14px; height: 14px; border-radius: 50%; background: var(--ok); }
.estado-gps[data-buscando="true"]::before { background: none; border: 2.5px solid var(--linea); border-top-color: var(--verde); animation: girar .8s linear infinite; }
@keyframes girar { to { transform: rotate(360deg); } }
/* Ubicación y detalles plegables */
.detalles { padding: 0; overflow: hidden; }
.detalles__resumen { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 52px; padding: 12px 16px; cursor: pointer; list-style: none; }
.detalles__resumen::-webkit-details-marker { display: none; }
.detalles__resumen::after { content: ''; flex: none; width: 9px; height: 9px; border-right: 2px solid var(--follaje); border-bottom: 2px solid var(--follaje); transform: rotate(45deg) translate(-2px, -2px); transition: transform .15s; }
.detalles[open] > .detalles__resumen::after { transform: rotate(-135deg) translate(-2px, -2px); }
.detalles__titulo { font-weight: 500; white-space: nowrap; }
.detalles__dato { margin-left: auto; font-size: 13px; color: var(--follaje); text-align: right; overflow-wrap: anywhere; }
.detalles > .lista { padding: 0 16px 4px; }
/* Barra fija: confirmar al alcance del pulgar */
.checada__pie {
  position: sticky; bottom: 0; z-index: 5;
  margin: auto -16px -24px; padding: 10px 16px calc(8px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 6px;
  background: var(--hueso); border-top: 1px solid var(--linea);
  box-shadow: 0 -6px 16px rgb(25 29 27 / 6%);
}
.checada__motivo { font-size: 14px; font-weight: 500; color: var(--aviso-texto); text-align: center; }
.checada__motivo:empty { display: none; }

/* ---------- Avisos ---------- */
.aviso {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px 14px; border-radius: var(--radio-chico);
  background: var(--aviso-fondo); color: var(--aviso-texto); font-size: 14px;
}
.aviso--critico { background: var(--critico-fondo); color: var(--critico-texto); }
.aviso--ok { background: var(--ok-fondo); color: var(--ok-texto); }

/* Barra de nueva versión */
.actualizacion {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--alto-nav) + 12px + env(safe-area-inset-bottom));
  width: min(448px, calc(100% - 32px));
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 12px 10px 16px; border-radius: var(--radio-chico);
  background: var(--grafito); color: var(--blanco); font-size: 14px;
  box-shadow: var(--sombra); z-index: 20;
}
.actualizacion .boton { border-color: var(--blanco); color: var(--blanco); min-height: 40px; padding: 6px 14px; }

/* ---------- Navegación inferior ---------- */
.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  background: var(--blanco);
  border-top: 1px solid var(--linea);
  padding-bottom: env(safe-area-inset-bottom);
}
.nav__lista { max-width: 480px; margin: 0 auto; display: grid; grid-template-columns: repeat(4, 1fr); list-style: none; padding: 0; }
.nav__boton {
  width: 100%; height: var(--alto-nav);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  border: 0; background: none; color: var(--follaje);
  font-size: 13px; text-decoration: none;
}
.nav__boton svg { width: 24px; height: 24px; }
.nav__boton[aria-current="page"] { color: var(--verde); font-weight: 600; }

/* ---------- Panel de coordinación (panel.html) ---------- */
.app--panel { max-width: 1040px; }
.panel__cabecera { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; }
.panel__titulo { font-size: 18px; font-weight: 600; }
.panel__filtros { display: flex; flex-wrap: wrap; gap: 8px; }
.panel__filtros [aria-selected="true"] { background: var(--verde); color: var(--blanco); }
.panel__lista { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); gap: 12px; align-items: start; }
.incidencia { display: flex; flex-direction: column; gap: 6px; }
.incidencia__cabecera { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; margin-bottom: 2px; }
.incidencia__cabecera .chip { white-space: normal; text-align: right; }
.incidencia__linea { font-size: 14px; overflow-wrap: anywhere; }
.incidencia__etiqueta { color: var(--follaje); }
.incidencia__botones { display: flex; gap: 8px; }
.incidencia__botones > * { flex: 1; }

/* Tablero del día (HU-27) */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); gap: 12px; }
@media (max-width: 479px) { .kpis { grid-template-columns: 1fr 1fr; } .kpi__valor { font-size: 24px; white-space: nowrap; } .kpi__de { font-size: 14px; } }
.kpi { display: flex; flex-direction: column; gap: 2px; }
.kpi__etiqueta { font-size: 13px; font-weight: 500; color: var(--follaje); }
.kpi__valor { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 32px; font-weight: 500; line-height: 1.15; color: var(--grafito); }
.kpi__de { font-size: 18px; color: var(--follaje); }
.kpi__detalle { font-size: 13px; color: var(--follaje); }
.kpi__detalle a { color: var(--verde); }
.tabla__marco { overflow-x: auto; margin: -4px; padding: 4px; }
.tabla { width: 100%; border-collapse: collapse; font-size: 14px; }
.tabla thead th { text-align: left; font-size: 13px; font-weight: 500; color: var(--follaje); padding: 8px 10px; border-bottom: 1px solid var(--linea); white-space: nowrap; }
.tabla td, .tabla tbody th { padding: 10px; text-align: left; border-bottom: 1px solid var(--linea); vertical-align: middle; }
.tabla tbody tr:last-child > * { border-bottom: 0; }
.tabla tbody tr:hover { background: color-mix(in srgb, var(--verde) 4%, transparent); }
.tabla .tabla__num { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
.tabla__persona { font-weight: 500; }
.tabla__sub { display: block; font-size: 13px; color: var(--follaje); font-weight: 400; }
@media (max-width: 599px) {
  /* En celular cada persona es una ficha: nombre y estado arriba, entrada · lugar · horas abajo */
  .tabla thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .tabla tbody tr { display: grid; grid-template-columns: 1fr auto; column-gap: 12px; row-gap: 2px; padding: 10px 0; border-bottom: 1px solid var(--linea); }
  .tabla tbody tr:last-child { border-bottom: 0; }
  .tabla tbody tr > * { padding: 0; border-bottom: 0; }
  .tabla tbody th { grid-column: 1; grid-row: 1; }
  .tabla tbody td:nth-child(5) { grid-column: 2; grid-row: 1; justify-self: end; }
  .tabla tbody td:nth-child(2), .tabla tbody td:nth-child(3), .tabla tbody td:nth-child(4) { grid-column: 1 / -1; font-size: 13px; text-align: left; }
  .tabla tbody td[data-etiqueta]::before { content: attr(data-etiqueta) ': '; color: var(--follaje); font-family: var(--sans); }
  .tabla tbody td[colspan] { grid-column: 1 / -1; }
}
.tabla thead .tabla__num { font-family: var(--sans); }

/* Métricas (HU-39): patrones de tablero (indicador con estado, gráficas, lista de atención) */
.kpi__etiqueta { display: flex; align-items: center; justify-content: space-between; gap: 6px; flex-wrap: wrap; }
.kpi__etiqueta .chip { font-size: 12px; padding: 2px 8px; }
.graficas { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: 12px; align-items: start; }
.grafica-tarjeta { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.grafica-tarjeta__titulo { font-size: 15px; font-weight: 600; }
.grafica { display: block; width: 100%; height: auto; overflow: visible; font-family: var(--sans); }
.grafica-vacia { padding: 24px 0; text-align: center; }
.grafica .g-rejilla { stroke: var(--linea); stroke-width: 1; }
.grafica .g-eje { font-size: 13px; fill: var(--follaje); }
.grafica .g-eje--nombre { fill: var(--grafito); }
.grafica .g-valor { font: 500 13px var(--mono); fill: var(--grafito); }
.grafica .g-serie { fill: var(--agua); }
.grafica .g-linea { fill: none; stroke: var(--agua); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.grafica .g-punto { fill: var(--agua); stroke: var(--blanco); stroke-width: 2; }
.grafica .g-toque { fill: transparent; }
.grafica .g-meta { stroke: var(--tierra); stroke-width: 2; stroke-dasharray: 5 4; }
.grafica .g-meta-texto { font-size: 13px; font-weight: 600; fill: var(--tierra); }
.g-ok { fill: var(--serie-ok); background: var(--serie-ok); }
.g-aviso { fill: var(--serie-aviso); background: var(--serie-aviso); }
.g-critico { fill: var(--serie-critico); background: var(--serie-critico); }
.grafica rect:hover, .grafica .g-toque:hover { opacity: .85; }
.leyenda { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; color: var(--follaje); }
.leyenda li { display: inline-flex; align-items: center; gap: 6px; }
.leyenda__marca { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.tabla--datos { font-size: 13px; }
@media (max-width: 599px) { .tabla--datos thead { position: static; width: auto; height: auto; overflow: visible; clip: auto; } .tabla--datos tbody tr { display: table-row; padding: 0; } .tabla--datos tbody tr > * { padding: 6px 8px; border-bottom: 1px solid var(--linea); } }
.atencion .lista__fila { align-items: center; }
.atencion__enlace { display: flex; flex-direction: column; gap: 2px; min-height: var(--tactil); justify-content: center; color: inherit; text-decoration: none; flex: 1; min-width: 0; }
.atencion__enlace:hover .lista__titulo { text-decoration: underline; }
.atencion .chip { white-space: nowrap; }

/* Mapa con polígonos (HU-25) · Leaflet. isolation: sus capas no tapan el menú fijo del panel */
.mapa-tarjeta { display: flex; flex-direction: column; gap: 10px; }
.mapa-real { height: 440px; border-radius: var(--radio-chico); overflow: hidden; background: #E9EEE6; position: relative; z-index: 0; isolation: isolate; font-family: var(--sans); }
@media (max-width: 599px) { .mapa-real { height: 360px; } }
.mapa-real .mapa-sitio { fill: var(--salvia); fill-opacity: .35; stroke: var(--verde); stroke-width: 2; stroke-dasharray: 6 4; }
.mapa-real .mapa-checada { stroke: var(--blanco); stroke-width: 3; fill-opacity: 1; }
.mapa-real .mapa-checada--dentro { fill: var(--serie-ok); }
.mapa-real .mapa-checada--fuera { fill: var(--serie-critico); }
.mapa-real .mapa-checada--sin-zona { fill: var(--agua); }
.mapa-real .mapa-precision { stroke-dasharray: 3 3; fill-opacity: .12; }
.mapa-real .mapa-precision--dentro { fill: var(--serie-ok); stroke: var(--serie-ok); }
.mapa-real .mapa-precision--fuera { fill: var(--serie-critico); stroke: var(--serie-critico); }
.mapa-real .mapa-precision--sin-zona { fill: var(--agua); stroke: var(--agua); }
.mapa-real .leaflet-popup-content { margin: 12px 14px; font-size: 14px; line-height: 1.45; }
.mapa-ventana p { margin: 0; }
.mapa-ventana__titulo { font-weight: 600; margin-bottom: 4px !important; }
.mapa-ventana a { display: inline-block; margin-top: 6px; color: var(--verde); font-weight: 600; }
.mapa-real .leaflet-control-zoom a { width: 36px; height: 36px; line-height: 36px; }
.leyenda__marca--punto { border-radius: 50%; }
.leyenda__marca--sin-zona { background: var(--agua); }
.leyenda__marca--sitio { background: rgb(126 154 118 / 35%); border: 2px dashed var(--verde); border-radius: 2px; }
.campo--en-linea { flex-direction: row; align-items: center; gap: 8px; }
.campo--en-linea .campo__entrada { min-width: 0; }

/* Bandeja de revisión (HU-23) */
.revision__motivos { display: flex; flex-wrap: wrap; gap: 6px; }
.revision__selfie { width: 100%; max-width: 240px; aspect-ratio: 4 / 3; object-fit: cover; border-radius: var(--radio-chico); background: #2B302D; }

/* Reportes (HU-31) */
.reportes { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr)); gap: 12px; align-items: end; }
.reportes__persona { grid-column: span 2; }
.reportes__botones, .reportes__error { grid-column: 1 / -1; }
.reportes__botones { display: flex; flex-wrap: wrap; gap: 8px; }
.reportes__botones > * { flex: 1 1 240px; }
@media (max-width: 479px) { .reportes__persona { grid-column: 1 / -1; } }

/* Mi registro (HU-16) */
.mi-registro { gap: 10px; margin-top: 8px; }
.observadas__titulo { margin-top: 16px; }
.mi-registro .campo__fila { flex-wrap: wrap; }
.mi-registro .campo__fila > .campo { flex: 1 1 140px; min-width: 0; }
.mi-registro input[type="date"] { width: 100%; min-width: 0; }
.recordatorio__boton { margin-top: 10px; }

/* Menú de secciones del panel: fijo arriba, útil sobre todo en el celular */
.panel__menu { position: sticky; top: 0; z-index: 5; display: flex; gap: 4px; overflow-x: auto; padding: 8px 16px; background: var(--hueso); border-bottom: 1px solid var(--linea); }
.panel__menu a { flex: 1 0 auto; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: var(--tactil); padding: 0 12px; border-radius: var(--radio-chico); color: var(--verde); font-weight: 600; font-size: 15px; text-decoration: none; }
.panel__menu a:hover, .panel__menu a:focus-visible { background: color-mix(in srgb, var(--verde) 8%, transparent); }
.panel__cuenta:not(:empty) { min-width: 22px; padding: 1px 7px; border-radius: 999px; background: var(--critico-fondo); color: var(--critico-texto); font-size: 13px; font-family: var(--mono); text-align: center; }
.panel__seccion { scroll-margin-top: 72px; }
html:has(.app--panel) { scroll-behavior: smooth; }
/* Ayudas del panel: una línea y el resto en «Más información» */
.ayuda { font-size: 13px; color: var(--follaje); }
.ayuda > summary { display: inline-flex; align-items: center; min-height: var(--tactil); cursor: pointer; color: var(--verde); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.ayuda > p { margin-top: 2px; }
.ayuda > p + p { margin-top: 6px; }
@media (max-width: 479px) {
  .panel__menu { gap: 0; padding: 6px 8px; }
  .panel__menu a { flex: 1 1 auto; padding: 0 6px; gap: 4px; font-size: 14px; }
  .panel__cuenta:not(:empty) { min-width: 20px; padding: 1px 5px; }
}

/* Personas (HU-09) */
.horario-editor { border: 1px solid var(--linea); border-radius: var(--radio-chico); padding: 10px 12px; margin: 0; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.horario-editor__bloque { display: flex; flex-direction: column; gap: 6px; }
.horario-editor__dias { display: flex; flex-wrap: wrap; gap: 6px; }
.dia-chip { position: relative; display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; padding: 0 8px;
  border: 1.5px solid var(--linea); border-radius: var(--radio-chico); background: var(--blanco); font-weight: 600; cursor: pointer; }
.dia-chip input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.dia-chip:has(input:checked) { background: var(--verde); border-color: var(--verde); color: var(--blanco); }
.dia-chip:has(input:focus-visible) { outline: 3px solid color-mix(in srgb, var(--verde) 35%, transparent); outline-offset: 2px; }
.horario-editor__horas { flex-wrap: wrap; }
.horario-editor__horas > .campo { flex: 1 1 100px; min-width: 0; }
.alta__fila { flex-wrap: wrap; }
.alta__fila > .campo { flex: 1 1 160px; min-width: 0; }
.alta__contrasena { font-size: 20px; letter-spacing: .05em; margin-top: 4px; }
.personas__botones { flex-wrap: wrap; }
.personas__botones > * { flex: 1 1 140px; }
.personas__edicion { display: flex; flex-direction: column; gap: 10px; margin-top: 4px; }
.personas__delicado { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; padding-top: 12px; border-top: 1px solid var(--linea); }

/* Perfil: cerrar sesión separado del resto */
.perfil__salir { margin-top: 16px; }

/* ---------- Reducir movimiento (ajuste del teléfono) ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
  .boton:active, .boton-principal:active, .opcion:active, .nav__boton:active { transform: none !important; }
  .estado-gps[data-buscando="true"]::before { border-color: var(--verde); }
}

/* Respaldos (HU-34) */
.respaldos__fechas { flex-wrap: wrap; }
.respaldos__fechas > .campo { flex: 1 1 140px; min-width: 0; }
.respaldo__huella { font-size: 13px; color: var(--follaje); white-space: nowrap; }

/* Marca por organización (HU-11) */
.marca__fila, .marca__botones { flex-wrap: wrap; align-items: flex-end; }
.marca__fila > .campo { flex: 1 1 140px; min-width: 0; }
.marca__selector { flex: 0 0 96px !important; }
.marca__muestra { padding: 4px; height: var(--tactil); width: 100%; cursor: pointer; background: var(--blanco); }
.marca__muestra::-webkit-color-swatch-wrapper { padding: 0; }
.marca__muestra::-webkit-color-swatch { border: 0; border-radius: 6px; }
.marca__muestra::-moz-color-swatch { border: 0; border-radius: 6px; }
.marca__botones > .boton { flex: 1 1 180px; }
.marca__vista { --muestra: var(--verde); display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; padding: 14px; border-radius: var(--radio-chico); background: var(--hueso); }
.marca__boton { display: inline-flex; align-items: center; min-height: var(--tactil); padding: 10px 18px; border-radius: var(--radio-chico); background: var(--muestra); color: var(--blanco); font-weight: 600; }
.marca__enlace { color: var(--muestra); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.marca__error { color: var(--critico-texto); font-weight: 500; }
