// =============================================================
// Remote& website — shared chrome (Header, Footer, CTAs)
// Mint canvas. Global-only voice.
// =============================================================

const NAV_ITEMS = [
  { label: 'Product', href: '#', cards: [
    {
      eyebrow: 'People OS', title: 'HRMS', href: '/hrms', icon: 'users-round',
      bg: '#2E5119', fg: '#E2F1D2', accent: '#A4CC7C',
      body: 'One unified system of record for your global headcount — every employee, contract, document, and workflow in one place.',
      stat: { value: '11', label: 'HRMS modules' },
      features: [
        { icon: 'network',       label: 'Org chart & headcount',  desc: 'Live reporting lines and approval routes' },
        { icon: 'user-plus',     label: 'Onboarding & offboarding', desc: 'Day-one ready, fully audited exits' },
        { icon: 'calendar-days', label: 'Time off & leave',         desc: 'Local holidays, accruals, balances' },
        { icon: 'file-text',     label: 'Documents & e-sign',       desc: 'Contracts, policies, addenda — signed in-app' },
      ],
      modules: [
        { label: 'People management', icon: 'id-card',            href: '/platform/people-management' },
        { label: 'Onboarding',        icon: 'user-plus',          href: '/platform/onboarding' },
        { label: 'Offboarding',       icon: 'user-minus',         href: '/platform/offboarding' },
        { label: 'Leave management',  icon: 'calendar-days',      href: '/platform/leave-management' },
        { label: 'Compensation',      icon: 'circle-dollar-sign', href: '/platform/compensation' },
        { label: 'Documents',         icon: 'file-text',          href: '/platform/documents' },
        { label: 'Asset management',  icon: 'laptop',             href: '/platform/asset-management' },
      ],
    },
    {
      eyebrow: 'Pay anywhere', title: 'Global workforce', href: '/global-workforce-management', icon: 'globe',
      bg: '#E2F1D2', fg: '#1B3210', accent: '#2E5119',
      body: 'Hire direct employees, EOR staff, and contractors across 150+ countries — paid accurately, in local currency, on time.',
      stat: { value: '150+', label: 'countries covered' },
      features: [
        { icon: 'briefcase',  label: 'Employer of record',  desc: 'Hire without opening an entity' },
        { icon: 'building-2', label: 'Local payroll',       desc: 'Statutory filings handled' },
        { icon: 'handshake',  label: 'Contractors',         desc: 'Compliant agreements & invoices' },
        { icon: 'banknote',   label: 'Multi-currency pay',  desc: 'Local-rail payouts, FX transparent' },
      ],
      modules: [
        { label: 'Local payroll',          icon: 'building-2', href: '/platform/local-payroll' },
        { label: 'Expense reimbursements', icon: 'receipt',    href: '/platform/expense-reimbursements' },
        { label: 'Employer of record',     icon: 'briefcase',  href: '/platform/employer-of-record' },
        { label: 'Remote contractors',     icon: 'handshake',  href: '/platform/remote-contractors' },
      ],
    },
    {
      eyebrow: 'Always-on', title: 'AI agents', href: '/ai', icon: 'sparkles',
      bg: '#F26B4A', fg: '#FFF4EE', accent: '#FFD7C5',
      body: 'Specialist AI agents that run hiring, payroll, and people ops alongside your team — with clear scopes and audit trails.',
      stat: { value: '24/7', label: 'always working' },
      features: [
        { icon: 'wallet',        label: 'Payla — payroll AI', desc: 'Runs cycles, catches anomalies' },
        { icon: 'users',         label: 'Hiring agent',       desc: 'Sourcing, screening, scheduling' },
        { icon: 'life-buoy',     label: 'People ops agent',   desc: 'Answers employees instantly' },
        { icon: 'shield-check',  label: 'Audit-grade trails', desc: 'Every action logged & reviewable' },
      ],
      modules: [
        { label: 'AI agents overview', icon: 'sparkles',       href: '/ai' },
        { label: 'Payla — payroll AI', icon: 'wallet',         href: '/agent-payla' },
        { label: 'Recruitment',        icon: 'search',         href: '/platform/recruitment' },
      ],
    },
  ], footer: [
    { label: 'HRMS overview',    href: '/hrms',                          icon: 'layout-grid' },
    { label: 'See pricing',      href: '/pricing',                       icon: 'tag' },
    { label: 'Book a demo',      href: '/book-a-demo',                   icon: 'calendar' },
    { label: 'Country guides',   href: '/guides',                        icon: 'map' },
    { label: 'Integrations',     href: '/integrations',                  icon: 'plug' },
  ]},
  { label: 'Resources', href: '#', library: {
    headline: 'The global atlas',
    tagline: '85 country guides, calculators, and references — built for teams hiring across borders.',
    countries: [
      { code: 'eg', name: 'Egypt',              flag: '🇪🇬', slug: 'egypt' },
      { code: 'sa', name: 'Saudi Arabia',       flag: '🇸🇦', slug: 'saudi-arabia' },
      { code: 'ae', name: 'United Arab Emirates', flag: '🇦🇪', slug: 'united-arab-emirates' },
      { code: 'kw', name: 'Kuwait',             flag: '🇰🇼', slug: 'kuwait' },
      { code: 'bh', name: 'Bahrain',            flag: '🇧🇭', slug: 'bahrain' },
      { code: 'qa', name: 'Qatar',              flag: '🇶🇦', slug: 'qatar' },
      { code: 'jo', name: 'Jordan',             flag: '🇯🇴', slug: 'jordan' },
      { code: 'ma', name: 'Morocco',            flag: '🇲🇦', slug: 'morocco' },
      { code: 'tn', name: 'Tunisia',            flag: '🇹🇳', slug: 'tunisia' },
      { code: 'gb', name: 'United Kingdom',     flag: '🇬🇧', slug: 'united-kingdom' },
      { code: 'de', name: 'Germany',            flag: '🇩🇪', slug: 'germany' },
      { code: 'fr', name: 'France',             flag: '🇫🇷', slug: 'france' },
      { code: 'es', name: 'Spain',              flag: '🇪🇸', slug: 'spain' },
      { code: 'it', name: 'Italy',              flag: '🇮🇹', slug: 'italy' },
      { code: 'nl', name: 'Netherlands',        flag: '🇳🇱', slug: 'netherlands' },
      { code: 'ie', name: 'Ireland',            flag: '🇮🇪', slug: 'ireland' },
      { code: 'ca', name: 'Canada',             flag: '🇨🇦', slug: 'canada' },
      { code: 'br', name: 'Brazil',             flag: '🇧🇷', slug: 'brazil' },
      { code: 'mx', name: 'Mexico',             flag: '🇲🇽', slug: 'mexico' },
      { code: 'in', name: 'India',              flag: '🇮🇳', slug: 'india' },
      { code: 'sg', name: 'Singapore',          flag: '🇸🇬', slug: 'singapore' },
      { code: 'au', name: 'Australia',          flag: '🇦🇺', slug: 'australia' },
    ],
    tools: [
      { title: 'Cost calculator', desc: 'See the all-in monthly cost of an employee anywhere', icon: 'calculator', href: '/tools/cost-calculator', tag: 'Live' },
      { title: 'Country tools',   desc: 'Quick calculators for country-specific tasks',         icon: 'wrench',     href: '/country-tools',         tag: 'Soon' },
    ],
    topics: ['Payroll taxes', 'Statutory leave', 'Bonus rules', 'Termination', 'Equity & options', 'Benefits'],
  }, footer: [
    { label: 'See pricing',    href: '/pricing',      icon: 'tag' },
    { label: 'Book a demo',    href: '/book-a-demo',  icon: 'calendar' },
    { label: 'Country guides', href: '/guides',       icon: 'map' },
    { label: 'Integrations',   href: '/integrations', icon: 'plug' },
  ]},
  { label: 'Pricing', href: '/pricing' },
];

