/* ==================================================================
   QUANT TRADING COMPANION — CLEAN DARK SYSTEM
   Pixel-accurate to Reference Design (No AI Slop / No Neon Gradients)
   ================================================================== */

:root {
  /* Matte Obsidian Glass Palette */
  --bg-app: #07090e;
  --bg-card: rgba(18, 23, 34, 0.72);
  --bg-card-hover: rgba(25, 32, 48, 0.82);
  --bg-card-active: rgba(30, 38, 58, 0.9);
  --border-card: rgba(255, 255, 255, 0.08);
  --border-subtle: rgba(255, 255, 255, 0.04);

  /* Glassmorphism System */
  --glass-blur: blur(20px);
  --glass-shadow: 0 12px 36px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  --glass-shadow-hover: 0 16px 44px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.12);

  /* Typography */
  --text-primary: #ffffff;
  --text-secondary: #94a3b8;
  --text-muted: #546479;

  /* Trading Colors */
  --green: #00d084;
  --green-bg: rgba(0, 208, 132, 0.12);
  --green-border: rgba(0, 208, 132, 0.25);

  --red: #ff4b55;
  --red-bg: rgba(255, 75, 85, 0.12);
  --red-border: rgba(255, 75, 85, 0.25);

  --blue: #2563eb;
  --blue-light: #3b82f6;
  --blue-bg: rgba(37, 99, 235, 0.15);
  --blue-border: rgba(37, 99, 235, 0.3);

  --amber: #f59e0b;
  --amber-bg: rgba(245, 158, 11, 0.15);

  --purple: #8b5cf6;
  --purple-bg: rgba(139, 92, 246, 0.15);

  --cyan: #06b6d4;
  --cyan-bg: rgba(6, 182, 212, 0.15);

  /* Responsive Constraints */
  --max-width-mobile: 430px;
  --max-width-desktop: 1260px;
  --max-width: var(--max-width-mobile);
  --radius-card: 14px;
  --radius-sm: 8px;
  --dock-height: 56px;

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* Global Reset */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

[hidden] {
  display: none !important;
}

html, body {
  background-color: var(--bg-app);
  background-image: 
    radial-gradient(circle at 18% 12%, rgba(37, 99, 235, 0.10) 0%, transparent 45%),
    radial-gradient(circle at 82% 18%, rgba(139, 92, 246, 0.08) 0%, transparent 42%),
    radial-gradient(circle at 45% 75%, rgba(0, 208, 132, 0.06) 0%, transparent 48%),
    radial-gradient(circle at 85% 82%, rgba(6, 182, 212, 0.06) 0%, transparent 40%);
  background-attachment: fixed;
  color: var(--text-primary);
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.45;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-variant-numeric: tabular-nums;
}

/* ---------------- Vector SVG Icon Constraints ---------------- */
svg {
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
  max-width: 100%;
}

.icon-xs { width: 12px; height: 12px; flex-shrink: 0; }
.icon-sm { width: 15px; height: 15px; flex-shrink: 0; }
.icon    { width: 18px; height: 18px; flex-shrink: 0; }
.icon-lg { width: 24px; height: 24px; flex-shrink: 0; }

.btn svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.btn-sm svg {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
}

.card-heading svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.banner-badge svg {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
}

.status-icon-circle {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 12px;
}
.status-icon-circle.error {
  background: var(--red-bg);
  border: 1px solid var(--red-border);
  color: var(--red);
}
.status-icon-circle svg {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

/* ---------------- Browser Dev Toolbar ---------------- */
.browser-banner {
  position: sticky;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: #11151f;
  border-bottom: 1px solid var(--border-card);
  padding: 8px 16px;
}
.banner-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.banner-left {
  display: flex;
  align-items: center;
  gap: 8px;
}
.banner-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--blue-bg);
  border: 1px solid var(--blue-border);
  color: #60a5fa;
  font-size: 11.5px;
  font-weight: 600;
  padding: 3px 7px;
  border-radius: 6px;
}
.banner-text {
  color: var(--text-secondary);
  font-size: 12px;
}
.banner-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-card);
  color: var(--text-primary);
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.banner-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* ---------------- App Shell & Centering ---------------- */
.app-shell {
  max-width: var(--max-width);
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  padding-bottom: calc(var(--dock-height) + var(--safe-bottom) + 24px);
}

