:root {
  --bg: #131722;
  --panel: #1e222d;
  --panel-2: #2a2e39;
  --border: #2a2e39;
  --text: #d1d4dc;
  --muted: #787b86;
  --accent: #2962ff;
  --up: #089981;
  --down: #f23645;
  --gap: #0c0e15;
  --shadow: rgba(0, 0, 0, 0.5);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--gap); color: var(--text); font-size: 13px; overflow: clip; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input, textarea, select { font: inherit; color: var(--text); }

/* ---------- top bar ---------- */
#topbar {
  height: 44px; display: flex; align-items: center; gap: 4px; padding: 0 8px;
  background: var(--bg); border-bottom: 4px solid var(--gap); overflow-x: auto; scrollbar-width: none; white-space: nowrap;
}
#symbol-btn {
  display: flex; align-items: center; gap: 8px; padding: 0 12px; height: 32px; border-radius: 4px; color: var(--muted);
  min-width: 130px;
}
#symbol-btn:hover { background: var(--panel-2); }
#symbol-btn-text { font-weight: 600; font-size: 14px; color: var(--text); }
.divider { width: 1px; height: 22px; background: var(--border); margin: 0 4px; }
#intervals { display: flex; gap: 2px; }
#intervals button { padding: 6px 8px; border-radius: 4px; color: var(--text); font-weight: 500; }
#intervals button:hover { background: var(--panel-2); }
#intervals button.active { color: var(--accent); background: rgba(41, 98, 255, 0.12); }
.icon-btn { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 4px; color: var(--text); }
.icon-btn:hover { background: var(--panel-2); }
.spacer { flex: 1; }
.brand { color: var(--muted); font-size: 12px; padding-right: 6px; }

/* ---------- layout ---------- */
#main { display: flex; height: calc(100% - 44px); gap: 4px; }
#chart-wrap { position: relative; flex: 1; min-width: 0; background: var(--bg); }
.cw-chart { position: absolute; inset: 0; }

/* ---------- left toolbar ---------- */
#toolbar {
  width: 52px; flex: none; background: var(--bg); display: flex; flex-direction: column; align-items: center;
  padding: 6px 0; gap: 2px; overflow-y: auto;
}
.tb-group { position: relative; display: flex; }
.tb-btn {
  width: 40px; height: 38px; display: grid; place-items: center; border-radius: 4px; color: var(--text);
}
.tb-btn:hover { background: var(--panel-2); }
.tb-btn.active, .tb-btn.on { color: var(--accent); }
.tb-btn.active { background: rgba(41, 98, 255, 0.12); }
.tb-more {
  position: absolute; right: -6px; top: 0; bottom: 0; width: 12px; display: grid; place-items: center;
  color: var(--muted); opacity: 0; border-radius: 3px;
}
.tb-group:hover .tb-more { opacity: 1; }
.tb-more:hover { background: var(--panel-2); color: var(--text); }
.tb-sep { width: 28px; height: 1px; background: var(--border); margin: 6px 0; }

.flyout {
  position: fixed; z-index: 50; background: var(--panel); border-radius: 8px; padding: 6px 0;
  box-shadow: 0 6px 24px var(--shadow); min-width: 280px; max-height: calc(100vh - 16px); overflow-y: auto;
}
.flyout-item {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 4px 14px 4px 8px; text-align: left;
}
.flyout-item:hover { background: var(--panel-2); }
.flyout-item.active { color: var(--accent); }
.flyout-item span { flex: 1; }
.flyout-item kbd { color: var(--muted); font-family: inherit; font-size: 11px; }

/* ---------- legend ---------- */
.legend { position: absolute; top: 8px; left: 12px; z-index: 3; pointer-events: none; }
.legend-title { font-size: 15px; font-weight: 500; margin-bottom: 4px; }
.legend-ohlc { display: flex; gap: 10px; flex-wrap: wrap; color: var(--muted); font-size: 12px; }
.legend-ohlc b { font-weight: 500; margin-left: 3px; }

/* ---------- style bar ---------- */
#style-bar {
  position: absolute; top: 56px; left: 50%; transform: translateX(-50%); z-index: 5;
  display: flex; align-items: center; gap: 6px; padding: 5px 6px; border-radius: 6px;
  background: var(--panel); box-shadow: 0 4px 20px rgba(0, 0, 0, 0.45);
}
#style-bar[hidden] { display: none; }
.sb-name { color: var(--muted); font-size: 12px; padding: 0 6px; white-space: nowrap; }
.sb-colors { display: flex; align-items: center; gap: 3px; padding: 0 4px; border-left: 1px solid var(--border); }
.sb-swatch { width: 18px; height: 18px; border-radius: 3px; outline-offset: 1px; }
.sb-swatch.active { outline: 2px solid #fff; }
.sb-custom { width: 22px; height: 22px; padding: 0; border: 0; background: none; cursor: pointer; }
.sb-seg { display: flex; border-left: 1px solid var(--border); padding-left: 4px; }
.sb-seg button { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 4px; }
.sb-seg button:hover { background: var(--panel-2); }
.sb-seg button.active { background: rgba(41, 98, 255, 0.2); }
.sb-seg span { display: block; width: 16px; background: var(--text); border-radius: 1px; }
.sb-seg .dash-solid { height: 2px; }
.sb-seg .dash-dashed { height: 0; border-top: 2px dashed var(--text); background: none; }
.sb-seg .dash-dotted { height: 0; border-top: 2px dotted var(--text); background: none; }
.sb-text {
  width: 180px; resize: none; background: var(--bg); border: 1px solid var(--border); border-radius: 4px;
  padding: 4px 6px; outline: none; height: 28px;
}
.sb-text:focus { border-color: var(--accent); }
.sb-select { background: var(--bg); border: 1px solid var(--border); border-radius: 4px; height: 28px; }
.sb-icon { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 4px; color: var(--text); }
.sb-icon svg { width: 22px; height: 22px; }
.sb-icon:hover { background: var(--panel-2); }
.sb-icon.on { color: var(--accent); }
.sb-icon:last-child:hover { color: var(--down); }

/* ---------- watchlist ---------- */
#watchlist { width: 280px; flex: none; background: var(--bg); display: flex; flex-direction: column; }
.wl-head { padding: 12px 14px 8px; font-weight: 600; font-size: 14px; }
#wl-add {
  margin: 0 10px 8px; padding: 7px 8px; border-radius: 4px; background: var(--panel); color: var(--muted); text-align: left;
}
#wl-add:hover { color: var(--text); background: var(--panel-2); }
.perp {
  font-style: normal; font-size: 9px; font-weight: 600; color: #f0b90b; border: 1px solid rgba(240,185,11,.5);
  border-radius: 3px; padding: 0 3px; margin-left: 5px; vertical-align: 1px;
}
.wl-cols, .wl-row { display: grid; grid-template-columns: 1fr 90px 64px 18px; align-items: center; padding: 0 10px 0 14px; }
.wl-cols { color: var(--muted); font-size: 11px; padding-bottom: 4px; border-bottom: 1px solid var(--border); }
.wl-cols span:not(:first-child) { text-align: right; }
#wl-list { overflow-y: auto; flex: 1; }
.wl-row { height: 34px; cursor: pointer; }
.wl-row:hover { background: var(--panel); }
.wl-row.active { background: rgba(41, 98, 255, 0.14); }
.wl-sym { font-weight: 500; }
.wl-sym small { color: var(--muted); font-weight: 400; margin-left: 2px; font-size: 10px; }
.wl-price, .wl-chg { text-align: right; font-variant-numeric: tabular-nums; }
.wl-del { color: var(--muted); opacity: 0; font-size: 16px; line-height: 1; justify-self: end; }
.wl-row:hover .wl-del { opacity: 1; }
.wl-del:hover { color: var(--down); }
.flash-up { animation: flashUp 0.8s; }
.flash-down { animation: flashDown 0.8s; }
@keyframes flashUp { from { color: var(--up); } }
@keyframes flashDown { from { color: var(--down); } }

