/* global window */
/* AgroNutikas Operating Environment — icon set (stroked, 24×24, square caps) */
const mk = (p) => `<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="square" stroke-linejoin="miter">${p}</svg>`;
const ICONS = {
  today:     mk('<rect x="3" y="4" width="18" height="17"/><line x1="3" y1="9" x2="21" y2="9"/><line x1="8" y1="2" x2="8" y2="6"/><line x1="16" y1="2" x2="16" y2="6"/>'),
  inbox:     mk('<polyline points="3 12 8 12 10 15 14 15 16 12 21 12"/><path d="M3 12 5 5h14l2 7v7H3z"/>'),
  users:     mk('<circle cx="9" cy="8" r="3"/><path d="M3 20a6 6 0 0 1 12 0"/><path d="M16 5a3 3 0 0 1 0 6"/><path d="M21 20a6 6 0 0 0-4-5.6"/>'),
  cube:      mk('<polygon points="12 2 21 7 21 17 12 22 3 17 3 7"/><polyline points="3 7 12 12 21 7"/><line x1="12" y1="12" x2="12" y2="22"/>'),
  code:      mk('<polyline points="16 18 22 12 16 6"/><polyline points="8 6 2 12 8 18"/>'),
  globe:     mk('<circle cx="12" cy="12" r="9"/><line x1="3" y1="12" x2="21" y2="12"/><path d="M12 3a14 14 0 0 1 0 18 14 14 0 0 1 0-18z"/>'),
  layers:    mk('<polygon points="12 3 21 8 12 13 3 8"/><polyline points="3 13 12 18 21 13"/>'),
  book:      mk('<path d="M4 4h13a2 2 0 0 1 2 2v14H6a2 2 0 0 1-2-2z"/><line x1="9" y1="8" x2="15" y2="8"/><line x1="9" y1="12" x2="14" y2="12"/>'),
  coins:     mk('<ellipse cx="12" cy="6" rx="8" ry="3"/><path d="M4 6v6c0 1.7 3.6 3 8 3s8-1.3 8-3V6"/><path d="M4 12v6c0 1.7 3.6 3 8 3s8-1.3 8-3v-6"/>'),
  vault:     mk('<rect x="3" y="4" width="18" height="16"/><circle cx="12" cy="12" r="4"/><line x1="12" y1="8" x2="12" y2="10"/><line x1="12" y1="14" x2="12" y2="16"/>'),
  shield:    mk('<path d="M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z"/><path d="M9 12l2 2 4-4"/>'),
  settings:  mk('<circle cx="12" cy="12" r="3"/><path d="M12 2v3M12 19v3M2 12h3M19 12h3M5 5l2 2M17 17l2 2M19 5l-2 2M7 17l-2 2"/>'),
  search:    mk('<circle cx="11" cy="11" r="7"/><line x1="21" y1="21" x2="16.5" y2="16.5"/>'),
  x:         mk('<line x1="6" y1="6" x2="18" y2="18"/><line x1="18" y1="6" x2="6" y2="18"/>'),
  arrow:     mk('<line x1="4" y1="12" x2="19" y2="12"/><polyline points="13 6 19 12 13 18"/>'),
  chev:      mk('<polyline points="9 18 15 12 9 6"/>'),
  chevd:     mk('<polyline points="6 9 12 15 18 9"/>'),
  plus:      mk('<line x1="12" y1="5" x2="12" y2="19"/><line x1="5" y1="12" x2="19" y2="12"/>'),
  bell:      mk('<path d="M18 8a6 6 0 0 0-12 0c0 7-3 9-3 9h18s-3-2-3-9"/><path d="M13.7 21a2 2 0 0 1-3.4 0"/>'),
  alert:     mk('<path d="M10.3 3.5 1.8 18a2 2 0 0 0 1.7 3h17a2 2 0 0 0 1.7-3L13.7 3.5a2 2 0 0 0-3.4 0z"/><line x1="12" y1="9" x2="12" y2="13"/><line x1="12" y1="17" x2="12" y2="17"/>'),
  check:     mk('<polyline points="4 12 10 18 20 6"/>'),
  clock:     mk('<circle cx="12" cy="12" r="9"/><polyline points="12 7 12 12 16 14"/>'),
  flag:      mk('<line x1="5" y1="22" x2="5" y2="3"/><path d="M5 3h13l-3 5 3 5H5"/>'),
  git:       mk('<circle cx="6" cy="6" r="2.5"/><circle cx="6" cy="18" r="2.5"/><circle cx="18" cy="9" r="2.5"/><path d="M6 8.5v7M18 11.5c0 3-4 3.5-9 4"/>'),
  deploy:    mk('<path d="M4 14l8-10 8 10"/><line x1="12" y1="4" x2="12" y2="20"/><polyline points="8 16 12 20 16 16"/>'),
  pulse:     mk('<polyline points="2 12 7 12 10 4 14 20 17 12 22 12"/>'),
  map:       mk('<polygon points="1 6 1 22 8 18 16 22 23 18 23 2 16 6 8 2 1 6"/><line x1="8" y1="2" x2="8" y2="18"/><line x1="16" y1="6" x2="16" y2="22"/>'),
  doc:       mk('<path d="M6 2h8l4 4v16H6z"/><polyline points="14 2 14 6 18 6"/><line x1="9" y1="13" x2="15" y2="13"/><line x1="9" y1="17" x2="15" y2="17"/>'),
  link:      mk('<path d="M10 13a5 5 0 0 0 7 0l2-2a5 5 0 0 0-7-7l-1 1"/><path d="M14 11a5 5 0 0 0-7 0l-2 2a5 5 0 0 0 7 7l1-1"/>'),
  external:  mk('<path d="M14 4h6v6"/><line x1="20" y1="4" x2="10" y2="14"/><path d="M19 13v6a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V6a1 1 0 0 1 1-1h6"/>'),
  user:      mk('<circle cx="12" cy="8" r="4"/><path d="M4 21a8 8 0 0 1 16 0"/>'),
  phone:     mk('<path d="M5 3h4l2 5-3 2a12 12 0 0 0 6 6l2-3 5 2v4a2 2 0 0 1-2 2A17 17 0 0 1 3 6a2 2 0 0 1 2-3z"/>'),
  mail:      mk('<rect x="2" y="5" width="20" height="14"/><polyline points="2 6 12 13 22 6"/>'),
  snooze:    mk('<circle cx="12" cy="13" r="8"/><polyline points="12 9 12 13 15 13"/><line x1="5" y1="3" x2="9" y2="3"/><line x1="19" y1="3" x2="15" y2="3"/>'),
  escalate:  mk('<polyline points="6 15 12 9 18 15"/><polyline points="6 20 12 14 18 20"/>'),
  edit:      mk('<path d="M4 20h4L20 8l-4-4L4 16z"/><line x1="14" y1="6" x2="18" y2="10"/>'),
  filter:    mk('<polygon points="3 4 21 4 14 13 14 20 10 20 10 13"/>'),
  db:        mk('<ellipse cx="12" cy="5" rx="8" ry="3"/><path d="M4 5v14c0 1.7 3.6 3 8 3s8-1.3 8-3V5"/><path d="M4 12c0 1.7 3.6 3 8 3s8-1.3 8-3"/>'),
  cal:       mk('<rect x="3" y="4" width="18" height="17"/><line x1="3" y1="9" x2="21" y2="9"/>'),
  bolt:      mk('<polygon points="13 2 4 14 11 14 10 22 20 9 13 9"/>'),
  eye:       mk('<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"/>'),
  lock:      mk('<rect x="4" y="11" width="16" height="10"/><path d="M8 11V7a4 4 0 0 1 8 0v4"/>'),
  play:      mk('<polygon points="6 4 20 12 6 20"/>'),
  img:       mk('<rect x="3" y="4" width="18" height="16"/><circle cx="9" cy="10" r="2"/><polyline points="3 18 9 13 13 16 17 13 21 17"/>'),
  robot:     mk('<rect x="4" y="8" width="16" height="12"/><line x1="12" y1="4" x2="12" y2="8"/><circle cx="12" cy="4" r="1.4"/><line x1="9" y1="13" x2="9" y2="15"/><line x1="15" y1="13" x2="15" y2="15"/>'),
  target:    mk('<circle cx="12" cy="12" r="9"/><circle cx="12" cy="12" r="5"/><circle cx="12" cy="12" r="1.4"/>'),
  trend:     mk('<polyline points="3 17 9 11 13 15 21 7"/><polyline points="15 7 21 7 21 13"/>'),
  branch:    mk('<line x1="6" y1="3" x2="6" y2="15"/><circle cx="18" cy="6" r="3"/><circle cx="6" cy="18" r="3"/><path d="M18 9a9 9 0 0 1-9 9"/>'),
  list:      mk('<line x1="8" y1="6" x2="21" y2="6"/><line x1="8" y1="12" x2="21" y2="12"/><line x1="8" y1="18" x2="21" y2="18"/><line x1="3" y1="6" x2="3.01" y2="6"/><line x1="3" y1="12" x2="3.01" y2="12"/><line x1="3" y1="18" x2="3.01" y2="18"/>'),
  refresh:   mk('<polyline points="21 4 21 10 15 10"/><path d="M3.5 9a9 9 0 0 1 14.8-3.4L21 8"/><polyline points="3 20 3 14 9 14"/><path d="M20.5 15a9 9 0 0 1-14.8 3.4L3 16"/>'),
  menu:      mk('<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"/>'),
  scale:     mk('<line x1="12" y1="3" x2="12" y2="21"/><path d="M6 7h12"/><path d="M6 7l-3 7a3 3 0 0 0 6 0z"/><path d="M18 7l-3 7a3 3 0 0 0 6 0z"/>'),
  euro:      mk('<path d="M18 6a8 8 0 1 0 0 12"/><line x1="3" y1="10" x2="13" y2="10"/><line x1="3" y1="14" x2="11" y2="14"/>'),
};
window.ICONS = ICONS;
window.Ic = function Ic({ name, className }) {
  return React.createElement('span', { className: 'ic ' + (className||''), dangerouslySetInnerHTML: { __html: ICONS[name] || ICONS.doc } });
};
