
// RMTCTRL — Reusable Components
// Exports all shared UI primitives to window

// ── MenuIcon (hamburger) ────────────────────────────────────────────────────
function MenuIcon({ size = 20, color = '#F5F5F7' }) {
  return (
    <svg width={size} height={size} viewBox="0 0 24 24" fill="none" stroke={color} strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
      <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" />
    </svg>
  );
}

// ── useViewportWidth (responsive breakpoint hook) ───────────────────────────
function useViewportWidth() {
  const [w, setW] = React.useState(() => typeof window !== 'undefined' ? window.innerWidth : 1440);
  React.useEffect(() => {
    let raf = null;
    const onResize = () => {
      if (raf) cancelAnimationFrame(raf);
      raf = requestAnimationFrame(() => setW(window.innerWidth));
    };
    window.addEventListener('resize', onResize);
    return () => { window.removeEventListener('resize', onResize); if (raf) cancelAnimationFrame(raf); };
  }, []);
  return w;
}

// ── useLocalStorage hook (auto-persisted state) ─────────────────────────────
function useLocalStorage(key, initial) {
  const [value, setValue] = React.useState(() => {
    try {
      const raw = localStorage.getItem(key);
      return raw !== null ? JSON.parse(raw) : initial;
    } catch {
      return initial;
    }
  });
  React.useEffect(() => {
    try {
      localStorage.setItem(key, JSON.stringify(value));
    } catch {
      /* localStorage may be full or disabled */
    }
  }, [key, value]);
  return [value, setValue];
}

// ── StatusPill ──────────────────────────────────────────────────────────────
const STATUS_CONFIG = {
  'ON TIME':     { color: TOKENS.color.accent, bg: 'rgba(0,255,148,0.12)', dot: false },
  'DELAYED':     { color: TOKENS.color.warn, bg: 'rgba(255,184,0,0.12)',  dot: false },
  'BOARDING':    { color: TOKENS.color.accent, bg: 'rgba(0,255,148,0.12)', dot: true  },
  'GATE':        { color: TOKENS.color.info, bg: 'rgba(59,158,255,0.12)',dot: false },
  'LANDED':      { color: TOKENS.color.textSecondary, bg: 'rgba(153,153,161,0.12)',dot: false },
  'CANCELLED':   { color: TOKENS.color.error, bg: 'rgba(255,59,92,0.12)', dot: false },
  'WORK BLOCK':  { color: TOKENS.color.textPrimary, bg: 'rgba(245,245,247,0.1)',dot: false },
  'IN TRANSIT':  { color: TOKENS.color.warn, bg: 'rgba(255,184,0,0.12)', dot: true  },
  'ARRIVED':     { color: TOKENS.color.accent, bg: 'rgba(0,255,148,0.12)', dot: false },
};

function getStatusConfig(label) {
  const key = Object.keys(STATUS_CONFIG).find(k => label.toUpperCase().startsWith(k));
  return STATUS_CONFIG[key] || { color: TOKENS.color.textSecondary, bg: 'rgba(153,153,161,0.12)', dot: false };
}

function StatusPill({ label, large }) {
  const cfg = getStatusConfig(label);
  return (
    <span style={{
      display: 'inline-flex', alignItems: 'center', gap: 6,
      background: cfg.bg, borderRadius: 999,
      padding: large ? '8px 16px' : '6px 12px',
      fontFamily: "'JetBrains Mono', monospace",
      fontSize: large ? 13 : 11, fontWeight: 600,
      color: cfg.color, letterSpacing: '0.05em',
      textTransform: 'uppercase', whiteSpace: 'nowrap',
    }}>
      {cfg.dot && (
        <span style={{
          width: 6, height: 6, borderRadius: '50%',
          background: cfg.color, flexShrink: 0,
          animation: 'pill-pulse 1.5s ease-in-out infinite',
        }} />
      )}
      {label}
    </span>
  );
}