/* ---------------- Top Navigation Bar (Mobile & Stage Header) ---------------- */
.top-nav {
  padding: calc(12px + var(--safe-top)) 16px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: rgba(11, 14, 20, 0.88);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  position: sticky;
  top: 0;
  z-index: 50;
  width: 100%;
}
.user-profile {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}
.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: #192234;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.1);
  flex-shrink: 0;
}
.user-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.user-name-row {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}
.user-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chevron-sm {
  width: 14px;
  height: 14px;
  color: var(--text-muted);
  flex-shrink: 0;
}
.account-tag {
  font-size: 11.5px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.icon-action-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-card);
  color: var(--text-secondary);
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.icon-action-btn svg { width: 16px; height: 16px; }
.icon-action-btn:hover {
  background: var(--bg-card);
  color: var(--text-primary);
}

/* Status Pill */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.3px;
  white-space: nowrap;
}
.status-pill.online {
  background: var(--green-bg);
  color: var(--green);
  border: 1px solid var(--green-border);
}
.status-pill.offline {
  background: var(--red-bg);
  color: var(--red);
  border: 1px solid var(--red-border);
}
.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* ---------------- Screens ---------------- */
.screen {
  display: none !important;
  flex: 1;
  padding: 16px 18px 24px;
}
.screen.active {
  display: block !important;
}

/* ---------------- Locked Access Gate (Enter Code First) ---------------- */
body:not(.app-unlocked) .top-nav,
body:not(.app-unlocked) .dock-tabbar,
body:not(.app-unlocked) .dock-bar,
body:not(.app-unlocked) .desktop-sidebar,
body:not(.app-unlocked) #browser-banner {
  display: none !important;
}

body:not(.app-unlocked) .app-shell {
  max-width: 480px !important;
  margin: 40px auto !important;
  padding: 16px !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  min-height: calc(100vh - 80px) !important;
}

body:not(.app-unlocked) .app-main-stage {
  width: 100% !important;
  max-width: 100% !important;
}

body:not(.app-unlocked) #screen-connect {
  width: 100% !important;
  padding: 0 !important;
}

.auth-brand-badge {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 22px;
  justify-content: center;
}
.brand-badge.large {
  width: 44px;
  height: 44px;
  border-radius: 12px;
}
.brand-badge.large svg {
  width: 22px;
  height: 22px;
}
.auth-brand-title {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.2px;
  color: #ffffff;
}
.auth-brand-sub {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

.connect-title {
  font-size: 17px;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 6px;
  text-align: center;
}
.connect-sub {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 18px;
  text-align: center;
  line-height: 1.45;
}

.code-input {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace !important;
  font-size: 16px !important;
  font-weight: 700 !important;
  letter-spacing: 2px !important;
  text-align: center !important;
  text-transform: uppercase !important;
  padding: 14px 16px !important;
  background: rgba(8, 11, 17, 0.7) !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  border-radius: 10px !important;
  color: #ffffff !important;
  transition: border-color 0.2s ease, box-shadow 0.2s ease !important;
}
.code-input:focus {
  border-color: #3b82f6 !important;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25) !important;
  outline: none !important;
}

.form-error-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 75, 85, 0.12);
  border: 1px solid rgba(255, 75, 85, 0.25);
  border-radius: 8px;
  padding: 8px 12px;
  color: var(--red);
  font-size: 12.5px;
  font-weight: 600;
  margin-bottom: 14px;
}

.center-content {
  min-height: 55vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  text-align: center;
  padding: 24px;
}

/* ---------------- Solid Cards ---------------- */
.solid-card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-card);
  padding: 18px;
  margin-bottom: 16px;
}

/* ---------------- View Headers ---------------- */
.view-header {
  margin-bottom: 18px;
}
.eyebrow {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 2px;
}
.hero-title {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.4px;
  color: var(--text-primary);
}
.header-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.mini-status-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
  background: var(--green-bg);
  color: var(--green);
  border: 1px solid var(--green-border);
}
.mini-status-chip .chip-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}
.page-sub {
  font-size: 13.5px;
  color: var(--text-secondary);
  margin-top: 3px;
}

