/* ===========================================================================
   Stratus Markets — independent Hyperliquid-style trading UI
   Original stylesheet. Accent palette: BLUE (positive/brand), red (negative).
   =========================================================================== */

:root {
  --bg:          #0b0e13;
  --bg-2:        #11151c;
  --panel:       #141a22;
  --panel-2:     #1a212b;
  --border:      #222b37;
  --border-2:    #2c3744;
  --text:        #e6edf3;
  --text-dim:    #9aa7b4;
  --text-faint:  #61707f;

  /* Brand/UI accent = blue; buy/long/positive = green */
  --accent:      #2f81f7;
  --accent-2:    #4aa3ff;
  --accent-dim:  #1b3550;
  --up:          #0ecb81;
  --up-bg:       rgba(14,203,129,0.12);
  --down:        #f6465d;
  --down-bg:     rgba(246,70,93,0.12);

  --warn:        #e3a008;
  --radius:      8px;
  --mono:        'SFMono-Regular', ui-monospace, 'Roboto Mono', Menlo, Consolas, monospace;
  --sans:        -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

/* ── Loading placeholder ─────────────────────────────────────────────────── */
.panel-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 80px;
  color: #3a4a5a;
  font-size: 12px;
  letter-spacing: 0.02em;
  pointer-events: none;
  user-select: none;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 13px;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 6px; }
::-webkit-scrollbar-track { background: transparent; }

#app { display: flex; flex-direction: column; min-height: 100%; }

/* ── Top bar ─────────────────────────────────────────────────────────────── */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  height: 52px; padding: 0 16px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
  position: relative; z-index: 50;
}
.topbar-left { display: flex; align-items: center; gap: 28px; }
.brand { display: flex; align-items: center; gap: 9px; }
.brand-mark {
  width: 20px; height: 20px; border-radius: 5px; display: block;
  box-shadow: 0 0 14px rgba(47,129,247,0.5);
}
.brand-name { font-weight: 700; font-size: 15px; letter-spacing: .2px; }
.brand-accent { color: var(--accent-2); }
.mainnav { display: flex; gap: 4px; }
/* Hamburger (hidden on desktop) */
.nav-burger {
  display: none; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; width: 36px; height: 36px; flex-shrink: 0;
  background: transparent; border: 1px solid var(--border-2); border-radius: 6px;
}
.nav-burger span { display: block; width: 16px; height: 2px; background: var(--text-dim); border-radius: 1px; }
.nav-burger:hover { border-color: var(--accent); }
.nav-burger:hover span { background: var(--text); }
.mainnav a {
  padding: 7px 12px; border-radius: 6px; color: var(--text-dim);
  font-weight: 600; font-size: 13px; transition: all .12s;
}
.mainnav a:hover { color: var(--text); background: var(--panel); }
.mainnav a.active { color: var(--accent-2); background: var(--accent-dim); }

.topbar-right { display: flex; align-items: center; gap: 14px; }
.net-status { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-dim); }
.net-status .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-faint); }
.net-status.live .dot { background: var(--up); box-shadow: 0 0 8px var(--up); }
.net-status.down .dot { background: var(--down); }

