/**
 * Signal Copier Pro - Design System
 * 
 * Single source of truth for all styling.
 * Import this in every page for consistent design.
 * Supports both dark (default) and light themes.
 */

/* ==========================================================================
   CSS CUSTOM PROPERTIES (Design Tokens)
   ========================================================================== */

:root {
  /* ────────────────────────────────────────────────────────────────────
     COLOR VALUES — Phase R2 (Claude Design dark palette)
     ────────────────────────────────────────────────────────────────────
     Token NAMES preserved (~2350 var() references in the codebase
     keep working). Token VALUES updated to match the new design's
     mint-on-dark identity. Light theme overrides are at the bottom
     of this :root block via [data-theme="light"].
     ──────────────────────────────────────────────────────────────── */

  /* Primary: mint #3FE3B0 (was #00d4aa) — brighter, slightly cooler */
  --color-primary: #3FE3B0;
  --color-primary-dark: #0fbf8a;
  --color-primary-light: #56eebd;
  --color-primary-glow: rgba(63, 227, 176, 0.22);
  --color-primary-subtle: rgba(63, 227, 176, 0.08);
  /* Secondary = violet (used for badges, tags). Bumped to match design. */
  --color-secondary: #a78bfa;

  /* Backgrounds: deep slate-with-green-tint, three depth levels */
  --bg-primary: #05090a;
  --bg-secondary: #070d0d;
  --bg-tertiary: #040807;
  --bg-card: #0c1413;
  --bg-card-hover: #0f1918;
  --bg-input: #0a1110;
  --bg-overlay: rgba(0, 0, 0, 0.7);

  /* Text colours, slightly tinted toward the mint family for cohesion */
  --text-primary: #e9f3f1;
  --text-secondary: #7d8e8c;
  --text-muted: #56635f;
  --text-inverse: #04110d;

  /* Semantic colours — adjusted to match the design's softer palette */
  --color-success: #3FE3B0;
  --color-success-bg: rgba(63, 227, 176, 0.1);
  --color-warning: #E8B86A;  /* amber for forex differentiation */
  --color-warning-bg: rgba(232, 184, 106, 0.1);
  --color-danger: #ef6a6a;
  --color-danger-bg: rgba(239, 106, 106, 0.1);
  --color-info: #3b82f6;
  --color-info-bg: rgba(59, 130, 246, 0.1);

  /* Trading-specific aliases (kept for backwards-compat with code that
     references them; same physical values as success/danger). */
  --color-long: #3FE3B0;
  --color-short: #ef6a6a;
  --color-profit: #3FE3B0;
  --color-loss: #ef6a6a;

  /* Borders — soft, near-mint dark grey */
  --border-color: #16201f;
  --border-color-light: #1d2a29;
  --border-focus: rgba(63, 227, 176, 0.5);

  /* Header background — translucent over deep slate for the blur effect */
  --header-bg: rgba(5, 9, 10, 0.7);
  
  /* Border Radius */
  --border-radius-sm: 6px;
  --border-radius: 10px;
  --border-radius-lg: 16px;
  --border-radius-xl: 24px;
  --border-radius-full: 9999px;
  
  /* Shadows (Dark Theme) */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 4px 20px var(--color-primary-glow);
  
  /* Typography */
  --font-family: 'Inter Tight', 'Inter', ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, Menlo, 'Fira Code', monospace;
  --font-size-xs: 0.75rem;
  --font-size-sm: 0.875rem;
  --font-size-base: 1rem;
  --font-size-lg: 1.125rem;
  --font-size-xl: 1.25rem;
  --font-size-2xl: 1.5rem;
  --font-size-3xl: 2rem;
  --font-size-4xl: 2.5rem;
  --font-weight-normal: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;
  --line-height-tight: 1.25;
  --line-height-normal: 1.5;
  --line-height-relaxed: 1.75;
  
  /* Spacing */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  
  /* Layout */
  --sidebar-width: 260px;
  --header-height: 64px;
  --content-max-width: 1400px;
  
  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.2s ease;
  --transition-slow: 0.3s ease;
  
  /* Z-Index */
  --z-dropdown: 100;
  --z-sticky: 200;
  --z-modal: 300;
  --z-toast: 400;
  
  /* Theme indicator */
  --theme-icon: "🌙";

  /* ────────────────────────────────────────────────────────────────────
     DESIGN-SYSTEM ALIASES (Phase R1 — Claude Design intake)
     ────────────────────────────────────────────────────────────────────
     The new design uses shorter, more conventional token names
     (--mint, --ink, --panel, --line, --muted, --amber, ...).
     R1 adds these as ALIASES pointing at the existing physical
     tokens so the same value resolves through either name. R2 will
     update the underlying values + component styles together so the
     visual change lands atomically. Until R2, these aliases are a
     pure name-bridge with zero visual effect.
     ──────────────────────────────────────────────────────────────── */
  --bg: var(--bg-primary);
  --bg-2: var(--bg-secondary);
  --bg-3: var(--bg-tertiary);
  --panel: var(--bg-card);
  --panel-2: var(--bg-card-hover);
  --panel-3: var(--bg-input);
  --line: var(--border-color);
  --line-2: var(--border-color-light);
  --line-3: var(--border-color-light);
  --ink: var(--text-primary);
  --muted: var(--text-secondary);
  --muted-2: var(--text-muted);
  --muted-3: var(--text-muted);
  --mint: var(--color-primary);
  --mint-2: var(--color-primary-dark);
  --mint-glow: var(--color-primary-glow);
  --amber: var(--color-warning);
  --amber-2: var(--color-warning);
  --red: var(--color-danger);
  --red-2: var(--color-danger);
  --violet: var(--color-secondary);
  --radius: var(--border-radius);
  /* Featured-card gradient hook (used by hero / pricing-popular card).
     Defaults to a subtle linear gradient over panel; light-theme block
     overrides to a cream variant. R2 will use this on .equity-card etc. */
  --featured-bg: linear-gradient(180deg, var(--bg-card), var(--bg-secondary));
  --featured-card-bg: linear-gradient(180deg, var(--bg-card), var(--bg-secondary));
}

/* ==========================================================================
   LIGHT THEME
   ========================================================================== */

[data-theme="light"] {
  /* ────────────────────────────────────────────────────────────────────
     LIGHT THEME — Phase R2 (Claude Design cream palette)
     Mint shifts to #16a37a for AA contrast on white; amber, red,
     and violet all shift to darker tints. The cream backgrounds
     (#fbfaf7 / #f5f3ef) give a "premium paper" feel instead of
     hard-white.
     ──────────────────────────────────────────────────────────────── */

  /* Mint adjusted for AA contrast against white */
  --color-primary: #16a37a;
  --color-primary-dark: #0f7d5d;
  --color-primary-light: #1cb88a;
  --color-primary-glow: rgba(22, 163, 122, 0.18);
  --color-primary-subtle: rgba(22, 163, 122, 0.08);
  --color-secondary: #7c5fc7;

  /* Cream backgrounds */
  --bg-primary: #fbfaf7;
  --bg-secondary: #f5f3ef;
  --bg-tertiary: #efedea;
  --bg-card: #ffffff;
  --bg-card-hover: #faf9f6;
  --bg-input: #ffffff;
  --bg-overlay: rgba(0, 0, 0, 0.5);

  /* Dark inks on cream */
  --text-primary: #1a1d1c;
  --text-secondary: #5e635e;
  --text-muted: #85877f;
  --text-inverse: #ffffff;

  /* Semantic colours retuned for light backgrounds */
  --color-success: #16a37a;
  --color-success-bg: rgba(22, 163, 122, 0.12);
  --color-warning: #b8862f;
  --color-warning-bg: rgba(184, 134, 47, 0.12);
  --color-danger: #c64545;
  --color-danger-bg: rgba(198, 69, 69, 0.10);
  --color-info: #3b82f6;
  --color-info-bg: rgba(59, 130, 246, 0.10);

  /* Trading aliases follow */
  --color-long: #16a37a;
  --color-short: #c64545;
  --color-profit: #16a37a;
  --color-loss: #c64545;

  /* Borders (soft warm grey) */
  --border-color: #ebe9e4;
  --border-color-light: #dad7d1;
  --border-focus: rgba(22, 163, 122, 0.45);

  /* Header background — translucent cream */
  --header-bg: rgba(251, 250, 247, 0.85);

  /* Shadows (Light Theme - softer than dark) */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.15);

  /* Theme indicator */
  --theme-icon: "☀️";

  /* Featured-card gradient — cream-to-mint hint */
  --featured-bg: linear-gradient(180deg, #ffffff, #f0fbf6);
  --featured-card-bg: linear-gradient(180deg, #fdfcf9, #f0fbf6);
}

/* ==========================================================================
   BASE STYLES
   ========================================================================== */

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* Always reserve scrollbar space — prevents 8px horizontal layout
     shift ("jerk") between pages whose content does/doesn't overflow
     the viewport. Operator on 2026-05-11 reported visible jerks when
     navigating between /connect (taller, scrollbar appears) and
     /leaderboard (shorter, no scrollbar) — measured via CDP as
     main.width changing 1532 ↔ 1540 across the swap.

     Why both rules together:
       - ``overflow-y: scroll`` forces a scrollbar slot to always
         exist on the html root, even when content doesn't overflow.
         This is the universal cross-browser fix; works in every
         engine. Without it, the html element's overflow stays
         ``visible`` (the default) which gives variable-width
         scrollbars on pages that overflow and zero space on pages
         that don't.
       - ``scrollbar-gutter: stable`` is the modern spec replacement
         (Chrome/Edge 94+, Safari 18.2+, Firefox 97+). Once the
         baseline rises we can drop ``overflow-y: scroll`` for it.
         Until then both coexist safely — when scrollbar-gutter is
         honored, overflow-y:scroll just contributes the same gutter
         (no extra). */
  overflow-y: scroll;
  scrollbar-gutter: stable;
}

