// === comun.jsx — piezas compartidas por las escenas de «Por cobrar» ===
// Dibujan la pantalla de play tal como es (PorCobrarSubpage.razor, PorCobrarItemU.razor,
// RecordatorioWhatsAppDialog.razor), ampliada para leerse a 1920. Colores de var.css (tema claro)
// y de los .razor.css de la pantalla; tipografía Roboto e iconos Material, como play.
// Las tarjetas de cifras (DnzKpiCard con HighlightColor) llevan en play un degradado: aquí van en
// su color plano, sin degradados.

const PC = {
  azul:'#1d73e2',        // --rz-primary
  rojo:'#d04547',        // --rz-danger
  verde:'#3a8707',       // --rz-success
  ambar:'#ffc107',       // --rz-warning
  naranja:'#ff9800',     // .aging-header--warning (borde)
  naranjaTxt:'#e65100',  // .aging-header--warning (texto)
  amarilloTxt:'#f57f17', // .aging-header--recent (texto)
  wa:'#25D366',          // .whatsapp-btn
  tinta:'#1b1d20',       // --rz-base-900
  texto:'#45494f',       // --rz-base-800
  gris:'#6b7280',
  borde:'#dfe5ec',       // --rz-base-300
  base100:'#f3f6f9',
  base200:'#e3eaf2',
  fondo:'#EEF2F6',
};
const ROBOTO = "Roboto, system-ui, 'Segoe UI', Arial, sans-serif";

// Entrada tranquila: 0→1 en d segundos, sin rebote.
function ap(t, t0, d = 0.7){ return Easing.easeOutCubic(clamp((t - t0) / d, 0, 1)); }
// Ventana de foco: 1 entre a y b (con rampas suaves), 0 fuera.
function foco(t, a, b, r = 0.5){ return clamp((t - a) / r, 0, 1) * (1 - clamp((t - b) / r, 0, 1)); }

function eur(n){
  const [e, c] = n.toFixed(2).split('.');
  return e.replace(/\B(?=(\d{3})+(?!\d))/g, '.') + ',' + c + ' €';
}

function Ico({ n, s = 24, c = 'currentColor', style }){
  return <span className="material-icons" style={{ fontSize:s, color:c, lineHeight:1, display:'inline-block', verticalAlign:'middle', ...style }}>{n}</span>;
}

function WaLogo({ s = 22, c = '#fff' }){
  return (
    <svg width={s} height={s} viewBox="0 0 24 24" fill={c} style={{ display:'block' }}>
      <path d="M17.472 14.382c-.297-.149-1.758-.867-2.03-.967-.273-.099-.471-.148-.67.15-.197.297-.767.966-.94 1.164-.173.199-.347.223-.644.075-.297-.15-1.255-.463-2.39-1.475-.883-.788-1.48-1.761-1.653-2.059-.173-.297-.018-.458.13-.606.134-.133.298-.347.446-.52.149-.174.198-.298.298-.497.099-.198.05-.371-.025-.52-.075-.149-.669-1.612-.916-2.207-.242-.579-.487-.5-.669-.51-.173-.008-.371-.01-.57-.01-.198 0-.52.074-.792.372-.272.297-1.04 1.016-1.04 2.479 0 1.462 1.065 2.875 1.213 3.074.149.198 2.096 3.2 5.077 4.487.709.306 1.262.489 1.694.625.712.227 1.36.195 1.871.118.571-.085 1.758-.719 2.006-1.413.248-.694.248-1.289.173-1.413-.074-.124-.272-.198-.57-.347m-5.421 7.403h-.004a9.87 9.87 0 01-5.031-1.378l-.361-.214-3.741.982.998-3.648-.235-.374a9.86 9.86 0 01-1.51-5.26c.001-5.45 4.436-9.884 9.888-9.884 2.64 0 5.122 1.03 6.988 2.898a9.825 9.825 0 012.893 6.994c-.003 5.45-4.437 9.884-9.885 9.884m8.413-18.297A11.815 11.815 0 0012.05 0C5.495 0 .16 5.335.157 11.892c0 2.096.547 4.142 1.588 5.945L.057 24l6.305-1.654a11.882 11.882 0 005.683 1.448h.005c6.554 0 11.89-5.335 11.893-11.893a11.821 11.821 0 00-3.48-8.413z"/>
    </svg>
  );
}

