// VendorHub — recruit-focused landing for the ABGS vendor network.
// Audience: truckers, fleets, freight forwarders, customs brokers, warehouses,
//           moving companies, last-mile, drayage, rail intermodal.
// Goal: lead-gen — short interest form is the conversion.
const { useState: useStateVH, useMemo: useMemoVH, useEffect: useEffectVH } = React;

// ─────────────────────────────────────────────────────────────────────────────
//  i18n dictionary — every visible string in this page is keyed here so the
//  global EN ↔ ES toggle flips the whole flow without touching component code.
// ─────────────────────────────────────────────────────────────────────────────
const VH_I18N = {
  en: {
    // Hero
    'hero.eyebrow':       'Vendor Hub · Carrier Network',
    'hero.title.a':       'Run with the ',
    'hero.title.b':       'freight that moves.',
    'hero.lead':          'Truckers, forwarders, brokers, warehouses, and movers — join the ABGS network. Steady volume, reliable Net-30 pay, one dispatcher who knows your trucks. Onboarding in under 10 minutes.',
    'hero.cta.apply':     'Apply to drive with us',
    'hero.cta.preview':   'Preview the load board',
    'hero.stat.vendors':  'active vendors',
    'hero.stat.fum':      'freight under mgmt',
    'hero.stat.countries':'countries',
    'hero.stat.payment':  'on-time payment',
    // Hero card
    'live.label':         'LIVE LOAD BOARD',
    'live.pickup':        'Pickup',
    'live.dropoff':       'Dropoff',
    'live.miles':         'mi',
    'live.posted':        'Posted rate',
    'live.permile':       '/ {rpm} per mile',
    'live.percontainer':  '/ per container',
    'live.allin':         '/ all-in',
    'live.book':          'Book it now',
    // Vendor types — labels & blurbs
    'vt.truckers.label':   'Owner-operators',
    'vt.truckers.blurb':   'Single-truck and small-fleet drivers running OTR or regional.',
    'vt.truckers.p1':      'Steady freight volume',
    'vt.truckers.p2':      'Net-30 reliable pay',
    'vt.truckers.p3':      'Single dispatcher',
    'vt.truckers.p4':      'Driver mobile app',
    'vt.fleets.label':     'Fleets & asset carriers',
    'vt.fleets.blurb':     'Mid-to-large carriers with dedicated lanes and hazmat capable equipment.',
    'vt.fleets.p1':        'Dedicated lanes',
    'vt.fleets.p2':        'Volume contracts',
    'vt.fleets.p3':        'EDI / API integration',
    'vt.fleets.p4':        'Tiered performance bonuses',
    'vt.forwarders.label': 'Freight forwarders',
    'vt.forwarders.blurb': 'Origin and destination agents joining the global ABGS partner network.',
    'vt.forwarders.p1':    'Global network access',
    'vt.forwarders.p2':    'Co-load opportunities',
    'vt.forwarders.p3':    'Reciprocal volume',
    'vt.forwarders.p4':    'Compliance support',
    'vt.brokers.label':    'Customs brokers',
    'vt.brokers.blurb':    'Licensed brokers covering ports we don’t self-file in.',
    'vt.brokers.p1':       'Direct entry routing',
    'vt.brokers.p2':       'Filing volume',
    'vt.brokers.p3':       'Single PO contact',
    'vt.brokers.p4':       'Net-30 settlement',
    'vt.warehouses.label': 'Warehouses & 3PLs',
    'vt.warehouses.blurb': 'Bonded, ambient, cold-chain and FTZ space across the Americas, EU, APAC.',
    'vt.warehouses.p1':    'Capacity utilization',
    'vt.warehouses.p2':    'Long-term storage demand',
    'vt.warehouses.p3':    'Cross-dock flow',
    'vt.warehouses.p4':    'WMS integration',
    'vt.movers.label':     'Moving companies',
    'vt.movers.blurb':     'Residential and commercial movers for international relocations.',
    'vt.movers.p1':        'International leads',
    'vt.movers.p2':        'Origin/destination pairing',
    'vt.movers.p3':        'Survey → quote handoff',
    'vt.movers.p4':        'Insurance partner',
    'vt.lastmile.label':   'Last-mile / final-mile',
    'vt.lastmile.blurb':   'White-glove and threshold delivery, appointment-based.',
    'vt.lastmile.p1':      'Appointment density',
    'vt.lastmile.p2':      'POD via app',
    'vt.lastmile.p3':      'Returns reverse-flow',
    'vt.lastmile.p4':      'Same-day pay option',
    'vt.drayage.label':    'Drayage / port',
    'vt.drayage.blurb':    'Port and rail-ramp drayage with chassis pools.',
    'vt.drayage.p1':       'Steady container flow',
    'vt.drayage.p2':       'Pre-pull authority',
    'vt.drayage.p3':       'Demurrage avoidance fees',
    'vt.drayage.p4':       'Yard visibility',
    'vt.rail.label':       'Rail intermodal',
    'vt.rail.blurb':       'Class I and short-line intermodal partners.',
    'vt.rail.p1':          'IPI / RIPI volume',
    'vt.rail.p2':          'Long-haul base rates',
    'vt.rail.p3':          'Block-stack scheduling',
    'vt.rail.p4':          'Door-to-ramp',
    // Type picker
    'types.eyebrow':       'Who we partner with',
    'types.title':         'Nine vendor types. One onboarding flow.',
    'types.lead':          'Pick what describes you best. We tailor the application, the paperwork, and the value we offer to your line of work.',
    'types.applyAs':       'Apply as {label}',
    'types.requirements':  'Requirements',
    'docs.heading':        'What you’ll need',
    'docs.required':       'REQUIRED',
    'docs.optional':       'OPTIONAL',
    // Docs by type — labels and notes
    'docs.truckers.0.label':   'MC / DOT number',
    'docs.truckers.0.note':    'Active authority ≥ 6 months',
    'docs.truckers.1.label':   'Insurance certificate',
    'docs.truckers.1.note':    '$1M auto liability, $100k cargo',
    'docs.truckers.2.label':   'W-9',
    'docs.truckers.2.note':    'For settlement payments',
    'docs.truckers.3.label':   'Banking / ACH info',
    'docs.truckers.3.note':    'For Net-30 ACH settlement',
    'docs.fleets.0.label':     'MC / DOT number',
    'docs.fleets.0.note':      'Active authority ≥ 12 months',
    'docs.fleets.1.label':     'Fleet insurance',
    'docs.fleets.1.note':      '$1M+ auto, $250k cargo',
    'docs.fleets.2.label':     'Safety scorecard',
    'docs.fleets.2.note':      'CSA / SMS report',
    'docs.fleets.3.label':     'EDI capability',
    'docs.fleets.3.note':      '204/210/214/990',
    'docs.forwarders.0.label': 'E&O insurance',
    'docs.forwarders.0.note':  'Min $1M coverage',
    'docs.forwarders.1.label': 'FMC license / equiv.',
    'docs.forwarders.1.note':  'OTI bond if US-bound trade',
    'docs.forwarders.2.label': 'IATA / CASS code',
    'docs.forwarders.2.note':  'For air freight',
    'docs.forwarders.3.label': 'Agency network refs',
    'docs.forwarders.3.note':  '≥ 3 reciprocal partners',
    'docs.brokers.0.label':    'CHB license number',
    'docs.brokers.0.note':     'CBP-issued, individual or firm',
    'docs.brokers.1.label':    'Customs bond',
    'docs.brokers.1.note':     'Continuous bond preferred',
    'docs.brokers.2.label':    'E&O insurance',
    'docs.brokers.2.note':     '$1M minimum',
    'docs.brokers.3.label':    'Port coverage list',
    'docs.brokers.3.note':     'Where you self-file',
    'docs.warehouses.0.label': 'Facility list & specs',
    'docs.warehouses.0.note':  'Sqft, dock doors, racking',
    'docs.warehouses.1.label': 'WMS info',
    'docs.warehouses.1.note':  'System name, integration mode',
    'docs.warehouses.2.label': 'Insurance certificate',
    'docs.warehouses.2.note':  '$1M general liability',
    'docs.warehouses.3.label': 'Bonded / FTZ status',
    'docs.warehouses.3.note':  'If applicable',
    'docs.movers.0.label':     'USDOT / state license',
    'docs.movers.0.note':      'Household goods authority',
    'docs.movers.1.label':     'Cargo insurance',
    'docs.movers.1.note':      'Released-value or full-value',
    'docs.movers.2.label':     'Packing crew profile',
    'docs.movers.2.note':      'In-house vs contracted',
    'docs.movers.3.label':     'Survey form sample',
    'docs.movers.3.note':      'Pre-move survey output',
    'docs.lastmile.0.label':   'DOT or state authority',
    'docs.lastmile.0.note':    'Where applicable',
    'docs.lastmile.1.label':   'Auto + cargo insurance',
    'docs.lastmile.1.note':    '$500k auto, $50k cargo',
    'docs.lastmile.2.label':   'Background-checked drivers',
    'docs.lastmile.2.note':    'For white-glove tier',
    'docs.lastmile.3.label':   'Mobile device policy',
    'docs.lastmile.3.note':    'For POD app',
    'docs.drayage.0.label':    'MC / DOT number',
    'docs.drayage.0.note':     'Port-approved carrier',
    'docs.drayage.1.label':    'TWIC for drivers',
    'docs.drayage.1.note':     'For port access',
    'docs.drayage.2.label':    'Chassis pool membership',
    'docs.drayage.2.note':     'POOL/PIER/UIIA',
    'docs.drayage.3.label':    'UIIA agreement',
    'docs.drayage.3.note':     'Up-to-date',
    'docs.rail.0.label':       'AAR membership / agent',
    'docs.rail.0.note':        'Class I or short-line',
    'docs.rail.1.label':       'IPI/RIPI service map',
    'docs.rail.1.note':        'Lanes covered',
    'docs.rail.2.label':       'Insurance certificate',
    'docs.rail.2.note':        'Per AAR minimums',
    'docs.rail.3.label':       'EDI capability',
    'docs.rail.3.note':        '404/417/418',
    // Perks
    'perks.eyebrow':       'Why vendors stay',
    'perks.title':         'Six reasons our network keeps growing.',
    'perks.lead':          'We compete for vendors the same way good vendors compete for shippers — with steady volume, fair pay, and humans who answer the phone.',
    'perks.1.title':       'Steady freight volume',
    'perks.1.body':        '$2.4B in annual freight under management means consistent loads — not spot-market scraps. Truckers average 3.2 loads/week from us.',
    'perks.1.unit':        'loads / wk avg',
    'perks.2.title':       'Reliable Net-30 settlement',
    'perks.2.body':        'Predictable Net-30 pay on every load — invoice on delivery, paid on day 30, every time. Factoring partners pre-approved if you need cash sooner.',
    'perks.2.unit':        'every invoice',
    'perks.3.title':       'Dedicated lanes',
    'perks.3.body':        'Earn priority on lanes you run well. Tier 1 carriers see book-it-now offers before the load board posts.',
    'perks.3.unit':        'right of refusal',
    'perks.4.title':       'Mobile app for drivers',
    'perks.4.body':        'Check-in, POD upload, geofenced milestones, settlement statements. Works offline, syncs when you’re back in signal.',
    'perks.4.unit':        '+ Android',
    'perks.5.title':       'Single point of contact',
    'perks.5.body':        'Your dispatcher knows your trucks, your drivers, your preferred lanes. No call centers, no ticket queues, no re-explaining.',
    'perks.5.unit':        'human, every call',
    'perks.6.title':       'Global network access',
    'perks.6.body':        'Forwarders join our 142-agent network across 68 countries. Reciprocal volume, shared customer accounts, co-load discounts.',
    'perks.6.unit':        'partner agents',
    // Load board
    'lb.eyebrow':          'Live load board · preview',
    'lb.title.a':          'Real loads, posted now.',
    'lb.title.b':          'Sign up to bid or book.',
    'lb.filter.all':       'All',
    'lb.filter.ocean':     'Ocean',
    'lb.filter.air':       'Air',
    'lb.filter.truck':     'Truck',
    'lb.filter.drayage':   'Drayage',
    'lb.filter.rail':      'Rail',
    'lb.sort.priority':    'Sort: Hot first',
    'lb.sort.rpm':         'Sort: best $/unit',
    'lb.sort.miles':       'Sort: Distance',
    'lb.col.load':         'Load #',
    'lb.col.route':        'Origin → Destination',
    'lb.col.equip':        'Equipment',
    'lb.col.miles':        'Miles',
    'lb.col.rate':         'Rate',
    'lb.col.rpm':          '$/unit',
    'lb.cell.perctr':      'per ctr',
    'lb.cell.allin':       'all-in',
    'lb.col.action':       'Action',
    'lb.book':             'Book',
    'lb.label.cutoff':     'Cutoff/Sailing',
    'lb.label.departure':  'Departure',
    'lb.label.pickup':     'Pickup',
    'lb.showing':          'Showing {n} of 1,284 active loads · 312 ocean · 84 air · sign up to see all',
    'lb.unlock':           'Unlock the full board',
    'lb.openPortal':       'Open vendor portal',
    // Tiers
    'tiers.eyebrow':       'Carrier ladder',
    'tiers.title':         'Earn priority by running well.',
    'tiers.lead':          'Every vendor starts at Standard and moves up automatically based on on-time pickup, on-time delivery, claims ratio, and tender acceptance. No politics. The dashboard shows you exactly where you stand.',
    'tiers.label':         'Tier {n}',
    'tiers.1.name':        'Standard',
    'tiers.1.desc':        'Public load board access',
    'tiers.1.p1':          'Browse & bid',
    'tiers.1.p2':          'Net-30 pay',
    'tiers.1.p3':          'Standard dispatch',
    'tiers.2.name':        'Preferred',
    'tiers.2.desc':        'After 25 on-time loads',
    'tiers.2.p1':          'Pre-published lanes',
    'tiers.2.p2':          'Priority Net-30 cycle',
    'tiers.2.p3':          'Dedicated dispatcher',
    'tiers.3.name':        'Tier 1',
    'tiers.3.desc':        'After 100 on-time + 98% score',
    'tiers.3.p1':          'Right of first refusal',
    'tiers.3.p2':          'Volume bonuses',
    'tiers.3.p3':          'Quarterly business review',
    // Signup
    'signup.eyebrow':      'Apply in 2 minutes',
    'signup.title':        'Tell us about your operation.',
    'signup.lead':         'A real human — not a chatbot — will reach out within one business day. If you’re ready to onboard, we’ll send a secure link to upload MC, insurance, and W-9.',
    'signup.bullet.1':     'Response within 1 business day',
    'signup.bullet.2':     'SOC 2 Type II — your docs are encrypted',
    'signup.bullet.3':     'Talk to a dispatcher, never a call queue',
    'signup.support':      'Vendor support',
    'signup.f.name':       'Full name',
    'signup.f.name.ph':    'Maria Gonzalez',
    'signup.f.company':    'Company',
    'signup.f.company.ph': 'Gonzalez Trucking LLC',
    'signup.f.email':      'Work email',
    'signup.f.email.ph':   'maria@gtrucking.com',
    'signup.f.phone':      'Phone',
    'signup.f.phone.ph':   '(305) 555-0142',
    'signup.f.iam':        'I am a...',
    'signup.f.equip':      'Equipment / capacity',
    'signup.f.equip.ph':   'e.g. 12 dry vans, 4 reefers, 25k sqft warehouse',
    'signup.f.lanes':      'Primary lanes / regions',
    'signup.f.lanes.ph':   'e.g. SoCal → Phoenix, Laredo ↔ Memphis',
    'signup.disc':         'By submitting you agree to ABGS’s vendor terms. We’ll only use your info to evaluate the partnership — no marketing spam, ever.',
    'signup.submit':       'Submit application',
    'signup.submitting':   'Submitting…',
    'signup.error.unavail':'Application service unavailable. Please refresh and try again.',
    'signup.error.generic':'Could not submit your application. Please try again.',
    'signup.sent.title':   'We’ll be in touch soon.',
    'signup.sent.body.a':  'Confirmation sent to',
    'signup.sent.body.b':  '. A vendor specialist will reach out within 1 business day.',
    'signup.sent.fallback':'your email',
    'signup.sent.btn':     'Submit another',
    // Final CTA
    'cta.title':           'Steady freight beats the spot market every Monday.',
    'cta.lead':            'Apply once. We’ll match you to lanes you actually want to run.',
    'cta.apply':           'Apply to the network',
    'cta.email':           'Email vendor team',
    // Lanes — equipment + pickup phrasing
    'lane.eq.dryvan53':    'Dry Van 53′',
    'lane.eq.40reefocean': '40′ Reefer · Ocean',
    'lane.eq.hazmat':      'Hazmat Tanker',
    'lane.eq.40reefair':   '40′ Reefer · Air',
    'lane.eq.40hcdray':    '40′ HC Drayage',
    'lane.eq.40hcfcl':     '40′ HC · Ocean FCL',
    'lane.eq.reefer53':    'Reefer 53′',
    'lane.eq.flatbed':     'Flatbed',
    'lane.eq.20drylcl':    '20′ Dry · Ocean LCL',
    'lane.eq.drayrail':    'Drayage → Rail',
    'lane.pk.today1400':   'Today 14:00',
    'lane.pk.cutWed1200':  'Cutoff Wed 12:00',
    'lane.pk.thu0530':     'Thu 05:30',
    'lane.pk.mon2200':     'Mon 22:00 LATAM',
    'lane.pk.today1100':   'Today 11:00',
    'lane.pk.sailSat0600': 'Sails Sat 06:00',
    'lane.pk.tom0600':     'Tomorrow 06:00',
    'lane.pk.sailFri1800': 'Sails Fri 18:00',
    'lane.pk.wed1300':     'Wed 13:00',
    'lane.pk.cutThu1600':  'Cutoff Thu 16:00',
    'lane.pk.wed0930':     'Wed 09:30',
    'lane.pk.cutSun1800':  'Cutoff Sun 18:00',
  },
  es: {
    // Hero
    'hero.eyebrow':       'Centro de Socios · Red de Transportistas',
    'hero.title.a':       'Mueve la ',
    'hero.title.b':       'carga que avanza.',
    'hero.lead':          'Camioneros, agentes de carga, agentes aduanales, almacenes y mudanceras — únete a la red ABGS. Volumen estable, pago confiable Net-30, un solo despachador que conoce tus camiones. Onboarding en menos de 10 minutos.',
    'hero.cta.apply':     'Aplica para manejar con nosotros',
    'hero.cta.preview':   'Ver el tablero de cargas',
    'hero.stat.vendors':  'socios activos',
    'hero.stat.fum':      'carga gestionada',
    'hero.stat.countries':'países',
    'hero.stat.payment':  'pagos a tiempo',
    // Hero card
    'live.label':         'TABLERO EN VIVO',
    'live.pickup':        'Recogida',
    'live.dropoff':       'Entrega',
    'live.miles':         'mi',
    'live.posted':        'Tarifa publicada',
    'live.permile':       '/ {rpm} por milla',
    'live.percontainer':  '/ por contenedor',
    'live.allin':         '/ todo incluido',
    'live.book':          'Reservar ahora',
    // Vendor types
    'vt.truckers.label':   'Operadores propietarios',
    'vt.truckers.blurb':   'Conductores de un camión o flotas pequeñas, OTR o regional.',
    'vt.truckers.p1':      'Volumen de carga estable',
    'vt.truckers.p2':      'Pago Net-30 confiable',
    'vt.truckers.p3':      'Un único despachador',
    'vt.truckers.p4':      'App móvil para conductores',
    'vt.fleets.label':     'Flotas y transportistas con activos',
    'vt.fleets.blurb':     'Transportistas medianos a grandes con rutas dedicadas y equipo apto para hazmat.',
    'vt.fleets.p1':        'Rutas dedicadas',
    'vt.fleets.p2':        'Contratos por volumen',
    'vt.fleets.p3':        'Integración EDI / API',
    'vt.fleets.p4':        'Bonos por desempeño escalonado',
    'vt.forwarders.label': 'Agentes de carga',
    'vt.forwarders.blurb': 'Agentes de origen y destino que se suman a la red global de partners de ABGS.',
    'vt.forwarders.p1':    'Acceso a red global',
    'vt.forwarders.p2':    'Oportunidades de co-load',
    'vt.forwarders.p3':    'Volumen recíproco',
    'vt.forwarders.p4':    'Apoyo en cumplimiento',
    'vt.brokers.label':    'Agentes aduanales',
    'vt.brokers.blurb':    'Agentes con licencia que cubren puertos donde no autodespachamos.',
    'vt.brokers.p1':       'Ruteo de pedimento directo',
    'vt.brokers.p2':       'Volumen de despachos',
    'vt.brokers.p3':       'Un único contacto de PO',
    'vt.brokers.p4':       'Liquidación Net-30',
    'vt.warehouses.label': 'Almacenes y 3PLs',
    'vt.warehouses.blurb': 'Espacio fiscal, ambiente, cadena fría y FTZ en Américas, UE y APAC.',
    'vt.warehouses.p1':    'Utilización de capacidad',
    'vt.warehouses.p2':    'Demanda de almacenaje a largo plazo',
    'vt.warehouses.p3':    'Flujo cross-dock',
    'vt.warehouses.p4':    'Integración con WMS',
    'vt.movers.label':     'Empresas de mudanzas',
    'vt.movers.blurb':     'Mudanceras residenciales y comerciales para reubicaciones internacionales.',
    'vt.movers.p1':        'Leads internacionales',
    'vt.movers.p2':        'Emparejamiento origen/destino',
    'vt.movers.p3':        'Survey → cotización',
    'vt.movers.p4':        'Aliado de seguros',
    'vt.lastmile.label':   'Última milla / final',
    'vt.lastmile.blurb':   'Entrega white-glove y al umbral, con cita previa.',
    'vt.lastmile.p1':      'Densidad de citas',
    'vt.lastmile.p2':      'POD por app',
    'vt.lastmile.p3':      'Devoluciones inversas',
    'vt.lastmile.p4':      'Pago el mismo día',
    'vt.drayage.label':    'Drayage / puerto',
    'vt.drayage.blurb':    'Drayage de puerto y rampa ferroviaria con pools de chasis.',
    'vt.drayage.p1':       'Flujo estable de contenedores',
    'vt.drayage.p2':       'Autoridad de pre-pull',
    'vt.drayage.p3':       'Cargos para evitar demoras',
    'vt.drayage.p4':       'Visibilidad del patio',
    'vt.rail.label':       'Intermodal ferroviario',
    'vt.rail.blurb':       'Partners intermodales Class I y short-line.',
    'vt.rail.p1':          'Volumen IPI / RIPI',
    'vt.rail.p2':          'Tarifas base de larga distancia',
    'vt.rail.p3':          'Programación block-stack',
    'vt.rail.p4':          'Puerta a rampa',
    // Type picker
    'types.eyebrow':       'Con quién nos asociamos',
    'types.title':         'Nueve tipos de socios. Un solo flujo de onboarding.',
    'types.lead':          'Elige lo que mejor te describe. Adaptamos la solicitud, los documentos y el valor que ofrecemos a tu línea de trabajo.',
    'types.applyAs':       'Aplicar como {label}',
    'types.requirements':  'Requisitos',
    'docs.heading':        'Lo que vas a necesitar',
    'docs.required':       'OBLIGATORIO',
    'docs.optional':       'OPCIONAL',
    // Docs by type
    'docs.truckers.0.label':   'Número MC / DOT',
    'docs.truckers.0.note':    'Autoridad activa ≥ 6 meses',
    'docs.truckers.1.label':   'Certificado de seguro',
    'docs.truckers.1.note':    'Responsabilidad auto $1M, carga $100k',
    'docs.truckers.2.label':   'W-9',
    'docs.truckers.2.note':    'Para pagos de liquidación',
    'docs.truckers.3.label':   'Datos bancarios / ACH',
    'docs.truckers.3.note':    'Para liquidación Net-30 ACH',
    'docs.fleets.0.label':     'Número MC / DOT',
    'docs.fleets.0.note':      'Autoridad activa ≥ 12 meses',
    'docs.fleets.1.label':     'Seguro de flota',
    'docs.fleets.1.note':      '$1M+ auto, $250k carga',
    'docs.fleets.2.label':     'Tarjeta de seguridad',
    'docs.fleets.2.note':      'Reporte CSA / SMS',
    'docs.fleets.3.label':     'Capacidad EDI',
    'docs.fleets.3.note':      '204/210/214/990',
    'docs.forwarders.0.label': 'Seguro E&O',
    'docs.forwarders.0.note':  'Cobertura mínima $1M',
    'docs.forwarders.1.label': 'Licencia FMC / equiv.',
    'docs.forwarders.1.note':  'Bono OTI si embarca a EE.UU.',
    'docs.forwarders.2.label': 'Código IATA / CASS',
    'docs.forwarders.2.note':  'Para carga aérea',
    'docs.forwarders.3.label': 'Referencias de red de agentes',
    'docs.forwarders.3.note':  '≥ 3 partners recíprocos',
    'docs.brokers.0.label':    'Número de licencia CHB',
    'docs.brokers.0.note':     'Emitida por CBP, individual o firma',
    'docs.brokers.1.label':    'Bono aduanal',
    'docs.brokers.1.note':     'Bono continuo preferido',
    'docs.brokers.2.label':    'Seguro E&O',
    'docs.brokers.2.note':     'Mínimo $1M',
    'docs.brokers.3.label':    'Lista de puertos cubiertos',
    'docs.brokers.3.note':     'Donde autodespachas',
    'docs.warehouses.0.label': 'Lista de instalaciones y specs',
    'docs.warehouses.0.note':  'Sqft, andenes, racks',
    'docs.warehouses.1.label': 'Información de WMS',
    'docs.warehouses.1.note':  'Nombre del sistema, modo de integración',
    'docs.warehouses.2.label': 'Certificado de seguro',
    'docs.warehouses.2.note':  'Responsabilidad general $1M',
    'docs.warehouses.3.label': 'Estatus fiscal / FTZ',
    'docs.warehouses.3.note':  'Si aplica',
    'docs.movers.0.label':     'Licencia USDOT / estatal',
    'docs.movers.0.note':      'Autoridad de menaje doméstico',
    'docs.movers.1.label':     'Seguro de carga',
    'docs.movers.1.note':      'Released-value o full-value',
    'docs.movers.2.label':     'Perfil del equipo de empaque',
    'docs.movers.2.note':      'Interno vs contratado',
    'docs.movers.3.label':     'Muestra de formato de survey',
    'docs.movers.3.note':      'Resultado del survey previo',
    'docs.lastmile.0.label':   'Autoridad DOT o estatal',
    'docs.lastmile.0.note':    'Donde aplique',
    'docs.lastmile.1.label':   'Seguro auto + carga',
    'docs.lastmile.1.note':    '$500k auto, $50k carga',
    'docs.lastmile.2.label':   'Conductores con verificación',
    'docs.lastmile.2.note':    'Para nivel white-glove',
    'docs.lastmile.3.label':   'Política de dispositivos móviles',
    'docs.lastmile.3.note':    'Para la app de POD',
    'docs.drayage.0.label':    'Número MC / DOT',
    'docs.drayage.0.note':     'Transportista aprobado por puerto',
    'docs.drayage.1.label':    'TWIC para conductores',
    'docs.drayage.1.note':     'Para acceso al puerto',
    'docs.drayage.2.label':    'Membresía en chassis pool',
    'docs.drayage.2.note':     'POOL/PIER/UIIA',
    'docs.drayage.3.label':    'Acuerdo UIIA',
    'docs.drayage.3.note':     'Vigente',
    'docs.rail.0.label':       'Membresía AAR / agente',
    'docs.rail.0.note':        'Class I o short-line',
    'docs.rail.1.label':       'Mapa de servicio IPI/RIPI',
    'docs.rail.1.note':        'Rutas cubiertas',
    'docs.rail.2.label':       'Certificado de seguro',
    'docs.rail.2.note':        'Mínimos según AAR',
    'docs.rail.3.label':       'Capacidad EDI',
    'docs.rail.3.note':        '404/417/418',
    // Perks
    'perks.eyebrow':       'Por qué los socios se quedan',
    'perks.title':         'Seis razones por las que nuestra red sigue creciendo.',
    'perks.lead':          'Competimos por nuestros socios igual que los buenos socios compiten por sus clientes — con volumen estable, pagos justos y humanos que contestan el teléfono.',
    'perks.1.title':       'Volumen estable de carga',
    'perks.1.body':        '$2.4B en carga gestionada al año significa cargas consistentes — no las sobras del spot. Nuestros camioneros promedian 3.2 cargas/semana con nosotros.',
    'perks.1.unit':        'cargas / sem prom.',
    'perks.2.title':       'Liquidación Net-30 confiable',
    'perks.2.body':        'Pago Net-30 predecible en cada carga — facturas al entregar, pagadas el día 30, siempre. Partners de factoring pre-aprobados si necesitas efectivo antes.',
    'perks.2.unit':        'cada factura',
    'perks.3.title':       'Rutas dedicadas',
    'perks.3.body':        'Gana prioridad en las rutas que corres bien. Los carriers Tier 1 ven ofertas book-it-now antes de que la carga se publique.',
    'perks.3.unit':        'derecho de rechazo',
    'perks.4.title':       'App móvil para conductores',
    'perks.4.body':        'Check-in, subida de POD, hitos por geocerca, estados de cuenta. Funciona offline, sincroniza al volver a tener señal.',
    'perks.4.unit':        '+ Android',
    'perks.5.title':       'Un único punto de contacto',
    'perks.5.body':        'Tu despachador conoce tus camiones, tus conductores, tus rutas preferidas. Sin call centers, sin filas de tickets, sin re-explicar nada.',
    'perks.5.unit':        'humano, en cada llamada',
    'perks.6.title':       'Acceso a red global',
    'perks.6.body':        'Los agentes se suman a nuestra red de 142 partners en 68 países. Volumen recíproco, cuentas compartidas, descuentos por co-load.',
    'perks.6.unit':        'agentes aliados',
    // Load board
    'lb.eyebrow':          'Tablero en vivo · vista previa',
    'lb.title.a':          'Cargas reales, publicadas ahora.',
    'lb.title.b':          'Regístrate para ofertar o reservar.',
    'lb.filter.all':       'Todos',
    'lb.filter.ocean':     'Marítimo',
    'lb.filter.air':       'Aéreo',
    'lb.filter.truck':     'Camión',
    'lb.filter.drayage':   'Drayage',
    'lb.filter.rail':      'Ferrocarril',
    'lb.sort.priority':    'Orden: Hot primero',
    'lb.sort.rpm':         'Orden: mejor $/unidad',
    'lb.sort.miles':       'Orden: Distancia',
    'lb.col.load':         'Carga #',
    'lb.col.route':        'Origen → Destino',
    'lb.col.equip':        'Equipo',
    'lb.col.miles':        'Millas',
    'lb.col.rate':         'Tarifa',
    'lb.col.rpm':          '$/unidad',
    'lb.cell.perctr':      'por ctr',
    'lb.cell.allin':       'incluido',
    'lb.col.action':       'Acción',
    'lb.book':             'Reservar',
    'lb.label.cutoff':     'Cierre/Zarpe',
    'lb.label.departure':  'Despegue',
    'lb.label.pickup':     'Recogida',
    'lb.showing':          'Mostrando {n} de 1,284 cargas activas · 312 marítimas · 84 aéreas · regístrate para ver todas',
    'lb.unlock':           'Desbloquear el tablero completo',
    'lb.openPortal':       'Abrir portal de socios',
    // Tiers
    'tiers.eyebrow':       'Escalera de carriers',
    'tiers.title':         'Gana prioridad corriendo bien.',
    'tiers.lead':          'Cada socio empieza en Standard y sube automáticamente según recogida a tiempo, entrega a tiempo, ratio de reclamos y aceptación de tenders. Sin política. El dashboard te muestra exactamente dónde estás.',
    'tiers.label':         'Nivel {n}',
    'tiers.1.name':        'Standard',
    'tiers.1.desc':        'Acceso al tablero público',
    'tiers.1.p1':          'Ver y ofertar',
    'tiers.1.p2':          'Pago Net-30',
    'tiers.1.p3':          'Despacho estándar',
    'tiers.2.name':        'Preferido',
    'tiers.2.desc':        'Tras 25 cargas a tiempo',
    'tiers.2.p1':          'Rutas pre-publicadas',
    'tiers.2.p2':          'Ciclo Net-30 prioritario',
    'tiers.2.p3':          'Despachador dedicado',
    'tiers.3.name':        'Tier 1',
    'tiers.3.desc':        'Tras 100 a tiempo + 98% score',
    'tiers.3.p1':          'Derecho de primer rechazo',
    'tiers.3.p2':          'Bonos por volumen',
    'tiers.3.p3':          'Revisión trimestral del negocio',
    // Signup
    'signup.eyebrow':      'Aplica en 2 minutos',
    'signup.title':        'Cuéntanos sobre tu operación.',
    'signup.lead':         'Una persona real — no un chatbot — te contactará dentro de 1 día hábil. Si estás listo para hacer onboarding, te enviaremos un enlace seguro para subir MC, seguro y W-9.',
    'signup.bullet.1':     'Respuesta en 1 día hábil',
    'signup.bullet.2':     'SOC 2 Type II — tus documentos van encriptados',
    'signup.bullet.3':     'Hablas con un despachador, nunca con una fila',
    'signup.support':      'Soporte para socios',
    'signup.f.name':       'Nombre completo',
    'signup.f.name.ph':    'María González',
    'signup.f.company':    'Empresa',
    'signup.f.company.ph': 'González Trucking SAS',
    'signup.f.email':      'Correo de trabajo',
    'signup.f.email.ph':   'maria@gtrucking.com',
    'signup.f.phone':      'Teléfono',
    'signup.f.phone.ph':   '(305) 555-0142',
    'signup.f.iam':        'Soy un...',
    'signup.f.equip':      'Equipo / capacidad',
    'signup.f.equip.ph':   'p. ej. 12 furgones, 4 refrigerados, 25k sqft de almacén',
    'signup.f.lanes':      'Rutas / regiones principales',
    'signup.f.lanes.ph':   'p. ej. SoCal → Phoenix, Laredo ↔ Memphis',
    'signup.disc':         'Al enviar aceptas los términos para socios de ABGS. Solo usaremos tu información para evaluar la alianza — sin spam de marketing, jamás.',
    'signup.submit':       'Enviar solicitud',
    'signup.submitting':   'Enviando…',
    'signup.error.unavail':'Servicio de aplicaciones no disponible. Por favor recarga e intenta de nuevo.',
    'signup.error.generic':'No pudimos enviar tu solicitud. Por favor intenta de nuevo.',
    'signup.sent.title':   'Te contactaremos pronto.',
    'signup.sent.body.a':  'Confirmación enviada a',
    'signup.sent.body.b':  '. Un especialista de socios se pondrá en contacto dentro de 1 día hábil.',
    'signup.sent.fallback':'tu correo',
    'signup.sent.btn':     'Enviar otra',
    // Final CTA
    'cta.title':           'La carga estable le gana al spot todos los lunes.',
    'cta.lead':            'Aplica una vez. Te emparejamos con las rutas que de verdad quieres correr.',
    'cta.apply':           'Aplicar a la red',
    'cta.email':           'Escribir al equipo de socios',
    // Lanes — equipment + pickup phrasing
    'lane.eq.dryvan53':    'Furgón seco 53′',
    'lane.eq.40reefocean': '40′ Refrigerado · Marítimo',
    'lane.eq.hazmat':      'Cisterna Hazmat',
    'lane.eq.40reefair':   '40′ Refrigerado · Aéreo',
    'lane.eq.40hcdray':    '40′ HC Drayage',
    'lane.eq.40hcfcl':     '40′ HC · FCL Marítimo',
    'lane.eq.reefer53':    'Refrigerado 53′',
    'lane.eq.flatbed':     'Plataforma',
    'lane.eq.20drylcl':    '20′ Seco · LCL Marítimo',
    'lane.eq.drayrail':    'Drayage → Ferrocarril',
    'lane.pk.today1400':   'Hoy 14:00',
    'lane.pk.cutWed1200':  'Cierre Mié 12:00',
    'lane.pk.thu0530':     'Jue 05:30',
    'lane.pk.mon2200':     'Lun 22:00 LATAM',
    'lane.pk.today1100':   'Hoy 11:00',
    'lane.pk.sailSat0600': 'Zarpa Sáb 06:00',
    'lane.pk.tom0600':     'Mañana 06:00',
    'lane.pk.sailFri1800': 'Zarpa Vie 18:00',
    'lane.pk.wed1300':     'Mié 13:00',
    'lane.pk.cutThu1600':  'Cierre Jue 16:00',
    'lane.pk.wed0930':     'Mié 09:30',
    'lane.pk.cutSun1800':  'Cierre Dom 18:00',
  },
};