body {
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  line-height: var(--line-height-normal);
  color: var(--text-primary);
  background: var(--bg-primary);
  min-height: 100vh;
}

/* Background grid pattern */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: 
    linear-gradient(rgba(0, 212, 170, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 212, 170, 0.02) 1px, transparent 1px);
  background-size: 60px 60px;
  pointer-events: none;
  z-index: -1;
}

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

a:hover {
  color: var(--color-primary-light);
}

/* ==========================================================================
   TYPOGRAPHY
   ========================================================================== */

h1, h2, h3, h4, h5, h6 {
  font-weight: var(--font-weight-bold);
  line-height: var(--line-height-tight);
  color: var(--text-primary);
}

h1 { font-size: var(--font-size-4xl); }
h2 { font-size: var(--font-size-3xl); }
h3 { font-size: var(--font-size-2xl); }
h4 { font-size: var(--font-size-xl); }
h5 { font-size: var(--font-size-lg); }
h6 { font-size: var(--font-size-base); }

.text-gradient {
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-success { color: var(--color-success); }
.text-danger { color: var(--color-danger); }
.text-warning { color: var(--color-warning); }

.font-mono { font-family: var(--font-mono); }

/* ==========================================================================
   LAYOUT COMPONENTS
   ========================================================================== */

/* App Shell */
.app-shell {
  display: flex;
  min-height: 100vh;
  /* Keep app roots bounded even if a previous Turbo page left
     page-scoped body/layout rules in the merged document head. */
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.app-sidebar {
  width: var(--sidebar-width);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  z-index: var(--z-sticky);
}

.app-main {
  flex: 1;
  /* min-width: 0 lets this flex column shrink below its content's
     min-content width — critical because the .news-ticker .track
     (white-space: nowrap, 9 doubled items) has a min-content far
     wider than the viewport. Without this, .app-main refuses to
     shrink and the whole page widens to fit the marquee, blowing
     body.scrollWidth past 2600px on a 1440px viewport. */
  min-width: 0;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
}

.app-header {
  height: var(--header-height);
  background: var(--header-bg);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-color);
  padding: 0 var(--space-8);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
}

.app-content {
  flex: 1;
  padding: var(--space-8);
  /* No max-width — pages span the full width of the main area
     so the right-edge gap matches across every screen.
     (Was: max-width: 1400px which produced ~280-px dead space on
     wide displays on some pages but not others, depending on
     which class set was applied.) */
}
/* When both .page and .app-content are applied to the same element,
   .page wins on padding (32px) — explicit so future changes to either
   class don't accidentally double or zero out the inset. */
.page.app-content { padding: 32px; }

/* ──────────────────────────────────────────────────────────────────
   Cross-document View Transitions
   ──────────────────────────────────────────────────────────────────
   Enabled in the browser via <meta name="view-transition"
   content="same-origin"> (added by instant-nav.js). For each element
   we want to track across page navigations we set a
   ``view-transition-name``. The browser then knows "this element on
   page A is the same logical element as the one with the matching
   name on page B" and:
     - If they're at the same position with the same dimensions
       (typical for the sidebar, which is fixed-positioned and
       identical across every authed page) → NO transition is
       rendered for that element. From the user's perspective it
       "stays put" across the navigation.
     - The rest of the page (with no name OR the default
       ``::view-transition-old(root)`` / ``::view-transition-new(root)``)
       cross-fades.
   The result: clicking a sidebar link feels like a true SPA — sidebar
   doesn't reload, content fades to the new page. Chrome/Edge 126+,
   Safari 18.2+; older browsers fall back to a plain navigation (still
   correct, just no cross-fade). */
aside.app-sidebar,
#app-sidebar {
  view-transition-name: app-sidebar;
}
.app-header {
  view-transition-name: app-header;
}
.mobile-header {
  view-transition-name: mobile-header;
}
.bottom-nav {
  view-transition-name: bottom-nav;
}
::view-transition-old(app-sidebar),
::view-transition-new(app-sidebar) {
  /* Don't animate the sidebar — keep it visually stable. */
  animation: none;
}
::view-transition-old(app-header),
::view-transition-new(app-header),
::view-transition-old(mobile-header),
::view-transition-new(mobile-header),
::view-transition-old(bottom-nav),
::view-transition-new(bottom-nav) {
  animation: none;
}
::view-transition-old(root),
::view-transition-new(root) {
  /* Content area cross-fade: 180 ms is fast enough to feel
     instantaneous but slow enough that the user notices the
     transition happened. */
  animation-duration: 180ms;
}

/* ==========================================================================
   PUBLIC HEADER (for non-authenticated pages)
   ========================================================================== */

.public-header {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  background: var(--header-bg);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-color);
}

.public-header-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: var(--space-4) var(--space-6);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-6);
}

.public-logo {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  text-decoration: none;
  color: var(--text-primary);
}

/* Brand mark: rendered SVG already includes its own dark background +
   rounded corners + glow, so the wrapper just sizes it. */
.public-logo .logo-icon {
  width: 40px;
  height: 40px;
  display: block;
  border-radius: var(--border-radius);
}

.public-logo .logo-text {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-bold);
}