// ── Los datos del ejemplo (plan.md): hoy es el 9 de octubre de 2026 ──
const EMPRESA = 'Distribuciones Tormes, S.L.';
const TRAMOS = {
  critical: { label:'Vencido +60 días',   icon:'report',       color:PC.rojo,        borde:PC.rojo,    bg:'rgba(211,81,83,0.08)' },
  warning:  { label:'Vencido 30-59 días', icon:'warning',      color:PC.naranjaTxt,  borde:PC.naranja, bg:'rgba(255,152,0,0.08)' },
  recent:   { label:'Vencido 1-29 días',  icon:'schedule',     color:PC.amarilloTxt, borde:PC.ambar,   bg:'rgba(255,193,7,0.08)' },
  ok:       { label:'Al día',             icon:'check_circle', color:PC.verde,       borde:PC.verde,   bg:'rgba(62,145,8,0.08)' },
};
const ROWBG = { critical:'rgba(211,81,83,0.05)', warning:'rgba(255,152,0,0.05)', recent:'rgba(255,193,7,0.04)', ok:'transparent' };
// GetAgingBadgeStyle: ≥60 Danger · ≥30 Warning · resto Success
const kDias = d => d >= 60 ? 'danger' : d >= 30 ? 'warning' : 'success';
const kRow = d => d >= 60 ? 'critical' : d >= 30 ? 'warning' : d >= 1 ? 'recent' : 'ok';

function fac(f, num, v, dias, pend, cob = 0){
  const total = pend + cob;
  return { f, num, v, dias, pend, cob, pct: total > 0 ? cob / total * 100 : 0 };
}
const CLIENTES = [
  { id:'plaza',   nombre:'Bar La Plaza',     tramo:'critical', dias:75, color:'#7E57C2', facturas:[ fac('11 jul','F-2026-0712','26 jul',75,380,100), fac('28 ago','F-2026-0790','12 sept',27,240) ] },
  { id:'alba',    nombre:'Gestoría Alba',    tramo:'critical', dias:62, color:'#26A69A', facturas:[ fac('29 jul','F-2026-0731','8 ago',62,290) ] },
  { id:'clinica', nombre:'Clínica Sonrisas', tramo:'warning',  dias:43, color:'#5C6BC0', facturas:[ fac('12 ago','F-2026-0755','27 ago',43,1150,500) ] },
  { id:'cafe',    nombre:'Café Central',     tramo:'warning',  dias:35, color:'#8D6E63', facturas:[ fac('20 ago','F-2026-0786','4 sept',35,180) ] },
  { id:'ribera',  nombre:'Talleres Ribera',  tramo:'recent',   dias:13, color:'#EF6C00', facturas:[ fac('1 sept','F-2026-0801','26 sept',13,860), fac('25 sept','F-2026-0832','14 oct',-5,420) ] },
  { id:'sol',     nombre:'Panadería Sol',    tramo:'recent',   dias:8,  color:'#C0CA33', facturas:[ fac('16 sept','F-2026-0818','1 oct',8,150) ] },
  { id:'miramar', nombre:'Hotel Miramar',    tramo:'ok',       dias:0,  color:'#29B6F6', facturas:[ fac('2 oct','F-2026-0846','1 nov',-23,1940) ] },
  { id:'martin',  nombre:'Frutas Martín',    tramo:'ok',       dias:0,  color:'#66BB6A', facturas:[ fac('30 sept','F-2026-0840','15 oct',-6,310) ] },
];
CLIENTES.forEach(c => {
  c.total = c.facturas.reduce((s, f) => s + f.pend, 0);
  c.vencido = c.facturas.filter(f => f.dias > 0).reduce((s, f) => s + f.pend, 0);
});
const CLI = Object.fromEntries(CLIENTES.map(c => [c.id, c]));