// ── Button ───────────────────────────────────────────────────────────────────
function Btn({ variant='primary', size='md', children, onClick, disabled, fullWidth, icon }) {
  const heights = { sm: 40, md: 48, lg: 56 };
  const fonts = { sm: 13, md: 15, lg: 16 };
  const styles = {
    primary:     { bg: TOKENS.color.accent, color: TOKENS.color.bg, border: 'none' },
    secondary:   { bg: 'transparent', color: TOKENS.color.textPrimary, border: '1.5px solid #26262E' },
    ghost:       { bg: 'transparent', color: TOKENS.color.accent, border: 'none' },
    destructive: { bg: 'transparent', color: TOKENS.color.error, border: '1.5px solid #FF3B5C' },
  };
  const s = styles[variant];
  return (
    <button onClick={onClick} disabled={disabled} style={{
      height: heights[size], minHeight: heights[size],
      padding: '0 20px',
      background: s.bg, color: s.color,
      border: s.border || 'none',
      borderRadius: 12, cursor: disabled ? 'not-allowed' : 'pointer',
      fontFamily: "'Inter', sans-serif",
      fontSize: fonts[size], fontWeight: 600,
      display: 'inline-flex', alignItems: 'center', justifyContent: 'center', gap: 8,
      width: fullWidth ? '100%' : 'auto',
      opacity: disabled ? 0.4 : 1,
      transition: `opacity ${TOKENS.anim.fast}, transform ${TOKENS.anim.fast}`,
      flexShrink: 0,
    }}>
      {icon && <span style={{ display: 'flex' }}>{icon}</span>}
      {children}
    </button>
  );
}

// ── Card ─────────────────────────────────────────────────────────────────────
function Card({ children, style, onClick, noPad }) {
  return (
    <div onClick={onClick} style={{
      background: TOKENS.color.surface, borderRadius: 16,
      border: '1px solid #26262E',
      padding: noPad ? 0 : 20,
      overflow: noPad ? 'hidden' : 'visible',
      cursor: onClick ? 'pointer' : 'default',
      ...style
    }}>
      {children}
    </div>
  );
}

// ── Input ─────────────────────────────────────────────────────────────────────
function Input({ label, value, onChange, error, helper, type='text', mono, prefix }) {
  const [focused, setFocused] = React.useState(false);
  return (
    <div style={{ display: 'flex', flexDirection: 'column', gap: 6 }}>
      <label style={{
        fontFamily: "'Inter', sans-serif", fontSize: 13, fontWeight: 500,
        color: focused ? TOKENS.color.accent : TOKENS.color.textSecondary, transition: `color ${TOKENS.anim.fast}`,
      }}>{label}</label>
      <div style={{
        display: 'flex', alignItems: 'center', gap: 8,
        background: TOKENS.color.surface2, borderRadius: 12,
        border: `1.5px solid ${error ? TOKENS.color.error : focused ? TOKENS.color.accent : TOKENS.color.border}`,
        padding: '0 16px', height: 52, transition: `border-color ${TOKENS.anim.fast}`,
      }}>
        {prefix && <span style={{ color: TOKENS.color.textSecondary, fontSize: 18 }}>{prefix}</span>}
        <input
          type={type} value={value} onChange={e => onChange(e.target.value)}
          onFocus={() => setFocused(true)} onBlur={() => setFocused(false)}
          style={{
            flex: 1, background: 'none', border: 'none', outline: 'none',
            fontFamily: mono ? "'JetBrains Mono', monospace" : "'Inter', sans-serif",
            fontSize: 15, fontWeight: mono ? 600 : 400,
            color: TOKENS.color.textPrimary, textTransform: mono ? 'uppercase' : 'none',
          }}
        />
      </div>
      {error && <span style={{ fontFamily: "'Inter',sans-serif", fontSize: 13, color: TOKENS.color.error }}>{error}</span>}
      {helper && !error && <span style={{ fontFamily: "'Inter',sans-serif", fontSize: 13, color: TOKENS.color.textTertiary }}>{helper}</span>}
    </div>
  );
}

// ── FilterChip ────────────────────────────────────────────────────────────────
function FilterChip({ label, selected, onClick }) {
  return (
    <button onClick={onClick} style={{
      height: 36, padding: '0 14px', borderRadius: 999,
      background: selected ? 'rgba(0,255,148,0.1)' : 'transparent',
      border: `1.5px solid ${selected ? TOKENS.color.accent : TOKENS.color.border}`,
      color: selected ? TOKENS.color.accent : TOKENS.color.textSecondary,
      fontFamily: "'Inter', sans-serif", fontSize: 13, fontWeight: 500,
      cursor: 'pointer', whiteSpace: 'nowrap', flexShrink: 0,
      transition: `all ${TOKENS.anim.fast}`,
    }}>{label}</button>
  );
}

