/* ============================================================================
   MorenoTrans — estilos (rediseño de noviembre de 2026)

   Para usar con una mano, de pie y con prisa:
     · lo que se pulsa de verdad mide 52-56 px o más;
     · cabeceras en grafito con el rojo del logo, contenido claro en tarjetas;
     · colores con significado: ámbar = por cargar, verde = hecho / cargado,
       azul = recogidas apuntadas, y palets en azul / bultos en marrón;
     · efectos solo con transform y opacity (no cargan los móviles modestos),
       y ninguno si el móvil pide menos animaciones (al final del archivo).
   ========================================================================== */

/* ─────────────────────────── TOKENS ─────────────────────────── */
:root {
  --bg:        #f1f2f5;
  --card:      #ffffff;
  --card-2:    #f6f7f9;
  --card-3:    #eceef2;
  --text:      #121418;
  --muted:     #626977;
  --muted-2:   #8d939d;
  --line:      #e4e7ec;
  --line-2:    #d3d8df;

  /* Marca: el grafito y el rojo del icono. */
  --marca:       #e12a34;
  --marca-2:     #c11f29;
  --marca-suave: rgba(225, 42, 52, .12);
  --grafito:     #15171c;
  --grafito-2:   #20242b;
  --sobre-oscuro:   #f4f5f7;
  --sobre-oscuro-2: #a9b0bb;
  --cristal:        rgba(255, 255, 255, .07);
  --cristal-borde:  rgba(255, 255, 255, .10);

  --verde:     #16a34a;
  --verde-2:   #12863d;
  --verde-txt: #15803d;
  --ambar:     #f59e0b;
  --ambar-txt: #a1520a;
  --azul:      #2563eb;
  --azul-txt:  #1d4ed8;
  --rojo:      #dc2626;

  /* Palets y bultos en color para distinguirlos de un vistazo. En claro van
     un punto más hondos para que se lean sobre blanco. */
  --palet:     #0277b3;
  --bulto:     #7a4a1f;
  /* Los mismos, para leerse sobre las cabeceras oscuras. */
  --palet-claro: #7dd3fc;
  --bulto-claro: #e2b07a;

  --tap:     56px;
  --radio:   18px;
  --radio-s: 13px;
  --tabbar:  64px;

  --pad-top:    env(safe-area-inset-top, 0px);
  --pad-bottom: env(safe-area-inset-bottom, 0px);
  --pad-left:   env(safe-area-inset-left, 0px);
  --pad-right:  env(safe-area-inset-right, 0px);

  --sombra-1: 0 1px 2px rgba(16, 19, 26, .05), 0 2px 8px rgba(16, 19, 26, .04);
  --sombra-2: 0 4px 10px rgba(16, 19, 26, .06), 0 14px 34px rgba(16, 19, 26, .12);
  --sombra-3: 0 -8px 40px rgba(10, 12, 16, .25);

  --suave: cubic-bezier(.2, .9, .25, 1);     /* frena al llegar */
  --pop:   cubic-bezier(.34, 1.56, .64, 1);  /* se pasa un poco y vuelve */
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:      #0b0c0f;
    --card:    #16191e;
    --card-2:  #1d2128;
    --card-3:  #262b33;
    --text:    #f2f4f7;
    --muted:   #9ba3b0;
    --muted-2: #6e7682;
    --line:    #252a32;
    --line-2:  #333a45;

    --marca:       #ff4e57;
    --marca-2:     #e5363f;
    --marca-suave: rgba(255, 78, 87, .16);
    --grafito:     #101216;
    --grafito-2:   #1a1d23;

    --verde:     #22c55e;
    --verde-2:   #16a34a;
    --verde-txt: #4ade80;
    --ambar:     #fbbf24;
    --ambar-txt: #fbbf24;
    --azul:      #60a5fa;
    --azul-txt:  #93c5fd;
    --rojo:      #f87171;

    --palet:     #7dd3fc;
    --bulto:     #d9a066;

    --sombra-1: 0 1px 2px rgba(0, 0, 0, .5);
    --sombra-2: 0 6px 24px rgba(0, 0, 0, .6);
    --sombra-3: 0 -8px 40px rgba(0, 0, 0, .7);
  }
}

/* ─────────────────────────── BASE ─────────────────────────── */
* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
}

body {
  font: 400 16px/1.35 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto,
        "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
  /* hueco para la barra de pestañas flotante */
  padding-bottom: calc(var(--tabbar) + 26px + var(--pad-bottom));
}

body.bloqueado { overflow: hidden; }

button, input, select, textarea {
  font: inherit;
  color: inherit;
  touch-action: manipulation;
}

button {
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  transition: transform .14s var(--suave), background-color .18s ease, color .18s ease, border-color .18s ease;
}

button:disabled { cursor: default; }

/* El atributo `hidden` se aplica con display:none desde la hoja del navegador,
   así que CUALQUIER regla de autor que fije `display` lo anula en silencio. */
[hidden] { display: none !important; }

svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  display: block;
  flex: 0 0 auto;
}

/* Nada de texto seleccionable en los controles: al pulsar rápido y repetido
   iOS/Android sacan el menú de selección y estorban. */
.hero, .topbar, .fila, .sheet, .tabbar, .toast, .tabla, .cg, .minibar { user-select: none; -webkit-user-select: none; }
input, textarea, .leyenda { user-select: text; -webkit-user-select: text; }

:focus-visible {
  outline: 3px solid var(--azul);
  outline-offset: 2px;
}

/* ─────────────────────────── PANTALLAS ─────────────────────────── */
.pantalla { display: block; }

/* ─────────────────────────── CABECERA GRANDE (HOY) ─────────────────────────── */
.hero {
  position: relative;
  overflow: hidden;
  color: var(--sobre-oscuro);
  background:
    radial-gradient(130% 100% at 108% -10%, rgba(225, 42, 52, .34) 0%, rgba(225, 42, 52, 0) 52%),
    linear-gradient(165deg, #22262e 0%, #15171c 62%, #111317 100%);
  padding: calc(14px + var(--pad-top)) calc(16px + var(--pad-right)) 16px calc(16px + var(--pad-left));
  border-radius: 0 0 28px 28px;
  box-shadow: 0 8px 24px rgba(10, 12, 16, .18);
}

/* El trazo rojo del icono, muy discreto, rozando la esquina de la cabecera
   (por encima de la fecha cruzaba el texto). */
.hero::after {
  content: "";
  position: absolute;
  right: -62%;
  top: -34px;
  width: 120%;
  height: 150px;
  border-bottom: 2px solid rgba(225, 42, 52, .42);
  border-radius: 50%;
  transform: rotate(-12deg);
  pointer-events: none;
}

.hero > * { position: relative; z-index: 1; }

.hero-fila {
  display: flex;
  align-items: center;
  gap: 11px;
}

.marca-logo {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border-radius: 13px;
  object-fit: cover;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .08), 0 4px 12px rgba(0, 0, 0, .35);
}

.hero-tit { flex: 1; min-width: 0; }

.marca {
  margin: 0;
  font-size: 21px;
  font-weight: 800;
  letter-spacing: -.02em;
  line-height: 1.1;
}

.hero-fecha {
  margin: 2px 0 0;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--sobre-oscuro-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.icon-btn {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  color: var(--text);
}

.icon-btn:active { background: var(--card-3); transform: scale(.92); }

.icon-btn-claro { color: var(--sobre-oscuro); background: var(--cristal); }
.icon-btn-claro:active { background: rgba(255, 255, 255, .16); }

/* ─── Estado de la sincronización ─── */
.estado-red {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: 12px 0 0;
  padding: 5px 11px 5px 9px;
  border-radius: 999px;
  background: var(--cristal);
  border: 1px solid var(--cristal-borde);
  font-size: 12.5px;
  font-weight: 700;
  color: var(--sobre-oscuro);
  max-width: 100%;
}

.estado-red span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.estado-red i,
.minibar-estado i {
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted-2);
}

