/* ============================================================
   Asset Bridge — Dark Trading Dashboard
   ============================================================ */

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

/* ── Colour tokens ───────────────────────────────────────── */
:root {
  --bg-base:        #020617;
  --bg-surface:     #0a0f1e;
  --bg-surface-2:   #0f172a;
  --bg-surface-3:   #1a2235;
  --bg-input:       #1e2a3a;
  --border:         rgba(255,255,255,0.06);
  --border-accent:  rgba(99,102,241,0.3);
  --border-subtle:  rgba(255,255,255,0.04);

  --accent:         #6366f1;
  --accent-2:       #818cf8;
  --accent-hover:   #4f46e5;
  --accent-gradient: linear-gradient(135deg, #6366f1, #a855f7);

  --cyan:           #22d3ee;
  --purple:         #a855f7;
  --live-green:     #10b981;
  --live-green-2:   #34d399;
  --pnl-red:        #ef4444;
  --pnl-red-2:      #f87171;
  --gold:           #f59e0b;

  --text:           #f1f5f9;
  --text-muted:     #94a3b8;
  --text-subtle:    #475569;

  --font:           'Inter', sans-serif;
  --mono:           'JetBrains Mono', monospace;

  --radius:         12px;
  --radius-sm:      8px;
  --shadow:         0 25px 50px rgba(0,0,0,0.5);
  --glow-blue:      0 0 20px rgba(99,102,241,0.2);
  --glow-green:     0 0 20px rgba(16,185,129,0.2);

  /* Accent tint helpers — used for hover/active/badge backgrounds */
  --accent-tint-4:  rgba(99,102,241,0.04);
  --accent-tint-6:  rgba(99,102,241,0.06);
  --accent-tint-10: rgba(99,102,241,0.10);
  --accent-tint-12: rgba(99,102,241,0.12);
  --accent-tint-15: rgba(99,102,241,0.15);
  --accent-tint-20: rgba(99,102,241,0.20);
  --accent-tint-30: rgba(99,102,241,0.30);
  --accent-glow-sm: 0 0 30px rgba(99,102,241,0.40);
  --accent-glow-md: 0 4px 20px rgba(99,102,241,0.35);
  --accent-glow-lg: 0 6px 28px rgba(99,102,241,0.50);
  --accent-ring:    0 0 0 3px rgba(99,102,241,0.15);
  --accent-card-bg: linear-gradient(135deg, rgba(99,102,241,.12), rgba(168,85,247,.08));
  --accent-card-before: radial-gradient(ellipse at 80% 20%, rgba(99,102,241,.15), transparent 60%);
}

/* ── Light theme overrides (Pearl & Midnight) ────────────── */
[data-theme="light"] {
  --bg-base:        #f1f5f4;
  --bg-surface:     #ffffff;
  --bg-surface-2:   #e9eeec;
  --bg-surface-3:   #dde5e2;
  --bg-input:       #f6f9f8;
  --border:         rgba(13,31,26,0.10);
  --border-accent:  rgba(13,148,136,0.30);
  --border-subtle:  rgba(13,31,26,0.05);

  --accent:         #0d9488;
  --accent-2:       #14b8a6;
  --accent-hover:   #0f766e;
  --accent-gradient: linear-gradient(135deg, #0d9488, #0891b2);

  --cyan:           #0891b2;
  --purple:         #7c3aed;
  --live-green:     #16a34a;
  --live-green-2:   #22c55e;
  --pnl-red:        #dc2626;
  --pnl-red-2:      #ef4444;
  --gold:           #b45309;

  --text:           #0d1f1a;
  --text-muted:     #3d5a52;
  --text-subtle:    #8faaa3;

  --shadow:         0 25px 50px rgba(13,31,26,0.10);
  --glow-blue:      0 0 20px rgba(13,148,136,0.15);
  --glow-green:     0 0 20px rgba(22,163,74,0.15);

  /* Accent tints — teal-based for light mode */
  --accent-tint-4:  rgba(13,148,136,0.04);
  --accent-tint-6:  rgba(13,148,136,0.06);
  --accent-tint-10: rgba(13,148,136,0.10);
  --accent-tint-12: rgba(13,148,136,0.12);
  --accent-tint-15: rgba(13,148,136,0.15);
  --accent-tint-20: rgba(13,148,136,0.20);
  --accent-tint-30: rgba(13,148,136,0.30);
  --accent-glow-sm: 0 0 30px rgba(13,148,136,0.30);
  --accent-glow-md: 0 4px 20px rgba(13,148,136,0.25);
  --accent-glow-lg: 0 6px 28px rgba(13,148,136,0.35);
  --accent-ring:    0 0 0 3px rgba(13,148,136,0.15);
  --accent-card-bg: linear-gradient(135deg, rgba(13,148,136,.10), rgba(8,145,178,.06));
  --accent-card-before: radial-gradient(ellipse at 80% 20%, rgba(13,148,136,.12), transparent 60%);
}

/* Suppress noise + blobs in light mode */
[data-theme="light"] body::before { opacity: 0; }
[data-theme="light"] .blob { opacity: 0; }

/* ── Theme toggle button ─────────────────────────────────── */
.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface-2);
  border: 1px solid var(--border);
  color: var(--text-muted);
  flex-shrink: 0;
  transition: background 0.2s, color 0.2s;
}
.theme-toggle:hover {
  background: var(--bg-surface-3);
  color: var(--text);
}
.theme-toggle svg { width: 16px; height: 16px; pointer-events: none; }