.public-nav {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.public-nav-link {
  padding: var(--space-2) var(--space-4);
  border-radius: var(--border-radius);
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: var(--font-weight-medium);
  transition: all var(--transition-fast);
}

.public-nav-link:hover {
  color: var(--text-primary);
  background: var(--bg-tertiary);
}

.public-nav-link.active {
  color: var(--color-primary);
  background: var(--color-primary-subtle);
}

.public-header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

/* Public page layout (no sidebar) */
.public-layout {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.public-layout .public-content {
  flex: 1;
  max-width: 1400px;
  margin: 0 auto;
  padding: var(--space-8);
  width: 100%;
}

/* Responsive public header */
@media (max-width: 768px) {
  .public-header-inner {
    padding: var(--space-3) var(--space-4);
  }
  
  .public-nav {
    display: none;
  }
  
  .public-logo .logo-text {
    display: none;
  }
  
  .public-header-actions .btn {
    padding: var(--space-2) var(--space-3);
    font-size: var(--font-size-sm);
  }
}

/* ==========================================================================
   SIDEBAR
   ========================================================================== */

.sidebar-header {
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

/* Sidebar brand mark — same SVG as the public logo, sized down. */
.sidebar-logo {
  width: 40px;
  height: 40px;
  display: block;
  border-radius: var(--border-radius);
}

.sidebar-brand {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-bold);
}

.sidebar-nav {
  flex: 1;
  padding: var(--space-4) 0;
  overflow-y: auto;
}

.nav-section {
  padding: 0 var(--space-4);
  margin-bottom: var(--space-4);
}

.nav-section-title {
  font-size: var(--font-size-xs);
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  padding: var(--space-3) var(--space-3) var(--space-2);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3);
  margin-bottom: var(--space-1);
  border-radius: var(--border-radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.nav-item:hover {
  background: var(--color-primary-subtle);
  color: var(--text-primary);
}

.nav-item.active {
  background: rgba(0, 212, 170, 0.15);
  color: var(--color-primary);
}

.nav-item .icon {
  font-size: var(--font-size-lg);
  width: 24px;
  text-align: center;
}

/* Expandable nav item */
.nav-item-expandable {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3);
  margin-bottom: var(--space-1);
  border-radius: var(--border-radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.nav-item-expandable:hover {
  background: var(--color-primary-subtle);
  color: var(--text-primary);
}

.nav-item-expandable.expanded {
  color: var(--color-primary);
}

.nav-item-expandable .icon {
  font-size: var(--font-size-lg);
  width: 24px;
  text-align: center;
}

.nav-item-expandable .expand-arrow {
  margin-left: auto;
  font-size: 10px;
  opacity: 0.6;
  transition: transform var(--transition-fast);
}

/* Submenu */
.nav-submenu {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease-out;
  padding-left: var(--space-4);
}

.nav-submenu.show {
  max-height: 500px;
}

.nav-subitem {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  margin-bottom: 2px;
  border-radius: var(--border-radius-sm);
  color: var(--text-muted);
  font-size: var(--font-size-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.nav-subitem:hover {
  background: var(--color-primary-subtle);
  color: var(--text-primary);
}

.nav-subitem.active {
  background: rgba(0, 212, 170, 0.15);
  color: var(--color-primary);
}

.nav-subitem .icon {
  font-size: var(--font-size-base);
  width: 20px;
  text-align: center;
}

.sidebar-footer {
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--border-color);
  background: var(--bg-tertiary);
}

/* ==========================================================================
   CARDS
   ========================================================================== */

.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  overflow: hidden;
}

.card-header {
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(180deg, rgba(0, 212, 170, 0.03) 0%, transparent 100%);
}

.card-title {
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-semibold);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.card-body {
  padding: var(--space-6);
}

.card-footer {
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--border-color);
  background: var(--bg-input);
}

/* Stat Cards */
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: var(--space-5);
}

.stat-label {
  font-size: var(--font-size-sm);
  color: var(--text-muted);
  margin-bottom: var(--space-2);
}

.stat-value {
  font-size: var(--font-size-2xl);
  font-weight: var(--font-weight-bold);
}

.stat-value.positive { color: var(--color-profit); }
.stat-value.negative { color: var(--color-loss); }

.stat-change {
  font-size: var(--font-size-sm);
  margin-top: var(--space-1);
}

/* ==========================================================================
   BUTTONS
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  border-radius: var(--border-radius-sm);
  font-family: inherit;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  cursor: pointer;
  transition: all var(--transition-fast);
  border: none;
  outline: none;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
  color: var(--text-inverse);
  box-shadow: var(--shadow-glow);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 25px var(--color-primary-glow);
}

.btn-secondary {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-primary);
}

.btn-secondary:hover:not(:disabled) {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--color-primary-subtle);
  color: var(--color-primary);
}

.btn-danger {
  background: var(--color-danger-bg);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: var(--color-danger);
}

.btn-danger:hover:not(:disabled) {
  background: rgba(239, 68, 68, 0.2);
}

.btn-success {
  background: var(--color-success-bg);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: var(--color-success);
}

.btn-sm {
  padding: var(--space-2) var(--space-3);
  font-size: var(--font-size-xs);
}

.btn-lg {
  padding: var(--space-4) var(--space-8);
  font-size: var(--font-size-base);
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
}

.btn-icon.btn-sm {
  width: 28px;
  height: 28px;
}

/* ==========================================================================
   CALLOUTS
   ========================================================================== */

.app-callout {
  border-radius: var(--border-radius);
  padding: var(--space-4);
}

.app-callout-title {
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-semibold);
  margin: 0 0 var(--space-2) 0;
}

.app-callout-text {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  line-height: 1.6;
  margin: 0;
}

.app-callout-text + .app-callout-text {
  margin-top: var(--space-2);
}

.app-callout-info {
  background: var(--color-primary-subtle, rgba(139, 92, 246, 0.1));
  border: 1px solid rgba(139, 92, 246, 0.3);
}

.app-callout-info .app-callout-title {
  color: var(--color-primary);
}

.app-callout-danger {
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.25);
}

.app-callout-danger .app-callout-title {
  color: var(--color-danger);
}

.app-callout-inline-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
  margin-top: var(--space-3);
}

.app-callout-inline-code {
  background: rgba(255, 255, 255, 0.06);
  padding: 0.15rem 0.4rem;
  border-radius: 6px;
  font-family: var(--font-mono);
  color: var(--text-primary);
}

.app-risk-accept {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  cursor: pointer;
  font-size: var(--font-size-sm);
  color: var(--text-primary);
  margin-top: var(--space-3);
}

.app-risk-accept input[type="checkbox"] {
  margin-top: 3px;
  flex-shrink: 0;
}

/* ==========================================================================
   FORMS
   ========================================================================== */

.form-group {
  margin-bottom: var(--space-5);
}

.form-label {
  display: block;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  color: var(--text-secondary);
  margin-bottom: var(--space-2);
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  color: var(--text-primary);
  font-family: inherit;
  font-size: var(--font-size-sm);
  transition: all var(--transition-fast);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-glow);
  background: var(--bg-card);
}

.form-input::placeholder {
  color: var(--text-muted);
}

/* Ensure autofill doesn't override our styles */
.form-input:-webkit-autofill,
.form-input:-webkit-autofill:hover,
.form-input:-webkit-autofill:focus {
  -webkit-box-shadow: 0 0 0 1000px var(--bg-tertiary) inset !important;
  -webkit-text-fill-color: var(--text-primary) !important;
  border-color: var(--border-color);
}

.form-hint {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  margin-top: var(--space-1);
}

.form-error {
  font-size: var(--font-size-xs);
  color: var(--color-danger);
  margin-top: var(--space-1);
}

.form-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-4);
}

/* ==========================================================================
   TABLES
   ========================================================================== */

.table-container {
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th,
.table td {
  padding: var(--space-4);
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

.table th {
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  background: var(--bg-input);
}

.table tbody tr {
  transition: background var(--transition-fast);
}

.table tbody tr:hover {
  background: var(--bg-card-hover);
}

.table td {
  font-size: var(--font-size-sm);
}

/* ==========================================================================
   BADGES
   ========================================================================== */

.badge {
  display: inline-flex;
  align-items: center;
  padding: var(--space-1) var(--space-2);
  border-radius: var(--border-radius-sm);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-primary {
  background: var(--color-primary-subtle);
  color: var(--color-primary);
}

.badge-success {
  background: var(--color-success-bg);
  color: var(--color-success);
}

.badge-danger {
  background: var(--color-danger-bg);
  color: var(--color-danger);
}

.badge-warning {
  background: var(--color-warning-bg);
  color: var(--color-warning);
}

.badge-info {
  background: var(--color-info-bg);
  color: var(--color-info);
}

.badge-muted {
  background: rgba(107, 107, 123, 0.2);
  color: var(--text-muted);
}

/* Trading badges */
.badge-long {
  background: var(--color-success-bg);
  color: var(--color-long);
}

.badge-short {
  background: var(--color-danger-bg);
  color: var(--color-short);
}

/* ==========================================================================
   TOGGLE / SWITCH
   ========================================================================== */

.toggle {
  position: relative;
  width: 48px;
  height: 26px;
  background: var(--bg-input);
  border-radius: 13px;
  cursor: pointer;
  transition: all var(--transition-normal);
  border: 1px solid var(--border-color);
}

.toggle.active {
  background: var(--color-primary);
  border-color: var(--color-primary);
}

.toggle::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  background: white;
  border-radius: 50%;
  transition: transform var(--transition-normal);
}

.toggle.active::after {
  transform: translateX(22px);
}

/* ==========================================================================
   MODALS
   ========================================================================== */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg-overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: var(--z-modal);
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-normal);
}

.modal-overlay.show {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  width: 90%;
  max-width: 500px;
  max-height: 85vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transform: scale(0.95);
  transition: transform var(--transition-normal);
}

.modal-overlay.show .modal {
  transform: scale(1);
}

.modal-header {
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-semibold);
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: var(--font-size-2xl);
  cursor: pointer;
  padding: var(--space-1);
  line-height: 1;
  transition: color var(--transition-fast);
}

.modal-close:hover {
  color: var(--text-primary);
}

.modal-body {
  padding: var(--space-6);
  overflow-y: auto;
}

.modal-footer {
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--border-color);
  display: flex;
  gap: var(--space-3);
  justify-content: flex-end;
}

/* ==========================================================================
   TOAST NOTIFICATIONS
   ========================================================================== */

.toast-container {
  position: fixed;
  top: var(--space-4);
  right: var(--space-4);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: var(--space-4) var(--space-5);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-width: 300px;
  box-shadow: var(--shadow-lg);
  animation: slideIn var(--transition-normal) ease;
}

.toast.success { border-color: var(--color-success); }
.toast.error { border-color: var(--color-danger); }
.toast.warning { border-color: var(--color-warning); }
.toast.info { border-color: var(--color-info); }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ==========================================================================
   LOADING STATES
   ========================================================================== */