// Hook used by every VH* section. Subscribes to the global language toggle so
// re-renders flow when the user switches EN ↔ ES.
function useVhT() {
  const i18n = (window.__useI18n && window.__useI18n()) || { lang: 'en' };
  const lang = (VH_I18N[i18n.lang] ? i18n.lang : 'en');
  return (key, vars) => {
    let val = VH_I18N[lang][key] !== undefined
      ? VH_I18N[lang][key]
      : (VH_I18N.en[key] !== undefined ? VH_I18N.en[key] : key);
    if (vars && typeof val === 'string') {
      Object.keys(vars).forEach(k => { val = val.split('{' + k + '}').join(vars[k]); });
    }
    return val;
  };
}

// ---------- Data builders ----------
const VH_VENDOR_TYPE_IDS = ['truckers','fleets','forwarders','brokers','warehouses','movers','lastmile','drayage','rail'];
const VH_VENDOR_TYPE_ICONS = {
  truckers: 'truck', fleets: 'truck', forwarders: 'globe', brokers: 'shieldCheck',
  warehouses: 'warehouse', movers: 'homeMove', lastmile: 'pin', drayage: 'container', rail: 'stack',
};
function vhVendorTypes(t) {
  return VH_VENDOR_TYPE_IDS.map(id => ({
    id,
    icon: VH_VENDOR_TYPE_ICONS[id],
    label: t(`vt.${id}.label`),
    blurb: t(`vt.${id}.blurb`),
    perks: [t(`vt.${id}.p1`), t(`vt.${id}.p2`), t(`vt.${id}.p3`), t(`vt.${id}.p4`)],
  }));
}