.btn {
  border: 1px solid var(--border-2); background: var(--panel);
  color: var(--text); padding: 8px 14px; border-radius: 6px;
  font-weight: 600; font-size: 13px; transition: all .12s;
}
.btn:hover { border-color: var(--accent); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-2); border-color: var(--accent-2); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-block { width: 100%; justify-content: center; }
.btn-small { padding: 5px 10px; font-size: 11px; font-weight: 500; flex: 1; }
.btn-buy  { background: var(--up);   border-color: var(--up);   color: #fff; }
.btn-buy:hover  { filter: brightness(1.1); }
.btn-sell { background: var(--down); border-color: var(--down); color: #fff; }
.btn-sell:hover { filter: brightness(1.1); }

/* ── Layout ──────────────────────────────────────────────────────────────── */
#view { flex: 1; }
.footer {
  display: flex; justify-content: space-between; gap: 16px;
  padding: 10px 16px; border-top: 1px solid var(--border);
  color: var(--text-faint); font-size: 11px; background: var(--bg-2);
}
.footer-warn { color: var(--warn); }
.footer-link { color: var(--text-dim); text-decoration: underline; text-underline-offset: 2px; }
.footer-link:hover { color: var(--accent-2); }

/* ── Copy-trading teaser banner (Trade + Markets) ────────────────────────── */
#copy-teaser { position: relative; }
.page > #copy-teaser { margin: -4px 0 14px; }
.copy-teaser {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 44px 9px 14px;
  background: linear-gradient(90deg, var(--accent-dim), var(--bg-2));
  border: 1px solid var(--border-2); border-radius: 8px;
  font-size: 13px; color: var(--text-dim); line-height: 1.4;
  transition: border-color .12s;
}
.copy-teaser:hover { border-color: var(--accent); }
.copy-teaser .ct-tag {
  flex-shrink: 0; font-size: 10px; font-weight: 700; letter-spacing: 1px;
  text-transform: uppercase; padding: 3px 9px; border-radius: 999px;
  background: rgba(47,129,247,.18); color: var(--accent-2);
}
.copy-teaser .ct-text strong { color: var(--text); }
.copy-teaser .ct-text .copy-up { color: var(--up); }
.copy-teaser .ct-text .copy-dn { color: var(--down); }
.copy-teaser .ct-cta { flex-shrink: 0; margin-left: auto; font-weight: 600; color: var(--accent-2); white-space: nowrap; }
.ct-close {
  position: absolute; top: 50%; right: 8px; transform: translateY(-50%);
  width: 28px; height: 28px; display: flex; align-items: center; justify-content: center;
  background: none; border: none; border-radius: 6px;
  color: var(--text-faint); font-size: 12px;
}
.ct-close:hover { color: var(--text); background: var(--panel); }
/* Inside the trade view the teaser sits above the grid, flush like a strip */
#view > #copy-teaser .copy-teaser { border-radius: 0; border-left: 0; border-right: 0; border-top: 0; }

/* ── First-visit spotlight on the Copy nav link ──────────────────────────── */
.mainnav a.nav-new::after {
  content: 'NEW'; margin-left: 6px; font-size: 9px; font-weight: 800;
  letter-spacing: .8px; padding: 2px 5px; border-radius: 4px; vertical-align: 2px;
  background: var(--accent); color: #fff;
}
.nav-spot {
  position: fixed; z-index: 200; width: 260px; padding: 12px 14px;
  background: var(--panel-2); border: 1px solid var(--accent);
  border-radius: 10px; box-shadow: 0 14px 34px rgba(0,0,0,.55);
  font-size: 12.5px; line-height: 1.5; color: var(--text-dim);
}
.nav-spot::before {
  content: ''; position: absolute; top: -6px; left: 124px;
  width: 10px; height: 10px; transform: rotate(45deg);
  background: var(--panel-2); border-left: 1px solid var(--accent); border-top: 1px solid var(--accent);
}
.nav-spot strong { display: block; color: var(--text); margin-bottom: 3px; font-size: 13px; }
.nav-spot span { display: block; margin-bottom: 10px; }
.nav-spot-x {
  display: block; width: 100%; padding: 7px 0; border-radius: 6px;
  background: var(--accent); border: none; color: #fff; font-weight: 600; font-size: 12px;
}
.nav-spot-x:hover { background: var(--accent-2); }

/* Trading grid */
.trade-grid {
  display: grid;
  grid-template-columns: 1fr 320px 300px;
  grid-template-rows: auto 1fr auto;
  gap: 1px;
  background: var(--border);
  height: calc(100vh - 52px - 33px);
}
.panel { background: var(--bg); overflow: hidden; display: flex; flex-direction: column; }
.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 12px; border-bottom: 1px solid var(--border);
  font-weight: 600; font-size: 12px; color: var(--text-dim);
  text-transform: uppercase; letter-spacing: .4px;
}

/* Market header bar */
.market-bar {
  grid-column: 1 / 4;
  display: flex; align-items: center; gap: 24px;
  padding: 0 16px; height: 58px;
  background: var(--bg-2); overflow-x: auto;
}
.market-pick { display: flex; align-items: center; gap: 10px; cursor: pointer; padding: 6px 10px; border-radius: 6px; }
.market-pick:hover { background: var(--panel); }
.market-pick .sym { font-size: 17px; font-weight: 700; }
.market-pick .chev { color: var(--text-faint); font-size: 11px; }
.market-stat { display: flex; flex-direction: column; gap: 2px; white-space: nowrap; }
.market-stat .label { color: var(--text-faint); font-size: 10px; text-transform: uppercase; letter-spacing: .4px; }
.market-stat .value { font-family: var(--mono); font-size: 13px; font-weight: 600; }
.mark-price { font-size: 18px !important; }
/* Desktop: header groups are transparent (single inline row); expand btn hidden */
.mb-main, .mb-more { display: contents; }
.mb-expand { display: none; }

.up   { color: var(--up); }
.down { color: var(--down); }

/* Chart */
.chart-panel { grid-column: 1; grid-row: 2; }
.chart-toolbar { display: flex; gap: 2px; padding: 6px 10px; border-bottom: 1px solid var(--border); }
.tf-btn { padding: 4px 9px; border-radius: 5px; background: transparent; border: none; color: var(--text-dim); font-weight: 600; font-size: 12px; }
.tf-btn:hover { background: var(--panel); color: var(--text); }
.tf-btn.active { background: var(--accent-dim); color: var(--accent-2); }
#chart { flex: 1; min-height: 0; }

/* Trade markers drawn over the chart (fills + open orders) */
.chart-markers { position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: 3; }
.cm {
  position: absolute; width: 16px; height: 16px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font: 700 9px/1 system-ui, sans-serif; box-sizing: border-box;
  user-select: none; transition: transform .08s ease;
}
.cm-solid { background: var(--cm); color: #000; opacity: .5; }   /* processed fills: 50% transparent */
.cm-open  { background: rgba(0, 0, 0, .5); border: 1.5px solid var(--cm); color: var(--cm); }
.cm-click { pointer-events: auto; cursor: pointer; }
.cm-click:hover { transform: scale(1.18); filter: brightness(1.2); opacity: 1; }

/* Order book / Recent trades (shared panel, tab-switched) */
.book-panel { grid-column: 2; grid-row: 2; }
.feed-tabs { display: inline-flex; gap: 2px; }
.feed-tab {
  padding: 3px 9px; border: none; border-radius: 5px; background: transparent;
  color: var(--text-faint); font-weight: 600; font-size: 12px;
  text-transform: uppercase; letter-spacing: .4px; cursor: pointer;
}
.feed-tab:hover { background: var(--panel); color: var(--text); }
.feed-tab.active { background: var(--accent-dim); color: var(--accent-2); }
/* feed-status stoplight in the panel header */
.book-light {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  margin-left: 6px; vertical-align: middle; background: var(--down);
  transition: background .3s, box-shadow .3s;
}
.book-light.green  { background: var(--up);   box-shadow: 0 0 4px var(--up); }
.book-light.yellow { background: #f0b90b;     box-shadow: 0 0 4px #f0b90b; }
.book-light.red    { background: var(--down); box-shadow: 0 0 4px var(--down); }
.book-light.off    { background: var(--text-faint); box-shadow: none; opacity: .5; }
.book { flex: 1; overflow-y: auto; font-family: var(--mono); font-size: 12px; }
.book-cols { display: flex; justify-content: space-between; padding: 5px 12px; color: var(--text-faint); font-size: 10px; text-transform: uppercase; }
/* 3-column book layout: Price | Size | Total (header + rows share the grid) */
.book-cols.book3 { display: grid; grid-template-columns: 1.2fr 1fr 1fr; align-items: center; }
.book-cols.book3 span:nth-child(2), .book-cols.book3 > span:nth-child(3) { text-align: right; }
/* price-aggregation dropdown in the book column header (design from test.html,
   scaled to the 10px header font + app palette) */
.dd-wrap { position: relative; display: inline-flex; margin-left: 6px; vertical-align: top; }
.dd-trigger {
  display: inline-flex; align-items: center; padding: 0 4px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 4px;
  color: var(--text-faint); font-size: 10px; line-height: 14px;
  font-family: var(--mono); cursor: pointer; white-space: nowrap;
}
.dd-trigger:hover { background: var(--panel-2); color: var(--text); }
.dd-trigger::after { content: "\25BE"; margin-left: 3px; font-size: 8px; color: var(--text-faint); }
.dd-menu {
  display: none; position: absolute; top: 100%; left: 0; margin-top: 3px;
  background: var(--panel); border: 1px solid var(--border-2); border-radius: 5px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, .4); z-index: 60; min-width: 58px; overflow: hidden;
}
.dd-menu.show { display: block; }
.dd-menu.dd-right { left: auto; right: 0; }   /* right-edge columns open leftward */
.dd-item {
  display: block; width: 100%; padding: 5px 9px; background: none; border: none;
  color: var(--text-dim); text-align: left; font-size: 10px; font-family: var(--mono);
  cursor: pointer; transition: background-color .15s;
}
.dd-item:hover { background: var(--panel-2); color: var(--text); }
.dd-item.active { color: var(--accent-2); }
.book-row { position: relative; display: grid; grid-template-columns: 1.2fr 1fr 1fr; padding: 2px 12px; cursor: pointer; }
.book-row .sz, .book-row .total { text-align: right; }
.book-row:hover { background: var(--panel-2); }
.book-row .depth { position: absolute; top: 0; right: 0; bottom: 0; opacity: .14; }
.book-row.ask .depth { background: var(--down); }
.book-row.bid .depth { background: var(--up); }
.book-row .px { position: relative; z-index: 1; }
.book-row.ask .px { color: var(--down); }
.book-row.bid .px { color: var(--up); }
.book-row .sz, .book-row .cum, .book-row .total { position: relative; z-index: 1; color: var(--text-dim); }
.book-mid { display: flex; align-items: center; justify-content: space-between; padding: 7px 12px; border-block: 1px solid var(--border); font-family: var(--mono); cursor: pointer; }
.book-mid:hover { background: var(--panel-2); }
.book-mid .spread { color: var(--text-faint); font-size: 11px; }

/* Trades feed (12 rows max, rendered fully — no scroll) */
.trades { flex: 1; overflow-y: auto; font-family: var(--mono); font-size: 12px; }
.trade-row { display: flex; justify-content: space-between; padding: 2px 12px; }

/* Order form */
.order-panel { grid-column: 3; grid-row: 2 / 4; overflow-y: auto; }
.order-form { padding: 12px; display: flex; flex-direction: column; gap: 12px; }
.seg { display: flex; background: var(--panel); border-radius: 7px; padding: 3px; gap: 3px; }
.seg button { flex: 1; padding: 7px; border: none; background: transparent; color: var(--text-dim); font-weight: 700; border-radius: 5px; }
.seg button.active.buy  { background: var(--up);   color: #fff; }
.seg button.active.sell { background: var(--down); color: #fff; }
.seg.small button { padding: 5px; font-size: 12px; font-weight: 600; }
.seg.small button.active { background: var(--accent-dim); color: var(--accent-2); }

.field { display: flex; flex-direction: column; gap: 5px; }
.field label, .field .flabel { color: var(--text-faint); font-size: 11px; text-transform: uppercase; letter-spacing: .3px; }
/* Ask/Mid/Bid quick-price buttons, right-justified on the Price label row */
.label-row { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.px-quick { display: inline-flex; gap: 4px; }
.px-q {
  padding: 1px 6px; background: var(--panel); border: 1px solid var(--border); border-radius: 4px;
  color: var(--text-dim); font-size: 10px; line-height: 14px; font-family: var(--mono);
  cursor: pointer; white-space: nowrap;
  min-width: 62px; text-align: center;   /* width holds steady when price is blank */
}
.px-q:hover { background: var(--panel-2); border-color: var(--border-2); color: var(--text); }
.input-wrap { display: flex; align-items: center; background: var(--panel); border: 1px solid var(--border); border-radius: 6px; padding: 0 10px; min-width: 0; }
.input-wrap:focus-within { border-color: var(--accent); }
.input-wrap input { flex: 1; min-width: 0; background: transparent; border: none; outline: none; color: var(--text); font-family: var(--mono); font-size: 14px; padding: 9px 0; }
.input-wrap .suffix { color: var(--text-faint); font-size: 12px; }

.lev-row { display: flex; align-items: center; gap: 10px; }
.lev-row input[type=range] { flex: 1; accent-color: var(--accent); }
.lev-val { font-family: var(--mono); font-weight: 700; min-width: 42px; text-align: right; }

.row-split { display: flex; gap: 8px; }
.row-split .field { flex: 1; }

.chk { display: flex; align-items: center; gap: 7px; color: var(--text-dim); font-size: 12px; cursor: pointer; }
.chk input { accent-color: var(--accent); }

.order-summary { display: flex; flex-direction: column; gap: 5px; padding-top: 6px; border-top: 1px solid var(--border); }
.order-summary .line { display: flex; justify-content: space-between; color: var(--text-dim); font-size: 12px; }
.order-summary .line .v { font-family: var(--mono); color: var(--text); }

/* slippage chip header (market orders) */
.slip-chip {
  display: inline-block; background: var(--accent-dim); color: var(--accent-2);
  border-radius: 4px; padding: 1px 6px; font-size: 10px; font-weight: 700;
  letter-spacing: .5px; text-transform: uppercase;
}

/* size % slider (hyperliquid-style) */
.pct-slider-row { display: flex; align-items: center; gap: 10px; }
.pct-slider-row input[type=range] { flex: 1; accent-color: var(--accent); }
.pct-val { font-family: var(--mono); font-size: 12px; color: var(--text-dim); min-width: 38px; text-align: right; }

/* Reduce-only slide toggle (ported from wh app .wb-tog) */
.ro-row { display: flex; align-items: center; gap: 10px; padding: 2px 0; }
.ro-tog {
  width: 28px; height: 16px; border-radius: 8px; background: var(--panel-2);
  border: 1px solid var(--border-2); position: relative; cursor: pointer; flex-shrink: 0;
}
.ro-tog.on { background: var(--up); border-color: var(--up); }
.ro-knob {
  width: 10px; height: 10px; border-radius: 50%; background: var(--text);
  position: absolute; top: 2px; left: 2px; transition: left .15s;
}
.ro-tog.on .ro-knob { left: 14px; }
.ro-info { cursor: pointer; }
.ro-name { font-size: 12px; color: var(--text); }
.ro-desc { font-size: 10px; color: var(--text-faint); }

/* TP/SL — order form legs + modals */
.tpsl-head { display: flex; align-items: center; justify-content: space-between; padding: 2px 0; margin-top: 2px; }
.tpsl-chk { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text); cursor: pointer; }
.tpsl-chk input { accent-color: var(--up); cursor: pointer; }
.tpsl-mode { width: 124px; flex-shrink: 0; }
.tpsl-row { display: flex; flex-wrap: nowrap; align-items: flex-end; width: 100%; gap: 8px; box-sizing: border-box; }
.tpsl-row .field { flex: 1; min-width: 0; }
.tpsl-hint { font-size: 10px; color: var(--text-faint); line-height: 1.4; }
.tpsl-hint.warn { color: var(--warn); }
.tpsl-hint.err { color: var(--down); }
.dropdown-wrapper { position: relative; flex-shrink: 0; }
.dropdown-menu {
  display: none; position: absolute; top: calc(100% + 2px); right: 0;
  background: var(--bg-2); border: 1px solid var(--border-2); border-radius: 6px;
  min-width: 38px; overflow: hidden; z-index: 120;
}
.dropdown-menu.open { display: block; }
.dropdown-item {
  display: block; width: 100%; background: none; border: none;
  color: var(--text); font-size: 11px; font-family: var(--mono);
  padding: 6px 10px; cursor: pointer; text-align: center;
}
.dropdown-item:hover { background: var(--panel-2); color: var(--accent-2); }
/* %/$ unit selector — sibling of input-wrap inside .tpsl-val-wrap */
.tpsl-val-wrap { display: flex; gap: 4px; align-items: stretch; width: 100%; min-width: 0; }
.tpsl-val-wrap .input-wrap { flex: 1; min-width: 0; }
.unit-trigger {
  background: var(--panel-2); color: var(--text); border: 1px solid var(--border);
  border-radius: 6px; font-size: 11px; padding: 0 10px; cursor: pointer;
  font-family: var(--mono); white-space: nowrap; flex-shrink: 0;
}
.unit-trigger:hover { color: var(--accent-2); border-color: var(--accent); }
/* Margin modal Add/Remove dropdown */
.mm-mode-btn {
  background: var(--accent); color: #fff; border: none; border-radius: 6px;
  font-size: 13px; font-weight: 600; padding: 8px 12px; cursor: pointer;
  white-space: nowrap; flex-shrink: 0;
}
.mm-mode-btn::after { content: " \25BE"; font-size: 10px; opacity: 0.7; }
.mm-mode-btn:hover { background: var(--accent-2); }
.mm-mode-dd .dropdown-menu { min-width: 90px; }
.mm-mode-dd .dropdown-item { text-align: left; font-size: 13px; font-family: var(--sans); padding: 8px 12px; }

/* margin mode tag + adjust pencil (positions table) */
.mode-tag {
  font-size: 9px; color: var(--text-faint); border: 1px solid var(--border-2);
  border-radius: 3px; padding: 0 4px; margin-left: 5px; text-transform: uppercase;
  letter-spacing: .4px; vertical-align: middle;
}
.lock-tag {
  font-size: 9px; color: var(--text-faint); border: 1px solid var(--border-2);
  border-radius: 3px; padding: 1px 4px; margin-left: 5px; letter-spacing: .3px;
  vertical-align: middle; white-space: nowrap;
  background: none; cursor: pointer; font-family: inherit; line-height: 1.4;
}
.lock-tag:hover { color: var(--text-dim); border-color: var(--accent); }
.pencil-btn {
  background: none; border: none; color: var(--text-dim); cursor: pointer;
  padding: 1px 3px; margin-left: 3px; vertical-align: middle;
}
.pencil-btn:hover { color: var(--accent-2); }

/* Adjust Margin modal (ported from wh app) */
.margin-modal { width: min(400px, 92vw); max-height: min(90vh, calc(100vh - 90px)); }
.margin-modal .mm-body { overflow-y: auto; }
/* Full-screen TP/SL form */
.tpsl-fs-bg { padding-top: 0 !important; align-items: stretch !important; background: var(--bg) !important; }
.tpsl-fs { width: 100% !important; max-width: 100% !important; height: 100dvh !important; max-height: 100dvh !important; border-radius: 0 !important; border: none !important; display: flex; flex-direction: column; }
.tpsl-fs .mm-head { flex-shrink: 0; }
.tpsl-fs .mm-body { flex: 1; overflow-y: auto; max-width: 640px; margin: 0 auto; width: 100%; padding-left: 24px; padding-right: 24px; }
.mm-head { padding: 18px 18px 0; text-align: center; position: relative; }
.mm-x {
  position: absolute; top: 10px; right: 10px; background: none;
  border: 1px solid var(--border); border-radius: 5px; color: var(--text-dim);
  width: 24px; height: 24px; cursor: pointer;
}
.mm-x:hover { color: var(--text); border-color: var(--border-2); }
.mm-title { font-size: 17px; font-weight: 700; margin-bottom: 5px; }
.mm-sub { font-size: 11px; color: var(--text-dim); line-height: 1.5; max-width: 300px; margin: 0 auto 6px; }
.mm-body { padding: 12px 16px 16px; display: flex; flex-direction: column; gap: 12px; }
.mm-row { display: flex; flex-wrap: nowrap; align-items: center; width: 100%; gap: 8px; box-sizing: border-box; }
.mm-amt { flex: 1 1 0; min-width: 50px; }
.mm-amt input { min-width: 0; width: 100%; }
.mm-max {
  background: none; border: 1px solid var(--border); border-radius: 6px;
  color: var(--accent-2); font-size: 10px; font-weight: 700; padding: 10px 8px;
  cursor: pointer; letter-spacing: .05em; flex-shrink: 0; white-space: nowrap;
}
.mm-max:hover { border-color: var(--accent); }
.mm-mode { flex-shrink: 0; }
.mm-slider-row { display: flex; align-items: center; gap: 12px; }
.mm-slider-row input[type=range] { flex: 1; accent-color: var(--accent); }
.tpsl-sz-slider { width: 100%; margin-top: 8px; accent-color: var(--accent); }
.mm-liq { font-size: 11px; color: var(--text-dim); white-space: nowrap; }
.mm-liq strong { font-family: var(--mono); margin-left: 4px; color: var(--text); }
.mm-info { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-dim); }
.mm-info .v { font-family: var(--mono); color: var(--text); }

/* Positions / bottom tabs — spans under chart AND book/trades */
.bottom-panel { grid-column: 1 / 3; grid-row: 3; max-height: 230px; }
.tabs { display: flex; gap: 2px; padding: 6px 10px 0; border-bottom: 1px solid var(--border); }
.tab { padding: 6px 12px; border: none; background: transparent; color: var(--text-dim); font-weight: 600; font-size: 12px; border-bottom: 2px solid transparent; }
.tab.active { color: var(--text); border-bottom-color: var(--accent); }
.tab .badge { margin-left: 5px; background: var(--panel-2); border-radius: 8px; padding: 1px 6px; font-size: 10px; }
.tab-spot-chip { align-self: center; margin-right: 8px; padding: 2px 10px; border: 1px solid var(--border); border-radius: 999px; background: var(--panel-2); color: var(--text-dim); font-weight: 600; font-size: 11px; text-decoration: none; }
.tab-spot-chip:hover { color: var(--accent); border-color: var(--accent); }
.tbl-wrap { flex: 1; overflow: auto; }

table.data { width: 100%; border-collapse: collapse; font-size: 12px; }
table.data th { position: sticky; top: 0; background: var(--bg); text-align: right; padding: 7px 12px; color: var(--text-faint); font-weight: 600; font-size: 11px; text-transform: uppercase; border-bottom: 1px solid var(--border); white-space: nowrap; }
table.data th:first-child, table.data td:first-child { text-align: left; }
table.data td { padding: 7px 12px; text-align: right; font-family: var(--mono); border-bottom: 1px solid var(--border); white-space: nowrap; }
table.data tr:hover td { background: var(--panel); }
table.data .sym-cell { font-family: var(--sans); font-weight: 700; }
/* dex / leverage chips shown after the symbol on the Markets page */
.sym-chip {
  display: inline-block; font-family: var(--sans); font-weight: 600; font-size: 10px;
  line-height: 1.4; border: 1px solid var(--border-2); border-radius: 4px;
  padding: 0 5px; margin-left: 6px; vertical-align: middle; letter-spacing: .2px;
}
.sym-chip.dex { color: var(--accent-2); border-color: var(--accent-dim); text-transform: uppercase; }
.sym-chip.lev { color: var(--text-faint); }
table.data .tbl-total-row td { color: var(--text-faint); font-family: var(--sans); font-size: 11px; border-top: 1px solid var(--border); border-bottom: none; padding: 6px 12px; }
table.data .tbl-total-row:hover td { background: none; }
.pill { display: inline-block; padding: 1px 7px; border-radius: 4px; font-size: 10px; font-weight: 700; }
.pill.long  { background: var(--up-bg);   color: var(--up); }
.pill.short { background: var(--down-bg); color: var(--down); }
.lev-tag { color: var(--text-faint); font-size: 10px; margin-left: 4px; }
.link-btn { background: none; border: 1px solid var(--border-2); border-radius: 5px; color: var(--text-dim); padding: 3px 9px; font-size: 11px; }
.link-btn:hover { border-color: var(--down); color: var(--down); }
.tpsl-add-btn { background: none; border: 1px solid var(--border-2); border-radius: 50%; color: var(--text-dim); width: 16px; height: 16px; font-size: 12px; line-height: 1; padding: 0; cursor: pointer; vertical-align: middle; }
.tpsl-add-btn:hover { border-color: var(--accent-2); color: var(--accent-2); }
.oo-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 14px; height: 14px; border-radius: 7px; padding: 0 2px; font-size: 9px; font-weight: 700; margin-left: 4px; vertical-align: middle; background: var(--panel-2); border: none; cursor: default; font-family: inherit; }
button.oo-badge { cursor: pointer; }
button.oo-badge:hover { opacity: 0.75; }

/* Markets page */
.page { max-width: 1280px; margin: 0 auto; padding: 20px 16px; }
.page h1 { font-size: 22px; margin: 0 0 4px; }
.page .sub { color: var(--text-dim); margin: 0 0 18px; }
.toolbar { display: flex; gap: 10px; margin-bottom: 14px; align-items: center; flex-wrap: wrap; }
.search { flex: 1; min-width: 200px; }
.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }

/* Portfolio */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 18px; }
.kpi { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.kpi .label { color: var(--text-faint); font-size: 11px; text-transform: uppercase; letter-spacing: .4px; }
.kpi .value { font-family: var(--mono); font-size: 22px; font-weight: 700; margin-top: 4px; }
.empty { padding: 36px; text-align: center; color: var(--text-faint); }
.connect-cta { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 60px 20px; }

/* Modal (market picker) */
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 100; display: flex; align-items: flex-start; justify-content: center; padding-top: 80px; }
.modal { width: 560px; max-width: 92vw; max-height: 70vh; background: var(--bg-2); border: 1px solid var(--border-2); border-radius: 10px; display: flex; flex-direction: column; overflow: hidden; }
.modal-head { padding: 12px 14px; border-bottom: 1px solid var(--border); }
.modal-head input { width: 100%; background: var(--panel); border: 1px solid var(--border); border-radius: 6px; padding: 9px 12px; color: var(--text); outline: none; }
.modal-list { overflow-y: auto; }
.modal-row { display: flex; justify-content: space-between; padding: 9px 14px; cursor: pointer; }
.modal-row:hover { background: var(--panel); }
.modal-row .l { display: flex; gap: 8px; align-items: center; }
.modal-row .tag { font-size: 9px; color: var(--text-faint); border: 1px solid var(--border-2); border-radius: 3px; padding: 0 4px; }