/* ---------- misc ---------- */
.cw-loading { position: absolute; inset: 0; display: grid; place-items: center; z-index: 4; pointer-events: none; }
.cw-loading[hidden] { display: none; }
.spinner {
  width: 32px; height: 32px; border-radius: 50%; border: 3px solid var(--panel-2); border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
#toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 100;
  background: var(--panel-2); padding: 10px 16px; border-radius: 6px; box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}
#toast[hidden] { display: none; }

@media (max-width: 900px) { #watchlist { display: none; } .brand { display: none; } }

/* ---------- indicators ---------- */
.text-btn {
  display: flex; align-items: center; gap: 6px; height: 32px; padding: 0 10px; border-radius: 4px; font-weight: 500;
}
.text-btn:hover { background: var(--panel-2); }
.ind-menu {
  position: fixed; z-index: 60; background: var(--panel); border-radius: 6px; padding: 6px 0; min-width: 300px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.5);
}
.ind-menu button { display: flex; flex-direction: column; width: 100%; text-align: left; padding: 7px 14px; gap: 2px; }
.ind-menu button:hover { background: var(--panel-2); }
.ind-menu b { font-weight: 500; }
.ind-menu span { color: var(--muted); font-size: 12px; }

.legend-ind { margin-top: 4px; display: flex; flex-direction: column; gap: 1px; }
.pane-legend { position: absolute; left: 12px; z-index: 3; }
.ind-row {
  display: inline-flex; align-items: center; gap: 8px; height: 22px; padding: 0 4px; margin-left: -4px;
  border-radius: 4px; pointer-events: auto; font-size: 12px; width: fit-content;
}
.ind-row:hover { background: rgba(42, 46, 57, 0.85); }
.ind-title { color: var(--text); cursor: pointer; }
.ind-vals { display: flex; gap: 8px; }
.ind-vals b { font-weight: 500; font-variant-numeric: tabular-nums; }
.ind-row.off .ind-title, .ind-row.off .ind-vals { opacity: 0.4; }
.ind-actions { display: flex; gap: 2px; opacity: 0.35; transition: opacity .12s; }
.ind-row:hover .ind-actions, .ind-row.selected .ind-actions { opacity: 1; }
.ind-row.selected { background: rgba(41, 98, 255, 0.18); outline: 1px solid rgba(41, 98, 255, 0.5); }
.ind-actions button { width: 20px; height: 20px; display: grid; place-items: center; border-radius: 3px; color: var(--muted); }
.ind-actions button:hover { color: var(--text); background: var(--panel-2); }

.ind-dialog-backdrop { position: fixed; inset: 0; z-index: 80; background: rgba(0, 0, 0, 0.4); display: grid; place-items: center; }
.ind-dialog { background: var(--panel); border-radius: 8px; width: 320px; box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6); padding-bottom: 4px; }
.ind-dialog-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; font-size: 15px; font-weight: 600; border-bottom: 1px solid var(--border); }
.ind-dialog-head button { color: var(--muted); }
.ind-dialog-section { padding: 12px 16px 4px; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; }
.ind-dialog label { display: flex; justify-content: space-between; align-items: center; padding: 5px 16px; }
.ind-dialog input[type=number] { width: 90px; background: var(--bg); border: 1px solid var(--border); border-radius: 4px; padding: 5px 8px; outline: none; }
.ind-dialog input[type=number]:focus { border-color: var(--accent); }
.ind-dialog input[type=color] { width: 32px; height: 24px; border: 0; padding: 0; background: none; cursor: pointer; }
.ind-dialog-foot { display: flex; gap: 8px; padding: 14px 16px 12px; margin-top: 8px; border-top: 1px solid var(--border); }
.btn-primary { background: var(--accent); color: #fff; padding: 6px 16px; border-radius: 4px; font-weight: 500; }
.btn-ghost { padding: 6px 12px; border-radius: 4px; color: var(--text); }
.btn-ghost:hover { background: var(--panel-2); }

#hint {
  position: absolute; bottom: 44px; left: 50%; transform: translateX(-50%); z-index: 5; pointer-events: none;
  background: rgba(42, 46, 57, 0.92); padding: 6px 12px; border-radius: 4px; font-size: 12px; color: var(--text); white-space: nowrap;
}
#hint[hidden] { display: none; }

