/* ─── ATP v2 Design Tokens ──────────────────────────────────────────────── */
:root {
  --bg-primary:   #000000;
  --bg-secondary: #0d0d0d;
  --bg-tertiary:  #141414;
  --bg-hover:     #1c1c1c;
  --bg-active:    #0c1540;
  --text-primary: #e0e3ea;
  --text-secondary: #787b86;
  --text-muted:   #4c525e;
  --accent:       #2962ff;
  --accent-hover: #1e53e5;
  --accent-bg:    rgba(41, 98, 255, 0.13);
  --green:        #26a69a;
  --red:          #ef5350;
  --border:       #1c1c1c;

  /* v1 compatibility aliases */
  --bg-panel:     #0d0d0d;
  --bg-panel-2:   #141414;
  --up:           #26a69a;
  --down:         #ef5350;
  --text-1:       #e0e3ea;
  --text-2:       #787b86;
  --text-3:       #4c525e;
  --border-strong: #2c2c2c;
  --accent-soft:   rgba(41,98,255,0.12);

  --top-h:          40px;
  --left-w:         46px;
  --right-icon-w:   46px;
  --right-panel-w:  310px;
  --bottom-h:       28px;
}

/* ─── Reset ─────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body, #root { height: 100%; overflow: hidden; background: var(--bg-primary); }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Trebuchet MS", "Segoe UI", sans-serif;
  font-size: 12px;
  color: var(--text-primary);
  line-height: 1.4;
}
button { font-family: inherit; font-size: inherit; cursor: pointer; }
svg { display: block; flex-shrink: 0; }

/* ─── Utility classes ───────────────────────────────────────────────────── */
.flex-1  { flex: 1 1 0%; min-width: 0; }
.mono    { font-family: 'Courier New', monospace; font-variant-numeric: tabular-nums; }
.text-1  { color: var(--text-1); }
.text-2  { color: var(--text-2); }
.text-3  { color: var(--text-3); }
.num     { text-align: right; }
.row     { display: flex; align-items: center; }
.ib      { display: inline-flex; align-items: center; justify-content: center;
           border: none; background: transparent; color: var(--text-2); cursor: pointer;
           border-radius: 3px; padding: 0; flex-shrink: 0; }
.ib:hover { background: var(--bg-hover); color: var(--text-1); }
.ib svg   { width: 14px; height: 14px; }

/* ─── Root layout ───────────────────────────────────────────────────────── */
.atp-root { display: flex; flex-direction: column; height: 100%; }
.atp-body  { display: flex; flex: 1; overflow: hidden; }

/* ─── Scrollbar ─────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg-tertiary); border-radius: 2px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ═══════════════════════════════════════════════════════════════════════════
   TOP MENU
═══════════════════════════════════════════════════════════════════════════ */
.top-menu {
  height: var(--top-h);
  min-height: var(--top-h);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 6px;
  gap: 2px;
  z-index: 200;
  flex-shrink: 0;
}
.top-left, .top-right { display: flex; align-items: center; gap: 1px; }
.top-sep { width: 1px; height: 18px; background: var(--border); margin: 0 5px; flex-shrink: 0; }

/* Profile button */
.profile-btn {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--accent); border: none;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 12px; font-weight: 700;
  cursor: pointer; flex-shrink: 0;
}
.profile-btn:hover { background: var(--accent-hover); }

/* Symbol / search */
.search-btn {
  display: flex; align-items: center; gap: 5px;
  padding: 4px 8px; border-radius: 4px;
  border: 1px solid var(--border); background: var(--bg-tertiary);
  color: var(--text-secondary); cursor: pointer;
  font-size: 12px; white-space: nowrap;
}
.search-btn:hover { border-color: var(--text-muted); color: var(--text-primary); }
.search-btn svg { width: 13px; height: 13px; }

/* Timeframe buttons */
.tf-btn {
  padding: 4px 6px; border-radius: 3px; border: none;
  background: transparent; color: var(--text-secondary);
  font-size: 12px; font-weight: 500; white-space: nowrap;
}
.tf-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.tf-btn.active { color: var(--accent); background: var(--accent-bg); }

/* Generic icon button (top menu + toolbar) */
.ico-btn {
  width: 30px; height: 30px; border-radius: 4px; border: none;
  background: transparent; color: var(--text-secondary);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; flex-shrink: 0; position: relative;
}
.ico-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.ico-btn.active { color: var(--accent); background: var(--accent-bg); }
.ico-btn svg { width: 17px; height: 17px; }

/* Labeled top-menu button (Indicator, Template…) */
.top-btn {
  display: flex; align-items: center; gap: 4px;
  padding: 4px 7px; border-radius: 4px; border: none;
  background: transparent; color: var(--text-secondary); font-size: 12px;
  white-space: nowrap; cursor: pointer;
}
.top-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.top-btn.active { color: var(--accent); background: var(--accent-bg); }
.top-btn svg { width: 15px; height: 15px; }

/* Layout picker button */
.layout-btn {
  display: flex; align-items: center; gap: 4px;
  padding: 4px 7px; border-radius: 4px; border: none;
  background: transparent; color: var(--text-secondary); font-size: 12px;
  cursor: pointer;
}
.layout-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.layout-btn.active { color: var(--accent); background: var(--accent-bg); }
.layout-btn svg { width: 16px; height: 16px; }

/* ─── Timeframe picker ──────────────────────────────────────────────────── */
.tf-picker {
  position: fixed; z-index: 900;
  background: var(--bg-secondary);
  border: 1px solid var(--border); border-radius: 6px;
  box-shadow: 0 6px 24px rgba(0,0,0,.55);
  width: 340px;
  display: flex; flex-direction: column;
  max-height: 460px;
  animation: fadeIn .1s ease;
}
.tf-picker-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 9px 12px 5px;
  font-size: 11px; font-weight: 600; color: var(--text-primary);
  border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.tf-search-input {
  flex: 1; background: transparent; border: none; outline: none;
  color: var(--text-primary); font-size: 12px; font-family: inherit;
}
.tf-search-input::placeholder { color: var(--text-muted); }
.tf-picker-body { flex: 1; overflow-y: auto; padding: 6px 0; }
.tf-group { padding: 0 0 4px; }
.tf-group-label {
  padding: 5px 12px 3px;
  font-size: 10px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .07em; color: var(--text-muted);
}
.tf-group-note { font-weight: 400; letter-spacing: 0; text-transform: none; }
.tf-group-items {
  display: flex; flex-wrap: wrap; gap: 2px; padding: 2px 10px 4px;
}
.tf-item {
  display: flex; align-items: center;
  border-radius: 4px; overflow: hidden;
  border: 1px solid transparent;
}
.tf-item.active { border-color: var(--accent); }
.tf-star-btn {
  width: 22px; height: 24px; border: none; background: transparent;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); padding: 0 2px 0 4px;
}
.tf-star-btn:hover { color: var(--accent); }
.tf-label-btn {
  padding: 3px 7px 3px 2px; border: none; background: transparent;
  color: var(--text-secondary); font-size: 12px; font-family: inherit;
  cursor: pointer; white-space: nowrap;
}
.tf-label-btn:hover { color: var(--text-primary); }
.tf-item.active .tf-label-btn { color: var(--accent); }
.tf-item:hover { background: var(--bg-hover); }

/* ─── Indicator picker ──────────────────────────────────────────────────── */
.indicator-picker {
  position: fixed; z-index: 900;
  background: var(--bg-secondary);
  border: 1px solid var(--border); border-radius: 6px;
  box-shadow: 0 6px 24px rgba(0,0,0,.55);
  width: 320px;
  display: flex; flex-direction: column;
  max-height: 400px;
  animation: fadeIn .1s ease;
}
.ind-header {
  padding: 9px 12px 5px;
  font-size: 11px; font-weight: 600; color: var(--text-primary);
  border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.ind-search {
  display: flex; align-items: center; gap: 7px;
  padding: 6px 10px; border-bottom: 1px solid var(--border); flex-shrink: 0;
  color: var(--text-muted);
}
.ind-search svg { width: 13px; height: 13px; flex-shrink: 0; }
.ind-body { flex: 1; overflow-y: auto; padding: 4px 0; }
.ind-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; cursor: default;
}
.ind-item:hover { background: var(--bg-hover); }
.ind-item.on { background: var(--accent-bg); }
.ind-info { flex: 1; min-width: 0; }
.ind-name { font-size: 12px; font-weight: 600; color: var(--text-primary); }
.ind-desc { font-size: 10px; color: var(--text-muted); margin-top: 1px; line-height: 1.3; }
.ind-toggle-btn {
  padding: 3px 10px; border-radius: 3px; border: 1px solid var(--border);
  background: var(--bg-tertiary); color: var(--text-primary);
  font-size: 11px; font-family: inherit; cursor: pointer;
  white-space: nowrap; flex-shrink: 0;
}
.ind-toggle-btn:hover { border-color: var(--accent); color: var(--accent); }
.ind-toggle-btn.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.ind-toggle-btn.on:hover { background: var(--accent-hover); }
.ind-badge {
  background: var(--accent); color: #fff;
  font-size: 9px; font-weight: 700; border-radius: 8px;
  padding: 1px 5px; margin-left: 2px;
}
.ind-active-section { border-top: 1px solid var(--border); flex-shrink: 0; }
.ind-active-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 5px 12px; color: var(--text-primary); font-size: 12px;
}
.ind-remove-btn {
  width: 20px; height: 20px; border: none; background: transparent;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); border-radius: 3px;
}
.ind-remove-btn:hover { background: var(--bg-hover); color: var(--red); }
.ind-remove-btn svg { width: 12px; height: 12px; }

/* ═══════════════════════════════════════════════════════════════════════════
   DROPDOWN / POPUP MENUS
═══════════════════════════════════════════════════════════════════════════ */
.dropdown {
  position: fixed; z-index: 900;
  background: var(--bg-secondary);
  border: 1px solid var(--border); border-radius: 6px;
  box-shadow: 0 6px 24px rgba(0,0,0,.5);
  min-width: 180px; overflow: hidden;
  animation: fadeIn .1s ease;
}
@keyframes fadeIn { from { opacity:0; transform:translateY(-4px); } to { opacity:1; transform:translateY(0); } }

.dd-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 14px; cursor: pointer;
  color: var(--text-primary); font-size: 12px; white-space: nowrap;
}
.dd-item:hover { background: var(--bg-hover); }
.dd-item svg { width: 14px; height: 14px; color: var(--text-secondary); }
.dd-divider { height: 1px; background: var(--border); margin: 2px 0; }
.dd-section { padding: 8px 14px 4px; font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .08em; }

/* Candle type menu (wider, with icons) */
.candle-item {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 12px; cursor: pointer;
  color: var(--text-primary); font-size: 12px;
}
.candle-item:hover { background: var(--bg-hover); }
.candle-item.active { color: var(--accent); }
.candle-item svg { width: 18px; height: 18px; color: var(--text-secondary); flex-shrink: 0; }
.candle-item.active svg { color: var(--accent); }

/* ═══════════════════════════════════════════════════════════════════════════
   LEFT SIDEBAR
═══════════════════════════════════════════════════════════════════════════ */
.left-sidebar {
  width: var(--left-w); min-width: var(--left-w);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column; align-items: center;
  padding: 4px 0; gap: 1px;
  overflow-y: auto; overflow-x: hidden;
  flex-shrink: 0; z-index: 100;
}

.sb-tool {
  width: 38px; height: 34px; border-radius: 4px; border: none;
  background: transparent; color: var(--text-secondary);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; position: relative; flex-shrink: 0;
}
.sb-tool:hover { background: var(--bg-hover); color: var(--text-primary); }
.sb-tool.active { color: var(--accent); background: var(--accent-bg); }
.sb-tool svg { width: 18px; height: 18px; }

/* Small triangle indicator for tools that have a flyout */
.sb-tool .has-sub::after {
  content: '';
  position: absolute; bottom: 3px; right: 3px;
  border-left: 4px solid transparent;
  border-bottom: 4px solid currentColor;
}

.sb-divider { width: 26px; height: 1px; background: var(--border); margin: 3px 0; flex-shrink: 0; }

/* Left sidebar flyout */
.sb-flyout {
  position: fixed; z-index: 800;
  max-height: calc(100vh - 80px);
  overflow-y: auto; overflow-x: hidden;
  scrollbar-width: none; -ms-overflow-style: none;
  background: var(--bg-secondary);
  border: 1px solid var(--border); border-radius: 6px;
  box-shadow: 0 6px 20px rgba(0,0,0,.5);
  padding: 4px; min-width: 200px;
  animation: fadeIn .1s ease;
}
.sb-flyout-group { margin-bottom: 4px; }
.sb-flyout-group-title {
  font-size: 10px; text-transform: uppercase;
  letter-spacing: .08em; color: var(--text-muted);
  padding: 4px 8px 2px;
}
.sb-flyout-item {
  display: flex; align-items: center; gap: 9px;
  padding: 6px 10px; border-radius: 4px;
  cursor: pointer; color: var(--text-primary); font-size: 12px;
}
.sb-flyout-item:hover { background: var(--bg-hover); }
.sb-flyout-item.active { color: var(--accent); }
.sb-flyout-item svg { width: 15px; height: 15px; color: var(--text-secondary); flex-shrink: 0; }
.sb-flyout-item.active svg { color: var(--accent); }
.sb-flyout-divider { height: 1px; background: var(--border); margin: 3px 4px; }

