/* ============================================================
   AXIS — Design tokens & base styles
   ============================================================ */

:root {
  /* Brand */
  --indigo-50:  #EEF2FF;
  --indigo-100: #E0E7FF;
  --indigo-200: #C7D2FE;
  --indigo-300: #A5B4FC;
  --indigo-400: #818CF8;
  --indigo-500: #6366F1;
  --indigo-600: #4F46E5;
  --indigo-700: #4338CA;

  /* Slate scale */
  --slate-50:  #F8FAFC;
  --slate-100: #F1F5F9;
  --slate-200: #E2E8F0;
  --slate-300: #CBD5E1;
  --slate-400: #94A3B8;
  --slate-500: #64748B;
  --slate-600: #475569;
  --slate-700: #334155;
  --slate-800: #1E293B;
  --slate-900: #0F172A;

  /* Semantic */
  --green-50:  #ECFDF5;  --green-500: #10B981;  --green-600: #059669;  --green-700: #047857;
  --amber-50:  #FFFBEB;  --amber-500: #F59E0B;  --amber-600: #D97706;  --amber-700: #B45309;
  --red-50:    #FEF2F2;  --red-500:   #EF4444;  --red-600:   #DC2626;  --red-700:   #B91C1C;
  --blue-50:   #EFF6FF;  --blue-500:  #3B82F6;  --blue-600:  #2563EB;  --blue-700:  #1D4ED8;
  --violet-500:#8B5CF6;

  /* Semantic roles — light theme */
  --canvas:     #FAFBFC;
  --surface:    #FFFFFF;
  --surface-2:  #F8FAFC;
  --surface-hover: #F1F5F9;
  --sidebar-bg: #FFFFFF;
  --ink:        #0F172A;
  --ink-2:      #1E293B;
  --text:       #334155;
  --text-2:     #64748B;
  --text-3:     #94A3B8;
  --border:     #E9EDF2;
  --border-2:   #E2E8F0;
  --primary:    #4F46E5;
  --primary-hover: #4338CA;
  --primary-soft:  #EEF2FF;
  --on-primary: #FFFFFF;
  --ring:       rgba(79,70,229,.35);

  --shadow-xs: 0 1px 2px rgba(15,23,42,.05);
  --shadow-sm: 0 1px 2px rgba(15,23,42,.04), 0 1px 3px rgba(15,23,42,.06);
  --shadow-md: 0 2px 4px rgba(15,23,42,.04), 0 4px 12px rgba(15,23,42,.07);
  --shadow-lg: 0 8px 16px rgba(15,23,42,.08), 0 16px 40px rgba(15,23,42,.12);
  --shadow-pop: 0 4px 12px rgba(15,23,42,.10), 0 12px 32px rgba(15,23,42,.16);

  --r-sm: 6px;
  --r-md: 8px;
  --r-lg: 10px;
  --r-xl: 14px;
  --r-2xl: 18px;

  --sidebar-w: 248px;
  --sidebar-w-collapsed: 72px;
  --topbar-h: 60px;

  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
}

[data-theme="dark"] {
  --canvas:     #0B1120;
  --surface:    #111827;
  --surface-2:  #161E2E;
  --surface-hover: #1C2538;
  --sidebar-bg: #0E1626;
  --ink:        #F8FAFC;
  --ink-2:      #E2E8F0;
  --text:       #CBD5E1;
  --text-2:     #94A3B8;
  --text-3:     #64748B;
  --border:     #1F2A3D;
  --border-2:   #273449;
  --primary:    #6366F1;
  --primary-hover: #818CF8;
  --primary-soft:  #1E1B4B;
  --on-primary: #FFFFFF;
  --ring:       rgba(129,140,248,.4);

  --shadow-xs: 0 1px 2px rgba(0,0,0,.3);
  --shadow-sm: 0 1px 3px rgba(0,0,0,.35);
  --shadow-md: 0 2px 6px rgba(0,0,0,.35), 0 8px 20px rgba(0,0,0,.35);
  --shadow-lg: 0 10px 30px rgba(0,0,0,.5);
  --shadow-pop: 0 12px 32px rgba(0,0,0,.55);

  --green-50: rgba(16,185,129,.12);
  --amber-50: rgba(245,158,11,.12);
  --red-50:   rgba(239,68,68,.12);
  --blue-50:  rgba(59,130,246,.12);
  --indigo-50: rgba(99,102,241,.14);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: var(--font);
  background: var(--canvas);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-size: 14px;
  line-height: 1.5;
  font-feature-settings: 'cv01','cv02','cv03','ss01';
}

#root { height: 100%; }

