/* ═══════════════════════════════════════════════════════════════════════════
   IBIT TRADING — UNIFIED LIGHT THEME (BingX/Binance-inspired)
   Shared by all trading pages: trade-spot, trade-futures, trade-bot, trade-pro
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
  /* Light surface */
  --fx-bg:        #ffffff;
  --fx-bg-soft:   #f6f7f9;
  --fx-bg-soft2:  #f1f3f6;
  --fx-border:    #eef0f4;
  --fx-border-2:  #e5e7eb;
  /* Text */
  --fx-text:      #1f2329;
  --fx-text-2:    #5b6068;
  --fx-text-3:    #9ba0a8;
  /* Status */
  --fx-up:        #16c784;
  --fx-up-bg:     rgba(22,199,132,0.10);
  --fx-down:      #ea3943;
  --fx-down-bg:   rgba(234,57,67,0.10);
  /* Brand */
  --fx-brand:     #1f2329;       /* primary buttons / active tabs */
  --fx-brand-2:   #ffc107;       /* IBIT yellow accent (tooltip badge) */
  --fx-shadow:    0 4px 12px rgba(0,0,0,0.06);
  /* Responsive trading shell (matches app.css breakpoints) */
  --trading-shell-max: 100%;
  --nav-safe-bottom: env(safe-area-inset-bottom, 0px);
}

@media (min-width: 768px) {
  :root { --trading-shell-max: min(100%, 640px); }
  body.fx-body,
  body.trading-body { background: var(--fx-bg-soft); }
}

@media (min-width: 1024px) {
  :root { --trading-shell-max: min(100%, 560px); }
}

@media (min-width: 1280px) {
  :root { --trading-shell-max: 480px; }
}

/* Mobile container — Bot, FTT Spot, Futures use .fx-app; Pro uses .mt4-app */
html:has(body.fx-body),
html:has(body.trading-body) {
  overflow-x: hidden;
  overflow-y: auto;
  height: auto;
  min-height: 100%;
  min-height: 100dvh;
}
body.fx-body,
body.trading-body {
  overflow-x: hidden !important;
  overflow-y: auto !important;
  height: auto !important;
  min-height: 100vh;
  min-height: 100dvh;
  width: 100%;
  max-width: 100vw;
  -webkit-overflow-scrolling: touch;
}
/* MT4 (trade-pro) — fullscreen app shell, own internal scroll */
html:has(body.fx-mt4-page),
body.fx-mt4-page {
  overflow: hidden !important;
  height: 100% !important;
  height: 100dvh !important;
  min-height: 0 !important;
  width: 100%;
  max-width: 100vw;
}
body.fx-mt4-page {
  display: flex;
  justify-content: center;
  background: var(--fx-bg-soft);
}
.fx-body { background: var(--fx-bg); color: var(--fx-text); font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', system-ui, sans-serif; margin: 0; }
.fx-body * { box-sizing: border-box; }
.fx-app {
  width: 100%;
  max-width: var(--trading-shell-max);
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--fx-bg);
  padding-bottom: calc(76px + var(--nav-safe-bottom));
  position: relative;
  overflow-x: hidden;
}

/* ===== Shared platform tab strip (Spot | Futures | Bot | Pro) ===== */
.fx-platform-tabs {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 12px 16px 6px;
  background: var(--fx-bg);
  border-bottom: 1px solid transparent;
  overflow-x: auto;
  scrollbar-width: none;
}
.fx-platform-tabs::-webkit-scrollbar { display: none; }
.fx-platform-tabs a,
.fx-platform-tabs button {
  background: transparent;
  border: 0;
  text-decoration: none;
  color: var(--fx-text-3);
  font-size: 16px;
  font-weight: 600;
  padding: 6px 0;
  cursor: pointer;
  position: relative;
  white-space: nowrap;
  flex: 0 0 auto;
}
.fx-platform-tabs a.active,
.fx-platform-tabs button.active { color: var(--fx-text); font-weight: 700; }
.fx-platform-tabs a.active::after,
.fx-platform-tabs button.active::after {
  content:"";
  position: absolute; left: 0; right: 0; bottom: -8px;
  height: 2px; background: var(--fx-text);
  border-radius: 2px;
}

/* ===== Shared bottom nav (light) ===== */
.fx-bottom-nav {
  position: fixed; bottom: 0; left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: var(--trading-shell-max);
  background: var(--fx-bg);
  border-top: 1px solid var(--fx-border);
  display: grid; grid-template-columns: repeat(5, 1fr);
  padding: 6px 0 calc(6px + var(--nav-safe-bottom, env(safe-area-inset-bottom, 0px)));
  z-index: 90;
}
.fx-bottom-nav a {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  text-decoration: none; color: var(--fx-text-2);
  font-size: 10px; padding: 4px 0;
}
.fx-bottom-nav a.active { color: var(--fx-text); font-weight: 600; }
.fx-bottom-nav a svg { width: 18px; height: 18px; }
.fx-bottom-nav .center { position: relative; }
.fx-bottom-nav .center .badge {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--fx-brand); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 12px; margin-top: -12px;
}

/* Light-theme toast */
.fx-toast {
  position: fixed; top: 60px; left: 50%; transform: translateX(-50%);
  background: var(--fx-brand); color: #fff;
  padding: 10px 16px; border-radius: 6px;
  font-size: 13px; z-index: 200;
  opacity: 0; transition: opacity .2s; pointer-events: none;
  max-width: 90%;
}
.fx-toast.show { opacity: 1; }
.fx-toast.err  { background: var(--fx-down); }
.fx-toast.ok   { background: var(--fx-up); }

/**
 * Light-theme variable override for legacy dark classes.
 * Apply `body.fx-body` (instead of `body.trading-body`) and any existing
 * `.t-*` styles will auto-render in light mode.
 */