/* Dark mode: show moon. Light mode: show sun. */
.theme-toggle .icon-sun  { display: none; }
.theme-toggle .icon-moon { display: block; }
[data-theme="light"] .theme-toggle .icon-sun  { display: block; }
[data-theme="light"] .theme-toggle .icon-moon { display: none; }

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

html, body {
  height: 100%;
  background: var(--bg-base);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
input, button { outline: none; }

/* ── Scrollbar ───────────────────────────────────────────── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg-surface-3); border-radius: 4px; }

/* ── Noise texture overlay ───────────────────────────────── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.03'/%3E%3C/svg%3E");
  background-size: 200px;
  pointer-events: none;
  z-index: 0;
  opacity: 0.4;
}

/* ── Ambient glow blobs ──────────────────────────────────── */
.blob {
  position: fixed;
  border-radius: 50%;
  filter: blur(120px);
  pointer-events: none;
  z-index: 0;
}
.blob-1 {
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(99,102,241,.12), transparent 70%);
  top: -200px; right: -100px;
}
.blob-2 {
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(168,85,247,.08), transparent 70%);
  bottom: -100px; left: -100px;
}
.blob-3 {
  width: 300px; height: 300px;
  background: radial-gradient(circle, rgba(34,211,238,.06), transparent 70%);
  top: 40%; left: 40%;
}

/* ── Mono font utility ───────────────────────────────────── */
.font-mono { font-family: var(--mono); }

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-theme-toggle {
  position: fixed;
  top: 20px;
  right: 28px;
  z-index: 10;
}

.login-page {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--bg-base);
  padding: 24px;
}

.login-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  margin-bottom: 36px;
}

.login-brand-logo {
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  filter: hue-rotate(0deg);
}

/* Dark mode: white logo shown, light logo hidden */
.login-brand-logo img {
  width: 64px;
  height: 64px;
  filter: none;
}

.logo-dark  { display: block; }
.logo-light { display: none;  }

/* Light mode: black logo shown with teal filter, white logo hidden */
[data-theme="light"] .logo-dark           { display: none; }
[data-theme="light"] .logo-light          { display: block; }
[data-theme="light"] .logo-light          { filter: invert(42%) sepia(72%) saturate(500%) hue-rotate(135deg) brightness(88%) contrast(95%); }

.login-brand-name {
  font-family: 'Cinzel', serif;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: none;
  text-align: center;
  background: linear-gradient(90deg, var(--text), var(--accent-2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--bg-surface);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 40px;
  box-shadow: var(--shadow), 0 0 0 1px var(--accent-tint-6);
}

.login-card h2 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin-bottom: 6px;
}

.login-card p {
  color: var(--text-muted);
  font-size: 13px;
  margin-bottom: 28px;
}

.form-group { margin-bottom: 20px; }

.form-group label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.form-group input {
  width: 100%;
  background: var(--bg-surface-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  transition: border-color .2s, box-shadow .2s;
}

.form-group input:focus {
  border-color: var(--accent);
  box-shadow: var(--accent-ring);
}

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

/* Django error list */
.errorlist {
  list-style: none;
  color: var(--pnl-red);
  font-size: 12px;
  margin-top: 5px;
}

.login-btn {
  width: 100%;
  padding: 13px;
  background: var(--accent-gradient);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  margin-top: 8px;
  letter-spacing: 0.02em;
  transition: opacity .2s, transform .1s, box-shadow .2s;
  box-shadow: var(--accent-glow-md);
}

.login-btn:hover {
  opacity: 0.9;
  box-shadow: var(--accent-glow-lg);
}

.login-btn:active { transform: scale(0.99); }

.login-demo-hint {
  text-align: center;
  margin-top: 20px;
  color: var(--text-subtle);
  font-size: 12px;
}

.login-demo-hint a { color: var(--accent); }

/* ============================================================
   DASHBOARD LAYOUT
   ============================================================ */
.dashboard-root {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── Top navbar ──────────────────────────────────────────── */
.navbar {
  height: 54px;
  flex-shrink: 0;
  background: var(--bg-surface-2);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 100;
}

/* Brand: square icon + uppercase name */
.navbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-right: 36px;
  flex-shrink: 0;
}

.navbar-logo {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.navbar-logo img {
  filter: none;
}

.navbar-name {
  font-family: 'Cinzel', serif;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: none;
  color: var(--text);
}

/* ── Nav menu ────────────────────────────────────────────── */
.nav-menu {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
}

.nav-menu-item {
  padding: 5px 14px;
  border-radius: 6px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  background: transparent;
  border: none;
  white-space: nowrap;
  transition: color .18s, background .18s;
}

.nav-menu-item:hover {
  color: var(--text);
  background: var(--bg-surface-3);
}

.nav-menu-item.active {
  color: var(--accent-2);
  background: var(--bg-surface-3);
  font-weight: 600;
}

/* Right side of navbar */
.navbar-right {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-left: auto;
}

/* LIVE FEED badge — inline dot + text, no pill */
.live-badge {
  display: flex;
  align-items: center;
  gap: 7px;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  color: var(--live-green);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--live-green);
  box-shadow: 0 0 8px var(--live-green);
  animation: livepulse 1.5s infinite;
}

@keyframes livepulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.2; }
}