@keyframes spin {
  to { transform: rotate(360deg); }
}

.skeleton {
  background: linear-gradient(90deg, var(--bg-input) 25%, var(--bg-card) 50%, var(--bg-input) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--border-radius-sm);
}

/* Skeleton text placeholder */
.skeleton-text {
  display: inline-block;
  background: linear-gradient(90deg, var(--bg-input) 25%, var(--bg-card) 50%, var(--bg-input) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--border-radius-sm);
  color: transparent;
  min-width: 60px;
}

/* Skeleton loader spinner */
.skeleton-loader {
  width: 24px;
  height: 24px;
  border: 2px solid var(--bg-input);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto;
}

/* Inline loading indicator for values */
.value-loading {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-xs);
  color: var(--color-text-secondary);
  font-size: var(--font-size-sm);
}

.value-loading::before {
  content: '';
  width: 12px;
  height: 12px;
  border: 2px solid var(--bg-input);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ==========================================================================
   UTILITY CLASSES
   ========================================================================== */

/* Flexbox */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.flex-1 { flex: 1; }
.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); }
.gap-8 { gap: var(--space-8); }

/* Grid */
.grid { display: grid; }
.grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid-cols-4 { grid-template-columns: repeat(4, 1fr); }

/* Spacing */
.m-0 { margin: 0; }
.mt-2 { margin-top: var(--space-2); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.p-0 { padding: 0; }
.p-4 { padding: var(--space-4); }
.p-6 { padding: var(--space-6); }

/* Display */
.hidden { display: none; }
.block { display: block; }
.inline-block { display: inline-block; }

/* Text */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-sm { font-size: var(--font-size-sm); }
.text-lg { font-size: var(--font-size-lg); }
.font-medium { font-weight: var(--font-weight-medium); }
.font-semibold { font-weight: var(--font-weight-semibold); }
.font-bold { font-weight: var(--font-weight-bold); }
.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Responsive Grid */
@media (max-width: 768px) {
  .grid-cols-2,
  .grid-cols-3,
  .grid-cols-4 {
    grid-template-columns: 1fr;
  }
  
  .form-row {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   SCROLLBAR
   ========================================================================== */

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* ==========================================================================
   THEME SWITCH COMPONENT
   ========================================================================== */

.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--border-radius-full);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.theme-toggle:hover {
  background: var(--bg-card-hover);
  border-color: var(--color-primary);
}

.theme-toggle .theme-icon {
  font-size: 1.1rem;
  line-height: 1;
}

/* Theme Switch (Toggle Style) */
.theme-switch {
  position: relative;
  display: inline-block;
  width: 60px;
  height: 30px;
}

.theme-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.theme-switch-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-full);
  transition: all var(--transition-normal);
  overflow: hidden;
}

.theme-switch-slider::before {
  content: '';
  position: absolute;
  height: 22px;
  width: 22px;
  left: 3px;
  bottom: 3px;
  background: var(--color-primary);
  border-radius: 50%;
  transition: all var(--transition-normal);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.theme-switch input:checked + .theme-switch-slider::before {
  transform: translateX(30px);
}

.theme-switch-icon {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.9rem;
  transition: opacity var(--transition-fast);
}

.theme-switch-icon.sun {
  left: 8px;
  opacity: 0;
}

.theme-switch-icon.moon {
  right: 8px;
  opacity: 1;
}

.theme-switch input:checked + .theme-switch-slider .sun {
  opacity: 1;
}

.theme-switch input:checked + .theme-switch-slider .moon {
  opacity: 0;
}

/* Light theme scrollbar adjustments */
[data-theme="light"] ::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.1);
}

[data-theme="light"] ::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.2);
}

/* Light theme - grid pattern */
[data-theme="light"] body::before {
  background-image: 
    linear-gradient(rgba(0, 212, 170, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 212, 170, 0.05) 1px, transparent 1px);
}

/* ==========================================================================
   NOTIFICATION BELL & DROPDOWN
   ========================================================================== */

.notification-bell {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  background: var(--bg-input);
  border-radius: var(--border-radius);
  cursor: pointer;
  transition: all var(--transition-fast);
  color: var(--text-secondary);
}

.notification-bell:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.notification-bell svg {
  width: 20px;
  height: 20px;
}

.notification-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  background: var(--color-danger);
  color: white;
  font-size: 0.7rem;
  font-weight: 600;
  border-radius: var(--border-radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--bg-secondary);
}

.notification-dropdown {
  animation: slideIn 0.2s ease;
}

.notification-dropdown-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4);
  border-bottom: 1px solid var(--border-color);
  font-weight: var(--font-weight-semibold);
}

.notification-dropdown-body {
  max-height: 350px;
  overflow-y: auto;
}

.notification-dropdown-footer {
  padding: var(--space-3) var(--space-4);
  border-top: 1px solid var(--border-color);
  text-align: center;
}

.notification-dropdown-footer a {
  color: var(--color-primary);
  text-decoration: none;
  font-size: var(--font-size-sm);
}

.notification-dropdown-footer a:hover {
  text-decoration: underline;
}

.notification-item {
  display: flex;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  cursor: pointer;
  transition: background var(--transition-fast);
  border-bottom: 1px solid var(--border-color);
}

.notification-item:last-child {
  border-bottom: none;
}

.notification-item:hover {
  background: var(--bg-secondary);
}

.notification-item.unread {
  background: var(--color-primary-subtle);
}

.notification-item.unread:hover {
  background: rgba(0, 212, 170, 0.15);
}

.notification-icon {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  background: var(--bg-input);
  border-radius: var(--border-radius);
}

.notification-content {
  flex: 1;
  min-width: 0;
}

