// Inline Lucide-style icons (subset). Each is a <svg> stroke-based icon.
// Usage: <Icon name="folder" size={14} />
const ICONS = {
  // nav
  dashboard: 'M3 13h8V3H3zM13 21h8V11h-8zM3 21h8v-6H3zM13 9h8V3h-8z',
  users:     'M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2 M9 11a4 4 0 1 0 0-8 4 4 0 0 0 0 8 M22 21v-2a4 4 0 0 0-3-3.87 M16 3.13a4 4 0 0 1 0 7.75',
  tree:      'M7 21h10 M12 21V7 M7 7h10 M5 7a2 2 0 1 0 4 0 2 2 0 1 0-4 0 M15 7a2 2 0 1 0 4 0 2 2 0 1 0-4 0 M10 21a2 2 0 1 0 4 0 2 2 0 1 0-4 0',
  server:    'M2 4h20v6H2zM2 14h20v6H2z M6 7h.01 M6 17h.01',
  refresh:   'M21 12a9 9 0 1 1-3-6.7L21 8 M21 3v5h-5',
  history:   'M3 12a9 9 0 1 0 3-6.7L3 8 M3 3v5h5 M12 7v5l3 2',
  cog:       'M12 15a3 3 0 1 0 0-6 3 3 0 0 0 0 6 M19.4 15a1.6 1.6 0 0 0 .3 1.8l.1.1a2 2 0 1 1-2.8 2.8l-.1-.1a1.6 1.6 0 0 0-1.8-.3 1.6 1.6 0 0 0-1 1.5V21a2 2 0 1 1-4 0v-.1a1.6 1.6 0 0 0-1-1.5 1.6 1.6 0 0 0-1.8.3l-.1.1a2 2 0 1 1-2.8-2.8l.1-.1a1.6 1.6 0 0 0 .3-1.8 1.6 1.6 0 0 0-1.5-1H3a2 2 0 1 1 0-4h.1a1.6 1.6 0 0 0 1.5-1 1.6 1.6 0 0 0-.3-1.8l-.1-.1a2 2 0 1 1 2.8-2.8l.1.1a1.6 1.6 0 0 0 1.8.3H9a1.6 1.6 0 0 0 1-1.5V3a2 2 0 1 1 4 0v.1a1.6 1.6 0 0 0 1 1.5 1.6 1.6 0 0 0 1.8-.3l.1-.1a2 2 0 1 1 2.8 2.8l-.1.1a1.6 1.6 0 0 0-.3 1.8V9a1.6 1.6 0 0 0 1.5 1H21a2 2 0 1 1 0 4h-.1a1.6 1.6 0 0 0-1.5 1z',
  // ui
  search:    'M11 19a8 8 0 1 0 0-16 8 8 0 0 0 0 16 M21 21l-4.3-4.3',
  plus:      'M12 5v14 M5 12h14',
  chevR:     'M9 6l6 6-6 6',
  chevD:     'M6 9l6 6 6-6',
  chevU:     'M6 15l6-6 6 6',
  chevL:     'M15 6l-6 6 6 6',
  x:         'M18 6 6 18 M6 6l12 12',
  check:     'M5 13l4 4L19 7',
  more:      'M5 12h.01 M12 12h.01 M19 12h.01',
  filter:    'M3 5h18l-7 9v6l-4-2v-4z',
  folder:    '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',
  user:      'M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2 M12 11a4 4 0 1 0 0-8 4 4 0 0 0 0 8',
  edit:      'M12 20h9 M16.5 3.5a2.1 2.1 0 1 1 3 3L7 19l-4 1 1-4z',
  archive:   'M21 8v13H3V8 M1 3h22v5H1 M10 12h4',
  move:      'M5 9l-3 3 3 3 M9 5l3-3 3 3 M15 19l-3 3-3-3 M19 9l3 3-3 3 M2 12h20 M12 2v20',
  alert:     'M12 9v4 M12 17h.01 M10.3 3.86 1.82 18a2 2 0 0 0 1.7 3h17a2 2 0 0 0 1.7-3L13.7 3.86a2 2 0 0 0-3.4 0z',
  info:      'M12 16v-4 M12 8h.01 M12 22a10 10 0 1 0 0-20 10 10 0 0 0 0 20',
  ok:        'M22 11.08V12a10 10 0 1 1-5.93-9.14 M22 4 12 14.01l-3-3',
  loader:    'M21 12a9 9 0 1 1-6.2-8.55',
  bolt:      'M13 2 3 14h9l-1 8 10-12h-9z',
  cmd:       'M15 6V3a3 3 0 1 1 3 3h-3zM9 6V3a3 3 0 1 0-3 3h3zM9 18v3a3 3 0 1 1-3-3h3zM15 18v3a3 3 0 1 0 3-3h-3z M9 6h6v12H9z',
  log:       'M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z M14 2v6h6 M16 13H8 M16 17H8 M10 9H8',
  power:     'M12 2v10 M18.4 6.6a9 9 0 1 1-12.7 0',
  link:      'M10 13a5 5 0 0 0 7 0l3-3a5 5 0 0 0-7-7l-1 1 M14 11a5 5 0 0 0-7 0l-3 3a5 5 0 0 0 7 7l1-1',
  diff:      'M12 3v18 M5 8l7-5 7 5 M5 16l7 5 7-5',
  bell:      'M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9 M10.3 21a1.94 1.94 0 0 0 3.4 0',
  download:  'M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4 M7 10l5 5 5-5 M12 15V3',
  arrowR:    'M5 12h14 M12 5l7 7-7 7',
  arrowL:    'M19 12H5 M12 19l-7-7 7-7',
  rotate:    'M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8 M21 3v5h-5 M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16 M8 16H3v5',
  branch:    'M6 3v12 M18 9a3 3 0 1 0 0-6 3 3 0 0 0 0 6 M6 21a3 3 0 1 0 0-6 3 3 0 0 0 0 6 M18 9a9 9 0 0 1-9 9',
  shield:    'M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10',
  zap:       'M13 2 3 14h9l-1 8 10-12h-9z',
  eye:       'M2 12s3.5-7 10-7 10 7 10 7-3.5 7-10 7-10-7-10-7 M12 15a3 3 0 1 0 0-6 3 3 0 0 0 0 6',
  trash:     'M3 6h18 M8 6V4h8v2 M19 6l-1 14H6L5 6 M10 11v6 M14 11v6',
};

function Icon({ name, size = 14, className = '', strokeWidth = 1.6, style = {} }) {
  const d = ICONS[name];
  if (!d) return null;
  const paths = d.split(' M').map((p, i) => i === 0 ? p : 'M' + p);
  return (
    <svg
      className={'icon ' + className}
      width={size} height={size}
      viewBox="0 0 24 24"
      fill="none"
      stroke="currentColor"
      strokeWidth={strokeWidth}
      strokeLinecap="round"
      strokeLinejoin="round"
      style={style}
      aria-hidden="true"
    >
      {paths.map((p, i) => <path key={i} d={p} />)}
    </svg>
  );
}

// brand mark — abstract R logo
function BrandMark({ size = 18 }) {
  return (
    <svg width={size} height={size} viewBox="0 0 24 24" aria-hidden="true">
      <rect x="2" y="2" width="20" height="20" rx="5" fill="var(--accent-strong)"/>
      <path d="M8 17V7h5a3 3 0 0 1 0 6h-2l4 4" stroke="#fff" strokeWidth="1.8" fill="none" strokeLinecap="round" strokeLinejoin="round"/>
    </svg>
  );
}

Object.assign(window, { Icon, BrandMark });
