/* [Pulso-Supabase] 👥 Clientes (public/clientes.js, 13-nov). Usa la ventana de cobros-meta.css (.cm-adm, .cm-top, .cm-k…) y las variables de
   estilos.css: claro y oscuro cambian solos. Celular primero: tarjetas; desde 760 px, tabla. */
.cl-adm { --cl-a: var(--marca-a, #f43f5e); --cl-b: var(--marca-b, #a855f7); }
.cl-body { position: relative; }

/* 🔢 totales: se tocan para filtrar */
.cl-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cl-k { font: inherit; color: inherit; text-align: left; cursor: pointer; transition: border-color var(--dur-1, .15s), box-shadow var(--dur-1, .15s), transform var(--dur-1, .15s); }
.cl-k:hover { border-color: var(--accent); }
.cl-k:active { transform: scale(.985); }
.cl-k:focus-visible { outline: none; box-shadow: var(--foco); }
.cl-k.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; background: var(--accent-bg); }
.cl-k i { font-style: normal; }
.cl-k small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* 🔍 búsqueda, grupos y filtros */
.cl-barra { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; margin: 4px auto 10px; }
.cl-busca { flex: 1 1 260px; display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--border-2); border-radius: 999px; padding: 0 14px; min-height: var(--h-toque, 44px); }
.cl-busca:focus-within { border-color: var(--accent); box-shadow: var(--foco); }
.cl-busca input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--t1); font: inherit; font-size: var(--f-in, 16px); padding: 10px 0; }
.cl-busca input::placeholder { color: var(--t3); }
.cl-btn-f { min-height: var(--h-toque, 44px); }
.cl-btn-f.on { border-color: var(--accent); color: var(--accent); }
.cl-btn-f em { font-style: normal; background: var(--accent); color: #fff; border-radius: 999px; padding: 0 7px; margin-left: 4px; font-size: 12px; }
.cl-sel { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cl-sel > span { font-size: var(--f-xs, 12px); color: var(--t2); font-weight: 600; }
.cl-sel select, .cl-sel input { min-height: 40px; }
.cl-orden { flex: 0 1 200px; }
.cl-segs { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 2px 1px 8px; margin-bottom: 4px; }
.cl-segs::-webkit-scrollbar { display: none; }
.cl-seg { flex: 0 0 auto; border: 1px solid var(--border); background: var(--surface); color: var(--t1); border-radius: 999px; padding: 7px 13px; font: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.cl-seg:hover { border-color: var(--accent); }
.cl-seg.on { background: var(--accent-fuerte, #7c3aed); border-color: transparent; color: #fff; }
.cl-filtros { display: none; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; align-items: end; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-xl, 18px); padding: 12px 14px; margin-bottom: 12px; }
.cl-filtros.abierto { display: grid; animation: clBaja .2s ease-out; }
.cl-tog { display: flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 12px; border: 1px solid var(--border); border-radius: 999px; cursor: pointer; font-size: 13.5px; font-weight: 600; background: var(--bg); }
.cl-tog input { width: 18px; height: 18px; accent-color: var(--accent); margin: 0; }
.cl-tog:has(input:checked) { border-color: var(--accent); background: var(--accent-bg); }
.cl-limpiar { border: 0; background: none; color: var(--accent); font: inherit; font-weight: 700; cursor: pointer; min-height: 40px; justify-self: start; }

/* 📋 la lista */
.cl-res { transition: opacity var(--dur-2, .25s); }
.cl-res.cl-cargando { opacity: .5; pointer-events: none; }
.cl-cuenta { font-size: 13px; color: var(--t2); margin: 4px 2px 8px; }
.cl-cab { display: none; }
.cl-lista { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.cl-fila { width: 100%; display: grid; grid-template-columns: 42px minmax(0, 1fr) auto; grid-template-areas: 'av nom num' 'av ciu gas' 'av ori ori' 'av ult tags';
  gap: 2px 10px; align-items: center; text-align: left; font: inherit; color: var(--t1); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-xl, 18px); padding: 12px 14px; cursor: pointer;
  transition: border-color var(--dur-1, .15s), box-shadow var(--dur-1, .15s), transform var(--dur-1, .15s); }
.cl-fila:hover { border-color: var(--accent); box-shadow: 0 8px 22px -16px var(--accent); }
.cl-fila:active { transform: scale(.995); }
.cl-fila:focus-visible { outline: none; box-shadow: var(--foco); }
.cl-av { grid-area: av; align-self: start; width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 15px; color: #fff; letter-spacing: .02em;
  background: linear-gradient(135deg, hsl(var(--h, 280) 72% 58%), hsl(calc(var(--h, 280) + 40) 70% 48%)); box-shadow: 0 6px 14px -8px hsl(var(--h, 280) 70% 40%); }
.cl-c-nom { grid-area: nom; display: flex; flex-direction: column; min-width: 0; }
.cl-c-nom b { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cl-c-nom small, .cl-c-num small, .cl-c-ult small { color: var(--t2); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cl-c-ciu { grid-area: ciu; color: var(--t2); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cl-c-ori { grid-area: ori; display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.cl-c-num { display: flex; flex-direction: column; align-items: flex-end; font-variant-numeric: tabular-nums; }
.cl-c-com { grid-area: num; }
.cl-c-gas { grid-area: gas; }
.cl-c-num b { font-size: 15px; }
.cl-c-ult { grid-area: ult; display: flex; flex-direction: column; min-width: 0; margin-top: 4px; }
.cl-c-ult b { font-size: 13px; font-weight: 600; }
.cl-c-tags { grid-area: tags; display: flex; flex-wrap: wrap; gap: 4px; justify-content: flex-end; align-self: end; }
.cl-tag, .cl-ori { display: inline-flex; align-items: center; gap: 3px; font-size: 11.5px; font-weight: 700; border-radius: 999px; padding: 2px 9px; white-space: nowrap; border: 1px solid var(--border); background: var(--bg); color: var(--t2); }
.cl-ori-p { background: var(--accent-bg); border-color: transparent; color: var(--accent); }
.cl-tag-vip { background: var(--amber-bg); border-color: var(--amber-bd); color: var(--amber-t, var(--amber)); }
.cl-tag-dor { background: var(--accent-bg); border-color: transparent; color: var(--accent); }
.cl-tag-dev { background: var(--red-bg); border-color: var(--red-bd); color: var(--red); }
.cl-tag-bloq { background: var(--red); border-color: transparent; color: #fff; }
.cl-pag { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 16px 0 4px; font-size: 13.5px; color: var(--t2); }
.cl-pag .cm-pill[disabled] { opacity: .45; cursor: default; }

/* ⬇️ menú de descarga */
.cl-menu-w { position: relative; }
.cl-menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 8; width: min(300px, 86vw); background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow); padding: 6px; display: flex; flex-direction: column; animation: clBaja .16s ease-out; }
.cl-menu[hidden] { display: none; }
.cl-menu button { display: flex; flex-direction: column; gap: 2px; text-align: left; border: 0; background: none; color: var(--t1); font: inherit; padding: 10px 12px; border-radius: 12px; cursor: pointer; }
.cl-menu button:hover, .cl-menu button:focus-visible { background: var(--accent-bg); outline: none; }
.cl-menu small { color: var(--t2); font-size: 12.5px; }

/* 🧾 ficha del cliente: al lado en escritorio, hoja de abajo en el celular */
.cl-velo { position: absolute; inset: 0; z-index: 9; background: rgba(15, 18, 32, .38); opacity: 0; transition: opacity .25s; }
.cl-velo.on { opacity: 1; }
.cl-velo[hidden], .cl-ficha[hidden] { display: none; }
.cl-ficha { position: absolute; z-index: 10; left: 0; right: 0; bottom: 0; max-height: 90%; overflow: auto; background: var(--bg); border-radius: 22px 22px 0 0; box-shadow: 0 -18px 50px -20px rgba(0,0,0,.45);
  padding: 8px 16px 28px; transform: translateY(100%); transition: transform .26s cubic-bezier(.2, .9, .3, 1); overscroll-behavior: contain; }
.cl-ficha.on { transform: none; }
.cl-f-top { position: sticky; top: 0; display: flex; justify-content: flex-end; padding: 4px 0; background: var(--bg); z-index: 1; }
.cl-f-top::before { content: ''; position: absolute; left: 50%; top: 6px; width: 40px; height: 4px; border-radius: 4px; background: var(--border-2); transform: translateX(-50%); }
.cl-f-cab { display: flex; gap: 14px; align-items: center; margin: 2px 0 12px; }
.cl-f-cab h3 { margin: 0; font-size: 19px; line-height: 1.2; overflow-wrap: anywhere; }
.cl-av-g { width: 60px; height: 60px; font-size: 21px; flex: 0 0 auto; }
.cl-f-sub { color: var(--t2); font-size: 13.5px; margin-top: 2px; overflow-wrap: anywhere; }
.cl-f-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.cl-f-acc { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.cl-f-acc .cm-pill { text-decoration: none; display: inline-flex; align-items: center; min-height: 40px; }
.cl-wa { background: var(--wa-fuerte, #0f7a5c); border-color: transparent; color: #fff; }
.cl-f-kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-bottom: 10px; }
.cl-f-kpis > div { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r, 14px); padding: 10px 12px; display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.cl-f-kpis i { font-style: normal; font-size: 16px; }
.cl-f-kpis b { font-size: 17px; font-variant-numeric: tabular-nums; }
.cl-f-kpis small { color: var(--t2); font-size: 12px; }
.cl-f-lin { margin: 6px 0; font-size: 13.5px; color: var(--t1); }
.cl-f-h { margin: 16px 0 8px; font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--t2); }
.cl-f-oris { display: flex; flex-direction: column; gap: 8px; }
.cl-f-ori { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r, 14px); padding: 10px 12px; display: flex; flex-direction: column; gap: 3px; }
.cl-f-ori small { color: var(--t2); font-size: 12.5px; overflow-wrap: anywhere; }
.cl-f-ped { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.cl-f-ped li { display: flex; flex-wrap: wrap; gap: 6px; align-items: flex-start; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r, 14px); padding: 9px 12px; }
.cl-f-ped li > div { flex: 1 1 100%; display: flex; flex-direction: column; min-width: 0; }
.cl-f-ped b { font-size: 13.5px; overflow-wrap: anywhere; }
.cl-f-ped small { color: var(--t2); font-size: 12px; overflow-wrap: anywhere; }
.cl-est { font-size: 11.5px; font-weight: 700; border-radius: 999px; padding: 2px 9px; background: var(--bg); border: 1px solid var(--border); color: var(--t2); }
.cl-est-ok { background: var(--green-bg); border-color: var(--green-bd); color: var(--green-t, var(--green)); }
.cl-est-mal { background: var(--red-bg); border-color: var(--red-bd); color: var(--red); }
.cl-est-pen { background: var(--amber-bg); border-color: var(--amber-bd); color: var(--amber-t, var(--amber)); }

/* 📥 importar */
.cl-imp { position: absolute; inset: 0; z-index: 12; display: flex; align-items: flex-end; justify-content: center; background: rgba(15, 18, 32, .42); animation: clVelo .2s ease-out; }
.cl-imp-c { width: 100%; max-width: 560px; max-height: 92%; overflow: auto; background: var(--bg); border-radius: 22px 22px 0 0; padding: 14px 16px 24px; box-shadow: var(--shadow); animation: clSube .26s cubic-bezier(.2, .9, .3, 1); }
.cl-imp-h { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; font-size: 17px; }
.cl-pasos { margin: 0 0 14px; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; font-size: 13.5px; color: var(--t2); line-height: 1.4; }
.cl-pasos b { color: var(--t1); }
.cl-soltar { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 22px 14px; border: 2px dashed var(--border-2); border-radius: var(--r-xl, 18px); background: var(--surface); color: var(--t1); font: inherit; font-size: 15px; cursor: pointer; transition: border-color .15s, background .15s; }
.cl-soltar small { color: var(--t2); font-size: 12.5px; }
.cl-soltar:hover, .cl-soltar.sobre { border-color: var(--accent); background: var(--accent-bg); }
.cl-imp-nom { margin: 14px 0 10px; }
.cl-imp-nom input { font-size: var(--f-in, 16px); }
.cl-imp-k { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 6px 0 8px; }
.cl-imp-k > div { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r, 14px); padding: 10px; display: flex; flex-direction: column; min-width: 0; }
.cl-imp-k b { font-size: 18px; font-variant-numeric: tabular-nums; }
.cl-imp-k small { color: var(--t2); font-size: 12px; line-height: 1.25; }
.cl-imp-nota { font-size: 12.5px; margin: 4px 0; }
.cl-imp-bts { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; margin-top: 12px; }
.cl-prim { background: var(--marca-fuerte, linear-gradient(135deg, #e11d48, #9333ea)); border-color: transparent; color: #fff; padding: 10px 16px; }
.cl-prim:hover { border-color: transparent; filter: brightness(1.06); }
.cl-barra-p { height: 10px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); overflow: hidden; margin-top: 10px; }
.cl-barra-p span { display: block; height: 100%; background: var(--marca, linear-gradient(135deg, #f43f5e, #a855f7)); transition: width .3s; }
.cl-imp-oris { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.cl-imp-oris li { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r, 14px); padding: 9px 12px; }
.cl-imp-oris li > div { display: flex; flex-direction: column; min-width: 0; }
.cl-imp-oris small { color: var(--t2); font-size: 12px; }
.cl-quitar:hover { border-color: var(--red); color: var(--red); }
.cl-imp-ok { text-align: center; padding: 10px 0 4px; }
.cl-imp-ok h3 { margin: 8px 0 4px; }
.cl-imp-ok .cl-imp-bts { justify-content: center; }
.cl-ok-ico svg { width: 64px; height: 64px; }
.cl-ok-ico circle { fill: var(--green, #16a34a); transform-origin: center; animation: clPop .45s cubic-bezier(.2, 1.6, .4, 1); }
.cl-ok-ico path { fill: none; stroke: #fff; stroke-width: 5; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 40; stroke-dashoffset: 40; animation: clTraza .4s .3s ease-out forwards; }

/* ❔ guía */
.cl-guia { position: absolute; inset: 0; z-index: 14; display: flex; align-items: flex-end; justify-content: center; padding: 16px; background: rgba(15, 18, 32, .35); }
.cl-guia > div { max-width: 440px; width: 100%; padding: 18px; border-radius: 20px; background: var(--surface); box-shadow: var(--shadow); animation: clSube .3s ease-out; }
.cl-guia small { color: var(--t2); }
.cl-guia h3 { margin: 4px 0 6px; }
.cl-guia p { margin: 0; line-height: 1.45; color: var(--t1); }

@keyframes clBaja { from { opacity: 0; transform: translateY(-6px); } }
@keyframes clSube { from { opacity: .4; transform: translateY(40px); } }
@keyframes clVelo { from { opacity: 0; } }
@keyframes clPop { from { transform: scale(0); } }
@keyframes clTraza { to { stroke-dashoffset: 0; } }

/* 🖥️ escritorio: tabla cómoda y la ficha a la derecha */
@media (min-width: 760px) {
  .cl-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .cl-btn-f { display: none; }
  .cl-filtros { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)) auto auto auto; animation: none; }
  .cl-cab, .cl-fila { grid-template-columns: 42px minmax(170px, 2fr) minmax(90px, 1fr) minmax(120px, 1.3fr) 82px 112px minmax(120px, 1.3fr) minmax(90px, 1fr); grid-template-areas: none; }
  .cl-cab { display: grid; gap: 10px; padding: 0 15px 6px; font-size: 12px; font-weight: 700; color: var(--t2); text-transform: uppercase; letter-spacing: .04em; }
  .cl-cab span:nth-child(5), .cl-cab span:nth-child(6) { text-align: right; }
  .cl-lista { gap: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-xl, 18px); overflow: hidden; }
  .cl-fila { grid-area: auto; border: 0; border-radius: 0; border-top: 1px solid var(--border); padding: 10px 14px; gap: 10px; }
  .cl-lista li:first-child .cl-fila { border-top: 0; }
  .cl-fila:hover { background: var(--surface-2); box-shadow: none; }
  .cl-fila > * { grid-area: auto !important; margin-top: 0 !important; }
  .cl-av { align-self: center; }
  .cl-c-tags { justify-content: flex-start; align-self: center; }
  .cl-ficha { left: auto; top: 0; right: 0; bottom: 0; width: min(460px, 92vw); max-height: none; border-radius: 22px 0 0 22px; transform: translateX(100%); box-shadow: -18px 0 50px -20px rgba(0,0,0,.45); padding-top: 12px; }
  .cl-f-top::before { display: none; }
  .cl-f-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .cl-imp { align-items: center; padding: 20px; }
  .cl-imp-c { border-radius: 22px; }
  .cl-guia { align-items: center; }
}
@media (min-width: 1100px) { .cl-kpis { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
@media (prefers-reduced-motion: reduce) {
  .cl-ficha, .cl-velo, .cl-k, .cl-fila, .cl-barra-p span { transition: none; }
  .cl-filtros.abierto, .cl-menu, .cl-imp, .cl-imp-c, .cl-guia > div, .cl-ok-ico circle { animation: none; }
  .cl-ok-ico path { animation: none; stroke-dashoffset: 0; }
}

/* el ícono de línea del botón (public/cabecera.js: data-ico="clientes"): dos personas, como los demás módulos */
html.cf-hx-listo #cf-app .cf-header-actions [data-ico="clientes"]::before, .cf-mmenu-ico[data-ico="clientes"]::before { -webkit-mask-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22black%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22M16%2021v-2a4%204%200%200%200-4-4H6a4%204%200%200%200-4%204v2%22/%3E%3Ccircle%20cx%3D%229%22%20cy%3D%227%22%20r%3D%224%22/%3E%3Cpath%20d%3D%22M22%2021v-2a4%204%200%200%200-3-3.87%22/%3E%3Cpath%20d%3D%22M16%203.13a4%204%200%200%201%200%207.75%22/%3E%3C/svg%3E"); mask-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22black%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22M16%2021v-2a4%204%200%200%200-4-4H6a4%204%200%200%200-4%204v2%22/%3E%3Ccircle%20cx%3D%229%22%20cy%3D%227%22%20r%3D%224%22/%3E%3Cpath%20d%3D%22M22%2021v-2a4%204%200%200%200-3-3.87%22/%3E%3Cpath%20d%3D%22M16%203.13a4%204%200%200%201%200%207.75%22/%3E%3C/svg%3E"); }