/* Wallet connect modal */
.wallet-modal { width: 380px; }
.wm-head { display: flex; justify-content: space-between; align-items: center; padding: 13px 16px; border-bottom: 1px solid var(--border); font-weight: 700; }
.wm-close { background: none; border: none; color: var(--text-faint); font-size: 14px; cursor: pointer; }
.wm-close:hover { color: var(--text); }
.wm-list { padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; max-height: 320px; overflow-y: auto; }
.wallet-item { display: flex; align-items: center; gap: 10px; width: 100%; background: var(--panel); border: 1px solid var(--border-2); border-radius: 8px; padding: 11px 13px; color: var(--text); font-size: 13px; cursor: pointer; }
.wallet-item:hover { border-color: var(--accent); }
.wallet-icon { width: 22px; height: 22px; border-radius: 5px; }
.wallet-name { font-weight: 600; }
.wallet-detected { margin-left: auto; font-size: 10px; color: var(--up); }
.wallet-none { padding: 14px 6px; text-align: center; color: var(--text-faint); font-size: 12px; line-height: 1.5; }
.wc-connect-btn { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 0 12px 12px; background: var(--panel); border: 1px solid var(--border-2); border-radius: 8px; padding: 11px; color: var(--text); font-size: 13px; font-weight: 600; cursor: pointer; }
.wc-connect-btn:hover { border-color: #3b99fc; }

/* Connect-modal account login */
.wm-sep { display: flex; align-items: center; gap: 10px; margin: 4px 12px 10px; color: var(--text-faint); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; }
.wm-sep span { white-space: nowrap; }
.wm-sep::before, .wm-sep::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.wm-login { display: flex; flex-direction: column; gap: 8px; margin: 0 12px 14px; }
.wm-login input { background: var(--panel); border: 1px solid var(--border-2); border-radius: 8px; padding: 10px 12px; color: var(--text); font-size: 13px; }
.wm-login input:focus { outline: none; border-color: var(--accent); }
.wm-login-hint { margin: 2px 0 0; color: var(--text-faint); font-size: 11px; text-align: center; }
.wm-forgot { color: var(--accent); cursor: pointer; text-decoration: none; }
.wm-forgot:hover { text-decoration: underline; }

/* Wallet dropdown (connected state) */
.wallet-wrap { position: relative; }
.wallet-dd { position: absolute; right: 0; top: calc(100% + 6px); background: var(--bg-2); border: 1px solid var(--border-2); border-radius: 8px; padding: 10px; min-width: 230px; z-index: 150; display: none; box-shadow: 0 8px 28px rgba(0,0,0,.45); }
.wallet-dd.open { display: block; }
.wallet-dd .dd-addr { font-family: var(--mono); font-size: 11px; color: var(--text-dim); word-break: break-all; margin-bottom: 9px; }
.wallet-dd .dd-status { font-size: 11px; color: var(--text-faint); margin-bottom: 9px; }
.wallet-dd .dd-status .ok { color: var(--up); }
.wallet-dd .dd-status .warn { color: var(--down); }
.wallet-dd button { width: 100%; background: var(--panel); border: 1px solid var(--border-2); border-radius: 6px; padding: 8px; color: var(--text); cursor: pointer; font-size: 12px; }
.wallet-dd button:hover { border-color: var(--down); color: var(--down); }

/* Active-wallet management inside the connected dropdown */
.dd-wallets { margin: 4px 0 9px; }
.dd-sep { height: 1px; background: var(--border); margin: 4px 0 9px; }
.dd-wallets-label { font-size: 10px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-faint); margin-bottom: 7px; }
.dd-hint { font-size: 11px; color: var(--text-faint); margin: 0 0 4px; }
.dd-hint a, .dd-login-link { color: var(--accent); cursor: pointer; text-decoration: none; }
.dd-hint a:hover, .dd-login-link:hover { text-decoration: underline; }
.dd-wallet-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 5px 0; }
.dd-wallet-row .dd-w-addr { font-family: var(--mono); font-size: 11px; color: var(--text-dim); }
.dd-wallet-row.active .dd-w-addr { color: var(--text); }
.dd-wallet-row .badge { font-size: 9px; }
.wallet-dd button.dd-mini { width: auto; padding: 3px 9px; font-size: 11px; }
.wallet-dd button.dd-mini:hover { border-color: var(--accent); color: var(--accent); }
.wallet-dd button.dd-add { margin-top: 6px; }
.wallet-dd button.dd-add:hover { border-color: var(--accent); color: var(--accent); }
.dd-reveal { display: flex; gap: 6px; margin-top: 6px; }
.dd-reveal .dd-mini { flex: 1; }

