/* Clientes y reactivación. Mismo lenguaje visual que Dilook Admin:
   tarjetas blancas flotantes sobre fondo lavanda, acento violeta → azul. Sin modo oscuro. */
:root {
  --violeta: #6a4de6;
  --violeta-oscuro: #5135c9;
  --violeta-claro: #efebff;
  --azul: #4c7cf3;
  --azul-claro: #e7efff;
  --celeste: #22c3e6;
  --rosa: #c955e6;
  --naranja: #f7893b;
  --naranja-claro: #fff0e4;
  --grad: linear-gradient(125deg, #5b6cf6 0%, #7b55ef 55%, #b456e8 100%);
  --grad-wa: linear-gradient(125deg, #1fb978 0%, #12966a 100%);
  --texto: #1d1a3d;
  --gris: #7b7894;
  --gris-suave: #9a97b5;
  --gris-claro: #f4f3fa;
  --borde: #ebe9f4;
  --fondo: #eef0fb;
  --blanco: #fff;
  --rojo: #d6334a;
  --rojo-claro: #fdecef;
  --verde: #12966a;
  --verde-claro: #e3f6ee;
  --amarillo: #a36400;
  --amarillo-claro: #fff4dc;
  --radio: 20px;
  --radio-chico: 12px;
  --sombra: 0 1px 2px rgba(60, 50, 140, .04), 0 10px 30px rgba(60, 50, 140, .07);
  --sombra-color: 0 10px 24px rgba(106, 77, 230, .32);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--texto);
  background: var(--fondo) linear-gradient(140deg, #e9edff 0%, #f1ecff 45%, #e8f2ff 100%) fixed;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
body.con-menu { display: flex; }
a { color: var(--violeta); text-decoration: none; }
a:hover { color: var(--violeta-oscuro); }
h1 { font-size: 26px; margin: 0; line-height: 1.2; letter-spacing: -.02em; font-weight: 700; }
h2 { font-size: 16px; margin: 0 0 14px; letter-spacing: -.01em; font-weight: 650; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
h3 { font-size: 14px; margin: 22px 0 10px; font-weight: 650; display: flex; align-items: center; gap: 8px; }
h2 .icono, h3 .icono { width: 30px; height: 30px; padding: 6px; border-radius: 10px; background: var(--violeta-claro); color: var(--violeta); }
h3 .icono { width: 26px; height: 26px; padding: 5px; }
p { margin: 0 0 12px; }
code { background: var(--gris-claro); padding: 1px 6px; border-radius: 6px; font-size: 12.5px; }
.icono { width: 20px; height: 20px; flex: none; }
.tenue { color: var(--gris); }
.chico { font-size: 12.5px; }
.solo-lector { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.solo-movil { display: none; }
[hidden] { display: none !important; }

/* ---------- menú lateral ---------- */
.lateral {
  width: 248px; flex: none;
  background: var(--blanco); border-radius: 28px; box-shadow: var(--sombra);
  display: flex; flex-direction: column;
  position: sticky; top: 16px; height: calc(100vh - 32px);
  margin: 16px 0 16px 16px; padding: 24px 16px 16px;
}
.marca { display: flex; align-items: center; gap: 12px; padding: 0 8px 22px; color: var(--texto); }
.marca:hover { color: var(--texto); }
.marca-logo {
  width: 42px; height: 42px; border-radius: 14px; flex: none;
  background: var(--grad); color: #fff; display: grid; place-items: center;
  font-weight: 800; font-size: 18px; box-shadow: var(--sombra-color);
}
.marca-texto { min-width: 0; }
.marca-texto strong { display: block; font-size: 15px; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.marca-texto small { display: block; color: var(--gris); font-size: 11.5px; margin-top: 2px; }
.lateral nav { display: flex; flex-direction: column; gap: 4px; flex: 1; overflow-y: auto; }
.lateral nav a {
  display: flex; align-items: center; gap: 12px;
  color: #4d4a6b; padding: 10px 14px; border-radius: 14px; font-weight: 550;
  transition: background .15s, color .15s;
}
.lateral nav a .icono { color: var(--gris-suave); transition: color .15s; }
.lateral nav a:hover { background: var(--gris-claro); color: var(--texto); }
.lateral nav a:hover .icono { color: var(--violeta); }
.lateral nav a.activo { background: var(--grad); color: #fff; box-shadow: var(--sombra-color); }
.lateral nav a.activo .icono { color: #fff; }
.separador { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: #aaa7c2; padding: 14px 14px 6px; font-weight: 600; }
.separador:first-child { padding-top: 0; }
.lateral-pie { display: flex; gap: 6px; padding-top: 14px; border-top: 1px solid var(--borde); }
.lateral-pie a, .lateral-pie button {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 8px; border-radius: 12px; color: var(--gris); font: inherit; font-size: 13px; font-weight: 550;
  background: none; border: 0; cursor: pointer; white-space: nowrap;
}
.lateral-pie a:hover, .lateral-pie button:hover, .lateral-pie a[aria-current] { background: var(--gris-claro); color: var(--violeta); }
.lateral-pie form { flex: 1; display: flex; margin: 0; }
.lateral-pie .icono { width: 18px; height: 18px; }

.principal { flex: 1; min-width: 0; padding: 18px 32px 60px; max-width: 1360px; }
.sin-menu .principal { max-width: none; min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.sin-menu .contenido { width: 100%; max-width: 420px; }

/* ---------- barra superior ---------- */
.barra-sup { display: flex; align-items: center; gap: 14px; margin: 0 0 22px; min-height: 60px; }
.marca-movil { display: none; }
.buscador { flex: 1; max-width: 460px; position: relative; display: flex; margin: 0; }
.buscador .icono { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--gris-suave); pointer-events: none; }
.buscador input { width: 100%; border: 0; border-radius: 999px; padding: 13px 18px 13px 46px; background: var(--blanco); box-shadow: var(--sombra); }
.buscador input:hover { background: var(--blanco); }
.estado-sync { margin-left: auto; display: flex; align-items: center; gap: 8px; color: var(--gris); font-size: 13px; background: rgba(255, 255, 255, .6); padding: 9px 14px; border-radius: 999px; white-space: nowrap; }
.estado-sync .punto { background: var(--verde); box-shadow: 0 0 0 4px var(--verde-claro); }
.estado-sync.apagado .punto { background: #b9b6cf; box-shadow: 0 0 0 4px var(--gris-claro); }
.estado-sync.con-error { color: var(--rojo); }
.estado-sync.con-error .punto { background: var(--rojo); box-shadow: 0 0 0 4px var(--rojo-claro); }
.perfil { display: flex; align-items: center; gap: 10px; color: var(--texto); background: var(--blanco); padding: 6px 16px 6px 6px; border-radius: 999px; box-shadow: var(--sombra); }
.perfil:hover { color: var(--texto); box-shadow: 0 0 0 2px var(--violeta-claro), var(--sombra); }
.perfil-texto strong, .perfil-texto small { display: block; line-height: 1.2; white-space: nowrap; max-width: 160px; overflow: hidden; text-overflow: ellipsis; }
.perfil-texto strong { font-size: 13.5px; }
.perfil-texto small { color: var(--gris); font-size: 11.5px; }

/* ---------- avatar ---------- */
.avatar {
  width: 38px; height: 38px; border-radius: 50%; flex: none;
  background: var(--grad); color: #fff; display: grid; place-items: center;
  font-weight: 700; font-size: 13.5px; letter-spacing: .02em;
}
.avatar-grande { width: 64px; height: 64px; font-size: 22px; box-shadow: var(--sombra-color); }
.avatar.t1 { background: linear-gradient(125deg, #4c7cf3, #22c3e6); }
.avatar.t2 { background: linear-gradient(125deg, #f7893b, #f5b02e); }
.avatar.t3 { background: linear-gradient(125deg, #c955e6, #e8577a); }

/* ---------- encabezados ---------- */
.encabezado { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.encabezado p { margin: 6px 0 0; }
.encabezado .botones { margin: 0; }
.miga { margin: 0 0 8px; font-size: 13px; }
.miga a { color: var(--gris); display: inline-flex; align-items: center; gap: 4px; }
.miga a:hover { color: var(--violeta); }

/* ---------- botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  background: var(--grad); color: #fff; border: 0;
  padding: 10px 18px; border-radius: var(--radio-chico); font: inherit; font-weight: 650; cursor: pointer; white-space: nowrap;
  box-shadow: 0 6px 16px rgba(106, 77, 230, .25);
  transition: transform .12s, box-shadow .12s, background .12s, opacity .12s;
}
.btn:hover { color: #fff; box-shadow: var(--sombra-color); transform: translateY(-1px); }
.btn:active { transform: none; }
.btn:disabled { opacity: .5; cursor: default; transform: none; }
.btn .icono { width: 17px; height: 17px; }
.btn-claro { background: var(--blanco); color: var(--texto); box-shadow: inset 0 0 0 1px var(--borde); }
.btn-claro:hover { color: var(--violeta); box-shadow: inset 0 0 0 1px #d8d1fb; background: #faf9ff; }
.btn-peligro { background: var(--blanco); color: var(--rojo); box-shadow: inset 0 0 0 1px #f5c6ce; }
.btn-peligro:hover { background: var(--rojo-claro); color: var(--rojo); box-shadow: inset 0 0 0 1px #f5c6ce; }
.btn-wa { background: var(--grad-wa); box-shadow: 0 6px 16px rgba(18, 150, 106, .25); }
.btn-wa:hover { box-shadow: 0 10px 24px rgba(18, 150, 106, .32); }
.btn-chico { padding: 6px 12px; font-size: 13px; font-weight: 600; border-radius: 10px; }
.btn-icono { padding: 9px; width: 40px; height: 40px; }
.btn-ancho { width: 100%; }
form.en-linea { display: inline; margin: 0; }
.botones { display: flex; gap: 10px; margin-top: 8px; flex-wrap: wrap; align-items: center; }
.botones form { margin: 0; }

/* ---------- tarjetas de cifras ---------- */
.tarjetas, .kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 18px; margin-bottom: 22px; }
.kpi {
  background: var(--blanco); border-radius: var(--radio); padding: 20px 22px; box-shadow: var(--sombra);
  color: var(--texto); position: relative; overflow: hidden; display: flex; flex-direction: column;
  transition: transform .15s, box-shadow .15s;
}
a.kpi:hover { color: var(--texto); transform: translateY(-2px); box-shadow: 0 1px 2px rgba(60, 50, 140, .05), 0 16px 36px rgba(60, 50, 140, .12); }
.kpi-t { color: var(--gris); font-size: 13px; font-weight: 550; order: -1; }
.kpi-n { font-size: 25px; margin: 4px 0 2px; font-variant-numeric: tabular-nums; letter-spacing: -.02em; font-weight: 750; line-height: 1.25; }
.kpi-n small { font-size: 14px; font-weight: 600; color: var(--gris); letter-spacing: 0; }
.kpi-sub { color: var(--gris); font-size: 12px; }
.kpi-ico { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; background: var(--violeta-claro); color: var(--violeta); margin-bottom: 12px; order: -2; }
.kpi-ico.verde { background: var(--verde-claro); color: var(--verde); }
.kpi-ico.azul { background: var(--azul-claro); color: var(--azul); }
.kpi-ico.naranja { background: var(--naranja-claro); color: var(--naranja); }
.kpi.destacada { background: var(--grad); color: #fff; box-shadow: var(--sombra-color); }
.kpi.destacada .kpi-t, .kpi.destacada .kpi-sub, .kpi.destacada .kpi-n small { color: rgba(255, 255, 255, .85); }
.kpi.destacada .kpi-ico { background: rgba(255, 255, 255, .2); color: #fff; }
.kpi.destacada::after { content: ""; position: absolute; right: -30px; top: -40px; width: 140px; height: 140px; border-radius: 50%; background: rgba(255, 255, 255, .12); pointer-events: none; }
.kpi.destacada a { color: #fff; text-decoration: underline; }
.kpi.con-anillo { flex-direction: row; align-items: center; justify-content: space-between; gap: 12px; }
.kpi.con-anillo > div { min-width: 0; display: flex; flex-direction: column; }
.kpi.con-anillo { gap: 8px; padding-right: 16px; }
.kpi.con-anillo .kpi-t { white-space: nowrap; }
.kpi.con-anillo .anillo { width: 56px; height: 56px; }

/* anillos y gráficos */
.anillo { width: 70px; height: 70px; flex: none; }
.anillo-fondo { fill: none; stroke: var(--gris-claro); stroke-width: 7; }
.anillo-valor { fill: none; stroke: var(--violeta); stroke-width: 7; stroke-linecap: round; }
.anillo text { font-size: 13px; font-weight: 750; fill: var(--texto); }
.anillo.azul .anillo-valor { stroke: var(--azul); }
.anillo.celeste .anillo-valor { stroke: var(--celeste); }
.anillo.naranja .anillo-valor { stroke: var(--naranja); }
.anillo.rosa .anillo-valor { stroke: var(--rosa); }
.anillo.verde .anillo-valor { stroke: var(--verde); }
.grafico { width: 100%; height: auto; display: block; }
.grafico .grilla { stroke: var(--borde); stroke-dasharray: 3 5; }
.grafico .eje { font-size: 11px; fill: var(--gris); }
.grafico .serie-nuevos { fill: var(--celeste); }
.grafico .serie-vuelven { fill: var(--violeta); }
.leyenda { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12.5px; color: var(--gris); }
.leyenda span { display: inline-flex; align-items: center; gap: 6px; }
.dona { width: 168px; height: 168px; flex: none; }
.dona-fondo { fill: none; stroke: var(--gris-claro); stroke-width: 16; }
.dona-parte { fill: none; stroke-width: 16; stroke: var(--violeta); }
.dona-centro { font-size: 15px; font-weight: 750; fill: var(--texto); }
.dona-sub { font-size: 8.5px; fill: var(--gris); }
.reparto { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; justify-content: center; }
.reparto ul { list-style: none; margin: 0; padding: 0; flex: 1; min-width: 180px; display: flex; flex-direction: column; gap: 4px; }
.reparto li a { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--texto); padding: 6px 8px; border-radius: 10px; }
.reparto li a:hover { background: var(--gris-claro); color: var(--texto); }
.reparto li b { margin-left: auto; font-variant-numeric: tabular-nums; font-weight: 650; }
.punto { width: 10px; height: 10px; border-radius: 50%; flex: none; background: #b9b6cf; display: inline-block; }
/* colores de segmento (dona, puntos, leyenda) */
.dona-parte.seg-activo { stroke: var(--verde); }
.dona-parte.seg-t1 { stroke: var(--azul); }
.dona-parte.seg-t2 { stroke: var(--naranja); }
.dona-parte.seg-t3 { stroke: var(--rosa); }
.dona-parte.seg-dormido { stroke: #c9c6dc; }
.punto.seg-activo, .punto-ok { background: var(--verde); }
.punto.seg-t1 { background: var(--azul); }
.punto.seg-t2 { background: var(--naranja); }
.punto.seg-t3 { background: var(--rosa); }
.punto.seg-dormido { background: #c9c6dc; }
.punto.serie-nuevos { background: var(--celeste); }
.punto.serie-vuelven { background: var(--violeta); }
.punto-error { background: var(--rojo); }

/* ---------- cajas (secciones) ---------- */
.tarjeta { background: var(--blanco); border-radius: var(--radio); padding: 22px 24px; margin-bottom: 20px; box-shadow: var(--sombra); }
.tarjeta > :last-child { margin-bottom: 0; }
.tarjeta-cab { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.tarjeta-cab h2 { margin: 0; }
.tarjeta-cab p { margin: 0; }
.tarjeta-cab > a { font-size: 13px; font-weight: 600; }
.sin-relleno { padding: 6px 8px; }
.grilla-panel { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(300px, 1fr); gap: 20px; align-items: start; }
.grilla-panel > div { position: sticky; top: 16px; }
.dos-columnas { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 20px; align-items: start; }
.dos-columnas > .tarjeta { margin-bottom: 20px; }
.caja-chica { max-width: 460px; margin: 0 auto; }
.vacio { color: var(--gris); margin: 6px 0; text-align: center; padding: 18px 0; }
.contador { font-size: 12px; font-weight: 700; background: var(--violeta-claro); color: var(--violeta-oscuro); padding: 2px 9px; border-radius: 999px; }

/* ---------- lista de WhatsApp (Hoy) ---------- */
.pendientes { list-style: none; margin: 0; padding: 0; }
.pendiente { display: flex; align-items: center; gap: 14px; padding: 12px 0; border-bottom: 1px dashed var(--borde); transition: opacity .2s; }
.pendiente:last-child { border-bottom: 0; }
.pendiente-quien { display: flex; align-items: center; gap: 12px; min-width: 0; flex: 1; color: var(--texto); }
.pendiente-quien:hover { color: var(--texto); }
.pendiente-quien:hover strong { color: var(--violeta); }
.pendiente-quien > span:last-child { min-width: 0; }
.pendiente-quien strong { display: block; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pendiente-quien small { display: block; color: var(--gris); font-size: 12px; margin-top: 2px; }
.pendiente-quien small .tag { margin-right: 4px; }
.pendiente-valor { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; text-align: right; }
.pendiente-valor small { display: block; font-weight: 500; color: var(--gris); font-size: 11.5px; }
.pendiente-acciones { display: flex; gap: 6px; align-items: center; }
.pendiente-acciones form { margin: 0; }
.pendiente.hecho { opacity: .45; }
.pendiente.hecho .btn-wa { background: var(--verde-claro); color: var(--verde); box-shadow: none; }

/* listas de actividad */
.lista-items { list-style: none; margin: 0; padding: 0; }
.lista-items li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px dashed var(--borde); }
.lista-items li:last-child { border-bottom: 0; }
.item-ico { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; flex: none; background: var(--violeta-claro); color: var(--violeta); }
.item-ico .icono { width: 18px; height: 18px; }
.item-ico.verde { background: var(--verde-claro); color: var(--verde); }
.item-ico.azul { background: var(--azul-claro); color: var(--azul); }
.item-ico.gris { background: var(--gris-claro); color: var(--gris); }
.item-texto { min-width: 0; flex: 1; }
.item-texto strong { display: block; font-weight: 600; }
.item-texto small { color: var(--gris); font-size: 12px; }
.item-valor { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; text-align: right; }

/* ---------- tablas ---------- */
.tabla-envoltorio { padding: 6px 8px; overflow-x: auto; }
.tabla { width: 100%; border-collapse: separate; border-spacing: 0; }
.tabla th, .tabla td { padding: 11px 12px; text-align: left; border-bottom: 1px solid var(--borde); vertical-align: middle; }
.tabla thead th { font-size: 11.5px; color: var(--gris-suave); font-weight: 650; text-transform: uppercase; letter-spacing: .06em; white-space: nowrap; }
.tabla tbody tr { transition: background .12s; }
.tabla tbody tr:hover td { background: #f8f7ff; }
.tabla tbody tr:hover td:first-child { border-radius: 12px 0 0 12px; }
.tabla tbody tr:hover td:last-child { border-radius: 0 12px 12px 0; }
.tabla tbody tr:last-child td { border-bottom: 0; }
.tabla .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.celda-cliente { display: flex; align-items: center; gap: 12px; color: var(--texto); min-width: 230px; }
.tabla td { white-space: nowrap; }
.tabla td:first-child { white-space: normal; }
.tabla td small.tenue { display: block; }
.celda-cliente:hover { color: var(--texto); }
.celda-cliente:hover strong { color: var(--violeta); }
.celda-cliente .avatar { width: 34px; height: 34px; font-size: 12px; }
.celda-cliente > span:last-child { min-width: 0; }
.celda-cliente strong { display: block; font-weight: 600; max-width: 280px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.celda-cliente small { display: block; color: var(--gris); font-size: 12px; }
.paginador { display: flex; align-items: center; justify-content: center; gap: 14px; margin: 4px 0 20px; color: var(--gris); font-size: 13px; }

/* ---------- etiquetas ---------- */
.tag { display: inline-block; font-size: 11.5px; font-weight: 650; padding: 3px 10px; border-radius: 999px; background: var(--gris-claro); color: var(--gris); white-space: nowrap; vertical-align: middle; line-height: 1.5; }
.tag-activo, .tag-estado-completed, .tag.verde { background: var(--verde-claro); color: var(--verde); }
.tag-t1, .tag-estado-processing, .tag.azul { background: var(--azul-claro); color: #3561d6; }
.tag-t2, .tag-omitido, .tag-estado-on-hold, .tag-estado-pending, .tag.amarillo { background: var(--naranja-claro); color: #c25a10; }
.tag-t3 { background: #fbeafd; color: #a634c4; }
.tag-error, .tag-estado-cancelled, .tag-estado-failed, .tag-estado-refunded, .tag.rojo { background: var(--rojo-claro); color: var(--rojo); }
.tag.violeta { background: var(--violeta-claro); color: var(--violeta-oscuro); }

/* ---------- avisos ---------- */
.aviso { padding: 13px 18px 13px 22px; border-radius: 16px; margin-bottom: 16px; box-shadow: var(--sombra); background: #f2fbf7; color: #0d6b4b; position: relative; }
.aviso::before { content: ""; position: absolute; left: 0; top: 12px; bottom: 12px; width: 4px; border-radius: 0 4px 4px 0; background: var(--verde); }
.aviso p:last-child { margin-bottom: 0; }
.aviso a { color: inherit; text-decoration: underline; font-weight: 600; }
.aviso-error { background: #fff4f6; color: #a8253a; }
.aviso-error::before { background: var(--rojo); }
.aviso-info { background: #f5f6ff; color: #36408f; }
.aviso-info::before { background: var(--azul); }
.tarjeta .aviso { box-shadow: none; }
.texto-error { color: var(--rojo); font-size: 12.5px; font-weight: 500; }

/* ---------- formularios ---------- */
.pila { display: flex; flex-direction: column; gap: 14px; }
.campo { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 13px; min-width: 0; color: #46436a; margin-bottom: 14px; }
.pila .campo, .grilla-2 .campo, .grilla-3 .campo { margin-bottom: 0; }
.campo > span { display: flex; align-items: center; gap: 6px; }
.campo > span .icono { width: 17px; height: 17px; color: var(--verde); }
.ayuda-campo, .campo small.tenue { font-weight: 400; font-size: 12px; color: var(--gris); }
.grilla-2, .grilla-3 { display: grid; gap: 16px; margin-bottom: 16px; }
.grilla-2 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grilla-3 { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.check { display: block; position: relative; padding-left: 28px; font-size: 14px; margin-bottom: 10px; cursor: pointer; }
.check input[type=checkbox] { position: absolute; left: 0; top: 1px; margin: 0; }
.check .icono { width: 18px; height: 18px; color: var(--violeta); vertical-align: -4px; }
.check-grande { background: var(--gris-claro); padding: 12px 14px 12px 42px; border-radius: var(--radio-chico); font-weight: 600; }
.check-grande input[type=checkbox] { left: 14px; top: 13px; }
.opciones { display: flex; gap: 6px 18px; flex-wrap: wrap; margin-top: 6px; }
.opciones .check { margin-bottom: 0; font-weight: 400; color: var(--texto); }
fieldset { border: 0; padding: 0; margin: 0 0 16px; min-width: 0; }
legend { padding: 0; margin-bottom: 4px; font-weight: 600; }
input, select, textarea {
  font: inherit; font-weight: 400; color: var(--texto);
  border: 1px solid transparent; border-radius: var(--radio-chico); padding: 10px 13px; background: var(--gris-claro); max-width: 100%; width: 100%;
  transition: background .12s, border-color .12s, box-shadow .12s;
}
textarea { resize: vertical; line-height: 1.5; }
input:hover, select:hover, textarea:hover { background: #efeef8; }
input:focus, select:focus, textarea:focus { outline: 0; background: var(--blanco); border-color: #b9a9f7; box-shadow: 0 0 0 4px rgba(106, 77, 230, .12); }
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--violeta); padding: 0; flex: none; }
select { appearance: none; -webkit-appearance: none; padding-right: 36px; background-image: linear-gradient(45deg, transparent 50%, #8f8bb0 50%), linear-gradient(135deg, #8f8bb0 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
.en-fila { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 0; }
.en-fila select, .en-fila input { width: auto; }
.campo-chico { max-width: 200px; padding: 6px 10px; }
.en-fila select { padding-top: 7px; padding-bottom: 7px; }

/* filtros de Clientes */
.filtros { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 18px; }
.filtros .campo { margin: 0; flex: 0 1 auto; }
.filtros .campo > span { font-size: 11.5px; color: var(--gris-suave); text-transform: uppercase; letter-spacing: .06em; padding-left: 4px; }
.filtros input, .filtros select { background-color: var(--blanco); box-shadow: var(--sombra); }
.filtros select { width: auto; min-width: 150px; }
.campo-buscar { flex: 1 1 280px !important; position: relative; }
.campo-buscar .icono { position: absolute; left: 14px; bottom: 11px; color: var(--gris-suave); pointer-events: none; }
.campo-buscar input { padding-left: 42px; }

/* plegables */
.plegable { margin-top: 14px; border-top: 1px dashed var(--borde); padding-top: 12px; }
.plegable summary { cursor: pointer; color: var(--violeta); font-weight: 600; font-size: 13px; list-style: none; display: inline-flex; align-items: center; gap: 6px; }
.plegable summary::-webkit-details-marker { display: none; }
.plegable summary::before { content: "+"; display: grid; place-items: center; width: 18px; height: 18px; border-radius: 6px; background: var(--violeta-claro); font-size: 13px; }
.plegable[open] summary::before { content: "−"; }
.plegable[open] summary { margin-bottom: 12px; }

/* ---------- ficha de cliente ---------- */
.ficha-cab { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.ficha-quien { flex: 1; min-width: 220px; }
.ficha-quien h1 { margin-bottom: 4px; overflow-wrap: anywhere; }
.ficha-quien p { margin: 0 0 6px; overflow-wrap: anywhere; }
.ficha-quien p:last-child { margin: 0; }
.ficha-acciones { display: flex; gap: 8px; flex-wrap: wrap; }
.ficha-acciones form { margin: 0; }

/* línea de reactivación */
.linea { list-style: none; margin: 0 0 14px; padding: 0; display: grid; grid-auto-columns: 1fr; grid-auto-flow: column; gap: 6px; }
.linea-paso { position: relative; padding: 16px 12px 12px; border-radius: 14px; background: var(--gris-claro); color: var(--gris); min-width: 0; }
.linea-paso::before { content: ""; position: absolute; left: 12px; right: 12px; top: 0; height: 4px; border-radius: 0 0 4px 4px; background: #d9d6e8; }
.linea-paso strong { display: block; color: var(--texto); font-size: 13px; overflow-wrap: anywhere; }
.linea-paso small { display: block; font-size: 11.5px; }
.linea-paso.actual { background: var(--blanco); box-shadow: 0 0 0 2px var(--violeta), var(--sombra); }
.linea-paso.actual strong::after { content: " · hoy"; color: var(--violeta); }
.linea-paso:first-child::before { background: var(--verde); }
.linea-paso.paso-t1::before { background: var(--azul); }
.linea-paso.paso-t2::before { background: var(--naranja); }
.linea-paso.paso-t3::before { background: var(--rosa); }

/* productos con barra */
.productos { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.productos li { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(80px, 1fr) auto; gap: 14px; align-items: center; }
.productos-nombre { font-weight: 600; overflow-wrap: anywhere; }
.barra-fondo { height: 10px; border-radius: 999px; background: var(--gris-claro); overflow: hidden; display: block; }
.barra-lleno { display: block; height: 100%; border-radius: 999px; background: var(--grad); }

/* pedidos */
.pedidos { list-style: none; margin: 0; padding: 0; }
.pedido { padding: 12px 0; border-bottom: 1px dashed var(--borde); }
.pedido:last-child { border-bottom: 0; }
.pedido-cab { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.pedido-total { margin-left: auto; font-variant-numeric: tabular-nums; }
.pedido p { margin: 4px 0 0; }
.pedido-no-cuenta .pedido-total { color: var(--gris-suave); text-decoration: line-through; }

/* historial */
.historial { list-style: none; margin: 0; padding: 0; }
.historial li { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px dashed var(--borde); }
.historial li:last-child { border-bottom: 0; }
.historial li > div { min-width: 0; flex: 1; }
.historial small { display: block; }
.historial-ico { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; flex: none; background: var(--violeta-claro); color: var(--violeta); }
.historial-ico .icono { width: 18px; height: 18px; }
.historial-ico.canal-whatsapp { background: var(--verde-claro); color: var(--verde); }
.historial-ico.canal-email { background: var(--azul-claro); color: var(--azul); }
.historial-texto { margin: 6px 0 0; background: var(--gris-claro); padding: 8px 12px; border-radius: 10px; white-space: pre-line; overflow-wrap: anywhere; }

/* ---------- ajustes ---------- */
.tramo { border-radius: 16px; background: #faf9ff; margin-bottom: 12px; position: relative; overflow: hidden; box-shadow: inset 0 0 0 1px var(--borde); }
.tramo::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--violeta); }
.tramo.paso-t1::before { background: var(--azul); }
.tramo.paso-t2::before { background: var(--naranja); }
.tramo.paso-t3::before { background: var(--rosa); }
.tramo summary { display: flex; align-items: center; gap: 14px; padding: 14px 18px 14px 20px; cursor: pointer; list-style: none; border-radius: 16px; transition: background .12s; }
.tramo summary::-webkit-details-marker { display: none; }
.tramo summary:hover { background: #f4f2ff; }
.tramo summary:focus-visible { outline: 2px solid rgba(106, 77, 230, .35); outline-offset: -2px; }
.tramo-n { width: 30px; height: 30px; border-radius: 10px; display: grid; place-items: center; flex: none; font-weight: 750; font-size: 13px; color: #fff; background: var(--violeta); }
.tramo.paso-t1 .tramo-n { background: var(--azul); }
.tramo.paso-t2 .tramo-n { background: var(--naranja); }
.tramo.paso-t3 .tramo-n { background: var(--rosa); }
.tramo-titulo { flex: 1; min-width: 0; }
.tramo-titulo strong { display: block; font-size: 15px; }
.tramo-titulo small { display: block; color: var(--gris); font-size: 12.5px; }
.tramo-flecha { width: 30px; height: 30px; border-radius: 10px; flex: none; background: var(--blanco); box-shadow: inset 0 0 0 1px var(--borde); position: relative; transition: transform .2s; }
.tramo-flecha::after { content: ""; position: absolute; left: 11px; top: 9px; width: 7px; height: 7px; border-right: 2px solid var(--gris); border-bottom: 2px solid var(--gris); transform: rotate(45deg); }
.tramo[open] .tramo-flecha { transform: rotate(180deg); }
.tramo[open] summary { border-bottom: 1px dashed var(--borde); border-radius: 16px 16px 0 0; }
.tramo-cuerpo { padding: 18px 18px 6px 20px; }
.tramo input, .tramo textarea, .tramo select { background: var(--blanco); box-shadow: inset 0 0 0 1px var(--borde); }


/* ---------- diseño de los emails (Ajustes) ---------- */
.diseno-email { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 28px; align-items: start; }
.diseno-opciones h3:first-child { margin-top: 0; }
.logo-actual { min-height: 76px; display: flex; align-items: center; justify-content: center; padding: 14px; border-radius: 14px; margin-bottom: 14px;
  background-color: #fff; background-image: linear-gradient(45deg, #f1f0f7 25%, transparent 25%, transparent 75%, #f1f0f7 75%), linear-gradient(45deg, #f1f0f7 25%, transparent 25%, transparent 75%, #f1f0f7 75%);
  background-size: 16px 16px; background-position: 0 0, 8px 8px; box-shadow: inset 0 0 0 1px var(--borde); }
.logo-actual img { max-height: 64px; max-width: 100%; display: block; }
input[type=file] { padding: 8px; background: var(--gris-claro); }
input[type=file]::file-selector-button { border: 0; border-radius: 9px; background: var(--blanco); color: var(--violeta); font: inherit; font-weight: 650; padding: 6px 12px; margin-right: 10px; cursor: pointer; box-shadow: 0 1px 3px rgba(60, 50, 140, .12); }
.paletas { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.paleta { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px 6px 6px; border-radius: 999px; border: 0; background: var(--blanco); box-shadow: inset 0 0 0 1px var(--borde); font: inherit; font-size: 13px; font-weight: 600; color: var(--texto); cursor: pointer; }
.paleta:hover { box-shadow: inset 0 0 0 1px #c9bdf8; }
.paleta.elegida { box-shadow: inset 0 0 0 2px var(--violeta); }
.paleta i { width: 26px; height: 26px; border-radius: 50%; display: block; border: 4px solid; }
.selector-color { display: flex; align-items: center; gap: 10px; }
.selector-color input[type=color] { width: 48px; height: 40px; padding: 4px; cursor: pointer; flex: none; }
.selector-color input[type=color]::-webkit-color-swatch-wrapper { padding: 0; }
.selector-color input[type=color]::-webkit-color-swatch { border: 0; border-radius: 8px; }
.selector-color code { font-size: 13px; }
.colores { margin-bottom: 12px; }
.diseno-vista { background: var(--gris-claro); border-radius: 18px; padding: 16px; position: sticky; top: 16px; }
.vista-cab .campo { margin-bottom: 8px; }
.vista-cab select { background-color: var(--blanco); }
.vista-asunto { margin: 0 0 10px; font-size: 13.5px; overflow-wrap: anywhere; }
.vista-email { width: 100%; height: 620px; border: 0; border-radius: 14px; background: #fff; display: block; margin-bottom: 8px; box-shadow: var(--sombra); }
.paleta-violeta i { background: #6a4de6; border-color: #f1f0f7; box-shadow: 0 0 0 1px #6a4de633; }
.paleta-nuez i { background: #8a5a2b; border-color: #f6f0e8; box-shadow: 0 0 0 1px #8a5a2b33; }
.paleta-verde i { background: #12966a; border-color: #edf6f1; box-shadow: 0 0 0 1px #12966a33; }
.paleta-azul i { background: #2f6fe4; border-color: #eef3fc; box-shadow: 0 0 0 1px #2f6fe433; }
.paleta-rosa i { background: #d63e7b; border-color: #fbf0f4; box-shadow: 0 0 0 1px #d63e7b33; }
.paleta-naranja i { background: #e8702a; border-color: #fbf2ea; box-shadow: 0 0 0 1px #e8702a33; }
.paleta-negro i { background: #1d1a3d; border-color: #f2f2f4; box-shadow: 0 0 0 1px #1d1a3d33; }

/* ---------- administración ---------- */
.subnav { display: inline-flex; gap: 4px; flex-wrap: wrap; background: var(--blanco); padding: 5px; border-radius: 999px; box-shadow: var(--sombra); margin-bottom: 22px; max-width: 100%; }
.subnav a { display: inline-flex; align-items: center; gap: 7px; padding: 8px 16px; border-radius: 999px; color: var(--gris); font-weight: 600; font-size: 13.5px; white-space: nowrap; }
.subnav a .icono { width: 17px; height: 17px; }
.subnav a:hover { color: var(--violeta); background: var(--gris-claro); }
.subnav a[aria-current] { background: var(--grad); color: #fff; box-shadow: var(--sombra-color); }
.estado-conexion { display: flex; gap: 14px; align-items: center; background: var(--gris-claro); border-radius: 16px; padding: 14px 16px; margin-bottom: 16px; }
.estado-conexion .punto { width: 12px; height: 12px; }
.estado-conexion .punto-ok { box-shadow: 0 0 0 5px var(--verde-claro); }
.estado-conexion .punto-error { box-shadow: 0 0 0 5px var(--rojo-claro); }
.estado-conexion > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pasos { margin: 0 0 18px; padding: 0; list-style: none; counter-reset: paso; display: flex; flex-direction: column; gap: 10px; }
.pasos li { counter-increment: paso; position: relative; padding: 2px 0 0 38px; min-height: 26px; }
.pasos li::before { content: counter(paso); position: absolute; left: 0; top: 0; width: 26px; height: 26px; border-radius: 50%; background: var(--violeta-claro); color: var(--violeta); font-weight: 700; font-size: 12.5px; display: grid; place-items: center; }
.lista-simple { list-style: none; margin: 0; padding: 0; }
.usuario-fila { display: flex; gap: 14px; align-items: flex-start; flex-wrap: wrap; padding: 14px 0; border-bottom: 1px dashed var(--borde); }
.usuario-fila:last-child { border-bottom: 0; }
.usuario-fila > div:first-of-type { flex: 1; min-width: 220px; }
.usuario-fila .plegable { border: 0; margin: 0; padding: 0; flex-basis: 100%; }
.usuario-fila .plegable .botones { background: var(--gris-claro); padding: 12px; border-radius: 14px; }
.usuario-fila .plegable input, .usuario-fila .plegable select { background: var(--blanco); }
code.ruta { display: block; padding: 12px 14px; border-radius: 12px; margin: 0 0 12px; overflow-wrap: anywhere; font-size: 13px; background: #1d1a3d; color: #e3dcff; }
.registro { list-style: none; margin: 0 0 12px; padding: 0; font: 12.5px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace; max-height: 360px; overflow: auto; background: var(--gris-claro); border-radius: 12px; }
.registro li { padding: 5px 12px; border-bottom: 1px solid var(--borde); overflow-wrap: anywhere; }
.registro li:last-child { border-bottom: 0; }

/* ---------- ingreso y páginas sueltas ---------- */
.ingreso { background: var(--blanco); border-radius: 28px; padding: 36px 32px 30px; box-shadow: 0 20px 60px rgba(70, 50, 160, .15); position: relative; overflow: hidden; }
.ingreso::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 6px; background: var(--grad); }
.ingreso-marca { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; margin-bottom: 24px; }
.ingreso-marca .marca-logo { width: 54px; height: 54px; font-size: 22px; border-radius: 17px; }
.ingreso-marca strong { font-size: 19px; letter-spacing: -.01em; display: block; }
.ingreso-marca small { color: var(--gris); font-size: 13px; display: block; }
.ingreso h1 { font-size: 20px; margin-bottom: 8px; }
.ingreso .btn { width: 100%; margin-top: 4px; }
.ingreso .pie { text-align: center; margin: 18px 0 0; font-size: 13px; }

/* ---------- barra inferior (celular) ---------- */
.tabbar { display: none; }

/* ---------- anchos de barras (sin estilos inline) ---------- */
.ancho-0 { width: 0; } .ancho-5 { width: 5%; } .ancho-10 { width: 10%; } .ancho-15 { width: 15%; } .ancho-20 { width: 20%; }
.ancho-25 { width: 25%; } .ancho-30 { width: 30%; } .ancho-35 { width: 35%; } .ancho-40 { width: 40%; } .ancho-45 { width: 45%; }
.ancho-50 { width: 50%; } .ancho-55 { width: 55%; } .ancho-60 { width: 60%; } .ancho-65 { width: 65%; } .ancho-70 { width: 70%; }
.ancho-75 { width: 75%; } .ancho-80 { width: 80%; } .ancho-85 { width: 85%; } .ancho-90 { width: 90%; } .ancho-95 { width: 95%; }
.ancho-100 { width: 100%; }

/* ---------- pantallas chicas ---------- */
@media (max-width: 1100px) {
  .grilla-panel { grid-template-columns: 1fr; }
  .diseno-email { grid-template-columns: 1fr; }
  .diseno-vista { position: static; }
  .grilla-panel > div { position: static; }
  .estado-sync { display: none; }
}
@media (max-width: 900px) {
  body.con-menu { display: block; padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
  .lateral { display: none; }
  .principal { padding: 12px 16px 30px; }
  .barra-sup { gap: 10px; margin-bottom: 18px; min-height: 0; }
  .marca-movil { display: block; }
  .marca-movil .marca-logo { width: 44px; height: 44px; }
  .buscador { max-width: none; }
  .buscador input { padding: 12px 14px 12px 42px; font-size: 16px; }
  .buscador .icono { left: 14px; }
  .perfil { padding: 4px; margin-left: 0; }
  .perfil .avatar { width: 36px; height: 36px; }
  .perfil-texto { display: none; }
  .tabbar {
    display: flex; position: fixed; left: 12px; right: 12px; bottom: calc(10px + env(safe-area-inset-bottom)); z-index: 20;
    background: var(--blanco); border-radius: 22px; padding: 6px; gap: 4px;
    box-shadow: 0 10px 40px rgba(60, 50, 140, .18);
  }
  .tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 7px 4px; border-radius: 16px; color: var(--gris); font-size: 11px; font-weight: 600; }
  .tabbar a.activo { background: var(--grad); color: #fff; box-shadow: var(--sombra-color); }
  .tabbar .icono { width: 21px; height: 21px; }
  h1 { font-size: 23px; }
  .tarjeta { padding: 18px; }
  .tabla-envoltorio { padding: 4px 6px; }
  .tarjetas, .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .kpi { padding: 16px; }
  .kpi-n { font-size: 19px; }
  .kpi-t { font-size: 12px; }
  .ficha-quien h1 { font-size: 20px; }
  .ficha-cab .avatar-grande { width: 52px; height: 52px; font-size: 18px; }
  .kpi-ico { width: 38px; height: 38px; border-radius: 12px; margin-bottom: 10px; }
  .kpi.con-anillo .anillo { width: 52px; height: 52px; }
  .ocultar-movil { display: none; }
  .celda-cliente { min-width: 0; }
  .celda-cliente .avatar { display: none; }
  .celda-cliente strong { max-width: 50vw; }
  .tabla th, .tabla td { padding: 10px 8px; }
  .solo-movil { display: block; }
  input, select, textarea { font-size: 16px; }
}
@media (max-width: 600px) {
  .pendiente { flex-wrap: wrap; gap: 10px; }
  .pendiente-quien { flex-basis: 100%; }
  .pendiente-valor { text-align: left; margin-left: 50px; }
  .pendiente-acciones { margin-left: auto; }
  .linea { grid-auto-flow: row; grid-template-columns: 1fr 1fr; }
  .tramo summary { display: grid; grid-template-columns: 30px minmax(0, 1fr) 30px; gap: 6px 10px; padding: 12px 14px 12px 16px; }
  .tramo-n { grid-column: 1; grid-row: 1; }
  .tramo-titulo { grid-column: 2; grid-row: 1; }
  .tramo-flecha { grid-column: 3; grid-row: 1; }
  .tramo summary .tag { grid-column: 2; grid-row: 2; justify-self: start; }
  .tramo-cuerpo { padding: 14px 14px 4px 16px; }
  .diseno-vista { padding: 10px; margin: 0 -8px; }
  .vista-email { height: 560px; }
  .productos li { grid-template-columns: 1fr auto; }
  .productos .barra-fondo { grid-column: 1 / -1; grid-row: 2; }
  .filtros select { width: 100%; min-width: 0; }
  .filtros .campo { flex: 1 1 140px; }
  .filtros .btn { flex: 1 1 100%; }
  .subnav { display: flex; overflow-x: auto; flex-wrap: nowrap; border-radius: 18px; }
  .encabezado { align-items: flex-start; }
  .kpi.con-anillo { flex-direction: column; align-items: flex-start; }
  .kpi.con-anillo .anillo { order: -1; }
}
@media (max-width: 330px) {
  .tarjetas, .kpis { grid-template-columns: 1fr; }
}
@media print {
  .lateral, .barra-sup, .tabbar, .botones { display: none !important; }
  body { background: #fff; }
  .tarjeta, .kpi { box-shadow: none; border: 1px solid #ddd; }
}