function vhPerks(t) {
  return [
    { icon: 'shipments', stat: '3.2',    title: t('perks.1.title'), body: t('perks.1.body'), statUnit: t('perks.1.unit') },
    { icon: 'coins',     stat: 'Net-30', title: t('perks.2.title'), body: t('perks.2.body'), statUnit: t('perks.2.unit') },
    { icon: 'pin',       stat: '1st',    title: t('perks.3.title'), body: t('perks.3.body'), statUnit: t('perks.3.unit') },
    { icon: 'zap',       stat: 'iOS',    title: t('perks.4.title'), body: t('perks.4.body'), statUnit: t('perks.4.unit') },
    { icon: 'users',     stat: '1',      title: t('perks.5.title'), body: t('perks.5.body'), statUnit: t('perks.5.unit') },
    { icon: 'globe',     stat: '142',    title: t('perks.6.title'), body: t('perks.6.body'), statUnit: t('perks.6.unit') },
  ];
}

function vhTiers(t) {
  return [
    { name: t('tiers.1.name'), desc: t('tiers.1.desc'), perks: [t('tiers.1.p1'), t('tiers.1.p2'), t('tiers.1.p3')] },
    { name: t('tiers.2.name'), desc: t('tiers.2.desc'), perks: [t('tiers.2.p1'), t('tiers.2.p2'), t('tiers.2.p3')] },
    { name: t('tiers.3.name'), desc: t('tiers.3.desc'), perks: [t('tiers.3.p1'), t('tiers.3.p2'), t('tiers.3.p3')] },
  ];
}

