/* PerpSync design tokens: the one place for color, type, spacing, radius, shadow, motion and layers. */

@font-face {
  font-family: 'Inter';
  src: url('/fonts/inter.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Bricolage Grotesque';
  src: url('/fonts/bricolage.woff2') format('woff2');
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'JetBrains Mono';
  src: url('/fonts/jbmono.woff2') format('woff2');
  font-weight: 100 800;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: dark;

  /* surfaces */
  --bg-0: #07090d;
  --bg-1: #0b0f16;
  --surface-1: #10151e;
  --surface-2: #141a24;
  --surface-3: #1a2230;
  --surface-hover: #1d2635;
  --overlay: rgba(3, 5, 8, 0.66);

  /* lines */
  --border: #1f2836;
  --border-strong: #2c3748;
  --highlight: rgba(255, 255, 255, 0.04);

  /* text */
  --text: #e9eef5;
  --text-2: #a3aec0;
  --text-3: #8794a8;
  --text-on-brand: #04170f;

  /* brand */
  --mint: #4ee6a6;
  --link: #4ee6a6;
  --blue: #6aa8ff;
  --grad-a: #4ee6a6;
  --grad-b: #6aa8ff;
  --brand-gradient: linear-gradient(135deg, var(--grad-a) 0%, var(--grad-b) 100%);
  --brand-glow: 0 0 0 1px rgba(78, 230, 166, 0.25), 0 8px 32px -8px rgba(78, 230, 166, 0.35);

  /* semantic */
  --up: #4ee6a6;
  --up-soft: rgba(78, 230, 166, 0.12);
  --down: #ff5c6c;
  --down-soft: rgba(255, 92, 108, 0.12);
  --on-down: #1f0306;
  --warn: #ffb547;
  --warn-soft: rgba(255, 181, 71, 0.13);
  --info: #6aa8ff;
  --info-soft: rgba(106, 168, 255, 0.13);
  --neutral-soft: rgba(163, 174, 192, 0.12);
  --focus: #6aa8ff;

  /* chart series */
  --c0: #4ee6a6;
  --c1: #6aa8ff;
  --c2: #ffb547;
  --c3: #ff7ab6;
  --c4: #b18cff;
  --c5: #5ad1e6;
  --c6: #f2e25a;
  --c7: #ff8f5c;

  /* type */
  --font-display: 'Bricolage Grotesque', 'Inter', system-ui, sans-serif;
  --font-ui: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --fs-12: 12px;
  --fs-13: 13px;
  --fs-14: 14px;
  --fs-16: 16px;
  --fs-18: 18px;
  --fs-22: 22px;
  --fs-28: 28px;
  --fs-36: 36px;
  --fs-48: 48px;
  --fs-hero: 56px;

  /* spacing (4px grid) */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 20px;
  --s-6: 24px;
  --s-8: 32px;
  --s-10: 40px;
  --s-14: 56px;
  --s-18: 72px;
  --gutter: 24px;

  /* radius */
  --r-chip: 8px;
  --r-control: 10px;
  --r-card: 14px;
  --r-sheet: 20px;
  --r-pill: 999px;

  /* elevation */
  --shadow-card: inset 0 1px 0 var(--highlight);
  --shadow-pop: 0 1px 0 var(--highlight) inset, 0 16px 48px -12px rgba(0, 0, 0, 0.6), 0 2px 8px rgba(0, 0, 0, 0.3);

  /* motion */
  --dur-1: 120ms;
  --dur-2: 180ms;
  --dur-3: 240ms;
  --dur-4: 500ms;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --ease-sheet: cubic-bezier(0.32, 0.72, 0, 1);

  /* layout */
  --sidebar-w: 232px;
  --sidebar-w-collapsed: 68px;
  --topbar-h: 60px;
  --tabbar-h: 64px;
  --content-max: 1280px;

  /* layers */
  --z-topbar: 20;
  --z-sidebar: 30;
  --z-tabbar: 30;
  --z-fab: 35;
  --z-toast: 100;
}

@media (max-width: 720px) {
  :root {
    --fs-hero: 44px;
    --gutter: 16px;
  }
}

/* Light theme: follows the system unless the user picked one in Settings > Appearance. */
@media (prefers-color-scheme: light) {
  :root:not([data-theme='dark']) {
    color-scheme: light;
    --bg-0: #f6f8fb;
    --bg-1: #eef2f7;
    --surface-1: #ffffff;
    --surface-2: #f7f9fc;
    --surface-3: #eef2f7;
    --surface-hover: #e8edf4;
    --overlay: rgba(15, 23, 42, 0.36);
    --border: #e3e8ef;
    --border-strong: #cfd7e3;
    --highlight: rgba(255, 255, 255, 0.7);
    --text: #0b1220;
    --text-2: #4a5568;
    --text-3: #5c687a;
    --up: #0b7d53;
  --link: #0b7d53;
    --link: #0b7d53;
    --up-soft: rgba(15, 157, 104, 0.1);
    --down: #d93848;
    --down-soft: rgba(217, 56, 72, 0.09);
    --on-down: #ffffff;
    --warn: #995700;
    --warn-soft: rgba(214, 140, 20, 0.13);
    --info: #2f6fd6;
    --info-soft: rgba(47, 111, 214, 0.1);
    --neutral-soft: rgba(74, 85, 104, 0.09);
    --focus: #2f6fd6;
    --c0: #12a874;
    --c1: #2f6fd6;
    --c2: #d68c14;
    --c3: #d6457f;
    --c4: #7d55d9;
    --c5: #1597ad;
    --c6: #a89300;
    --c7: #d9622b;
    --brand-glow: 0 0 0 1px rgba(15, 157, 104, 0.2), 0 8px 28px -10px rgba(15, 157, 104, 0.35);
    --shadow-card: 0 1px 2px rgba(15, 23, 42, 0.05);
    --shadow-pop: 0 18px 48px -12px rgba(15, 23, 42, 0.25), 0 2px 8px rgba(15, 23, 42, 0.08);
  }
}
:root[data-theme='light'] {
  color-scheme: light;
  --bg-0: #f6f8fb;
  --bg-1: #eef2f7;
  --surface-1: #ffffff;
  --surface-2: #f7f9fc;
  --surface-3: #eef2f7;
  --surface-hover: #e8edf4;
  --overlay: rgba(15, 23, 42, 0.36);
  --border: #e3e8ef;
  --border-strong: #cfd7e3;
  --highlight: rgba(255, 255, 255, 0.7);
  --text: #0b1220;
  --text-2: #4a5568;
  --text-3: #5c687a;
  --up: #0b7d53;
  --link: #0b7d53;
  --up-soft: rgba(15, 157, 104, 0.1);
  --down: #d93848;
  --down-soft: rgba(217, 56, 72, 0.09);
  --on-down: #ffffff;
  --warn: #995700;
  --warn-soft: rgba(214, 140, 20, 0.13);
  --info: #2f6fd6;
  --info-soft: rgba(47, 111, 214, 0.1);
  --neutral-soft: rgba(74, 85, 104, 0.09);
  --focus: #2f6fd6;
  --c0: #12a874;
  --c1: #2f6fd6;
  --c2: #d68c14;
  --c3: #d6457f;
  --c4: #7d55d9;
  --c5: #1597ad;
  --c6: #a89300;
  --c7: #d9622b;
  --brand-glow: 0 0 0 1px rgba(15, 157, 104, 0.2), 0 8px 28px -10px rgba(15, 157, 104, 0.35);
  --shadow-card: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-pop: 0 18px 48px -12px rgba(15, 23, 42, 0.25), 0 2px 8px rgba(15, 23, 42, 0.08);
}

@media (prefers-reduced-motion: reduce) {
  :root {
    --dur-1: 1ms;
    --dur-2: 1ms;
    --dur-3: 1ms;
    --dur-4: 1ms;
  }
}

/* Unlockable accents (Settings > Appearance). They change brand color only; profit/loss colors never change. */
:root[data-accent='gold'] {
  --grad-a: #f7d26a;
  --grad-b: #ff9f43;
  --mint: #f5c451;
  --link: #f5c451;
  --brand-glow: 0 0 0 1px rgba(245, 196, 81, 0.3), 0 8px 32px -8px rgba(255, 159, 67, 0.4);
}
:root[data-accent='legend'] {
  --grad-a: #c4a5ff;
  --grad-b: #ff7ab6;
  --mint: #c4a5ff;
  --link: #c4a5ff;
  --brand-glow: 0 0 0 1px rgba(196, 165, 255, 0.3), 0 8px 32px -8px rgba(255, 122, 182, 0.4);
}
:root[data-theme='light'][data-accent='gold'] { --link: #855a00; }
:root[data-theme='light'][data-accent='legend'] { --link: #6b3fd1; }
@media (prefers-color-scheme: light) {
  :root:not([data-theme='dark'])[data-accent='gold'] { --link: #855a00; }
  :root:not([data-theme='dark'])[data-accent='legend'] { --link: #6b3fd1; }
}