/* ---------------- TAB 1: HERO EQUITY CARD ---------------- */
.hero-equity-card {
  padding: 20px;
}
.equity-top {
  margin-bottom: 18px;
}
.equity-label-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.equity-caption {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
}
.wallet-icon-badge {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: #1c2332;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #60a5fa;
}
.wallet-icon-badge svg { width: 18px; height: 18px; }

.equity-value-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.equity-number {
  font-size: 34px;
  font-weight: 800;
  letter-spacing: -0.8px;
  color: #ffffff;
  font-variant-numeric: tabular-nums;
}
.floating-text {
  font-size: 13.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.floating-text.neg { color: var(--red); }
.floating-text.pos { color: var(--green); }

.equity-metrics-bar {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding-top: 16px;
  border-top: 1px solid var(--border-subtle);
}
.eq-sub-col {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.eq-sub-label {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.3px;
}
.eq-sub-val {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

/* ---------------- Section Titles ---------------- */
.section-block {
  margin-bottom: 18px;
}
.section-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.section-title {
  font-size: 15.5px;
  font-weight: 700;
  color: #ffffff;
}
.section-link {
  background: transparent;
  border: none;
  color: #60a5fa;
  font-size: 13px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  cursor: pointer;
}
.section-link svg { width: 14px; height: 14px; }
.subsection-title {
  font-size: 15px;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 12px;
}

/* ---------------- 2x2 System Status Grid (Photo 3) ---------------- */
.status-grid-2x2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 18px;
}
.status-tile {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-card);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.tile-header {
  display: flex;
  align-items: center;
  gap: 8px;
}
.tile-icon-box {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.tile-icon-box.emerald { background: var(--green-bg); color: var(--green); }
.tile-icon-box.blue    { background: var(--blue-bg);  color: #60a5fa; }
.tile-icon-box.cyan    { background: var(--cyan-bg);  color: var(--cyan); }
.tile-icon-box.purple  { background: var(--purple-bg);color: var(--purple); }
.tile-icon-box svg { width: 16px; height: 16px; }

.tile-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}
.tile-status-text {
  font-size: 14.5px;
  font-weight: 700;
}
.tile-status-text.pos { color: var(--green); }
.tile-status-text.warn { color: var(--amber); }
.tile-status-text.neg { color: var(--red); }

/* ---------------- Positions & Volume (Photo 3) ---------------- */
.stats-row-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 18px;
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-card);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
}
.stat-icon-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.stat-icon-circle {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.stat-icon-circle.blue   { background: var(--blue-bg);   color: #60a5fa; }
.stat-icon-circle.purple { background: var(--purple-bg); color: var(--purple); }
.stat-icon-circle svg { width: 15px; height: 15px; }

.stat-tag-line {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-muted);
}
.stat-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
  letter-spacing: 0.3px;
  margin-bottom: 3px;
}
.stat-big-val {
  font-size: 20px;
  font-weight: 800;
  color: #ffffff;
  font-variant-numeric: tabular-nums;
}

/* ---------------- Order Summary Cards (Direct from Photo 3) ---------------- */
.order-summary-card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-card);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.order-summary-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.side-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 7px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.3px;
}
.side-chip.buy {
  background: rgba(37, 99, 235, 0.2);
  color: #60a5fa;
}
.side-chip.sell {
  background: rgba(255, 75, 85, 0.2);
  color: #ff6e76;
}
.side-chip svg { width: 11px; height: 11px; }

.order-summary-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.4px;
}
.order-summary-val {
  font-size: 18px;
  font-weight: 800;
  color: #ffffff;
  font-variant-numeric: tabular-nums;
}

