// icons.jsx — єдина система лінійних іконок (stroke-based, 24-grid, currentColor)
// Використання:
//   <Icon name="folder" />            — за іменем
//   <Icon e="📁" />                   — за емодзі (мапиться через EMOJI_MAP)
// Розмір за замовчуванням 1.1em (успадковує font-size контейнера).
(function () {
  const I = {
    dot:        '<circle cx="12" cy="12" r="3"/>',
    building:   '<rect x="4" y="3" width="11" height="18" rx="1"/><path d="M15 8h4a1 1 0 0 1 1 1v12"/><path d="M3 21h18"/><path d="M8 7h3M8 11h3M8 15h3"/>',
    home:       '<path d="M3 11l9-8 9 8"/><path d="M5 9.5V21h14V9.5"/><path d="M9.5 21v-6h5v6"/>',
    factory:    '<path d="M3 21V10l6 4V10l6 4V7h6v14z"/><path d="M3 21h18"/><path d="M7 17h2M13 17h2"/>',
    landmark:   '<path d="M3 21h18"/><path d="M5 21v-9M9.5 21v-9M14.5 21v-9M19 21v-9"/><path d="M3.5 11 12 4l8.5 7z"/>',
    hardhat:    '<path d="M2 18a10 10 0 0 1 20 0"/><path d="M9 5.5a3 3 0 0 1 6 0V9"/><rect x="2" y="18" width="20" height="2.6" rx="1"/>',
    construction:'<path d="M2 22h20"/><path d="M5 22V3"/><path d="M5 3l14 4"/><path d="M5 7l11 3"/><path d="M16 7v3"/><path d="M14.2 10h3.6l-1.8 3z"/>',
    ruler:      '<path d="M3 16.5 16.5 3l4.5 4.5L7.5 21z"/><path d="M7 9l2 2M10 6l2 2M13 12l2 2M16 9l2 2"/>',
    mountain:   '<path d="M3 20h18"/><path d="M3 20l6-11 4 6 2-3 5 8z"/>',
    search:     '<circle cx="11" cy="11" r="6"/><path d="M20 20l-4.5-4.5"/>',
    tag:        '<path d="M3 11V4a1 1 0 0 1 1-1h7l9 9-8 8z"/><circle cx="7.5" cy="7.5" r="1.3"/>',
    clipboard:  '<rect x="5" y="4" width="14" height="17" rx="2"/><path d="M9 4V3a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v1"/><path d="M9 11h6M9 15h6"/>',
    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"/>',
    map:        '<path d="M9 4 4 6v14l5-2 6 2 5-2V4l-5 2-6-2z"/><path d="M9 4v14M15 6v14"/>',
    book:       '<path d="M5 4h11a2 2 0 0 1 2 2v14H7a2 2 0 0 1-2-2z"/><path d="M5 18a2 2 0 0 1 2-2h11"/>',
    mail:       '<rect x="3" y="5" width="18" height="14" rx="2"/><path d="M3.5 6.5 12 13l8.5-6.5"/>',
    pencil:     '<path d="M4 20h4L20 8l-4-4L4 16z"/><path d="M14 6l4 4"/>',
    trees:      '<path d="M12 3 7 11h10z"/><path d="M12 8l-4 6h8z"/><path d="M12 14v7"/>',
    shapes:     '<circle cx="8" cy="8" r="3.5"/><rect x="13" y="5" width="6" height="6" rx="1"/><path d="M8 13l4 7H4z"/>',
    brick:      '<rect x="3" y="5" width="18" height="14" rx="1"/><path d="M3 9.7h18M3 14.3h18M9 5v4.7M15 9.7v4.6M9 14.3V19"/>',
    calculator: '<rect x="5" y="3" width="14" height="18" rx="2"/><rect x="8" y="6" width="8" height="3" rx="0.5"/><path d="M9 13h0M12 13h0M15 13h0M9 17h0M12 17h0M15 17h0"/>',
    file:       '<path d="M6 3h8l5 5v13H6z"/><path d="M14 3v5h5"/><path d="M9 13h6M9 17h6"/>',
    files:      '<rect x="7" y="3" width="11" height="15" rx="1.5"/><path d="M4 6v13a2 2 0 0 0 2 2h9"/><path d="M10 8h5M10 12h5"/>',
    wrench:     '<path d="M15.5 5a4 4 0 0 0-5.2 5.2L4 16.5 7.5 20l6.3-6.3A4 4 0 0 0 19 8.5l-2.6 2.6-2-2z"/>',
    wind:       '<path d="M3 8h11a3 3 0 1 0-3-3"/><path d="M3 12h15a3 3 0 1 1-3 3"/><path d="M3 16h8"/>',
    utensils:   '<path d="M7 3v8M5 3v4a2 2 0 0 0 4 0V3M7 11v10"/><path d="M16 3c-2 0-3 2-3 5s1 4 3 4v9"/>',
    droplet:    '<path d="M12 3c4 5 6 8 6 11a6 6 0 0 1-12 0c0-3 2-6 6-11z"/>',
    zap:        '<path d="M13 2 4 14h7l-2 8 9-12h-7z"/>',
    radio:      '<circle cx="12" cy="12" r="2"/><path d="M7.5 7.5a6 6 0 0 0 0 9M16.5 7.5a6 6 0 0 1 0 9M4.5 4.5a10 10 0 0 0 0 15M19.5 4.5a10 10 0 0 1 0 15"/>',
    flame:      '<path d="M12 3c1 4 5 5 5 9.5a5 5 0 0 1-10 0c0-2 1-3.2 2-4.2 0 1.8 1 2.7 2 2.7 0-2.7-1-5-1-8z"/>',
    plug:       '<path d="M9 3v5M15 3v5"/><path d="M7 8h10v3a5 5 0 0 1-10 0z"/><path d="M12 16v5"/>',
    coins:      '<ellipse cx="9" cy="7" rx="6" ry="3"/><path d="M3 7v5c0 1.6 2.7 2.9 6 3"/><ellipse cx="15" cy="14" rx="6" ry="3"/><path d="M9 14.2V17c0 1.6 2.7 3 6 3s6-1.4 6-3v-3"/>',
    banknote:   '<rect x="2" y="6" width="20" height="12" rx="2"/><circle cx="12" cy="12" r="2.5"/><path d="M6 9v6M18 9v6"/>',
    card:       '<rect x="2" y="5" width="20" height="14" rx="2"/><path d="M2 9.5h20"/><path d="M6 14h4"/>',
    chart:      '<path d="M4 4v16h16"/><rect x="7" y="11" width="3" height="6"/><rect x="12" y="7" width="3" height="10"/><rect x="17" y="13" width="3" height="4"/>',
    trending:   '<path d="M3 17l6-6 4 4 8-8"/><path d="M15 7h6v6"/>',
    package:    '<path d="M12 3 21 7.5v9L12 21 3 16.5v-9z"/><path d="M3 7.5 12 12l9-4.5M12 12v9"/>',
    upload:     '<path d="M12 16V4"/><path d="M7 9l5-5 5 5"/><path d="M4 20h16"/>',
    download:   '<path d="M12 4v12"/><path d="M7 11l5 5 5-5"/><path d="M4 20h16"/>',
    checkCircle:'<circle cx="12" cy="12" r="9"/><path d="M8 12.5l2.5 2.5 5-5.5"/>',
    check:      '<path d="M5 12.5l4.5 4.5L19 7"/>',
    lock:       '<rect x="5" y="10" width="14" height="11" rx="2"/><path d="M8 10V7a4 4 0 0 1 8 0v3"/><path d="M12 14v3"/>',
    shield:     '<path d="M12 3 5 6v6c0 4 3 7 7 9 4-2 7-5 7-9V6z"/><path d="M9 12l2 2 4-4"/>',
    receipt:    '<path d="M5 3h14v18l-2.5-1.5L14 21l-2-1.5L10 21l-2.5-1.5L5 21z"/><path d="M9 8h6M9 12h6"/>',
    car:        '<path d="M3 13l2-5a2 2 0 0 1 1.9-1.4h10.2A2 2 0 0 1 19 8l2 5"/><path d="M3 13h18v4H3z"/><circle cx="7.5" cy="17.5" r="1.5"/><circle cx="16.5" cy="17.5" r="1.5"/>',
    notebook:   '<rect x="5" y="3" width="14" height="18" rx="2"/><path d="M9 3v18"/><path d="M12 8h4M12 12h4"/>',
    camera:     '<path d="M3 8h3l1.5-2h9L18 8h3v12H3z"/><circle cx="12" cy="13" r="3.5"/>',
    flask:      '<path d="M9 3h6M10 3v6l-5 9.5A1 1 0 0 0 6 20h12a1 1 0 0 0 1-1.5L14 9V3"/><path d="M8 14h8"/>',
    graduation: '<path d="M2 8l10-4 10 4-10 4z"/><path d="M6 10.5V15c0 1.5 3 2.5 6 2.5s6-1 6-2.5v-4.5"/><path d="M22 8v5"/>',
    medal:      '<circle cx="12" cy="15" r="5"/><path d="M9 10.8 6 3l3 1 3 4 3-4 3-1-3 7.8"/><path d="M10.5 15h3M12 13.5v3"/>',
    user:       '<circle cx="12" cy="8" r="4"/><path d="M5 20a7 7 0 0 1 14 0"/>',
    users:      '<circle cx="9" cy="8" r="3.5"/><path d="M3 19a6 6 0 0 1 12 0"/><path d="M16 5.5a3.5 3.5 0 0 1 0 7"/><path d="M16.5 13a6 6 0 0 1 4.5 6"/>',
    briefcase:  '<rect x="3" y="7" width="18" height="13" rx="2"/><path d="M8 7V5a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"/><path d="M3 12h18"/>',
    key:        '<circle cx="8" cy="14" r="4"/><path d="M11 11 20 2"/><path d="M17 5l3 3M15 7l2 2"/>',
    mic:        '<rect x="9" y="3" width="6" height="11" rx="3"/><path d="M5 11a7 7 0 0 0 14 0"/><path d="M12 18v3"/>',
    scroll:     '<path d="M6 4h11v13a3 3 0 0 1-3 3H7"/><path d="M6 4a2 2 0 0 0-2 2v1h4"/><path d="M17 20a3 3 0 0 0 3-3v-1h-4"/><path d="M9 9h6M9 13h6"/>',
    alert:      '<path d="M12 3 2 20h20z"/><path d="M12 9v5"/><path d="M12 17.5h0"/>',
    cake:       '<path d="M4 21h16"/><path d="M5 21v-7a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v7"/><path d="M4 16c2 0 2 1.4 4 1.4S12 16 12 16s2 1.4 4 1.4S18 16 20 16"/><path d="M12 5v4"/><path d="M12 3.5h0"/>',
    target:     '<circle cx="12" cy="12" r="8"/><circle cx="12" cy="12" r="4.5"/><circle cx="12" cy="12" r="1.2"/>',
    calendar:   '<rect x="4" y="5" width="16" height="16" rx="2"/><path d="M4 9h16M8 3v4M16 3v4"/>',
    sun:        '<circle cx="12" cy="12" r="4"/><path d="M12 2v2M12 20v2M2 12h2M20 12h2M5 5l1.5 1.5M17.5 17.5 19 19M19 5l-1.5 1.5M6.5 17.5 5 19"/>',
    sprout:     '<path d="M12 21v-9"/><path d="M12 12C12 8 9 6 4 6c0 4 3 6 8 6z"/><path d="M12 14c0-3 2.5-5 7-5 0 3.5-3 5-7 5z"/>',
    refresh:    '<path d="M4 12a8 8 0 0 1 13.5-5.5L20 9"/><path d="M20 4v5h-5"/><path d="M20 12a8 8 0 0 1-13.5 5.5L4 15"/><path d="M4 20v-5h5"/>',
    plus:       '<path d="M12 5v14M5 12h14"/>',
    minus:      '<path d="M5 12h14"/>',
    swap:       '<path d="M7 4 3 8l4 4"/><path d="M3 8h14"/><path d="M17 20l4-4-4-4"/><path d="M21 16H7"/>',
    mapPin:     '<path d="M12 21s7-6 7-12a7 7 0 0 0-14 0c0 6 7 12 7 12z"/><circle cx="12" cy="9" r="2.5"/>',
    folder:     '<path d="M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"/>',
    externalLink:'<path d="M14 4h6v6"/><path d="M20 4 11 13"/><path d="M18 14v5a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h5"/>',
    image:      '<rect x="3" y="4" width="18" height="16" rx="2"/><circle cx="8.5" cy="9.5" r="1.8"/><path d="M21 16l-5-5L5 20"/>',
    megaphone:  '<path d="M3 11v2a1 1 0 0 0 1 1h2l9 5V5L6 10H4a1 1 0 0 0-1 1z"/><path d="M18 8a4 4 0 0 1 0 8"/>',
    lightbulb:  '<path d="M9 18h6"/><path d="M10 21h4"/><path d="M12 3a6 6 0 0 1 4 10.5c-.7.7-1 1.3-1 2.5H9c0-1.2-.3-1.8-1-2.5A6 6 0 0 1 12 3z"/>',
    laptop:     '<rect x="4" y="5" width="16" height="11" rx="1.5"/><path d="M2 20h20"/>',
    monitor:    '<rect x="3" y="4" width="18" height="12" rx="2"/><path d="M9 20h6M12 16v4"/>',
    paperclip:  '<path d="M20 11 11.5 19.5a5 5 0 0 1-7-7L13 4a3.5 3.5 0 0 1 5 5l-8 8a2 2 0 0 1-3-3l7.5-7.5"/>',
    message:    '<path d="M4 5h16a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1H9l-4 4v-4H4a1 1 0 0 1-1-1V6a1 1 0 0 1 1-1z"/>',
    bot:        '<rect x="4" y="8" width="16" height="11" rx="2.5"/><path d="M12 4v4"/><path d="M12 3.5h0"/><circle cx="9" cy="13" r="1.1"/><circle cx="15" cy="13" r="1.1"/><path d="M2 12v3M22 12v3"/>',
    star:       '<path d="M12 3 14.7 9l6.3.5-4.8 4.2 1.5 6.3L12 16.8 6.3 20l1.5-6.3L3 9.5 9.3 9z"/>',
    clock:      '<circle cx="12" cy="12" r="8"/><path d="M12 7v5l3.5 2"/>',
    disc:       '<circle cx="12" cy="12" r="9"/><circle cx="12" cy="12" r="2.5"/>',
    fuel:       '<path d="M5 21V5a2 2 0 0 1 2-2h5a2 2 0 0 1 2 2v16"/><path d="M3 21h13"/><path d="M7 10h5"/><path d="M14 8l3 3v6a2 2 0 0 0 4 0V9l-3-3"/>',
    plusCircle: '<circle cx="12" cy="12" r="9"/><path d="M12 8v8M8 12h8"/>',
    circle:     '<circle cx="12" cy="12" r="8"/>',
    play:       '<path d="M8 5v14l11-7z"/>',
    arrowRight: '<path d="M5 12h14"/><path d="M13 6l6 6-6 6"/>',
  };

  // Емодзі → ім'я іконки
  const E = {
    '👔':'briefcase','🏷':'tag','📐':'ruler','🪨':'mountain','🔍':'search','📋':'clipboard',
    '⚙️':'settings','⚙':'settings','🏺':'book','🏛':'landmark','🗺':'map','📗':'book','📨':'mail',
    '✏️':'pencil','✏':'pencil','✎':'pencil','✍️':'pencil','✍':'pencil','📝':'pencil',
    '🌳':'trees','🛝':'shapes','🧱':'brick','🧮':'calculator','🏗':'construction','📄':'file',
    '🔧':'wrench','🛠':'wrench','🛠️':'wrench','🧰':'wrench','🌬':'wind','🌬️':'wind','🍽':'utensils','🍽️':'utensils',
    '💧':'droplet','⚡':'zap','⚡️':'zap','📡':'radio','🔥':'flame','🔌':'plug','💰':'coins','💵':'banknote',
    '📊':'chart','📈':'trending','📑':'files','📦':'package','📤':'upload','📥':'download',
    '✅':'checkCircle','✓':'check','🔐':'lock','💳':'card','🧾':'receipt','🚗':'car','📓':'notebook',
    '📷':'camera','✉':'mail','✉️':'mail','🏭':'factory','🏘':'building','🏘️':'building','🔬':'flask','🛡':'shield','🛡️':'shield',
    '👷':'hardhat','🏢':'building','💡':'lightbulb','💻':'laptop','📎':'paperclip','🖥':'monitor','🖥️':'monitor',
    '📢':'megaphone','🏦':'landmark','🤝':'users','🎓':'graduation','🎖':'medal','🎖️':'medal',
    '👤':'user','🏫':'building','🏡':'home','🔑':'key','👥':'users','📚':'book','🎤':'mic','📜':'scroll',
    '⚠':'alert','⚠️':'alert','🎂':'cake','🎯':'target','📅':'calendar','🏖':'sun','🏖️':'sun',
    '🌱':'sprout','🔄':'refresh','➕':'plus','➖':'minus','⇄':'swap','📍':'mapPin','📁':'folder',
    '↗':'externalLink','↗️':'externalLink','🖼':'image','🖼️':'image','📕':'book','📘':'book',
    '💬':'message','🤖':'bot','★':'star','⭐':'star','⏱':'clock','⏱️':'clock','💿':'disc','⛽':'fuel',
    '+':'plus','−':'minus','➗':'dot','→':'arrowRight','↑':'upload','🅿️':'car','🅿':'car','•':'dot',
  };

  function Icon(props) {
    const { name, e, size, stroke, className, style } = props || {};
    const key = name || E[e] || (e ? 'dot' : 'dot');
    const inner = I[key] || I.dot;
    const s = size != null ? size : '1.1em';
    return React.createElement('svg', {
      className: 'ic' + (className ? ' ' + className : ''),
      width: s, height: s, viewBox: '0 0 24 24',
      fill: 'none', stroke: 'currentColor',
      strokeWidth: stroke != null ? stroke : 1.8,
      strokeLinecap: 'round', strokeLinejoin: 'round',
      'aria-hidden': true,
      style: { flexShrink: 0, ...(style || {}) },
      dangerouslySetInnerHTML: { __html: inner },
    });
  }

  // ВАЖЛИВО: не чіпаємо існуючий window.Icon (об'єкт із Plus/Check/X…).
  // Лінійна система живе під window.Ico.
  window.Ico = Icon;
  window.ICON_PATHS = I;
  window.EMOJI_ICONS = E;
  window.emojiIcon = function (emoji) { return E[emoji] || 'dot'; };
})();