const NavDropdown = ({ label, items, groups, cards, footer, library }) => {
  const [open, setOpen] = React.useState(false);
  const [headerEl, setHeaderEl] = React.useState(null);
  const ref = React.useRef(null);
  const closeTimer = React.useRef(null);
  const cancelClose = () => { if (closeTimer.current) { clearTimeout(closeTimer.current); closeTimer.current = null; } };
  const scheduleClose = () => { cancelClose(); closeTimer.current = setTimeout(() => setOpen(false), 180); };
  React.useEffect(() => {
    const handler = (e) => {
      if (!ref.current) return;
      if (ref.current.contains(e.target)) return;
      const panel = document.querySelector('[data-nav-panel]');
      if (panel && panel.contains(e.target)) return;
      setOpen(false);
    };
    document.addEventListener('mousedown', handler);
    if (ref.current) setHeaderEl(ref.current.closest('header'));
    return () => { document.removeEventListener('mousedown', handler); cancelClose(); };
  }, []);
  React.useEffect(() => {
    if (open && window.lucide && window.lucide.createIcons) window.lucide.createIcons();
  }, [open]);
  const isMega = !!(cards || groups || library);
  const linkStyle = { display: 'block', padding: '8px 12px', fontSize: 13, fontWeight: 500, color: '#111210', textDecoration: 'none', borderRadius: 8 };
  const Link = (it) => (
    <a key={it.label} href={it.href} style={linkStyle}
      onMouseOver={e => e.currentTarget.style.background = '#E2F1D2'}
      onMouseOut={e => e.currentTarget.style.background = 'transparent'}>
      {it.label}
    </a>
  );
  return (
    <div ref={ref} style={{ position: 'relative' }}
      onMouseEnter={() => { cancelClose(); setOpen(true); }}
      onMouseLeave={scheduleClose}>
      <button onClick={() => setOpen(o => !o)}
        style={{ background: 'none', border: 'none', cursor: 'pointer', color: '#111210', fontSize: 13, fontWeight: 500, padding: '4px 0', display: 'flex', alignItems: 'center', gap: 4, fontFamily: 'inherit' }}>
        {label}
        <i data-lucide="chevron-down" style={{ width: 13, height: 13, opacity: 0.6, transition: 'transform 0.15s', transform: open ? 'rotate(180deg)' : 'none' }}></i>
      </button>
      {open && (() => {
        const panel = (
          <div data-nav-panel={isMega ? '' : undefined} onMouseEnter={cancelClose} onMouseLeave={scheduleClose} style={{ position: 'absolute', top: '100%', left: isMega ? 0 : 0, right: isMega ? 0 : 'auto', paddingTop: isMega ? 0 : 10, zIndex: 100 }}>
        <div style={{ background: '#FAFAF7', border: '1px solid #E3E8DD', borderRadius: isMega ? 0 : 16, borderTop: isMega ? 'none' : undefined, borderLeft: isMega ? 'none' : undefined, borderRight: isMega ? 'none' : undefined, boxShadow: '0 24px 56px rgba(17,18,16,0.14)', padding: isMega ? '14px 0 14px' : 8, minWidth: isMega ? 0 : 220 }}>
          {cards ? (
            <div style={{ maxWidth: 'var(--max-w-wide, 1200px)', margin: '0 auto', padding: '0 28px' }}>
              <div style={{ display: 'grid', gridTemplateColumns: `repeat(${cards.length}, 1fr)`, gap: 12 }}>
              {cards.map(c => (
                <div key={c.title}
                  style={{ position: 'relative', minWidth: 0, background: c.bg, color: c.fg, borderRadius: 16, padding: 16, display: 'flex', flexDirection: 'column', transition: 'transform 0.2s', boxSizing: 'border-box', overflow: 'hidden', whiteSpace: 'normal' }}
                  onMouseOver={e => { e.currentTarget.style.transform = 'translateY(-4px)'; const a = e.currentTarget.querySelector('[data-arrow]'); if (a) a.style.transform = 'translateX(4px)'; }}
                  onMouseOut={e => { e.currentTarget.style.transform = 'none'; const a = e.currentTarget.querySelector('[data-arrow]'); if (a) a.style.transform = 'none'; }}>
                  <div aria-hidden="true" style={{ position: 'absolute', right: -40, top: -40, width: 180, height: 180, borderRadius: '50%', background: c.accent, opacity: 0.22 }}></div>
                  <div aria-hidden="true" style={{ position: 'absolute', right: -16, bottom: -16, width: 90, height: 90, borderRadius: '50%', background: c.accent, opacity: 0.14 }}></div>
                  <div style={{ position: 'relative', display: 'flex', alignItems: 'center', justifyContent: 'space-between', marginBottom: 10 }}>
                    <div style={{ width: 34, height: 34, borderRadius: 10, background: 'rgba(255,255,255,0.14)', border: `1px solid ${c.accent}`, display: 'flex', alignItems: 'center', justifyContent: 'center' }}>
                      <i data-lucide={c.icon || 'sparkles'} style={{ width: 16, height: 16, color: c.fg }}></i>
                    </div>
                    {c.stat && (
                      <div style={{ textAlign: 'right' }}>
                        <div style={{ fontFamily: 'var(--font-display)', fontSize: 20, fontWeight: 500, lineHeight: 1, letterSpacing: '-0.02em' }}>{c.stat.value}</div>
                        <div style={{ fontFamily: 'var(--font-mono)', fontSize: 9, letterSpacing: '0.1em', textTransform: 'uppercase', color: c.accent, marginTop: 2 }}>{c.stat.label}</div>
                      </div>
                    )}
                  </div>
                  <div style={{ position: 'relative', fontFamily: 'var(--font-mono)', fontSize: 9.5, letterSpacing: '0.14em', textTransform: 'uppercase', color: c.accent, marginBottom: 4 }}>{c.eyebrow}</div>
                  <div style={{ position: 'relative', fontFamily: 'var(--font-display)', fontSize: 20, fontWeight: 500, letterSpacing: '-0.02em', lineHeight: 1.05, marginBottom: 6 }}>{c.title}</div>
                  <div style={{ position: 'relative', fontSize: 12, lineHeight: 1.4, opacity: 0.88, marginBottom: 10, overflowWrap: 'break-word' }}>{c.body}</div>
                  {c.features && (
                    <ul style={{ position: 'relative', listStyle: 'none', padding: 0, margin: '0 0 10px', display: 'flex', flexDirection: 'column', gap: 5 }}>
                      {c.features.map(f => (
                        <li key={f.label || f} style={{ display: 'flex', alignItems: 'center', gap: 8 }}>
                          <span style={{ flexShrink: 0, width: 20, height: 20, borderRadius: 6, background: 'rgba(255,255,255,0.12)', border: `1px solid ${c.accent}`, display: 'inline-flex', alignItems: 'center', justifyContent: 'center' }}>
                            <i data-lucide={f.icon || 'check'} style={{ width: 11, height: 11, color: c.fg }}></i>
                          </span>
                          <span style={{ fontSize: 11.5, fontWeight: 500, lineHeight: 1.25 }}>{f.label || f}</span>
                        </li>
                      ))}
                    </ul>
                  )}
                  {c.modules && (
                    <div style={{ position: 'relative', paddingTop: 10, marginBottom: 10, borderTop: `1px solid ${c.accent}33` }}>
                      <div style={{ fontFamily: 'var(--font-mono)', fontSize: 8.5, letterSpacing: '0.14em', textTransform: 'uppercase', color: c.accent, marginBottom: 6, opacity: 0.95 }}>Modules</div>
                      <div style={{ display: 'flex', flexWrap: 'wrap', gap: 5 }}>
                        {c.modules.map(m => (
                          <a key={m.label} href={m.href}
                            onClick={e => e.stopPropagation()}
                            style={{ display: 'inline-flex', alignItems: 'center', gap: 5, padding: '4px 9px', borderRadius: 999, background: 'rgba(255,255,255,0.10)', border: `1px solid ${c.accent}66`, color: c.fg, fontSize: 10.5, fontWeight: 500, textDecoration: 'none', transition: 'background 0.15s, border-color 0.15s' }}
                            onMouseOver={e => { e.currentTarget.style.background = 'rgba(255,255,255,0.22)'; e.currentTarget.style.borderColor = c.accent; }}
                            onMouseOut={e => { e.currentTarget.style.background = 'rgba(255,255,255,0.10)'; e.currentTarget.style.borderColor = `${c.accent}66`; }}>
                            <i data-lucide={m.icon || 'circle'} style={{ width: 10, height: 10 }}></i>
                            {m.label}
                          </a>
                        ))}
                      </div>
                    </div>
                  )}
                  <a href={c.href} style={{ position: 'relative', marginTop: 'auto', fontSize: 12, fontWeight: 600, display: 'inline-flex', alignItems: 'center', gap: 5, borderBottom: `1px solid ${c.accent}`, paddingBottom: 2, alignSelf: 'flex-start', color: c.fg, textDecoration: 'none' }}>
                    Explore {c.title} <i data-arrow data-lucide="arrow-right" style={{ width: 12, height: 12, transition: 'transform 0.18s' }}></i>
                  </a>
                </div>
              ))}
              </div>
              {footer && (
                <div style={{ marginTop: 12, paddingTop: 10, borderTop: '1px solid #E3E8DD', display: 'flex', alignItems: 'center', justifyContent: 'space-between', gap: 18, flexWrap: 'wrap' }}>
                  <div style={{ fontFamily: 'var(--font-mono)', fontSize: 10.5, letterSpacing: '0.14em', textTransform: 'uppercase', color: '#6B6F65' }}>Quick links</div>
                  <div style={{ display: 'flex', gap: 8, flexWrap: 'wrap' }}>
                    {footer.map(f => (
                      <a key={f.label} href={f.href}
                        style={{ display: 'inline-flex', alignItems: 'center', gap: 6, padding: '8px 12px', borderRadius: 999, background: '#fff', border: '1px solid #E3E8DD', color: '#111210', fontSize: 12.5, fontWeight: 500, textDecoration: 'none', transition: 'background 0.15s, border-color 0.15s' }}
                        onMouseOver={e => { e.currentTarget.style.background = '#E2F1D2'; e.currentTarget.style.borderColor = '#A4CC7C'; }}
                        onMouseOut={e => { e.currentTarget.style.background = '#fff'; e.currentTarget.style.borderColor = '#E3E8DD'; }}>
                        <i data-lucide={f.icon} style={{ width: 13, height: 13 }}></i>
                        {f.label}
                      </a>
                    ))}
                  </div>
                </div>
              )}
            </div>
          ) : groups ? (
            <div style={{ maxWidth: 'var(--max-w-wide, 1200px)', margin: '0 auto', padding: '0 28px' }}>
              <div style={{ display: 'grid', gridTemplateColumns: `repeat(${groups.length}, 1fr)`, gap: 12 }}>
                {groups.map(g => (
                  <div key={g.title} style={{ position: 'relative', minWidth: 0, background: g.bg || '#fff', borderRadius: 16, padding: 14, overflow: 'hidden', whiteSpace: 'normal', display: 'flex', flexDirection: 'column' }}>
                    <div aria-hidden="true" style={{ position: 'absolute', right: -40, top: -40, width: 150, height: 150, borderRadius: '50%', background: g.tint || g.accent, opacity: 0.22 }}></div>
                    <div aria-hidden="true" style={{ position: 'absolute', right: 30, top: 70, width: 40, height: 40, borderRadius: 10, background: g.tint || g.accent, opacity: 0.14 }}></div>
                    <div aria-hidden="true" style={{ position: 'absolute', right: -10, bottom: -10, width: 70, height: 70, borderRadius: '50%', background: g.tint || g.accent, opacity: 0.12 }}></div>
                    <div style={{ position: 'relative', display: 'flex', alignItems: 'flex-start', justifyContent: 'space-between', gap: 10, marginBottom: 12, paddingBottom: 10, borderBottom: `1px dashed ${g.tint || g.accent}55` }}>
                      <div style={{ display: 'flex', alignItems: 'center', gap: 11, minWidth: 0 }}>
                        <div style={{ position: 'relative', width: 38, height: 38, borderRadius: 11, background: `linear-gradient(135deg, ${g.accent} 0%, ${g.accent}cc 100%)`, display: 'flex', alignItems: 'center', justifyContent: 'center', boxShadow: `0 6px 16px ${g.accent}44, inset 0 1px 0 rgba(255,255,255,0.25)` }}>
                          <i data-lucide={g.icon || 'square'} style={{ width: 18, height: 18, color: '#fff' }}></i>
                        </div>
                        <div style={{ minWidth: 0 }}>
                          <div style={{ display: 'flex', alignItems: 'center', gap: 6 }}>
                            <span style={{ width: 4, height: 4, borderRadius: '50%', background: g.accent }}></span>
                            <div style={{ fontFamily: 'var(--font-mono)', fontSize: 9, letterSpacing: '0.16em', textTransform: 'uppercase', color: g.accent, fontWeight: 600 }}>{g.title}</div>
                          </div>
                          <div style={{ fontFamily: 'var(--font-display)', fontSize: 17, fontWeight: 500, letterSpacing: '-0.025em', lineHeight: 1.1, color: '#111210', marginTop: 2 }}>{g.heading || g.title}</div>
                        </div>
                      </div>
                      {g.stat && (
                        <div style={{ textAlign: 'right', flexShrink: 0, padding: '3px 8px', borderRadius: 8, background: `${g.tint || g.accent}22` }}>
                          <div style={{ fontFamily: 'var(--font-display)', fontSize: 18, fontWeight: 500, lineHeight: 1, letterSpacing: '-0.02em', color: g.accent }}>{g.stat.value}</div>
                          <div style={{ fontFamily: 'var(--font-mono)', fontSize: 8.5, letterSpacing: '0.1em', textTransform: 'uppercase', color: g.accent, opacity: 0.85, marginTop: 2 }}>{g.stat.label}</div>
                        </div>
                      )}
                    </div>
                    {g.tagline && <div style={{ position: 'relative', fontSize: 11.5, lineHeight: 1.4, color: '#3a3d36', marginBottom: 10, opacity: 0.88 }}>{g.tagline}</div>}
                    {g.featured && (
                      <a href={g.featured.href}
                        style={{ position: 'relative', display: 'flex', alignItems: 'center', gap: 11, padding: '11px 12px', borderRadius: 12, background: `linear-gradient(135deg, #fff 0%, ${g.tint || g.accent}1a 100%)`, border: `1px solid ${g.tint || g.accent}99`, textDecoration: 'none', color: '#111210', marginBottom: 12, transition: 'transform 0.18s, box-shadow 0.18s, border-color 0.18s', whiteSpace: 'normal', overflow: 'hidden', boxShadow: `0 1px 0 rgba(255,255,255,0.6) inset, 0 2px 6px ${g.accent}1a` }}
                        onMouseOver={e => { e.currentTarget.style.transform = 'translateY(-2px)'; e.currentTarget.style.boxShadow = `0 10px 24px ${g.accent}33`; e.currentTarget.style.borderColor = g.accent; const arr = e.currentTarget.querySelector('[data-arrow]'); if (arr) arr.style.transform = 'translateX(3px)'; }}
                        onMouseOut={e => { e.currentTarget.style.transform = 'none'; e.currentTarget.style.boxShadow = `0 1px 0 rgba(255,255,255,0.6) inset, 0 2px 6px ${g.accent}1a`; e.currentTarget.style.borderColor = `${g.tint || g.accent}99`; const arr = e.currentTarget.querySelector('[data-arrow]'); if (arr) arr.style.transform = 'none'; }}>
                        <span aria-hidden="true" style={{ position: 'absolute', left: 0, top: 0, bottom: 0, width: 3, background: g.accent }}></span>
                        <span style={{ minWidth: 0, flex: 1, paddingLeft: 4 }}>
                          <span style={{ display: 'flex', alignItems: 'center', gap: 6, flexWrap: 'wrap' }}>
                            <span style={{ fontSize: 13, fontWeight: 600, lineHeight: 1.2, letterSpacing: '-0.005em' }}>{g.featured.title}</span>
                            <span style={{ fontFamily: 'var(--font-mono)', fontSize: 8, letterSpacing: '0.1em', textTransform: 'uppercase', color: '#fff', background: g.accent, padding: '2px 7px', borderRadius: 999, fontWeight: 600 }}>Overview</span>
                          </span>
                          <span style={{ display: 'block', fontSize: 11.5, color: '#4a4e44', lineHeight: 1.35, marginTop: 3 }}>{g.featured.desc}</span>
                        </span>
                        <span data-arrow style={{ flexShrink: 0, width: 24, height: 24, borderRadius: '50%', background: '#fff', border: `1px solid ${g.accent}66`, display: 'inline-flex', alignItems: 'center', justifyContent: 'center', transition: 'transform 0.18s' }}>
                          <i data-lucide="arrow-right" style={{ width: 12, height: 12, color: g.accent }}></i>
                        </span>
                      </a>
                    )}
                    <div style={{ position: 'relative', display: 'flex', flexDirection: 'column', gap: 2 }}>
                      {g.items.map(it => (
                        <a key={it.label} href={it.href}
                          style={{ display: 'flex', alignItems: 'center', gap: 8, padding: '5px 8px', borderRadius: 8, textDecoration: 'none', color: '#111210', transition: 'background 0.15s', whiteSpace: 'normal' }}
                          onMouseOver={e => e.currentTarget.style.background = 'rgba(255,255,255,0.7)'}
                          onMouseOut={e => e.currentTarget.style.background = 'transparent'}>
                          <span style={{ flexShrink: 0, width: 22, height: 22, borderRadius: 6, background: '#fff', border: `1px solid ${g.tint || g.accent}`, display: 'inline-flex', alignItems: 'center', justifyContent: 'center' }}>
                            <i data-lucide={it.icon || 'circle'} style={{ width: 12, height: 12, color: g.accent }}></i>
                          </span>
                          <span style={{ fontSize: 12.5, fontWeight: 500, lineHeight: 1.2, flex: 1 }}>{it.label}</span>
                          <i data-lucide="chevron-right" style={{ width: 11, height: 11, color: g.accent, opacity: 0.5 }}></i>
                        </a>
                      ))}
                    </div>
                  </div>
                ))}
              </div>
              {footer && (
                <div style={{ marginTop: 12, paddingTop: 10, borderTop: '1px solid #E3E8DD', display: 'flex', alignItems: 'center', justifyContent: 'space-between', gap: 18, flexWrap: 'wrap' }}>
                  <div style={{ fontFamily: 'var(--font-mono)', fontSize: 10.5, letterSpacing: '0.14em', textTransform: 'uppercase', color: '#6B6F65' }}>Quick links</div>
                  <div style={{ display: 'flex', gap: 8, flexWrap: 'wrap' }}>
                    {footer.map(f => (
                      <a key={f.label} href={f.href}
                        style={{ display: 'inline-flex', alignItems: 'center', gap: 6, padding: '8px 12px', borderRadius: 999, background: '#fff', border: '1px solid #E3E8DD', color: '#111210', fontSize: 12.5, fontWeight: 500, textDecoration: 'none', transition: 'background 0.15s, border-color 0.15s', whiteSpace: 'normal' }}
                        onMouseOver={e => { e.currentTarget.style.background = '#E2F1D2'; e.currentTarget.style.borderColor = '#A4CC7C'; }}
                        onMouseOut={e => { e.currentTarget.style.background = '#fff'; e.currentTarget.style.borderColor = '#E3E8DD'; }}>
                        <i data-lucide={f.icon} style={{ width: 13, height: 13 }}></i>
                        {f.label}
                      </a>
                    ))}
                  </div>
                </div>
              )}
            </div>
          ) : library ? (
            <div style={{ maxWidth: 'var(--max-w-wide, 1200px)', margin: '0 auto', padding: '0 28px' }}>
              {/* Header strip — atlas/search style */}
              <div style={{ position: 'relative', display: 'flex', alignItems: 'center', justifyContent: 'space-between', gap: 18, padding: '10px 14px', marginBottom: 12, borderRadius: 14, background: 'linear-gradient(135deg, #2E5119 0%, #1B3210 100%)', color: '#E2F1D2', overflow: 'hidden' }}>
                <div aria-hidden="true" style={{ position: 'absolute', right: -30, top: -30, width: 160, height: 160, borderRadius: '50%', background: '#A4CC7C', opacity: 0.18 }}></div>
                <div aria-hidden="true" style={{ position: 'absolute', right: 120, bottom: -40, width: 100, height: 100, borderRadius: '50%', background: '#74B144', opacity: 0.14 }}></div>
                <div style={{ position: 'relative', display: 'flex', alignItems: 'center', gap: 12 }}>
                  <div style={{ width: 38, height: 38, borderRadius: 10, background: 'rgba(255,255,255,0.12)', border: '1px solid #A4CC7C', display: 'flex', alignItems: 'center', justifyContent: 'center' }}>
                    <i data-lucide="library" style={{ width: 18, height: 18, color: '#E2F1D2' }}></i>
                  </div>
                  <div>
                    <div style={{ fontFamily: 'var(--font-mono)', fontSize: 10, letterSpacing: '0.14em', textTransform: 'uppercase', color: '#FFD86B' }}>Resources</div>
                    <div style={{ fontFamily: 'var(--font-display)', fontSize: 20, fontWeight: 500, letterSpacing: '-0.02em', lineHeight: 1.1, marginTop: 1, color: '#FFFFFF' }}>{library.headline}</div>
                  </div>
                </div>
                <div style={{ position: 'relative', fontSize: 12.5, lineHeight: 1.45, opacity: 0.9, maxWidth: 420, whiteSpace: 'normal' }}>{library.tagline}</div>
                <a href="/guides" style={{ position: 'relative', display: 'inline-flex', alignItems: 'center', gap: 6, padding: '8px 14px', borderRadius: 999, background: '#F26B4A', color: '#fff', fontSize: 12.5, fontWeight: 600, textDecoration: 'none', whiteSpace: 'nowrap', boxShadow: '0 6px 16px rgba(242,107,74,0.32)' }}>
                  <i data-lucide="arrow-right" style={{ width: 13, height: 13 }}></i>
                  Browse all 85
                </a>
              </div>
              {/* Body — 2-column asymmetric: country grid + tools */}
              <div style={{ display: 'grid', gridTemplateColumns: '1.55fr 1fr', gap: 12 }}>
                {/* Country grid */}
                <div style={{ position: 'relative', minWidth: 0, background: '#fff', border: '1px solid #E3E8DD', borderRadius: 14, padding: 14, overflow: 'hidden', whiteSpace: 'normal' }}>
                  <div aria-hidden="true" style={{ position: 'absolute', right: -50, top: -50, width: 180, height: 180, borderRadius: '50%', background: '#E2F1D2', opacity: 0.55 }}></div>
                  <div style={{ position: 'relative', display: 'flex', alignItems: 'center', justifyContent: 'space-between', marginBottom: 10 }}>
                    <div style={{ display: 'flex', alignItems: 'center', gap: 8 }}>
                      <i data-lucide="globe-2" style={{ width: 14, height: 14, color: '#2E5119' }}></i>
                      <div style={{ fontFamily: 'var(--font-mono)', fontSize: 10, letterSpacing: '0.14em', textTransform: 'uppercase', color: '#2E5119' }}>Country guides</div>
                    </div>
                    <a href="/guides" style={{ fontSize: 11.5, fontWeight: 600, color: '#2E5119', textDecoration: 'none', display: 'inline-flex', alignItems: 'center', gap: 4, whiteSpace: 'nowrap' }}>
                      View all <i data-lucide="arrow-right" style={{ width: 11, height: 11 }}></i>
                    </a>
                  </div>
                  <div style={{ position: 'relative', display: 'grid', gridTemplateColumns: 'repeat(4, 1fr)', gap: 6 }}>
                    {library.countries.map(c => (
                      <a key={c.code} href={`/guides/${c.slug}`}
                        style={{ display: 'flex', alignItems: 'center', gap: 8, padding: '8px 10px', borderRadius: 9, border: '1px solid #E3E8DD', background: '#FFFFFF', textDecoration: 'none', color: '#111210', transition: 'transform 0.12s, border-color 0.12s, background 0.12s', whiteSpace: 'normal', minWidth: 0 }}
                        onMouseOver={e => { e.currentTarget.style.background = '#E2F1D2'; e.currentTarget.style.borderColor = '#A4CC7C'; e.currentTarget.style.transform = 'translateY(-1px)'; }}
                        onMouseOut={e => { e.currentTarget.style.background = '#FFFFFF'; e.currentTarget.style.borderColor = '#E3E8DD'; e.currentTarget.style.transform = 'none'; }}>
                        <span style={{ fontSize: 20, lineHeight: 1, flexShrink: 0 }}>{c.flag}</span>
                        <span style={{ fontSize: 12, fontWeight: 600, lineHeight: 1.2, color: '#1B3210', minWidth: 0, overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }}>{c.name}</span>
                      </a>
                    ))}
                  </div>
                  <div style={{ position: 'relative', marginTop: 10, paddingTop: 10, borderTop: '1px dashed #CFD6C7', display: 'flex', alignItems: 'center', gap: 6, flexWrap: 'wrap' }}>
                    <span style={{ fontFamily: 'var(--font-mono)', fontSize: 9.5, letterSpacing: '0.14em', textTransform: 'uppercase', color: '#6B6F65', marginRight: 4 }}>Topics</span>
                    {library.topics.map(t => (
                      <a key={t} href="/guides" style={{ fontSize: 11, color: '#2E5119', textDecoration: 'none', padding: '3px 8px', borderRadius: 999, background: '#E2F1D2', whiteSpace: 'nowrap' }}>{t}</a>
                    ))}
                  </div>
                </div>
                {/* Tools rail */}
                <div style={{ display: 'flex', flexDirection: 'column', gap: 8, minWidth: 0 }}>
                  {library.tools.map(t => (
                    <a key={t.title} href={t.href}
                      style={{ position: 'relative', display: 'flex', gap: 12, padding: 14, borderRadius: 14, background: '#fff', border: '1px solid #E3E8DD', textDecoration: 'none', color: '#111210', transition: 'transform 0.15s, box-shadow 0.15s, border-color 0.15s', overflow: 'hidden', whiteSpace: 'normal', minWidth: 0 }}
                      onMouseOver={e => { e.currentTarget.style.transform = 'translateY(-2px)'; e.currentTarget.style.boxShadow = '0 12px 28px rgba(17,18,16,0.08)'; e.currentTarget.style.borderColor = '#A4CC7C'; }}
                      onMouseOut={e => { e.currentTarget.style.transform = 'none'; e.currentTarget.style.boxShadow = 'none'; e.currentTarget.style.borderColor = '#E3E8DD'; }}>
                      <div aria-hidden="true" style={{ position: 'absolute', right: -20, top: -20, width: 80, height: 80, borderRadius: '50%', background: t.tag === 'Live' ? '#FFE7DD' : '#E6F1F6', opacity: 0.7 }}></div>
                      <div style={{ position: 'relative', flexShrink: 0, width: 42, height: 42, borderRadius: 11, background: t.tag === 'Live' ? '#F26B4A' : '#2E5119', display: 'flex', alignItems: 'center', justifyContent: 'center' }}>
                        <i data-lucide={t.icon} style={{ width: 18, height: 18, color: '#fff' }}></i>
                      </div>
                      <div style={{ position: 'relative', minWidth: 0, flex: 1 }}>
                        <div style={{ display: 'flex', alignItems: 'center', gap: 6, marginBottom: 3 }}>
                          <span style={{ fontFamily: 'var(--font-display)', fontSize: 16, fontWeight: 500, letterSpacing: '-0.01em' }}>{t.title}</span>
                          <span style={{ fontFamily: 'var(--font-mono)', fontSize: 8.5, letterSpacing: '0.1em', textTransform: 'uppercase', padding: '2px 7px', borderRadius: 999, background: t.tag === 'Live' ? '#E2F1D2' : '#F6F7F2', color: t.tag === 'Live' ? '#2E5119' : '#6B6F65' }}>{t.tag}</span>
                        </div>
                        <div style={{ fontSize: 11.5, color: '#6B6F65', lineHeight: 1.4 }}>{t.desc}</div>
                      </div>
                      <i data-lucide="arrow-right" style={{ position: 'relative', width: 14, height: 14, alignSelf: 'center', color: '#2E5119', flexShrink: 0 }}></i>
                    </a>
                  ))}
                  <div style={{ position: 'relative', padding: 12, borderRadius: 12, background: '#F6F7F2', border: '1px dashed #CFD6C7', display: 'flex', alignItems: 'center', gap: 10, whiteSpace: 'normal' }}>
                    <i data-lucide="lightbulb" style={{ width: 16, height: 16, color: '#74B144', flexShrink: 0 }}></i>
                    <div style={{ fontSize: 11.5, lineHeight: 1.4, color: '#3a3d36' }}>More tools dropping monthly. <a href="/contact" style={{ color: '#2E5119', fontWeight: 600 }}>Tell us what you need →</a></div>
                  </div>
                </div>
              </div>
              {footer && (
                <div style={{ marginTop: 14, paddingTop: 12, borderTop: '1px solid #E3E8DD', display: 'flex', alignItems: 'center', justifyContent: 'space-between', gap: 18, flexWrap: 'wrap' }}>
                  <div style={{ fontFamily: 'var(--font-mono)', fontSize: 10.5, letterSpacing: '0.14em', textTransform: 'uppercase', color: '#6B6F65' }}>Quick links</div>
                  <div style={{ display: 'flex', gap: 8, flexWrap: 'wrap' }}>
                    {footer.map(f => (
                      <a key={f.label} href={f.href}
                        style={{ display: 'inline-flex', alignItems: 'center', gap: 6, padding: '8px 12px', borderRadius: 999, background: '#fff', border: '1px solid #E3E8DD', color: '#111210', fontSize: 12.5, fontWeight: 500, textDecoration: 'none', transition: 'background 0.15s, border-color 0.15s', whiteSpace: 'normal' }}
                        onMouseOver={e => { e.currentTarget.style.background = '#E2F1D2'; e.currentTarget.style.borderColor = '#A4CC7C'; }}
                        onMouseOut={e => { e.currentTarget.style.background = '#fff'; e.currentTarget.style.borderColor = '#E3E8DD'; }}>
                        <i data-lucide={f.icon} style={{ width: 13, height: 13 }}></i>
                        {f.label}
                      </a>
                    ))}
                  </div>
                </div>
              )}
            </div>
          ) : items.map(Link)}
        </div>
          </div>
        );
        return isMega && headerEl ? ReactDOM.createPortal(panel, headerEl) : panel;
      })()}
    </div>
  );
};