/* User info: name + email stacked, avatar circle on right */
.navbar-user {
  display: flex;
  align-items: center;
  gap: 10px;
}

.navbar-user-info {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
  transition: opacity .2s, max-width .2s;
}

.navbar-user-name {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text);
  line-height: 1;
}

.navbar-user-email {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  line-height: 1;
}

.navbar-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
}

.navbar-logout {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  padding: 0;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  transition: color .2s;
  border: none;
  background: none;
  display: flex;
  align-items: center;
  gap: 6px;
}
.navbar-logout:hover { color: var(--text); }
.navbar-logout svg {
  width: 20px;
  height: 20px;
}
.navbar-logout-label {
  display: inline-block;
}
.navbar-user-info {
  transition: opacity .2s, max-width .2s;
}

/* ── Main content area ───────────────────────────────────── */
.dashboard-main {
  padding: 14px 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  /* Constrain to viewport so dashboard is non-scrollable on desktop */
  height: calc(100vh - 54px);
  overflow: hidden;
}

/* ── PnL section: desktop 4-col grid wrapper ─────────────── */
.pnl-section {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1.4fr;
  gap: 12px;
  flex-shrink: 0;
}

/* pnl-row dissolves on desktop so its 3 cards sit directly in the pnl-section grid */
.pnl-row {
  display: contents;
}

/* On desktop: balance card goes last (position 4), matching original layout */
.balance-card {
  order: 4;
}

.pnl-card {
  background: var(--bg-surface);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: border-color .25s, transform .2s, box-shadow .2s;
}

.pnl-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--accent-gradient);
}

.pnl-card:hover {
  border-color: var(--border-accent);
  transform: translateY(-1px);
  box-shadow: var(--glow-blue);
}

.pnl-card-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.pnl-card-toggle {
  font-size: 9px;
  color: var(--text-subtle);
  font-weight: 500;
}

.pnl-card-value {
  font-family: var(--mono);
  font-size: 22px;
  font-weight: 600;
  line-height: 1;
  margin-bottom: 6px;
  transition: all .3s;
}

.pnl-card-value.pos { color: var(--live-green); }
.pnl-card-value.neg { color: var(--pnl-red); }

.pnl-card-pct {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-muted);
}

/* Progress bar strip at bottom of PnL card */
.pnl-card-bar {
  position: absolute;
  bottom: 0; left: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--live-green), transparent);
  transition: width .5s ease;
}
.pnl-card-bar.neg {
  background: linear-gradient(90deg, var(--pnl-red), transparent);
}

/* ── My Performance nav card (mobile-only) ───────────────── */
.pnl-card-nav {
  display: none; /* hidden on desktop */
  text-decoration: none;
  background: linear-gradient(135deg, rgba(99,102,241,0.15), rgba(16,185,129,0.10));
  border: 1px solid rgba(99,102,241,0.4) !important;
  cursor: pointer;
  flex-direction: column;
  justify-content: space-between;
  transition: border-color .2s, transform .15s;
}
.pnl-card-nav:hover,
.pnl-card-nav:active {
  border-color: rgba(99,102,241,0.75) !important;
  transform: translateY(-1px);
}
.pnl-card-nav .pnl-card-label {
  color: #a5b4fc;
  font-size: 10px;
}
.pnl-card-nav-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
}
.pnl-card-nav-icon {
  width: 28px;
  height: 28px;
  color: #6366f1;
  stroke: #6366f1;
}
.pnl-card-nav-cta {
  font-size: 13px;
  font-weight: 600;
  color: #a5b4fc;
  letter-spacing: 0.01em;
}

