/* Dark Trader: MT5-style lists on phones, MT5 desktop layout from 1024px. Gains are blue, losses red, as in MT5. */
:root {
  --bg: #07080b;
  --bg-2: #0b0d12;
  --surface: #11131a;
  --surface-2: #171a23;
  --surface-3: #1e222d;
  --line: rgba(255, 255, 255, 0.06);
  --line-2: rgba(255, 255, 255, 0.1);
  --text: #f3f4f7;
  --text-2: #c3c7d1;
  --muted: #7d8394;
  --brand: #2962ff;
  --brand-2: #1846c4;
  --buy: #2f7bff;
  --buy-2: #1f5fd6;
  --sell: #ff3b5c;
  --sell-2: #d62445;
  --up: #4a90ff;
  --down: #f23f5d;
  --warn: #ffb020;
  --radius: 16px;
  --radius-sm: 11px;
  --tabbar-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color-scheme: dark;
}

:root[data-theme=light] {
  --bg: #f3f4f6;
  --bg-2: #eceef2;
  --surface: #ffffff;
  --surface-2: #f1f2f5;
  --surface-3: #e4e7ec;
  --line: rgba(0, 0, 0, 0.08);
  --line-2: rgba(0, 0, 0, 0.14);
  --text: #15171c;
  --text-2: #3a3f4a;
  --muted: #6c7280;
  --up: #1a66ff;
  --down: #e0243f;
  --shadow: 0 14px 40px rgba(0, 0, 0, 0.16);
  color-scheme: light;
}
[data-theme=light] input:focus, [data-theme=light] select:focus { background: #fff; }
[data-theme=light] input::placeholder { color: #9aa0ab; }
[data-theme=light] .tabbar { background: rgba(255, 255, 255, .97); }
[data-theme=light] .kv-row i { border-bottom-color: rgba(0, 0, 0, .18); }
[data-theme=light] .toast { background: rgba(255, 255, 255, .98); }
[data-theme=light] .login-card { background: rgba(255, 255, 255, .92); }
[data-theme=light] .side.buy { color: #1f5fd6; }
[data-theme=light] .side.sell { color: #d62445; }
[data-theme=light] .status-banner { color: #9f1239; }
[data-theme=light] .status-banner.passed { color: #1e40af; }
[data-theme=light] .chart-closed { background: rgba(255, 255, 255, .5); }
[data-theme=light] .segmented button.active { box-shadow: 0 1px 4px rgba(0, 0, 0, .12); }

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--text); font: 400 15px/1.45 var(--font);
  font-feature-settings: 'tnum' 1, 'cv11' 1; -webkit-font-smoothing: antialiased; overscroll-behavior: none;
}
[hidden] { display: none !important; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
svg { width: 20px; height: 20px; flex: none; }
.up { color: var(--up) !important; }
.down { color: var(--down) !important; }
.muted { color: var(--muted); }

/* ---------- controls ---------- */
input, select {
  width: 100%; min-width: 0; height: 46px; padding: 0 14px; border-radius: var(--radius-sm);
  background: var(--bg-2); border: 1px solid var(--line-2); outline: none; transition: border-color .15s, background .15s;
}
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 20px) 20px, calc(100% - 15px) 20px; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 36px; }
input:focus, select:focus { border-color: var(--buy); background: #0d1118; }
input::placeholder { color: #4f5564; }
input[type=number] { -moz-appearance: textfield; }
input[type=number]::-webkit-inner-spin-button, input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }

.form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 7px; }
.field > span { font-size: 12px; font-weight: 600; color: var(--muted); letter-spacing: .02em; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.hint { margin: 0; color: var(--muted); font-size: 13px; text-align: center; }
.form-error { margin: 0; min-height: 1.2em; color: var(--down); font-size: 13px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 44px; padding: 0 18px;
  border-radius: var(--radius-sm); font-weight: 700; font-size: 15px; background: var(--surface-3); color: var(--text);
  transition: transform .08s, filter .15s, opacity .15s; }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn-lg { height: 52px; font-size: 16px; }
.btn-xl { height: 60px; flex-direction: column; gap: 0; line-height: 1.15; }
.btn-xl span { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; opacity: .85; }
.btn-xl b { font-size: 17px; font-weight: 700; }
.btn-sm { height: 34px; padding: 0 12px; font-size: 13px; }
.btn-brand { background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; box-shadow: 0 8px 24px rgba(41, 98, 255, .28); }
.btn-buy { background: linear-gradient(180deg, var(--buy), var(--buy-2)); color: #fff; box-shadow: 0 8px 22px rgba(47, 123, 255, .25); }
.btn-sell { background: linear-gradient(180deg, var(--sell), var(--sell-2)); color: #fff; box-shadow: 0 8px 22px rgba(255, 59, 92, .25); }
.btn-ghost { background: transparent; border: 1px solid var(--line-2); color: var(--text-2); }
.btn-ghost:hover { border-color: var(--muted); color: var(--text); }
.icon-btn { width: 38px; height: 38px; border-radius: 11px; display: inline-grid; place-items: center; color: var(--muted); }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }

.segmented { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--bg-2); border: 1px solid var(--line);
  border-radius: 12px; padding: 4px; gap: 4px; }
.segmented button { height: 38px; border-radius: 9px; font-weight: 600; font-size: 14px; color: var(--muted); transition: background .15s, color .15s; white-space: nowrap; padding: 0 12px; }
.segmented button.active { background: var(--surface-3); color: var(--text); box-shadow: 0 2px 8px rgba(0, 0, 0, .3); }
.segmented.compact { grid-auto-columns: auto; }
.segmented.compact button { height: 32px; font-size: 13px; }
.segmented em { font-style: normal; color: var(--brand); margin-left: 3px; }

.chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 1px; }
.chips::-webkit-scrollbar { display: none; }
.chips.wrap { flex-wrap: wrap; overflow: visible; }
.chips button { flex: none; height: 32px; padding: 0 13px; border-radius: 99px; font-size: 13px; font-weight: 600; color: var(--muted);
  background: var(--bg-2); border: 1px solid var(--line); transition: all .15s; }
.chips button.active { color: var(--text); background: var(--surface-3); border-color: var(--line-2); }

.stepper { display: grid; grid-template-columns: 42px 1fr 42px; height: 46px; border-radius: var(--radius-sm); background: var(--bg-2);
  border: 1px solid var(--line-2); overflow: hidden; }
.stepper:focus-within { border-color: var(--buy); }
.stepper input { height: 100%; border: 0; border-radius: 0; background: transparent; text-align: center; font-weight: 600; padding: 0 4px; }
.stepper button { display: grid; place-items: center; color: var(--muted); }
.stepper button:active { background: var(--surface-3); color: var(--text); }
.stepper svg { width: 16px; height: 16px; }
.stepper.sl:focus-within { border-color: var(--down); }
.stepper.tp:focus-within { border-color: var(--up); }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.kbd { font-size: 11px; color: var(--muted); border: 1px solid var(--line-2); border-radius: 6px; padding: 1px 6px; }
.section-title { margin: 22px 2px 10px; font-size: 13px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }

/* ---------- login ---------- */
.login { min-height: 100%; position: relative; overflow: hidden; display: grid; place-items: center; padding: 24px 16px calc(24px + var(--safe-b)); }
.login-glow { position: absolute; top: -30%; right: -20%; bottom: auto; left: -20%; height: 70%; background: radial-gradient(closest-side, rgba(41, 98, 255, .28), transparent),
  radial-gradient(closest-side at 70% 40%, rgba(47, 123, 255, .18), transparent); filter: blur(10px); pointer-events: none; }
.login-inner { position: relative; width: min(420px, 100%); display: flex; flex-direction: column; gap: 26px; }
.login-brand { text-align: center; }
.logo-xl { width: 64px; height: 64px; filter: drop-shadow(0 12px 30px rgba(41, 98, 255, .45)); }
.login-brand h1 { margin: 14px 0 6px; font-size: 30px; font-weight: 800; letter-spacing: -.02em; }
.login-brand p { margin: 0; color: var(--muted); }
.login-card { padding: 22px; display: flex; flex-direction: column; gap: 18px; background: rgba(17, 19, 26, .85); backdrop-filter: blur(16px); box-shadow: var(--shadow); }

/* ---------- app shell ---------- */
.app { height: 100vh; height: 100dvh; display: flex; flex-direction: column; }
.appbar { position: relative; display: flex; align-items: center; gap: 6px; min-height: calc(54px + var(--safe-t)); padding: var(--safe-t) 6px 0 4px; background: var(--bg);
  border-bottom: 1px solid var(--line); z-index: 5; flex: none; }
.appbar-brand { display: none; align-items: center; gap: 10px; font-weight: 800; font-size: 17px; letter-spacing: -.01em; white-space: nowrap; }
.logo { width: 30px; height: 30px; }
.menu-btn { width: 44px; height: 44px; color: var(--text-2); }
.menu-btn svg { width: 24px; height: 24px; }
.appbar-title { display: flex; flex-direction: column; justify-content: center; min-width: 0; flex: 1; line-height: 1.15; }
.appbar-title h1 { margin: 0; font-size: 20px; font-weight: 600; letter-spacing: -.01em; white-space: nowrap; }
.appbar-title small { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appbar-title small:empty { display: none; }
/* Trade: the floating profit sits small in the middle of the bar, as in MT5 */
.appbar.centered .appbar-title { position: absolute; left: 60px; right: 60px; top: var(--safe-t); bottom: 0; align-items: center; pointer-events: none; }
.appbar.centered .appbar-title h1 { font-size: 16px; font-weight: 600; }
.appbar-actions { display: flex; gap: 0; margin-left: auto; }
.appbar-actions .icon-btn { width: 42px; height: 42px; color: var(--text-2); }
.appbar-actions svg { width: 22px; height: 22px; }
.appbar-actions .icon-btn.on { color: var(--buy); }
.tf-btn { font-size: 14px; font-weight: 700; width: auto !important; padding: 0 8px; }
.acct-chip { display: none; align-items: center; gap: 10px; padding: 6px 12px 6px 10px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); min-width: 0; }
.acct-chip-text { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.2; min-width: 0; }
.acct-chip-text b { font-size: 14px; }
.acct-chip-text small { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 260px; }
.conn { width: 8px; height: 8px; border-radius: 50%; background: var(--warn); flex: none; display: inline-block; }
.conn.ok { background: #17c784; }
.conn.bad { background: var(--down); }
.status { font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; padding: 3px 7px; border-radius: 6px; }
.status.active { background: rgba(23, 199, 132, .12); color: #17c784; }
.status.breached, .status.disabled { background: rgba(242, 63, 93, .14); color: var(--down); }
.status.passed { background: rgba(47, 123, 255, .15); color: #7fb0ff; }
.appbar-metrics { display: none; }

.layout { flex: 1; min-height: 0; position: relative; }
.view { display: none; flex-direction: column; min-height: 0; height: 100%; overflow-y: auto; padding: 0 0 calc(var(--tabbar-h) + var(--safe-b) + 12px); }
.layout[data-active=quotes] .v-quotes, .layout[data-active=chart] .v-chart, .layout[data-active=trade] .v-trade,
.layout[data-active=history] .v-history, .layout[data-active=messages] .v-messages, .layout[data-active=account] .v-account { display: flex; }
.v-account { padding: 14px 16px calc(var(--tabbar-h) + var(--safe-b) + 16px); }
.toolbox { display: none; }
.view-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.view-head h2 { margin: 0; font-size: 20px; font-weight: 800; letter-spacing: -.02em; }
.only-desktop { display: none !important; }

.tabbar { position: fixed; left: 0; right: 0; bottom: 0; height: calc(var(--tabbar-h) + var(--safe-b)); padding-bottom: var(--safe-b); display: grid;
  grid-template-columns: repeat(5, 1fr); background: rgba(12, 13, 17, .96); backdrop-filter: blur(18px); border-top: 1px solid var(--line); z-index: 20; }
.tabbar button { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--muted); font-size: 11px; font-weight: 600; }
.tabbar svg { width: 24px; height: 24px; }
.tabbar button.active { color: var(--buy); }
.dot-count { position: absolute; top: 7px; left: calc(50% + 7px); min-width: 17px; height: 17px; padding: 0 5px; border-radius: 99px; background: var(--buy);
  color: #fff; font-size: 10px; font-style: normal; font-weight: 800; display: grid; place-items: center; }
.dot-count:empty { display: none; }

/* ---------- side menu ---------- */
.drawer { position: fixed; top: 0; bottom: 0; left: 0; width: min(310px, 84vw); z-index: 46; background: var(--surface); border-right: 1px solid var(--line-2);
  box-shadow: var(--shadow); display: flex; flex-direction: column; padding-top: var(--safe-t); animation: slide .22s ease-out; }
.drawer-head { padding: 22px 20px 18px; border-bottom: 1px solid var(--line);
  background: radial-gradient(120% 120% at 0 0, rgba(41, 98, 255, .2), transparent 60%), var(--surface); }
.drawer-head .logo { width: 40px; height: 40px; margin-bottom: 12px; }
.drawer-head b { display: block; font-size: 17px; }
.drawer-head span { display: block; color: var(--muted); font-size: 13px; margin-top: 2px; }
.drawer-head .dh-bal { margin-top: 10px; color: var(--text-2); font-size: 14px; }
.drawer-head .dh-bal .status { display: inline-block; margin: 0 0 0 6px; }
.drawer-nav { display: flex; flex-direction: column; padding: 8px 0; }
.drawer-nav button { display: flex; align-items: center; gap: 16px; padding: 14px 20px; font-size: 15px; font-weight: 500; text-align: left; }
.drawer-nav button:active { background: var(--surface-2); }
.drawer-nav svg { width: 22px; height: 22px; color: var(--muted); }
.drawer-nav .danger { color: var(--down); }
.drawer-nav .danger svg { color: var(--down); }
@keyframes slide { from { transform: translateX(-100%); } }

/* ---------- full-screen panel (add / edit symbols) ---------- */
.panel { position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 44; background: var(--bg); display: flex; flex-direction: column; padding-top: var(--safe-t); animation: fade .15s; }
.panel-head { display: flex; align-items: center; gap: 6px; min-height: 54px; padding: 0 6px 0 4px; border-bottom: 1px solid var(--line); }
.panel-head h2 { margin: 0; flex: 1; font-size: 19px; font-weight: 600; }
.panel-head .icon-btn { width: 44px; height: 44px; color: var(--text-2); }
.panel-head svg { width: 23px; height: 23px; }
.panel .search { margin: 10px 16px; }
.panel-body { flex: 1; overflow-y: auto; padding-bottom: calc(20px + var(--safe-b)); }
.grp { display: flex; align-items: center; justify-content: space-between; width: 100%; padding: 14px 16px; border-bottom: 1px solid var(--line); font-size: 16px; font-weight: 600; text-align: left; }
.grp small { color: var(--muted); font-weight: 500; font-size: 13px; }
.grp svg { width: 18px; height: 18px; color: var(--muted); transition: transform .15s; }
.grp.open svg { transform: rotate(180deg); }
.sym-item { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 12px; width: 100%; padding: 10px 16px 10px 28px; border-bottom: 1px solid var(--line); text-align: left; }
.sym-item b { display: block; font-size: 15px; }
.sym-item small { display: block; font-size: 12px; color: var(--muted); }
.sym-item svg { width: 26px; height: 26px; color: #17c784; }
.sym-item.added svg { color: var(--muted); }
.sym-item.flat { padding-left: 16px; }
.edit-row { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 14px; padding: 12px 10px 12px 16px; border-bottom: 1px solid var(--line); background: var(--bg); touch-action: none; }
.edit-row.dragging { background: var(--surface-2); box-shadow: 0 8px 24px rgba(0, 0, 0, .5); position: relative; z-index: 2; }
.edit-row b { font-size: 16px; display: block; }
.edit-row small { color: var(--muted); font-size: 12px; }
.edit-row .del { color: var(--down); width: 30px; height: 30px; display: grid; place-items: center; }
.edit-row .del svg { width: 26px; height: 26px; }
.edit-row .grip { width: 40px; height: 40px; display: grid; place-items: center; color: var(--muted); cursor: grab; touch-action: none; }

/* ---------- quotes (MT5 advanced view) ---------- */
.q-tools { display: none; }
.q-tools h2 { margin: 0; font-size: 15px; font-weight: 700; flex: 1; }
.search { display: none; align-items: center; gap: 8px; height: 42px; padding: 0 12px; border-radius: 11px; background: var(--surface); border: 1px solid var(--line); color: var(--muted); }
.search.show { display: flex; }
.search svg { width: 16px; height: 16px; }
.search input { height: 100%; border: 0; background: transparent; padding: 0; font-size: 15px; }
.q-head { display: none; }
.quote-list { display: flex; flex-direction: column; }
.q-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; column-gap: 14px; padding: 9px 16px;
  border-bottom: 1px solid var(--line); cursor: pointer; }
.q-row:active { background: var(--surface); }
.q-row.closed .q-px .p { color: var(--muted) !important; }
.q-l { min-width: 0; line-height: 1.3; }
.q-chg { font-size: 12px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.q-chg [data-f=pct] { margin-left: 6px; }
.q-sym { font-size: 16px; font-weight: 700; letter-spacing: .01em; }
.q-meta { display: flex; gap: 10px; font-size: 12px; color: var(--muted); white-space: nowrap; }
.q-spr::before { content: '⇔ '; font-size: 11px; }
.q-px { text-align: right; min-width: 92px; }
.q-px .p { font-size: 15px; font-weight: 600; white-space: nowrap; line-height: 1.15; color: var(--text); }
.q-px .p b { font-size: 24px; font-weight: 700; letter-spacing: -.02em; }
.q-px .p sup { font-size: 12px; font-weight: 700; margin-left: 1px; vertical-align: 9px; }
.q-px .p.up { color: var(--buy) !important; }
.q-px .p.down { color: var(--down) !important; }
.q-px small { display: block; font-size: 11px; color: var(--muted); white-space: nowrap; margin-top: 1px; }
.q-row.selected { background: rgba(47, 123, 255, .07); }
.menu-list { display: flex; flex-direction: column; margin: 0 -18px; }
.menu-list button { padding: 15px 22px; text-align: left; font-size: 16px; border-top: 1px solid var(--line); }
.menu-list button:active { background: var(--surface-2); }
.spec { display: grid; grid-template-columns: 1fr auto; gap: 8px 14px; font-size: 14px; }
.spec span { color: var(--muted); }
.spec b { text-align: right; font-weight: 600; }

/* ---------- chart: toolbar in the top bar, one-click panel full width, symbol over the chart ---------- */
.v-chart { padding: 0 0 calc(var(--tabbar-h) + var(--safe-b)); overflow: hidden; }
.chart-head { display: none; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding: 8px 16px; }
.sym-btn { display: flex; align-items: center; gap: 6px; font-size: 18px; font-weight: 800; letter-spacing: -.01em; }
.sym-btn svg { width: 18px; height: 18px; color: var(--muted); }
.chart-quote { display: flex; align-items: baseline; gap: 8px; margin-left: auto; }
.chart-quote b { font-size: 17px; font-weight: 700; }
.chart-quote span { font-size: 13px; font-weight: 700; }
.chart-tools { display: flex; align-items: center; gap: 10px; width: 100%; }
.chart-tools .chips { flex: 1; }
.icon-group { display: flex; gap: 2px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.icon-group button { width: 32px; height: 26px; border-radius: 7px; display: grid; place-items: center; color: var(--muted); }
.icon-group button.active { background: var(--surface-3); color: var(--text); }
.icon-group svg { width: 17px; height: 17px; }
.chart-wrap { flex: 1; min-height: 200px; position: relative; background: var(--chart-bg, var(--bg)); overflow: hidden; }
.chart { position: absolute; top: 0; right: 0; bottom: 0; left: 0; }
/* the chart never scrolls the page, so a finger can drag SL / TP lines and objects up and down */
.chart, .chart * { touch-action: none !important; }
.chart-overlay { position: absolute; top: 0; right: 0; bottom: 0; left: 0; width: 100%; height: 100%; pointer-events: none; z-index: 2; }
.chart-sym { position: absolute; z-index: 3; top: 6px; left: 10px; display: flex; flex-direction: column; align-items: flex-start; text-align: left; line-height: 1.25; padding: 2px 4px; border-radius: 6px; font-family: Roboto, var(--font); }
.chart-sym b { font-size: 14px; font-weight: 500; color: var(--chart-ink, var(--text)); }
.chart-sym b::after { content: ' ▾'; color: var(--chart-fg, var(--muted)); font-size: 11px; }
.chart-sym span { font-size: 11px; color: var(--chart-fg, var(--muted)); }
.sym-drop { position: absolute; z-index: 6; top: 44px; left: 8px; width: 210px; max-height: 60%; overflow-y: auto; background: var(--surface); border: 1px solid var(--line-2);
  border-radius: 12px; box-shadow: var(--shadow); padding: 4px 0; }
.sym-drop button { display: flex; justify-content: space-between; width: 100%; padding: 10px 14px; font-size: 14px; font-weight: 600; }
.sym-drop button small { color: var(--muted); font-weight: 500; }
.sym-drop button.active { color: var(--buy); }
.sym-drop button:active { background: var(--surface-2); }
.tf-pop { position: absolute; z-index: 6; top: 8px; left: 50%; transform: translateX(-50%); display: grid; grid-template-columns: repeat(5, 52px); gap: 6px; padding: 10px;
  background: var(--surface); border: 1px solid var(--line-2); border-radius: 14px; box-shadow: var(--shadow); }
.tf-pop button { height: 40px; border-radius: 10px; font-weight: 700; font-size: 14px; background: var(--bg-2); color: var(--text-2); }
.tf-pop button.active { background: var(--buy); color: #fff; }
.chart-legend { position: absolute; left: 14px; top: 46px; font: 400 11px Roboto, var(--font); color: var(--chart-fg, var(--muted)); pointer-events: none; z-index: 3; white-space: pre; }
.chart-closed { position: absolute; top: 0; right: 0; bottom: 0; left: 0; display: grid; place-items: center; z-index: 3; font-weight: 700; color: var(--muted); background: rgba(7, 8, 11, .55); pointer-events: none; }

/* trade levels: "buy 0.10", "SL", "TP" small on the left, just above the line, like MT5 */
.trade-tags { position: absolute; top: 0; right: 0; bottom: 0; left: 0; pointer-events: none; z-index: 3; overflow: hidden; }
.tt { position: absolute; left: 6px; top: 0; display: flex; align-items: center; gap: 5px; height: 15px; font: 500 11px/1 Roboto, var(--font); color: var(--c);
  text-shadow: 0 0 3px var(--chart-bg, var(--bg)), 0 0 2px var(--chart-bg, var(--bg)); white-space: nowrap; will-change: transform; }
.tt.sel span { font-weight: 700; }
.tt .x { display: none; pointer-events: auto; width: 17px; height: 15px; border-radius: 3px; place-items: center; background: var(--c); color: #fff; font-size: 9px; text-shadow: none; }
.tt.sel .x { display: inline-grid; }
.tt.drag span { padding: 2px 6px; border-radius: 3px; background: var(--c); color: #fff; text-shadow: none; }
.pl { position: absolute; left: 8px; font: 500 11px Roboto, var(--font); color: var(--chart-fg, var(--muted)); white-space: nowrap; }
.pl b { font-weight: 500; color: var(--chart-ink, var(--text-2)); }
.pl i { font-style: normal; margin-left: 8px; }
/* indicator windows under the price chart, each a chart of its own (MT5 subwindows) */
.pane { position: absolute; left: 0; right: 0; z-index: 1; border-top: 1px solid rgba(128, 128, 128, .45); background: var(--chart-bg, var(--bg)); }
.pane-chart { position: absolute; top: 0; right: 0; bottom: 0; left: 0; }
.pane, .pane * { touch-action: none !important; }
.pane .pl { top: 3px; z-index: 3; pointer-events: none; }

/* drawing objects */
.place-hint { position: absolute; z-index: 5; left: 50%; bottom: 14px; transform: translateX(-50%); display: flex; align-items: center; gap: 12px; padding: 6px 6px 6px 14px;
  border-radius: 22px; background: rgba(20, 22, 30, .92); color: #fff; font-size: 13px; white-space: nowrap; box-shadow: 0 6px 20px rgba(0, 0, 0, .4); }
.place-hint button { padding: 6px 12px; border-radius: 16px; background: rgba(255, 255, 255, .14); font-weight: 600; font-size: 13px; }
.obj-bar { position: absolute; z-index: 5; top: 8px; right: 74px; display: flex; gap: 2px; padding: 3px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line-2); box-shadow: var(--shadow); }
.obj-bar button { width: 36px; height: 34px; border-radius: 9px; display: grid; place-items: center; color: var(--text-2); }
.obj-bar button:active, .obj-bar button.on { background: var(--surface-3); color: var(--buy); }
.obj-bar svg { width: 19px; height: 19px; }
.obj-bar #objColor { display: block; width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line-2); }

/* one-click trading: SELL | volume | BUY across the full width under the top bar (MT5) */
.trade-bar { display: grid; grid-template-columns: 1fr 104px 1fr; flex: none; background: var(--surface); border-bottom: 1px solid var(--line); font-family: Roboto, 'Segoe UI', Arial, sans-serif; }
.tb-btn { height: 56px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: #fff; line-height: 1; }
.tb-btn:active { filter: brightness(.9); }
.tb-btn span { font-size: 11px; font-weight: 500; letter-spacing: .08em; }
.tb-btn > b { font-size: 15px; font-weight: 500; white-space: nowrap; letter-spacing: 0; }
.tb-btn > b b { font-size: 26px; font-weight: 700; letter-spacing: -.01em; }
.tb-btn sup { font-size: 13px; font-weight: 500; vertical-align: top; position: relative; top: 1px; margin-left: 1px; }
.tb-btn.sell { background: #e8343e; }
.tb-btn.buy { background: #1c6fe8; }
.tb-btn:disabled { opacity: .5; }
.tb-lots { height: 56px; border-radius: 0; border: 0; background: var(--surface); grid-template-columns: 26px 1fr 26px; }
.tb-lots input { font: 500 16px Roboto, 'Segoe UI', Arial, sans-serif; color: var(--text); }
.tb-lots button { color: var(--muted); }
.tb-lots svg { width: 13px; height: 13px; }

/* settings, indicators and objects panels */
.set-title { margin: 0; padding: 18px 16px 8px; font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.set-group { border-top: 1px solid var(--line); }
.set-group .switch-row { padding: 12px 16px; border-bottom: 1px solid var(--line); }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px; border-bottom: 1px solid var(--line); font-size: 15px; }
.seg-sm { min-width: 180px; padding: 3px; }
.seg-sm button { height: 30px; font-size: 13px; }
.set-note { margin: 0; padding: 4px 16px 10px; font-size: 13px; color: var(--muted); }
.color-row { display: flex; align-items: center; justify-content: space-between; padding: 8px 16px; border-bottom: 1px solid var(--line); font-size: 15px; cursor: pointer; }
.color-row input { width: 46px; height: 30px; padding: 2px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--surface); cursor: pointer; }
.reset-btn { margin: 16px; width: calc(100% - 32px); }
.schemes { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; padding: 4px 16px; }
.scheme { display: flex; flex-direction: column; gap: 8px; padding: 8px; border-radius: 12px; border: 1.5px solid var(--line-2); text-align: left; font-size: 13px; }
.scheme.active { border-color: var(--buy); }
.scheme .sw { display: flex; align-items: center; justify-content: center; gap: 7px; height: 54px; border-radius: 8px; background: var(--s-bg);
  background-image: linear-gradient(var(--s-grid) 1px, transparent 1px); background-size: 100% 13px; border: 1px solid var(--line); }
.scheme .sw i { width: 9px; border: 1px solid var(--s-up); background: var(--s-bull); position: relative; }
.scheme .sw i:nth-child(1) { height: 20px; transform: translateY(6px); }
.scheme .sw i:nth-child(2) { height: 26px; border-color: var(--s-dn); background: var(--s-bear); }
.scheme .sw i:nth-child(3) { height: 16px; transform: translateY(-4px); }
.scheme .sw i:nth-child(4) { height: 24px; border-color: var(--s-dn); background: var(--s-bear); transform: translateY(4px); }
.scheme b { font-weight: 600; }
.row-open { text-align: left; min-width: 0; }
.swatches { display: flex; gap: 4px; padding-right: 6px; }
.swatches i { width: 12px; height: 12px; border-radius: 50%; }
.add-row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 14px 16px; font-size: 15px; font-weight: 600; color: var(--buy); border-bottom: 1px solid var(--line); }
.add-row svg { width: 24px; height: 24px; color: #17c784; }
.ind-form { padding-bottom: 16px; }
.ind-form > .btn { margin: 18px 16px 0; width: calc(100% - 32px); }
.ind-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 4px 16px 6px; }
.obj-tools { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; padding: 2px 16px 6px; }
.obj-tools button { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 6px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line);
  font-size: 12px; color: var(--text-2); text-align: center; line-height: 1.2; }
.obj-tools button:active { background: var(--surface-2); }
.obj-tools svg { width: 24px; height: 24px; color: var(--text); }
.link-row { width: 100%; text-align: left; }
.link-row svg { width: 22px; height: 22px; color: var(--muted); flex: none; }
.msg-text { white-space: normal; color: var(--text-2) !important; line-height: 1.35; margin-top: 4px !important; }
.row.msg .r-main { align-items: flex-start; }
.row.msg.warning .r-title b, .row.msg.breach .r-title b { color: var(--warn); }

/* ---------- order panel / sheet ---------- */
.v-order { display: flex !important; position: fixed; left: 0; right: 0; bottom: 0; height: auto; max-height: 92vh; max-height: 92dvh; z-index: 40;
  background: var(--surface); border-radius: 22px 22px 0 0; border: 1px solid var(--line-2); border-bottom: 0; box-shadow: var(--shadow);
  padding: 8px 16px calc(18px + var(--safe-b)); transform: translateY(105%); transition: transform .28s cubic-bezier(.2, .8, .2, 1); overflow-y: auto; }
.v-order.open { transform: none; }
.sheet-grip { width: 40px; height: 5px; border-radius: 99px; background: var(--line-2); margin: 2px auto 12px; flex: none; }
.order-form { gap: 12px; }
.estimate { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; font-size: 13px; color: var(--muted); padding: 12px 14px; border-radius: 12px; background: var(--bg-2); }
.estimate:empty { display: none; }
.estimate b { text-align: right; font-weight: 600; color: var(--text); }

/* ---------- trade & history (MT5 lists) ---------- */
.kv { display: flex; flex-direction: column; padding: 10px 16px 12px; border-bottom: 1px solid var(--line); }
.kv-total { font-size: 22px; font-weight: 700; padding: 4px 0 8px; }
.kv-row { display: flex; align-items: baseline; gap: 6px; font-size: 15px; line-height: 1.9; }
.kv-row span { color: var(--text-2); white-space: nowrap; }
.kv-row i { flex: 1; border-bottom: 1px dotted rgba(255, 255, 255, .16); transform: translateY(-4px); }
.kv-row b { font-weight: 600; white-space: nowrap; }
.sec-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 16px 6px; font-size: 13px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .06em; background: var(--bg-2); border-bottom: 1px solid var(--line); }
.link { color: var(--buy); font-size: 13px; font-weight: 600; text-transform: none; letter-spacing: 0; }
.link:disabled { color: var(--muted); }
.rows { display: flex; flex-direction: column; }
.row { border-bottom: 1px solid var(--line); cursor: pointer; }
.row:active { background: var(--surface); }
.r-main { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 10px 16px; }
.r-title { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.r-title b { font-weight: 700; }
.r-title .buy { color: var(--buy); }
.r-title .sell { color: var(--down); }
.r-sub { font-size: 13px; color: var(--muted); margin-top: 2px; white-space: nowrap; }
.r-right { text-align: right; }
.r-pl { font-size: 16px; font-weight: 700; white-space: nowrap; }
.r-time { font-size: 12px; color: var(--muted); margin-top: 2px; white-space: nowrap; }
.r-state { font-size: 13px; color: var(--muted); }
.r-more { display: grid; grid-template-columns: auto 1fr auto 1fr; gap: 4px 10px; padding: 0 16px 12px; font-size: 13px; }
.r-more span { color: var(--muted); }
.r-more b { font-weight: 600; text-align: right; white-space: nowrap; }
.r-more .actions { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.row.balance .r-title b { color: var(--text-2); }
.side { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; padding: 2px 7px; border-radius: 6px; vertical-align: 2px; }
.side.buy { color: #8cb6ff; background: rgba(47, 123, 255, .14); }
.side.sell { color: #ff8ea2; background: rgba(255, 59, 92, .14); }
.empty { padding: 34px 16px; text-align: center; color: var(--muted); font-size: 14px; }
.empty b { display: block; color: var(--text-2); font-size: 15px; margin-bottom: 4px; }
.h-tabs { padding: 10px 16px; border-bottom: 1px solid var(--line); }
.journal-row { display: grid; grid-template-columns: auto 1fr; gap: 10px; padding: 8px 2px; border-bottom: 1px solid var(--line); font-size: 13px; }
.journal-row time { color: var(--muted); white-space: nowrap; font-size: 12px; }
.journal-row.warning span, .journal-row.breach span { color: var(--warn); }

/* ---------- account ---------- */
.profile { padding: 18px; display: grid; grid-template-columns: auto 1fr; gap: 14px; align-items: center; }
.avatar { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; font-weight: 800; font-size: 20px; color: #fff;
  background: linear-gradient(135deg, var(--brand), #7b2cff); }
.profile h3 { margin: 0; font-size: 18px; }
.profile p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.profile-grid { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.profile-grid div { padding: 10px; border-radius: 12px; background: var(--bg-2); }
.profile-grid span { display: block; font-size: 11px; color: var(--muted); }
.profile-grid b { font-size: 14px; }
.rules { display: flex; flex-direction: column; gap: 10px; }
.rule { padding: 14px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); }
.rule-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-size: 14px; font-weight: 600; }
.rule-top b { font-size: 13px; font-weight: 600; color: var(--text-2); }
.meter { height: 8px; margin: 10px 0 8px; border-radius: 99px; background: var(--bg-2); overflow: hidden; }
.meter i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, #17c784, #3ee0a1); transition: width .4s; }
.meter i.warn { background: linear-gradient(90deg, #ffb020, #ffcb5c); }
.meter i.danger { background: linear-gradient(90deg, #f23f5d, #ff7088); }
.meter i.target { background: linear-gradient(90deg, #2f7bff, #6fa3ff); }
.rule small { font-size: 12px; color: var(--muted); }
.status-banner { padding: 14px; border-radius: 14px; background: rgba(242, 63, 93, .12); border: 1px solid rgba(242, 63, 93, .3); color: #ffb3c0; font-size: 14px; }
.status-banner.passed { background: rgba(47, 123, 255, .12); border-color: rgba(47, 123, 255, .3); color: #b3cdff; }
.rule-foot { font-size: 12px; color: var(--muted); padding: 2px; }
.settings { overflow: hidden; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); cursor: pointer; }
.switch-row span { display: flex; flex-direction: column; font-weight: 600; font-size: 15px; }
.switch-row small { font-weight: 400; font-size: 12px; color: var(--muted); }
.switch-row input { display: none; }
.switch-row i { width: 46px; height: 28px; border-radius: 99px; background: var(--surface-3); position: relative; flex: none; transition: background .2s; }
.switch-row i::after { content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: transform .2s; }
.switch-row input:checked + i { background: var(--buy); }
.switch-row input:checked + i::after { transform: translateX(18px); }
.row-btn { display: block; width: 100%; text-align: left; padding: 15px 16px; font-weight: 600; border-bottom: 1px solid var(--line); }
.row-btn:last-child { border-bottom: 0; }
.row-btn:active { background: var(--surface-2); }
.row-btn.danger { color: var(--down); }

/* ---------- sheet (modals) ---------- */
.backdrop { position: fixed; top: 0; right: 0; bottom: 0; left: 0; background: rgba(0, 0, 0, .55); backdrop-filter: blur(3px); z-index: 35; animation: fade .2s; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; max-height: 90vh; max-height: 90dvh; overflow-y: auto; background: var(--surface);
  border-radius: 22px 22px 0 0; border: 1px solid var(--line-2); border-bottom: 0; box-shadow: var(--shadow);
  padding: 8px 18px calc(20px + var(--safe-b)); animation: up .28s cubic-bezier(.2, .8, .2, 1); }
.sheet h3 { margin: 0; font-size: 19px; font-weight: 800; letter-spacing: -.01em; }
.sheet .sub { margin: -6px 0 0; color: var(--muted); font-size: 14px; }
.sheet .actions { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 10px; }
.sheet .stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.sheet .stat-row div { padding: 10px; border-radius: 12px; background: var(--bg-2); }
.sheet .stat-row span { display: block; font-size: 11px; color: var(--muted); }
.sheet .stat-row b { font-size: 15px; }
.creds { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; padding: 16px; border-radius: 14px; background: var(--bg-2); border: 1px dashed var(--line-2); font-size: 16px; }
.creds b { font-weight: 800; letter-spacing: .02em; user-select: all; }
.pick-list { display: flex; flex-direction: column; gap: 6px; }
.pick { display: flex; justify-content: space-between; align-items: center; padding: 14px; border-radius: 12px; background: var(--bg-2); font-weight: 700; }
.pick small { color: var(--muted); font-weight: 500; }
.pick.active { outline: 1px solid var(--brand); }

/* ---------- toasts ---------- */
.toasts { position: fixed; left: 12px; right: 12px; bottom: calc(var(--tabbar-h) + var(--safe-b) + 10px); flex-direction: column-reverse; z-index: 60; display: flex; gap: 8px; pointer-events: none; }
/* a sheet is open: notices go to the top so they never cover its buttons */
@media (max-width: 1023px) { body:has(.sheet:not([hidden])) .toasts { top: calc(var(--safe-t) + 10px); bottom: auto; flex-direction: column; } }
#sheetForm .sheet-grip { display: none; }
.toast { pointer-events: none; padding: 12px 14px; border-radius: 14px; background: rgba(23, 26, 35, .96); backdrop-filter: blur(12px);
  border: 1px solid var(--line-2); box-shadow: var(--shadow); font-size: 14px; display: flex; gap: 10px; align-items: flex-start; animation: down .25s ease-out; }
.toast::before { content: ''; width: 8px; height: 8px; margin-top: 6px; border-radius: 50%; background: var(--buy); flex: none; }
.toast.trade::before { background: var(--up); }
.toast.warning::before { background: var(--warn); }
.toast.error::before, .toast.breach::before { background: var(--down); }

@keyframes up { from { transform: translateY(100%); } }
@keyframes down { from { transform: translateY(-12px); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }

/* ================= desktop: Market Watch | chart | order, toolbox below ================= */
@media (min-width: 1024px) {
  body { font-size: 13px; }
  .only-desktop { display: revert !important; }
  .only-mobile { display: none !important; }
  .appbar { padding: 8px 16px; gap: 16px; min-height: 56px; }
  .appbar-brand { display: flex; }
  .appbar-title, .appbar-actions, .menu-btn, .drawer { display: none !important; }
  .acct-chip { display: flex; cursor: pointer; }
  .appbar-metrics { display: flex; gap: 22px; margin-left: auto; }
  .appbar-metrics div { display: flex; flex-direction: column; line-height: 1.25; }
  .appbar-metrics span { font-size: 11px; color: var(--muted); font-weight: 500; }
  .appbar-metrics b { font-size: 15px; font-weight: 700; }
  .tabbar { display: none; }

  .layout { display: grid; gap: 1px; background: var(--line);
    grid-template-columns: 380px minmax(0, 1fr) 320px;
    grid-template-rows: minmax(0, 1fr) 270px;
    grid-template-areas: 'quotes chart order' 'quotes tool tool'; }
  .view { display: flex !important; background: var(--bg); padding: 0; }
  .v-trade, .v-history, .v-messages, .v-account, .v-settings { display: none !important; }
  .v-quotes { grid-area: quotes; }
  .v-chart { grid-area: chart; }
  .v-order { grid-area: order; position: static; transform: none; border-radius: 0; border: 0; box-shadow: none; max-height: none; padding: 12px 14px; background: var(--bg); }
  .v-order .sheet-grip { display: none; }
  .view-head h2 { font-size: 15px; }

  /* Market Watch table */
  .q-tools { display: flex; align-items: center; gap: 2px; padding: 4px 6px 4px 12px; }
  .q-tools .icon-btn { width: 32px; height: 32px; }
  .q-tools svg { width: 18px; height: 18px; }
  .panel { top: 6vh; right: auto; bottom: auto; left: 50%; width: 480px; height: 84vh; transform: translateX(-50%); border: 1px solid var(--line-2); border-radius: 18px; box-shadow: var(--shadow); overflow: hidden; }
  .q-head, .q-row { display: grid; grid-template-columns: minmax(0, 1.2fr) 1fr 1fr 46px 60px; column-gap: 8px; align-items: center; }
  .q-head { padding: 6px 12px; font-size: 11px; font-weight: 600; color: var(--muted); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
    background: var(--bg); flex: none; }
  .v-quotes { overflow: hidden; }
  .quote-list { flex: 1; overflow-y: auto; }
  .q-head span:not(:first-child) { text-align: right; }
  .q-row { padding: 5px 12px; }
  .q-l, .q-meta { display: contents; }
  .q-sym { grid-column: 1; grid-row: 1; font-size: 13px; }
  .q-px { grid-row: 1; min-width: 0; }
  .q-px[data-f=bid] { grid-column: 2; }
  .q-px[data-f=ask] { grid-column: 3; }
  .q-px .p { font-size: 13px; }
  .q-px .p b { font-size: 13px; font-weight: 700; letter-spacing: 0; }
  .q-px .p sup { font-size: 10px; vertical-align: 4px; }
  .q-px small, .q-meta [data-f=time], .q-chg [data-f=pts] { display: none; }
  .q-spr { grid-column: 4; grid-row: 1; text-align: right; font-size: 12px; color: var(--muted); }
  .q-spr::before { content: none; }
  .q-chg { grid-column: 5; grid-row: 1; text-align: right; }
  .q-chg [data-f=pct] { margin: 0; }

  /* chart */
  .v-chart { padding: 0; }
  .v-chart { position: relative; }
  .chart-head { display: flex; padding: 8px 14px; border-bottom: 1px solid var(--line); }
  .trade-bar { position: absolute; z-index: 4; top: 96px; left: 12px; grid-template-columns: 104px 112px 104px; border: 0; border-radius: 10px; overflow: hidden; box-shadow: 0 8px 26px rgba(0, 0, 0, .55); }
  .tb-btn, .tb-lots { height: 48px; }
  .tb-btn > b b { font-size: 21px; }
  .tb-btn > b, .tb-lots input { font-size: 13px; }
  .tb-btn sup { font-size: 11px; }
  .tt .x { display: inline-grid; }
  .tb-lots { grid-template-columns: 26px 1fr 26px; }
  .tb-lots input { font-size: 14px; min-width: 0; }
  .chart-legend { top: 104px; left: 348px; }
  .chart-tools { width: 100%; flex-wrap: wrap; justify-content: flex-start; }
  .chart-tools .chips { flex: none; }
  .chips button { height: 28px; padding: 0 11px; font-size: 12px; }

  /* order ticket */
  .v-order input, .v-order select, .v-order .stepper { height: 38px; }
  .v-order .order-form { gap: 10px; }
  .v-order .segmented button { height: 30px; font-size: 12px; }
  .v-order .chips button { height: 26px; padding: 0 9px; font-size: 12px; }
  .v-order .btn-xl { height: 50px; }
  .v-order .btn-xl span { font-size: 10px; }
  .v-order .estimate { padding: 9px 12px; gap: 4px 12px; font-size: 12px; }
  .v-order .view-head { margin-bottom: 8px; }

  /* toolbox */
  .toolbox { grid-area: tool; display: flex; flex-direction: column; min-height: 0; background: var(--bg); }
  .tool-tabs { display: flex; align-items: center; gap: 2px; padding: 0 8px; border-bottom: 1px solid var(--line); background: var(--bg-2); flex: none; }
  .tool-tabs button { height: 34px; padding: 0 14px; font-size: 12px; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; }
  .tool-tabs button.active { color: var(--text); border-bottom-color: var(--buy); }
  .tool-tabs select { margin-left: auto; width: auto; height: 26px; font-size: 12px; padding: 0 30px 0 10px; background-position: calc(100% - 16px) 11px, calc(100% - 11px) 11px; }
  .tool-pane { flex: 1; min-height: 0; overflow: auto; }
  .tool-pane > div { padding: 8px 12px; }
  .desk-rules { flex-direction: row; flex-wrap: wrap; }
  .desk-rules .rule { flex: 1 1 260px; }
  .desk-rules .rule-foot, .desk-rules .status-banner { flex-basis: 100%; }
  .grid { width: 100%; border-collapse: collapse; font-size: 12px; white-space: nowrap; }
  .grid th { position: sticky; top: 0; background: var(--bg); text-align: left; font-weight: 600; color: var(--muted); padding: 6px 10px; border-bottom: 1px solid var(--line); z-index: 1; }
  .grid td { padding: 5px 10px; border-bottom: 1px solid var(--line); }
  .grid .num { text-align: right; }
  .grid tbody tr { cursor: default; }
  .grid tbody tr[data-pos]:hover, .grid tbody tr[data-ord]:hover { background: var(--surface); cursor: pointer; }
  .grid .buy { color: var(--buy); }
  .grid .sell { color: var(--down); }
  .grid tr.sum td { background: var(--bg-2); color: var(--text-2); font-weight: 600; }
  .grid tr.sum b { color: var(--text); margin-right: 18px; }
  .grid .x { width: 26px; text-align: center; color: var(--muted); font-size: 15px; line-height: 1; }
  .grid .x:hover { color: var(--down); }
  .grid .empty-row td { color: var(--muted); text-align: center; padding: 16px; }

  .sheet { left: 50%; right: auto; bottom: auto; top: 50%; width: min(440px, calc(100vw - 32px)); transform: translate(-50%, -50%);
    border-radius: 20px; border-bottom: 1px solid var(--line-2); animation: pop .2s ease-out; padding: 20px; }
  .sheet .sheet-grip { display: none; }
  .toasts { left: auto; right: 18px; top: 70px; bottom: auto; width: 360px; }
  @keyframes pop { from { transform: translate(-50%, -48%); opacity: 0; } }
}
@media (min-width: 1024px) and (max-height: 760px) {
  .layout { grid-template-rows: minmax(0, 1fr) 220px; }
}

/* ---------- MT5 accounts: list, find a server, log in ---------- */
.login { place-items: start center; }
.login-inner { gap: 16px; padding-top: max(8px, var(--safe-t)); }
.login-step { display: flex; flex-direction: column; gap: 14px; }
.login-step[hidden] { display: none; }
.login-head { display: grid; grid-template-columns: 40px 1fr 40px; align-items: center; min-height: 44px; }
.login-head h2 { margin: 0; text-align: center; font-size: 18px; font-weight: 700; }
.login-head .icon-btn:first-child:not([hidden]) ~ h2, .login-head h2 { grid-column: 2; }
.login-head > :last-child { grid-column: 3; justify-self: end; }
.login-step .login-brand { padding: 10px 0 4px; }
.login-step .login-brand h1 { font-size: 26px; margin: 10px 0 4px; }
.btn-ic { width: 18px; height: 18px; margin-right: 6px; vertical-align: -3px; }
.acct-list { display: flex; flex-direction: column; gap: 8px; }
.acct-item, .srv-company, .srv-card { display: flex; align-items: center; gap: 12px; padding: 12px 10px 12px 14px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); cursor: pointer; }
.acct-item.on { border-color: var(--buy); }
.acct-item.busy { opacity: .55; pointer-events: none; }
.acct-item .logo, .srv-company .logo, .srv-card .logo { width: 38px; height: 38px; flex: none; }
.acct-item > span, .srv-company > span, .srv-card > span, .srv-item > span { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.acct-item b, .srv-company b, .srv-card b { font-size: 15px; }
.acct-item small, .srv-company small, .srv-card small, .srv-item small { font-size: 12.5px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-item small.muted { color: var(--muted); }
.acct-item .icon-btn { color: var(--muted); }
.login-search { height: 46px; }
.srv-results { display: flex; flex-direction: column; border-radius: 14px; overflow: hidden; }
.srv-company { cursor: default; border-radius: 14px 14px 0 0; border-bottom: 0; }
.srv-results .empty { background: var(--surface); border-radius: 14px; }
.srv-item { display: flex; align-items: center; gap: 12px; padding: 13px 14px 13px 64px; background: var(--surface); border: 1px solid var(--line); border-top: 0; text-align: left; }
.srv-item:last-child { border-radius: 0 0 14px 14px; }
.srv-item b { font-size: 15px; font-weight: 600; }
.srv-item svg { width: 18px; height: 18px; transform: rotate(180deg); color: var(--muted); flex: none; }
.srv-item:active, .acct-item:active { background: var(--surface-2); }
.srv-card { cursor: default; }
.login-sub { margin: 0; font-weight: 700; font-size: 15px; }
.check-row { display: flex; align-items: center; gap: 10px; font-size: 14px; cursor: pointer; }
.check-row input { display: none; }
.check-row i { width: 20px; height: 20px; border-radius: 5px; border: 2px solid var(--line-2); display: grid; place-items: center; }
.check-row input:checked + i { background: var(--buy); border-color: var(--buy); }
.check-row input:checked + i::after { content: ''; width: 5px; height: 10px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg) translate(-1px, -1px); }

/* ---------- login: brand panel (desktop) + form ---------- */
.login { display: grid; grid-template-columns: minmax(0, 1fr); place-items: stretch; padding: 0; }
.login-pane { position: relative; min-width: 0; display: flex; flex-direction: column; align-items: center; min-height: 100vh; min-height: 100dvh; padding: calc(18px + var(--safe-t)) 16px calc(12px + var(--safe-b)); }
.login-pane .login-inner { flex: 1; width: min(440px, 100%); padding-top: 10px; }
.login-hero { display: none; }
.signin-title { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 6px; margin: 0 0 4px; }
.signin-title h1 { margin: 6px 0 0; font-size: 26px; font-weight: 800; letter-spacing: -.02em; }
.signin-title p { margin: 0; color: var(--muted); font-size: 14px; max-width: 330px; }
.srv-pick { display: flex; align-items: center; gap: 12px; width: 100%; padding: 9px 14px 9px 9px; border-radius: var(--radius-sm); background: var(--bg-2); border: 1px solid var(--line-2); text-align: left; transition: border-color .15s; }
.srv-pick:hover { border-color: var(--muted); }
.srv-pick .logo { width: 34px; height: 34px; }
.srv-pick span { display: flex; flex-direction: column; flex: 1; min-width: 0; line-height: 1.25; }
.srv-pick b { font-size: 15px; }
.srv-pick small { color: var(--muted); font-size: 12.5px; }
.srv-pick em { font-style: normal; font-size: 13px; font-weight: 600; color: var(--buy); }
.input-ic { position: relative; display: block; }
.input-ic > svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--muted); pointer-events: none; }
.input-ic input { padding-left: 42px; }
.input-ic:focus-within > svg { color: var(--buy); }
.input-ic input[name=password] { padding-right: 46px; }
.eye { position: absolute; right: 5px; top: 50%; transform: translateY(-50%); width: 36px; height: 36px; display: grid; place-items: center; color: var(--muted); border-radius: 9px; }
.eye:hover { color: var(--text); background: var(--surface-2); }
.eye svg { width: 19px; height: 19px; }
.caps { color: var(--warn); font-size: 12px; font-weight: 600; }
#signinBtn.busy span::before { content: ''; display: inline-block; width: 15px; height: 15px; margin-right: 9px; vertical-align: -2px; border: 2px solid rgba(255, 255, 255, .4);
  border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.shake { animation: shake .35s; }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
.login .hint a { color: var(--buy); font-weight: 600; text-decoration: none; }
.login-foot { display: flex; gap: 18px; justify-content: center; padding: 18px 0 4px; color: var(--muted); font-size: 12px; }
.login-foot span { display: inline-flex; align-items: center; gap: 6px; }
.login-foot svg { width: 14px; height: 14px; }
.hero-brand { display: flex; align-items: center; gap: 10px; font-size: 17px; }
.hero-brand b { font-weight: 800; }
.hero-brand span { color: var(--muted); font-size: 13px; }
.hero-copy h1 { margin: 0; font-size: clamp(32px, 3vw, 46px); line-height: 1.08; letter-spacing: -.03em; font-weight: 800; }
.hero-copy h1 span { display: inline-block; margin-top: 8px; font-size: .5em; letter-spacing: -.01em; font-weight: 700;
  background: linear-gradient(90deg, #7aa7ff, #2962ff 45%, #7cd3ff); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero-copy p { margin: 16px 0 0; color: var(--text-2); font-size: 16px; max-width: 520px; }
.hero-points { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 16px; }
.hero-points li { display: flex; gap: 14px; align-items: center; }
.hp-ic { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: rgba(41, 98, 255, .12); color: var(--brand); flex: none; }
.hp-ic svg { width: 19px; height: 19px; }
.hero-points li > span:last-child { display: flex; flex-direction: column; }
.hero-points small { color: var(--muted); font-size: 13px; }
.hero-risk { margin: auto 0 0; color: var(--muted); font-size: 12px; }
@media (min-width: 1024px) {
  .login { grid-template-columns: minmax(460px, 1.15fr) minmax(460px, 1fr); }
  .login-hero { display: flex; flex-direction: column; gap: 32px; padding: 40px 56px; position: relative; z-index: 1; min-height: 100vh; min-height: 100dvh; border-right: 1px solid var(--line);
    background: radial-gradient(900px 520px at 0% 0%, rgba(41, 98, 255, .17), transparent 60%), radial-gradient(700px 520px at 100% 100%, rgba(47, 123, 255, .11), transparent 60%), rgba(9, 10, 14, .55); }
  .login-pane { justify-content: center; padding: 40px 32px 16px; }
  .login-pane .login-inner { flex: 0 1 auto; }
  .login-foot { position: absolute; bottom: 14px; left: 0; right: 0; }
  .only-phone { display: none; }
}

/* ---------- History: sliding Positions / Orders / Deals switch, list in the middle, totals at the bottom ---------- */
.v-history { overflow: hidden; }
.seg-wrap { flex: none; padding: 10px 14px 8px; }
.seg { position: relative; display: grid; grid-template-columns: repeat(3, 1fr); padding: 4px; border-radius: 14px;
  background: var(--bg-2); border: 1px solid var(--line); isolation: isolate; }
.seg button { position: relative; z-index: 1; height: 36px; border-radius: 10px; font-size: 13.5px; font-weight: 700; color: var(--muted); transition: color .25s; }
.seg button.active { color: #fff; }
.seg-pill { position: absolute; z-index: 0; top: 4px; bottom: 4px; left: 4px; width: calc((100% - 8px) / 3); border-radius: 10px;
  background: linear-gradient(180deg, #4b8fff, var(--buy)); box-shadow: 0 6px 18px rgba(47, 123, 255, .35), inset 0 1px 0 rgba(255, 255, 255, .18);
  transition: transform .38s cubic-bezier(.3, 1.35, .45, 1); }
.seg[data-on=orders] .seg-pill { transform: translateX(100%); }
.seg[data-on=deals] .seg-pill { transform: translateX(200%); }
.h-active { flex: none; display: flex; gap: 6px; padding: 0 14px 8px; overflow-x: auto; scrollbar-width: none; }
.h-active[hidden] { display: none; }
.h-active .chip.on { color: var(--buy); border-color: rgba(47, 123, 255, .45); background: rgba(47, 123, 255, .1); }
.h-active .chip.on svg { color: var(--buy); }
.h-list { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; border-top: 1px solid var(--line); }
.h-list.anim-next .row { animation: h-in-r .42s cubic-bezier(.2, .8, .2, 1) both; animation-delay: calc(var(--i, 0) * 26ms); }
.h-list.anim-prev .row { animation: h-in-l .42s cubic-bezier(.2, .8, .2, 1) both; animation-delay: calc(var(--i, 0) * 26ms); }
.h-list.anim-fade .row { animation: h-in-up .38s ease-out both; animation-delay: calc(var(--i, 0) * 22ms); }
.h-list[class*=anim-] .empty { animation: h-in-up .35s ease-out both; }
@keyframes h-in-r { from { opacity: 0; transform: translateX(26px); } }
@keyframes h-in-l { from { opacity: 0; transform: translateX(-26px); } }
@keyframes h-in-up { from { opacity: 0; transform: translateY(10px); } }
@media (prefers-reduced-motion: reduce) { .h-list .row, .seg-pill { animation: none !important; transition: none !important; } }
.h-sum { flex: none; margin: 8px 12px 0; padding: 12px 14px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line-2);
  box-shadow: 0 -10px 24px rgba(0, 0, 0, .25); }
.h-sum-top { display: flex; align-items: baseline; justify-content: space-between; padding-bottom: 8px; margin-bottom: 8px; border-bottom: 1px solid var(--line); }
.h-sum-top span { font-size: 13px; font-weight: 700; color: var(--text-2); text-transform: uppercase; letter-spacing: .06em; }
.h-sum-top b { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; }
.h-sum-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 5px 18px; }
.h-sum-grid div { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; min-width: 0; }
.h-sum-grid span { color: var(--muted); }
.h-sum-grid b { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
#histSymBtn.on { color: var(--buy); position: relative; }
#histSymBtn.on::after { content: ''; position: absolute; top: 8px; right: 8px; width: 7px; height: 7px; border-radius: 50%; background: var(--buy); }
.sheet h3.sheet-ic { display: flex; align-items: center; gap: 8px; }
.sheet h3.sheet-ic svg { width: 20px; height: 20px; color: var(--buy); }
.pick svg { width: 18px; height: 18px; color: var(--buy); }
.u-tabs { display: flex; border-bottom: 1px solid var(--line); flex: none; }
.u-tabs button { flex: 1; height: 44px; font-size: 13px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); position: relative; }
.u-tabs button.active { color: var(--text); }
.u-tabs button.active::after { content: ''; position: absolute; left: 22%; right: 22%; bottom: -1px; height: 2px; border-radius: 2px; background: var(--buy); }
.h-filters { display: flex; gap: 6px; padding: 8px 12px; overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid var(--line); flex: none; }
.h-filters::-webkit-scrollbar { display: none; }
.chip { flex: none; display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border-radius: 99px; font-size: 12.5px; font-weight: 600; color: var(--text-2); background: var(--surface); border: 1px solid var(--line-2); }
.chip svg { width: 14px; height: 14px; color: var(--muted); }
.chip i { font-style: normal; color: var(--buy); }
.v-history .row[data-hist] { cursor: pointer; }
.v-history .row.open { background: var(--surface); }
.r-state.filled { color: var(--text-2); }
.r-state.canceled { color: var(--muted); text-decoration: line-through; }
td.r-state.canceled { text-decoration: none; }
.custom-range { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.custom-range input { color-scheme: inherit; }
.pick i { font-style: normal; color: var(--buy); }
.tool-sp { flex: 1; }
#deskHistTab, #deskHistSym, #deskPeriod { margin-left: 6px !important; }
.tt .pl { position: static; font-weight: 700; font-size: 11px; margin-left: 2px; }
.tt .pl.up { color: var(--up); }
.tt .pl.down { color: var(--down); }

/* ---------- one-click panel toggle and the round chart menu ---------- */
#viewActions #typeBtn { display: none; }
#tradeBarBtn.on, #crossBtn.on { color: var(--buy); }
.trade-bar[hidden] { display: none; }
.wheel { position: absolute; z-index: 8; width: 0; height: 0; }
.wheel[hidden] { display: none; }
.w-disc { position: absolute; left: -96px; top: -96px; width: 192px; height: 192px; border-radius: 50%;
  background: radial-gradient(circle, rgba(10, 12, 17, .55) 0 40%, rgba(10, 12, 17, .82) 41% 100%); backdrop-filter: blur(3px);
  border: 1px solid var(--line-2); animation: w-pop .16s ease-out; }
.w-item, .w-center { position: absolute; display: grid; place-items: center; border-radius: 50%; color: var(--text); }
.w-item { left: -22px; top: -22px; width: 44px; height: 44px; background: var(--surface-3); border: 1px solid var(--line-2); box-shadow: 0 4px 14px rgba(0, 0, 0, .45);
  transform: translate(var(--x), var(--y)); animation: w-in .2s ease-out backwards; animation-delay: var(--d); align-content: center; gap: 1px; }
.w-item svg { width: 17px; height: 17px; }
.w-item b { font-size: 12px; font-weight: 800; }
.w-item small { font-size: 7.5px; font-weight: 600; color: var(--text-2); line-height: 1; }
.w-item.on { color: var(--buy); border-color: var(--buy); }
.w-item.cur { background: var(--buy); border-color: var(--buy); color: #fff; }
.w-item:active { transform: translate(var(--x), var(--y)) scale(.92); }
.w-center { left: -19px; top: -19px; width: 38px; height: 38px; background: var(--brand); box-shadow: 0 4px 16px rgba(41, 98, 255, .4); }
.w-center svg { width: 17px; height: 17px; }
[data-ring=tf] .w-item { width: 40px; height: 40px; left: -20px; top: -20px; }
@keyframes w-pop { from { transform: scale(.6); opacity: 0; } }
@keyframes w-in { from { transform: translate(0, 0) scale(.4); opacity: 0; } }
:root[data-theme=light] .w-disc { background: radial-gradient(circle, rgba(255, 255, 255, .5) 0 40%, rgba(255, 255, 255, .85) 41% 100%); }
.icon-group [data-tradebar].on { color: var(--buy); }

/* ---------- phones: the MT5 iOS look (black, floating glass tab bar and controls, grouped Settings) ---------- */
.h-scroll { display: flex; flex-direction: column; flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.h-period { align-self: center; font-size: 12.5px; color: var(--muted); padding: 2px 10px 8px; }
.glass-btn { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 50%; color: var(--text); }
.glass-btn svg { width: 22px; height: 22px; }
.t-empty, .v-settings { display: none; }
.dot-count.red { background: #ff3b30; }
@media (max-width: 1023px) {
  :root { --tabbar-h: 72px; --glass: rgba(38, 38, 41, .6); --glass-2: rgba(255, 255, 255, .13); --glass-line: rgba(255, 255, 255, .1);
    --ios-blue: #0a84ff; --card: #1c1c1e; --card-line: rgba(84, 84, 88, .5); }
  :root:not([data-theme=light]) { --bg: #000; }
  :root[data-theme=light] { --glass: rgba(250, 250, 252, .72); --glass-2: rgba(0, 0, 0, .08); --glass-line: rgba(0, 0, 0, .08); --ios-blue: #007aff; --card: #fff; --card-line: rgba(60, 60, 67, .2); }
  body { font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Inter', system-ui, sans-serif; }
  .glass-btn, .tabbar, .seg { background: var(--glass); border: 1px solid var(--glass-line); -webkit-backdrop-filter: blur(22px) saturate(180%); backdrop-filter: blur(22px) saturate(180%);
    box-shadow: 0 8px 26px rgba(0, 0, 0, .4), inset 0 1px 0 rgba(255, 255, 255, .07); }

  /* title bar: centred title, no line, no menu (Settings is a tab) */
  .appbar { border-bottom: 0; min-height: calc(52px + var(--safe-t)); padding: var(--safe-t) 8px 0; }
  .appbar .appbar-title { position: absolute; left: 70px; right: 70px; top: var(--safe-t); bottom: 0; align-items: center; pointer-events: none; }
  .appbar .appbar-title h1, .appbar.centered .appbar-title h1 { font-size: 17px; font-weight: 600; }
  .menu-btn { display: none; }
  .appbar[data-view=messages] .menu-btn, .appbar[data-view=account] .menu-btn { display: grid; }
  .appbar[data-view=history] { display: none; }
  .appbar[data-view=quotes] .appbar-actions .icon-btn, .appbar[data-view=trade] #newOrderBtn { width: 44px; height: 44px; border-radius: 50%; color: var(--text);
    background: var(--glass); border: 1px solid var(--glass-line); -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); }
  .appbar[data-view=quotes] #editSymBtn { position: absolute; left: 8px; top: calc(var(--safe-t) + 4px); }
  .appbar[data-view=chart] .appbar-actions { flex: 1; margin-left: 0; }
  .appbar[data-view=chart] #tfBtn { order: -1; margin-right: auto; font-size: 17px; color: var(--text); }
  .appbar[data-view=chart] #tradeBarBtn { margin-left: auto; }

  /* floating glass tab bar */
  .tabbar { left: 14px; right: 14px; bottom: calc(var(--safe-b) + 8px); height: 62px; padding: 5px; border-radius: 31px; }
  .tabbar button { border-radius: 26px; color: var(--text); font-size: 10.5px; font-weight: 500; gap: 2px; transition: background .25s, color .25s; }
  .tabbar svg { width: 25px; height: 25px; }
  .tabbar button.active { background: var(--glass-2); color: var(--ios-blue); }
  .dot-count { top: 2px; }
  .view { padding-bottom: calc(var(--tabbar-h) + var(--safe-b) + 14px); }

  /* history: glass sort button, Positions | Orders | Deals capsule, clock; rows on black, TP / SL bar on the left */
  .v-history { position: relative; padding: 0; }
  .seg-wrap { position: absolute; z-index: 6; top: calc(var(--safe-t) + 8px); left: 12px; right: 12px; padding: 0; display: grid;
    grid-template-columns: 46px minmax(0, 1fr) 46px; align-items: center; gap: 10px; pointer-events: none; }
  .seg-wrap > * { pointer-events: auto; }
  .glass-btn.on { color: var(--ios-blue); }
  .seg { justify-self: center; width: 100%; max-width: 310px; border-radius: 25px; padding: 4px; }
  .seg button { height: 40px; border-radius: 21px; font-size: 15.5px; font-weight: 500; color: var(--text); }
  .seg button.active { color: var(--text); }
  .seg-pill { border-radius: 21px; background: var(--glass-2); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08); }
  .h-scroll { padding: calc(var(--safe-t) + 64px) 0 calc(var(--tabbar-h) + var(--safe-b) + 14px); }
  .h-list { flex: none; overflow: visible; border-top: 0; }
  .v-history .row { position: relative; border-bottom: 0; }
  .v-history .r-main { padding: 5px 16px; }
  .v-history .row.open { background: var(--card); }
  .row.hl-tp::before, .row.hl-sl::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: #34c759; }
  .row.hl-sl::before { background: #ff3b30; }
  .v-history .r-title, .v-trade .r-title { font-size: 16.5px; }
  .v-history .r-sub, .v-history .r-time, .v-trade .r-sub { font-size: 15px; color: #8e8e93; margin-top: 1px; }
  .v-history .r-pl, .v-trade .r-pl { font-size: 17px; font-weight: 600; }
  .r-title .buy, .r-pl.up { color: var(--ios-blue); }
  .r-title .sell, .r-pl.down { color: #ff453a; }
  .h-sum { margin: 16px 0 0; padding: 0 16px; background: none; border: 0; border-radius: 0; box-shadow: none; }
  .h-sum div { display: flex; justify-content: space-between; font-size: 17px; line-height: 1.6; }
  .h-sum b { font-weight: 400; font-variant-numeric: tabular-nums; }
  .h-active { padding: 0 16px 8px; }

  /* trade: plain lines, big icon when nothing is open */
  .v-trade .kv { border-bottom: 0; padding: 4px 16px 10px; }
  .v-trade .kv-row { font-size: 16.5px; line-height: 1.7; }
  .v-trade .kv-row span { color: var(--text); }
  .v-trade .kv-row i { visibility: hidden; }
  .v-trade .kv-row b { font-weight: 400; }
  .v-trade .sec-head { background: none; border: 0; text-transform: none; letter-spacing: 0; font-size: 15px; font-weight: 600; color: #8e8e93; padding: 12px 16px 4px; }
  .v-trade .sec-head[hidden] { display: none; }
  .v-trade .row, .v-messages .row { border-bottom: 0; }
  .v-trade:has(#posList:empty):has(#ordList:empty) .t-empty { display: grid; flex: 1; place-items: center; color: var(--text); }
  .t-empty svg { width: 150px; height: 150px; margin-bottom: 70px; }

  /* settings: iOS grouped cards with coloured icons */
  .layout[data-active=settings] .v-settings { display: flex; }
  .v-settings { flex-direction: column; gap: 26px; padding: 8px 16px calc(var(--tabbar-h) + var(--safe-b) + 18px); }
  .set-card { background: var(--card); border-radius: 26px; overflow: hidden; flex: none; }
  .set-head { position: relative; display: flex; flex-direction: column; align-items: center; gap: 3px; width: 100%; padding: 18px 44px 16px; text-align: center; }
  .set-head b { font-size: 19px; font-weight: 500; margin-bottom: 3px; }
  .set-head span { font-size: 15px; }
  .set-head .set-plan { color: #8e8e93; font-size: 13.5px; display: flex; align-items: center; gap: 6px; }
  .set-head em { font-style: normal; }
  .set-head .chev { position: absolute; right: 16px; top: 50%; margin-top: -10px; }
  .chev { width: 20px; height: 20px; color: #6d6d72; flex: none; }
  .ms-row { display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 16px; align-items: center; width: 100%; padding-left: 16px; text-align: left; cursor: pointer; }
  .ms-row:active { background: rgba(255, 255, 255, .05); }
  .set-ic { width: 40px; height: 40px; border-radius: 10px; background: var(--c); display: grid; place-items: center; color: #fff; }
  .set-ic svg { width: 24px; height: 24px; }
  .set-body { display: flex; align-items: center; gap: 10px; min-height: 66px; min-width: 0; padding: 9px 16px 9px 0; border-top: 1px solid var(--card-line); }
  .set-card > .ms-row:first-child .set-body { border-top: 0; }
  .set-txt { flex: 1; display: flex; flex-direction: column; min-width: 0; }
  .set-txt b { font-size: 18px; font-weight: 400; }
  .set-txt small { font-size: 15.5px; color: #8e8e93; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .ms-row[data-set=logout] b { color: #ff453a; }
  .set-badge { min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; background: #ff3b30; color: #fff; font: 700 12px/22px var(--font); font-style: normal; text-align: center; }
  .ms-sw input { display: none; }
  .ms-sw i { display: block; width: 51px; height: 31px; border-radius: 99px; background: rgba(120, 120, 128, .32); position: relative; transition: background .2s; }
  .ms-sw i::after { content: ''; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .3); transition: transform .2s; }
  .ms-sw input:checked + i { background: #34c759; }
  .ms-sw input:checked + i::after { transform: translateX(20px); }
  .v-account .card, .v-account .rules .rule { background: var(--card); border-color: transparent; }
}

/* ---------- pending-order line tag; compact one-click panel and History totals at the bottom on phones ---------- */
.pend-tag { position: absolute; z-index: 5; left: 8px; top: 0; display: flex; align-items: center; gap: 6px; height: 28px; pointer-events: none; font: 500 12px/1 Roboto, var(--font); }
.pend-tag[hidden] { display: none; }
.pend-tag b { padding: 5px 7px; border-radius: 5px; background: #ffb020; color: #111; font-weight: 700; }
.pend-tag span { color: var(--chart-ink, var(--text)); text-shadow: 0 0 3px var(--chart-bg, var(--bg)); }
.pend-tag button { pointer-events: auto; height: 26px; padding: 0 10px; border-radius: 6px; color: #fff; font-weight: 600; font-size: 12px; box-shadow: 0 3px 10px rgba(0, 0, 0, .4); }
.pend-tag button.buy { background: #1c6fe8; }
.pend-tag button.sell { background: #e8343e; }
.pend-tag button.x { width: 26px; padding: 0; background: rgba(120, 120, 128, .55); }
[data-pendline].on { color: #ffb020 !important; }
@media (max-width: 1023px) {
  .trade-bar { position: absolute; z-index: 4; top: 6px; left: 8px; grid-template-columns: 84px 82px 84px; border: 0; border-radius: 9px; overflow: hidden;
    box-shadow: 0 6px 20px rgba(0, 0, 0, .5); }
  .tb-btn, .tb-lots { height: 40px; }
  .tb-btn span { font-size: 9px; }
  .tb-btn > b { font-size: 11px; }
  .tb-btn > b b { font-size: 17px; }
  .tb-btn sup { font-size: 9px; }
  .tb-lots { grid-template-columns: 22px 1fr 22px; }
  .tb-lots input { font-size: 13px; min-width: 0; }
  .tb-lots svg { width: 11px; height: 11px; }
  .v-chart:has(.trade-bar:not([hidden])) .chart-sym { top: 52px; }
  .v-chart:has(.trade-bar:not([hidden])) .chart-legend { top: 92px; }
  .h-sum { margin-top: auto; padding-top: 16px; }
}

/* ---------- phones: full-width one-click panel, type sized like the MT5 iOS app ---------- */
@media (max-width: 1023px) {
  body { font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', Roboto, 'Segoe UI', system-ui, sans-serif; }
  .trade-bar { position: static; grid-template-columns: 1fr 96px 1fr; border-radius: 0; box-shadow: none; border-bottom: 1px solid var(--line); }
  .tb-btn, .tb-lots { height: 46px; }
  .tb-btn span { font-size: 10px; }
  .tb-btn > b { font-size: 13px; }
  .tb-btn > b b { font-size: 21px; }
  .tb-btn sup { font-size: 11px; }
  .tb-lots input { font-size: 15px; }
  .v-chart:has(.trade-bar:not([hidden])) .chart-sym { top: 6px; }
  .v-chart:has(.trade-bar:not([hidden])) .chart-legend { top: 46px; }

  .appbar .appbar-title h1, .appbar.centered .appbar-title h1 { font-size: 16px; }
  .tabbar button { font-size: 10px; }
  .tabbar svg { width: 23px; height: 23px; }
  .seg button { font-size: 14.5px; }
  .v-history .r-title, .v-trade .r-title { font-size: 15px; letter-spacing: -.01em; }
  .v-history .r-title b, .v-trade .r-title b { font-weight: 700; }
  .v-history .r-sub, .v-history .r-time, .v-trade .r-sub { font-size: 13.5px; }
  .v-history .r-pl, .v-trade .r-pl { font-size: 15.5px; font-weight: 600; }
  .v-history .r-main { padding: 4px 16px; }
  .h-sum div { font-size: 15.5px; line-height: 1.55; }
  .v-trade .kv-row { font-size: 15px; line-height: 1.6; }
  .set-head b { font-size: 17px; }
  .set-head span { font-size: 14px; }
  .set-txt b { font-size: 16px; }
  .set-txt small { font-size: 14px; }
  .set-ic { width: 34px; height: 34px; border-radius: 8px; }
  .set-ic svg { width: 21px; height: 21px; }
  .ms-row { grid-template-columns: 34px minmax(0, 1fr); gap: 14px; }
  .set-body { min-height: 58px; }
  .v-messages .r-title { font-size: 15px; }
  .v-messages .r-sub { font-size: 13.5px; }
}

/* ---------- phones: liquid-glass sheets, iOS buttons and fields, no period line in History ---------- */
@media (max-width: 1023px) {
  .h-period { display: none; }
  .h-scroll { padding-top: calc(var(--safe-t) + 70px); }
  .backdrop { background: rgba(0, 0, 0, .38); backdrop-filter: none; }
  .sheet, .v-order { left: 8px; right: 8px; bottom: calc(8px + var(--safe-b)); border-radius: 32px; padding: 8px 18px 20px;
    background: rgba(30, 30, 33, .78); border: 1px solid var(--glass-line); -webkit-backdrop-filter: blur(34px) saturate(180%); backdrop-filter: blur(34px) saturate(180%);
    box-shadow: 0 20px 60px rgba(0, 0, 0, .6), inset 0 1px 0 rgba(255, 255, 255, .08); }
  .v-order { transform: translateY(calc(100% + 24px)); }
  .v-order.open { transform: none; }
  :root[data-theme=light] .sheet, :root[data-theme=light] .v-order { background: rgba(250, 250, 252, .82); }
  .sheet-grip { width: 36px; background: rgba(255, 255, 255, .22); }
  .sheet h3 { font-size: 17px; font-weight: 600; letter-spacing: 0; }
  .sheet .sub { font-size: 14px; color: #8e8e93; }
  .btn { border-radius: 16px; font-weight: 600; box-shadow: none; }
  .btn-buy { background: var(--ios-blue); }
  .btn-sell { background: #ff453a; }
  .btn-brand { background: var(--ios-blue); box-shadow: none; }
  .btn-ghost { background: var(--glass-2); border: 0; color: var(--text); }
  .pick-list { gap: 0; border-radius: 16px; overflow: hidden; background: rgba(118, 118, 128, .14); }
  .pick { border-radius: 0; background: none; font-weight: 400; font-size: 16px; padding: 14px 16px; }
  .pick + .pick { border-top: 1px solid var(--card-line); }
  .pick.active { outline: 0; color: var(--ios-blue); }
  .sheet > .pick { border-radius: 16px; background: rgba(118, 118, 128, .14); }
  .sheet input, .sheet select, .v-order input, .v-order select, .v-order .stepper, .sheet .stepper, .estimate {
    background: rgba(118, 118, 128, .16); border-color: transparent; border-radius: 12px; }
  .v-order .stepper input { background: none; }
  .toast { border-radius: 22px; background: rgba(38, 38, 41, .72); border: 1px solid var(--glass-line); -webkit-backdrop-filter: blur(24px) saturate(180%); backdrop-filter: blur(24px) saturate(180%); }
  .v-account .card, .v-account .rules .rule { border-radius: 22px; }
  .q-row { border-bottom-color: rgba(84, 84, 88, .3); }
}

/* MT5 does not dim a closed market: a small "Market closed" line under the symbol info instead */
.chart-closed { top: auto; right: auto; bottom: auto; left: auto; left: 14px; top: 64px; display: block; background: none !important; font: 400 11px Roboto, var(--font); color: var(--chart-fg, var(--muted)); }
.chart-closed[hidden] { display: none; }
@media (min-width: 1024px) { .chart-closed { top: 122px; left: 348px; } }
@media (max-width: 1023px) { .tb-btn.sell { background: #ff453a; } .tb-btn.buy { background: var(--ios-blue); } .tb-lots { background: #000; } }

/* MT5: OHLC on the symbol's line, the description under it, then "Market closed" */
.chart-sym { max-width: calc(100% - 90px); }
.cs-top { display: flex; align-items: baseline; gap: 6px; max-width: 100%; min-width: 0; }
.cs-top b { flex: none; }
.chart-sym .chart-legend { position: static !important; font: 400 12px Roboto, var(--font); color: var(--chart-ink, var(--text)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.chart-legend[hidden] { display: none; }
.chart-closed { top: 44px; left: 14px; }
@media (min-width: 1024px) { .chart-closed { top: 44px; left: 14px; } }
.chart-sym { max-width: calc(100% - 76px); left: 6px; }
.chart-sym b { font-size: 13px; }
.cs-top { gap: 5px; }
.chart-sym .chart-legend { font-size: 11px; letter-spacing: -.01em; }
.chart-closed, .chart-closed[style] { left: 10px; top: 40px; }
@media (min-width: 1024px) { .chart-closed { left: 10px; top: 40px; } }

/* ---------- demo accounts: form on the login screen, DEMO marks in the terminal ---------- */
.demo-sizes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.demo-size { padding: 11px 6px; border-radius: var(--radius-sm); background: var(--bg-2); border: 1px solid var(--line-2); font-weight: 600; font-size: 14px; color: var(--text-2); }
.demo-size.on { border-color: var(--buy); color: var(--text); box-shadow: inset 0 0 0 1px var(--buy); }
.demo-facts { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--muted); }
.demo-facts span { display: flex; flex-direction: column; gap: 3px; }
.demo-facts b { color: var(--text); font-size: 13px; font-weight: 600; }
#demoBtn.busy span::before { content: ''; display: inline-block; width: 15px; height: 15px; margin-right: 9px; vertical-align: -2px; border: 2px solid rgba(255, 255, 255, .4);
  border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
.demo-creds { gap: 4px; }
.demo-cred { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.demo-cred span { width: 80px; color: var(--muted); font-size: 13px; }
.demo-cred b { flex: 1; font: 600 16px/1.2 ui-monospace, Menlo, Consolas, monospace; word-break: break-all; }
.demo-cred .icon-btn svg { width: 18px; height: 18px; }
.demo-pill { display: inline-block; margin-left: 6px; padding: 2px 6px; border-radius: 5px; background: #ffb020; color: #111; font: 700 10px/1.3 var(--font); letter-spacing: .04em; font-style: normal; vertical-align: 2px; }
.demo-tag { position: absolute; z-index: 5; left: 52px; bottom: 36px; padding: 3px 7px; border-radius: 5px; background: rgba(255, 176, 32, .16); border: 1px solid rgba(255, 176, 32, .55);
  color: #ffb020; font: 700 11px/1.2 var(--font); letter-spacing: .06em; pointer-events: none; }
.demo-tag[hidden] { display: none; }
.status-banner.demo { background: rgba(255, 176, 32, .1); border-color: rgba(255, 176, 32, .35); color: #ffd28a; }
[data-theme=light] .status-banner.demo { color: #8a5a00; }

/* ---------- login, modern: compact, black with blue / teal light, Log in | Demo account tabs ---------- */
.login { --l-accent: #0a84ff; --l-card: rgba(20, 22, 28, .66); --l-line: rgba(255, 255, 255, .08); --l-field: rgba(255, 255, 255, .045);
  background: #050608; font-size: 14px; }
.login-glow { top: 0; right: 0; bottom: 0; left: 0; height: auto; filter: none; background:
  radial-gradient(520px 340px at 12% -4%, rgba(10, 132, 255, .2), transparent 70%),
  radial-gradient(460px 320px at 100% 8%, rgba(43, 184, 164, .13), transparent 70%),
  radial-gradient(620px 380px at 50% 112%, rgba(41, 98, 255, .09), transparent 70%); }
.login-glow::after { content: ''; position: absolute; top: 0; right: 0; bottom: 0; left: 0; opacity: .35;
  background-image: linear-gradient(rgba(255, 255, 255, .025) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, .025) 1px, transparent 1px);
  background-size: 44px 44px; -webkit-mask-image: radial-gradient(ellipse at 50% 0%, #000 20%, transparent 70%); mask-image: radial-gradient(ellipse at 50% 0%, #000 20%, transparent 70%); }
.login-pane .login-inner { width: min(380px, 100%); gap: 14px; }
.login-step { gap: 12px; }
.login .logo-xl { width: 44px; height: 44px; filter: drop-shadow(0 8px 22px rgba(41, 98, 255, .35)); }
.signin-title { gap: 4px; margin: 4px 0 2px; }
.signin-title h1, .login-step .login-brand h1 { font-size: 21px; font-weight: 700; letter-spacing: -.015em; margin: 8px 0 0; }
.signin-title p, .login-brand p { font-size: 13px; color: #8b8f99; max-width: 300px; line-height: 1.45; }
.login-head { min-height: 36px; }
.login-head h2 { font-size: 16px; font-weight: 600; }

/* Log in | Demo account */
.auth-seg { display: grid; grid-template-columns: 1fr 1fr; padding: 3px; border-radius: 12px; background: rgba(118, 118, 128, .16); border: 1px solid var(--l-line); }
.auth-seg[hidden] { display: none; }
.auth-seg button { height: 32px; border-radius: 9px; font-size: 13px; font-weight: 600; color: #a1a5ae; transition: background .15s, color .15s; }
.auth-seg button.on { background: rgba(255, 255, 255, .12); color: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .4); }
.auth-seg button:not(.on):hover { color: #fff; }

.login .login-card, .login .card.login-card { padding: 16px; gap: 13px; border-radius: 18px; background: var(--l-card); border: 1px solid var(--l-line);
  -webkit-backdrop-filter: blur(24px) saturate(160%); backdrop-filter: blur(24px) saturate(160%); box-shadow: 0 24px 60px rgba(0, 0, 0, .45), inset 0 1px 0 rgba(255, 255, 255, .05); }
.login .field { gap: 6px; }
.login .field > span { font-size: 11.5px; font-weight: 500; color: #8b8f99; letter-spacing: .01em; }
.login input { height: 42px; font-size: 14px; border-radius: 11px; background: var(--l-field); border-color: var(--l-line); }
.login input:focus { border-color: var(--l-accent); background: rgba(10, 132, 255, .06); box-shadow: 0 0 0 3px rgba(10, 132, 255, .15); }
.login .input-ic > svg { left: 13px; width: 16px; height: 16px; }
.login .input-ic input { padding-left: 38px; }
.login .input-ic:focus-within > svg { color: var(--l-accent); }
.login .eye { width: 32px; height: 32px; }
.login .eye svg { width: 17px; height: 17px; }
.login .srv-pick { padding: 7px 12px 7px 7px; gap: 10px; border-radius: 11px; background: var(--l-field); border-color: var(--l-line); }
.login .srv-pick .logo { width: 28px; height: 28px; }
.login .srv-pick b { font-size: 13.5px; font-weight: 600; }
.login .srv-pick small { font-size: 11.5px; }
.login .srv-pick em { font-size: 12.5px; color: var(--l-accent); }
.login .check-row { font-size: 13px; color: #c7cad1; gap: 9px; }
.login .check-row i { width: 18px; height: 18px; }
.login .check-row input:checked + i { background: var(--l-accent); border-color: var(--l-accent); }
.login .btn { border-radius: 12px; }
.login .btn-lg { height: 44px; font-size: 14.5px; font-weight: 600; }
.login .btn-brand { background: var(--l-accent); box-shadow: 0 6px 20px rgba(10, 132, 255, .28); }
.login .btn-brand:hover { filter: brightness(1.08); }
.login .btn-ghost { background: rgba(255, 255, 255, .06); border: 1px solid var(--l-line); color: #e6e7ea; }
.login .form-error { font-size: 12.5px; min-height: 0; }
.login .form-error:empty { display: none; }
.login .hint { font-size: 12px; color: #6f7480; }
.login .hint a { color: var(--l-accent); font-weight: 500; }
.login-foot { font-size: 11px; padding: 14px 0 2px; color: #5d626d; }

/* demo form and saved accounts in the same style */
.login .demo-sizes { gap: 6px; }
.login .demo-size { padding: 9px 4px; border-radius: 10px; font-size: 13px; background: var(--l-field); border-color: var(--l-line); }
.login .demo-size.on { border-color: var(--l-accent); color: #fff; background: rgba(10, 132, 255, .12); box-shadow: none; }
.login .demo-facts { padding: 10px 12px; border-radius: 11px; background: rgba(255, 255, 255, .03); border: 1px solid var(--l-line); font-size: 11px; }
.login .demo-facts b { font-size: 12.5px; }
.login .demo-cred b { font-size: 14px; }
.login .demo-cred span { font-size: 12px; width: 72px; }
.login .acct-item, .login .srv-company, .login .srv-item, .login .srv-results .empty { background: var(--l-card); border-color: var(--l-line); }
.login .acct-item { padding: 10px 8px 10px 12px; border-radius: 14px; }
.login .acct-item .logo, .login .srv-company .logo { width: 32px; height: 32px; }
.login .acct-item b, .login .srv-company b, .login .srv-item b { font-size: 14px; font-weight: 600; }
.login .acct-item small, .login .srv-item small, .login .srv-company small { font-size: 12px; }
.login .acct-item.on { border-color: var(--l-accent); }
.login .login-search { height: 42px; border-radius: 12px; }

@media (min-width: 1024px) {
  .login { grid-template-columns: minmax(440px, 1.1fr) minmax(440px, 1fr); }
  .login-hero { gap: 26px; padding: 36px 52px; border-right-color: var(--l-line);
    background: radial-gradient(700px 460px at 0% 0%, rgba(10, 132, 255, .13), transparent 60%), radial-gradient(600px 460px at 100% 100%, rgba(43, 184, 164, .08), transparent 60%), rgba(8, 9, 12, .5); }
  .hero-brand { font-size: 15px; }
  .hero-brand .logo { width: 28px; height: 28px; }
  .hero-copy h1 { font-size: clamp(28px, 2.4vw, 36px); font-weight: 700; letter-spacing: -.025em; }
  .hero-copy h1 span { font-size: .52em; font-weight: 600; background: linear-gradient(90deg, #5fb0ff, #2bb8a4); -webkit-background-clip: text; background-clip: text; }
  .hero-copy p { font-size: 14px; color: #8b8f99; max-width: 460px; margin-top: 12px; }
  .hero-points { gap: 12px; }
  .hero-points b { font-size: 13px; font-weight: 600; }
  .hero-points small { font-size: 12px; }
  .hp-ic { width: 32px; height: 32px; border-radius: 10px; background: rgba(10, 132, 255, .12); color: #5fb0ff; }
  .hp-ic svg { width: 16px; height: 16px; }
  .hero-risk { font-size: 11px; color: #5d626d; }
  .login-pane .login-inner { width: 360px; }
}

/* ---------- login, polish: drawn chart in the brand panel, glowing card, entrance motion ---------- */
.hero-art { position: relative; max-width: 560px; padding: 18px 18px 14px; border-radius: 20px; border: 1px solid var(--l-line);
  background: linear-gradient(180deg, rgba(20, 22, 28, .7), rgba(12, 13, 18, .55)); box-shadow: 0 30px 60px -30px rgba(10, 132, 255, .35); overflow: hidden; }
.hero-art svg { display: block; width: 100%; height: 150px; overflow: visible; }
.ha-grid path { stroke: rgba(255, 255, 255, .05); stroke-width: 1; fill: none; }
.ha-fill { fill: url(#haFill); opacity: 0; animation: haFade 1.2s .9s ease-out forwards; }
.ha-line { fill: none; stroke: url(#haLine); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1; stroke-dashoffset: 1;
  filter: drop-shadow(0 6px 14px rgba(41, 98, 255, .55)); animation: haDraw 1.8s .2s cubic-bezier(.6, 0, .2, 1) forwards; }
.ha-dot { fill: #2bb8a4; opacity: 0; transform-box: fill-box; transform-origin: center; animation: haFade .3s 1.9s forwards, haPulse 2s 2.2s ease-in-out infinite; }
.hero-stats { display: flex; gap: 10px; margin-top: 12px; }
.hero-stats span { flex: 1; display: flex; flex-direction: column; gap: 1px; padding: 10px 12px; border-radius: 12px; background: rgba(255, 255, 255, .035); border: 1px solid var(--l-line); }
.hero-stats b { font-size: 17px; font-weight: 700; background: linear-gradient(90deg, #fff, #9cc4ff); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero-stats small { font-size: 11.5px; color: #8b8f99; }
@keyframes haDraw { to { stroke-dashoffset: 0; } }
@keyframes haFade { to { opacity: 1; } }
@keyframes haPulse { 0%, 100% { transform: scale(1); filter: drop-shadow(0 0 0 rgba(43, 184, 164, 0)); } 50% { transform: scale(1.35); filter: drop-shadow(0 0 8px rgba(43, 184, 164, .9)); } }

/* Glow behind the form card that slowly drifts, and a gradient hairline around it. */
.login-pane::before { content: ''; position: absolute; top: 18%; left: 50%; width: min(520px, 110vw); height: 420px; transform: translateX(-50%); pointer-events: none;
  background: radial-gradient(closest-side, rgba(10, 132, 255, .18), transparent 70%); animation: glowDrift 9s ease-in-out infinite alternate; }
@keyframes glowDrift { from { transform: translate(-56%, -10px) scale(.95); } to { transform: translate(-44%, 20px) scale(1.05); } }
.login .login-card { position: relative; box-shadow: 0 24px 60px -24px rgba(0, 0, 0, .8), 0 0 0 1px rgba(255, 255, 255, .02) inset; }
.login .login-card::before { content: ''; position: absolute; inset: -1px; border-radius: inherit; padding: 1px; pointer-events: none;
  background: linear-gradient(140deg, rgba(10, 132, 255, .6), rgba(255, 255, 255, .04) 40%, rgba(43, 184, 164, .45));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; }
.login .logo-xl { animation: logoFloat 4s ease-in-out infinite; }
@keyframes logoFloat { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
.login .btn-brand { background: linear-gradient(135deg, #0a84ff, #2962ff); position: relative; overflow: hidden; }
.login .btn-brand::after { content: ''; position: absolute; top: 0; bottom: 0; left: -60%; width: 40%; transform: skewX(-20deg);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .25), transparent); animation: btnShine 4.5s 1.5s ease-in-out infinite; }
@keyframes btnShine { 0% { left: -60%; } 30%, 100% { left: 130%; } }
.login-step:not([hidden]) > * { animation: riseIn .5s cubic-bezier(.2, .7, .2, 1) both; }
.login-step:not([hidden]) > :nth-child(2) { animation-delay: .06s; }
.login-step:not([hidden]) > :nth-child(3) { animation-delay: .12s; }
.login-step:not([hidden]) > :nth-child(4) { animation-delay: .18s; }
.login-step:not([hidden]) > :nth-child(5) { animation-delay: .24s; }
.hero-copy, .hero-art, .hero-points li { animation: riseIn .7s cubic-bezier(.2, .7, .2, 1) both; }
.hero-art { animation-delay: .1s; }
.hero-points li:nth-child(1) { animation-delay: .25s; }
.hero-points li:nth-child(2) { animation-delay: .35s; }
.hero-points li:nth-child(3) { animation-delay: .45s; }
@keyframes riseIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .login *, .login *::before, .login *::after, .login-pane::before { animation: none !important; }
  .ha-line { stroke-dashoffset: 0; }
  .ha-fill, .ha-dot { opacity: 1; }
}

/* payout request (funded accounts) */
.payout-btn { width: 100%; margin-top: 4px; }
.payout-h { margin: 18px 0 6px; font-size: 13px; color: var(--muted); font-weight: 500; }
.payout-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.payout-row small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.payout-state { font-size: 12px; padding: 3px 8px; border-radius: 6px; background: var(--surface-2, rgba(255,255,255,.06)); white-space: nowrap; }
.payout-state.paid { color: #22c55e; } .payout-state.rejected { color: #f23f5d; } .payout-state.pending { color: #f5a524; }
.payout-close { width: 100%; margin-top: 16px; }

/* ---------- speed: taps act at once (no double-tap-zoom wait) ---------- */
button, a, label, input, select, .q-row { touch-action: manipulation; }

/* ---------- What's new ---------- */
.bell-btn { position: relative; color: var(--text-2); flex: none; }
.bell-btn svg { width: 22px; height: 22px; }
.badge { position: absolute; top: 8px; right: 8px; width: 9px; height: 9px; border-radius: 50%; background: var(--down); box-shadow: 0 0 0 2px var(--bg); }
.drawer-nav button { position: relative; }
.drawer-nav .badge { position: static; margin-left: auto; box-shadow: none; }
.bell-btn.ring svg { animation: bell-ring .9s ease 2; transform-origin: 50% 15%; }
@keyframes bell-ring { 0%, 100% { transform: rotate(0) } 20% { transform: rotate(14deg) } 40% { transform: rotate(-12deg) } 60% { transform: rotate(8deg) } 80% { transform: rotate(-4deg) } }
.upd-list { display: flex; flex-direction: column; gap: 12px; max-height: 60vh; overflow-y: auto; margin: 4px 0; }
.upd { padding: 14px; border-radius: 14px; background: var(--surface-2, rgba(255,255,255,.05)); border: 1px solid var(--line); }
.upd.new { border-color: rgba(41, 98, 255, .55); background: rgba(41, 98, 255, .08); }
.upd-head { display: flex; align-items: baseline; gap: 8px; }
.upd-head b { font-size: 15px; }
.upd-head small { margin-left: auto; color: var(--muted); font-size: 12px; white-space: nowrap; }
.upd-tag { font-size: 10.5px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; color: #fff; background: var(--brand); padding: 2px 6px; border-radius: 6px; }
.upd ul { margin: 8px 0 0; padding-left: 18px; color: var(--text-2); font-size: 13.5px; line-height: 1.45; }
.upd li + li { margin-top: 4px; }
.upd-ver { color: var(--muted); font-size: 12px; text-align: center; margin: 2px 0 0; }

/* New version ready: a bar above the tab bar until the trader updates or dismisses it. */
.update-bar { position: fixed; left: 12px; right: 12px; bottom: calc(var(--tabbar-h) + var(--safe-b) + 10px); z-index: 61; display: flex; align-items: center; gap: 10px;
  padding: 10px 8px 10px 14px; border-radius: 14px; background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; box-shadow: 0 14px 34px rgba(18, 56, 176, .45); }
.update-bar span { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.update-bar b { font-size: 14px; }
.update-bar small { font-size: 12px; opacity: .85; }
.update-bar .btn { background: #fff; color: var(--brand-2); font-weight: 700; }
.update-bar .icon-btn { color: #fff; width: 34px; height: 34px; }
.update-bar .icon-btn svg { width: 18px; height: 18px; }
@media (min-width: 1024px) { .update-bar { left: auto; right: 20px; bottom: 20px; width: 380px; } }