// ----------------- Header (with mobile menu) -----------------
const SiteHeader = ({ active }) => {
  const [open, setOpen] = React.useState(false);
  const arHref = (typeof window !== 'undefined')
    ? '/ar' + (window.location.pathname === '/' ? '' : window.location.pathname).replace(/\/$/, '')
    : '/ar';

  return (
    <header className="rmh-header">
      <style>{`
        .rmh-header {
          position: sticky; top: 0; z-index: 50;
          background: rgba(250,250,247,0.88);
          backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
          border-bottom: 1px solid rgba(17,18,16,0.06);
        }
        .rmh-header-row {
          max-width: var(--max-w-wide); margin: 0 auto;
          padding: 12px 28px;
          display: flex; align-items: center; gap: 18px;
        }
        .rmh-header-logo img { height: 38px; display: block; }
        @media (max-width: 980px) { .rmh-header-logo img { height: 32px; } }
        @media (max-width: 480px) { .rmh-header-logo img { height: 30px; } }
        .rmh-header-nav {
          display: flex; gap: 18px; flex: 1; min-width: 0;
          justify-content: center; align-items: center;
        }
        .rmh-header-nav a {
          color: #111210; font-size: 13px; font-weight: 500;
          text-decoration: none; position: relative;
          white-space: nowrap; padding: 4px 0;
        }
        .rmh-header-nav a.active { color: #2E5119; }
        .rmh-header-nav a.active::after {
          content: ""; position: absolute; left: 0; right: 0; bottom: -17px;
          height: 2px; background: #F26B4A; border-radius: 1px;
        }
        .rmh-header-cta { display: flex; gap: 6px; align-items: center; flex-shrink: 0; }
        .rmh-header-cta-primary {
          background: #F26B4A; color: #fff; text-decoration: none;
          padding: 9px 16px; border-radius: 11px; font-weight: 600; font-size: 13px;
          box-shadow: 0 6px 16px rgba(242,107,74,0.32); white-space: nowrap;
        }
        .rmh-lang-switch {
          display: inline-flex; align-items: center; justify-content: center;
          background: #F6F7F2; color: #2E5119; text-decoration: none;
          padding: 8px 14px; border-radius: 999px; font-weight: 600; font-size: 13px;
          border: 1px solid #E3E8DD; min-height: 36px;
        }
        .rmh-lang-switch:hover { background: #E2F1D2; border-color: #A4CC7C; }
        .rmh-lang-switch-mobile { display: none; }
        .rmh-header-burger {
          display: none; background: #2E5119; border: none;
          border-radius: 12px; padding: 10px 12px; cursor: pointer; color: #FAFAF7;
          box-shadow: 0 4px 12px rgba(46,81,25,0.22); transition: transform 0.15s ease, box-shadow 0.15s ease;
          min-width: 44px; min-height: 44px;
        }
        .rmh-header-burger:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(46,81,25,0.28); }
        .rmh-header-burger:active { transform: translateY(0); }
        .rmh-mobile-panel { display: none; }
        @media (max-width: 980px) {
          .rmh-header-row { padding: 10px 16px; gap: 12px; justify-content: space-between; }
          .rmh-header-nav { display: none; }
          .rmh-header-cta { margin-left: auto; }
          .rmh-header-burger { display: inline-flex; align-items: center; justify-content: center; }
          .rmh-mobile-panel {
            display: ${open ? 'block' : 'none'};
            position: absolute; left: 0; right: 0; top: 100%;
            background: #FAFAF7; border-bottom: 1px solid rgba(17,18,16,0.08);
            box-shadow: 0 20px 40px rgba(17,18,16,0.10);
            padding: 14px 16px 20px;
          }
          .rmh-mobile-panel a {
            display: block; padding: 14px 8px; font-size: 15px; font-weight: 500;
            color: #111210; text-decoration: none; border-bottom: 1px solid rgba(17,18,16,0.06);
            min-height: 44px;
          }
          .rmh-mobile-panel a.active { color: #2E5119; }
          .rmh-mobile-panel-cta { margin-top: 14px; }
        }
        @media (max-width: 560px) {
          .rmh-header-cta-primary { display: none; }
          .rmh-lang-switch { display: none; }
          .rmh-lang-switch-mobile { display: flex; }
        }
      `}</style>
      <div className="rmh-header-row">
        <a href="index.html" className="rmh-header-logo" style={{ display: 'flex', alignItems: 'center', gap: 8, textDecoration: 'none', flexShrink: 0 }}>
          <img src="/assets/logo-horizontal-mint.svg" alt="Remote&" />
        </a>
        <nav className="rmh-header-nav">
          {NAV_ITEMS.map(n => (n.items || n.groups || n.cards || n.library)
            ? <NavDropdown key={n.label} label={n.label} items={n.items} groups={n.groups} cards={n.cards} library={n.library} footer={n.footer} />
            : <a key={n.label} href={n.href} className={active === n.href ? 'active' : ''}>{n.label}</a>
          )}
        </nav>
        <div className="rmh-header-cta">
          <a href={arHref} className="rmh-lang-switch" aria-label="العربية">ع</a>
          <a href="/book-a-demo" className="rmh-header-cta-primary">Book a demo</a>
          <button className="rmh-header-burger" aria-label="Toggle menu" onClick={() => setOpen(o => !o)}>
            <i data-lucide={open ? 'x' : 'menu'} style={{ width: 20, height: 20 }}></i>
          </button>
        </div>
      </div>
      <div className="rmh-mobile-panel">
        {NAV_ITEMS.flatMap(n => {
          if (n.groups) return n.groups.flatMap(g => [
            <div key={n.label + g.title} style={{ fontFamily: 'var(--font-mono)', fontSize: 10, letterSpacing: '0.1em', textTransform: 'uppercase', color: '#2E5119', padding: '14px 8px 4px' }}>{g.title}</div>,
            ...g.items.map(it => <a key={it.label} href={it.href}>{it.label}</a>),
          ]);
          if (n.cards) return n.cards.flatMap(c => [
            <div key={n.label + c.title} style={{ fontFamily: 'var(--font-mono)', fontSize: 10, letterSpacing: '0.1em', textTransform: 'uppercase', color: '#2E5119', padding: '14px 8px 4px' }}>{c.title}</div>,
            <a key={c.title} href={c.href}>{c.title} overview</a>,
            ...(c.modules || []).map(m => <a key={c.title + m.label} href={m.href}>{m.label}</a>),
          ]);
          if (n.library) return [
            <a key="guides" href="/guides">Country guides</a>,
            ...n.library.tools.map(t => <a key={t.title} href={t.href}>{t.title}</a>),
          ];
          if (n.items) return n.items.map(it => <a key={it.label} href={it.href}>{it.label}</a>);
          return [<a key={n.label} href={n.href} className={active === n.href ? 'active' : ''}>{n.label}</a>];
        })}
        <a className="rmh-mobile-panel-cta" href="/book-a-demo" style={{ background: '#F26B4A', color: '#fff', textAlign: 'center', borderRadius: 12, fontWeight: 600, padding: '14px 16px', borderBottom: 'none' }}>Book a demo</a>
        <a href={arHref} className="rmh-lang-switch-mobile" style={{ display: 'block', textAlign: 'center', background: '#F6F7F2', color: '#2E5119', borderRadius: 12, fontWeight: 600, padding: '12px 16px', marginTop: 10, borderBottom: 'none', border: '1px solid #E3E8DD', textDecoration: 'none' }}>العربية</a>
      </div>
    </header>
  );
};