.fx-body {
  --t-bg:       #ffffff;
  --t-bg-2:     #f6f7f9;
  --t-bg-3:     #f1f3f6;
  --t-bg-card:  #ffffff;
  --t-border:   #eef0f4;
  --t-text:     #1f2329;
  --t-text-2:   #5b6068;
  --t-text-3:   #9ba0a8;
  --t-up:       #16c784;
  --t-up-bg:    rgba(22,199,132,0.10);
  --t-down:     #ea3943;
  --t-down-bg:  rgba(234,57,67,0.10);
  --t-accent:   #1f2329;
  --t-accent-2: #ffc107;
  --t-accent-bg: rgba(255,193,7,0.18);
}
.fx-body.trading-body { background: var(--fx-bg); color: var(--fx-text); }
.fx-body .t-price-bar,
.fx-body .t-section-tabs,
.fx-body .t-panel,
.fx-body .t-tf,
.fx-body .t-input-row,
.fx-body .t-chart-wrap { background: var(--fx-bg); color: var(--fx-text); border-color: var(--fx-border); }
.fx-body .t-topbar { background: var(--fx-bg); border-bottom: 1px solid var(--fx-border); color: var(--fx-text); }
.fx-body .t-topbar .t-back,
.fx-body .t-topbar .t-topbar-action { color: var(--fx-text); }
.fx-body .t-pair-button { background: var(--fx-bg-soft); color: var(--fx-text); }
.fx-body .t-pair-icon   { background: var(--fx-brand-2); color: #1f2329; }
.fx-body .t-pair-name   { color: var(--fx-text); }
.fx-body .t-pair-tag    { background: rgba(255,193,7,0.18); color: #946a00; }
.fx-body .t-section-tabs button { color: var(--fx-text-3); }
.fx-body .t-section-tabs button.active { color: var(--fx-text); }
.fx-body .t-input-row input { color: var(--fx-text); }
.fx-body .t-input-row input::placeholder { color: var(--fx-text-3); }
.fx-body .t-percent-grid button { background: var(--fx-bg-soft); color: var(--fx-text); }
.fx-body .t-dur-grid button { background: var(--fx-bg-soft); color: var(--fx-text); border-color: var(--fx-border); }
.fx-body .t-tabs button { color: var(--fx-text-3); }
.fx-body .t-tabs button.active { color: var(--fx-text); background: var(--fx-bg-soft); }
.fx-body .t-side-toggle button { background: var(--fx-bg-soft); color: var(--fx-text); }
.fx-body .t-side-toggle button.long.active  { background: var(--fx-up);   color: #fff; }
.fx-body .t-side-toggle button.short.active { background: var(--fx-down); color: #fff; }
.fx-body .t-list-empty { color: var(--fx-text-3); }
.fx-body .t-position, .fx-body .t-trade-card, .fx-body .t-stats-card { background: var(--fx-bg-soft); border-color: var(--fx-border); color: var(--fx-text); }
.fx-body .t-stats-card .l { color: var(--fx-text-3); }
.fx-body .t-stats-card .v { color: var(--fx-text); }
.fx-body .t-position .info-grid .l { color: var(--fx-text-3); }
.fx-body .t-position .info-grid .v { color: var(--fx-text); }
.fx-body .t-position .actions button { background: var(--fx-bg); color: var(--fx-text); border: 1px solid var(--fx-border); }
.fx-body .t-position .actions button.danger { background: var(--fx-down); color: #fff; border-color: var(--fx-down); }
.fx-body .t-trade-card .meta { color: var(--fx-text-3); }
.fx-body .t-chart-loading { background: var(--fx-bg-soft); color: var(--fx-text-3); }
.fx-body .t-ma-legend { color: var(--fx-text-2); background: rgba(255,255,255,0.85); }
.fx-body .t-feed .row { border-bottom: 1px solid var(--fx-border); color: var(--fx-text); }
.fx-body .t-feed .ts, .fx-body .t-feed .who { color: var(--fx-text-3); }
.fx-body .ws-status { color: var(--fx-text-3); }

/* ----- MT4 (.mt4-*) light-theme overrides -----
   Replace iconic-dark MT4 look with our unified light theme. */
/* Pro/MT4: platform tabs become a flex child of mt4-app */
.fx-body.fx-mt4-page .mt4-app {
  background: var(--fx-bg);
  color: var(--fx-text);
}
.fx-body.fx-mt4-page .mt4-app > .fx-platform-tabs {
  position: relative; top: auto;
  flex: 0 0 auto;                 /* don't grow/shrink in flex column */
  border-bottom: 1px solid var(--fx-border);
}
/* Non-MT4 pages: platform tabs stick to viewport top when scrolling */
.fx-body:not(.fx-mt4-page) .fx-platform-tabs {
  position: sticky; top: 0; z-index: 80;
  background: var(--fx-bg);
}
.fx-body .mt4-top   { background: var(--fx-bg); border-bottom-color: var(--fx-border); }
.fx-body .mt4-ic-btn{ color: var(--fx-text); }
.fx-body .mt4-ic-btn.active { color: var(--fx-up); }
.fx-body .mt4-symbol{ background: var(--fx-bg-soft); color: var(--fx-text); }
.fx-body .mt4-tf-btn{ background: var(--fx-bg-soft); color: var(--fx-text); }
.fx-body .mt4-strip { background: var(--fx-bg); border-bottom-color: var(--fx-border); }
/* MT4 mobile trade strip: SELL is RED, BUY is BLUE — each side keeps
   its identity at all times so the trader instantly sees direction.
   tick-up / tick-down / dimmed only adjust *saturation* of that side's
   own colour: the side whose price just moved pops, the opposite side
   stays at its base shade. Colours never swap. */
.fx-body #sellBtn.mt4-side-btn { background: #d32f2f; color: #ffffff; }
.fx-body #sellBtn.mt4-side-btn.tick-down { background: #ef4444; }
.fx-body #sellBtn.mt4-side-btn.dimmed    { background: #ef9a9a; }
.fx-body #buyBtn.mt4-side-btn  { background: #1976d2; color: #ffffff; }
.fx-body #buyBtn.mt4-side-btn.tick-up    { background: #2196f3; }
.fx-body #buyBtn.mt4-side-btn.dimmed     { background: #90caf9; }
.fx-body .mt4-side-btn .lbl      { opacity: 0.9; }
/* 3-part MT4 price hierarchy: small head — BIG middle pair — small tail */
.fx-body .mt4-side-btn .px       { font-family: 'Roboto Mono', monospace; display:inline-flex; align-items:baseline; }
.fx-body .mt4-side-btn .px .main { font-size: 13px; font-weight: 600; opacity: 0.92; }
.fx-body .mt4-side-btn .px .big  { font-size: 22px; font-weight: 700; line-height: 1; margin: 0 1px; }
.fx-body .mt4-side-btn .px .tiny { font-size: 13px; font-weight: 600; opacity: 0.92; }
.fx-body .mt4-lot-picker { background: var(--fx-bg); border-color: var(--fx-border-2); }
.fx-body .mt4-lot-arrow,
.fx-body .mt4-lot-val    { color: var(--fx-text); }
.fx-body .mt4-spread-badge { color: var(--fx-text-2); }
.fx-body .mt4-body { background: var(--fx-bg-soft); }
.fx-body .mt4-nav  { background: var(--fx-bg); border-top-color: var(--fx-border); }
.fx-body .mt4-nav-tab { color: var(--fx-text-3); }
.fx-body .mt4-nav-tab.active { color: var(--fx-text); }
.fx-body .mt4-quote { background: var(--fx-bg); border-bottom-color: var(--fx-border); }
.fx-body .mt4-quote:active { background: rgba(22,199,132,0.05); }
.fx-body .mt4-q-change.up   { color: #1976d2; }
.fx-body .mt4-q-change.down { color: var(--fx-down); }
.fx-body .mt4-q-pair { color: var(--fx-text); }
.fx-body .mt4-q-time { color: var(--fx-text-3); }
.fx-body .mt4-q-extreme { color: var(--fx-text-3); }
.fx-body .mt4-q-extreme .v { color: var(--fx-text-2); }
.fx-body .mt4-px.up   { color: #1976d2; }
.fx-body .mt4-px.down { color: var(--fx-down); }
.fx-body .mt4-px.flat { color: var(--fx-text); }
.fx-body .mt4-chart-overlay { color: var(--fx-text-3); }
.fx-body .mt4-radial-overlay { background: transparent; }
/* The MT4 radial is intentionally always solid-blue with white labels,
   regardless of page theme. */
.fx-body .mt4-radial-action,
.fx-body .mt4-radial-tf       { color: #ffffff; }
.fx-body .mt4-radial-tf.active { color: #1976d2; }
.fx-body .mt4-acct { background: var(--fx-bg); color: var(--fx-text); }
.fx-body .mt4-acct-row { color: var(--fx-text); border-bottom-color: var(--fx-border); }
.fx-body .mt4-acct-row .lbl { color: var(--fx-text-3); }
/* MT4 light theme uses BLUE (#0974d4) for "up" / profitable amounts and
   RED (#ea3943) for "down". Override the dark-theme teal/orange. */
.fx-body .mt4-acct-row .val.up   { color: #0974d4; }
.fx-body .mt4-acct-row .val.down { color: #ea3943; }
.fx-body .mt4-acct-row .dot      { border-bottom-color: #c2c8d3; }
.fx-body .mt4-pos-row { background: var(--fx-bg); border-bottom-color: var(--fx-border); color: var(--fx-text); }
.fx-body .mt4-pos-row .meta { color: var(--fx-text-3); }
.fx-body .mt4-hist-tabs { background: var(--fx-bg); border-bottom-color: var(--fx-border); }
.fx-body .mt4-hist-tabs span { color: var(--fx-text-3); }
.fx-body .mt4-hist-tabs span.active { color: var(--fx-text); }
.fx-body .mt4-hist-row { background: var(--fx-bg); border-bottom-color: var(--fx-border); color: var(--fx-text); }
.fx-body .mt4-hist-row .meta { color: var(--fx-text-3); }
/* Modal stays dark on all themes (modal bg is hardcoded #161a1e),
   so search rows keep the dark-theme text colours regardless of page theme. */
.fx-body .mt4-search-row     { background: transparent; border-bottom-color: rgba(255,255,255,0.06); color: #ffffff; }
.fx-body .mt4-search-row .sym{ color: #ffffff; }
.fx-body .mt4-search-row .px { color: #c8cdd6; }
.fx-body .mt4-confirm-row { color: var(--fx-text); }
.fx-body .mt4-confirm-label { color: var(--fx-text-3); }
.fx-body .mt4-confirm-val { color: var(--fx-text); font-family: 'Roboto Mono', monospace; font-weight: 600; }
.fx-body .mt4-btn-cancel { background: var(--fx-bg-soft); color: var(--fx-text); }
.fx-body .mt4-btn-submit.buy  { background: #1976d2; color: #fff; }
.fx-body .mt4-btn-submit.sell { background: #ea3943; color: #fff; }

/* ─── MT4 New Order sheet (light) ─────────────────────────────── */
.fx-body .mt4-modal-overlay { background: rgba(0, 0, 0, 0.35); }
.fx-body .mt4-modal {
  background: #ffffff; color: #1f2329;
  border: 0;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.22);
  border-radius: 10px;
}
.fx-body .mt4-modal-header { border-bottom-color: #eef0f4; }
.fx-body .mt4-modal-header input { color: #1f2329; }
.fx-body .mt4-modal-header input::placeholder { color: #9aa3b2; }
.fx-body .mt4-search-row { border-bottom-color: #eef0f4; }
.fx-body .mt4-search-row:hover  { background: rgba(33, 150, 243, 0.04); }
.fx-body .mt4-search-row:active { background: rgba(33, 150, 243, 0.10); }
.fx-body .mt4-search-row .sym  { color: #1f2329; }
.fx-body .mt4-search-row .px   { color: #5b6068; }

/* MT4-style order sheet contents */
.fx-body .mt4-os-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; border-bottom: 1px solid #eef0f4;
}
.fx-body .mt4-os-head .ttl { font-size: 14px; font-weight: 700; color: #1f2329; }
.fx-body .mt4-os-head .x   { background: transparent; border: 0; font-size: 22px; line-height: 1; color: #5b6068; cursor: pointer; padding: 2px 6px; }
.fx-body .mt4-os-sym {
  padding: 14px 16px 6px;
  font-size: 22px; font-weight: 800; color: #1f2329; letter-spacing: 0.3px;
}
.fx-body .mt4-os-sub { padding: 0 16px 12px; font-size: 12px; color: #5b6068; }

.fx-body .mt4-os-row {
  display: grid; grid-template-columns: 110px 1fr;
  align-items: center; gap: 10px;
  padding: 10px 16px;
  border-top: 1px solid #f3f5f8;
}
.fx-body .mt4-os-row .k { font-size: 13px; color: #5b6068; font-weight: 600; }
.fx-body .mt4-os-row .v { font-size: 14px; color: #1f2329; font-weight: 600; font-family: 'Roboto Mono', monospace; text-align: right; }
.fx-body .mt4-os-row .v.muted { color: #9aa3b2; }

/* Stepper input — used for Volume / SL / TP */
.fx-body .mt4-step {
  display: grid; grid-template-columns: 36px 1fr 36px;
  align-items: center;
  border: 1px solid #d9dde5; border-radius: 6px;
  background: #ffffff; overflow: hidden;
}
.fx-body .mt4-step input {
  border: 0; outline: 0; background: transparent;
  text-align: center; font-size: 16px; font-weight: 700;
  color: #1f2329; padding: 8px 4px; min-width: 0;
  font-family: 'Roboto Mono', monospace;
}
.fx-body .mt4-step button {
  background: #f3f5f8; border: 0; padding: 0;
  font-size: 18px; font-weight: 700; color: #1f2329;
  height: 38px; cursor: pointer;
  transition: background 0.1s;
}
.fx-body .mt4-step button:hover  { background: #e8ebf0; }
.fx-body .mt4-step button:active { background: #d9dde5; }
.fx-body .mt4-step.compact button { height: 32px; }
.fx-body .mt4-step.compact input  { font-size: 13px; padding: 6px 4px; }

.fx-body .mt4-os-select {
  border: 1px solid #d9dde5; border-radius: 6px;
  background: #ffffff; color: #1f2329;
  padding: 7px 10px; font-size: 14px; font-weight: 700;
  width: 100%; text-align: right;
  font-family: inherit;
}

/* Live bid/ask price tape inside the order sheet */
.fx-body .mt4-os-tape {
  display: grid; grid-template-columns: 1fr 60px 1fr;
  gap: 6px; padding: 12px 12px 14px;
  background: #f6f7f9; border-top: 1px solid #eef0f4;
}
.fx-body .mt4-os-tape .px {
  display: flex; flex-direction: column; align-items: center;
  background: #ffffff; border-radius: 8px;
  padding: 8px 0;
  border: 1px solid #d9dde5;
}
.fx-body .mt4-os-tape .px .lbl  { font-size: 10px; font-weight: 700; color: #5b6068; letter-spacing: 0.5px; }
.fx-body .mt4-os-tape .px .val  { font-size: 17px; font-weight: 800; font-family: 'Roboto Mono', monospace; margin-top: 2px; }
.fx-body .mt4-os-tape .px.sell .val { color: #ea3943; }
.fx-body .mt4-os-tape .px.buy  .val { color: #1976d2; }
.fx-body .mt4-os-tape .gap {
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; color: #9aa3b2; font-family: 'Roboto Mono', monospace;
}

/* Bottom CTA bar — TWO big MT4-style buttons */
.fx-body .mt4-os-cta {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 8px; padding: 12px 14px 16px;
}
.fx-body .mt4-os-cta button {
  border: 0; border-radius: 8px;
  padding: 14px 8px;
  color: #fff; font-size: 15px; font-weight: 800;
  cursor: pointer; transition: filter 0.1s;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.fx-body .mt4-os-cta button .lbl { font-size: 11px; font-weight: 700; opacity: 0.95; letter-spacing: 0.5px; }
.fx-body .mt4-os-cta button .px  { font-family: 'Roboto Mono', monospace; }
.fx-body .mt4-os-cta button.sell { background: #ea3943; }
.fx-body .mt4-os-cta button.buy  { background: #1976d2; }
.fx-body .mt4-os-cta button:hover  { filter: brightness(1.05); }
.fx-body .mt4-os-cta button:active { filter: brightness(0.95); }
.fx-body .mt4-os-cta button:disabled { opacity: 0.55; cursor: default; }
.fx-body .mt4-fab { background: var(--fx-brand); color: #fff; }
.fx-body #tab-charts,
.fx-body #tab-quotes,
.fx-body #tab-trade,
.fx-body #tab-history,
.fx-body #tab-messages { background: var(--fx-bg) !important; }
.fx-body .mt4-pane { background: var(--fx-bg) !important; }

/* Generic light buttons */
.fx-btn-primary { background: var(--fx-brand); color: #fff; border: 0; padding: 12px; border-radius: 6px; font-size: 14px; font-weight: 600; cursor: pointer; }
.fx-btn-buy     { background: var(--fx-up);    color: #fff; border: 0; padding: 12px; border-radius: 6px; font-size: 14px; font-weight: 600; cursor: pointer; }
.fx-btn-sell    { background: var(--fx-down);  color: #fff; border: 0; padding: 12px; border-radius: 6px; font-size: 14px; font-weight: 600; cursor: pointer; }
.fx-btn-ghost   { background: var(--fx-bg-soft); color: var(--fx-text); border: 0; padding: 10px; border-radius: 6px; font-size: 13px; cursor: pointer; }

/* Common pair pill */
.fx-pair-pill { display: inline-flex; align-items: center; gap: 4px; padding: 4px 8px; background: var(--fx-bg-soft); border-radius: 4px; font-size: 12px; font-weight: 600; color: var(--fx-text); }

/* Shared card */
.fx-card { background: var(--fx-bg); border: 1px solid var(--fx-border); border-radius: 8px; padding: 12px; }

/* ═══════════════════════════════════════════════════════════════════════════
   LEGACY DARK THEME (Binance-inspired)  —  kept for unmigrated pages
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
  --t-bg: #0b0e11;
  --t-bg-2: #161a1e;
  --t-bg-3: #1e2329;
  --t-bg-card: #181c22;
  --t-border: #2a2e35;
  --t-text: #eaecef;
  --t-text-2: #b7bdc6;
  --t-text-3: #707a8a;
  --t-up: #0ecb81;
  --t-up-bg: rgba(14, 203, 129, 0.12);
  --t-down: #f6465d;
  --t-down-bg: rgba(246, 70, 93, 0.12);
  --t-accent: #f0b90b;
  --t-accent-2: #fcd535;
  --t-accent-bg: rgba(240, 185, 11, 0.12);
}

.trading-body {
  background: var(--t-bg);
  color: var(--t-text);
  font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', system-ui, sans-serif;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.trading-body * { box-sizing: border-box; }

/* ============= Top Bar ============= */
.t-topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px;
  background: var(--t-bg);
  border-bottom: 1px solid var(--t-border);
}
.t-back { background: transparent; border: 0; color: var(--t-text); font-size: 18px; cursor: pointer; padding: 6px; }
.t-pair-button {
  flex: 1; display: flex; align-items: center; gap: 8px;
  background: var(--t-bg-2); border: 1px solid var(--t-border);
  padding: 6px 10px; border-radius: 8px; cursor: pointer;
}
.t-pair-icon { width: 22px; height: 22px; border-radius: 50%; background: var(--t-accent); color: #000; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 800; }
.t-pair-name { font-weight: 700; font-size: 14px; color: var(--t-text); }
.t-pair-tag { font-size: 10px; padding: 2px 6px; border-radius: 4px; background: var(--t-accent-bg); color: var(--t-accent); font-weight: 700; margin-left: 4px; }
.t-topbar-action { background: transparent; border: 0; color: var(--t-text-2); cursor: pointer; padding: 6px; font-size: 16px; }

/* ============= Live price bar (under topbar) ============= */
.t-price-bar { padding: 12px 14px; background: var(--t-bg); border-bottom: 1px solid var(--t-border); }
.t-price-bar .price { font-size: 28px; font-weight: 800; font-family: 'SF Mono', Menlo, monospace; line-height: 1.1; }
.t-price-bar .change { font-size: 13px; font-weight: 600; margin-top: 2px; }
.t-price-bar .stats { display: flex; gap: 14px; margin-top: 10px; flex-wrap: wrap; }
.t-price-bar .stat { font-size: 11px; }
.t-price-bar .stat .label { color: var(--t-text-3); display: block; }
.t-price-bar .stat .val { color: var(--t-text); font-weight: 600; }
.up { color: var(--t-up); }
.down { color: var(--t-down); }
.bg-up { background: var(--t-up-bg) !important; color: var(--t-up) !important; }
.bg-down { background: var(--t-down-bg) !important; color: var(--t-down) !important; }

/* ============= Timeframe selector ============= */
.t-tf {
  display: flex; gap: 2px; padding: 8px 14px;
  background: var(--t-bg);
  border-bottom: 1px solid var(--t-border);
  overflow-x: auto;
}
.t-tf::-webkit-scrollbar { display: none; }
.t-tf button {
  background: transparent; border: 0; color: var(--t-text-3);
  font-size: 12px; font-weight: 600; padding: 6px 10px;
  border-radius: 4px; cursor: pointer; white-space: nowrap;
}
.t-tf button.active { background: var(--t-bg-3); color: var(--t-accent); }

/* ============= Chart container ============= */
.t-chart-wrap { background: var(--t-bg); height: 320px; position: relative; }
.t-chart-wrap canvas { display: block; }
.t-chart-loading {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  color: var(--t-text-3); font-size: 13px;
}

/* ============= Order book ============= */
.t-orderbook { padding: 8px 12px; background: var(--t-bg); }
.t-orderbook .ob-header { display: grid; grid-template-columns: 1fr 1fr 1fr; font-size: 10px; color: var(--t-text-3); margin-bottom: 4px; text-transform: uppercase; }
.t-orderbook .ob-header > div:last-child { text-align: right; }
.t-orderbook .ob-row {
  display: grid; grid-template-columns: 1fr 1fr 1fr;
  font-size: 11px; font-family: 'SF Mono', monospace;
  padding: 2px 0; position: relative;
}
.t-orderbook .ob-row .amt, .t-orderbook .ob-row .total { text-align: right; color: var(--t-text-2); }
.t-orderbook .ob-row .price-ask { color: var(--t-down); }
.t-orderbook .ob-row .price-bid { color: var(--t-up); }
.t-orderbook .ob-row .depth-bar {
  position: absolute; top: 0; bottom: 0; right: 0;
  background: var(--t-up-bg);
  z-index: -1; transition: width 0.3s;
}
.t-orderbook .ob-row.ask .depth-bar { background: var(--t-down-bg); }
.t-orderbook .ob-divider {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 0; border-top: 1px solid var(--t-border); border-bottom: 1px solid var(--t-border);
  margin: 6px 0;
}
.t-orderbook .ob-divider .px { font-size: 16px; font-weight: 800; font-family: 'SF Mono', monospace; }

/* ============= Action panel (buy/sell) ============= */
.t-panel { padding: 14px; background: var(--t-bg); border-top: 1px solid var(--t-border); }
.t-tabs { display: flex; background: var(--t-bg-2); border-radius: 8px; padding: 3px; margin-bottom: 12px; }
.t-tabs button { flex: 1; background: transparent; border: 0; color: var(--t-text-3); padding: 8px 0; font-size: 13px; font-weight: 600; cursor: pointer; border-radius: 6px; }
.t-tabs button.active { background: var(--t-bg-3); color: var(--t-text); }
.t-tabs.buy-sell button.active.buy { background: var(--t-up); color: #000; }
.t-tabs.buy-sell button.active.sell { background: var(--t-down); color: #fff; }

.t-input-row {
  display: flex; align-items: center; gap: 8px;
  background: var(--t-bg-2); border: 1px solid var(--t-border);
  border-radius: 8px; padding: 10px 12px; margin-bottom: 8px;
}
.t-input-row .label { font-size: 12px; color: var(--t-text-3); min-width: 60px; }
.t-input-row input {
  flex: 1; background: transparent; border: 0; outline: 0;
  color: var(--t-text); font-size: 15px; font-weight: 600;
  text-align: right; font-family: 'SF Mono', monospace;
}
.t-input-row input::-webkit-outer-spin-button,
.t-input-row input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.t-input-row input[type=number] { -moz-appearance: textfield; }
.t-input-row .suffix { color: var(--t-text-3); font-size: 11px; }
.t-input-row .step { background: var(--t-bg-3); border: 0; color: var(--t-text); width: 24px; height: 24px; border-radius: 4px; font-size: 14px; cursor: pointer; }

.t-slider-row { padding: 8px 4px 16px; }
.t-percent-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 12px; }
.t-percent-grid button { background: var(--t-bg-2); border: 1px solid var(--t-border); color: var(--t-text-2); padding: 6px 0; border-radius: 6px; font-size: 11px; cursor: pointer; }
.t-percent-grid button:hover { background: var(--t-bg-3); }

.t-action-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.t-btn-buy, .t-btn-sell {
  border: 0; padding: 14px; border-radius: 8px;
  font-size: 14px; font-weight: 700; cursor: pointer;
  transition: transform 0.05s;
}
.t-btn-buy { background: var(--t-up); color: #000; }
.t-btn-sell { background: var(--t-down); color: #fff; }
.t-btn-buy:active, .t-btn-sell:active { transform: scale(0.98); }
.t-btn-full {
  width: 100%; border: 0; padding: 14px;
  border-radius: 8px; font-size: 14px; font-weight: 700; cursor: pointer;
  background: var(--t-accent); color: #000;
}

/* ============= Position / order list ============= */
.t-section-tabs {
  display: flex; gap: 16px; padding: 12px 14px 0;
  border-bottom: 1px solid var(--t-border);
}
.t-section-tabs button {
  background: transparent; border: 0; color: var(--t-text-3);
  font-size: 13px; font-weight: 600; padding: 6px 0; cursor: pointer;
  position: relative;
}
.t-section-tabs button.active { color: var(--t-text); }
.t-section-tabs button.active::after {
  content: ''; position: absolute; bottom: -1px; left: 0; right: 0;
  height: 2px; background: var(--t-accent);
}
.t-section-tabs .count {
  display: inline-block; min-width: 16px; padding: 0 5px; margin-left: 4px;
  background: var(--t-accent); color: #000;
  border-radius: 8px; font-size: 10px; line-height: 16px; font-weight: 700;
}

.t-list { padding: 8px 14px; }
.t-list-empty { text-align: center; padding: 30px 0; color: var(--t-text-3); font-size: 12px; }
.t-trade-card {
  background: var(--t-bg-2); border: 1px solid var(--t-border);
  border-radius: 8px; padding: 10px 12px; margin-bottom: 8px;
}
.t-trade-card .row { display: flex; justify-content: space-between; align-items: center; }
.t-trade-card .pair { font-weight: 700; color: var(--t-text); }
.t-trade-card .side { font-size: 10px; padding: 2px 6px; border-radius: 4px; font-weight: 700; margin-left: 6px; }
.t-trade-card .side.long { background: var(--t-up-bg); color: var(--t-up); }
.t-trade-card .side.short { background: var(--t-down-bg); color: var(--t-down); }
.t-trade-card .meta { font-size: 11px; color: var(--t-text-3); margin-top: 4px; font-family: 'SF Mono', monospace; }
.t-trade-card .pnl { font-weight: 700; font-family: 'SF Mono', monospace; }

/* ============= Pair selector modal (bottom sheet) ============= */
.t-sheet-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.6); z-index: 100;
  display: none; align-items: flex-end; justify-content: center;
}
.t-sheet-overlay.open { display: flex; }
.t-sheet {
  width: 100%; max-width: var(--trading-shell-max); max-height: 80vh;
  background: var(--t-bg-2); border-radius: 16px 16px 0 0;
  display: flex; flex-direction: column;
  animation: sheet-up 0.25s ease;
}
@keyframes sheet-up { from { transform: translateY(100%); } to { transform: translateY(0); } }
.t-sheet-header { padding: 14px 16px 10px; display: flex; justify-content: space-between; align-items: center; }
.t-sheet-header .title { font-weight: 700; font-size: 15px; }
.t-sheet-header .close-x {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--t-bg-3); border: 0; color: var(--t-text-2);
  font-size: 16px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: 0.15s;
}
.t-sheet-header .close-x:hover { background: var(--t-border); color: var(--t-text); }

.t-sheet-search { padding: 4px 16px 12px; position: relative; }
.t-sheet-search::before {
  content: '\f002'; /* fa-magnifying-glass */
  font-family: 'Font Awesome 6 Free'; font-weight: 900;
  position: absolute; left: 28px; top: 50%; transform: translateY(-30%);
  font-size: 12px; color: var(--t-text-3); pointer-events: none;
}
.t-sheet-search input {
  width: 100%; padding: 10px 12px 10px 34px;
  background: var(--t-bg-3); border: 1px solid transparent;
  border-radius: 10px; color: var(--t-text); outline: 0; font-size: 13px;
  transition: 0.15s;
}
.t-sheet-search input:focus { border-color: var(--t-accent-2, var(--t-accent)); background: var(--t-bg); }

.t-sheet-cats {
  display: flex; gap: 6px;
  padding: 4px 16px 10px;
  overflow-x: auto;
  scrollbar-width: none;
}
.t-sheet-cats::-webkit-scrollbar { display: none; }
.t-sheet-cats button {
  flex-shrink: 0;
  background: var(--t-bg-3); border: 1px solid transparent;
  color: var(--t-text-2);
  font-size: 12px; font-weight: 600;
  padding: 6px 12px; border-radius: 999px;
  cursor: pointer; white-space: nowrap;
  transition: 0.15s;
}
.t-sheet-cats button:hover { background: var(--t-border); color: var(--t-text); }
.t-sheet-cats button.active {
  background: var(--t-accent-2, var(--t-accent));
  color: #1f2329;
  border-color: var(--t-accent-2, var(--t-accent));
}

.t-sheet-sort {
  display: flex; gap: 6px;
  padding: 0 16px 10px;
  overflow-x: auto;
  scrollbar-width: none;
  border-bottom: 1px solid var(--t-border);
}
.t-sheet-sort::-webkit-scrollbar { display: none; }
.t-sheet-sort .sort-btn {
  flex-shrink: 0; background: transparent; border: 1px solid var(--t-border);
  color: var(--t-text-2); font-size: 11px; font-weight: 600;
  padding: 5px 11px; border-radius: 999px;
  cursor: pointer; white-space: nowrap;
  transition: 0.15s;
}
.t-sheet-sort .sort-btn:hover { background: var(--t-bg-3); color: var(--t-text); }
.t-sheet-sort .sort-btn.active {
  background: var(--t-text);
  color: var(--t-bg);
  border-color: var(--t-text);
}

.t-sheet-list { overflow-y: auto; padding: 6px 8px 14px; }
.t-pair-row {
  display: grid; grid-template-columns: 28px 1fr auto auto;
  gap: 10px; align-items: center; padding: 10px 8px;
  border-radius: 6px; cursor: pointer;
}
.t-pair-row:hover { background: var(--t-bg-3); }
.t-pair-row.active { background: var(--t-accent-bg); }
.t-pair-row .ic { width: 24px; height: 24px; border-radius: 50%; background: var(--t-accent); color: #000; font-weight: 800; font-size: 10px; display: flex; align-items: center; justify-content: center; }
.t-pair-row .nm { font-size: 13px; font-weight: 600; color: var(--t-text); }
.t-pair-row .sub { font-size: 10px; color: var(--t-text-3); }
.t-pair-row .px { font-size: 13px; font-weight: 600; color: var(--t-text); font-family: 'SF Mono', monospace; text-align: right; }
.t-pair-row .ch { font-size: 11px; font-weight: 600; text-align: right; min-width: 56px; }

/* ============= Leverage modal ============= */
.t-lev-mods { display: flex; gap: 8px; margin: 14px 0; }
.t-lev-mods button { flex: 1; padding: 8px 0; background: var(--t-bg-3); border: 0; color: var(--t-text-2); font-size: 12px; border-radius: 6px; cursor: pointer; }
.t-lev-mods button.active { background: var(--t-accent); color: #000; font-weight: 700; }

/* ============= Toast (override for trading theme) ============= */
.toast { background: var(--t-bg-3) !important; color: var(--t-text) !important; }
.toast.success { background: var(--t-up-bg) !important; color: var(--t-up) !important; border: 1px solid var(--t-up); }
.toast.error { background: var(--t-down-bg) !important; color: var(--t-down) !important; border: 1px solid var(--t-down); }

/* ============= Bottom Nav override for dark theme ============= */
.trading-body .bottom-nav { background: var(--t-bg-2) !important; border-top: 1px solid var(--t-border) !important; }
.trading-body .bottom-nav .nav-item { color: var(--t-text-3) !important; }
.trading-body .bottom-nav .nav-item.active { color: var(--t-accent) !important; }
.trading-body .bottom-nav .nav-center .nav-center-btn { background: linear-gradient(135deg, var(--t-accent), var(--t-accent-2)) !important; box-shadow: 0 4px 16px rgba(240, 185, 11, 0.5) !important; }
.trading-body .bottom-nav .nav-item.active span { color: var(--t-accent) !important; }
.trading-body .status-bar { background: var(--t-bg) !important; color: var(--t-text-2) !important; }

/* ============= Live update flash ============= */
@keyframes flash-up { 0% { background: var(--t-up-bg); } 100% { background: transparent; } }
@keyframes flash-down { 0% { background: var(--t-down-bg); } 100% { background: transparent; } }
.flash-up { animation: flash-up 0.5s ease-out; }
.flash-down { animation: flash-down 0.5s ease-out; }

/* ============= Quick trade specific ============= */
.t-spot-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.t-spot-buttons .btn { padding: 16px; border: 0; border-radius: 10px; font-weight: 800; font-size: 16px; cursor: pointer; }
.t-spot-buttons .btn-up { background: linear-gradient(135deg, var(--t-up), #04a96b); color: #fff; }
.t-spot-buttons .btn-down { background: linear-gradient(135deg, var(--t-down), #d83a4d); color: #fff; }

.t-dur-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin-bottom: 12px; }
.t-dur-grid button {
  background: var(--t-bg-2); border: 1px solid var(--t-border);
  color: var(--t-text-2); padding: 8px 0; border-radius: 6px;
  font-size: 12px; cursor: pointer; text-align: center;
}
.t-dur-grid button.active { background: var(--t-accent-bg); color: var(--t-accent); border-color: var(--t-accent); }
.t-dur-grid button .pay { display: block; font-size: 9px; opacity: 0.85; margin-top: 1px; }

/* ============= Hub specific ============= */
.t-hub-card {
  background: linear-gradient(135deg, var(--t-bg-2), var(--t-bg-3));
  border: 1px solid var(--t-border); border-radius: 12px;
  padding: 16px; cursor: pointer; position: relative; overflow: hidden;
}
.t-hub-card .icon { font-size: 24px; margin-bottom: 8px; }
.t-hub-card .title { font-size: 15px; font-weight: 700; color: var(--t-text); }
.t-hub-card .desc { font-size: 11px; color: var(--t-text-3); margin-top: 4px; line-height: 1.4; }
.t-hub-card .badge { position: absolute; top: 10px; right: 10px; font-size: 9px; font-weight: 700; padding: 2px 6px; background: var(--t-accent); color: #000; border-radius: 4px; }

/* ============= Position card (Futures) ============= */
.t-position {
  background: var(--t-bg-2); border: 1px solid var(--t-border);
  border-radius: 10px; padding: 12px; margin-bottom: 8px;
}
.t-position .head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.t-position .pnl-big { font-size: 18px; font-weight: 800; font-family: 'SF Mono', monospace; }
.t-position .pnl-sub { font-size: 11px; color: var(--t-text-3); }
.t-position .info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; font-size: 11px; }
.t-position .info-grid .l { color: var(--t-text-3); }
.t-position .info-grid .v { color: var(--t-text); font-family: 'SF Mono', monospace; }
.t-position .actions { display: flex; gap: 6px; margin-top: 10px; }
.t-position .actions button { flex: 1; padding: 7px 0; background: var(--t-bg-3); border: 1px solid var(--t-border); color: var(--t-text); border-radius: 6px; font-size: 11px; cursor: pointer; }
.t-position .actions button.danger { background: var(--t-down-bg); color: var(--t-down); border-color: transparent; }

/* ============= Live trades feed ============= */
.t-feed { background: var(--t-bg-2); border: 1px solid var(--t-border); border-radius: 10px; padding: 10px 12px; }
.t-feed .row { display: grid; grid-template-columns: auto 1fr auto auto; gap: 8px; padding: 6px 0; font-size: 11px; border-bottom: 1px solid rgba(42,46,57,0.4); }
.t-feed .row:last-child { border-bottom: 0; }
.t-feed .row .ts { color: var(--t-text-3); font-family: 'SF Mono', monospace; }
.t-feed .row .who { color: var(--t-text-2); font-weight: 600; }
.t-feed .row .pn { color: var(--t-text); font-weight: 600; font-family: 'SF Mono', monospace; text-align: right; }

/* ============= Order book row hover ============= */
.t-orderbook .ob-row:hover { background: rgba(240,185,11,0.05); cursor: pointer; }

/* ============= MA legend ============= */
.t-ma-legend {
  position: absolute; top: 6px; left: 10px;
  display: flex; gap: 10px; font-size: 10px;
  font-family: 'SF Mono', monospace; z-index: 10;
  pointer-events: none;
}
.t-ma-legend span { color: var(--t-text-2); }
.t-ma-legend .m7  { color: #f0b90b; }
.t-ma-legend .m25 { color: #a855f7; }
.t-ma-legend .m99 { color: #3b82f6; }

/* ============= Stats grid ============= */
.t-stats-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; padding: 0 14px 14px; }
.t-stats-card { background: var(--t-bg-2); border: 1px solid var(--t-border); border-radius: 8px; padding: 10px 12px; }
.t-stats-card .l { font-size: 10px; color: var(--t-text-3); text-transform: uppercase; letter-spacing: 0.3px; }
.t-stats-card .v { font-size: 16px; font-weight: 800; color: var(--t-text); font-family: 'SF Mono', monospace; margin-top: 2px; }
.t-stats-card .vs { font-size: 11px; color: var(--t-text-3); margin-top: 1px; }

/* ============= Reduce-only badge ============= */
.t-badge { display: inline-block; padding: 2px 6px; border-radius: 3px; font-size: 9px; font-weight: 700; }
.t-badge.gold { background: var(--t-accent-bg); color: var(--t-accent); }
.t-badge.success { background: var(--t-up-bg); color: var(--t-up); }
.t-badge.danger { background: var(--t-down-bg); color: var(--t-down); }

/* ============= Side toggle (LONG/SHORT) ============= */
.t-side-toggle { display: flex; gap: 0; background: var(--t-bg-2); border: 1px solid var(--t-border); border-radius: 8px; padding: 3px; margin-bottom: 10px; }
.t-side-toggle button { flex: 1; background: transparent; border: 0; padding: 8px; color: var(--t-text-3); font-size: 13px; font-weight: 700; border-radius: 6px; cursor: pointer; }
.t-side-toggle button.long.active { background: var(--t-up); color: #000; }
.t-side-toggle button.short.active { background: var(--t-down); color: #fff; }

/* ═══════════════════════════════════════════════════════════════════════
   MT4 / METATRADER 4 STYLES — Pro Trading page
   ═══════════════════════════════════════════════════════════════════════ */
.mt4-app {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: var(--trading-shell-max);
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: #0d1117;
  color: #cfd2d9;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  overflow: hidden;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

/* Top bar (44px) */
.mt4-top {
  height: 44px; flex-shrink: 0;
  display: flex; align-items: center; gap: 6px;
  padding: 0 8px; background: #0d1117;
  border-bottom: 1px solid #1a1f2e;
}
.mt4-ic-btn {
  background: transparent; border: 0; padding: 8px;
  display: flex; align-items: center; justify-content: center;
  color: #cfd2d9; cursor: pointer; border-radius: 4px;
}
.mt4-ic-btn.active { color: #5dade2; }
.mt4-symbol {
  display: flex; align-items: center; gap: 4px;
  padding: 4px 8px; background: #1a1f2e; border-radius: 4px;
  cursor: pointer; color: #cfd2d9; font-size: 13px; font-weight: 700;
}
.mt4-tf-btn {
  background: #1a1f2e; border: 0; padding: 4px 10px;
  border-radius: 4px; font-size: 12px; font-weight: 700; color: #cfd2d9;
  cursor: pointer;
}

/* Trade strip — SELL | LOT | BUY (56px) */
.mt4-strip {
  height: 56px; flex-shrink: 0;
  display: flex; align-items: stretch; gap: 4px;
  padding: 4px 8px; background: #0d1117;
  border-bottom: 1px solid #1a1f2e;
}
.mt4-side-btn {
  flex: 1; border: 0; border-radius: 4px;
  color: #fff; cursor: pointer; padding: 6px 8px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: #1e4976; transition: background 0.15s;
  user-select: none;
}
.mt4-side-btn:disabled { opacity: 0.5; cursor: default; }
.mt4-side-btn.tick-up   { background: #1976d2; }
.mt4-side-btn.tick-down { background: #e53935; }
.mt4-side-btn.dimmed    { background: #1a3a5c; }
.mt4-side-btn .lbl    { font-size: 10px; font-weight: 700; opacity: 0.85; letter-spacing: 0.5px; }
.mt4-side-btn .px     { font-size: 16px; font-weight: 700; font-family: 'Roboto Mono', monospace; }

.mt4-lot-wrap {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px;
}
.mt4-spread-badge {
  font-size: 10px; font-weight: 600; color: #9aa1ad;
  font-family: 'Roboto Mono', monospace; letter-spacing: 0.3px;
  line-height: 1;
}
.mt4-lot-picker {
  display: flex; flex-direction: row; align-items: center; justify-content: center;
  gap: 4px; padding: 0 6px; min-width: 90px;
  background: #0d1117; border: 1px solid #2b2f3a; border-radius: 4px;
}
.mt4-lot-arrow {
  background: transparent; border: 0; padding: 4px; cursor: pointer;
  color: #cfd2d9; display: flex; align-items: center; justify-content: center;
  font-size: 14px;
}
.mt4-lot-val {
  font-size: 15px; font-weight: 700; color: #cfd2d9;
  font-family: 'Roboto Mono', monospace; min-width: 36px; text-align: center;
}

/* Body (flex 1) */
.mt4-body { flex: 1; overflow: hidden; position: relative; }

/* Bottom nav (56px) */
.mt4-nav {
  height: 56px; flex-shrink: 0;
  display: flex; background: #0d1117;
  border-top: 1px solid #1a1f2e;
}
.mt4-nav-tab {
  flex: 1; background: transparent; border: 0; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; color: #5e6673;
}
.mt4-nav-tab.active { color: #5dade2; }
.mt4-nav-tab .ic   { font-size: 18px; line-height: 1; }
.mt4-nav-tab .lbl  { font-size: 10px; }

/* MT4 Quote row — 3-column grid */
.mt4-quote {
  display: grid;
  grid-template-columns: minmax(110px, 1.05fr) 1fr 1fr;
  column-gap: 8px;
  align-items: start;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(70, 80, 95, 0.16);
  background: #000;
  cursor: pointer;
}
.mt4-quote:active { background: rgba(0, 184, 169, 0.08); }
.mt4-q-info { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.mt4-q-change { font-size: 10px; font-weight: 500; letter-spacing: 0.2px; }
.mt4-q-change.up   { color: #3b82f6; }
.mt4-q-change.down { color: #f46036; }
.mt4-q-pair { font-size: 16px; font-weight: 700; color: #e6e8ec; letter-spacing: 0.4px; line-height: 1.15; margin-top: 1px; }
.mt4-q-time { font-size: 10px; color: #5e6673; margin-top: 2px; display: flex; align-items: center; white-space: nowrap; }
.mt4-q-time .sep { margin: 0 5px; opacity: 0.55; font-size: 11px; }
.mt4-q-price-col {
  display: flex; flex-direction: column; align-items: flex-end; gap: 4px; min-width: 0;
}
.mt4-q-extreme { font-size: 10px; color: #5e6673; white-space: nowrap; font-family: 'Roboto Mono', 'Consolas', monospace; }
.mt4-q-extreme .v { color: #7d8694; }

/* 3-part MT4 price split */
.mt4-px {
  font-family: 'Roboto Mono', 'Consolas', monospace;
  line-height: 1; white-space: nowrap; display: inline-block;
}
.mt4-px .main { font-size: 16px; font-weight: 400; opacity: 0.92; }
.mt4-px .big  { font-size: 24px; font-weight: 700; letter-spacing: -0.3px; }
.mt4-px .tiny { font-size: 11px; font-weight: 400; opacity: 0.85; position: relative; top: -10px; margin-left: 1px; }
.mt4-px.up   { color: #3b82f6; }
.mt4-px.down { color: #f46036; }
.mt4-px.flat { color: #cfd2d9; }

/* Charts overlay */
.mt4-chart-overlay {
  position: absolute; top: 10px; left: 12px;
  padding: 5px 10px; background: rgba(15, 19, 26, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px; z-index: 5; pointer-events: none;
  font-size: 12px; line-height: 1;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
}
.mt4-chart-overlay .pair  { color: #fff; font-weight: 700; letter-spacing: 0.3px; }
.mt4-chart-overlay .tf    { color: #9aa3b2; font-size: 11px; margin-left: 6px; font-weight: 600; }

/* Chart FAB (radial trigger) */
.mt4-fab {
  position: absolute; right: 8px; bottom: 8px; z-index: 6;
  width: 32px; height: 32px; border-radius: 16px;
  background: rgba(26, 31, 46, 0.92); border: 1px solid #2b2f3a;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; padding: 0; color: #cfd2d9; font-size: 22px;
  font-weight: 700; letter-spacing: 2px; line-height: 1;
  animation: pro-fab-pulse 2.4s ease-out infinite;
}
@keyframes pro-fab-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(93,173,226,0.0); }
  50%      { box-shadow: 0 0 0 6px rgba(93,173,226,0.18); }
}

/* Account summary (dotted MT4 lines) */
.mt4-acct { padding: 14px 16px 8px 16px; }
.mt4-acct-row {
  display: flex; align-items: center; padding: 6px 0;
}
.mt4-acct-row .lbl { color: #9aa1ad; font-size: 13px; }
.mt4-acct-row .dot {
  flex: 1; border-bottom: 1px dotted #3a4150;
  margin: 0 8px; position: relative; top: -4px;
}
.mt4-acct-row .val {
  color: #cfd2d9; font-size: 13px; font-weight: 700;
  font-family: 'Roboto Mono', monospace;
}
.mt4-acct-row .val.up   { color: #00b8a9; }
.mt4-acct-row .val.down { color: #f46036; }

/* Position card */
.mt4-pos {
  background: #1a1f2e; border-radius: 6px; padding: 10px;
  margin-bottom: 8px; border: 1px solid #2b2f3a;
}
.mt4-pos .head {
  display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px;
}
.mt4-side-tag {
  font-size: 11px; font-weight: 700; padding: 2px 6px; border-radius: 3px;
  color: #000;
}
.mt4-side-tag.buy  { background: #00b8a9; }
.mt4-side-tag.sell { background: #f46036; color: #fff; }
.mt4-pos .pair { font-size: 13px; font-weight: 700; color: #cfd2d9; margin-left: 8px; }
.mt4-pos .close-btn {
  background: #3a4150; border: 0; width: 22px; height: 22px; border-radius: 4px;
  color: #fff; cursor: pointer; font-size: 12px;
  display: flex; align-items: center; justify-content: center;
}
.mt4-pos .info { display: flex; gap: 12px; font-size: 11px; color: #9aa1ad; }
.mt4-pos .info .v { color: #cfd2d9; }
.mt4-pos .pnl { margin-left: auto; font-weight: 700; }
.mt4-pos .pnl.up   { color: #00b8a9; }
.mt4-pos .pnl.down { color: #f46036; }
.mt4-pos .footer { font-size: 10px; color: #5e6673; margin-top: 4px; }

/* History tabs (POSITIONS / ORDERS / DEALS) */
.mt4-hist-tabs {
  display: flex; padding: 0 16px; background: #0d1117;
  border-bottom: 1px solid #1a1f2e;
}
.mt4-hist-tabs span {
  flex: 1; text-align: center; padding: 12px 0;
  font-size: 12px; font-weight: 600; cursor: pointer; letter-spacing: 0.5px;
  color: #5e6673; border-bottom: 2px solid transparent;
}
.mt4-hist-tabs span.active { color: #5dade2; border-bottom-color: #5dade2; }

/* Empty block */
.mt4-empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  height: 50%; min-height: 200px; gap: 12px; color: #5e6673; font-size: 12px;
}
.mt4-empty .icon {
  width: 64px; height: 64px; border-radius: 12px; background: #1a1f2e;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; color: #3a4150;
}

/* Modal */
.mt4-modal-overlay {
  position: fixed; inset: 0; background: rgba(0, 0, 0, 0.7);
  z-index: 1000; display: flex; align-items: center; justify-content: center;
  padding: 16px;
}
.mt4-modal {
  background: #161a1e; border-radius: 8px; width: 100%; max-width: var(--trading-shell-max);
  border: 1px solid #2b2f3a; overflow: hidden;
}
.mt4-modal-header {
  display: flex; align-items: center; gap: 8px; padding: 10px 12px;
  border-bottom: 1px solid #2b2f3a;
}
.mt4-modal-header input {
  flex: 1; background: transparent; border: 0; outline: 0;
  color: #ffffff; font-size: 15px; padding: 4px;
  font-weight: 500;
}
.mt4-modal-header input::placeholder { color: #8a93a3; opacity: 1; }
.mt4-search-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; cursor: pointer;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  transition: background 0.12s;
}
.mt4-search-row:hover  { background: rgba(255, 255, 255, 0.04); }
.mt4-search-row:active { background: rgba(0, 184, 169, 0.1); }
.mt4-search-row .sym   { font-size: 14px; font-weight: 700; color: #ffffff; letter-spacing: 0.3px; }
.mt4-search-row .px    { font-size: 13px; color: #c8cdd6; font-family: 'Roboto Mono', monospace; font-weight: 600; }

/* Confirm modal */
.mt4-confirm-row {
  display: flex; justify-content: space-between; padding: 4px 0;
}
.mt4-confirm-label { font-size: 12px; color: #9aa1ad; }
.mt4-confirm-val   { font-size: 13px; color: #cfd2d9; font-family: 'Roboto Mono', monospace; font-weight: 600; }

/* Radial menu — MT4 donut. MT4 mobile keeps the chart FULLY visible
   behind the wheel — no dim, no blur — so we use a fully-transparent
   overlay. The only purpose of this layer is to capture taps outside
   the wheel so they close it. */
.mt4-radial-overlay {
  position: fixed; inset: 0; z-index: 1500;
  display: flex; align-items: center; justify-content: center;
  background: transparent;
  -webkit-tap-highlight-color: transparent;
}
.mt4-radial {
  position: relative; width: 290px; height: 290px;
  animation: radial-in 0.18s cubic-bezier(.2, .9, .3, 1) both;
  filter: drop-shadow(0 8px 24px rgba(33, 150, 243, 0.35));
}
@keyframes radial-in {
  from { transform: scale(0.82); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}
.mt4-radial-tf {
  position: absolute; transform: translate(-50%, -50%);
  background: transparent; border: 0;
  padding: 4px 8px; border-radius: 30px;
  font-size: 14px; font-weight: 700; line-height: 1; letter-spacing: 0.3px;
  white-space: nowrap;
  color: #ffffff; cursor: pointer; z-index: 2;
  font-family: 'Inter', system-ui, sans-serif;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.18);
  transition: background 0.12s, color 0.12s, transform 0.1s;
}
.mt4-radial-tf:active { transform: translate(-50%, -50%) scale(0.92); }
.mt4-radial-tf.active {
  background: #ffffff; color: #1976d2;
  padding: 5px 12px; font-weight: 800;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.22);
  text-shadow: none;
}
/* Action icons sit just inside the donut hole — white inline SVGs at
   22px so they read clearly against the bright-blue band. */
.mt4-radial-action {
  position: absolute; transform: translate(-50%, -50%);
  background: transparent; border: 0; padding: 4px; cursor: pointer;
  width: 40px; height: 40px;
  color: #ffffff; z-index: 2;
  display: flex; align-items: center; justify-content: center;
  transition: transform 0.1s, opacity 0.12s;
  opacity: 0.96;
}
.mt4-radial-action svg {
  width: 22px; height: 22px;
  stroke: currentColor; fill: none;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.mt4-radial-action.active { opacity: 1; }
.mt4-radial-action.active::after {
  content: ""; position: absolute; inset: 2px;
  border-radius: 50%;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.7);
}
.mt4-radial-action:active { transform: translate(-50%, -50%) scale(0.88); }

/* Toast */
.mt4-toast {
  position: fixed; bottom: 76px; left: 50%; transform: translateX(-50%);
  color: #fff; padding: 10px 16px; border-radius: 6px;
  font-size: 13px; font-weight: 600;
  z-index: 2000; max-width: 90vw;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}
.mt4-toast.ok  { background: rgba(0, 184, 169, 0.95); }
.mt4-toast.err { background: rgba(244, 96, 54, 0.95); }

/* Buttons */
.mt4-btn-cancel {
  flex: 1; background: #2b2f3a; color: #cfd2d9; border: 0;
  border-radius: 4px; padding: 12px 0; font-size: 13px; font-weight: 600; cursor: pointer;
}
.mt4-btn-submit {
  flex: 2; color: #fff; border: 0; border-radius: 4px;
  padding: 12px 0; font-size: 14px; font-weight: 700; cursor: pointer;
}
.mt4-btn-submit.buy  { background: #00b8a9; color: #000; }
.mt4-btn-submit.sell { background: #f46036; }

/* ============= Connection status ============= */
.ws-status { display: inline-flex; align-items: center; gap: 4px; font-size: 10px; color: var(--t-text-3); }
.ws-status .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--t-text-3); }
.ws-status.live .dot { background: var(--t-up); animation: pulse 2s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }

/* ============= Trade direction arrow on price ============= */
.price-arrow { display: inline-block; font-size: 18px; vertical-align: middle; margin-left: 4px; transition: transform 0.2s; }
.price-arrow.up { color: var(--t-up); }
.price-arrow.down { color: var(--t-down); }

/* ============= Hub / Markets list ============= */
.t-markets-table { padding: 0 14px; }
.t-markets-table .head { display: grid; grid-template-columns: 1.4fr 1fr 0.8fr; padding: 8px 0; font-size: 11px; color: var(--t-text-3); border-bottom: 1px solid var(--t-border); }
.t-markets-table .row {
  display: grid; grid-template-columns: 1.4fr 1fr 0.8fr;
  padding: 12px 0; border-bottom: 1px solid var(--t-border);
  align-items: center; cursor: pointer;
}
.t-markets-table .row:hover { background: var(--t-bg-2); }
.t-markets-table .row .nm { display: flex; align-items: center; gap: 8px; }
.t-markets-table .row .ic { width: 26px; height: 26px; border-radius: 50%; background: var(--t-accent); color: #000; font-weight: 800; font-size: 11px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.t-markets-table .row .info .pn { font-weight: 700; font-size: 13px; }
.t-markets-table .row .info .sm { color: var(--t-text-3); font-size: 10px; }
.t-markets-table .row .price { font-family: 'SF Mono', monospace; font-weight: 600; font-size: 13px; text-align: right; }
.t-markets-table .row .chg { text-align: right; font-size: 12px; font-weight: 700; padding: 4px 6px; border-radius: 4px; }
