// vita-core.jsx — design tokens, Vita personalities, icons, small UI atoms
// Brand: PREVENT — navy + teal (#3DD9D6), warm & human.

// ── Theme tokens ────────────────────────────────────────────────
function getTheme(dark, accent, accentDeep) {
  if (dark) {
    return {
      dark: true,
      bg0: '#06122B', bg1: '#0A1A33', bg2: '#0F2A5C',
      surface: 'rgba(255,255,255,0.05)',
      surfaceSolid: '#11244A',
      stroke: 'rgba(255,255,255,0.10)',
      strokeStrong: 'rgba(255,255,255,0.18)',
      text: '#EAF1FA', textSoft: '#B9C6DC', muted: '#7E8FAD',
      accent, accentDeep,
      coral: '#E97A78', green: '#73C58E',
      onAccent: '#06122B',
      shadow: '0 20px 50px rgba(0,0,0,0.45)',
    };
  }
  return {
    dark: false,
    bg0: '#EEF3FA', bg1: '#F4F7FB', bg2: '#FFFFFF',
    surface: '#FFFFFF',
    surfaceSolid: '#FFFFFF',
    stroke: 'rgba(10,26,51,0.08)',
    strokeStrong: 'rgba(10,26,51,0.14)',
    text: '#0A1A33', textSoft: '#3C4D6B', muted: '#6B7B96',
    accent: accentDeep, accentDeep,
    coral: '#D9534F', green: '#3E8F5A',
    onAccent: '#FFFFFF',
    shadow: '0 18px 44px rgba(15,42,92,0.14)',
  };
}

// ── Vita personalities (the "variations" the user can explore) ───
const VITA_PERSONAS = {
  calida: {
    id: 'calida', name: 'Cálida', tagline: 'Cercana y empática',
    accent: '#3DD9D6', accentDeep: '#16A8A5',
    desc: 'Te habla como una amiga de confianza que además es médica. La calidez va primero.',
    voiceHint: 'cálida y cercana',
    voice: { rate: 0.97, pitch: 1.06 },
    persona: 'Tu personalidad es CÁLIDA: cercana, empática y humana, como una amiga de toda la vida que además es médica. Usas un tono afectuoso, validas las emociones del paciente y celebras los pequeños avances. Tuteas siempre.',
  },
  serena: {
    id: 'serena', name: 'Serena', tagline: 'Calmada y tranquilizadora',
    accent: '#5BC0EB', accentDeep: '#2E86C0',
    desc: 'Voz pausada que reduce la ansiedad. Habla despacio, con suavidad y mucha contención.',
    voiceHint: 'pausada y suave',
    voice: { rate: 0.9, pitch: 1.0 },
    persona: 'Tu personalidad es SERENA: pausada, suave y tranquilizadora. Bajas la ansiedad del paciente con frases cortas, calmadas y contenedoras. Transmites seguridad y paz. Tuteas siempre.',
  },
  coach: {
    id: 'coach', name: 'Coach', tagline: 'Motivadora y de longevidad',
    accent: '#73C58E', accentDeep: '#3E8F5A',
    desc: 'Te impulsa con energía a mejorar tus hábitos y bajar tu edad biológica.',
    voiceHint: 'enérgica y motivadora',
    voice: { rate: 1.0, pitch: 1.02 },
    persona: 'Tu personalidad es COACH: enérgica, motivadora y orientada a la longevidad. Impulsas al paciente con entusiasmo a mejorar sus hábitos, sin regañar. Enmarcas todo como progreso y potencial. Tuteas siempre.',
  },
};