// ----------------- Top notice strip -----------------
const SiteNotice = () => (
  <div style={{ background: 'linear-gradient(90deg, #2E5119 0%, #15554B 55%, #2E8C7D 100%)', color: '#FFFFFF', padding: '12px clamp(14px, 4vw, 32px)', textAlign: 'center', fontSize: 14, position: 'relative', zIndex: 60, overflow: 'hidden' }}>
    <style>{`
      .rmh-notice-inner { display:inline-flex; align-items:center; gap:12px; flex-wrap:wrap; justify-content:center; row-gap:8px; }
      .rmh-notice-claim { display:inline-flex; align-items:center; gap:6px; background:#FFFFFF; color:#2E5119; text-decoration:none; padding:9px 18px; border-radius:999px; font-size:13px; font-weight:600; min-height:36px; }
      @media (max-width: 560px) {
        .rmh-notice-inner { gap:8px; font-size:12.5px; }
        .rmh-notice-ending { display:none; }
      }
    `}</style>
    <span aria-hidden="true" style={{ position: 'absolute', right: -40, top: -60, fontFamily: 'var(--font-serif)', fontStyle: 'italic', fontSize: 140, color: 'rgba(255,255,255,0.06)', lineHeight: 1, pointerEvents: 'none', userSelect: 'none' }}>&amp;</span>
    <span className="rmh-notice-inner" style={{ position: 'relative' }}>
      <span style={{ background: '#F26B4A', color: '#FFFFFF', fontFamily: 'var(--font-mono)', fontSize: 10.5, padding: '4px 10px', borderRadius: 999, letterSpacing: '0.12em', fontWeight: 700, textTransform: 'uppercase', boxShadow: '0 4px 12px rgba(242,107,74,0.35)' }}>Exclusive launch offer</span>
      <span style={{ fontWeight: 500 }}>
        Free for your first <strong style={{ color: '#FFD86B', fontWeight: 700 }}>30 users</strong> — full HRMS <span style={{ fontFamily: 'var(--font-serif)', fontStyle: 'italic', color: '#FFD86B' }}>&amp;</span> every AI agent.
      </span>
      <span className="rmh-notice-ending" style={{ fontFamily: 'var(--font-mono)', fontSize: 11, color: '#FFD86B', letterSpacing: '0.08em' }}>⏳ Ending soon</span>
      <a href="/book-a-demo" className="rmh-notice-claim">
        Claim it <span aria-hidden="true">→</span>
      </a>
    </span>
  </div>
);