/* Toggle item (keep drawing, etc.) */
.sb-flyout-toggle {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 10px; border-radius: 4px; cursor: pointer;
  color: var(--text-primary); font-size: 12px;
}
.sb-flyout-toggle:hover { background: var(--bg-hover); }
.toggle-pill {
  width: 28px; height: 15px; border-radius: 8px;
  background: var(--bg-tertiary); position: relative; transition: background .15s;
}
.toggle-pill.on { background: var(--accent); }
.toggle-pill::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 11px; height: 11px; border-radius: 50%;
  background: #fff; transition: left .15s;
}
.toggle-pill.on::after { left: 15px; }
.toggle-pill.danger.on { background: var(--red); }

/* Show / Hide visibility flyout (redesigned) */
.sb-vis-flyout {
  position: fixed; z-index: 800; min-width: 224px;
  background: var(--bg-secondary); border: 1px solid var(--border-strong);
  border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.55);
  padding: 6px; animation: fadeIn .1s ease;
}
.sb-vis-title { font-size: 10px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-muted); padding: 4px 8px 6px; }
.sb-vis-row { display: flex; align-items: center; gap: 10px; padding: 7px 9px; border-radius: 5px; cursor: pointer; }
.sb-vis-row:hover { background: var(--bg-hover); }
.sb-vis-ico { display: inline-flex; width: 16px; flex-shrink: 0; color: var(--text-secondary); }
.sb-vis-ico svg { width: 15px; height: 15px; }
.sb-vis-label { flex: 1; font-size: 12px; color: var(--text-primary); white-space: nowrap; }
.sb-vis-sep { height: 1px; background: var(--border); margin: 4px; }
.sb-vis-master .sb-vis-label { color: var(--text-secondary); }

/* Tooltip on left sidebar tools */
.sb-tip {
  position: absolute; left: calc(100% + 8px); top: 50%;
  transform: translateY(-50%);
  background: var(--bg-tertiary); color: var(--text-primary);
  padding: 3px 7px; border-radius: 4px; font-size: 11px;
  white-space: nowrap; pointer-events: none; z-index: 900;
  opacity: 0; transition: opacity .1s;
  border: 1px solid var(--border);
}
.sb-tool:hover .sb-tip { opacity: 1; }

/* ═══════════════════════════════════════════════════════════════════════════
   CHART AREA
═══════════════════════════════════════════════════════════════════════════ */
.chart-area {
  flex: 1; background: #000000;
  overflow: hidden;
  display: flex; flex-direction: column;
}
/* chart-content must be a flex container so chart-pane can use flex:1 */
.chart-content {
  flex: 1; min-height: 0;
  display: flex; flex-direction: column;
  overflow: hidden; position: relative;   /* anchor for floating overlays */
}

/* ── Chart pane (Lightweight Charts) ───────────────── */
.chart-pane {
  display: flex; flex-direction: column;
  flex: 1; min-height: 0;
  position: relative; overflow: hidden;
}
.chart-body {
  flex: 1; min-height: 0; position: relative; overflow: hidden;
}
/* LWC canvas — keep below all overlays */
.chart-container { width: 100%; height: 100%; position: relative; z-index: 1; }
/* Remove LightweightCharts attribution badge */
#tv-attr-logo { display: none !important; }

/* Drawing overlay canvas */
.chart-draw-overlay {
  position: absolute; top: 0; left: 0;
  pointer-events: none; z-index: 5;
}
.chart-draw-overlay.drawing  { pointer-events: all; cursor: crosshair; }
.chart-draw-overlay.erasing  { pointer-events: all; cursor: cell; }
.chart-draw-overlay.replay-selecting { pointer-events: all; cursor: crosshair; }
.chart-draw-overlay.hidden   { display: none; }

/* ─── Replay control bar (docked bottom strip) ───────────────────────── */
.replay-bar {
  flex-shrink: 0; height: 38px; display: flex; align-items: center; gap: 10px;
  padding: 0 12px; background: var(--bg-secondary); border-top: 1px solid var(--border);
  font-size: 12px; color: var(--text-secondary); z-index: 25;
}
.replay-grp { display: flex; align-items: center; gap: 4px; }
.replay-scrub-grp { flex: 1; min-width: 0; }
.replay-ib {
  width: 28px; height: 26px; border: none; border-radius: 5px; background: transparent;
  color: var(--text-primary); font-size: 14px; cursor: pointer; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
}
.replay-ib:hover:not(:disabled) { background: var(--bg-hover); }
.replay-ib:disabled { opacity: .35; cursor: default; }
.replay-play { background: var(--accent-bg); color: var(--accent); }
.replay-play:hover { background: var(--accent-bg); }
.replay-scrub { flex: 1; min-width: 60px; accent-color: var(--accent); cursor: pointer; }
.replay-pos { font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--text-secondary); min-width: 120px; }
.replay-speed {
  height: 26px; background: var(--bg-tertiary); border: 1px solid var(--border);
  border-radius: 5px; color: var(--text-primary); font-size: 12px; padding: 0 6px; cursor: pointer;
}
.replay-exit {
  height: 26px; padding: 0 12px; border: 1px solid var(--border); border-radius: 5px;
  background: transparent; color: var(--text-secondary); font-size: 12px; cursor: pointer;
}
.replay-exit:hover { background: var(--bg-hover); color: var(--text-primary); border-color: var(--red); }
.replay-report {
  height: 26px; padding: 0 12px; border: 1px solid var(--border); border-radius: 5px;
  background: transparent; color: var(--text-secondary); font-size: 12px; cursor: pointer;
}
.replay-report:hover { background: var(--bg-hover); color: var(--text-primary); border-color: var(--accent); }
.replay-hint { color: var(--accent); font-weight: 500; }
.replay-spacer { flex: 1; }
.replay-datetime {
  height: 26px; background: var(--bg-tertiary); border: 1px solid var(--border);
  border-radius: 5px; color: var(--text-primary); font-size: 12px; padding: 0 8px; cursor: pointer;
}
.replay-datetime:focus { outline: 1px solid var(--accent); }