/* ── Balance card (4th) ──────────────────────────────────── */
.balance-card {
  background: var(--accent-card-bg);
  border: 1px solid var(--border-accent) !important;
  cursor: default;
  /* Two-column layout: balance value left, action buttons right */
  display: flex;
  flex-direction: column;
}

.balance-card::before {
  background: var(--accent-card-before);
  height: 100%;
}

.balance-card:hover {
  transform: none;
  box-shadow: none;
}

.balance-card .pnl-card-label {
  color: var(--accent-2);
  font-weight: 700;
}

/* Inner wrapper: balance number left, buttons stacked right */
.balance-card-body {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex: 1;
}

.balance-value {
  font-family: var(--mono);
  font-size: 26px;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 6px;
  position: relative;
}

.balance-currency {
  font-size: 18px;
  color: #FFD43B;
  opacity: 1;
  filter: drop-shadow(0 0 4px rgba(255, 196, 0, 0.45));
}

.perf-today-value .balance-currency {
  margin-right: 6px;
}

.balance-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--cyan);
  animation: livepulse .9s infinite;
  box-shadow: 0 0 10px var(--cyan);
  margin-left: 4px;
  flex-shrink: 0;
}

/* Buttons stacked vertically on the right */
.balance-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
}

.btn-withdraw, .btn-deposit {
  width: 90px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: not-allowed;
  position: relative;
  text-align: center;
  transition: all .2s;
}

.btn-withdraw {
  background: rgba(239,68,68,.06);
  border: 1px solid rgba(239,68,68,.2);
  color: rgba(239,68,68,.45);
}

.btn-deposit {
  background: rgba(16,185,129,.06);
  border: 1px solid rgba(16,185,129,.2);
  color: rgba(16,185,129,.45);
}

/* Tooltip on disabled buttons */
.btn-tip {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-surface-3);
  border: 1px solid var(--border-accent);
  color: var(--accent-2);
  font-size: 10px;
  white-space: nowrap;
  padding: 4px 8px;
  border-radius: 5px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
  font-weight: 500;
}
.btn-withdraw:hover .btn-tip,
.btn-deposit:hover .btn-tip { opacity: 1; }

/* ── Middle row: 3 columns aligned to top pnl-row ───────── */
/*
   Top row:  1fr | 1fr | 1fr | 1.4fr
   Middle:   1fr | 2fr | 1.4fr
   → price col aligns under one PnL card
   → chart spans two PnL cards
   → positions panel aligns under balance card
*/
.middle-row {
  display: grid;
  grid-template-columns: 1fr 2fr 1.4fr;
  grid-template-rows: 1fr;  /* single row fills full flex height */
  gap: 10px;
  flex: 3 1 0;
  min-height: 0;
  align-items: stretch;
  align-content: stretch;
}

/* ── Vertical price ticker panel ─────────────────────────── */
.price-ticker-col {
  background: var(--bg-surface);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  height: 100%;
  min-height: 0;
}

.price-ticker-col .panel-header {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  flex-shrink: 0;
}

/* scroll wrapper clips the animation */
.vticker-scroll-wrap {
  flex: 1;
  overflow: hidden;
  position: relative;
  min-height: 0;
}

/* the list scrolls upward on a loop */
@keyframes vticker-scroll {
  0%   { transform: translateY(0); }
  100% { transform: translateY(-50%); }
}

.vticker-list {
  display: flex;
  flex-direction: column;
  animation: vticker-scroll 20s linear infinite;
}

.vticker-list:hover {
  animation-play-state: paused;
}

.vticker-item {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 11px 16px;
  border-bottom: 1px solid var(--border-subtle);
  transition: background .15s;
  flex-shrink: 0;
}

.vticker-item:hover { background: var(--accent-tint-6); }

.vticker-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.vticker-badge {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
  letter-spacing: 0.02em;
}

.vticker-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.vticker-sym {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.03em;
}

.vticker-sub {
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 400;
}

.vticker-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
  flex-shrink: 0;
}

.vticker-price {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.vticker-chg {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
}

.vticker-chg.pos {
  color: var(--live-green);
  background: rgba(16,185,129,.12);
}
.vticker-chg.neg {
  color: var(--pnl-red);
  background: rgba(239,68,68,.12);
}

/* ── Chart panel ─────────────────────────────────────────── */
.chart-panel {
  background: var(--bg-surface);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
  height: 100%;
}

.chart-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  flex-shrink: 0;
}

.chart-panel-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.chart-range-selector { display: flex; gap: 4px; }

.chart-range-btn {
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-subtle);
  border: 1px solid transparent;
  transition: all .2s;
}

.chart-range-btn.active,
.chart-range-btn:hover {
  background: var(--accent-tint-15);
  border-color: var(--accent-tint-30);
  color: var(--accent-2);
}

