// PERSONA PLATFORM — Shared tokens (indigo "mind" accent)
const Tpn = window.ArbiterTokens;

const pn = {
  // Accent — deep indigo
  indigo:       '#4F46E5',
  indigoDark:   '#3730A3',
  indigoBg:     'rgba(79,70,229,0.07)',
  indigoBorder: 'rgba(79,70,229,0.22)',

  violet:    '#7C3AED',
  violetBg:  'rgba(124,58,237,0.08)',

  crimson:   '#9F1239',
  crimsonBg: 'rgba(159,18,57,0.07)',

  amber:     '#B45309',
  amberBg:   'rgba(180,83,9,0.08)',

  orange:    '#EA580C',
  orangeBg:  'rgba(234,88,12,0.08)',

  emerald:   '#059669',
  emeraldBg: 'rgba(5,150,105,0.08)',

  teal:      '#0D9488',
  tealBg:    'rgba(13,148,136,0.08)',

  slate:     '#475569',
  slateBg:   'rgba(71,85,105,0.06)',

  // Layout
  container: { flex: 1, overflow: 'auto', background: Tpn.color.bg.primary },
  header: {
    padding: '16px 24px', borderBottom: `1px solid ${Tpn.color.border.light}`,
    background: Tpn.color.bg.card, display: 'flex', alignItems: 'center', justifyContent: 'space-between',
  },
  headerTitle: { display: 'flex', alignItems: 'center', gap: '12px' },
  pnIcon: {
    width: '32px', height: '32px', borderRadius: '6px',
    background: 'linear-gradient(135deg, #4F46E5 0%, #7C3AED 100%)',
    display: 'flex', alignItems: 'center', justifyContent: 'center',
    fontSize: '15px', color: '#fff',
  },
  title:    { fontSize: '18px', fontWeight: 700, color: Tpn.color.text.primary, letterSpacing: '-0.02em' },
  subtitle: { fontSize: '12px', color: Tpn.color.text.tertiary, marginTop: '1px' },

  tabs: {
    display: 'flex', gap: '0', borderBottom: `1px solid ${Tpn.color.border.light}`,
    background: Tpn.color.bg.card, padding: '0 24px', overflowX: 'auto',
  },
  tab: {
    padding: '10px 16px', fontSize: '12px', fontWeight: 500,
    color: Tpn.color.text.tertiary, cursor: 'pointer', border: 'none', background: 'none',
    borderBottom: '2px solid transparent', fontFamily: Tpn.font.family,
    transition: 'all 0.15s', marginBottom: '-1px', whiteSpace: 'nowrap',
  },
  tabActive: { color: '#4F46E5', borderBottom: '2px solid #4F46E5', fontWeight: 600 },
  body: { padding: '20px 24px' },

  card:  { background: Tpn.color.bg.card, border: `1px solid ${Tpn.color.border.light}`, borderRadius: Tpn.radius.lg, overflow: 'hidden', marginBottom: '16px' },
  cardH: { padding: '10px 16px', borderBottom: `1px solid ${Tpn.color.border.light}`, fontSize: '12px', fontWeight: 600, color: Tpn.color.text.primary, display: 'flex', alignItems: 'center', justifyContent: 'space-between' },

  stat:      { display: 'flex', flexDirection: 'column', gap: '2px', padding: '12px 16px', background: Tpn.color.bg.secondary, borderRadius: '6px', border: `1px solid ${Tpn.color.border.light}` },
  statLabel: { fontSize: '10px', fontWeight: 600, color: Tpn.color.text.tertiary, textTransform: 'uppercase', letterSpacing: '0.08em' },
  statValue: { fontSize: '22px', fontWeight: 700, letterSpacing: '-0.02em', lineHeight: 1.1, color: Tpn.color.text.primary },
  statDelta: { fontSize: '10px', fontWeight: 500, marginTop: '2px' },

  tag:  { display: 'inline-flex', alignItems: 'center', padding: '2px 8px', borderRadius: '10px', fontSize: '10px', fontWeight: 600 },
  pill: { display: 'inline-flex', alignItems: 'center', padding: '3px 10px', borderRadius: '12px', fontSize: '11px', fontWeight: 500, gap: '4px' },

  th: { fontSize: '10px', fontWeight: 600, color: Tpn.color.text.tertiary, textTransform: 'uppercase', letterSpacing: '0.08em', padding: '8px 12px', textAlign: 'left', background: Tpn.color.bg.secondary, borderBottom: `1px solid ${Tpn.color.border.light}` },
  td: { fontSize: '12px', color: Tpn.color.text.primary, padding: '10px 12px', borderBottom: `1px solid ${Tpn.color.border.light}`, verticalAlign: 'middle' },

  btnPrimary:   { padding: '6px 14px', borderRadius: '6px', background: '#4F46E5', border: 'none', color: '#fff', fontSize: '12px', fontWeight: 700, cursor: 'pointer', fontFamily: Tpn.font.family },
  btnSecondary: { padding: '5px 12px', borderRadius: '6px', border: `1px solid ${Tpn.color.border.light}`, background: Tpn.color.bg.card, fontSize: '11px', fontWeight: 500, color: Tpn.color.text.secondary, cursor: 'pointer', fontFamily: Tpn.font.family },
  btnGhost:     { padding: '4px 10px', borderRadius: '5px', border: 'none', background: 'transparent', fontSize: '11px', fontWeight: 500, color: '#4F46E5', cursor: 'pointer', fontFamily: Tpn.font.family },

  // Type → color
  typeColor: (t) => ({
    Defendant: { bg: 'rgba(159,18,57,0.08)',  color: '#9F1239',  label: 'Defendant' },
    Witness:   { bg: 'rgba(124,58,237,0.08)', color: '#7C3AED',  label: 'Witness'   },
    Attorney:  { bg: 'rgba(79,70,229,0.08)',  color: '#4F46E5',  label: 'Attorney'  },
    Judge:     { bg: 'rgba(5,150,105,0.08)',  color: '#059669',  label: 'Judge'     },
    Agent:     { bg: 'rgba(180,83,9,0.08)',   color: '#B45309',  label: 'Agent'     },
    Expert:    { bg: 'rgba(13,148,136,0.08)', color: '#0D9488',  label: 'Expert'    },
  }[t] || { bg: 'rgba(71,85,105,0.06)', color: '#475569', label: t }),

  // Risk → color
  riskColor: (r) => ({
    Critical: { bg: 'rgba(159,18,57,0.08)',  color: '#9F1239' },
    High:     { bg: 'rgba(234,88,12,0.08)',  color: '#EA580C' },
    Medium:   { bg: 'rgba(180,83,9,0.08)',   color: '#B45309' },
    Low:      { bg: 'rgba(5,150,105,0.08)',  color: '#059669' },
  }[r] || { bg: 'rgba(71,85,105,0.06)', color: '#475569' }),

  // OCEAN trait definitions
  oceanTraits: [
    { key: 'o', label: 'Openness',          desc: 'Intellectual curiosity, ambiguity tolerance',    color: '#4F46E5' },
    { key: 'c', label: 'Conscientiousness', desc: 'Self-discipline, goal-directedness',              color: '#059669' },
    { key: 'e', label: 'Extraversion',      desc: 'Social dominance, assertiveness',                color: '#B45309' },
    { key: 'a', label: 'Agreeableness',     desc: 'Cooperation, conflict aversion',                 color: '#7C3AED' },
    { key: 'n', label: 'Neuroticism',       desc: 'Emotional instability, stress reactivity',       color: '#9F1239' },
  ],
};

window.__pn = pn;