// ----------------- Final CTA band (single, global) -----------------
const FinalCTA = () => (
  <section style={{ background: '#FAFAF7', padding: '88px 0 0' }}>
    <div style={{ maxWidth: 'var(--max-w-wide)', margin: '0 auto', padding: '0 24px' }}>
      <div style={{
        background: '#FFF4DD', borderRadius: 24,
        padding: '40px 32px', display: 'flex',
        alignItems: 'center', gap: 24, flexWrap: 'wrap', justifyContent: 'space-between',
        marginBottom: 80,
      }}>
        <h3 style={{ fontFamily: 'var(--font-serif)', fontStyle: 'italic', fontSize: 'clamp(24px, 3.4vw, 36px)', fontWeight: 400, margin: 0, color: '#1B3210', letterSpacing: '-0.02em' }}>
          See it on your own team.
        </h3>
        <div style={{ display: 'flex', gap: 12, alignItems: 'center', flexWrap: 'wrap' }}>
          <a href="/book-a-demo" style={{ background: '#F26B4A', color: '#fff', textDecoration: 'none', padding: '12px 22px', borderRadius: 12, fontWeight: 600, fontSize: 14, boxShadow: '0 6px 18px rgba(242,107,74,0.28)' }}>Book a demo</a>
        </div>
      </div>
    </div>
  </section>
);