// ── Icons (simple geometric paths only) ─────────────────────────
const Icon = {
  mic: (p) => (
    <svg viewBox="0 0 24 24" width={p.s || 24} height={p.s || 24} fill="none" stroke={p.c || 'currentColor'} strokeWidth={p.w || 2} strokeLinecap="round" strokeLinejoin="round">
      <rect x="9" y="2" width="6" height="12" rx="3" /><path d="M5 11a7 7 0 0 0 14 0" /><line x1="12" y1="18" x2="12" y2="22" />
    </svg>
  ),
  send: (p) => (
    <svg viewBox="0 0 24 24" width={p.s || 22} height={p.s || 22} fill="none" stroke={p.c || 'currentColor'} strokeWidth={p.w || 2} strokeLinecap="round" strokeLinejoin="round">
      <path d="M5 12h13M13 6l6 6-6 6" />
    </svg>
  ),
  sun: (p) => (
    <svg viewBox="0 0 24 24" width={p.s || 18} height={p.s || 18} fill="none" stroke={p.c || 'currentColor'} strokeWidth={p.w || 2} strokeLinecap="round" strokeLinejoin="round">
      <circle cx="12" cy="12" r="4" /><path d="M12 2v2M12 20v2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M2 12h2M20 12h2M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4" />
    </svg>
  ),
  moon: (p) => (
    <svg viewBox="0 0 24 24" width={p.s || 18} height={p.s || 18} fill="none" stroke={p.c || 'currentColor'} strokeWidth={p.w || 2} strokeLinecap="round" strokeLinejoin="round">
      <path d="M21 12.8A9 9 0 1 1 11.2 3a7 7 0 0 0 9.8 9.8z" />
    </svg>
  ),
  check: (p) => (
    <svg viewBox="0 0 24 24" width={p.s || 18} height={p.s || 18} fill="none" stroke={p.c || 'currentColor'} strokeWidth={p.w || 2.5} strokeLinecap="round" strokeLinejoin="round">
      <path d="M4 12.5l5 5L20 6" />
    </svg>
  ),
  sparkle: (p) => (
    <svg viewBox="0 0 24 24" width={p.s || 18} height={p.s || 18} fill={p.c || 'currentColor'}>
      <path d="M12 2l1.8 6.2L20 10l-6.2 1.8L12 18l-1.8-6.2L4 10l6.2-1.8z" />
    </svg>
  ),
  pulse: (p) => (
    <svg viewBox="0 0 24 24" width={p.s || 20} height={p.s || 20} fill="none" stroke={p.c || 'currentColor'} strokeWidth={p.w || 2} strokeLinecap="round" strokeLinejoin="round">
      <path d="M2 12h4l2.5-7 4 14 2.5-7H22" />
    </svg>
  ),
  heart: (p) => (
    <svg viewBox="0 0 24 24" width={p.s || 20} height={p.s || 20} fill={p.fill || 'none'} stroke={p.c || 'currentColor'} strokeWidth={p.w || 2} strokeLinecap="round" strokeLinejoin="round">
      <path d="M12 20S3.5 14.2 3.5 8.6A4.6 4.6 0 0 1 12 6a4.6 4.6 0 0 1 8.5 2.6C20.5 14.2 12 20 12 20z" />
    </svg>
  ),
  chevron: (p) => (
    <svg viewBox="0 0 24 24" width={p.s || 18} height={p.s || 18} fill="none" stroke={p.c || 'currentColor'} strokeWidth={p.w || 2.5} strokeLinecap="round" strokeLinejoin="round">
      <path d="M9 6l6 6-6 6" />
    </svg>
  ),
  shield: (p) => (
    <svg viewBox="0 0 24 24" width={p.s || 18} height={p.s || 18} fill="none" stroke={p.c || 'currentColor'} strokeWidth={p.w || 2} strokeLinecap="round" strokeLinejoin="round">
      <path d="M12 3l7 3v6c0 4.5-3 7.5-7 9-4-1.5-7-4.5-7-9V6z" /><path d="M9 12l2 2 4-4" />
    </svg>
  ),
  x: (p) => (
    <svg viewBox="0 0 24 24" width={p.s || 18} height={p.s || 18} fill="none" stroke={p.c || 'currentColor'} strokeWidth={p.w || 2} strokeLinecap="round" strokeLinejoin="round">
      <path d="M6 6l12 12M18 6L6 18" />
    </svg>
  ),
  volume: (p) => (
    <svg viewBox="0 0 24 24" width={p.s || 18} height={p.s || 18} fill="none" stroke={p.c || 'currentColor'} strokeWidth={p.w || 2} strokeLinecap="round" strokeLinejoin="round">
      <path d="M4 9v6h4l5 4V5L8 9z" /><path d="M16.5 8.5a5 5 0 0 1 0 7" />
    </svg>
  ),
  volumeOff: (p) => (
    <svg viewBox="0 0 24 24" width={p.s || 18} height={p.s || 18} fill="none" stroke={p.c || 'currentColor'} strokeWidth={p.w || 2} strokeLinecap="round" strokeLinejoin="round">
      <path d="M4 9v6h4l5 4V5L8 9z" /><path d="M22 9l-6 6M16 9l6 6" />
    </svg>
  ),
  mail: (p) => (
    <svg viewBox="0 0 24 24" width={p.s || 18} height={p.s || 18} fill="none" stroke={p.c || 'currentColor'} strokeWidth={p.w || 1.8} strokeLinecap="round" strokeLinejoin="round">
      <rect x="3" y="5" width="18" height="14" rx="3" /><path d="M4 7l8 6 8-6" />
    </svg>
  ),
  lock: (p) => (
    <svg viewBox="0 0 24 24" width={p.s || 18} height={p.s || 18} fill="none" stroke={p.c || 'currentColor'} strokeWidth={p.w || 1.8} strokeLinecap="round" strokeLinejoin="round">
      <rect x="4" y="10" width="16" height="11" rx="3" /><path d="M8 10V7a4 4 0 0 1 8 0v3" />
    </svg>
  ),
  user: (p) => (
    <svg viewBox="0 0 24 24" width={p.s || 18} height={p.s || 18} fill="none" stroke={p.c || 'currentColor'} strokeWidth={p.w || 1.8} strokeLinecap="round" strokeLinejoin="round">
      <circle cx="12" cy="8" r="4" /><path d="M4 21c0-4 4-6 8-6s8 2 8 6" />
    </svg>
  ),
  eye: (p) => (
    <svg viewBox="0 0 24 24" width={p.s || 18} height={p.s || 18} fill="none" stroke={p.c || 'currentColor'} strokeWidth={p.w || 1.8} strokeLinecap="round" strokeLinejoin="round">
      <path d="M2 12s3.5-7 10-7 10 7 10 7-3.5 7-10 7-10-7-10-7z" /><circle cx="12" cy="12" r="3" />
    </svg>
  ),
  eyeOff: (p) => (
    <svg viewBox="0 0 24 24" width={p.s || 18} height={p.s || 18} fill="none" stroke={p.c || 'currentColor'} strokeWidth={p.w || 1.8} strokeLinecap="round" strokeLinejoin="round">
      <path d="M3 3l18 18M10.6 10.7a3 3 0 0 0 4.2 4.2M9.9 5.2A9.8 9.8 0 0 1 12 5c6.5 0 10 7 10 7a16 16 0 0 1-3.3 4M6.1 6.2A16 16 0 0 0 2 12s3.5 7 10 7a9.7 9.7 0 0 0 3.4-.6" />
    </svg>
  ),
  faceid: (p) => (
    <svg viewBox="0 0 24 24" width={p.s || 18} height={p.s || 18} fill="none" stroke={p.c || 'currentColor'} strokeWidth={p.w || 1.8} strokeLinecap="round" strokeLinejoin="round">
      <path d="M4 8V6a2 2 0 0 1 2-2h2M16 4h2a2 2 0 0 1 2 2v2M20 16v2a2 2 0 0 1-2 2h-2M8 20H6a2 2 0 0 1-2-2v-2" />
      <path d="M9 9v1M15 9v1M12 9v3l-1 1" /><path d="M9 15a4 4 0 0 0 6 0" />
    </svg>
  ),
  phone: (p) => (
    <svg viewBox="0 0 24 24" width={p.s || 18} height={p.s || 18} fill="none" stroke={p.c || 'currentColor'} strokeWidth={p.w || 1.8} strokeLinecap="round" strokeLinejoin="round">
      <path d="M6.5 3.5h3.2l1.8 4.3-2.1 1.3a12.5 12.5 0 0 0 5.5 5.5l1.3-2.1 4.3 1.8v3.2a2 2 0 0 1-2.2 2A17 17 0 0 1 4.5 5.7a2 2 0 0 1 2-2.2z" />
    </svg>
  ),
  food: (p) => (
    <svg viewBox="0 0 24 24" width={p.s || 18} height={p.s || 18} fill="none" stroke={p.c || 'currentColor'} strokeWidth={p.w || 1.8} strokeLinecap="round" strokeLinejoin="round">
      <path d="M12 8c-1-3-4-3.5-6-2-2.4 1.8-2 6 0 9 1.2 1.8 2.4 3 4 3 .8 0 1.3-.4 2-.4s1.2.4 2 .4c1.6 0 2.8-1.2 4-3 1-1.5 1.6-3.6 1.2-5.2" />
      <path d="M12 8c0-2 1.2-3.5 3.2-4" />
    </svg>
  ),
  animo: (p) => (
    <svg viewBox="0 0 24 24" width={p.s || 18} height={p.s || 18} fill="none" stroke={p.c || 'currentColor'} strokeWidth={p.w || 1.8} strokeLinecap="round" strokeLinejoin="round">
      <circle cx="12" cy="12" r="9" /><path d="M8.5 14a4.5 4.5 0 0 0 7 0" /><circle cx="9" cy="10" r=".6" fill={p.c || 'currentColor'} stroke="none" /><circle cx="15" cy="10" r=".6" fill={p.c || 'currentColor'} stroke="none" />
    </svg>
  ),
  doc: (p) => (
    <svg viewBox="0 0 24 24" width={p.s || 18} height={p.s || 18} fill="none" stroke={p.c || 'currentColor'} strokeWidth={p.w || 1.8} strokeLinecap="round" strokeLinejoin="round">
      <path d="M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8z" /><path d="M14 3v5h5M9 13h6M9 17h6" />
    </svg>
  ),
  clip: (p) => (
    <svg viewBox="0 0 24 24" width={p.s || 18} height={p.s || 18} fill="none" stroke={p.c || 'currentColor'} strokeWidth={p.w || 1.8} strokeLinecap="round" strokeLinejoin="round">
      <path d="M21 11l-8.5 8.5a5 5 0 0 1-7-7L13 4a3.4 3.4 0 0 1 5 5l-8.5 8.5a1.8 1.8 0 0 1-2.5-2.5L15 7" />
    </svg>
  ),
  plus: (p) => (
    <svg viewBox="0 0 24 24" width={p.s || 18} height={p.s || 18} fill="none" stroke={p.c || 'currentColor'} strokeWidth={p.w || 2} strokeLinecap="round" strokeLinejoin="round">
      <path d="M12 5v14M5 12h14" />
    </svg>
  ),
  home: (p) => (
    <svg viewBox="0 0 24 24" width={p.s || 18} height={p.s || 18} fill={p.fill || 'none'} stroke={p.c || 'currentColor'} strokeWidth={p.w || 1.9} strokeLinecap="round" strokeLinejoin="round">
      <path d="M4 11l8-7 8 7v8a1.5 1.5 0 0 1-1.5 1.5h-13A1.5 1.5 0 0 1 4 19z" />
    </svg>
  ),
  alert: (p) => (
    <svg viewBox="0 0 24 24" width={p.s || 18} height={p.s || 18} fill="none" stroke={p.c || 'currentColor'} strokeWidth={p.w || 1.9} strokeLinecap="round" strokeLinejoin="round">
      <path d="M12 3l9 16H3z" /><path d="M12 10v4M12 17v.5" />
    </svg>
  ),
  calendar: (p) => (
    <svg viewBox="0 0 24 24" width={p.s || 18} height={p.s || 18} fill="none" stroke={p.c || 'currentColor'} strokeWidth={p.w || 1.8} strokeLinecap="round" strokeLinejoin="round">
      <rect x="4" y="5" width="16" height="16" rx="3" /><path d="M4 9h16M8 3v4M16 3v4" /><path d="M9 14h2M14 14h1" />
    </svg>
  ),
  pill: (p) => (
    <svg viewBox="0 0 24 24" width={p.s || 18} height={p.s || 18} fill="none" stroke={p.c || 'currentColor'} strokeWidth={p.w || 1.8} strokeLinecap="round" strokeLinejoin="round">
      <rect x="3" y="8" width="18" height="8" rx="4" transform="rotate(45 12 12)" /><path d="M9 9l6 6" />
    </svg>
  ),
  lab: (p) => (
    <svg viewBox="0 0 24 24" width={p.s || 18} height={p.s || 18} fill="none" stroke={p.c || 'currentColor'} strokeWidth={p.w || 1.8} strokeLinecap="round" strokeLinejoin="round">
      <path d="M9 3v6L4.5 17a2 2 0 0 0 1.8 3h11.4a2 2 0 0 0 1.8-3L15 9V3" /><path d="M8 3h8M7.5 14h9" />
    </svg>
  ),
  bell: (p) => (
    <svg viewBox="0 0 24 24" width={p.s || 18} height={p.s || 18} fill="none" stroke={p.c || 'currentColor'} strokeWidth={p.w || 1.8} strokeLinecap="round" strokeLinejoin="round">
      <path d="M6 9a6 6 0 0 1 12 0c0 5 2 6 2 6H4s2-1 2-6z" /><path d="M10 20a2 2 0 0 0 4 0" />
    </svg>
  ),
  upload: (p) => (
    <svg viewBox="0 0 24 24" width={p.s || 18} height={p.s || 18} fill="none" stroke={p.c || 'currentColor'} strokeWidth={p.w || 1.8} strokeLinecap="round" strokeLinejoin="round">
      <path d="M12 16V4M8 8l4-4 4 4" /><path d="M5 16v3a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-3" />
    </svg>
  ),
  camera: (p) => (
    <svg viewBox="0 0 24 24" width={p.s || 18} height={p.s || 18} fill="none" stroke={p.c || 'currentColor'} strokeWidth={p.w || 1.8} strokeLinecap="round" strokeLinejoin="round">
      <path d="M4 8h3l1.5-2h7L17 8h3a1 1 0 0 1 1 1v9a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V9a1 1 0 0 1 1-1z" /><circle cx="12" cy="13" r="3.2" />
    </svg>
  ),
  scan: (p) => (
    <svg viewBox="0 0 24 24" width={p.s || 18} height={p.s || 18} fill="none" stroke={p.c || 'currentColor'} strokeWidth={p.w || 1.8} strokeLinecap="round" strokeLinejoin="round">
      <path d="M4 8V6a2 2 0 0 1 2-2h2M16 4h2a2 2 0 0 1 2 2v2M20 16v2a2 2 0 0 1-2 2h-2M8 20H6a2 2 0 0 1-2-2v-2" /><path d="M4 12h16" />
    </svg>
  ),
  card: (p) => (
    <svg viewBox="0 0 24 24" width={p.s || 18} height={p.s || 18} fill="none" stroke={p.c || 'currentColor'} strokeWidth={p.w || 1.8} strokeLinecap="round" strokeLinejoin="round">
      <rect x="3" y="5" width="18" height="14" rx="3" /><path d="M3 10h18M7 15h4" />
    </svg>
  ),
  refresh: (p) => (
    <svg viewBox="0 0 24 24" width={p.s || 18} height={p.s || 18} fill="none" stroke={p.c || 'currentColor'} strokeWidth={p.w || 1.8} strokeLinecap="round" strokeLinejoin="round">
      <path d="M20 11a8 8 0 0 0-14-4.5L4 8M4 4v4h4" /><path d="M4 13a8 8 0 0 0 14 4.5L20 16M20 20v-4h-4" />
    </svg>
  ),
  arrowRight: (p) => (
    <svg viewBox="0 0 24 24" width={p.s || 18} height={p.s || 18} fill="none" stroke={p.c || 'currentColor'} strokeWidth={p.w || 2} strokeLinecap="round" strokeLinejoin="round">
      <path d="M5 12h14M13 6l6 6-6 6" />
    </svg>
  ),
  users: (p) => (
    <svg viewBox="0 0 24 24" width={p.s || 18} height={p.s || 18} fill="none" stroke={p.c || 'currentColor'} strokeWidth={p.w || 1.8} strokeLinecap="round" strokeLinejoin="round">
      <circle cx="9" cy="8" r="3.4" /><path d="M3 20c0-3.3 2.7-5.4 6-5.4s6 2.1 6 5.4" /><path d="M16 5.2a3.4 3.4 0 0 1 0 6.4M18 14.6c2.2.5 3.8 2.2 3.8 5.4" />
    </svg>
  ),
  swap: (p) => (
    <svg viewBox="0 0 24 24" width={p.s || 18} height={p.s || 18} fill="none" stroke={p.c || 'currentColor'} strokeWidth={p.w || 1.8} strokeLinecap="round" strokeLinejoin="round">
      <path d="M7 4L3 8l4 4" /><path d="M3 8h13a4 4 0 0 1 4 4" /><path d="M17 20l4-4-4-4" /><path d="M21 16H8a4 4 0 0 1-4-4" />
    </svg>
  ),
  child: (p) => (
    <svg viewBox="0 0 24 24" width={p.s || 18} height={p.s || 18} fill="none" stroke={p.c || 'currentColor'} strokeWidth={p.w || 1.8} strokeLinecap="round" strokeLinejoin="round">
      <circle cx="12" cy="6" r="2.6" /><path d="M12 8.6V15M8 11h8M9.5 20l2.5-5 2.5 5" />
    </svg>
  ),
  logout: (p) => (
    <svg viewBox="0 0 24 24" width={p.s || 18} height={p.s || 18} fill="none" stroke={p.c || 'currentColor'} strokeWidth={p.w || 1.8} strokeLinecap="round" strokeLinejoin="round">
      <path d="M14 20H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h8" /><path d="M17 16l4-4-4-4M21 12H9" />
    </svg>
  ),
  consent: (p) => (
    <svg viewBox="0 0 24 24" width={p.s || 18} height={p.s || 18} fill="none" stroke={p.c || 'currentColor'} strokeWidth={p.w || 1.8} strokeLinecap="round" strokeLinejoin="round">
      <path d="M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8z" /><path d="M14 3v5h5" /><path d="M9.5 14l1.8 1.8 3.2-3.6" />
    </svg>
  ),
  video: (p) => (
    <svg viewBox="0 0 24 24" width={p.s || 18} height={p.s || 18} fill="none" stroke={p.c || 'currentColor'} strokeWidth={p.w || 1.8} strokeLinecap="round" strokeLinejoin="round">
      <rect x="3" y="6" width="13" height="12" rx="2.5" /><path d="M16 10l5-3v10l-5-3z" />
    </svg>
  ),
  brain: (p) => (
    <svg viewBox="0 0 24 24" width={p.s || 18} height={p.s || 18} fill="none" stroke={p.c || 'currentColor'} strokeWidth={p.w || 1.7} strokeLinecap="round" strokeLinejoin="round">
      <path d="M12 5a2.5 2.5 0 0 0-4.6-1.3A2.4 2.4 0 0 0 4.5 6 2.4 2.4 0 0 0 4 10.5a2.5 2.5 0 0 0 1 4.2 2.4 2.4 0 0 0 3.4 2.6A2.5 2.5 0 0 0 12 19z" /><path d="M12 5a2.5 2.5 0 0 1 4.6-1.3A2.4 2.4 0 0 1 19.5 6 2.4 2.4 0 0 1 20 10.5a2.5 2.5 0 0 1-1 4.2 2.4 2.4 0 0 1-3.4 2.6A2.5 2.5 0 0 1 12 19z" /><path d="M12 5v14" />
    </svg>
  ),
  pin: (p) => (
    <svg viewBox="0 0 24 24" width={p.s || 18} height={p.s || 18} fill={p.fill || 'none'} stroke={p.c || 'currentColor'} strokeWidth={p.w || 1.8} strokeLinecap="round" strokeLinejoin="round">
      <path d="M12 21s-6.5-5.6-6.5-11A6.5 6.5 0 0 1 18.5 10c0 5.4-6.5 11-6.5 11z" /><circle cx="12" cy="10" r="2.4" />
    </svg>
  ),
  star: (p) => (
    <svg viewBox="0 0 24 24" width={p.s || 18} height={p.s || 18} fill={p.fill || 'none'} stroke={p.c || 'currentColor'} strokeWidth={p.w || 1.6} strokeLinecap="round" strokeLinejoin="round">
      <path d="M12 3.5l2.6 5.3 5.9.9-4.3 4.1 1 5.8L12 17l-5.2 2.7 1-5.8L3.5 9.7l5.9-.9z" />
    </svg>
  ),
  clock: (p) => (
    <svg viewBox="0 0 24 24" width={p.s || 18} height={p.s || 18} fill="none" stroke={p.c || 'currentColor'} strokeWidth={p.w || 1.8} strokeLinecap="round" strokeLinejoin="round">
      <circle cx="12" cy="12" r="9" /><path d="M12 7v5l3.5 2" />
    </svg>
  ),
  grid: (p) => (
    <svg viewBox="0 0 24 24" width={p.s || 18} height={p.s || 18} fill={p.fill || 'none'} stroke={p.c || 'currentColor'} strokeWidth={p.w || 1.9} strokeLinecap="round" strokeLinejoin="round">
      <rect x="4" y="4" width="7" height="7" rx="2" /><rect x="13" y="4" width="7" height="7" rx="2" /><rect x="4" y="13" width="7" height="7" rx="2" /><rect x="13" y="13" width="7" height="7" rx="2" />
    </svg>
  ),
  route: (p) => (
    <svg viewBox="0 0 24 24" width={p.s || 18} height={p.s || 18} fill="none" stroke={p.c || 'currentColor'} strokeWidth={p.w || 1.8} strokeLinecap="round" strokeLinejoin="round">
      <circle cx="6" cy="19" r="2.4" /><circle cx="18" cy="5" r="2.4" /><path d="M8 17.5c6-1 8-3.5 8-8.5" />
    </svg>
  ),
  droplet: (p) => (
    <svg viewBox="0 0 24 24" width={p.s || 18} height={p.s || 18} fill={p.fill || 'none'} stroke={p.c || 'currentColor'} strokeWidth={p.w || 1.8} strokeLinecap="round" strokeLinejoin="round">
      <path d="M12 3.5s6 6.4 6 10.5a6 6 0 0 1-12 0c0-4.1 6-10.5 6-10.5z" />
    </svg>
  ),
  flame: (p) => (
    <svg viewBox="0 0 24 24" width={p.s || 18} height={p.s || 18} fill={p.fill || 'none'} stroke={p.c || 'currentColor'} strokeWidth={p.w || 1.7} strokeLinecap="round" strokeLinejoin="round">
      <path d="M12 3c1 3-2 4-2 7a2 2 0 0 0 4 0c0-1 0-1.5.5-2 1 1.5 2.5 3 2.5 5.5a5 5 0 0 1-10 0C7 12 11 10 12 3z" />
    </svg>
  ),
  sunrise: (p) => (
    <svg viewBox="0 0 24 24" width={p.s || 18} height={p.s || 18} fill="none" stroke={p.c || 'currentColor'} strokeWidth={p.w || 1.8} strokeLinecap="round" strokeLinejoin="round">
      <path d="M12 4v3M5.6 9.6l-1-1M18.4 9.6l1-1M3 17h2M19 17h2M8.5 17a3.5 3.5 0 0 1 7 0" /><path d="M2 21h20M9 7l3-3 3 3" />
    </svg>
  ),
  sundial: (p) => (
    <svg viewBox="0 0 24 24" width={p.s || 18} height={p.s || 18} fill="none" stroke={p.c || 'currentColor'} strokeWidth={p.w || 1.8} strokeLinecap="round" strokeLinejoin="round">
      <circle cx="12" cy="12" r="4.5" /><path d="M12 2v2M12 20v2M2 12h2M20 12h2M5 5l1.4 1.4M17.6 17.6L19 19M19 5l-1.4 1.4M6.4 17.6L5 19" />
    </svg>
  ),
  walk: (p) => (
    <svg viewBox="0 0 24 24" width={p.s || 18} height={p.s || 18} fill="none" stroke={p.c || 'currentColor'} strokeWidth={p.w || 1.8} strokeLinecap="round" strokeLinejoin="round">
      <circle cx="13" cy="4.5" r="1.6" /><path d="M11 21l1.5-5L10 13l1-5 3 2 2 2M9 21l2.5-5" />
    </svg>
  ),
  stethoscope: (p) => (
    <svg viewBox="0 0 24 24" width={p.s || 18} height={p.s || 18} fill="none" stroke={p.c || 'currentColor'} strokeWidth={p.w || 1.8} strokeLinecap="round" strokeLinejoin="round">
      <path d="M6 3v5a4 4 0 0 0 8 0V3" /><path d="M10 16v-3" /><circle cx="18" cy="16" r="2.5" /><path d="M16 17.5c-.5 2-2.5 3.5-6 3.5s-5.5-2-5.5-5" />
    </svg>
  ),
};

