/* ===================================================================
   KabelFlux v5 — SVG icon set
   Clean 16/20px stroke icons (no emoji clutter — emoji is unreliable
   across OS, and the original design uses inline emoji which fights
   the engineering aesthetic).
   =================================================================== */

const Icon = ({ name, size = 16, stroke = 'currentColor', fill = 'none', strokeWidth = 1.6, style }) => {
  const p = { width: size, height: size, viewBox: '0 0 24 24', fill, stroke, strokeWidth, strokeLinecap: 'round', strokeLinejoin: 'round', style, 'aria-hidden': true };
  const paths = {
    /* navigation */
    layout:    <><rect x="3" y="3" width="18" height="8" rx="1.5"/><rect x="3" y="13" width="11" height="8" rx="1.5"/><rect x="16" y="13" width="5" height="8" rx="1.5"/></>,
    diagram:   <><circle cx="6" cy="6" r="2.4"/><circle cx="18" cy="18" r="2.4"/><circle cx="18" cy="6" r="2.4"/><path d="M8 7c4 0 6 4 10 11"/><path d="M8 6h7.5"/></>,
    wires:     <><path d="M3 8c4 0 4 8 8 8s4-8 8-8"/><circle cx="3" cy="8" r="1.2"/><circle cx="21" cy="8" r="1.2"/></>,
    connector: <><rect x="3" y="6" width="18" height="12" rx="2"/><circle cx="8" cy="12" r="1.2" fill="currentColor"/><circle cx="12" cy="12" r="1.2" fill="currentColor"/><circle cx="16" cy="12" r="1.2" fill="currentColor"/></>,
    nodes:     <><circle cx="6" cy="6" r="2"/><circle cx="18" cy="6" r="2"/><circle cx="12" cy="18" r="2"/><path d="M7.5 7.5L11 16.5M16.5 7.5L13 16.5M8 6h8"/></>,
    bom:       <><rect x="4" y="3" width="16" height="18" rx="2"/><path d="M9 3v3h6V3"/><path d="M8 11h8M8 14.5h8M8 18h5"/></>,
    notes:     <><path d="M4 5a2 2 0 0 1 2-2h7l5 5v11a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2z"/><path d="M13 3v5h5"/><path d="M8 13l2 2 5-5"/></>,
    title:     <><rect x="3" y="4" width="18" height="16" rx="1.5"/><path d="M3 10h18M9 14h9M9 17h6"/></>,
    library:   <><circle cx="12" cy="12" r="2"/><path d="M12 3v3M12 18v3M3 12h3M18 12h3M5.5 5.5l2 2M16.5 16.5l2 2M5.5 18.5l2-2M16.5 7.5l2-2"/></>,
    settings:  <><circle cx="12" cy="12" r="3"/><path d="M19.4 15a1.7 1.7 0 0 0 .3 1.8l.1.1a2 2 0 1 1-2.8 2.8l-.1-.1a1.7 1.7 0 0 0-1.8-.3 1.7 1.7 0 0 0-1 1.5V21a2 2 0 0 1-4 0v-.1a1.7 1.7 0 0 0-1.1-1.5 1.7 1.7 0 0 0-1.8.3l-.1.1a2 2 0 1 1-2.8-2.8l.1-.1a1.7 1.7 0 0 0 .3-1.8 1.7 1.7 0 0 0-1.5-1H3a2 2 0 0 1 0-4h.1a1.7 1.7 0 0 0 1.5-1.1 1.7 1.7 0 0 0-.3-1.8l-.1-.1a2 2 0 1 1 2.8-2.8l.1.1a1.7 1.7 0 0 0 1.8.3H9a1.7 1.7 0 0 0 1-1.5V3a2 2 0 0 1 4 0v.1a1.7 1.7 0 0 0 1 1.5 1.7 1.7 0 0 0 1.8-.3l.1-.1a2 2 0 1 1 2.8 2.8l-.1.1a1.7 1.7 0 0 0-.3 1.8V9a1.7 1.7 0 0 0 1.5 1H21a2 2 0 0 1 0 4h-.1a1.7 1.7 0 0 0-1.5 1z"/></>,
    /* topbar */
    search:    <><circle cx="11" cy="11" r="7"/><path d="M21 21l-4.3-4.3"/></>,
    bell:      <><path d="M18 16a2 2 0 0 0 .5-3.4L17 11V8a5 5 0 0 0-10 0v3l-1.5 1.6A2 2 0 0 0 6 16h12z"/><path d="M10 19a2 2 0 0 0 4 0"/></>,
    backup:    <><path d="M3 12a9 9 0 1 0 3-6.7"/><path d="M3 4v5h5"/><circle cx="12" cy="12" r="2" fill="currentColor"/></>,
    share:     <><circle cx="6" cy="12" r="2.5"/><circle cx="18" cy="6" r="2.5"/><circle cx="18" cy="18" r="2.5"/><path d="M8 11l8-4M8 13l8 4"/></>,
    user:      <><circle cx="12" cy="8" r="3.5"/><path d="M5 20c1-3.5 4-5.5 7-5.5s6 2 7 5.5"/></>,
    plus:      <><path d="M12 5v14M5 12h14"/></>,
    import_:   <><path d="M4 14v4a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-4"/><path d="M12 3v12M7 10l5 5 5-5"/></>,
    export_:   <><path d="M4 14v4a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-4"/><path d="M12 15V3M7 8l5-5 5 5"/></>,
    download:  <><path d="M4 17v3h16v-3"/><path d="M12 4v12M7 11l5 5 5-5"/></>,
    chevD:     <><path d="M6 9l6 6 6-6"/></>,
    chevR:     <><path d="M9 6l6 6-6 6"/></>,
    chevL:     <><path d="M15 6l-6 6 6 6"/></>,
    check:     <><path d="M5 12l5 5L20 7"/></>,
    x:         <><path d="M6 6l12 12M18 6L6 18"/></>,
    edit:      <><path d="M4 20h4l11-11-4-4L4 16v4z"/><path d="M14 5l4 4"/></>,
    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"/><path d="M10 11v6M14 11v6"/></>,
    copy:      <><rect x="8" y="8" width="12" height="12" rx="2"/><path d="M16 8V6a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v8a2 2 0 0 0 2 2h2"/></>,
    refresh:   <><path d="M3 12a9 9 0 0 1 15-6.7l3 2.7"/><path d="M21 4v5h-5"/><path d="M21 12a9 9 0 0 1-15 6.7l-3-2.7"/><path d="M3 20v-5h5"/></>,
    play:      <><path d="M6 4l14 8-14 8z" fill="currentColor"/></>,
    pause:     <><rect x="6" y="4" width="4" height="16" fill="currentColor"/><rect x="14" y="4" width="4" height="16" fill="currentColor"/></>,
    /* statuses */
    warn:      <><path d="M12 3l10 18H2z"/><path d="M12 10v4M12 17.5v.5"/></>,
    info:      <><circle cx="12" cy="12" r="9"/><path d="M12 8v.5M11 12h1v5h1"/></>,
    ok:        <><circle cx="12" cy="12" r="9"/><path d="M8 12l3 3 5-6"/></>,
    err:       <><circle cx="12" cy="12" r="9"/><path d="M9 9l6 6M15 9l-6 6"/></>,
    bolt:      <><path d="M13 2L4 14h6l-1 8 9-12h-6z"/></>,
    sliders:   <><path d="M4 6h10M18 6h2M4 12h2M10 12h10M4 18h12M20 18h0"/><circle cx="16" cy="6" r="2"/><circle cx="8" cy="12" r="2"/><circle cx="18" cy="18" r="2"/></>,
    tune:      <><path d="M6 4v4M6 12v8M12 4v10M12 18v2M18 4v2M18 10v10"/><circle cx="6" cy="10" r="2"/><circle cx="12" cy="16" r="2"/><circle cx="18" cy="8" r="2"/></>,
    image:     <><rect x="3" y="4" width="18" height="16" rx="2"/><circle cx="9" cy="10" r="2"/><path d="M21 16l-5-5-9 9"/></>,
    /* layout-specific */
    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"/></>,
    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"/></>,
    eyeOff:    <><path d="M3 3l18 18"/><path d="M10.6 5.1A11.4 11.4 0 0 1 12 5c6.5 0 10 7 10 7a18.6 18.6 0 0 1-3 3.9M6.6 6.6A18.7 18.7 0 0 0 2 12s3.5 7 10 7c1.6 0 3.1-.4 4.4-1.1"/><path d="M9.5 9.5a3 3 0 0 0 4.2 4.2"/></>,
    move:      <><path d="M12 3v18M3 12h18M9 6l3-3 3 3M9 18l3 3 3-3M6 9l-3 3 3 3M18 9l3 3-3 3"/></>,
    zoomIn:    <><circle cx="11" cy="11" r="7"/><path d="M21 21l-4.3-4.3M11 8v6M8 11h6"/></>,
    zoomOut:   <><circle cx="11" cy="11" r="7"/><path d="M21 21l-4.3-4.3M8 11h6"/></>,
    cmd:       <><path d="M6 9a2 2 0 1 1 2-2v10a2 2 0 1 1-2-2h12a2 2 0 1 1-2 2V7a2 2 0 1 1 2 2H6z"/></>,
    pin:       <><circle cx="12" cy="12" r="3" fill="currentColor"/><circle cx="12" cy="12" r="6"/></>,
    bundle:    <><path d="M4 8c5 0 5 8 16 8"/><path d="M4 12c5 0 5 4 16 4"/><path d="M4 16c5 0 5 0 16 0"/></>,
    ruler:     <><path d="M3 17L17 3l4 4L7 21z"/><path d="M7 13l2 2M10 10l2 2M13 7l2 2"/></>,
    flask:     <><path d="M9 3v6L4 19a2 2 0 0 0 1.7 3h12.6A2 2 0 0 0 20 19l-5-10V3"/><path d="M8 3h8"/><path d="M6.5 14h11"/></>,
    file:      <><path d="M14 3H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V9z"/><path d="M14 3v6h6"/></>,
    folder:    <><path d="M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"/></>,
    history:   <><circle cx="12" cy="12" r="9"/><path d="M12 7v5l3 2"/></>,
    star:      <><path d="M12 3l3 6 6.5 1-5 4.5L18 21l-6-3.5L6 21l1.5-6.5L2.5 10 9 9z"/></>,
    filter:    <><path d="M4 4h16l-6 8v6l-4 2v-8z"/></>,
    sort:      <><path d="M7 4v16M3 8l4-4 4 4M17 20V4M13 16l4 4 4-4"/></>,
    keyboard:  <><rect x="2" y="6" width="20" height="12" rx="2"/><path d="M6 10h0M10 10h0M14 10h0M18 10h0M6 14h12"/></>,
  };
  if (!paths[name]) return null;
  return <svg {...p}>{paths[name]}</svg>;
};

window.Icon = Icon;
