/* ============================================================
   ICONS — minimal line-icon set (UI primitives)
   window.Icon
   ============================================================ */
(function () {
  const P = {
    search:    <><circle cx="11" cy="11" r="7"/><line x1="21" y1="21" x2="16.5" y2="16.5"/></>,
    user:      <><circle cx="12" cy="8" r="4"/><path d="M4 21c0-4.4 3.6-8 8-8s8 3.6 8 8"/></>,
    bookmark:  <path d="M6 4h12v17l-6-4-6 4V4z"/>,
    arrowR:    <><line x1="4" y1="12" x2="20" y2="12"/><polyline points="14 6 20 12 14 18"/></>,
    arrowL:    <><line x1="20" y1="12" x2="4" y2="12"/><polyline points="10 6 4 12 10 18"/></>,
    chevR:     <polyline points="9 6 15 12 9 18"/>,
    chevD:     <polyline points="6 9 12 15 18 9"/>,
    eye:       <><path d="M2 12s3.5-7 10-7 10 7 10 7-3.5 7-10 7-10-7-10-7z"/><circle cx="12" cy="12" r="3"/></>,
    up:        <><path d="M12 20V6"/><polyline points="6 12 12 6 18 12"/></>,
    share:     <><circle cx="18" cy="5" r="3"/><circle cx="6" cy="12" r="3"/><circle cx="18" cy="19" r="3"/><line x1="8.6" y1="10.6" x2="15.4" y2="6.4"/><line x1="8.6" y1="13.4" x2="15.4" y2="17.6"/></>,
    menu:      <><line x1="3" y1="6" x2="21" y2="6"/><line x1="3" y1="12" x2="21" y2="12"/><line x1="3" y1="18" x2="21" y2="18"/></>,
    x:         <><line x1="6" y1="6" x2="18" y2="18"/><line x1="18" y1="6" x2="6" y2="18"/></>,
    plus:      <><line x1="12" y1="5" x2="12" y2="19"/><line x1="5" y1="12" x2="19" y2="12"/></>,
    edit:      <><path d="M4 20h4L19 9l-4-4L4 16v4z"/><line x1="14" y1="6" x2="18" y2="10"/></>,
    trash:     <><polyline points="3 6 21 6"/><path d="M8 6V4h8v2M6 6l1 14h10l1-14"/></>,
    grid:      <><rect x="3" y="3" width="7" height="7"/><rect x="14" y="3" width="7" height="7"/><rect x="3" y="14" width="7" height="7"/><rect x="14" y="14" width="7" height="7"/></>,
    rss:       <><path d="M4 11a9 9 0 0 1 9 9"/><path d="M4 4a16 16 0 0 1 16 16"/><circle cx="5" cy="19" r="1.5"/></>,
    users:     <><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 5.2a3.2 3.2 0 0 1 0 6M21 20c0-2.6-1.6-4.8-4-5.6"/></>,
    check:     <polyline points="4 12 10 18 20 6"/>,
    clock:     <><circle cx="12" cy="12" r="9"/><polyline points="12 7 12 12 16 14"/></>,
    file:      <><path d="M14 3H6v18h12V7l-4-4z"/><polyline points="14 3 14 7 18 7"/></>,
    settings:  <><circle cx="12" cy="12" r="3"/><path d="M12 2v3M12 19v3M2 12h3M19 12h3M5 5l2 2M17 17l2 2M19 5l-2 2M7 17l-2 2"/></>,
    home:      <><path d="M3 11l9-8 9 8"/><path d="M5 10v10h14V10"/></>,
    link:      <><path d="M10 14a4 4 0 0 0 6 0l3-3a4 4 0 1 0-6-6l-1 1"/><path d="M14 10a4 4 0 0 0-6 0l-3 3a4 4 0 1 0 6 6l1-1"/></>,
    logout:    <><path d="M16 17l5-5-5-5"/><line x1="21" y1="12" x2="9" y2="12"/><path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"/></>,
    bolt:      <polygon points="13 2 4 14 11 14 10 22 20 9 13 9 13 2"/>,
    comment:   <path d="M21 15a2 2 0 0 1-2 2H8l-5 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"/>,
    filter:    <polygon points="3 4 21 4 14 12 14 20 10 18 10 12 3 4"/>,
    dot:       <circle cx="12" cy="12" r="4"/>,
  };

  function Icon({ name, size = 18, stroke = 1.7, fill = false, style, className }) {
    const fillIcons = { bookmark: 1, dot: 1, bolt: 1 };
    const useFill = fill && fillIcons[name];
    return (
      <svg width={size} height={size} viewBox="0 0 24 24"
        fill={useFill ? "currentColor" : "none"} stroke="currentColor"
        strokeWidth={stroke} strokeLinecap="round" strokeLinejoin="round"
        style={style} className={className} aria-hidden="true">
        {P[name] || null}
      </svg>
    );
  }
  window.Icon = Icon;
})();
