// Icon set — stroke-based, consistent 1.6 weight
const Icon = ({ name, size = 18, color = 'currentColor', className = '', style = {} }) => {
  const paths = {
    logoA: <><path d="M5 19L12 5l7 14M8 14h8"/></>,
    dashboard: <><rect x="3" y="3" width="7" height="9" rx="1.5"/><rect x="14" y="3" width="7" height="5" rx="1.5"/><rect x="14" y="12" width="7" height="9" rx="1.5"/><rect x="3" y="16" width="7" height="5" rx="1.5"/></>,
    users: <><circle cx="9" cy="8" r="3.5"/><path d="M2 20c0-3.5 3.1-6 7-6s7 2.5 7 6"/><circle cx="17" cy="9" r="2.5"/><path d="M15 20c0-2.4 2-4 4-4s3 1 3 3"/></>,
    wallet: <><path d="M3 7c0-1.1.9-2 2-2h12a2 2 0 012 2v10a2 2 0 01-2 2H5a2 2 0 01-2-2V7z"/><path d="M16 13h3M3 9h18"/></>,
    receipt: <><path d="M5 3h14v18l-3-2-2 2-2-2-2 2-2-2-3 2V3z"/><path d="M8 8h8M8 12h8M8 16h5"/></>,
    briefcase: <><rect x="3" y="7" width="18" height="13" rx="2"/><path d="M8 7V5a2 2 0 012-2h4a2 2 0 012 2v2M3 13h18"/></>,
    megaphone: <><path d="M3 11v2a1 1 0 001 1h2l4 4V6L6 10H4a1 1 0 00-1 1z"/><path d="M14 7c1.5 1 2.5 2.8 2.5 5s-1 4-2.5 5"/></>,
    folder: <><path d="M3 7a2 2 0 012-2h4l2 2h8a2 2 0 012 2v8a2 2 0 01-2 2H5a2 2 0 01-2-2V7z"/></>,
    file: <><path d="M14 3H6a2 2 0 00-2 2v14a2 2 0 002 2h12a2 2 0 002-2V9l-6-6z"/><path d="M14 3v6h6"/></>,
    book: <><path d="M4 5a2 2 0 012-2h13v16H6a2 2 0 00-2 2V5z"/><path d="M4 19a2 2 0 012-2h13"/></>,
    calc: <><rect x="4" y="3" width="16" height="18" rx="2"/><path d="M8 7h8M8 11h1M12 11h1M16 11h1M8 15h1M12 15h1M16 15h1M8 19h1M12 19h5"/></>,
    doc: <><path d="M14 3H7a2 2 0 00-2 2v14a2 2 0 002 2h10a2 2 0 002-2V8l-5-5z"/><path d="M14 3v5h5M9 14h6M9 17h4"/></>,
    message: <><path d="M4 5a2 2 0 012-2h12a2 2 0 012 2v10a2 2 0 01-2 2H9l-5 4V5z"/></>,
    bell: <><path d="M6 8a6 6 0 1112 0v4l2 3H4l2-3V8z"/><path d="M10 19a2 2 0 004 0"/></>,
    search: <><circle cx="11" cy="11" r="7"/><path d="M20 20l-3.5-3.5"/></>,
    plus: <><path d="M12 5v14M5 12h14"/></>,
    check: <><path d="M5 12l4 4L19 6"/></>,
    chevron: <><path d="M9 6l6 6-6 6"/></>,
    chevronDown: <><path d="M6 9l6 6 6-6"/></>,
    arrowRight: <><path d="M5 12h14M13 6l6 6-6 6"/></>,
    arrowUp: <><path d="M12 19V5M6 11l6-6 6 6"/></>,
    arrowDown: <><path d="M12 5v14M6 13l6 6 6-6"/></>,
    close: <><path d="M6 6l12 12M18 6L6 18"/></>,
    whatsapp: <><path d="M3 21l1.5-5.3A9 9 0 1112 21H3z"/><path d="M8.5 9c.2 1 .8 2.2 1.7 3 .9.9 2 1.5 3 1.7.3.1.7 0 .9-.2l.8-.7c.2-.2.6-.2.9 0l1.4.9c.2.1.3.4.2.6-.3.7-1.1 1.6-2.4 1.7-2 .1-5.7-2.3-6.5-6.4-.1-1 .7-1.9 1.4-2.2.2-.1.5 0 .6.2l.9 1.4c.2.3.2.7 0 .9l-.7.8c-.2.2-.3.5-.2.8z" fill="currentColor" stroke="none"/></>,
    zap: <><path d="M13 2L3 14h9l-1 8 10-12h-9l1-8z"/></>,
    shield: <><path d="M12 3l8 3v6c0 5-3.5 8.5-8 9.5-4.5-1-8-4.5-8-9.5V6l8-3z"/></>,
    star: <><path d="M12 2l3 6.5 7 1-5 5 1.2 7L12 18l-6.2 3.5L7 14.5 2 9.5l7-1L12 2z"/></>,
    sparkle: <><path d="M12 2v6M12 16v6M2 12h6M16 12h6M5 5l3 3M16 16l3 3M5 19l3-3M16 8l3-3"/></>,
    calendar: <><rect x="3" y="5" width="18" height="16" rx="2"/><path d="M8 3v4M16 3v4M3 10h18"/></>,
    clock: <><circle cx="12" cy="12" r="9"/><path d="M12 7v5l3 2"/></>,
    pie: <><path d="M12 3v9h9a9 9 0 11-9-9z"/><path d="M16 3a8 8 0 015 5h-5V3z"/></>,
    trend: <><path d="M3 17l6-6 4 4 7-7"/><path d="M14 8h6v6"/></>,
    menu: <><path d="M4 6h16M4 12h16M4 18h16"/></>,
    settings: <><circle cx="12" cy="12" r="3"/><path d="M19.4 15a1.7 1.7 0 00.3 1.8l.1.1a2 2 0 11-2.8 2.8l-.1-.1a1.7 1.7 0 00-1.8-.3 1.7 1.7 0 00-1 1.5V21a2 2 0 01-4 0v-.1a1.7 1.7 0 00-1.1-1.5 1.7 1.7 0 00-1.8.3l-.1.1a2 2 0 11-2.8-2.8l.1-.1a1.7 1.7 0 00.3-1.8 1.7 1.7 0 00-1.5-1H3a2 2 0 010-4h.1A1.7 1.7 0 004.6 9a1.7 1.7 0 00-.3-1.8l-.1-.1a2 2 0 112.8-2.8l.1.1a1.7 1.7 0 001.8.3h0a1.7 1.7 0 001-1.5V3a2 2 0 014 0v.1a1.7 1.7 0 001 1.5 1.7 1.7 0 001.8-.3l.1-.1a2 2 0 112.8 2.8l-.1.1a1.7 1.7 0 00-.3 1.8v0a1.7 1.7 0 001.5 1H21a2 2 0 010 4h-.1a1.7 1.7 0 00-1.5 1z"/></>,
    phone: <><path d="M22 16.9v3a2 2 0 01-2.2 2 20 20 0 01-8.6-3 19.7 19.7 0 01-6-6 20 20 0 01-3-8.7A2 2 0 014.1 2h3a2 2 0 012 1.7c.1.9.3 1.8.6 2.6a2 2 0 01-.5 2.1L8 9.6a16 16 0 006 6l1.3-1.3a2 2 0 012.1-.5c.8.3 1.7.5 2.6.6a2 2 0 011.7 2z"/></>,
    mail: <><rect x="3" y="5" width="18" height="14" rx="2"/><path d="M3 7l9 6 9-6"/></>,
    dollar: <><path d="M12 3v18M16 7h-5a2.5 2.5 0 000 5h2a2.5 2.5 0 010 5H7"/></>,
    map: <><path d="M9 3L3 5v16l6-2 6 2 6-2V3l-6 2-6-2z"/><path d="M9 3v16M15 5v16"/></>,
    filter: <><path d="M3 5h18l-7 8v6l-4-2v-4L3 5z"/></>,
    grid: <><rect x="3" y="3" width="7" height="7" rx="1"/><rect x="14" y="3" width="7" height="7" rx="1"/><rect x="3" y="14" width="7" height="7" rx="1"/><rect x="14" y="14" width="7" height="7" rx="1"/></>,
    lock: <><rect x="4" y="10" width="16" height="11" rx="2"/><path d="M8 10V7a4 4 0 018 0v3"/></>,
    upload: <><path d="M12 15V3M6 9l6-6 6 6"/><path d="M4 17v2a2 2 0 002 2h12a2 2 0 002-2v-2"/></>,
    download: <><path d="M12 3v12M6 9l6 6 6-6"/><path d="M4 17v2a2 2 0 002 2h12a2 2 0 002-2v-2"/></>,
    pix: <><path d="M12 3l3 3-3 3-3-3 3-3zM12 15l3 3-3 3-3-3 3-3zM3 12l3-3 3 3-3 3-3-3zM15 12l3-3 3 3-3 3-3-3z"/></>,
    bar: <><path d="M4 20V10M10 20V4M16 20v-7M22 20H2"/></>,
    circleCheck: <><circle cx="12" cy="12" r="9"/><path d="M8 12l3 3 5-5"/></>,
    circleAlert: <><circle cx="12" cy="12" r="9"/><path d="M12 8v5M12 16.5v.5"/></>,
    power: <><path d="M12 3v9M5.6 7.6a8 8 0 1012.8 0"/></>,
    logout: <><path d="M9 21H5a2 2 0 01-2-2V5a2 2 0 012-2h4M16 17l5-5-5-5M21 12H9"/></>,
    target: <><circle cx="12" cy="12" r="9"/><circle cx="12" cy="12" r="5"/><circle cx="12" cy="12" r="1" fill="currentColor"/></>,
    help: <><circle cx="12" cy="12" r="9"/><path d="M9.5 9a2.5 2.5 0 015 0c0 1.5-2.5 2-2.5 3.5M12 17v.5"/></>,
    external: <><path d="M14 5h5v5M19 5l-9 9M13 21H5a2 2 0 01-2-2V9"/></>,
    edit: <><path d="M14 3l7 7-11 11H3v-7L14 3z"/></>,
    trash: <><path d="M4 7h16M10 11v6M14 11v6"/><path d="M6 7l1 13a2 2 0 002 2h6a2 2 0 002-2l1-13M9 7V4a1 1 0 011-1h4a1 1 0 011 1v3"/></>,
    more: <><circle cx="5" cy="12" r="1.5" fill="currentColor"/><circle cx="12" cy="12" r="1.5" fill="currentColor"/><circle cx="19" cy="12" r="1.5" fill="currentColor"/></>,
    sun: <><circle cx="12" cy="12" r="4"/><path d="M12 2v2M12 20v2M4 12H2M22 12h-2M5 5l1.5 1.5M17.5 17.5L19 19M5 19l1.5-1.5M17.5 6.5L19 5"/></>,
    moon: <><path d="M20 14A8 8 0 1110 4a6 6 0 0010 10z"/></>,
    barchart: <><path d="M4 20h16M7 20v-6M12 20V8M17 20v-10"/></>,
    pin: <><path d="M12 22s7-7 7-12a7 7 0 10-14 0c0 5 7 12 7 12z"/><circle cx="12" cy="10" r="2.5"/></>,
    drag: <><circle cx="9" cy="6" r="1.2" fill="currentColor"/><circle cx="15" cy="6" r="1.2" fill="currentColor"/><circle cx="9" cy="12" r="1.2" fill="currentColor"/><circle cx="15" cy="12" r="1.2" fill="currentColor"/><circle cx="9" cy="18" r="1.2" fill="currentColor"/><circle cx="15" cy="18" r="1.2" fill="currentColor"/></>,
    refresh: <><path d="M21 12a9 9 0 01-15.5 6.2L3 16M3 12a9 9 0 0115.5-6.2L21 8"/><path d="M21 4v4h-4M3 20v-4h4"/></>,
    cpu: <><rect x="5" y="5" width="14" height="14" rx="2"/><rect x="9" y="9" width="6" height="6"/><path d="M9 2v3M15 2v3M9 19v3M15 19v3M2 9h3M2 15h3M19 9h3M19 15h3"/></>,
    'trending-up': <><path d="M3 17l6-6 4 4 7-7"/><path d="M14 8h6v6"/></>,
    'bar-chart': <><path d="M4 20h16M7 20v-6M12 20V8M17 20v-10"/></>,
    alert: <><path d="M12 3l10 18H2L12 3z"/><path d="M12 10v5M12 18v.5"/></>,
    kanban: <><rect x="3" y="4" width="5" height="16" rx="1.5"/><rect x="10" y="4" width="5" height="10" rx="1.5"/><rect x="17" y="4" width="4" height="14" rx="1.5"/></>,
    shopping: <><path d="M3 5h2l2 12h12l2-9H7"/><circle cx="9" cy="20" r="1.5"/><circle cx="17" cy="20" r="1.5"/></>,
    wrench: <><path d="M14.7 6.3a4 4 0 00-5.4 5.4l-6.3 6.3 2 2 6.3-6.3a4 4 0 005.4-5.4l-2.5 2.5-2-2 2.5-2.5z"/></>,
    sync: <><path d="M4 4v6h6M20 20v-6h-6"/><path d="M20 10a8 8 0 00-14-4M4 14a8 8 0 0014 4"/></>,
    repeat: <><path d="M17 2l4 4-4 4"/><path d="M3 11V9a4 4 0 014-4h14M7 22l-4-4 4-4"/><path d="M21 13v2a4 4 0 01-4 4H3"/></>,
    'minus-circle': <><circle cx="12" cy="12" r="9"/><path d="M8 12h8"/></>,
    award: <><circle cx="12" cy="9" r="6"/><path d="M8.5 13.5L7 21l5-3 5 3-1.5-7.5"/></>,
    palm: <><path d="M12 22V11"/><path d="M12 11c-3-4-7-3-8-2M12 11c3-4 7-3 8-2M12 11c-1-4 1-7 3-8M12 11c1-4-1-7-3-8M12 11c-3-2-7 0-8 2M12 11c3-2 7 0 8 2"/></>,
    tag: <><path d="M3 12V5a2 2 0 012-2h7l9 9-9 9-9-9z"/><circle cx="8" cy="8" r="1.5" fill="currentColor"/></>,
    ban: <><circle cx="12" cy="12" r="9"/><path d="M5.5 5.5l13 13"/></>,
    heart: <><path d="M12 21s-7-4.5-9.5-9A5.5 5.5 0 0112 6a5.5 5.5 0 019.5 6c-2.5 4.5-9.5 9-9.5 9z"/></>,
    heartbeat: <><path d="M3 12h4l2-5 4 10 2-5h6"/></>,
    'pause-circle': <><circle cx="12" cy="12" r="9"/><path d="M10 9v6M14 9v6"/></>,
    'map-pin': <><path d="M12 22s7-7 7-12a7 7 0 10-14 0c0 5 7 12 7 12z"/><circle cx="12" cy="10" r="2.5"/></>,
    list: <><path d="M8 6h13M8 12h13M8 18h13"/><circle cx="4" cy="6" r="1" fill="currentColor"/><circle cx="4" cy="12" r="1" fill="currentColor"/><circle cx="4" cy="18" r="1" fill="currentColor"/></>,
    user: <><circle cx="12" cy="8" r="4"/><path d="M4 21c0-4.4 3.6-8 8-8s8 3.6 8 8"/></>,
    x: <><path d="M6 6l12 12M18 6L6 18"/></>,
    dots: <><circle cx="5" cy="12" r="1.5" fill="currentColor"/><circle cx="12" cy="12" r="1.5" fill="currentColor"/><circle cx="19" cy="12" r="1.5" fill="currentColor"/></>,
  };
  const p = paths[name];
  if (!p) return null;
  return (
    <svg width={size} height={size} viewBox="0 0 24 24" fill="none"
      stroke={color} strokeWidth="1.6" strokeLinecap="round" strokeLinejoin="round"
      className={className} style={style}>{p}</svg>
  );
};

