// Linea sottile, 1.5px stroke, 20x20 viewBox standard
const Icon = ({ d, size = 20, fill = false, stroke = 1.5, children, className = '' }) => (
  <svg
    width={size}
    height={size}
    viewBox="0 0 24 24"
    fill={fill ? 'currentColor' : 'none'}
    stroke="currentColor"
    strokeWidth={stroke}
    strokeLinecap="round"
    strokeLinejoin="round"
    className={className}
    aria-hidden="true"
  >
    {d ? <path d={d} /> : children}
  </svg>
);

const I = {
  Dashboard: (p) => <Icon {...p}><rect x="3" y="3" width="7" height="9" rx="1.2"/><rect x="14" y="3" width="7" height="5" rx="1.2"/><rect x="14" y="12" width="7" height="9" rx="1.2"/><rect x="3" y="16" width="7" height="5" rx="1.2"/></Icon>,
  Cash:      (p) => <Icon {...p}><rect x="3" y="6" width="18" height="13" rx="1.5"/><path d="M3 10h18M7 15h3"/><circle cx="15" cy="15" r="1.2"/></Icon>,
  Tag:       (p) => <Icon {...p}><path d="M3 12V4h8l10 10-8 8L3 12Z"/><circle cx="7.5" cy="7.5" r="1.2"/></Icon>,
  Box:       (p) => <Icon {...p}><path d="M3 7l9-4 9 4-9 4-9-4Z"/><path d="M3 7v10l9 4 9-4V7"/><path d="M12 11v10"/></Icon>,
  Users:     (p) => <Icon {...p}><circle cx="9" cy="8" r="3.2"/><path d="M3 20c0-3.3 2.7-6 6-6s6 2.7 6 6"/><path d="M16 11a3 3 0 1 0 0-6"/><path d="M21 20c0-2.5-1.6-4.6-3.8-5.5"/></Icon>,
  Doc:       (p) => <Icon {...p}><path d="M14 3H7a1.5 1.5 0 0 0-1.5 1.5v15A1.5 1.5 0 0 0 7 21h10a1.5 1.5 0 0 0 1.5-1.5V7.5L14 3Z"/><path d="M14 3v4.5h4.5M9 12h6M9 16h6"/></Icon>,
  Settings:  (p) => <Icon {...p}><circle cx="12" cy="12" r="2.5"/><path d="M19.4 14.3a7.7 7.7 0 0 0 0-4.6l2-1.4-2-3.5-2.3.8a8 8 0 0 0-4-2.3L12.6 1h-4l-.5 2.3a8 8 0 0 0-4 2.3l-2.3-.8-2 3.5 2 1.4a7.7 7.7 0 0 0 0 4.6l-2 1.4 2 3.5 2.3-.8a8 8 0 0 0 4 2.3l.5 2.3h4l.5-2.3a8 8 0 0 0 4-2.3l2.3.8 2-3.5-2-1.4Z"/></Icon>,
  Search:    (p) => <Icon {...p}><circle cx="11" cy="11" r="6.5"/><path d="m20 20-3.5-3.5"/></Icon>,
  Barcode:   (p) => <Icon {...p}><path d="M4 5v14M7 5v14M10 5v14M13 5v14M16 5v14M19 5v14" strokeWidth="1.5"/></Icon>,
  Plus:      (p) => <Icon {...p}><path d="M12 5v14M5 12h14"/></Icon>,
  Minus:     (p) => <Icon {...p}><path d="M5 12h14"/></Icon>,
  X:         (p) => <Icon {...p}><path d="M6 6l12 12M18 6 6 18"/></Icon>,
  Check:     (p) => <Icon {...p}><path d="m4 12 5 5L20 6"/></Icon>,
  ArrowR:    (p) => <Icon {...p}><path d="M5 12h14M13 6l6 6-6 6"/></Icon>,
  ArrowU:    (p) => <Icon {...p}><path d="M12 19V5M6 11l6-6 6 6"/></Icon>,
  ArrowD:    (p) => <Icon {...p}><path d="M12 5v14M6 13l6 6 6-6"/></Icon>,
  User:      (p) => <Icon {...p}><circle cx="12" cy="8" r="3.5"/><path d="M4.5 20.5c0-4 3.5-6 7.5-6s7.5 2 7.5 6"/></Icon>,
  Gift:      (p) => <Icon {...p}><rect x="3" y="9" width="18" height="12" rx="1.2"/><path d="M3 13h18M12 9v12M8 9a2.5 2.5 0 1 1 4-2c0 .8-.5 2-4 2Zm8 0a2.5 2.5 0 1 0-4-2c0 .8.5 2 4 2Z"/></Icon>,
  Ticket:    (p) => <Icon {...p}><path d="M3 8a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v2a2 2 0 0 0 0 4v2a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-2a2 2 0 0 0 0-4V8Z"/><path d="M14 6v12" strokeDasharray="2 2"/></Icon>,
  Return:    (p) => <Icon {...p}><path d="M9 14 4 9l5-5"/><path d="M4 9h11a5 5 0 0 1 5 5v6"/></Icon>,
  Wallet:    (p) => <Icon {...p}><rect x="3" y="6" width="18" height="14" rx="1.5"/><path d="M3 10h18M17 15h2"/></Icon>,
  Card:      (p) => <Icon {...p}><rect x="3" y="6" width="18" height="12" rx="1.5"/><path d="M3 10h18M7 15h3"/></Icon>,
  Bell:      (p) => <Icon {...p}><path d="M6 16V10a6 6 0 1 1 12 0v6l1.5 2h-15L6 16Z"/><path d="M10 21h4"/></Icon>,
  Clock:     (p) => <Icon {...p}><circle cx="12" cy="12" r="8.5"/><path d="M12 7v5l3 2"/></Icon>,
  Trash:     (p) => <Icon {...p}><path d="M4 7h16M9 7V5a1.5 1.5 0 0 1 1.5-1.5h3A1.5 1.5 0 0 1 15 5v2M6 7l1 12.5A1.5 1.5 0 0 0 8.5 21h7a1.5 1.5 0 0 0 1.5-1.5L18 7"/></Icon>,
  Pause:     (p) => <Icon {...p}><rect x="6" y="5" width="4" height="14" rx="1"/><rect x="14" y="5" width="4" height="14" rx="1"/></Icon>,
  Dots:      (p) => <Icon {...p} stroke={0} fill={true}><circle cx="6" cy="12" r="1.5"/><circle cx="12" cy="12" r="1.5"/><circle cx="18" cy="12" r="1.5"/></Icon>,
  Filter:    (p) => <Icon {...p}><path d="M3 5h18l-7 9v6l-4-2v-4L3 5Z"/></Icon>,
  Edit:      (p) => <Icon {...p}><path d="M4 20h4l10-10-4-4L4 16v4Z"/><path d="m13 6 4 4"/></Icon>,
  Receipt:   (p) => <Icon {...p}><path d="M5 3v18l2.5-1.5L10 21l2-1.5L14 21l2.5-1.5L19 21V3Z"/><path d="M8 8h8M8 12h8M8 16h5"/></Icon>,
  Globe:     (p) => <Icon {...p}><circle cx="12" cy="12" r="8.5"/><path d="M3.5 12h17M12 3.5c2.5 3 2.5 14 0 17M12 3.5c-2.5 3-2.5 14 0 17"/></Icon>,
  Store:     (p) => <Icon {...p}><path d="M3 9 4.5 4h15L21 9M3 9v11h18V9M3 9c0 2 2 3 3 3s3-1 3-3M9 9c0 2 1.3 3 3 3s3-1 3-3M15 9c0 2 1 3 3 3s3-1 3-3"/></Icon>,
  Refresh:   (p) => <Icon {...p}><path d="M4 12a8 8 0 0 1 14-5.7L21 9"/><path d="M21 4v5h-5"/><path d="M20 12a8 8 0 0 1-14 5.7L3 15"/><path d="M3 20v-5h5"/></Icon>,
  Diamond:   (p) => <Icon {...p}><path d="M6 3h12l3 5-9 13L3 8l3-5Z"/><path d="M3 8h18M9 3l3 5 3-5M9 8l3 13 3-13"/></Icon>,
  Truck:     (p) => <Icon {...p}><path d="M3 7h11v9H3zM14 10h4l3 3v3h-7"/><circle cx="7" cy="18" r="1.8"/><circle cx="17" cy="18" r="1.8"/></Icon>,
  QR:        (p) => <Icon {...p}><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"/><path d="M14 14h3v3h-3zM18 18h3v3h-3zM14 19h3"/></Icon>,
  Lock:      (p) => <Icon {...p}><rect x="5" y="11" width="14" height="10" rx="1.5"/><path d="M8 11V7a4 4 0 0 1 8 0v4"/></Icon>,
  EOD:       (p) => <Icon {...p}><circle cx="12" cy="12" r="8.5"/><path d="M12 7v5l3 3"/><path d="M16.5 19.5 19 17"/><path d="m7.5 19.5-2.5-2.5"/></Icon>,
};

// ─── Logo Easy2Sell ───────────────────────────────────────────────────────
// Monogramma del brand (E2S, quadrato nero a gradiente). Fonte unica: il file
// /public/favicon.svg (stesso del sito), così logo e favicon restano allineati.
const Logo = ({ size = 32 }) => (
  <img src="/public/favicon.svg" width={size} height={size} alt="Easy2Sell"
    style={{ display: 'block', filter: 'drop-shadow(0 3px 8px rgba(0,0,0,.18))' }} />
);

Object.assign(window, { Icon, I, Logo });