/* ---------------- Refined Compact Buttons (Exact Reference Proportions) ---------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 14px;
  height: 34px;
  max-height: 34px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.2px;
  border: none;
  cursor: pointer;
  transition: opacity 0.15s ease, background 0.15s ease;
  user-select: none;
}
.btn-sm {
  height: 30px;
  max-height: 30px;
  padding: 0 10px;
  font-size: 11.5px;
  border-radius: 7px;
}
.icon-xs { width: 12px; height: 12px; }
.btn:active { transform: scale(0.98); opacity: 0.85; }
.btn.wide { width: 100%; }

.btn-start {
  background: #103423;
  border: 1px solid rgba(0, 208, 132, 0.35);
  color: #34d399;
}
.btn-start:hover { background: #174b34; }
.btn-start:disabled {
  background: #151922;
  border-color: var(--border-card);
  color: var(--text-muted);
  cursor: not-allowed;
}

.btn-stop {
  background: #2b171c;
  border: 1px solid rgba(255, 75, 85, 0.35);
  color: #fb7185;
}
.btn-stop:hover { background: #3c2027; }
.btn-stop:disabled { opacity: 0.35; cursor: not-allowed; }

.btn-close-all {
  background: #ff3b5c;
  color: #ffffff;
  font-weight: 700;
}
.btn-close-all:hover { background: #e0304f; }

.btn-primary { background: var(--blue); color: #ffffff; }
.btn-primary:hover { background: #1d4ed8; }
.btn-emerald { background: var(--green); color: #0b0e14; font-weight: 700; }
.btn-crimson { background: #ff3b5c; color: #ffffff; font-weight: 700; }
.btn-ghost {
  background: transparent;
  border: 1px solid var(--border-card);
  color: var(--text-secondary);
}
.btn-ghost:hover { background: var(--bg-card); color: var(--text-primary); }
.btn-warning {
  background: var(--amber-bg);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: #fbbf24;
}

/* ---------------- TAB 2: POSITIONS VIEW (Photo 4) ---------------- */
.pos-actions-bar {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin-bottom: 14px;
}
.action-pill-btn {
  padding: 0 8px;
  height: 34px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  transition: opacity 0.15s ease;
}
.action-pill-btn:active {
  opacity: 0.8;
}
.action-pill-btn.blue {
  background: #152238;
  border: 1px solid rgba(59, 130, 246, 0.2);
  color: #60a5fa;
}
.action-pill-btn.red {
  background: #2a1720;
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: #f87171;
}
.action-pill-btn.primary-red {
  background: #ff3b5c;
  color: #ffffff;
  font-weight: 700;
}

.segmented-control {
  display: flex;
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: 8px;
  padding: 2px;
  margin-bottom: 14px;
}
.segment-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  padding: 5px 6px;
  height: 28px;
  border-radius: 6px;
  cursor: pointer;
}
.segment-btn.active {
  background: #232c3d;
  color: #ffffff;
}

/* ---------------- Trade Cards (Photos 1 & 4) ---------------- */
.trades-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.trade-card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-card);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.trade-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}
.symbol-avatar {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: #182338;
  color: #60a5fa;
  font-size: 11px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.symbol-avatar.gold {
  background: #2a2215;
  color: #fbbf24;
}

.trade-details {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.trade-title-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.trade-symbol {
  font-size: 14.5px;
  font-weight: 700;
  color: #ffffff;
}
.side-tag {
  font-size: 10.5px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 4px;
}
.side-tag.buy {
  background: rgba(37, 99, 235, 0.2);
  color: #60a5fa;
}
.side-tag.sell {
  background: rgba(255, 75, 85, 0.2);
  color: #ff6e76;
}

.trade-prices-line {
  font-size: 12px;
  color: var(--text-secondary);
}
.trade-time-line {
  font-size: 11px;
  color: var(--text-muted);
}

.trade-right {
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: right;
}
.trade-profit-col {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
}
.trade-profit {
  font-size: 15.5px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.trade-profit.pos { color: var(--green); }
.trade-profit.neg { color: var(--red); }
.trade-exit-price {
  font-size: 11px;
  color: var(--text-muted);
}

.trade-close-x {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-card);
  color: var(--text-muted);
  width: 28px;
  height: 28px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.trade-close-x:hover {
  background: var(--red-bg);
  color: var(--red);
}
.trade-close-x svg { width: 14px; height: 14px; }

/* ---------------- TAB 3: HISTORY VIEW (Photo 1) ---------------- */
.timeframe-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}
.timeframe-pill {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  padding: 8px;
  border-radius: 10px;
  cursor: pointer;
  text-align: center;
}
.timeframe-pill.active {
  background: #1c2b48;
  border-color: #2b4578;
  color: #ffffff;
}

.history-hero-card {
  padding: 20px;
}
.hist-hero-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.hist-hero-caption {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
}
.hist-page-tag {
  font-size: 11px;
  color: var(--text-muted);
}
.hist-profit-val {
  font-size: 34px;
  font-weight: 800;
  letter-spacing: -0.8px;
  font-variant-numeric: tabular-nums;
  margin-bottom: 16px;
}
.hist-profit-val.pos { color: var(--green); }
.hist-profit-val.neg { color: var(--red); }

.hist-stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding-top: 14px;
  border-top: 1px solid var(--border-subtle);
  margin-bottom: 12px;
}
.hist-stat-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.hist-stat-num {
  font-size: 18px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.hist-stat-num.pos { color: var(--green); }
.hist-stat-num.neg { color: var(--red); }
.hist-stat-label {
  font-size: 11.5px;
  color: var(--text-secondary);
}

.hist-winrate-box {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 8px;
}
.winrate-text {
  font-size: 13px;
  color: var(--text-secondary);
}
.winrate-text strong { color: #ffffff; }

/* ---------------- TAB 4: MORE MENU (Photo 2) ---------------- */
.settings-menu-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 24px;
}
.menu-item-card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-card);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  transition: background 0.15s ease;
}
.menu-item-card:hover {
  background: var(--bg-card-hover);
}