// Avatar helper — deterministic colored initials
const Avatar = ({ name, size = 32, src }) => {
  const initials = name.split(' ').map(w => w[0]).slice(0,2).join('').toUpperCase();
  const hues = [12, 28, 160, 210, 260, 330, 45];
  const h = hues[name.charCodeAt(0) % hues.length];
  return (
    <div style={{
      width: size, height: size, borderRadius: '50%',
      background: `linear-gradient(135deg, hsl(${h} 75% 62%), hsl(${h} 80% 48%))`,
      color: 'white', display: 'grid', placeItems: 'center',
      fontWeight: 600, fontSize: size * 0.38, flexShrink: 0,
      boxShadow: '0 0 0 2px rgba(255,255,255,.08)',
    }}>{initials}</div>
  );
};

// Brazilian Real formatter
const BRL = (n) => 'R$ ' + n.toLocaleString('pt-BR', { minimumFractionDigits: 2, maximumFractionDigits: 2 });
const BRLShort = (n) => {
  if (n >= 1000000) return 'R$ ' + (n/1000000).toFixed(1).replace('.', ',') + 'M';
  if (n >= 1000) return 'R$ ' + (n/1000).toFixed(1).replace('.', ',') + 'k';
  return 'R$ ' + n.toFixed(0);
};

Object.assign(window, { Icon, Avatar, BRL, BRLShort });