button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input { font-family: inherit; }
a { color: inherit; text-decoration: none; }
::selection { background: var(--indigo-200); color: var(--slate-900); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 99px; border: 3px solid var(--canvas); }
::-webkit-scrollbar-thumb:hover { background: var(--slate-400); }

.icon { width: 18px; height: 18px; flex: none; stroke: currentColor; stroke-width: 1.75; fill: none; stroke-linecap: round; stroke-linejoin: round; }

/* Focus ring */
:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ring); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 16px; border-radius: var(--r-md);
  font-size: 13.5px; font-weight: 600; letter-spacing: -0.01em;
  transition: background .15s, box-shadow .15s, transform .05s, border-color .15s, color .15s;
  white-space: nowrap; user-select: none;
}
.btn:active { transform: translateY(.5px); }
.btn-primary { background: var(--primary); color: var(--on-primary); box-shadow: var(--shadow-xs); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-primary:disabled { opacity: .6; cursor: not-allowed; }
.btn-ghost { color: var(--text); }
.btn-ghost:hover { background: var(--surface-hover); }
.btn-outline { background: var(--surface); color: var(--ink-2); border: 1px solid var(--border-2); box-shadow: var(--shadow-xs); }
.btn-outline:hover { background: var(--surface-2); border-color: var(--slate-300); }
.btn-sm { height: 32px; padding: 0 12px; font-size: 12.5px; }
.btn-icon { width: 36px; height: 36px; padding: 0; border-radius: var(--r-md); color: var(--text-2); position: relative; }
.btn-icon:hover { background: var(--surface-hover); color: var(--ink-2); }

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-sm);
}

/* ---------- Pills / badges ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  height: 24px; padding: 0 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600; letter-spacing: -0.01em;
  white-space: nowrap;
}
.pill .dot { width: 6px; height: 6px; border-radius: 99px; background: currentColor; }
.pill-green  { color: var(--green-700);  background: var(--green-50); }
.pill-amber  { color: var(--amber-700);  background: var(--amber-50); }
.pill-red    { color: var(--red-700);    background: var(--red-50); }
.pill-blue   { color: var(--blue-700);   background: var(--blue-50); }
.pill-slate  { color: var(--text-2);     background: var(--surface-hover); }
.pill-indigo { color: var(--indigo-700); background: var(--indigo-50); }
[data-theme="dark"] .pill-green { color: #6EE7B7; }
[data-theme="dark"] .pill-amber { color: #FCD34D; }
[data-theme="dark"] .pill-red   { color: #FCA5A5; }
[data-theme="dark"] .pill-blue  { color: #93C5FD; }
[data-theme="dark"] .pill-indigo{ color: #C7D2FE; }

/* ---------- Avatars ---------- */
.avatar {
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 999px; color: #fff; font-weight: 600;
  font-size: 12px; letter-spacing: -0.02em; flex: none;
  background: var(--av, var(--indigo-500));
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.12);
}
.avatar-stack { display: flex; }
.avatar-stack .avatar { box-shadow: 0 0 0 2px var(--surface); margin-left: -8px; }
.avatar-stack .avatar:first-child { margin-left: 0; }

/* ---------- Progress ---------- */
.progress { height: 6px; border-radius: 99px; background: var(--surface-hover); overflow: hidden; }
.progress > i { display: block; height: 100%; border-radius: 99px; background: var(--primary); transition: width .6s cubic-bezier(.2,.7,.2,1); }

/* ---------- Misc ---------- */
.divider { height: 1px; background: var(--border); border: 0; }
.kbd {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; padding: 0 4px; border-radius: 4px;
  font-size: 11px; font-weight: 600; color: var(--text-2);
  background: var(--surface-hover); border: 1px solid var(--border-2);
  font-family: var(--font);
}
.eyebrow { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); }
.muted { color: var(--text-2); }

@keyframes spin { to { transform: rotate(360deg); } }
.spinner { width: 16px; height: 16px; border-radius: 99px; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; animation: spin .6s linear infinite; }

@keyframes shimmer { 100% { background-position: -200% 0; } }
.skel {
  background: linear-gradient(90deg, var(--surface-hover) 25%, var(--border) 37%, var(--surface-hover) 63%);
  background-size: 200% 100%; animation: shimmer 1.3s infinite; border-radius: 6px;
}

@keyframes fadeUp { from { transform: translateY(9px); } to { transform: translateY(0); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn { from { transform: translateY(-4px) scale(.985); } to { transform: translateY(0) scale(1); } }
.animate-in { animation: fadeUp .4s cubic-bezier(.2,.7,.2,1) forwards; }
