/* Panel de clientes — móvil primero, letra grande, botones de pulgar. Estética tranquila y cuidada (clínicas de todo tipo,
   también estéticas): fondo marfil, tarjetas blancas con sombra suave, mucho aire, el color de cada clínica como acento. */
@font-face { font-family: "Inter"; src: url("/static/fuentes/inter-variable.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
:root {
  --principal: #412ce1; --principal-texto: #fff;
  --tinte: color-mix(in srgb, var(--principal) 9%, #fff);
  --tinte-fuerte: color-mix(in srgb, var(--principal) 16%, #fff);
  --principal-oscuro: color-mix(in srgb, var(--principal) 82%, #000);
  --fondo: #f7f5f2; --tarjeta: #fff; --texto: #1c1917; --suave: #78716c; --borde: #ebe7e1; --borde-fuerte: #d9d3cb;
  --rojo: #d92d4b; --rojo-fondo: #fdeef1; --verde: #0f9f6e; --verde-fondo: #e7f7f0; --naranja: #b45309; --naranja-fondo: #fff5e6;
  --wa: #1faa59;
  --sombra: 0 1px 2px rgba(28,25,23,.04), 0 6px 20px rgba(28,25,23,.05);
  --sombra-alta: 0 10px 40px rgba(28,25,23,.14);
  --radio: 18px;
  /* Colores de las fases (iguales para todas las clínicas, para leer el tablero de un vistazo) */
  --f-nuevo: #2563eb; --f-nuevo-fondo: #e8efff;
  --f-1: #c2410c; --f-1-fondo: #fff0e5;
  --f-2: #7c3aed; --f-2-fondo: #f2ebff;
  --f-3: #0e7490; --f-3-fondo: #e3f5f9;
  --f-4: #be185d; --f-4-fondo: #fdeaf3;
  --f-ganado: #0f9f6e; --f-ganado-fondo: #e3f6ee;
  --f-perdido: #78716c; --f-perdido-fondo: #f1efec;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; background: var(--fondo); color: var(--texto); font: 16px/1.5 "Inter", -apple-system, "Segoe UI", Roboto, system-ui, sans-serif;
  font-feature-settings: "cv11", "ss01"; -webkit-font-smoothing: antialiased; }
a { color: var(--principal-oscuro); text-decoration: none; }
h1 { font-size: 1.6rem; line-height: 1.2; margin: .2rem 0 .6rem; letter-spacing: -.025em; font-weight: 700; }
h2.titulo-seccion { font-size: .8rem; margin: 1.9rem 0 .7rem; font-weight: 650; letter-spacing: .09em; text-transform: uppercase; color: var(--suave); }
.texto-suave { color: var(--suave); font-size: .95rem; }
.texto-naranja { color: var(--naranja); }
.texto-rojo { color: var(--rojo); }
.margen-arriba { margin-top: 1.5rem; }
.numero { font-variant-numeric: tabular-nums; }
code { background: var(--fondo); border: 1px solid var(--borde); border-radius: 6px; padding: 0 .35rem; font-size: .9em; }
section { scroll-margin-top: 80px; }
svg.i { width: 22px; height: 22px; flex: none; }

/* ---------- Cabecera ---------- */
.cabecera { position: sticky; top: 0; z-index: 6; display: flex; align-items: center; justify-content: space-between; gap: .6rem;
  padding: calc(.55rem + env(safe-area-inset-top)) 16px .55rem; background: color-mix(in srgb, var(--fondo) 82%, transparent);
  -webkit-backdrop-filter: saturate(1.6) blur(16px); backdrop-filter: saturate(1.6) blur(16px); border-bottom: 1px solid color-mix(in srgb, var(--borde) 70%, transparent); }
.cabecera-titulo { font-weight: 650; font-size: 1.02rem; display: flex; align-items: center; gap: .65rem; min-width: 0; color: var(--texto); letter-spacing: -.01em; }
.cabecera-titulo span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cabecera-logo { width: 38px; height: 38px; object-fit: contain; background: #fff; border-radius: 11px; padding: 3px; flex: none; box-shadow: 0 0 0 1px var(--borde); }
.cabecera-usuario { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; border-radius: 50%; flex: none;
  background: var(--tinte-fuerte); color: var(--principal-oscuro); font-weight: 700; font-size: .95rem; }
.logo-inicial { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; border-radius: 11px; flex: none;
  background: var(--principal); color: var(--principal-texto); font-weight: 750; font-size: 1.1rem; }
.lista .logo-inicial, .pantalla-entrar .logo-inicial { color: #fff; }
.logo-inicial-grande { width: 80px; height: 80px; font-size: 2.2rem; border-radius: 24px; background: var(--principal); color: var(--principal-texto) !important; margin-bottom: .8rem;
  box-shadow: 0 12px 30px color-mix(in srgb, var(--principal) 35%, transparent); }
.banda-ver-como { position: sticky; top: 58px; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: .6rem;
  background: var(--naranja-fondo); border-bottom: 1px solid #f5c37a; padding: .5rem 16px; font-size: .92rem; margin: 0; }

.contenido { padding: 14px 16px calc(100px + env(safe-area-inset-bottom)); max-width: 720px; margin: 0 auto; }

/* ---------- Barra de abajo (móvil) / menú lateral (ordenador) ---------- */
.barra-inferior { position: fixed; bottom: 0; left: 0; right: 0; display: flex; z-index: 6;
  background: color-mix(in srgb, #fff 88%, transparent); -webkit-backdrop-filter: saturate(1.6) blur(18px); backdrop-filter: saturate(1.6) blur(18px);
  border-top: 1px solid var(--borde); padding: 4px 4px env(safe-area-inset-bottom); }
.menu-marca { display: none; }
.barra-inferior a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 1px; padding: .45rem 0 .4rem; color: var(--suave);
  font-size: .72rem; font-weight: 550; min-height: 58px; letter-spacing: .01em; }
.barra-inferior .icono { display: flex; align-items: center; justify-content: center; width: 52px; height: 30px; border-radius: 999px; transition: background .15s; }
.barra-inferior a.activo { color: var(--principal-oscuro); font-weight: 700; }
.barra-inferior a.activo .icono { background: var(--tinte-fuerte); }
.barra-inferior .icono svg { width: 23px; height: 23px; display: block; }

/* Botón flotante «+ Lead» */
.boton-flotante { position: fixed; right: 18px; bottom: calc(80px + env(safe-area-inset-bottom)); z-index: 7; display: inline-flex; align-items: center; gap: .4rem;
  height: 56px; padding: 0 1.3rem 0 1.05rem; border-radius: 18px; background: var(--principal); color: var(--principal-texto); font-weight: 700; font-size: 1rem;
  box-shadow: 0 10px 28px color-mix(in srgb, var(--principal) 40%, transparent), 0 2px 6px rgba(0,0,0,.12); }
.boton-flotante svg { width: 24px; height: 24px; }

/* ---------- Tarjetas y botones ---------- */
.tarjeta { background: var(--tarjeta); border: 1px solid var(--borde); border-radius: var(--radio); padding: 1.1rem; margin-bottom: .8rem; box-shadow: var(--sombra); }
.tarjeta-vacia { text-align: center; padding: 2rem 1.2rem; }
.tarjeta-vacia .emoji { font-size: 2.4rem; line-height: 1; margin-bottom: .6rem; }
.destacada { border: 1.5px solid color-mix(in srgb, var(--principal) 45%, var(--borde)); }
.destacada .titulo-seccion { margin-top: 0; }

.boton { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; min-height: 48px; padding: .6rem 1.15rem; border-radius: 14px;
  border: 1.5px solid var(--borde-fuerte); font: inherit; font-size: .97rem; font-weight: 600; cursor: pointer; background: var(--tarjeta); color: var(--texto);
  transition: transform .08s, filter .15s, background .15s; text-align: center; }
.boton:hover { background: #fbfaf8; }
.boton-principal { background: var(--principal); color: var(--principal-texto); border-color: var(--principal); width: 100%;
  box-shadow: 0 6px 16px color-mix(in srgb, var(--principal) 25%, transparent); }
.boton-principal:hover { background: var(--principal); filter: brightness(.94); }
.boton-bloque { width: 100%; margin-top: 1rem; }
.boton-pequeno { min-height: 40px; padding: .3rem .85rem; font-size: .9rem; border-radius: 12px; }
.boton-peligro { border-color: color-mix(in srgb, var(--rojo) 50%, #fff); color: var(--rojo); }
.boton-suave { background: var(--tinte); border-color: transparent; color: var(--principal-oscuro); }
.boton:active { transform: scale(.97); }
.boton-icono { width: 34px; height: 34px; border: 1px solid var(--borde); border-radius: 10px; background: var(--tarjeta); color: var(--texto); cursor: pointer; font-size: 1rem; }
.botones-fila { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-top: .7rem; }
.botones-fila .boton-principal { width: auto; flex: 1 1 200px; }
.titulo-con-boton { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .6rem; margin-bottom: .4rem; }
.titulo-con-boton .boton-principal { width: auto; }

/* ---------- Formularios ---------- */
.formulario label { display: block; font-weight: 600; margin-bottom: 1rem; font-size: .95rem; }
.formulario small { display: block; font-weight: 400; margin-top: .3rem; }
.formulario input[type=text], .formulario input[type=password], .formulario input[type=url], .formulario input[type=tel], .formulario input[type=email],
.formulario select, .formulario textarea, .lista-editable input[type=text], .lista-editable textarea, .formulario input[type=file], .campo {
  display: block; width: 100%; margin-top: .35rem; padding: .7rem .9rem; font: inherit; font-weight: 400; font-size: 1.05rem;
  border: 1.5px solid var(--borde); border-radius: 13px; background: #fcfbfa; color: var(--texto); min-height: 50px; transition: border-color .15s, box-shadow .15s; }
.formulario select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2378716c' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right .8rem center; background-size: 20px; padding-right: 2.6rem; }
.formulario textarea { min-height: 96px; resize: vertical; }
.formulario input[type=file] { font-size: .95rem; background: var(--tarjeta); }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--principal) !important; box-shadow: 0 0 0 4px color-mix(in srgb, var(--principal) 16%, transparent); }
.selector-color { display: block; width: 90px; height: 50px; margin-top: .35rem; border: 1.5px solid var(--borde); border-radius: 13px; padding: 3px; background: var(--tarjeta); }
.formulario fieldset { border: 1.5px solid var(--borde); border-radius: 14px; padding: .7rem 1rem .4rem; margin: 0 0 1rem; }
.formulario legend { font-weight: 650; padding: 0 .3rem; }
.formulario .opcion, .formulario .casilla, .casilla { display: flex; align-items: flex-start; gap: .65rem; font-weight: 500; min-height: 44px; margin-bottom: .35rem; }
.opcion input, .casilla input { width: 22px; height: 22px; margin: .1rem 0 0; flex: none; accent-color: var(--principal); }
.enlace-previo { display: flex; align-items: center; gap: .3rem; }
.enlace-previo .texto-suave { white-space: nowrap; font-weight: 400; }
.logo-actual { display: flex; align-items: center; gap: .8rem; margin-top: .5rem; }
.logo-actual img { width: 56px; height: 56px; object-fit: contain; border: 1px solid var(--borde); border-radius: 12px; }
.dos-campos { display: grid; grid-template-columns: 1fr 1fr; gap: 0 .7rem; }

/* Chips de un toque (canal, servicio, motivo, periodo) */
.chips { display: flex; flex-wrap: wrap; gap: .45rem; margin: .4rem 0 1rem; }
.chips input { position: absolute; opacity: 0; pointer-events: none; }
.chip { display: inline-flex; align-items: center; gap: .3rem; min-height: 42px; padding: .4rem .95rem; border-radius: 999px; border: 1.5px solid var(--borde);
  background: var(--tarjeta); color: var(--texto); font-weight: 550; font-size: .93rem; cursor: pointer; user-select: none; transition: all .12s; }
.chips input:checked + .chip, .chip.activo { background: var(--principal); color: var(--principal-texto); border-color: var(--principal); }
.chips input:focus-visible + .chip { box-shadow: 0 0 0 4px color-mix(in srgb, var(--principal) 20%, transparent); }

/* ---------- Avisos ---------- */
.aviso { background: var(--verde-fondo); border: 1px solid color-mix(in srgb, var(--verde) 35%, #fff); color: #075e43; border-radius: 14px; padding: .85rem 1rem;
  margin-bottom: .9rem; font-weight: 600; word-break: break-word; animation: entra .25s ease-out; }
.aviso-error { background: var(--rojo-fondo); border-color: color-mix(in srgb, var(--rojo) 35%, #fff); color: var(--rojo); }
.alerta-roja { display: flex; align-items: center; gap: .75rem; background: var(--rojo-fondo); color: #9f1239; border: 1px solid color-mix(in srgb, var(--rojo) 25%, #fff);
  border-radius: 16px; padding: .8rem 1rem; margin-bottom: .9rem; font-weight: 600; }
.alerta-roja .punto { width: 10px; height: 10px; border-radius: 50%; background: var(--rojo); flex: none; box-shadow: 0 0 0 4px color-mix(in srgb, var(--rojo) 20%, transparent); animation: late 1.6s infinite; }
.alerta-roja .flecha { margin-left: auto; color: inherit; }
@keyframes late { 50% { box-shadow: 0 0 0 7px color-mix(in srgb, var(--rojo) 8%, transparent); } }
@keyframes entra { from { opacity: 0; transform: translateY(-4px); } }

/* ---------- Listas genéricas (agencia) ---------- */
.lista { list-style: none; margin: 0 0 .8rem; padding: 0; background: var(--tarjeta); border: 1px solid var(--borde); border-radius: var(--radio); overflow: hidden; box-shadow: var(--sombra); }
.lista > li + li { border-top: 1px solid var(--borde); }
.lista > li.texto-suave { padding: .9rem 1rem; }
.fila { display: flex; align-items: center; justify-content: space-between; gap: .6rem; padding: .85rem 1rem; color: var(--texto); min-height: 66px; }
a.fila:active { background: #faf9f7; }
.fila-marca { display: flex; align-items: center; gap: .8rem; min-width: 0; }
.mini-logo { width: 42px; height: 42px; object-fit: contain; border-radius: 12px; border: 1px solid var(--borde); flex: none; }
.fila-apagada { opacity: .55; }
.flecha { color: var(--borde-fuerte); font-size: 1.5rem; line-height: 1; }
.volver { display: inline-flex; align-items: center; gap: .2rem; margin-bottom: .6rem; font-weight: 600; color: var(--suave); min-height: 36px; }
.etiqueta { display: inline-block; font-size: .74rem; font-weight: 650; padding: .08rem .55rem; border-radius: 999px; background: var(--fondo); border: 1px solid var(--borde); color: var(--suave); vertical-align: middle; }
.etiqueta-dueno { background: var(--tinte-fuerte); color: var(--principal-oscuro); border-color: transparent; }
.etiqueta-roja { background: var(--rojo-fondo); color: var(--rojo); border-color: transparent; }
.etiqueta-verde { background: var(--verde-fondo); color: var(--verde); border-color: transparent; }
.medidor { display: inline-flex; align-items: center; gap: .4rem; font-weight: 650; font-size: .85rem; }
.medidor .barra { width: 54px; height: 6px; border-radius: 999px; background: var(--borde); overflow: hidden; }
.medidor .barra i { display: block; height: 100%; background: var(--verde); border-radius: inherit; }
.medidor.bajo .barra i { background: var(--rojo); }
.medidor.medio .barra i { background: #e8a33b; }

.fila-usuario { padding: .85rem 1rem; }
.botones-usuario { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .6rem; }
details.desplegable { margin-bottom: 1rem; }
details.desplegable > summary { list-style: none; width: auto; display: inline-flex; margin-bottom: .6rem; }
details.desplegable > summary::-webkit-details-marker { display: none; }
details.desplegable[open] > summary { background: var(--tarjeta); color: var(--texto); border-color: var(--borde); box-shadow: none; }

.pestanas { display: flex; gap: .4rem; overflow-x: auto; margin: .4rem -16px .9rem; padding: 0 16px .3rem; scrollbar-width: none; }
.pestanas::-webkit-scrollbar { display: none; }
.pestanas a { flex: none; display: inline-flex; align-items: center; gap: .4rem; padding: .5rem .95rem; border-radius: 999px; background: var(--tarjeta);
  border: 1px solid var(--borde); color: var(--texto); font-weight: 550; font-size: .92rem; min-height: 40px; }
.pestanas a.activo { background: var(--texto); color: #fff; border-color: var(--texto); }
.pestanas .n { font-size: .78rem; font-weight: 700; background: var(--fondo); color: var(--suave); border-radius: 999px; padding: 0 .45rem; min-width: 1.4rem; text-align: center; }
.pestanas a.activo .n { background: rgba(255,255,255,.18); color: #fff; }
.enlace-grande { font-size: 1.1rem; font-weight: 700; word-break: break-all; margin: .2rem 0; }

/* ---------- Lista de leads ---------- */
.saludo { display: flex; align-items: flex-end; justify-content: space-between; gap: .8rem; margin: .3rem 0 .9rem; }
.saludo h1 { margin: 0; }
.saludo .texto-suave { margin: .15rem 0 0; }
.buscador { position: relative; margin-bottom: .7rem; }
.buscador input { width: 100%; min-height: 48px; padding: .6rem 1rem .6rem 2.7rem; border-radius: 14px; border: 1px solid var(--borde); background: var(--tarjeta); font: inherit; font-size: 1rem; box-shadow: var(--sombra); }
.buscador svg { position: absolute; left: .9rem; top: 50%; transform: translateY(-50%); width: 19px; height: 19px; color: var(--suave); }
.leads { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .55rem; }
.lead { display: flex; align-items: center; gap: .8rem; background: var(--tarjeta); border: 1px solid var(--borde); border-radius: var(--radio); padding: .75rem .75rem .75rem .85rem;
  box-shadow: var(--sombra); position: relative; }
.lead.urgente { border-color: color-mix(in srgb, var(--rojo) 35%, var(--borde)); }
.lead.urgente::before { content: ""; position: absolute; left: -1px; top: 14px; bottom: 14px; width: 4px; border-radius: 0 4px 4px 0; background: var(--rojo); }
.lead-enlace { flex: 1; display: flex; align-items: center; gap: .8rem; min-width: 0; color: var(--texto); }
.avatar { display: inline-flex; align-items: center; justify-content: center; width: 46px; height: 46px; border-radius: 50%; flex: none; font-weight: 700; font-size: .95rem;
  letter-spacing: .02em; background: var(--fc-fondo, var(--tinte)); color: var(--fc, var(--principal-oscuro)); }
.lead-datos { min-width: 0; flex: 1; }
.lead-nombre { font-weight: 650; font-size: 1.02rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; letter-spacing: -.01em; }
.lead-detalle { color: var(--suave); font-size: .87rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.lead-acciones { display: flex; gap: .4rem; flex: none; }
.accion-redonda { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 50%; border: 0; cursor: pointer; }
.accion-redonda svg { width: 21px; height: 21px; }
.accion-llamar { background: var(--tinte-fuerte); color: var(--principal-oscuro); }
.accion-wa { background: #e5f6ec; color: var(--wa); }
.fase { display: inline-flex; align-items: center; gap: .3rem; font-size: .76rem; font-weight: 700; padding: .12rem .55rem; border-radius: 999px;
  background: var(--fc-fondo); color: var(--fc); white-space: nowrap; }
.fase::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.c-nuevo { --fc: var(--f-nuevo); --fc-fondo: var(--f-nuevo-fondo); }
.c-1 { --fc: var(--f-1); --fc-fondo: var(--f-1-fondo); } .c-2 { --fc: var(--f-2); --fc-fondo: var(--f-2-fondo); }
.c-3 { --fc: var(--f-3); --fc-fondo: var(--f-3-fondo); } .c-4 { --fc: var(--f-4); --fc-fondo: var(--f-4-fondo); }
.c-ganado { --fc: var(--f-ganado); --fc-fondo: var(--f-ganado-fondo); } .c-perdido { --fc: var(--f-perdido); --fc-fondo: var(--f-perdido-fondo); }
.paginas { display: flex; justify-content: center; gap: .6rem; margin: 1rem 0; }

/* ---------- Ficha ---------- */
.ficha-cabeza { text-align: center; padding: 1.4rem 1.1rem 1.1rem; position: relative; overflow: hidden; }
.ficha-cabeza::before { content: ""; position: absolute; inset: 0 0 auto; height: 74px; background: linear-gradient(135deg, var(--tinte-fuerte), var(--tinte)); }
.ficha-cabeza > * { position: relative; }
.ficha-cabeza .avatar { width: 76px; height: 76px; font-size: 1.5rem; box-shadow: 0 0 0 5px #fff; }
.ficha-cabeza h1 { margin: .55rem 0 .1rem; font-size: 1.45rem; }
.ficha-cabeza .datos { color: var(--suave); font-size: .93rem; margin: 0 0 .2rem; }
.ficha-cabeza .datos a { color: var(--texto); font-weight: 600; }
.grandes { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; margin-top: 1rem; }
.boton-grande { display: flex; align-items: center; justify-content: center; gap: .55rem; min-height: 60px; border-radius: 16px; font-weight: 700; font-size: 1.08rem; border: 0; cursor: pointer;
  font-family: inherit; transition: transform .08s, filter .15s; }
.boton-grande:active { transform: scale(.97); }
.boton-grande svg { width: 24px; height: 24px; }
.boton-llamar { background: var(--principal); color: var(--principal-texto); box-shadow: 0 8px 20px color-mix(in srgb, var(--principal) 30%, transparent); }
.boton-wa { background: var(--wa); color: #fff; box-shadow: 0 8px 20px rgba(31,170,89,.28); }
.boton-grande.apagado { background: var(--fondo); color: var(--suave); box-shadow: none; pointer-events: none; }
.fases-botones { display: flex; flex-wrap: wrap; gap: .45rem; }
.fases-botones form { display: contents; }
.boton-fase { display: inline-flex; align-items: center; gap: .35rem; min-height: 46px; padding: .45rem 1rem; border-radius: 999px; border: 1.5px solid var(--borde);
  background: var(--tarjeta); color: var(--texto); font: inherit; font-weight: 600; font-size: .95rem; cursor: pointer; transition: all .12s; }
.boton-fase::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--fc); }
.boton-fase.actual { background: var(--fc); color: #fff; border-color: var(--fc); box-shadow: 0 6px 16px color-mix(in srgb, var(--fc) 30%, transparent); }
.boton-fase.actual::before { background: #fff; }
.info-lineas { margin: 0; display: grid; gap: .1rem; }
.info-lineas div { display: flex; justify-content: space-between; gap: 1rem; padding: .55rem 0; border-bottom: 1px solid var(--borde); font-size: .95rem; }
.info-lineas div:last-child { border-bottom: 0; }
.info-lineas dt { color: var(--suave); }
.info-lineas dd { margin: 0; font-weight: 600; text-align: right; word-break: break-word; }
.info-lineas dd.corto { white-space: nowrap; }
.historial { list-style: none; margin: 0; padding: 0 0 0 1.1rem; border-left: 2px solid var(--borde); }
.historial li { position: relative; padding: 0 0 .85rem .3rem; font-size: .93rem; }
.historial li::before { content: ""; position: absolute; left: -1.53rem; top: .45rem; width: 10px; height: 10px; border-radius: 50%; background: var(--tarjeta); border: 2px solid var(--borde-fuerte); }
.historial li.h-fase::before { border-color: var(--principal); background: var(--principal); }
.historial li.h-llamada::before, .historial li.h-whatsapp::before { border-color: var(--wa); }
.historial .cuando { color: var(--suave); font-size: .82rem; display: block; }
.ganado-banda { display: flex; align-items: center; justify-content: center; gap: .5rem; background: var(--verde-fondo); color: #075e43; border-radius: 14px; padding: .7rem; font-weight: 700; margin-top: .9rem; }

/* Hoja de abajo (WhatsApp con mensaje, Ganado, Perdido, mover en el tablero) */
dialog.hoja { border: 0; padding: 0; width: 100%; max-width: 560px; margin: auto auto 0; border-radius: 26px 26px 0 0; background: var(--tarjeta); color: var(--texto);
  box-shadow: var(--sombra-alta); max-height: 90vh; }
dialog.hoja::backdrop { background: rgba(28,25,23,.42); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
dialog.hoja[open] { animation: sube .22s cubic-bezier(.2,.8,.3,1); }
@keyframes sube { from { transform: translateY(40px); opacity: .4; } }
.hoja-dentro { padding: .6rem 1.2rem calc(1.2rem + env(safe-area-inset-bottom)); }
.hoja-dentro::before { content: ""; display: block; width: 42px; height: 5px; border-radius: 999px; background: var(--borde-fuerte); margin: 0 auto .9rem; }
.hoja h2 { margin: 0 0 .3rem; font-size: 1.2rem; letter-spacing: -.01em; }
.hoja .cerrar { position: absolute; right: 12px; top: 12px; width: 38px; height: 38px; border-radius: 50%; border: 0; background: var(--fondo); font-size: 1.2rem; cursor: pointer; color: var(--suave); }
.opciones-hoja { display: flex; flex-direction: column; gap: .5rem; margin: .8rem 0 0; }
.opcion-hoja { display: flex; align-items: center; gap: .8rem; padding: .85rem 1rem; border: 1.5px solid var(--borde); border-radius: 16px; color: var(--texto); font-weight: 600; background: var(--tarjeta);
  text-align: left; font: inherit; cursor: pointer; width: 100%; }
.opcion-hoja small { display: block; color: var(--suave); font-weight: 400; font-size: .85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.opcion-hoja > span { min-width: 0; flex: 1; }
.opcion-hoja .icono-wa { width: 40px; height: 40px; border-radius: 12px; background: #e5f6ec; color: var(--wa); display: inline-flex; align-items: center; justify-content: center; flex: none; }
.importe-grande { display: flex; align-items: center; gap: .5rem; font-size: 2rem; font-weight: 750; border: 1.5px solid var(--borde); border-radius: 16px; padding: .3rem 1rem; margin: .5rem 0 1rem; }
.formulario .importe-grande input, .importe-grande input { border: 0 !important; box-shadow: none !important; margin: 0; min-height: 0; padding: .3rem 0; border-radius: 0; font: inherit; width: 100%; min-width: 0; background: transparent; padding: .3rem 0; color: var(--texto); }
.importe-grande input:focus { box-shadow: none; }
.importe-grande:focus-within { border-color: var(--verde); box-shadow: 0 0 0 4px color-mix(in srgb, var(--verde) 16%, transparent); }
.boton-verde { background: var(--verde); border-color: var(--verde); color: #fff; box-shadow: 0 6px 16px rgba(15,159,110,.25); width: 100%; }
.boton-verde:hover { background: var(--verde); filter: brightness(.95); }

/* ---------- Tablero ---------- */
.tablero { display: flex; gap: .8rem; overflow-x: auto; scroll-snap-type: x mandatory; margin: 0 -16px; padding: .2rem 16px 1rem; scrollbar-width: thin; }
.columna { flex: 0 0 86%; scroll-snap-align: center; background: color-mix(in srgb, var(--fc-fondo) 55%, #fff); border-radius: 22px; padding: .8rem; min-height: 60vh;
  border: 1px solid color-mix(in srgb, var(--fc) 12%, transparent); }
.columna.encima { outline: 2.5px dashed var(--fc); outline-offset: -4px; }
.columna-cabeza { display: flex; align-items: baseline; justify-content: space-between; gap: .5rem; padding: .2rem .3rem .7rem; }
.columna-cabeza h2 { margin: 0; font-size: 1rem; color: var(--fc); display: flex; align-items: center; gap: .45rem; }
.columna-cabeza h2::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--fc); }
.columna-cabeza .cuenta { color: var(--suave); font-size: .85rem; font-weight: 600; text-align: right; }
.columna-cabeza .cuenta strong { color: var(--texto); font-size: .95rem; }
.tarjetas { display: flex; flex-direction: column; gap: .5rem; min-height: 80px; }
.tarjeta-lead { background: var(--tarjeta); border-radius: 16px; padding: .75rem 3.3rem .75rem .85rem; box-shadow: var(--sombra); border: 1px solid var(--borde); cursor: grab; position: relative; }
.tarjeta-lead.arrastrando { opacity: .45; }
.tarjeta-lead a { color: var(--texto); }
.tarjeta-lead .nombre { font-weight: 650; display: block; letter-spacing: -.01em; }
.tarjeta-lead .linea { display: flex; justify-content: space-between; gap: .5rem; color: var(--suave); font-size: .85rem; margin-top: .15rem; }
.tarjeta-lead .euros { color: var(--texto); font-weight: 700; white-space: nowrap; }
.tarjeta-lead .euros.propuesto { color: var(--suave); font-weight: 600; }
.tarjeta-lead .mover { position: absolute; top: 50%; transform: translateY(-50%); right: .5rem; width: 38px; height: 38px; border-radius: 12px; border: 0; background: var(--fondo); color: var(--suave); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; }
.tarjeta-lead.vieja { border-color: color-mix(in srgb, var(--rojo) 30%, var(--borde)); }
.columna-vacia { text-align: center; color: var(--suave); font-size: .88rem; padding: 1.4rem .5rem; border: 1.5px dashed color-mix(in srgb, var(--fc) 20%, var(--borde)); border-radius: 16px; }
.solo-ordenador { display: none; }
@media (min-width: 900px) { .solo-ordenador { display: inline; } }
.puntos-columnas { display: flex; justify-content: center; gap: .35rem; margin: -.3rem 0 .6rem; }
.puntos-columnas a { width: 8px; height: 8px; border-radius: 50%; background: var(--fc); opacity: .35; }

/* ---------- Cifras ---------- */
.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; margin-bottom: .8rem; }
.kpi { background: var(--tarjeta); border: 1px solid var(--borde); border-radius: var(--radio); padding: .95rem 1rem; box-shadow: var(--sombra); }
.kpi .valor { display: block; font-size: 1.75rem; font-weight: 750; letter-spacing: -.03em; line-height: 1.15; font-variant-numeric: tabular-nums; }
.kpi .nombre { color: var(--suave); font-size: .85rem; font-weight: 550; }
.kpi .pie { display: block; color: var(--suave); font-size: .8rem; margin-top: .2rem; }
.kpi-grande { grid-column: 1 / -1; background: linear-gradient(135deg, var(--principal), var(--principal-oscuro)); color: var(--principal-texto); border: 0;
  box-shadow: 0 12px 30px color-mix(in srgb, var(--principal) 30%, transparent); }
.kpi-grande .valor { font-size: 2.3rem; }
.kpi-grande .nombre, .kpi-grande .pie { color: inherit; opacity: .85; }
.kpi.verde .valor { color: var(--verde); }
.kpi.roja .valor { color: var(--rojo); }
.barras { display: flex; flex-direction: column; gap: .65rem; }
.barra-fila { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .15rem .8rem; font-size: .93rem; }
.barra-fila .etq { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.barra-fila .num { color: var(--suave); text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.barra-fila .num strong { color: var(--texto); }
.barra-fila .pista { grid-column: 1 / -1; height: 9px; border-radius: 999px; background: var(--fondo); overflow: hidden; display: flex; }
.barra-fila .pista i { display: block; height: 100%; background: color-mix(in srgb, var(--principal) 30%, #fff); }
.barra-fila .pista i.g { background: var(--verde); }
.leyenda { display: flex; gap: 1rem; color: var(--suave); font-size: .8rem; margin: .1rem 0 .8rem; }
.leyenda span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: .35rem; vertical-align: -1px; background: color-mix(in srgb, var(--principal) 30%, #fff); }
.leyenda span.g::before { background: var(--verde); }
.tabla-envoltura { overflow-x: auto; margin: 0 -1.1rem; padding: 0 1.1rem; }
table.tabla { width: 100%; border-collapse: collapse; font-size: .92rem; font-variant-numeric: tabular-nums; }
.tabla th { text-align: right; font-weight: 600; color: var(--suave); font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; padding: .3rem .5rem .5rem; white-space: nowrap; }
.tabla td { text-align: right; padding: .6rem .4rem; border-top: 1px solid var(--borde); white-space: nowrap; }
.tabla th:first-child, .tabla td:first-child { text-align: left; padding-left: 0; white-space: normal; }
.tabla td:first-child { font-weight: 600; }
.persona { display: flex; align-items: center; gap: .8rem; }
.persona-cifras { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; margin-top: .8rem; text-align: center; }
.persona-cifras div { background: var(--fondo); border-radius: 12px; padding: .5rem .3rem; }
.persona-cifras strong { display: block; font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.persona-cifras span { color: var(--suave); font-size: .78rem; }
.semaforo { font-weight: 700; }
.semaforo.verde { color: var(--verde); } .semaforo.ambar { color: #c2780b; } .semaforo.rojo { color: var(--rojo); }

/* Listas editables (servicios, fases…) */
.filas-opciones { list-style: none; margin: 0; padding: 0; }
.fila-opcion { display: flex; align-items: flex-start; gap: .5rem; padding: .55rem 0; border-bottom: 1px solid var(--borde); }
.fila-opcion .mover { display: flex; flex-direction: column; gap: 2px; flex: none; min-width: 34px; text-align: center; padding-top: .3rem; }
.fila-opcion .campos { flex: 1; display: flex; flex-wrap: wrap; gap: .4rem; min-width: 0; }
.fila-opcion .campos > input { flex: 1 1 180px; margin: 0; }
.fila-opcion .campos textarea { flex: 1 1 100%; margin: 0; min-height: 80px; }
.fila-opcion .precio { display: flex; align-items: center; gap: .3rem; flex: 0 0 120px; }
.fila-opcion .precio input { margin: 0; }
.fila-opcion .quitar { display: flex; align-items: center; gap: .3rem; font-size: .85rem; color: var(--suave); flex: none; padding-top: .75rem; }
.fila-opcion .quitar input { width: 20px; height: 20px; accent-color: var(--rojo); }
.fila-opcion.quitada .campos { opacity: .4; text-decoration: line-through; }
.fila-fija .campos input { background: var(--tarjeta); }

/* ---------- Entrada ---------- */
.sin-sesion { background: radial-gradient(1200px 600px at 50% -10%, var(--tinte-fuerte), var(--fondo) 60%); min-height: 100vh; }
.pantalla-entrar { max-width: 420px; margin: 8vh auto 0; text-align: center; background: var(--tarjeta); border: 1px solid var(--borde);
  border-radius: 28px; padding: 2.2rem 1.5rem 1.5rem; box-shadow: 0 24px 60px rgba(28,25,23,.08); }
.pantalla-entrar h1 { font-size: 1.5rem; margin-bottom: .2rem; }
.pantalla-entrar .formulario { text-align: left; margin-top: 1.4rem; }
.logo-entrar { max-width: 170px; max-height: 100px; object-fit: contain; margin-bottom: .8rem; }
.firma-agencia { display: flex; align-items: center; justify-content: center; gap: .5rem; margin: 1.5rem 0 0; padding-top: 1.1rem; border-top: 1px solid var(--borde); color: var(--suave); font-size: .9rem; }
.firma-agencia img { width: 26px; height: 26px; object-fit: contain; }
.firma-agencia strong { color: var(--texto); letter-spacing: .06em; text-transform: uppercase; font-size: .85rem; }
.sin-sesion .contenido { padding-bottom: 32px; }

/* Interruptor (avisos de Telegram, etc.) */
.interruptor { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.paso { display: flex; gap: .8rem; align-items: flex-start; margin-bottom: .8rem; }
.paso .n { flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--tinte-fuerte); color: var(--principal-oscuro); font-weight: 700; display: inline-flex; align-items: center; justify-content: center; font-size: .9rem; }

@media (min-width: 900px) {
  body { padding-left: 248px; }
  body.sin-sesion { padding-left: 0; }
  .cabecera { position: static; background: transparent; border: 0; padding: 1.4rem 36px .2rem; -webkit-backdrop-filter: none; backdrop-filter: none; }
  .cabecera-titulo { visibility: hidden; }
  .banda-ver-como { top: 0; }
  .contenido { max-width: 1000px; padding: 6px 36px 48px; margin: 0; }
  .barra-inferior { top: 0; bottom: auto; right: auto; width: 248px; height: 100vh; flex-direction: column; justify-content: flex-start; gap: .15rem;
    border-top: 0; border-right: 1px solid var(--borde); padding: 1.2rem 0 0; background: #fff; }
  .menu-marca { display: flex; align-items: center; gap: .7rem; padding: .2rem 1.2rem 1.4rem; font-weight: 700; font-size: 1.02rem; letter-spacing: -.01em; line-height: 1.25; }
  .menu-marca img, .menu-marca .logo-inicial { width: 42px; height: 42px; }
  .menu-marca img { object-fit: contain; border-radius: 12px; box-shadow: 0 0 0 1px var(--borde); }
  .menu-marca small { display: block; font-weight: 500; color: var(--suave); font-size: .8rem; }
  .barra-inferior a { flex: none; flex-direction: row; justify-content: flex-start; gap: .7rem; padding: .55rem .75rem; margin: 0 .75rem; border-radius: 12px;
    font-size: .95rem; min-height: 46px; color: #57534e; }
  .barra-inferior .icono { width: 26px; height: 26px; background: none !important; }
  .barra-inferior a:hover { background: var(--fondo); }
  .barra-inferior a.activo { background: var(--tinte); color: var(--principal-oscuro); }
  .boton-principal { width: auto; min-width: 200px; }
  .pantalla-entrar .boton-principal, .hoja .boton-principal, .boton-verde { width: 100%; }
  .pestanas { margin: .4rem 0 .9rem; padding: 0 0 .3rem; flex-wrap: wrap; }
  .boton-flotante { right: 36px; bottom: 32px; }
  .pagina-ancha .contenido { max-width: none; }
  .tablero { margin: 0; padding: .2rem 0 1rem; scroll-snap-type: none; }
  .solo-movil { display: none; }
  .columna { flex: 1 0 250px; min-height: 70vh; }
  .solo-ordenador { display: none; }
@media (min-width: 900px) { .solo-ordenador { display: inline; } }
.puntos-columnas { display: none; }
  .kpis { grid-template-columns: repeat(4, 1fr); }
  .kpi-grande { grid-column: span 2; }
  .dos-columnas { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; align-items: start; }
  .ficha-rejilla { display: grid; grid-template-columns: 380px 1fr; gap: 1rem; align-items: start; }
  dialog.hoja { margin: auto; border-radius: 26px; }
}

/* ---------- Buscador que filtra mientras escribes (plantillas) ---------- */
.buscador-vivo { width: 100%; font-size: 1rem; padding: .8rem 1rem .8rem 2.6rem; border: 1.5px solid var(--borde); border-radius: 14px; background: var(--tarjeta)
  url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") no-repeat .9rem center / 18px;
  margin: .3rem 0 1rem; }
.buscador-vivo:focus { outline: none; border-color: var(--principal); box-shadow: 0 0 0 3px color-mix(in srgb, var(--principal) 18%, transparent); }
.lista-plantillas { max-height: 420px; overflow-y: auto; padding-right: .2rem; }
.grupo-plantillas h3 { font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--suave); margin: .8rem 0 .4rem; }
.opcion-plantilla { padding: .55rem .7rem; border-radius: 12px; border: 1.5px solid transparent; }
.opcion-plantilla:has(input:checked) { border-color: var(--principal); background: color-mix(in srgb, var(--principal) 6%, transparent); }
details.plantilla { padding: 0; margin-bottom: .6rem; }
details.plantilla summary { cursor: pointer; list-style: none; padding: .9rem 2.4rem .9rem 1rem; position: relative; display: flex; flex-direction: column; gap: .15rem; }
details.plantilla summary::-webkit-details-marker { display: none; }
details.plantilla summary::after { content: "›"; position: absolute; right: 1rem; top: 50%; transform: translateY(-50%); font-size: 1.4rem; color: var(--suave); transition: transform .2s; }
details.plantilla[open] summary::after { transform: translateY(-50%) rotate(90deg); }
details.plantilla dl { margin: 0; padding: 0 1rem .4rem; }
details.plantilla dl > div { padding: .6rem 0; border-top: 1px solid var(--borde); }
details.plantilla dt { font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--suave); margin-bottom: .25rem; }
details.plantilla dd { margin: 0; line-height: 1.5; }
details.plantilla > p { padding: 0 1rem 1rem; }

/* ---------- Lo que se queda fijo arriba al bajar (como en el CRM de la agencia) ---------- */
:root { --cab: 58px; --banda: 0px; }
.pegado-arriba { position: sticky; top: calc(var(--cab) + var(--banda)); z-index: 4; background: var(--fondo); margin: 0 -16px .6rem; padding: .5rem 16px .1rem; }
.pegado-arriba .buscador { margin-bottom: .5rem; }
.pegado-arriba .pestanas { margin-bottom: .3rem; }
.pestanas.pegado-arriba { margin: .4rem -16px .9rem; padding: .5rem 16px .5rem; }
.banda-ver-como { top: var(--cab); }
.resultados-de { margin: .2rem 0 .5rem; }
/* Ficha del lead: barra con llamar / WhatsApp y saltos a cada parte */
.ficha-saltos { position: sticky; top: calc(var(--cab) + var(--banda)); z-index: 4; display: flex; align-items: center; gap: .4rem; overflow-x: auto; scrollbar-width: none;
  background: var(--fondo); margin: -.2rem -16px .7rem; padding: .45rem 16px; border-bottom: 1px solid var(--borde); }
.ficha-saltos::-webkit-scrollbar { display: none; }
.ficha-saltos a:not(.salto-accion) { position: relative; flex: 0 0 auto; padding: .38rem .8rem; border-radius: 999px; background: var(--tarjeta); border: 1px solid var(--borde);
  color: var(--texto); font-size: .88rem; font-weight: 600; white-space: nowrap; text-decoration: none; }
.ficha-saltos a.activo { background: var(--texto); border-color: var(--texto); color: #fff; }
.salto-accion { flex: none; width: 38px; height: 38px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; border: 0; padding: 0; cursor: pointer; color: #fff; }
.salto-accion svg { width: 19px; height: 19px; }
.salto-llamar { background: var(--principal); color: var(--principal-texto); }
.salto-wa { background: var(--wa); }
.saltos-enlaces { display: flex; gap: .4rem; overflow-x: auto; scrollbar-width: none; min-width: 0; flex: 1; }
.saltos-enlaces::-webkit-scrollbar { display: none; }
.salto-separador { flex: none; width: 1px; height: 24px; background: var(--borde); margin: 0 .15rem; }
.punto-aviso { position: absolute; top: 1px; right: 1px; width: 9px; height: 9px; border-radius: 50%; background: var(--rojo); border: 2px solid var(--tarjeta); }
[id] { scroll-margin-top: calc(var(--cab) + var(--banda) + 4.2rem); }
/* Tablero: fases fijas arriba; tocar una lleva a su columna */
.fases-tablero { display: flex; gap: .4rem; overflow-x: auto; scrollbar-width: none; padding-bottom: .5rem; }
.fases-tablero::-webkit-scrollbar { display: none; }
.fases-tablero a { flex: none; display: inline-flex; align-items: center; gap: .4rem; padding: .4rem .8rem; border-radius: 999px; background: var(--tarjeta); border: 1px solid var(--borde);
  color: var(--texto); font-size: .86rem; font-weight: 600; white-space: nowrap; text-decoration: none; }
.fases-tablero a i { width: 8px; height: 8px; border-radius: 50%; background: var(--fc); }
.fases-tablero a .n { color: var(--suave); font-weight: 700; font-size: .8rem; }
.fases-tablero a.activo { border-color: var(--fc); background: color-mix(in srgb, var(--fc-fondo) 70%, #fff); }
/* Aviso «ya está en tu lista» al apuntar un lead a mano */
.aviso-existe { display: flex; justify-content: space-between; align-items: center; gap: .6rem; padding: .75rem .9rem; margin: -.2rem 0 .9rem; border-radius: 14px;
  background: var(--naranja-fondo); border: 1px solid #f5c37a; color: var(--texto); text-decoration: none; font-size: .93rem; }
.aviso-existe .flecha { font-weight: 700; white-space: nowrap; color: var(--principal-oscuro); }
/* Aviso abajo con «Deshacer» */
.toast { position: fixed; left: 50%; bottom: calc(150px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 30; display: flex; align-items: center; gap: .8rem;
  background: #1f1b18; color: #fff; padding: .55rem .55rem .55rem 1rem; border-radius: 14px; box-shadow: 0 10px 30px rgba(0,0,0,.25); max-width: calc(100% - 32px);
  font-size: .93rem; animation: toast-entra .25s ease-out; }
.toast span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.toast button { flex: none; background: rgba(255,255,255,.14); color: #fff; border: 0; border-radius: 10px; padding: .5rem .8rem; font: inherit; font-weight: 700; cursor: pointer; }
@keyframes toast-entra { from { opacity: 0; transform: translate(-50%, 12px); } }
@media (min-width: 900px) {
  :root { --cab: 0px; }
  .pegado-arriba, .ficha-saltos { margin-left: -36px; margin-right: -36px; padding-left: 36px; padding-right: 36px; }
  .pestanas.pegado-arriba { margin-left: -36px; margin-right: -36px; padding-left: 36px; padding-right: 36px; }
  .toast { bottom: 110px; }
}
.zona-peligro { border: 1.5px solid color-mix(in srgb, var(--rojo) 35%, transparent); }
.boton-peligro { background: var(--rojo); color: #fff; border: 0; }
.boton-peligro:disabled { opacity: .4; cursor: not-allowed; }

/* ---------- Que no se tape nada arriba (08-11-2026) ---------- */
/* Móvil: los botones de arriba bajan a otra línea en vez de salirse por la derecha */
.ficha-saltos { flex-wrap: wrap; overflow: visible; row-gap: .35rem; }
.saltos-enlaces { flex-wrap: wrap; overflow: visible; row-gap: .35rem; }
.ficha-saltos a:not(.salto-accion) { padding: .34rem .66rem; font-size: .84rem; }
.salto-accion { position: relative; }
.fases-tablero { flex-wrap: wrap; overflow: visible; row-gap: .35rem; }
.fases-tablero a { padding: .32rem .62rem; font-size: .82rem; gap: .3rem; }
/* Ficha de la clínica (agencia): muchos apartados → en el móvil se desliza (con sombra que avisa de que hay más) y no se queda fija */
@media (max-width: 899px) {
  .saltos-muchos { position: sticky; flex-wrap: nowrap; overflow-x: auto; -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent); mask-image: linear-gradient(90deg, #000 85%, transparent); }
}
/* Ordenador: se aprovecha todo el ancho */
@media (min-width: 900px) {
  .contenido { max-width: 1240px; }
  .tablero { overflow-x: auto; }
  .columna { flex: 1 1 0; min-width: 175px; }
  .tarjeta-lead { padding: .7rem .75rem .7rem .8rem; }
  .tarjeta-lead .nombre { padding-right: 2.1rem; }
  .tarjeta-lead .mover { top: .5rem; transform: none; right: .45rem; width: 32px; height: 32px; border-radius: 10px; }
  .tarjeta-lead .linea { flex-wrap: wrap; column-gap: .5rem; row-gap: 0; }
}
@media (min-width: 1500px) { .columna { min-width: 200px; } }
/* Ajuste fino: la barra de la ficha en una sola línea en el móvil; las fases del tablero en una rejilla de 3 */
.ficha-saltos { column-gap: .3rem; }
.ficha-saltos .salto-separador { display: none; }
.saltos-enlaces { gap: .3rem; }
.ficha-saltos a:not(.salto-accion) { padding: .3rem .55rem; font-size: .8rem; }
.salto-accion { width: 36px; height: 36px; }
@media (max-width: 899px) {
  .fases-tablero { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .3rem; }
  .fases-tablero a { min-width: 0; justify-content: flex-start; padding: .3rem .5rem; }
  .fases-tablero a span:not(.n) { overflow: hidden; text-overflow: ellipsis; }
}
@media (min-width: 900px) {
  body { padding-left: 220px; }
  .barra-inferior { width: 220px; }
  .tablero { gap: .55rem; }
  .columna { min-width: 0; padding: .55rem; border-radius: 18px; }
  .tarjeta-lead { padding: .6rem .6rem .6rem .7rem; border-radius: 14px; }
  .tarjeta-lead .nombre { font-size: .93rem; padding-right: 1.9rem; }
  .tarjeta-lead .mover { width: 28px; height: 28px; top: .45rem; right: .4rem; }
  .tarjeta-lead .linea { font-size: .8rem; }
  .columna-cabeza { flex-wrap: wrap; }
  .columna-cabeza h2 { font-size: .92rem; }
}
@media (min-width: 900px) { body.sin-sesion { padding-left: 0; } }
@media (max-width: 899px) { .ficha-saltos a:not(.salto-accion) { padding: .3rem .48rem; font-size: .78rem; } .salto-accion { width: 34px; height: 34px; } }
@media (max-width: 899px) { .saltos-enlaces, .ficha-saltos { gap: .25rem; } .ficha-saltos a:not(.salto-accion) { padding: .3rem .44rem; } }
@media (max-width: 899px) { .saltos-muchos a:not(.salto-accion) { flex: none; } .saltos-muchos::after { content: ""; flex: none; width: 24px; } }
.pegado-arriba .buscador-vivo { margin: 0 0 .5rem; }
/* Botón Salir: abajo del todo en el menú de la izquierda (ordenador). En el móvil está en «Cuenta». */
.menu-salir { display: none; }
@media (min-width: 900px) {
  .menu-salir { display: block; margin: auto 0 0; padding: .6rem 0 1.2rem; border-top: 1px solid var(--borde); }
  .menu-salir button { display: flex; align-items: center; gap: .7rem; width: calc(100% - 1.5rem); margin: 0 .75rem; padding: .55rem .75rem; min-height: 46px;
    border: 0; border-radius: 12px; background: none; font: inherit; font-size: .95rem; font-weight: 500; color: #57534e; cursor: pointer; text-align: left; }
  .menu-salir button:hover { background: var(--rojo-fondo); color: var(--rojo); }
  .menu-salir .icono { width: 26px; height: 26px; display: inline-flex; align-items: center; justify-content: center; }
  .menu-salir svg { width: 22px; height: 22px; }
}
/* Entrada: centrada en el ordenador, y ayuda «¿Has olvidado la contraseña?» */
.sin-sesion .contenido { display: flex; flex-direction: column; justify-content: center; min-height: 100vh; min-height: 100dvh; }
.sin-sesion .pantalla-entrar { margin: 0 auto; width: 100%; }
@media (min-width: 900px) { .sin-sesion .contenido { max-width: none; margin: 0; padding: 32px; } }
.olvido { margin-top: 1rem; text-align: left; font-size: .92rem; }
.olvido summary { cursor: pointer; text-align: center; color: var(--principal-oscuro); font-weight: 600; list-style: none; padding: .4rem; }
.olvido summary::-webkit-details-marker { display: none; }
.olvido[open] summary { margin-bottom: .4rem; }
.olvido p { margin: .5rem 0; line-height: 1.5; }

/* =====================================================================================================================
   TIPOGRAFÍA ESTILO APPLE (08-11-2026)
   · En iPhone / Mac se usa la letra del sistema de Apple (San Francisco), con sus números redondeados en las cifras.
   · En Android / Windows, Inter 4 con tamaños ópticos (corte «Display» en los títulos grandes, como hace Apple).
   · Escala de tamaños de iOS: título grande 34 · título 28 · 22 · 20 · titular 17 · cuerpo 17 · 15 · 13 · 12.
   · Espaciado de letras según el tamaño (cuanto más grande, más apretado), números de ancho fijo en cifras y euros.
   ===================================================================================================================== */
@font-face { font-family: "InterApp"; src: url("/static/fuentes/inter-opsz.woff2") format("woff2"); font-weight: 100 900; font-style: normal; font-display: swap; }
:root {
  --letra: -apple-system, BlinkMacSystemFont, "InterApp", "Inter", "Segoe UI Variable Text", "Segoe UI", Roboto, system-ui, sans-serif;
  --letra-numeros: ui-rounded, "SF Pro Rounded", -apple-system, BlinkMacSystemFont, "InterApp", system-ui, sans-serif;
  /* espaciado (en em) por tamaño: fórmula de tracking dinámico de Inter, muy cercana a la de San Francisco */
  --tr-34: -.022em; --tr-28: -.021em; --tr-22: -.019em; --tr-20: -.017em; --tr-17: -.013em; --tr-15: -.009em; --tr-13: -.003em; --tr-12: 0em; --tr-10: .006em;
  --texto: #1d1d1f; --suave: #6e6e73; --terciario: #86868b;
}
/* Safari (letra de Apple): San Francisco ya ajusta solo su espaciado → no lo tocamos */
@supports (font: -apple-system-body) and (-webkit-appearance: none) {
  :root { --tr-34: .004em; --tr-28: .007em; --tr-22: .01em; --tr-20: .012em; --tr-17: -.024em; --tr-15: -.014em; --tr-13: -.006em; --tr-12: 0em; --tr-10: .01em; }
}
html { font-size: 16px; }
body { font-family: var(--letra); font-size: 17px; line-height: 1.4; letter-spacing: var(--tr-17); font-optical-sizing: auto; font-kerning: normal;
  font-feature-settings: normal; text-rendering: optimizeLegibility; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; color: var(--texto); }
button, input, select, textarea { font-family: inherit; letter-spacing: inherit; }

/* Títulos */
h1 { font-size: 34px; line-height: 1.12; font-weight: 700; letter-spacing: var(--tr-34); margin: .25rem 0 .55rem; }
.saludo h1 { font-size: 34px; }
.ficha-cabeza h1 { font-size: 28px; letter-spacing: var(--tr-28); line-height: 1.15; }
h2.titulo-seccion, .titulo-seccion { font-size: 20px; line-height: 1.25; font-weight: 650; letter-spacing: var(--tr-20); text-transform: none; color: var(--texto);
  margin: 2rem 0 .7rem; }
.hoja h2 { font-size: 22px; font-weight: 700; letter-spacing: var(--tr-22); line-height: 1.2; }
.grupo-plantillas h3, details.plantilla dt, .tabla th { font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--terciario); }

/* Texto */
.texto-suave { font-size: 15px; letter-spacing: var(--tr-15); color: var(--suave); line-height: 1.4; }
p { line-height: 1.47; }
small { font-size: 13px; letter-spacing: var(--tr-13); }

/* Cabecera y menú */
.cabecera-titulo { font-size: 17px; font-weight: 600; letter-spacing: var(--tr-17); }
.barra-inferior a { font-size: 10.5px; font-weight: 500; letter-spacing: var(--tr-10); }
.barra-inferior a.activo { font-weight: 600; }
@media (min-width: 900px) {
  .barra-inferior a, .menu-salir button { font-size: 15px; font-weight: 500; letter-spacing: var(--tr-15); }
  .barra-inferior a.activo { font-weight: 600; }
  .menu-marca { font-size: 17px; font-weight: 650; letter-spacing: var(--tr-17); }
  .menu-marca small { font-size: 13px; font-weight: 400; letter-spacing: var(--tr-13); }
}

/* Botones y controles */
.boton { font-size: 17px; font-weight: 600; letter-spacing: var(--tr-17); border-radius: 14px; }
.boton-pequeno { font-size: 15px; letter-spacing: var(--tr-15); border-radius: 11px; }
.boton-grande { font-size: 17px; font-weight: 600; letter-spacing: var(--tr-17); }
.boton-flotante { font-size: 17px; font-weight: 600; letter-spacing: var(--tr-17); }
.boton-fase { font-size: 15px; font-weight: 600; letter-spacing: var(--tr-15); }
.chip { font-size: 15px; font-weight: 500; letter-spacing: var(--tr-15); }
.pestanas a { font-size: 15px; font-weight: 500; letter-spacing: var(--tr-15); }
.pestanas a.activo { font-weight: 600; }
.pestanas .n, .fases-tablero a .n { font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: 0; }
.fase { font-size: 12px; font-weight: 600; letter-spacing: .005em; }
.formulario label { font-size: 15px; font-weight: 600; letter-spacing: var(--tr-15); }
.formulario small { font-size: 13px; }
.formulario input[type=text], .formulario input[type=password], .formulario input[type=url], .formulario input[type=tel], .formulario input[type=email],
.formulario select, .formulario textarea, .lista-editable input[type=text], .lista-editable textarea, .campo, .buscador input, .buscador-vivo {
  font-size: 17px; letter-spacing: var(--tr-17); }
.formulario .opcion, .formulario .casilla, .casilla { font-size: 17px; font-weight: 400; letter-spacing: var(--tr-17); }
.formulario legend { font-size: 15px; font-weight: 600; }
.aviso { font-size: 15px; letter-spacing: var(--tr-15); }
.toast { font-size: 15px; letter-spacing: var(--tr-15); }

/* Listas */
.lead-nombre { font-size: 17px; font-weight: 600; letter-spacing: var(--tr-17); }
.lead-detalle { font-size: 15px; letter-spacing: var(--tr-15); line-height: 1.35; }
.avatar { font-weight: 600; letter-spacing: .01em; }
.tarjeta-lead .nombre { font-size: 15px; font-weight: 600; letter-spacing: var(--tr-15); line-height: 1.3; }
.tarjeta-lead .linea { font-size: 13px; letter-spacing: var(--tr-13); }
.columna-cabeza h2 { font-size: 15px; font-weight: 650; letter-spacing: var(--tr-15); }
.info-lineas div { font-size: 15px; letter-spacing: var(--tr-15); }
.historial { font-size: 15px; letter-spacing: var(--tr-15); }
.historial .cuando { font-size: 13px; letter-spacing: var(--tr-13); color: var(--terciario); }

/* Cifras: números redondeados de Apple y de ancho fijo */
.kpi .valor { font-family: var(--letra-numeros); font-size: 32px; font-weight: 700; letter-spacing: var(--tr-28); font-variant-numeric: tabular-nums; }
.kpi-grande .valor { font-size: 44px; letter-spacing: var(--tr-34); }
.kpi .nombre { font-size: 13px; font-weight: 600; letter-spacing: var(--tr-13); }
.kpi .pie { font-size: 13px; letter-spacing: var(--tr-13); }
.euros, .cuenta, .num, .persona-cifras strong, .tabla td, [data-suma], [data-cuenta] { font-variant-numeric: tabular-nums; }
.persona-cifras strong { font-family: var(--letra-numeros); }
table.tabla { font-size: 15px; letter-spacing: var(--tr-15); }
.barra-fila { font-size: 15px; letter-spacing: var(--tr-15); }
.leyenda { font-size: 13px; }

/* Entrada */
.pantalla-entrar h1 { font-size: 28px; letter-spacing: var(--tr-28); }
.olvido { font-size: 15px; letter-spacing: var(--tr-15); }

/* Ordenador: títulos algo más grandes, como en macOS */
@media (min-width: 900px) {
  h1, .saludo h1 { font-size: 34px; }
  .ficha-cabeza h1 { font-size: 28px; }
}
@media (min-width: 900px) {
  .contenido { max-width: 1080px; }
  .kpis .kpi-grande[style] { grid-column: span 2 !important; }
}
.botones-titulo { display: flex; gap: .5rem; flex-wrap: wrap; }
.botones-titulo .boton-principal { width: auto; }
.fila-con-accion { display: flex; align-items: center; gap: .5rem; }
.fila-con-accion > .fila { flex: 1; min-width: 0; }
.accion-fila { flex: none; }
.accion-fila { margin-right: .8rem; }
/* Icono de la app (el mismo del CRM de la agencia) */
.icono-app { width: 38px; height: 38px; border-radius: 10px; flex: none; display: block; }
.menu-marca .icono-app { width: 42px; height: 42px; border-radius: 11px; box-shadow: none !important; }
.icono-app-grande { width: 80px; height: 80px; border-radius: 20px; margin: 0 auto .8rem; box-shadow: 0 12px 30px rgba(65,44,225,.3); }
/* Botones rojos: «Quitar acceso» en contorno rojo; los de borrar de verdad, rojo lleno. Al pasar el ratón nunca se quedan en blanco */
.boton.boton-peligro { background: var(--tarjeta); color: var(--rojo); border-color: color-mix(in srgb, var(--rojo) 50%, #fff); }
.boton.boton-peligro:hover:not(:disabled) { background: var(--rojo-fondo); color: var(--rojo); border-color: var(--rojo); }
.zona-peligro .boton.boton-peligro, .boton.boton-peligro[data-boton-borrar], details .boton.boton-peligro { background: var(--rojo); color: #fff; border-color: var(--rojo); }
.zona-peligro .boton.boton-peligro:hover:not(:disabled), .boton.boton-peligro[data-boton-borrar]:hover:not(:disabled), details .boton.boton-peligro:hover:not(:disabled) {
  background: color-mix(in srgb, var(--rojo) 86%, #000); color: #fff; border-color: color-mix(in srgb, var(--rojo) 86%, #000); }
.boton.boton-peligro:disabled { opacity: .45; cursor: not-allowed; }
.icono-app { background: #fff; object-fit: contain; box-shadow: 0 0 0 1px var(--borde); }
.icono-app-grande { box-shadow: 0 10px 30px rgba(28,25,23,.12), 0 0 0 1px var(--borde); }

/* ---------- Seguimientos, volver a contactar, dinero en juego e informe mensual ---------- */
.en-juego { display: flex; align-items: center; gap: .9rem; padding: .95rem 1.1rem; margin: 0 0 .8rem; border-radius: var(--radio); text-decoration: none; color: var(--texto);
  background: linear-gradient(135deg, var(--tarjeta), color-mix(in srgb, var(--principal) 6%, var(--tarjeta))); border: 1px solid var(--borde); box-shadow: var(--sombra); }
.en-juego-cifra { font-family: var(--letra-numeros); font-size: 28px; font-weight: 700; letter-spacing: var(--tr-28); color: var(--principal-oscuro); font-variant-numeric: tabular-nums; white-space: nowrap; }
.en-juego-texto { flex: 1; font-size: 15px; line-height: 1.35; letter-spacing: var(--tr-15); }
.en-juego-texto strong { font-weight: 600; }
.en-juego .parados { color: var(--naranja); font-weight: 600; }
.en-juego .flecha, .aviso-informe .flecha { color: var(--suave); font-size: 1.4rem; }
.aviso-informe { display: flex; align-items: center; gap: .8rem; padding: .85rem 1.1rem; margin: 0 0 .8rem; border-radius: var(--radio); text-decoration: none; color: var(--texto);
  background: var(--tinte); border: 1px solid color-mix(in srgb, var(--principal) 25%, var(--borde)); }
.aviso-informe .emoji { font-size: 1.6rem; }
.aviso-informe > span:nth-child(2) { flex: 1; font-size: 15px; line-height: 1.35; }
.lead-toca { display: block; font-size: 13px; font-weight: 600; color: var(--principal-oscuro); letter-spacing: var(--tr-13); margin: .1rem 0; }
.lead-toca.volver { color: var(--verde); }
.tarjeta.toca { border: 1.5px solid color-mix(in srgb, var(--principal) 45%, var(--borde)); background: color-mix(in srgb, var(--principal) 4%, var(--tarjeta)); }
.recordatorio { margin: 0 0 .7rem; font-size: 17px; display: flex; flex-wrap: wrap; align-items: baseline; gap: .3rem .6rem; }
.en-linea, .en-linea-form { display: inline; margin: 0; }
.enlace-boton { background: none; border: 0; padding: 0; font: inherit; font-size: 15px; color: var(--principal-oscuro); cursor: pointer; text-decoration: underline; }
.atajos { display: flex; flex-wrap: wrap; gap: .45rem; }
.atajos form { margin: 0; }
.atajos .chip { cursor: pointer; }
.atajo-fecha { display: inline-flex; gap: .35rem; align-items: center; }
.atajo-fecha input[type=date] { font: inherit; font-size: 15px; min-height: 42px; padding: .3rem .6rem; border: 1.5px solid var(--borde); border-radius: 999px; background: var(--tarjeta); color: var(--texto); }
.boton-wa-suave { background: #e5f6ec; color: #11733b; border-color: transparent; }
.boton-wa-suave svg { width: 20px; height: 20px; }
.boton-verde-suave { background: var(--verde-fondo); color: var(--verde); border-color: transparent; }
.volver-campos { display: flex; align-items: center; flex-wrap: wrap; gap: .35rem; font-size: 13px; color: var(--suave); margin-top: .35rem; }
.volver-campos input { width: auto !important; min-height: 36px !important; padding: .25rem .5rem !important; font-size: 15px !important; display: inline-block !important; margin: 0 !important; }
.volver-campos input[inputmode=numeric] { width: 3.6rem !important; text-align: center; }
.volver-campos input[type=text]:not([inputmode]) { flex: 1; min-width: 9rem; }
/* Informe mensual */
.informe { max-width: 820px; margin: 0 auto; }
.informe-meses { display: flex; justify-content: space-between; gap: .5rem; margin-bottom: 1rem; }
.informe-cabeza { text-align: center; margin: .5rem 0 1.4rem; }
.informe-logo { width: 72px; height: 72px; object-fit: contain; border-radius: 18px; background: #fff; box-shadow: 0 0 0 1px var(--borde); margin-bottom: .6rem; }
.informe-ante { margin: 0; font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--suave); }
.informe-cabeza h1 { font-size: 40px; margin: .2rem 0 .1rem; }
.informe-cabeza .texto-suave { margin: 0; }
.informe-heroe { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 1.6rem 1rem; border-radius: 24px; margin-bottom: .8rem;
  background: linear-gradient(135deg, var(--principal), var(--principal-oscuro)); color: var(--principal-texto); box-shadow: 0 16px 40px color-mix(in srgb, var(--principal) 30%, transparent); }
.informe-heroe .nombre { font-size: 15px; font-weight: 600; opacity: .9; }
.informe-heroe .valor { font-family: var(--letra-numeros); font-size: 56px; font-weight: 700; letter-spacing: var(--tr-34); line-height: 1.1; margin: .2rem 0; font-variant-numeric: tabular-nums; }
.informe-heroe .pie { font-size: 15px; opacity: .95; display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: .4rem; }
.informe-heroe small { opacity: .8; }
.informe-heroe .cambio { background: rgba(255,255,255,.18); color: #fff; }
.cambio { display: inline-block; font-size: 13px; font-weight: 700; padding: .05rem .5rem; border-radius: 999px; background: var(--fondo); color: var(--suave); font-variant-numeric: tabular-nums; }
.cambio.sube { background: var(--verde-fondo); color: var(--verde); }
.cambio.baja { background: var(--rojo-fondo); color: var(--rojo); }
.informe-kpis .informe-retorno { grid-column: 1 / -1; }
.informe-vueltas { background: var(--verde-fondo); border-color: color-mix(in srgb, var(--verde) 30%, var(--borde)); font-size: 15px; }
.informe-nota { font-size: 17px; line-height: 1.55; white-space: normal; }
.informe-paso { display: flex; align-items: center; gap: 1rem; text-decoration: none; color: var(--texto); font-size: 15px; }
.informe-paso .valor { font-family: var(--letra-numeros); font-size: 28px; font-weight: 700; color: var(--principal-oscuro); white-space: nowrap; }
@media (min-width: 900px) { .informe-kpis { grid-template-columns: repeat(4, 1fr); } }
@media print {
  .barra-inferior, .cabecera, .no-imprimir, .boton-flotante, .banda-ver-como, .toast, .aviso { display: none !important; }
  body { padding: 0 !important; background: #fff; }
  .contenido { max-width: none; padding: 0; }
  .tarjeta, .kpi { box-shadow: none; break-inside: avoid; }
  .informe-heroe { -webkit-print-color-adjust: exact; print-color-adjust: exact; box-shadow: none; }
  .kpi-grande { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
