/* ============================================
   BASE.CSS — Design System Tokens & Reset
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  /* Color Palette — Light Professional */
  --color-bg: #f4f6fa;
  --color-surface: #ffffff;
  --color-surface-2: #f8fafc;
  --color-surface-3: #eef1f6;
  --color-border: #e2e8f0;
  --color-border-strong: #cbd5e1;

  /* Brand */
  --color-primary: #1a56db;
  --color-primary-hover: #1648c3;
  --color-primary-light: #ebf0ff;
  --color-primary-subtle: #dbeafe;

  /* Semantic */
  --color-profit: #059669;
  --color-profit-light: #d1fae5;
  --color-loss: #dc2626;
  --color-loss-light: #fee2e2;
  --color-warning: #d97706;
  --color-warning-light: #fef3c7;
  --color-info: #0891b2;
  --color-info-light: #e0f2fe;

  /* Text */
  --color-text: #0f172a;
  --color-text-2: #334155;
  --color-text-3: #64748b;
  --color-text-4: #94a3b8;
  --color-text-inverse: #ffffff;

  /* Shadows */
  --shadow-xs: 0 1px 2px rgba(15,23,42,0.05);
  --shadow-sm: 0 1px 3px rgba(15,23,42,0.08), 0 1px 2px rgba(15,23,42,0.04);
  --shadow-md: 0 4px 6px rgba(15,23,42,0.06), 0 2px 4px rgba(15,23,42,0.04);
  --shadow-lg: 0 10px 15px rgba(15,23,42,0.08), 0 4px 6px rgba(15,23,42,0.04);
  --shadow-xl: 0 20px 25px rgba(15,23,42,0.1), 0 8px 10px rgba(15,23,42,0.04);

  /* Spacing */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;

  /* Radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  /* Transitions */
  --transition-fast: 120ms ease;
  --transition-base: 200ms ease;
  --transition-slow: 350ms ease;

  /* Sidebar */
  --sidebar-width: 252px;
  --sidebar-collapsed: 68px;
  --header-height: 64px;
}

/* Dark Mode */
[data-theme="dark"] {
  --color-bg: #0b0f1a;
  --color-surface: #111827;
  --color-surface-2: #1a2236;
  --color-surface-3: #1e293b;
  --color-border: #1e2d45;
  --color-border-strong: #2d3f5e;
  --color-primary: #3b82f6;
  --color-primary-hover: #2563eb;
  --color-primary-light: #1e3a5f;
  --color-primary-subtle: #1e3a5f;
  --color-profit: #10b981;
  --color-profit-light: #064e3b;
  --color-loss: #f87171;
  --color-loss-light: #450a0a;
  --color-warning: #fbbf24;
  --color-warning-light: #451a03;
  --color-info: #22d3ee;
  --color-info-light: #0c3a4a;
  --color-text: #f1f5f9;
  --color-text-2: #cbd5e1;
  --color-text-3: #94a3b8;
  --color-text-4: #475569;
  --color-text-inverse: #0f172a;
  --shadow-xs: 0 1px 2px rgba(0,0,0,0.3);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.4);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.4);
  --shadow-lg: 0 10px 15px rgba(0,0,0,0.4);
  --shadow-xl: 0 20px 25px rgba(0,0,0,0.5);
}

/* === RESET === */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  font-family: var(--font-sans);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

a {
  color: var(--color-primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}
a:hover { color: var(--color-primary-hover); }

img, svg { display: block; max-width: 100%; }

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
}

/* === TYPOGRAPHY === */
h1 { font-size: 2rem; font-weight: 700; line-height: 1.2; letter-spacing: -0.025em; }
h2 { font-size: 1.5rem; font-weight: 700; line-height: 1.3; letter-spacing: -0.02em; }
h3 { font-size: 1.2rem; font-weight: 600; line-height: 1.4; }
h4 { font-size: 1rem; font-weight: 600; line-height: 1.4; }

.text-xs  { font-size: 0.75rem; }
.text-sm  { font-size: 0.825rem; }
.text-md  { font-size: 1rem; }
.text-lg  { font-size: 1.125rem; }
.text-xl  { font-size: 1.25rem; }
.text-2xl { font-size: 1.5rem; }
.text-3xl { font-size: 1.875rem; }

.font-medium  { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold    { font-weight: 700; }
.font-mono    { font-family: var(--font-mono); }

.text-muted   { color: var(--color-text-3); }
.text-primary { color: var(--color-primary); }
.text-profit  { color: var(--color-profit); }
.text-loss    { color: var(--color-loss); }
.text-warning { color: var(--color-warning); }

/* === SCROLLBAR === */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--color-border-strong); border-radius: var(--radius-full); }
::-webkit-scrollbar-thumb:hover { background: var(--color-text-4); }

/* === UTILITIES === */
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border-width: 0;
}
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }
.w-full { width: 100%; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