/* Self-custody wallet modals (create / import / reveal / password) */
.sw-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 300; display: flex; align-items: center; justify-content: center; padding: 18px; }
.sw-modal { background: var(--bg-2); border: 1px solid var(--border-2); border-radius: 12px; padding: 20px; width: 380px; max-width: 100%; box-shadow: 0 12px 40px rgba(0,0,0,.5); }
.sw-modal h3 { margin: 0 0 10px; font-size: 16px; }
.sw-modal .sw-muted { color: var(--text-dim); font-size: 13px; margin: 0 0 12px; }
.sw-modal .sw-lbl { display: block; font-size: 12px; color: var(--text-dim); margin: 12px 0 5px; }
.sw-modal .sw-opt { color: var(--text-faint); font-weight: 400; }
.sw-modal input, .sw-modal textarea { width: 100%; background: var(--panel); border: 1px solid var(--border-2); border-radius: 8px; padding: 10px 12px; color: var(--text); font-size: 13px; box-sizing: border-box; }
.sw-modal input:focus, .sw-modal textarea:focus { outline: none; border-color: var(--accent); }
.sw-modal textarea { font-family: var(--mono); resize: vertical; }
.sw-tabs { display: flex; gap: 6px; margin-bottom: 12px; }
.sw-tabs button { flex: 1; background: var(--panel); border: 1px solid var(--border-2); border-radius: 8px; padding: 8px; color: var(--text-dim); font-size: 13px; cursor: pointer; }
.sw-tabs button.on { color: var(--text); border-color: var(--accent); }
.sw-warn { background: rgba(255,170,0,.08); border: 1px solid rgba(255,170,0,.3); color: var(--text); border-radius: 8px; padding: 9px 11px; font-size: 12px; margin: 12px 0; }
.sw-secret { font-family: var(--mono); font-size: 14px; line-height: 1.6; word-break: break-all; background: var(--panel); border: 1px solid var(--border-2); border-radius: 8px; padding: 12px; margin: 4px 0 4px; user-select: all; }
.sw-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }
.sw-actions .btn { width: auto; padding: 9px 16px; }