[data-estado="ok"] i     { background: #22c55e; box-shadow: 0 0 0 3px rgba(34, 197, 94, .2); }
[data-estado="sync"] i   { background: #60a5fa; animation: latido 1s ease-in-out infinite; }
[data-estado="pend"] i   { background: #fbbf24; box-shadow: 0 0 0 3px rgba(251, 191, 36, .2); }
[data-estado="off"] i    { background: #9aa3b0; }
[data-estado="error"] i  { background: #f87171; }
[data-estado="demo"] i   { background: #c084fc; box-shadow: 0 0 0 3px rgba(192, 132, 252, .22); }

@keyframes latido {
  50% { transform: scale(.6); opacity: .55; }
}

/* ─── Tarjetas del resumen ─── */
.resumen {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
  padding: 10px 11px 10px;
  border-radius: 17px;
  background: var(--cristal);
  border: 1px solid var(--cristal-borde);
  color: inherit;
  text-align: left;
}

.stat:active { transform: scale(.96); background: rgba(255, 255, 255, .13); }

.stat-k {
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--sobre-oscuro-2);
  white-space: nowrap;
}

.stat-n {
  font-size: 30px;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
  color: var(--sobre-oscuro-2);
}

/* Una línea por tipo: «3 Palets» encima de «4 Bultos». */
.stat-sub {
  display: flex;
  flex-direction: column;
  max-width: 100%;
  margin-top: 1px;
  font-size: 12px;
  font-weight: 650;
  line-height: 1.3;
  color: var(--sobre-oscuro-2);
}

.stat-sub > span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stat-pend.activo .stat-n { color: #fbbf24; }
.stat-ok.activo .stat-n   { color: #4ade80; }
.stat-rec.activo .stat-n  { color: #93c5fd; }
.stat-pend.activo { border-color: rgba(251, 191, 36, .32); }

/* Las palabras palet/bulto, legibles sobre el grafito. */
.hero .w-palet, .topbar .w-palet, .minibar .w-palet { color: var(--palet-claro); }
.hero .w-bulto, .topbar .w-bulto, .minibar .w-bulto { color: var(--bulto-claro); }

/* ─── Barra fina al bajar ─── */
.minibar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 32;
  display: flex;
  align-items: center;
  gap: 10px;
  height: calc(50px + var(--pad-top));
  padding: var(--pad-top) calc(14px + var(--pad-right)) 0 calc(14px + var(--pad-left));
  background: rgba(21, 23, 28, .96);
  color: var(--sobre-oscuro);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .22);
  transform: translateY(-110%);
  transition: transform .28s var(--suave);
  pointer-events: none;
}

.minibar.visible { transform: none; }

.minibar-logo { width: 26px; height: 26px; border-radius: 8px; }
.minibar-tit { flex: 1; min-width: 0; font-size: 15px; font-weight: 750; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.minibar-estado { display: grid; place-items: center; width: 22px; height: 22px; }

/* ─────────────────────────── CABECERAS DE LAS DEMÁS PANTALLAS ─────────────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  color: var(--sobre-oscuro);
  background:
    radial-gradient(90% 140% at 110% -40%, rgba(225, 42, 52, .26) 0%, rgba(225, 42, 52, 0) 60%),
    linear-gradient(165deg, #22262e 0%, #15171c 70%);
  padding: calc(12px + var(--pad-top)) calc(16px + var(--pad-right)) 14px calc(16px + var(--pad-left));
  border-radius: 0 0 24px 24px;
  box-shadow: 0 8px 22px rgba(10, 12, 16, .16);
}

.topbar-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand { min-width: 0; flex: 1; }

.brand h1 {
  margin: 0;
  font-size: 25px;
  font-weight: 800;
  letter-spacing: -.02em;
}

.tot {
  margin: 2px 0 0;
  font-size: 13px;
  font-weight: 650;
  color: var(--sobre-oscuro-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tot.activo { color: var(--sobre-oscuro); }

/* ─── Filtros año / mes ─── */
.filtros {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr) auto;
  gap: 8px;
  align-items: end;
  margin-top: 10px;
}

.filtros-1 { grid-template-columns: minmax(0, 170px) auto; justify-content: space-between; }

.btn-descargar { width: 46px; height: 46px; }

.sel {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.sel > span {
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--sobre-oscuro-2);
  margin: 0 0 4px 3px;
}

.sel select {
  width: 100%;
  height: 46px;
  border: 1px solid var(--cristal-borde);
  background-color: var(--cristal);
  color: var(--sobre-oscuro);
  border-radius: 14px;
  padding: 0 34px 0 13px;
  font-size: 15px;
  font-weight: 700;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  /* flecha dibujada en el propio fondo: sin imágenes externas */
  background-image:
    linear-gradient(45deg, transparent 50%, currentColor 50%),
    linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 18px) 21px, calc(100% - 13px) 21px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

.sel select option { color: #121418; background: #ffffff; }
.sel select:disabled { opacity: .5; }
.sel select:focus-visible { border-color: var(--azul); }

.inf-head .tot { margin-top: 10px; }

/* ─────────────────────────── SEGMENTADO ───────────────────────────
   Con <span class="seg-ind"> la pastilla se DESLIZA hasta la opción elegida
   (--i y --n los pone app.js). Sin ella, la opción marcada se pinta sola. */
.segmented {
  position: relative;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  gap: 4px;
  background: var(--card-3);
  border-radius: 14px;
  padding: 4px;
  margin-bottom: 12px;
}

.segmented button {
  position: relative;
  z-index: 1;
  height: 40px;
  border-radius: 11px;
  font-size: 14px;
  font-weight: 750;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 0;
  white-space: nowrap;
}

.segmented button.on { color: var(--text); }

/* Sin pastilla deslizante (el selector Kg / Palets / Bultos). Con una clase
   y no con :has(), que los Android algo antiguos no entienden. */
.seg-simple button.on {
  background: var(--card);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .12);
}

.segmented button:active { transform: scale(.96); }

.seg-ind {
  position: absolute;
  z-index: 0;
  top: 4px;
  bottom: 4px;
  left: 4px;
  width: calc((100% - 8px - (var(--n, 2) - 1) * 4px) / var(--n, 2));
  border-radius: 11px;
  background: var(--card);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .14);
  transform: translateX(calc(var(--i, 0) * (100% + 4px)));
  transition: transform .3s var(--suave);
}

.seg-oscuro { background: rgba(255, 255, 255, .08); margin: 12px 0 0; }
.seg-oscuro button { color: var(--sobre-oscuro-2); }
.seg-oscuro button.on { color: #121418; }
.seg-oscuro .seg-ind { background: #ffffff; }

/* Contadores dentro de una opción del segmentado. */
.seg-n {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--ambar);
  color: #2a1a04;
  font-size: 11px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  display: inline-grid;
  place-items: center;
}

.seg-n-azul { background: var(--azul); color: #ffffff; }

@media (prefers-color-scheme: dark) {
  .seg-n-azul { color: #0b1220; }
}

/* ─────────────────────────── LISTADO DE AGENCIAS ─────────────────────────── */
.lista {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px calc(12px + var(--pad-right)) 6px calc(12px + var(--pad-left));
}

/* Separador de grupo: «Con pendientes», «Anotadas hoy», «Resto». */
.grupo-tit {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 10px 4px 2px;
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--muted);
}

.grupo-tit:first-child { margin-top: 2px; }
.grupo-tit::after { content: ""; flex: 1; height: 1px; background: var(--line-2); }
.grupo-tit b { color: var(--text); font-weight: 800; }

.fila {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 74px;
  padding: 9px 10px 9px 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radio);
  box-shadow: var(--sombra-1);
}

/* Filete a la izquierda: verde si hay algo hoy, ámbar si queda algo por cargar. */
.fila::before {
  content: "";
  position: absolute;
  left: -1px;
  top: 16px;
  bottom: 16px;
  width: 4px;
  border-radius: 0 4px 4px 0;
  background: transparent;
}

.fila.anotada::before { background: var(--verde); }
.fila.con-pend::before { background: var(--ambar); }

/* La zona pulsable "abrir sin llamar": todo menos el botón verde. */
.fila-tap {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  padding: 2px 0;
  border-radius: 12px;
}

.fila-tap:active { transform: scale(.985); }

/* ─── Logo ─── */
.logo {
  flex: 0 0 auto;
  width: 50px;
  height: 50px;
  border-radius: 14px;
  background: #ffffff;          /* fondo blanco fijo: muchos logos son PNG
                                   transparentes pensados para fondo claro */
  border: 1px solid var(--line);
  overflow: hidden;
  display: grid;
  place-items: center;
}

.logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 4px;
}

/* Una FOTO (el icono de los sitios de «Varios») llena el cuadrado entero. */
.logo-foto { background: transparent; }
.logo-foto img { object-fit: cover; padding: 0; }

/* Suplente cuando el archivo no carga: iniciales */
.logo .iniciales {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: .02em;
  color: #ffffff;
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
}

/* ─── Texto de la fila ─── */
.fila-txt {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.fila-txt > * { max-width: 100%; }

.fila-nombre {
  font-size: 16.5px;
  font-weight: 750;
  letter-spacing: -.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Etiquetas de estado debajo del nombre. */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 5px;
  max-width: 100%;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding: 3px 9px 3px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.3;
  background: var(--card-3);
  color: var(--text);
}

.chip > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }

.chip::before {
  content: "";
  flex: 0 0 auto;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted-2);
}

.chip em { font-style: normal; color: var(--muted); font-weight: 700; }

.chip-pend { background: color-mix(in srgb, var(--ambar) 15%, var(--card)); }
.chip-pend::before { background: var(--ambar); }
.chip-ok { background: color-mix(in srgb, var(--verde) 12%, var(--card)); }
.chip-ok::before { background: var(--verde); }
.chip-rec { background: color-mix(in srgb, var(--azul) 12%, var(--card)); }
.chip-rec::before { background: var(--azul); }
.chip-nota::before { display: none; }
.chip-nota { color: var(--muted); font-weight: 600; }

.sin-tel {
  margin-top: 3px;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
}

.sitio-ubi {
  display: block;
  margin-top: 2px;
  font-size: 12.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ─── Botón de llamar ─── */
.btn-llamar,
.btn-mapa {
  flex: 0 0 auto;
  width: 54px;
  height: 54px;
  border-radius: 17px;
  color: #ffffff;
  display: grid;
  place-items: center;
}

.btn-llamar {
  background: linear-gradient(180deg, #22b45a 0%, #15993f 100%);
  box-shadow: 0 4px 12px rgba(22, 163, 74, .32), inset 0 1px 0 rgba(255, 255, 255, .22);
}

.btn-llamar svg, .btn-mapa svg { width: 25px; height: 25px; }

.btn-llamar:active, .btn-mapa:active { transform: scale(.9); }

.btn-llamar:disabled,
.btn-mapa:disabled {
  background: var(--card-3);
  color: var(--muted-2);
  box-shadow: none;
}

.btn-llamar:disabled:active, .btn-mapa:disabled:active { transform: none; }

/* Donde una agencia lleva el verde de llamar, un sitio lleva el azul de
   «cómo llegar»: el color lo distingue sin tener que leer el icono. */
.btn-mapa {
  background: linear-gradient(180deg, #3b82f6 0%, #2563eb 100%);
  box-shadow: 0 4px 12px rgba(37, 99, 235, .3), inset 0 1px 0 rgba(255, 255, 255, .2);
}

/* ─── «Varios»: desplegable con los sitios del día ─── */
.pend.grupo-varios {
  margin-top: 6px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radio);
  box-shadow: var(--sombra-1);
  overflow: hidden;
}

.pend-sum {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 74px;
  padding: 9px 10px 9px 12px;
  list-style: none;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}

/* Safari pinta su propio triángulo si no se le quita por las dos vías. */
.pend-sum::-webkit-details-marker { display: none; }
.pend-sum::marker { content: ""; }

.pend-tit {
  flex: 1;
  min-width: 0;
  font-size: 16.5px;
  font-weight: 750;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pend-n {
  flex: 0 0 auto;
  min-width: 26px;
  height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--ambar);
  color: #2a1a04;
  font-size: 12.5px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  display: grid;
  place-items: center;
}

.pend-n.cero { background: var(--card-3); color: var(--muted); }

.pend-chev {
  width: 20px;
  height: 20px;
  color: var(--muted);
  transition: transform .25s var(--suave);
}

.pend[open] .pend-chev { transform: rotate(180deg); }

.varios-mas {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: var(--ambar);
  color: #2a1a04;
  display: grid;
  place-items: center;
  box-shadow: 0 3px 10px rgba(245, 158, 11, .3);
}

.varios-mas svg { width: 22px; height: 22px; stroke-width: 2.6; }
.varios-mas:active { transform: scale(.9); }

.grupo-varios .pend-body { border-top: 1px solid var(--line); }
.grupo-varios .pend-body .fila {
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
}
.grupo-varios .pend-body .fila + .fila { border-top: 1px solid var(--line); }

.pend-vacio {
  margin: 0;
  padding: 14px 16px 16px;
  font-size: 13.5px;
  color: var(--muted);
  text-align: center;
}

/* ─────────────────────────── PANTALLA CARGA ─────────────────────────── */
.scroll {
  padding: 14px calc(12px + var(--pad-right)) 12px calc(12px + var(--pad-left));
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.carga-lista {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.carga-lista:empty { display: none; }

.cg {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radio);
  box-shadow: var(--sombra-1);
  overflow: hidden;
}

.cg-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 10px 10px 12px;
}

.cg-ag {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 11px;
  text-align: left;
  border-radius: 12px;
}

.cg-ag:active { transform: scale(.98); }

.cg-ag .logo { width: 42px; height: 42px; border-radius: 12px; }

.cg-txt { display: flex; flex-direction: column; min-width: 0; }

.cg-nom {
  font-size: 16px;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Hasta dos líneas: con «Todo cargado» al lado, en una sola se cortaba. */
.cg-sub {
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.cg-items {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 6px;
  padding: 0 10px 10px;
}

/* Agencia con TODO cargado hoy: se queda, apagada y recogida, por si hay
   que desmarcar algo. */
.cg.completa .cg-head { opacity: .75; }
.cg.completa .cg-sub { color: var(--verde-txt); }

.cg-toggle {
  flex: 0 0 auto;
  height: 36px;
  padding: 0 10px;
  border-radius: 11px;
  font-size: 12.5px;
  font-weight: 750;
  color: var(--muted);
}

.carga-rec .card-tit { margin-bottom: 8px; }
/* Al saltar aquí desde la tarjeta «Recogidas», que no quede bajo la cabecera. */
.carga-rec { scroll-margin-top: 96px; }
.carga-rec-lista { display: grid; gap: 6px; }

.crec-ag {
  display: block;
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--azul-txt);
}

/* ─────────────────────────── VACÍO GRANDE ─────────────────────────── */
.vacio-grande {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
  padding: 34px 22px 26px;
  color: var(--muted);
}

.vacio-grande svg {
  width: 30px;
  height: 30px;
  padding: 15px;
  box-sizing: content-box;
  border-radius: 50%;
  background: var(--card);
  color: var(--verde);
  box-shadow: var(--sombra-1);
  margin-bottom: 6px;
}

#notas-vacio svg { color: var(--muted); }

.vacio-grande strong { font-size: 17px; font-weight: 800; color: var(--text); }
.vacio-grande span { font-size: 14px; line-height: 1.5; max-width: 300px; }

.vacio {
  margin: 28px 16px;
  text-align: center;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.5;
}

/* ─────────────────────────── BARRA DE PESTAÑAS ─────────────────────────── */
.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 35;
  padding: 0 calc(10px + var(--pad-right)) calc(8px + var(--pad-bottom)) calc(10px + var(--pad-left));
  pointer-events: none;
}

.tabbar-in {
  pointer-events: auto;
  position: relative;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  height: var(--tabbar);
  padding: 6px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--sombra-2);
}

.tab-ind {
  position: absolute;
  top: 6px;
  bottom: 6px;
  left: 6px;
  width: calc((100% - 12px) / 4);
  border-radius: 18px;
  background: var(--marca-suave);
  transform: translateX(calc(var(--i, 0) * 100%));
  transition: transform .34s var(--suave);
}

.tab {
  position: relative;
  z-index: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border-radius: 18px;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 750;
}

.tab svg { width: 23px; height: 23px; transition: transform .3s var(--pop); }
.tab.on { color: var(--marca); }
.tab.on svg { transform: translateY(-1px) scale(1.08); }
.tab:active { transform: scale(.94); }

.tab-n {
  position: absolute;
  top: 3px;
  left: calc(50% + 5px);
  min-width: 19px;
  height: 19px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--ambar);
  color: #2a1a04;
  border: 2px solid var(--card);
  font-size: 10.5px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  display: grid;
  place-items: center;
  line-height: 1;
}

.tab-n-gris { background: var(--muted-2); color: #ffffff; }

/* ─────────────────────────── TARJETAS ─────────────────────────── */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radio);
  padding: 14px;
  box-shadow: var(--sombra-1);
}

.card.flush { padding: 0; overflow: hidden; }

.card-tit {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 12px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}

.card-tit.pad { padding: 14px 14px 0; margin-bottom: 10px; }
.card-tit svg { width: 17px; height: 17px; }

/* ─────────────────────────── KPIs ─────────────────────────── */
.kpis {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

@media (min-width: 520px) {
  .kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

.kpi {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radio);
  padding: 12px 13px;
  display: flex;
  flex-direction: column;
  min-width: 0;
  box-shadow: var(--sombra-1);
}

.kpi.ancho {
  grid-column: 1 / -1;
  background:
    radial-gradient(120% 140% at 100% 0%, rgba(225, 42, 52, .22) 0%, rgba(225, 42, 52, 0) 60%),
    linear-gradient(165deg, #22262e 0%, #15171c 80%);
  border-color: transparent;
  color: var(--sobre-oscuro);
}

.kpi.ancho .kpi-k { color: var(--sobre-oscuro-2); }
.kpi.ancho .kpi-sub { color: #4ade80; }

.kpi-k {
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--muted);
}

.kpi-v {
  font-size: 25px;
  font-weight: 800;
  line-height: 1.15;
  margin-top: 3px;
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kpi-v em { font-style: normal; font-size: 13px; font-weight: 700; color: var(--muted); }

.kpi-sub { font-size: 12.5px; font-weight: 650; color: var(--verde-txt); margin-top: 2px; }

/* ─────────────────────────── DONUT ─────────────────────────── */
.pie-wrap {
  position: relative;
  width: 100%;
}

/*
 * CORTAR LA HERENCIA DE LA REGLA DE ICONOS: `svg { fill:none; stroke… }` se
 * hereda, y los caminos del donut sin trazo propio salían rayados de blanco.
 */
.pie-wrap svg { width: 100%; height: auto; overflow: visible; stroke: none; stroke-width: 0; }

.pie-tip {
  position: absolute;
  display: none;
  z-index: 5;
  pointer-events: none;
  background: var(--card);
  border: 1px solid var(--line-2);
  border-radius: 12px;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 650;
  line-height: 1.4;
  white-space: nowrap;
  box-shadow: var(--sombra-2);
}

.pie-tip .tip-pct { color: var(--azul-txt); font-weight: 800; }
.pie-tip .tip-extra { color: var(--muted); font-size: 12px; font-weight: 500; }

.pie-legend {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
}

.lg-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 8px;
  border-top: 1px solid var(--line);
  cursor: pointer;
  border-radius: 10px;
  transition: background-color .18s ease;
}

.lg-row.hot { background: var(--card-2); }

.lg-chip {
  flex: 0 0 auto;
  width: 13px;
  height: 13px;
  border-radius: 4px;
}

.lg-lbl {
  flex: 1;
  min-width: 0;
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lg-val {
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.lg-pct {
  font-size: 13px;
  font-weight: 800;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  min-width: 52px;
  text-align: right;
}

.pie-vacio {
  margin: 22px 0 6px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}

/* ─────────────────────────── TABLA ─────────────────────────── */
.scroll-x {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.tabla {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  min-width: 460px;
}

.tabla th,
.tabla td {
  padding: 11px 10px;
  text-align: left;
  border-top: 1px solid var(--line);
  white-space: nowrap;
}

.tabla thead th {
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--card-2);
  position: sticky;
  top: 0;
}

.tabla .num { text-align: right; font-variant-numeric: tabular-nums; }

.tabla .td-ag {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  position: sticky;
  left: 0;
  background: var(--card);
}

.tb-chip {
  flex: 0 0 auto;
  width: 11px;
  height: 11px;
  border-radius: 3px;
}

.tabla tfoot td {
  background: var(--card-2);
  border-top: 2px solid var(--line-2);
}

.tabla tfoot .td-ag { background: var(--card-2); }

.pct-num { display: block; font-weight: 700; }

.pct-barra {
  display: block;
  height: 4px;
  border-radius: 2px;
  background: var(--line);
  margin-top: 4px;
  overflow: hidden;
}

.pct-barra i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--marca), #ff8a5c);
  border-radius: 2px;
}

.td-vacio {
  text-align: center !important;
  color: var(--muted);
  padding: 24px 12px !important;
}

/* ─────────────────────── HISTORIAL: ACORDEÓN POR MESES ───────────────────── */
.mes {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radio);
  box-shadow: var(--sombra-1);
  overflow: hidden;
}

.mes-head {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  min-height: 68px;
  padding: 11px 14px;
  text-align: left;
}

.mes-head:active { background: var(--card-2); }

.mes-head .caret {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: var(--card-3);
  color: var(--muted);
  transition: transform .25s var(--suave);
}

.mes-head .caret svg { width: 18px; height: 18px; }

.mes.abierto .mes-head .caret { transform: rotate(90deg); }

.mes-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.mes-nombre {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -.01em;
}

.mes-nombre .hoy,
.dia-f .hoy {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--marca-suave);
  color: var(--marca);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .06em;
  vertical-align: 2px;
}

.mes-tot {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  margin-top: 2px;
}

.mes-body { border-top: 1px solid var(--line); animation: desplegar .28s var(--suave); }

@keyframes desplegar {
  from { opacity: 0; transform: translateY(-6px); }
}

/* ─── Un día dentro del mes ─── */
.dia-b { padding: 2px 0 9px; }
.dia-b + .dia-b { border-top: 1px solid var(--line); }
.dia-b.es-hoy { box-shadow: inset 4px 0 0 var(--marca); }

.dia-cab {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 8px 6px 14px;
}

.dia-f {
  font-size: 14.5px;
  font-weight: 800;
  flex: 0 0 auto;
  white-space: nowrap;
}

.dia-t {
  flex: 1;
  min-width: 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dia-btns { display: flex; gap: 2px; flex: 0 0 auto; }

.dia-btns button {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  color: var(--muted);
}

.dia-btns button svg { width: 18px; height: 18px; }
.dia-btns button:active { background: var(--card-3); transform: scale(.9); }
.dia-btns button.danger { color: var(--rojo); }

.dia-linea {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 5px 14px 5px 22px;
}

.dia-linea .ag { font-weight: 700; font-size: 14px; flex: 0 0 auto; }

.dia-linea .val {
  font-size: 13px;
  color: var(--muted);
  text-align: right;
  flex: 1;
  min-width: 0;
}

.dia-linea .nt { display: block; font-size: 12px; font-style: italic; }

.dia-rec .val { color: var(--azul-txt); font-weight: 600; }

.mes-pie {
  display: flex;
  gap: 8px;
  padding: 10px 14px 14px;
  border-top: 1px solid var(--line);
}

.mes-pie button {
  flex: 1;
  height: 46px;
  border-radius: 13px;
  background: var(--card-2);
  border: 1px solid var(--line-2);
  font-size: 14px;
  font-weight: 750;
}

.mes-pie button:active { transform: scale(.97); background: var(--card-3); }

/* ─────────────────────────── VELO ─────────────────────────── */
.backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(6, 8, 12, .55);
  opacity: 0;
  transition: opacity .3s ease;
}

.backdrop.visible { opacity: 1; }

/* ─────────────────────────── HOJAS (SHEETS) ─────────────────────────── */
.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  max-height: 94dvh;
  overflow: hidden;
  background: var(--bg);
  border-radius: 26px 26px 0 0;
  box-shadow: var(--sombra-3);
  /* --dy lo mueve el dedo al arrastrar (ver `hacerArrastrable` en app.js). */
  --dy: 0px;
  transform: translateY(calc(100% + 30px + var(--dy)));
  transition: transform .36s var(--suave);
  padding-left: var(--pad-left);
  padding-right: var(--pad-right);
}

.sheet.abierto { transform: translateY(var(--dy)); }

/* Mientras se arrastra con el dedo el movimiento debe ser inmediato */
.sheet.arrastrando { transition: none; }

.grab {
  flex: 0 0 auto;
  padding: 10px 0 4px;
  display: grid;
  place-items: center;
  touch-action: none;
  cursor: grab;
  background: var(--card);
}

.grab span {
  width: 44px;
  height: 5px;
  border-radius: 3px;
  background: var(--line-2);
}

.sheet-head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 12px 12px 14px;
  background: var(--card);
}

.sheet-ident { flex: 1; min-width: 0; }

.sheet-head h2 {
  margin: 0;
  min-width: 0;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sheet-acc {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

/* Botones-pastilla de la cabecera: Llamar y Cómo llegar. */
.chip-acc {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px 0 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 750;
}

.chip-acc svg { width: 16px; height: 16px; stroke-width: 2.3; }
.chip-acc:active { transform: scale(.95); }

.chip-verde { background: color-mix(in srgb, var(--verde) 14%, var(--card)); color: var(--verde-txt); }
.chip-azul  { background: color-mix(in srgb, var(--azul) 13%, var(--card)); color: var(--azul-txt); }

.sheet-tabs-wrap {
  flex: 0 0 auto;
  padding: 0 12px 10px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
}

.sheet-tabs { margin: 0; }
.sheet-tabs button { height: 44px; font-size: 14.5px; }

.sheet-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Al cambiar de pestaña la nueva entra desde el lado en que está. */
.panel.entra { animation: panelEntra .26s var(--suave); }

@keyframes panelEntra {
  from { opacity: 0; transform: translateX(var(--desde, 14px)); }
}

/* ─── Bloques ─── */
.bloque {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radio);
  padding: 14px;
  box-shadow: var(--sombra-1);
}

.bloque-tit {
  margin: 0 0 10px;
  font-size: 12.5px;
  font-weight: 800;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ─── Contador ─── */
.cnt-cab {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.cnt-cab .bloque-tit { margin: 0; font-size: 15px; letter-spacing: .05em; }

.cnt {
  display: grid;
  grid-template-columns: var(--tap) minmax(64px, auto) var(--tap);
  align-items: center;
  gap: 6px;
}

.cnt-btn {
  width: var(--tap);
  height: var(--tap);
  border-radius: 18px;
  background: var(--card-2);
  border: 1px solid var(--line-2);
  display: grid;
  place-items: center;
}

.cnt-btn svg { width: 26px; height: 26px; stroke-width: 2.6; }
.cnt-btn:active { transform: scale(.9); background: var(--card-3); }

.cnt-mas {
  background: var(--grafito);
  border-color: var(--grafito);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(21, 23, 28, .25);
}

.cnt-mas:active { background: var(--grafito-2); }

@media (prefers-color-scheme: dark) {
  .cnt-mas { background: #f2f4f7; border-color: #f2f4f7; color: #121418; box-shadow: none; }
  .cnt-mas:active { background: #d9dde3; }
}

.cnt-btn:disabled { opacity: .35; box-shadow: none; }
.cnt-btn:disabled:active { transform: none; }

.cnt-num {
  text-align: center;
  font-size: 42px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -.03em;
  font-variant-numeric: tabular-nums;
}

/* ─── Accesos rápidos 1-8 ─── */
.quick {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 6px;
  margin-top: 12px;
}

.quick button {
  height: 46px;
  border-radius: 13px;
  background: var(--card-2);
  border: 1px solid var(--line-2);
  font-size: 17px;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
}

.quick button:active { transform: scale(.88); }

/* El número fijado, en el color del tipo: azul los palets, marrón los bultos. */
#q-palets button.sel { background: var(--palet); border-color: var(--palet); color: #ffffff; }
#q-bultos button.sel { background: var(--bulto); border-color: var(--bulto); color: #ffffff; }

@media (prefers-color-scheme: dark) {
  #q-palets button.sel, #q-bultos button.sel { color: #0b0c0f; }
}

/* ─── Pesos ─── */
.pesos-wrap {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed var(--line-2);
}

.pesos-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.pesos-tit {
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
}

.mini-btn {
  flex: 0 0 auto;
  height: 36px;
  padding: 0 13px;
  border-radius: 12px;
  background: var(--card-2);
  border: 1px solid var(--line-2);
  font-size: 13px;
  font-weight: 750;
  color: var(--azul-txt);
  white-space: nowrap;
}

.mini-btn:active { transform: scale(.95); }

.mini-verde {
  color: var(--verde-txt);
  border-color: color-mix(in srgb, var(--verde) 45%, var(--line-2));
  background: color-mix(in srgb, var(--verde) 9%, var(--card));
}

/* Una FILA por unidad: cuántas, el peso y para quién es. */
.pesos {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
}

.peso-fila {
  display: grid;
  grid-template-columns: 48px 108px minmax(0, 1fr);
  gap: 6px;
  align-items: center;
}

/* Cuántas unidades agrupa la línea. Discreto mientras es «×1». */
.cant {
  height: 54px;
  border: 1px solid var(--line-2);
  background: var(--card-2);
  border-radius: 14px;
  font-size: 14px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

.cant:active { transform: scale(.94); }

.cant.grupo {
  border-color: var(--ambar);
  background: color-mix(in srgb, var(--ambar) 15%, var(--card-2));
  color: var(--ambar-txt);
}

/* Campo «Para quién». */
.para {
  height: 54px;
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line-2);
  background: var(--card-2);
  border-radius: 14px;
  padding: 0 12px;
  outline: none;
  font-size: 16px;
  font-weight: 650;
  color: var(--text);
  -webkit-appearance: none;
  appearance: none;
  transition: border-color .18s ease, box-shadow .18s ease;
}

.para::placeholder { color: var(--muted-2); font-weight: 500; opacity: 1; }
.para:focus { border-color: var(--azul); box-shadow: 0 0 0 3px color-mix(in srgb, var(--azul) 18%, transparent); }

/* Cada peso es un BOTÓN que abre el teclado propio de la app. */
.peso {
  display: flex;
  align-items: center;
  gap: 3px;
  background: var(--card-2);
  border: 1px solid var(--line-2);
  border-radius: 14px;
  height: 54px;
  padding: 0 10px 0 9px;
  text-align: left;
}

.peso:active { transform: scale(.95); }

.peso.lleno {
  border-color: color-mix(in srgb, var(--verde) 60%, var(--line-2));
  background: color-mix(in srgb, var(--verde) 9%, var(--card-2));
}

.peso .idx {
  font-size: 11px;
  font-weight: 800;
  color: var(--muted-2);
  flex: 0 0 auto;
  min-width: 13px;
}

.peso .pv {
  flex: 1;
  min-width: 0;
  text-align: right;
  font-size: 18px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted-2);
}

.peso.lleno .pv { color: var(--text); }

.peso .un {
  font-size: 11px;
  font-weight: 750;
  color: var(--muted);
  flex: 0 0 auto;
}

/* ─── Cargado para reparto ─── */
.recog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.recog-head .bloque-tit { margin: 0; }

.recog-vacio {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  color: var(--muted);
}

.recog-lista {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 6px;
}

.recog {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 58px;
  padding: 6px 12px;
  border: 1px solid var(--line-2);
  border-radius: 15px;
  background: var(--card-2);
  cursor: pointer;
  transition: background-color .2s ease, border-color .2s ease, transform .14s var(--suave);
}

.recog:active { transform: scale(.985); }

.recog.hecho {
  border-color: color-mix(in srgb, var(--verde) 50%, var(--line-2));
  background: color-mix(in srgb, var(--verde) 9%, var(--card-2));
}

.recog-txt {
  flex: 1;
  min-width: 0;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.3;
}

.recog.hecho .recog-txt { color: var(--muted); text-decoration: line-through; text-decoration-thickness: 2px; }

/* «Parte»: recoger solo unas cuantas de un grupo. */
.recog-parte {
  flex: 0 0 auto;
  height: 34px;
  padding: 0 12px;
  border-radius: 11px;
  border: 1px solid var(--line-2);
  background: var(--card);
  font-size: 12.5px;
  font-weight: 800;
  color: var(--azul-txt);
}

.recog-parte:active { transform: scale(.94); }

/* Lo arrastrado de otro día: no es de hoy, es una deuda. */
.recog-badge,
.rec-badge {
  flex: 0 0 auto;
  font-size: 11px;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 999px;
  color: var(--ambar-txt);
  background: color-mix(in srgb, var(--ambar) 18%, transparent);
  white-space: nowrap;
}

/* ─── Casillas: se dibujan al marcar ───
   Grandes a propósito: se marcan de pie, con guantes y en marcha. */
.recog-chk,
.rec-chk {
  -webkit-appearance: none;
  appearance: none;
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  margin: 0;
  border-radius: 10px;
  border: 2px solid var(--line-2);
  background: var(--card);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background-color .2s ease, border-color .2s ease, transform .14s var(--suave);
}

.recog-chk::after,
.rec-chk::after {
  content: "";
  width: 7px;
  height: 14px;
  margin-top: -3px;
  border: solid #ffffff;
  border-width: 0 3px 3px 0;
  transform: rotate(45deg) scale(0);
  transition: transform .26s var(--pop);
}

.recog-chk:checked,
.rec-chk:checked {
  background: var(--verde);
  border-color: var(--verde);
}

.recog-chk:checked::after,
.rec-chk:checked::after { transform: rotate(45deg) scale(1); }

.recog-chk:active,
.rec-chk:active { transform: scale(.86); }

@media (prefers-color-scheme: dark) {
  .recog-chk::after, .rec-chk::after { border-color: #08130c; }
}

/* ─── Compartido: cargado / pendiente ─── */
.compartido {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radio);
  padding: 11px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-shadow: var(--sombra-1);
}

.cmp-fila {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  font-size: 13.5px;
}

.cmp-fila em { font-style: normal; color: var(--muted); font-weight: 650; }
.cmp-fila b { font-weight: 750; white-space: nowrap; }

.cmp-pend { color: var(--ambar-txt); }

.cmp-total {
  border-top: 1px solid var(--line);
  padding-top: 7px;
  margin-top: 1px;
}

.cmp-total em { color: var(--text); font-weight: 750; }
.cmp-total b { color: var(--verde-txt); }

/* ─── Recogidas apuntadas y notas ─── */
.rec-nueva {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.rec-nueva-txt {
  width: 100%;
  height: 52px;
  min-width: 0;
  border: 1px solid var(--line-2);
  background: var(--card-2);
  border-radius: 15px;
  padding: 0 14px;
  outline: none;
  font-size: 16px;          /* 16px o iOS hace zoom al enfocar */
  color: var(--text);
  -webkit-appearance: none;
  appearance: none;
  transition: border-color .18s ease, box-shadow .18s ease;
}

.rec-nueva-txt::placeholder { color: var(--muted-2); }
.rec-nueva-txt:focus { border-color: var(--azul); box-shadow: 0 0 0 3px color-mix(in srgb, var(--azul) 18%, transparent); }

.btn-anadir {
  width: 52px;
  height: 52px;
  border-radius: 15px;
  background: var(--grafito);
  color: #ffffff;
  display: grid;
  place-items: center;
  box-shadow: 0 4px 12px rgba(21, 23, 28, .22);
}

.btn-anadir svg { width: 25px; height: 25px; stroke-width: 2.6; }
.btn-anadir:active { transform: scale(.9); }

@media (prefers-color-scheme: dark) {
  .btn-anadir { background: #f2f4f7; color: #121418; box-shadow: none; }
}

/* En la cabecera oscura de Notas. */
.topbar .rec-nueva { margin-top: 12px; }
.rec-nueva-oscura .rec-nueva-txt {
  background: rgba(255, 255, 255, .08);
  border-color: rgba(255, 255, 255, .14);
  color: var(--sobre-oscuro);
}
.rec-nueva-oscura .rec-nueva-txt::placeholder { color: rgba(244, 245, 247, .5); }
.rec-nueva-oscura .btn-anadir {
  background: var(--marca);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(225, 42, 52, .4);
}

.bloque .rec-nueva { margin-top: 2px; }

.rec-vacio {
  margin: 10px 0 0;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--muted);
}

.rec-lista {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 6px;
  margin-top: 10px;
}

.rec-lista:empty { display: none; }

/* Cada recogida ES su campo de texto: corregirla es escribir encima. */
.rec-fila {
  display: flex;
  align-items: center;
  gap: 4px;
  border: 1px solid var(--line-2);
  border-radius: 15px;
  background: var(--card-2);
  padding: 0 4px 0 12px;
  min-height: 56px;
  transition: background-color .2s ease, border-color .2s ease;
}

.rec-fila.hecha {
  border-color: color-mix(in srgb, var(--verde) 50%, var(--line-2));
  background: color-mix(in srgb, var(--verde) 9%, var(--card-2));
}

.rec-fila.hecha .rec-txt { color: var(--muted); text-decoration: line-through; }

.rec-txt {
  flex: 1;
  min-width: 0;
  height: 50px;
  border: 0;
  background: none;
  outline: none;
  padding: 0 8px;
  font-size: 15.5px;
  font-weight: 650;
  color: inherit;
  -webkit-appearance: none;
  appearance: none;
}

.rec-del {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  color: var(--rojo);
}

.rec-del svg { width: 20px; height: 20px; }
.rec-del:active { background: color-mix(in srgb, var(--rojo) 12%, transparent); transform: scale(.9); }

/* Recogida en la pantalla Carga: solo se marca (se corrige en su agencia). */
.crec {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 58px;
  padding: 7px 12px;
  border: 1px solid var(--line-2);
  border-radius: 15px;
  background: var(--card-2);
  cursor: pointer;
  transition: background-color .2s ease, border-color .2s ease, transform .14s var(--suave);
}

.crec:active { transform: scale(.985); }
.crec.hecha {
  border-color: color-mix(in srgb, var(--verde) 50%, var(--line-2));
  background: color-mix(in srgb, var(--verde) 9%, var(--card-2));
}
.crec-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.crec-t { font-size: 15px; font-weight: 700; line-height: 1.3; }
.crec.hecha .crec-t { color: var(--muted); text-decoration: line-through; }

/* ─── Notas: día y hora del aviso ─── */
.notas-lista { margin-top: 0; gap: 8px; }

.nota-bloque {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  padding: 8px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radio);
  box-shadow: var(--sombra-1);
}

.nota-bloque .rec-fila { background: var(--card-2); }

.nota-cuando {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  padding: 0 4px 2px 44px;
}

.nota-fecha, .nota-hora {
  height: 40px;
  border: 1px solid var(--line-2);
  background: var(--card-2);
  border-radius: 11px;
  padding: 0 9px;
  font-size: 14px;
  font-weight: 650;
  color: inherit;
  -webkit-appearance: none;
  appearance: none;
  min-width: 0;
}

.nota-fecha { flex: 1 1 130px; }
.nota-hora  { flex: 0 0 96px; }

.nota-fecha:focus, .nota-hora:focus { border-color: var(--azul); outline: none; }

/* El aviso salta un día antes: se dice, no se deja adivinar. */
.nota-aviso {
  flex: 1 1 100%;
  font-size: 12px;
  font-weight: 700;
  color: var(--azul-txt);
}

.nota-aviso.sin { color: var(--muted); font-weight: 600; }

.nota-bloque.hecha { opacity: .72; }
.nota-bloque.hecha .nota-cuando { opacity: .6; }

/* ─── Aviso de agencia sin teléfono ─── */
.tel-aviso {
  margin: 0;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
}

.tel-aviso code {
  font-size: 12px;
  background: var(--card-3);
  padding: 1px 5px;
  border-radius: 5px;
}

/* ─── Pie de la hoja: total siempre visible ─── */
.sheet-foot {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px calc(10px + var(--pad-bottom));
  background: var(--card);
  border-top: 1px solid var(--line);
}

.total-kg {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.total-kg span {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}

.total-kg strong {
  font-size: 28px;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn-guardar {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: var(--tap);
  min-width: 150px;
  padding: 0 24px;
  border-radius: 18px;
  background: linear-gradient(180deg, #22b45a 0%, #15993f 100%);
  color: #ffffff;
  font-size: 17px;
  font-weight: 800;
  box-shadow: 0 6px 16px rgba(22, 163, 74, .32), inset 0 1px 0 rgba(255, 255, 255, .22);
}

.btn-guardar svg { width: 22px; height: 22px; stroke-width: 2.6; }
.btn-guardar:active { transform: scale(.96); }

.btn-guardar:disabled {
  background: var(--card-3);
  color: var(--muted-2);
  box-shadow: none;
}

/* ─── La hoja de un sitio («Varios») ─── */
.sitio-bloque { padding-bottom: 4px; }

.campo { display: block; margin: 0 0 14px; }
.campo-ultimo { margin-bottom: 10px; }

.campo-et {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 800;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .05em;
}

.campo input,
.campo textarea {
  width: 100%;
  padding: 13px 14px;
  border: 1px solid var(--line-2);
  border-radius: 14px;
  background: var(--card-2);
  color: var(--text);
  font: inherit;
  font-size: 16px;
  -webkit-appearance: none;
  transition: border-color .18s ease, box-shadow .18s ease;
}

.campo textarea { resize: vertical; min-height: 92px; line-height: 1.45; }

.campo input:focus,
.campo textarea:focus {
  outline: none;
  border-color: var(--azul);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--azul) 18%, transparent);
}

.campo-con-btn { display: flex; gap: 8px; align-items: stretch; }
.campo-con-btn input { flex: 1; min-width: 0; }

.campo-btn {
  flex: 0 0 auto;
  width: 52px;
  border-radius: 14px;
  background: var(--verde);
  color: #ffffff;
  display: grid;
  place-items: center;
}

.campo-btn svg { width: 22px; height: 22px; }
.campo-btn:active { transform: scale(.94); }

.mapa-caja {
  position: relative;
  /* `flex: none` NO es decorativo: la hoja es un flex en columna y un iframe
     sin esto se aplastaba a 5 px. */
  flex: 0 0 auto;
  min-height: 190px;
  margin: 0 0 12px;
  border: 1px solid var(--line-2);
  border-radius: 16px;
  overflow: hidden;
  background: var(--card-2);
}

.mapa-caja iframe {
  display: block;
  width: 100%;
  height: 190px;
  border: 0;
}

/* Capa transparente por encima: sin ella el dedo arrastraría el mapa. */
.mapa-tap {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background: transparent;
  border: 0;
  cursor: pointer;
}

.mapa-vacio {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 190px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
  padding: 0 18px;
}

.mapa-vacio svg { width: 30px; height: 30px; stroke-width: 1.7; }

.mapa-pie {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 6px 10px;
  background: rgba(15, 18, 24, .66);
  color: #ffffff;
  font-size: 11.5px;
  text-align: center;
  pointer-events: none;
}

.sitio-acc { display: flex; gap: 10px; margin: 0 0 16px; }
.sitio-acc .fbtn { flex: 1 1 0; }

.fbtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 48px;
  padding: 0 12px;
  border: 1px solid var(--line-2);
  border-radius: 14px;
  background: var(--card);
  color: var(--text);
  font-size: 14px;
  font-weight: 650;
}

.fbtn svg { width: 18px; height: 18px; }
.fbtn:active { background: var(--card-2); transform: scale(.97); }
.fbtn:disabled { color: var(--muted); opacity: .6; }

.btn-borrar-sitio {
  display: block;
  width: 100%;
  min-height: 48px;
  margin: 8px 0 4px;
  border: 1px solid color-mix(in srgb, var(--rojo) 35%, var(--line-2));
  border-radius: 14px;
  background: var(--card);
  color: var(--rojo);
  font-size: 14px;
  font-weight: 750;
}

.btn-borrar-sitio:active { background: color-mix(in srgb, var(--rojo) 8%, var(--card)); }

/* ─────────────────── ESCÁNER DE LA HOJA DE PREASIGNACIÓN ─────────────────── */
.esc-entrada { display: flex; gap: 8px; }

.esc-btn {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 13px;
  min-height: 70px;
  padding: 10px 14px 10px 10px;
  border-radius: var(--radio);
  color: #ffffff;
  text-align: left;
  background:
    radial-gradient(120% 160% at 100% 0%, rgba(225, 42, 52, .4) 0%, rgba(225, 42, 52, 0) 55%),
    linear-gradient(160deg, #262a32 0%, #15171c 100%);
  box-shadow: 0 6px 18px rgba(16, 19, 26, .22);
}

.esc-ico {
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  border-radius: 15px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, .12);
}

.esc-ico svg { width: 27px; height: 27px; }
.esc-txt { display: flex; flex-direction: column; min-width: 0; }
.esc-txt strong { font-size: 17px; font-weight: 800; line-height: 1.2; }
.esc-txt em { font-style: normal; font-size: 13px; color: rgba(255, 255, 255, .72); }
.esc-btn:active { transform: scale(.97); }

.esc-galeria {
  flex: 0 0 auto;
  width: 70px;
  border-radius: var(--radio);
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--muted);
  display: grid;
  place-items: center;
  box-shadow: var(--sombra-1);
}

.esc-galeria:active { background: var(--card-2); transform: scale(.95); }

/* ─── La capa ─── */
.sheet-esc { height: 92dvh; }
.esc-sub { margin: 2px 0 0; font-size: 13px; color: var(--muted); font-weight: 650; }
.sheet-esc .sheet-head { border-bottom: 1px solid var(--line); }
.sheet-esc .total-kg strong { font-size: 16px; line-height: 1.25; white-space: normal; }

.esc-estado { padding: 26px 10px; text-align: center; }

/* La hoja con la raya que la recorre mientras se lee. */
.esc-anim {
  position: relative;
  width: 76px;
  height: 96px;
  margin: 0 auto 20px;
  border-radius: 12px;
  border: 2px solid var(--line-2);
  background:
    repeating-linear-gradient(180deg, transparent 0 11px, var(--line-2) 11px 13px) 12px 16px / calc(100% - 24px) calc(100% - 30px) no-repeat,
    var(--card);
  overflow: hidden;
}

.esc-anim i {
  position: absolute;
  left: 0;
  right: 0;
  top: 8px;
  height: 3px;
  background: var(--marca);
  box-shadow: 0 0 14px 2px rgba(225, 42, 52, .55);
  animation: escanea 1.5s ease-in-out infinite alternate;
}

@keyframes escanea {
  to { transform: translateY(76px); }
}

.esc-barra {
  height: 8px;
  border-radius: 4px;
  background: var(--line);
  overflow: hidden;
}

.esc-barra i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--marca), #ff8a5c);
  transition: width .3s ease;
}

.esc-msg { margin: 14px 0 0; font-size: 16px; font-weight: 750; font-variant-numeric: tabular-nums; }
.esc-nota { margin: 10px 0 0; font-size: 13px; color: var(--muted); }

.esc-error p { margin: 6px 0 14px; font-size: 15px; line-height: 1.45; }

.esc-acc { display: flex; gap: 10px; margin-top: 12px; }
.esc-acc .fbtn { flex: 1 1 0; }

.esc-resumen { margin: 0 0 8px; font-size: 14.5px; line-height: 1.45; }

/* ¿Cuadra con la fila de TOTAL de la hoja? */
.esc-cuadre {
  margin: 0 0 10px;
  padding: 10px 13px;
  border-radius: 13px;
  font-size: 13.5px;
  font-weight: 700;
  line-height: 1.4;
}

.esc-cuadre.ok  { background: color-mix(in srgb, var(--verde) 13%, var(--card)); color: var(--verde-txt); }
.esc-cuadre.mal { background: color-mix(in srgb, var(--ambar) 18%, var(--card)); color: var(--text); }

.esc-todos {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 10px;
  font-size: 13px;
  color: var(--muted);
  font-weight: 700;
}

.esc-lineas { display: flex; flex-direction: column; gap: 8px; }

.esc-linea {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radio);
  padding: 9px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-shadow: var(--sombra-1);
  transition: opacity .2s ease;
}

.esc-linea.fuera { opacity: .5; }
.esc-linea.fuera .esc-dest { text-decoration: line-through; }

.esc-l1 {
  display: grid;
  grid-template-columns: 44px 76px 112px minmax(0, 1fr);
  gap: 6px;
  align-items: center;
}

.esc-chk {
  height: 46px;
  border-radius: 13px;
  border: 2px solid var(--line-2);
  background: var(--card-2);
  display: grid;
  place-items: center;
  color: transparent;
}

.esc-chk[aria-pressed="true"] { border-color: var(--verde); background: var(--verde); color: #ffffff; }
.esc-chk svg { width: 22px; height: 22px; stroke-width: 3; }

.esc-tipo {
  height: 46px;
  border-radius: 13px;
  border: 1px solid var(--line-2);
  background: var(--card-2);
  font-size: 14px;
  padding: 0 4px;
}

.esc-tipo:active, .esc-chk:active { transform: scale(.94); }

.esc-cant {
  display: grid;
  grid-template-columns: 36px 1fr 36px;
  align-items: center;
  height: 46px;
  border-radius: 13px;
  border: 1px solid var(--line-2);
  background: var(--card-2);
  overflow: hidden;
}

.esc-cant button { height: 100%; display: grid; place-items: center; color: var(--azul-txt); }
.esc-cant button svg { width: 18px; height: 18px; stroke-width: 2.6; }
.esc-cant button:active { background: var(--card-3); }
.esc-cant output { text-align: center; font-size: 17px; font-weight: 800; font-variant-numeric: tabular-nums; }

.esc-kg {
  display: flex;
  align-items: center;
  gap: 3px;
  height: 46px;
  border-radius: 13px;
  border: 1px solid var(--line-2);
  background: var(--card-2);
  padding: 0 8px;
  min-width: 0;
}

.esc-kg input {
  flex: 1;
  min-width: 0;
  width: 100%;
  border: 0;
  outline: none;
  background: transparent;
  text-align: right;
  font-size: 16px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.esc-kg span { font-size: 11px; font-weight: 700; color: var(--muted); }
.esc-kg:focus-within { border-color: var(--azul); }

.esc-dest { height: 48px; width: 100%; }

.esc-aviso { margin: 0; font-size: 12.5px; font-weight: 600; color: var(--muted); }

.esc-mas { width: 100%; margin-top: 10px; }

.esc-olvidar {
  display: block;
  margin: 12px auto 0;
  padding: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  text-decoration: underline;
}

.esc-texto { margin-top: 14px; }
.esc-texto summary { cursor: pointer; font-size: 13px; font-weight: 700; color: var(--muted); padding: 6px 0; }
.esc-texto pre {
  margin: 6px 0 0;
  padding: 10px;
  max-height: 260px;
  overflow: auto;
  border-radius: 12px;
  background: var(--card);
  border: 1px solid var(--line);
  font-size: 11.5px;
  line-height: 1.4;
  white-space: pre-wrap;
  word-break: break-word;
  user-select: text;
  -webkit-user-select: text;
}

/* ─── Enseñar columnas ─── */
.esc-ens-paso { margin: 0 0 10px; font-size: 16px; line-height: 1.4; }
.esc-ens-hechos { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 10px; }
.esc-ens-hechos:empty { display: none; }
.esc-hecho {
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--line);
  font-size: 13px;
  font-weight: 700;
}
.esc-hecho em { font-style: normal; color: var(--muted); font-weight: 600; }
.esc-ens-opc { display: flex; flex-wrap: wrap; gap: 8px; }
.esc-opc {
  min-height: 50px;
  padding: 8px 14px;
  border-radius: 14px;
  border: 1px solid var(--line-2);
  background: var(--card);
  font-size: 15px;
  font-weight: 700;
  text-align: left;
}
.esc-opc.fila { width: 100%; font-weight: 600; font-size: 14px; }
.esc-opc:active { background: var(--card-2); transform: scale(.98); }
.esc-opc:disabled { opacity: .35; }

/* Número leído con poca confianza: en naranja hasta que se toca. */
.esc-kg.dudoso, .esc-cant.dudoso {
  border-color: var(--ambar);
  background: color-mix(in srgb, var(--ambar) 15%, var(--card-2));
}
.esc-aviso.dudoso { color: var(--ambar-txt); }

/* ─────────────────────────── TECLADO NUMÉRICO ─────────────────────────── */
.sheet-kb { background: var(--bg); }

.kb-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 2px 12px 6px 16px;
  background: var(--card);
}

.kb-tit {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
}

.kb-display {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 8px;
  padding: 4px 12px 16px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
}

.kb-valor {
  font-size: 56px;
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.03em;
  max-width: 100%;
  overflow: hidden;
}

.kb-valor.vacio { color: var(--muted-2); opacity: .5; }

.kb-un { font-size: 20px; font-weight: 750; color: var(--muted); }

.kb-nav {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
  padding: 10px 12px;
}

.kb-navbtn {
  height: 44px;
  border-radius: 13px;
  background: var(--card);
  border: 1px solid var(--line-2);
  font-size: 13.5px;
  font-weight: 750;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-width: 0;
  padding: 0 6px;
}

.kb-navbtn svg { width: 16px; height: 16px; }
.kb-navbtn.acento { color: var(--azul-txt); }
.kb-navbtn:active { transform: scale(.95); background: var(--card-2); }
.kb-navbtn:disabled { opacity: .35; }
.kb-navbtn:disabled:active { transform: none; background: var(--card); }

.kb-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 0 12px 12px;
}