// ── Ventana: navegador + barra de play ──
function Ventana({ x = 110, y = 150, w = 1700, h = 900, url = 'play.dinaup.com/App/Pymes/Receivables', op = 1, children }){
  return (
    <div style={{ position:'absolute', left:x, top:y, width:w, height:h, borderRadius:16, overflow:'hidden', background:'#fff',
      border:`1px solid ${PC.borde}`, boxShadow:'0 24px 60px rgba(15,23,42,0.10)', opacity:op }}>
      <BrowserChrome url={url} title="Dinaup — Pymes"/>
      <div style={{ height:60, display:'flex', alignItems:'center', gap:18, padding:'0 26px', borderBottom:`1px solid ${PC.borde}`, background:'#fff' }}>
        <Ico n="menu" s={28} c={PC.texto}/>
        <DinaupLogo size={22}/>
        <span style={{ fontFamily:ROBOTO, fontSize:19, color:PC.gris, marginLeft:6 }}>Pymes</span>
        <span style={{ flex:1 }}/>
        <span style={{ fontFamily:ROBOTO, fontSize:17, color:PC.texto }}>{EMPRESA}</span>
        <div style={{ width:38, height:38, borderRadius:99, background:PC.azul, color:'#fff', fontFamily:ROBOTO, fontWeight:700, fontSize:16, display:'flex', alignItems:'center', justifyContent:'center' }}>LM</div>
      </div>
      <div style={{ position:'absolute', left:0, right:0, top:137, bottom:0, background:'#fff', overflow:'hidden', fontFamily:ROBOTO, color:PC.tinta }}>
        {children}
      </div>
    </div>
  );
}

// Cabecera de la pantalla: icono payments + «Ventas Pendientes de Cobro», ayuda y recargar.
function TituloPantalla({ x = 40, y = 26, w = 1620, op = 1 }){
  return (
    <div style={{ position:'absolute', left:x, top:y, width:w, display:'flex', alignItems:'center', gap:14, opacity:op }}>
      <Ico n="payments" s={36} c={PC.tinta}/>
      <span style={{ fontSize:34, fontWeight:400, color:PC.tinta }}>Ventas Pendientes de Cobro</span>
      <span style={{ flex:1 }}/>
      <span style={{ display:'flex', alignItems:'center', gap:6, fontSize:17, color:PC.azul }}><Ico n="help_outline" s={20} c={PC.azul}/>Cómo reclamar el pago</span>
      <div style={{ width:40, height:40, borderRadius:6, background:PC.base200, display:'flex', alignItems:'center', justifyContent:'center' }}><Ico n="refresh" s={22} c={PC.texto}/></div>
    </div>
  );
}