.menu-icon-box {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.menu-icon-box.blue    { background: var(--blue-bg);   color: #60a5fa; }
.menu-icon-box.purple  { background: var(--purple-bg); color: var(--purple); }
.menu-icon-box.emerald { background: var(--green-bg);  color: var(--green); }
.menu-icon-box.amber   { background: var(--amber-bg);  color: var(--amber); }
.menu-icon-box.cyan    { background: var(--cyan-bg);   color: var(--cyan); }
.menu-icon-box.red     { background: var(--red-bg);    color: var(--red); }
.menu-icon-box svg { width: 20px; height: 20px; }

.menu-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.menu-title {
  font-size: 14.5px;
  font-weight: 700;
  color: #ffffff;
}
.menu-sub {
  font-size: 12px;
  color: var(--text-secondary);
}
.menu-chevron {
  width: 16px;
  height: 16px;
  color: var(--text-muted);
}
.text-red { color: #ff6e76 !important; }

.workspace-footer {
  text-align: center;
  padding: 16px 0;
}
.app-brand-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}
.app-version-tag {
  font-size: 11px;
  color: var(--text-muted);
}

/* ---------------- BOTTOM DOCK TABBAR (100% Device Width Native Experience) ---------------- */
.dock-tabbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  width: 100%;
  max-width: 100%;
  transform: none;
  height: calc(var(--dock-height) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: rgba(11, 14, 20, 0.94);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: stretch;
  justify-content: space-around;
  padding: 0;
  margin: 0;
  z-index: 100;
}
.dock-tab {
  flex: 1 1 25%;
  width: 25%;
  height: 100%;
  background: transparent;
  border: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0;
  margin: 0;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: color 0.15s ease, background 0.15s ease;
}
.dock-tab:active {
  background: rgba(255, 255, 255, 0.04);
}
.dock-icon-wrapper svg { width: 20px; height: 20px; }
.dock-label {
  font-size: 10.5px;
  font-weight: 600;
}
.dock-tab.active {
  color: #3b82f6;
}
.dock-tab.active .dock-icon-wrapper svg {
  stroke: #3b82f6;
}

/* ---------------- Modals & Sheets (CRITICAL BUGFIX: [hidden] DISPLAY) ---------------- */
.sheet-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(6px);
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.sheet-overlay[hidden] {
  display: none !important;
}

.sheet-panel {
  background: #141822;
  border: 1px solid var(--border-card);
  border-radius: 24px 24px 0 0;
  width: 100%;
  max-width: var(--max-width);
  padding: 12px 18px calc(20px + var(--safe-bottom));
}
.sheet-drag-handle {
  width: 38px;
  height: 4px;
  background: #2a3344;
  border-radius: 8px;
  margin: 0 auto 14px;
}
.sheet-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.sheet-title {
  font-size: 17px;
  font-weight: 700;
  color: #ffffff;
}
.close-sheet-btn {
  background: rgba(255, 255, 255, 0.05);
  border: none;
  color: var(--text-secondary);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.close-sheet-btn svg { width: 14px; height: 14px; }

.sheet-content {
  margin-bottom: 18px;
  color: var(--text-secondary);
  font-size: 13.5px;
}
.sheet-content.scrollable {
  max-height: 55vh;
  overflow-y: auto;
}
.sheet-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Modal Table */
.modal-kv-table {
  background: #0f131c;
  border: 1px solid var(--border-card);
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 10px 0;
}
.modal-kv-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
}
.modal-kv-row .k { color: var(--text-secondary); }
.modal-kv-row .v { color: var(--text-primary); font-weight: 600; }

/* ---------------- Loader & Toast ---------------- */
.loader-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border-card);
  border-top-color: #3b82f6;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-msg {
  font-size: 13.5px;
  color: var(--text-secondary);
  font-weight: 500;
}