const VH_DOC_REQ = {
  truckers:   [true, true, true, false],
  fleets:     [true, true, true, false],
  forwarders: [true, false, false, false],
  brokers:    [true, true, true, true],
  warehouses: [true, false, true, false],
  movers:     [true, true, false, false],
  lastmile:   [true, true, false, false],
  drayage:    [true, true, true, true],
  rail:       [true, true, true, false],
};
function vhDocsByType(t, typeId) {
  return [0, 1, 2, 3].map(i => ({
    label: t(`docs.${typeId}.${i}.label`),
    note: t(`docs.${typeId}.${i}.note`),
    required: VH_DOC_REQ[typeId][i],
  }));
}

// Lane shells keep stable id + numeric data; equipment + pickup are i18n keys.
const VH_LANE_SHELLS = [
  { id: 'L-83214',  origin: 'Long Beach, CA',     dest: 'Phoenix, AZ',     equipKey: 'lane.eq.dryvan53',    pickupKey: 'lane.pk.today1400',   miles: 372,  rate: 1480, rpm: 3.98, mode: 'truck',   priority: 'hot' },
  { id: 'L-IN-7244',origin: 'Guatemala City, GT', dest: 'Savannah, GA',    equipKey: 'lane.eq.40reefocean', pickupKey: 'lane.pk.cutWed1200',  miles: 1620, rate: 3850, rpm: 2.38, mode: 'ocean',   priority: 'hot',    flag: '🇬🇹→🇺🇸' },
  { id: 'L-83244',  origin: 'Houston, TX',        dest: 'Kansas City, MO', equipKey: 'lane.eq.hazmat',      pickupKey: 'lane.pk.thu0530',     miles: 754,  rate: 3950, rpm: 5.24, mode: 'truck',   priority: 'hot' },
  { id: 'L-IN-7263',origin: 'Bogotá, CO',         dest: 'Houston, TX',     equipKey: 'lane.eq.40reefair',   pickupKey: 'lane.pk.mon2200',     miles: 2340, rate: 6420, rpm: 2.74, mode: 'air',     priority: 'hot',    flag: '🇨🇴→🇺🇸' },
  { id: 'L-83229',  origin: 'Savannah, GA',       dest: 'Atlanta, GA',     equipKey: 'lane.eq.40hcdray',    pickupKey: 'lane.pk.today1100',   miles: 248,  rate: 720,  rpm: 2.90, mode: 'drayage', priority: 'hot' },
  { id: 'L-IN-7258',origin: 'Manzanillo, MX',     dest: 'Long Beach, CA',  equipKey: 'lane.eq.40hcfcl',     pickupKey: 'lane.pk.sailSat0600', miles: 1240, rate: 1980, rpm: 1.60, mode: 'ocean',   priority: 'normal', flag: '🇲🇽→🇺🇸' },
  { id: 'L-83218',  origin: 'Laredo, TX',         dest: 'Memphis, TN',     equipKey: 'lane.eq.reefer53',    pickupKey: 'lane.pk.tom0600',     miles: 887,  rate: 3120, rpm: 3.52, mode: 'truck',   priority: 'normal' },
  { id: 'L-IN-7240',origin: 'Cartagena, CO',      dest: 'Buenos Aires, AR',equipKey: 'lane.eq.40hcfcl',     pickupKey: 'lane.pk.sailFri1800', miles: 4810, rate: 4280, rpm: 0.89, mode: 'ocean',   priority: 'hot',    flag: '🇨🇴→🇦🇷' },
  { id: 'L-83236',  origin: 'Miami, FL',          dest: 'Charlotte, NC',   equipKey: 'lane.eq.flatbed',     pickupKey: 'lane.pk.wed1300',     miles: 720,  rate: 2380, rpm: 3.31, mode: 'truck',   priority: 'normal' },
  { id: 'L-IN-7251',origin: 'Guatemala City, GT', dest: 'Miami, FL',       equipKey: 'lane.eq.20drylcl',    pickupKey: 'lane.pk.cutThu1600',  miles: 1180, rate: 1640, rpm: 1.39, mode: 'ocean',   priority: 'normal', flag: '🇬🇹→🇺🇸' },
  { id: 'L-83221',  origin: 'Newark, NJ',         dest: 'Chicago, IL',     equipKey: 'lane.eq.drayrail',    pickupKey: 'lane.pk.wed0930',     miles: 786,  rate: 2210, rpm: 2.81, mode: 'rail',    priority: 'normal' },
  { id: 'L-IN-7269',origin: 'Shanghai, CN',       dest: 'Los Angeles, CA', equipKey: 'lane.eq.40hcfcl',     pickupKey: 'lane.pk.cutSun1800',  miles: 6440, rate: 3120, rpm: 0.48, mode: 'ocean',   priority: 'normal', flag: '🇨🇳→🇺🇸' },
];
function vhLanes(t) {
  return VH_LANE_SHELLS.map(l => ({ ...l, equip: t(l.equipKey), pickup: t(l.pickupKey) }));
}

// Per-mode unit label. Trucking-style modes are quoted per mile; ocean FCL per container,
// LCL per shipment (all-in); air per shipment (all-in). "Per mile" is misleading for intl.
function vhLaneUnitFull(t, l) {
  if (l.mode === 'truck' || l.mode === 'drayage' || l.mode === 'rail') {
    return t('live.permile', { rpm: l.rpm.toFixed(2) });
  }
  if (l.mode === 'ocean') {
    return l.equipKey.endsWith('lcl') ? t('live.allin') : t('live.percontainer');
  }
  return t('live.allin');
}
function vhLaneUnitCell(t, l) {
  if (l.mode === 'truck' || l.mode === 'drayage' || l.mode === 'rail') {
    return `$${l.rpm.toFixed(2)}/mi`;
  }
  if (l.mode === 'ocean') {
    return l.equipKey.endsWith('lcl') ? t('lb.cell.allin') : t('lb.cell.perctr');
  }
  return t('lb.cell.allin');
}

// ---------- Subcomponents ----------
function VHEyebrow({ children, color = '#1846B0' }) {
  return (
    <div style={{ display: 'inline-flex', alignItems: 'center', gap: 8,
      fontFamily: 'JetBrains Mono, monospace', fontSize: 11, fontWeight: 600,
      letterSpacing: '0.12em', textTransform: 'uppercase', color }}>
      <span style={{ width: 18, height: 1, background: color, opacity: 0.6 }}/>
      {children}
    </div>
  );
}