// ── Las cinco tarjetas de cifras (DnzKpiCard con HighlightColor: tarjeta rellena) ──
const KPI_COLOR = {
  red:    { bg:'#e9564f', txt:'#fff' },
  white:  { bg:'#fff',    txt:'#212121', borde:true },
  orange: { bg:'#b5380b', txt:'#fff' },
  yellow: { bg:'#fde74c', txt:'#212121' },
  green:  { bg:'#5fb34a', txt:'#fff' },
};
const KPIS = [
  { id:'vencida',  titulo:'Deuda vencida',   valor:eur(3250), icono:'error_outline', color:'red' },
  { id:'total',    titulo:'Total pendiente', valor:eur(5920), icono:'payments',      color:'white' },
  { id:'semana',   titulo:'Vence en 7 días', valor:eur(730),  icono:'schedule',      color:'orange' },
  { id:'clientes', titulo:'Clientes',        valor:'8',       icono:'group',         color:'white' },
  { id:'dso',      titulo:'DSO promedio',    valor:'33 días', icono:'speed',         color:'yellow' },
];
function Kpi({ k, x, y, w = 300, h = 128, op = 1, dy = 0, realce = 0, valorSize = 36 }){
  const c = KPI_COLOR[k.color];
  return (
    <div style={{ position:'absolute', left:x, top:y + dy, width:w, height:h, borderRadius:12, background:c.bg, color:c.txt, opacity:op,
      border: c.borde ? `1px solid ${PC.borde}` : '1px solid transparent', boxSizing:'border-box', padding:'18px 22px',
      boxShadow: realce > 0 ? `0 ${10 + 14 * realce}px ${24 + 26 * realce}px rgba(15,23,42,${0.06 + 0.10 * realce})` : '0 2px 6px rgba(15,23,42,0.06)',
      transform:`translateY(${-6 * realce}px)` }}>
      <div style={{ fontSize:18, opacity:0.85 }}>{k.titulo}</div>
      <div style={{ fontSize:valorSize, marginTop:14, lineHeight:1, whiteSpace:'nowrap' }}>{k.valor}</div>
      <Ico n={k.icono} s={58} c={c.txt} style={{ position:'absolute', right:16, top:16, opacity:0.4 }}/>
    </div>
  );
}

// ── Insignia (RadzenBadge, material) ──
function Insignia({ txt, k, size = 15 }){
  const st = { danger:{ bg:PC.rojo, c:'#fff' }, warning:{ bg:PC.ambar, c:PC.tinta }, success:{ bg:PC.verde, c:'#fff' }, light:{ bg:PC.base200, c:PC.tinta } }[k];
  return <span style={{ display:'inline-flex', alignItems:'center', gap:4, background:st.bg, color:st.c, fontSize:size, fontWeight:500, padding:'3px 10px', borderRadius:20, whiteSpace:'nowrap', lineHeight:1.2, textTransform:'uppercase', letterSpacing:'0.3px' }}>{txt}</span>;
}

// ── Cabecera de un tramo (.aging-header) ──
function Tramo({ clave, n, total, x, y, w, op = 1, dx = 0 }){
  const tr = TRAMOS[clave];
  return (
    <div style={{ position:'absolute', left:x + dx, top:y, width:w, height:48, borderRadius:8, background:tr.bg, borderLeft:`5px solid ${tr.borde}`,
      color:tr.color, display:'flex', alignItems:'center', gap:12, padding:'0 18px', boxSizing:'border-box', opacity:op, fontWeight:600, fontSize:19 }}>
      <Ico n={tr.icon} s={24} c={tr.color}/>
      <span>{tr.label}</span>
      <span style={{ fontWeight:400, fontSize:17, opacity:0.75 }}>{n} clientes</span>
      <span style={{ flex:1 }}/>
      <span style={{ fontWeight:700, fontSize:20 }}>{eur(total)}</span>
    </div>
  );
}

// Avatar con la inicial (DnzAvatarInitial)
function Avatar({ c, s = 46 }){
  return <div style={{ width:s, height:s, borderRadius:99, background:c.color, color:'#fff', fontWeight:500, fontSize:s * 0.42, display:'flex', alignItems:'center', justifyContent:'center', flexShrink:0 }}>{c.nombre[0]}</div>;
}