.notification-title {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  color: var(--text-primary);
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.notification-message {
  font-size: var(--font-size-xs);
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.notification-time {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ==========================================================================
   NEW DESIGN STRUCTURAL CLASSES (Phase R2)
   ==========================================================================
   These are classes the new Claude Design uses that we don't have yet.
   Adding them alongside our existing classes (.app-shell / .app-main /
   .app-header / .app-content) so pages can opt-in incrementally during
   R3 without breaking pages that still use the old names.

   The visual style here matches the design bundle's app.css exactly,
   re-tokenised through our :root variables so light/dark mode works
   identically with our existing [data-theme] mechanism.
   ========================================================================== */

/* App shell — CSS Grid layout (alternative to flex-based .app-shell) */
.app {
  display: grid;
  grid-template-columns: 248px 1fr;
  min-height: 100vh;
  background: var(--bg-primary);
}

/* Sidebar (new design uses .sidebar; our existing pages use .app-sidebar —
   selectors below cover both so the same look applies regardless). */
.sidebar,
aside.app-sidebar {
  background: linear-gradient(180deg, var(--bg-secondary), var(--bg-tertiary));
  border-right: 1px solid var(--border-color);
  /* Top padding is 0 so the brand block sits flush at the top edge
     and its 56-px height aligns with the topbar's 56-px height —
     producing a single uninterrupted horizontal rule across the
     whole shell. */
  padding: 0 0 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
}

.sidebar .brand,
aside.app-sidebar .brand {
  /* Brand row matches topbar height (64 px) so they share a
     bottom border across the page. */
  height: 64px;
  padding: 0 22px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 12px;
  flex-shrink: 0;
}
.sidebar .brand .mark,
aside.app-sidebar .brand .mark {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  overflow: hidden;
  flex-shrink: 0;
  box-shadow: 0 0 0 1px var(--color-primary-subtle), 0 8px 24px var(--color-primary-glow);
}
.sidebar .brand .mark img,
.sidebar .brand .mark svg,
aside.app-sidebar .brand .mark img,
aside.app-sidebar .brand .mark svg {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: inherit;
}
.sidebar .brand .name,
aside.app-sidebar .brand .name {
  font-weight: 700;
  font-size: 15.5px;
  letter-spacing: -0.01em;
}
.sidebar .brand .name .pro,
aside.app-sidebar .brand .name .pro {
  color: var(--color-primary);
  font-weight: 600;
}

/* Nav-group (label + items) — new design pattern.
   Our existing .nav-section also gets light-touch alignment via the
   :is() selector at the bottom of this block. */
.nav-group {
  margin-top: 10px;
  padding: 0 14px;
}
.nav-group .label {
  font-size: 10.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 0 12px 8px;
  font-weight: 500;
}

/* New design's .nav-item style. Our existing .nav-item already exists
   above with similar but slightly different styling — these rules
   override it to match the new design (smaller padding, mint active
   stripe). */
.sidebar .nav-item,
aside.app-sidebar .nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 12px;
  border-radius: 9px;
  color: var(--text-secondary);
  font-size: 13.5px;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
}
.sidebar .nav-item:hover,
aside.app-sidebar .nav-item:hover {
  background: var(--color-primary-subtle);
  color: var(--text-primary);
}
.sidebar .nav-item.active,
aside.app-sidebar .nav-item.active {
  background: rgba(63, 227, 176, 0.10);
  color: var(--color-primary);
  box-shadow: inset 2px 0 0 var(--color-primary);
}
.sidebar .nav-item .ico,
aside.app-sidebar .nav-item .ico {
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  font-size: 14px;
  flex-shrink: 0;
  opacity: 0.85;
}
.sidebar .nav-item.active .ico,
aside.app-sidebar .nav-item.active .ico {
  opacity: 1;
}
/* Pill counters next to nav items (e.g. unread notifications) */
.sidebar .nav-item .pill,
aside.app-sidebar .nav-item .pill {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 10.5px;
  padding: 1px 6px;
  border-radius: 99px;
  background: var(--color-primary-subtle);
  color: var(--color-primary);
  border: 1px solid rgba(63, 227, 176, 0.25);
}
.sidebar .nav-item .pill.red,
aside.app-sidebar .nav-item .pill.red {
  background: var(--color-danger-bg);
  color: var(--color-danger);
  border-color: rgba(239, 106, 106, 0.25);
}
.sidebar .nav-item .pill.amber,
aside.app-sidebar .nav-item .pill.amber {
  background: var(--color-warning-bg);
  color: var(--color-warning);
  border-color: rgba(232, 184, 106, 0.25);
}

/* Collapsible nav group (Settings with sub-items) */
.nav-collapse {
  margin: 0;
  padding: 0;
}
.nav-collapse > summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 12px;
  border-radius: 9px;
  color: var(--text-secondary);
  font-size: 13.5px;
  font-weight: 500;
  transition: background 0.15s ease, color 0.15s ease;
}
.nav-collapse > summary::-webkit-details-marker,
.nav-collapse > summary::marker {
  display: none;
}
.nav-collapse > summary:hover {
  background: var(--color-primary-subtle);
  color: var(--text-primary);
}
.nav-collapse > summary .ico {
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  font-size: 14px;
  flex-shrink: 0;
  opacity: 0.85;
}
.nav-collapse > summary .caret {
  margin-left: auto;
  font-size: 11px;
  opacity: 0.55;
  transition: transform 0.2s ease;
}
.nav-collapse[open] > summary .caret {
  transform: rotate(180deg);
}
.nav-collapse[open] > summary {
  color: var(--text-primary);
}

.nav-sub {
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin: 2px 0 4px 14px;
  padding-left: 14px;
  border-left: 1px solid var(--border-color);
}
.nav-sub .nav-item.sub {
  padding: 7px 10px;
  font-size: 12.5px;
  color: var(--text-secondary);
  box-shadow: none !important;
}
.nav-sub .nav-item.sub .dot-ico {
  width: 5px;
  height: 5px;
  border-radius: 99px;
  background: var(--text-muted);
  flex-shrink: 0;
  display: inline-block;
  margin-right: 6px;
  transition: background 0.15s, box-shadow 0.15s;
}
.nav-sub .nav-item.sub:hover {
  color: var(--text-primary);
  background: transparent;
}
.nav-sub .nav-item.sub:hover .dot-ico {
  background: var(--color-primary);
}
.nav-sub .nav-item.sub.active {
  color: var(--color-primary);
  background: transparent;
}
.nav-sub .nav-item.sub.active .dot-ico {
  background: var(--color-primary);
  box-shadow: 0 0 8px var(--color-primary);
}

/* Sidebar user card (.me) */
.sidebar .me,
aside.app-sidebar .me {
  margin: 0 14px;
  padding: 12px;
  border-radius: 11px;
  background: linear-gradient(180deg, var(--color-primary-subtle), rgba(63, 227, 176, 0.02));
  border: 1px solid rgba(63, 227, 176, 0.18);
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar .me .av,
aside.app-sidebar .me .av {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: linear-gradient(140deg, var(--color-primary), var(--color-primary-dark));
  display: grid;
  place-items: center;
  color: var(--text-inverse);
  font-weight: 700;
  font-size: 14px;
}
.sidebar .me .who,
aside.app-sidebar .me .who {
  flex: 1;
  min-width: 0;
}
.sidebar .me .who .nm,
aside.app-sidebar .me .who .nm {
  font-size: 13px;
  color: var(--text-primary);
  font-weight: 600;
  line-height: 1.2;
}
.sidebar .me .who .ti,
aside.app-sidebar .me .who .ti {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--color-primary);
  letter-spacing: 0.12em;
  margin-top: 2px;
}
.sidebar .me .out,
aside.app-sidebar .me .out {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  display: grid;
  place-items: center;
  color: var(--text-secondary);
  border: 1px solid var(--border-color-light);
  cursor: pointer;
}
.sidebar .me .out:hover,
aside.app-sidebar .me .out:hover {
  color: var(--color-danger);
  border-color: rgba(239, 106, 106, 0.3);
}

/* Note: the .spacer between .sidebar-nav and .me used to declare
   flex:1, but .sidebar-nav already has flex:1 — having both meant
   they split free space 50/50 and the nav's overflow:auto cropped
   the lower nav groups (Configuration / Community / Settings) below
   the half-height fold. Leaving the spacer as a layout no-op so
   .sidebar-nav grabs all free space and the user card sits at the
   bottom natively. */

/* Topbar (new design name for our .app-header) */
.topbar {
  height: 64px;
  padding: 0 32px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--header-bg);
  backdrop-filter: blur(14px);
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
}
.topbar .title {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 12px;
}
.topbar .title .crumb {
  color: var(--text-muted);
  font-weight: 400;
  font-size: 14px;
}
.topbar .title .crumb::after {
  content: "/";
  margin: 0 10px;
  color: var(--border-color-light);
}
.topbar .title .live {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--color-primary);
  font-weight: 500;
  background: var(--color-primary-subtle);
  padding: 4px 10px;
  border-radius: 99px;
  border: 1px solid rgba(63, 227, 176, 0.2);
  font-family: var(--font-mono);
  letter-spacing: 0.06em;
}
.topbar .title .live .dot {
  width: 6px;
  height: 6px;
  border-radius: 99px;
  background: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(63, 227, 176, 0.2);
  animation: pulse-mint 2s infinite;
}
@keyframes pulse-mint {
  50% { opacity: 0.6; }
}
.topbar .right {
  display: flex;
  align-items: center;
  gap: 10px;
}
.topbar .ic-btn {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  border: 1px solid var(--border-color-light);
  background: var(--bg-input);
  display: grid;
  place-items: center;
  color: var(--text-secondary);
  cursor: pointer;
  position: relative;
}
.topbar .ic-btn:hover {
  color: var(--text-primary);
  border-color: var(--border-color-light);
}
.topbar .ic-btn .ind {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 7px;
  height: 7px;
  background: var(--color-primary);
  border-radius: 99px;
  box-shadow: 0 0 0 2px var(--bg-primary);
}

/* Page container + page-head */
.page {
  padding: 32px;
  flex: 1;
}
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 22px;
  gap: 24px;
}
.page-head .h {
  flex: 1;
  min-width: 0;
}
.page-head h1 {
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0 0 4px;
}
.page-head .sub {
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.5;
  margin: 0;
}
.page-head .actions {
  display: flex;
  gap: 10px;
  flex-shrink: 0;
}

/* Stat strip (dashboard) */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 24px;
}
.stat {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 18px 20px;
  position: relative;
  overflow: hidden;
}
.stat .lbl {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  margin-bottom: 8px;
  font-weight: 500;
}
.stat .v {
  font-family: var(--font-mono);
  font-size: 26px;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  line-height: 1.1;
}
.stat .v.mint { color: var(--color-primary); }
.stat .v.red { color: var(--color-danger); }
.stat .v.amber { color: var(--color-warning); }
.stat .delta {
  margin-top: 6px;
  font-size: 11.5px;
  font-family: var(--font-mono);
  color: var(--text-secondary);
}
.stat .delta.up { color: var(--color-primary); }
.stat .delta.down { color: var(--color-danger); }

/* Equity hero card (dashboard primary metric) */
.equity-card {
  background: var(--featured-bg);
  border: 1px solid rgba(63, 227, 176, 0.25);
  border-radius: 16px;
  padding: 24px;
  position: relative;
  overflow: hidden;
}
.equity-card::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 240px;
  height: 100%;
  background: radial-gradient(50% 80% at 100% 50%, var(--color-primary-glow), transparent 70%);
  pointer-events: none;
}
.equity-card .top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
}
.equity-card .lbl {
  font-size: 11px;
  color: var(--color-primary);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-family: var(--font-mono);
  margin-bottom: 6px;
}
.equity-card .val {
  font-size: 36px;
  font-weight: 700;
  letter-spacing: -0.025em;
  font-family: var(--font-mono);
  line-height: 1;
}
.equity-card .val .small {
  font-size: 18px;
  color: var(--text-secondary);
  font-weight: 500;
  margin-left: 6px;
}