function VHHero({ accent }) {
  const t = useVhT();
  return (
    <section style={{ position: 'relative', overflow: 'hidden',
      background: 'linear-gradient(165deg, #0B1220 0%, #1846B0 78%, #2563EB 100%)',
      color: '#fff', padding: '88px 64px 96px' }}>
      {/* grid texture */}
      <div aria-hidden style={{ position: 'absolute', inset: 0,
        backgroundImage: 'linear-gradient(rgba(255,255,255,0.05) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,0.05) 1px, transparent 1px)',
        backgroundSize: '32px 32px', opacity: 0.5, pointerEvents: 'none',
        maskImage: 'radial-gradient(ellipse at 70% 30%, black 30%, transparent 75%)',
        WebkitMaskImage: 'radial-gradient(ellipse at 70% 30%, black 30%, transparent 75%)' }}/>
      {/* glow */}
      <div aria-hidden style={{ position: 'absolute', top: '-20%', right: '-10%',
        width: 720, height: 720, borderRadius: '50%',
        background: 'radial-gradient(circle, rgba(96,165,250,0.32) 0%, transparent 60%)',
        pointerEvents: 'none' }}/>
      <div style={{ position: 'relative', maxWidth: 1600, margin: '0 auto',
        display: 'grid', gridTemplateColumns: '1.15fr 1fr', gap: 72, alignItems: 'center' }}>
        <div>
          <VHEyebrow color="#bfdbfe">{t('hero.eyebrow')}</VHEyebrow>
          <h1 style={{ margin: '20px 0 0', fontSize: 64, lineHeight: 1.05,
            fontWeight: 700, letterSpacing: '-0.025em' }}>
            {t('hero.title.a')}<span style={{
              background: 'linear-gradient(90deg, #fff 0%, #bfdbfe 60%, #fff 100%)',
              backgroundSize: '200% 100%', animation: 'shimmer 8s linear infinite',
              WebkitBackgroundClip: 'text', backgroundClip: 'text',
              WebkitTextFillColor: 'transparent' }}>{t('hero.title.b')}</span>
          </h1>
          <p style={{ margin: '24px 0 0', fontSize: 19, lineHeight: 1.55,
            color: 'rgba(240,247,255,0.82)', maxWidth: 580 }}>
            {t('hero.lead')}
          </p>
          <div style={{ marginTop: 32, display: 'flex', gap: 12, flexWrap: 'wrap' }}>
            <a href="#signup" style={{ display: 'inline-flex', alignItems: 'center', gap: 8,
              padding: '14px 22px', borderRadius: 9999, background: '#fff',
              color: '#0B1220', fontSize: 15, fontWeight: 700,
              textDecoration: 'none', letterSpacing: '-0.005em',
              boxShadow: '0 12px 28px -10px rgba(255,255,255,0.4)' }}>
              {t('hero.cta.apply')} <Icon name="arrowRight" size={16}/>
            </a>
            <a href="#loadboard" style={{ display: 'inline-flex', alignItems: 'center', gap: 8,
              padding: '14px 22px', borderRadius: 9999,
              background: 'rgba(255,255,255,0.08)', border: '1px solid rgba(255,255,255,0.22)',
              color: '#fff', fontSize: 15, fontWeight: 600, textDecoration: 'none' }}>
              {t('hero.cta.preview')}
            </a>
          </div>
          {/* trust line */}
          <div style={{ marginTop: 40, display: 'flex', gap: 32, flexWrap: 'wrap',
            color: 'rgba(240,247,255,0.62)', fontSize: 13 }}>
            {[
              ['4,200+', t('hero.stat.vendors')],
              ['$2.4B', t('hero.stat.fum')],
              ['68', t('hero.stat.countries')],
              ['98.4%', t('hero.stat.payment')],
            ].map(([v, l]) => (
              <div key={l}>
                <div style={{ fontFamily: 'JetBrains Mono, monospace', fontSize: 22,
                  fontWeight: 600, color: '#fff', letterSpacing: '-0.01em' }}>{v}</div>
                <div style={{ marginTop: 4, fontSize: 12, letterSpacing: '0.04em',
                  textTransform: 'uppercase', fontWeight: 600 }}>{l}</div>
              </div>
            ))}
          </div>
        </div>

        {/* Right: live "next load" card */}
        <VHHeroCard/>
      </div>
    </section>
  );
}

function VHHeroCard() {
  const t = useVhT();
  const lanes = vhLanes(t);
  // Simulated rotating load
  const [idx, setIdx] = useStateVH(0);
  useEffectVH(() => {
    const tick = setInterval(() => setIdx(i => (i + 1) % lanes.length), 4200);
    return () => clearInterval(tick);
  }, [lanes.length]);
  const ln = lanes[idx];
  return (
    <div style={{ position: 'relative' }}>
      <div style={{ position: 'absolute', inset: '-12px',
        background: 'radial-gradient(ellipse, rgba(96,165,250,0.35) 0%, transparent 70%)',
        filter: 'blur(20px)', pointerEvents: 'none' }}/>
      <div style={{ position: 'relative', borderRadius: 20,
        background: 'linear-gradient(180deg, rgba(255,255,255,0.06) 0%, rgba(255,255,255,0.02) 100%)',
        border: '1px solid rgba(255,255,255,0.16)',
        backdropFilter: 'blur(12px)', padding: '20px',
        boxShadow: '0 24px 60px -20px rgba(0,0,0,0.6)' }}>
        <div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between' }}>
          <div style={{ display: 'inline-flex', alignItems: 'center', gap: 8,
            padding: '4px 10px', borderRadius: 9999,
            background: 'rgba(220,38,38,0.14)', border: '1px solid rgba(220,38,38,0.36)',
            color: '#fecaca', fontSize: 11, fontWeight: 700, letterSpacing: '0.08em' }}>
            <span style={{ width: 6, height: 6, borderRadius: 9999, background: '#f87171',
              animation: 'pulse-dot 1.8s infinite' }}/>
            {t('live.label')}
          </div>
          <div style={{ fontFamily: 'JetBrains Mono, monospace', fontSize: 11,
            color: 'rgba(240,247,255,0.55)' }}>{ln.id}</div>
        </div>

        <div style={{ marginTop: 18, display: 'grid', gridTemplateColumns: '1fr auto 1fr',
          alignItems: 'center', gap: 14 }}>
          <div>
            <div style={{ fontSize: 11, color: 'rgba(240,247,255,0.55)', fontWeight: 600,
              letterSpacing: '0.08em', textTransform: 'uppercase' }}>{t('live.pickup')}</div>
            <div style={{ fontSize: 18, fontWeight: 700, marginTop: 4,
              letterSpacing: '-0.015em' }}>{ln.origin}</div>
            <div style={{ fontSize: 12, color: 'rgba(240,247,255,0.65)', marginTop: 2 }}>{ln.pickup}</div>
          </div>
          <div style={{ display: 'flex', flexDirection: 'column', alignItems: 'center', gap: 4 }}>
            <div style={{ width: 96, height: 1, background: 'linear-gradient(90deg, transparent, rgba(255,255,255,0.5), transparent)' }}/>
            <Icon name="arrowRight" size={18} style={{ color: '#bfdbfe' }}/>
            <div style={{ fontFamily: 'JetBrains Mono, monospace', fontSize: 11,
              color: 'rgba(240,247,255,0.6)' }}>{ln.miles} {t('live.miles')}</div>
          </div>
          <div style={{ textAlign: 'right' }}>
            <div style={{ fontSize: 11, color: 'rgba(240,247,255,0.55)', fontWeight: 600,
              letterSpacing: '0.08em', textTransform: 'uppercase' }}>{t('live.dropoff')}</div>
            <div style={{ fontSize: 18, fontWeight: 700, marginTop: 4,
              letterSpacing: '-0.015em' }}>{ln.dest}</div>
            <div style={{ fontSize: 12, color: 'rgba(240,247,255,0.65)', marginTop: 2 }}>{ln.equip}</div>
          </div>
        </div>

        <div style={{ marginTop: 20, padding: '14px 16px', borderRadius: 12,
          background: 'rgba(255,255,255,0.06)', border: '1px solid rgba(255,255,255,0.12)',
          display: 'flex', alignItems: 'center', justifyContent: 'space-between' }}>
          <div>
            <div style={{ fontSize: 11, color: 'rgba(240,247,255,0.6)',
              letterSpacing: '0.08em', textTransform: 'uppercase', fontWeight: 600 }}>
              {t('live.posted')}
            </div>
            <div style={{ display: 'flex', alignItems: 'baseline', gap: 8, marginTop: 4 }}>
              <div style={{ fontFamily: 'JetBrains Mono, monospace', fontSize: 26,
                fontWeight: 600, letterSpacing: '-0.01em' }}>${ln.rate.toLocaleString()}</div>
              <div style={{ fontSize: 12, color: 'rgba(240,247,255,0.65)' }}>
                {vhLaneUnitFull(t, ln)}
              </div>
            </div>
          </div>
          <button style={{ padding: '10px 16px', borderRadius: 9999,
            background: '#fff', border: 0, color: '#0B1220',
            fontWeight: 700, fontSize: 13, cursor: 'pointer',
            fontFamily: 'inherit', letterSpacing: '-0.005em' }}>
            {t('live.book')}
          </button>
        </div>

        <div style={{ marginTop: 12, display: 'flex', gap: 6 }}>
          {lanes.map((_, i) => (
            <div key={i} style={{ flex: 1, height: 2, borderRadius: 2,
              background: i === idx ? '#bfdbfe' : 'rgba(255,255,255,0.18)',
              transition: 'background 240ms' }}/>
          ))}
        </div>
      </div>
    </div>
  );
}

// ---------- Vendor type chooser ----------
function VHTypePicker({ activeType, setActiveType }) {
  const t = useVhT();
  const types = vhVendorTypes(t);
  const active = types.find(x => x.id === activeType) || types[0];
  const docs = vhDocsByType(t, active.id);
  return (
    <section style={{ background: '#fff', borderTop: '1px solid #eaecf0',
      padding: '88px 64px' }}>
      <div style={{ maxWidth: 1600, margin: '0 auto' }}>
        <div style={{ display: 'flex', alignItems: 'flex-end',
          justifyContent: 'space-between', gap: 40, marginBottom: 36 }}>
          <div>
            <VHEyebrow>{t('types.eyebrow')}</VHEyebrow>
            <h2 style={{ margin: '14px 0 0', fontSize: 44, fontWeight: 700,
              letterSpacing: '-0.025em', color: '#0B1220', maxWidth: 720,
              lineHeight: 1.1 }}>
              {t('types.title')}
            </h2>
          </div>
          <p style={{ margin: 0, fontSize: 15, lineHeight: 1.55, color: '#475467',
            maxWidth: 380 }}>
            {t('types.lead')}
          </p>
        </div>

        {/* Tab strip */}
        <div style={{ display: 'flex', flexWrap: 'wrap', gap: 8, marginBottom: 28 }}>
          {types.map(x => {
            const isActive = x.id === activeType;
            return (
              <button key={x.id} onClick={() => setActiveType(x.id)}
                style={{ display: 'inline-flex', alignItems: 'center', gap: 8,
                  padding: '10px 16px', borderRadius: 9999,
                  border: `1px solid ${isActive ? '#0B1220' : '#eaecf0'}`,
                  background: isActive ? '#0B1220' : '#fff',
                  color: isActive ? '#fff' : '#344054',
                  fontFamily: 'inherit', fontSize: 13, fontWeight: 600,
                  cursor: 'pointer', transition: 'all 180ms cubic-bezier(0.16,1,0.3,1)',
                  letterSpacing: '-0.005em' }}>
                <Icon name={x.icon} size={14} style={{ opacity: 0.85 }}/>
                {x.label}
              </button>
            );
          })}
        </div>

        {/* Active type card */}
        <div style={{ display: 'grid', gridTemplateColumns: '1.4fr 1fr', gap: 32,
          padding: '36px', borderRadius: 20,
          background: 'linear-gradient(180deg, #f9fafb 0%, #fff 100%)',
          border: '1px solid #eaecf0' }}>
          <div>
            <div style={{ display: 'inline-flex', alignItems: 'center', gap: 10,
              padding: '6px 12px', borderRadius: 9999,
              background: '#EFF6FF', color: '#1846B0',
              fontSize: 12, fontWeight: 700, letterSpacing: '0.04em' }}>
              <Icon name={active.icon} size={14}/> {active.label}
            </div>
            <h3 style={{ margin: '20px 0 0', fontSize: 32, fontWeight: 700,
              letterSpacing: '-0.02em', color: '#0B1220', lineHeight: 1.15 }}>
              {active.blurb}
            </h3>
            <div style={{ marginTop: 24, display: 'grid',
              gridTemplateColumns: '1fr 1fr', gap: 14 }}>
              {active.perks.map(p => (
                <div key={p} style={{ display: 'flex', alignItems: 'center', gap: 10,
                  fontSize: 14, fontWeight: 500, color: '#101828' }}>
                  <span style={{ width: 22, height: 22, borderRadius: 9999,
                    background: '#ECFDF3', color: '#027A48',
                    display: 'inline-flex', alignItems: 'center', justifyContent: 'center',
                    flexShrink: 0 }}>
                    <Icon name="check" size={12} strokeWidth={2.5}/>
                  </span>
                  {p}
                </div>
              ))}
            </div>
            <div style={{ marginTop: 28, display: 'flex', gap: 10 }}>
              <a href="#signup" style={{ display: 'inline-flex', alignItems: 'center', gap: 8,
                padding: '12px 18px', borderRadius: 9999, background: '#1E57D6',
                color: '#fff', fontSize: 14, fontWeight: 600,
                textDecoration: 'none', letterSpacing: '-0.005em' }}>
                {t('types.applyAs', { label: active.label.toLowerCase() })} <Icon name="arrowRight" size={14}/>
              </a>
              <a href="#requirements" style={{ display: 'inline-flex', alignItems: 'center', gap: 8,
                padding: '12px 18px', borderRadius: 9999, background: 'transparent',
                border: '1px solid #d0d5dd', color: '#101828',
                fontSize: 14, fontWeight: 600, textDecoration: 'none' }}>
                {t('types.requirements')}
              </a>
            </div>
          </div>
          {/* Right: docs/req checklist */}
          <div style={{ background: '#fff', borderRadius: 14,
            border: '1px solid #eaecf0', padding: '20px 22px',
            boxShadow: '0 1px 3px rgba(16,24,40,0.06)' }} id="requirements">
            <div style={{ fontFamily: 'JetBrains Mono, monospace', fontSize: 11,
              fontWeight: 600, letterSpacing: '0.1em', textTransform: 'uppercase',
              color: '#98a2b3', marginBottom: 14 }}>
              {t('docs.heading')}
            </div>
            <div style={{ display: 'flex', flexDirection: 'column', gap: 0 }}>
              {docs.map((d, i) => (
                <div key={d.label} style={{ display: 'flex', alignItems: 'center',
                  justifyContent: 'space-between', gap: 12, padding: '10px 0',
                  borderTop: i === 0 ? 'none' : '1px solid #f2f4f7' }}>
                  <div>
                    <div style={{ fontSize: 13.5, fontWeight: 600, color: '#101828' }}>{d.label}</div>
                    <div style={{ fontSize: 11.5, color: '#667085', marginTop: 2 }}>{d.note}</div>
                  </div>
                  <span style={{ fontFamily: 'JetBrains Mono, monospace', fontSize: 10,
                    fontWeight: 700, padding: '3px 8px', borderRadius: 4,
                    background: d.required ? '#fef3f2' : '#f2f4f7',
                    color: d.required ? '#b42318' : '#667085',
                    letterSpacing: '0.06em' }}>
                    {d.required ? t('docs.required') : t('docs.optional')}
                  </span>
                </div>
              ))}
            </div>
          </div>
        </div>
      </div>
    </section>
  );
}