.chart-range-label {
  font-size: 10px;
  color: var(--text-subtle);
  font-family: var(--mono);
}

.chart-wrapper {
  flex: 1;
  position: relative;
  min-height: 0;
}

.chart-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.chart-stat-item { text-align: center; }
.chart-stat-label {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-subtle);
  margin-bottom: 2px;
  display: block;
}
.chart-stat-value {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
}
.chart-stat-value.pos { color: var(--live-green); }
.chart-stat-value.neg { color: var(--pnl-red); }

/* ── Positions / history panel (right) ───────────────────── */
.positions-panel {
  background: var(--bg-surface);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  height: 100%;
  min-height: 0;
}

.panel-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.panel-tab {
  flex: 1;
  padding: 12px 16px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-subtle);
  text-align: center;
  position: relative;
  transition: color .2s;
}

.panel-tab.active { color: var(--accent-2); }
.panel-tab.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 10%; right: 10%;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--purple));
}
.panel-tab:hover:not(.active) { color: var(--text); }

.panel-content {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

.panel-content .tab-pane { display: none; }
.panel-content .tab-pane.active { display: block; }

/* ── Tables ──────────────────────────────────────────────── */
.positions-table,
.order-table {
  width: 100%;
  border-collapse: collapse;
}

.positions-table thead tr,
.order-table thead tr {
  position: sticky;
  top: 0;
  z-index: 2;
}

.positions-table th,
.order-table th {
  padding: 8px 12px;
  font-size: 9px;
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-subtle);
  background: var(--bg-surface-2);
  font-weight: 500;
  text-align: left;
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
}

.positions-table td,
.order-table td {
  padding: 9px 12px;
  font-family: var(--mono);
  font-size: 11px;
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
  transition: background .15s;
}

.positions-table tr:hover td,
.order-table tr:hover td { background: var(--accent-tint-4); }

.positions-table tr:last-child td,
.order-table tr:last-child td { border-bottom: none; }

/* Direction badges */
.dir-badge {
  display: inline-flex;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.dir-badge.long  { background: rgba(16,185,129,.1); color: var(--live-green-2); border: 1px solid rgba(16,185,129,.2); }
.dir-badge.short { background: rgba(239,68,68,.1);  color: var(--pnl-red-2);    border: 1px solid rgba(239,68,68,.2); }

/* PnL cells */
.pnl-cell { font-weight: 600; }
.pnl-cell.pos { color: var(--live-green); }
.pnl-cell.neg { color: var(--pnl-red); }

/* Status / order-type badges */
.status-badge {
  display: inline-flex;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.status-badge.filled    { background: rgba(16,185,129,.1);  color: var(--live-green);  border: 1px solid rgba(16,185,129,.2); }
.status-badge.pending   { background: rgba(245,158,11,.1);  color: var(--gold);         border: 1px solid rgba(245,158,11,.2); }
.status-badge.cancelled { background: rgba(100,116,139,.2); color: var(--text-muted);  border: 1px solid rgba(100,116,139,.2); }
.status-badge.market    { background: var(--accent-tint-10); color: var(--accent-2);     border: 1px solid var(--accent-tint-20); }
.status-badge.limit     { background: rgba(34,211,238,.1);  color: var(--cyan);         border: 1px solid rgba(34,211,238,.2); }
.status-badge.stop      { background: rgba(245,158,11,.1);  color: var(--gold);         border: 1px solid rgba(245,158,11,.2); }

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-subtle);
  font-size: 12px;
  font-family: var(--mono);
}

/* ── Flash animations ────────────────────────────────────── */
@keyframes flashGreen {
  0%   { background: rgba(16,185,129,.2); }
  100% { background: transparent; }
}
@keyframes flashRed {
  0%   { background: rgba(239,68,68,.2); }
  100% { background: transparent; }
}
.flash-green td { animation: flashGreen .6s ease-out; }
.flash-red   td { animation: flashRed   .6s ease-out; }

/* ── Order History section (bottom) ──────────────────────── */
.order-history-section {
  background: var(--bg-surface);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  flex: 2 1 0;          /* share remaining space: order-history gets 2 parts */
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.section-title {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.section-count {
  font-size: 11px;
  font-family: var(--mono);
  color: var(--text-subtle);
}

.order-history-section .panel-content {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  padding: 0 12px 16px;
}

/* ── Utility ─────────────────────────────────────────────── */
.text-muted  { color: var(--text-muted); }
.text-subtle { color: var(--text-subtle); }

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

/* CSS variables for sidebar dimensions */
:root {
  --sidebar-expanded: 200px;
  --sidebar-collapsed: 52px;
  --sidebar-w: var(--sidebar-expanded);
}

/* Sidebar toggle button (in navbar) */
.sidebar-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  color: var(--text-muted);
  background: transparent;
  flex-shrink: 0;
  margin-right: 12px;
  transition: background .2s, color .2s;
}
.sidebar-toggle:hover {
  background: var(--bg-surface-3);
  color: var(--text);
}

/* Body wrapper holding sidebar + main */
.dashboard-body {
  display: flex;
  flex: 1;
  min-height: 0;
  position: relative;
}

/* ── Sidebar panel ───────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-expanded);
  flex-shrink: 0;
  background: var(--bg-surface-2);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  transition: width .25s cubic-bezier(.4,0,.2,1);
  overflow: hidden;
  position: sticky;
  top: 54px;               /* stick below navbar */
  height: calc(100vh - 54px);
}