.toast-notification {
  position: fixed;
  bottom: calc(var(--dock-height) + var(--safe-bottom) + 16px);
  left: 50%;
  transform: translateX(-50%);
  background: #1c2332;
  border: 1px solid var(--border-card);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  color: #ffffff;
  z-index: 300;
}
.toast-notification.ok   { color: var(--green); border-color: var(--green-border); }
.toast-notification.warn { color: var(--amber); border-color: rgba(245, 158, 11, 0.3); }
.toast-notification.err  { color: var(--red);   border-color: var(--red-border); }

/* ---------------- Setup Forms ---------------- */
.pairing-icon-box {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: var(--blue-bg);
  border: 1px solid var(--blue-border);
  color: #60a5fa;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 14px;
}
.pairing-icon-box svg { width: 24px; height: 24px; }
.input-label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.text-input {
  width: 100%;
  background: #0d1017;
  border: 1px solid var(--border-card);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 15px;
  color: #ffffff;
  font-family: inherit;
  outline: none;
}
.text-input:focus { border-color: #3b82f6; }
.form-hint {
  font-size: 12px;
  color: var(--text-secondary);
  margin: 8px 0 14px;
}
.form-error-msg {
  color: var(--red);
  font-size: 12.5px;
  font-weight: 600;
  margin-bottom: 10px;
}
.card-heading {
  font-size: 13.5px;
  font-weight: 700;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
}
.steps-list, .checklist {
  padding-left: 18px;
  color: var(--text-secondary);
  font-size: 12.5px;
  line-height: 1.6;
}
.steps-list code {
  background: rgba(255, 255, 255, 0.06);
  padding: 2px 5px;
  border-radius: 4px;
  color: #93c5fd;
  font-size: 11.5px;
}
.kv-item {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 13px;
}
.kv-item:last-child { border-bottom: none; }
.kv-item .k { color: var(--text-secondary); }
.kv-item .v { color: var(--text-primary); font-weight: 600; }
.action-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 16px;
}

/* ---------------- PC & Responsive Glassmorphism Terminal ---------------- */

/* Glass surfaces shared elevation */
.solid-card,
.status-tile,
.stat-card,
.order-summary-card,
.trade-card,
.menu-item-card {
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  box-shadow: var(--glass-shadow);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.solid-card:hover,
.status-tile:hover,
.stat-card:hover,
.order-summary-card:hover,
.menu-item-card:hover {
  border-color: rgba(255, 255, 255, 0.14);
}

/* Desktop Sidebar Component */
.desktop-sidebar {
  width: 260px;
  flex-shrink: 0;
  background: rgba(14, 18, 28, 0.78);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-card);
  box-shadow: var(--glass-shadow);
  border-radius: 20px;
  padding: 22px 18px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  position: sticky;
  top: 24px;
  height: calc(100vh - 48px);
  z-index: 90;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-subtle);
}

.brand-badge {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--blue-bg);
  border: 1px solid var(--blue-border);
  color: #60a5fa;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.brand-badge svg { width: 18px; height: 18px; }

.brand-text {
  display: flex;
  flex-direction: column;
}
.brand-title {
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.3px;
  color: #ffffff;
}
.brand-sub {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
}