/* Eyebrow / kicker (marketing pages) */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px 6px 8px;
  border-radius: 999px;
  background: var(--color-primary-subtle);
  border: 1px solid rgba(63, 227, 176, 0.25);
  color: var(--color-primary);
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: 0.02em;
}
.eyebrow .dot {
  width: 6px;
  height: 6px;
  border-radius: 99px;
  background: var(--color-primary);
  box-shadow: 0 0 0 4px rgba(63, 227, 176, 0.18);
}

/* Sec-kicker (small monospace label above section headings) */
.sec-kicker {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--color-primary);
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

/* Empty state */
.empty {
  padding: 60px 24px;
  text-align: center;
  border: 1px dashed var(--border-color-light);
  border-radius: 14px;
  background: var(--bg-input);
}
.empty .ic {
  font-size: 32px;
  opacity: 0.5;
  margin-bottom: 14px;
}
.empty h3 {
  font-size: 17px;
  font-weight: 600;
  margin: 0 0 6px;
}
.empty p {
  color: var(--text-secondary);
  font-size: 13.5px;
  margin: 0 0 18px;
  max-width: 380px;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.55;
}

/* Grid helpers (used by .split-2, .split-1-2, .split-eq) */
.split-2 { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; }
.split-1-2 { display: grid; grid-template-columns: 1fr 2fr; gap: 16px; }
.split-eq { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* Tabs (new design pattern, used on Trades / Signals etc.) */
.tabs {
  display: inline-flex;
  gap: 2px;
  padding: 4px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 11px;
  margin-bottom: 20px;
}
.tabs a {
  padding: 7px 14px;
  border-radius: 8px;
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
}
.tabs a:hover { color: var(--text-primary); }
.tabs a.active {
  background: var(--bg-card);
  color: var(--text-primary);
  box-shadow: 0 1px 0 var(--border-color-light);
}
.tabs a .ct {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
}
.tabs a.active .ct { color: var(--color-primary); }

/* 2026-06-05 — Operator-reported mobile audit (playwright at 375px).
   .tabs uses inline-flex which lets long labels either WRAP onto
   3 lines ("By account & channel" on /analytics) OR CLIP past the
   viewport edge (/admin "Activity" tab, /journal trailing icon).
   On mobile: make the strip horizontally-scrollable. Hide the
   scrollbar so the pill still reads as a button group; user can
   swipe to reveal off-screen tabs. */
@media (max-width: 768px) {
  .tabs {
    display: flex;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .tabs::-webkit-scrollbar { display: none; }
  .tabs a {
    flex: 0 0 auto;
    white-space: nowrap;
  }
}

/* Theme-toggle button (injected by instant-nav.js / design-theme-controller.js).
   Shows a sun in dark mode, moon in light mode — flips on click. */
.theme-toggle {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--border-color-light);
  background: var(--bg-input);
  color: var(--text-secondary);
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 16px;
  flex-shrink: 0;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
  font-family: inherit;
  padding: 0;
}
.theme-toggle:hover {
  color: var(--text-primary);
  border-color: var(--border-color-light);
}
.theme-toggle .sun,
.theme-toggle .moon { display: none; }
[data-theme="dark"] .theme-toggle .sun,
:root:not([data-theme="light"]) .theme-toggle .sun { display: inline; }
[data-theme="light"] .theme-toggle .moon { display: inline; }

/* Scroll-to-top button (injected by instant-nav.js). Fades in past 400 px. */
.scroll-top {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 90;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--color-primary);
  color: var(--text-inverse);
  border: none;
  cursor: pointer;
  font-size: 20px;
  font-weight: 700;
  font-family: inherit;
  display: grid;
  place-items: center;
  box-shadow: 0 8px 24px -6px var(--color-primary-glow), 0 0 0 1px rgba(63, 227, 176, 0.3);
  opacity: 0;
  transform: translateY(12px) scale(0.9);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease, background 0.15s ease;
}
.scroll-top.show {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}
.scroll-top:hover {
  background: var(--color-primary-light);
  transform: translateY(-2px) scale(1);
}

/* Responsive — match the new design's 980 / 640 breakpoints */
@media (max-width: 980px) {
  .app { grid-template-columns: 1fr; }
  .stats { grid-template-columns: 1fr 1fr; }
  .split-2, .split-1-2, .split-eq { grid-template-columns: 1fr; }
  .page { padding: 20px; }
  .topbar { padding: 0 20px; }
  .page-head { flex-direction: column; align-items: flex-start; gap: 14px; }
  .page-head .actions { width: 100%; flex-wrap: wrap; }
}
@media (max-width: 640px) {
  .stats { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stats .stat { padding: 14px 16px; }
  .stats .stat .v { font-size: 22px; }
  .topbar .title { font-size: 15px; }
  .topbar .title .live { display: none; }
  .page-head h1 { font-size: 22px; }
}

/* ==========================================================================
   DESIGN COMPOUND CLASSES
   The Signal Copier Pro design uses compound forms (.btn.primary, .badge.mint)
   alongside the established hyphenated forms (.btn-primary, .badge-success).
   Keep both — pages migrate incrementally and old pages keep working.
   ========================================================================== */

.btn.primary {
  background: var(--mint);
  color: #04110d;
  box-shadow: 0 8px 24px -8px rgba(63, 227, 176, 0.55), inset 0 -1px 0 rgba(0, 0, 0, 0.18);
}
.btn.primary:hover:not(:disabled) { transform: translateY(-1px); background: var(--mint-2, #56eebd); }
.btn.ghost {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--line-2, var(--border-color));
}
.btn.ghost:hover:not(:disabled) { border-color: var(--color-primary); background: var(--color-primary-subtle); }
.btn.danger {
  background: transparent;
  color: var(--color-danger);
  border: 1px solid rgba(239, 106, 106, 0.3);
}
.btn.danger:hover:not(:disabled) { background: rgba(239, 106, 106, 0.08); }
.btn.amber {
  background: var(--color-warning);
  color: #1a1208;
}
.btn.amber:hover:not(:disabled) { background: #f1c47e; }
.btn.sm { height: 32px; padding: 0 12px; font-size: 13px; border-radius: 8px; }
.btn.lg { height: 46px; padding: 0 22px; font-size: 15px; border-radius: 12px; }
.btn.xl { height: 54px; padding: 0 28px; font-size: 16px; border-radius: 14px; }
.btn.block { width: 100%; justify-content: center; }

.badge.mint {
  background: rgba(63, 227, 176, 0.10);
  color: var(--color-primary);
  border: 1px solid rgba(63, 227, 176, 0.25);
}
.badge.amber {
  background: rgba(232, 184, 106, 0.10);
  color: var(--color-warning);
  border: 1px solid rgba(232, 184, 106, 0.25);
}
.badge.red {
  background: rgba(239, 106, 106, 0.10);
  color: var(--color-danger);
  border: 1px solid rgba(239, 106, 106, 0.25);
}
.badge.violet {
  background: rgba(167, 139, 250, 0.10);
  color: var(--color-secondary);
  border: 1px solid rgba(167, 139, 250, 0.25);
}
.badge.muted {
  background: var(--panel-3, var(--bg-tertiary));
  color: var(--text-muted);
  border: 1px solid var(--border-color);
}
.badge.mono { font-family: var(--font-mono); }
.badge .dot { width: 5px; height: 5px; border-radius: 99px; background: currentColor; display: inline-block; }

[data-theme="light"] .btn.primary {
  background: var(--color-primary);
  color: #ffffff;
  box-shadow: 0 6px 16px -6px rgba(22, 163, 122, 0.40), inset 0 -1px 0 rgba(0, 0, 0, 0.18);
}
[data-theme="light"] .btn.primary:hover:not(:disabled) { background: #1cb88a; }
[data-theme="light"] .btn.ghost { border-color: var(--border-color); }
[data-theme="light"] .badge.mint { background: rgba(22, 163, 122, 0.10); color: var(--color-primary); border-color: rgba(22, 163, 122, 0.25); }
[data-theme="light"] .badge.amber { background: rgba(184, 134, 47, 0.10); color: var(--color-warning); border-color: rgba(184, 134, 47, 0.25); }
[data-theme="light"] .badge.red { background: rgba(198, 69, 69, 0.08); color: var(--color-danger); border-color: rgba(198, 69, 69, 0.25); }

/* ==========================================================================
   DESIGN PUBLIC SHELL  (.nav + .wrap + footer.site)
   Marketing/info pages (index, help, docs, terms, privacy, live, blog).
   ========================================================================== */
.wrap { max-width: 1200px; margin: 0 auto; padding: 0 32px; }
.wrap-sm { max-width: 720px; margin: 0 auto; padding: 0 24px; }
.wrap-md { max-width: 920px; margin: 0 auto; padding: 0 24px; }

.nav {
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: blur(14px);
  background: rgba(5, 9, 10, 0.7);
  border-bottom: 1px solid var(--border-color);
}
[data-theme="light"] .nav { background: rgba(255, 255, 255, 0.85); }
.nav-inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 68px;
}
.nav .logo {
  display: flex; align-items: center; gap: 10px;
  font-weight: 700; font-size: 17px; letter-spacing: -0.01em;
  color: var(--text-primary); text-decoration: none;
}
.nav .logo .mark {
  width: 32px; height: 32px; border-radius: 9px;
  display: grid; place-items: center; overflow: hidden; flex-shrink: 0;
  box-shadow: 0 0 0 1px rgba(63, 227, 176, 0.25), 0 8px 24px rgba(63, 227, 176, 0.20);
}
.nav .logo .mark img,
.nav .logo .mark svg { width: 100%; height: 100%; display: block; }
.nav .logo .pro { color: var(--color-primary); font-weight: 600; }

.nav-links {
  display: flex; align-items: center; gap: 30px;
  font-size: 14px; color: var(--text-muted);
}
.nav-links a {
  color: var(--text-muted); text-decoration: none;
  transition: color 0.15s;
}
.nav-links a:hover, .nav-links a.active { color: var(--text-primary); }

.nav-cta { display: flex; align-items: center; gap: 14px; }
@media (max-width: 768px) {
  .nav-links { display: none; }
  .nav-cta .btn.ghost { display: none; }
}

footer.site {
  padding: 48px 0 36px;
  color: var(--text-muted);
  font-size: 13px;
  border-top: 1px solid var(--border-color);
}
.foot-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr;
  gap: 32px; margin-bottom: 36px;
}
.foot-grid h5 {
  font-size: 11px; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--text-muted);
  margin: 0 0 14px; font-weight: 500;
}
.foot-grid a {
  display: block; color: var(--text-muted);
  padding: 4px 0; text-decoration: none;
}
.foot-grid a:hover { color: var(--text-primary); }
.foot-grid p {
  color: var(--text-muted); font-size: 13px;
  line-height: 1.55; max-width: 300px; margin: 14px 0 0;
}
.foot-bottom {
  border-top: 1px solid var(--border-color);
  padding-top: 24px;
  display: flex; justify-content: space-between; align-items: center;
  color: var(--text-muted); font-size: 12px; gap: 16px; flex-wrap: wrap;
}
.foot-bottom .mono { letter-spacing: 0.06em; font-family: var(--font-mono); }
.foot-bottom .status-pill {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-mono);
}
.foot-bottom .status-pill .lamp {
  width: 6px; height: 6px; border-radius: 99px;
  background: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(63, 227, 176, 0.18);
}

