/* Telenueva · panel de clientes y cobranzas (demo). Claro, tarjetas blancas, tinta azul y verde agua; semáforo apagado. */
:root {
  --fondo: #f1f3f6;
  --card: #ffffff;
  --tinta: #0f1b2d;
  --tinta-2: #3a4658;
  --gris: #7a8494;
  --gris-cl: #b9c0cb;
  --linea: #e6e9ee;
  --linea-2: #f2f4f7;
  --agua: #0e8f87;
  --agua-cl: #53d1c1;
  --agua-bg: #e3f4f2;
  --azul: #2a5bd7;
  /* Semáforo */
  --ok: #2f7d4a; --ok-bg: #e5f2e9;
  --pv: #2a6fb8; --pv-bg: #e6eef9;
  --ojo: #a86d00; --ojo-bg: #fbf0d9;
  --alto: #a8493a; --alto-bg: #f7e6e1;
  --r: 20px;
  color-scheme: light;
}
[hidden] { display: none !important; }
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body { background: var(--fondo); color: var(--tinta); font-family: 'Inter', system-ui, sans-serif; font-size: 14px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
button, input { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.num { font-variant-numeric: tabular-nums; }

.marco { display: grid; grid-template-columns: 232px minmax(0, 1fr); height: 100vh; height: 100dvh; max-width: 1640px; margin: 0 auto; }

/* ===== Lateral ===== */
.lado { display: flex; flex-direction: column; padding: 22px 16px 18px; gap: 24px; min-height: 0; }
.lado-marca { display: flex; align-items: center; gap: 11px; padding: 4px 8px; }
.isot { width: 38px; height: 38px; border-radius: 12px; background: var(--tinta); display: grid; place-items: center; flex: none; }
.isot svg { width: 26px; height: 26px; fill: none; stroke: var(--agua-cl); stroke-width: 3.4; stroke-linecap: round; }
.lado-marca b { display: block; font-size: 18px; font-weight: 700; letter-spacing: -.03em; line-height: 1.1; }
.lado-marca span { display: block; font-size: 11px; color: var(--gris); margin-top: 1px; }
.menu { display: flex; flex-direction: column; gap: 4px; }
.menu button { display: flex; align-items: center; gap: 12px; height: 46px; padding: 0 14px; border-radius: 14px; font-size: 13.5px; font-weight: 500; color: var(--tinta-2); transition: background .2s, color .2s; text-align: left; position: relative; }
.menu button:hover { background: rgba(255, 255, 255, .75); }
.menu button.activo { background: var(--tinta); color: #fff; font-weight: 600; box-shadow: 0 10px 22px -12px rgba(15, 27, 45, .6); }
.menu svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.menu .badge { margin-left: auto; font-size: 11px; font-weight: 600; background: var(--agua-bg); color: var(--agua); border-radius: 999px; padding: 1px 8px; }
.menu button.activo .badge { background: rgba(255, 255, 255, .16); color: #fff; }
.lado-pie { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.muestra { background: var(--card); border-radius: 16px; padding: 12px 14px; font-size: 11.5px; color: var(--gris); line-height: 1.4; }
.muestra b { display: block; color: var(--agua); font-size: 10px; letter-spacing: .14em; text-transform: uppercase; margin-bottom: 4px; }
.restaurar { height: 38px; border-radius: 12px; border: 1px dashed var(--gris-cl); color: var(--tinta-2); font-size: 12px; font-weight: 600; }

/* ===== Principal ===== */
.principal { display: flex; flex-direction: column; min-height: 0; min-width: 0; padding: 18px 22px 18px 4px; gap: 14px; }
.cab { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; padding: 4px 4px 0; flex: none; }
.cab h1 { font-size: 25px; font-weight: 650; letter-spacing: -.025em; line-height: 1.1; }
.cab-sub { font-size: 12.5px; color: var(--gris); margin-top: 3px; }
.cab-der { display: flex; align-items: center; gap: 10px; }
.sec { flex: 1; min-height: 0; display: grid; gap: 14px; animation: sec .45s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes sec { from { opacity: 0; transform: translateY(10px); } }

.card { background: var(--card); border-radius: var(--r); padding: 16px 18px; min-height: 0; min-width: 0; display: flex; flex-direction: column; box-shadow: 0 1px 2px rgba(15, 27, 45, .04); }
.card-cab { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; flex: none; flex-wrap: wrap; }
.card-cab h2 { font-size: 14px; font-weight: 600; }
.card-sub { font-size: 11.5px; color: var(--gris); }
.graf { flex: 1; min-height: 0; position: relative; }
.graf svg { display: block; width: 100%; height: 100%; overflow: visible; }
.leyenda { display: flex; gap: 14px; flex-wrap: wrap; font-size: 11.5px; color: var(--tinta-2); }
.leyenda span { display: inline-flex; align-items: center; gap: 6px; }
.leyenda i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.eje { font-size: 10.5px; fill: var(--gris); font-family: 'Inter', sans-serif; }
.eje-linea { stroke: var(--linea); stroke-width: 1; }
.rot { font-size: 11px; fill: var(--tinta-2); font-weight: 600; font-family: 'Inter', sans-serif; }
.rot-chico { font-size: 10px; fill: var(--gris); font-family: 'Inter', sans-serif; }
.marca-barra { transition: opacity .15s; }
.graf:hover .marca-barra { opacity: .55; }
.graf .marca-barra:hover { opacity: 1; }

.tip { position: fixed; z-index: 60; pointer-events: none; background: var(--tinta); color: #fff; font-size: 12px; padding: 8px 10px; border-radius: 10px; line-height: 1.35; max-width: 240px; box-shadow: 0 10px 24px -10px rgba(0, 0, 0, .5); }
.tip b { display: block; font-weight: 600; }
.aviso { position: fixed; z-index: 70; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--tinta); color: #fff; padding: 11px 18px; border-radius: 999px; font-size: 13px; font-weight: 500; box-shadow: 0 14px 30px -12px rgba(0, 0, 0, .5); animation: aviso .3s ease both; white-space: nowrap; }
@keyframes aviso { from { opacity: 0; transform: translate(-50%, 10px); } }

/* Pastilla de semáforo */
.sem { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 600; padding: 3px 9px 3px 7px; border-radius: 999px; white-space: nowrap; }
.sem::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.sem.aldia { color: var(--ok); background: var(--ok-bg); }
.sem.porvencer { color: var(--pv); background: var(--pv-bg); }
.sem.vencido { color: var(--ojo); background: var(--ojo-bg); }
.sem.mora { color: var(--alto); background: var(--alto-bg); }
.punto { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: none; }

.btn { height: 34px; padding: 0 13px; border-radius: 11px; font-size: 12.5px; font-weight: 600; display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; transition: transform .12s, background .2s; }
.btn:active { transform: scale(.97); }
.btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.btn.prim { background: var(--tinta); color: #fff; }
.btn.wa { background: var(--agua-bg); color: var(--agua); }
.btn.sec2 { background: var(--linea-2); color: var(--tinta-2); }
.btn.chico { height: 30px; padding: 0 10px; font-size: 12px; border-radius: 10px; }
.btn-ic { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: var(--linea-2); color: var(--tinta-2); flex: none; }
.btn-ic.wa { background: var(--agua-bg); color: var(--agua); }
.btn-ic svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

/* ===== Hoy ===== */
#s-hoy { grid-template-rows: auto minmax(0, 1.05fr) minmax(0, 1fr); }
.kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; }
.kpi { background: var(--card); border-radius: var(--r); padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.kpi small { font-size: 11.5px; color: var(--gris); font-weight: 500; }
.kpi b { font-size: 22px; font-weight: 650; letter-spacing: -.025em; line-height: 1.15; white-space: nowrap; }
.kpi span { font-size: 11.5px; color: var(--tinta-2); display: flex; align-items: center; gap: 6px; }
.kpi .barrita { height: 5px; border-radius: 9px; background: var(--linea-2); overflow: hidden; margin-top: 4px; }
.kpi .barrita i { display: block; height: 100%; background: var(--agua); border-radius: 9px; }
.kpi.oscuro { background: var(--tinta); color: #fff; }
.kpi.oscuro small, .kpi.oscuro span { color: rgba(255, 255, 255, .72); }
.kpi.oscuro .barrita { background: rgba(255, 255, 255, .14); }
.kpi.oscuro .barrita i { background: var(--agua-cl); }
.fila-a { display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(0, 1fr); gap: 14px; min-height: 0; }
.fila-b { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) minmax(0, 1fr); gap: 14px; min-height: 0; }

.semaforo { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); align-items: center; gap: 12px; }
.semaforo svg { width: 100%; max-height: 100%; display: block; }
.sem-lista { display: flex; flex-direction: column; gap: 4px; }
.sem-lista button { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 9px; padding: 7px 9px; border-radius: 11px; text-align: left; transition: background .2s; }
.sem-lista button:hover { background: var(--linea-2); }
.sem-lista b { font-size: 12.5px; font-weight: 600; }
.sem-lista small { display: block; font-size: 11px; color: var(--gris); }
.sem-lista em { font-style: normal; font-size: 13px; font-weight: 650; }

.llamar { flex: 1; min-height: 0; overflow: auto; display: flex; flex-direction: column; margin: 0 -6px; padding: 0 6px; scrollbar-width: thin; }
.fila-cli { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--linea-2); }
.fila-cli:last-child { border-bottom: 0; }
.fila-cli .nom { min-width: 0; cursor: pointer; }
.fila-cli .nom b { font-size: 13px; font-weight: 600; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fila-cli .nom small { font-size: 11.5px; color: var(--gris); display: flex; gap: 8px; align-items: center; white-space: nowrap; }
.fila-cli .monto { font-size: 13px; font-weight: 650; text-align: right; }
.fila-cli .monto small { display: block; font-size: 11px; color: var(--gris); font-weight: 500; }
.fila-cli .acc { display: flex; gap: 6px; }

/* ===== Clientes ===== */
#s-clientes { grid-template-rows: minmax(0, 1fr); }
.tabla-card { padding: 14px 16px 12px; }
.tabla-top { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; flex: none; }
.buscador { flex: 1; min-width: 220px; max-width: 360px; display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px; border-radius: 12px; background: var(--linea-2); }
.buscador svg { width: 17px; height: 17px; fill: none; stroke: var(--gris); stroke-width: 1.7; stroke-linecap: round; flex: none; }
.buscador input { flex: 1; min-width: 0; border: 0; background: none; outline: none; font-size: 13.5px; }
.filtros { display: flex; gap: 6px; flex-wrap: wrap; }
.filtros button { height: 32px; padding: 0 12px; border-radius: 999px; font-size: 12px; font-weight: 600; color: var(--tinta-2); background: var(--linea-2); display: inline-flex; align-items: center; gap: 7px; transition: all .2s; }
.filtros button.activo { background: var(--tinta); color: #fff; }
.filtros button em { font-style: normal; font-weight: 500; opacity: .7; }
.tabla { flex: 1; min-height: 0; overflow: auto; scrollbar-width: thin; }
.tabla table { width: 100%; border-collapse: collapse; font-size: 13px; }
.tabla th { position: sticky; top: 0; background: var(--card); text-align: left; font-size: 11px; font-weight: 600; color: var(--gris); text-transform: uppercase; letter-spacing: .06em; padding: 8px 10px; border-bottom: 1px solid var(--linea); z-index: 1; white-space: nowrap; }
.tabla td { padding: 9px 10px; border-bottom: 1px solid var(--linea-2); white-space: nowrap; }
.tabla tbody tr { cursor: pointer; transition: background .15s; }
.tabla tbody tr:hover { background: #f8f9fb; }
.tabla td.der, .tabla th.der { text-align: right; }
.tabla .hist { display: inline-flex; gap: 3px; vertical-align: middle; }
.tabla .hist i, .ficha .hist i { width: 8px; height: 16px; border-radius: 3px; display: inline-block; }
.h-ok { background: var(--agua-cl); }
.h-tarde { background: #f2cf7d; }
.h-impago { background: #e2a99d; }
.vacio { padding: 40px 10px; text-align: center; color: var(--gris); font-size: 13px; }
.pagina { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-top: 10px; flex: none; font-size: 12px; color: var(--gris); }
.pagina .pags { display: flex; gap: 4px; }
.pagina button { min-width: 32px; height: 32px; border-radius: 10px; background: var(--linea-2); font-size: 12px; font-weight: 600; color: var(--tinta-2); padding: 0 8px; }
.pagina button.activo { background: var(--tinta); color: #fff; }
.pagina button:disabled { opacity: .4; cursor: default; }

/* ===== Cobranzas (kanban) ===== */
#s-cobranzas { grid-template-rows: minmax(0, 1fr); }
.kanban { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; min-height: 0; }
.col { background: rgba(255, 255, 255, .55); border-radius: var(--r); padding: 12px; display: flex; flex-direction: column; min-height: 0; border: 1px solid var(--linea); transition: background .2s, border-color .2s; }
.col.sobre { background: var(--agua-bg); border-color: var(--agua-cl); }
.col-cab { padding: 2px 4px 10px; flex: none; }
.col-cab div { display: flex; align-items: center; gap: 8px; }
.col-cab b { font-size: 13.5px; font-weight: 600; }
.col-cab .cuenta { font-size: 11.5px; font-weight: 600; color: var(--gris); background: var(--card); border-radius: 999px; padding: 1px 8px; }
.col-cab strong { display: block; font-size: 19px; font-weight: 650; letter-spacing: -.02em; margin-top: 4px; }
.col-cab .barrita { height: 4px; border-radius: 9px; background: var(--linea); margin-top: 8px; overflow: hidden; }
.col-cab .barrita i { display: block; height: 100%; border-radius: 9px; }
.col-lista { flex: 1; min-height: 0; overflow: auto; display: flex; flex-direction: column; gap: 8px; scrollbar-width: thin; padding: 2px; }
.tarj { background: var(--card); border-radius: 14px; padding: 11px 12px; box-shadow: 0 1px 2px rgba(15, 27, 45, .05); cursor: grab; display: flex; flex-direction: column; gap: 8px; flex: none; animation: sec .35s ease both; }
.tarj.arrastrando { opacity: .4; }
.tarj-top { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.tarj-top b { font-size: 13px; font-weight: 600; }
.tarj-top small { display: block; font-size: 11px; color: var(--gris); }
.tarj-top .m { font-size: 13px; font-weight: 650; text-align: right; white-space: nowrap; }
.tarj-pie { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.tarj-pie .acc { display: flex; gap: 5px; }
.dias { font-size: 11px; font-weight: 600; color: var(--gris); display: inline-flex; align-items: center; gap: 5px; }
.mas { text-align: center; font-size: 12px; color: var(--gris); padding: 8px; }

/* ===== WhatsApp ===== */
#s-whatsapp { grid-template-columns: minmax(0, 300px) minmax(0, 1fr) minmax(0, 320px); grid-template-rows: minmax(0, 1fr); }
.wa-lista-card { padding: 14px 10px 10px; }
.wa-lista-card .card-cab { padding: 0 8px; }
.wa-lista { flex: 1; min-height: 0; overflow: auto; scrollbar-width: thin; }
.wa-item { width: 100%; display: grid; grid-template-columns: 38px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 9px 8px; border-radius: 13px; text-align: left; transition: background .15s; }
.wa-item:hover { background: var(--linea-2); }
.wa-item.activo { background: var(--agua-bg); }
.avatar { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 650; color: var(--tinta-2); background: var(--linea-2); position: relative; flex: none; }
.avatar .punto { position: absolute; right: -1px; bottom: -1px; border: 2px solid #fff; width: 12px; height: 12px; }
.wa-item b { font-size: 13px; font-weight: 600; display: block; }
.wa-item small { font-size: 11.5px; color: var(--gris); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wa-item .hora { font-size: 10.5px; color: var(--gris); text-align: right; }
.wa-item .nuevo { display: block; margin: 3px 0 0 auto; width: 8px; height: 8px; border-radius: 50%; background: var(--agua); }
.wa-chat { padding: 0; overflow: hidden; }
.chat-cab { display: flex; align-items: center; gap: 11px; padding: 13px 16px; border-bottom: 1px solid var(--linea); flex: none; }
.chat-cab .t { flex: 1; min-width: 0; }
.chat-cab b { font-size: 14px; font-weight: 600; display: block; }
.chat-cab small { font-size: 11.5px; color: var(--gris); display: flex; gap: 8px; align-items: center; }
.chat-cuerpo { flex: 1; min-height: 0; overflow: auto; padding: 16px; display: flex; flex-direction: column; gap: 8px; background: #f6f7f4 radial-gradient(circle at 1px 1px, rgba(15, 27, 45, .05) 1px, transparent 0) 0 0 / 18px 18px; }
.globo { max-width: 76%; padding: 8px 11px 6px; border-radius: 14px; font-size: 13px; line-height: 1.4; box-shadow: 0 1px 1px rgba(15, 27, 45, .06); animation: globo .3s ease both; }
@keyframes globo { from { opacity: 0; transform: translateY(6px) scale(.98); } }
.globo.tn { align-self: flex-end; background: #dcf3ee; border-bottom-right-radius: 4px; }
.globo.cl { align-self: flex-start; background: #fff; border-bottom-left-radius: 4px; }
.globo small { display: flex; justify-content: flex-end; gap: 6px; font-size: 10px; color: var(--gris); margin-top: 3px; }
.globo .auto { color: var(--agua); font-weight: 600; }
.fecha-chat { align-self: center; font-size: 11px; color: var(--gris); background: #fff; border-radius: 999px; padding: 3px 10px; }
.escribiendo { align-self: flex-start; background: #fff; border-radius: 14px; padding: 10px 14px; display: flex; gap: 4px; }
.escribiendo i { width: 6px; height: 6px; border-radius: 50%; background: var(--gris-cl); animation: pun 1s infinite; }
.escribiendo i:nth-child(2) { animation-delay: .15s; } .escribiendo i:nth-child(3) { animation-delay: .3s; }
@keyframes pun { 50% { transform: translateY(-3px); background: var(--gris); } }
.chat-pie { border-top: 1px solid var(--linea); padding: 10px 12px 12px; flex: none; display: flex; flex-direction: column; gap: 8px; }
.plantillas { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.plantillas button { flex: none; height: 30px; padding: 0 11px; border-radius: 999px; border: 1px solid var(--linea); font-size: 12px; font-weight: 500; color: var(--tinta-2); background: #fff; }
.plantillas button:hover { border-color: var(--agua-cl); color: var(--agua); }
.escribir { display: flex; gap: 8px; }
.escribir input { flex: 1; min-width: 0; height: 40px; border-radius: 12px; border: 0; background: var(--linea-2); padding: 0 13px; outline: none; font-size: 13.5px; }
.escribir .btn { height: 40px; }
.wa-der { display: grid; grid-template-rows: auto minmax(0, 1fr); gap: 14px; min-height: 0; }
.embudo { display: flex; flex-direction: column; gap: 9px; }
.embudo div { display: grid; grid-template-columns: 82px minmax(0, 1fr) 46px; align-items: center; gap: 8px; font-size: 12px; }
.embudo span { color: var(--tinta-2); }
.embudo i { display: block; height: 22px; border-radius: 7px; background: var(--agua); transition: width .8s cubic-bezier(.2, .8, .2, 1); }
.embudo b { font-size: 12.5px; font-weight: 650; text-align: right; }
.secuencia { flex: 1; min-height: 0; overflow: auto; display: flex; flex-direction: column; scrollbar-width: thin; }
.paso { display: grid; grid-template-columns: 18px minmax(0, 1fr) auto; gap: 10px; padding: 0 0 12px; position: relative; }
.paso::before { content: ""; position: absolute; left: 8px; top: 16px; bottom: 0; width: 2px; background: var(--linea); }
.paso:last-child::before { display: none; }
.paso > i { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--agua); background: #fff; margin-top: 1px; position: relative; z-index: 1; }
.paso b { font-size: 12.5px; font-weight: 600; display: block; }
.paso small { font-size: 11.5px; color: var(--gris); display: block; line-height: 1.35; }
.paso em { font-style: normal; font-size: 11.5px; font-weight: 600; color: var(--agua); white-space: nowrap; }
.secuencia.apagada { opacity: .45; filter: grayscale(1); }
.interruptor { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 600; color: var(--agua); }
.interruptor i { width: 34px; height: 20px; border-radius: 99px; background: var(--agua); position: relative; transition: background .2s; }
.interruptor i::after { content: ""; position: absolute; top: 3px; left: 17px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: left .2s; }
.interruptor[aria-pressed="false"] { color: var(--gris); }
.interruptor[aria-pressed="false"] i { background: var(--gris-cl); }
.interruptor[aria-pressed="false"] i::after { left: 3px; }

/* ===== Ficha ===== */
.velo { position: fixed; inset: 0; background: rgba(15, 27, 45, .28); z-index: 40; animation: fade .25s ease both; }
@keyframes fade { from { opacity: 0; } }
.ficha { position: fixed; z-index: 50; top: 12px; right: 12px; bottom: 12px; width: min(420px, calc(100vw - 24px)); background: var(--card); border-radius: 24px; box-shadow: 0 30px 60px -20px rgba(15, 27, 45, .45); display: flex; flex-direction: column; overflow: hidden; animation: ficha .35s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes ficha { from { transform: translateX(30px); opacity: 0; } }
.ficha-cab { padding: 18px 20px 14px; display: flex; gap: 12px; align-items: flex-start; border-bottom: 1px solid var(--linea); }
.ficha-cab .avatar { width: 46px; height: 46px; font-size: 14px; }
.ficha-cab .t { flex: 1; min-width: 0; }
.ficha-cab h3 { font-size: 18px; font-weight: 650; letter-spacing: -.02em; }
.ficha-cab p { font-size: 12px; color: var(--gris); margin-top: 2px; }
.cerrar { width: 34px; height: 34px; border-radius: 11px; background: var(--linea-2); display: grid; place-items: center; flex: none; }
.cerrar svg { width: 16px; height: 16px; stroke: var(--tinta-2); stroke-width: 2; stroke-linecap: round; fill: none; }
.ficha-cuerpo { flex: 1; overflow: auto; padding: 16px 20px; display: flex; flex-direction: column; gap: 16px; }
.saldo-caja { border-radius: 18px; padding: 14px 16px; background: var(--linea-2); display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.saldo-caja small { font-size: 11.5px; color: var(--gris); display: block; }
.saldo-caja b { font-size: 26px; font-weight: 700; letter-spacing: -.03em; }
.datos-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; font-size: 12.5px; }
.datos-grid small { display: block; font-size: 11px; color: var(--gris); }
.datos-grid b { font-weight: 600; }
.ficha h4 { font-size: 12px; font-weight: 600; color: var(--gris); text-transform: uppercase; letter-spacing: .07em; margin-bottom: 8px; }
.ficha .hist { display: flex; gap: 6px; align-items: flex-end; }
.ficha .hist div { flex: 1; text-align: center; font-size: 10.5px; color: var(--gris); }
.ficha .hist i { width: 100%; height: 28px; border-radius: 7px; display: block; margin-bottom: 4px; }
.mov { display: flex; flex-direction: column; gap: 0; }
.mov div { display: flex; justify-content: space-between; gap: 10px; font-size: 12.5px; padding: 8px 0; border-bottom: 1px solid var(--linea-2); }
.mov div:last-child { border: 0; }
.mov small { color: var(--gris); }
.ficha-pie { padding: 12px 20px 18px; border-top: 1px solid var(--linea); display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ficha-pie .btn { justify-content: center; height: 42px; }
.ficha-pie .ancho { grid-column: 1 / -1; }
.promesa-dias { display: flex; gap: 6px; flex-wrap: wrap; }

/* ===== iPad y menos ===== */
@media (max-width: 1180px) {
  .marco { grid-template-columns: 76px minmax(0, 1fr); }
  .lado { padding: 18px 10px; align-items: center; }
  .lado-marca div:not(.isot), .menu span, .menu .badge, .muestra { display: none; }
  .menu button { width: 52px; justify-content: center; padding: 0; }
  .restaurar { font-size: 0; width: 52px; }
  .restaurar::before { content: "↺"; font-size: 16px; }
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .kpis .kpi:nth-child(n+4) { display: none; }
  #s-whatsapp { grid-template-columns: minmax(0, 260px) minmax(0, 1fr); }
  .wa-der { display: none; }
}
@media (max-width: 1180px) and (min-width: 761px) and (orientation: portrait) {
  .principal { overflow: auto; }
  .sec { flex: none; }
  #s-hoy { grid-template-rows: auto 330px auto; }
  .fila-a { grid-template-columns: 1fr; grid-template-rows: 330px; }
  .fila-a .card:nth-child(2) { display: none; }
  .fila-b { grid-template-columns: 1fr 1fr; grid-auto-rows: 300px; }
  .fila-b .card:first-child { grid-column: 1 / -1; height: 360px; }
  .kpis .kpi:nth-child(n+4) { display: flex; }
  #s-clientes, #s-cobranzas, #s-whatsapp { height: calc(100dvh - 100px); }
  .kanban { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: minmax(0, 1fr); }
  #s-whatsapp { grid-template-columns: minmax(0, 230px) minmax(0, 1fr); }
}

/* ===== Teléfono ===== */
@media (max-width: 760px) {
  body { font-size: 14px; }
  .marco { display: block; height: auto; }
  .lado { position: fixed; z-index: 30; left: 10px; right: 10px; bottom: max(10px, env(safe-area-inset-bottom)); padding: 6px; border-radius: 22px; background: rgba(15, 27, 45, .94); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); gap: 0; box-shadow: 0 16px 30px -14px rgba(0, 0, 0, .55); }
  .lado-marca, .lado-pie { display: none; }
  .lado { align-items: stretch; }
  .menu { flex-direction: row; gap: 4px; width: 100%; }
  .menu button { flex: 1 1 0; min-width: 0; width: auto; height: 54px; flex-direction: column; gap: 3px; justify-content: center; color: rgba(255, 255, 255, .7); border-radius: 17px; font-size: 10.5px; padding: 0; }
  .menu span { display: block !important; }
  .menu button.activo { background: rgba(255, 255, 255, .14); box-shadow: none; color: #fff; }
  .menu button span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .menu button:hover { background: rgba(255, 255, 255, .08); }
  .principal { padding: 14px 14px 100px; gap: 12px; }
  .cab { flex-direction: column; align-items: stretch; gap: 8px; }
  .cab h1 { font-size: 23px; }
  .cab h1::before { content: "Telenueva"; color: var(--agua); font-weight: 600; font-size: 13px; display: block; letter-spacing: 0; margin-bottom: 2px; }
  .sec, #s-hoy, #s-clientes, #s-cobranzas, #s-whatsapp { display: flex; flex-direction: column; gap: 12px; }
  .sec[hidden] { display: none !important; }
  .kpis { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpis .kpi:nth-child(n+4) { display: flex; }
  .kpis .kpi:first-child { grid-column: 1 / -1; }
  .kpi b { font-size: 20px; }
  .fila-a, .fila-b { display: flex; flex-direction: column; gap: 12px; }
  .fila-a .card:nth-child(2) { display: flex; }
  .card { padding: 14px; }
  .graf { flex: none; height: 220px; }
  .semaforo { grid-template-columns: 120px minmax(0, 1fr); }
  .llamar { max-height: none; overflow: visible; }
  .fila-cli { grid-template-columns: minmax(0, 1fr) auto; }
  .fila-cli .acc { grid-column: 1 / -1; }
  .fila-cli .acc .btn { flex: 1; justify-content: center; }
  .buscador { max-width: none; min-width: 0; width: 100%; flex: none; }
  .filtros { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -14px; padding: 0 14px; }
  .filtros button { flex: none; }
  .tabla { overflow: visible; }
  .tabla table, .tabla tbody, .tabla tr, .tabla td { display: block; }
  .tabla thead { display: none; }
  .tabla tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px; padding: 11px 2px; border-bottom: 1px solid var(--linea-2); }
  .tabla td { padding: 0; border: 0; }
  .tabla td.c-zona, .tabla td.c-hist, .tabla td.c-contacto { display: none; }
  .tabla td.c-plan { grid-column: 1; font-size: 12px; color: var(--gris); }
  .tabla td.c-sem { grid-column: 2; grid-row: 2; text-align: right; }
  .tabla td.c-dias { display: none; }
  .tabla td.c-saldo { grid-column: 2; grid-row: 1; font-weight: 650; }
  .tabla td.c-nom { grid-column: 1; grid-row: 1; font-weight: 600; }
  .pagina { flex-direction: column; }
  .kanban { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; gap: 10px; margin: 0 -14px; padding: 0 14px 4px; scrollbar-width: none; }
  .col { flex: 0 0 86%; scroll-snap-align: center; height: calc(100dvh - 210px); }
  #s-whatsapp .wa-lista-card { max-height: 300px; }
  .wa-chat { height: 560px; flex: none; }
  .wa-der { display: grid; grid-template-rows: auto auto; }
  .secuencia { overflow: visible; }
  .globo { max-width: 88%; }
  .ficha { top: auto; left: 8px; right: 8px; bottom: 8px; width: auto; max-height: 88dvh; border-radius: 24px; animation-name: fichaTel; }
  @keyframes fichaTel { from { transform: translateY(40px); opacity: 0; } }
  .aviso { bottom: 96px; }
  .fila-cli:nth-child(n+6) { display: none; }
  .chat-cab { padding: 12px; gap: 8px; }
  .chat-cab small > span:last-child, .chat-cab [data-ficha] { display: none; }
}

/* La línea de abajo del nombre no invade el monto */
.fila-cli .nom small { overflow: hidden; }
.fila-cli .nom small > span:last-child { overflow: hidden; text-overflow: ellipsis; min-width: 0; }

/* Servicios del cliente */
.susp { font-size: 10.5px; font-weight: 600; color: var(--alto); background: var(--alto-bg); border-radius: 6px; padding: 1px 6px; margin-left: 4px; }
.servs { display: flex; flex-direction: column; gap: 8px; }
.serv { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 9px 10px; border-radius: 14px; background: var(--linea-2); }
.serv b { font-size: 13px; font-weight: 600; display: block; }
.serv small { font-size: 11.5px; color: var(--gris); display: block; }
.serv em { font-style: normal; font-size: 11px; font-weight: 600; border-radius: 999px; padding: 2px 8px; }
.serv em.activo { color: var(--ok); background: var(--ok-bg); }
.serv em.suspendido { color: var(--alto); background: var(--alto-bg); }
.serv-ic { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; background: #fff; color: var(--agua); }
.serv-ic svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.ver-app { text-align: center; font-size: 12px; font-weight: 600; color: var(--tinta-2); padding: 9px; border-radius: 12px; background: var(--card); }
.ver-app:hover { color: var(--agua); }
a.btn { text-decoration: none; justify-content: center; }
@media (max-width: 1180px) { .ver-app { display: none; } }
