/* ============================================================
   Vela — icon set (inline SVG, stroke-based)
   <Icon name="..." /> — inherits currentColor
   ============================================================ */
(function () {
  const P = {
    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"/></>,
    pipeline: <><path d="M3 6h18M3 12h18M3 18h18"/><circle cx="8" cy="6" r="1.6" fill="currentColor" stroke="none"/><circle cx="15" cy="12" r="1.6" fill="currentColor" stroke="none"/><circle cx="11" cy="18" r="1.6" fill="currentColor" stroke="none"/></>,
    clients: <><circle cx="9" cy="8" r="3.2"/><path d="M3.5 19a5.5 5.5 0 0 1 11 0"/><path d="M16 5.5a3 3 0 0 1 0 5.4"/><path d="M17.5 14.4A5.2 5.2 0 0 1 20.5 19"/></>,
    docs: <><path d="M6 2.5h7l5 5V21a.5.5 0 0 1-.5.5h-11A.5.5 0 0 1 6 21z"/><path d="M13 2.5V7.5h5"/><path d="M9 13h6M9 16.5h4"/></>,
    rates: <><path d="M3 17l5-5 3.5 3.5L20 7"/><path d="M15 7h5v5"/></>,
    calendar: <><rect x="3.5" y="4.5" width="17" height="16" rx="2"/><path d="M3.5 9h17M8 2.5v4M16 2.5v4"/></>,
    settings: <><circle cx="12" cy="12" r="3"/><path d="M12 2.5v2.5M12 19v2.5M4.2 4.2l1.8 1.8M18 18l1.8 1.8M2.5 12H5M19 12h2.5M4.2 19.8 6 18M18 6l1.8-1.8"/></>,
    search: <><circle cx="11" cy="11" r="7"/><path d="m20 20-3.5-3.5"/></>,
    bell: <><path d="M18 8a6 6 0 0 0-12 0c0 7-3 8-3 8h18s-3-1-3-8"/><path d="M13.7 21a2 2 0 0 1-3.4 0"/></>,
    plus: <><path d="M12 5v14M5 12h14"/></>,
    chevR: <><path d="m9 6 6 6-6 6"/></>,
    chevL: <><path d="m15 6-6 6 6 6"/></>,
    chevD: <><path d="m6 9 6 6 6-6"/></>,
    arrowR: <><path d="M5 12h14M13 6l6 6-6 6"/></>,
    check: <><path d="m4 12 5 5L20 6"/></>,
    checkCircle: <><circle cx="12" cy="12" r="9"/><path d="m8 12 2.5 2.5L16 9"/></>,
    clock: <><circle cx="12" cy="12" r="9"/><path d="M12 7v5l3.5 2"/></>,
    flag: <><path d="M5 21V4M5 4h11l-2 3.5L16 11H5"/></>,
    upload: <><path d="M12 16V4M7 9l5-5 5 5"/><path d="M4 16v2.5A1.5 1.5 0 0 0 5.5 20h13a1.5 1.5 0 0 0 1.5-1.5V16"/></>,
    download: <><path d="M12 4v12M7 11l5 5 5-5"/><path d="M4 20h16"/></>,
    ai: <><path d="M12 3l1.6 4.4L18 9l-4.4 1.6L12 15l-1.6-4.4L6 9l4.4-1.6z"/><path d="M18 14l.7 1.9L20.5 16l-1.8.7L18 18.5l-.7-1.8L15.5 16l1.8-.6z"/></>,
    user: <><circle cx="12" cy="8" r="3.5"/><path d="M5 20a7 7 0 0 1 14 0"/></>,
    home: <><path d="M4 11.5 12 4l8 7.5"/><path d="M6 10v10h12V10"/><path d="M10 20v-6h4v6"/></>,
    dollar: <><path d="M12 2v20M16.5 6.5C16.5 4.6 14.5 3.5 12 3.5S7.5 4.8 7.5 7s2 3 4.5 3.5 4.5 1.4 4.5 3.5-2 3.5-4.5 3.5-4.5-1.1-4.5-3"/></>,
    shield: <><path d="M12 3l7 3v5c0 4.5-3 8-7 10-4-2-7-5.5-7-10V6z"/><path d="m9 12 2 2 4-4"/></>,
    lock: <><rect x="5" y="11" width="14" height="9" rx="2"/><path d="M8 11V8a4 4 0 0 1 8 0v3"/></>,
    sparkLine: <><path d="M3 15c3 0 3-6 6-6s3 4 6 4 3-7 6-7"/></>,
    dots: <><circle cx="5" cy="12" r="1.6" fill="currentColor" stroke="none"/><circle cx="12" cy="12" r="1.6" fill="currentColor" stroke="none"/><circle cx="19" cy="12" r="1.6" fill="currentColor" stroke="none"/></>,
    filter: <><path d="M3 5h18l-7 8v6l-4 2v-8z"/></>,
    mail: <><rect x="3" y="5" width="18" height="14" rx="2"/><path d="m3.5 6.5 8.5 6 8.5-6"/></>,
    phone: <><path d="M5 3.5h3l1.5 4-2 1.5a11 11 0 0 0 5 5l1.5-2 4 1.5v3a1.5 1.5 0 0 1-1.6 1.5C10.4 18.8 5.2 13.6 3.5 5.1A1.5 1.5 0 0 1 5 3.5z"/></>,
    pencil: <><path d="M4 20h4l10-10-4-4L4 16z"/><path d="m13.5 6.5 4 4"/></>,
    eye: <><path d="M2 12s4-7 10-7 10 7 10 7-4 7-10 7S2 12 2 12z"/><circle cx="12" cy="12" r="3"/></>,
    star: <><path d="M12 3.5l2.6 5.5 6 .8-4.4 4.2 1.1 6L12 17.3 6.7 20l1.1-6L3.4 9.8l6-.8z"/></>,
    warn: <><path d="M12 3 2.5 20h19z"/><path d="M12 9.5v4.5M12 17h.01"/></>,
    handshake: <><path d="M3 10l4-3 5 3 5-3 4 3"/><path d="M7 7v8l5 4 5-4V7"/></>,
    link: <><path d="M9 13a3.5 3.5 0 0 0 5 0l3-3a3.5 3.5 0 0 0-5-5l-1 1"/><path d="M15 11a3.5 3.5 0 0 0-5 0l-3 3a3.5 3.5 0 0 0 5 5l1-1"/></>,
    menu: <><path d="M3 6h18M3 12h18M3 18h18"/></>,
    inbox: <><path d="M3 13h4l2 3h6l2-3h4"/><path d="M5 5h14l2 8v5a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1v-5z"/></>,
    folder: <><path d="M3 7a1.5 1.5 0 0 1 1.5-1.5H9l2 2.5h8A1.5 1.5 0 0 1 20.5 9.5V18a1.5 1.5 0 0 1-1.5 1.5H4.5A1.5 1.5 0 0 1 3 18z"/></>,
    sync: <><path d="M3 9a9 9 0 0 1 15-3l3 3M21 15a9 9 0 0 1-15 3l-3-3"/><path d="M21 4v5h-5M3 20v-5h5"/></>,
    alert: <><circle cx="12" cy="12" r="9"/><path d="M12 7.5v5M12 16h.01"/></>,
    whatsapp: <><path d="M3 21l1.7-4.3A8 8 0 1 1 8 19.5z"/><path d="M9 9.5c0 3 2.5 5.5 5.5 5.5.6 0 1-.3 1-.9 0-.3-.6-1.2-1.1-1.3-.4-.1-.8.4-1.1.4-.7 0-2.4-1.6-2.4-2.4 0-.3.5-.7.4-1.1-.1-.5-1-1.1-1.3-1.1-.6 0-.9.4-.9 1z"/></>,
    idcard: <><rect x="3" y="5" width="18" height="14" rx="2"/><circle cx="8.5" cy="11" r="2"/><path d="M5 16a3.5 3.5 0 0 1 7 0M14 9.5h4M14 13h3"/></>,
    building: <><rect x="5" y="3" width="14" height="18" rx="1.5"/><path d="M9 7h2M13 7h2M9 11h2M13 11h2M9 15h2M13 15h2M10 21v-3h4v3"/></>,
    location: <><path d="M12 21s7-5.5 7-11a7 7 0 0 0-14 0c0 5.5 7 11 7 11z"/><circle cx="12" cy="10" r="2.5"/></>,
    euro: <><path d="M16.5 6.5A6 6 0 1 0 16.5 17.5"/><path d="M5 10.5h7M5 13.5h6"/></>,
    send: <><path d="M4 12l16-7-7 16-2.5-6.5z"/></>,
    sparkles: <><path d="M12 3l1.6 4.4L18 9l-4.4 1.6L12 15l-1.6-4.4L6 9l4.4-1.6z"/></>,
    target: <><circle cx="12" cy="12" r="8.5"/><circle cx="12" cy="12" r="4.5"/><circle cx="12" cy="12" r="1" fill="currentColor" stroke="none"/></>,
    google: <><path d="M21 12.2c0-.7-.06-1.4-.18-2H12v3.8h5.06a4.3 4.3 0 0 1-1.88 2.82v2.34h3.04C19.96 17.4 21 15 21 12.2z" fill="currentColor" stroke="none"/><path d="M12 21c2.55 0 4.7-.85 6.26-2.3l-3.04-2.34c-.85.57-1.93.9-3.22.9-2.47 0-4.57-1.67-5.32-3.92H3.5v2.42A9 9 0 0 0 12 21z" fill="currentColor" stroke="none" opacity=".8"/><path d="M6.68 13.34a5.4 5.4 0 0 1 0-3.42V7.5H3.5a9 9 0 0 0 0 8.08z" fill="currentColor" stroke="none" opacity=".55"/><path d="M12 6.96c1.39 0 2.64.48 3.62 1.42l2.7-2.7A9 9 0 0 0 3.5 7.5l3.18 2.42C7.43 7.67 9.53 6.96 12 6.96z" fill="currentColor" stroke="none" opacity=".9"/></>,
    refresh: <><path d="M3 9a9 9 0 0 1 15-3l3 3M21 4v5h-5"/></>,
    x: <><path d="M6 6l12 12M18 6 6 18"/></>,
    template: <><path d="M12 3 3 7.5l9 4.5 9-4.5z"/><path d="M3 12l9 4.5L21 12M3 16.5 12 21l9-4.5"/></>,
    trash: <><path d="M4 7h16M9 7V5a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2M6 7l1 13a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1l1-13"/></>,
    salesforce: <><path d="M7 18a4 4 0 0 1-.5-7.97A5 5 0 0 1 16 9.2 3.5 3.5 0 1 1 17 18z"/></>,
  };

  function Icon({ name, size = 18, stroke = 1.7, style, className }) {
    const path = P[name];
    if (!path) return null;
    return (
      <svg width={size} height={size} viewBox="0 0 24 24" fill="none"
        stroke="currentColor" strokeWidth={stroke} strokeLinecap="round"
        strokeLinejoin="round" style={style} className={className} aria-hidden="true">
        {path}
      </svg>
    );
  }

  // Brand mark — sharp geometric sail (Direction B)
  function VelaMark({ size = 28, color = "currentColor", accent = "#06B6D4", gradient = false, onDark = false }) {
    const gid = "vm-grad-" + Math.random().toString(36).slice(2, 8);
    const mainFill = gradient ? `url(#${gid})` : (accent || color);
    const mast = onDark ? "rgba(255,255,255,.42)" : "rgba(11,27,54,.32)";
    return (
      <svg width={size} height={size} viewBox="0 0 32 32" fill="none" aria-hidden="true" style={{ display: "block" }}>
        {gradient && (
          <defs>
            <linearGradient id={gid} x1="6" y1="3" x2="26" y2="28" gradientUnits="userSpaceOnUse">
              <stop stopColor="#1466FF" /><stop offset="1" stopColor="#06B6D4" />
            </linearGradient>
          </defs>
        )}
        <path d="M16 2 L16 30" stroke={mast} strokeWidth="1.4" />
        <path d="M16.9 3.4 L25.5 27 L16.9 22 Z" fill={mainFill} />
        <path d="M15.1 3.4 L6.5 27 L15.1 22 Z" fill={gradient ? mainFill : color} opacity={gradient ? .5 : .42} />
        <circle cx="16" cy="29" r="1.7" fill={onDark ? "#fff" : "#0B1B36"} />
      </svg>
    );
  }

  window.Icon = Icon;
  window.VelaMark = VelaMark;
})();