// ── Toggle ────────────────────────────────────────────────────────────────────
function Toggle({ on, onChange }) {
  return (
    <div onClick={() => onChange(!on)} style={{
      width: 50, height: 28, borderRadius: 999,
      background: on ? TOKENS.color.accent : TOKENS.color.border,
      position: 'relative', cursor: 'pointer',
      transition: `background ${TOKENS.anim.base}`, flexShrink: 0,
    }}>
      <div style={{
        width: 22, height: 22, borderRadius: '50%',
        background: on ? TOKENS.color.bg : TOKENS.color.textTertiary,
        position: 'absolute', top: 3,
        left: on ? 25 : 3, transition: `left ${TOKENS.anim.base}`,
      }} />
    </div>
  );
}

// ── Avatar ────────────────────────────────────────────────────────────────────
function Avatar({ size=40, src, initials='AN', color=TOKENS.color.accent }) {
  return (
    <div style={{
      width: size, height: size, borderRadius: '50%',
      background: src ? `url(${src})` : `linear-gradient(135deg, ${color}33, ${color}66)`,
      border: `1.5px solid ${color}44`,
      display: 'flex', alignItems: 'center', justifyContent: 'center',
      flexShrink: 0,
      fontFamily: "'Inter', sans-serif", fontSize: size * 0.36,
      fontWeight: 700, color: color,
    }}>
      {!src && initials}
    </div>
  );
}

// ── SkeletonBlock ─────────────────────────────────────────────────────────────
function Skeleton({ width='100%', height=16, radius=8 }) {
  return (
    <div style={{
      width, height, borderRadius: radius,
      background: 'linear-gradient(90deg, #1F1F26 25%, #26262E 50%, #1F1F26 75%)',
      backgroundSize: '200% 100%',
      animation: 'skeleton-shimmer 1.2s linear infinite',
    }} />
  );
}

// ── EmptyState ─────────────────────────────────────────────────────────────────
function EmptyState({ icon, headline, sub, cta, onCta }) {
  return (
    <div style={{
      display: 'flex', flexDirection: 'column', alignItems: 'center',
      justifyContent: 'center', gap: 16, padding: '48px 32px', textAlign: 'center',
    }}>
      <div style={{ opacity: 0.25, color: TOKENS.color.textPrimary }}>{icon}</div>
      <div>
        <div style={{
          fontFamily: "'Inter', sans-serif", fontSize: 18, fontWeight: 600,
          color: TOKENS.color.textPrimary, marginBottom: 8,
        }}>{headline}</div>
        <div style={{
          fontFamily: "'Inter', sans-serif", fontSize: 15, color: TOKENS.color.textSecondary,
        }}>{sub}</div>
      </div>
      {cta && (
        <Btn variant="primary" size="md" onClick={onCta}>{cta}</Btn>
      )}
    </div>
  );
}

// ── BottomTabBar ──────────────────────────────────────────────────────────────
function BottomTabBar({ active, onNavigate }) {
  const tabs = [
    { id: 'home', label: 'Home', icon: CompassIcon },
    { id: 'trips', label: 'Trips', icon: RouteIcon },
    { id: 'workspaces', label: 'Spaces', icon: MapPinIcon },
    { id: 'vault', label: 'Vault', icon: FolderIcon },
  ];
  return (
    <div style={{
      position: 'absolute', bottom: 0, left: 0, right: 0,
      height: 84, background: TOKENS.color.bg,
      borderTop: '1px solid #26262E',
      display: 'flex', alignItems: 'flex-start',
      paddingTop: 10, paddingBottom: 20,
      paddingLeft: 0, paddingRight: 0,
    }}>
      {tabs.map(tab => {
        const isActive = active === tab.id;
        const Icon = tab.icon;
        return (
          <button key={tab.id} onClick={() => onNavigate(tab.id)} style={{
            flex: 1, display: 'flex', flexDirection: 'column',
            alignItems: 'center', gap: 4,
            background: 'none', border: 'none', cursor: 'pointer',
            padding: '4px 0',
          }}>
            <Icon size={22} color={isActive ? TOKENS.color.accent : TOKENS.color.textTertiary} fill={isActive ? TOKENS.color.accent : 'none'} />
            <span style={{
              fontFamily: "'Inter', sans-serif", fontSize: 10, fontWeight: 500,
              color: isActive ? TOKENS.color.textPrimary : TOKENS.color.textTertiary,
            }}>{tab.label}</span>
          </button>
        );
      })}
    </div>
  );
}