// ── Brand wordmark + pulse mark ─────────────────────────────────
function PreventMark({ t, size = 16, withWord = true }) {
  return (
    <div style={{ display: 'flex', alignItems: 'center', gap: 8 }}>
      <div style={{
        width: size + 12, height: size + 12, borderRadius: 9,
        display: 'grid', placeItems: 'center',
        background: `linear-gradient(135deg, ${t.accent}, ${t.accentDeep})`,
        boxShadow: `0 4px 14px ${hexA(t.accent, 0.4)}`,
      }}>
        {Icon.pulse({ s: size, c: t.onAccent, w: 2.4 })}
      </div>
      {withWord && (
        <span style={{
          fontFamily: 'Hanken Grotesk, sans-serif', fontWeight: 700,
          letterSpacing: 2.5, fontSize: size - 2, color: t.text, textTransform: 'uppercase',
        }}>prevent</span>
      )}
    </div>
  );
}

// ── helpers ─────────────────────────────────────────────────────
function hexA(hex, a) {
  const h = hex.replace('#', '');
  const r = parseInt(h.substring(0, 2), 16);
  const g = parseInt(h.substring(2, 4), 16);
  const b = parseInt(h.substring(4, 6), 16);
  return `rgba(${r},${g},${b},${a})`;
}

Object.assign(window, { getTheme, VITA_PERSONAS, Icon, PreventMark, hexA });