.kb-tecla {
  height: 62px;
  border-radius: 17px;
  background: var(--card);
  border: 1px solid var(--line);
  font-size: 27px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  display: grid;
  place-items: center;
  box-shadow: 0 2px 0 var(--line-2);
}

.kb-tecla:active { background: var(--card-3); transform: translateY(2px) scale(.97); box-shadow: none; }

.kb-tecla.kb-del { background: var(--card-2); }
.kb-tecla.kb-del svg { width: 28px; height: 28px; }

.kb-ok {
  margin: 0 12px calc(12px + var(--pad-bottom));
  width: calc(100% - 24px);
}

/* En pantallas bajas (móvil apaisado) el teclado se compacta para que quepa. */
@media (max-height: 620px) {
  .kb-valor { font-size: 38px; }
  .kb-display { padding: 2px 12px 10px; }
  .kb-tecla { height: 48px; font-size: 22px; }
  .kb-navbtn { height: 38px; }
}

/* ─────────────────────────── MENÚS ─────────────────────────── */
.sheet-menu { padding-bottom: calc(10px + var(--pad-bottom)); }

.sheet-menu .grab { background: transparent; }

.menu-list {
  padding: 4px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 68px;
  padding: 10px 14px 10px 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radio);
  text-align: left;
  box-shadow: var(--sombra-1);
}