// ---------- Perks grid ----------
function VHPerks() {
  const t = useVhT();
  const perks = vhPerks(t);
  return (
    <section style={{ background: '#fcfcfd', padding: '88px 64px',
      borderTop: '1px solid #eaecf0' }}>
      <div style={{ maxWidth: 1600, margin: '0 auto' }}>
        <div style={{ maxWidth: 720 }}>
          <VHEyebrow color="#B45309">{t('perks.eyebrow')}</VHEyebrow>
          <h2 style={{ margin: '14px 0 0', fontSize: 44, fontWeight: 700,
            letterSpacing: '-0.025em', color: '#0B1220', lineHeight: 1.1 }}>
            {t('perks.title')}
          </h2>
          <p style={{ margin: '16px 0 0', fontSize: 17, lineHeight: 1.55,
            color: '#475467' }}>
            {t('perks.lead')}
          </p>
        </div>

        <div style={{ marginTop: 56, display: 'grid',
          gridTemplateColumns: 'repeat(3, 1fr)', gap: 0,
          border: '1px solid #eaecf0', borderRadius: 16, overflow: 'hidden',
          background: '#fff' }}>
          {perks.map((p, i) => (
            <div key={p.title} style={{
              padding: '32px 28px',
              borderRight: ((i + 1) % 3 === 0) ? 'none' : '1px solid #eaecf0',
              borderBottom: i < perks.length - 3 ? '1px solid #eaecf0' : 'none',
              position: 'relative', background: '#fff',
              transition: 'background 180ms' }}
              onMouseEnter={e => e.currentTarget.style.background = '#fafbfc'}
              onMouseLeave={e => e.currentTarget.style.background = '#fff'}>
              <div style={{ display: 'flex', alignItems: 'flex-start',
                justifyContent: 'space-between', gap: 16 }}>
                <div style={{ width: 40, height: 40, borderRadius: 10,
                  background: '#EFF6FF', color: '#1846B0',
                  display: 'inline-flex', alignItems: 'center',
                  justifyContent: 'center' }}>
                  <Icon name={p.icon} size={20}/>
                </div>
                <div style={{ textAlign: 'right' }}>
                  <div style={{ fontFamily: 'JetBrains Mono, monospace', fontSize: 28,
                    fontWeight: 600, color: '#0B1220', letterSpacing: '-0.02em',
                    lineHeight: 1 }}>{p.stat}</div>
                  <div style={{ fontSize: 10.5, color: '#667085', marginTop: 4,
                    letterSpacing: '0.06em', textTransform: 'uppercase',
                    fontWeight: 600 }}>{p.statUnit}</div>
                </div>
              </div>
              <h3 style={{ margin: '20px 0 0', fontSize: 19, fontWeight: 700,
                letterSpacing: '-0.015em', color: '#0B1220' }}>{p.title}</h3>
              <p style={{ margin: '8px 0 0', fontSize: 14, lineHeight: 1.55,
                color: '#475467' }}>{p.body}</p>
            </div>
          ))}
        </div>
      </div>
    </section>
  );
}

// ---------- Load board teaser ----------
function VHLoadBoard() {
  const t = useVhT();
  const allLanes = vhLanes(t);
  const [filter, setFilter] = useStateVH('all');
  const [sort, setSort] = useStateVH('priority');
  const lanes = useMemoVH(() => {
    let l = filter === 'all' ? allLanes : allLanes.filter(x => x.mode === filter);
    if (sort === 'rpm') l = [...l].sort((a, b) => b.rpm - a.rpm);
    if (sort === 'miles') l = [...l].sort((a, b) => a.miles - b.miles);
    if (sort === 'priority') l = [...l].sort((a, b) => (b.priority === 'hot') - (a.priority === 'hot'));
    return l;
  }, [filter, sort, allLanes]);

  return (
    <section id="loadboard" style={{ background: '#0B1220', color: '#fff',
      padding: '88px 64px', position: 'relative', overflow: 'hidden' }}>
      <div aria-hidden style={{ position: 'absolute', inset: 0,
        backgroundImage: 'linear-gradient(rgba(255,255,255,0.04) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,0.04) 1px, transparent 1px)',
        backgroundSize: '32px 32px', opacity: 0.6, pointerEvents: 'none' }}/>
      <div style={{ position: 'relative', maxWidth: 1600, margin: '0 auto' }}>
        <div style={{ display: 'flex', alignItems: 'flex-end',
          justifyContent: 'space-between', gap: 40, marginBottom: 32, flexWrap: 'wrap' }}>
          <div>
            <VHEyebrow color="#bfdbfe">{t('lb.eyebrow')}</VHEyebrow>
            <h2 style={{ margin: '14px 0 0', fontSize: 44, fontWeight: 700,
              letterSpacing: '-0.025em', lineHeight: 1.1, maxWidth: 640 }}>
              {t('lb.title.a')}<br/>
              <span style={{ color: '#bfdbfe' }}>{t('lb.title.b')}</span>
            </h2>
          </div>
          <div style={{ display: 'flex', gap: 8, alignItems: 'center', flexWrap: 'wrap' }}>
            {/* mode filter */}
            <div style={{ display: 'flex', gap: 2, padding: 3,
              background: 'rgba(255,255,255,0.06)', borderRadius: 9999,
              border: '1px solid rgba(255,255,255,0.12)' }}>
              {[
                ['all', t('lb.filter.all')],
                ['ocean', t('lb.filter.ocean')],
                ['air', t('lb.filter.air')],
                ['truck', t('lb.filter.truck')],
                ['drayage', t('lb.filter.drayage')],
                ['rail', t('lb.filter.rail')],
              ].map(([v, l]) => (
                <button key={v} onClick={() => setFilter(v)} style={{
                  padding: '6px 14px', borderRadius: 9999, border: 0, cursor: 'pointer',
                  background: filter === v ? '#fff' : 'transparent',
                  color: filter === v ? '#0B1220' : 'rgba(240,247,255,0.7)',
                  fontFamily: 'inherit', fontSize: 12, fontWeight: 600 }}>{l}</button>
              ))}
            </div>
            <select value={sort} onChange={e => setSort(e.target.value)}
              style={{ padding: '8px 14px', borderRadius: 9999,
                background: 'rgba(255,255,255,0.06)',
                border: '1px solid rgba(255,255,255,0.16)',
                color: '#fff', fontFamily: 'inherit', fontSize: 12, fontWeight: 600,
                cursor: 'pointer' }}>
              <option value="priority" style={{ color: '#000' }}>{t('lb.sort.priority')}</option>
              <option value="rpm"      style={{ color: '#000' }}>{t('lb.sort.rpm')}</option>
              <option value="miles"    style={{ color: '#000' }}>{t('lb.sort.miles')}</option>
            </select>
          </div>
        </div>

        <div style={{ borderRadius: 16, overflow: 'hidden',
          border: '1px solid rgba(255,255,255,0.1)',
          background: 'rgba(255,255,255,0.02)' }}>
          {/* header */}
          <div style={{ display: 'grid',
            gridTemplateColumns: '90px 1.6fr 1.4fr 90px 110px 130px 110px',
            gap: 16, padding: '14px 22px',
            background: 'rgba(255,255,255,0.04)',
            borderBottom: '1px solid rgba(255,255,255,0.08)',
            fontFamily: 'JetBrains Mono, monospace', fontSize: 10.5,
            fontWeight: 600, letterSpacing: '0.1em', textTransform: 'uppercase',
            color: 'rgba(240,247,255,0.55)' }}>
            <div>{t('lb.col.load')}</div>
            <div>{t('lb.col.route')}</div>
            <div>{t('lb.col.equip')}</div>
            <div style={{ textAlign: 'right' }}>{t('lb.col.miles')}</div>
            <div style={{ textAlign: 'right' }}>{t('lb.col.rate')}</div>
            <div style={{ textAlign: 'right' }}>{t('lb.col.rpm')}</div>
            <div style={{ textAlign: 'right' }}>{t('lb.col.action')}</div>
          </div>
          {lanes.map((l, i) => (
            <div key={l.id} style={{ display: 'grid',
              gridTemplateColumns: '90px 1.6fr 1.4fr 90px 110px 130px 110px',
              gap: 16, padding: '16px 22px', alignItems: 'center',
              borderBottom: i === lanes.length - 1 ? 'none' : '1px solid rgba(255,255,255,0.06)',
              transition: 'background 180ms' }}
              onMouseEnter={e => e.currentTarget.style.background = 'rgba(255,255,255,0.03)'}
              onMouseLeave={e => e.currentTarget.style.background = 'transparent'}>
              <div style={{ display: 'flex', alignItems: 'center', gap: 6 }}>
                {l.priority === 'hot' && (
                  <span style={{ width: 6, height: 6, borderRadius: 9999,
                    background: '#f87171', boxShadow: '0 0 0 3px rgba(248,113,113,0.18)' }}/>
                )}
                <span style={{ fontFamily: 'JetBrains Mono, monospace', fontSize: 12,
                  color: 'rgba(240,247,255,0.7)' }}>{l.id}</span>
              </div>
              <div>
                <div style={{ fontSize: 14, fontWeight: 600, letterSpacing: '-0.005em',
                  display: 'flex', alignItems: 'center', gap: 8, flexWrap: 'wrap' }}>
                  {l.flag && (
                    <span style={{ fontSize: 13, padding: '2px 8px', borderRadius: 6,
                      background: 'rgba(96,165,250,0.14)',
                      border: '1px solid rgba(96,165,250,0.28)',
                      color: '#bfdbfe', fontFamily: 'JetBrains Mono, monospace',
                      fontWeight: 600, letterSpacing: '0.02em' }}>{l.flag}</span>
                  )}
                  <span>{l.origin} <span style={{ color: 'rgba(240,247,255,0.4)', margin: '0 6px' }}>→</span> {l.dest}</span>
                </div>
                <div style={{ fontSize: 11.5, color: 'rgba(240,247,255,0.55)', marginTop: 2 }}>
                  {l.mode === 'ocean' ? t('lb.label.cutoff') : l.mode === 'air' ? t('lb.label.departure') : t('lb.label.pickup')}{' '}{l.pickup}
                </div>
              </div>
              <div style={{ fontSize: 13, color: 'rgba(240,247,255,0.85)' }}>{l.equip}</div>
              <div style={{ textAlign: 'right', fontFamily: 'JetBrains Mono, monospace',
                fontSize: 13 }}>{l.miles}</div>
              <div style={{ textAlign: 'right', fontFamily: 'JetBrains Mono, monospace',
                fontSize: 14, fontWeight: 600 }}>${l.rate.toLocaleString()}</div>
              <div style={{ textAlign: 'right', fontFamily: 'JetBrains Mono, monospace',
                fontSize: 13, color: (l.mode === 'truck' || l.mode === 'drayage' || l.mode === 'rail') && l.rpm >= 4
                  ? '#86efac' : 'rgba(240,247,255,0.85)' }}>
                {vhLaneUnitCell(t, l)}
              </div>
              <div style={{ textAlign: 'right' }}>
                <button style={{ padding: '7px 14px', borderRadius: 9999,
                  background: '#fff', border: 0, color: '#0B1220',
                  fontFamily: 'inherit', fontSize: 12, fontWeight: 700,
                  cursor: 'pointer' }}>
                  {t('lb.book')}
                </button>
              </div>
            </div>
          ))}
        </div>

        <div style={{ marginTop: 16, display: 'flex', alignItems: 'center',
          justifyContent: 'space-between', flexWrap: 'wrap', gap: 12 }}>
          <div style={{ fontSize: 12.5, color: 'rgba(240,247,255,0.55)',
            fontFamily: 'JetBrains Mono, monospace' }}>
            {t('lb.showing', { n: lanes.length })}
          </div>
          <div style={{ display: 'flex', alignItems: 'center', gap: 14, flexWrap: 'wrap' }}>
            <a href="#signup" style={{ display: 'inline-flex', alignItems: 'center', gap: 6,
              color: '#bfdbfe', fontSize: 13, fontWeight: 600, textDecoration: 'none' }}>
              {t('lb.unlock')} <Icon name="arrowRight" size={13}/>
            </a>
            <a href="vendor-portal.html" style={{ display: 'inline-flex', alignItems: 'center', gap: 6,
              padding: '9px 16px', borderRadius: 9999,
              background: '#fff', color: '#0B1220',
              fontSize: 13, fontWeight: 700, textDecoration: 'none',
              boxShadow: '0 8px 20px -10px rgba(255,255,255,0.5)' }}>
              {t('lb.openPortal')} <Icon name="arrowRight" size={13}/>
            </a>
          </div>
        </div>
      </div>
    </section>
  );
}