.sidebar-user-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar-user-card .user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  font-size: 12px;
}
.sidebar-user-card .user-name {
  font-size: 13.5px;
  font-weight: 700;
}
.sidebar-user-card .account-tag {
  font-size: 11.5px;
  color: var(--text-secondary);
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.sidebar-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 10px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
  position: relative;
  text-align: left;
  width: 100%;
}
.sidebar-nav-item svg {
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  transition: color 0.15s ease;
}
.sidebar-nav-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #ffffff;
}
.sidebar-nav-item:hover svg {
  color: #ffffff;
}
.sidebar-nav-item.active {
  background: rgba(37, 99, 235, 0.15);
  border: 1px solid rgba(37, 99, 235, 0.3);
  color: #60a5fa;
}
.sidebar-nav-item.active svg {
  color: #60a5fa;
}

.sidebar-badge {
  margin-left: auto;
  background: rgba(37, 99, 235, 0.25);
  color: #93c5fd;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 6px;
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--border-subtle);
}
.sidebar-status-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

/* Desktop 2-Column Home Layout */
.home-terminal-grid {
  display: block;
}

.desktop-live-panel {
  padding: 18px;
  margin-bottom: 16px;
}
.desktop-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.desktop-pills {
  display: flex;
  gap: 6px;
}
.desktop-pills .action-pill-btn {
  height: 28px;
  padding: 0 8px;
  font-size: 11px;
}
.desktop-trades-scroll {
  max-height: 400px;
  overflow-y: auto;
  padding-right: 4px;
}
.desktop-trades-scroll::-webkit-scrollbar {
  width: 4px;
}
.desktop-trades-scroll::-webkit-scrollbar-thumb {
  background: #2a3344;
  border-radius: 4px;
}

.desktop-ctrl-card {
  padding: 16px 18px;
}
.desktop-ctrl-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.desktop-btn-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1.2fr;
  gap: 8px;
}

/* ---------------- Responsive Breakpoints ---------------- */

/* Mobile & Tablet (< 992px) */
@media (max-width: 991px) {
  .desktop-sidebar {
    display: none !important;
  }
  .home-col-secondary {
    display: none !important;
  }
  .app-shell {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    padding-bottom: calc(var(--dock-height) + var(--safe-bottom) + 18px) !important;
  }
  .app-main-stage {
    width: 100% !important;
    max-width: 100% !important;
  }
  section.screen {
    width: 100% !important;
    max-width: 100% !important;
    padding: 14px 16px 20px !important;
  }
  .dock-tabbar {
    display: flex !important;
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100vw !important;
    max-width: 100vw !important;
    transform: none !important;
    border-radius: 0 !important;
    border-left: none !important;
    border-right: none !important;
    border-bottom: none !important;
  }
  .dock-tab {
    flex: 1 1 25% !important;
    width: 25% !important;
    height: 100% !important;
  }
}

/* Desktop Terminal View (>= 992px) */
@media (min-width: 992px) {
  .app-shell {
    max-width: var(--max-width-desktop);
    margin: 24px auto;
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 24px;
    padding-bottom: 30px;
    border: none;
    background: transparent;
  }

  .app-main-stage {
    flex: 1;
    min-width: 0;
  }

  /* Hide mobile dock on PC */
  .dock-tabbar {
    display: none !important;
  }

  /* Desktop Stage Header */
  .top-nav {
    border-radius: 18px;
    background: rgba(14, 18, 28, 0.72);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border-card);
    box-shadow: var(--glass-shadow);
    margin-bottom: 18px;
    padding: 14px 20px;
  }
  .top-nav .user-profile {
    display: none; /* Already prominently in the left glass sidebar */
  }

  /* 2-Column Terminal Layout */
  .home-terminal-grid {
    display: grid;
    grid-template-columns: 1.15fr 1fr;
    gap: 22px;
    align-items: flex-start;
  }
  .home-col-primary {
    min-width: 0;
  }
  .home-col-secondary {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-width: 0;
  }

  /* Settings Page 2-Column Grid on Desktop */
  .settings-menu-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
  }

  /* Desktop Centered Glass Modals */
  .sheet-overlay {
    align-items: center;
    justify-content: center;
  }
  .sheet-panel {
    max-width: 520px;
    margin: auto;
    border-radius: 20px;
    padding: 24px 28px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.75), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  }
  .sheet-drag-handle {
    display: none;
  }
}