// Botones del cliente: «Email» (azul) y WhatsApp (verde, solo icono)
function BotonEmail({ realce = 0, pulso = 0 }){
  return (
    <div style={{ display:'flex', alignItems:'center', gap:8, height:40, padding:'0 16px', borderRadius:6, background:PC.azul, color:'#fff', fontSize:17, fontWeight:500,
      boxShadow: realce > 0 ? `0 0 0 ${4 * realce}px rgba(29,115,226,0.22)` : 'none', transform:`scale(${1 - 0.05 * pulso})` }}>
      <Ico n="email" s={20} c="#fff"/>EMAIL
    </div>
  );
}
function BotonWa({ realce = 0, pulso = 0 }){
  return (
    <div style={{ width:48, height:40, borderRadius:6, background:PC.wa, display:'flex', alignItems:'center', justifyContent:'center',
      boxShadow: realce > 0 ? `0 0 0 ${4 * realce}px rgba(37,211,102,0.25)` : 'none', transform:`scale(${1 - 0.05 * pulso})` }}>
      <WaLogo s={20}/>
    </div>
  );
}

// ── Tarjeta de cliente (PorCobrarItemU): cabecera y, si se pide, su tabla de facturas ──
function Cliente({ c, x, y, w, op = 1, dx = 0, conTabla = false, realceTotal = 0, realceBotones = 0, colsFoco = null, filaFoco = -1, pulsoEmail = 0, pulsoWa = 0, realceEmail = 0, realceWa = 0, alto }){
  const tr = TRAMOS[c.tramo];
  const altoTabla = conTabla ? 56 + c.facturas.length * 62 : 0;
  const H = alto || (88 + (conTabla ? altoTabla + 8 : 0));
  return (
    <div style={{ position:'absolute', left:x + dx, top:y, width:w, height:H, background:'#fff', borderRadius:10, border:`1px solid ${PC.borde}`,
      borderLeft:`5px solid ${tr.borde}`, boxSizing:'border-box', boxShadow:'0 2px 8px rgba(15,23,42,0.05)', opacity:op, overflow:'hidden' }}>
      <div style={{ position:'absolute', left:20, right:20, top:14, height:60, display:'flex', alignItems:'center', gap:14 }}>
        <Avatar c={c}/>
        <div style={{ minWidth:0 }}>
          <div style={{ display:'flex', alignItems:'center', gap:10 }}>
            <span style={{ fontSize:21, fontWeight:700, color:PC.tinta, whiteSpace:'nowrap' }}>{c.nombre}</span>
            {c.dias > 0 && <Insignia txt={`${c.dias}d vencido`} k={kDias(c.dias)}/>}
          </div>
          <div style={{ fontSize:15, color:PC.gris, marginTop:3 }}>{c.facturas.length} facturas pendientes</div>
        </div>
        <span style={{ flex:1 }}/>
        <div style={{ textAlign:'right', padding:'4px 8px', borderRadius:8, background: realceTotal > 0 ? `rgba(29,115,226,${0.08 * realceTotal})` : 'transparent' }}>
          <div style={{ fontSize:14, color:PC.gris }}>Total Pendiente</div>
          <div style={{ fontSize:24, fontWeight:500, color:PC.tinta }}>{eur(c.total)}</div>
          {c.vencido > 0 && c.vencido !== c.total && <div style={{ fontSize:14, color:PC.rojo }}>{eur(c.vencido)} vencido</div>}
        </div>
        <div style={{ display:'flex', gap:6, marginLeft:10, padding:4, borderRadius:10, background: realceBotones > 0 ? `rgba(15,23,42,${0.05 * realceBotones})` : 'transparent' }}>
          <BotonEmail realce={realceEmail} pulso={pulsoEmail}/>
          <BotonWa realce={realceWa} pulso={pulsoWa}/>
        </div>
      </div>
      {conTabla && <TablaFacturas c={c} x={20} y={96} w={w - 46} colsFoco={colsFoco} filaFoco={filaFoco}/>}
    </div>
  );
}