@media (max-width: 980px) {
  .foot-grid { grid-template-columns: 1fr 1fr; }
  .wrap, .wrap-md { padding: 0 20px; }
}
@media (max-width: 600px) {
  .foot-grid { grid-template-columns: 1fr; }
}

/* Page hero (used on /pricing, /help, /docs, /terms, /privacy). */
.page-hero {
  padding: 80px 0 56px;
  text-align: center;
  position: relative;
  border-bottom: 1px solid var(--border-color);
}
.page-hero .eyebrow {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 6px 12px 6px 8px; border-radius: 999px;
  background: var(--color-primary-subtle); color: var(--color-primary);
  border: 1px solid rgba(63, 227, 176, 0.25);
  font-size: 12.5px; font-weight: 500; letter-spacing: 0.02em;
  margin-bottom: 14px;
}
.page-hero .eyebrow .dot {
  width: 6px; height: 6px; border-radius: 99px; background: var(--color-primary);
  box-shadow: 0 0 0 4px rgba(63, 227, 176, 0.18);
}
.page-hero h1 {
  font-size: clamp(32px, 5vw, 48px); font-weight: 700;
  letter-spacing: -0.025em; line-height: 1.1; margin: 0 0 10px;
}
.page-hero h1 .accent { color: var(--color-primary); }
.page-hero .lede {
  color: var(--text-secondary); font-size: 16px;
  line-height: 1.5; max-width: 620px; margin: 0 auto;
}

/* ==========================================================================
   DESIGN AUTH PAGES  (login / register / forgot / reset / verify-email)
   Single centered card on a soft gradient backdrop.
   ========================================================================== */
.auth-shell {
  min-height: 100vh;
  display: grid; place-items: center;
  padding: 48px 24px;
  position: relative; overflow: hidden;
  background: var(--bg-primary, #05090a);
}
.auth-shell::before {
  content: ""; position: absolute; inset: 0;
  background:
    radial-gradient(40% 50% at 50% 0%, rgba(63, 227, 176, 0.10), transparent 60%),
    radial-gradient(60% 40% at 0% 100%, rgba(167, 139, 250, 0.05), transparent 60%);
  pointer-events: none;
}
.auth-card {
  position: relative; width: 100%; max-width: 440px;
  background: linear-gradient(180deg, var(--bg-card), var(--bg-tertiary, var(--bg-secondary)));
  border: 1px solid var(--border-color);
  border-radius: 18px;
  padding: 36px 36px 32px;
  box-shadow: 0 30px 80px -30px rgba(0, 0, 0, 0.6);
}
.auth-card .top {
  display: flex; flex-direction: column; align-items: center;
  text-align: center; margin-bottom: 28px;
}
.auth-card .top .mark-lg {
  width: 48px; height: 48px; border-radius: 12px;
  background: linear-gradient(140deg, var(--color-primary), #1a8b6a);
  display: grid; place-items: center;
  color: #04110d; font-weight: 800; font-size: 22px;
  box-shadow: 0 0 0 1px rgba(63, 227, 176, 0.35), 0 8px 24px rgba(63, 227, 176, 0.18);
  margin-bottom: 16px;
}
.auth-card .top .mark-lg img,
.auth-card .top .mark-lg svg { width: 100%; height: 100%; display: block; border-radius: inherit; }
.auth-card .top .mark-lg:has(img) { background: transparent !important; padding: 0; }
.auth-card h1 {
  font-size: 22px; font-weight: 600; letter-spacing: -0.015em; margin: 0 0 6px;
}
.auth-card .sub { color: var(--text-muted); font-size: 13.5px; margin: 0; }
.auth-card .links {
  margin-top: 18px;
  color: var(--text-muted); font-size: 13.5px; text-align: center;
}
.auth-card .links a { color: var(--color-primary); font-weight: 500; text-decoration: none; }
.auth-card .links a:hover { text-decoration: underline; }
.auth-back {
  display: inline-flex; align-items: center; gap: 8px;
  color: var(--text-muted); font-size: 13.5px;
  position: absolute; top: 24px; left: 24px;
  text-decoration: none;
}
.auth-back:hover { color: var(--text-primary); }
.auth-card .field + .field { margin-top: 18px; }
.auth-card label.fld {
  display: block; font-size: 13px; color: var(--text-primary);
  font-weight: 500; margin-bottom: 8px;
}
.auth-card label.fld .hint {
  color: var(--text-muted); font-weight: 400; font-size: 12px; margin-left: 6px;
}
.auth-card .check {
  display: inline-flex; align-items: center; gap: 10px;
  font-size: 13.5px; color: var(--text-primary);
  cursor: pointer; user-select: none;
}
.auth-card .check input {
  appearance: none; width: 18px; height: 18px;
  border: 1px solid var(--border-color);
  border-radius: 5px;
  background: var(--bg-tertiary, var(--bg-input));
  position: relative; cursor: pointer;
}
.auth-card .check input:checked {
  background: var(--color-primary); border-color: var(--color-primary);
}
.auth-card .check input:checked::after {
  content: "✓"; position: absolute; inset: 0;
  display: grid; place-items: center;
  color: #04110d; font-size: 12px; font-weight: 800;
}
.auth-card .auth-trust {
  margin-top: 24px; padding-top: 20px;
  border-top: 1px solid var(--border-color);
  display: flex; gap: 18px; justify-content: center;
  color: var(--text-muted); font-size: 11.5px;
  font-family: var(--font-mono); letter-spacing: 0.08em;
}

/* ==========================================================================
   DESIGN FORM CONTROLS  (.input / .select / .textarea)
   ========================================================================== */
.input, .select, .textarea {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  border-radius: 10px;
  background: var(--bg-tertiary, var(--bg-input));
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14px;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  background: var(--bg-card);
}
.input::placeholder { color: var(--text-muted); }
.textarea { height: auto; padding: 12px 14px; resize: vertical; min-height: 90px; }
.select {
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--text-muted) 50%),
    linear-gradient(135deg, var(--text-muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) center, calc(100% - 13px) center;
  background-size: 5px 5px;
  background-repeat: no-repeat;
  padding-right: 38px;
}

/* ==========================================================================
   DESIGN FILTER BAR  (used on Trades / Signals / Alerts etc.)
   ========================================================================== */
.filters {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 20px;
  align-items: center;
}
.filters .input,
.filters .select { height: 36px; font-size: 13px; background: var(--bg-card); width: auto; }
.filters .input { min-width: 220px; }
.filters .sep { color: var(--text-muted); font-family: var(--font-mono); font-size: 12px; }
.filters .legend {
  display: flex; align-items: center; gap: 6px;
  font-size: 11.5px; color: var(--text-muted);
  font-family: var(--font-mono); letter-spacing: 0.08em;
}
.filters .legend .sw { width: 8px; height: 8px; border-radius: 99px; }
@media (max-width: 640px) {
  .filters { gap: 8px; }
  .filters .input { min-width: 0; flex: 1 1 100%; }
}

/* ==========================================================================
   DESIGN DATA TABLE  (.tr-table — used on Trades / Signals / Journal)
   ========================================================================== */
.tr-table {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.tr-table > table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; min-width: 720px; }
.tr-table th {
  text-align: left;
  padding: 12px 16px;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
  background: var(--bg-card-hover, var(--bg-secondary));
  border-bottom: 1px solid var(--border-color);
  font-weight: 500;
  position: sticky;
  top: 0;
}
.tr-table td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
  color: var(--text-primary);
}
.tr-table tr:last-child td { border-bottom: none; }
.tr-table tr:hover td { background: rgba(63, 227, 176, 0.025); }