/* Password show/hide eye */
.pw-wrap { position: relative; display: block; }
.pw-wrap > input { width: 100%; box-sizing: border-box; padding-right: 38px; }
.pw-wrap .pw-eye { position: absolute; top: 50%; right: 6px; transform: translateY(-50%); width: auto; min-width: 0; background: none; border: none; box-shadow: none; padding: 4px; margin: 0; cursor: pointer; color: var(--text-faint); display: inline-flex; align-items: center; line-height: 0; }
.pw-wrap .pw-eye:hover { color: var(--text); background: none; }

/* Toasts */
.toasts { position: fixed; bottom: 20px; right: 20px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--panel-2); border: 1px solid var(--border-2); border-left-width: 3px; border-radius: 7px; padding: 11px 14px; min-width: 240px; max-width: 360px; font-size: 13px; box-shadow: 0 6px 24px rgba(0,0,0,.4); animation: slidein .2s; }
.toast.ok   { border-left-color: var(--up); }
.toast.err  { border-left-color: var(--down); }
.toast.info { border-left-color: var(--accent); }
.toast .t-title { font-weight: 700; margin-bottom: 2px; }
.toast .t-body { color: var(--text-dim); font-family: var(--mono); font-size: 11px; word-break: break-word; }
@keyframes slidein { from { transform: translateX(20px); opacity: 0; } }

