/* OMNIVARX | أومنيفاركس — application styles (navy + gold; green = buy/profit, red = sell/loss).
   Mobile first. RTL by default with logical properties; English switches the document to LTR. */

/* ------------------------------------------------------------------ tokens */
:root {
  --font: "Segoe UI", "Noto Sans Arabic", "Noto Sans", Tahoma, "Geeza Pro", "Arial", sans-serif;
  --mono: "Cascadia Mono", "Consolas", "SFMono-Regular", "Menlo", monospace;
  --top-h: 56px;
  --bottom-h: 62px;
  --side-w: 248px;
  --r: 14px;
  --r-sm: 9px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --gold: #d4af37;
  --gold-2: #f0cf6b;
  --gold-ink: #0b1630;
  --buy: #22c55e;
  --sell: #ef4444;
  --warn: #f59e0b;
  --info: #38bdf8;
  --violet: #a78bfa;
}

:root,
[data-theme="dark"] {
  color-scheme: dark;
  --bg: #060d1e;
  --bg-2: #081329;
  --surface: #0b1630;
  --card: #0e1c3a;
  --card-2: #12234a;
  --line: rgba(148, 163, 184, .16);
  --line-2: rgba(148, 163, 184, .28);
  --text: #e8eef8;
  --text-2: #c4d0e3;
  --muted: #8b9cb8;
  --input: #0a1834;
  --hover: rgba(212, 175, 55, .08);
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  --buy-bg: rgba(34, 197, 94, .14);
  --sell-bg: rgba(239, 68, 68, .14);
  --warn-bg: rgba(245, 158, 11, .15);
  --info-bg: rgba(56, 189, 248, .13);
  --gold-bg: rgba(212, 175, 55, .14);
  --off-bg: rgba(148, 163, 184, .14);
  --pos: #34d399;
  --neg: #f87171;

  --ch-bg: #08122a;
  --ch-grid: rgba(148, 163, 184, .08);
  --ch-text: #8fa3bf;
  --ch-up: #22c55e;
  --ch-down: #ef4444;
  --ch-cross: rgba(212, 175, 55, .75);
  --ch-ema20: #38bdf8;
  --ch-ema50: #a78bfa;
  --ch-ema200: #f59e0b;
  --ch-vwap: #ec4899;
  --ch-bb: #64748b;
  --ch-entry: #d4af37;
  --ch-tp1: #86efac;
  --ch-tp2: #4ade80;
  --ch-tp3: #16a34a;
  --ch-sl: #f87171;
  --ch-bid: #d4af37;
  --ch-ask: #64748b;
  --ch-label-bg: #0f1e3d;
  --ch-label-text: #e5edf7;
  --ch-head: #e5edf7;
  --ch-sep: rgba(148, 163, 184, .2);
}

[data-theme="light"] {
  color-scheme: light;
  --gold: #a8841c;
  --gold-2: #c9a227;
  --gold-ink: #ffffff;
  --buy: #15803d;
  --sell: #dc2626;
  --warn: #b45309;
  --info: #0369a1;
  --bg: #eef2f8;
  --bg-2: #e6ecf5;
  --surface: #ffffff;
  --card: #ffffff;
  --card-2: #f5f7fb;
  --line: #dbe2ee;
  --line-2: #c5cfdf;
  --text: #0b1630;
  --text-2: #24324f;
  --muted: #5a6a86;
  --input: #f7f9fc;
  --hover: rgba(168, 132, 28, .08);
  --shadow: 0 10px 30px rgba(15, 30, 61, .12);
  --buy-bg: rgba(21, 128, 61, .1);
  --sell-bg: rgba(220, 38, 38, .1);
  --warn-bg: rgba(180, 83, 9, .1);
  --info-bg: rgba(3, 105, 161, .09);
  --gold-bg: rgba(168, 132, 28, .12);
  --off-bg: rgba(90, 106, 134, .12);
  --pos: #047857;
  --neg: #b91c1c;

  --ch-bg: #ffffff;
  --ch-grid: rgba(15, 30, 61, .07);
  --ch-text: #5a6a86;
  --ch-up: #16a34a;
  --ch-down: #dc2626;
  --ch-cross: rgba(168, 132, 28, .8);
  --ch-ema20: #0284c7;
  --ch-ema50: #7c3aed;
  --ch-ema200: #d97706;
  --ch-vwap: #db2777;
  --ch-bb: #94a3b8;
  --ch-entry: #a8841c;
  --ch-tp1: #22c55e;
  --ch-tp2: #16a34a;
  --ch-tp3: #166534;
  --ch-sl: #dc2626;
  --ch-bid: #a8841c;
  --ch-ask: #64748b;
  --ch-label-bg: #0b1630;
  --ch-label-text: #ffffff;
  --ch-head: #0b1630;
  --ch-sep: rgba(15, 30, 61, .14);
}

/* ------------------------------------------------------------------ base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
[hidden] { display: none !important; }
a { color: var(--gold); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
code { font-family: var(--mono); font-size: .92em; }
h1, h2, h3 { margin: 0; line-height: 1.3; }
p { margin: 0 0 .5em; }
svg { flex: none; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
::selection { background: var(--gold-bg); }

.num { font-variant-numeric: tabular-nums; }
span.num, b.num, code.num, small.num, strong.num, i.num, div.num, p.num { direction: ltr; unicode-bidi: isolate; }
td.num, th.num, dd.num { direction: ltr; text-align: right; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.small, small { font-size: 12px; }
.pos { color: var(--pos); }
.neg { color: var(--neg); }
.buy-t, .c-buy { color: var(--buy); }
.sell-t, .c-sell { color: var(--sell); }
.c-entry { color: var(--ch-entry) !important; }
.c-tp1 { color: var(--ch-tp1) !important; }
.c-tp2 { color: var(--ch-tp2) !important; }
.c-tp3 { color: var(--ch-tp3) !important; }
.c-sl { color: var(--ch-sl) !important; }
.err-text { color: var(--neg); }
.form-err { color: var(--neg); background: var(--sell-bg); border: 1px solid color-mix(in srgb, var(--sell) 40%, transparent); padding: 8px 12px; border-radius: var(--r-sm); margin: 8px 0; }
.noscript { padding: 24px; text-align: center; }

/* ------------------------------------------------------------------ wordmark + rights */
.wordmark { display: flex; flex-direction: column; align-items: center; gap: 2px; text-align: center; }
.wm-name {
  font-weight: 800; letter-spacing: .22em; font-size: 26px; direction: ltr;
  background: linear-gradient(180deg, var(--gold-2), var(--gold));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  padding-inline-start: .22em;
}
.wm-ar { font-size: 15px; color: var(--text-2); font-weight: 600; }
.wm-tag { font-size: 10.5px; letter-spacing: .24em; color: var(--muted); direction: ltr; }
.wordmark.xl .wm-name { font-size: clamp(30px, 8vw, 52px); }
.wordmark.xl .wm-ar { font-size: clamp(16px, 3.6vw, 22px); }
.wordmark.xl .wm-tag { font-size: clamp(10px, 2.4vw, 13px); }
.wordmark.sm .wm-name { font-size: 22px; }

.rights { text-align: center; font-size: 11.5px; color: var(--muted); line-height: 1.7; }
.rights > div { direction: ltr; unicode-bidi: plaintext; }
.rights .r-maker { color: var(--gold); font-weight: 600; }