// Tabla de facturas (RadzenTable con líneas horizontales). colsFoco: {fecha, numero, venc, estado, cobrado, pendiente} → 0..1
const COLS = [
  { id:'fecha',     txt:'Fecha',       w:0.15, al:'left' },
  { id:'numero',    txt:'Número',      w:0.20, al:'left' },
  { id:'venc',      txt:'Vencimiento', w:0.17, al:'left' },
  { id:'estado',    txt:'Estado',      w:0.14, al:'center' },
  { id:'cobrado',   txt:'Cobrado',     w:0.17, al:'right' },
  { id:'pendiente', txt:'Pendiente',   w:0.17, al:'right' },
];
function TablaFacturas({ c, x, y, w, colsFoco, filaFoco = -1 }){
  const f0 = id => colsFoco ? (colsFoco[id] || 0) : 0;
  const algun = colsFoco && Object.values(colsFoco).some(v => v > 0);
  let cx = 0; const xs = COLS.map(col => { const r = cx; cx += col.w * w; return r; });
  const celda = (col, i, contenido, fila) => (
    <div key={col.id} style={{ position:'absolute', left:xs[i], width:col.w * w, top:0, bottom:0, display:'flex', alignItems:'center',
      justifyContent: col.al === 'right' ? 'flex-end' : col.al === 'center' ? 'center' : 'flex-start', padding:'0 14px', boxSizing:'border-box',
      opacity: algun ? 0.4 + 0.6 * Math.max(f0(col.id), 0) : 1 }}>{contenido}</div>
  );
  return (
    <div style={{ position:'absolute', left:x, top:y, width:w }}>
      {COLS.map((col, i) => f0(col.id) > 0 && (
        <div key={'h' + col.id} style={{ position:'absolute', left:xs[i] + 4, width:col.w * w - 8, top:0, height:56 + c.facturas.length * 62, borderRadius:8,
          background:`rgba(29,115,226,${0.07 * f0(col.id)})`, border:`2px solid rgba(29,115,226,${0.5 * f0(col.id)})`, boxSizing:'border-box' }}/>
      ))}
      <div style={{ position:'relative', height:56, borderBottom:`1px solid ${PC.borde}`, fontSize:16, fontWeight:500, color:PC.gris }}>
        {COLS.map((col, i) => celda(col, i, col.txt))}
      </div>
      {c.facturas.map((f, n) => {
        const fila = kRow(f.dias);
        return (
          <div key={f.num} style={{ position:'relative', height:62, borderBottom:`1px solid ${PC.base200}`, background:ROWBG[fila], fontSize:18, color:PC.tinta,
            boxShadow: filaFoco === n ? `inset 0 0 0 2px ${PC.azul}` : 'none', borderRadius: filaFoco === n ? 6 : 0 }}>
            {celda(COLS[0], 0, f.f)}
            {celda(COLS[1], 1, <span style={{ display:'inline-flex', alignItems:'center', gap:6, background:PC.base200, borderRadius:20, padding:'4px 12px', fontSize:15, fontWeight:500, textTransform:'uppercase' }}>{f.num}<Ico n="open_in_new" s={16} c="#444"/></span>)}
            {celda(COLS[2], 2, f.v)}
            {celda(COLS[3], 3, f.dias > 0 ? <Insignia txt={`${f.dias}d`} k={kDias(f.dias)}/> : f.dias === 0 ? <Insignia txt="Hoy" k="warning"/> : <Insignia txt={`en ${-f.dias}d`} k="success"/>)}
            {celda(COLS[4], 4, (
              <div style={{ display:'flex', flexDirection:'column', alignItems:'flex-end', gap:5 }}>
                <span style={{ fontSize:16 }}>{eur(f.cob)}</span>
                <div style={{ width:70, height:5, borderRadius:3, background:PC.base200, overflow:'hidden' }}>
                  <div style={{ width:`${f.pct}%`, height:'100%', background: f.pct >= 50 ? PC.verde : PC.rojo }}/>
                </div>
              </div>
            ))}
            {celda(COLS[5], 5, <span style={{ fontSize:16 }}>{eur(f.pend)}</span>)}
          </div>
        );
      })}
    </div>
  );
}