.loading { padding: 40px; text-align: center; color: var(--text-faint); }
.spinner { display: inline-block; width: 18px; height: 18px; border: 2px solid var(--border-2); border-top-color: var(--accent); border-radius: 50%; animation: spin .7s linear infinite; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Loading state for account tables (positions/balances/orders/history) */
.empty-loading { display: flex; align-items: center; justify-content: center; gap: 9px; }
.spinner-dot { width: 14px; height: 14px; border: 2px solid var(--border-2); border-top-color: var(--accent); border-radius: 50%; display: inline-block; animation: spin .7s linear infinite; }

/* ── Funds modal (Deposit / Withdraw) ─────────────────────────────────────── */
.dw-modal { width: 420px; max-height: none; }
.dw-head { display: flex; align-items: center; justify-content: space-between; font-size: 14px; }
.dw-x { background: none; border: none; color: var(--text-faint); font-size: 15px; line-height: 1; padding: 2px 4px; }
.dw-x:hover { color: var(--text); }
.dw-toggle { margin: 14px 14px 2px; }
.dw-body { padding: 12px 14px 16px; }
.dw-form { display: flex; flex-direction: column; gap: 14px; }
.dw-field { display: flex; flex-direction: column; gap: 7px; }
.dw-row { display: flex; align-items: baseline; justify-content: space-between; }
.dw-label { color: var(--text-faint); font-size: 11px; text-transform: uppercase; letter-spacing: .3px; }
.dw-avail { color: var(--text-dim); font-size: 11px; font-family: var(--mono); }
.dw-form .input-wrap .px-q { margin: 0 8px; }
.dw-addr { font-size: 12px !important; }
.dw-note { color: var(--text-faint); font-size: 11.5px; line-height: 1.45; margin: 0; }
.dw-note b { color: var(--text-dim); }
.dw-warn { background: var(--down-bg); border: 1px solid rgba(246,70,93,.28); color: var(--text-dim); border-radius: 6px; padding: 9px 11px; font-size: 11.5px; line-height: 1.45; }
.dw-warn b { color: var(--text); }

/* ── Receive / deposit-watcher flow ───────────────────────────────────────── */
.dw-sub { margin: 0 0 14px; }
.rcv-qr {
  display: flex; align-items: center; justify-content: center;
  background: #fff; border-radius: 8px; padding: 12px; min-height: 168px;
}
.rcv-qr svg { width: 168px; height: 168px; display: block; }
.rcv-qr-na { color: #444; font-size: 12px; text-align: center; }
.rcv-status { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-faint); }
.rcv-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); animation: rcvpulse 1.4s ease-in-out infinite; flex-shrink: 0; }
.rcv-status.seen { color: var(--up); }
.rcv-status.seen .rcv-dot { background: var(--up); animation: none; }
.rcv-card { display: flex; flex-direction: column; gap: 10px; background: var(--panel); border: 1px solid var(--border-2); border-radius: 8px; padding: 12px; }
.rcv-card-row { display: flex; align-items: center; justify-content: space-between; }
.rcv-card-row b { font-family: var(--mono); font-size: 15px; color: var(--text); }
.rcv-keep { align-self: center; }
@keyframes rcvpulse { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }

/* ── Responsive: tablet (901–1100px) ───────────────────────────────────────
   Book/trades drops below the chart; the order builder stays in the right
   column beside both. Bottom tabs span the full width underneath. */
@media (max-width: 1100px) {
  .trade-grid { grid-template-columns: 1fr 280px; grid-template-rows: auto 320px auto auto; height: auto; min-height: calc(100vh - 52px - 33px); }
  .market-bar { grid-column: 1 / -1; }
  .chart-panel { grid-column: 1; grid-row: 2; }
  .book-panel { grid-column: 1; grid-row: 3; }
  .order-panel { grid-column: 2; grid-row: 2 / 4; }
  .bottom-panel { grid-column: 1 / -1; grid-row: 4; }
}

/* ── Responsive: mobile (≤900px, down to 320px) ──────────────────────────── */
@media (max-width: 900px) {
  /* Top bar / hamburger nav */
  .topbar { padding: 0 10px; }
  .topbar-left { gap: 10px; }
  .topbar-right { gap: 8px; }
  .nav-burger { display: flex; }
  .mainnav {
    display: none; position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column; gap: 2px; padding: 8px;
    background: var(--bg-2); border-bottom: 1px solid var(--border-2);
    box-shadow: 0 14px 30px rgba(0,0,0,.5);
  }
  .mainnav.open { display: flex; }
  .mainnav a { padding: 12px 14px; font-size: 14px; }

  /* Stacked single-column trade layout:
     header → chart → book/trades → order builder → bottom tabs */
  .trade-grid { display: flex; flex-direction: column; height: auto; gap: 1px; }
  .market-bar  { order: 0; }
  .chart-panel { order: 1; height: 44vh; min-height: 260px; }
  .book-panel  { order: 2; height: auto; flex-shrink: 0; }
  .order-panel { order: 3; }
  .book        { flex: none; overflow-y: visible; }
  .trades      { flex: none; overflow-y: visible; }
  .bottom-panel{ order: 4; max-height: none; }

  /* Markets / collateral tables still hide secondary columns on narrow screens.
     Positions / orders / history / balances show every column and scroll
     horizontally inside their .tbl-wrap instead. */
  table.data .m-hide { display: none; }

  /* Expandable symbol header: line 1 = symbol / mark / 24h change [+ chevron] */
  .market-bar { height: auto; padding: 8px 10px; flex-wrap: wrap; gap: 6px 14px; overflow: visible; }
  .mb-main { display: flex; align-items: center; gap: 12px; width: 100%; }
  .market-pick { padding: 4px 6px; }
  .mb-expand {
    display: flex; align-items: center; justify-content: center;
    margin-left: auto; width: 30px; height: 30px; flex-shrink: 0;
    background: transparent; border: 1px solid var(--border-2); border-radius: 6px;
    color: var(--text-dim); font-size: 11px; transition: transform .15s;
  }
  .mb-expand.open { transform: rotate(180deg); color: var(--accent-2); border-color: var(--accent); }
  .mb-more { display: none; }
  .mb-more.open {
    display: flex; flex-wrap: wrap; gap: 8px 20px; width: 100%;
    padding: 6px 6px 2px; border-top: 1px solid var(--border);
  }

  /* General panel/page comfort on small screens */
  .order-form { padding: 10px; }
  .page { padding: 16px 10px; }
  .modal-bg { padding: 16px 8px 0; }
  .modal { max-width: 96vw; }

  /* Comfortable tap targets */
  .btn { min-height: 40px; }
  .tf-btn, .feed-tab { min-height: 34px; }

  /* Copy teaser: stack text, keep CTA reachable */
  .copy-teaser { flex-wrap: wrap; gap: 6px 10px; padding: 10px 40px 10px 12px; }
  .copy-teaser .ct-cta { margin-left: 0; width: 100%; }
  .nav-spot { display: none !important; }  /* nav is behind the burger; pill only */
}