.side-pill {
  display: inline-flex; justify-content: center;
  font-family: var(--font-mono); font-size: 10.5px; font-weight: 700;
  letter-spacing: 0.08em; padding: 3px 9px;
  border-radius: 5px; min-width: 54px;
}
.side-pill.long { background: rgba(63, 227, 176, 0.10); color: var(--color-primary); }
.side-pill.short { background: rgba(239, 106, 106, 0.10); color: var(--color-danger); }

.pair-cell {
  font-family: var(--font-mono); font-weight: 700;
  color: var(--text-primary); display: inline-flex; align-items: center; gap: 8px;
}
.pair-cell .ic {
  width: 18px; height: 18px; border-radius: 4px;
  background: var(--bg-tertiary, var(--bg-input));
  font-size: 9px; font-weight: 700;
  display: grid; place-items: center;
  color: var(--text-muted); font-family: var(--font-mono);
}

.mono-c { font-family: var(--font-mono); color: var(--text-primary); }
.mono-m { font-family: var(--font-mono); color: var(--text-muted); }

.pl-c { font-family: var(--font-mono); font-weight: 600; }
.pl-c.pos { color: var(--color-primary); }
.pl-c.neg { color: var(--color-danger); }
.pl-pct { font-family: var(--font-mono); color: var(--text-muted); font-size: 11.5px; margin-left: 4px; }

.pager {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px;
  background: var(--bg-card-hover, var(--bg-secondary));
  border-top: 1px solid var(--border-color);
}
.pager .ct { color: var(--text-muted); font-size: 13px; font-family: var(--font-mono); }
.pager .ct b { color: var(--text-primary); }
.pager .controls { display: flex; gap: 6px; }
.pager .controls a,
.pager .controls button {
  padding: 6px 11px;
  border: 1px solid var(--border-color);
  border-radius: 7px;
  color: var(--text-muted);
  font-size: 13px;
  background: var(--bg-tertiary, var(--bg-input));
  cursor: pointer; text-decoration: none;
  font-family: inherit;
}
.pager .controls a.active,
.pager .controls button.active {
  background: var(--color-primary);
  color: #04110d;
  border-color: var(--color-primary);
  font-weight: 600;
}
.pager .controls a:hover:not(.active),
.pager .controls button:hover:not(.active):not(:disabled) {
  color: var(--text-primary);
  border-color: var(--border-color-light);
}
.pager .controls button:disabled { opacity: 0.5; cursor: not-allowed; }

/* ==========================================================================
   DESIGN SIGNAL LIST  (.sig-list — used on /signals and /journal)
   Grid-row layout, not a table. Columns: time | type | channel | pair
   | direction | category | status | preview | actions
   2026-05-19 — added Category column (AI-determined classification)
   between Direction and Status so operators can read the bucket
   without changing the filter.
   ========================================================================== */
.sig-list {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  /* overflow-x: auto so the grid horizontally scrolls inside the card
     when the columns won't fit (~1080px desktop content area minus the
     ~260px sidebar). overflow-y: hidden preserves the rounded corner
     clip. Combined with .sig-row min-width below, columns retain their
     readable widths instead of collapsing into illegible slivers. */
  overflow-x: auto;
  overflow-y: hidden;
}
.sig-row {
  display: grid;
  /* 9 cols (added 2026-05-19 Category): time(110) type(80) channel(1fr)
     pair(110) direction(80) category(130) status(120) preview(1.2fr)
     actions(36) — sum of fixed = 666px + 2.2fr + 8 gaps × 12px = 762
     baseline. Trimmed pair / time / status from 130 → 110/120 so the
     row fits desktop content widths (~1180px) without horizontal
     overflow when sidebar is present. */
  grid-template-columns: 110px 80px 1fr 110px 80px 130px 120px 1.2fr 36px;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-color);
  align-items: center;
  font-size: 13px;
  /* Enforce a min-width so on narrow viewports the grid scrolls inside
     .sig-list instead of crushing columns. Sum of fixed cols + gaps +
     reasonable minimums for the two 1fr cols. */
  min-width: 1080px;
}
.sig-row:last-child { border-bottom: none; }
.sig-row.head {
  background: var(--bg-card-hover, var(--bg-secondary));
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 12px 18px;
  font-weight: 500;
}
.sig-row:not(.head):hover { background: rgba(63, 227, 176, 0.025); }
.sig-row .t { font-family: var(--font-mono); color: var(--text-muted); font-size: 12.5px; }
.sig-row .channel {
  display: flex; align-items: center; gap: 8px;
  color: var(--text-primary); font-size: 13px;
  min-width: 0; overflow: hidden;
}
.sig-row .channel .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sig-row .channel .h {
  width: 22px; height: 22px; border-radius: 6px;
  background: var(--bg-tertiary, var(--bg-input));
  display: grid; place-items: center;
  font-size: 10px; color: var(--text-muted);
  font-family: var(--font-mono); flex-shrink: 0;
}
.sig-row .pair { font-family: var(--font-mono); font-weight: 700; font-size: 13.5px; }
.sig-row .dir {
  font-family: var(--font-mono); font-size: 11px; font-weight: 700;
  letter-spacing: 0.08em; padding: 3px 8px;
  border-radius: 5px; display: inline-flex; justify-content: center; min-width: 54px;
}
.sig-row .dir.long { background: rgba(63, 227, 176, 0.10); color: var(--color-primary); }
.sig-row .dir.short { background: rgba(239, 106, 106, 0.10); color: var(--color-danger); }
.sig-row .preview {
  color: var(--text-muted); font-family: var(--font-mono);
  font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
/* .sig-list now always has overflow-x: auto and .sig-row has
   min-width: 1080px regardless of breakpoint (see above). The
   previous max-width: 980px-only rule is gone. */

/* ── Appearance toggles: density + reduce-motion ────────────────────────
   Both are applied to <html> and read by the Appearance section in
   settings.html. The density classes shrink/grow card padding that
   drives "how packed the UI feels"; reduce-motion kills the
   non-essential transitions and animations across the app. */
html[data-density="compact"] .card,
html[data-density="compact"] .bcard,
html[data-density="compact"] .ap-card { padding: 1rem; }
html[data-density="compact"] .card + .card,
html[data-density="compact"] .bcard + .bcard { margin-top: 0.75rem; }

html[data-density="spacious"] .card,
html[data-density="spacious"] .bcard,
html[data-density="spacious"] .ap-card { padding: 2rem; }
html[data-density="spacious"] .card + .card,
html[data-density="spacious"] .bcard + .bcard { margin-top: 1.75rem; }

html.reduce-motion *,
html.reduce-motion *::before,
html.reduce-motion *::after {
  transition: none !important;
  animation: none !important;
  scroll-behavior: auto !important;
}