/* Collapsed state — toggled by JS */
.sidebar.collapsed {
  width: var(--sidebar-collapsed);
}

/* Nav section */
.sidebar-nav {
  flex: 1;
  padding: 16px 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Individual sidebar item */
.sidebar-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 10px;
  border-radius: 8px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  transition: background .18s, color .18s;
  position: relative;
  min-height: 36px;
}

.sidebar-item:hover:not(.disabled) {
  background: var(--bg-surface-3);
  color: var(--text);
}

.sidebar-item.active {
  background: var(--bg-surface-3);
  color: var(--accent-2);
  font-weight: 600;
}

.sidebar-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 6px; bottom: 6px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--accent);
}

.sidebar-item.disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* Tooltip on icon-only (collapsed) items */
.sidebar.collapsed .sidebar-item:hover .sidebar-label::after {
  content: attr(data-tooltip);
}

/* Icon */
.sidebar-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  stroke-width: 1.8;
}

/* Label — hidden in collapsed mode */
.sidebar-label {
  opacity: 1;
  transition: opacity .18s;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar.collapsed .sidebar-label {
  opacity: 0;
  width: 0;
  pointer-events: none;
}

/* Collapsed tooltip */
.sidebar.collapsed .sidebar-item {
  justify-content: center;
  padding: 9px;
}

/* Footer: profile + logout */
.sidebar-footer {
  padding: 12px 8px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar-profile {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  overflow: hidden;
}

.sidebar-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
}

.sidebar-user-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
  overflow: hidden;
  transition: opacity .18s;
}

.sidebar.collapsed .sidebar-user-info { opacity: 0; width: 0; overflow: hidden; }

.sidebar.collapsed .sidebar-profile {
  justify-content: center;
  padding: 8px;
}

.sidebar.collapsed .sidebar-logout {
  justify-content: center;
  padding: 9px;
}

.sidebar.collapsed .sidebar-logout .sidebar-label {
  opacity: 0;
  width: 0;
  pointer-events: none;
}

.sidebar-user-name {
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-role {
  font-size: 9px;
  color: var(--text-subtle);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.sidebar-logout {
  color: var(--text-subtle);
  font-size: 11px;
}

.sidebar-logout:hover {
  color: var(--pnl-red) !important;
  background: rgba(239,68,68,.06) !important;
}

/* ── Sidebar overlay (mobile) ────────────────────────────── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 49;
}

.sidebar-overlay.visible { display: block; }

/* ── Responsive: mobile sidebar ─────────────────────────── */
@media (max-width: 768px) {
  :root { --sidebar-w: var(--sidebar-expanded); }

  .live-badge { display: none; }

  .sidebar {
    position: fixed;
    top: 54px;
    left: 0;
    height: calc(100vh - 54px);
    z-index: 50;
    transform: translateX(-100%);
    transition: transform .25s cubic-bezier(.4,0,.2,1);
    width: var(--sidebar-expanded) !important; /* always full on mobile */
  }

  .sidebar.mobile-open {
    transform: translateX(0);
  }

  .dashboard-main {
    margin-left: 0 !important;
  }
}

/* ── Dashboard main adjusts to sidebar width ─────────────── */
.dashboard-main {
  flex: 1;
  min-width: 0;
  /* padding already set above */
}

/* ============================================================
   PERFORMANCE PAGE  (/performance/)
   ============================================================ */

.perf-main {
  overflow-y: auto;
  height: calc(100vh - 54px);
  gap: 14px;
}

/* Page header */
.perf-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.perf-page-title {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--text);
}

.perf-page-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 3px;
}

/* Section wrapper */
.perf-section {
  background: var(--bg-surface);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.perf-section-earnings {
  /* natural height — let content determine size */
}

/* Section header */
.perf-section-header { display: flex; flex-direction: column; gap: 3px; }

.perf-section-tag {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-2);
  background: var(--accent-tint-12);
  border: 1px solid var(--accent-tint-20);
  border-radius: 4px;
  padding: 2px 8px;
  align-self: flex-start;
  margin-bottom: 4px;
}