// ---------- Tier ladder ----------
function VHTiers() {
  const t = useVhT();
  const tiers = vhTiers(t);
  return (
    <section style={{ background: '#fff', padding: '88px 64px',
      borderTop: '1px solid #eaecf0' }}>
      <div style={{ maxWidth: 1600, margin: '0 auto' }}>
        <div style={{ display: 'grid', gridTemplateColumns: '1fr 2fr', gap: 64,
          alignItems: 'flex-start' }}>
          <div>
            <VHEyebrow>{t('tiers.eyebrow')}</VHEyebrow>
            <h2 style={{ margin: '14px 0 0', fontSize: 40, fontWeight: 700,
              letterSpacing: '-0.025em', color: '#0B1220', lineHeight: 1.1 }}>
              {t('tiers.title')}
            </h2>
            <p style={{ margin: '16px 0 0', fontSize: 15, lineHeight: 1.55,
              color: '#475467' }}>
              {t('tiers.lead')}
            </p>
          </div>
          <div style={{ display: 'grid', gridTemplateColumns: 'repeat(3, 1fr)',
            gap: 16 }}>
            {tiers.map((tier, i) => (
              <div key={tier.name} style={{
                padding: '24px',
                borderRadius: 14,
                background: i === 2 ? 'linear-gradient(180deg, #0B1220 0%, #1846B0 100%)' : '#fcfcfd',
                color: i === 2 ? '#fff' : '#101828',
                border: i === 2 ? '1px solid #1846B0' : '1px solid #eaecf0',
                boxShadow: i === 2 ? '0 12px 32px -16px rgba(24,70,176,0.4)' : 'none' }}>
                <div style={{ fontFamily: 'JetBrains Mono, monospace', fontSize: 11,
                  fontWeight: 700, letterSpacing: '0.1em', textTransform: 'uppercase',
                  color: i === 2 ? '#bfdbfe' : '#98a2b3' }}>
                  {t('tiers.label', { n: i + 1 })}
                </div>
                <h3 style={{ margin: '8px 0 0', fontSize: 22, fontWeight: 700,
                  letterSpacing: '-0.02em' }}>{tier.name}</h3>
                <p style={{ margin: '4px 0 0', fontSize: 13,
                  color: i === 2 ? 'rgba(240,247,255,0.75)' : '#667085' }}>
                  {tier.desc}
                </p>
                <div style={{ marginTop: 18, paddingTop: 18,
                  borderTop: i === 2 ? '1px solid rgba(255,255,255,0.12)' : '1px solid #eaecf0',
                  display: 'flex', flexDirection: 'column', gap: 10 }}>
                  {tier.perks.map(p => (
                    <div key={p} style={{ display: 'flex', alignItems: 'center', gap: 10,
                      fontSize: 13.5, fontWeight: 500 }}>
                      <Icon name="check" size={14} strokeWidth={2.5}
                        style={{ color: i === 2 ? '#86efac' : '#039855' }}/>
                      {p}
                    </div>
                  ))}
                </div>
              </div>
            ))}
          </div>
        </div>
      </div>
    </section>
  );
}

// ---------- Signup form ----------
function VHSignup() {
  const t = useVhT();
  const types = vhVendorTypes(t);
  const [form, setForm] = useStateVH({
    name: '', company: '', email: '', phone: '',
    type: 'truckers', equipment: '', lanes: '',
  });
  const [sent, setSent] = useStateVH(false);
  const [submitting, setSubmitting] = useStateVH(false);
  const [submitError, setSubmitError] = useStateVH(null);
  // Anti-bot: honeypot field + form-mounted timestamp.
  const [honeypot, setHoneypot] = useStateVH('');
  const openedAtRef = React.useRef(Date.now());
  const set = (k, v) => setForm(f => ({ ...f, [k]: v }));

  const onSubmit = async (e) => {
    e.preventDefault();
    if (submitting) return;
    setSubmitError(null);
    setSubmitting(true);

    const typeMeta = types.find(x => x.id === form.type);
    const leadDoc = {
      name: form.name.trim(),
      email: form.email.trim(),
      company: form.company.trim(),
      phone: form.phone.trim(),
      vendorType: form.type,
      vendorTypeLabel: typeMeta ? typeMeta.label : form.type,
      equipment: form.equipment.trim() || null,
      lanes: form.lanes.trim() || null,
      source: 'vendor-hub',
      pageUrl: typeof location !== 'undefined' ? location.href : null,
      userAgent: typeof navigator !== 'undefined' ? navigator.userAgent : null,
    };

    try {
      if (window.__abgsLeads && window.__abgsLeads.saveLead) {
        await window.__abgsLeads.saveLead(leadDoc, {
          honeypot,
          formOpenedAt: openedAtRef.current,
        });
      } else {
        throw new Error(t('signup.error.unavail'));
      }
    } catch (err) {
      setSubmitting(false);
      setSubmitError(err && err.message ? err.message : t('signup.error.generic'));
      return;
    }

    setSubmitting(false);
    setSent(true);
  };
  const inputStyle = {
    padding: '12px 14px', borderRadius: 10, border: '1px solid #d0d5dd',
    fontFamily: 'inherit', fontSize: 14, color: '#101828',
    background: '#fff', outline: 'none', width: '100%',
  };
  return (
    <section id="signup" style={{ background: '#fcfcfd',
      padding: '88px 64px', borderTop: '1px solid #eaecf0' }}>
      <div style={{ maxWidth: 1180, margin: '0 auto',
        display: 'grid', gridTemplateColumns: '1fr 1.1fr', gap: 64,
        alignItems: 'flex-start' }}>
        {/* Left side */}
        <div>
          <VHEyebrow color="#1846B0">{t('signup.eyebrow')}</VHEyebrow>
          <h2 style={{ margin: '14px 0 0', fontSize: 40, fontWeight: 700,
            letterSpacing: '-0.025em', color: '#0B1220', lineHeight: 1.1 }}>
            {t('signup.title')}
          </h2>
          <p style={{ margin: '16px 0 0', fontSize: 15, lineHeight: 1.6,
            color: '#475467' }}>
            {t('signup.lead')}
          </p>
          <div style={{ marginTop: 28, display: 'flex', flexDirection: 'column', gap: 14 }}>
            {[
              ['clock',  t('signup.bullet.1')],
              ['lock',   t('signup.bullet.2')],
              ['users',  t('signup.bullet.3')],
            ].map(([icon, txt]) => (
              <div key={txt} style={{ display: 'flex', alignItems: 'center', gap: 12,
                fontSize: 14, color: '#344054' }}>
                <span style={{ width: 32, height: 32, borderRadius: 8,
                  background: '#EFF6FF', color: '#1846B0',
                  display: 'inline-flex', alignItems: 'center', justifyContent: 'center' }}>
                  <Icon name={icon} size={16}/>
                </span>
                {txt}
              </div>
            ))}
          </div>

          <div style={{ marginTop: 36, padding: '18px 20px', borderRadius: 12,
            background: '#fff', border: '1px solid #eaecf0' }}>
            <div style={{ fontFamily: 'JetBrains Mono, monospace', fontSize: 11,
              fontWeight: 600, letterSpacing: '0.1em', textTransform: 'uppercase',
              color: '#98a2b3', marginBottom: 10 }}>{t('signup.support')}</div>
            <div style={{ display: 'flex', alignItems: 'center', gap: 14 }}>
              <div style={{ fontSize: 14, fontWeight: 600, color: '#101828' }}>vendors@abgs.com</div>
              <span style={{ width: 1, height: 14, background: '#eaecf0' }}/>
              <div style={{ fontSize: 14, fontWeight: 600, color: '#101828' }}>+1 (305) 555-0142</div>
            </div>
          </div>
        </div>

        {/* Form */}
        <form onSubmit={onSubmit}
          style={{ background: '#fff', padding: '32px', borderRadius: 18,
            border: '1px solid #eaecf0',
            boxShadow: '0 12px 28px -16px rgba(16,24,40,0.12)' }}>
          {sent ? (
            <div style={{ textAlign: 'center', padding: '24px 12px' }}>
              <div style={{ width: 56, height: 56, borderRadius: 9999,
                background: '#ECFDF3', color: '#027A48', margin: '0 auto',
                display: 'inline-flex', alignItems: 'center', justifyContent: 'center' }}>
                <Icon name="check" size={28} strokeWidth={2.5}/>
              </div>
              <h3 style={{ margin: '20px 0 0', fontSize: 22, fontWeight: 700,
                letterSpacing: '-0.02em', color: '#0B1220' }}>
                {t('signup.sent.title')}
              </h3>
              <p style={{ margin: '8px auto 0', fontSize: 14, color: '#475467',
                maxWidth: 320, lineHeight: 1.55 }}>
                {t('signup.sent.body.a')} <strong>{form.email || t('signup.sent.fallback')}</strong>{t('signup.sent.body.b')}
              </p>
              <button type="button" onClick={() => { setSent(false); setSubmitError(null); setForm({ name: '', company: '', email: '', phone: '', type: 'truckers', equipment: '', lanes: '' }); }}
                style={{ marginTop: 24, padding: '10px 18px', borderRadius: 9999,
                  background: 'transparent', border: '1px solid #d0d5dd',
                  color: '#101828', fontFamily: 'inherit', fontSize: 13,
                  fontWeight: 600, cursor: 'pointer' }}>
                {t('signup.sent.btn')}
              </button>
            </div>
          ) : (
            <>
              <div style={{ display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 14 }}>
                <Field label={t('signup.f.name')} required>
                  <input value={form.name} onChange={e => set('name', e.target.value)}
                    placeholder={t('signup.f.name.ph')} style={inputStyle} required/>
                </Field>
                <Field label={t('signup.f.company')} required>
                  <input value={form.company} onChange={e => set('company', e.target.value)}
                    placeholder={t('signup.f.company.ph')} style={inputStyle} required/>
                </Field>
                <Field label={t('signup.f.email')} required>
                  <input type="email" value={form.email} onChange={e => set('email', e.target.value)}
                    placeholder={t('signup.f.email.ph')} style={inputStyle} required/>
                </Field>
                <Field label={t('signup.f.phone')} required>
                  <input type="tel" value={form.phone} onChange={e => set('phone', e.target.value)}
                    placeholder={t('signup.f.phone.ph')} style={inputStyle} required/>
                </Field>
              </div>

              <Field label={t('signup.f.iam')} required style={{ marginTop: 14 }}>
                <div style={{ display: 'grid',
                  gridTemplateColumns: 'repeat(3, 1fr)', gap: 6 }}>
                  {types.map(x => {
                    const isActive = form.type === x.id;
                    return (
                      <button type="button" key={x.id} onClick={() => set('type', x.id)}
                        style={{
                          padding: '10px 8px', borderRadius: 8,
                          border: `1px solid ${isActive ? '#1E57D6' : '#eaecf0'}`,
                          background: isActive ? '#EFF6FF' : '#fff',
                          color: isActive ? '#1846B0' : '#475467',
                          fontFamily: 'inherit', fontSize: 12, fontWeight: 600,
                          cursor: 'pointer', display: 'flex', alignItems: 'center',
                          gap: 6, justifyContent: 'center',
                          letterSpacing: '-0.005em' }}>
                        <Icon name={x.icon} size={12}/> {x.label.split(' ')[0]}
                      </button>
                    );
                  })}
                </div>
              </Field>

              <Field label={t('signup.f.equip')} style={{ marginTop: 14 }}>
                <input value={form.equipment} onChange={e => set('equipment', e.target.value)}
                  placeholder={t('signup.f.equip.ph')} style={inputStyle}/>
              </Field>

              <Field label={t('signup.f.lanes')} style={{ marginTop: 14 }}>
                <input value={form.lanes} onChange={e => set('lanes', e.target.value)}
                  placeholder={t('signup.f.lanes.ph')} style={inputStyle}/>
              </Field>

              <div style={{ marginTop: 22, padding: '12px 14px', borderRadius: 8,
                background: '#f9fafb', border: '1px solid #eaecf0',
                fontSize: 12, color: '#667085', lineHeight: 1.5 }}>
                {t('signup.disc')}
              </div>

              {/* Honeypot — bots fill all visible inputs, humans don't see this. */}
              <div aria-hidden="true" style={{ position: 'absolute', left: '-9999px',
                width: 1, height: 1, overflow: 'hidden' }}>
                <label>
                  Website
                  <input type="text" name="website" tabIndex={-1} autoComplete="off"
                    value={honeypot} onChange={e => setHoneypot(e.target.value)}/>
                </label>
              </div>

              {submitError && (
                <div role="alert" style={{ marginTop: 14, padding: '10px 14px', borderRadius: 8,
                  background: '#FEF3F2', border: '1px solid #FECDCA',
                  color: '#B42318', fontSize: 13, lineHeight: 1.5 }}>
                  {submitError}
                </div>
              )}

              <button type="submit" disabled={submitting} style={{
                marginTop: 18, width: '100%', padding: '14px 20px', borderRadius: 10,
                background: submitting ? '#94aef0' : '#1E57D6', color: '#fff', border: 0,
                fontFamily: 'inherit', fontSize: 15, fontWeight: 700,
                cursor: submitting ? 'wait' : 'pointer', display: 'inline-flex', alignItems: 'center',
                justifyContent: 'center', gap: 8, letterSpacing: '-0.005em',
                boxShadow: '0 8px 16px -8px rgba(30,87,214,0.5)' }}>
                {submitting ? t('signup.submitting') : <>{t('signup.submit')} <Icon name="arrowRight" size={16}/></>}
              </button>
            </>
          )}
        </form>
      </div>
    </section>
  );
}