// ── Micro label ───────────────────────────────────────────────────────────────
function MicroLabel({ children, color }) {
  return (
    <span style={{
      fontFamily: "'JetBrains Mono', monospace",
      fontSize: 11, fontWeight: 600,
      color: color || TOKENS.color.textTertiary,
      letterSpacing: '0.08em',
      textTransform: 'uppercase',
    }}>{children}</span>
  );
}

function MonoText({ children, size=15, weight=400, color=TOKENS.color.textPrimary }) {
  return (
    <span style={{
      fontFamily: "'JetBrains Mono', monospace",
      fontSize: size, fontWeight: weight, color,
    }}>{children}</span>
  );
}

// ── Icon primitives (hand-drawn SVG for portability) ───────────────────────
function CompassIcon({ size=24, color=TOKENS.color.textPrimary, fill='none' }) {
  return (
    <svg width={size} height={size} viewBox="0 0 24 24" fill={fill} stroke={color} strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round">
      <circle cx="12" cy="12" r="10"/>
      <polygon points="16.24 7.76 14.12 14.12 7.76 16.24 9.88 9.88 16.24 7.76"/>
    </svg>
  );
}
function RouteIcon({ size=24, color=TOKENS.color.textPrimary, fill='none' }) {
  return (
    <svg width={size} height={size} viewBox="0 0 24 24" fill="none" stroke={color} strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round">
      <circle cx="6" cy="19" r="3"/><path d="M9 19h8.5a3.5 3.5 0 0 0 0-7h-11a3.5 3.5 0 0 1 0-7H15"/><circle cx="18" cy="5" r="3"/>
    </svg>
  );
}
function MapPinIcon({ size=24, color=TOKENS.color.textPrimary, fill='none' }) {
  return (
    <svg width={size} height={size} viewBox="0 0 24 24" fill={fill===TOKENS.color.accent?TOKENS.color.accent:'none'} stroke={color} strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round">
      <path d="M21 10c0 7-9 13-9 13s-9-6-9-13a9 9 0 0 1 18 0z"/><circle cx="12" cy="10" r="3"/>
    </svg>
  );
}
function FolderIcon({ size=24, color=TOKENS.color.textPrimary, fill='none' }) {
  return (
    <svg width={size} height={size} viewBox="0 0 24 24" fill={fill===TOKENS.color.accent?TOKENS.color.accent:'none'} stroke={color} strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round">
      <path d="M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z"/>
    </svg>
  );
}
function PlaneIcon({ size=20, color=TOKENS.color.textPrimary }) {
  return (
    <svg width={size} height={size} viewBox="0 0 24 24" fill="none" stroke={color} strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round">
      <path d="M17.8 19.2 16 11l3.5-3.5C21 6 21 4 19 2c-2-2-4-2-5.5-.5L10 5 1.8 6.2a1 1 0 0 0-.5 1.7l.5.5 5 2.1 2.1 5 .5.5a1 1 0 0 0 1.7-.5z"/>
    </svg>
  );
}
function BedIcon({ size=20, color=TOKENS.color.textPrimary }) {
  return (
    <svg width={size} height={size} viewBox="0 0 24 24" fill="none" stroke={color} strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round">
      <path d="M2 4v16"/><path d="M2 8h18a2 2 0 0 1 2 2v10"/><path d="M2 17h20"/><path d="M6 8v9"/>
    </svg>
  );
}
function LaptopIcon({ size=20, color=TOKENS.color.textPrimary }) {
  return (
    <svg width={size} height={size} viewBox="0 0 24 24" fill="none" stroke={color} strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round">
      <path d="M20 16V7a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v9m16 0H4m16 0 1.28 2.55a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45L4 16"/>
    </svg>
  );
}
function ChevronRightIcon({ size=20, color=TOKENS.color.textTertiary }) {
  return (
    <svg width={size} height={size} viewBox="0 0 24 24" fill="none" stroke={color} strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round">
      <polyline points="9 18 15 12 9 6"/>
    </svg>
  );
}
function PlusIcon({ size=20, color=TOKENS.color.bg }) {
  return (
    <svg width={size} height={size} viewBox="0 0 24 24" fill="none" stroke={color} strokeWidth="2" strokeLinecap="round">
      <line x1="12" y1="5" x2="12" y2="19"/><line x1="5" y1="12" x2="19" y2="12"/>
    </svg>
  );
}
function ArrowLeftIcon({ size=22, color=TOKENS.color.textPrimary }) {
  return (
    <svg width={size} height={size} viewBox="0 0 24 24" fill="none" stroke={color} strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round">
      <line x1="19" y1="12" x2="5" y2="12"/><polyline points="12 19 5 12 12 5"/>
    </svg>
  );
}
function SearchIcon({ size=20, color=TOKENS.color.textTertiary }) {
  return (
    <svg width={size} height={size} viewBox="0 0 24 24" fill="none" stroke={color} strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round">
      <circle cx="11" cy="11" r="8"/><line x1="21" y1="21" x2="16.65" y2="16.65"/>
    </svg>
  );
}
function HeartIcon({ size=20, color=TOKENS.color.textTertiary, filled=false }) {
  return (
    <svg width={size} height={size} viewBox="0 0 24 24" fill={filled?TOKENS.color.accent:'none'} stroke={filled?TOKENS.color.accent:color} strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round">
      <path d="M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z"/>
    </svg>
  );
}
function StarIcon({ size=20, color=TOKENS.color.warn, filled=false }) {
  return (
    <svg width={size} height={size} viewBox="0 0 24 24" fill={filled?TOKENS.color.warn:'none'} stroke={color} strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round">
      <polygon points="12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"/>
    </svg>
  );
}
function WifiIcon({ size=16, color=TOKENS.color.accent }) {
  return (
    <svg width={size} height={size} viewBox="0 0 24 24" fill="none" stroke={color} strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round">
      <path d="M5 12.55a11 11 0 0 1 14.08 0"/><path d="M1.42 9a16 16 0 0 1 21.16 0"/><path d="M8.53 16.11a6 16 0 0 1 6.95 0"/><line x1="12" y1="20" x2="12.01" y2="20"/>
    </svg>
  );
}
function ShareIcon({ size=20, color=TOKENS.color.textPrimary }) {
  return (
    <svg width={size} height={size} viewBox="0 0 24 24" fill="none" stroke={color} strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round">
      <circle cx="18" cy="5" r="3"/><circle cx="6" cy="12" r="3"/><circle cx="18" cy="19" r="3"/>
      <line x1="8.59" y1="13.51" x2="15.42" y2="17.49"/><line x1="15.41" y1="6.51" x2="8.59" y2="10.49"/>
    </svg>
  );
}
function GlobeIcon({ size=64, color=TOKENS.color.textPrimary }) {
  return (
    <svg width={size} height={size} viewBox="0 0 24 24" fill="none" stroke={color} strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round">
      <circle cx="12" cy="12" r="10"/><line x1="2" y1="12" x2="22" y2="12"/>
      <path d="M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"/>
    </svg>
  );
}
function NavigationIcon({ size=20, color=TOKENS.color.textPrimary }) {
  return (
    <svg width={size} height={size} viewBox="0 0 24 24" fill="none" stroke={color} strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round">
      <polygon points="3 11 22 2 13 21 11 13 3 11"/>
    </svg>
  );
}
function CalendarIcon({ size=20, color=TOKENS.color.textPrimary }) {
  return (
    <svg width={size} height={size} viewBox="0 0 24 24" fill="none" stroke={color} strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round">
      <rect x="3" y="4" width="18" height="18" rx="2" ry="2"/><line x1="16" y1="2" x2="16" y2="6"/><line x1="8" y1="2" x2="8" y2="6"/><line x1="3" y1="10" x2="21" y2="10"/>
    </svg>
  );
}
function DollarIcon({ size=20, color=TOKENS.color.textPrimary }) {
  return (
    <svg width={size} height={size} viewBox="0 0 24 24" fill="none" stroke={color} strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round">
      <line x1="12" y1="1" x2="12" y2="23"/><path d="M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6"/>
    </svg>
  );
}
function BriefcaseIcon({ size=20, color=TOKENS.color.textPrimary }) {
  return (
    <svg width={size} height={size} viewBox="0 0 24 24" fill="none" stroke={color} strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round">
      <rect x="2" y="7" width="20" height="14" rx="2" ry="2"/><path d="M16 21V5a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v16"/>
    </svg>
  );
}
function ShieldIcon({ size=20, color=TOKENS.color.textPrimary }) {
  return (
    <svg width={size} height={size} viewBox="0 0 24 24" fill="none" stroke={color} strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round">
      <path d="M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z"/>
    </svg>
  );
}
function TicketIcon({ size=20, color=TOKENS.color.textPrimary }) {
  return (
    <svg width={size} height={size} viewBox="0 0 24 24" fill="none" stroke={color} strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round">
      <path d="M2 9a3 3 0 0 1 0 6v2a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-2a3 3 0 0 1 0-6V7a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2Z"/><path d="M13 5v2"/><path d="M13 17v2"/><path d="M13 11v2"/>
    </svg>
  );
}
function UserIcon({ size=20, color=TOKENS.color.textPrimary }) {
  return (
    <svg width={size} height={size} viewBox="0 0 24 24" fill="none" stroke={color} strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round">
      <path d="M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"/><circle cx="12" cy="7" r="4"/>
    </svg>
  );
}
function XIcon({ size=20, color=TOKENS.color.textPrimary }) {
  return (
    <svg width={size} height={size} viewBox="0 0 24 24" fill="none" stroke={color} strokeWidth="1.5" strokeLinecap="round">
      <line x1="18" y1="6" x2="6" y2="18"/><line x1="6" y1="6" x2="18" y2="18"/>
    </svg>
  );
}
function CheckIcon({ size=16, color=TOKENS.color.accent }) {
  return (
    <svg width={size} height={size} viewBox="0 0 24 24" fill="none" stroke={color} strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
      <polyline points="20 6 9 17 4 12"/>
    </svg>
  );
}
function BellIcon({ size=20, color=TOKENS.color.textPrimary }) {
  return (
    <svg width={size} height={size} viewBox="0 0 24 24" fill="none" stroke={color} strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round">
      <path d="M18 8A6 6 0 0 0 6 8c0 7-3 9-3 9h18s-3-2-3-9"/><path d="M13.73 21a2 2 0 0 1-3.46 0"/>
    </svg>
  );
}
function CameraIcon({ size=24, color=TOKENS.color.textTertiary }) {
  return (
    <svg width={size} height={size} viewBox="0 0 24 24" fill="none" stroke={color} strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round">
      <path d="M23 19a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h4l2-3h6l2 3h4a2 2 0 0 1 2 2z"/><circle cx="12" cy="13" r="4"/>
    </svg>
  );
}
function ImageIcon({ size=24, color=TOKENS.color.textTertiary }) {
  return (
    <svg width={size} height={size} viewBox="0 0 24 24" fill="none" stroke={color} strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round">
      <rect x="3" y="3" width="18" height="18" rx="2" ry="2"/><circle cx="8.5" cy="8.5" r="1.5"/>
      <polyline points="21 15 16 10 5 21"/>
    </svg>
  );
}

// Export everything to window
Object.assign(window, {
  StatusPill, Btn, Card, Input, FilterChip, Toggle, Avatar, Skeleton,
  EmptyState, BottomTabBar, MicroLabel, MonoText,
  CompassIcon, RouteIcon, MapPinIcon, FolderIcon, PlaneIcon, BedIcon,
  LaptopIcon, ChevronRightIcon, PlusIcon, ArrowLeftIcon, SearchIcon,
  HeartIcon, StarIcon, WifiIcon, ShareIcon, GlobeIcon, NavigationIcon,
  CalendarIcon, DollarIcon, BriefcaseIcon, ShieldIcon, TicketIcon,
  UserIcon, XIcon, CheckIcon, BellIcon, CameraIcon, ImageIcon,
});