.perf-section-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.2px;
}

.perf-section-desc {
  font-size: 11px;
  color: var(--text-muted);
}

.perf-system-current-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.perf-open-table-wrap {
  overflow-x: auto;
}

.perf-open-table-wrap table {
  min-width: 480px;
}

/* Stats row */
.perf-stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.perf-stat-card {
  background: var(--bg-surface-3);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.perf-stat-label {
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-subtle);
}

.perf-stat-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}
.perf-stat-value.pos { color: var(--live-green); }

/* Chart panels */
.perf-chart-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.perf-chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-subtle);
}

.perf-chart-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.perf-chart-wrap {
  height: 240px;
  padding: 12px;
  position: relative;
}

/* Earnings grid: monthly chart + calendar side by side */
.perf-earnings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.perf-earnings-grid .perf-chart-panel {
  display: flex;
  flex-direction: column;
}

.perf-earnings-grid .perf-chart-wrap {
  height: 380px;
}

/* Calendar nav */
.cal-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.cal-nav-btn {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: var(--bg-surface-3);
  color: var(--text-muted);
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, color .15s;
}

.cal-nav-btn:hover {
  background: var(--accent-tint-15);
  color: var(--accent-2);
}

.cal-month-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
  min-width: 70px;
  text-align: center;
}

/* Calendar grid */
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
  padding: 10px 12px 12px;
}

.cal-day-header {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-subtle);
  text-align: center;
  padding: 4px 0;
  letter-spacing: 0.06em;
}

.cal-day {
  aspect-ratio: 1;
  border-radius: 5px;
  display: flex;
  flex-direction: column;
  padding: 5px 6px;
  align-items: center;
  justify-content: center;
  gap: 1px;
  font-size: 9px;
  background: var(--bg-surface-3);
  border: 1px solid var(--border-subtle);
  transition: border-color .15s;
  overflow: hidden;
  padding: 2px 1px;
}

.cal-day.blank {
  background: transparent;
  border-color: transparent;
}

.cal-day.cal-pos {
  background: rgba(16,185,129,.08);
  border-color: rgba(16,185,129,.2);
}

.cal-day.cal-neg {
  background: rgba(239,68,68,.06);
  border-color: rgba(239,68,68,.15);
}

.cal-day-num {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
}

.cal-day-pnl {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
  margin-top: 3px;
}

.cal-day-pnl.pos { color: var(--live-green); }
.cal-day-pnl.neg { color: var(--pnl-red); }

/* Current status grid */
.perf-current-grid {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 12px;
}

.perf-today-card {
  background: var(--accent-card-bg);
  border: 1px solid var(--border-accent);
  border-radius: var(--radius-sm);
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-start;
}

.perf-today-label {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent-2);
}

.perf-today-value {
  display: inline-flex;
  align-items: center;
  font-size: 24px;
  font-weight: 700;
  line-height: 1;
}
.perf-today-value.pos { color: var(--live-green); }
.perf-today-value.neg { color: var(--pnl-red); }

.perf-today-date {
  font-size: 10px;
  color: var(--text-subtle);
}