function Field({ label, required, children, style }) {
  return (
    <label style={{ display: 'flex', flexDirection: 'column', gap: 6, ...style }}>
      <span style={{ fontSize: 12, fontWeight: 600, color: '#344054',
        letterSpacing: '-0.005em' }}>
        {label} {required && <span style={{ color: '#dc2626' }}>*</span>}
      </span>
      {children}
    </label>
  );
}

// ---------- FAQ + final CTA strip ----------
function VHFinalCTA() {
  const t = useVhT();
  return (
    <section style={{ background: '#fff', padding: '64px 64px 96px',
      borderTop: '1px solid #eaecf0' }}>
      <div style={{ maxWidth: 1600, margin: '0 auto',
        padding: '48px 56px', borderRadius: 24,
        background: 'linear-gradient(135deg, #0B1220 0%, #1846B0 100%)',
        color: '#fff', position: 'relative', overflow: 'hidden',
        display: 'grid', gridTemplateColumns: '1.4fr 1fr', gap: 40, alignItems: 'center' }}>
        <div aria-hidden style={{ position: 'absolute', inset: 0,
          backgroundImage: 'linear-gradient(rgba(255,255,255,0.05) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,0.05) 1px, transparent 1px)',
          backgroundSize: '24px 24px', opacity: 0.5, pointerEvents: 'none' }}/>
        <div style={{ position: 'relative' }}>
          <h2 style={{ margin: 0, fontSize: 40, fontWeight: 700,
            letterSpacing: '-0.025em', lineHeight: 1.1 }}>
            {t('cta.title')}
          </h2>
          <p style={{ margin: '16px 0 0', fontSize: 16, lineHeight: 1.55,
            color: 'rgba(240,247,255,0.78)', maxWidth: 540 }}>
            {t('cta.lead')}
          </p>
        </div>
        <div style={{ position: 'relative', display: 'flex',
          flexDirection: 'column', gap: 10 }}>
          <a href="#signup" style={{ padding: '14px 22px', borderRadius: 9999,
            background: '#fff', color: '#0B1220',
            fontSize: 15, fontWeight: 700, textDecoration: 'none',
            display: 'inline-flex', alignItems: 'center', justifyContent: 'center',
            gap: 8 }}>
            {t('cta.apply')} <Icon name="arrowRight" size={16}/>
          </a>
          <a href="mailto:vendors@abgs.com" style={{ padding: '14px 22px',
            borderRadius: 9999, background: 'transparent',
            border: '1px solid rgba(255,255,255,0.24)', color: '#fff',
            fontSize: 15, fontWeight: 600, textDecoration: 'none',
            display: 'inline-flex', alignItems: 'center', justifyContent: 'center',
            gap: 8 }}>
            {t('cta.email')}
          </a>
        </div>
      </div>
    </section>
  );
}

// ---------- Tweaks ----------
function VHTweaks({ tweaks, setTweak }) {
  const [hidden, setHidden] = useStateVH(true);
  useEffectVH(() => {
    const handler = (e) => {
      if (e.data?.type === '__activate_edit_mode')   { window.__inEditMode = true;  setHidden(false); }
      if (e.data?.type === '__deactivate_edit_mode') { window.__inEditMode = false; setHidden(true);  }
    };
    window.addEventListener('message', handler);
    setTimeout(() => window.parent.postMessage({ type: '__edit_mode_available' }, '*'), 80);
    return () => window.removeEventListener('message', handler);
  }, []);
  return (
    <div className={`tweaks ${hidden ? 'hidden' : ''}`} id="tweaks-panel">
      <div className="tweaks-header">
        <div className="tweaks-title">Tweaks</div>
        <button onClick={() => { setHidden(true); window.parent.postMessage({ type: '__edit_mode_dismissed' }, '*'); }}
          style={{ background: 'transparent', border: 0, cursor: 'pointer',
            color: '#667085', padding: 4, display: 'inline-flex' }}>
          <Icon name="x" size={14}/>
        </button>
      </div>
      <div className="tweaks-body">
        <div className="tweak-row">
          <div className="tweak-label">Hero headline</div>
          <div className="tweak-seg">
            {[['volume', 'Volume'], ['pay', 'Pay'], ['network', 'Network']].map(([v, l]) => (
              <button key={v} className={tweaks.heroTone === v ? 'active' : ''}
                onClick={() => setTweak('heroTone', v)}>{l}</button>
            ))}
          </div>
        </div>
        <div className="tweak-row">
          <div className="tweak-label">Show load board</div>
          <div className="tweak-seg">
            {[['true', 'Show'], ['false', 'Hide']].map(([v, l]) => (
              <button key={v} className={String(tweaks.showLoadBoard) === v ? 'active' : ''}
                onClick={() => setTweak('showLoadBoard', v === 'true')}>{l}</button>
            ))}
          </div>
        </div>
        <div className="tweak-row">
          <div className="tweak-label">Show tier ladder</div>
          <div className="tweak-seg">
            {[['true', 'Show'], ['false', 'Hide']].map(([v, l]) => (
              <button key={v} className={String(tweaks.showTiers) === v ? 'active' : ''}
                onClick={() => setTweak('showTiers', v === 'true')}>{l}</button>
            ))}
          </div>
        </div>
        <div className="tweak-row">
          <div className="tweak-label">Form length</div>
          <div className="tweak-seg">
            {[['short', 'Short'], ['medium', 'Med']].map(([v, l]) => (
              <button key={v} className={tweaks.formLength === v ? 'active' : ''}
                onClick={() => setTweak('formLength', v)}>{l}</button>
            ))}
          </div>
        </div>
      </div>
    </div>
  );
}

// ---------- Main ----------
function VendorHub() {
  const [tweaks, setTweaks] = useStateVH(window.__tweaks || {
    heroTone: 'volume', showLoadBoard: true, showTiers: true, formLength: 'short',
  });
  useEffectVH(() => {
    const fn = (t) => setTweaks({ ...t });
    window.__tweakListeners = window.__tweakListeners || [];
    window.__tweakListeners.push(fn);
    return () => { window.__tweakListeners = window.__tweakListeners.filter(f => f !== fn); };
  }, []);

  const [activeType, setActiveType] = useStateVH('truckers');

  return (
    <div>
      <SiteNav/>
      <VHHero accent={tweaks.heroTone}/>
      <VHTypePicker activeType={activeType} setActiveType={setActiveType}/>
      <VHPerks/>
      {tweaks.showLoadBoard !== false && <VHLoadBoard/>}
      {tweaks.showTiers !== false && <VHTiers/>}
      <VHSignup/>
      <VHFinalCTA/>
      <Footer/>
      <VHTweaks tweaks={tweaks} setTweak={window.setTweak}/>
    </div>
  );
}

window.VendorHub = VendorHub;