/* ---------- futures legend ---------- */
.tag {
  font-size: 11px; font-weight: 500; color: #f0b90b; background: rgba(240,185,11,.12); padding: 1px 6px; border-radius: 3px;
  vertical-align: 2px;
}
.legend-fut { display: flex; gap: 12px; color: var(--muted); font-size: 12px; margin-top: 3px; }
.legend-fut[hidden] { display: none; }
.legend-fut b { font-weight: 500; margin-left: 4px; color: var(--text); font-variant-numeric: tabular-nums; }

/* ---------- symbol search ---------- */
.ss-backdrop { position: fixed; inset: 0; z-index: 90; background: rgba(0,0,0,.45); display: flex; justify-content: center; align-items: flex-start; padding-top: 8vh; }
.ss-dialog {
  width: min(720px, 94vw); height: min(640px, 84vh); background: var(--panel); border-radius: 8px;
  display: flex; flex-direction: column; box-shadow: 0 12px 48px rgba(0,0,0,.6);
}
.ss-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px 10px; font-size: 16px; font-weight: 600; }
.ss-close { color: var(--muted); }
.ss-close:hover { color: var(--text); }
.ss-input-wrap { display: flex; align-items: center; gap: 10px; margin: 0 16px; padding: 0 12px; border: 1px solid var(--border); border-radius: 6px; color: var(--muted); }
.ss-input-wrap:focus-within { border-color: var(--accent); }
.ss-input { flex: 1; height: 40px; background: none; border: 0; outline: 0; font-size: 15px; text-transform: uppercase; }
.ss-input::placeholder { text-transform: none; color: var(--muted); }
.ss-tabs { display: flex; gap: 6px; padding: 12px 16px 8px; border-bottom: 1px solid var(--border); }
.ss-tabs button { padding: 5px 12px; border-radius: 14px; background: var(--panel-2); color: var(--text); font-size: 12px; }
.ss-tabs button.active { background: var(--text); color: var(--bg); }
.ss-list { flex: 1; overflow-y: auto; }
.ss-row {
  display: grid; grid-template-columns: 1fr 90px 110px 74px 72px; align-items: center; gap: 8px;
  height: 38px; padding: 0 16px; cursor: pointer; border-bottom: 1px solid rgba(42,46,57,.5);
}
.ss-row:hover, .ss-row.active { background: var(--panel-2); }
.ss-sym b { font-weight: 600; }
.ss-sym span { color: var(--muted); margin-left: 1px; }
.ss-badge { font-size: 11px; justify-self: start; padding: 1px 6px; border-radius: 3px; }
.ss-badge.futures { color: #f0b90b; background: rgba(240,185,11,.12); }
.ss-badge.spot { color: #64b5f6; background: rgba(100,181,246,.12); }
.ss-price, .ss-chg, .ss-vol { text-align: right; font-variant-numeric: tabular-nums; }
.ss-vol { color: var(--muted); font-size: 12px; }
.ss-msg { padding: 16px; color: var(--muted); text-align: center; }
.ss-foot { padding: 8px 16px; color: var(--muted); font-size: 11px; border-top: 1px solid var(--border); }

/* ---------- context menu ---------- */
.ctx-menu {
  position: fixed; z-index: 95; min-width: 200px; background: var(--panel); border-radius: 6px; padding: 4px 0;
  box-shadow: 0 6px 24px rgba(0,0,0,.5);
}
.ctx-title { padding: 6px 12px 4px; color: var(--muted); font-size: 11px; }
.ctx-menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 6px 12px; text-align: left; }
.ctx-menu button:hover { background: var(--panel-2); }
.ctx-menu button span { flex: 1; }
.ctx-menu button.danger:hover { color: var(--down); }
.ctx-menu kbd { color: var(--muted); font-family: inherit; font-size: 11px; }

/* ---------- light interface ---------- */
:root[data-ui="light"] {
  --panel: #f0f3fa;
  --panel-2: #e0e3eb;
  --border: #e0e3eb;
  --text: #131722;
  --muted: #787b86;
  --gap: #e0e3eb;
  color-scheme: light;
}
:root[data-ui="light"] .tb-btn.active, :root[data-ui="light"] #intervals button.active { background: rgba(41, 98, 255, 0.1); }
:root[data-ui="light"] .ss-tabs button.active { background: var(--text); color: #fff; }
:root[data-ui="light"] .ind-row:hover { background: rgba(240, 243, 250, 0.92); }
:root[data-ui="light"] #toast { color: var(--text); }

/* ---------- theme dialog ---------- */
.theme-dialog { width: 380px; max-height: 88vh; display: flex; flex-direction: column; }
.theme-fields { overflow-y: auto; }
.presets { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 6px 16px 4px; }
.preset { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 6px; border-radius: 6px; border: 1px solid var(--border); font-size: 11px; }
.preset:hover { border-color: var(--muted); }
.preset.active { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.preset-swatch { width: 100%; height: 34px; border-radius: 4px; display: flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid rgba(128,128,128,.25); }
.preset-swatch i { width: 8px; height: 20px; border-radius: 1px; border: 1.5px solid; }
.preset-swatch i:last-child { height: 14px; margin-top: 6px; }
.ind-dialog input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--accent); }

/* ---------- account ---------- */
#account-btn { height: 32px; display: flex; align-items: center; margin-left: 4px; border-radius: 4px; flex: none; }
#account-btn .signin { background: var(--accent); color: #fff; padding: 6px 14px; border-radius: 4px; font-weight: 500; }
#account-btn .signin:hover { filter: brightness(1.1); }
.avatar {
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 600; color: #fff;
  background: linear-gradient(135deg, #2962ff, #9c27b0);
}
.avatar.big { width: 40px; height: 40px; font-size: 18px; flex: none; }
.acct-menu { width: 280px; }
.acct-head { display: flex; gap: 12px; align-items: center; padding: 10px 12px; }
.acct-head div { display: flex; flex-direction: column; min-width: 0; }
.acct-head span:not(.avatar) { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; }
.acct-note { color: var(--muted); font-size: 12px; padding: 0 12px 8px; line-height: 1.4; border-bottom: 1px solid var(--border); margin-bottom: 4px; }

.auth-dialog { width: 360px; }
.auth-tabs { display: flex; gap: 4px; padding: 12px 16px 0; }
.auth-tabs button { flex: 1; padding: 8px; border-radius: 4px; color: var(--muted); font-weight: 500; }
.auth-tabs button.active { background: var(--panel-2); color: var(--text); }
.auth-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 10px; }
.auth-field { display: flex; flex-direction: column; gap: 4px; padding: 0 !important; align-items: stretch !important; }
.auth-field span { color: var(--muted); font-size: 12px; }
.auth-field input { background: var(--bg); border: 1px solid var(--border); border-radius: 4px; padding: 9px 10px; outline: none; font-size: 14px; }
.auth-field input:focus { border-color: var(--accent); }
.auth-field[hidden] { display: none !important; }
.auth-submit { padding: 10px; font-size: 14px; margin-top: 4px; }
.auth-submit:disabled { opacity: .6; cursor: default; }
.auth-error { color: var(--down); font-size: 12px; background: rgba(242,54,69,.1); padding: 8px 10px; border-radius: 4px; }
.auth-error[hidden] { display: none; }
.auth-warn { color: #f0b90b; font-size: 12px; line-height: 1.4; background: rgba(240,185,11,.08); padding: 8px 10px; border-radius: 4px; }
.auth-hint { color: var(--muted); font-size: 12px; text-align: center; }
.g-btn { display: flex; justify-content: center; min-height: 40px; }
.auth-or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; }
.auth-or::before, .auth-or::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* ---------- TradingView-like toolbar ---------- */
#toolbar { padding-bottom: 8px; }
.tb-spacer { flex: 1; min-height: 8px; }
.tb-group.open .tb-btn { background: var(--panel-2); }
.tb-group.open .tb-more { opacity: 1; }
.fly-section { padding: 10px 16px 4px; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .05em; }
.fly-sep { height: 1px; background: var(--border); margin: 6px 0; }
.flyout-item { cursor: pointer; padding: 2px 10px 2px 10px; min-height: 36px; }
.flyout-item svg { flex: none; }
.flyout-item kbd { min-width: 34px; text-align: right; }
.flyout-item .fav { width: 26px; height: 26px; display: grid; place-items: center; color: var(--muted); opacity: 0; border-radius: 4px; }
.flyout-item .fav svg { width: 18px; height: 18px; }
.flyout-item:hover .fav, .flyout-item .fav.on { opacity: 1; }
.flyout-item .fav.on { color: #f0b90b; }
.flyout-item .fav:hover { background: var(--panel-2); }
.flyout-item.disabled { opacity: .4; cursor: default; }
.flyout-item.danger:not(.disabled):hover { color: var(--down); }
.flyout-item.opt.active { color: var(--accent); }
.flyout-item .chk { width: 20px; height: 20px; display: grid; place-items: center; }
.flyout-item .chk svg { width: 18px; height: 18px; }
.ico-spacer { width: 28px; flex: none; }
.switch { width: 34px; height: 18px; border-radius: 9px; background: var(--panel-2); position: relative; flex: none; transition: background .15s; }
.switch::after { content: ''; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: left .15s; }
.switch.on { background: var(--accent); }
.switch.on::after { left: 18px; }
.opt-flyout { min-width: 300px; }

.fav-toggle.on { color: #f0b90b; }
.fav-bar {
  position: absolute; left: 12px; bottom: 36px; z-index: 6; display: flex; gap: 2px; padding: 3px;
  background: var(--panel); border-radius: 6px; box-shadow: 0 4px 16px var(--shadow);
}
.fav-bar[hidden] { display: none; }
.fav-bar .tb-btn { width: 34px; height: 34px; }
.fav-bar .tb-btn svg { width: 24px; height: 24px; }

.zoom-reset {
  position: absolute; right: 90px; top: 10px; z-index: 6; background: var(--panel); color: var(--text);
  padding: 6px 12px; border-radius: 4px; box-shadow: 0 2px 10px var(--shadow); font-size: 12px;
}
.zoom-reset[hidden] { display: none; }
.zoom-reset:hover { background: var(--panel-2); }

.ind-row.locked .ind-actions button[data-a="remove"], .ind-row.locked .ind-actions button[data-a="settings"] { display: none; }

/* ---------- emoji picker ---------- */
.emoji-pop { width: 360px; padding: 0; display: flex; flex-direction: column; height: min(460px, calc(100vh - 16px)); overflow: hidden; }
.emoji-tabs { display: flex; border-bottom: 1px solid var(--border); padding: 0 6px; flex: none; }
.emoji-tabs button { flex: 1; height: 40px; font-size: 18px; border-bottom: 2px solid transparent; }
.emoji-tabs button:hover { background: var(--panel-2); }
.emoji-body { flex: 1; overflow-y: auto; padding: 0 8px 8px; }
.emoji-grid { display: grid; grid-template-columns: repeat(8, 1fr); }
.emoji-grid button { height: 40px; font-size: 24px; border-radius: 6px; font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif; }
.emoji-grid button:hover { background: var(--panel-2); }
.emoji-grid.icons button { font-size: 20px; color: var(--text); font-family: inherit; }
.emoji-modes { display: flex; justify-content: center; gap: 24px; border-top: 1px solid var(--border); flex: none; }
.emoji-modes button { padding: 10px 4px; color: var(--muted); border-bottom: 2px solid transparent; }
.emoji-modes button.active { color: var(--accent); border-bottom-color: var(--accent); }

/* =================================================================== */
/* TradingView-style top bar                                           */
/* =================================================================== */
#topbar { height: 48px; gap: 2px; padding: 0 8px; border-bottom: 4px solid var(--gap); }
#topbar .divider { height: 24px; margin: 0 6px; }
.hdr-avatar { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; margin-right: 6px; flex: none; }
.hdr-avatar .signin { background: var(--accent); color: #fff; padding: 6px 12px; border-radius: 18px; font-weight: 500; font-size: 13px; white-space: nowrap; }
.hdr-avatar:has(.signin) { width: auto; }
.hdr-pill {
  display: flex; align-items: center; height: 36px; padding: 0 14px; border-radius: 18px; background: var(--panel); flex: none;
  font-weight: 600; font-size: 15px; color: var(--text); max-width: 190px;
}
.hdr-pill span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hdr-pill:hover { background: var(--panel-2); }
.hdr-btn {
  display: flex; align-items: center; gap: 6px; height: 36px; padding: 0 10px; border-radius: 6px; color: var(--text);
  font-size: 15px; white-space: nowrap; flex: none;
}
.hdr-btn svg { flex: none; }
.hdr-tf { font-weight: 500; min-width: 42px; justify-content: center; }
.hdr-icon { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 6px; color: var(--text); flex: none; }
.hdr-btn:hover, .hdr-icon:hover:not(:disabled) { background: var(--panel); }
/* Pressed look while the button's menu or dialog is open (grey in light, lighter in dark). */
.hdr-btn.open, .hdr-icon.open, .hdr-icon.on { background: var(--panel-2); }
.hdr-icon:disabled { opacity: .35; cursor: default; }
:root[data-ui="dark"] .hdr-btn.open, :root[data-ui="dark"] .hdr-icon.open { background: #363a45; color: #fff; }

.hdr-pop {
  position: fixed; z-index: 70; background: var(--bg); border-radius: 8px; box-shadow: 0 6px 28px var(--shadow);
  border: 1px solid var(--border); padding: 6px; max-height: calc(100vh - 70px); overflow-y: auto;
}
:root[data-ui="dark"] .hdr-pop { background: var(--panel); }

/* interval menu */
.tf-pop { width: 260px; }
.tf-add { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border-radius: 6px; background: var(--panel); margin-bottom: 4px; font-size: 14px; }
.tf-add:hover { background: var(--panel-2); }
.tf-section { display: flex; justify-content: space-between; align-items: center; width: 100%; padding: 12px 12px 6px; color: var(--muted); font-size: 12px; letter-spacing: .05em; text-transform: uppercase; border-top: 1px solid var(--border); margin-top: 4px; }
.tf-section:first-of-type { border-top: 0; }
.tf-section.collapsed svg { transform: rotate(180deg); }
.tf-item { position: relative; display: block; width: 100%; text-align: left; padding: 8px 12px; border-radius: 6px; font-size: 14px; }
.tf-item:hover:not(.disabled) { background: var(--panel); }
.tf-item.active { background: #131722; color: #fff; }
:root[data-ui="dark"] .tf-item.active { background: #d1d4dc; color: #131722; }
.tf-item.disabled { color: var(--muted); opacity: .55; cursor: default; }
.tf-del { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); font-style: normal; color: var(--muted); font-size: 16px; opacity: 0; }
.tf-item:hover .tf-del { opacity: 1; }
.tf-del:hover { color: var(--down); }
.tf-custom { padding: 8px; display: flex; flex-direction: column; gap: 10px; }
.tf-custom-title { font-weight: 600; font-size: 14px; }
.tf-custom-row { display: flex; gap: 8px; }
.tf-custom-row input, .tf-custom-row select { background: var(--bg); border: 1px solid var(--border); border-radius: 6px; padding: 7px 8px; outline: none; }
.tf-custom-row input { width: 80px; }
.tf-custom-row select { flex: 1; }
.tf-custom-err { color: var(--down); font-size: 12px; }
.tf-custom-err[hidden] { display: none; }
.tf-custom-btns { display: flex; justify-content: flex-end; gap: 6px; }

/* small menus (screenshot) */
.menu-pop { min-width: 280px; }
.menu-title { padding: 8px 12px 4px; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .05em; }
.menu-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 9px 12px; border-radius: 6px; text-align: left; font-size: 14px; }
.menu-item:hover { background: var(--panel); }
.menu-item span { flex: 1; }
.menu-item kbd { color: var(--muted); font-family: inherit; font-size: 12px; }

/* quick search */
.qs-backdrop { position: fixed; inset: 0; z-index: 95; background: rgba(0,0,0,.25); display: flex; justify-content: center; padding-top: 10vh; }
.qs { width: min(640px, 94vw); max-height: 70vh; background: var(--bg); border-radius: 10px; box-shadow: 0 12px 48px var(--shadow); display: flex; flex-direction: column; overflow: hidden; align-self: flex-start; }
:root[data-ui="dark"] .qs { background: var(--panel); }
.qs-input { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--border); color: var(--muted); }
.qs-input input { flex: 1; border: 0; outline: 0; background: none; font-size: 16px; color: var(--text); }
.qs-input kbd { font-family: inherit; font-size: 11px; border: 1px solid var(--border); border-radius: 4px; padding: 2px 6px; }
.qs-list { overflow-y: auto; padding: 6px; }
.qs-group { padding: 10px 10px 4px; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .05em; }
.qs-row { display: flex; align-items: center; gap: 12px; padding: 6px 10px; border-radius: 6px; cursor: pointer; }
.qs-row.active { background: var(--panel-2); }
.qs-ico { width: 28px; height: 28px; display: grid; place-items: center; flex: none; color: var(--text); }
.qs-ico svg { width: 22px; height: 22px; }
.qs-name { flex: 1; }
.qs-hint { color: var(--muted); font-size: 12px; max-width: 45%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qs-empty { padding: 24px; text-align: center; color: var(--muted); }

/* settings dialog */
.set-backdrop { position: fixed; inset: 0; z-index: 90; background: rgba(0,0,0,.3); display: grid; place-items: center; outline: none; }
.set-dialog { width: min(760px, 96vw); height: min(600px, 92vh); background: var(--bg); border-radius: 10px; box-shadow: 0 12px 48px var(--shadow); display: flex; flex-direction: column; }
:root[data-ui="dark"] .set-dialog { background: var(--panel); }
.set-head { display: flex; justify-content: space-between; align-items: center; padding: 22px 26px 12px; font-size: 22px; font-weight: 600; }
.set-x { font-size: 20px; color: var(--text); width: 34px; height: 34px; border-radius: 6px; }
.set-x:hover { background: var(--panel-2); }
.set-main { flex: 1; display: flex; min-height: 0; }
.set-nav { width: 230px; padding: 8px 14px; display: flex; flex-direction: column; gap: 2px; flex: none; }
.set-tab { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 8px; font-size: 15px; text-align: left; }
.set-tab:hover { background: var(--panel); }
.set-tab.active { background: var(--panel); font-weight: 600; }
:root[data-ui="dark"] .set-tab.active, :root[data-ui="dark"] .set-tab:hover { background: var(--panel-2); }
.set-body { flex: 1; overflow-y: auto; padding: 4px 26px 20px; }
.set-section { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; margin: 18px 0 8px; }
.set-section:first-child { margin-top: 6px; }
.set-row { display: flex; align-items: center; gap: 12px; min-height: 40px; }
.set-label { flex: 1; font-size: 14px; }
.set-checkrow { cursor: pointer; font-size: 14px; }
.set-checkrow > span:not(.set-label) { flex: 1; }
.set-check { width: 20px; height: 20px; accent-color: #131722; flex: none; }
:root[data-ui="dark"] .set-check { accent-color: var(--accent); }
.set-check-spacer { width: 20px; flex: none; }
.set-colors { display: flex; gap: 6px; }
.set-color { width: 40px; height: 32px; border: 1px solid var(--border); border-radius: 6px; padding: 3px; background: var(--bg); cursor: pointer; }
.set-select { min-width: 200px; height: 36px; border: 1px solid var(--border); border-radius: 6px; padding: 0 8px; background: var(--bg); }
.set-presets { padding: 4px 0 6px; }
.set-foot { display: flex; align-items: center; gap: 10px; padding: 16px 26px 22px; position: relative; }
.set-tpl { position: relative; }
.set-tpl-btn { display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 16px; border: 1px solid var(--border); border-radius: 8px; font-size: 15px; }
.set-tpl-menu { position: absolute; bottom: 46px; left: 0; min-width: 260px; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 6px 24px var(--shadow); padding: 6px; z-index: 5; }
:root[data-ui="dark"] .set-tpl-menu { background: var(--panel); }
.set-tpl-menu button { display: block; width: 100%; text-align: left; padding: 8px 10px; border-radius: 6px; }
.set-tpl-menu button:hover { background: var(--panel-2); }
.set-tpl-sep { height: 1px; background: var(--border); margin: 4px 0; }
.btn-outline { height: 40px; padding: 0 22px; border: 1px solid var(--text); border-radius: 8px; font-size: 15px; }
.btn-solid { height: 40px; padding: 0 26px; border-radius: 8px; font-size: 15px; background: #131722; color: #fff; }
:root[data-ui="dark"] .btn-solid { background: #d1d4dc; color: #131722; }
.btn-outline:hover { background: var(--panel); }

/* status line toggles */
.legend.hide-title .legend-title, .legend.hide-ohlc .lg-ohlc, .legend.hide-chg .lg-chg, .legend.hide-vol .lg-vol { display: none; }
.cw.hide-ind-titles .ind-title { display: none; }
.cw.hide-ind-values .ind-vals { display: none; }

/* ---------- multi-chart layout ---------- */
#charts { position: absolute; inset: 0; display: grid; gap: 4px; background: var(--gap); }
.cw { position: relative; min-width: 0; min-height: 0; background: var(--bg); overflow: hidden; }
#charts.multi .cw { outline: 1px solid transparent; outline-offset: -1px; }
#charts.multi .cw.active { outline: 2px solid var(--accent); outline-offset: -2px; z-index: 1; }
.layout-pop { width: 360px; padding: 10px 14px; }
.lay-row { display: flex; align-items: center; gap: 4px; padding: 8px 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.lay-n { width: 22px; color: var(--muted); font-size: 14px; }
.lay-btn { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 6px; color: var(--text); }
.lay-btn:hover { background: var(--panel); }
.lay-btn.active { background: #131722; color: #fff; }
:root[data-ui="dark"] .lay-btn.active { background: #d1d4dc; color: #131722; }
.lay-sync-title { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .05em; padding: 16px 0 6px; }
.lay-sync { display: flex; align-items: center; gap: 8px; padding: 8px 0; cursor: pointer; font-size: 14px; }
.lay-info { width: 18px; height: 18px; border-radius: 50%; background: var(--panel-2); color: var(--muted); font-size: 11px; font-style: normal; display: grid; place-items: center; font-weight: 600; }

/* ---------- chart type menu ---------- */
.type-pop { width: 300px; }
.type-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 6px 10px; border-radius: 8px; text-align: left; font-size: 15px; }
.type-item:hover:not(.disabled) { background: var(--panel); }
.type-item.active { background: #131722; color: #fff; }
:root[data-ui="dark"] .type-item.active { background: #d1d4dc; color: #131722; }
.type-item.disabled { opacity: .45; cursor: default; }
.type-sep { height: 1px; background: var(--border); margin: 6px 4px; }
.set-number { width: 120px; height: 36px; border: 1px solid var(--border); border-radius: 6px; padding: 0 8px; background: var(--bg); }

/* ---------- alerts ---------- */
.side-tabs { display: flex; gap: 2px; padding: 8px 8px 4px; border-bottom: 1px solid var(--border); }
.side-tab { flex: 1; padding: 7px 6px; border-radius: 6px; font-weight: 500; color: var(--muted); display: flex; align-items: center; justify-content: center; gap: 6px; }
.side-tab.active { color: var(--text); background: var(--panel); }
.al-count { font-style: normal; background: #ff9800; color: #fff; border-radius: 9px; font-size: 11px; padding: 0 6px; line-height: 16px; }
.al-count[hidden] { display: none; }
#alerts-panel { flex: 1; display: flex; flex-direction: column; min-height: 0; overflow-y: auto; }
#alerts-panel[hidden], #watch-panel[hidden] { display: none; }
#watch-panel { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.al-panel-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px 8px; font-weight: 600; font-size: 14px; }
.al-new { width: 28px; height: 28px; border-radius: 6px; display: grid; place-items: center; }
.al-new:hover { background: var(--panel); }
.al-panel-note { margin: 0 12px 8px; padding: 8px 10px; border-radius: 6px; background: rgba(240,185,11,.1); color: var(--text); font-size: 12px; line-height: 1.4; }
.al-empty { color: var(--muted); font-size: 12px; text-align: center; padding: 18px 12px; line-height: 1.5; }
.al-item { position: relative; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.al-item.off { opacity: .6; }
.al-item:hover { background: var(--panel); }
.al-item-top { display: flex; align-items: center; gap: 8px; }
.al-item-top b { flex: 1; }
.al-badge { font-size: 11px; padding: 1px 6px; border-radius: 4px; background: var(--panel-2); }
.al-badge.active { background: rgba(8,153,129,.15); color: var(--up); }
.al-badge.triggered { background: rgba(255,152,0,.15); color: #ff9800; }
.al-badge.expired { background: rgba(120,123,134,.15); color: var(--muted); }
.al-item .switch { cursor: pointer; }
.al-item-cond { font-size: 13px; margin-top: 4px; }
.al-item-meta { font-size: 11px; color: var(--muted); margin-top: 2px; }
.al-item-actions { position: absolute; right: 10px; bottom: 8px; display: none; gap: 2px; }
.al-item:hover .al-item-actions { display: flex; }
.al-item-actions button { width: 24px; height: 24px; display: grid; place-items: center; border-radius: 4px; color: var(--muted); }
.al-item-actions button:hover { background: var(--panel-2); color: var(--text); }
.al-log-head { padding: 14px 14px 6px; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .05em; }
.al-ev { padding: 6px 14px; font-size: 12px; border-bottom: 1px solid var(--border); display: grid; grid-template-columns: auto 1fr; gap: 2px 8px; }
.al-ev span { color: var(--muted); }
.al-ev div { grid-column: 1 / -1; }

.al-backdrop { position: fixed; inset: 0; z-index: 92; background: rgba(0,0,0,.3); display: grid; place-items: center; }
.al-dialog { width: min(520px, 96vw); max-height: 92vh; overflow-y: auto; background: var(--bg); border-radius: 12px; box-shadow: 0 12px 48px var(--shadow); }
:root[data-ui="dark"] .al-dialog { background: var(--panel); }
.al-head { display: flex; justify-content: space-between; align-items: flex-start; padding: 22px 24px 16px; border-bottom: 1px solid var(--border); }
.al-title { font-size: 22px; font-weight: 600; }
.al-symbol { display: flex; align-items: center; gap: 6px; margin-top: 8px; font-size: 16px; padding: 4px 8px; margin-left: -8px; border-radius: 6px; }
.al-symbol:hover { background: var(--panel); }
.al-x { font-size: 20px; width: 34px; height: 34px; border-radius: 6px; }
.al-x:hover { background: var(--panel-2); }
.al-body { padding: 18px 24px 8px; }
.al-row { display: grid; grid-template-columns: 130px 1fr; gap: 12px; margin-bottom: 14px; align-items: start; }
.al-inline { align-items: center; }
.al-label { color: var(--muted); font-size: 14px; padding-top: 9px; }
.al-inline .al-label { padding-top: 0; }
.al-dialog select, .al-dialog input[type=number], .al-dialog input[type=datetime-local], .al-dialog input[name=message] {
  width: 100%; height: 40px; border: 1px solid var(--border); border-radius: 8px; padding: 0 10px; background: var(--bg); font-size: 14px; outline: none;
}
.al-dialog select:focus, .al-dialog input:focus { border-color: var(--accent); }
.al-conds { display: flex; flex-direction: column; gap: 14px; }
.al-cond { display: flex; flex-direction: column; gap: 8px; }
.al-cond + .al-cond { padding-top: 14px; border-top: 1px dashed var(--border); }
.al-cond-top { display: flex; gap: 6px; }
.al-rm { width: 40px; border-radius: 8px; color: var(--muted); }
.al-rm:hover { background: var(--panel); color: var(--down); }
.al-pair { display: flex; gap: 8px; }
.al-pair > * { flex: 1; }
.al-pair label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.al-add { display: flex; align-items: center; gap: 6px; color: var(--accent); font-size: 14px; align-self: flex-start; padding: 4px 0; }
.al-sep { height: 1px; background: var(--border); margin: 6px 0 16px; }
.al-notify { display: flex; flex-direction: column; gap: 8px; padding-top: 8px; font-size: 14px; }
.al-notify label { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.al-notify input { width: 18px; height: 18px; accent-color: #131722; }
.al-notify input:disabled + * , .al-notify label:has(input:disabled) { opacity: .5; }
.al-note { color: var(--muted); font-size: 12px; line-height: 1.4; }
.al-note div + div { margin-top: 4px; }
.al-error { color: var(--down); font-size: 13px; margin: 4px 0 8px; }
.al-error[hidden] { display: none; }
.al-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 24px 22px; border-top: 1px solid var(--border); }

.alert-stack { position: fixed; right: 16px; bottom: 16px; z-index: 99; display: flex; flex-direction: column; gap: 8px; width: 320px; }
.alert-card { background: var(--bg); border: 1px solid var(--border); border-left: 4px solid #ff9800; border-radius: 8px; box-shadow: 0 6px 24px var(--shadow); padding: 10px 12px; animation: alertIn .25s ease-out; }
:root[data-ui="dark"] .alert-card { background: var(--panel); }
.alert-card-head { display: flex; align-items: center; gap: 6px; }
.alert-card-head svg { width: 20px; height: 20px; color: #ff9800; }
.alert-card-head b { flex: 1; }
.alert-card-head span { color: var(--muted); font-size: 12px; }
.alert-card-head button { color: var(--muted); }
.alert-card-msg { margin-top: 6px; font-size: 14px; }
.alert-card-price { margin-top: 2px; font-size: 12px; color: var(--muted); }
@keyframes alertIn { from { transform: translateX(30px); opacity: 0; } }
.tg-box p { font-size: 14px; line-height: 1.5; margin: 6px 0 10px; }
.tg-btns { display: flex; gap: 8px; }
.set-small { height: 34px; padding: 0 14px; font-size: 13px; }

/* ---------- replay ---------- */
.rp-selecting { cursor: crosshair; }
.rp-cut { position: absolute; top: 0; bottom: 28px; width: 0; border-left: 2px dashed var(--accent); z-index: 7; pointer-events: none; }
.rp-cut::before { content: '✂'; position: absolute; top: 6px; left: -9px; font-size: 16px; color: var(--accent); }
.rp-hint { position: absolute; top: 56px; left: 50%; transform: translateX(-50%); z-index: 8; background: var(--accent); color: #fff; padding: 6px 12px; border-radius: 6px; font-size: 13px; pointer-events: none; white-space: nowrap; }
.rp-bar {
  position: absolute; left: 50%; bottom: 40px; transform: translateX(-50%); z-index: 8; display: flex; align-items: center; gap: 2px;
  background: var(--bg); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 6px 24px var(--shadow); padding: 4px; white-space: nowrap;
}
:root[data-ui="dark"] .rp-bar { background: var(--panel); }
.rp-bar button { display: flex; align-items: center; gap: 6px; height: 34px; padding: 0 8px; border-radius: 6px; font-size: 13px; }
.rp-bar button:hover, .rp-bar button.on { background: var(--panel-2); }
.rp-bar .rp-play { width: 38px; justify-content: center; background: var(--accent); color: #fff; }
.rp-bar .rp-play:hover { background: #1e53e5; }
.rp-bar select { height: 30px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg); padding: 0 4px; }
.rp-bar .rp-exit:hover { color: var(--down); }
.rp-sep { width: 1px; height: 22px; background: var(--border); margin: 0 4px; }
.rp-tf { font-weight: 600; padding: 0 6px; }
.rp-time { font-size: 12px; color: var(--muted); padding: 0 6px; font-variant-numeric: tabular-nums; }
.rp-panel {
  position: absolute; right: 8px; top: 8px; bottom: 8px; width: 300px; z-index: 9; overflow-y: auto;
  background: var(--bg); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 6px 24px var(--shadow); padding: 12px; font-size: 13px;
}
:root[data-ui="dark"] .rp-panel { background: var(--panel); }
.rp-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.rp-head button { color: var(--muted); width: 26px; height: 26px; border-radius: 6px; }
.rp-acct { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; padding-bottom: 10px; border-bottom: 1px solid var(--border); margin-bottom: 10px; }
.rp-acct span { display: block; color: var(--muted); font-size: 11px; }
.rp-acct b { font-variant-numeric: tabular-nums; }
.up { color: var(--up); } .down { color: var(--down); }
.rp-sides { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 8px; }
.rp-sides button { border: 1px solid var(--border); border-radius: 8px; padding: 6px; display: flex; flex-direction: column; align-items: center; }
.rp-sides small { font-size: 11px; }
.rp-sell { color: var(--down); } .rp-buy { color: var(--accent); }
.rp-sell.active { background: var(--down); color: #fff; border-color: var(--down); }
.rp-buy.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.rp-types { display: flex; gap: 2px; background: var(--panel); border-radius: 6px; padding: 2px; margin-bottom: 8px; }
.rp-types button { flex: 1; padding: 5px; border-radius: 5px; font-size: 12px; }
.rp-types button.active { background: var(--bg); box-shadow: 0 1px 3px var(--shadow); }
.rp-field { display: flex; flex-direction: column; gap: 3px; margin-bottom: 8px; }
.rp-field[hidden] { display: none; }
.rp-field span { color: var(--muted); font-size: 11px; }
.rp-field input, .rp-field select { height: 34px; border: 1px solid var(--border); border-radius: 6px; padding: 0 8px; background: var(--bg); outline: none; }
.rp-field input:focus { border-color: var(--accent); }
.rp-pcts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin: -2px 0 8px; }
.rp-pcts button { border: 1px solid var(--border); border-radius: 5px; padding: 3px; font-size: 11px; }
.rp-pcts button:hover { background: var(--panel); }
.rp-row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.rp-cost { color: var(--muted); font-size: 11px; min-height: 14px; margin-bottom: 6px; }
.rp-submit { width: 100%; height: 38px; border-radius: 8px; color: #fff; font-weight: 600; font-size: 14px; }
.rp-submit.buy { background: var(--accent); } .rp-submit.sell { background: var(--down); }
.rp-sub { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .05em; margin: 14px 0 6px; }
.rp-posline { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 3px 0; }
.rp-posline button { color: var(--muted); }
.rp-hint2 { color: var(--muted); font-size: 11px; margin: 4px 0 6px; line-height: 1.4; }
.rp-btns { display: flex; gap: 4px; flex-wrap: wrap; }
.rp-btns button { border: 1px solid var(--border); border-radius: 6px; padding: 5px 8px; font-size: 12px; }
.rp-btns button:hover { background: var(--panel); }
.rp-foot { display: flex; gap: 6px; margin-top: 14px; padding-top: 10px; border-top: 1px solid var(--border); }
.rp-foot button { flex: 1; border: 1px solid var(--border); border-radius: 6px; padding: 6px; font-size: 12px; }
.rp-foot button:hover { background: var(--panel); }
.rp-stats { width: min(760px, 96vw); height: min(680px, 92vh); }
.rp-stats-body { flex: 1; overflow-y: auto; padding: 0 26px; }
.rp-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 14px; }
.rp-cards > div { background: var(--panel); border-radius: 8px; padding: 10px; }
.rp-cards span { display: block; color: var(--muted); font-size: 11px; }
.rp-cards b { font-size: 18px; }
.rp-cards small { display: block; color: var(--muted); }
.rp-equity { width: 100%; height: 160px; background: var(--panel); border-radius: 8px; margin-bottom: 12px; }
.rp-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.rp-table th, .rp-table td { padding: 6px; border-bottom: 1px solid var(--border); text-align: right; font-variant-numeric: tabular-nums; }
.rp-table th:nth-child(2), .rp-table td:nth-child(2) { text-align: left; }
.rp-empty { text-align: center !important; color: var(--muted); padding: 16px !important; }
.rp-note, .set-note { color: var(--muted); font-size: 12px; line-height: 1.4; margin-top: 8px; }

#chart-wrap.rp-open #charts { right: 316px; }
#chart-wrap.rp-open .rp-panel { top: 0; right: 0; bottom: 0; border-radius: 0; box-shadow: none; border-width: 0 0 0 1px; }
body.replay-on .fav-bar { display: none; }

.g-loading { height: 40px; display: grid; place-items: center; color: var(--muted); font-size: 13px; border: 1px dashed var(--border); border-radius: 4px; width: 288px; }