.perf-open-positions {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.perf-open-header {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

/* ── JetBrains Mono enforcement ─────────────────────────── */
/* All numeric / tabular data must use the mono font */
.font-mono,
.pnl-card-value,
.pnl-card-pct,
.balance-value,
.vticker-price,
.vticker-chg,
.chart-stat-value,
.chart-range-label,
.positions-table td,
.positions-table th,
.order-table td,
.order-table th,
.section-count,
.dir-badge,
.status-badge {
  font-family: var(--mono);
}

/* ============================================================
   Responsive adjustments
   ============================================================ */

@media (max-width: 1200px) {
  .pnl-section {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  }
  /* Switch middle-row to single column, each panel auto-height */
  .middle-row {
    grid-template-columns: 1fr;
    grid-template-rows: none;
    flex: none;
    align-content: start;
    height: auto;
  }
  .chart-panel,
  .positions-panel,
  .price-ticker-col {
    height: auto;
    min-height: 300px;
  }
  .order-history-section {
    flex: none;
    height: auto;
    min-height: 220px;
  }
  .panel-content {
    overflow-x: auto;
    max-height: 340px;
  }
  .positions-table,
  .order-table {
    min-width: 640px;
  }
  .perf-system-current-grid {
    grid-template-columns: 1fr;
  }
  /* dashboard-main scrollable below desktop */
  .dashboard-main {
    height: auto;
    overflow-y: auto;
  }
}

@media (max-width: 1024px) {
  .perf-stats-row {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  }
  .perf-earnings-grid {
    grid-template-columns: 1fr;
  }
  .perf-chart-wrap {
    height: 220px;
  }
  .perf-earnings-grid .perf-chart-wrap {
    height: 280px;
  }
  .perf-current-grid {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  }
}

@media (max-width: 768px) {

  /* ── Layout: flat flex column so we can reorder all panels ── */
  .dashboard-main {
    display: flex;
    flex-direction: column;
    height: auto;
    overflow-y: auto;
    padding: 12px 12px 80px;
    gap: 12px;
  }

  /* Dissolve wrappers so all panels are direct flex children of dashboard-main */
  .middle-row,
  .pnl-section {
    display: contents;
  }

  /* ── Card ordering (1 = top) ── */
  .balance-card          { order: 1; }
  .chart-panel           { order: 2; }
  .pnl-row               { order: 3; }
  .positions-panel       { order: 4; }
  .order-history-section { order: 5; }
  .price-ticker-col      { order: 6; }

  /* ── PnL row: restore grid for the 4-tile 2×2 layout ── */
  .pnl-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  /* Show My Performance nav card only on mobile */
  .pnl-card-nav {
    display: flex;
  }

  /* ── Card polish ── */
  .pnl-card,
  .balance-card {
    border-radius: 16px;
    padding: 16px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.18);
  }

  .chart-panel,
  .positions-panel,
  .price-ticker-col,
  .order-history-section {
    border-radius: 16px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.18);
    height: auto;
  }

  /* ── Panel sizing ── */
  .chart-panel {
    min-height: 300px;
  }
  .chart-wrapper {
    height: 240px;
    min-height: 220px;
    flex: none;
  }
  .positions-panel {
    min-height: 240px;
  }
  .positions-panel .panel-content {
    max-height: 300px;
    overflow-y: auto;
  }
  .order-history-section {
    flex: none;
    min-height: 0;
  }
  .order-history-section .panel-content {
    max-height: 320px;
    overflow-y: auto;
  }
  .price-ticker-col {
    min-height: 200px;
    max-height: 320px;
  }
  .vticker-scroll-wrap {
    height: 200px;
    min-height: 180px;
  }

  /* ── Tables: horizontal scroll ── */
  .panel-content {
    overflow-x: auto;
  }
  .positions-table,
  .order-table {
    min-width: 500px;
  }
  .positions-table th,
  .positions-table td,
  .order-table th,
  .order-table td {
    font-size: 11px;
    padding: 9px 11px;
  }

  /* ── Navbar on mobile: hide brand name, show logo box only ── */
  .navbar-brand .navbar-name {
    display: none;
    font-size: 14px;
  }
  .navbar-brand {
    gap: 6px;
  }

  /* ── Vticker item layout ── */
  .vticker-item {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
  .price-ticker-col .panel-header {
    padding-bottom: 8px;
  }

  /* ── Performance page ── */
  .perf-main {
    display: flex;
    flex-direction: column;
    height: auto;
    overflow-y: auto;
    padding: 12px 12px 80px;
    gap: 12px;
  }
  .perf-system-current-grid,
  .perf-earnings-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
  }
  .perf-page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  .perf-section {
    padding: 14px 16px;
    border-radius: 16px;
  }
  .perf-chart-wrap {
    height: 180px;
  }
  .perf-earnings-grid .perf-chart-wrap {
    height: 240px;
  }
  .cal-day-num {
    font-size: 11px;
  }
  .cal-day-pnl {
    font-size: 9px;
  }
  .perf-current-grid {
    grid-template-columns: 1fr;
  }
  .cal-grid {
    gap: 2px;
  }
  .perf-section-desc {
    font-size: 10px;
  }
  .perf-open-table-wrap {
    padding-bottom: 0;
  }
  .perf-open-positions table {
    min-width: 480px;
  }

  /* ── User info & logout in navbar ── */
  .navbar-user-info {
    opacity: 0;
    max-width: 0;
    overflow: hidden;
  }
  .navbar-user:hover .navbar-user-info {
    opacity: 1;
    max-width: 220px;
  }
  .navbar-logout-label {
    display: none;
  }
  .navbar-logout:hover .navbar-logout-label {
    display: inline-block;
  }
}

@media (min-width: 1200px) {
  .pnl-section {
    gap: 8px;
  }
  .pnl-card {
    padding: 12px 14px;
  }
  .pnl-card-value {
    font-size: 20px;
  }
  /* On large screens panels fill the flex-allocated height */
  .middle-row > *,
  .chart-panel,
  .price-ticker-col,
  .positions-panel {
    height: 100%;
  }
}

/* ── my_performance.html ─────────────────────────────────── */
.up-equity-wrap {
  height: 300px;
}

.up-trade-log-wrap {
  overflow-x: auto;
  overflow-y: auto;
  max-height: 420px;
}

.up-trade-log-wrap table {
  min-width: 720px;
}

@media (max-width: 768px) {
  .up-equity-wrap { height: 200px; }
}