/* ------------------------------------------------------------------ splash */
.splash {
  position: fixed; inset: 0; z-index: 100; display: grid; place-items: center;
  background: radial-gradient(1200px 600px at 50% 20%, #12264f 0%, #081329 55%, #050b19 100%);
  color: #e8eef8; transition: opacity .45s ease, visibility .45s;
  padding: 24px;
}
[data-theme="light"] .splash { background: radial-gradient(1200px 600px at 50% 20%, #ffffff 0%, #eef2f8 60%, #e3e9f3 100%); color: var(--text); }
.splash.out { opacity: 0; visibility: hidden; }
.splash-inner { display: flex; flex-direction: column; align-items: center; gap: 14px; max-width: 560px; text-align: center; }
.splash-bar { width: min(240px, 60vw); height: 3px; border-radius: 3px; background: rgba(148, 163, 184, .18); overflow: hidden; margin: 10px 0 4px; }
.splash-bar i { display: block; height: 100%; width: 40%; background: linear-gradient(90deg, transparent, var(--gold), transparent); animation: sweep 1.2s ease-in-out infinite; }
@keyframes sweep { 0% { transform: translateX(-120%); } 100% { transform: translateX(320%); } }
.splash-motto { font-size: 14px; letter-spacing: .08em; color: var(--gold-2); margin: 0; direction: ltr; }
[data-theme="light"] .splash-motto { color: var(--gold); }
.splash-dev { font-size: 11px; letter-spacing: .18em; color: #8b9cb8; margin: 0; direction: ltr; }
.splash .rights { margin-top: 18px; }

/* ------------------------------------------------------------------ auth */
.auth { min-height: 100dvh; background: radial-gradient(1000px 500px at 50% 0%, var(--card-2) 0%, var(--bg) 70%); }
.auth-wrap { min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; padding: calc(20px + var(--safe-t)) 16px calc(20px + var(--safe-b)); position: relative; }
.auth-tools { position: absolute; top: calc(12px + var(--safe-t)); inset-inline-end: 12px; display: flex; gap: 8px; }
.auth-card {
  width: min(440px, 100%); background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 26px 22px;
  box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 12px;
  border-top: 2px solid var(--gold);
}
.auth-card .wordmark { margin-bottom: 6px; }
.auth-title { font-size: 19px; text-align: center; }
.auth-sub { text-align: center; color: var(--muted); margin: 0; }
.auth-motto { text-align: center; color: var(--gold); font-size: 12.5px; letter-spacing: .06em; margin: 6px 0 0; direction: ltr; }
.auth-foot-btns { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.pass-wrap { position: relative; display: flex; }
.pass-wrap .inp { flex: 1; padding-inline-end: 64px; }
.pass-eye { position: absolute; inset-inline-end: 6px; top: 50%; transform: translateY(-50%); border: 0; background: transparent; color: var(--gold); font-size: 12px; padding: 4px 6px; }
.acct-list { display: flex; flex-direction: column; gap: 10px; max-height: 56dvh; overflow: auto; }
.acct-card { display: flex; gap: 12px; align-items: center; justify-content: space-between; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--card-2); }
.acct-card.pending { border-color: color-mix(in srgb, var(--warn) 55%, transparent); }
.acct-main { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.acct-login { font-weight: 700; font-size: 16px; }
.acct-meta, .acct-name { color: var(--muted); font-size: 12.5px; overflow-wrap: anywhere; }
.acct-badges { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.acct-act { display: flex; flex-direction: column; gap: 6px; flex: none; }
.acct-modal .acct-list { max-height: 60dvh; }
.empty-text { text-align: center; color: var(--muted); padding: 12px; }

/* ------------------------------------------------------------------ app shell */
.app { min-height: 100dvh; display: flex; flex-direction: column; }
.top {
  position: sticky; top: 0; z-index: 40; height: calc(var(--top-h) + var(--safe-t)); padding: var(--safe-t) 10px 0;
  display: flex; align-items: center; gap: 8px; background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: baseline; gap: 8px; text-decoration: none !important; flex: none; }
.brand-o { font-weight: 800; letter-spacing: .16em; font-size: 16px; direction: ltr; background: linear-gradient(180deg, var(--gold-2), var(--gold)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.brand-ar { color: var(--muted); font-size: 12px; font-weight: 600; }
.acct-chip {
  display: inline-flex; align-items: center; gap: 6px; min-width: 0; max-width: 240px; height: 32px; padding: 0 10px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--card); color: var(--text-2); font-size: 12px;
}
.acct-chip .ac-l { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-chip.wide { max-width: none; width: 100%; justify-content: center; height: 38px; }
.top-spacer { flex: 1; }
.clock { display: flex; flex-direction: column; align-items: flex-end; font-size: 11px; color: var(--muted); line-height: 1.25; }
.icon-btn {
  display: inline-grid; place-items: center; width: 36px; height: 36px; flex: none; border-radius: 10px;
  border: 1px solid var(--line); background: var(--card); color: var(--text-2); padding: 0;
}
.icon-btn:hover { border-color: var(--gold); color: var(--gold); }
.icon-btn svg { width: 18px; height: 18px; }
.lang-btn { font-weight: 700; font-size: 13px; }

.live-pill {
  display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 11px; border-radius: 999px; font-size: 12px; font-weight: 600;
  border: 1px solid var(--line); background: var(--card); white-space: nowrap; flex: none;
}
.live-pill i { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; }
.live-pill.lv-live { color: var(--buy); border-color: color-mix(in srgb, var(--buy) 45%, transparent); background: var(--buy-bg); }
.live-pill.lv-live i { background: var(--buy); box-shadow: 0 0 0 0 rgba(34, 197, 94, .6); animation: pulse 1.6s infinite; }
.live-pill.lv-stale { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 50%, transparent); background: var(--warn-bg); }
.live-pill.lv-stale i { background: var(--warn); }
.live-pill.lv-down { color: var(--sell); border-color: color-mix(in srgb, var(--sell) 50%, transparent); background: var(--sell-bg); }
.live-pill.lv-down i { background: var(--sell); }
.live-pill.lv-noea { color: var(--muted); }
.live-pill.lv-connecting { color: var(--info); background: var(--info-bg); }
.live-pill.lv-connecting i { background: var(--info); animation: blink 1s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, .55); } 70% { box-shadow: 0 0 0 7px rgba(34, 197, 94, 0); } 100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); } }
@keyframes blink { 50% { opacity: .3; } }

.banner {
  position: sticky; top: calc(var(--top-h) + var(--safe-t)); z-index: 35; display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; justify-content: center;
  padding: 7px 14px; font-size: 13px; font-weight: 600; text-align: center; border-bottom: 1px solid var(--line);
}
.banner.lv-stale { background: var(--warn-bg); color: var(--warn); }
.banner.lv-down { background: var(--sell-bg); color: var(--sell); }
.banner.lv-noea, .banner.lv-connecting { background: var(--off-bg); color: var(--text-2); }
.banner.lv-info { background: var(--gold-bg); color: var(--gold); }
[data-theme="dark"] .banner { backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.ban-acct { display: inline-flex; gap: 8px; align-items: center; color: var(--warn); }

.shell { flex: 1; display: grid; grid-template-columns: minmax(0, 1fr); min-height: 0; }
.side { display: none; }
.main { min-width: 0; padding: 14px 12px calc(var(--bottom-h) + var(--safe-b) + 18px); display: flex; flex-direction: column; gap: 14px; }
.view { min-width: 0; flex: 1; }
.foot { padding: 18px 8px 6px; border-top: 1px solid var(--line); margin-top: 8px; }

.bottom {
  position: fixed; inset-inline: 0; bottom: 0; z-index: 40; height: calc(var(--bottom-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-top: 1px solid var(--line);
}
.bn-a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-width: 0;
  color: var(--muted); font-size: 10.5px; border: 0; background: none; text-decoration: none !important; padding: 4px 2px;
}
.bn-a span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.bn-a svg { width: 22px; height: 22px; }
.bn-a.on { color: var(--gold); }
.bn-a.on svg { filter: drop-shadow(0 0 6px rgba(212, 175, 55, .45)); }

.side-nav { display: flex; flex-direction: column; gap: 4px; padding: 12px 10px; }
.side-group { display: flex; flex-direction: column; gap: 2px; }
.side-title { font-size: 11px; color: var(--muted); letter-spacing: .08em; padding: 14px 12px 6px; text-transform: uppercase; }
.nav-a {
  display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 10px; color: var(--text-2);
  text-decoration: none !important; font-size: 13.5px; border-inline-start: 3px solid transparent;
}
.nav-a svg { width: 18px; height: 18px; color: var(--muted); }
.nav-a:hover { background: var(--hover); }
.nav-a.on { background: var(--gold-bg); color: var(--gold); border-inline-start-color: var(--gold); font-weight: 600; }
.nav-a.on svg { color: var(--gold); }
.side-foot { padding: 10px 14px 16px; border-top: 1px solid var(--line); }
.side-user { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12.5px; }
.su-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.sheet { position: fixed; inset: 0; z-index: 60; background: rgba(3, 8, 20, .55); opacity: 0; transition: opacity .2s; display: flex; align-items: flex-end; justify-content: center; }
.sheet.in { opacity: 1; }
.sheet-panel {
  width: min(720px, 100%); max-height: 90dvh; overflow: auto; background: var(--surface); border: 1px solid var(--line); border-bottom: 0;
  border-radius: 20px 20px 0 0; padding: 14px 14px calc(18px + var(--safe-b)); transform: translateY(24px); transition: transform .2s;
  display: flex; flex-direction: column; gap: 12px;
}
.sheet.in .sheet-panel { transform: none; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; }
.sheet-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(102px, 1fr)); gap: 8px; }
.sheet-a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center; min-height: 78px;
  padding: 10px 6px; border-radius: 12px; background: var(--card); border: 1px solid var(--line); color: var(--text-2); font-size: 12px; text-decoration: none !important;
}
.sheet-a svg { width: 22px; height: 22px; color: var(--gold); }
.sheet-a.on { border-color: var(--gold); color: var(--gold); background: var(--gold-bg); }
.sheet-tools { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }

/* visibility helpers */
.only-wide { display: none !important; }
.hide-mob { display: none !important; }
@media (max-width: 420px) { .hide-xs { display: none !important; } }

/* ------------------------------------------------------------------ page + cards */
.page { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 10px 16px; }
.ph-title { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ph-title h1 { font-size: 20px; font-weight: 700; }
.ph-sub { font-size: 11.5px; letter-spacing: .12em; color: var(--gold); text-transform: uppercase; }
.ph-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); min-width: 0; display: flex; flex-direction: column; }
.card.bare { background: transparent; border: 0; }
.card.bare > .card-body { padding: 0; }
.card.pending { border-color: color-mix(in srgb, var(--warn) 55%, transparent); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 14px 0; flex-wrap: wrap; }
.card-head h2 { font-size: 14.5px; font-weight: 700; color: var(--text); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.card-head h2::before { content: ""; width: 4px; height: 14px; border-radius: 2px; background: var(--gold); }
.card-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.card-body { padding: 12px 14px 14px; min-width: 0; }
.grid { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); }
.span-2 { grid-column: 1 / -1; }
.stats { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 11px 13px; min-width: 0; }
.stat-l { font-size: 12px; color: var(--muted); }
.stat-v { font-size: 19px; font-weight: 700; margin-top: 2px; overflow-wrap: anywhere; direction: ltr; text-align: start; unicode-bidi: plaintext; }
.stat-s { font-size: 11.5px; color: var(--muted); margin-top: 4px; display: flex; flex-direction: column; gap: 4px; }
.stat.pos .stat-v { color: var(--pos); }
.stat.neg .stat-v { color: var(--neg); }
.sub-h { font-size: 13.5px; margin: 14px 0 6px; color: var(--text-2); }
.empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 26px 12px; color: var(--muted); text-align: center; }
.empty svg { width: 30px; height: 30px; color: var(--gold); opacity: .8; }
.empty p { margin: 0; max-width: 520px; }
.empty.locked svg { color: var(--muted); }
.notes { margin: 10px 0 0; padding-inline-start: 18px; color: var(--muted); font-size: 12.5px; }
.notes li { margin: 3px 0; }
.reason { margin: 6px 0 0; color: var(--text-2); font-size: 13px; line-height: 1.6; }
.rej-t { color: var(--neg); }
.warn-box { background: var(--sell-bg); color: var(--sell); border: 1px solid color-mix(in srgb, var(--sell) 40%, transparent); padding: 10px 12px; border-radius: 10px; font-weight: 600; }
.verify { padding: 9px 12px; border-radius: 10px; font-weight: 600; margin: 0; }
.verify.ok { background: var(--buy-bg); color: var(--pos); }
.verify.bad { background: var(--sell-bg); color: var(--neg); }
.row-btns { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 10px; }
.row-btns.end { justify-content: flex-end; }
.row-btns.center { justify-content: center; }
.btn-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.row-act { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.link-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.link-grid .btn { justify-content: flex-start; }

/* key/value */
.kv-grid { margin: 0; display: flex; flex-direction: column; }
.kv-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px dashed var(--line); min-width: 0; }
.kv-row:last-child { border-bottom: 0; }
.kv-row dt { color: var(--muted); font-size: 12.5px; flex: none; max-width: 48%; }
.kv-row dd { margin: 0; text-align: end; min-width: 0; overflow-wrap: anywhere; display: flex; flex-wrap: wrap; gap: 4px; justify-content: flex-end; align-items: center; }
.kv-row dd.num { justify-content: flex-end; }
table.kv { width: 100%; border-collapse: collapse; font-size: 13px; }
table.kv th { text-align: start; color: var(--muted); font-weight: 500; padding: 5px 0; }
table.kv td { text-align: end; padding: 5px 0; }
table.kv tr + tr { border-top: 1px dashed var(--line); }

