// TASKS PLATFORM — Shared tokens (cobalt "work" accent)
const Ttk = window.ArbiterTokens;

const tk = {
  // Accent — cobalt blue
  cobalt:       '#2563EB',
  cobaltDark:   '#1E40AF',
  cobaltBg:     'rgba(37,99,235,0.07)',
  cobaltBorder: 'rgba(37,99,235,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: Ttk.color.bg.primary },
  header: {
    padding: '16px 24px', borderBottom: `1px solid ${Ttk.color.border.light}`,
    background: Ttk.color.bg.card, display: 'flex', alignItems: 'center', justifyContent: 'space-between',
  },
  headerTitle: { display: 'flex', alignItems: 'center', gap: '12px' },
  tkIcon: {
    width: '32px', height: '32px', borderRadius: '6px',
    background: 'linear-gradient(135deg, #2563EB 0%, #1E40AF 100%)',
    display: 'flex', alignItems: 'center', justifyContent: 'center',
    fontSize: '15px', color: '#fff', fontWeight: 700,
  },
  title:    { fontSize: '18px', fontWeight: 700, color: Ttk.color.text.primary, letterSpacing: '-0.02em' },
  subtitle: { fontSize: '12px', color: Ttk.color.text.tertiary, marginTop: '1px' },

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

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

  stat:      { display: 'flex', flexDirection: 'column', gap: '2px', padding: '12px 16px', background: Ttk.color.bg.secondary, borderRadius: '6px', border: `1px solid ${Ttk.color.border.light}` },
  statLabel: { fontSize: '10px', fontWeight: 600, color: Ttk.color.text.tertiary, textTransform: 'uppercase', letterSpacing: '0.08em' },
  statValue: { fontSize: '22px', fontWeight: 700, letterSpacing: '-0.02em', lineHeight: 1.1, color: Ttk.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: Ttk.color.text.tertiary, textTransform: 'uppercase', letterSpacing: '0.08em', padding: '8px 12px', textAlign: 'left', background: Ttk.color.bg.secondary, borderBottom: `1px solid ${Ttk.color.border.light}` },
  td: { fontSize: '12px', color: Ttk.color.text.primary, padding: '10px 12px', borderBottom: `1px solid ${Ttk.color.border.light}`, verticalAlign: 'middle' },

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

  // Priority color
  priorityColor: (p) => ({
    high:   { bg: 'rgba(159,18,57,0.08)', color: '#9F1239' },
    medium: { bg: 'rgba(180,83,9,0.08)',  color: '#B45309' },
    low:    { bg: 'rgba(5,150,105,0.08)', color: '#059669' },
  }[p] || { bg: 'rgba(71,85,105,0.06)', color: '#475569' }),

  // Status color
  statusColor: (s) => ({
    'To Do':       { bg: 'rgba(71,85,105,0.08)',  color: '#475569' },
    'In Progress': { bg: 'rgba(37,99,235,0.08)',  color: '#2563EB' },
    'In Review':   { bg: 'rgba(180,83,9,0.08)',   color: '#B45309' },
    'Done':        { bg: 'rgba(5,150,105,0.08)',  color: '#059669' },
  }[s] || { bg: 'rgba(71,85,105,0.06)', color: '#475569' }),
};

window.__tk = tk;