/* Drawing selection settings toolbar (top-center of chart) */
.dw-set-wrap { position: relative; display: inline-flex; }
.dw-set-btn {
  min-width: 24px; height: 24px; padding: 0 5px; border: none; border-radius: 4px;
  background: transparent; color: #c8cbcf; font-size: 13px; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
}
.dw-set-btn:hover { background: #2a2d36; color: #fff; }
.dw-set-btn.on { background: var(--accent-bg); color: var(--accent); }
.dw-set-btn svg { width: 14px; height: 14px; }
.dw-del:hover { color: var(--red); background: rgba(239,83,80,.14); }
/* Bell icon on the drawing panel — green once this drawing carries a live alert */
.dw-alert-on { color: var(--green); background: rgba(38,166,154,.14); }
.dw-alert-on:hover { color: var(--green); background: rgba(38,166,154,.22); }
.dw-set-sep { width: 1px; height: 18px; background: #2c2c2c; margin: 0 2px; }
.dw-swatch { width: 15px; height: 15px; border-radius: 3px; border: 1px solid rgba(255,255,255,.2); display: block; }
.dw-textswatch { font-size: 13px; font-weight: 700; line-height: 1; }
.dw-widthbtn { font-size: 11px; font-weight: 600; padding: 0 6px; }
.dw-sw { width: 18px; height: 18px; border-radius: 3px; cursor: pointer; border: 1px solid rgba(255,255,255,.12); }
.dw-sw.on { outline: 2px solid #fff; outline-offset: 1px; }
.dw-sw:hover { transform: scale(1.12); }

/* Line-style preview swatch (button icon + dropdown item) */
.dw-dashprev { display: inline-block; width: 20px; height: 0; border-top: 2px solid #c8cbcf; }
.dw-dashprev-dashed { border-top-style: dashed; }
.dw-dashprev-dotted { border-top-style: dotted; border-top-width: 2.5px; }

/* Line-width preview bar (dropdown item) */
.dw-wprev { display: inline-block; width: 20px; background: #c8cbcf; border-radius: 2px; }

/* Shared color popup (context panel's line-color / text-color buttons) */
.dw-colorpop {
  position: absolute; top: 30px; left: 0; z-index: 31; width: 216px;
  background: #14161c; border: 1px solid #2c2c2c; border-radius: 6px; padding: 8px;
  box-shadow: 0 6px 22px rgba(0,0,0,.5);
}
.dw-cg-row { display: flex; gap: 4px; margin-bottom: 4px; }
.dw-cg-row .dw-sw { flex: 1; width: auto; height: 18px; }
.dw-cg-addrow { position: relative; margin: 6px 0 2px; }
.dw-cg-add {
  width: 100%; height: 22px; border: 1px dashed #3a3d46; border-radius: 4px;
  background: transparent; color: #9aa0aa; font-size: 14px; line-height: 1; cursor: pointer;
}
.dw-cg-add:hover { background: #2a2d36; color: #fff; }
.dw-cg-opacity { display: flex; align-items: center; gap: 6px; margin-top: 8px; }
.dw-cg-op-label { font-size: 11px; color: #9aa0aa; white-space: nowrap; }
.dw-cg-opacity input[type=range] { flex: 1; accent-color: var(--accent); }
.dw-cg-op-val { font-size: 11px; color: #c8cbcf; min-width: 30px; text-align: right; font-variant-numeric: tabular-nums; }

/* Generic small dropdown list (width / style / template / more menus) */
.dw-listpop {
  position: absolute; top: 30px; left: 0; z-index: 31; min-width: 150px;
  background: #14161c; border: 1px solid #2c2c2c; border-radius: 6px; padding: 4px;
  box-shadow: 0 6px 22px rgba(0,0,0,.5);
}
.dw-listpop-item {
  display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 4px;
  font-size: 12px; color: #d1d4dc; cursor: pointer; white-space: nowrap;
}
.dw-listpop-item:hover { background: #2a2d36; }
.dw-listpop-item.on { background: var(--accent-bg); color: var(--accent); }
.dw-listpop-item.on .dw-dashprev, .dw-listpop-item.on .dw-wprev { border-color: var(--accent); background: var(--accent); }
.dw-listpop-item svg { width: 14px; height: 14px; }
.dw-listpop-item.dw-disabled { color: #5d606b; cursor: default; }
.dw-listpop-item.dw-disabled:hover { background: transparent; }
.dw-listpop-danger { color: var(--red); }
.dw-listpop-danger:hover { background: rgba(239,83,80,.14); }
.dw-listpop-sechead {
  font-size: 10px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
  color: var(--text-muted); padding: 6px 8px 3px;
}
.dw-listpop-sep { height: 1px; background: #23262e; margin: 4px 2px; }
/* Anchor to the trigger's right edge instead of its left — needed for any
   button that sits near the right edge of a narrow container (the Settings
   dialog's Style tab rows are all right-aligned via .dw-dlg-c2), otherwise
   a left-anchored popup runs straight off the dialog/viewport edge. */
.dw-pop-right { left: auto; right: 0; }
/* Opens upward instead of downward — needed for the Settings dialog's footer
   Template button, which sits at the very bottom of a scroll-clipped
   (overflow:auto) dialog box; a downward popup there gets cut off. */
.dw-pop-up { top: auto; bottom: 30px; }

/* Drawing style templates: named list, delete-on-hover */
.dw-tmplpop { min-width: 190px; max-height: 260px; overflow-y: auto; }
.dw-tmpl-hint { padding: 6px 8px; }
.dw-tmpl-item { justify-content: space-between; }
.dw-tmpl-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dw-tmpl-del {
  color: #5d606b; font-size: 14px; line-height: 1; padding: 0 2px; border-radius: 3px; flex-shrink: 0;
}
.dw-tmpl-del:hover { color: var(--red); background: rgba(239,83,80,.14); }

/* Save-template modal (mirrors TradingView's "Save drawing template" dialog) */
.dw-tmpl-savedlg { width: 380px; }
.dw-tmpl-savelabel { padding: 4px 0 8px; }
.dw-tmpl-savein {
  width: 100%; box-sizing: border-box; background: #0c0e12; border: 1px solid var(--border-strong);
  border-radius: 5px; padding: 9px 10px; color: var(--text-primary); font-size: 13px; font-family: inherit;
}
.dw-tmpl-savein:focus { outline: none; border-color: var(--accent); }
.dw-tmpl-combo { position: relative; }
.dw-tmpl-combo .dw-tmpl-savein { padding-right: 32px; }
.dw-tmpl-combo-caret {
  position: absolute; top: 0; right: 0; bottom: 0; width: 32px;
  display: flex; align-items: center; justify-content: center;
  background: none; border: none; color: var(--text-muted); cursor: pointer;
}
.dw-tmpl-combo-caret:hover { color: var(--text-primary); }
.dw-tmpl-combo-caret svg { transition: transform .12s ease; }
.dw-tmpl-combo-caret.open svg { transform: rotate(180deg); }
.dw-tmpl-combo-list {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 5;
  background: #14161c; border: 1px solid #2c2c2c; border-radius: 6px; padding: 4px;
  box-shadow: 0 6px 22px rgba(0,0,0,.5); max-height: 180px; overflow-y: auto;
}
.dw-tmpl-combo-item {
  padding: 8px 10px; border-radius: 4px; font-size: 13px; color: var(--text-primary); cursor: pointer;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.dw-tmpl-combo-item:hover { background: #2a2d36; }

/* Drawing right-click context menu */
.dw-ctxmenu {
  position: absolute; z-index: 32; min-width: 140px;
  background: #14161c; border: 1px solid #2c2c2c; border-radius: 6px;
  padding: 4px; box-shadow: 0 8px 26px rgba(0,0,0,.6);
}
.dw-ctx-item { padding: 7px 12px; font-size: 12px; color: #d1d4dc; border-radius: 4px; cursor: pointer; }
.dw-ctx-item:hover { background: #2a2d36; }
.dw-ctx-del { color: var(--red); }
.dw-ctx-del:hover { background: rgba(239,83,80,.14); }
.dw-ctx-sep { height: 1px; background: #2c2c2c; margin: 3px 0; }

/* Floating draggable context panel */
.dw-cpanel {
  position: absolute; z-index: 30; display: flex; align-items: center; gap: 2px;
  background: rgba(20,22,28,.97); border: 1px solid #2c2c2c; border-radius: 7px;
  padding: 3px 4px; box-shadow: 0 6px 22px rgba(0,0,0,.55);
}
.dw-cp-handle {
  display: flex; align-items: center; padding: 0 3px; cursor: grab; color: #5d606b;
}
.dw-cp-handle:active { cursor: grabbing; }
.dw-cp-handle svg { width: 9px; height: 15px; }

/* Details settings dialog */
.dw-dlg-backdrop {
  position: fixed; inset: 0; z-index: 200; background: rgba(0,0,0,.5);
  display: flex; align-items: center; justify-content: center;
}
.dw-dlg {
  width: 340px; max-width: 92vw; max-height: 88vh; overflow: auto;
  background: #14161c; border: 1px solid #2c2c2c; border-radius: 10px;
  box-shadow: 0 18px 50px rgba(0,0,0,.6);
}
.dw-dlg-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px; border-bottom: 1px solid #23262e;
}
.dw-dlg-title { font-size: 13px; font-weight: 600; color: #e0e3ea; }
.dw-dlg-titlegrp { display: flex; align-items: center; gap: 4px; }
.dw-dlg-x { border: none; background: transparent; color: #787b86; cursor: pointer; padding: 4px; border-radius: 4px; }
.dw-dlg-x:hover { background: #23262e; color: #fff; }
.dw-dlg-x svg { width: 14px; height: 14px; }
.dw-dlg-body { padding: 6px 14px 14px; }
.dw-dlg-row { display: flex; flex-direction: column; gap: 7px; padding: 11px 0; border-bottom: 1px solid #1c1f26; }
.dw-dlg-row:last-child { border-bottom: none; }
.dw-dlg-num { font-size: 12px; color: #c8cbcf; min-width: 34px; text-align: right; font-variant-numeric: tabular-nums; }
.dw-dlg-input {
  flex: 1; background: #0c0e12; border: 1px solid #2c2c2c; border-radius: 5px;
  padding: 6px 9px; color: #e0e3ea; font-size: 12px; font-family: inherit;
}
.dw-dlg-input:focus { outline: none; border-color: var(--accent); }
.dw-dlg-palette { display: flex; flex-direction: column; gap: 4px; }
.dw-dlg-prow { display: flex; gap: 4px; }
.dw-dlg-prow .dw-sw { width: 22px; height: 20px; border-radius: 3px; flex: 1; }
.dw-seg { display: inline-flex; background: #0c0e12; border: 1px solid #2c2c2c; border-radius: 6px; overflow: hidden; }
.dw-seg-btn {
  border: none; background: transparent; color: #9aa0aa; padding: 6px 12px; font-size: 12px; cursor: pointer;
}
.dw-seg-btn:hover { background: #1c1f26; color: #fff; }
.dw-seg-btn.on { background: var(--accent); color: #fff; }
.dw-dlg-foot { display: flex; justify-content: flex-end; padding: 12px 14px; border-top: 1px solid #23262e; }
.dw-dlg-done {
  background: var(--accent); color: #fff; border: none; border-radius: 6px;
  padding: 7px 18px; font-size: 12px; font-weight: 600; cursor: pointer;
}
.dw-dlg-done:hover { background: var(--accent-hover); }
.dw-dlg-done:disabled { opacity: .5; cursor: default; }
.dw-dlg-foot { gap: 8px; }
.dw-dlg-cancel {
  background: transparent; color: #a7abb3; border: 1px solid #2c2c2c; border-radius: 6px;
  padding: 7px 16px; font-size: 12px; font-weight: 600; cursor: pointer;
}
.dw-dlg-cancel:hover { background: #1c1f26; color: #fff; }

/* Tabbed details panel */
.dw-dlg-tabs { display: flex; gap: 2px; padding: 4px 10px 0; border-bottom: 1px solid #23262e; }
.dw-dlg-tab {
  padding: 7px 11px; font-size: 12px; cursor: pointer; background: transparent;
  border: none; border-bottom: 2px solid transparent; color: var(--text-secondary);
}
.dw-dlg-tab:hover { color: var(--text-primary); }
.dw-dlg-tab.on { color: var(--text-primary); border-bottom-color: var(--accent); font-weight: 600; }
.dw-dlg-row2 { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 7px 0; min-height: 30px; border-bottom: 1px solid #1a1d24; }
.dw-dlg-row2:last-child { border-bottom: none; }
.dw-dlg-l2 { font-size: 12px; color: var(--text-secondary); flex-shrink: 0; }
.dw-dlg-c2 { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.dw-dlg-c2 input[type=range] { width: 92px; accent-color: var(--accent); }
.dw-chk {
  width: 20px; height: 20px; border-radius: 4px; border: 1px solid var(--border-strong);
  background: #0c0e12; color: var(--accent); font-size: 12px; cursor: pointer; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center; line-height: 1;
}
.dw-chk.on { background: var(--accent-bg); border-color: var(--accent); }
.dw-cin { width: 30px; height: 24px; padding: 0; border: 1px solid var(--border-strong); border-radius: 4px; background: transparent; cursor: pointer; flex-shrink: 0; }
.dw-dlg-sel { background: #0c0e12; border: 1px solid var(--border-strong); border-radius: 5px; color: var(--text-primary); font-size: 12px; padding: 4px 6px; }
.dw-dlg-sep { height: 1px; background: #23262e; margin: 8px 0; }

/* Style tab — "Line" row's 3 boxed buttons (color / dash / end-marker) */
.dw-dlg-linegrp { display: flex; gap: 6px; }
.dw-dlg-linebtn {
  width: 40px; height: 32px; border-radius: 6px; border: 1px solid var(--border-strong);
  background: #0c0e12; cursor: pointer; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 3px; padding: 0;
}
.dw-dlg-linebtn:hover { background: #171a20; }
.dw-dlg-linebtn-sw { width: 16px; height: 16px; border-radius: 3px; }
.dw-dlg-linebtn-ln { width: 20px; height: 2px; border-radius: 1px; }
.dw-dlg-markerbtn { color: #c8cbcf; }
.dw-listpop-item svg[width="16"] { width: 16px; height: 16px; flex-shrink: 0; }
/* Dropdown-styled button reused for Extend / Stats (native <select> look,
   but backed by a custom popup so it can show checkboxes, not just options) */
.dw-dlg-selbtn { width: 100%; text-align: left; cursor: pointer; position: relative; }
.dw-dlg-selbtn::after { content: '▾'; float: right; color: var(--text-secondary); }
.dw-dlg-chkrow { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-secondary); cursor: pointer; width: 100%; }
.dw-dlg-sechead { font-size: 11px; font-weight: 600; letter-spacing: .04em; color: var(--text-muted); padding: 14px 0 2px; }
.dw-dlg-rename { border: none; background: transparent; color: #787b86; cursor: pointer; padding: 3px; border-radius: 4px; display: inline-flex; }
.dw-dlg-rename:hover { background: #23262e; color: #fff; }
.dw-dlg-rename svg { width: 12px; height: 12px; }
.dw-dlg-spacer { flex: 1; }
/* Checkbox-style rows inside the shared .dw-listpop dropdown (Extend / Stats) */
.dw-listpop-chk { cursor: pointer; }
.dw-listpop-chk input[type=checkbox] { accent-color: var(--accent); cursor: pointer; }

/* Alert dialog — Notifications tab: one row per channel (checkbox + label +
   optional "?" tooltip, muted description, extra controls when checked). */
.alert-notif-row { padding: 10px 0; border-bottom: 1px solid #1a1d24; }
.alert-notif-row:last-child { border-bottom: none; }
.alert-notif-head { display: flex; align-items: center; gap: 9px; }
.alert-notif-label { font-size: 12.5px; font-weight: 600; color: var(--text-primary); }
.alert-notif-help {
  width: 15px; height: 15px; border-radius: 50%; border: 1px solid var(--text-muted);
  color: var(--text-muted); font-size: 10px; display: inline-flex; align-items: center;
  justify-content: center; cursor: help; flex-shrink: 0;
}
.alert-notif-desc { font-size: 11px; color: var(--text-muted); padding: 3px 0 0 29px; line-height: 1.4; }
.alert-notif-input { margin: 8px 0 0 29px; width: calc(100% - 29px); }
.alert-notif-selects { display: flex; gap: 8px; margin: 8px 0 0 29px; }
.alert-notif-selects .dw-dlg-sel { flex: 1; }
.dw-dlg-hint { font-size: 11px; color: var(--text-muted); padding: 4px 0 8px; }
.dw-bi { min-width: 28px; }
.dw-dlg-textrow { display: flex; align-items: center; gap: 6px; padding: 4px 0 8px; }
.dw-dlg-ta {
  width: 100%; min-height: 84px; resize: vertical; padding: 8px 10px;
  background: #0c0e12; border: 1px solid var(--border-strong); border-radius: 6px;
  color: var(--text-primary); font-family: inherit; font-size: 13px; box-sizing: border-box;
}
.dw-dlg-ta:focus { outline: none; border-color: var(--accent); }
.dw-dlg-nin, .dw-dlg-num { font-variant-numeric: tabular-nums; }
.dw-dlg-nin {
  width: 100px; padding: 5px 7px; background: #0c0e12; border: 1px solid var(--border-strong);
  border-radius: 5px; color: var(--text-primary); font-size: 12px; font-family: 'Courier New', monospace;
}
.dw-nin-sm { width: 64px; }
.dw-dlg-nin:focus { outline: none; border-color: var(--accent); }
.dw-dlg-nin:disabled { opacity: .4; cursor: default; }

/* Visibility tab — per-unit row (checkbox + label, then min/slider/max) */
.dw-dlg-visrow { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid #1a1d24; }
.dw-dlg-visrow:last-child { border-bottom: none; }
.dw-dlg-visrow .dw-dlg-chkrow { flex: 0 0 74px; width: auto; white-space: nowrap; }
.dw-dlg-visrange { display: flex; align-items: center; gap: 5px; flex: 1; min-width: 0; }
.dw-dlg-visrange .dw-dlg-nin {
  width: 34px; padding: 4px 2px; font-size: 10.5px; flex-shrink: 0; text-align: center;
  -moz-appearance: textfield;
}
/* Hide the native up/down spinner so all the width goes to the digits —
   at this size (3-digit values like 366) the stepper otherwise eats enough
   space to clip the text. */
.dw-dlg-visrange .dw-dlg-nin::-webkit-outer-spin-button,
.dw-dlg-visrange .dw-dlg-nin::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.dw-rslider { position: relative; flex: 1; height: 20px; display: flex; align-items: center; cursor: pointer; }
.dw-rslider-track { position: absolute; left: 0; right: 0; height: 3px; background: #2c2c2c; border-radius: 2px; }
.dw-rslider-fill { position: absolute; height: 3px; background: var(--accent); border-radius: 2px; }
.dw-rslider-handle {
  position: absolute; top: 50%; width: 14px; height: 14px; margin-top: -7px; transform: translateX(-50%);
  border-radius: 50%; background: #fff; border: 2px solid var(--accent); cursor: grab;
}
.dw-rslider-handle:active { cursor: grabbing; }
.dw-rslider-disabled, .dw-rslider-disabled .dw-rslider { cursor: default; }
.dw-rslider-disabled .dw-rslider-fill { background: #3a3d46; }
.dw-rslider-disabled .dw-rslider-handle { background: #23262e; border-color: #3a3d46; cursor: default; }
/* Fib level grid */
.dw-fib-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; }
.dw-fib-row { display: flex; align-items: center; gap: 6px; }
.dw-fib-val {
  width: 64px; padding: 4px 6px; background: #0c0e12; border: 1px solid var(--border-strong);
  border-radius: 4px; color: var(--text-primary); font-size: 12px;
}
.dw-fib-val:focus { outline: none; border-color: var(--accent); }
.dw-fib-val:disabled { color: var(--text-muted); border-color: #23262e; cursor: default; }

/* Parallel Channel's Style-tab level rows — single column (TradingView
   layout), one full-width row per level, unlike Fib's 2-column grid. */
.dw-lvl-grid { display: flex; flex-direction: column; gap: 6px; }
.dw-lvl-row { display: flex; align-items: center; gap: 8px; }
.dw-lvl-val { flex: 1; min-width: 0; }
.dw-lvl-swbtn {
  width: 84px; height: 32px; border-radius: 6px; border: 1px solid var(--border-strong);
  background: #0c0e12; cursor: pointer; display: flex; flex-shrink: 0;
  align-items: center; justify-content: center; gap: 8px; padding: 0 10px;
}
.dw-lvl-swbtn:hover { background: #171a20; }
.dw-lvl-sw { width: 16px; height: 16px; border-radius: 3px; flex-shrink: 0; }
.dw-lvl-dash { flex: 1; height: 0; border-top: 2px solid #c8cbcf; }
.dw-lvl-dash.dw-dashprev-dashed { border-top-style: dashed; }
.dw-lvl-dash.dw-dashprev-dotted { border-top-style: dotted; border-top-width: 2.5px; }

/* OHLC legend — top-left overlay */
.chart-legend {
  position: absolute; top: 6px; left: 8px;
  z-index: 15; pointer-events: none;
  display: flex; align-items: center; flex-wrap: wrap; gap: 3px;
  font-size: 11px;
}
.cl-sym  { font-weight: 700; font-size: 13px; color: #d1d4dc; letter-spacing: .3px; }
.cl-tf   { color: #787b86; }
.cl-prov { color: #4c525e; font-size: 10px; }
.cl-dot  { color: #333; margin: 0 1px; }
.cl-bar  { display: inline-block; width: 1px; height: 11px; background: #2c2c2c; margin: 0 4px; }
.cl-lbl  { color: #4c525e; font-size: 10px; margin-right: 1px; }
.cl-val  { color: #c8cbcf; font-family: 'Courier New', monospace; font-size: 11px; margin-right: 4px; }
.cl-up   { color: #26a69a; }
.cl-dn   { color: #ef5350; }
.cl-chg  { font-weight: 600; margin-left: 2px; font-size: 11px; }

/* A / L scale control buttons */
/* A / L controls docked at the bottom of the price scale (right edge).
   Hidden by default — revealed only when the cursor is over the price scale,
   because the price itself is the most important thing to read. */
.chart-ps-btns {
  position: absolute; right: 6px; bottom: 26px;
  display: flex; flex-direction: row; gap: 3px; z-index: 18;   /* A L side by side */
  opacity: 0; pointer-events: none; transition: opacity .14s ease;
}
.chart-ps-btns.show { opacity: 1; pointer-events: auto; }
.csb {
  width: 24px; height: 24px;
  background: #0a0a0a; border: 1px solid rgba(255,255,255,.08);
  border-radius: 3px; color: #606060;
  font-size: 11px; font-weight: 700; line-height: 1;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: all .15s ease;
}
.csb:hover { background: #1a1a1a; border-color: #2962ff; color: #8a8a8a; }
.csb.on { background: #2962ff; border-color: #2962ff; color: #ffffff; box-shadow: 0 0 8px rgba(41,98,255,.5); }
/* Scroll-to-latest chevron — a floating round pill just above the time
   axis (TradingView-style), not a flat square block flush against the
   price scale. */
.chart-golatest {
  position: absolute; right: 68px; bottom: 30px; z-index: 15;
  width: 26px; height: 26px; border-radius: 50%;
  background: #16181d; border: 1px solid rgba(255,255,255,.1);
  box-shadow: 0 2px 6px rgba(0,0,0,.4);
}
.csb-go { color: #26a69a; font-size: 13px; letter-spacing: -1px; padding-left: 1px; }
.csb-go:hover { background: #1f2a28; border-color: #26a69a; color: #2dc4ae; box-shadow: 0 2px 8px rgba(38,166,154,.35); }

.chart-placeholder {
  position: absolute; inset: 0; z-index: 20;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 10px; color: var(--text-secondary);
  background: #000000; pointer-events: none;
}
.chart-placeholder svg { width: 40px; height: 40px; opacity: .22; flex-shrink: 0; }
.chart-placeholder p { font-size: 13px; margin: 0; }
.chart-overlay {
  position: absolute; inset: 0; z-index: 20;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 8px; font-size: 13px; color: var(--text-secondary);
  background: rgba(0,0,0,.82); pointer-events: none;
}
.chart-overlay-error { color: #ef5350; pointer-events: all; }
.chart-spinner {
  width: 22px; height: 22px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: chartSpin .7s linear infinite;
}
@keyframes chartSpin { to { transform: rotate(360deg); } }

/* Multi-layout grid */
.layout-container { position: absolute; inset: 0; display: grid; }
.layout-pane {
  border: 1px solid var(--border); background: var(--bg-primary);
  display: flex; flex-direction: column;
  position: relative; overflow: hidden;
}
.layout-pane.focused { border-color: var(--accent); }

/* ═══════════════════════════════════════════════════════════════════════════
   RIGHT SIDEBAR
═══════════════════════════════════════════════════════════════════════════ */
.right-sidebar { display: flex; flex-shrink: 0; }

.right-icons {
  width: var(--right-icon-w); min-width: var(--right-icon-w);
  background: var(--bg-secondary);
  border-left: 1px solid var(--border);
  display: flex; flex-direction: column;
  align-items: center; padding: 4px 0; gap: 1px;
  overflow-y: auto;
}
.right-icons-divider { width: 26px; height: 1px; background: var(--border); margin: 3px 0; flex-shrink: 0; }

.panel-btn {
  width: 38px; height: 34px; border-radius: 4px; border: none;
  background: transparent; color: var(--text-secondary);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; position: relative; flex-shrink: 0;
}
.panel-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.panel-btn.active { color: var(--accent); background: var(--accent-bg); }
.panel-btn svg { width: 17px; height: 17px; }
.panel-btn .pb-tip {
  position: absolute; right: calc(100% + 8px); top: 50%;
  transform: translateY(-50%);
  background: var(--bg-tertiary); color: var(--text-primary);
  padding: 3px 7px; border-radius: 4px; font-size: 11px;
  white-space: nowrap; pointer-events: none; z-index: 900;
  opacity: 0; transition: opacity .1s;
  border: 1px solid var(--border);
}
.panel-btn:hover .pb-tip { opacity: 1; }
.panel-btn-badge {
  position: absolute; top: 2px; right: 3px;
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 14px; height: 14px; padding: 0 3px;
  border-radius: 7px; background: var(--red, #ef5350); color: #fff;
  font-size: 9px; font-weight: 700; line-height: 1;
}

/* Right panel content */
.right-panel {
  width: var(--right-panel-w); min-width: var(--right-panel-w);
  background: var(--bg-secondary);
  border-left: 1px solid var(--border);
  display: flex; flex-direction: column; overflow: hidden;
  position: relative;
}

/* Drag-to-resize handle on the left edge of the right panel */
.rp-resize {
  position: absolute; left: 0; top: 0; bottom: 0; width: 6px;
  cursor: col-resize; background: transparent;
  border-left: 2px solid transparent;
  transition: border-color .12s, background .12s;
  z-index: 20;
}
.rp-resize:hover, .rp-resize.dragging {
  border-left-color: var(--accent);
  background: rgba(106, 169, 255, 0.13);
}
.rp-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 12px; height: 38px; min-height: 38px;
  border-bottom: 1px solid var(--border);
  font-size: 13px; font-weight: 600; flex-shrink: 0;
}
.rp-header-right { display: flex; align-items: center; gap: 2px; }
.rp-body         { flex: 1; overflow-y: auto; padding: 8px; }
.rp-body.flush   { padding: 0; display: flex; flex-direction: column; overflow: hidden; }

/* Constrain bare SVG icons inside the flush watchlist panel */
.rp-body.flush svg { width: 14px; height: 14px; }
/* Asset/flag SVGs must fill their own containers */
.rp-body.flush .fx-flag svg,
.rp-body.flush .asset-svg svg,
.rp-body.flush .cmdty-flag svg { width: 100%; height: 100%; }

/* Panel empty state */
.panel-empty {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  height: 180px; gap: 8px; color: var(--text-muted);
}
.panel-empty svg { width: 28px; height: 28px; opacity: .5; }
.panel-empty p { font-size: 11px; }

/* Object Tree panel — one row per drawing, front-most first */
.obj-tree { padding: 4px; }
.obj-tree-row {
  display: flex; align-items: center; justify-content: space-between; gap: 6px;
  padding: 7px 8px; border-radius: 5px; cursor: pointer; color: var(--text-secondary);
}
.obj-tree-row:hover { background: var(--bg-hover); }
.obj-tree-row.on { background: var(--accent-bg); color: var(--accent); }
.obj-tree-name { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.obj-tree-actions { display: flex; align-items: center; gap: 2px; flex-shrink: 0; }
.obj-tree-ibtn {
  border: none; background: transparent; color: inherit; opacity: .6; cursor: pointer;
  padding: 3px; border-radius: 4px; display: inline-flex;
}
.obj-tree-ibtn:hover { opacity: 1; background: rgba(255,255,255,.08); }
.obj-tree-ibtn svg { width: 13px; height: 13px; }
.obj-tree-del:hover { color: var(--red); }
.obj-tree-ibtn:disabled { opacity: .25; cursor: default; }
.obj-tree-ibtn:disabled:hover { background: transparent; }

.obj-tree-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 8px; border-bottom: 1px solid var(--border);
}
.obj-tree-toolbar-side { display: flex; align-items: center; gap: 2px; }
.obj-tree-group-head {
  display: flex; align-items: center; gap: 5px; padding: 6px 8px; cursor: pointer;
  color: var(--text-secondary); font-size: 12px; font-weight: 600;
}
.obj-tree-group-head:hover { background: var(--bg-hover); border-radius: 5px; }
.obj-tree-caret { display: inline-block; transition: transform .12s; font-size: 10px; }
.obj-tree-caret.closed { transform: rotate(-90deg); }
.obj-tree-group-body { padding-left: 14px; }

.obj-tree-row { position: relative; }
.obj-tree-tooltip {
  display: none; position: absolute; left: 0; top: -38px; z-index: 40;
  background: #1a1d24; border: 1px solid #2c2c2c; border-radius: 5px;
  padding: 6px 9px; font-size: 11px; line-height: 1.4; color: #d1d4dc;
  white-space: pre; box-shadow: 0 4px 14px rgba(0,0,0,.5); pointer-events: none;
}
.obj-tree-row:hover .obj-tree-tooltip { display: block; }

/* Economic Calendar panel */
.cal-day-h { font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); padding: 10px 12px 6px; }
.cal-week-btn { background: none; border: 1px solid var(--border); color: var(--text-muted); border-radius: 5px; padding: 3px 9px; font-size: 11px; cursor: pointer; margin-left: 4px; }
.cal-week-btn.on { color: var(--text-primary); border-color: var(--accent); background: var(--bg-hover); }
.cal-cats { display: flex; gap: 6px; padding: 8px 12px; border-bottom: 1px solid var(--border); overflow-x: auto; flex: 0 0 auto; }
.cal-cat { flex: 0 0 auto; background: var(--bg-primary); border: 1px solid var(--border); color: var(--text-secondary); border-radius: 999px; padding: 5px 14px; font-size: 12px; cursor: pointer; }
.cal-cat.on { background: #fff; color: #0e1116; border-color: #fff; font-weight: 600; }
.cal-cat:disabled { opacity: 0.4; cursor: not-allowed; }
.cal-content { overflow-y: auto; }
.cal-row2 { display: grid; grid-template-columns: 52px 22px 1fr; align-items: start; gap: 10px; padding: 8px 12px; border-bottom: 1px solid var(--border); cursor: pointer; }
.cal-row2:hover { background: var(--bg-hover); }
.cal-time { font-family: "Geist Mono", monospace; font-size: 11px; color: var(--text-secondary); padding-top: 1px; }
.cal-flag { font-size: 15px; line-height: 1; }
.cal-main { min-width: 0; }
.cal-title-row { display: flex; align-items: center; gap: 8px; }
.cal-name { font-size: 12.5px; color: var(--text-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-impact { display: inline-flex; gap: 2px; flex: 0 0 auto; }
.cal-impact i { width: 3px; height: 9px; border-radius: 1px; display: inline-block; }
.cal-holiday { font-size: 10px; color: var(--text-muted); background: var(--bg-active); border-radius: 3px; padding: 1px 6px; }
.cal-vals { display: flex; gap: 12px; margin-top: 3px; font-size: 11px; color: var(--text-muted); }
.cal-vals b { color: var(--text-primary); font-weight: 600; }
.cal-vals .cal-act { color: var(--accent); }
.cal-empty { text-align: center; color: var(--text-secondary); padding: 30px 16px; font-size: 12.5px; line-height: 1.5; }
.cal-range { font-size: 11px; color: var(--text-secondary); font-family: "Geist Mono", monospace; min-width: 96px; text-align: center; }
.cal-week-strip { display: flex; gap: 6px; padding: 8px 12px; overflow-x: auto; border-bottom: 1px solid var(--border); flex: 0 0 auto; }
.cal-daycard { flex: 0 0 auto; min-width: 56px; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 8px; background: var(--bg-primary); border: 1px solid var(--border); border-radius: 8px; cursor: pointer; }
.cal-daycard:hover { border-color: var(--accent); }
.cal-daycard.on { background: var(--bg-hover); border-color: var(--accent); }
.cal-daycard.today .cal-dc-wd { color: var(--accent); }
.cal-dc-wd { font-size: 11px; color: var(--text-secondary); white-space: nowrap; }
.cal-dc-n { font-size: 13px; font-weight: 700; color: var(--text-primary); }
.cal-filters { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--border); flex: 0 0 auto; }
.cal-imp-toggles { display: flex; gap: 5px; }
.cal-imp-btn { background: var(--bg-primary); border: 1px solid var(--border); color: var(--text-muted); border-radius: 5px; padding: 3px 9px; font-size: 11px; cursor: pointer; }
.cal-imp-btn.on { color: var(--text-primary); }
.cal-cur { position: relative; }
.cal-cur-btn { background: var(--bg-primary); border: 1px solid var(--border); color: var(--text-secondary); border-radius: 5px; padding: 3px 10px; font-size: 11px; cursor: pointer; }
.cal-cur-menu { position: absolute; right: 0; top: calc(100% + 4px); z-index: 30; background: var(--bg-tertiary); border: 1px solid var(--border-strong); border-radius: 8px; box-shadow: 0 12px 40px rgba(0,0,0,0.5); max-height: 260px; overflow-y: auto; min-width: 150px; padding: 4px; }
.cal-cur-item { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 10px; background: none; border: none; color: var(--text-primary); font-size: 12px; padding: 6px 8px; border-radius: 5px; cursor: pointer; text-align: left; }
.cal-cur-item:hover { background: var(--bg-hover); }
.cal-cur-item.on { color: var(--accent); }
.cal-title-row .cal-name { flex: 1; min-width: 0; }
.cal-caret { color: var(--text-muted); font-size: 9px; flex: 0 0 auto; }
.cal-row2.open { background: var(--bg-hover); }
.cal-row2.cal-now { box-shadow: inset 3px 0 0 var(--accent); } /* "now" anchor marker — where the calendar lands on open */
.cal-detail { grid-column: 1 / -1; margin-top: 8px; padding: 11px 12px; background: var(--bg-primary); border: 1px solid var(--border); border-radius: 8px; display: grid; grid-template-columns: 1fr 1fr; gap: 11px 12px; }
.cal-det-row { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cal-det-row span { font-size: 9.5px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); font-weight: 600; }
.cal-det-row b { color: var(--text-primary); font-weight: 600; font-size: 12px; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-det-row b.cal-act { color: var(--accent); }

/* Reports panel — closed paper-trade journal */
.reports-head {
  display: flex; align-items: center; gap: 6px; margin-bottom: 8px;
}
.reports-head-t { flex: 1; font-size: 11px; font-weight: 600; color: var(--text-secondary); }
.reports-btn {
  font-size: 10px; padding: 3px 8px; border-radius: 4px; cursor: pointer;
  background: var(--bg-tertiary); border: 1px solid var(--border); color: var(--text-secondary);
}
.reports-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.reports-btn.danger:hover { border-color: var(--red, #ef5350); color: var(--red, #ef5350); }
.reports-metrics {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px;
  padding-bottom: 10px; margin-bottom: 8px; border-bottom: 1px solid var(--border);
}
.reports-metric {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  background: var(--bg-tertiary); border: 1px solid var(--border); border-radius: 5px; padding: 5px 4px;
}
.reports-metric-v { font-size: 12px; font-weight: 600; color: var(--text-primary); font-variant-numeric: tabular-nums; }
.reports-metric-v.up, .reports-metric-v .up { color: var(--green, #26a69a); }
.reports-metric-v.down, .reports-metric-v .down { color: var(--red, #ef5350); }
.reports-metric-l { font-size: 9px; color: var(--text-muted); }
.reports-summary {
  display: flex; gap: 8px; padding-bottom: 10px; margin-bottom: 8px; border-bottom: 1px solid var(--border);
}
.reports-stat { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.reports-stat-v { font-size: 13px; font-weight: 600; color: var(--text-primary); font-variant-numeric: tabular-nums; }
.reports-stat-l { font-size: 10px; color: var(--text-muted); }
.reports-pnl.up .reports-stat-v { color: var(--green, #26a69a); }
.reports-pnl.down .reports-stat-v { color: var(--red, #ef5350); }
.reports-list { display: flex; flex-direction: column; gap: 6px; }
.reports-row { background: var(--bg-tertiary); border: 1px solid var(--border); border-radius: 6px; padding: 7px 9px; }
.reports-row-top { display: flex; align-items: center; gap: 6px; font-size: 12px; }
.reports-side { font-weight: 600; }
.reports-side.buy { color: var(--green, #26a69a); }
.reports-side.sell { color: var(--red, #ef5350); }
.reports-sym { flex: 1; color: var(--text-secondary); }
.reports-pl { font-weight: 600; font-variant-numeric: tabular-nums; }
.reports-pl.up { color: var(--green, #26a69a); }
.reports-pl.down { color: var(--red, #ef5350); }
.reports-row-bottom {
  display: flex; align-items: center; gap: 8px; margin-top: 4px;
  font-size: 10px; color: var(--text-muted); font-variant-numeric: tabular-nums;
}
.reports-tag { padding: 1px 6px; border-radius: 3px; background: var(--bg-hover); color: var(--text-secondary); }
.reports-tag.tp { color: var(--green, #26a69a); }
.reports-tag.sl { color: var(--red, #ef5350); }
.reports-time { margin-left: auto; }

/* Alerts panel — TradingView-style Alerts / Log tabs */
.alerts-tab-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 15px; height: 15px; margin-left: 5px; padding: 0 4px;
  border-radius: 8px; background: var(--red, #ef5350); color: #fff;
  font-size: 9.5px; font-weight: 700; line-height: 1; vertical-align: middle;
}
.alerts-toolbar { display: flex; align-items: center; gap: 2px; padding: 8px 0; margin-bottom: 4px; }
.alerts-tb-btn {
  width: 26px; height: 26px; border: none; background: transparent; color: var(--text-muted);
  border-radius: 4px; font-size: 14px; cursor: pointer;
}
.alerts-tb-btn[disabled] { cursor: not-allowed; opacity: .55; }
.alerts-tb-btn:not([disabled]):hover { background: var(--bg-hover); color: var(--text-primary); }
.alerts-tb-btn.on { background: var(--accent-bg); color: var(--accent); }
.alerts-search-input {
  width: 100%; margin-bottom: 8px; padding: 6px 9px; font-size: 12px;
  background: var(--bg-tertiary); border: 1px solid var(--border); border-radius: 5px;
  color: var(--text-primary); outline: none;
}
.alerts-search-input:focus { border-color: var(--accent); }

/* Sort/"..." dropdowns — reuse .dw-ctxmenu's shell */
.alerts-menu { max-height: 70vh; overflow-y: auto; }
.alerts-menu .dw-ctx-item { display: flex; align-items: center; gap: 8px; }
.alerts-menu .dw-ctx-item svg { flex: 0 0 auto; width: 12px; height: 12px; color: var(--text-muted); }
.alerts-menu .dw-ctx-del svg { color: var(--red); }
.alerts-menu-active { color: var(--accent); }
.alerts-menu-section-title {
  padding: 8px 12px 4px; font-size: 10px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .03em; color: var(--text-muted);
}
.alerts-menu-radio, .alerts-menu-check { display: flex; align-items: center; gap: 8px; }
.alerts-menu-dot {
  flex: 0 0 auto; width: 12px; height: 12px; border-radius: 50%; border: 1.5px solid var(--text-muted);
  position: relative;
}
.alerts-menu-dot.on { border-color: var(--accent); }
.alerts-menu-dot.on::after {
  content: ''; position: absolute; inset: 2px; border-radius: 50%; background: var(--accent);
}
.alerts-menu-box {
  flex: 0 0 auto; width: 13px; height: 13px; border-radius: 3px; border: 1.5px solid var(--text-muted);
  display: inline-flex; align-items: center; justify-content: center; font-size: 10px; line-height: 1; color: var(--accent);
}
.alerts-menu-box.on { border-color: var(--accent); }
.alerts-menu-count { color: var(--text-muted); font-size: 11px; }
.alerts-menu-disabled { opacity: .45; cursor: not-allowed; }
.alerts-menu-disabled:hover { background: transparent !important; }
.alerts-log-daylabel {
  padding: 6px 2px 2px; font-size: 10px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .04em; color: var(--text-muted);
}
.alerts-webhook-tag { color: var(--accent); }

.alerts-list { display: flex; flex-direction: column; gap: 6px; }
.alert-row {
  display: flex; align-items: flex-start; gap: 8px; cursor: pointer;
  background: var(--bg-tertiary); border: 1px solid var(--border); border-radius: 6px; padding: 8px 9px;
}
.alert-row:hover { border-color: var(--border-strong); }
.alert-row .pulse { flex: 0 0 auto; width: 7px; height: 7px; border-radius: 50%; margin-top: 4px; }
.alert-row .pulse.active    { background: var(--green, #26a69a); }
.alert-row .pulse.paused    { background: var(--text-muted); }
.alert-row .pulse.triggered { background: #ffb300; }
.alert-row .pulse.expired   { background: var(--red, #ef5350); }
.alert-row .flex-1 { flex: 1; min-width: 0; }
.alert-row-title { display: flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 500; color: var(--text-secondary); }
.alert-row.unread .alert-row-title { font-weight: 700; color: var(--text-primary); }
.alert-row-src { flex: 0 0 auto; display: inline-flex; color: var(--text-muted); }
.alert-row-message { margin-top: 2px; font-size: 10.5px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.alert-row-meta { margin-top: 3px; font-size: 10.5px; color: var(--text-muted); }
.alert-row-meta .mono { font-family: 'Courier New', monospace; }
.alert-status.active    { color: var(--green, #26a69a); }
.alert-status.paused    { color: var(--text-muted); }
.alert-status.triggered { color: #ffb300; }
.alert-status.expired   { color: var(--red, #ef5350); }
.alert-row-date { color: var(--text-muted); }
.alert-row-actions { flex: 0 0 auto; display: none; align-items: center; gap: 1px; }
.alert-row:hover .alert-row-actions { display: flex; }
.alert-row-icon {
  border: none; background: transparent; color: var(--text-muted);
  cursor: pointer; padding: 4px; border-radius: 4px; display: inline-flex; align-items: center; justify-content: center;
}
.alert-row-icon:hover { background: rgba(255,255,255,.08); color: var(--text-primary); }
.alert-row-icon.danger:hover { background: rgba(239,83,80,.2); color: var(--red, #ef5350); }

/* Chats panel tabs */
.chat-tabs { display: flex; border-bottom: 1px solid var(--border); margin-bottom: 8px; }
.chat-tab  { flex: 1; padding: 7px 4px; text-align: center; font-size: 11px; cursor: pointer; color: var(--text-secondary); border-bottom: 2px solid transparent; }
.chat-tab:hover  { color: var(--text-primary); }
.chat-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ── Watchlist panel layout ─────────────────────────────────────────────── */
.panel-header {
  display: flex; align-items: center; gap: 8px;
  height: 36px; padding: 0 8px 0 12px;
  border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.panel-header .title    { font-weight: 600; font-size: 12px; }
.panel-content { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; }

/* ── Watchlist row ────────────────────────────────────────────────────────── */
.wl-row {
  display: grid;
  grid-template-columns: var(--wl-cols, 18px minmax(56px,1fr) 64px 52px 48px);
  align-items: center; column-gap: 5px;
  height: var(--row-h-sm, 28px); padding: 0 8px;
  font-size: 11.5px; cursor: pointer; position: relative;
}
.wl-row:hover { background: var(--bg-hover); }
.wl-row-resize { position: absolute; left: 0; right: 0; bottom: -2px; height: 5px; cursor: row-resize; z-index: 4; touch-action: none; }
.wl-row-resize:hover { background: var(--accent); box-shadow: 0 0 0 1px var(--accent); opacity: 0.55; }
.wl-row.active { background: var(--accent-soft); }
.wl-row.active::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 2px; background: var(--accent); }
.wl-remove {
  position: absolute; right: 5px; top: 50%; transform: translateY(-50%);
  width: 18px; height: 18px; display: none; align-items: center; justify-content: center;
  background: var(--bg-panel-2); border: 1px solid var(--border); border-radius: 4px;
  color: var(--text-2); cursor: pointer; z-index: 2;
}
.wl-row[draggable="true"] { cursor: grab; }
.wl-row.dragging { opacity: 0.5; background: var(--bg-active); }
.wl-row:hover .wl-remove { display: flex; }
.wl-remove:hover { color: var(--down); border-color: var(--down); }
.wl-flagbtn:hover { color: var(--text-1); border-color: var(--accent); }
.wl-flag-swatch { width: 20px; height: 20px; border-radius: 50%; border: 1px solid rgba(255,255,255,0.12); cursor: pointer; padding: 0; transition: transform 0.1s; }
.wl-flag-swatch:hover { transform: scale(1.15); }
/* Price flash — number color only, no background */
.wl-price, .wl-chg-abs, .wl-chg { transition: color 0.55s ease-out; }
.wl-row.flash-up   .wl-price, .wl-row.flash-up   .wl-chg-abs, .wl-row.flash-up   .wl-chg { color: var(--up);   transition: none; }
.wl-row.flash-down .wl-price, .wl-row.flash-down .wl-chg-abs, .wl-row.flash-down .wl-chg { color: var(--down); transition: none; }

/* ── Asset icon system ────────────────────────────────────────────────────── */
.wl-token { width: 18px; height: 18px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 9px; font-weight: 700; flex-shrink: 0; letter-spacing: -0.02em; box-shadow: inset 0 -1px 0 rgba(0,0,0,0.1); }
.fx-pair  { position: relative; display: inline-block; flex-shrink: 0; }
.fx-flag  { position: absolute; top: 0; border-radius: 50%; overflow: hidden; box-shadow: 0 0 0 1.3px var(--bg-panel-2), inset 0 0 0 0.5px rgba(255,255,255,0.22); }
.fx-flag svg { display: block; width: 100%; height: 100%; }
.fx-flag.b { z-index: 2; }
.fx-flag.q { z-index: 1; }
.asset-logo { border-radius: 50%; display: block; flex-shrink: 0; vertical-align: middle; box-shadow: inset 0 0 0 0.5px rgba(255,255,255,0.14); }
.asset-svg  { display: inline-block; flex-shrink: 0; border-radius: 50%; overflow: hidden; box-shadow: inset 0 0 0 0.5px rgba(255,255,255,0.14); }
.asset-svg svg { display: block; width: 100%; height: 100%; }
.cmdty-wrap { position: relative; display: inline-block; flex-shrink: 0; }
.cmdty-wrap .asset-svg { position: absolute; inset: 0; }
.cmdty-flag { position: absolute; right: -1px; bottom: -1px; z-index: 2; border-radius: 50%; overflow: hidden; box-shadow: 0 0 0 1.2px var(--bg-panel-2); }
.cmdty-flag svg { display: block; width: 100%; height: 100%; }

/* ── Watchlist text cells ─────────────────────────────────────────────────── */
.wl-sym { font-weight: 500; color: var(--text-1); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wl-price, .wl-chg, .wl-chg-abs { font-variant-numeric: tabular-nums; font-size: 11px; text-align: right; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wl-chg.up, .wl-chg-abs.up   { color: var(--up); }
.wl-chg.down, .wl-chg-abs.down { color: var(--down); }

/* ── Watchlist column headers ─────────────────────────────────────────────── */
.wl-col-h {
  display: grid;
  grid-template-columns: var(--wl-cols, 18px minmax(56px,1fr) 64px 52px 48px);
  align-items: center; column-gap: 5px; height: 22px; padding: 0 8px;
  font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-3); border-bottom: 1px solid var(--border); background: var(--bg-panel-2);
  flex-shrink: 0;
}
.wl-col-h .num { text-align: right; }
.wl-col-h > span { position: relative; }
.wl-col-resize { position: absolute; top: 0; bottom: 0; right: -3px; width: 7px; cursor: col-resize; z-index: 4; touch-action: none; }
.wl-col-resize::after { content: ""; position: absolute; right: 3px; top: 5px; bottom: 5px; width: 1px; background: var(--border); }
.wl-col-resize:hover::after { top: 0; bottom: 0; width: 2px; background: var(--accent); }

/* ── Generic list rows / inline button ───────────────────────────────────── */
.list-row { display: flex; align-items: center; gap: 8px; padding: 6px 10px; font-size: 12px; cursor: pointer; border-radius: 4px; }
.list-row:hover { background: var(--bg-hover); }
.list-row .ic { color: var(--text-3); }

/* ═══════════════════════════════════════════════════════════════════════════
   BOTTOM BAR (v1-style status bar)
═══════════════════════════════════════════════════════════════════════════ */
.bottom-bar {
  height: var(--bottom-h); min-height: var(--bottom-h);
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 8px; gap: 6px; flex-shrink: 0;
  font-size: 11px; color: var(--text-secondary);
}
.sb-range-chip {
  height: 20px; padding: 0 6px; border-radius: 3px;
  border: none; background: transparent;
  font-size: 11px; color: var(--text-secondary);
  display: inline-flex; align-items: center; cursor: pointer; white-space: nowrap;
}
.sb-range-chip:hover { background: var(--bg-hover); color: var(--text-primary); }
.sb-range-chip.active { background: var(--bg-active); color: var(--text-primary); }
.sb-range-chip svg { width: 12px; height: 12px; }
.sb-spacer { flex: 1; min-width: 0; }
.status-pill {
  height: 20px; padding: 0 7px;
  border: 1px solid var(--border); border-radius: 3px;
  background: var(--bg-tertiary); color: var(--text-secondary);
  font-size: 10px; white-space: nowrap;
  display: inline-flex; align-items: center;
}
.status-pill.active { color: var(--accent); background: var(--accent-bg); border-color: rgba(41,98,255,.35); }
.status-action { cursor: pointer; }
.status-action:hover { border-color: var(--text-muted); color: var(--text-primary); }
.sb-bullet { color: var(--text-muted); font-size: 10px; }
.sb-clock  { font-size: 11px; white-space: nowrap; }
.sb-conn   { display: flex; align-items: center; gap: 5px; }
.sb-conn-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green); box-shadow: 0 0 5px rgba(38,166,154,.45); flex-shrink: 0; }
.sb-conn-label { font-size: 11px; white-space: nowrap; }
.mc-focus-controls { display: inline-flex; align-items: center; gap: 5px; }
.mc-view-toggle {
  height: 20px; padding: 0 7px; border-radius: 3px;
  border: 1px solid var(--border); background: var(--bg-tertiary);
  color: var(--text-secondary); font-size: 11px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 4px;
}
.mc-view-toggle:hover { border-color: var(--accent); color: var(--text-primary); }
.mc-view-toggle svg { width: 11px; height: 11px; }
.mc-focus-browser {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 0 4px; height: 22px; border-radius: 4px;
  border: 1px solid var(--border); background: var(--bg-tertiary);
}
.mc-focus-label { font-size: 11px; color: var(--text-secondary); white-space: nowrap; padding: 0 2px; }
.mc-nav {
  width: 18px; height: 18px; display: inline-flex; align-items: center; justify-content: center;
  border: none; border-radius: 3px; background: transparent;
  color: var(--text-primary); font-size: 14px; line-height: 1; cursor: pointer;
}
.mc-nav:hover { background: var(--bg-hover); }
.mc-dots { display: inline-flex; align-items: center; gap: 3px; }
.mc-dot {
  min-width: 18px; height: 18px; padding: 0 3px; border-radius: 3px;
  border: none; background: transparent; color: var(--text-secondary);
  font-size: 10px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.mc-dot:hover { background: var(--bg-hover); }
.mc-dot.on { background: var(--accent-bg); color: var(--accent); }
.dd-item.active { color: var(--accent); }
.sb-tz-picker { scrollbar-width: none; -ms-overflow-style: none; }
.sb-tz-picker::-webkit-scrollbar { display: none; }
.sb-tz-search {
  margin: 6px 8px 4px; padding: 5px 8px; border-radius: 5px;
  background: var(--bg-tertiary); border: 1px solid var(--border);
  color: var(--text-primary); font-size: 12px; font-family: inherit; outline: none;
}
.sb-tz-search::placeholder { color: var(--text-muted); }
.sb-tz-search:focus { border-color: var(--accent); }
.sb-goto-pop { display: flex; align-items: center; gap: 6px; padding: 8px; min-width: 240px; }
.sb-goto-label { font-size: 11px; color: var(--text-secondary); white-space: nowrap; }
.sb-goto-input {
  flex: 1; padding: 4px 6px; border-radius: 5px; min-width: 0;
  background: var(--bg-tertiary); border: 1px solid var(--border);
  color: var(--text-primary); font-size: 12px; font-family: inherit; outline: none;
}
.sb-goto-input:focus { border-color: var(--accent); }
.sb-goto-btn {
  padding: 4px 12px; border-radius: 5px; cursor: pointer;
  background: var(--bg-tertiary); border: 1px solid var(--border); color: var(--text-primary); font-size: 12px;
}
.sb-goto-btn:hover { border-color: var(--accent); background: var(--bg-hover); }

/* ─── Save / Share button ──────────────────────────────────────────────── */
.save-share-btn {
  display: flex; align-items: center; gap: 4px;
  padding: 5px 10px; border-radius: 4px; border: none;
  background: var(--accent); color: #fff;
  font-size: 12px; font-family: inherit;
  cursor: pointer; white-space: nowrap; flex-shrink: 0;
}
.save-share-btn:hover { background: var(--accent-hover); }
.save-share-btn.active { background: var(--accent-hover); }

/* ─── Snapshot button (camera + chevron) ─────────────────────────────── */
.snapshot-btn {
  width: auto !important;
  padding: 0 6px;
  gap: 3px;
}
.snapshot-btn svg:first-child { width: 16px; height: 16px; }

/* ─── Floating Favorites Bar (V1-style draggable pill) ───────────────── */
.floating-fav-bar {
  position: absolute; z-index: 24;
  display: flex; gap: 2px; padding: 3px;
  background: rgba(20,22,28,.9);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  box-shadow: 0 6px 22px rgba(0,0,0,.5);
  backdrop-filter: blur(5px);
}
.floating-fav-bar.vertical { flex-direction: column; }
.ffb-handle, .ffb-tool, .ffb-orient {
  width: 30px; height: 30px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 6px; color: var(--text-secondary);
  position: relative; border: none; background: transparent; touch-action: none;
  transition: background .14s ease, color .14s ease, box-shadow .14s ease, transform .12s ease;
}
.ffb-handle { cursor: grab; color: var(--text-muted); width: 20px; }
.floating-fav-bar.vertical .ffb-handle { width: 30px; height: 20px; }
.ffb-handle:active { cursor: grabbing; }
.ffb-tool { cursor: pointer; }
.ffb-orient { cursor: pointer; color: var(--text-muted); }
.ffb-tool:hover, .ffb-handle:hover, .ffb-orient:hover { background: var(--bg-hover); color: var(--text-primary); }
.ffb-tool:active { transform: scale(.92); }
/* Active (selected) tool: stronger tint + a defined ring + a small accent dot,
   so it reads clearly at a glance instead of the previous barely-there tint. */
.ffb-tool.active {
  background: var(--accent-bg);
  color: var(--accent);
  box-shadow: inset 0 0 0 1px rgba(41,98,255,.5);
}
.ffb-tool.active::after {
  content: '';
  position: absolute; left: 50%; bottom: 3px; transform: translateX(-50%);
  width: 4px; height: 4px; border-radius: 50%; background: var(--accent);
}
.floating-fav-bar.vertical .ffb-tool.active::after { left: 3px; bottom: 50%; transform: translateY(50%); }
.ffb-tool svg, .ffb-orient svg { width: 18px; height: 18px; }
.ffb-handle svg { width: 12px; height: 12px; }
/* Dragging: lift the tile off the bar (scale + shadow), not just fade it, so
   the drag itself reads as an action happening rather than a static dim state. */
.ffb-tool.ffb-dragging {
  opacity: .85;
  transform: scale(1.12);
  box-shadow: 0 6px 16px rgba(0,0,0,.5);
  background: var(--bg-hover);
  z-index: 2;
}
/* Drop target: a clear insertion ring plus a slight nudge, distinct from hover. */
.ffb-tool.ffb-drop {
  box-shadow: inset 0 0 0 2px var(--accent);
  background: var(--bg-hover);
  transform: scale(1.05);
}
.ffb-hint { font-size: 11px; color: var(--text-muted); padding: 0 6px; white-space: nowrap; align-self: center; }

/* ─── Trade ticket (SELL | LOT | BUY) ────────────────────────────────── */
.trade-ticket {
  position: absolute; top: 34px; left: 8px; z-index: 16;
  display: flex; align-items: stretch; gap: 3px;
  font-family: 'Courier New', monospace; font-size: 11px;
}
.trade-ticket button {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 3px 9px; border-radius: 4px; line-height: 1.15; cursor: pointer;
  border: 1px solid transparent;
}
.trade-ticket .tt-px  { font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; min-width: 7ch; text-align: center; }
.trade-ticket .tt-lbl { font-size: 9px; font-weight: 700; letter-spacing: .5px; opacity: .85; }
.trade-ticket .tt-sell, .trade-ticket .tt-buy { min-width: 78px; box-sizing: border-box; }
.trade-ticket .tt-sell { background: rgba(239,83,80,.18); color: var(--red);   border-color: var(--red); }
.trade-ticket .tt-buy  { background: rgba(41,98,255,.18); color: var(--accent); border-color: var(--accent); }
.trade-ticket .tt-sell:hover { background: rgba(239,83,80,.32); }
.trade-ticket .tt-buy:hover  { background: rgba(41,98,255,.32); }
.trade-ticket .tt-lot {
  width: 46px; text-align: center;
  background: rgba(20,22,28,.92); border: 1px solid var(--border-strong); border-radius: 4px;
  color: var(--text-primary); font-family: inherit; font-size: 12px; font-weight: 600; padding: 0 4px;
}
.trade-ticket .tt-lot:focus { outline: none; border-color: var(--accent); }
/* hide number-input spinners */
.trade-ticket .tt-lot::-webkit-outer-spin-button,
.trade-ticket .tt-lot::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.trade-ticket .tt-lot { -moz-appearance: textfield; }

/* ─── Paper position widget (on the entry line) ──────────────────────── */
.pos-widget {
  position: absolute; right: 58px; transform: translateY(-50%);
  z-index: 16; display: flex; align-items: stretch; gap: 0; height: 20px;
  font-family: 'Courier New', monospace; font-size: 10px;
  border-radius: 4px; overflow: hidden;
  border: 1px solid #2c2c2c; background: rgba(14,16,20,.96);
  box-shadow: 0 1px 6px rgba(0,0,0,.4);
}
.pos-widget .pos-side {
  display: flex; align-items: center; padding: 0 6px; font-weight: 700; color: #fff;
}
.pos-widget.buy  .pos-side { background: rgba(38,166,154,.9); }
.pos-widget.sell .pos-side { background: rgba(239,83,80,.9); }
.pos-widget .pos-bt {
  border: none; border-left: 1px solid #2c2c2c; background: transparent;
  color: #787b86; padding: 0 7px; font-size: 9px; font-weight: 700; cursor: pointer;
}
.pos-widget .pos-bt.on { color: #26a69a; }
.pos-widget .pos-bt.sl.on { color: #ef5350; }
.pos-widget .pos-bt:hover { background: #1c1f26; color: #fff; }
.pos-widget .pos-pl { display: flex; align-items: center; padding: 0 8px; border-left: 1px solid #2c2c2c; font-variant-numeric: tabular-nums; }
.pos-widget .pos-pl.up   { color: var(--green); }
.pos-widget .pos-pl.down { color: var(--red); }
.pos-widget .pos-x {
  border: none; border-left: 1px solid #2c2c2c; background: transparent;
  color: #787b86; padding: 0 8px; cursor: pointer; font-size: 11px;
}
.pos-widget .pos-x:hover { background: rgba(239,83,80,.2); color: var(--red); }

/* Draggable TP/SL price tags on the price scale */
.pos-tag {
  position: absolute; right: 0; transform: translateY(-50%);
  z-index: 18; padding: 1px 6px; font-size: 10px; font-weight: 700;
  font-family: 'Courier New', monospace; color: #fff; border-radius: 3px;
  cursor: ns-resize; white-space: nowrap; touch-action: none;
}
.pos-tag.tp { background: #26a69a; }
.pos-tag.sl { background: #ef5350; }

/* Invisible full-width strip along an alert's line — lets it be grabbed
   anywhere to drag, like a drawing's line, not just at the price-scale tag.
   Sits below the cursor "+" (z-index 23) so hovering the "+" still wins. */
.alert-rail {
  position: absolute; left: 0; z-index: 17; height: 8px; cursor: ns-resize; touch-action: none;
  -webkit-user-select: none; user-select: none;
}

/* On-line alert label — appears while hovering the line (via .alert-rail),
   centered horizontally on the chart pane like TradingView's own alert
   label, rather than pinned to the price scale. */
.chart-alert-label {
  /* border/text color is set inline per-alert (a.color) — this is only the
     shared shape/layout; do not hardcode a color here. */
  position: absolute; z-index: 20; transform: translate(-50%, -50%);
  display: flex; align-items: stretch;
  background: #14161c; border: 1px solid; border-radius: 4px;
  overflow: hidden; cursor: ns-resize; touch-action: none;
  box-shadow: 0 4px 14px rgba(0,0,0,.5);
  -webkit-user-select: none; user-select: none;
}
.chart-alert-label-text {
  display: flex; align-items: center; padding: 5px 10px;
  font-size: 11px; font-weight: 700; font-family: 'Courier New', monospace;
  color: inherit; white-space: nowrap;
}
.chart-alert-label-x {
  border: none; border-left: 1px solid rgba(255,255,255,.15); background: transparent;
  color: #9aa0aa; padding: 0 8px; cursor: pointer; display: flex; align-items: center;
}
.chart-alert-label-x svg { width: 14px; height: 14px; }
.chart-alert-label-x:hover { background: rgba(239,83,80,.18); color: #ef5350; }
.chart-alert-label.paused { opacity: .65; }
.chart-alert-label.paused .chart-alert-label-text { display: flex; align-items: center; gap: 4px; }
.chart-alert-label.paused .chart-alert-label-text svg { width: 11px; height: 11px; }

/* Alert right-click menu — reuses .dw-ctxmenu's shell, adds icon+label rows
   and a checkbox row (only scoped here so the plain-text drawing menu keeps
   its original layout). */
.alert-ctxmenu { min-width: 190px; }
.alert-ctxmenu .dw-ctx-item { display: flex; align-items: center; gap: 9px; }
.alert-ctxmenu .dw-ctx-item svg { flex: 0 0 auto; width: 14px; height: 14px; color: var(--text-muted); }
.alert-ctxmenu .dw-ctx-del svg { color: var(--red); }
.alert-ctx-checkmark { width: 14px; flex: 0 0 auto; color: var(--accent); font-size: 12px; text-align: center; }

/* Delete-alert confirmation — reuses the .dw-dlg shell, red confirm button. */
.alert-confirm-text { padding: 4px 0 10px; font-size: 13px; color: var(--text-secondary); line-height: 1.5; }
.alert-confirm-delete {
  background: #ef5350; color: #fff; border: none; border-radius: 6px;
  padding: 7px 18px; font-size: 12px; font-weight: 600; cursor: pointer;
}
.alert-confirm-delete:hover { background: #d94842; }

/* Placeholder-insert row in the alert dialog's Message tab. */
.alert-ph-row { display: flex; flex-wrap: wrap; gap: 4px; padding: 6px 0 10px; }
.alert-ph-row .dw-seg-btn { border-radius: 4px; font-size: 10.5px; padding: 4px 7px; }

/* Alert "popup" toasts — fixed top-right stack, portaled nowhere (renders
   inside the chart pane, which already spans full width/height). */
.alert-toast-stack {
  position: absolute; top: 12px; right: 70px; z-index: 30;
  display: flex; flex-direction: column; gap: 6px; max-width: 280px;
}
.alert-toast {
  display: flex; align-items: center; gap: 8px; padding: 9px 12px;
  background: #1a1d24; border: 1px solid #ffb300; border-left-width: 3px;
  border-radius: 6px; color: #e0e3ea; font-size: 12px; cursor: pointer;
  box-shadow: 0 6px 20px rgba(0,0,0,.5);
}
.alert-toast svg { flex: 0 0 auto; color: #ffb300; }
.alert-toast-text { flex: 1; overflow-wrap: anywhere; }

/* Current price + candle countdown box on the price scale */
.price-tag {
  position: absolute; right: 0; transform: translateY(-50%);
  z-index: 22; min-width: 54px; text-align: center;                /* price is top priority — never covered */
  font-family: 'Courier New', monospace; border-radius: 3px; overflow: hidden;
  pointer-events: none;
}
.price-tag-px { font-size: 11px; font-weight: 700; color: #fff; padding: 1px 5px; }
.price-tag.up   .price-tag-px { background: var(--green); }
.price-tag.down .price-tag-px { background: var(--red); }
.price-tag-cd { font-size: 10px; font-weight: 700; color: #e0e3ea; background: rgba(14,16,20,.96); padding: 1px 5px; }

/* Cursor quick-action "+" — sits at the plot/price-scale boundary, at the
   crosshair's current row (TradingView-style). Tied to the live cursor via
   `left`/`top` set inline per-frame; only rendered while hovering the chart. */
.chart-cursor-plus {
  position: absolute; transform: translate(-50%, -50%);
  z-index: 23; width: 22px; height: 22px; padding: 0; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: rgba(20, 22, 28, .96); border: 1px solid rgba(255,255,255,.25);
  color: #e0e3ea; font-size: 15px; line-height: 1; font-weight: 400;
  cursor: pointer; box-shadow: 0 1px 4px rgba(0,0,0,.4);
}
.chart-cursor-plus:hover,
.chart-cursor-plus.open { background: var(--accent); border-color: var(--accent); color: #fff; }

/* Cursor quick-action menu — opens from the "+", frozen at the price it was
   opened at. Items are visual-only for now (see the "+" render block).
   Portaled to <body> (fixed, page-relative coords) so it renders above the
   right sidebar instead of being clipped by its own stacking context.
   left/top/visibility are set precisely by the smart-position layout effect
   (flips to stay within the chart pane), not by this CSS. */
.cursor-menu {
  position: fixed;
  z-index: 900; min-width: 260px;
  background: #14161c; border: 1px solid #2c2c2c; border-radius: 8px;
  padding: 4px; box-shadow: 0 10px 30px rgba(0,0,0,.6);
}
.cursor-menu-item {
  display: flex; align-items: center; gap: 9px; padding: 7px 9px;
  border-radius: 5px; cursor: pointer; color: #d1d4dc;
}
.cursor-menu-item:hover { background: #2a2d36; }
.cursor-menu-ico { flex: 0 0 auto; display: flex; color: var(--text-muted); }
.cursor-menu-label { flex: 1; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cursor-menu-sc { flex: 0 0 auto; font-size: 10.5px; color: var(--text-muted); }
.cursor-menu-sep { height: 1px; background: #2c2c2c; margin: 3px 4px; }

/* ─── Star button in flyout items ───────────────────────────────────── */
.tool-fav-btn {
  width: 22px; height: 22px; border: none; background: transparent;
  border-radius: 3px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; opacity: 0;
  transition: opacity .1s;
}
.sb-flyout-item:hover .tool-fav-btn { opacity: 1; }
.tool-fav-btn.active { opacity: 1; }
.tool-fav-btn:hover { background: var(--bg-hover); }
.sb-flyout::-webkit-scrollbar { display: none; }

/* Tools Bar toggle — golden when active */
.sb-tool-toolbar.active { color: #f0c040; }
.sb-tool-toolbar.active svg { color: #f0c040; }

/* ─── Layout Formation Picker ────────────────────────────────────────── */
.lfp-dropdown { width: 340px; max-height: 540px; overflow-y: auto; }
.lfp-body { padding: 6px 12px 8px; }
.lfp-row {
  display: flex; align-items: center; gap: 6px;
  margin-bottom: 5px; min-height: 28px;
}
.lfp-count {
  width: 14px; font-size: 11px; color: var(--text-muted);
  flex-shrink: 0; text-align: center;
}
.lfp-icons { display: flex; flex-wrap: wrap; gap: 3px; }
.lfp-btn {
  border: 1px solid var(--border); border-radius: 3px; padding: 3px;
  background: var(--bg-tertiary); color: var(--text-muted);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: border-color .1s, color .1s;
}
.lfp-btn:hover { border-color: var(--accent); color: var(--text-primary); }
.lfp-btn.active { border-color: var(--accent); color: var(--accent); background: var(--accent-bg); }

/* Sync in layout toggle rows */
.lfp-sync-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 7px 14px; cursor: pointer; font-size: 12px;
  color: var(--text-primary);
}
.lfp-sync-item:hover { background: var(--bg-hover); }

/* ─── TF "view more" button ──────────────────────────────────────────── */
.tf-more-btn {
  height: 26px; padding: 0 5px; border-radius: 3px; border: none;
  background: transparent; color: var(--text-muted);
  display: flex; align-items: center; gap: 2px;
  cursor: pointer; font-size: 11px;
}
.tf-more-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.tf-more-btn.active { color: var(--accent); background: var(--accent-bg); }

/* ─── Template button ────────────────────────────────────────────────── */
.template-btn {
  display: flex; align-items: center; gap: 4px;
  padding: 4px 7px; border-radius: 4px; border: none;
  background: transparent; color: var(--text-secondary); font-size: 12px;
  white-space: nowrap; cursor: pointer;
}
.template-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.template-btn.active { color: var(--accent); background: var(--accent-bg); }
.template-btn svg { width: 15px; height: 15px; }

/* ─── Workspace switcher ─────────────────────────────────────────────── */
.ws-switcher { position: relative; display: inline-flex; }
.ws-name-btn {
  display: flex; align-items: center; gap: 5px;
  padding: 4px 8px; border-radius: 4px; border: none;
  background: transparent; color: var(--text-primary); font-size: 12px;
  white-space: nowrap; cursor: pointer; max-width: 180px;
}
.ws-name-btn:hover { background: var(--bg-hover); }
.ws-name-btn.active { background: var(--accent-bg); color: var(--accent); }
.ws-name-btn > svg:first-child { width: 14px; height: 14px; color: var(--text-secondary); }
.ws-name-btn.active > svg:first-child { color: var(--accent); }
.ws-name-label {
  font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  max-width: 120px;
}
.ws-name-btn > svg:last-child { width: 8px; height: 5px; opacity: .7; flex-shrink: 0; }

/* dropdown positions relative to the switcher, not the viewport */
.ws-dropdown { position: absolute; top: 100%; left: 0; margin-top: 4px; }
.ws-item { padding: 7px 10px; gap: 7px; }
.ws-check {
  width: 14px; flex-shrink: 0; display: inline-flex;
  align-items: center; justify-content: center; color: var(--accent);
}
.ws-check svg { width: 13px; height: 13px; color: inherit; }
.ws-item.active .ws-item-name { color: var(--accent); }
.ws-item-name {
  flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ws-ib {
  width: 22px; height: 22px; border: none; border-radius: 4px;
  background: transparent; color: var(--text-muted);
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; flex-shrink: 0; opacity: 0; transition: opacity .1s, color .1s, background .1s;
}
.ws-item:hover .ws-ib { opacity: 1; }
.ws-ib:hover { background: var(--bg-hover); color: var(--text-primary); }
.ws-ib-danger:hover { color: var(--red); }
.ws-ib svg { width: 13px; height: 13px; }
.ws-new { color: var(--text-secondary); }
.ws-new:hover { color: var(--text-primary); }
.ws-new .ws-check { color: var(--text-secondary); }

/* ═══════════════════════════════════════════════════════════════════════════
   AUTH SCREENS + ADMIN PANEL
═══════════════════════════════════════════════════════════════════════════ */
.auth-screen {
  position: fixed; inset: 0; z-index: 500;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(1200px 600px at 50% -10%, #10131a, #000);
}
.auth-card {
  width: 360px; max-width: 92vw; padding: 26px 26px 22px;
  background: #0e1015; border: 1px solid #23262e; border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0,0,0,.6);
}
.auth-brand { display: flex; align-items: center; gap: 9px; font-size: 15px; font-weight: 700; color: #e0e3ea; margin-bottom: 20px; }
.auth-logo { width: 26px; height: 26px; border-radius: 7px; background: var(--accent); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 800; }
.auth-title { font-size: 17px; font-weight: 600; color: #e0e3ea; margin-bottom: 14px; }
.auth-form { display: flex; flex-direction: column; }
.auth-form label { font-size: 11px; color: #787b86; margin: 10px 0 5px; text-transform: uppercase; letter-spacing: .05em; }
.auth-form input {
  background: #060709; border: 1px solid #2a2e39; border-radius: 7px;
  padding: 10px 12px; color: #e0e3ea; font-size: 14px; font-family: inherit;
}
.auth-form input:focus { outline: none; border-color: var(--accent); }
.auth-code { letter-spacing: 8px; text-align: center; font-size: 20px !important; font-family: 'Courier New', monospace; }
.auth-btn {
  margin-top: 18px; background: var(--accent); color: #fff; border: none;
  border-radius: 8px; padding: 11px; font-size: 14px; font-weight: 600; cursor: pointer;
}
.auth-btn:hover:not(:disabled) { background: var(--accent-hover); }
.auth-btn:disabled { opacity: .5; cursor: not-allowed; }
.auth-link { margin-top: 12px; background: none; border: none; color: #787b86; font-size: 12px; cursor: pointer; }
.auth-link:hover { color: #e0e3ea; }
.auth-err { margin-top: 12px; color: #ef5350; font-size: 12px; background: rgba(239,83,80,.1); border: 1px solid rgba(239,83,80,.3); border-radius: 6px; padding: 8px 10px; }
.auth-note { color: #9aa0aa; font-size: 12px; margin-bottom: 8px; line-height: 1.5; }
.auth-hint { margin-top: 14px; text-align: center; color: #4c525e; font-size: 11px; }
.auth-msg { color: #787b86; font-size: 13px; text-align: center; padding: 20px 0; }

/* profile menu account block */
.profile-av { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.dd-account { padding: 10px 14px 8px; border-bottom: 1px solid var(--border); }
.dd-account-name { font-size: 13px; font-weight: 700; color: var(--text-primary); }
.dd-account-email { font-size: 11px; color: var(--text-secondary); }
.dd-account-role { font-size: 10px; color: var(--accent); margin-top: 2px; text-transform: uppercase; letter-spacing: .04em; }
.dd-danger:hover { color: var(--red); }

/* admin panel */
.admin-backdrop { position: fixed; inset: 0; z-index: 400; background: rgba(0,0,0,.55); display: flex; align-items: center; justify-content: center; }
.admin-modal { width: 920px; max-width: 95vw; max-height: 88vh; display: flex; flex-direction: column; background: #0e1015; border: 1px solid #23262e; border-radius: 12px; overflow: hidden; box-shadow: 0 20px 60px rgba(0,0,0,.6); }
.admin-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid #23262e; }
.admin-title { font-size: 15px; font-weight: 700; color: #e0e3ea; }
.admin-head-actions { display: flex; align-items: center; gap: 8px; }
.admin-x { background: none; border: none; color: #787b86; cursor: pointer; padding: 6px; border-radius: 6px; }
.admin-x:hover { background: #23262e; color: #fff; }
.admin-x svg { width: 15px; height: 15px; }
.admin-btn { background: #1a1e27; color: #d1d4dc; border: 1px solid #2c303a; border-radius: 7px; padding: 7px 13px; font-size: 12px; cursor: pointer; font-family: inherit; }
.admin-btn:hover { background: #23262e; }
.admin-btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.admin-btn.primary:hover { background: var(--accent-hover); }
.admin-flash { padding: 8px 16px; background: rgba(38,166,154,.12); color: #26a69a; font-size: 12px; border-bottom: 1px solid #23262e; }
.admin-table-wrap { overflow: auto; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.admin-table th { text-align: left; padding: 10px 12px; color: #787b86; font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; border-bottom: 1px solid #23262e; position: sticky; top: 0; background: #0e1015; }
.admin-table td { padding: 9px 12px; border-bottom: 1px solid #16181e; color: #d1d4dc; }
.admin-sub { font-size: 10px; color: #5d606b; }
.admin-avatar { width: 28px; height: 28px; border-radius: 50%; background: #23262e; color: #9aa0aa; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 12px; overflow: hidden; }
.admin-avatar img { width: 100%; height: 100%; object-fit: cover; }
.admin-role { padding: 2px 7px; border-radius: 4px; background: #1a1e27; font-size: 10px; font-weight: 700; }
.admin-role.adm { background: var(--accent-bg); color: var(--accent); }
.admin-status { font-size: 10px; font-weight: 700; }
.admin-status.active { color: #26a69a; }
.admin-status.disabled { color: #787b86; }
.admin-status.expired { color: #ff9800; }
.admin-row-actions { display: flex; gap: 4px; }
.admin-row-actions button { background: none; border: 1px solid #2c303a; color: #9aa0aa; width: 26px; height: 26px; border-radius: 5px; cursor: pointer; font-size: 12px; display: inline-flex; align-items: center; justify-content: center; }
.admin-row-actions button:hover { background: #23262e; color: #fff; }
.admin-row-actions button svg { width: 13px; height: 13px; }
.admin-form { padding: 16px; overflow: auto; }
.admin-form-title { font-size: 14px; font-weight: 600; color: #e0e3ea; margin-bottom: 14px; }
.admin-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.admin-grid label { display: flex; flex-direction: column; gap: 5px; font-size: 11px; color: #787b86; text-transform: uppercase; letter-spacing: .04em; }
.admin-grid .admin-wide { grid-column: span 2; }
.admin-grid input, .admin-grid select { background: #060709; border: 1px solid #2a2e39; border-radius: 6px; padding: 8px 10px; color: #e0e3ea; font-size: 13px; font-family: inherit; text-transform: none; }
.admin-grid input:focus, .admin-grid select:focus { outline: none; border-color: var(--accent); }
.admin-grid input[type=file] { padding: 6px; font-size: 11px; }
.admin-form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

/* ─── Replay Bar Selection Effect (TradingView-style) ────────────────────── */
.chart-container.replay-selecting {
  /* Container marked for replay selection mode */
}

/* Highlight effect on selected bar during replay */
.chart-selected-bar-indicator {
  position: absolute;
  top: 0;
  width: 2px;
  height: 100%;
  background: linear-gradient(to bottom, #2962ff, rgba(41, 98, 255, 0.3));
  pointer-events: none;
  z-index: 10;
  opacity: 0;
  transition: opacity 0.2s ease-in-out;
  box-shadow: 0 0 12px rgba(41, 98, 255, 0.6), inset 0 0 4px rgba(41, 98, 255, 0.3);
}

.chart-container.show-bar-selection .chart-selected-bar-indicator {
  opacity: 1;
  animation: barSelectPulse 0.3s ease-out;
}

@keyframes barSelectPulse {
  0% { opacity: 0; box-shadow: 0 0 4px rgba(41, 98, 255, 0.2); }
  50% { opacity: 1; box-shadow: 0 0 16px rgba(41, 98, 255, 0.8); }
  100% { opacity: 1; box-shadow: 0 0 12px rgba(41, 98, 255, 0.6); }
}

/* Crosshair/line effect on selected bar */
.chart-selection-line {
  position: absolute;
  width: 100%;
  height: 1px;
  background: rgba(41, 98, 255, 0.3);
  pointer-events: none;
  z-index: 9;
  opacity: 0;
  transition: opacity 0.2s ease-in-out;
}

.chart-container.show-bar-selection .chart-selection-line {
  opacity: 1;
}

/* Bar Play deliberately looks IDENTICAL to the live chart — no dimming
   overlay. (Previously a semi-transparent rgba(0,0,0,.4) sheet covered the
   whole pane during replay; users backtest here and asked for it to match
   live exactly.) The .replay-bar-selected / .show-bar-selection classes are
   still toggled by the chart component, so the rule is kept but made a
   no-op rather than removing the classes' only styling hook. */
.chart-container.replay-bar-selected::before,
.chart-container.replay-bar-selected.show-bar-selection::before {
  content: none;
}

/* Search pairs modal */
.search-overlay {
  position: fixed; inset: 0; z-index: 300; background: rgba(0,0,0,.55);
  display: flex; align-items: flex-start; justify-content: center; padding-top: 10vh;
}
.search-modal {
  width: 560px; max-width: 92vw; max-height: 72vh; display: flex; flex-direction: column;
  background: #14161c; border: 1px solid #2c2c2c; border-radius: 10px;
  box-shadow: 0 18px 50px rgba(0,0,0,.6); overflow: hidden;
}
.search-modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px; border-bottom: 1px solid #23262e; flex-shrink: 0;
}
.search-modal-title { font-size: 13px; font-weight: 600; color: #e0e3ea; }
.search-modal-x { border: none; background: transparent; color: #787b86; cursor: pointer; padding: 4px; border-radius: 4px; }
.search-modal-x:hover { background: #23262e; color: #fff; }
.search-modal-x svg { width: 14px; height: 14px; }
.search-input-wrap {
  display: flex; align-items: center; gap: 8px; padding: 10px 14px;
  border-bottom: 1px solid #23262e; flex-shrink: 0;
}
.search-input-wrap svg { width: 15px; height: 15px; color: var(--text-muted); flex-shrink: 0; }
.search-modal-input {
  flex: 1; background: transparent; border: none; outline: none;
  font-size: 14px; color: var(--text-primary);
}
.search-modal-input::placeholder { color: var(--text-muted); }
.search-clear-btn {
  border: none; background: var(--bg-hover); color: var(--text-muted); cursor: pointer;
  width: 18px; height: 18px; border-radius: 50%; font-size: 13px; line-height: 1;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.search-clear-btn:hover { color: var(--text-primary); }
.search-tabs {
  display: flex; gap: 4px; padding: 8px 14px; border-bottom: 1px solid #23262e;
  flex-shrink: 0; overflow-x: auto;
}
.search-tab {
  border: none; background: transparent; color: var(--text-secondary); cursor: pointer;
  font-size: 11.5px; padding: 5px 10px; border-radius: 5px; white-space: nowrap;
}
.search-tab:hover { background: var(--bg-hover); }
.search-tab.active { background: var(--accent-bg); color: var(--accent); font-weight: 600; }
.search-results { overflow-y: auto; padding: 6px; }
.search-state-msg { padding: 24px 14px; text-align: center; font-size: 12px; color: var(--text-muted); }
.search-row {
  display: flex; align-items: center; gap: 10px; padding: 8px 8px; border-radius: 6px; cursor: pointer;
}
.search-row:hover { background: var(--bg-hover); }
.search-row.kb-active { background: var(--bg-hover); box-shadow: inset 2px 0 0 var(--accent); }
.search-row.active { background: var(--accent-bg); }
.search-row-id { flex: 1; min-width: 0; }
.search-row-sym { font-size: 13px; font-weight: 600; color: var(--text-primary); font-family: 'Courier New', monospace; }
.search-row-badges { display: flex; gap: 5px; flex-shrink: 0; }
.search-type-badge {
  font-size: 9.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .02em;
  padding: 2px 6px; border-radius: 3px; background: var(--bg-tertiary); color: var(--text-secondary);
}
.search-badge-muted { color: var(--text-muted); }
.search-row-provider { width: 52px; flex-shrink: 0; text-align: right; font-size: 10px; color: var(--text-muted); }
.search-modal-foot {
  padding: 8px 14px; border-top: 1px solid #23262e; font-size: 10.5px; color: var(--text-muted); flex-shrink: 0;
}

@media (max-width: 900px) {
  :root {
    --top-h: 44px;
    --left-w: 42px;
    --right-icon-w: 42px;
    --right-panel-w: min(72vw, 300px);
    --bottom-h: 34px;
  }

  .top-menu {
    justify-content: flex-start;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .top-menu::-webkit-scrollbar { display: none; }
  .top-left,
  .top-right,
  .replay-bar {
    flex-shrink: 0;
  }

  .replay-bar {
    overflow-x: auto;
    gap: 4px;
  }
  .replay-pos { min-width: auto; }
  .search-overlay { padding: 6vh 10px 0; }
  .search-modal { width: 100%; max-width: 100%; }
}