// ----------------- Footer -----------------
const SiteFooter = () => (
  <footer style={{ background: '#C8E6A8', color: '#1B3210', padding: '72px 0 32px' }}>
    <style>{`
      .rmh-footer-grid {
        display: grid;
        grid-template-columns: 2fr 1fr 1fr 1fr;
        gap: 32px; margin-bottom: 48px;
      }
      @media (max-width: 900px) {
        .rmh-footer-grid { grid-template-columns: 1fr 1fr; gap: 28px 24px; }
      }
      @media (max-width: 560px) {
        .rmh-footer-grid { grid-template-columns: 1fr; gap: 24px; }
      }
    `}</style>
    <div style={{ maxWidth: 'var(--max-w-wide)', margin: '0 auto', padding: '0 24px' }}>
      <div className="rmh-footer-grid">
        <div>
          <img src="/assets/logo-horizontal-mint.svg" alt="Remote&" style={{ height: 30 }} />
          <p style={{ marginTop: 16, fontSize: 14, lineHeight: 1.55, color: '#2E5119', maxWidth: 320 }}>
            The AI PeopleOS for hiring, paying, and supporting global teams in 150+ countries.
          </p>
          <div style={{ display: 'flex', gap: 8, marginTop: 18 }}>
            {['linkedin','twitter','github'].map(ic => (
              <span key={ic} style={{ width: 32, height: 32, borderRadius: 8, background: '#FAFAF7', display: 'inline-flex', alignItems: 'center', justifyContent: 'center', color: '#2E5119' }}>
                <i data-lucide={ic} style={{ width: 14, height: 14 }}></i>
              </span>
            ))}
          </div>
        </div>
        {[
          { h: 'Platform', items: [
            { label: 'HRMS', href: 'hrms.html' },
            { label: 'Global workforce', href: 'global-workforce-management.html' },
            { label: 'AI agents', href: 'ai.html' },
            { label: 'Pricing', href: 'pricing.html' },
          ] },
          { h: 'Resources', items: [
            { label: 'Country tools', href: 'country-tools.html' },
            { label: 'Integrations', href: 'integrations.html' },
            { label: 'Trust', href: 'trust.html' },
          ] },
          { h: 'Company', items: [
            { label: 'About', href: '/about' },
            { label: 'Contact', href: '/contact' },
            { label: 'Book a demo', href: '/book-a-demo' },
            { label: 'Terms & Conditions', href: '/legal/terms-and-conditions' },
          ] },
        ].map(col => (
          <div key={col.h}>
            <div style={{ fontFamily: 'var(--font-mono)', fontSize: 10, color: '#2E5119', textTransform: 'uppercase', letterSpacing: '0.08em', marginBottom: 14 }}>{col.h}</div>
            {col.items.map(it => <a key={it.label} href={it.href} style={{ display: 'block', fontSize: 14, color: '#1B3210', padding: '8px 0', textDecoration: 'none', minHeight: 36 }}>{it.label}</a>)}
          </div>
        ))}
      </div>
      <div style={{ borderTop: '1px solid rgba(27,50,16,0.18)', paddingTop: 24, display: 'flex', justifyContent: 'space-between', fontSize: 12, color: '#2E5119', flexWrap: 'wrap', gap: 12 }}>
        <span>© 2026 Remote&amp;.</span>
        <span>Built for global teams.</span>
      </div>
    </div>
  </footer>
);

