@font-face { font-family: "Inter"; src: url("assets/inter.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Manrope"; src: url("assets/manrope.woff2") format("woff2"); font-weight: 200 800; font-display: swap; }

/* =========================================================
   Tokens (tema claro). Una sola acentuación: terracota de marca.
   ========================================================= */
:root {
  --fondo: #F7F8FA; --superficie: #fff; --superficie-2: #F2F4F7;
  --borde: #E4E7EC; --borde-fuerte: #D0D5DD;
  --texto: #101828; --suave: #667085;
  --acento: #B8472D; --acento-h: #9E3B24; --acento-t: #FBEAE4;
  --azul: #041C34; --oro: #BF8A2E; --azul-accion: #1B5FC7; --azul-accion-h: #1649A0;
  --ok: #067647; --ok-t: #DCFAE6; --alerta: #B54708; --alerta-t: #FEF0C7; --mal: #B42318; --mal-t: #FEE4E2;
  --r1: 8px; --r2: 12px; --r3: 16px;
  --sombra: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
  --sombra-2: 0 8px 24px rgba(16, 24, 40, .12);
  --salida: cubic-bezier(.23, 1, .32, 1);
  --nav-h: 62px; --cab-h: 56px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 16px/1.5 "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; background: var(--fondo); color: var(--texto); -webkit-font-smoothing: antialiased; }
h1, h2, h3 { font-family: "Manrope", "Inter", sans-serif; margin: 0; letter-spacing: -.01em; }
h1 { font-size: 1.2rem; margin-bottom: .8rem; }
h2 { font-size: 1.35rem; font-weight: 800; }
h3 { font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--suave); margin: 1.6rem 0 .6rem; }
h3.primero { margin-top: 0; }
a { color: var(--acento); }
.pequeno { font-size: .85rem; color: var(--suave); }
code { background: var(--superficie-2); padding: 1px 5px; border-radius: 4px; word-break: break-all; font-size: .8rem; }
.svg { display: inline-block; vertical-align: middle; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* =========================================================
   Formularios
   ========================================================= */
label { display: block; font-size: .85rem; font-weight: 500; color: var(--suave); margin-bottom: .9rem; }
input, select, textarea { display: block; width: 100%; margin-top: .3rem; padding: .65rem .8rem; min-height: 46px; font: inherit; font-size: 16px; color: var(--texto); border: 1px solid var(--borde-fuerte); border-radius: var(--r2); background: var(--superficie); transition: border-color .15s var(--salida), box-shadow .15s var(--salida); }
textarea { min-height: 96px; resize: vertical; }
input::placeholder, textarea::placeholder { color: #6B7280; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: none; border-color: var(--acento); box-shadow: 0 0 0 4px var(--acento-t); }
button:focus-visible, a:focus-visible { outline: 3px solid var(--acento); outline-offset: 2px; }
.error { color: var(--mal); font-size: .9rem; margin: 0 0 .8rem; }
.dos { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; }

/* =========================================================
   Botones
   ========================================================= */
button, .boton { font: inherit; font-weight: 600; font-size: .95rem; cursor: pointer; min-height: 46px; padding: .55rem 1rem; border-radius: var(--r2); border: 1px solid var(--borde-fuerte); background: var(--superficie); color: var(--texto); text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: .45rem; transition: background-color .15s var(--salida), border-color .15s var(--salida), transform .1s var(--salida); }
@media (hover: hover) { button:hover { background: var(--superficie-2); } button.primario:hover { background: var(--acento-h); } }
button:active { transform: scale(.97); }
button:disabled { opacity: .45; cursor: default; transform: none; }
button.primario { background: var(--acento); border-color: var(--acento); color: #fff; }
button.peligro { color: var(--mal); }
button.azul { background: var(--azul-accion); border-color: var(--azul-accion); color: #fff; }
button.rojo { background: var(--mal); border-color: var(--mal); color: #fff; }
button.pequeno-btn { min-height: 44px; padding: .3rem .9rem; font-size: .88rem; }
@media (hover: hover) { button.azul:hover { background: var(--azul-accion-h); } button.rojo:hover { background: #912018; } }
button.enlace { border: 0; background: none; color: var(--acento); min-height: 40px; padding: .3rem .6rem; }
button.grande { min-height: 56px; font-size: 1.02rem; border-radius: var(--r2); }
.primario[type=submit] { width: 100%; }
.icono-btn { min-height: 44px; min-width: 44px; padding: 0; border-radius: 50%; border: 0; background: var(--superficie-2); color: var(--texto); display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.boton-wa { width: 100%; margin: 0 0 .9rem; color: var(--ok); border-color: #A6E9C0; background: #F6FEF9; }

/* =========================================================
   Acceso (login / 2FA): todo azul, el logo se funde con el fondo
   ========================================================= */
.centro { min-height: 100dvh; display: grid; place-items: center; padding: 1rem; background: var(--azul); color: #fff; }
.centro .tarjeta { width: 100%; max-width: 400px; padding: .5rem; }
.centro .logo.grande { height: 56px; width: auto; display: block; margin: 0 auto 2rem; }
.centro h1 { color: #fff; text-align: center; }
.centro label, .centro .pequeno { color: #AEBBD0; }
.centro code { background: #0B2F52; color: #fff; }
.centro .error { color: #FFB4AB; }
.centro button.enlace { color: #D9E2EE; width: 100%; margin-top: .4rem; }
.centro button.enlace:hover { background: transparent; }
.centro input { border-color: #1D4570; }
.qr { display: block; margin: .5rem auto; width: 200px; height: 200px; background: #fff; padding: 8px; border-radius: var(--r2); }

/* =========================================================
   Estructura: cabecera clara + contenido + menú
   ========================================================= */
.barra { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: .6rem; height: calc(var(--cab-h) + env(safe-area-inset-top)); padding: env(safe-area-inset-top) 1rem 0; background: var(--azul); color: #fff; }
.barra .logo { height: 30px; width: auto; display: block; }
.barra .pequeno { color: #AEBBD0; }
.barra button.enlace { color: #E7ECF4; }
@media (hover: hover) { .barra button.enlace:hover { background: rgba(255, 255, 255, .1); } }
.espacio { flex: 1; }
#contenido { padding: 1.1rem 1rem calc(var(--nav-h) + 1.4rem + env(safe-area-inset-bottom)); max-width: 760px; margin: 0 auto; }
.vacio { color: var(--suave); text-align: center; padding: 2rem 1rem; }
.banner { background: var(--alerta-t); color: var(--alerta); border-radius: var(--r2); padding: .7rem .9rem; font-size: .9rem; margin: 0 0 1rem; }
.aviso { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--nav-h) + 14px + env(safe-area-inset-bottom)); z-index: 30; background: var(--texto); color: #fff; padding: .7rem 1.1rem; border-radius: var(--r2); max-width: 92vw; font-size: .93rem; box-shadow: var(--sombra-2); animation: sube .2s var(--salida); }
.aviso.mal { background: var(--mal); }

/* menú: barra inferior en móvil (máx. 5 elementos) */
#menu { position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: rgba(255, 255, 255, .94); backdrop-filter: saturate(1.4) blur(10px); border-top: 1px solid var(--borde); padding-bottom: env(safe-area-inset-bottom); }
#menu a, #menu button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: var(--nav-h); padding: 0; border: 0; border-radius: 0; background: none; font-size: .7rem; font-weight: 600; color: var(--suave); text-decoration: none; transition: color .15s var(--salida); }
#menu .ico { display: flex; }
#menu a.activo, #menu button.activo { color: var(--acento); }
.solo-pc { display: none !important; }

/* escritorio: menú a la izquierda, contenido amplio */
@media (min-width: 900px) {
  .solo-pc { display: flex !important; }
  .solo-movil { display: none !important; }
  .barra { padding: 0 1.5rem; }
  .cuerpo { display: grid; grid-template-columns: 230px minmax(0, 1fr); min-height: calc(100dvh - var(--cab-h)); }
  #contenido { order: 2; }
  #menu { order: 1; }
  #contenido { max-width: 1240px; width: 100%; padding: 1.8rem 2rem 3rem; }
  #menu { position: sticky; top: var(--cab-h); align-self: start; height: calc(100dvh - var(--cab-h)); display: flex; flex-direction: column; justify-content: flex-start; gap: 2px; background: var(--superficie); backdrop-filter: none; border-top: 0; border-right: 1px solid var(--borde); padding: 1rem .7rem; }
  #menu a, #menu button { flex-direction: row; justify-content: flex-start; gap: .75rem; min-height: 44px; padding: 0 .85rem; border-radius: var(--r2); font-size: .95rem; }
  #menu a:hover { background: var(--superficie-2); }
  #menu a.activo { background: var(--acento-t); }
  .aviso { bottom: 24px; }
}

/* =========================================================
   Etiquetas y chips
   ========================================================= */
.etiqueta { display: inline-flex; align-items: center; gap: .25rem; font-size: .75rem; font-weight: 600; padding: .15rem .6rem; border-radius: 999px; background: var(--superficie-2); color: var(--suave); margin: 0 .3rem .3rem 0; }
.etiqueta.movil, .etiqueta.ok { background: var(--ok-t); color: var(--ok); }
.etiqueta.alerta { background: var(--alerta-t); color: var(--alerta); }
.etiqueta.mal { background: var(--mal-t); color: var(--mal); }
.chips-fila { display: flex; gap: .4rem; overflow-x: auto; padding: .1rem 0 .6rem; scrollbar-width: none; }
.chips-fila::-webkit-scrollbar { display: none; }
.chip { min-height: 36px; padding: .25rem .8rem; border-radius: 999px; font-size: .82rem; white-space: nowrap; }
.chip.activo { background: var(--texto); border-color: var(--texto); color: #fff; }
@media (hover: hover) { .chip.activo:hover { background: var(--texto); } }

/* =========================================================
   LLAMADAS
   ========================================================= */
.cold-cab { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; gap: .6rem; flex-wrap: wrap; }
.cold-filtros { display: flex; gap: 1.1rem; flex-wrap: wrap; font-size: .85rem; color: var(--suave); }
.cold-filtros label { display: flex; align-items: center; gap: .45rem; margin: 0; min-height: 40px; }
.cold-filtros input { width: 20px; height: 20px; min-height: 0; margin: 0; accent-color: var(--acento); }
.cold-grid { display: block; }
.cola { display: none; }
.ficha { background: var(--superficie); border: 1px solid var(--borde); border-radius: var(--r3); padding: 1.5rem 1.2rem; text-align: center; box-shadow: var(--sombra); }
.ficha .nombre { font-family: "Manrope", sans-serif; font-weight: 800; font-size: 1.6rem; line-height: 1.2; letter-spacing: -.02em; margin: .3rem 0 .35rem; word-break: break-word; }
.ficha .dir { color: var(--suave); font-size: .92rem; margin-bottom: .4rem; }
.ficha .tel { display: flex; flex-direction: column; align-items: center; gap: .15rem; margin: 1.1rem 0; padding: 1rem; border-radius: var(--r2); background: var(--superficie-2); border: 1px solid var(--borde); color: var(--texto); text-decoration: none; font-family: "Manrope", sans-serif; font-weight: 800; font-size: 2.1rem; letter-spacing: .01em; transition: background-color .15s var(--salida), transform .1s var(--salida); }
.ficha .tel:active { transform: scale(.98); }
.ficha .tel small { display: flex; align-items: center; gap: .35rem; font-family: "Inter", sans-serif; font-size: .8rem; font-weight: 600; color: var(--acento); letter-spacing: 0; }
.ficha .acciones2 { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; margin-top: 1.1rem; }
.ficha .secundarias { display: flex; justify-content: center; gap: .2rem; flex-wrap: wrap; margin-top: .9rem; }
.motivos { display: grid; gap: .5rem; margin-top: .9rem; }
.contador { text-align: center; margin-top: 1rem; }

@media (min-width: 900px) {
  .cold-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 1.5rem; align-items: start; }
  .cola { display: block; }
  .cola h3 { margin-top: 0; }
  .cola-item { display: flex; flex-direction: column; align-items: flex-start; gap: 0; width: 100%; min-height: 56px; margin-bottom: .5rem; text-align: left; font-weight: 400; border-radius: var(--r2); }
  .cola-item b { font-weight: 600; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .ficha { padding: 2.2rem 2rem; }
  .ficha .nombre { font-size: 2rem; }
  .ficha .tel { font-size: 2.6rem; }
  .ficha .acciones2 { max-width: 460px; margin-inline: auto; }
}

/* =========================================================
   HOME
   ========================================================= */
.home-grid { display: block; }
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: .75rem; margin: 1rem 0 0; }
.stat { background: var(--superficie); border: 1px solid var(--borde); border-radius: var(--r2); padding: .9rem 1rem; box-shadow: var(--sombra); }
.stat b { display: block; font-family: "Manrope", sans-serif; font-size: 1.9rem; line-height: 1.1; font-weight: 800; letter-spacing: -.02em; }
.stat span { font-size: .8rem; color: var(--suave); }
.cal { background: var(--superficie); border: 1px solid var(--borde); border-radius: var(--r3); padding: .8rem; box-shadow: var(--sombra); }
.cal-cab { display: flex; align-items: center; justify-content: space-between; margin-bottom: .4rem; }
.cal-cab strong { font-family: "Manrope", sans-serif; }
.cal-cab strong::first-letter { text-transform: uppercase; }
.cal-cab button { min-height: 40px; min-width: 40px; padding: 0; border: 0; border-radius: 50%; background: none; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; text-align: center; }
.cal-grid .dow { font-size: .7rem; font-weight: 600; color: var(--suave); padding: 4px 0; }
.cal-grid button { min-height: 44px; padding: 0; border: 0; border-radius: var(--r2); background: transparent; font-weight: 500; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
.cal-grid button.fuera { color: var(--suave); font-weight: 400; }
.cal-grid button.hoy { color: var(--acento); font-weight: 800; }
.cal-grid button.sel { background: var(--acento); color: #fff; }
.cal-grid button .punto { width: 5px; height: 5px; border-radius: 50%; background: var(--acento); }
.cal-grid button.sel .punto { background: #fff; }
.cal-grid button .punto.sinvisita { background: transparent; }
.visita { display: flex; align-items: center; gap: .9rem; background: var(--superficie); border: 1px solid var(--borde); border-radius: var(--r2); padding: .9rem 1rem; margin-bottom: .8rem; box-shadow: var(--sombra); }
.visita .hora { font-family: "Manrope", sans-serif; font-weight: 800; min-width: 3.5rem; }
.visita .info { flex: 1; min-width: 0; }
.visita .info b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.visita .icono-btn { color: var(--acento); background: var(--acento-t); }
.visita button.enlace { min-height: 36px; min-width: 36px; padding: 0; color: var(--suave); }
@media (min-width: 900px) {
  .home-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 2rem; align-items: start; }
}

/* =========================================================
   LEADS: tarjetas en móvil, tabla en escritorio
   ========================================================= */
.barra-leads { display: grid; grid-template-columns: 1fr 150px; gap: .6rem; margin: 1rem 0 .7rem; }
.barra-leads input, .barra-leads select { margin: 0; }
.lead-cab { display: none; }
.lead-item { display: grid; grid-template-columns: 1fr auto; grid-template-areas: "n e" "t r"; gap: .1rem .8rem; align-items: center; width: 100%; text-align: left; background: var(--superficie); border: 1px solid var(--borde); border-radius: var(--r2); padding: .75rem .95rem; margin-bottom: .5rem; min-height: 64px; font-weight: 400; box-shadow: var(--sombra); }
.lead-item .ln { grid-area: n; font-weight: 700; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.lead-item .lt { grid-area: t; font-size: .85rem; color: var(--suave); }
.lead-item .le { grid-area: e; justify-self: end; }
.lead-item .lr { grid-area: r; justify-self: end; display: flex; gap: .55rem; color: var(--suave); min-height: 18px; }
.lead-item .etiqueta { margin: 0; }
@media (min-width: 900px) {
  .barra-leads { grid-template-columns: minmax(0, 420px) 200px; }
  .lead-cab, .lead-item { display: grid; grid-template-columns: minmax(0, 2.2fr) 1.2fr 1.2fr 1fr; grid-template-areas: "n t e r"; gap: 1rem; }
  .lead-cab { padding: .4rem 1rem; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--suave); }
  .lead-item { min-height: 54px; padding: .45rem 1rem; margin-bottom: .35rem; box-shadow: none; }
  .lead-item:hover { background: var(--superficie-2); }
  .lead-item .le, .lead-item .lr { justify-self: start; }
  .lead-item .lt { font-size: .95rem; color: var(--texto); }
}

/* =========================================================
   WHATSAPP: lista + acciones + conversación + filtros
   ========================================================= */
.wa { display: block; }
.wa-col-lista { display: block; }
.wa-col-chat { display: none; }
.wa-col-filtros { display: none; background: var(--superficie); border: 1px solid var(--borde); border-radius: var(--r3); padding: .2rem 1rem 1rem; margin-bottom: .8rem; }
.wa.filtros-abiertos .wa-col-filtros { display: block; }
.wa.con-chat .wa-col-lista, .wa.con-chat .wa-col-filtros { display: none; }
.wa.con-chat .wa-col-chat { display: flex; }
.wa-titulo { display: flex; align-items: center; justify-content: space-between; }
.wa-abre-filtros { gap: .35rem; }
.filtro-grupo h3 { margin: 1rem 0 .5rem; }
.chips-col { display: flex; flex-wrap: wrap; gap: .4rem; }
.wa-col-filtros select { margin: 0; }
.wa-busca { position: relative; margin: .9rem 0 .7rem; color: var(--suave); }
.wa-busca .svg { position: absolute; left: .85rem; top: 50%; transform: translateY(-50%); }
.wa-busca input { margin: 0; padding-left: 2.5rem; }
.wa-item { display: flex; align-items: center; gap: .75rem; width: 100%; text-align: left; border: 0; border-radius: var(--r2); background: none; padding: .65rem .6rem; min-height: 64px; font-weight: 400; }
.wa-item.sel { background: var(--acento-t); }
.avatar { flex: none; width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; background: var(--superficie-2); color: var(--texto); font-family: "Manrope", sans-serif; font-weight: 800; }
.wa-item.sel .avatar { background: #fff; color: var(--acento); }
.wa-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.wa-fila { display: flex; align-items: center; justify-content: space-between; gap: .5rem; min-width: 0; }
.wa-fila b { font-weight: 600; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.wa-prev { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.punto-rojo { flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--acento); }
.wa-col-chat { flex-direction: column; height: calc(100dvh - var(--cab-h) - var(--nav-h) - 2.4rem - env(safe-area-inset-bottom)); background: var(--superficie); border: 1px solid var(--borde); border-radius: var(--r3); overflow: hidden; box-shadow: var(--sombra); }
.wa-cab { display: flex; align-items: center; gap: .6rem; padding: .6rem .8rem; border-bottom: 1px solid var(--borde); }
.wa-quien { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.wa-quien b { overflow-wrap: anywhere; }
.chip-visita { align-self: flex-start; margin: .2rem 0 0; }
.wa-acciones { flex: none; padding: .7rem .8rem; border-bottom: 1px solid var(--borde); background: var(--superficie); }
.acciones-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(92px, 1fr)); gap: .5rem; }
.accion { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .25rem; min-height: 64px; padding: .4rem; border-radius: var(--r2); border: 1px solid var(--borde-fuerte); background: var(--superficie); color: var(--texto); font: inherit; font-size: .8rem; font-weight: 600; text-decoration: none; text-align: center; cursor: pointer; transition: background-color .15s var(--salida), transform .1s var(--salida); }
.accion:active { transform: scale(.97); }
@media (hover: hover) { .accion:hover { background: var(--superficie-2); } }
.accion.principal { background: var(--azul-accion); border-color: var(--azul-accion); color: #fff; }
@media (hover: hover) { .accion.principal:hover { background: var(--azul-accion-h); } }
.accion.ambar { color: var(--alerta); }
.accion.peligro { background: var(--mal); border-color: var(--mal); color: #fff; }
@media (hover: hover) { .accion.peligro:hover { background: #912018; } }
.accion:disabled { opacity: .45; }
.motivos-fila { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .6rem; }
.motivos-fila button { min-height: 40px; font-size: .85rem; }
.nota { margin: 0; padding: .5rem .9rem; font-size: .82rem; background: var(--alerta-t); color: var(--alerta); }
.wa-msgs { flex: 1; min-height: 0; overflow-y: auto; padding: 1rem .9rem; display: flex; flex-direction: column; gap: .35rem; background: var(--fondo); }
.wa-dia { align-self: center; font-size: .72rem; font-weight: 600; color: var(--suave); background: var(--superficie); border: 1px solid var(--borde); border-radius: 999px; padding: .1rem .7rem; margin: .5rem 0; }
.wa-dia::first-letter { text-transform: uppercase; }
.burbuja { max-width: 82%; width: fit-content; padding: .5rem .75rem .35rem; border-radius: 16px; font-size: .95rem; line-height: 1.4; box-shadow: var(--sombra); overflow-wrap: break-word; }
.burbuja.in { align-self: flex-start; background: var(--superficie); border-bottom-left-radius: 5px; }
.burbuja.out { align-self: flex-end; background: var(--acento-t); border-bottom-right-radius: 5px; }
.burbuja.fallo { background: var(--mal-t); }
.burbuja .txt-msg { display: block; white-space: pre-wrap; }
.burbuja .meta { display: flex; align-items: center; justify-content: flex-end; gap: .25rem; font-size: .7rem; color: var(--suave); margin-top: 2px; }
.burbuja.fallo .estado-msg { color: var(--mal); }
.wa-compose { flex: none; display: flex; align-items: flex-end; gap: .5rem; padding: .6rem; border-top: 1px solid var(--borde); background: var(--superficie); }
.wa-compose textarea { margin: 0; min-height: 46px; max-height: 140px; resize: none; border-radius: 23px; padding: .7rem 1rem; }
.enviar { flex: none; width: 46px; height: 46px; min-height: 0; padding: 0; border-radius: 50%; background: var(--acento); border-color: var(--acento); color: #fff; }
@media (hover: hover) { .enviar:hover { background: var(--acento-h); } }
.wa-vacio { margin: auto; text-align: center; color: var(--suave); display: flex; flex-direction: column; align-items: center; gap: .6rem; }
@media (min-width: 900px) {
  .wa { display: grid; grid-template-columns: 350px minmax(0, 1fr); gap: 1.2rem; align-items: start; height: calc(100dvh - var(--cab-h) - 5.2rem); }
  .wa-abre-filtros { display: none; }
  .wa-col-lista, .wa.con-chat .wa-col-lista { display: block; overflow-y: auto; max-height: 100%; padding-right: .3rem; }
  .wa-col-filtros, .wa.con-chat .wa-col-filtros { display: block; margin: 0; max-height: 100%; overflow-y: auto; }
  .wa-col-chat, .wa.con-chat .wa-col-chat { display: flex; height: 100%; }
  .wa-acciones { flex: 0 0 auto; min-height: 25%; display: flex; flex-direction: column; justify-content: center; }
  .accion { min-height: 76px; }
  .burbuja { max-width: 68%; }
}

/* =========================================================
   Marcadores de sección (Vendedores / Compradores)
   ========================================================= */
.hueco { margin-top: 1.2rem; background: var(--superficie); border: 1px dashed var(--borde-fuerte); border-radius: var(--r3); padding: 2.4rem 1.4rem; text-align: center; }
.hueco-ico { display: inline-grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; background: var(--acento-t); color: var(--acento); margin-bottom: .8rem; }
.hueco p { margin: .2rem auto; max-width: 440px; }

/* =========================================================
   Diálogos: hoja inferior en móvil, tarjeta centrada en escritorio
   ========================================================= */
dialog { border: 0; padding: 0; width: min(460px, 100%); max-height: 92dvh; border-radius: var(--r3); color: var(--texto); background: var(--superficie); box-shadow: var(--sombra-2); }
dialog::backdrop { background: rgba(16, 24, 40, .45); }
dialog[open] { animation: sube .22s var(--salida); }
dialog[open]::backdrop { animation: aparece .2s ease-out; }
dialog form, dialog .hoja { padding: 1.3rem; padding-bottom: calc(1.3rem + env(safe-area-inset-bottom)); overflow-y: auto; max-height: 92dvh; display: block; }
dialog h2 { margin-bottom: .25rem; }
dialog .pequeno { margin: 0 0 1rem; }
.acciones { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; margin-top: .5rem; }
.fila-enlace { display: flex; align-items: center; gap: .8rem; min-height: 56px; padding: 0 .4rem; border-bottom: 1px solid var(--borde); color: var(--texto); text-decoration: none; font-weight: 600; }
.fila-enlace .ico { color: var(--acento); display: flex; }
dialog .hoja button { width: 100%; margin-top: 1rem; }
@media (max-width: 599px) {
  dialog { margin: auto 0 0; width: 100%; max-width: 100%; border-radius: var(--r3) var(--r3) 0 0; }
}
@keyframes sube { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes aparece { from { opacity: 0; } to { opacity: 1; } }

/* Menos movimiento si el sistema lo pide */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}


/* =========================================================
   Bandeja: clasificación, nombre editable, contador
   ========================================================= */
#menu a { position: relative; }
.badge { position: absolute; top: 6px; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--mal); color: #fff; font-size: .68rem; font-weight: 700; line-height: 18px; text-align: center; }
@media (min-width: 900px) { .badge { position: static; margin-left: auto; } }
.etiqueta.mini { font-size: .66rem; padding: .05rem .45rem; margin: 0 0 0 .4rem; }
.wa-nom { display: flex; align-items: center; min-width: 0; }
.wa-nom b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.nombre-caja { min-width: 0; }
.nombre-btn { display: inline-flex; align-items: center; gap: .4rem; min-height: 32px; padding: 0 .3rem 0 0; border: 0; background: none; text-align: left; max-width: 100%; color: var(--texto); }
.nombre-btn b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nombre-btn .svg { color: var(--suave); flex: none; }
@media (hover: hover) { .nombre-btn:hover { background: none; } .nombre-btn:hover .svg { color: var(--acento); } }
.nombre-input { margin: 0; min-height: 40px; padding: .4rem .7rem; font-weight: 600; }
.grande-input { min-height: 48px; margin: .6rem 0 .7rem; }
.wa-acciones.clasificar { background: #FFF8EB; }
.clasificar-t { margin: 0; font-family: "Manrope", sans-serif; font-weight: 800; font-size: 1.05rem; }
.clasificar .pequeno { margin: .15rem 0 0; }
.acciones-grid.tres { grid-template-columns: repeat(3, 1fr); }
.cambiar-txt { flex-basis: 100%; margin: 0 0 .3rem; }
@media (min-width: 900px) {
  .wa-acciones .acciones-grid.tres { grid-template-columns: repeat(3, 1fr); max-width: 520px; }
}


/* =========================================================
   Bandeja v2: vistas con color, filtros plegables, chat seleccionado en color fuerte
   ========================================================= */
.wa-col-filtros, .wa-abre-filtros, .wa-titulo { display: none; }
.vistas { display: flex; flex-wrap: wrap; gap: .4rem; padding: .7rem 0 .2rem; }
.vistas::-webkit-scrollbar { display: none; }
.vista { min-height: 38px; padding: .25rem .7rem; border-radius: 999px; font-size: .82rem; white-space: nowrap; gap: .4rem; }
.vista .n { font-weight: 800; }
.punto-c { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.c-naranja .punto-c { background: #F08C00; } .c-azul .punto-c { background: var(--azul-accion); } .c-gris .punto-c { background: #98A2B3; }
.vista.activa { background: var(--texto); border-color: var(--texto); color: #fff; }
@media (hover: hover) { .vista.activa:hover { background: var(--texto); } }
.wa-barra { display: flex; gap: .5rem; align-items: center; margin: .6rem 0; }
.wa-barra .wa-busca { flex: 1; margin: 0; }
.btn-filtros { min-height: 46px; padding: 0 .8rem; gap: .35rem; }
.n-filtros { background: var(--acento); color: #fff; border-radius: 999px; font-size: .7rem; min-width: 18px; height: 18px; line-height: 18px; text-align: center; padding: 0 4px; }
.wa-filtros-panel { background: var(--superficie); border: 1px solid var(--borde); border-radius: var(--r3); padding: .1rem 1rem 1rem; margin-bottom: .7rem; }
.wa-item { border-left: 5px solid transparent; border-radius: var(--r2); margin-bottom: 2px; background: var(--superficie); }
.wa-item .avatar { background: var(--superficie-2); }
.wa-item .hora { font-size: .78rem; color: var(--suave); flex: none; }
.wa-item .wa-prev { font-size: .85rem; color: var(--suave); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wa-item.k-clasificar { background: #FFF1DC; border-left-color: #F08C00; }
.wa-item.k-clasificar .avatar { background: #FFD9A0; color: #8A4B00; }
.wa-item.k-responder { background: #E6EEFF; border-left-color: var(--azul-accion); }
.wa-item.k-responder .avatar { background: #BCD0FF; color: #123C86; }
.wa-item.k-responder .wa-prev { color: var(--texto); font-weight: 600; }
.wa-item.k-cola { background: #F1EBFF; border-left-color: #7C4DFF; }
.wa-item.k-error { background: var(--mal-t); border-left-color: var(--mal); }
.wa-item.k-esperando { border-left-color: #C4CAD4; }
.wa-item.k-descartado { opacity: .6; }
.wa-item.sel, .wa-item.sel.k-clasificar, .wa-item.sel.k-responder, .wa-item.sel.k-cola, .wa-item.sel.k-error { background: var(--azul-accion); border-left-color: #0B3A8A; color: #fff; opacity: 1; }
.wa-item.sel .hora, .wa-item.sel .wa-prev { color: rgba(255, 255, 255, .85); }
.wa-item.sel .avatar { background: #fff; color: var(--azul-accion); }
.codigo-ficha { font-weight: 600; margin-bottom: .8rem !important; }
@media (min-width: 900px) { .wa-col-lista { padding-right: .4rem; } }

/* =========================================================
   Propiedades, casar y plantillas
   ========================================================= */
.cab-seccion { display: flex; align-items: center; justify-content: space-between; gap: .8rem; margin-bottom: .9rem; }
.cab-seccion button { min-height: 44px; }
.lista-props { display: flex; flex-direction: column; gap: .85rem; margin: 1rem 0 1.2rem; }
.prop-card { display: flex; align-items: center; gap: .8rem; width: 100%; text-align: left; padding: .9rem 1rem; border-radius: var(--r2); background: var(--superficie); border: 1px solid var(--borde); font-weight: 400; box-shadow: var(--sombra); }
.prop-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.prop-txt b { overflow-wrap: anywhere; }
.miniatura { flex: none; width: 64px; height: 64px; border-radius: var(--r1); background: var(--superficie-2); color: var(--suave); display: grid; place-items: center; overflow: hidden; }
.miniatura img, .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.f-dlg h3 { margin-top: 1.2rem; }
dialog.ancha { width: min(820px, 100%); }
.pegar { margin-bottom: 1rem; }
.pegar textarea { min-height: 84px; margin-bottom: .5rem; background: var(--superficie-2); }
.pegar button { width: 100%; }
.chk { display: inline-block; width: 22px; height: 22px; min-height: 0; margin: 0 .5rem 0 0; vertical-align: middle; accent-color: var(--acento); }
.chk-fila { display: flex; align-items: center; margin-top: -.3rem; }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: .5rem; margin-bottom: .7rem; }
.thumb { position: relative; aspect-ratio: 1; border-radius: var(--r1); overflow: hidden; background: var(--superficie-2); }
.thumb-x { position: absolute; top: 4px; right: 4px; min-height: 32px; width: 32px; padding: 0; border-radius: 50%; background: rgba(16, 24, 40, .75); color: #fff; border: 0; }
.oculto { display: none; }
.auto-form { margin-top: .4rem; }
.auto-form textarea { min-height: 220px; }
.casar-fila { display: flex; align-items: center; gap: .7rem; padding: .7rem 0; border-bottom: 1px solid var(--borde); }
.casar-acc { display: flex; flex-direction: column; align-items: stretch; gap: .35rem; flex: none; }
.sel-mini { min-height: 40px; margin: 0; padding: .3rem .5rem; font-size: .85rem; }
button.enlace.corto { align-self: flex-start; min-height: 32px; padding: 0; }
button.enlace.peligro-t { color: var(--mal); width: 100%; margin-top: .6rem; }
.prev-msg { white-space: pre-wrap; font: inherit; font-size: .92rem; background: #E7FCE8; border-radius: var(--r2); padding: .8rem; margin: 0 0 1rem; max-height: 240px; overflow-y: auto; }
.prev-3 { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-line; }

.sugerencias { margin: -.5rem 0 .9rem; background: var(--superficie); border: 1px solid var(--borde-fuerte); border-radius: var(--r2); box-shadow: var(--sombra-2); overflow: hidden; }
.sugerencias button { width: 100%; justify-content: flex-start; text-align: left; border: 0; border-radius: 0; border-bottom: 1px solid var(--borde); font-weight: 400; min-height: 46px; }
.sugerencias button:last-child { border-bottom: 0; }
.sugerencias .svg { color: var(--acento); }

.cab-botones { display: flex; gap: .5rem; flex-wrap: wrap; justify-content: flex-end; }
.cab-botones button { min-height: 44px; }
.f-dlg > button { width: 100%; margin-top: .6rem; }
.f-dlg .acciones button { margin-top: 0; }
.f-dlg input, .f-dlg select { min-height: 52px; }
.cab-seccion { flex-wrap: wrap; }

.auto-btn { flex: none; width: 46px; height: 46px; min-height: 0; padding: 0; border-radius: 50%; background: var(--superficie-2); color: var(--azul-accion); }

.caja-tz { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; margin-bottom: .9rem; }
.caja-tz .total-tz { grid-column: 1 / -1; margin: 0; background: var(--superficie-2); border-radius: var(--r1); padding: .5rem .7rem; color: var(--texto); }

.thumb-item { display: flex; flex-direction: column; gap: .3rem; }
.thumb-item .sel-mini { width: 100%; min-height: 40px; }
.thumbs { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }

.visita.anulada { opacity: .65; }
.acc-visita { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .45rem; }
.acc-visita .pequeno-btn { min-height: 40px; padding: .2rem .7rem; font-size: .82rem; }
.acc-visita .peligro { color: var(--mal); }

.visita .hora { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.15; min-width: 5.2rem; }
.visita .hora .dia { font-size: .78rem; font-weight: 600; color: var(--suave); text-transform: capitalize; }
.visita .hora .h { font-family: "Manrope", sans-serif; font-size: 1.5rem; font-weight: 800; }

.auto-card { background: var(--superficie); border: 1px solid var(--borde); border-radius: var(--r2); padding: 1rem; margin-bottom: .8rem; box-shadow: var(--sombra); }
.auto-cab { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: .4rem; }
.auto-card .auto-cab .etiqueta { margin-top: .3rem; }
.auto-card textarea { min-height: 140px; }
.interruptor { appearance: none; -webkit-appearance: none; flex: none; width: 56px; height: 32px; min-height: 0; margin: 0; padding: 0; border-radius: 999px; border: 0; background: #CBD1DB; position: relative; cursor: pointer; transition: background-color .2s var(--salida); }
.interruptor::after { content: ""; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(16,24,40,.3); transition: transform .2s var(--salida); }
.interruptor:checked { background: var(--ok); }
.interruptor:checked::after { transform: translateX(24px); }
.interruptor:focus-visible { outline: 3px solid var(--acento); outline-offset: 2px; }

.atencion { margin-bottom: 1.4rem; }
.atencion-lista { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: .8rem; }
.atencion-item { display: flex; align-items: center; gap: .8rem; width: 100%; text-align: left; padding: .8rem 1rem; border-radius: var(--r2); background: var(--superficie); border: 1px solid var(--borde); border-left: 5px solid var(--acento); font-weight: 500; box-shadow: var(--sombra); }
.atencion-item .n { font-family: "Manrope", sans-serif; font-size: 1.5rem; font-weight: 800; min-width: 2rem; }
.atencion-item span { flex: 1; }
.atencion-item.c-naranja { border-left-color: #E8833A; }
.atencion-item.c-azul { border-left-color: var(--azul-accion); }
.atencion-item.c-rojo { border-left-color: var(--mal); }
.atencion-ok { display: flex; align-items: center; gap: .5rem; margin: 0; padding: .7rem 1rem; border-radius: var(--r2); background: var(--ok-t); color: var(--ok); font-weight: 600; }

/* ---- accesibilidad: avisos de error que se quedan, obligatorios, objetivos táctiles de 44 px ---- */
.aviso { display: flex; align-items: center; gap: .7rem; }
.aviso-x { flex: none; min-height: 36px; min-width: 36px; width: 36px; padding: 0; border: 0; border-radius: 50%; background: rgba(255, 255, 255, .2); color: #fff; }
@media (hover: hover) { .aviso-x:hover { background: rgba(255, 255, 255, .35); } }
.oblig { font-weight: 400; color: var(--suave); font-size: .8rem; }
.error.en-campo { margin: -.4rem 0 .9rem; }
[aria-invalid="true"] { border-color: var(--mal); box-shadow: 0 0 0 3px var(--mal-t); }
.chk { width: 26px; height: 26px; }
html { scroll-padding-top: calc(var(--cab-h) + 12px); }
@media (max-width: 899px) {
  .chip, .vista { min-height: 44px; }
  .barra button.enlace, button.pequeno-btn, .acc-visita .pequeno-btn, .sel-mini, .cal-cab button { min-height: 44px; }
  .barra button.enlace, .cal-cab button { min-width: 44px; }
  .thumb-x { min-height: 40px; width: 40px; }
}

/* diálogos propios (div.f-dlg): mismos márgenes que los formularios */
.f-dlg { padding: 1.3rem; padding-bottom: calc(1.3rem + env(safe-area-inset-bottom)); overflow-y: auto; max-height: 92dvh; display: block; }
.f-dlg > h2 + .pequeno { margin-bottom: .8rem; }
/* filtros bajo un buscador: respirar */
input[type=search] + .chips-fila { margin-top: .8rem; }
.chips-fila + h3, .chips-fila + .lista-props { margin-top: .4rem; }

/* foco visible también sobre fondos azules; enlace de salto; título solo para lectores */
.barra :focus-visible, .centro :focus-visible { outline-color: #fff; }
.solo-lectores { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.saltar { position: absolute; left: .6rem; top: -4rem; z-index: 40; background: #fff; color: var(--texto); padding: .7rem 1rem; border-radius: var(--r2); box-shadow: var(--sombra-2); font-weight: 600; transition: top .15s var(--salida); }
.saltar:focus { top: .6rem; }
#contenido:focus { outline: none; }

/* alertas del sistema (Home) */
.alertas { display: grid; gap: .6rem; margin-bottom: .9rem; }
.alerta { display: flex; align-items: flex-start; gap: .8rem; padding: .85rem 1rem; border-radius: var(--r2); background: var(--superficie); border: 1px solid var(--mal); border-left: 5px solid var(--mal); box-shadow: var(--sombra); }
.alerta > .ico, .alerta > svg { color: var(--mal); flex: none; margin-top: .1rem; }
.alerta-txt { flex: 1; display: grid; gap: .2rem; }
.alerta-txt .pequeno { margin: 0; }
.alerta .pequeno-btn { flex: none; }

/* =========================================================
   Fichas de comprador, fases y diario (entrega 2)
   ========================================================= */
.nombre-visita { display: block; width: 100%; min-height: 0; padding: 0; border: 0; background: none; text-align: left; font: inherit; font-weight: 700; color: var(--acento); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-decoration: underline; text-underline-offset: 3px; }
.tel-visita { display: block; font-size: .92rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.prop-visita { margin: .25rem 0 .1rem; max-width: 100%; }
.etiqueta.fase { background: var(--acento-t); color: var(--acento); }
.etiqueta.fase.f-descartado { background: var(--mal-t); color: var(--mal); }
.etiqueta.fase.f-en_pausa { background: var(--alerta-t); color: var(--alerta); }
.etiqueta.fase.f-oferta, .etiqueta.fase.f-documentacion, .etiqueta.fase.f-firma, .etiqueta.fase.f-cerrado { background: var(--ok-t); color: var(--ok); }
button.fase-btn { border: 0; cursor: pointer; min-height: 32px; background: var(--acento-t); color: var(--acento); }
.ficha .ficha-tel { font-size: 1.05rem; font-weight: 700; margin: 0 0 .6rem; font-variant-numeric: tabular-nums; }
.ficha .ficha-emp { background: var(--superficie-2); border-radius: var(--r2); padding: .8rem 1rem; margin: .4rem 0 .9rem; }
.ficha .ficha-emp b { display: block; margin-bottom: .35rem; }
.ficha .op-fila { display: flex; flex-wrap: wrap; gap: .5rem; margin: .3rem 0 .8rem; }
.ficha .opciones { display: grid; gap: .5rem; margin: .3rem 0 1rem; }
.ficha .op-t { font-weight: 700; margin: 0; }
.ficha .op-btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; width: auto; min-height: 48px; margin: 0; padding: .4rem 1rem; border-radius: var(--r2); border: 1px solid var(--borde); background: var(--superficie); color: var(--texto); font-weight: 600; font-size: .92rem; text-decoration: none; cursor: pointer; }
.ficha .opciones .op-btn { width: 100%; justify-content: flex-start; }
.ficha .op-btn.primario { background: var(--acento); border-color: var(--acento); color: #fff; }
.ficha .op-btn.peligro { color: var(--mal); }
.ficha .op-btn.suave, .ficha .op-btn.atras { color: var(--suave); background: transparent; }
.ficha .casar-fila { display: grid; grid-template-columns: 1fr auto; gap: .5rem; margin: .4rem 0 1rem; }
.ficha .casar-fila select { margin: 0; }
.ficha .casar-fila .op-btn { margin: 0; }
.ficha textarea { width: 100%; }
.ficha .chips-fila { margin-top: .3rem; }
.ficha .chips-fila .chip { width: auto; margin: 0; }
.ficha .cerrar-ficha { width: 100%; margin-top: 1rem; }
.diario h3 { margin: 1rem 0 .4rem; }
.diario .ap { display: grid; grid-template-columns: 8.5rem 1fr; gap: .1rem .6rem; padding: .5rem 0; border-top: 1px solid var(--borde); font-size: .88rem; }
.diario .ap-f { color: var(--suave); font-variant-numeric: tabular-nums; }
.diario .ap-q { grid-column: 2; color: var(--suave); font-size: .76rem; }
.diario .ap-resultado .ap-t, .diario .ap-correccion .ap-t { font-weight: 600; }
.barra-comp { display: grid; grid-template-columns: 1fr; gap: .5rem; margin: 1rem 0 .7rem; }
.barra-comp input, .barra-comp select { margin: 0; }
@media (min-width: 900px) { .barra-comp { grid-template-columns: minmax(0, 1.4fr) 1fr 1fr; } }
.comp-item { display: grid; grid-template-columns: 1fr; gap: .15rem; width: 100%; text-align: left; background: var(--superficie); border: 1px solid var(--borde); border-radius: var(--r2); padding: .75rem .95rem; margin-bottom: .5rem; min-height: 64px; font-weight: 400; box-shadow: var(--sombra); }
.comp-item .comp-n { font-weight: 700; }
.comp-item .comp-t { font-size: .85rem; color: var(--suave); }
.comp-item .comp-e { display: flex; flex-wrap: wrap; margin-top: .2rem; }
.comp-item .etiqueta { margin: 0 .3rem .2rem 0; }
@media (hover: hover) { .comp-item:hover { background: var(--superficie-2); } }
.ficha .diario, .ficha .ficha-emp, .ficha .opciones { text-align: left; }
.ficha .ficha-emp { text-align: center; }
.diario h3 { text-align: left; }
.visita .info > div > .etiqueta { max-width: 100%; }
/* La etiqueta «alerta» chocaba con el aviso grande .alerta (borde rojo, caja ancha) */
.etiqueta.alerta { display: inline-flex; padding: .15rem .6rem; border: 0; border-radius: 999px; box-shadow: none; gap: .25rem; align-items: center; }
/* Tarjeta de visita en pantallas estrechas: hora arriba y datos debajo, para que se lea el nombre */
@media (max-width: 599px) {
  .visita { flex-direction: column; align-items: stretch; gap: .5rem; }
  .visita .hora { flex-direction: row; align-items: baseline; gap: .6rem; min-width: 0; }
  .nombre-visita { white-space: normal; }
}
/* Visita pasada sin resultado: tarjeta entera en color de aviso y accion principal destacada */
.visita.por-resolver { background: var(--alerta-t); border-color: var(--alerta); border-left: 6px solid var(--alerta); }
.visita.por-resolver .hora .h { color: var(--alerta); }
.acc-visita .pequeno-btn.primario { font-weight: 800; min-height: 46px; padding: .3rem 1.1rem; font-size: .92rem; box-shadow: 0 2px 8px rgba(0, 0, 0, .18); }
/* Agenda: selección de visitas y acción en lote */
.sel-prop-ag { margin: .4rem 0 .6rem; max-width: 420px; }
.cab-sel { display: flex; align-items: center; justify-content: space-between; gap: .6rem; }
.cab-sel .pequeno-btn { min-height: 40px; }
.vis-sel { display: flex; align-items: flex-start; gap: .6rem; }
.vis-sel .chk-vis { width: 26px; height: 26px; min-height: 0; margin: 1.1rem 0 0; flex: none; accent-color: var(--acento); }
.vis-sel .visita { flex: 1; min-width: 0; }
.vis-sel.marcada .visita { outline: 2px solid var(--acento); }
.barra-lote { position: sticky; bottom: calc(var(--nav-h, 0px) + .6rem); z-index: 5; display: flex; align-items: center; gap: .6rem; background: var(--texto); color: #fff; border-radius: var(--r2); padding: .6rem .8rem; box-shadow: var(--sombra-2); }
.barra-lote span { flex: 1; font-weight: 700; }
.barra-lote .enlace { color: #fff; }
.barra-lote .primario { display: inline-flex; align-items: center; gap: .4rem; }
.plan-envio { padding-left: 1.2rem; margin: .3rem 0 1rem; font-size: .88rem; }
.plan-envio li { margin-bottom: .45rem; }
.plan-envio li.tarde { color: var(--mal); }
.plan-envio .etiqueta { margin: .2rem 0 0 .3rem; }
.fila-plan { display: flex; align-items: baseline; justify-content: space-between; gap: .5rem; }
.fila-plan .enlace { width: auto; margin: 0; }
.vista-msg { white-space: pre-wrap; font: inherit; font-size: .9rem; background: var(--superficie-2); border-radius: var(--r2); padding: .7rem .9rem; margin: .2rem 0 .8rem; }
.chk-anular { display: flex; gap: .6rem; align-items: flex-start; background: var(--mal-t); border-radius: var(--r2); padding: .7rem .8rem; margin: .4rem 0 .8rem; }
.chk-anular input { width: 22px; height: 22px; min-height: 0; margin: .1rem 0 0; flex: none; accent-color: var(--mal); }
.chk-anular .pequeno { margin: 0; }
.ya-visita { background: var(--alerta-t); color: var(--texto); border-radius: var(--r2); padding: .7rem .9rem; margin: .3rem 0 .9rem; }
.ya-visita p { margin: 0 0 .4rem; }
.ya-visita .op-fila { display: flex; flex-wrap: wrap; gap: .5rem; }
.ya-visita .pequeno-btn { width: auto; margin: 0; min-height: 42px; }
.ya-visita .peligro { color: var(--mal); }
/* Agendar / anular visita: desplegables a la misma altura que día y hora */
#dlg-visita select, #dlg-visita input, .f-dlg select { min-height: 52px; height: 52px; }
#dlg-visita textarea { min-height: 120px; }
button.peligro-fondo { background: var(--mal); border-color: var(--mal); color: #fff; }
.barra-ag { display: grid; grid-template-columns: 1fr; gap: .5rem; margin: .6rem 0 .5rem; }
.barra-ag input, .barra-ag select { margin: 0; max-width: none; }
@media (min-width: 900px) { .barra-ag { grid-template-columns: minmax(0, 1.3fr) 1fr; } }
/* Bandeja: visitas del comprador arriba del chat */
.wa-visitas { display: grid; gap: .4rem; padding: .5rem .8rem 0; }
.wa-vis { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem; background: var(--superficie-2); border: 1px solid var(--borde); border-radius: var(--r2); padding: .55rem .8rem; font-size: .9rem; }
.wa-vis.por-resolver { background: var(--alerta-t); border-color: var(--alerta); border-left: 6px solid var(--alerta); }
.wa-vis .pequeno-btn { min-height: 40px; padding: .2rem .8rem; font-size: .85rem; width: auto; margin: 0; }
.wa-vis .pequeno-btn.primario { font-weight: 800; box-shadow: 0 2px 8px rgba(0, 0, 0, .18); }
.wa-vis .peligro { color: var(--mal); }
.wa-vis-acc { display: flex; flex-wrap: wrap; gap: .4rem; }
/* Tarjeta de visita única: 4 estados */
.visita.e-valorar { background: var(--alerta-t); border-color: var(--alerta); border-left: 6px solid var(--alerta); }
.visita.e-valorar .hora .h { color: var(--alerta); }
.visita.e-hecha { border-left: 6px solid var(--ok); }
.visita.e-hecha.res-malo { border-left-color: var(--mal); }
.visita.e-anulada { opacity: .6; border-left: 6px solid var(--borde-fuerte); }
.visita.compacta { padding: .6rem .8rem; margin-bottom: .5rem; box-shadow: none; }
.visita.compacta .hora { min-width: 4.2rem; }
.ficha-visitas h3 { margin: .6rem 0 .4rem; text-align: left; }
.ficha .visita .pequeno-btn { width: auto; margin: 0; }
/* Ficha del comprador: una tarjeta por propiedad */
.ficha .emp-card { text-align: left; border: 1px solid var(--borde); border-radius: var(--r2); padding: .8rem .9rem; margin: .6rem 0; background: var(--superficie); }
.ficha .emp-card.f-descartado, .ficha .emp-card.f-cerrado { background: var(--superficie-2); }
.ficha .prop-cab { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .4rem; margin-bottom: .5rem; }
.ficha .prop-cab .etiqueta { margin: 0; }
.ficha .paso-txt { align-self: center; font-weight: 600; color: var(--suave); padding: 0 .3rem; }
.ficha .op-fila .op-btn.primario { flex: 1; }
.ficha .ver-diario { width: 100%; margin: .6rem 0 .2rem; }

/* ---------- Campos con comprobación (Ajustes, ficha del local, formularios) ---------- */
.v-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .2rem 1.2rem; align-items: start; }
.v-grupo { padding: .2rem 0 .6rem; }
.v-grupo + .v-grupo { border-top: 1px dashed var(--borde); padding-top: .9rem; }
.v-grupo-t { font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--azul); margin: .3rem 0 .7rem; }
.v-campo > label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.v-campo > label > input, .v-campo > label > select { white-space: normal; }
.v-campo { margin-bottom: .9rem; }
.v-campo.v-ancho { grid-column: 1 / -1; }
.v-campo > label { margin-bottom: .2rem; }
.v-campo .v-ext { margin: .1rem 0 0; font-weight: 400; }
input.v-ok, select.v-ok, textarea.v-ok { border-color: var(--ok) !important; box-shadow: 0 0 0 1px var(--ok); background: #f6fef9; }
input.v-mal, select.v-mal, textarea.v-mal { border-color: var(--mal) !important; box-shadow: 0 0 0 1px var(--mal); background: #fffbfa; }
.v-msg { font-size: .8rem; font-weight: 600; margin: .15rem 0 .2rem; }
.v-msg.ok { color: var(--ok); }
.v-msg.ok::before { content: '✓ '; }
.v-msg.error { color: var(--mal); }
.v-msg.error::before { content: '✕ '; }

/* ---------- Ajustes ---------- */
.aj-form { max-width: 880px; }
.aj-bloque { border: 1px solid var(--borde); border-radius: var(--r1); padding: 1.2rem 1.4rem .6rem; margin: 0 0 1.2rem; background: var(--superficie); }
.aj-bloque legend { font-weight: 700; padding: 0 .4rem; }
.aj-hueco { border: 0; background: none; padding: 0; min-height: 0; font: .72rem ui-monospace, Menlo, monospace; color: var(--suave); cursor: copy; }
.aj-hueco:hover { color: var(--texto); text-decoration: underline; }
.aj-pie { position: sticky; bottom: 0; display: flex; gap: .6rem; justify-content: flex-end; padding: .8rem 0; background: var(--fondo); }

/* ---------- Ficha del local ---------- */
.fl-bloque { border: 1px solid var(--borde); border-radius: var(--r1); padding: .2rem .9rem; margin: 0 0 .7rem; background: var(--superficie); }
.fl-bloque > summary { cursor: pointer; font-weight: 700; padding: .7rem 0; min-height: 44px; }
.fl-bloque[open] > summary { border-bottom: 1px solid var(--borde); margin-bottom: .4rem; }
.fl-bloque.fl-mal > summary { color: var(--mal); }
.fl-cuenta { font-weight: 400; color: var(--suave); font-size: .85rem; }
.fl-bloque.fl-mal .fl-cuenta { color: var(--mal); }
.fl-faltan { background: var(--alerta-t); color: var(--alerta); border-radius: var(--r2); padding: .6rem .8rem; margin: 0 0 1rem; font-size: .88rem; }
.fl-faltan .chip { margin: .3rem .3rem 0 0; background: var(--superficie); }
.fl-faltan.ok { background: var(--ok-t); color: var(--ok); }
.cargas { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 0 1rem; }
.carga input { margin: -.5rem 0 .9rem; }
select.carga-si { border-color: var(--alerta); }
@media (max-width: 600px) { .v-campo > label { white-space: normal; } }
.v-campo > label.v-ext { white-space: normal; }

/* ---------- Ficha del vendedor por enlace ---------- */
.enlace-ficha { border: 1px solid var(--borde); border-radius: var(--r1); padding: .8rem 1rem; margin: 0 0 1rem; background: var(--superficie); }
.enlace-ficha.pendiente { border-color: var(--alerta); background: var(--alerta-t); }
.enlace-ficha p { margin: .2rem 0 .6rem; }
.acciones-fila { display: flex; flex-wrap: wrap; gap: .5rem; }
.acciones-fila button { margin: 0; }
table.diff { width: 100%; border-collapse: collapse; font-size: .88rem; margin: .6rem 0 1rem; }
table.diff th { text-align: left; font-size: .75rem; text-transform: uppercase; color: var(--suave); padding: .4rem; border-bottom: 1px solid var(--borde); }
table.diff td { padding: .5rem .4rem; border-bottom: 1px solid var(--borde); vertical-align: top; }
table.diff td.antes { color: var(--suave); }
table.diff td.nuevo { font-weight: 600; }

/* ---------- Botones Sí / No (campos.js: segmento) ---------- */
.v-seg-campo { display: block; }
.v-seg-t { display: block; font-size: .85rem; font-weight: 500; color: var(--suave); margin-bottom: .35rem; }
.v-seg { display: flex; gap: .5rem; flex-wrap: wrap; }
.v-seg-b { flex: 1 1 0; min-width: 90px; min-height: 52px; margin: 0; border: 1.5px solid var(--borde-fuerte); background: var(--superficie); color: var(--texto); border-radius: var(--r2); font-weight: 600; }
.v-seg-b:hover { border-color: var(--azul-accion); }
.v-seg-b.on { background: var(--azul-accion); border-color: var(--azul-accion); color: #fff; }

/* ---------- Varios firmantes (campos.js: editorPersonas) ---------- */
.personas { display: grid; gap: .8rem; }
.persona { background: var(--superficie); border: 1px solid var(--borde); border-radius: var(--r1); padding: .7rem .9rem .2rem; }
.persona-cab { display: flex; justify-content: space-between; align-items: center; margin-bottom: .3rem; }
.persona-cab .enlace { margin: 0; min-height: 0; }
.pers-anadir { width: 100%; margin-top: .8rem; border-style: dashed; }
