/* TraderLab Portal: токени, потім компоненти. Геометрія квадратна (6–8 px), без pill-кнопок і кіл.
   Inline-стилів немає: портал працює з CSP style-src 'self'. */

:root {
  color-scheme: dark;
  --bg: #0a0d12;
  --surface: #0e131b;
  --panel: #111821;
  --raised: #171f2b;
  --hover: #1d2736;
  --line: #1c2633;
  --line-strong: #2a3649;
  --text: #e6ebf2;
  --muted: #8794a8;
  --faint: #5b6a80;
  --accent: #3ddc97;
  --accent-ink: #04170e;
  --accent-soft: #123128;
  --blue: #6ea8ff;
  --warn: #f0b429;
  --warn-soft: #2e2611;
  --danger: #ff6170;
  --danger-soft: #2a1519;
  --up: #3ddc97;
  --down: #ff6170;

  --r: 6px;
  --r-lg: 8px;
  --gap: 14px;
  --pad: 18px;
  --control: 36px;
  --font: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Consolas, monospace;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.5 var(--font); font-variant-numeric: tabular-nums; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 24px; font-weight: 650; letter-spacing: -0.02em; }
h2 { font-size: 15px; font-weight: 600; }
h3 { font-size: 13px; font-weight: 600; }
small, .muted { color: var(--muted); font-size: 12px; }
small { display: block; }
.fine { color: var(--muted); font-size: 12px; }
.mono { font-family: var(--mono); font-size: 12px; word-break: break-all; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

/* ---------- кнопки і поля ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: var(--control); padding: 0 12px;
  border: 1px solid var(--line-strong); border-radius: var(--r);
  background: var(--raised); color: var(--text); white-space: nowrap; cursor: pointer;
  text-decoration: none; transition: background .15s, border-color .15s;
}
.btn:hover:not(:disabled) { background: var(--hover); border-color: #3a4a62; }
.btn:disabled { opacity: .5; cursor: wait; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn.primary:hover:not(:disabled) { background: #6ee9b8; border-color: #6ee9b8; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover:not(:disabled) { background: var(--raised); color: var(--text); }
.btn.danger { background: var(--danger-soft); border-color: #5a2a33; color: #ff9aa5; }
.btn.danger:hover:not(:disabled) { background: #3a1d25; }
.btn.small { min-height: 28px; padding: 0 9px; font-size: 12px; }
.btn.block { width: 100%; }
.linkbtn { border: 0; background: none; padding: 0; color: var(--blue); cursor: pointer; font-size: 12px; }
.linkbtn:hover { text-decoration: underline; }
.icon-btn { width: 32px; height: 32px; border: 0; border-radius: var(--r); background: transparent; color: var(--muted); font-size: 20px; cursor: pointer; }
.icon-btn:hover { background: var(--raised); color: var(--text); }

.form { display: grid; gap: 12px; }
.field { display: grid; gap: 6px; }
.field > span { color: var(--muted); font-size: 12px; }
input, select, textarea {
  width: 100%; min-height: var(--control); padding: 8px 10px;
  border: 1px solid var(--line-strong); border-radius: var(--r); background: var(--surface);
}
textarea { min-height: 84px; resize: vertical; }
input::placeholder, textarea::placeholder { color: var(--faint); }
input.search { min-height: 32px; width: min(280px, 100%); font-size: 13px; }
.invalid { border-color: var(--danger) !important; }
.ferr { color: var(--danger); font-size: 12px; }

.segmented { display: inline-flex; gap: 2px; padding: 2px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
.segmented button, .seg button {
  min-height: 28px; padding: 0 11px; border: 0; border-radius: 4px; background: transparent; color: var(--muted); cursor: pointer; white-space: nowrap;
}
.segmented button:hover, .seg button:hover { color: var(--text); }
.segmented button[aria-selected="true"], .segmented button.active,
.seg button.active, .seg button[aria-pressed="true"] { background: var(--raised); color: var(--text); box-shadow: inset 0 0 0 1px var(--line-strong); }
.seg { display: inline-flex; flex-wrap: wrap; max-width: 100%; gap: 2px; padding: 2px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
.segmented { flex-wrap: wrap; max-width: 100%; }

/* ---------- вхід ---------- */

.demo-bar { padding: 7px 20px; border-bottom: 1px solid #3b3317; background: var(--warn-soft); color: var(--warn); font-size: 12px; }
.auth { max-width: 1040px; min-height: calc(100vh - 34px); margin: 0 auto; padding: 48px 24px; display: grid; grid-template-columns: 1fr minmax(0, 380px); align-items: center; gap: 64px; }
.auth-intro h1 { font-size: 34px; line-height: 1.15; margin-top: 14px; }
.auth-intro p { max-width: 460px; margin-top: 12px; color: var(--muted); font-size: 15px; }
.auth-card { display: grid; gap: 16px; padding: 28px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--panel); }
.auth-card h2 { font-size: 19px; }
.auth-card .segmented { justify-self: start; }

.brand { font-size: 17px; font-weight: 700; letter-spacing: -0.01em; }
.brand span { margin-left: 6px; color: var(--muted); font-size: 11px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; }

/* ---------- оболонка ---------- */

.workspace { display: block; }
.sidebar {
  position: fixed; inset: 34px auto 0 0; width: 228px; padding: 22px 14px;
  display: flex; flex-direction: column; gap: 18px; border-right: 1px solid var(--line); background: var(--surface);
}
.sections { display: grid; gap: 2px; padding: 3px; border: 1px solid var(--line); border-radius: var(--r); }
.sections a { min-height: 30px; display: flex; align-items: center; padding: 0 10px; border-radius: 4px; color: var(--muted); text-decoration: none; font-size: 13px; }
.sections a:hover { color: var(--text); background: var(--raised); }
.sections a.active { background: var(--raised); color: var(--text); }
.nav { display: grid; gap: 2px; }
.nav button {
  display: flex; align-items: center; gap: 10px; min-height: 34px; padding: 0 10px;
  border: 0; border-radius: var(--r); background: transparent; color: var(--muted); text-align: left; cursor: pointer;
}
.nav button:hover { background: var(--raised); color: var(--text); }
.nav button[aria-current="page"] { background: var(--accent-soft); color: var(--accent); }
.nav .ni { width: 18px; display: inline-flex; justify-content: center; }
.ic { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.sidebar-foot { margin-top: auto; display: grid; gap: 6px; }
.conn { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.dot { width: 7px; height: 7px; border-radius: 2px; background: var(--accent); }
.dot.off { background: var(--danger); }
.sidebar-actions { display: grid; gap: 2px; margin-top: 6px; }
.sidebar-actions .btn { justify-content: flex-start; }

.main { margin-left: 228px; padding: 26px 30px 36px; min-width: 0; }
.banner { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; padding: 11px 14px; border: 1px solid #5a4b22; border-radius: var(--r); background: var(--warn-soft); color: var(--warn); }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.eyebrow { color: var(--faint); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; margin-bottom: 4px; }
.page-note { margin-top: 6px; color: var(--muted); font-size: 13px; max-width: 700px; }
.page-note:empty { display: none; }
.identity { display: flex; align-items: center; gap: 10px; }
.identity strong { display: block; font-size: 13px; }
.identity small { font-size: 11px; }
.avatar { display: grid; place-items: center; width: 34px; height: 34px; border-radius: var(--r); background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.foot { margin-top: 28px; color: var(--faint); font-size: 12px; }
.content { display: grid; gap: var(--gap); min-width: 0; }

/* ---------- блоки ---------- */

.panel { padding: var(--pad); border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--panel); min-width: 0; }
.panel-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.panel-head .btn-row { margin-left: auto; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--gap); }
.stat { display: grid; gap: 4px; padding: 14px var(--pad); border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--panel); text-align: left; color: inherit; font: inherit; cursor: default; }
button.stat { cursor: pointer; }
button.stat:hover { border-color: var(--line-strong); }
button.stat.active { border-color: var(--accent); }
.stat strong { font-size: 21px; font-weight: 650; }
.stat span { color: var(--muted); font-size: 12px; }
.split { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: var(--gap); align-items: start; }
.notice { padding: 11px 14px; border: 1px solid #3f3520; border-radius: var(--r); background: var(--warn-soft); color: var(--warn); font-size: 13px; }
.notice.info { border-color: #1f3350; background: #0e1828; color: #a9c3f2; }
.kv { display: grid; }
.kv > div { display: flex; justify-content: space-between; gap: 16px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.kv > div:last-child { border-bottom: 0; }
.kv span { color: var(--muted); }
.kv strong, .kv b { font-weight: 500; text-align: right; overflow-wrap: anywhere; }
.subhead { margin: 16px 0 8px; color: var(--muted); font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.plain { margin: 0; padding: 0; list-style: none; display: grid; gap: 4px; color: var(--muted); font-size: 13px; }
.positive, .up { color: var(--up); }
.negative, .down { color: var(--down); }
.right { text-align: right; }
.wrap { white-space: normal; min-width: 160px; }
.mt { margin-top: 10px; }

/* ---------- таблиці ---------- */

.table-wrap { overflow-x: auto; margin: 0 calc(var(--pad) * -1); padding: 0 var(--pad); }
.panel > .table-wrap:last-child { margin-bottom: calc(var(--pad) * -1); padding-bottom: var(--pad); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { padding: 8px 10px; border-bottom: 1px solid var(--line-strong); color: var(--faint); font-size: 11px; font-weight: 500; letter-spacing: .04em; text-align: left; text-transform: uppercase; white-space: nowrap; }
td { padding: 11px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; }
td small { margin-top: 2px; }
td .row-actions, .row-actions { display: flex; flex-wrap: nowrap; justify-content: flex-end; gap: 6px; }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--hover); }
tr.selected td { background: var(--accent-soft); }
.opt { display: table-cell; }

/* ---------- бейджі, стани, пусті ---------- */

.badge { display: inline-flex; align-items: center; padding: 2px 7px; border-radius: 4px; font-size: 11px; font-weight: 500; white-space: nowrap; background: var(--raised); color: var(--muted); }
.badge.ok { background: var(--accent-soft); color: var(--accent); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.mute, .badge.dim { background: var(--raised); color: var(--faint); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.tag { display: inline-block; margin: 1px 3px 1px 0; padding: 1px 6px; border-radius: 4px; background: var(--raised); color: var(--muted); font-size: 11px; }
.empty { display: grid; gap: 4px; place-items: center; padding: 30px 16px; border: 1px dashed var(--line-strong); border-radius: var(--r); color: var(--muted); text-align: center; }
.empty strong { color: var(--text); font-weight: 600; }
.skel-wrap { display: grid; gap: 8px; }
.skel { height: 34px; border-radius: 4px; background: linear-gradient(90deg, var(--raised), var(--hover), var(--raised)); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- дії, згруповані ---------- */

.action-groups { display: grid; gap: 10px; margin-bottom: 16px; }
.action-group { display: grid; grid-template-columns: 110px minmax(0, 1fr); align-items: center; gap: 12px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.action-group:last-child { padding-bottom: 0; border-bottom: 0; }
.action-group > span { color: var(--faint); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }
.client-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; }
.client-head h2 { font-size: 19px; }
.tabs { display: flex; flex-wrap: wrap; gap: 2px; margin-bottom: 14px; border-bottom: 1px solid var(--line); }
.tabs button { min-height: 36px; padding: 0 11px; border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--muted); cursor: pointer; white-space: nowrap; }
.tabs button:hover { color: var(--text); }
.tabs button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); }
.thread { margin-bottom: 10px; padding: 14px; border: 1px solid var(--line); border-radius: var(--r-lg); }
.message { margin: 6px 0; padding: 9px 12px; border-left: 2px solid var(--line-strong); background: var(--surface); border-radius: 0 var(--r) var(--r) 0; }
.message p { white-space: pre-wrap; overflow-wrap: anywhere; margin-bottom: 3px; }
.note-item { padding: 11px 13px; border: 1px solid var(--line); border-radius: var(--r); margin-bottom: 8px; }
.note-item p { white-space: pre-wrap; overflow-wrap: anywhere; }
.crm-comment { margin-top: 10px; padding: 10px; border-radius: var(--r); background: var(--surface); white-space: pre-wrap; font-size: 13px; }

/* ---------- монети і ціни ---------- */

.tk { display: inline-grid; place-items: center; flex: none; width: 26px; height: 26px; border-radius: var(--r); background: var(--raised); color: var(--muted); font-size: 12px; font-weight: 700; }
.tk.sm { width: 22px; height: 22px; font-size: 11px; }
.tk.xs { width: 18px; height: 18px; font-size: 10px; }
.tk.c-BTC { background: #3b2a14; color: #f7a23b; }
.tk.c-ETH { background: #1c2a45; color: #8fb0ff; }
.tk.c-USDT { background: #123128; color: var(--accent); }
.tk.c-BNB { background: #3a3110; color: #f0c040; }
.tk.c-SOL { background: #2a1d3c; color: #b28cff; }
.tk.c-XRP { background: #1d2430; color: #c9d4e4; }
.aname { display: inline-flex; align-items: center; gap: 9px; }
.aname b { display: block; font-weight: 600; }
.pchip { display: inline-block; min-width: 62px; padding: 2px 6px; border-radius: 4px; background: var(--raised); text-align: center; font-size: 12px; font-weight: 500; }
.pchip.up { background: var(--accent-soft); }
.pchip.down { background: var(--danger-soft); }
.flash-up { animation: flashUp .8s ease-out; }
.flash-down { animation: flashDown .8s ease-out; }
@keyframes flashUp { from { background: rgba(61, 220, 151, .22); } to { background: transparent; } }
@keyframes flashDown { from { background: rgba(255, 97, 112, .22); } to { background: transparent; } }

/* ---------- термінал (/client) ---------- */

.hero { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 16px; padding: 20px var(--pad); border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--panel); }
.hero-total { display: flex; align-items: baseline; gap: 8px; margin-top: 4px; }
.hero-total b { font-size: 32px; font-weight: 650; letter-spacing: -0.02em; }
.hero-total span { color: var(--muted); }
.hero-sub { display: flex; gap: 18px; margin-top: 6px; color: var(--muted); font-size: 13px; }
.hero-sub b { color: var(--text); font-weight: 500; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.hero-actions .btn { min-width: 118px; }
.ic-inline { width: 15px; height: 15px; }
.wgrid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: var(--gap); align-items: start; }
.wside { display: grid; gap: var(--gap); }

/* ---------- реальний рахунок ---------- */
.real-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: var(--gap); align-items: start; }
.lead-text { margin: 0 0 14px; color: var(--muted); font-size: 13px; line-height: 1.55; }
.steps { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; counter-reset: step; }
.steps li { display: grid; grid-template-columns: 26px minmax(0, 1fr); column-gap: 10px; counter-increment: step; }
.steps li::before { content: counter(step); grid-row: span 2; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-size: 12px; font-weight: 600; }
.steps b { font-size: 13px; }
.steps span { color: var(--muted); font-size: 12px; }
.goal { display: grid; gap: 6px; margin-bottom: 14px; }
.goal-head { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; }
.goal-head span { color: var(--muted); }
.goal progress { width: 100%; height: 8px; border: 0; border-radius: 4px; background: var(--raised); overflow: hidden; appearance: none; }
.goal progress::-webkit-progress-bar { background: var(--raised); }
.goal progress::-webkit-progress-value { background: var(--accent); border-radius: 4px; }
.goal progress::-moz-progress-bar { background: var(--accent); border-radius: 4px; }
.row-actions.start { justify-content: flex-start; }
.asset-cell { display: inline-flex; align-items: center; gap: 8px; }
.depo-list { display: grid; gap: 10px; margin-top: 12px; }
.depo { display: grid; gap: 6px; padding: 12px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
.depo header { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 6px; font-size: 13px; }
.depo header span { color: var(--muted); font-size: 12px; }
.depo-addr { display: flex; align-items: center; gap: 8px; }
.depo-addr code { flex: 1; min-width: 0; padding: 7px 9px; border-radius: var(--r); background: var(--raised); font-family: var(--mono); font-size: 12px; overflow-wrap: anywhere; user-select: all; }
.depo small { color: var(--muted); font-size: 12px; }
.depo .warn-text { color: var(--warn); }
.depo .ok-text { color: var(--accent); }
.field.check { display: grid; grid-template-columns: 18px minmax(0, 1fr); align-items: start; gap: 10px; cursor: pointer; }
.field.check input { width: 16px; height: 16px; min-height: 0; margin-top: 2px; padding: 0; accent-color: var(--accent); }
.field.check > span { color: var(--text); font-size: 13px; line-height: 1.45; }
.section-title { margin: 8px 0 0; color: var(--muted); font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.fine code { padding: 1px 5px; border-radius: 4px; background: var(--raised); font-family: var(--mono); font-size: 11px; }
@media (max-width: 1100px) { .real-grid { grid-template-columns: minmax(0, 1fr); } }
.rtrade .rt-grid { display: grid; gap: 10px; max-width: 460px; }
.rt-price { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.rt-price b { color: var(--text); font-family: var(--mono); font-size: 15px; }
.rt-quick { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.rt-avail { margin-left: auto; color: var(--muted); font-size: 12px; }
.rt-est { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 10px 12px; border-radius: var(--r); background: var(--surface); }
.rt-est span { color: var(--muted); font-size: 13px; }
.rt-est b { font-size: 15px; }
.rt-hist { margin: 18px 0 8px; font-size: 14px; }
.btn.block { width: 100%; }

/* ---------- налаштування: дерево команди, ролі, права ---------- */
.settings > .panel-head { margin-bottom: 12px; }
.otools { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.zoom { display: inline-flex; align-items: center; gap: 2px; }
.zoom b { min-width: 46px; color: var(--muted); font-size: 12px; font-weight: 500; text-align: center; }
.olegend { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.rchip { --rc: var(--muted); display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 8px; border: 1px solid color-mix(in srgb, var(--rc) 45%, transparent); border-radius: 999px; background: color-mix(in srgb, var(--rc) 12%, transparent); color: var(--text); font-size: 12px; white-space: nowrap; }
.rchip i { width: 8px; height: 8px; border-radius: 50%; background: var(--rc); box-shadow: 0 0 8px var(--rc); }
.orgwrap { display: grid; grid-template-columns: minmax(0, 1fr) 310px; gap: 14px; align-items: start; }
.orgscroll {
  overflow: auto; max-height: 74vh; padding: 22px 10px 30px; border: 1px solid var(--line); border-radius: var(--r-lg);
  background:
    radial-gradient(ellipse at 50% 0, rgba(61, 220, 151, .08), transparent 60%),
    repeating-linear-gradient(0deg, transparent 0 23px, rgba(255, 255, 255, .025) 23px 24px),
    repeating-linear-gradient(90deg, transparent 0 23px, rgba(255, 255, 255, .025) 23px 24px),
    var(--surface);
}
.otree { zoom: var(--zoom, 1); width: max-content; min-width: 100%; }
.otree ul { position: relative; margin: 0; padding: 0; list-style: none; }
.otree li { position: relative; }
.onode { --rc: var(--muted); position: relative; display: flex; justify-content: center; }
.omain {
  position: relative; display: grid; grid-template-columns: 40px minmax(0, auto); grid-template-areas: "av text" "av stats";
  align-items: center; column-gap: 10px; row-gap: 4px; min-width: 196px; max-width: 250px; padding: 11px 16px 11px 11px;
  border: 1px solid color-mix(in srgb, var(--rc) 38%, var(--line)); border-top: 3px solid var(--rc); border-radius: 12px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--rc) 11%, var(--panel)), var(--panel)); color: var(--text); text-align: left;
  box-shadow: 0 8px 22px rgba(0, 0, 0, .28); cursor: pointer; transition: transform .18s ease, box-shadow .18s ease;
}
.omain:hover { transform: translateY(-2px); box-shadow: 0 12px 28px rgba(0, 0, 0, .38), 0 0 0 1px color-mix(in srgb, var(--rc) 55%, transparent); }
.omain:focus-visible { outline: 2px solid var(--rc); outline-offset: 2px; }
.onode.sel .omain { box-shadow: 0 0 0 2px var(--rc), 0 12px 32px color-mix(in srgb, var(--rc) 32%, transparent); }
.onode.me .omain::after { content: 'Ви'; position: absolute; top: -10px; right: 10px; padding: 0 7px; border-radius: 6px; background: var(--accent); color: #04120b; font-size: 10px; font-weight: 700; line-height: 18px; }
.onode.off .omain { opacity: .55; filter: grayscale(.75); }
.onode.dim .omain { opacity: .32; }
.onode.hit .omain { box-shadow: 0 0 0 2px var(--warn), 0 0 22px rgba(240, 180, 41, .35); }
.oav {
  grid-area: av; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%;
  background: radial-gradient(circle at 30% 28%, color-mix(in srgb, var(--rc) 55%, #fff), var(--rc)); color: #0b1017;
  font-size: 14px; font-weight: 700; box-shadow: 0 0 0 3px color-mix(in srgb, var(--rc) 22%, transparent);
}
.oav.big { width: 52px; height: 52px; font-size: 18px; }
.oav.sm { --rc: var(--muted); width: 30px; height: 30px; flex: none; font-size: 11px; }
.otext { grid-area: text; display: grid; min-width: 0; }
.otext b { overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.otext small { color: var(--rc); font-size: 10.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; }
.ostats { grid-area: stats; display: flex; gap: 12px; color: var(--muted); font-size: 11px; }
.ostats span { display: inline-flex; align-items: center; gap: 4px; }
.ostats .ic { width: 12px; height: 12px; }
.otag { position: absolute; top: -10px; left: 10px; padding: 0 7px; border-radius: 6px; background: var(--danger-soft); color: var(--danger); font-size: 10px; line-height: 18px; white-space: nowrap; }
.otag.warn { background: var(--warn-soft); color: var(--warn); }
.otoggle { position: absolute; bottom: -12px; left: 50%; z-index: 2; min-width: 26px; height: 24px; padding: 0 7px; transform: translateX(-50%); border: 1px solid var(--line-strong); border-radius: 12px; background: var(--raised); color: var(--text); font-size: 12px; font-weight: 600; cursor: pointer; }
.otoggle:hover { border-color: var(--rc); color: var(--rc); }
.content.page-enter-lite .onode { animation: nodeIn .45s cubic-bezier(.2, .7, .2, 1) both; }
.content.page-enter-lite .otree ul ul .onode { animation-delay: .08s; }
.content.page-enter-lite .otree ul ul ul .onode { animation-delay: .16s; }
.content.page-enter-lite .otree ul ul ul ul .onode { animation-delay: .24s; }
@keyframes nodeIn { from { opacity: 0; transform: translateY(10px) scale(.96); } }

/* Лінії зв’язків: горизонтальна шина над дітьми і вертикалі до кожного вузла. */
@media (min-width: 701px) {
  .otree ul { display: flex; justify-content: center; padding-top: 28px; }
  .otree > ul { padding-top: 0; }
  .otree li { display: flex; flex-direction: column; align-items: center; padding: 28px 10px 0; }
  .otree > ul > li { padding-top: 0; }
  .otree li::before, .otree li::after { content: ''; position: absolute; top: 0; width: 50%; height: 28px; border-top: 2px solid var(--line-strong); }
  .otree li::before { right: 50%; }
  .otree li::after { left: 50%; border-left: 2px solid var(--line-strong); }
  .otree li:only-child::before { display: none; }
  .otree li:only-child::after { width: 0; border-top: 0; }
  .otree li:first-child::before { border: 0 none; }
  .otree li:first-child:not(:only-child)::after { border-radius: 10px 0 0 0; }
  .otree li:last-child:not(:only-child)::after { border: 0 none; }
  .otree li:last-child:not(:only-child)::before { border-right: 2px solid var(--line-strong); border-radius: 0 10px 0 0; }
  .otree ul ul::before { content: ''; position: absolute; top: 0; left: 50%; height: 28px; border-left: 2px solid var(--line-strong); }
  .otree > ul > li::before, .otree > ul > li::after { display: none; }
}
/* На телефоні дерево стає вертикальним списком із відступами. */
@media (max-width: 700px) {
  .orgscroll { max-height: none; padding: 14px 12px; }
  .otree { width: auto; zoom: 1; }
  .otree ul { padding-left: 22px; }
  .otree > ul { padding-left: 0; }
  .otree li { padding-top: 12px; }
  .otree ul ul > li::before { content: ''; position: absolute; top: 0; left: -14px; width: 14px; height: 40px; border-left: 2px solid var(--line-strong); border-bottom: 2px solid var(--line-strong); border-radius: 0 0 0 8px; }
  .otree ul ul > li:not(:last-child)::after { content: ''; position: absolute; top: 0; bottom: 0; left: -14px; border-left: 2px solid var(--line-strong); }
  .onode { justify-content: flex-start; }
  .omain { width: 100%; max-width: none; }
  .otoggle { top: 50%; right: 10px; bottom: auto; left: auto; transform: translateY(-50%); }
}

.opanel { --rc: var(--muted); position: sticky; top: 12px; display: grid; gap: 12px; padding: 16px; border: 1px solid var(--line); border-top: 3px solid var(--rc); border-radius: var(--r-lg); background: linear-gradient(180deg, color-mix(in srgb, var(--rc) 9%, var(--panel)), var(--panel)); }
.opanel.empty-panel { display: grid; gap: 6px; border-top-color: var(--line); padding: 30px 18px; color: var(--muted); font-size: 13px; text-align: center; }
.opanel.empty-panel b { color: var(--text); }
.ophead { display: flex; align-items: center; gap: 12px; }
.ophead b { display: block; font-size: 15px; }
.ophead small { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.otags { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.chain { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; color: var(--faint); font-size: 12px; }
.okids { display: flex; flex-wrap: wrap; gap: 6px; }
.kidchip { --rc: var(--muted); display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 4px; border: 1px solid color-mix(in srgb, var(--rc) 40%, var(--line)); border-radius: 999px; background: var(--surface); color: var(--rc); font-size: 11px; font-weight: 700; cursor: pointer; }
.kidchip span { color: var(--text); font-weight: 500; }
.kidchip:hover { background: color-mix(in srgb, var(--rc) 12%, var(--surface)); }
.row-actions.wrap { flex-wrap: wrap; }

.ladder { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 14px; }
.rung { --rc: var(--muted); display: inline-flex; align-items: center; gap: 7px; padding: 4px 12px 4px 4px; border: 1px solid color-mix(in srgb, var(--rc) 40%, transparent); border-radius: 999px; background: color-mix(in srgb, var(--rc) 13%, var(--surface)); font-size: 12px; }
.rung b { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--rc); color: #0b1017; font-size: 11px; }
.rung-arrow { color: var(--faint); }
.gridbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 10px; }
.gridbar .grow { flex: 1; }
.pgrid-wrap { max-height: 70vh; overflow: auto; border: 1px solid var(--line); border-radius: var(--r); }
.pgrid { min-width: 760px; }
.pgrid thead th { position: sticky; top: 0; z-index: 3; background: var(--panel); }
.pgrid thead th:first-child { left: 0; z-index: 4; }
.pgrid tbody th[scope="row"] { position: sticky; left: 0; z-index: 1; min-width: 240px; background: var(--panel); color: var(--text); font-size: 13px; font-weight: 400; letter-spacing: 0; text-transform: none; white-space: normal; }
.pgrid .rhead { --rc: var(--muted); position: sticky; min-width: 106px; border-bottom: 3px solid var(--rc); text-align: center; }
.rhead b, .rbtn { display: block; color: var(--rc); font-size: 12px; font-weight: 700; letter-spacing: 0; text-transform: none; }
.rbtn { margin: 0 auto; padding: 2px 6px; border: 0; border-radius: 4px; background: transparent; cursor: pointer; }
.rbtn:hover { background: var(--raised); }
.rhead small { display: block; color: var(--faint); font-size: 10px; letter-spacing: 0; text-transform: none; }
.rdel { position: absolute; top: 4px; right: 4px; width: 18px; height: 18px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--faint); cursor: pointer; }
.rdel:hover { background: var(--danger-soft); color: var(--danger); }
.pgroup th { position: static; padding-top: 14px; background: var(--surface); color: var(--muted); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; }
.pcell { text-align: center; }
.pcell input { width: 16px; height: 16px; min-height: 0; padding: 0; accent-color: var(--accent); cursor: pointer; }
.pcell.on .tick { color: var(--accent); font-weight: 700; }
.pgrid tbody tr:not(.pgroup):hover > * { background: var(--hover); }
.crit { display: inline-grid; place-items: center; width: 15px; height: 15px; border-radius: 50%; background: var(--danger-soft); color: var(--danger); font-size: 10px; font-weight: 800; vertical-align: middle; }
.person { display: inline-flex; align-items: center; gap: 10px; }
.person b { display: block; }
.person small { color: var(--muted); }
.muted-row td { opacity: .6; }
.copyrow { display: flex; gap: 8px; }
.copyrow input { font-family: var(--mono); }
@media (max-width: 1100px) { .orgwrap { grid-template-columns: minmax(0, 1fr); } .opanel { position: static; } }
.feed { margin: 0; padding: 0; list-style: none; display: grid; gap: 4px; }
.feed li { display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.feed li:last-child { border-bottom: 0; }
.op { display: grid; place-items: center; width: 26px; height: 26px; border-radius: var(--r); font-weight: 700; }
.op.in { background: var(--accent-soft); color: var(--accent); }
.op.out { background: var(--danger-soft); color: var(--danger); }
.ractions { display: inline-flex; flex-wrap: nowrap; gap: 6px; justify-content: flex-end; }

.tgrid {
  display: grid; gap: var(--gap); align-items: start;
  grid-template-columns: 230px minmax(0, 1fr) 300px;
  grid-template-areas: "pairs chart side" "pairs bottom side";
}
.tgrid > .tpairs { grid-area: pairs; }
.tgrid > .tchartp { grid-area: chart; padding: 0; overflow: hidden; }
.tgrid > .tside { grid-area: side; display: grid; gap: var(--gap); align-content: start; }
.tgrid > .tbottom { grid-area: bottom; }
.tpanel { padding: 12px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--panel); min-width: 0; }
.tpairs { display: grid; gap: 8px; align-content: start; }
.tsearch { position: relative; }
.tsearch svg { position: absolute; left: 9px; top: 50%; width: 14px; height: 14px; transform: translateY(-50%); fill: none; stroke: var(--faint); stroke-width: 2; }
.tsearch input { padding-left: 30px; min-height: 32px; font-size: 13px; }
.plist { display: grid; gap: 1px; max-height: 780px; overflow: auto; }
.pair-seg { width: 100%; }
.pair-seg button { flex: 1; }
.prow { display: grid; grid-template-columns: 26px minmax(0, 1fr); align-items: center; border-radius: var(--r); color: var(--muted); }
.prow:hover { background: var(--raised); color: var(--text); }
.prow.active { background: var(--accent-soft); color: var(--text); }
.prow-main { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "name price" "name chg"; align-items: center; column-gap: 8px; min-height: 40px; padding: 4px 8px 4px 2px; border: 0; background: transparent; color: inherit; cursor: pointer; text-align: left; }
.star { display: grid; place-items: center; width: 26px; height: 26px; padding: 0; border: 0; border-radius: var(--r); background: transparent; color: var(--faint); cursor: pointer; }
.star svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; }
.star:hover { color: var(--warn); }
.star.on { color: var(--warn); }
.star.on svg { fill: currentColor; }
.pb-pair .star { width: 30px; height: 30px; }
.pb-pair .star svg { width: 18px; height: 18px; }
.pname { grid-area: name; display: inline-flex; align-items: center; gap: 7px; min-width: 0; overflow: hidden; }
.pname b { color: var(--text); font-weight: 600; white-space: nowrap; }
.pname small { display: none; }
.pprice { grid-area: price; font-size: 12px; text-align: right; white-space: nowrap; color: var(--text); }
.pchg { grid-area: chg; font-size: 11px; text-align: right; white-space: nowrap; }
.thead { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.thead h3 { font-size: 13px; }
.pairbar { display: flex; align-items: center; flex-wrap: wrap; gap: 18px; padding: 12px var(--pad); margin-bottom: var(--gap); border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--panel); }
.pb-pair { display: flex; align-items: center; gap: 10px; }
.pb-pair h2 { font-size: 17px; }
.pb-pair h2 small { display: inline; color: var(--faint); font-size: 13px; margin-left: 2px; }
.pb-last b { font-size: 20px; font-weight: 650; display: block; }
.pb-stat { display: grid; gap: 2px; }
.pb-stat b { font-weight: 500; font-size: 13px; }
.order { display: grid; gap: 10px; }
.side-seg { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; padding: 3px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
.side-seg button { min-height: 32px; border: 0; border-radius: 4px; background: transparent; color: var(--muted); cursor: pointer; font-weight: 600; }
.side-seg button.buy.active { background: var(--accent-soft); color: var(--accent); }
.side-seg button.sell.active { background: var(--danger-soft); color: var(--danger); }
.otype { display: flex; justify-content: space-between; align-items: baseline; font-size: 13px; }
.otype small { display: inline; }
.avail { display: flex; justify-content: space-between; font-size: 13px; }
.avail b { font-weight: 500; }
.field .inwrap { position: relative; display: block; }
.field .inwrap input { padding-right: 56px; }
.field .inwrap em { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); color: var(--faint); font-style: normal; font-size: 12px; }
.field .inwrap.invalid input { border-color: var(--danger); }
.hint { color: var(--faint); font-size: 12px; }
.pct { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.pct button { min-height: 26px; border: 1px solid var(--line); border-radius: 4px; background: transparent; color: var(--muted); cursor: pointer; font-size: 12px; }
.pct button:hover { color: var(--text); border-color: var(--line-strong); }
.est { display: grid; gap: 4px; margin: 0; padding: 10px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); font-size: 13px; }
.est div { display: flex; justify-content: space-between; }
.est dt { color: var(--muted); }
.est dd { margin: 0; }
.submit { min-height: 40px; border: 0; border-radius: var(--r); font-weight: 700; cursor: pointer; }
.submit.buy { background: var(--accent); color: var(--accent-ink); }
.submit.sell { background: var(--danger); color: #1a0508; }
.submit:disabled { opacity: .6; cursor: wait; }
.demo-note { font-size: 11px; }
.movers { display: grid; grid-template-columns: 1fr 1fr; gap: var(--gap); margin-bottom: var(--gap); }
.mlist { display: grid; gap: 4px; }
.mover { display: grid; grid-template-columns: auto auto 1fr auto; align-items: center; gap: 10px; padding: 8px 10px; border: 0; border-radius: var(--r); background: transparent; color: var(--text); cursor: pointer; text-align: left; }
.mover:hover { background: var(--raised); }
.mover > span:not(.pchip) { text-align: right; }
.mk-head { align-items: center; }
.mk-head .tsearch { width: min(280px, 100%); }
.kind { display: inline-block; padding: 1px 7px; border-radius: 4px; background: var(--raised); color: var(--muted); font-size: 11px; }
.kind.k-trade { background: var(--accent-soft); color: var(--accent); }
.kind.k-withdrawal, .kind.k-admin { background: var(--warn-soft); color: var(--warn); }

/* ---------- CRM ---------- */

.crm-filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.crm-filters select { width: auto; min-width: 150px; min-height: 32px; font-size: 13px; }
.crm-card { margin-top: var(--gap); }
.crm-body { min-height: 120px; }

/* ---------- діалог ---------- */

dialog { width: min(480px, 94vw); padding: 22px; border: 1px solid var(--line-strong); border-radius: var(--r-lg); background: var(--panel); color: var(--text); }
dialog::backdrop { background: rgba(3, 6, 10, .72); }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.dialog-head h2 { font-size: 17px; }
.dialog-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
#dialogHint { margin: 0; }
.amount-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ---------- сповіщення ---------- */

.toast { position: fixed; right: 20px; bottom: 20px; z-index: 20; max-width: min(420px, calc(100vw - 40px)); padding: 11px 15px; border: 1px solid #2a5a48; border-radius: var(--r); background: #13241e; color: var(--text); box-shadow: 0 12px 30px rgba(0, 0, 0, .4); font-size: 13px; }
.toast.error { border-color: #6a2f3a; background: #2a1519; }

/* ---------- вхід ---------- */

.auth-intro .brand { font-size: 20px; }

/* ---------- адаптив ---------- */

@media (max-width: 1440px) {
  .tgrid { grid-template-columns: minmax(0, 1fr) 290px; grid-template-areas: "chart side" "bottom pairs"; }
  .plist { max-height: 420px; }
}
@media (max-width: 1280px) {
  .opt { display: none; }
}
@media (max-width: 1040px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split, .wgrid { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .sidebar { position: static; width: auto; flex-direction: column; gap: 10px; padding: 12px 14px; border-right: 0; border-bottom: 1px solid var(--line); }
  .sections { display: flex; }
  .sections a { flex: 1; justify-content: center; }
  .nav { display: flex; overflow-x: auto; gap: 4px; }
  .nav button { flex: none; }
  .sidebar-foot { margin: 0; grid-template-columns: auto 1fr auto; align-items: center; }
  .sidebar-foot .conn, .sidebar-foot small { display: none; }
  .sidebar-actions { display: flex; margin: 0; gap: 4px; }
  .main { margin-left: 0; padding: 18px 14px 30px; }
  .tgrid { grid-template-columns: minmax(0, 1fr); grid-template-areas: "chart" "side" "pairs" "bottom"; }
  .movers { grid-template-columns: 1fr; }
  .auth { grid-template-columns: 1fr; gap: 26px; padding: 30px 16px; }
  .auth-intro h1 { font-size: 27px; }
  .page-head { flex-direction: column; }
  .action-group { grid-template-columns: 1fr; gap: 6px; }
  .hero-total b { font-size: 26px; }
}
@media (max-width: 560px) {
  .stats { grid-template-columns: 1fr; }
  h1 { font-size: 20px; }
  .amount-row { grid-template-columns: 1fr; }
}
/* =====================================================================
   Клієнтська сторона: максимум руху. Усе вимикається при reduced-motion.
   ===================================================================== */

.grad {
  background: linear-gradient(90deg, #3ddc97, #ffd166, #ff8a5b, #3ddc97);
  background-size: 250% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: gradShift 6s linear infinite;
}

/* Атмосферне світіння за терміналом */
body[data-section="client"]::before {
  content: ''; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(40% 35% at 85% 0%, rgba(61, 220, 151, .10), transparent 70%),
    radial-gradient(35% 30% at 20% 100%, rgba(110, 168, 255, .08), transparent 70%),
    radial-gradient(30% 25% at 60% 60%, rgba(240, 180, 41, .05), transparent 70%);
  animation: ambient 16s ease-in-out infinite alternate;
}

/* Вхід на сторінку: блоки і рядки таблиць з’являються по черзі */
.content.page-enter > * { animation: riseIn .6s cubic-bezier(.2, .7, .2, 1) both; }
.content.page-enter > *:nth-child(2) { animation-delay: .07s; }
.content.page-enter > *:nth-child(3) { animation-delay: .14s; }
.content.page-enter > *:nth-child(4) { animation-delay: .21s; }
.content.page-enter > *:nth-child(5) { animation-delay: .28s; }
.content.page-enter > *:nth-child(n+6) { animation-delay: .35s; }
.content.page-enter tbody tr, .content.page-enter .prow, .content.page-enter .feed li, .content.page-enter .mover { animation: slideIn .5s cubic-bezier(.2, .7, .2, 1) both; }
.content.page-enter tbody tr:nth-child(2), .content.page-enter .prow:nth-child(2), .content.page-enter .feed li:nth-child(2), .content.page-enter .mover:nth-child(2) { animation-delay: .04s; }
.content.page-enter tbody tr:nth-child(3), .content.page-enter .prow:nth-child(3), .content.page-enter .feed li:nth-child(3), .content.page-enter .mover:nth-child(3) { animation-delay: .08s; }
.content.page-enter tbody tr:nth-child(4), .content.page-enter .prow:nth-child(4), .content.page-enter .feed li:nth-child(4) { animation-delay: .12s; }
.content.page-enter tbody tr:nth-child(5), .content.page-enter .prow:nth-child(5), .content.page-enter .feed li:nth-child(5) { animation-delay: .16s; }
.content.page-enter tbody tr:nth-child(6), .content.page-enter .prow:nth-child(6), .content.page-enter .feed li:nth-child(6) { animation-delay: .2s; }
.content.page-enter tbody tr:nth-child(7), .content.page-enter .prow:nth-child(7) { animation-delay: .24s; }
.content.page-enter tbody tr:nth-child(8), .content.page-enter .prow:nth-child(8) { animation-delay: .28s; }
.content.page-enter tbody tr:nth-child(n+9), .content.page-enter .prow:nth-child(n+9) { animation-delay: .32s; }
.content.page-enter-lite > * { animation: fadeIn .18s ease-out both; }
#pageTitle.title-in { animation: titleIn .5s cubic-bezier(.2, .7, .2, 1) both; }

/* Навігація клієнта */
body[data-section="client"] .nav button { position: relative; overflow: hidden; transition: background .25s, color .25s, padding-left .25s; }
body[data-section="client"] .nav button .ic { transition: transform .3s cubic-bezier(.3, 1.6, .5, 1); }
body[data-section="client"] .nav button:hover .ic { transform: translateY(-2px) rotate(-6deg) scale(1.12); }
body[data-section="client"] .nav button[aria-current="page"] { padding-left: 14px; box-shadow: inset 3px 0 0 var(--accent); }
body[data-section="client"] .nav button[aria-current="page"] .ic { filter: drop-shadow(0 0 6px rgba(61, 220, 151, .6)); }

/* Кнопки: підйом, блиск, хвиля від дотику */
body[data-section="client"] .btn, body[data-section="client"] .submit, body[data-section="client"] .prow,
body[data-section="client"] .side-seg button, body[data-section="client"] .seg button, body[data-section="client"] .mover,
body[data-section="client"] .pct button, .auth .btn, .auth .segmented button, .tick { position: relative; overflow: hidden; }
body[data-section="client"] .btn { transition: background .2s, border-color .2s, transform .2s, box-shadow .2s; }
body[data-section="client"] .btn:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(0, 0, 0, .3); }
body[data-section="client"] .btn.primary, .auth .btn.primary, body[data-section="client"] .submit.buy { animation: ring 3s ease-out infinite; }
body[data-section="client"] .btn.primary::after, .auth .btn.primary::after, body[data-section="client"] .submit::after {
  content: ''; position: absolute; top: 0; bottom: 0; left: -60%; width: 40%; pointer-events: none;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .4), transparent);
  transform: skewX(-20deg); transition: left .6s ease;
}
body[data-section="client"] .btn.primary:hover::after, .auth .btn.primary:hover::after, body[data-section="client"] .submit:hover::after { left: 120%; }
body[data-section="client"] .btn:active, body[data-section="client"] .submit:active { transform: scale(.97); }
.ripple {
  position: absolute; left: var(--x); top: var(--y); width: 10px; height: 10px; margin: -5px 0 0 -5px;
  border-radius: 50%; background: rgba(255, 255, 255, .35); pointer-events: none; animation: ripple .6s ease-out forwards;
}
.burst { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 60; pointer-events: none; }

/* Сповіщення: виїзд і смужка часу */
.toast { overflow: hidden; }
.toast:not([hidden]) { animation: toastIn .45s cubic-bezier(.2, .9, .3, 1.2) both; }
.toast:not([hidden])::after { content: ''; position: absolute; left: 0; bottom: 0; height: 2px; width: 100%; background: var(--accent); transform-origin: left; animation: toastBar 5s linear forwards; }
.toast.error:not([hidden])::after { background: var(--danger); }
.toast.error:not([hidden]) { animation: toastIn .45s cubic-bezier(.2, .9, .3, 1.2) both, shake .4s .45s; }

/* Числа, що змінюються */
[data-num] { transition: color .4s, text-shadow .4s; }
.num-up { color: var(--up) !important; text-shadow: 0 0 18px rgba(61, 220, 151, .45); }
.num-down { color: var(--down) !important; text-shadow: 0 0 18px rgba(255, 97, 112, .45); }

/* Бігучий рядок котирувань */
.tickerbar { position: relative; overflow: hidden; margin: -8px 0 18px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent); }
.tickerbar-track { display: flex; width: max-content; animation: ticker 70s linear infinite; }
.tickerbar:hover .tickerbar-track { animation-play-state: paused; }
.tick { display: inline-flex; align-items: center; gap: 7px; padding: 8px 16px; border: 0; border-right: 1px solid var(--line); background: transparent; color: var(--muted); font-size: 12px; cursor: pointer; white-space: nowrap; }
.tick b { color: var(--text); font-weight: 600; }
.tick:hover { background: var(--raised); }
.tick .tp { color: var(--text); font-family: var(--mono); }

/* Гаманець: живий градієнт і відблиск */
body[data-section="client"] .hero { position: relative; overflow: hidden; border-color: transparent; background:
  linear-gradient(var(--panel), var(--panel)) padding-box,
  linear-gradient(120deg, rgba(61, 220, 151, .6), rgba(110, 168, 255, .4), rgba(240, 180, 41, .5), rgba(61, 220, 151, .6)) border-box;
  background-size: 100% 100%, 300% 300%; animation: borderFlow 8s linear infinite; }
body[data-section="client"] .hero::after { content: ''; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(105deg, transparent 40%, rgba(255, 255, 255, .05) 50%, transparent 60%); background-size: 250% 100%; animation: sheen 5s ease-in-out infinite; }
body[data-section="client"] .hero-total b { background: linear-gradient(90deg, var(--text), #fff, var(--accent)); -webkit-background-clip: text; background-clip: text; color: transparent; }
body[data-section="client"] .hero-total b.num-up, body[data-section="client"] .hero-total b.num-down { -webkit-text-fill-color: currentColor; }

/* Панелі й картки клієнта підсвічуються при наведенні */
body[data-section="client"] .panel, body[data-section="client"] .tpanel, body[data-section="client"] .stat { transition: border-color .3s, box-shadow .3s, transform .3s; }
body[data-section="client"] .panel:hover, body[data-section="client"] .tpanel:hover { border-color: #2a3a52; box-shadow: 0 10px 30px rgba(0, 0, 0, .25); }

/* Термінал */
body[data-section="client"] .pairbar { position: relative; overflow: hidden; }
body[data-section="client"] .pairbar::before { content: ''; position: absolute; inset: 0; pointer-events: none; background: radial-gradient(60% 120% at 0% 50%, rgba(61, 220, 151, .08), transparent 60%); }
body[data-section="client"] .pb-last b { transition: color .3s; }
body[data-section="client"] .prow { transition: background .2s, transform .2s, box-shadow .2s; }
body[data-section="client"] .prow:hover { transform: translateX(3px); }
body[data-section="client"] .prow.active { box-shadow: inset 3px 0 0 var(--accent); }
.side-seg button { transition: background .25s, color .25s, transform .2s; }
.side-seg button.active { transform: scale(1.02); }
.side-seg button.buy.active { box-shadow: 0 0 0 1px rgba(61, 220, 151, .35), 0 0 18px rgba(61, 220, 151, .2); }
.side-seg button.sell.active { box-shadow: 0 0 0 1px rgba(255, 97, 112, .35), 0 0 18px rgba(255, 97, 112, .2); }
.submit { transition: transform .15s, box-shadow .25s, filter .25s; }
.submit:hover:not(:disabled) { filter: brightness(1.08); box-shadow: 0 8px 24px rgba(61, 220, 151, .25); }
.submit.sell:hover:not(:disabled) { box-shadow: 0 8px 24px rgba(255, 97, 112, .25); }
.pct button { transition: background .2s, color .2s, border-color .2s, transform .15s; }
.pct button:hover { transform: translateY(-1px); background: var(--raised); }
.inwrap input { transition: border-color .2s, box-shadow .2s; }
.inwrap input:focus { box-shadow: 0 0 0 3px rgba(110, 168, 255, .18); }
.shake { animation: shake .45s cubic-bezier(.36, .07, .19, .97) both; }
.est dd { transition: color .3s; }

/* Ринки */
body[data-section="client"] .mover { transition: background .2s, transform .25s, box-shadow .25s; }
body[data-section="client"] .mover:hover { transform: translateY(-2px) scale(1.01); box-shadow: 0 8px 22px rgba(0, 0, 0, .3); }
body[data-section="client"] tr.click { transition: background .2s; }
body[data-section="client"] .pchip { transition: transform .2s; }
body[data-section="client"] tr:hover .pchip { transform: scale(1.06); }
body[data-section="client"] .feed li { transition: background .2s, transform .2s; }
body[data-section="client"] .feed li:hover { transform: translateX(3px); }
body[data-section="client"] .op { animation: popIn .5s cubic-bezier(.3, 1.6, .5, 1) both; }

/* =====================================================================
   Екран входу: іскри, світіння, плаваючі монети, поява картки
   ===================================================================== */

.auth { position: relative; isolation: isolate; }
.auth-sparks { position: fixed; inset: 0; width: 100%; height: 100%; z-index: -1; pointer-events: none; }
.auth-glow { position: fixed; inset: 0; z-index: -2; pointer-events: none;
  background: radial-gradient(45% 45% at 25% 40%, rgba(61, 220, 151, .16), transparent 70%), radial-gradient(35% 40% at 80% 30%, rgba(240, 180, 41, .12), transparent 70%);
  animation: ambient 12s ease-in-out infinite alternate; }
.auth-coin { position: fixed; z-index: -1; display: grid; place-items: center; width: 52px; height: 52px; border: 1px solid var(--line-strong); border-radius: var(--r-lg); font-weight: 700; font-size: 22px; box-shadow: 0 14px 34px rgba(0, 0, 0, .4); animation: bob 6s ease-in-out infinite; pointer-events: none; }
.auth-coin.a1 { left: 8%; top: 18%; background: #3b2a14; color: #f7a23b; }
.auth-coin.a2 { right: 10%; top: 14%; background: #1c2a45; color: #8fb0ff; animation-delay: -2s; }
.auth-coin.a3 { right: 18%; bottom: 12%; background: #123128; color: var(--accent); animation-delay: -4s; }
.auth-intro { animation: riseIn .8s cubic-bezier(.2, .7, .2, 1) both; }
.auth-card { animation: cardIn .9s .15s cubic-bezier(.2, .8, .2, 1) both; position: relative; }
.auth-card::before { content: ''; position: absolute; inset: -1px; z-index: -1; border-radius: inherit; background: linear-gradient(120deg, rgba(61, 220, 151, .5), transparent 40%, transparent 60%, rgba(240, 180, 41, .4)); background-size: 300% 300%; animation: borderFlow 8s linear infinite; }
.auth-card input { transition: border-color .2s, box-shadow .25s; }
.auth-card input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(61, 220, 151, .16); }
.auth .segmented button { transition: background .25s, color .25s; }
@media (max-width: 900px) { .auth-coin { display: none; } }

/* =====================================================================
   CRM і адміністрування: щільно, стримано, більше даних на екрані
   ===================================================================== */

body[data-section="crm"], body[data-section="admin"] { --pad: 12px; --gap: 10px; --control: 30px; font-size: 13px; }
body[data-section="crm"] .main, body[data-section="admin"] .main { padding: 16px 20px 28px; max-width: none; }
body[data-section="crm"] h1, body[data-section="admin"] h1 { font-size: 19px; }
body[data-section="crm"] .page-head, body[data-section="admin"] .page-head { margin-bottom: 12px; }
body[data-section="crm"] .page-note, body[data-section="admin"] .page-note { font-size: 12px; margin-top: 2px; }
body[data-section="crm"] .panel-head, body[data-section="admin"] .panel-head { margin-bottom: 10px; }
body[data-section="crm"] td, body[data-section="admin"] td { padding: 7px 8px; }
body[data-section="crm"] th, body[data-section="admin"] th { padding: 6px 8px; }
body[data-section="crm"] .btn.small, body[data-section="admin"] .btn.small { min-height: 26px; padding: 0 8px; font-size: 12px; }
body[data-section="crm"] .stat, body[data-section="admin"] .stat { padding: 10px 12px; }
body[data-section="crm"] .stats, body[data-section="admin"] .stats { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }
body[data-section="crm"] .stat strong, body[data-section="admin"] .stat strong { font-size: 18px; }
body[data-section="crm"] .nav button, body[data-section="admin"] .nav button { min-height: 30px; }
body[data-section="crm"] .sidebar, body[data-section="admin"] .sidebar { width: 200px; }
body[data-section="crm"] .main, body[data-section="admin"] .main { margin-left: 200px; }
body[data-section="crm"] .thread, body[data-section="admin"] .thread { padding: 10px 12px; }
body[data-section="crm"] .empty, body[data-section="admin"] .empty { padding: 18px 12px; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: var(--gap); }
.kpi { display: grid; gap: 2px; padding: 10px 12px; border: 1px solid var(--line); border-left: 3px solid var(--line-strong); border-radius: var(--r); background: var(--panel); color: inherit; font: inherit; text-align: left; text-decoration: none; }
a.kpi, button.kpi { cursor: pointer; transition: border-color .15s, background .15s; }
a.kpi:hover, button.kpi:hover { background: var(--raised); text-decoration: none; }
.kpi small { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
.kpi strong { font-size: 20px; font-weight: 650; }
.kpi span { color: var(--faint); font-size: 11px; }
.kpi.warn { border-left-color: var(--warn); }
.kpi.warn strong { color: var(--warn); }
.kpi.danger { border-left-color: var(--danger); }
.kpi.danger strong { color: var(--danger); }

.toolbar { gap: 6px; }
.toolbar .seg { margin-right: 4px; }
.mini-select { width: auto; min-width: 120px; min-height: 30px; padding: 4px 8px; font-size: 12px; }
.count { margin-left: auto; font-size: 12px; }
.bulkbar { position: sticky; top: 0; z-index: 4; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 10px; padding: 8px 10px; border: 1px solid #2a5a48; border-radius: var(--r); background: #10241d; }
.bulkbar b { margin-right: 6px; font-size: 12px; }
th.sel, td.sel { width: 30px; padding-right: 0; }
td.sel input, th.sel input { width: 15px; height: 15px; min-height: 0; padding: 0; accent-color: var(--accent); cursor: pointer; }
tr.row-alert td { background: rgba(255, 97, 112, .06); }
.more { display: flex; justify-content: center; margin-top: 10px; }
.message.staff { border-left-color: var(--accent); }
.linkbtn.strong { color: var(--text); font-size: 13px; font-weight: 600; }
.linkbtn.strong:hover { color: var(--accent); }

/* =====================================================================
   Графік терміналу (chart.js) і стакан
   ===================================================================== */

.chart-mount { min-height: 300px; }
.tlc { display: flex; flex-direction: column; background: var(--panel); }
.tlc:fullscreen { height: 100vh; background: var(--bg); }
.tlc:fullscreen .tlc-body { flex: 1; min-height: 0; }
.tlc:fullscreen .tlc-stage { height: auto; }
.tlc-top { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; padding: 6px 8px; border-bottom: 1px solid var(--line); }
.tlc-group { display: inline-flex; gap: 2px; }
.tlc-sep { width: 1px; height: 20px; margin: 0 4px; background: var(--line); }
.tlc-grow { flex: 1; }
.tlc-btn { display: inline-flex; align-items: center; gap: 5px; min-height: 28px; padding: 0 8px; border: 0; border-radius: 4px; background: transparent; color: var(--muted); font-size: 12px; white-space: nowrap; cursor: pointer; }
.tlc-btn:hover { background: var(--raised); color: var(--text); }
.tlc-btn[aria-pressed="true"] { background: var(--raised); color: var(--accent); }
.tlc-btn svg, .tlc-tool svg, .tlc-lc svg, .tlc-x svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.tlc-ico { padding: 0 6px; }
.tlc-primary { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.tlc-primary:hover { background: #6ee9b8; color: var(--accent-ink); }
.tlc-body { display: flex; min-height: 0; }
.tlc-tools { display: flex; flex-direction: column; gap: 2px; padding: 6px 4px; border-right: 1px solid var(--line); background: var(--surface); }
.tlc-tool { display: grid; place-items: center; width: 32px; height: 32px; flex: none; border: 0; border-radius: 4px; background: transparent; color: var(--muted); cursor: pointer; }
.tlc-tool:hover { background: var(--raised); color: var(--text); }
.tlc-tool[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); }
.tlc-tsep { height: 1px; margin: 4px 2px; background: var(--line); }
.tlc-stage { position: relative; flex: 1; min-width: 0; height: 520px; overflow: hidden; outline: none; touch-action: none; cursor: crosshair; }
.tlc-stage:focus-visible { box-shadow: inset 0 0 0 2px var(--blue); }
.tlc-stage.panning { cursor: grabbing; }
.tlc-stage.over-drawing { cursor: move; }
.tlc-canvas { position: absolute; inset: 0; display: block; }
.tlc-legend { position: absolute; left: 8px; top: 6px; z-index: 2; display: grid; justify-items: start; gap: 2px; max-width: calc(100% - 100px); pointer-events: none; font-size: 12px; }
.tlc-lmain { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
.tlc-sym { color: var(--text); font-size: 13px; }
.tlc-ohlc { display: flex; flex-wrap: wrap; gap: 4px 10px; color: var(--muted); font-family: var(--mono); font-size: 11px; }
.tlc-ohlc b { color: var(--text); font-weight: 500; }
.tlc-plegends .tlc-li { position: absolute; left: 8px; z-index: 2; }
.tlc-li { display: inline-flex; align-items: center; gap: 8px; width: max-content; max-width: 100%; padding: 1px 4px; border-radius: 4px; color: var(--muted); font-family: var(--mono); font-size: 11px; pointer-events: auto; }
.tlc-li:hover, .tlc-li:focus-within { background: rgba(17, 24, 33, .9); }
.tlc-li.off { opacity: .5; }
.tlc-ln { color: var(--text); font-family: var(--font); font-size: 12px; }
.tlc-lc { display: inline-flex; gap: 2px; opacity: 0; transition: opacity .15s; }
.tlc-li:hover .tlc-lc, .tlc-li:focus-within .tlc-lc { opacity: 1; }
.tlc-lc button { display: grid; place-items: center; width: 22px; height: 22px; padding: 0; border: 0; border-radius: 4px; background: transparent; color: var(--muted); cursor: pointer; }
.tlc-lc button:hover { background: var(--raised); color: var(--text); }
.tlc-loading { position: absolute; inset: 0; z-index: 3; display: grid; place-items: center; align-content: center; gap: 10px; background: rgba(11, 16, 23, .7); color: var(--muted); font-size: 13px; }
.tlc-loading span { width: 120px; height: 3px; background: linear-gradient(90deg, transparent, var(--accent), transparent); background-size: 200% 100%; animation: shimmer 1s linear infinite; }
.tlc-pop { position: absolute; top: 8px; left: 50%; z-index: 5; width: min(420px, calc(100% - 16px)); max-height: calc(100% - 16px); overflow: auto; padding: 12px; transform: translateX(-50%); border: 1px solid var(--line-strong); border-radius: var(--r-lg); background: var(--panel); box-shadow: 0 20px 50px rgba(0, 0, 0, .5); }
.tlc-pop-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.tlc-x { display: grid; place-items: center; width: 28px; height: 28px; border: 0; border-radius: 4px; background: transparent; color: var(--muted); cursor: pointer; }
.tlc-x:hover { background: var(--raised); color: var(--text); }
.tlc-search { min-height: 32px; margin-bottom: 8px; font-size: 13px; }
.tlc-list { display: grid; gap: 1px; }
.tlc-gt { margin: 8px 0 4px; color: var(--faint); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; }
.tlc-list button { display: grid; grid-template-columns: 56px 1fr auto; align-items: center; gap: 8px; padding: 7px 8px; border: 0; border-radius: 4px; background: transparent; color: var(--text); font-size: 13px; text-align: left; cursor: pointer; }
.tlc-list button:hover { background: var(--raised); }
.tlc-list button b { color: var(--accent); font-family: var(--mono); font-size: 12px; }
.tlc-list button small { display: inline; color: var(--faint); }
.tlc-list button[hidden] { display: none; }
.tlc-form { display: grid; gap: 10px; }
.tlc-form label { display: grid; grid-template-columns: 1fr 120px; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; }
.tlc-form input { min-height: 30px; padding: 4px 8px; }
.tlc-form input[type="color"] { height: 30px; padding: 2px; }
.tlc-form-foot { display: flex; justify-content: flex-end; gap: 6px; }
.tlc-ctx { position: absolute; z-index: 6; display: grid; min-width: 230px; padding: 4px; border: 1px solid var(--line-strong); border-radius: var(--r); background: var(--panel); box-shadow: 0 14px 34px rgba(0, 0, 0, .5); }
.tlc-ctx button { padding: 8px 10px; border: 0; border-radius: 4px; background: transparent; color: var(--text); font-size: 13px; text-align: left; cursor: pointer; }
.tlc-ctx button:hover, .tlc-ctx button:focus-visible { background: var(--raised); }
.tlc-text { position: absolute; z-index: 6; width: 180px; min-height: 28px; padding: 4px 8px; font-size: 12px; }

.book { display: grid; gap: 2px; font-family: var(--mono); font-size: 12px; }
.book-tabs { width: 100%; margin-bottom: 6px; font-family: var(--font); }
.book-tabs button { flex: 1; }
.lvl { position: relative; display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; padding: 2px 6px; border-radius: 2px; }
.lvl > span { position: relative; z-index: 1; text-align: right; }
.lvl > span:first-child { text-align: left; }
.lvl::before { content: ''; position: absolute; top: 0; right: 0; bottom: 0; width: var(--w, 0%); border-radius: 2px; transition: width .4s ease; }
.lvl.ask > span:first-child { color: var(--down); }
.lvl.bid > span:first-child { color: var(--up); }
.lvl.ask::before { background: rgba(255, 97, 112, .12); }
.lvl.bid::before { background: rgba(61, 220, 151, .12); }
.lvl.trade::before, .lvl.head::before { display: none; }
.lvl.head { color: var(--faint); font-family: var(--font); font-size: 11px; }
.spread { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin: 4px 0; padding: 6px; border-block: 1px solid var(--line); }
.spread b { font-size: 15px; }
.spread small { display: inline; font-family: var(--font); }
.book .fine { margin-top: 6px; font-family: var(--font); }

@media (max-width: 900px) {
  .tlc-body { flex-direction: column; }
  .tlc-stage { flex: none; }
  .tlc:fullscreen .tlc-stage { flex: 1; }
  .tlc-tools { flex: none; flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .tlc-tsep { width: 1px; height: auto; margin: 2px 4px; }
  .tlc-btn span { display: none; }
}

/* Палітра команд */
.palette { width: min(560px, 94vw); margin-top: 12vh; padding: 0; overflow: hidden; }
.palette::backdrop { background: rgba(3, 6, 10, .6); }
.palette input { min-height: 46px; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: transparent; font-size: 15px; padding: 0 16px; }
.palette input:focus-visible { outline: none; }
.palette-list { margin: 0; padding: 6px; list-style: none; max-height: 50vh; overflow: auto; }
.palette-list li { display: flex; justify-content: space-between; gap: 12px; padding: 9px 10px; border-radius: var(--r); cursor: pointer; }
.palette-list li[aria-selected="true"], .palette-list li:hover { background: var(--raised); }
.palette-list li small { display: inline; color: var(--faint); }
.palette-help { padding: 8px 16px 12px; margin: 0; border-top: 1px solid var(--line); }

@media (max-width: 900px) {
  body[data-section="crm"] .main, body[data-section="admin"] .main { margin-left: 0; padding: 14px 12px 26px; }
  body[data-section="crm"] .sidebar, body[data-section="admin"] .sidebar { width: auto; }
  .count { margin-left: 0; }
}

/* =====================================================================
   Деривативи: ф’ючерси, сировина, валюти
   ===================================================================== */

.dv-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: var(--gap); margin-bottom: var(--gap); }
.dv-strip .stat strong { font-size: 19px; font-variant-numeric: tabular-nums; }
.dv-strip .stat[data-glow="up"] { border-color: rgba(61, 220, 151, .35); animation: glowUp 2.4s ease-in-out infinite; }
.dv-strip .stat[data-glow="down"] { border-color: rgba(255, 97, 112, .35); animation: glowDown 2.4s ease-in-out infinite; }

.dv-classes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--gap); margin-bottom: var(--gap); }
.dv-classes button { position: relative; display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 10px 14px; overflow: hidden; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--panel); color: var(--muted); font: inherit; font-weight: 600; cursor: pointer; text-align: left; transition: color .25s, border-color .25s, transform .3s cubic-bezier(.3, 1.5, .5, 1), box-shadow .3s; }
.dv-classes button .ic { width: 22px; height: 22px; transition: transform .45s cubic-bezier(.3, 1.6, .5, 1); }
.dv-classes button small { display: inline-grid; place-items: center; min-width: 24px; height: 20px; margin-left: auto; padding: 0 6px; border-radius: 10px; background: var(--raised); color: var(--faint); font-size: 11px; }
.dv-classes button:hover { color: var(--text); transform: translateY(-2px); }
.dv-classes button:hover .ic { transform: rotate(-10deg) scale(1.18); }
.dv-classes button.active { color: var(--text); border-color: transparent; background:
  linear-gradient(var(--panel), var(--panel)) padding-box,
  linear-gradient(120deg, var(--accent), var(--blue), var(--warn), var(--accent)) border-box;
  background-size: 100% 100%, 300% 300%; animation: borderFlow 6s linear infinite; box-shadow: 0 10px 30px rgba(61, 220, 151, .12); }
.dv-classes button.active .ic { color: var(--accent); filter: drop-shadow(0 0 8px rgba(61, 220, 151, .7)); }
.dv-classes button.active small { background: var(--accent-soft); color: var(--accent); }
.dv-classes button::before { content: ''; position: absolute; inset: 0; pointer-events: none; opacity: 0; background: radial-gradient(160px circle at var(--mx, 50%) var(--my, 50%), rgba(110, 168, 255, .16), transparent 70%); transition: opacity .3s; }
.dv-classes button:hover::before { opacity: 1; }

.dv-bar .pb-pair h2 small { padding: 1px 5px; border-radius: 4px; background: var(--warn-soft); color: var(--warn); font-size: 10px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; vertical-align: 3px; }
.dv-bar .pb-stat b + b { margin-top: 1px; color: var(--muted); font-size: 12px; }
.mstate { display: inline-flex; align-items: center; gap: 6px; }
.mstate i { position: relative; width: 8px; height: 8px; border-radius: 50%; background: var(--faint); }
.mstate.on { color: var(--up); }
.mstate.on i { background: var(--up); box-shadow: 0 0 10px var(--up); }
.mstate.on i::after { content: ''; position: absolute; inset: 0; border-radius: 50%; background: var(--up); animation: ping 1.6s cubic-bezier(0, 0, .2, 1) infinite; }
.mstate.off { color: var(--faint); }
.mstate.big { margin: 6px 0 10px; font-size: 15px; font-weight: 650; }
.mstate.big i { width: 11px; height: 11px; }
.dv-dot { justify-self: center; width: 7px; height: 7px; border-radius: 50%; background: var(--line-strong); }
.dv-dot.on { background: var(--up); box-shadow: 0 0 8px rgba(61, 220, 151, .7); animation: breathe 2.6s ease-in-out infinite; }
.prow.closed .prow-main { opacity: .62; }

.tk.dvk-commodities { background: linear-gradient(135deg, #3d2f12, #241b0a); color: #ffd166; }
.tk.dvk-commodities.c-XAGUSD, .tk.dvk-commodities.c-XPTUSD, .tk.dvk-commodities.c-XPDUSD { background: linear-gradient(135deg, #2b3340, #1a1f28); color: #dfe6f0; }
.tk.dvk-commodities.c-WTI, .tk.dvk-commodities.c-BRENT, .tk.dvk-commodities.c-NGAS { background: linear-gradient(135deg, #2b1d14, #170f0a); color: #ff8a5b; }
.tk.dvk-commodities.c-COPPER { background: linear-gradient(135deg, #3a2014, #1f110a); color: #ff9e6b; }
.tk.dvk-commodities.c-WHEAT, .tk.dvk-commodities.c-CORN, .tk.dvk-commodities.c-COFFEE, .tk.dvk-commodities.c-SUGAR, .tk.dvk-commodities.c-COCOA { background: linear-gradient(135deg, #24301a, #141c0d); color: #b9e07a; }
.tk.dvk-forex { background: linear-gradient(135deg, #18284a, #0f1730); color: #8fb0ff; font-size: 11px; }
.tk.dvk { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .06); }

.dv-order { position: relative; overflow: hidden; }
.dv-order::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 2px; background: linear-gradient(90deg, transparent, var(--up), transparent); background-size: 200% 100%; animation: shimmer 2.2s linear infinite; }
.dv-order.short::before { background-image: linear-gradient(90deg, transparent, var(--down), transparent); }
.dv-type { display: grid; grid-template-columns: repeat(3, 1fr); width: 100%; }
.dv-type button { min-height: 28px; }
.dv-side button { font-size: 14px; letter-spacing: .02em; }
.tpsl { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tpsl .field { font-size: 12px; }
.tpsl .inwrap input { padding-right: 34px; }

.lev { display: grid; gap: 8px; padding: 10px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); --heat: var(--up); transition: border-color .3s, box-shadow .3s; }
.lev[data-heat="warm"] { --heat: var(--warn); }
.lev[data-heat="hot"] { --heat: var(--down); border-color: rgba(255, 97, 112, .35); box-shadow: 0 0 22px rgba(255, 97, 112, .12); }
.lev-head { display: flex; justify-content: space-between; align-items: baseline; font-size: 13px; color: var(--muted); }
.lev-head b { color: var(--heat); font-size: 20px; font-weight: 750; font-variant-numeric: tabular-nums; text-shadow: 0 0 14px color-mix(in srgb, var(--heat) 55%, transparent); transition: color .3s; }
.lev-head b.lev-bump { animation: levBump .3s cubic-bezier(.3, 1.8, .5, 1); }
.lev input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; height: 6px; min-height: 0; padding: 0; border: 0; border-radius: 3px; cursor: pointer;
  background: linear-gradient(90deg, var(--up), var(--heat)) 0 0 / var(--fill, 0%) 100% no-repeat, var(--raised); }
.lev input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; border: 3px solid var(--panel); border-radius: 50%; background: var(--heat); box-shadow: 0 0 0 2px var(--heat), 0 0 16px var(--heat); transition: transform .2s; }
.lev input[type="range"]::-moz-range-thumb { width: 14px; height: 14px; border: 3px solid var(--panel); border-radius: 50%; background: var(--heat); box-shadow: 0 0 0 2px var(--heat), 0 0 16px var(--heat); }
.lev input[type="range"]:active::-webkit-slider-thumb { transform: scale(1.25); }
.lev input[type="range"]:focus-visible { outline: 2px solid var(--blue); outline-offset: 4px; }
.lev-presets { display: flex; flex-wrap: wrap; gap: 4px; }
.lev-presets button { position: relative; overflow: hidden; flex: 1; min-width: 38px; min-height: 24px; border: 1px solid var(--line); border-radius: 4px; background: transparent; color: var(--muted); font-size: 11px; font-weight: 600; cursor: pointer; transition: color .2s, border-color .2s, background .2s, transform .15s; }
.lev-presets button:hover { color: var(--text); transform: translateY(-1px); }
.lev-presets button.active { border-color: var(--heat); background: color-mix(in srgb, var(--heat) 14%, transparent); color: var(--heat); }

tr.dvpos td:first-child { box-shadow: inset 3px 0 0 var(--up); }
tr.dvpos.short td:first-child { box-shadow: inset 3px 0 0 var(--down); }
tr.dvpos td small { display: block; font-size: 11px; }
tr.dvpos[data-risk="high"] td { animation: dangerPulse 1.2s ease-in-out infinite; }
.dvtags { margin-top: 3px; }
.liq { display: block; color: #ff8a5b; }
.risk { display: block; width: 64px; height: 4px; margin: 4px 0 0 auto; overflow: hidden; border-radius: 2px; background: var(--raised); }
.risk i { display: block; width: var(--fill, 0%); height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--up), var(--warn), var(--down)); background-size: 64px 100%; transition: width .6s cubic-bezier(.2, .8, .2, 1); }
.content.dv-quake { animation: quake .6s cubic-bezier(.36, .07, .19, .97); }

.dv-session h3 { font-size: 13px; color: var(--muted); }
.dv-session .kv { margin-bottom: 8px; }
.dv-stats { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.dv-curve { grid-row: span 2; display: grid; gap: 6px; padding: 10px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
.dv-spark { width: 100%; height: 120px; }
.dv-spark .base { stroke: var(--line-strong); stroke-dasharray: 3 4; fill: none; }
.dv-spark .line { fill: none; stroke: var(--up); stroke-width: 2; stroke-linejoin: round; stroke-dasharray: 1200; stroke-dashoffset: 1200; animation: draw 1.6s cubic-bezier(.2, .7, .2, 1) forwards; filter: drop-shadow(0 0 6px rgba(61, 220, 151, .5)); }
.dv-spark.down .line { stroke: var(--down); filter: drop-shadow(0 0 6px rgba(255, 97, 112, .5)); }
.dv-spark .area { fill: rgba(61, 220, 151, .1); animation: fadeIn 1.2s .4s both; }
.dv-spark.down .area { fill: rgba(255, 97, 112, .1); }
.dv-bars { display: grid; gap: 8px; }
.dv-barrow { display: grid; grid-template-columns: 110px minmax(0, 1fr) 90px; align-items: center; gap: 10px; font-size: 13px; }
.dv-barrow small { display: inline; margin-left: 6px; color: var(--faint); }
.dv-barrow b { text-align: right; font-variant-numeric: tabular-nums; }
.dv-track { height: 8px; overflow: hidden; border-radius: 4px; background: var(--raised); }
.dv-track i { display: block; width: var(--fill, 0%); height: 100%; border-radius: inherit; background: var(--up); animation: grow 1s cubic-bezier(.2, .8, .2, 1) both; transform-origin: left; }
.dv-track i.down { background: var(--down); }

@media (max-width: 900px) {
  .dv-classes { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  .dv-classes button { flex-direction: column; justify-content: center; gap: 4px; min-height: 64px; padding: 8px 4px; font-size: 12px; text-align: center; }
  .dv-classes button small { margin-left: 0; }
  .dv-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dv-strip .stat strong { font-size: 16px; }
  .dv-stats { grid-template-columns: minmax(0, 1fr); }
  .dv-barrow { grid-template-columns: 90px minmax(0, 1fr) 80px; }
  .dv-bar { gap: 12px; }
}

/* =====================================================================
   Більше руху в клієнтській частині
   ===================================================================== */

/* Нахил карток і прожектор під курсором */
body[data-section="client"] .stat, body[data-section="client"] .mover { position: relative; transform-style: preserve-3d; }
body[data-section="client"] .tilting { transform: perspective(700px) rotateX(var(--rx, 0)) rotateY(var(--ry, 0)) translateY(-2px); box-shadow: 0 16px 34px rgba(0, 0, 0, .35); transition: transform .08s linear, box-shadow .3s; }
body[data-section="client"] .stat::after { content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; opacity: 0; background: radial-gradient(180px circle at var(--mx, 50%) var(--my, 50%), rgba(255, 255, 255, .07), transparent 70%); transition: opacity .3s; }
body[data-section="client"] .stat.tilting::after { opacity: 1; }

/* Поява блоків під час прокрутки */
body[data-section="client"] .reveal { opacity: 0; transform: translateY(26px) scale(.985); transition: opacity .7s cubic-bezier(.2, .7, .2, 1), transform .7s cubic-bezier(.2, .7, .2, 1); }
body[data-section="client"] .reveal.revealed { opacity: 1; transform: none; }

/* Заголовок сторінки і бренд */
body[data-section="client"] #pageTitle { background: linear-gradient(90deg, var(--text) 0%, var(--text) 40%, var(--accent) 50%, var(--text) 60%, var(--text) 100%); background-size: 300% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; animation: titleSweep 7s ease-in-out infinite; }
body[data-section="client"] .sidebar .brand span { animation: breathe 3.5s ease-in-out infinite; }
body[data-section="client"] .conn .dot:not(.off) { animation: breathe 2s ease-in-out infinite; }

/* Вхід на сторінку: вкладки, статистика і рядки отримують каскад */
.content.page-enter .dv-strip .stat, .content.page-enter .dv-classes button, .content.page-enter .stats .stat { animation: cardIn .7s cubic-bezier(.2, .8, .2, 1) both; }
.content.page-enter .dv-strip .stat:nth-child(2), .content.page-enter .dv-classes button:nth-child(2), .content.page-enter .stats .stat:nth-child(2) { animation-delay: .06s; }
.content.page-enter .dv-strip .stat:nth-child(3), .content.page-enter .dv-classes button:nth-child(3), .content.page-enter .stats .stat:nth-child(3) { animation-delay: .12s; }
.content.page-enter .dv-strip .stat:nth-child(4), .content.page-enter .stats .stat:nth-child(4) { animation-delay: .18s; }
.content.page-enter .dv-strip .stat:nth-child(5) { animation-delay: .24s; }
.content.page-enter .dv-strip .stat:nth-child(6) { animation-delay: .3s; }
.content.page-enter .badge { animation: popIn .45s .25s cubic-bezier(.3, 1.6, .5, 1) both; }
.content.page-enter .pairbar .pb-stat { animation: riseIn .5s cubic-bezier(.2, .7, .2, 1) both; }
.content.page-enter .pairbar .pb-stat:nth-child(3) { animation-delay: .05s; }
.content.page-enter .pairbar .pb-stat:nth-child(4) { animation-delay: .1s; }
.content.page-enter .pairbar .pb-stat:nth-child(5) { animation-delay: .15s; }
.content.page-enter .pairbar .pb-stat:nth-child(n+6) { animation-delay: .2s; }
.content.page-enter .chart-mount { animation: chartIn .9s cubic-bezier(.2, .8, .2, 1) both; }

/* Рядки таблиць: смуга підсвітки, що пробігає при наведенні */
body[data-section="client"] tbody tr { position: relative; transition: background .25s; }
body[data-section="client"] tbody tr:hover td { background: linear-gradient(90deg, rgba(110, 168, 255, .06), transparent 70%); }
body[data-section="client"] .row-actions .btn { transition: transform .2s cubic-bezier(.3, 1.6, .5, 1), background .2s, box-shadow .2s; }
body[data-section="client"] .row-actions .btn:hover { transform: translateY(-2px) scale(1.04); }

/* Ціни, що змінились, спалахують сильніше */
body[data-section="client"] .flash-up { animation: flashUp .9s ease-out, pricePop .35s cubic-bezier(.3, 1.6, .5, 1); }
body[data-section="client"] .flash-down { animation: flashDown .9s ease-out, pricePop .35s cubic-bezier(.3, 1.6, .5, 1); }
body[data-section="client"] .pb-last b { display: inline-block; }

/* Сегменти й вкладки: м’який підскок активної */
body[data-section="client"] .seg button { transition: background .25s, color .25s, transform .25s cubic-bezier(.3, 1.6, .5, 1), box-shadow .25s; }
body[data-section="client"] .seg button.active { transform: scale(1.03); }
body[data-section="client"] .seg button:hover:not(.active) { transform: translateY(-1px); }

/* Кнопка угоди: живий градієнт */
body[data-section="client"] .submit.buy { background: linear-gradient(110deg, #2fc887, var(--accent), #7af0bf, var(--accent)); background-size: 250% 100%; animation: ring 3s ease-out infinite, gradShift 5s linear infinite; }
body[data-section="client"] .submit.sell { background: linear-gradient(110deg, #e94b5b, var(--danger), #ff9aa4, var(--danger)); background-size: 250% 100%; animation: ringDown 3s ease-out infinite, gradShift 5s linear infinite; }

/* Порожні стани і скелети */
body[data-section="client"] .empty { animation: floaty 5s ease-in-out infinite; }
body[data-section="client"] .tk { transition: transform .4s cubic-bezier(.3, 1.6, .5, 1); }
body[data-section="client"] .prow:hover .tk, body[data-section="client"] tr:hover .tk, body[data-section="client"] .mover:hover .tk { transform: rotate(-8deg) scale(1.15); }

/* ---------- ключові кадри ---------- */
@keyframes glowUp { 50% { box-shadow: 0 0 26px rgba(61, 220, 151, .22); } }
@keyframes glowDown { 50% { box-shadow: 0 0 26px rgba(255, 97, 112, .22); } }
@keyframes ping { 75%, 100% { transform: scale(2.6); opacity: 0; } }
@keyframes breathe { 50% { opacity: .55; } }
@keyframes levBump { 50% { transform: scale(1.25); } }
@keyframes dangerPulse { 50% { background: rgba(255, 97, 112, .1); } }
@keyframes quake { 10%, 90% { transform: translate(-2px, 1px); } 20%, 80% { transform: translate(4px, -2px); } 30%, 50%, 70% { transform: translate(-6px, 2px); } 40%, 60% { transform: translate(6px, -1px); } }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes grow { from { transform: scaleX(0); } }
@keyframes titleSweep { 0%, 100% { background-position: 100% 0; } 50% { background-position: 0 0; } }
@keyframes chartIn { from { opacity: 0; transform: scale(.98); filter: blur(4px); } to { opacity: 1; transform: none; filter: none; } }
@keyframes pricePop { 50% { transform: scale(1.06); } }
@keyframes ringDown { 0% { box-shadow: 0 0 0 0 rgba(255, 97, 112, .4); } 70%, 100% { box-shadow: 0 0 0 12px rgba(255, 97, 112, 0); } }
@keyframes floaty { 50% { transform: translateY(-4px); } }

@keyframes gradShift { to { background-position: 250% 0; } }
@keyframes ambient { to { transform: translate3d(2%, 3%, 0) scale(1.08); } }
@keyframes riseIn { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
@keyframes slideIn { from { opacity: 0; transform: translateX(-10px); } to { opacity: 1; transform: none; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes titleIn { from { opacity: 0; transform: translateY(8px); letter-spacing: .02em; } to { opacity: 1; transform: none; } }
@keyframes ring { 0% { box-shadow: 0 0 0 0 rgba(61, 220, 151, .4); } 70%, 100% { box-shadow: 0 0 0 12px rgba(61, 220, 151, 0); } }
@keyframes ripple { to { transform: scale(36); opacity: 0; } }
@keyframes toastIn { from { opacity: 0; transform: translateY(18px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes toastBar { from { transform: scaleX(1); } to { transform: scaleX(0); } }
@keyframes ticker { to { transform: translateX(-50%); } }
@keyframes borderFlow { to { background-position: 0 0, 300% 0; } }
@keyframes sheen { 0%, 100% { background-position: 150% 0; } 50% { background-position: -50% 0; } }
@keyframes wipe { from { clip-path: inset(0 100% 0 0); opacity: .4; } to { clip-path: inset(0 0 0 0); opacity: 1; } }
@keyframes dash { to { stroke-dashoffset: -16; } }
@keyframes pulseSquare { 0% { transform: scale(1); opacity: 1; } 100% { transform: scale(3); opacity: 0; } }
@keyframes shake { 10%, 90% { transform: translateX(-1px); } 20%, 80% { transform: translateX(3px); } 30%, 50%, 70% { transform: translateX(-5px); } 40%, 60% { transform: translateX(5px); } }
@keyframes popIn { from { transform: scale(.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes bob { 50% { transform: translate3d(0, -14px, 0) rotate(-3deg); } }
@keyframes cardIn { from { opacity: 0; transform: translateY(24px) scale(.97); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
  .auth-sparks, .burst { display: none; }
  .grad { background: none; color: var(--accent); -webkit-text-fill-color: currentColor; }
  body[data-section="client"] .hero-total b { background: none; color: var(--text); -webkit-text-fill-color: currentColor; }
  body[data-section="client"] #pageTitle { background: none; color: var(--text); -webkit-text-fill-color: currentColor; }
  body[data-section="client"] .reveal { opacity: 1; transform: none; }
  .dv-spark .line { stroke-dashoffset: 0; }
}