// ── Cursor sencillo, que se desliza entre puntos ──
function Cursor({ t, puntos, clicks = [] }){
  if (!puntos.length || t < puntos[0].t - 0.4) return null;
  let x = puntos[0].x, y = puntos[0].y;
  for (let i = 0; i < puntos.length - 1; i++) {
    const a = puntos[i], b = puntos[i + 1];
    if (t >= a.t && t <= b.t) { const e = Easing.easeInOutCubic((t - a.t) / (b.t - a.t)); x = lerp(a.x, b.x, e); y = lerp(a.y, b.y, e); break; }
    if (t > b.t) { x = b.x; y = b.y; }
  }
  const op = clamp((t - puntos[0].t + 0.4) / 0.4, 0, 1);
  const clic = clicks.find(c => t >= c && t < c + 0.5);
  const anillo = clic !== undefined ? (t - clic) / 0.5 : -1;
  return (
    <div style={{ position:'absolute', left:x, top:y, opacity:op, pointerEvents:'none', zIndex:30 }}>
      {anillo >= 0 && <div style={{ position:'absolute', left:-18, top:-18, width:36, height:36, borderRadius:99, border:`2px solid ${PC.azul}`, opacity:1 - anillo, transform:`scale(${0.5 + anillo})` }}/>}
      <svg width="26" height="32" viewBox="0 0 22 28" style={{ position:'absolute', left:-3, top:-2 }}>
        <path d="M2 2 L2 22 L8 17 L11 24 L14 22 L11 16 L19 16 Z" fill="#fff" stroke="#111" strokeWidth="1.3" strokeLinejoin="round"/>
      </svg>
    </div>
  );
}

// Titular de la escena (eyebrow + título), sustituto plano de DemoHeader con entrada suave.
function Cabecera({ t, eyebrow, titulo, t0 = 0 }){
  const e = ap(t, t0, 0.8);
  return (
    <div style={{ position:'absolute', top:40, left:0, right:0, textAlign:'center', opacity:e, transform:`translateY(${(1 - e) * 10}px)` }}>
      <div className="f-plex" style={{ fontSize:16, fontWeight:600, letterSpacing:'2.4px', color:PC.azul }}>{eyebrow}</div>
      <div className="f-plex" style={{ fontSize:40, fontWeight:700, letterSpacing:'-0.02em', color:'#0F172A', marginTop:8 }}>{titulo}</div>
    </div>
  );
}

// La Única Cosa, en dos líneas, para las escenas 1, 5 y 6.
function UnicaCosa({ t, t1, t2, y = 420, op = 1 }){
  const a = ap(t, t1, 0.8), b = ap(t, t2, 0.8);
  return (
    <div style={{ position:'absolute', left:0, right:0, top:y, textAlign:'center', opacity:op }}>
      <div className="f-plex" style={{ fontSize:54, fontWeight:700, letterSpacing:'-0.02em', color:'#0F172A', opacity:a, transform:`translateY(${(1 - a) * 14}px)` }}>
        Arriba, lo que más tiempo lleva <span style={{ color:PC.rojo }}>vencido</span>.
      </div>
      <div className="f-plex" style={{ fontSize:54, fontWeight:700, letterSpacing:'-0.02em', color:'#0F172A', marginTop:18, opacity:b, transform:`translateY(${(1 - b) * 14}px)` }}>
        Al lado, el botón para <span style={{ color:PC.azul }}>reclamarlo</span>.
      </div>
    </div>
  );
}

function Fondo({ children }){
  return <SlideCanvas variant="light" bg={PC.fondo} grid={false}>{children}</SlideCanvas>;
}

Object.assign(window, { PC, ROBOTO, ap, foco, eur, Ico, WaLogo, EMPRESA, TRAMOS, CLIENTES, CLI, Ventana, TituloPantalla, KPIS, Kpi, Insignia, Tramo,
  Avatar, BotonEmail, BotonWa, Cliente, TablaFacturas, Cursor, Cabecera, UnicaCosa, Fondo, kDias });