.menu-item:active { background: var(--card-2); transform: scale(.98); }

.menu-ico,
.menu-item > svg {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  background: var(--card-3);
  color: var(--text);
}

.menu-item > svg { padding: 9px; }
.menu-ico svg { width: 21px; height: 21px; }

.menu-item span { display: flex; flex-direction: column; min-width: 0; }
.menu-item > span:not(.switch):not(.menu-ico) { flex: 1; }
.menu-item strong { font-size: 16px; font-weight: 750; }
.menu-item em { font-style: normal; font-size: 13px; color: var(--muted); }

.menu-item.danger strong { color: var(--rojo); }
.menu-item.danger .menu-ico { background: color-mix(in srgb, var(--rojo) 12%, var(--card)); color: var(--rojo); }
.ico-rojo  { background: color-mix(in srgb, var(--marca) 13%, var(--card)) !important; color: var(--marca) !important; }
.ico-verde { background: color-mix(in srgb, var(--verde) 13%, var(--card)) !important; color: var(--verde-txt) !important; }

.btn-cancelar {
  margin: 0 12px;
  height: var(--tap);
  border-radius: 18px;
  background: var(--card);
  border: 1px solid var(--line);
  font-size: 17px;
  font-weight: 750;
}

.btn-cancelar:active { transform: scale(.98); background: var(--card-2); }