// ----------------- Small helpers -----------------
const Eyebrow = ({ children, color = '#2E5119' }) => (
  <p style={{
    fontFamily: 'var(--font-mono)', fontSize: 12, fontWeight: 500,
    letterSpacing: '0.08em', textTransform: 'uppercase',
    color, margin: '0 0 16px',
  }}>{children}</p>
);

const Amp = ({ color = '#F26B4A', size = '1.05em' }) => (
  <span style={{ fontFamily: 'var(--font-serif)', fontStyle: 'italic', color, fontSize: size, fontWeight: 400 }}>&amp;</span>
);

// SiteLogoStrip kept as a no-op so any stale pages importing it don't break.
const SiteLogoStrip = () => null;

// Logo tile — renders a brand SVG from Simple Icons CDN with a letter-mark fallback.
// Pass `slug` if it differs from the display name (Simple Icons slug, lowercase, no spaces).
const LogoTile = ({ name, slug, mono = false }) => {
  const [failed, setFailed] = React.useState(false);
  const computedSlug = (slug || name).toLowerCase().replace(/[^a-z0-9]+/g, '');
  const src = mono
    ? `https://cdn.simpleicons.org/${computedSlug}/353833`
    : `https://cdn.simpleicons.org/${computedSlug}`;
  return (
    <div style={{
      background: '#FFFFFF', border: '1px solid #E3E8DD', borderRadius: 12,
      padding: '14px 12px', display: 'flex', alignItems: 'center',
      justifyContent: 'center', gap: 10, minHeight: 56,
    }}>
      {failed ? (
        <span style={{
          width: 22, height: 22, borderRadius: 5,
          background: '#E2F1D2', color: '#2E5119', fontSize: 11, fontWeight: 600,
          display: 'inline-flex', alignItems: 'center', justifyContent: 'center',
        }}>{name[0]}</span>
      ) : (
        <img src={src} alt="" style={{ width: 22, height: 22, objectFit: 'contain' }} onError={() => setFailed(true)} />
      )}
      <span style={{ fontSize: 13, fontWeight: 500, color: '#353833' }}>{name}</span>
    </div>
  );
};

Object.assign(window, { SiteHeader, SiteNotice, SiteFooter, SiteLogoStrip, FinalCTA, Eyebrow, Amp, LogoTile });