/* ------------------------------------------------------------------ controls */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 38px; padding: 0 15px; border-radius: 10px;
  border: 1px solid var(--line-2); background: var(--card-2); color: var(--text); font-weight: 600; font-size: 13.5px; white-space: nowrap;
  text-decoration: none !important; transition: background .15s, border-color .15s, transform .05s;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn svg { width: 17px; height: 17px; }
.btn.sm { height: 32px; padding: 0 11px; font-size: 12.5px; border-radius: 9px; }
.btn.xs { height: 27px; padding: 0 9px; font-size: 12px; border-radius: 8px; gap: 5px; }
.btn.xs svg { width: 14px; height: 14px; }
.btn.big { height: 50px; font-size: 17px; letter-spacing: .06em; border-radius: 12px; }
.btn.block { width: 100%; }
.btn.primary { background: linear-gradient(180deg, var(--gold-2), var(--gold)); border-color: var(--gold); color: #0b1630; }
[data-theme="light"] .btn.primary { color: #ffffff; background: linear-gradient(180deg, #b8921f, #94730f); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.ghost { background: transparent; }
.btn.ghost:hover { border-color: var(--gold); color: var(--gold); }
.btn.gold { background: var(--gold-bg); border-color: color-mix(in srgb, var(--gold) 60%, transparent); color: var(--gold); }
.btn.danger { background: var(--sell); border-color: var(--sell); color: #fff; }
.btn.danger-ghost { background: transparent; border-color: color-mix(in srgb, var(--sell) 55%, transparent); color: var(--neg); }
.btn.danger-ghost:hover { background: var(--sell-bg); }
.btn.buy { background: var(--buy); border-color: var(--buy); color: #fff; }
.btn.sell { background: var(--sell); border-color: var(--sell); color: #fff; }
.btn.kill { width: 100%; height: 52px; background: linear-gradient(180deg, #ef4444, #b91c1c); border-color: #b91c1c; color: #fff; font-size: 15px; }
.btn.kill-off { width: 100%; height: 52px; background: var(--buy-bg); border-color: var(--buy); color: var(--pos); font-size: 15px; }
.link-btn { border: 0; background: none; color: var(--gold); padding: 0; }

.inp {
  height: 38px; padding: 0 11px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--input); color: var(--text);
  min-width: 0; font-size: 14px;
}
select.inp { padding-inline-end: 28px; }
.inp.sm { height: 32px; font-size: 13px; }
.inp:focus { border-color: var(--gold); outline: none; box-shadow: 0 0 0 3px var(--gold-bg); }
.inp[readonly] { opacity: .75; }
.inp.bad { border-color: var(--sell); }
input[type="search"].inp { min-width: 160px; }
.form { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); }
.fld { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.fld > span { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.fld.row { flex-direction: row; align-items: center; justify-content: space-between; }
.fld .hint { color: var(--muted); font-size: 11.5px; }
.form .form-err, .form .full, .form .warn-box { grid-column: 1 / -1; }
.radio, .check { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; font-size: 13px; }
.radio input, .check input { accent-color: var(--gold); width: 16px; height: 16px; }
.acct-pick { display: flex; flex-direction: column; gap: 6px; }
.acct-checks { display: flex; flex-direction: column; gap: 6px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; max-height: 180px; overflow: auto; }
.acct-checks.dim { opacity: .45; pointer-events: none; }

.switch { position: relative; display: inline-block; width: 44px; height: 24px; flex: none; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--off-bg); border: 1px solid var(--line-2); transition: background .15s; }
.switch span::after { content: ""; position: absolute; top: 2px; inset-inline-start: 2px; width: 18px; height: 18px; border-radius: 50%; background: var(--muted); transition: transform .15s, background .15s; }
.switch input:checked + span { background: var(--gold-bg); border-color: var(--gold); }
.switch input:checked + span::after { background: var(--gold); transform: translateX(20px); }
[dir="rtl"] .switch input:checked + span::after { transform: translateX(-20px); }
.switch input:focus-visible + span { outline: 2px solid var(--gold); outline-offset: 2px; }

.seg { display: inline-flex; flex-wrap: nowrap; border: 1px solid var(--line-2); border-radius: 10px; overflow: hidden; background: var(--input); max-width: 100%; }
.seg-b { border: 0; background: transparent; color: var(--text-2); padding: 0 11px; height: 32px; font-size: 12.5px; font-weight: 600; white-space: nowrap; display: inline-flex; align-items: center; gap: 5px; }
.seg-b + .seg-b { border-inline-start: 1px solid var(--line); }
.seg-b.on { background: var(--gold-bg); color: var(--gold); }
.seg-b svg { width: 15px; height: 15px; }
.seg-dir .seg-b { flex: 1; height: 40px; font-size: 14px; justify-content: center; }
.seg-dir { display: flex; width: 100%; }
.seg-dir .seg-b.buy.on { background: var(--buy); color: #fff; }
.seg-dir .seg-b.sell.on { background: var(--sell); color: #fff; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip {
  display: inline-flex; align-items: center; height: 26px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--line-2);
  background: var(--card-2); color: var(--text-2); font-size: 12px; font-family: var(--mono); text-decoration: none !important;
}
.chip:hover { border-color: var(--gold); color: var(--gold); }

/* ------------------------------------------------------------------ badges */
.badge {
  display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: 999px; font-size: 11.5px; font-weight: 700;
  background: var(--off-bg); color: var(--text-2); white-space: nowrap; line-height: 1; vertical-align: middle;
}
.badge.sm { height: 19px; font-size: 10.5px; padding: 0 7px; }
.badge svg { width: 12px; height: 12px; }
.badge small { font-weight: 500; opacity: .85; font-size: 10.5px; }
.badge.ok, .badge.cmd-acked, .badge.lv-live { background: var(--buy-bg); color: var(--pos); }
.badge.bad, .badge.cmd-failed, .badge.cmd-rejected, .badge.lv-down { background: var(--sell-bg); color: var(--neg); }
.badge.warn, .badge.cmd-expired, .badge.lv-stale { background: var(--warn-bg); color: var(--warn); }
.badge.off, .badge.lv-noea { background: var(--off-bg); color: var(--muted); }
.badge.cmd-queued, .badge.cmd-sent, .badge.lv-connecting { background: var(--info-bg); color: var(--info); }
.badge.gold, .badge.role { background: var(--gold-bg); color: var(--gold); }
.badge.role-owner { background: linear-gradient(180deg, var(--gold-2), var(--gold)); color: #0b1630; }
.badge.dir { letter-spacing: .05em; }
.badge.dir.buy, .badge.buy { background: var(--buy); color: #fff; }
.badge.dir.sell, .badge.sell { background: var(--sell); color: #fff; }
.badge.dir.wait, .badge.wait { background: var(--off-bg); color: var(--muted); }
.badge.mode-demo { background: var(--info-bg); color: var(--info); }
.badge.mode-real { background: var(--gold-bg); color: var(--gold); }
.badge.mode-contest { background: rgba(167, 139, 250, .16); color: var(--violet); }
.badge.stage { background: var(--off-bg); }
.st-early { background: rgba(56, 189, 248, .15) !important; color: var(--info) !important; }
.st-pre { background: rgba(167, 139, 250, .17) !important; color: var(--violet) !important; }
.st-confirmed { background: var(--gold-bg) !important; color: var(--gold) !important; }
.st-executed { background: var(--buy-bg) !important; color: var(--pos) !important; }
.st-closed { background: var(--off-bg) !important; color: var(--text-2) !important; }
.st-rejected, .st-cancelled { background: var(--sell-bg) !important; color: var(--neg) !important; }
.st-expired { background: var(--off-bg) !important; color: var(--muted) !important; }
.ds { display: inline-flex; align-items: center; height: 19px; padding: 0 6px; border-radius: 5px; font-size: 10px; font-weight: 800; letter-spacing: .05em; font-family: var(--mono); border: 1px solid currentColor; }
.ds-ok { color: var(--pos); }
.ds-alias { color: var(--info); }
.ds-estimated { color: var(--warn); }
.ds-unsupported { color: var(--neg); }
.ds-nodata { color: var(--muted); }
.ds-line { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.rg-trend, .rg-trending { background: var(--buy-bg) !important; color: var(--pos) !important; }
.rg-range, .rg-ranging { background: var(--info-bg) !important; color: var(--info) !important; }
.rg-volatile, .rg-chaos, .rg-high_vol { background: var(--sell-bg) !important; color: var(--neg) !important; }
.lvl-info { --lc: var(--info); }
.lvl-warn, .lvl-warning { --lc: var(--warn); }
.lvl-danger, .lvl-critical, .lvl-error { --lc: var(--sell); }
.q-badges { display: inline-flex; flex-wrap: wrap; gap: 4px; justify-content: flex-end; }

/* meters */
.meter { position: relative; height: 6px; border-radius: 4px; background: var(--off-bg); overflow: hidden; min-width: 40px; flex: 1; }
.meter i { position: absolute; inset-block: 0; inset-inline-start: 0; background: linear-gradient(90deg, var(--gold), var(--gold-2)); border-radius: 4px; }
.meter.buy i { background: var(--buy); }
.meter.sell i { background: var(--sell); }
.score-inline, .score-c { display: flex; align-items: center; gap: 8px; min-width: 110px; }
.score-c .meter { max-width: 120px; }

/* ------------------------------------------------------------------ tables */
.tbl-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: 10px; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: start; font-weight: 600; color: var(--muted); font-size: 12px; padding: 8px 10px; border-bottom: 1px solid var(--line-2); white-space: nowrap; background: var(--card); position: sticky; top: 0; z-index: 1; }
.tbl td { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tbody tr:hover td { background: var(--hover); }
.tbl.compact td, .tbl.compact th { padding: 6px 8px; }
.tbl tr.clickable { cursor: pointer; }
.tbl tr.past td { opacity: .55; }
.tbl.matrix td, .tbl.matrix th { text-align: center; }
.tbl.matrix tbody th { text-align: start; }
.mx { display: inline-flex; align-items: center; justify-content: center; font-size: 11.5px; }
.mx.ok svg { width: 18px; height: 18px; color: var(--pos); }
.mx.no { color: var(--muted); }
.mx.part { color: var(--warn); font-weight: 600; }
.detail-txt { color: var(--muted); font-family: var(--mono); word-break: break-word; }
.id-c b { font-family: var(--mono); color: var(--gold); }
.name-c { min-width: 200px; }
.name-c .sn { display: block; font-weight: 600; }
.name-c .sd { display: block; color: var(--muted); }

/* phone: tables become cards (label from data-label) */
@media (max-width: 680px) {
  .tbl thead { display: none; }
  .tbl, .tbl tbody, .tbl tr, .tbl td { display: block; width: 100%; }
  .tbl tr { border: 1px solid var(--line); border-radius: 12px; margin-bottom: 10px; padding: 6px 10px; background: var(--card-2); }
  .tbl td { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px dashed var(--line); text-align: end; min-height: 32px; }
  .tbl td:last-child { border-bottom: 0; }
  .tbl td::before { content: attr(data-label); color: var(--muted); font-size: 12px; font-weight: 600; text-align: start; flex: none; max-width: 45%; }
  [dir="rtl"] .tbl td.num { flex-direction: row-reverse; }
  .tbl td.num { text-align: left; }
  .tbl tbody tr:hover td { background: transparent; }
  .name-c { min-width: 0; }
  .score-c .meter { max-width: none; }
  .row-act { justify-content: flex-end; }
  .tbl.matrix thead { display: none; }
  .tbl.matrix tbody th { display: block; border-bottom: 1px solid var(--line); padding: 6px 0; }
  .tbl.matrix td { justify-content: space-between; text-align: end; }
}

/* phone: strategy rows as compact two-line cards */
@media (max-width: 680px) {
  .tbl.strat-tbl tr { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 9px 11px; }
  .tbl.strat-tbl td { display: inline-flex; width: auto; min-height: 0; padding: 0; border: 0; gap: 6px; align-items: center; }
  .tbl.strat-tbl td::before { display: none; }
  .tbl.strat-tbl td.id-c { order: 0; }
  .tbl.strat-tbl td.name-c { order: 1; flex: 1 1 calc(100% - 70px); flex-direction: column; align-items: flex-start; text-align: start; }
  .tbl.strat-tbl td.score-c { order: 2; flex: 1 1 100%; min-width: 0; }
  .tbl.strat-tbl td:not(.id-c):not(.name-c):not(.score-c) { order: 3; }
  .tbl.strat-tbl td.lbl-c::before { display: inline; content: attr(data-label); font-size: 11px; max-width: none; }
  .tbl.strat-tbl td[colspan] { flex: 1 1 100%; }
}

/* ------------------------------------------------------------------ modal + toast */
#modals { position: relative; z-index: 80; }
.modal-wrap { position: fixed; inset: 0; z-index: 80; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(3, 8, 20, .6); opacity: 0; transition: opacity .18s; }
.modal-wrap.in { opacity: 1; }
.modal {
  width: min(520px, 100%); max-height: calc(100dvh - 32px); display: flex; flex-direction: column; background: var(--surface);
  border: 1px solid var(--line-2); border-radius: 16px; box-shadow: var(--shadow); transform: translateY(10px) scale(.98); transition: transform .18s;
}
.modal.wide { width: min(780px, 100%); }
.modal-wrap.in .modal { transform: none; }
.modal.danger-modal { border-color: color-mix(in srgb, var(--sell) 60%, transparent); border-top: 3px solid var(--sell); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.modal-head h3 { font-size: 16px; }
.modal-body { padding: 16px; overflow: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 16px calc(12px + var(--safe-b)); border-top: 1px solid var(--line); flex-wrap: wrap; }
.confirm-msg { font-size: 14px; line-height: 1.7; margin: 0; }
@media (max-width: 560px) {
  .modal-wrap { align-items: flex-end; padding: 0; }
  .modal, .modal.wide { width: 100%; border-radius: 18px 18px 0 0; max-height: 92dvh; }
  .modal-foot .btn { flex: 1; }
}
.toasts { position: fixed; z-index: 90; inset-inline: 0; bottom: calc(var(--bottom-h) + var(--safe-b) + 10px); display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 12px; }
.toast {
  pointer-events: auto; max-width: min(560px, 100%); padding: 10px 14px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line-2);
  box-shadow: var(--shadow); font-size: 13px; font-weight: 600; opacity: 0; transform: translateY(8px); transition: opacity .2s, transform .2s;
  border-inline-start: 4px solid var(--info);
}
.toast.in { opacity: 1; transform: none; }
.toast-ok { border-inline-start-color: var(--buy); }
.toast-err { border-inline-start-color: var(--sell); }
.toast-warn { border-inline-start-color: var(--warn); }

.cmd-sum { display: flex; flex-direction: column; gap: 10px; }
.cmd-type { font-weight: 700; font-size: 15px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cmd-type code { color: var(--gold); font-size: 12px; }
.cmd-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cmd-form .fld.full { grid-column: 1 / -1; }
@media (max-width: 420px) { .cmd-form { grid-template-columns: minmax(0, 1fr); } }
.act-grid { display: flex; flex-direction: column; gap: 10px; }
.act-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 14px; }
.act-grid .btn { width: 100%; justify-content: flex-start; }

/* ------------------------------------------------------------------ live chart */
.chart-page { gap: 10px; }
.chart-toolbar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.chart-toolbar .sym-sel { min-width: 120px; font-weight: 700; }
.tf-seg { overflow-x: auto; scrollbar-width: none; }
.tf-seg::-webkit-scrollbar { display: none; }
.tf-seg .seg-b { padding: 0 9px; font-family: var(--mono); }
.tb-spacer { flex: 1; }
.tb-group { display: flex; gap: 6px; align-items: center; flex-wrap: nowrap; }
@media (max-width: 767px) {
  .chart-toolbar .sym-sel { flex: 1 1 120px; order: 0; }
  .chart-toolbar .tb-group { order: 1; }
  .chart-toolbar .tf-seg { flex: 1 1 100%; order: 2; }
  .chart-toolbar .tf-seg .seg-b { flex: 1 0 auto; justify-content: center; }
  .chart-toolbar .tb-spacer { display: none; }
  .chart-toolbar .tb-group:last-child { order: 3; flex: 1 1 100%; }
}
.chart-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.chart-box {
  position: relative; height: max(340px, calc(100dvh - var(--top-h) - var(--bottom-h) - 210px)); border: 1px solid var(--line); border-radius: var(--r);
  background: var(--ch-bg); overflow: hidden; touch-action: none;
}
.chart-host { position: absolute; inset: 0; }
.chart-host canvas { display: block; width: 100%; height: 100%; }
.stale-mark { position: absolute; inset: 0; pointer-events: none; display: none; border-radius: var(--r); }
body[data-live="stale"] .stale-mark { display: block; box-shadow: inset 0 0 0 2px var(--warn); background: repeating-linear-gradient(135deg, transparent 0 18px, rgba(245, 158, 11, .05) 18px 36px); }
body[data-live="down"] .stale-mark, body[data-live="noea"] .stale-mark { display: block; box-shadow: inset 0 0 0 2px var(--sell); background: repeating-linear-gradient(135deg, transparent 0 18px, rgba(239, 68, 68, .06) 18px 36px); }
.chart-side { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); align-content: start; }
.quote { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.q-cell { display: flex; flex-direction: column; gap: 2px; background: var(--card-2); border-radius: 10px; padding: 8px; min-width: 0; }
.q-cell span { font-size: 11px; color: var(--muted); }
.q-cell b { font-size: 16px; overflow: hidden; text-overflow: ellipsis; }
.q-bid { color: var(--ch-bid); }
.q-ask { color: var(--text-2); }
.q-time { margin-top: 6px; text-align: end; }
.mini-trend { display: flex; gap: 6px; margin-top: 10px; }
.mt { flex: 1; display: flex; flex-direction: column; align-items: center; padding: 5px 0; border-radius: 8px; background: var(--card-2); font-weight: 700; font-size: 13px; }
.mt small { font-size: 10px; color: var(--muted); font-weight: 600; font-family: var(--mono); }
.mt.buy { color: var(--buy); background: var(--buy-bg); }
.mt.sell { color: var(--sell); background: var(--sell-bg); }
.mt.wait { color: var(--muted); }
.score-row { display: flex; gap: 8px; align-items: center; margin-top: 10px; flex-wrap: wrap; }
.sc { font-weight: 700; font-size: 12.5px; padding: 3px 9px; border-radius: 8px; font-family: var(--mono); }
.sc.buy { color: var(--pos); background: var(--buy-bg); }
.sc.sell { color: var(--neg); background: var(--sell-bg); }
.sig-mini { display: flex; flex-direction: column; gap: 8px; }
.sm-head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.qt { display: flex; flex-direction: column; gap: 8px; }
.qt-main { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.qt-pend { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.qt-pend .btn { font-family: var(--mono); font-size: 11px; }
.pos-mini { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.pm-row { display: flex; align-items: center; gap: 8px; justify-content: space-between; padding: 6px 8px; background: var(--card-2); border-radius: 9px; font-size: 12.5px; flex-wrap: wrap; }
.layers-box { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.lay-g { border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px 10px; margin: 0; min-width: 0; }
.lay-g legend { color: var(--gold); font-weight: 700; font-size: 12.5px; padding: 0 6px; }
.lay-i { display: flex; align-items: center; gap: 8px; padding: 4px 0; font-size: 13px; cursor: pointer; }
.lay-i input { accent-color: var(--gold); width: 16px; height: 16px; }

/* ------------------------------------------------------------------ market intelligence */
.trend-matrix { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.tm-cell { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px; border-radius: 10px; background: var(--card-2); border: 1px solid var(--line); text-align: center; min-width: 0; }
.tm-cell.buy { background: var(--buy-bg); border-color: color-mix(in srgb, var(--buy) 35%, transparent); color: var(--pos); }
.tm-cell.sell { background: var(--sell-bg); border-color: color-mix(in srgb, var(--sell) 35%, transparent); color: var(--neg); }
.tm-cell.wait { color: var(--muted); }
.tm-tf { font-family: var(--mono); font-size: 11px; font-weight: 700; color: var(--text-2); }
.tm-ar { font-size: 18px; line-height: 1; }
.tm-tx { font-size: 11px; }
.intel-state { display: flex; flex-direction: column; gap: 2px; }
.is-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 0; border-bottom: 1px dashed var(--line); }
.is-row:last-child { border-bottom: 0; }
.is-row > span { color: var(--muted); font-size: 12.5px; }
.score-bars { display: flex; flex-direction: column; gap: 8px; }
.score-bars > div { display: flex; align-items: center; gap: 10px; }
.score-bars b { min-width: 34px; text-align: end; }
.pd-wrap { display: flex; flex-direction: column; gap: 6px; }
.pd-head { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--muted); }
.pd-track { position: relative; display: grid; grid-template-columns: 1fr 1fr 1fr; height: 30px; border-radius: 9px; overflow: hidden; font-size: 11px; font-weight: 700; }
.pd-track > span { display: grid; place-items: center; }
.pd-d { background: var(--buy-bg); color: var(--pos); }
.pd-eq { background: var(--off-bg); color: var(--muted); }
.pd-p { background: var(--sell-bg); color: var(--neg); }
.pd-dot { position: absolute; top: 3px; bottom: 3px; width: 4px; margin-left: -2px; border-radius: 3px; background: var(--gold); box-shadow: 0 0 0 2px var(--card); }
.ranges { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; margin-top: 12px; }
.rg { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; border-radius: 10px; background: var(--card-2); }
.rg span { font-size: 11.5px; color: var(--muted); }

/* ------------------------------------------------------------------ strategies */
.strat-page { gap: 12px; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 10px; }
.filters .search, .filters input[type="search"] { flex: 1 1 200px; }
.cnt-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.cnt { display: inline-flex; gap: 6px; align-items: center; padding: 4px 10px; border-radius: 9px; font-size: 12px; font-weight: 700; font-family: var(--mono); }
.cnt.buy { background: var(--buy-bg); color: var(--pos); }
.cnt.sell { background: var(--sell-bg); color: var(--neg); }
.cnt.wait { background: var(--off-bg); color: var(--muted); }
.strat-table { min-width: 0; }
.g-tag { display: inline-grid; place-items: center; min-width: 22px; height: 20px; padding: 0 5px; border-radius: 6px; font-size: 11px; font-weight: 800; background: var(--gold-bg); color: var(--gold); font-family: var(--mono); }
.detail22 { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.d22-row { display: grid; grid-template-columns: minmax(120px, 38%) minmax(0, 1fr); border-bottom: 1px solid var(--line); }
.d22-row:last-child { border-bottom: 0; }
.d22-k { padding: 9px 10px; background: var(--card-2); color: var(--muted); font-size: 12.5px; font-weight: 600; display: flex; gap: 8px; align-items: flex-start; }
.d22-n { display: inline-grid; place-items: center; min-width: 20px; height: 20px; border-radius: 6px; background: var(--gold-bg); color: var(--gold); font-size: 10.5px; font-weight: 800; flex: none; }
.d22-v { padding: 9px 10px; min-width: 0; overflow-wrap: anywhere; display: flex; flex-direction: column; gap: 4px; justify-content: center; }
.d22-v .inp { max-width: 220px; }
.rej { font-size: 12.5px; color: var(--text-2); }
.sig-list { display: flex; flex-direction: column; gap: 6px; }
.sl-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12.5px; }
[dir="rtl"] .formula { text-align: right; }
.formula { display: block; font-family: var(--mono); font-size: 11px; color: var(--muted); font-weight: 400; margin-top: 2px; direction: ltr; text-align: start; unicode-bidi: plaintext; }

/* ------------------------------------------------------------------ signals / positions */
.sig-grid { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); }
.sig-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; display: flex; flex-direction: column; gap: 10px;
  border-inline-start: 4px solid var(--muted); min-width: 0;
}
.sig-card.dir-buy { border-inline-start-color: var(--buy); }
.sig-card.dir-sell { border-inline-start-color: var(--sell); }
.sig-card.active { box-shadow: 0 0 0 1px color-mix(in srgb, var(--gold) 30%, transparent); }
.sc-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sc-sym { font-size: 16px; }
.sc-id { margin-inline-start: auto; color: var(--muted); font-family: var(--mono); font-size: 12px; }
.pipe { display: flex; gap: 3px; flex-wrap: wrap; }
.pp { flex: 1; text-align: center; font-size: 10px; font-weight: 700; font-family: var(--mono); padding: 4px 2px; border-radius: 6px; background: var(--off-bg); color: var(--muted); min-width: 58px; }
.pp.done { background: var(--gold-bg); color: var(--gold); }
.pp.cur { background: var(--gold); color: #0b1630; }
.pipe.term .pp.end { background: var(--sell-bg); color: var(--neg); }
.sc-levels { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.sc-levels > div { display: flex; flex-direction: column; gap: 1px; padding: 6px; border-radius: 8px; background: var(--card-2); min-width: 0; }
.sc-levels span { font-size: 10.5px; color: var(--muted); font-weight: 700; font-family: var(--mono); }
.sc-levels b { font-size: 13px; overflow: hidden; text-overflow: ellipsis; }
.sc-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12.5px; color: var(--muted); }
.sc-meta b { color: var(--text-2); }
.sc-out { padding: 6px 8px; border-radius: 8px; background: var(--card-2); }
.sc-shot img { width: 100%; height: auto; border-radius: 10px; border: 1px solid var(--line); cursor: zoom-in; }
.shot-full { width: 100%; height: auto; border-radius: 10px; }
@media (max-width: 420px) { .sc-levels { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.warn-list { display: flex; flex-direction: column; gap: 8px; }
.wl { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 12px; background: var(--card); border: 1px solid var(--line); border-inline-start: 4px solid var(--lc, var(--info)); }
.wl-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }

/* ------------------------------------------------------------------ risk */
.ladder { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }
.ld { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 10px; background: var(--card-2); border: 1px solid var(--line); font-size: 12.5px; }
.ld-n { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--off-bg); font-weight: 800; font-size: 11px; flex: none; }
.ld.past { opacity: .6; }
.ld.cur { border-color: var(--gold); background: var(--gold-bg); color: var(--gold); font-weight: 700; }
.ld.cur .ld-n { background: var(--gold); color: #0b1630; }
.ld.s0 .ld-n { color: var(--pos); }
.ld.s7 .ld-n, .ld.s8 .ld-n { color: var(--neg); }
.style-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.sty { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 9px 11px; border-radius: 10px; background: var(--card-2); }
.risk-ctl { display: flex; flex-direction: column; gap: 6px; }
.rc-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 7px 0; border-bottom: 1px dashed var(--line); flex-wrap: wrap; }
.kill-row { margin-top: 10px; }

/* ------------------------------------------------------------------ calendar */
.next-ev { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 14px; border-radius: 12px; background: var(--gold-bg); border: 1px solid color-mix(in srgb, var(--gold) 40%, transparent); }
.next-ev .cd { margin-inline-start: auto; font-size: 18px; font-weight: 800; color: var(--gold); }
.imp { display: inline-flex; gap: 3px; vertical-align: middle; }
.imp i { width: 8px; height: 8px; border-radius: 50%; background: var(--off-bg); }
.imp i.on { background: var(--muted); }
.imp-2 i.on { background: var(--warn); }
.imp-3 i.on { background: var(--sell); }
.cur { font-family: var(--mono); font-weight: 700; }
.ev-name { min-width: 180px; }
.cal-body { display: flex; flex-direction: column; gap: 12px; }

/* ------------------------------------------------------------------ sessions */
.ses-body { display: flex; flex-direction: column; gap: 14px; }
.ses-clock-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: stretch; }
.big-clock { display: flex; flex-direction: column; gap: 2px; padding: 10px 16px; border-radius: 12px; background: var(--card); border: 1px solid var(--line); min-width: 140px; }
.big-clock span { font-size: 12px; color: var(--muted); }
.big-clock b { font-size: 24px; color: var(--gold); }
.weekend { display: flex; align-items: center; gap: 6px; padding: 10px 14px; border-radius: 12px; background: var(--warn-bg); color: var(--warn); font-weight: 600; flex-wrap: wrap; }
.ses-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.ses-card { --c: var(--gold); background: var(--card); border: 1px solid var(--line); border-top: 3px solid var(--c); border-radius: var(--r); padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; }
.ses-card.closed { opacity: .82; }
.ses-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ses-top h3 { font-size: 15px; }
.ses-time { font-size: 26px; font-weight: 800; color: var(--text); }
.ses-date { font-size: 12.5px; color: var(--muted); }
.ses-meta { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; font-size: 12px; }
.ses-cd { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-top: 6px; border-top: 1px dashed var(--line); font-size: 12.5px; color: var(--muted); }
.ses-cd b { font-size: 16px; color: var(--c); }
.timeline { display: flex; flex-direction: column; gap: 8px; }
.tl-row { display: grid; grid-template-columns: 96px minmax(0, 1fr); align-items: center; gap: 10px; }
.tl-name { font-size: 12.5px; color: var(--text-2); }
.tl-track { position: relative; height: 18px; border-radius: 6px; background: var(--card-2); }
.tl-track.axis { background: transparent; height: 16px; }
.tl-seg { --c: var(--gold); position: absolute; top: 3px; bottom: 3px; border-radius: 4px; background: var(--c); opacity: .85; }
.tl-now { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--text); border-radius: 2px; }
.tl-tick { position: absolute; top: 0; transform: translateX(-50%); font-size: 10.5px; color: var(--muted); }

/* ------------------------------------------------------------------ performance + math */
.curve-box { position: relative; height: 240px; }
.curve-box canvas, .curve { display: block; width: 100%; height: 100%; }
.perf-body, .math-body, .intel-body, .risk-body, .acc-body, .pos-body, .ord-body, .warn-body, .sig-body, .sys-body, .adm-body, .set-body { display: flex; flex-direction: column; gap: 14px; min-width: 0; }

/* ------------------------------------------------------------------ health / admin */
.log-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; max-height: 420px; overflow: auto; font-size: 12.5px; }
.lg { display: grid; grid-template-columns: auto auto minmax(0, 1fr); gap: 8px; padding: 4px 6px; border-radius: 6px; align-items: baseline; }
.lg b { font-size: 10.5px; font-family: var(--mono); }
.lg-warn b { color: var(--warn); }
.lg-error b, .lg-err b { color: var(--neg); }
.lg-info b { color: var(--info); }
.mirror-box { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; padding: 40px 16px; border: 1px dashed var(--line-2); border-radius: var(--r); }
.mirror-box svg { width: 44px; height: 44px; color: var(--gold); }
.mirror-box.off svg { color: var(--muted); }
.mirror-box h3 { font-size: 18px; }
.mirror-box code { font-size: 12px; color: var(--muted); }
.mirror-frame { margin-top: 12px; height: max(420px, calc(100dvh - var(--top-h) - var(--bottom-h) - 140px)); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; background: #000; }
.mirror-frame iframe { display: block; width: 100%; height: 100%; border: 0; }

/* settings + about */
.set-list { display: flex; flex-direction: column; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px dashed var(--line); flex-wrap: wrap; }
.set-row:last-child { border-bottom: 0; }
.set-row > span { font-weight: 600; color: var(--text-2); }
.set-row .inp { min-width: 150px; }
.about { display: flex; flex-direction: column; gap: 10px; align-items: stretch; }
.about .wordmark { align-self: center; }
.about-motto { text-align: center; color: var(--gold); margin: 0; }
.about-motto span[lang="ar"] { color: var(--text-2); font-size: 13px; }
.about-dev { text-align: center; font-size: 11.5px; letter-spacing: .16em; color: var(--muted); margin: 0; direction: ltr; }
.rights.in-about { padding-top: 10px; border-top: 1px dashed var(--line); }

/* ------------------------------------------------------------------ misc hooks */
.ic { width: 18px; height: 18px; flex: none; vertical-align: middle; }
.score-bars .sb { display: grid; grid-template-columns: minmax(70px, auto) minmax(0, 1fr) 40px; align-items: center; gap: 10px; font-size: 12.5px; color: var(--muted); }
.score-bars .sb b { color: var(--text); min-width: 0; }
.arrows { display: inline-flex; gap: 6px; font-family: var(--mono); }
.arrows b.buy { color: var(--buy); }
.arrows b.sell { color: var(--sell); }
.arrows b.wait { color: var(--muted); }
.tf-mini { margin-bottom: 10px; }
.tf-mini .seg-b { font-family: var(--mono); height: 28px; }
.badge.own-omx { background: var(--gold-bg); color: var(--gold); }
.badge.own-manual { background: var(--info-bg); color: var(--info); }
.badge.own-other { background: var(--off-bg); color: var(--muted); }
.badge.stage-0 { background: var(--buy-bg); color: var(--pos); }
.badge.stage-1, .badge.stage-2 { background: var(--warn-bg); color: var(--warn); }
.badge.stage-3, .badge.stage-4, .badge.stage-5 { background: rgba(249, 115, 22, .16); color: #f97316; }
.badge.stage-6, .badge.stage-7, .badge.stage-8 { background: var(--sell-bg); color: var(--neg); }
.detail-box { display: flex; flex-direction: column; gap: 12px; }
.strat-tbl td { white-space: nowrap; }
.strat-tbl td.name-c { white-space: normal; }
.g-tag.g1, .g-tag.g6 { background: rgba(56, 189, 248, .15); color: var(--info); }
.g-tag.g2, .g-tag.g7 { background: rgba(167, 139, 250, .17); color: var(--violet); }
.g-tag.g3, .g-tag.g8 { background: var(--buy-bg); color: var(--pos); }
.g-tag.g4, .g-tag.g9 { background: var(--warn-bg); color: var(--warn); }
.g-tag.g5, .g-tag.g10 { background: var(--gold-bg); color: var(--gold); }
.clock .clk-utc, .clock .clk-ksa { direction: ltr; unicode-bidi: isolate; white-space: nowrap; }
.clock b { color: var(--text-2); font-weight: 600; }
.q-spr { color: var(--muted); }
.modal-x { flex: none; }
.toast-msg { overflow-wrap: anywhere; }
@media (min-width: 768px) {
  .grid.g-intel, .grid.g-math { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 1400px) {
  .grid.g-math { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* ------------------------------------------------------------------ breakpoints */
@media (min-width: 600px) {
  .main { padding-inline: 16px; }
  .trend-matrix { grid-template-columns: repeat(8, minmax(0, 1fr)); }
  .sig-grid { grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); }
}
@media (min-width: 768px) {
  .grid.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .chart-side { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
  .ph-title h1 { font-size: 22px; }
  .chart-box { height: max(400px, calc(100dvh - var(--top-h) - var(--bottom-h) - 190px)); }
  .detail22 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .d22-row:nth-last-child(2):nth-child(odd) { border-bottom: 0; }
  .d22-row.wide { grid-column: 1 / -1; }
  .d22-row:nth-child(odd):not(.wide) { border-inline-end: 1px solid var(--line); }
}
@media (min-width: 1024px) {
  .shell { grid-template-columns: var(--side-w) minmax(0, 1fr); }
  .side {
    display: flex; flex-direction: column; justify-content: space-between; position: sticky; top: calc(var(--top-h) + var(--safe-t));
    height: calc(100dvh - var(--top-h) - var(--safe-t)); overflow-y: auto; border-inline-end: 1px solid var(--line); background: var(--bg-2);
  }
  .bottom { display: none; }
  .only-mob { display: none !important; }
  .hide-mob { display: inline-grid !important; }
  .main { padding: 18px 20px 24px; }
  .toasts { bottom: 20px; }
  .top { padding-inline: 16px; gap: 10px; }
  .chart-box { height: max(460px, calc(100dvh - var(--top-h) - 170px)); }
}
@media (min-width: 1180px) {
  .chart-layout { grid-template-columns: minmax(0, 1fr) 310px; }
  .chart-side { grid-template-columns: minmax(0, 1fr); }
}
@media (min-width: 1280px) {
  .only-wide { display: flex !important; }
  .stats { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
}
@media (min-width: 1600px) {
  .main { padding: 22px 28px 28px; }
  .chart-layout { grid-template-columns: minmax(0, 1fr) 340px; }
  .grid.g-2.g-wide3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 767px) {
  .brand-ar { display: none; }
  .acct-chip { max-width: 150px; }
}
@media (max-width: 520px) {
  .top .acct-chip { display: none; }
  .live-pill { padding: 0 9px; font-size: 11px; }
  .ph-title h1 { font-size: 18px; }
  .btn.big { height: 46px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-v { font-size: 16px; }
  .ses-time { font-size: 22px; }
  .tl-row { grid-template-columns: 70px minmax(0, 1fr); }
  .d22-row { grid-template-columns: minmax(0, 1fr); }
  .d22-k { padding-bottom: 4px; }
  .d22-v { padding-top: 4px; }
}
@media (max-width: 380px) {
  .brand-o { font-size: 14px; letter-spacing: .12em; }
  .top { gap: 6px; padding-inline: 8px; }
  .icon-btn { width: 34px; height: 34px; }
}
/* landscape phones: give the chart the height */
@media (max-height: 500px) and (orientation: landscape) {
  .chart-page > .page-head { display: none; }
  .chart-box { height: calc(100dvh - var(--top-h) - var(--bottom-h) - 24px); min-height: 240px; }
  .bottom { --bottom-h: 52px; }
  .main { padding-bottom: calc(52px + var(--safe-b) + 12px); }
  .bn-a span { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
@media print {
  .top, .side, .bottom, .banner, .toasts { display: none !important; }
  .main { padding: 0; }
}