/* ─── Interruptor del menú ─── */
.menu-item .switch { display: block; flex: 0 0 auto; }

.switch {
  flex: 0 0 auto;
  width: 50px;
  height: 30px;
  border-radius: 999px;
  background: var(--line-2);
  display: block;
  position: relative;
  transition: background-color .2s ease;
}

.switch i {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .35);
  transition: transform .26s var(--pop);
}

.switch.on { background: var(--verde); }
.switch.on i { transform: translateX(20px); }
.switch.ocupado { opacity: .5; }

/* ─── Cabecera de los menús ─── */
.dl-tit {
  margin: 2px 16px 0;
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -.01em;
}

.dl-sub {
  margin: 2px 16px 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

#acciones .dl-tit { margin-bottom: 10px; }

/* ─────────────────── SELECTOR DE CONTACTO PARA LLAMAR ─────────────────── */
.tel-lista {
  padding: 4px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  /* TXT tiene seis contactos: la lista se desplaza dentro de sí misma. */
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  max-height: calc(92dvh - 190px);
}

.tel-opcion {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 74px;
  padding: 12px 16px 12px 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radio);
  text-align: left;
  box-shadow: var(--sombra-1);
}

.tel-opcion:active { background: var(--card-2); transform: scale(.98); }

.tel-ico {
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  border-radius: 15px;
  background: linear-gradient(180deg, #22b45a 0%, #15993f 100%);
  color: #ffffff;
  display: grid;
  place-items: center;
  box-shadow: 0 3px 10px rgba(22, 163, 74, .3);
}

.tel-ico svg { width: 22px; height: 22px; }

.tel-txt {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 2px;
}

.tel-txt strong {
  font-size: 18px;
  font-weight: 750;
  letter-spacing: -.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tel-txt em {
  font-style: normal;
  font-size: 14px;
  font-weight: 650;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* Con un solo contacto no hay selector: solo se enseña su número. */
.tel-unico {
  margin: 0;
  padding: 6px 4px 6px;
  text-align: center;
  font-size: 30px;
  font-weight: 800;
  letter-spacing: .01em;
  font-variant-numeric: tabular-nums;
}

.tel-btn-llamar {
  margin: 0 12px 8px;
  width: calc(100% - 24px);
}

/* ─────────────────────────── AVISO FLOTANTE ─────────────────────────── */
/* Arriba y no abajo: abajo se solapaba con el pie de la hoja. */
.toast {
  position: fixed;
  left: 50%;
  top: calc(12px + var(--pad-top));
  z-index: 80;
  transform: translate(-50%, -24px) scale(.94);
  max-width: min(90vw, 420px);
  padding: 13px 20px;
  border-radius: 16px;
  background: #15171c;
  color: #ffffff;
  font-size: 15px;
  font-weight: 650;
  text-align: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .3);
  opacity: 0;
  transition: opacity .2s ease, transform .3s var(--pop);
  pointer-events: none;
}

@media (prefers-color-scheme: dark) {
  .toast { background: #f2f4f7; color: #121418; }
}

.toast.visible { opacity: 1; transform: translate(-50%, 0) scale(1); }

/* ─────────────────── PALETS Y BULTOS EN COLOR ───────────────────
   Van al final a propósito: misma especificidad que los sitios donde se
   usan, así que ganan por orden. Las cabeceras oscuras tienen su versión. */
.w-palet { color: var(--palet); font-weight: 800; }
.w-bulto { color: var(--bulto); font-weight: 800; }

.hero .w-palet, .topbar .w-palet, .esc-btn .w-palet { color: var(--palet-claro); }
.hero .w-bulto, .topbar .w-bulto, .esc-btn .w-bulto { color: var(--bulto-claro); }

/* Una línea ya cargada se apaga entera. */
.recog.hecho .w-palet,
.recog.hecho .w-bulto { color: var(--muted); }

/* ─────────────────────────── EFECTOS ─────────────────────────── */

/* Al entrar en una pantalla. */
.pantalla.entra { animation: pantallaEntra .3s var(--suave); }

@keyframes pantallaEntra {
  from { opacity: 0; transform: translateY(10px); }
}

/* Las filas entran escalonadas (solo al entrar en la pantalla o al abrir la
   app; los repintados de cada tecla no animan nada). */
.cascada > * {
  animation: subir .42s var(--suave) both;
  animation-delay: calc(var(--i, 0) * 30ms);
}

@keyframes subir {
  from { opacity: 0; transform: translateY(14px); }
}

/* Un número que cambia da un saltito. */
.salta { animation: salta .34s var(--pop); }

@keyframes salta {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.24); }
  100% { transform: scale(1); }
}

/* «Todo cargado»: onda verde alrededor. */
.exito { animation: exito .6s var(--suave); }

@keyframes exito {
  0%   { box-shadow: 0 0 0 0 rgba(22, 163, 74, .5); }
  100% { box-shadow: 0 0 0 16px rgba(22, 163, 74, 0); }
}

/* ─────────────────────────── PANTALLAS GRANDES ─────────────────────────── */
/* En escritorio la app se centra en una columna con aspecto de móvil. */
@media (min-width: 620px) {
  .hero, .topbar, .lista, .scroll, .vacio { max-width: 560px; margin-left: auto; margin-right: auto; }
  .minibar { max-width: 560px; margin: 0 auto; border-radius: 0 0 18px 18px; }
  .tabbar-in { max-width: 520px; margin: 0 auto; }
  .sheet { max-width: 560px; left: 50%; transform: translate(-50%, calc(100% + 30px + var(--dy))); }
  .sheet.abierto { transform: translate(-50%, var(--dy)); }
}

/* ─────────────────────────── MENOS MOVIMIENTO ───────────────────────────
   Si el móvil pide menos animaciones, todo pasa al instante: las hojas
   aparecen sin deslizarse y no hay saltitos ni escalonados. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 1ms !important;
    animation-delay: 0ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
    scroll-behavior: auto !important;
  }
}