/* ── Responsive: small phones (≤480px, min 320px) ────────────────────────── */
@media (max-width: 480px) {
  .net-status .net-label { display: none; }
  .brand-name { font-size: 14px; }
  .topbar-left { gap: 8px; }
  .btn { padding: 8px 11px; }
  .chart-toolbar { overflow-x: auto; }
  .tabs { padding: 6px 6px 0; }
  .tab { white-space: nowrap; padding: 6px 9px; }
  .footer { flex-direction: column; gap: 3px; }
  .toasts { left: 10px; right: 10px; bottom: 12px; }
  .toast { min-width: 0; max-width: none; }
  .wallet-dd { position: fixed; left: 10px; right: 10px; top: 56px; min-width: 0; }
  .kpi .value { font-size: 18px; }
  .mb-main { gap: 8px; }
  .market-pick .sym { font-size: 15px; }
  .mark-price { font-size: 16px !important; }
}

/* ===========================================================================
   ALERTS — TradingView webhook builder + alert config + event log
   Ported from the legacy root dashboard; colors mapped to this app's tokens.
   =========================================================================== */
.alerts-view .al-head h1 { margin-bottom: 2px; }
.alerts-view .al-approve {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: rgba(227,160,8,0.10); border: 1px solid var(--warn);
  color: var(--text); border-radius: var(--radius); padding: 9px 12px; margin-bottom: 14px; font-size: 12px;
}
.alerts-view .al-grid { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1.15fr); gap: 16px; align-items: start; }
.alerts-view .al-body { padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.alerts-view .al-row { display: flex; flex-direction: column; gap: 5px; }
.alerts-view .al-two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.alerts-view .al-field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.alerts-view .al-lbl { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--text-dim); font-weight: 600; }
.alerts-view .al-req { font-size: 9px; color: var(--down); border: 1px solid var(--down); border-radius: 3px; padding: 0 4px; font-weight: 700; }
.alerts-view .al-opt { font-size: 9px; color: var(--text-faint); font-weight: 500; }
.alerts-view .al-hint { font-size: 9px; color: var(--text-faint); }
.alerts-view .al-na { font-size: 9px; color: var(--text-faint); font-style: italic; }
.alerts-view .al-divider { height: 1px; background: var(--border); margin: 2px 0; }
.alerts-view .al-inp {
  width: 100%; background: var(--bg-2); border: 1px solid var(--border); border-radius: 6px;
  padding: 9px 10px; color: var(--text); font-family: var(--mono); font-size: 12px; outline: none;
}
.alerts-view .al-inp:focus { border-color: var(--accent); }
.alerts-view .al-inp:disabled { opacity: .4; cursor: not-allowed; }
.alerts-view .al-sympick {
  margin-left: auto; background: var(--panel-2); border: 1px solid var(--border-2); color: var(--text-dim);
  border-radius: 5px; width: 24px; height: 20px; font-size: 13px; line-height: 1; cursor: pointer;
}
.alerts-view .al-sympick:hover { border-color: var(--accent); color: var(--accent); }
/* Segmented controls */
.alerts-view .al-seg { display: flex; gap: 6px; }
.alerts-view .al-segbtn {
  flex: 1; padding: 8px 6px; background: var(--bg-2); border: 1px solid var(--border);
  border-radius: 6px; color: var(--text-dim); font-weight: 700; font-size: 12px; cursor: pointer; transition: .12s;
}
.alerts-view .al-segbtn:hover { border-color: var(--border-2); color: var(--text); }
.alerts-view .al-segbtn.active { background: var(--accent-dim); border-color: var(--accent); color: var(--text); }
.alerts-view [data-al="side"][data-val="buy"].active  { background: var(--up);   border-color: var(--up);   color: #fff; }
.alerts-view [data-al="side"][data-val="sell"].active { background: var(--down); border-color: var(--down); color: #fff; }
.alerts-view [data-al="tpsl"][data-val="tp"].active   { background: var(--up);   border-color: var(--up);   color: #fff; }
.alerts-view [data-al="tpsl"][data-val="sl"].active   { background: var(--down); border-color: var(--down); color: #fff; }
/* Reduce-only toggle */
.alerts-view .al-toggle-row { display: flex; align-items: center; gap: 10px; }
.alerts-view .al-toggle { width: 36px; height: 20px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--border-2); position: relative; flex-shrink: 0; cursor: pointer; transition: .15s; padding: 0; }
.alerts-view .al-toggle .al-knob { position: absolute; top: 1px; left: 1px; width: 16px; height: 16px; border-radius: 50%; background: var(--text-faint); transition: .15s; }
.alerts-view .al-toggle.on { background: var(--accent-dim); border-color: var(--accent); }
.alerts-view .al-toggle.on .al-knob { left: 17px; background: var(--accent-2); }
.alerts-view .al-toggle-name { font-size: 12px; font-weight: 600; color: var(--text); }
.alerts-view .al-toggle-desc { font-size: 10px; color: var(--text-faint); }
/* Place button */
.alerts-view .al-place { width: 100%; padding: 11px; border: none; border-radius: 6px; font-weight: 800; font-size: 13px; cursor: pointer; color: #fff; transition: filter .12s; }
.alerts-view .al-place.buy  { background: var(--up); }
.alerts-view .al-place.sell { background: var(--down); }
.alerts-view .al-place:hover:not(:disabled) { filter: brightness(1.1); }
.alerts-view .al-place:disabled { opacity: .5; cursor: not-allowed; }
.alerts-view .al-place-hint { font-size: 9px; color: var(--text-faint); text-align: center; margin-top: 5px; }
/* Alert config */
.alerts-view .al-sublbl { font-size: 11px; font-weight: 700; color: var(--text-dim); text-transform: uppercase; letter-spacing: .04em; }
.alerts-view .al-fine { font-size: 9px; color: var(--text-faint); margin-top: 4px; }
.alerts-view .al-fine b { color: var(--text-dim); font-weight: 600; }
.alerts-view .al-url-row { display: flex; gap: 6px; margin-top: 6px; }
.alerts-view .al-url-inp { flex: 1; min-width: 0; background: var(--bg-2); border: 1px solid var(--border); border-radius: 6px; padding: 8px 10px; color: var(--text); font-family: var(--mono); font-size: 11px; }
.alerts-view .al-copy { background: var(--panel-2); border: 1px solid var(--border-2); color: var(--text-dim); border-radius: 6px; padding: 7px 11px; font-size: 11px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.alerts-view .al-copy:hover { border-color: var(--accent); color: var(--accent); }
.alerts-view .al-copy.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.alerts-view .al-copy.copied { background: var(--up); border-color: var(--up); color: #fff; }
.alerts-view .al-json {
  width: 100%; min-height: 150px; margin-top: 6px; resize: vertical; overflow: hidden;
  background: var(--bg-2); border: 1px solid var(--border); border-radius: 6px; padding: 10px;
  color: var(--text); font-family: var(--mono); font-size: 12px; line-height: 1.5; outline: none;
}
.alerts-view .al-json-foot { display: flex; justify-content: flex-end; gap: 6px; margin-top: 6px; }
/* Field definitions */
.alerts-view .al-fd-hdr { display: flex; align-items: center; justify-content: space-between; margin-top: 14px; cursor: pointer; }
.alerts-view .al-roll { background: none; border: 1px solid var(--border); border-radius: 4px; color: var(--text-dim); font-size: 10px; font-weight: 700; padding: 2px 8px; cursor: pointer; }
.alerts-view .al-fd { width: 100%; border-collapse: collapse; margin-top: 8px; font-size: 11px; table-layout: fixed; }
.alerts-view .al-fd td { padding: 5px 6px; border-bottom: 1px solid var(--border); vertical-align: top; white-space: normal; word-break: break-word; overflow-wrap: anywhere; }
.alerts-view .al-fd td:first-child { width: 38%; }
.alerts-view .al-chip { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 5px; padding: 3px 7px; border-radius: 5px; background: var(--bg-2); border: 1px solid var(--border); cursor: pointer; max-width: 100%; }
.alerts-view .al-chip.al-always { cursor: default; border-style: dashed; }
.alerts-view .al-chip.active { border-color: var(--accent); background: var(--accent-dim); }
.alerts-view .al-chip.al-disabled { opacity: .4; }
.alerts-view .al-chip-n { font-family: var(--mono); font-weight: 700; color: var(--text); }
.alerts-view .al-chip-v { font-family: var(--mono); color: var(--accent-2); font-size: 10px; }
.alerts-view .al-chip-na { font-size: 8px; color: var(--text-faint); text-transform: uppercase; }
.alerts-view .al-ref { color: var(--text-faint); }
.alerts-view .al-vbtn { color: var(--accent-2); cursor: pointer; font-family: var(--mono); }
.alerts-view .al-vbtn:hover { text-decoration: underline; }
/* TradingView variable reference */
.alerts-view .al-tv-list { margin-top: 8px; display: flex; flex-direction: column; gap: 2px; }
.alerts-view .al-tv-item { display: flex; gap: 10px; font-size: 11px; padding: 3px 0; border-bottom: 1px dashed var(--border); }
.alerts-view .al-tv-k { font-family: var(--mono); color: var(--accent-2); min-width: 200px; }
.alerts-view .al-tv-v { color: var(--text-faint); }
/* Bottom-panel refresh tab + event log table */
/* Keep all tabs reachable (incl. Event Log) on narrow widths: never shrink a
   tab, scroll the bar horizontally instead of letting the card clip it. */
.alerts-view .tabs { flex-wrap: nowrap; overflow-x: auto; }
.alerts-view .tabs .tab { flex: 0 0 auto; }
.alerts-view .al-refresh { margin-left: auto; flex: 0 0 auto; color: var(--text-dim); }
.al-evt-table { table-layout: auto; }
.al-evt-table .al-evt-time { font-family: var(--mono); font-size: 10px; color: var(--text-dim); }
.al-evt-r { cursor: pointer; }
.al-evt-r:hover td { background: var(--panel); }
.al-evt-chev svg { width: 13px; height: 13px; transition: transform .15s; color: var(--text-faint); }
.al-evt-chev.on svg { transform: rotate(180deg); }
.al-evt-x { display: none; }
.al-evt-x.open { display: table-row; }
.al-evt-x > td { background: var(--bg-2); padding: 10px 12px !important; }
.al-evt-cols { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 10px; }
.al-evt-h { font-size: 10px; text-transform: uppercase; color: var(--text-faint); margin-bottom: 4px; letter-spacing: .04em; }
.al-jblock { background: var(--bg); border: 1px solid var(--border); border-radius: 6px; padding: 8px; font-family: var(--mono); font-size: 10px; line-height: 1.45; white-space: pre-wrap; word-break: break-word; max-height: 220px; overflow: auto; }
.al-evt-foot { display: flex; justify-content: center; padding: 10px; }
.al-jk { color: var(--accent-2); } .al-js { color: var(--up); } .al-jb { color: var(--warn); } .al-jn { color: var(--text); } .al-jnull { color: var(--text-faint); }
/* Status / action badges */
.al-badge { display: inline-block; padding: 1px 6px; border-radius: 4px; font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; }
.al-b-buy  { background: var(--up-bg);   color: var(--up); }
.al-b-sell { background: var(--down-bg); color: var(--down); }
.al-b-ok   { background: var(--up-bg);   color: var(--up); }
.al-b-fail { background: var(--down-bg); color: var(--down); }
.al-b-lim  { background: var(--accent-dim); color: var(--accent-2); }
.al-b-mkt  { background: var(--panel-2); color: var(--text-dim); }
.al-b-warn { background: rgba(227,160,8,0.15); color: var(--warn); }
/* Symbol picker id column (legacy) */
.al-sym-id { color: var(--text-faint); font-family: var(--mono); font-size: 11px; }

/* Symbol picker = full Markets view in a modal window */
.al-mkt-modal .modal.al-mkt-box { width: 980px; max-width: 95vw; max-height: 86vh; position: relative; padding: 0; }
.al-mkt-x { position: absolute; top: 10px; right: 12px; z-index: 3; width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; background: var(--panel-2); border: 1px solid var(--border-2); color: var(--text-dim); border-radius: 6px; font-size: 14px; cursor: pointer; }
.al-mkt-x:hover { border-color: var(--accent); color: var(--text); }
.al-mkt-body { overflow-y: auto; max-height: 86vh; }
.al-mkt-body .page { max-width: none; margin: 0; padding: 14px 16px 18px; }
.al-mkt-body .page h1 { padding-right: 36px; }
.al-mkt-body .card .tbl-wrap { max-height: none; }

@media (max-width: 900px) {
  .alerts-view .al-grid { grid-template-columns: 1fr; }
  .al-evt-cols { grid-template-columns: 1fr; }
}

/* ── Bonus marketing promos (New User + First Deposit) ───────────────────────── */
#bonus-promo { margin: 0 0 10px; }
.bonus-promos { display: flex; gap: 10px; flex-wrap: wrap; }
.bonus-promo {
  flex: 1 1 260px; display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border: none; border-radius: 12px; cursor: pointer;
  color: #fff; text-align: left; position: relative; overflow: hidden;
  box-shadow: 0 4px 16px rgba(0,0,0,.25); transition: transform .12s ease, box-shadow .12s ease;
}
.bonus-promo:hover { transform: translateY(-1px); box-shadow: 0 6px 22px rgba(0,0,0,.32); }
.promo-newuser { background: linear-gradient(135deg,#7c3aed 0%,#4f46e5 60%,#2563eb 100%); }
.promo-deposit { background: linear-gradient(135deg,#059669 0%,#10b981 60%,#34d399 120%); }
.promo-deposit:hover { box-shadow: 0 6px 22px rgba(16,185,129,.5); }
.bonus-promo::after { content:""; position:absolute; inset:0; pointer-events:none;
  background: radial-gradient(120px 60px at 110% -20%, rgba(255,255,255,.35), transparent 70%); }
.bp-icon { flex:0 0 auto; width:40px; height:40px; display:flex; align-items:center; justify-content:center;
  background: rgba(255,255,255,.18); border-radius:10px; }
.bp-text { display:flex; flex-direction:column; line-height:1.2; flex:1 1 auto; min-width:0; }
.bp-title { font-weight:700; font-size:14px; }
.bp-sub { font-size:12px; opacity:.92; }
.bp-cta { flex:0 0 auto; font-weight:700; font-size:13px; background:rgba(255,255,255,.2);
  padding:6px 10px; border-radius:8px; white-space:nowrap; }
@keyframes bpGlow { 0%,100% { box-shadow:0 4px 16px rgba(124,58,237,.25); } 50% { box-shadow:0 4px 22px rgba(124,58,237,.55); } }
.promo-newuser { animation: bpGlow 2.8s ease-in-out infinite; }

/* connect-modal promo */
.wm-promo { display:flex; align-items:center; gap:10px; margin:0 0 12px; padding:10px 12px;
  border-radius:10px; color:#fff; background:linear-gradient(135deg,#7c3aed,#2563eb 70%,#10b981);
  box-shadow:0 4px 14px rgba(0,0,0,.25); }
.wm-promo-badge { font-size:11px; font-weight:800; letter-spacing:.04em; background:#f59e0b; color:#1b1b1b;
  padding:3px 7px; border-radius:6px; }
.wm-promo-text { display:flex; flex-direction:column; line-height:1.25; }
.wm-promo-text strong { font-size:13px; }
.wm-promo-text span { font-size:11.5px; opacity:.92; }
