:root {
  --bg: #0c0f15;
  --panel: #131821;
  --panel-2: #181e29;
  --chart-bg: #0c0f15;
  --border: #232a37;
  --grid: #161c26;
  --text: #d8dde6;
  --text-dim: #8590a3;
  --hover: #1c2330;
  --accent: #3d7bfd;
  --up: #16b979;
  --down: #f0445a;
  --orange: #f5a524;
  --shadow: 0 10px 32px rgba(0, 0, 0, .5);
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #f4f6f9;
  --panel: #ffffff;
  --panel-2: #f7f8fa;
  --chart-bg: #ffffff;
  --border: #e1e5ec;
  --grid: #f0f2f6;
  --text: #1b2230;
  --text-dim: #687386;
  --hover: #eef1f6;
  --shadow: 0 10px 32px rgba(20, 30, 50, .16);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 13px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  display: flex; flex-direction: column; overflow: hidden;
}
button, select, input { font: inherit; color: inherit; }
kbd {
  font: 11px ui-monospace, monospace; padding: 0 4px; border: 1px solid var(--border);
  border-bottom-width: 2px; border-radius: 4px; background: var(--panel-2);
}
.ico { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.up { color: var(--up); }
.down { color: var(--down); }
.muted { color: var(--text-dim); font-size: 12px; margin: 6px 0; }
.count:not(:empty) {
  display: inline-block; min-width: 16px; padding: 0 4px; border-radius: 8px;
  background: var(--accent); color: #fff; font-size: 10px; line-height: 16px; text-align: center;
}

/* ---------- top bar ---------- */
.topbar {
  display: flex; align-items: center; gap: 4px;
  padding: 5px 8px; background: var(--panel); border-bottom: 1px solid var(--border);
  overflow-x: auto; scrollbar-width: none; flex: 0 0 auto;
}
.topbar::-webkit-scrollbar { display: none; }
.brand { font-weight: 700; white-space: nowrap; padding: 0 6px 0 2px; display: flex; align-items: center; gap: 6px; }
.logo { width: 24px; height: 24px; border-radius: 50%; display: block; flex: none; }
.spacer { flex: 1; }
.sep { width: 1px; height: 22px; background: var(--border); margin: 0 4px; flex: none; }

.btn, .seg button, select {
  background: transparent; border: 1px solid transparent; border-radius: 6px;
  padding: 5px 8px; cursor: pointer; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 5px;
}
.btn:hover, .seg button:hover, select:hover { background: var(--hover); }
.btn.icon { padding: 5px 7px; }
.btn.active { color: var(--orange); background: var(--hover); }
select { background: var(--panel); }
select option { background: var(--panel); color: var(--text); }
.symbol-btn { font-weight: 700; min-width: 120px; border-color: var(--border); }
.seg { display: flex; gap: 1px; }
.seg button.active { color: var(--accent); background: var(--hover); font-weight: 600; }
.seg button:disabled { opacity: .3; cursor: not-allowed; background: transparent; }
.more-iv { width: 76px; color: var(--text-dim); }

.status { white-space: nowrap; font-size: 12px; color: var(--text-dim); display: flex; align-items: center; gap: 6px; padding: 0 6px; }
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--text-dim); }
.status.live::before { background: var(--up); box-shadow: 0 0 6px var(--up); }
.status.demo::before, .status.replay::before { background: var(--orange); }
.status.fx::before { background: var(--accent); }
.status.delayed::before { background: #a78bfa; }

/* ---------- layout ---------- */
.layout { flex: 1; display: flex; min-height: 0; }

/* ---------- left drawing toolbar ---------- */
.tools {
  flex: 0 0 52px; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 6px 0; background: var(--panel); border-right: 1px solid var(--border);
  overflow-y: auto; overflow-x: hidden; scrollbar-width: none;
}
.tools::-webkit-scrollbar { display: none; }
.tools .tb { position: relative; width: 48px; display: flex; justify-content: center; flex: none; }
.tools .tb .main {
  width: 36px; height: 36px; display: grid; place-items: center;
  background: transparent; border: 0; border-radius: 7px; cursor: pointer; color: var(--text);
}
.tools .tb .main:hover, .tools .tb.open .main { background: var(--hover); }
.tools .tb.on .main { background: var(--text); color: var(--panel); }
.tools .tb .more {
  position: absolute; right: -1px; top: 9px; width: 11px; height: 18px; padding: 0;
  border: 0; border-radius: 3px; background: var(--hover); color: var(--text-dim);
  font-size: 11px; line-height: 18px; cursor: pointer; opacity: 0; transition: opacity .12s;
}
.tools .tb:hover .more, .tools .tb.open .more { opacity: 1; }
.tools .tb .more:hover { color: var(--text); background: var(--border); }
.tools svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
.tools .emo { font-size: 20px; line-height: 1; }
/* TradingView's own 28×28 icons keep their fills and strokes (set inline) */
.tools svg.tvi, .fly-item .fi svg.tvi { width: 28px; height: 28px; }
.fav-bar svg.tvi { width: 24px; height: 24px; }
.ot-ti svg.tvi { width: 22px; height: 22px; }
.tools .tb .more svg.tvi { width: 5px; height: 8px; }
.fly-item .fi { width: 28px; }
.tsep { width: 30px; height: 1px; background: var(--border); margin: 6px 0; flex: none; }

/* flyout menus next to the toolbar */
.flyout {
  position: fixed; z-index: 70; min-width: 250px; max-width: 360px; max-height: calc(100vh - 12px); overflow-y: auto;
  padding: 6px; background: var(--panel); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow);
  scrollbar-width: thin;
}
.flyout[hidden] { display: none; }
.flyout hr { border: 0; border-top: 1px solid var(--border); margin: 5px 4px; }
.fly-sec { font-size: 11px; color: var(--text-dim); text-transform: uppercase; letter-spacing: .6px; padding: 8px 10px 4px; }
.fly-item {
  display: flex; align-items: center; gap: 10px; padding: 0 8px; height: 38px; border-radius: 7px; cursor: pointer; white-space: nowrap;
}
.fly-item:hover { background: var(--hover); }
.fly-item.cur { background: var(--text); color: var(--panel); }
.fly-item.cur .help, .fly-item.cur kbd { color: var(--panel); }
.fly-item.disabled { opacity: .45; cursor: not-allowed; }
.fly-item .fi { width: 26px; display: grid; place-items: center; flex: none; }
.fly-item .fi svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
.fly-item .fn { flex: 1; font-size: 13.5px; }
.fly-item kbd { border: 0; background: transparent; color: var(--text-dim); font: 12px system-ui, sans-serif; padding: 0; }
.fly-item .help { display: grid; place-items: center; color: var(--text-dim); opacity: .7; }
.fly-item .help svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; }
.fly-item .star { border: 0; background: transparent; padding: 2px; cursor: pointer; color: var(--text-dim); display: grid; place-items: center; }
.fly-item .star svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linejoin: round; }
.fly-item .star.on { color: #facc15; }
.fly-item .star.on svg { fill: #facc15; }
.fly-item.cur .star:not(.on) { color: var(--panel); }
.fly-toggle { display: flex; align-items: center; gap: 12px; padding: 8px 10px; cursor: pointer; font-size: 13px; }
.fly-toggle span { flex: 1; }
.fly-toggle input { display: none; }
.fly-toggle > i { width: 34px; height: 18px; border-radius: 9px; background: var(--border); position: relative; flex: none; transition: background .15s; }
.fly-toggle > i::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: left .15s; }
.fly-toggle input:checked + i { background: var(--accent); }
.fly-toggle input:checked + i::after { left: 18px; }
.flyout.fly-emoji { width: 360px; }
.emo-tabs { display: flex; gap: 2px; padding: 2px 2px 6px; border-bottom: 1px solid var(--border); }
.emo-tabs button, .emo-kinds button { border: 0; background: transparent; cursor: pointer; border-radius: 6px; }
.emo-tabs button { font-size: 18px; padding: 4px 6px; opacity: .6; }
.emo-tabs button.on { opacity: 1; box-shadow: inset 0 -2px 0 var(--accent); }
.emo-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; max-height: 330px; overflow-y: auto; padding: 2px; }
.emo-grid button { border: 0; background: transparent; cursor: pointer; border-radius: 6px; font-size: 22px; height: 38px; color: var(--text); }
.emo-grid.sticker { grid-template-columns: repeat(5, 1fr); }
.emo-grid.sticker button { font-size: 34px; height: 54px; }
.emo-grid.icon button { font-size: 20px; }
.emo-grid button:hover { background: var(--hover); }
.emo-kinds { display: flex; justify-content: center; gap: 6px; padding-top: 6px; border-top: 1px solid var(--border); margin-top: 4px; }
.emo-kinds button { padding: 6px 12px; color: var(--text-dim); font-size: 13px; }
.emo-kinds button.on { color: var(--text); box-shadow: inset 0 -2px 0 var(--accent); }

/* floating favorites bar */
.fav-bar {
  position: fixed; z-index: 40; left: 50%; top: 52px; transform: translateX(-50%);
  display: flex; align-items: center; gap: 1px; padding: 3px; background: var(--panel);
  border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow);
}
.fav-bar[hidden] { display: none; }
.fav-bar .grip { cursor: grab; color: var(--text-dim); padding: 0 4px; font-size: 11px; letter-spacing: -2px; user-select: none; }
.fav-bar button { width: 30px; height: 30px; display: grid; place-items: center; border: 0; border-radius: 6px; background: transparent; cursor: pointer; color: var(--text); }
.fav-bar button:hover { background: var(--hover); }
.fav-bar button.on { background: var(--text); color: var(--panel); }
.fav-bar svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }

/* long-press values tooltip */
.val-tip {
  position: fixed; z-index: 90; display: grid; grid-template-columns: auto auto; gap: 2px 14px; padding: 8px 10px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow); font-size: 12px; pointer-events: none;
}
.val-tip[hidden] { display: none; }
.val-tip b { grid-column: 1 / -1; margin-bottom: 3px; }
.val-tip span:nth-child(odd) { color: var(--text-dim); }
.val-tip span:nth-child(even) { text-align: right; font-variant-numeric: tabular-nums; }

/* chart cursors */
.pane.main[data-cursor="dot"] canvas, .pane.main[data-cursor="demo"] canvas { cursor: none !important; }
.pane.main[data-cursor="arrow"] canvas { cursor: default !important; }
.pane.main[data-cursor="eraser"] canvas { cursor: cell !important; }
.pane.main[data-cursor="draw"] canvas { cursor: crosshair !important; }
.pane.main[data-hover="move"] canvas { cursor: move !important; }
.pane.main[data-hover="pointer"] canvas { cursor: pointer !important; }
.pane.osc[data-hover="pointer"] canvas { cursor: pointer !important; }

/* ---------- center column: charts + bottom bar ---------- */
.center { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.bottombar {
  flex: 0 0 34px; display: flex; align-items: center; gap: 2px; padding: 0 6px;
  background: var(--panel); border-top: 1px solid var(--border); overflow-x: auto; scrollbar-width: none;
}
.bottombar::-webkit-scrollbar { display: none; }
.bottombar .grow { flex: 1; }
.ranges { display: flex; gap: 1px; }
.ranges button, .bb-btn {
  background: transparent; border: 0; border-radius: 5px; padding: 4px 8px; cursor: pointer;
  color: var(--text); font-size: 12.5px; white-space: nowrap;
}
.ranges button:hover, .bb-btn:hover { background: var(--hover); }
.ranges button.on { color: var(--accent); background: var(--hover); }
.bb-btn.clock { font-variant-numeric: tabular-nums; }
.bb-btn.tag { border: 1px solid var(--border); font-size: 11.5px; font-weight: 600; color: var(--text-dim); padding: 3px 7px; margin-left: 4px; }
.bb-btn.tag.on { background: var(--text); color: var(--panel); border-color: var(--text); }
.tz-menu { min-width: 230px; max-height: min(70vh, 640px); overflow-y: auto; padding: 4px; }
.tz-menu button {
  display: flex; align-items: center; gap: 6px; width: 100%; padding: 7px 10px; text-align: left;
  background: transparent; border: 0; border-radius: 5px; cursor: pointer; font-size: 13px; white-space: nowrap;
}
.tz-menu button:hover { background: var(--hover); }
.tz-menu button.on { background: var(--text); color: var(--panel); }
/* ---------- TradingView-style top bar ---------- */
.topbar { gap: 2px; padding: 4px 8px; }
.topbar .sep { height: 24px; margin: 0 5px; }
.topbar .btn { font-size: 14px; padding: 6px 9px; border-radius: 6px; }
.topbar .btn .ico { width: 20px; height: 20px; }
.topbar .btn:disabled { opacity: .35; cursor: default; background: transparent; }
.symbol-pill {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 16px; margin-left: 4px;
  border: 0; border-radius: 17px; background: var(--hover); color: var(--text); font-weight: 700; font-size: 14.5px; cursor: pointer; white-space: nowrap;
}
.symbol-pill:hover { background: var(--border); }
.btn.round { border-radius: 50%; padding: 6px; }
.btn.chev { padding: 6px 2px; }
.btn.chev .ico { width: 16px; height: 16px; }
.seg button { font-size: 14px; padding: 6px 8px; }
.seg button.active { color: var(--text); background: var(--hover); font-weight: 600; }
.ct-btn .ico.ct, .ct-menu .ico.ct { width: 22px; height: 22px; stroke-width: 1.5; }
.ct-menu { min-width: 210px; padding: 4px; }
.ct-menu button { display: flex; align-items: center; gap: 12px; width: 100%; padding: 8px 10px; border: 0; background: transparent; border-radius: 6px; cursor: pointer; font-size: 14px; text-align: left; }
.ct-menu button:hover { background: var(--hover); }
.ct-menu button.on { background: var(--text); color: var(--panel); }
.tpl-menu { min-width: 250px; padding: 4px; }
.tpl-menu .tpl-save { width: 100%; text-align: left; padding: 9px 10px; border: 0; background: transparent; border-radius: 6px; cursor: pointer; font-size: 14px; }
.tpl-menu .tpl-save:hover { background: var(--hover); }
.tpl-row { display: flex; align-items: center; gap: 8px; padding: 7px 6px 7px 10px; border-radius: 6px; cursor: pointer; }
.tpl-row:hover { background: var(--hover); }
.tpl-row span { flex: 1; }
.tpl-row small { color: var(--text-dim); }
.tpl-row button { border: 0; background: transparent; color: var(--text-dim); cursor: pointer; display: grid; place-items: center; padding: 2px; border-radius: 4px; }
.tpl-row button svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 2; }
.tpl-row button:hover { color: var(--down); }

/* chart title line */
.legend .row { align-items: center; }
.sym-badge {
  width: 20px; height: 20px; border-radius: 50%; display: inline-grid; place-items: center; flex: none;
  color: #fff; font-size: 8.5px; font-weight: 800; letter-spacing: -.3px; text-shadow: none; overflow: hidden;
}
/* TradingView's logos: one round logo, or a pair: the quote currency's flag top-right (2/3 of the size), cut round the
   base currency's flag at the bottom-left, which is drawn over it (TradingView: 18 px pair, 12 px flags) */
.sym-badge.sym-logo, .sym-badge.sym-pair { background: none; }
.sym-badge.sym-logo img { width: 100%; height: 100%; border-radius: 50%; display: block; }
.sym-badge.sym-pair { position: relative; border-radius: 0; overflow: visible; display: inline-block; vertical-align: middle; }
.sym-pair > span { position: absolute; width: 66.667%; height: 66.667%; border-radius: 50%; overflow: hidden; }
.sym-pair > span img { width: 100%; height: 100%; display: block; }
.sym-pair > .b { left: 0; bottom: 0; }
/* TradingView cuts the quote flag along a circle of radius 8 (of 12) round the base flag's centre; in percentages so it
   scales with the icon */
.sym-pair > .q { right: 0; top: 0; clip-path: polygon(0 0, 100% 0, 100% 100%, 66.7% 100%, 65.7% 88.5%, 61.6% 74.5%, 55.4% 62.6%, 47.1% 52.9%,
  37% 44.6%, 25.5% 38.4%, 13% 34.6%, 0 33.3%); }
.sym-badge.sym-logo, .sym-badge.sym-pair { width: 18px; height: 18px; }
.legend .title { font-size: 14px; font-weight: 500; margin-right: 2px; }
.mkt { width: 9px; height: 9px; border-radius: 50%; flex: none; margin: 0 4px 0 2px; }
.mkt.open { background: var(--up); box-shadow: 0 0 0 3px color-mix(in srgb, var(--up) 25%, transparent); }
.mkt.closed { background: var(--text-dim); }
.mkt.na { background: var(--accent); opacity: .6; }
.dly { font-size: 9px; font-weight: 800; color: #1b1300; background: var(--orange); border-radius: 3px; padding: 0 3px; line-height: 13px; margin-right: 6px; }
.cmp-sw { width: 10px; height: 10px; border-radius: 2px; flex: none; }

/* interval menu */
.iv-menu { width: 230px; overflow-y: auto; padding: 4px; scrollbar-width: thin; }
.iv-add { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: 0; background: transparent; cursor: pointer; border-radius: 6px; font-size: 13.5px; text-align: left; }
.iv-add .plus { font-size: 16px; line-height: 1; }
.iv-add:hover { background: var(--hover); }
.iv-sec {
  display: flex; align-items: center; justify-content: space-between; margin-top: 4px; padding: 9px 10px 5px;
  border-top: 1px solid var(--border); font-size: 11px; color: var(--text-dim); text-transform: uppercase; letter-spacing: .6px; cursor: pointer; user-select: none;
}
.iv-sec .chev { font-size: 12px; transition: transform .15s; }
.iv-sec .chev.col { transform: rotate(180deg); }
.iv-item { display: flex; align-items: center; gap: 6px; padding: 0 6px 0 10px; height: 32px; border-radius: 6px; cursor: pointer; font-size: 13.5px; }
.iv-item .iv-name { flex: 1; }
.iv-item:hover { background: var(--hover); }
.iv-item.cur { background: var(--text); color: var(--panel); }
.iv-item.disabled { opacity: .4; cursor: not-allowed; }
.iv-item button { border: 0; background: transparent; padding: 3px; display: grid; place-items: center; cursor: pointer; color: var(--text-dim); border-radius: 4px; }
.iv-item button svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linejoin: round; stroke-linecap: round; }
.iv-item .iv-del { opacity: 0; }
.iv-item:hover .iv-del { opacity: 1; }
.iv-item .iv-star.on { color: #facc15; }
.iv-item .iv-star.on svg { fill: #facc15; }
.iv-item.cur button { color: var(--panel); }
.iv-item.cur .iv-star.on { color: var(--panel); }
.iv-item.cur .iv-star.on svg { fill: var(--panel); }
.iv-prompt-box {
  position: fixed; z-index: 85; width: 230px; padding: 14px 16px 12px; text-align: center;
  background: var(--panel); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow);
}
.iv-prompt-box[hidden] { display: none; }
.ivp-title { font-size: 17px; font-weight: 600; margin-bottom: 10px; display: flex; justify-content: center; align-items: center; gap: 6px; }
.ivp-info { font-size: 14px; color: var(--text-dim); cursor: help; font-weight: 400; }
.iv-prompt-box input {
  width: 100%; padding: 9px 10px; font-size: 16px; text-align: center; color: var(--text);
  background: transparent; border: 2px solid var(--accent); border-radius: 8px; outline: none;
}
.iv-prompt-box.bad input { border-color: var(--down); }
.ivp-hint { margin-top: 6px; font-size: 12px; color: var(--text-dim); min-height: 15px; }
.iv-prompt-box.bad .ivp-hint { color: var(--down); }
.iv-prompt input { width: 100%; padding: 10px 12px; font-size: 18px; border: 1px solid var(--accent); border-radius: 6px; background: var(--bg); outline: none; }
.sess-menu { min-width: 250px; padding: 4px; }
.sess-menu .grp { padding: 6px 10px 4px; }
.sess-menu button {
  display: block; width: 100%; padding: 8px 10px; text-align: left; background: transparent; border: 0;
  border-radius: 5px; cursor: pointer; font-size: 13.5px;
}
.sess-menu button small { display: block; font-size: 11px; color: var(--text-dim); margin-top: 1px; }
.sess-menu button:hover { background: var(--hover); }
.sess-menu button.on { background: var(--text); color: var(--panel); }
.sess-menu button.on small { color: var(--panel); opacity: .75; }

/* ---------- chart grid ---------- */
.grid {
  flex: 1; min-width: 0; min-height: 0; display: grid; gap: 1px;
  grid-template-columns: repeat(var(--cols, 1), minmax(0, 1fr));
  grid-template-rows: repeat(var(--rows, 1), minmax(0, 1fr));
  background: var(--border);
}
.view { position: relative; min-width: 0; min-height: 0; display: flex; flex-direction: column; background: var(--chart-bg); }
.grid.multi .view.active::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 6;
  box-shadow: inset 0 0 0 2px var(--accent);
}
.grid.multi .view.replaying.active::after { box-shadow: inset 0 0 0 2px var(--orange); }
.pane { position: relative; min-height: 0; }
.pane.main { flex: 1; }
.pane.osc { flex: 0 0 140px; border-top: 1px solid var(--border); }
.grid.multi .pane.osc { flex-basis: 22%; min-height: 48px; }
.pane.drawing, .pane.picking { cursor: crosshair; }
.pane-sep { position: absolute; left: 0; right: 0; top: -4px; height: 8px; z-index: 9; cursor: row-resize; touch-action: none; }
.pane-sep::after { content: ""; position: absolute; left: 0; right: 0; top: 2px; height: 3px; background: transparent; transition: background .1s; }
.pane-sep:hover::after, .pane-sep.drag::after { background: var(--accent); }
.overlay { position: absolute; inset: 0; pointer-events: none; z-index: 3; }

/* legend & pane labels */
.legend, .pane-label {
  position: absolute; top: 5px; left: 8px; right: 90px; z-index: 4;
  pointer-events: none; font-size: 12px; text-shadow: 0 0 4px var(--chart-bg);
}
.legend .title { font-size: 14px; font-weight: 600; margin-right: 6px; }
.legend .title .src { font-size: 11px; font-weight: 500; color: var(--text-dim); }
.legend .row { display: flex; flex-wrap: wrap; gap: 0 9px; align-items: baseline; }
.legend .k { color: var(--text-dim); margin-right: 3px; }
.legend .ind, .pane-label { display: flex; align-items: center; gap: 6px; width: fit-content; pointer-events: auto; border-radius: 4px; padding: 0 2px; }
.legend .ind { margin-top: 1px; }
.legend .ind:hover, .pane-label:hover { background: color-mix(in srgb, var(--panel) 80%, transparent); }
.legend .ind.dim .k, .pane.osc.dim .pane-label .name { opacity: .5; }
.acts { display: inline-flex; gap: 1px; opacity: 0; }
.legend .ind:hover .acts, .pane-label:hover .acts { opacity: 1; }
.acts button {
  width: 20px; height: 18px; display: grid; place-items: center; padding: 0;
  border: 0; background: transparent; color: var(--text-dim); border-radius: 4px; cursor: pointer;
}
.acts button:hover { background: var(--hover); color: var(--text); }
/* indicator rows, like TradingView's legend: on hover (or while selected) the title and a box of 28 px buttons right after
   it get a background and a 1 px border (grey on hover, blue when selected); the buttons sit over the values */
.legend .ind:has(.acts-box), .pane-label .ind:has(.acts-box) { flex-wrap: nowrap; white-space: nowrap; gap: 0; padding: 0; border-radius: 4px; outline: 0 !important; background: none !important; min-height: 24px; position: relative; }
.ind:has(.acts-box) > .name { white-space: nowrap; border: 1px solid transparent; border-right: 0; border-radius: 4px 0 0 4px; padding: 0 4px 0 1px; margin-right: 0; line-height: 22px; }
.ind:has(.acts-box) > .ind-vals { display: inline-flex; gap: 6px; padding-left: 4px; }
.ind:has(.acts-box) > .ind-vals span { white-space: nowrap; }
.ind .acts:has(.acts-box) { position: relative; width: 0; height: 24px; opacity: 1; display: block; }
.ind .acts-box { position: absolute; left: 0; top: 0; z-index: 3; display: none; height: 24px; box-sizing: border-box; border: 1px solid var(--border); border-left: 0;
  border-radius: 0 4px 4px 0; background: var(--panel); }
.ind:hover .acts-box, .ind.sel .acts-box { display: flex; }
.ind:hover > .name, .ind.sel > .name { background: var(--panel); border-color: var(--border); }
.ind.sel > .name, .ind.sel .acts-box { border-color: #2962ff; }
.ind .acts-box button { width: 28px; height: 22px; border-radius: 0; color: var(--text); background: transparent; }
.ind .acts-box button + button { border-left: 1px solid var(--border); }
.ind.sel .acts-box button + button { border-left-color: #2962ff; }
.ind .acts-box button:last-child { border-radius: 0 3px 3px 0; }
.ind .acts-box button:hover { background: var(--hover); color: var(--text); }
.ind .acts-box button.tv-ivl { color: #fb8c00; }
.acts .acts-box svg { width: 18px; height: 18px; fill: currentColor; stroke: none; }
/* TradingView's 28 px menu icons (the indicator's More menu): a 28 px icon column */
.ctx-menu:has(.ic svg[viewBox$="28 28"]) .ic { width: 28px; }
.ctx-menu .ic svg[viewBox$="28 28"] { width: 28px; height: 28px; margin: -6px 0; fill: currentColor; stroke: none; }
.acts svg, .draw-bar svg, .ctx-menu svg, .a-acts svg, #watchList .rm svg, .dialog-head svg {
  width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}
.tag.replay { font-size: 10px; font-weight: 700; letter-spacing: .5px; color: #1b1300; background: var(--orange); border-radius: 3px; padding: 0 5px; margin-right: 4px; }
.grid.multi .legend { font-size: 11px; }
.grid.multi .legend .title { font-size: 12px; }

/* bottom-right price-scale buttons */
.scale-btns { position: absolute; right: 2px; bottom: 3px; z-index: 5; display: flex; gap: 1px; }
.scale-btns button {
  font-size: 10px; padding: 1px 4px; line-height: 16px; border: 0; border-radius: 3px;
  background: transparent; color: var(--text-dim); cursor: pointer;
}
.scale-btns button:hover { background: var(--hover); color: var(--text); }
.scale-btns button.active { color: var(--accent); font-weight: 700; }

/* selected-drawing toolbar */
.draw-bar {
  position: absolute; top: 44px; left: 50%; transform: translateX(-50%); z-index: 7;
  display: flex; align-items: center; gap: 3px; padding: 4px 6px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow);
}
.draw-bar[hidden] { display: none; }
.draw-bar button {
  min-width: 22px; height: 22px; padding: 0 4px; display: grid; place-items: center;
  border: 0; border-radius: 5px; background: transparent; cursor: pointer; font-weight: 600; font-size: 12px;
}
.draw-bar button:hover { background: var(--hover); }
.draw-bar .sw { width: 16px; min-width: 16px; height: 16px; border-radius: 50%; border: 2px solid transparent; }
.draw-bar .sw.on { outline: 2px solid var(--text); outline-offset: 1px; }
.draw-bar i { width: 1px; height: 18px; background: var(--border); margin: 0 3px; }
.draw-bar .db-name { font-size: 12px; color: var(--text-dim); padding: 0 4px; white-space: nowrap; }
.draw-bar button.on { color: var(--orange); }
.text-edit {
  position: absolute; z-index: 8; min-width: 160px; padding: 3px 6px; font-weight: 600;
  background: var(--panel); border: 1px solid var(--accent); border-radius: 4px; outline: none;
}

/* replay controls: TradingView's bar under the chart (start point, play, forward, speed, update interval, jump to real time, exit) */
.replay-bar {
  position: relative; flex: none; height: 38px; z-index: 7;
  display: flex; align-items: center; justify-content: center; padding: 0 44px;
  background: var(--chart-bg); border-top: 1px solid var(--border); white-space: nowrap; overflow: hidden;
}
.replay-bar[hidden] { display: none; }
.replay-bar .rb-mid { display: flex; align-items: center; gap: 4px; }
.replay-bar button { height: 30px; min-width: 30px; padding: 0 6px; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: transparent; border: 0; border-radius: 6px; cursor: pointer; color: var(--text); font: inherit; font-size: 13px; }
.replay-bar button:hover:not(:disabled) { background: var(--hover); }
.replay-bar button:disabled { opacity: .35; cursor: default; }
.replay-bar svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.replay-bar .rb-select-wrap { display: inline-flex; }
.replay-bar .rb-select { padding: 0 8px; }
.replay-bar .rb-select.on { background: var(--hover); }
.replay-bar .rb-chev { min-width: 22px; padding: 0 2px; }
.replay-bar .rb-chev svg { width: 14px; height: 14px; }
.replay-bar .rb-txt { font-size: 13px; min-width: 34px; }
.replay-bar .rb-sep { width: 1px; height: 20px; background: var(--border); margin: 0 6px; }
.replay-bar .rb-exit { position: absolute; right: 8px; top: 4px; }
.grid.multi .replay-bar .rb-sel-txt { display: none; }
.pane.main[data-hover="ns"] canvas { cursor: ns-resize !important; }
.pane.picking canvas { cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='1.6' stroke-linecap='round'%3E%3Ccircle cx='6' cy='6' r='3'/%3E%3Ccircle cx='6' cy='18' r='3'/%3E%3Cpath d='M8.1 8.1L20 20M8.1 15.9L20 4'/%3E%3C/svg%3E") 12 12, crosshair !important; }
.rp-date-row { display: flex; gap: 8px; margin-bottom: 10px; }
.rp-date-row input { flex: 1; }
.rp-date .rp-first { width: 100%; justify-content: center; margin-bottom: 4px; }
.rp-exit p { margin: 0 0 12px; color: var(--text-dim); line-height: 1.45; }
.rt-conf { display: flex; gap: 10px; align-items: center; margin-bottom: 8px; }
.rt-conf .dim, .rt-panel .dim { color: var(--text-dim); font-size: 12px; }

/* replay trading: SELL / BUY under the legend */
.legend .rt-btns { gap: 0; margin-top: 4px; align-items: stretch; pointer-events: auto; width: fit-content; }
.rt-btn { display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 64px; padding: 2px 8px; border: 0; color: #fff; cursor: pointer; font: inherit; line-height: 1.15; }
.rt-btn b { font-size: 12px; font-weight: 600; }
.rt-btn small { font-size: 9px; letter-spacing: .4px; }
.rt-btn.sell { background: #f23645; border-radius: 4px 0 0 4px; }
.rt-btn.buy { background: #2962ff; border-radius: 0 4px 4px 0; }
.rt-btn:hover { filter: brightness(1.12); }
.legend .rt-spread { align-self: center; padding: 0 6px; font-size: 11px; color: var(--text-dim); background: var(--chart-bg); }

/* replay trading: order ticket */
.rt-ticket { position: fixed; z-index: 60; width: 280px; padding: 0 12px 12px; background: var(--panel); border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow); font-size: 13px; }
.rt-tk-head { display: flex; align-items: center; gap: 8px; height: 40px; cursor: move; }
.rt-tk-head button { width: 26px; height: 26px; display: grid; place-items: center; border: 0; background: transparent; color: var(--text-dim); border-radius: 5px; cursor: pointer; }
.rt-tk-head button:hover { background: var(--hover); color: var(--text); }
.rt-tk-head svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.rt-ico { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 5px; background: var(--text); color: var(--panel); font-size: 11px; }
.rt-tk-side { position: relative; display: flex; border-radius: 6px; overflow: hidden; margin-bottom: 10px; }
.rt-tk-side button { flex: 1; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 6px 10px; border: 0; cursor: pointer; background: var(--hover); color: var(--text); font: inherit; }
.rt-tk-side button[data-side="buy"] { align-items: flex-end; }
.rt-tk-side button small { font-size: 12px; }
.rt-tk-side button b { font-size: 14px; font-weight: 600; }
.rt-tk-side button.on[data-side="sell"] { background: rgba(242,54,69,.25); color: #f7525f; }
.rt-tk-side button.on[data-side="buy"] { background: rgba(41,98,255,.3); color: #6b93ff; }
.rt-tk-side .rt-spread { position: absolute; left: 50%; top: 6px; transform: translateX(-50%); padding: 0 5px; font-size: 11px; border-radius: 4px; background: var(--panel); color: var(--text-dim); }
.rt-tk-types { display: flex; border-bottom: 1px solid var(--border); margin-bottom: 10px; }
.rt-tk-types button { flex: 1; padding: 6px 0; border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--text-dim); cursor: pointer; font: inherit; font-size: 12px; }
.rt-tk-types button.on { color: var(--text); border-bottom-color: var(--text); }
.rt-tk-l { display: block; color: var(--text-dim); font-size: 12px; margin: 6px 0 4px; }
.rt-tk-in { width: 100%; box-sizing: border-box; }
.rt-tk-tv { display: flex; justify-content: space-between; margin: 8px 0; padding: 8px 10px; border-radius: 6px; background: var(--hover); color: var(--text-dim); }
.rt-tk-tv b { color: var(--text); font-weight: 600; }
.rt-tk-sec { font-weight: 600; margin: 10px 0 4px; }
.rt-tk-x { display: flex; justify-content: space-between; align-items: center; margin: 6px 0 4px; color: var(--text-dim); font-size: 12px; }
.rt-tk-pair { display: flex; gap: 6px; align-items: center; }
.rt-tk-pair input { flex: 1; min-width: 0; }
.rt-tk-pair span { color: var(--text-dim); font-size: 12px; }
.rt-tk-pair.off { opacity: .45; }
.rt-sw { position: relative; display: inline-block; width: 30px; height: 16px; }
.rt-sw input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.rt-sw i { position: absolute; inset: 0; border-radius: 9px; background: var(--border); pointer-events: none; transition: background .15s; }
.rt-sw i::after { content: ''; position: absolute; left: 2px; top: 2px; width: 12px; height: 12px; border-radius: 50%; background: #fff; transition: transform .15s; }
.rt-sw input:checked + i { background: #2962ff; }
.rt-sw input:checked + i::after { transform: translateX(14px); }
.rt-tk-go { width: 100%; margin-top: 12px; padding: 8px; border: 0; border-radius: 8px; color: #fff; cursor: pointer; font: inherit; font-weight: 600; display: flex; flex-direction: column; align-items: center; }
.rt-tk-go small { font-weight: 400; font-size: 11px; }
.rt-tk-go.buy { background: #2962ff; }
.rt-tk-go.sell { background: #f23645; }

/* replay trading: the panel under the chart */
.rt-panel { flex: none; height: 250px; display: flex; flex-direction: column; border-top: 1px solid var(--border); background: var(--panel); min-height: 0; font-size: 12px; }
.rt-panel.collapsed { height: auto; }
.rt-panel[hidden] { display: none; }
.rt-head { display: flex; align-items: center; height: 32px; padding: 0 8px; border-bottom: 1px solid var(--border); }
.rt-title { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 8px; border: 0; border-radius: 5px; background: var(--hover); color: var(--text); cursor: pointer; font: inherit; }
.rt-title .ico { width: 14px; height: 14px; }
.rt-title .rt-ico { width: 16px; height: 16px; font-size: 9px; }
.rt-acct { display: flex; gap: 18px; align-items: center; margin: 6px 8px; padding: 6px 10px; border-radius: 6px; background: var(--chart-bg); color: var(--text-dim); white-space: nowrap; overflow: hidden; }
.rt-acct b { color: var(--text); font-weight: 600; margin-left: 4px; }
.rt-acct .rt-name { padding: 3px 10px; border-radius: 12px; border: 1px solid var(--border); color: var(--text); }
.rt-panel .pos { color: #089981 !important; }
.rt-panel .neg { color: #f23645 !important; }
.rt-empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; }
.rt-empty b { font-size: 14px; }
.rt-empty > span { color: var(--text-dim); }
.rt-empty div { display: flex; gap: 8px; align-items: center; margin-top: 6px; color: var(--text-dim); }
.rt-pill { border: 0; border-radius: 14px; padding: 5px 14px; color: #fff; cursor: pointer; font: inherit; }
.rt-pill.sell { background: #f23645; }
.rt-pill.buy { background: #2962ff; }
.rt-tabs, .rt-sub { display: flex; gap: 6px; padding: 2px 8px 6px; }
.rt-tabs button, .rt-sub button { border: 0; border-radius: 14px; padding: 4px 12px; background: var(--hover); color: var(--text); cursor: pointer; font: inherit; }
.rt-sub button { background: transparent; color: var(--text-dim); border-radius: 5px; padding: 3px 8px; }
.rt-tabs button.on { background: var(--text); color: var(--panel); }
.rt-sub button.on { background: var(--hover); color: var(--text); }
.rt-body { flex: 1; overflow: auto; min-height: 0; padding: 0 8px 8px; }
/* the account manager like TradingView's: header buttons, account picker, hide values, download, maximize */
.grid[hidden] { display: none !important; }
.rt-head .grow, .rt-acct .grow, .rt-tabs .grow, .rt-perf-head .grow { flex: 1; }
.rt-panel.max { flex: 1; height: auto; }
.rt-hb { width: 26px; height: 26px; flex: none; display: inline-grid; place-items: center; border: 0; border-radius: 5px; background: transparent; color: var(--text-dim); cursor: pointer; padding: 0; }
.rt-hb:hover { background: var(--hover); color: var(--text); }
.rt-hb svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.7; }
.rt-head .rt-menu { margin-left: 2px; }
.rt-head .rt-menu svg { width: 14px; height: 14px; }
.rt-acct .rt-name { display: inline-flex; align-items: center; gap: 4px; font: inherit; background: transparent; cursor: pointer; }
.rt-acct button.rt-name:hover { background: var(--hover); }
.rt-acct .rt-name svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 2; }
.rt-acct .rt-hb { margin: -4px -4px -4px 0; }
.rt-tabs { align-items: center; }
.rt-tabs button small { opacity: .7; margin-left: 2px; }
.rt-tabs .rt-hb { border-radius: 5px; padding: 0; background: transparent; }
.rt-tbl td.wrap { white-space: normal; min-width: 320px; }
.rt-tbl .rt-2 { display: block; line-height: 1.5; }
.rt-tbl .rt-side { padding: 1px 6px; border-radius: 4px; font-size: 11px; background: rgba(41,98,255,.15); }
.rt-tbl .rt-side.sell { background: rgba(242,54,69,.15); }
.rt-tbl .rt-symb { display: inline-flex; align-items: center; border: 0; padding: 0; background: none; color: inherit; font: inherit; cursor: pointer; }
.rt-sub button small { opacity: .7; margin-left: 2px; }
.rt-stats b small { font-weight: 400; color: var(--text-dim); margin-left: 4px; font-size: 12px; }
.rt-perf-head { display: flex; align-items: center; gap: 4px; }
.rt-perf-head b { font-size: 14px; }
.rt-chart-wrap { position: relative; }
.rt-chart { display: block; width: 100%; height: 170px; }
.rt-panel.max .rt-chart { height: calc(100vh - 330px); min-height: 200px; }
.rt-legend { position: absolute; left: 10px; top: 4px; display: flex; flex-direction: column; gap: 2px; color: var(--text-dim); font-size: 11px; pointer-events: none; }
.rt-legend i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 4px; }
.rt-legend-t { position: absolute; left: -6px; top: 4px; width: 14px; height: 18px; border: 0; padding: 0; background: transparent; color: var(--text-dim); cursor: pointer; font-size: 12px; }
/* the account picker */
.rt-accmenu { position: fixed; z-index: 1000; min-width: 260px; padding: 6px; border: 1px solid var(--border); border-radius: 8px; background: var(--panel); box-shadow: 0 8px 28px rgba(0,0,0,.4); font-size: 13px; }
.rt-accmenu-h { padding: 4px 8px 6px; color: var(--text-dim); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
.rt-accrow { display: flex; align-items: center; gap: 10px; padding: 4px 4px 4px 10px; border-radius: 6px; cursor: pointer; }
.rt-accrow:hover { background: var(--hover); }
.rt-accrow.on { background: var(--text); color: var(--panel); }
.rt-accrow.on .rt-hb, .rt-accrow.on small { color: var(--panel); }
.rt-accrow .nm { flex: 1; }
.rt-accrow small { color: var(--text-dim); font-size: 10px; }
.rt-accrow .bal { font-variant-numeric: tabular-nums; opacity: .8; }
.rt-accmenu hr { border: 0; border-top: 1px solid var(--border); margin: 6px 0; }
.rt-accnew { display: flex; align-items: center; gap: 8px; width: 100%; padding: 6px 10px; border: 0; border-radius: 6px; background: transparent; color: var(--text); font: inherit; cursor: pointer; }
.rt-accnew:hover { background: var(--hover); }
.rt-accnew svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; }
/* Create account / Account settings / Reset account */
.pa-dlg { display: flex; flex-direction: column; gap: 10px; padding: 4px 2px 0; }
.pa-warn { padding: 8px 10px; border-radius: 6px; background: rgba(255,152,0,.14); color: var(--text); font-size: 12px; line-height: 1.45; }
.pa-f { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--text-dim); }
.pa-f input, .pa-f select { height: 32px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg); color: var(--text); padding: 0 8px; font: inherit; font-size: 13px; width: 100%; box-sizing: border-box; }
.pa-f input:disabled, .pa-f select:disabled { opacity: .45; }
.pa-row, .pa-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pa-lev { display: flex; gap: 6px; }
.pa-lev input { width: 70px; flex: none; }
.pa-sec { margin-top: 4px; color: var(--text-dim); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
.pa-dlg .info { display: inline-grid; place-items: center; width: 13px; height: 13px; border-radius: 50%; background: var(--hover); font-style: normal; font-size: 9px; cursor: help; margin-left: 2px; }
.rt-dl-sel { width: 100%; height: 32px; margin: 4px 0 6px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg); color: var(--text); padding: 0 8px; }
.rt-tbl { width: 100%; border-collapse: collapse; }
.rt-tbl th { text-align: left; font-weight: 400; color: var(--text-dim); padding: 5px 8px; border-bottom: 1px solid var(--border); white-space: nowrap; position: sticky; top: 0; background: var(--panel); }
.rt-tbl td { padding: 6px 8px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.rt-tbl .n { text-align: right; }
.rt-tbl small { color: var(--text-dim); }
.rt-tbl .buy { color: #2962ff; }
.rt-tbl .sell { color: #f23645; }
.rt-tbl .sym-badge { margin-right: 6px; }
.rt-tbl .rt-sym { padding: 1px 6px; border-radius: 4px; background: #2962ff; color: #fff; font-size: 11px; }
.rt-tbl .act { width: 30px; text-align: right; }
.rt-tbl .act button { width: 22px; height: 22px; display: inline-grid; place-items: center; border: 0; background: transparent; color: var(--text-dim); border-radius: 4px; cursor: pointer; }
.rt-tbl .act button:hover { background: var(--hover); color: var(--text); }
.rt-tbl .act svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.rt-tbl .st-filled { color: #089981; }
.rt-tbl .st-cancelled, .rt-tbl .st-rejected { color: var(--text-dim); }
.rt-none { color: var(--text-dim); text-align: center; padding: 18px !important; }
.rt-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 4px 0 10px; }
.rt-stats div { display: flex; flex-direction: column; gap: 2px; }
.rt-stats span { color: var(--text-dim); }
.rt-stats b { font-size: 14px; }
.rt-perf { display: flex; flex-direction: column; gap: 4px; }
.rt-curve { width: 100%; height: 90px; color: var(--text-dim); }

/* ---------- menus ---------- */
.menu {
  position: fixed; z-index: 60; padding: 6px; min-width: 200px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow);
}
.menu[hidden] { display: none; }
.menu .grp { font-size: 11px; color: var(--text-dim); padding: 8px 8px 2px; text-transform: uppercase; letter-spacing: .5px; }
.menu label { display: flex; align-items: center; gap: 8px; padding: 5px 8px; border-radius: 5px; cursor: pointer; }
.menu label:hover { background: var(--hover); }
.lay-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; }
.lay-grid button {
  display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 8px 10px;
  background: transparent; border: 0; border-radius: 6px; cursor: pointer; font-size: 11px;
}
.lay-grid button:hover { background: var(--hover); }
.lay-grid button.active { color: var(--accent); background: var(--hover); }
.lay { width: 20px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1; shape-rendering: geometricPrecision; }
#layoutBtn .lay { width: 20px; height: 17px; }

/* layout menu: one row per chart count */
.layout-menu { width: 430px; max-height: calc(100vh - 60px); overflow-y: auto; padding: 4px 8px; scrollbar-width: thin; }
.lay-row { display: flex; align-items: center; gap: 6px; padding: 6px 0; border-bottom: 1px solid var(--border); }
.lay-n { width: 22px; color: var(--text-dim); font-size: 13px; flex: none; }
.lay-icons { display: flex; flex-wrap: wrap; gap: 4px; }
.lay-icons button { width: 32px; height: 28px; display: grid; place-items: center; border: 0; border-radius: 6px; background: transparent; color: var(--text); cursor: pointer; }
.lay-icons button:hover { background: var(--hover); }
.lay-icons button.active { background: var(--text); color: var(--panel); }
.layout-menu .grp { padding-top: 12px; }
.fly-toggle .info, .lm-menu .info {
  display: inline-grid; place-items: center; width: 15px; height: 15px; border-radius: 50%; background: var(--border); color: var(--text-dim);
  font-size: 10px; font-style: normal; font-weight: 700; margin-left: 4px; cursor: help;
}
.fly-toggle.disabled { opacity: .5; cursor: not-allowed; }

/* layout name button + layout manager / snapshot menus */
.btn.layout-name { max-width: 180px; gap: 2px; }
.btn.layout-name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.btn.layout-name.dirty span::after { content: " •"; color: var(--orange); }
.lm-menu { width: 280px; padding: 6px; }
.lm-menu hr { border: 0; border-top: 1px solid var(--border); margin: 5px 2px; }
.lm-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: 6px; background: transparent; cursor: pointer; font-size: 14px; text-align: left; color: var(--text); }
.lm-item:hover { background: var(--hover); }
.lm-item span { flex: 1; }
.lm-item.muted-item { color: var(--text-dim); }
.lm-item.disabled { opacity: .45; cursor: not-allowed; }
.lm-item svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.lm-item kbd { border: 0; background: transparent; color: var(--text-dim); font: 12px system-ui, sans-serif; padding: 0; }
.lm-recent { display: flex; align-items: center; gap: 6px; padding: 6px 6px 6px 10px; border-radius: 6px; cursor: pointer; }
.lm-recent:hover { background: var(--hover); }
.lm-recent.cur { background: var(--text); color: var(--panel); }
.lm-recent div { flex: 1; min-width: 0; }
.lm-recent b { display: block; font-weight: 500; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lm-recent small { color: var(--text-dim); font-size: 12px; }
.lm-recent.cur small { color: var(--panel); opacity: .7; }
.lm-star { border: 0; background: transparent; cursor: pointer; color: var(--text-dim); display: grid; place-items: center; padding: 3px; }
.lm-star svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linejoin: round; }
.lm-star.on { color: #facc15; }
.lm-star.on svg { fill: #facc15; }
.lm-recent.cur .lm-star:not(.on) { color: var(--panel); }
.snap-menu { width: 300px; }
.lay-list li { grid-template-columns: 30px auto 1fr auto; }
.lay-list .lay-ico .lay { width: 20px; height: 17px; }
.lay-del { border: 0; background: transparent; color: var(--text-dim); cursor: pointer; display: grid; place-items: center; }
.lay-del svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.lay-del:hover { color: var(--down); }
.ctx-menu { min-width: 230px; }
.ctx-menu button {
  display: flex; align-items: center; gap: 8px; width: 100%; padding: 7px 8px; text-align: left;
  background: transparent; border: 0; border-radius: 5px; cursor: pointer;
}
.ctx-menu button:hover { background: var(--hover); }
.ctx-menu button.danger { color: var(--down); }
.ctx-menu .ic { width: 16px; display: grid; place-items: center; }
.ctx-menu kbd { margin-left: auto; }
.ctx-menu hr { border: 0; border-top: 1px solid var(--border); margin: 4px 0; }

/* ---------- side panel ---------- */
.side { flex: 0 0 290px; display: flex; flex-direction: column; background: var(--panel); border-left: 1px solid var(--border); min-height: 0; }
.side-tabs { display: flex; align-items: center; gap: 2px; padding: 6px 8px; border-bottom: 1px solid var(--border); }
.side-tabs button {
  background: transparent; border: 0; border-radius: 6px; padding: 5px 9px; cursor: pointer; font-weight: 600; color: var(--text-dim);
  display: inline-flex; gap: 5px; align-items: center;
}
.side-tabs button:hover { background: var(--hover); }
.side-tabs button.active { color: var(--text); background: var(--hover); }
.side-tabs .add { margin-left: auto; font-size: 18px; line-height: 1; padding: 2px 9px; color: var(--text); }
.side-body { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.side-body[hidden] { display: none; }
.wl-cols, #watchList li { display: grid; grid-template-columns: minmax(80px, 1fr) auto 58px 16px; gap: 6px; align-items: center; padding: 0 12px; }
.wl-cols { font-size: 11px; color: var(--text-dim); padding-top: 6px; padding-bottom: 4px; border-bottom: 1px solid var(--border); }
.wl-cols span:nth-child(2), .wl-cols span:nth-child(3) { text-align: right; }
#watchList, #alertList { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; }
#watchList li { height: 32px; cursor: pointer; font-variant-numeric: tabular-nums; }
#watchList li:hover { background: var(--hover); }
#watchList li.active { background: var(--hover); box-shadow: inset 3px 0 0 var(--accent); }
#watchList li.group { display: block; height: auto; cursor: default; padding: 10px 12px 4px; font-size: 11px; color: var(--text-dim); text-transform: uppercase; letter-spacing: .5px; }
#watchList li.group:hover { background: transparent; }
#watchList .sym { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#watchList .last, #watchList .chg { text-align: right; transition: color .4s; }
#watchList .last.flash-up { color: var(--up); }
#watchList .last.flash-down { color: var(--down); }
#watchList .rm { border: 0; background: transparent; color: var(--text-dim); cursor: pointer; padding: 0; opacity: 0; display: grid; place-items: center; }
#watchList li:hover .rm { opacity: 1; }
#alertList li { display: flex; gap: 8px; padding: 9px 12px; border-bottom: 1px solid var(--border); cursor: pointer; }
#alertList li:hover { background: var(--hover); }
#alertList li.done { opacity: .65; }
#alertList li.empty { display: block; color: var(--text-dim); cursor: default; border: 0; line-height: 1.8; }
#alertList li.empty:hover { background: transparent; }
.a-main { flex: 1; min-width: 0; }
.a-main span { color: var(--text-dim); }
.a-msg { font-size: 12px; margin-top: 2px; }
.a-st { font-size: 11px; color: var(--text-dim); margin-top: 2px; }
#alertList li.on .a-st { color: var(--orange); }
.a-acts { display: flex; gap: 2px; align-items: flex-start; }
.a-acts button { border: 0; background: transparent; color: var(--text-dim); cursor: pointer; border-radius: 4px; width: 22px; height: 22px; display: grid; place-items: center; }
.a-acts button:hover { background: var(--panel-2); color: var(--text); }
.tip { font-size: 11px; color: var(--text-dim); padding: 10px 12px; margin: 0; border-top: 1px solid var(--border); line-height: 1.8; }

/* ---------- modal dialogs ---------- */
.modal {
  position: fixed; inset: 0; z-index: 80; display: flex; align-items: flex-start; justify-content: center;
  padding-top: 10vh; background: rgba(0, 0, 0, .45);
}
.modal[hidden] { display: none; }
.dialog {
  max-height: 78vh; display: flex; flex-direction: column;
  background: var(--panel); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow);
}
.dialog-head { display: flex; align-items: center; padding: 12px 14px 8px; }
.drag-head { cursor: move; user-select: none; touch-action: none; }
.drag-head button, .drag-head input, .drag-head select { cursor: pointer; }
.dialog-head h3 { margin: 0; font-size: 15px; flex: 1; }
.dialog-head .close { border: 0; background: transparent; cursor: pointer; border-radius: 5px; width: 26px; height: 26px; display: grid; place-items: center; color: var(--text-dim); }
.dialog-head .close:hover { background: var(--hover); color: var(--text); }
.dialog-foot { font-size: 11px; color: var(--text-dim); padding: 8px 14px; border-top: 1px solid var(--border); }
.search-row { display: flex; align-items: center; gap: 8px; margin: 0 14px 8px; padding: 0 10px; border: 1px solid var(--border); border-radius: 7px; background: var(--bg); }
.search-row:focus-within { border-color: var(--accent); }
.search-row svg { width: 16px; height: 16px; fill: none; stroke: var(--text-dim); stroke-width: 2; }
.search-row input { flex: 1; border: 0; background: transparent; padding: 9px 0; outline: none; font-size: 14px; }
.sym-search, .ind-dialog { display: flex; flex-direction: column; min-height: 0; }
.chips { display: flex; gap: 4px; padding: 0 14px 8px; }
.chips button { border: 1px solid var(--border); background: transparent; border-radius: 14px; padding: 3px 12px; cursor: pointer; font-size: 12px; }
.chips button.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.sym-list { list-style: none; margin: 0; padding: 0 6px 6px; overflow-y: auto; min-height: 120px; max-height: 50vh; }
.sym-list li { display: grid; grid-template-columns: 28px minmax(90px, auto) 1fr auto; gap: 10px; align-items: center; padding: 7px 8px; border-radius: 6px; cursor: pointer; }
.sym-list li.sel { background: var(--hover); }
.sym-list li.empty { display: block; color: var(--text-dim); cursor: default; }
.sym-list .desc { color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.sym-list .src { color: var(--text-dim); font-size: 11px; white-space: nowrap; }
.badge { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 10px; font-weight: 700; color: #fff; }
.badge.crypto { background: #f59e0b; }
.badge.fx { background: var(--accent); }
.badge.cme { background: #8b5cf6; }
.badge.perp { background: #0ea5a4; }
.ind-list { overflow-y: auto; padding: 0 6px 6px; max-height: 55vh; }
.ind-list .grp { font-size: 11px; color: var(--text-dim); padding: 10px 8px 3px; text-transform: uppercase; letter-spacing: .5px; }
.ind-list .empty { padding: 12px 8px; color: var(--text-dim); }
.ind-row { display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 8px; text-align: left; background: transparent; border: 0; border-radius: 6px; cursor: pointer; }
.ind-row:hover { background: var(--hover); }
.ind-row .sw { width: 10px; height: 10px; border-radius: 2px; flex: none; }
.ind-row .where { margin-left: auto; font-size: 11px; color: var(--text-dim); }
.ind-row .cnt { font-size: 11px; color: var(--accent); }
.settings { padding: 0 14px 12px; }
.settings .sec { font-size: 11px; color: var(--text-dim); text-transform: uppercase; letter-spacing: .5px; margin: 8px 0 4px; }
.settings label { display: flex; align-items: center; gap: 10px; padding: 4px 0; }
.settings label span { flex: 1; }
.settings input:not([type="color"]), .settings select {
  width: 170px; padding: 6px 8px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg);
}
.settings input:focus, .settings select:focus { outline: none; border-color: var(--accent); }
.settings input[type="color"] { width: 44px; height: 28px; padding: 0 2px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg); cursor: pointer; }
.dialog-btns { display: flex; gap: 8px; margin-top: 12px; }
.dialog-btns .grow { flex: 1; }
.btn.primary { background: var(--accent); color: #fff; padding: 6px 16px; }
.btn.primary:hover { filter: brightness(1.1); background: var(--accent); }
.btn.ghost { border-color: var(--border); }

/* chart settings dialog */
.cs { display: grid; grid-template-columns: 170px 1fr; grid-template-rows: minmax(0, 1fr) auto; min-height: 0; height: min(560px, 70vh); }
.cs-tabs { display: flex; flex-direction: column; gap: 2px; padding: 4px 8px 8px; border-right: 1px solid var(--border); }
.cs-tabs button {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px; text-align: left;
  background: transparent; border: 0; border-radius: 6px; cursor: pointer; color: var(--text-dim); font-weight: 500;
}
.cs-tabs button:hover { background: var(--hover); color: var(--text); }
.cs-tabs button.active { background: var(--hover); color: var(--text); box-shadow: inset 3px 0 0 var(--accent); }
.cs-tabs svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.cs-body { overflow-y: auto; padding: 0 18px 12px; }
.cs-body .sec { font-size: 11px; color: var(--text-dim); text-transform: uppercase; letter-spacing: .6px; margin: 14px 0 4px; }
.cs-body .sec:first-child { margin-top: 4px; }
.cs-body .row { display: flex; align-items: center; gap: 12px; min-height: 36px; }
.cs-body .row.chk { cursor: pointer; gap: 10px; }
.cs-body .lbl { flex: 1; display: flex; align-items: center; gap: 10px; cursor: pointer; }
.cs-body input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--accent); margin: 0; cursor: pointer; }
.cs-body select, .cs-body input[type="number"] {
  width: 210px; padding: 6px 8px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg);
}
.cs-body select:focus, .cs-body input:focus { outline: none; border-color: var(--accent); }
.cs-body .num { display: flex; align-items: center; gap: 8px; }
.cs-body .num input { width: 90px; }
.cs-body .unit { color: var(--text-dim); font-size: 12px; width: 32px; }
.ctrls { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.ctrls.off { opacity: .35; pointer-events: none; }
.cpick { display: inline-flex; align-items: center; gap: 6px; padding: 3px 6px 3px 3px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg); }
.cpick input[type="color"] { width: 26px; height: 22px; padding: 0; border: 0; border-radius: 4px; background: none; cursor: pointer; }
.cpick input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
.cpick input[type="color"]::-webkit-color-swatch { border: 1px solid rgba(128,128,128,.4); border-radius: 4px; }
.cpick input[type="range"] { width: 64px; accent-color: var(--accent); }
.cpick b { font-size: 11px; font-weight: 500; color: var(--text-dim); width: 30px; text-align: right; }
.cs-foot { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-top: 1px solid var(--border); }
.cs-foot .grow { flex: 1; }
.cs-foot .tpl { border: 1px solid var(--border); }
.legend.bg { right: auto; background: color-mix(in srgb, var(--panel) 88%, transparent); border-radius: 6px; padding: 3px 6px; }
.scale-btns .gear { display: grid; place-items: center; padding: 1px 3px; }
.scale-btns .gear svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.bb-btn.max-btn { display: grid; place-items: center; width: 30px; height: 26px; padding: 0; margin-left: 4px; border: 1px solid var(--border); }
.bb-btn.max-btn[hidden] { display: none; }
.bb-btn.max-btn svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.bb-btn.max-btn.on { background: var(--text); color: var(--panel); border-color: var(--text); }
/* maximized chart fills the layout; the other charts stay loaded but hidden */
.grid.maxed .view:not(.maxed) { display: none; }
.grid.maxed .view.maxed { grid-column: 1 / -1 !important; grid-row: 1 / -1 !important; }
.grid.maxed .view.maxed::after { box-shadow: none !important; }
@media (max-width: 620px) {
  .cs { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr) auto; }
  .cs-tabs { flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--border); }
  .cs-tabs button span { white-space: nowrap; }
  .cs-body select, .cs-body input[type="number"] { width: 150px; }
}

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 100; max-width: calc(100vw - 32px);
  background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 10px 16px; box-shadow: var(--shadow);
}

@media (max-width: 1100px) { .brand-name { display: none; } }
@media (max-width: 900px) { .side { display: none; } .brand { display: none; } }
@media (max-width: 700px) {
  .grid.multi { grid-template-columns: minmax(0, 1fr) !important; grid-template-rows: none !important; grid-auto-rows: 360px; overflow-y: auto; }
  .grid.multi .view { grid-column: auto !important; grid-row: auto !important; }
}
@media (max-width: 520px) {
  .tools { flex-basis: 38px; }
  .tools button { width: 30px; height: 30px; }
  .pane.osc { flex-basis: 100px; }
}

/* ---------- indicator context menu, pane labels, object tree ---------- */
.ctx-menu button.off { opacity: .45; cursor: default; }
.ctx-menu button.off:hover { background: transparent; }
.ctx-menu button.has-sub.open { background: var(--hover); }
.ctx-menu .lbl { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 340px; }
.ctx-menu .arr { margin-left: auto; color: var(--text-dim); font-size: 15px; line-height: 1; }
.ctx-menu kbd + .arr { margin-left: 6px; }
.ctx-menu .chk { color: var(--accent); font-weight: 700; }
.ctx-menu .ic svg { width: 15px; height: 15px; }
.ctx-sub { min-width: 210px; z-index: 61; }
.pane-label { display: block !important; width: auto !important; background: none !important; pointer-events: none !important; }
.pane-label .ind { display: flex; align-items: center; gap: 6px; width: fit-content; pointer-events: auto; border-radius: 4px; padding: 0 2px; margin-bottom: 1px; }
.pane-label .ind:hover { background: color-mix(in srgb, var(--panel) 80%, transparent); }
.pane-label .ind:hover .acts { opacity: 1; }
.pane-label .k { color: var(--text-dim); margin-right: 3px; }
.legend .ind.dim .k, .pane-label .ind.dim .k { opacity: .5; }
.legend .ind.sel, .pane-label .ind.sel { outline: 1px solid var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); }
.ind-row .fav { display: grid; place-items: center; width: 18px; color: var(--text-dim); opacity: .55; }
.ind-row .fav.on, .ind-row:hover .fav { opacity: 1; }
.ind-row .fav svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.6; }
.ind-on { display: flex; align-items: center; gap: 8px; padding: 6px 2px 10px; font-size: 13px; }
.ind-on select { margin-left: auto; }
.a-ind { color: var(--text-dim); font-size: 12px; }
.about-ind p { margin: 0 0 12px; line-height: 1.5; }
.about-ind dl { display: grid; grid-template-columns: 110px 1fr; gap: 6px 10px; margin: 0; font-size: 13px; }
.about-ind dt { color: var(--text-dim); }
.about-ind dd { margin: 0; }
.src-view pre { max-height: 60vh; overflow: auto; margin: 0 0 10px; padding: 10px; background: var(--bg); border: 1px solid var(--border); border-radius: 6px; font: 12px/1.45 ui-monospace, Consolas, monospace; white-space: pre; }
.obj-tree { max-height: 65vh; overflow: auto; }
.ot-pane { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-dim); padding: 10px 4px 4px; }
.ot-pane:first-child { padding-top: 0; }
.ot-row { display: flex; align-items: center; gap: 8px; padding: 5px 6px; border-radius: 5px; font-size: 13px; }
.ot-row:hover { background: var(--hover); }
.ot-row.off .ot-name { opacity: .5; }
.ot-row.main .ot-name { font-weight: 600; }
.ot-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ot-acts { display: inline-flex; gap: 2px; }
.ot-acts button { width: 24px; height: 22px; display: grid; place-items: center; border: 0; background: transparent; color: var(--text-dim); border-radius: 4px; cursor: pointer; }
.ot-acts button:hover { background: var(--panel); color: var(--text); }
.ot-acts svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- chart menu: table view, chart templates ---------- */
.table-view .tv-wrap { max-height: 62vh; overflow: auto; border: 1px solid var(--border); border-radius: 6px; margin-bottom: 10px; }
.table-view table { border-collapse: collapse; width: 100%; font-size: 12px; font-variant-numeric: tabular-nums; }
.table-view th, .table-view td { padding: 5px 10px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--border); }
.table-view th:first-child, .table-view td:first-child { text-align: left; }
.table-view thead th { position: sticky; top: 0; background: var(--panel); color: var(--text-dim); font-weight: 500; z-index: 1; }
.table-view tbody tr:hover { background: var(--hover); }
.table-view td.up { color: var(--up); }
.table-view td.down { color: var(--down); }
.tpl-list { list-style: none; margin: 8px 0; padding: 0; max-height: 220px; overflow: auto; }
.tpl-list li { display: flex; align-items: center; gap: 8px; padding: 5px 6px; border-radius: 5px; font-size: 13px; }
.tpl-list li:hover { background: var(--hover); }
.tpl-list li span { flex: 1; }
.tpl-list button { border: 0; background: transparent; color: var(--text-dim); cursor: pointer; display: grid; place-items: center; }
.tpl-list button:hover { color: var(--down); }
.tpl-list svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; }

/* ================= chart settings dialog (TradingView layout) ================= */
.cs { grid-template-columns: 220px 1fr; height: min(640px, 76vh); }
.cs-tabs { border-right: 0; padding: 6px 10px 10px 14px; }
.cs-tabs button { padding: 10px 12px; gap: 12px; font-size: 14px; color: var(--text); font-weight: 400; border-radius: 8px; }
.cs-tabs button.active { box-shadow: none; background: var(--hover); font-weight: 600; }
.cs-tabs svg { width: 20px; height: 20px; stroke-width: 1.4; }
.cs-body { padding: 0 24px 16px 18px; }
.cs-body .sec { margin: 18px 0 8px; font-size: 11px; letter-spacing: .4px; }
.cs-body .sec:first-child, .cs-note + .sec { margin-top: 6px; }
.cs-note { margin: 4px 0 0; font-size: 12px; color: var(--text-dim); }
.cs-body .row { display: grid; grid-template-columns: minmax(150px, 190px) 1fr; align-items: center; gap: 10px; min-height: 40px; }
.cs-body .row.solo { grid-template-columns: 1fr; }
.cs-body .row.sub { padding-left: 26px; }
.cs-body .cl { display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: 14px; }
.cs-body .cl.plain { cursor: default; }
.cs-body .cl.off { opacity: .45; cursor: default; }
.cs-body .cl input[type="checkbox"] { width: 18px; height: 18px; }
.cs-body .ctrls { justify-content: flex-start; align-items: center; flex-wrap: nowrap; }
.cs-body .desc { font-size: 12px; color: var(--text-dim); margin: -6px 0 6px; }
.cs-body .desc.sub { padding-left: 26px; }
.cs-body select, .cs-body input[type="number"] { width: 180px; height: 34px; padding: 0 10px; border-radius: 8px; }
.cs-body .num input { width: 150px; }
.cs-body select:disabled, .cs-body input:disabled { opacity: .45; }
.cs-body input.op { width: 150px; height: 6px; -webkit-appearance: none; appearance: none; border-radius: 4px; cursor: pointer;
  background: linear-gradient(90deg, transparent, var(--accent)), repeating-conic-gradient(#666 0 25%, #333 0 50%) 0 0 / 8px 8px; }
.cs-body input.op::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; border-radius: 50%; background: #fff; border: 2px solid #111; }
.cs-body .info { display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; background: var(--hover); color: var(--text-dim); font-size: 10px; font-style: normal; font-weight: 700; cursor: help; }
.sw { display: inline-flex; align-items: center; gap: 6px; height: 34px; min-width: 34px; padding: 0 6px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); cursor: pointer; }
.sw:hover { border-color: var(--text-dim); }
.sw i { width: 20px; height: 20px; border-radius: 4px; display: block; box-shadow: inset 0 0 0 1px rgba(128,128,128,.35); }
.sw.line { padding-right: 10px; }
.ls { display: block; width: 26px; height: 0; border-top: 2px solid currentColor; }
.ls.ls1 { border-top-style: dotted; }
.ls.ls2 { border-top-style: dashed; }
.ls.ls3 { border-top-style: dashed; border-top-width: 3px; }
.ls.ls4 { border-top-style: dotted; border-top-width: 3px; }
.cs-foot { padding: 14px 18px; border-top: 0; gap: 10px; }
.cs-foot .btn { height: 34px; padding: 0 14px; border-radius: 8px; font-size: 14px; }
.cs-foot .btn.ghost { border: 1px solid var(--text-dim); background: transparent; }
.cs-foot .btn.primary { background: var(--text); color: var(--panel); }
.cs-foot .tpl-btn { display: inline-flex; align-items: center; gap: 6px; border-color: var(--border) !important; }
.cs-foot .tpl-btn .ico { width: 14px; height: 14px; }
/* color popover */
.cpop { position: fixed; z-index: 120; background: var(--panel); border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow); padding: 10px; width: 232px; }
.cpop[hidden] { display: none; }
.cp-grid { display: grid; grid-template-columns: repeat(10, 1fr); gap: 3px; }
.cp-grid button { width: 19px; height: 19px; border: 1px solid rgba(128,128,128,.35); border-radius: 3px; cursor: pointer; padding: 0; }
.cp-grid button.on { outline: 2px solid var(--accent); outline-offset: 1px; }
.cp-row { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.cp-custom { position: relative; width: 22px; height: 22px; border: 1px dashed var(--text-dim); border-radius: 4px; display: grid; place-items: center; cursor: pointer; color: var(--text-dim); }
.cp-custom input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.cp-op { font-size: 12px; color: var(--text-dim); }
.cp-row input[type="range"] { flex: 1; accent-color: var(--accent); }
.cp-row b { font-size: 11px; font-weight: 500; width: 32px; text-align: right; color: var(--text-dim); }
.cp-styles { display: flex; gap: 4px; margin-top: 10px; }
.cp-styles button { flex: 1; height: 26px; display: grid; place-items: center; border: 1px solid var(--border); border-radius: 5px; background: transparent; color: var(--text); cursor: pointer; }
.cp-styles button.on { border-color: var(--accent); }
.cp-styles .ls { width: 22px; }
.ctx-menu { z-index: 110; }

/* chart chrome driven by settings */
.legend.bg { background: var(--sl-bg, color-mix(in srgb, var(--panel) 88%, transparent)); }
.plus-btn { position: absolute; z-index: 6; width: 18px; height: 18px; padding: 0; border: 0; border-radius: 3px; background: var(--accent); color: #fff; font-size: 15px; line-height: 18px; cursor: pointer; }
.plus-btn[hidden] { display: none; }
.nav-btns { position: absolute; left: 50%; bottom: 34px; transform: translateX(-50%); z-index: 6; display: flex; gap: 4px; opacity: 0; transition: opacity .15s; pointer-events: none; }
.nav-btns button { width: 28px; height: 28px; border: 0; border-radius: 6px; background: color-mix(in srgb, var(--panel) 92%, transparent); color: var(--text); font-size: 16px; cursor: pointer; box-shadow: var(--shadow); }
.nav-btns button:hover { background: var(--hover); }
.view.nav-always .nav-btns, .view.nav-hover:hover .nav-btns { opacity: 1; pointer-events: auto; }
.latest-btn { position: absolute; z-index: 7; width: 26px; height: 26px; padding: 0; display: grid; place-items: center; border: 0; border-radius: 4px; background: #2a2e39; color: #fff; cursor: pointer; box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.latest-btn:hover { background: #131722; }
.latest-btn[hidden], .latest-tip[hidden] { display: none; }
.latest-btn svg { fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
:root:not([data-theme="light"]) .latest-btn { background: #434651; }
:root:not([data-theme="light"]) .latest-btn:hover { background: #50535e; }
.latest-tip { position: absolute; z-index: 30; display: flex; align-items: center; gap: 10px; white-space: nowrap; padding: 4px 4px 4px 8px; border-radius: 4px; background: #131722; color: #fff; font: 13px/18px -apple-system, BlinkMacSystemFont, "Trebuchet MS", Roboto, Ubuntu, sans-serif; pointer-events: none; box-shadow: 0 2px 6px rgba(0,0,0,.2); }
:root:not([data-theme="light"]) .latest-tip { background: #363a45; }
.latest-tip .lt-keys { display: flex; align-items: center; gap: 3px; color: #b2b5be; font-size: 12px; }
.latest-tip kbd { border: 0; border-radius: 3px; padding: 0 5px; background: #50535e; color: #fff; font: 600 11px/17px -apple-system, BlinkMacSystemFont, "Trebuchet MS", Roboto, sans-serif; }
.cur-label { position: absolute; right: 1px; bottom: 26px; z-index: 5; font-size: 10px; text-align: center; color: var(--text-dim); pointer-events: none; opacity: 0; }
.view.cur-always .cur-label, .view.cur-hover:hover .cur-label { opacity: 1; }
.view.smodes-hover .scale-btns { opacity: 0; transition: opacity .15s; }
.view.smodes-hover:hover .scale-btns { opacity: 1; }
.view.smodes-hidden .scale-btns { display: none; }
.view.scale-left .scale-btns, .view.scale-left .cur-label { right: auto; left: 2px; }
.pane-btns { position: absolute; top: 4px; right: 84px; z-index: 6; display: flex; gap: 2px; opacity: 0; transition: opacity .15s; }
.pane-btns button { width: 22px; height: 20px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 4px; background: color-mix(in srgb, var(--panel) 90%, transparent); color: var(--text-dim); cursor: pointer; }
.pane-btns button:hover { color: var(--text); background: var(--hover); }
.pane-btns svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.view.paneb-always .pane-btns, .view.paneb-hover .pane.osc:hover .pane-btns { opacity: 1; }
.view.paneb-hidden .pane-btns { display: none; }
.view.scale-left .pane-btns { right: 8px; }
.ev-tip { position: fixed; z-index: 70; max-width: 300px; background: var(--panel); border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow); padding: 8px 10px; font-size: 12px; pointer-events: none; }
.ev-tip[hidden] { display: none; }
.ev-tip .ev + .ev { margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--border); }
.ev-tip b { display: inline-block; padding: 0 4px; border-radius: 3px; color: #fff; font-size: 10px; margin-right: 4px; }
.ev-tip b.hi { background: #f23645; }
.ev-tip b.md { background: #ff9800; }
.ev-tip .evm { color: var(--text-dim); margin-top: 2px; }
.toast.sticky { cursor: pointer; box-shadow: 0 0 0 1px var(--orange), var(--shadow); }

/* ---------- broker connections ---------- */
.sym-search .chips { align-items: center; }
.sym-search .chips .grow { flex: 1; }
.sym-search .chips .link { border: 0; background: transparent; color: var(--accent); cursor: pointer; padding: 4px 6px; font-size: 12px; }
.sym-search .chips .link:hover { text-decoration: underline; }
.badge.broker { background: #2c3e50; color: #fff; }
.bk-tabs { display: flex; gap: 4px; margin-bottom: 12px; border-bottom: 1px solid var(--border); }
.bk-tabs button { border: 0; background: transparent; color: var(--text-dim); padding: 8px 12px; cursor: pointer; border-bottom: 2px solid transparent; font-size: 13px; }
.bk-tabs button.on { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }
.bk-tabs .ok { color: var(--up); font-style: normal; font-size: 9px; vertical-align: middle; }
.bk-on { margin: 8px 0 4px; line-height: 1.5; }
.bk-msg { font-size: 12px; color: var(--text-dim); align-self: center; }
.bk-msg.err { color: var(--down); }
.brokers code { background: var(--hover); border-radius: 4px; padding: 1px 5px; font-size: 12px; }

/* ---------- long / short position settings ---------- */
.ps-ren { border: 0; background: transparent; color: var(--text-dim); cursor: pointer; font-size: 15px; padding: 0 4px; }
.ps-ren:hover { color: var(--text); }
.ps { padding: 0 22px 18px; }
.dialog:has(> .ps) .dialog-head { padding: 18px 16px 10px 22px; }
.dialog:has(> .ps) .dialog-head h3 { font-size: 18px; display: flex; align-items: center; gap: 6px; }
.ps-tabs { display: flex; gap: 22px; border-bottom: 2px solid var(--border); margin: 0 0 14px; }
.ps-tabs button { border: 0; background: transparent; color: var(--text-dim); font-size: 15px; font-weight: 600; padding: 4px 0 8px; margin-bottom: -2px; cursor: pointer; border-bottom: 2px solid transparent; }
.ps-tabs button.on { color: var(--text); border-bottom-color: var(--text); }
.ps-body { max-height: 62vh; overflow-y: auto; padding-right: 4px; }
.ps-row { display: grid; grid-template-columns: 110px auto auto; justify-content: start; align-items: center; gap: 10px; min-height: 48px; }
.ps-row > span { font-size: 14px; }
.ps-row input[type="number"], .ps-row select { height: 34px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); padding: 0 10px; width: 100px; }
.ps-row select { width: 95px; }
.ps-row input:focus, .ps-row select:focus { outline: none; border-color: var(--accent); }
.ps-sec { font-size: 11px; color: var(--text-dim); text-transform: uppercase; letter-spacing: .4px; margin: 14px 0 2px; }
.ps-chk { display: flex; align-items: center; gap: 10px; min-height: 44px; font-size: 14px; cursor: pointer; }
.ps-chk input { width: 18px; height: 18px; accent-color: var(--accent); margin: 0; }
.ps-stats { height: 34px; max-width: 180px; padding: 0 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); color: var(--text); text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.ps-vis { display: grid; grid-template-columns: 110px 60px 1fr 60px; align-items: center; gap: 10px; min-height: 48px; }
.ps-vis input[type="number"] { height: 34px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); padding: 0 8px; width: 60px; }
.ps-vis.off input[type="number"], .ps-vis.off .dual { opacity: .4; pointer-events: none; }
.dual { position: relative; height: 18px; }
.dual input[type="range"] { position: absolute; inset: 0; width: 100%; margin: 0; background: none; pointer-events: none; -webkit-appearance: none; appearance: none; }
.dual input[type="range"]::-webkit-slider-runnable-track { height: 4px; background: var(--border); border-radius: 2px; }
.dual input[type="range"] + input[type="range"]::-webkit-slider-runnable-track { background: transparent; }
.dual input[type="range"]::-webkit-slider-thumb { pointer-events: auto; -webkit-appearance: none; width: 14px; height: 14px; margin-top: -5px; border-radius: 50%; background: #fff; border: 2px solid #111; cursor: pointer; }
.ps-foot { display: flex; align-items: center; gap: 10px; margin-top: 16px; }
.ps-foot .grow { flex: 1; }
.ps-foot .btn { height: 34px; padding: 0 14px; border-radius: 8px; font-size: 14px; }
.ps-foot .btn.ghost { border: 1px solid var(--text-dim); background: transparent; }
.ps-foot .btn.primary { background: var(--text); color: var(--panel); }
.ps-foot .tpl-btn { display: inline-flex; align-items: center; gap: 6px; border-color: var(--border) !important; }
.ps-foot .tpl-btn .ico { width: 14px; height: 14px; }

/* ---------- Indicators, metrics, and strategies (TradingView layout) ---------- */
.indx-dialog { height: min(720px, 86vh); max-height: 86vh !important; }
.indx-dialog .dialog-head { padding: 22px 22px 16px; }
.indx-dialog .dialog-head h3 { font-size: 20px; font-weight: 600; }
.indx { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.indx-search { display: flex; align-items: center; gap: 10px; margin: 0 22px 14px; padding: 0 14px; height: 44px; border: 1px solid var(--border); border-radius: 8px; background: color-mix(in srgb, var(--bg) 60%, transparent); }
.indx-search:focus-within { border-color: var(--accent); }
.indx-search svg { width: 20px; height: 20px; fill: none; stroke: var(--text-dim); stroke-width: 1.8; flex: none; }
.indx-search input { flex: 1; border: 0; background: transparent; font-size: 16px; outline: none; color: var(--text); }
.indx .ind-on { margin: 0 22px 10px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.indx-main { display: flex; flex: 1; min-height: 0; }
.indx-side { width: 222px; flex: none; overflow-y: auto; padding: 0 10px 16px 22px; }
.indx-grp { font-size: 11px; font-weight: 600; letter-spacing: .4px; text-transform: uppercase; color: var(--text-dim); margin: 14px 0 6px 12px; }
.indx-grp:first-child { margin-top: 2px; }
.indx-side button { display: flex; align-items: center; gap: 12px; width: 100%; height: 40px; padding: 0 12px; border: 0; border-radius: 8px; background: transparent; color: var(--text); font-size: 14px; text-align: left; cursor: pointer; }
.indx-side button:hover { background: var(--hover); }
.indx-side button.on { background: var(--hover); font-weight: 700; }
.indx-side svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.indx-content { flex: 1; min-width: 0; overflow-y: auto; padding: 0 22px 18px 28px; }
.indx-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 2px 0 14px; position: sticky; top: 0; background: var(--panel); padding-bottom: 4px; z-index: 1; }
.indx-chips button { height: 32px; padding: 0 12px; border: 0; border-radius: 16px; background: var(--hover); color: var(--text); font-size: 14px; cursor: pointer; }
.indx-chips button.on { background: var(--text); color: var(--panel); }
.indx-head { font-size: 11px; font-weight: 600; letter-spacing: .4px; text-transform: uppercase; color: var(--text-dim); margin: 4px 0 4px; }
.indx-list { list-style: none; margin: 0; padding: 0; }
.indx-list li { display: flex; align-items: center; gap: 8px; min-height: 32px; padding: 0 8px; margin: 0 -8px; border-radius: 6px; cursor: pointer; font-size: 14px; }
.indx-list li.sel { background: var(--hover); }
.indx-list .nm { flex: 0 1 auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.indx-list .cnt { font-size: 11px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; display: inline-grid; place-items: center; background: var(--accent); color: #fff; }
.indx-list .beta { font-size: 10px; font-weight: 600; letter-spacing: .3px; padding: 1px 4px; border-radius: 3px; background: var(--hover); color: var(--text-dim); }
.indx-list li.na .nm { color: var(--text-dim); }
.indx-list .fav { margin-left: auto; width: 26px; height: 26px; display: grid; place-items: center; border: 0; background: transparent; color: var(--text-dim); cursor: pointer; opacity: 0; }
.indx-list li.sel .fav, .indx-list .fav.on { opacity: 1; }
.indx-list .fav svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; }
.indx-list.tpl li { flex-direction: column; align-items: flex-start; justify-content: center; gap: 2px; padding-top: 6px; padding-bottom: 6px; }
.indx-list.tpl li:hover { background: var(--hover); }
.indx-list .sub { font-size: 12px; color: var(--text-dim); white-space: normal; }
.indx-empty { padding: 40px 10px; text-align: center; color: var(--text-dim); max-width: 440px; margin: 0 auto; line-height: 1.5; }
.indx-empty b { display: block; color: var(--text); font-size: 15px; margin-bottom: 6px; }
@media (max-width: 700px) { .indx-side { display: none; } .indx-content { padding-left: 22px; } }

/* ---------- Pine Script: editor panel, tables, settings ---------- */
.bb-sep { width: 1px; height: 18px; background: var(--border); margin: 0 6px; }
.bb-btn.pine-btn.on { background: var(--hover); color: var(--text); }
/* ---- Pine Editor (TradingView's): right panel (overlay or split view) or the bottom panel's tab */
.layout { position: relative; }
.pine-dock { position: absolute; top: 0; bottom: 0; z-index: 40; display: flex; flex-direction: column; min-width: 320px; background: var(--panel); border-left: 1px solid var(--border); box-shadow: -10px 0 28px rgba(0,0,0,.35); }
.pine-dock.split { position: relative; right: auto !important; flex: none; box-shadow: none; z-index: 1; }
.pine-dock[hidden] { display: none; }
.pe-resize-x { position: absolute; left: -4px; top: 0; bottom: 0; width: 8px; cursor: ew-resize; z-index: 3; }
.pe-head { display: flex; align-items: center; gap: 6px; height: 40px; padding: 0 8px 0 6px; flex: none; }
.pe-title { font-size: 13px; color: var(--text); }
.pe-head .grow, .pe-tools .grow, .pe-status .grow, .pe-tabs .grow, .pe-con-head .grow { flex: 1; }
.pe-host { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.pe-root { flex: 1; min-height: 0; display: flex; flex-direction: column; position: relative; }
.pe-ib { width: 30px; height: 30px; flex: none; display: inline-grid; place-items: center; border: 0; border-radius: 6px; padding: 0; background: transparent; color: var(--text); cursor: pointer; }
.pe-ib:hover { background: var(--hover); }
.pe-ib svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.3; stroke-linecap: round; stroke-linejoin: round; }
.pe-ib.pe-boxed { border: 1px solid var(--border); width: 34px; height: 34px; border-radius: 8px; }
.pe-run { border: 1px solid var(--border); width: 34px; height: 34px; border-radius: 8px; }
.pe-run svg { width: 20px; height: 20px; }
.pe-tools { display: flex; align-items: center; gap: 6px; padding: 2px 8px 8px; flex: none; }
.pe-namebtn { display: inline-flex; align-items: center; gap: 6px; min-width: 0; max-width: calc(100% - 130px); height: 34px; padding: 0 8px; border: 0; border-radius: 8px; background: transparent; color: var(--text); font: 600 17px/1 inherit; font-family: inherit; cursor: pointer; }
.pe-namebtn:hover { background: var(--hover); }
.pe-namebtn .pe-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pe-namebtn svg { width: 22px; height: 22px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
.pe-root.in-bottom .pe-tools { display: none; }
.pe-banner { flex: none; margin: 0 8px 6px; padding: 8px 12px; border-radius: 6px; background: rgba(255,152,0,.16); color: var(--text); font-size: 13px; }
.pe-banner b { color: #ff9800; }
.pe-banner button { border: 0; padding: 0; background: none; color: #2962ff; font: inherit; cursor: pointer; }
.pe-main { flex: 1; display: flex; min-height: 0; font: 13px/18px ui-monospace, SFMono-Regular, Consolas, 'Liberation Mono', monospace; border-top: 1px solid var(--border); }
.pe-gutter { width: 52px; flex: none; overflow: hidden; text-align: right; padding: 8px 10px 8px 0; color: var(--text-dim); user-select: none; position: relative; }
.pe-gutter div { position: relative; opacity: .65; }
.pe-gutter .d-mod::after, .pe-gutter .d-add::after { content: ''; position: absolute; right: -8px; top: 0; bottom: 0; width: 3px; background: #2962ff; }
.pe-gutter .d-add::after { background: #089981; }
.pe-edit { position: relative; flex: 1; min-width: 0; }
.pe-hl, .pe-ta { position: absolute; inset: 0; margin: 0; padding: 8px 10px; font: inherit; white-space: pre; tab-size: 4; overflow: auto; border: 0; }
.pe-hl { pointer-events: none; color: var(--text); overflow: hidden; }
.pe-ta { resize: none; background: transparent; color: transparent; caret-color: var(--text); outline: none; }
.pe-ta::selection { background: color-mix(in srgb, var(--accent) 35%, transparent); color: transparent; }
.pe-root.wrap .pe-hl, .pe-root.wrap .pe-ta { white-space: pre-wrap; word-break: break-all; }
.pe-root.wrap .pe-gutter div { box-sizing: border-box; }
.pe-meas { position: absolute; left: -9999px; top: 0; visibility: hidden; font: 13px/18px ui-monospace, SFMono-Regular, Consolas, 'Liberation Mono', monospace; white-space: pre-wrap; word-break: break-all; tab-size: 4; }
.pe-root.guide .pe-edit::before { content: ''; position: absolute; top: 0; bottom: 0; left: calc(10px + 80ch); border-left: 1px solid color-mix(in srgb, var(--text-dim) 35%, transparent); pointer-events: none; z-index: 1; }
.pe-inlay { color: var(--text-dim); opacity: .6; font-style: italic; }
.pe-mini { width: 64px; flex: none; cursor: pointer; border-left: 1px solid var(--border); }
.pe-root.nomini .pe-mini { display: none; }
.pe-suggest { position: absolute; z-index: 5; min-width: 200px; max-height: 220px; overflow: auto; padding: 3px; border: 1px solid var(--border); border-radius: 6px; background: var(--panel); box-shadow: 0 8px 24px rgba(0,0,0,.4); }
.pe-suggest div { padding: 2px 8px; border-radius: 4px; cursor: pointer; white-space: nowrap; }
.pe-suggest div.on, .pe-suggest div:hover { background: var(--hover); }
.pe-c { color: #6a9955; } .pe-s { color: #ce9178; } .pe-n { color: #b5cea8; } .pe-k { color: #c586c0; } .pe-t { color: #4ec9b0; } .pe-ns { color: #4fc1ff; } .pe-f { color: #dcdcaa; }
:root[data-theme="light"] .pe-c { color: #008000; } :root[data-theme="light"] .pe-s { color: #a31515; } :root[data-theme="light"] .pe-n { color: #098658; }
:root[data-theme="light"] .pe-k { color: #af00db; } :root[data-theme="light"] .pe-t { color: #267f99; } :root[data-theme="light"] .pe-ns { color: #0070c1; } :root[data-theme="light"] .pe-f { color: #795e26; }
.pe-console { display: none; flex: none; max-height: 160px; min-height: 60px; flex-direction: column; border-top: 1px solid var(--border); font-size: 12px; }
.pe-root.con-open .pe-console { display: flex; }
.pe-con-head { display: flex; align-items: center; padding: 0 4px 0 12px; height: 28px; color: var(--text-dim); }
.pe-con-head .pe-ib { width: 24px; height: 24px; }
.pe-con-head .pe-ib svg { width: 16px; height: 16px; }
.pe-con-body { overflow: auto; padding: 0 12px 6px; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.pe-con-body .t { color: var(--text-dim); margin-right: 6px; }
.pe-con-body .ok, .pe-con-body .prof { color: var(--text-dim); }
.pe-con-body .err { color: var(--down); cursor: pointer; }
.pe-con-body .err:hover { text-decoration: underline; }
.pe-con-body .log.warning { color: #ff9800; } .pe-con-body .log.error { color: var(--down); }
.pe-status { display: flex; align-items: center; gap: 4px; height: 30px; flex: none; padding: 0 8px 0 4px; border-top: 1px solid var(--border); font-size: 12px; color: var(--text-dim); }
.pe-status .pe-ib { width: 26px; height: 26px; }
.pe-status .pe-ib svg { width: 20px; height: 20px; }
.pe-status .pe-ib.err { color: var(--down); }
.pe-sb { border: 0; background: transparent; color: var(--text-dim); font: inherit; padding: 3px 6px; border-radius: 4px; cursor: pointer; white-space: nowrap; }
button.pe-sb:hover { background: var(--hover); color: var(--text); }
.pe-ver { cursor: default; display: none; }
.pe-root.in-bottom .pe-ver { display: inline; }
/* bottom panel: the tab row */
.pine-panel { position: relative; flex: none; height: 320px; display: flex; flex-direction: column; border-top: 1px solid var(--border); background: var(--panel); min-height: 0; }
.pine-panel[hidden] { display: none; }
.pine-panel.max { flex: 1; height: auto !important; }
.pe-resize { position: absolute; left: 0; right: 0; top: -4px; height: 8px; cursor: ns-resize; z-index: 2; }
.pe-tabs { display: flex; align-items: center; gap: 4px; height: 34px; padding: 0 6px; flex: none; border-bottom: 1px solid var(--border); }
.pe-tab, .rt-pinetab { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border: 0; border-radius: 6px; background: transparent; color: var(--text-dim); font: inherit; font-size: 13px; cursor: pointer; }
.pe-tab.on { background: var(--hover); color: var(--text); }
.pe-tab:hover, .rt-pinetab:hover { background: var(--hover); color: var(--text); }
.pe-tab svg, .rt-pinetab svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
.pe-tab .rt-ico { display: inline-grid; place-items: center; }
.pe-tabs .pe-ib { width: 26px; height: 26px; }
.pe-tabs .pe-ib svg { width: 20px; height: 20px; }
.rt-pinetab { margin-left: 4px; }
/* the right toolbar's Pine button sits at the bottom of the strip */
.side-strip .ss-grow { flex: 1; }
#pineSideBtn { margin-bottom: 8px; }
#pineSideBtn.on { background: var(--hover); box-shadow: inset 0 0 0 1px var(--border); }
/* New window / New tab: only the editor */
body.pine-only .pine-dock { position: fixed; inset: 0; width: auto !important; right: 0 !important; z-index: 500; border: 0; box-shadow: none; }
body.pine-only .pine-dock .pe-resize-x, body.pine-only [data-pe="split"], body.pine-only [data-pe="collapse"] { display: none; }
/* menus: section titles, switches, help marks, external links, the current item */
.ctx-menu .ctx-h { padding: 8px 12px 4px; font-size: 11px; color: var(--text-dim); text-transform: uppercase; letter-spacing: .04em; }
.ctx-menu .ctx-help { display: inline-grid; place-items: center; width: 14px; height: 14px; margin-left: 6px; border-radius: 50%; background: var(--hover); color: var(--text-dim); font-size: 10px; font-style: normal; }
.ctx-menu .ctx-sw { margin-left: auto; position: relative; width: 30px; height: 16px; border-radius: 8px; background: var(--border); flex: none; }
.ctx-menu .ctx-sw i { position: absolute; left: 2px; top: 2px; width: 12px; height: 12px; border-radius: 50%; background: var(--text-dim); transition: transform .15s; }
.ctx-menu .ctx-sw.on { background: #2962ff; }
.ctx-menu .ctx-sw.on i { transform: translateX(14px); background: #fff; }
.ctx-menu .ctx-ext { width: 15px; height: 15px; margin-left: auto; fill: none; stroke: currentColor; stroke-width: 1.4; opacity: .7; }
.ctx-menu button.sel { background: var(--text); color: var(--panel); }
.ctx-menu .ic svg { fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
/* dialogs: open script / built-ins, versions, palette, shortcuts */
.pe-open { display: flex; flex-direction: column; min-height: 0; }
.pe-search { display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 10px; margin-bottom: 8px; border: 1px solid var(--border); border-radius: 8px; color: var(--text-dim); }
.pe-search svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.5; }
.pe-search input { flex: 1; border: 0; background: transparent; color: var(--text); font: inherit; outline: none; }
.pe-open-h { display: flex; align-items: center; justify-content: space-between; padding: 4px 4px 4px 10px; font-size: 11px; color: var(--text-dim); text-transform: uppercase; letter-spacing: .04em; }
.pe-open-h .pe-ib { width: 26px; height: 26px; }
.pe-open-h .pe-ib svg { width: 18px; height: 18px; }
.pe-open-list { max-height: 55vh; overflow: auto; }
.pe-open-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 6px 6px 10px; border-radius: 6px; cursor: pointer; }
.pe-open-row:hover, .pe-open-row.on { background: var(--hover); }
.pe-open-row b { font-weight: 400; }
.pe-open-row .k svg { width: 16px; height: 16px; vertical-align: -3px; fill: none; stroke: currentColor; stroke-width: 1.5; }
.pe-open-row small { display: block; color: var(--text-dim); font-size: 11px; margin-top: 2px; }
.pe-open-row .pe-ib { opacity: 0; width: 28px; height: 28px; }
.pe-open-row:hover .pe-ib { opacity: 1; }
.pe-open-row .pe-ib svg { width: 18px; height: 18px; }
.dialog.pe-vh-box.max { width: calc(100vw - 24px) !important; height: calc(100vh - 24px); }
.pe-vh { display: flex; gap: 14px; height: min(70vh, 640px); }
.dialog.pe-vh-box.max .pe-vh { height: calc(100vh - 90px); }
.pe-vh-side { width: 210px; flex: none; display: flex; flex-direction: column; min-height: 0; }
.pe-seg { display: flex; gap: 2px; padding: 2px; margin-bottom: 8px; border-radius: 8px; background: var(--hover); }
.pe-seg button { flex: 1; height: 28px; border: 0; border-radius: 6px; background: transparent; color: var(--text); font: inherit; cursor: pointer; }
.pe-seg button.on { background: var(--panel); box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.pe-seg.icons { display: inline-flex; flex: none; align-self: flex-start; }
.pe-seg.icons button { width: 34px; flex: none; display: grid; place-items: center; }
.pe-seg svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.3; }
.pe-vh-list { flex: 1; overflow: auto; }
.pe-vh-day { padding: 10px 10px 4px; font-size: 11px; color: var(--text-dim); }
.pe-vh-v { position: relative; display: block; width: 100%; text-align: left; padding: 8px 10px; border: 0; border-radius: 6px; background: transparent; color: var(--text); font: inherit; cursor: pointer; }
.pe-vh-v.on { background: var(--hover); font-weight: 600; }
.pe-vh-v small { display: block; color: var(--text-dim); font-weight: 400; }
.pe-vh-name { position: absolute; right: 6px; top: 6px; opacity: 0; }
.pe-vh-v:hover .pe-vh-name { opacity: .8; }
.pe-vh-name svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.4; }
.pe-vh-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.pe-vh-diff { flex: 1; min-height: 0; overflow: auto; border: 1px solid var(--border); border-radius: 8px; display: flex; font: 12px/18px ui-monospace, SFMono-Regular, Consolas, monospace; }
.pe-vh-col { flex: 1; min-width: 0; overflow: hidden; }
.pe-vh-diff.two .pe-vh-col + .pe-vh-col { border-left: 1px solid var(--border); }
.pe-vh-ch { position: sticky; top: 0; padding: 8px 12px; background: var(--panel); font-family: inherit; font-weight: 600; border-bottom: 1px solid var(--border); }
.pe-vh-l { display: flex; white-space: pre; }
.pe-vh-l i { width: 44px; flex: none; text-align: right; padding-right: 8px; color: var(--text-dim); font-style: normal; }
.pe-vh-l span { overflow: hidden; text-overflow: ellipsis; }
.pe-vh-l.del { background: rgba(242,54,69,.28); }
.pe-vh-l.add { background: rgba(8,153,129,.28); }
.pe-vh-same { padding: 16px; }
.pe-cmd input { width: 100%; height: 36px; box-sizing: border-box; padding: 0 10px; margin-bottom: 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); color: var(--text); font: inherit; }
.pe-cmd-list { max-height: 50vh; overflow: auto; }
.pe-cmd-list button { display: flex; justify-content: space-between; width: 100%; padding: 7px 10px; border: 0; border-radius: 6px; background: transparent; color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.pe-cmd-list button.on, .pe-cmd-list button:hover { background: var(--hover); }
.pe-cmd-list kbd, .pe-keys kbd { color: var(--text-dim); font: 11px ui-monospace, monospace; }
.pe-keys div { display: flex; justify-content: space-between; padding: 6px 2px; border-bottom: 1px solid var(--border); }
.pe-howto p { line-height: 1.5; }
.pine-tables { position: absolute; inset: 0; pointer-events: none; z-index: 4; }
.pt-pos { position: absolute; display: flex; flex-direction: column; gap: 4px; pointer-events: auto; }
.pt-pos table { border-collapse: collapse; font-family: system-ui, sans-serif; }
.pt-pos td { padding: 2px 6px; white-space: nowrap; line-height: 1.3; }
.p-top_left { top: 26px; left: 8px; } .p-top_center { top: 26px; left: 50%; transform: translateX(-50%); align-items: center; } .p-top_right { top: 26px; right: 70px; align-items: flex-end; }
.p-middle_left { top: 50%; left: 8px; transform: translateY(-50%); } .p-middle_center { top: 50%; left: 50%; transform: translate(-50%, -50%); align-items: center; } .p-middle_right { top: 50%; right: 70px; transform: translateY(-50%); align-items: flex-end; }
.p-bottom_left { bottom: 28px; left: 8px; } .p-bottom_center { bottom: 28px; left: 50%; transform: translateX(-50%); align-items: center; } .p-bottom_right { bottom: 28px; right: 70px; align-items: flex-end; }
.view.scale-left .p-top_left, .view.scale-left .p-middle_left, .view.scale-left .p-bottom_left { left: 70px; }
.view.scale-left .p-top_right, .view.scale-left .p-middle_right, .view.scale-left .p-bottom_right { right: 8px; }
.pine-err { display: inline-grid; place-items: center; width: 14px; height: 14px; border-radius: 50%; background: var(--down); color: #fff; font-size: 10px; font-weight: 700; margin-right: 4px; cursor: help; }
.pine-set .pine-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; min-height: 44px; }
.pine-set .pine-row .pl { font-size: 14px; min-width: 90px; }
.pine-set .pine-row input[type="number"], .pine-set .pine-row input[type="text"], .pine-set .pine-row select, .pine-set .pine-row input[type="datetime-local"] {
  height: 32px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); padding: 0 8px; max-width: 170px; }
.pine-set .pine-row input[type="number"] { width: 90px; }
.pine-set .pine-row textarea { width: 100%; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); padding: 6px 8px; }
.pine-set .pine-row .ps-chk { min-height: 32px; }
.pine-set .info { display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; background: var(--hover); color: var(--text-dim); font-size: 10px; font-style: normal; font-weight: 700; cursor: help; }
.indx-scripts-bar { display: flex; gap: 8px; margin: 2px 0 14px; }
.indx-scripts-bar .btn { height: 32px; border-radius: 8px; padding: 0 12px; }
.indx-list li[data-script] .sub { margin-left: auto; font-size: 12px; color: var(--text-dim); }
.indx-list li[data-script] .fav { margin-left: 8px; opacity: 1; font-size: 14px; }

.pine-cv { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 3; }

/* line tool settings (lines, channels, pitchforks) */
.lt .lt-menu { flex: 1; min-width: 0; text-align: left; padding: 5px 8px; border: 1px solid var(--border); border-radius: 5px; background: transparent; color: var(--text); cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lt .lt-lvls { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; margin: 4px 0 8px; }
.lt .lt-lvl { display: flex; align-items: center; gap: 6px; }
.lt .lt-lvl input[type=number] { width: 64px; }
.lt .lt-pt input[type=number] { width: 110px; }
.lt .lt-text { width: 100%; box-sizing: border-box; margin: 8px 0; resize: vertical; background: var(--bg); color: var(--text); border: 1px solid var(--border); border-radius: 5px; padding: 6px 8px; font: inherit; }
.lt .lt-font { gap: 6px; justify-content: flex-start; }
.lt .lt-tog { width: 28px; height: 28px; border: 1px solid var(--border); border-radius: 5px; background: transparent; color: var(--text); cursor: pointer; }
.lt .lt-tog.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 18%, transparent); }
.cp-lbl { margin-top: 10px; font-size: 12px; color: var(--text-dim); }
.cp-lbl + .cp-styles { margin-top: 4px; }
.cp-widths i { display: block; width: 22px; background: currentColor; border-radius: 1px; }
.lt .lt-end { width: 78px; flex: none; }
.lt .ps-row .sw.line { flex: none; }

/* typing straight onto the chart: the drawing draws the text, this only holds the caret */
.text-edit.inline-edit { min-width: 0; padding: 1px 2px; font-weight: normal; color: transparent; background: transparent; border: 1px solid var(--accent);
  border-radius: 2px; resize: none; overflow: hidden; white-space: pre; box-sizing: border-box; }
.text-edit.inline-edit::selection { background: color-mix(in srgb, var(--accent) 35%, transparent); color: transparent; }
.lt .lt-emoji { width: 34px; height: 28px; border: 1px solid var(--border); border-radius: 5px; background: transparent; font-size: 16px; cursor: pointer; }
.lt .lt-n { min-width: 40px; font-size: 12px; }

/* replay trading: order ticket (TradingView's fields: label menus, ⇄ swap, equivalent value dropdowns) */
.rt-ticket { overflow-y: auto; width: 300px; }
.rt-ticket.docked { border-radius: 8px 0 0 8px; }
.rt-tk-head .rt-ic { width: 28px; height: 28px; }
.rt-tk-head .rt-ic svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.5; }
.rt-tk-head .rt-ic svg circle { fill: currentColor; stroke: none; }
.rt-tk-types { position: relative; border-bottom: 0; padding-bottom: 3px; }
.rt-tk-types::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; border-radius: 2px; background: var(--border); }
.rt-tk-types .rt-slider { position: absolute; bottom: 0; height: 3px; width: 25%; left: calc(var(--i) * 25%); border-radius: 2px; background: var(--text); z-index: 1; transition: left .15s; }
.rt-tk-types button { border-bottom: 0; }
.rt-lbl { display: inline-flex; align-items: center; gap: 2px; padding: 0; border: 0; background: transparent; color: var(--text-dim); font: inherit; font-size: 12px; cursor: pointer; }
.rt-lbl:hover { color: var(--text); }
.rt-chev { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.rt-tk-field { display: flex; align-items: center; gap: 4px; height: 34px; padding: 0 4px 0 0; border: 1px solid var(--border); border-radius: 6px; background: var(--chart-bg); }
.rt-tk-field:focus-within { border-color: #2962ff; }
.rt-tk-field input { flex: 1; min-width: 0; height: 100%; padding: 0 8px; border: 0 !important; background: transparent; color: var(--text); font: inherit; outline: none; box-shadow: none !important; }
.rt-tk-field.off { opacity: .5; }
.rt-swap { width: 24px; height: 24px; display: grid; place-items: center; border: 0; border-radius: 5px; background: transparent; color: var(--text-dim); cursor: pointer; flex: none; }
.rt-swap:hover { background: var(--hover); color: var(--text); }
.rt-swap svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.rt-eq { display: inline-flex; align-items: center; gap: 2px; height: 26px; padding: 0 4px 0 8px; border: 0; border-radius: 5px; background: transparent; color: var(--text-dim); font: inherit; font-size: 12px; cursor: pointer; white-space: nowrap; max-width: 55%; overflow: hidden; }
.rt-eq:hover { background: var(--hover); color: var(--text); }
.rt-eqtxt { color: var(--text-dim); font-size: 12px; padding: 0 6px; white-space: nowrap; }
.rt-ticket .rt-tk-l { display: flex; margin: 10px 0 5px; }
.rt-tk-sec { display: flex; width: 100%; justify-content: space-between; align-items: center; padding: 0; border: 0; background: transparent; color: var(--text); font: inherit; font-weight: 600; cursor: pointer; }
.rt-tk-x { margin: 12px 0 5px; }

/* ================================================================== right sidebar (TradingView's): panels + icon strip */
.side { flex: none; width: auto; display: flex; flex-direction: row; position: relative; background: var(--chart-bg); border-left: 1px solid var(--border); min-height: 0; }
.side-main { width: var(--side-w, 320px); display: flex; flex-direction: column; min-height: 0; min-width: 0; border-right: 1px solid var(--border); }
.side.collapsed .side-main, .side.collapsed .side-resize { display: none; }
.side-resize { position: absolute; left: -3px; top: 0; bottom: 0; width: 6px; cursor: col-resize; z-index: 5; }
.side-resize:hover { background: color-mix(in srgb, var(--accent) 35%, transparent); }
.side-strip { width: 44px; flex: none; display: flex; flex-direction: column; align-items: center; gap: 6px; padding-top: 6px; background: var(--chart-bg); }
.side-strip button { position: relative; width: 36px; height: 36px; display: grid; place-items: center; border: 0; border-radius: 7px; background: transparent; color: var(--text); cursor: pointer; }
.side-strip button:hover { background: var(--hover); }
.side-strip button.on { background: var(--hover); box-shadow: inset 0 0 0 1px var(--border); }
.side-strip svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.3; stroke-linejoin: round; stroke-linecap: round; }
.side-strip .count { position: absolute; top: 1px; right: 0; min-width: 15px; height: 15px; padding: 0 3px; border-radius: 8px; background: var(--accent); color: #fff; font-size: 10px; line-height: 15px; }
.side-strip .count:empty { display: none; }
.sp { flex: 1; display: flex; flex-direction: column; min-height: 0; font-size: 13px; }
.sp[hidden] { display: none; }
.sp-head, .sp-tools { display: flex; align-items: center; gap: 2px; height: 40px; padding: 0 6px 0 8px; flex: none; }
.sp-tools { height: 36px; border-bottom: 1px solid var(--border); }
.sp-ic { width: 30px; height: 30px; display: grid; place-items: center; border: 0; border-radius: 6px; background: transparent; color: var(--text); cursor: pointer; flex: none; }
.sp-ic:hover:not(:disabled), .sp-ic.on { background: var(--hover); }
.sp-ic:disabled { opacity: .35; cursor: default; }
.sp-ic svg, .sp svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
.sp svg circle[r="1.6"] { fill: currentColor; stroke: none; }
.sp-seg { display: flex; margin: 8px 8px 4px; padding: 2px; border-radius: 8px; background: var(--hover); flex: none; }
.sp-seg button { flex: 1; height: 28px; border: 0; border-radius: 6px; background: transparent; color: var(--text-dim); cursor: pointer; font: inherit; }
.sp-seg button.on { background: color-mix(in srgb, var(--text) 18%, var(--panel)); color: var(--text); font-weight: 600; }
.sp-empty { padding: 16px; color: var(--text-dim); text-align: center; font-size: 12px; }
.sp-blank { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 48px 20px; text-align: center; color: var(--text-dim); }
.sp .sp-blank svg { width: 64px; height: 64px; stroke-width: 1.1; color: var(--text); }
.sp-blank p { margin: 0; line-height: 1.45; }
.sp-sec-t { font-weight: 600; margin: 14px 0 6px; }
.sp .up { color: #089981; }
.sp .down { color: #f23645; }

/* watchlist */
.wl-name { display: inline-flex; align-items: center; gap: 2px; height: 30px; padding: 0 6px; border: 0; border-radius: 6px; background: transparent; color: var(--text); font: inherit; font-weight: 600; cursor: pointer; max-width: 60%; }
.wl-name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wl-name:hover { background: var(--hover); }
.sp .wl-name svg { width: 16px; height: 16px; }
.wl-cols { display: grid; grid-template-columns: var(--wl-grid); align-items: center; height: 26px; border-bottom: 1px solid var(--border); flex: none; padding-right: 8px; }
.wl-cols button { border: 0; background: transparent; color: var(--text-dim); font: inherit; font-size: 12px; text-align: left; cursor: pointer; padding: 0 4px; white-space: nowrap; overflow: hidden; }
.wl-cols button.r { text-align: right; }
.wl-cols button:hover { color: var(--text); }
.wl-cols .wl-h-flag { padding: 0; display: grid; place-items: center; }
.sp .wl-cols .wl-h-flag svg { width: 13px; height: 13px; }
.sp.cards .wl-cols { display: none; }
.wl-list { flex: 0 1 calc(var(--wl-split, .45) * 100%); overflow-y: auto; min-height: 60px; outline: none; }
.wl-row { position: relative; display: grid; grid-template-columns: var(--wl-grid); align-items: center; height: 30px; padding-right: 8px; border-bottom: 1px solid color-mix(in srgb, var(--border) 60%, transparent); cursor: pointer; font-variant-numeric: tabular-nums; }
.wl-row:hover { background: var(--hover); }
.wl-row.act { background: color-mix(in srgb, var(--hover) 60%, transparent); }
.wl-row.sel { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--text) 55%, transparent); border-radius: 4px; }
.wl-row.drop, .wl-sec.drop { box-shadow: inset 0 2px 0 var(--accent); }
.wl-flag { width: 10px; height: 14px; justify-self: start; opacity: 0; background: var(--text-dim); clip-path: polygon(0 0, 100% 0, 70% 50%, 100% 100%, 0 100%); }
.wl-row:hover .wl-flag { opacity: .5; }
.wl-flag.on { opacity: 1 !important; background: var(--fc); }
.wl-s { display: flex; align-items: center; gap: 6px; min-width: 0; padding-left: 2px; }
.wl-s .sym-badge { flex: none; }
.wl-t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wl-has-note { font-style: normal; color: var(--text-dim); font-size: 11px; }
.wl-c { text-align: right; white-space: nowrap; overflow: hidden; padding-left: 4px; }
.wl-c sup, .sd-last sup { font-size: 70%; vertical-align: super; line-height: 0; }
.wl-del { position: absolute; right: 6px; top: 4px; width: 22px; height: 22px; display: none; place-items: center; border: 0; border-radius: 4px; background: var(--hover); color: var(--text-dim); cursor: pointer; }
.sp .wl-del svg { width: 16px; height: 16px; }
.wl-row:hover .wl-del { display: grid; }
.wl-del:hover { color: var(--text); }
.wl-sec { display: flex; align-items: center; gap: 6px; height: 30px; padding: 0 8px 0 4px; border-bottom: 1px solid color-mix(in srgb, var(--border) 60%, transparent); color: var(--text-dim); font-size: 12px; cursor: pointer; letter-spacing: .3px; }
.wl-sec:hover { background: var(--hover); }
.sp .wl-caret svg { width: 16px; height: 16px; transition: transform .15s; }
.wl-sec.closed .wl-caret svg, .wl-caret.closed svg { transform: rotate(-90deg); }
.sp.cards .wl-row { grid-template-columns: 16px 1fr auto; height: 46px; }
.sp.cards .wl-s small { display: block; color: var(--text-dim); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 150px; }
.wl-card-r { text-align: right; font-size: 12px; }
.wl-card-r .wl-cl { font-size: 13px; }
.wl-split { height: 5px; flex: none; cursor: row-resize; border-top: 1px solid var(--border); background: var(--chart-bg); }
.wl-split:hover { background: color-mix(in srgb, var(--accent) 35%, transparent); }
.wl-open .ask-in, .ask-in { width: 100%; box-sizing: border-box; }
.wl-open-list { margin-top: 8px; max-height: 50vh; overflow-y: auto; }
.wl-open-row { display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: 6px; cursor: pointer; }
.wl-open-row:hover, .wl-open-row.on { background: var(--hover); }
.wl-open-row span { flex: 1; }
.wl-open-row small { color: var(--text-dim); }
.wl-open-row button { width: 24px; height: 24px; display: grid; place-items: center; border: 0; background: transparent; color: var(--text-dim); border-radius: 4px; cursor: pointer; }
.wl-open-row svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.5; }
.wl-adv { max-height: 70vh; overflow: auto; }
.wl-adv tr[data-sym] { cursor: pointer; }
.wl-adv tr[data-sym]:hover td { background: var(--hover); }
.wl-adv .up { color: #089981; } .wl-adv .down { color: #f23645; }

/* symbol details */
.sd { flex: 1; overflow-y: auto; padding: 0 12px 16px; min-height: 0; }
.sd-head { display: flex; align-items: center; gap: 8px; height: 44px; }
.sd-head b { font-size: 14px; }
.sd-name { color: var(--text); font-size: 12px; }
.sd-type { color: var(--text-dim); font-size: 12px; margin-top: 2px; }
.sd-price { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; margin-top: 12px; font-variant-numeric: tabular-nums; }
.sd-last { font-size: 26px; font-weight: 600; }
.sd-last sup { font-size: 15px; vertical-align: 10px; margin-left: 1px; }
.sd-ccy { font-size: 11px; color: var(--text-dim); }
.sd-chg { font-size: 15px; font-weight: 600; }
.sd-chg + .sd-chg { margin-left: 2px; }
.sd-mkt { margin-top: 2px; font-size: 12px; color: var(--text-dim); }
.sd-mkt::before { content: ''; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--text-dim); margin-right: 6px; }
.sd-mkt.open { color: #089981; } .sd-mkt.open::before { background: #089981; }
.sd-vol { margin-top: 14px; font-size: 12px; color: var(--text-dim); }
.sd-vol-l { display: flex; justify-content: space-between; }
.sd-vol-l b { display: block; color: var(--text); font-weight: 400; margin-top: 1px; }
.sd-vol-l .r { text-align: right; }
.sd-bar { display: flex; gap: 2px; height: 5px; margin-top: 6px; }
.sd-bar i { border-radius: 3px; background: #3179f5; }
.sd-bar i + i { background: #26c6da; }
.sd-card { margin-top: 14px; padding: 10px 12px; border-radius: 8px; background: #241b33; font-size: 12px; line-height: 1.45; }
:root[data-theme="light"] .sd-card { background: #f0ebfa; }
.sd-card.sd-note { background: var(--hover); cursor: pointer; white-space: pre-wrap; }
.sd-ev { color: #a588f2; }
.sd-ev-t { margin-top: 4px; text-transform: uppercase; }
.sd-perf { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.sd-tile { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 7px 0 6px; border-radius: 4px; background: var(--hover); font-size: 12px; }
.sd-tile b { font-weight: 600; }
.sd-tile span { font-size: 11px; color: var(--text); }
.sd-tile.down { color: #f7525f; }
.sd-tile.up { color: #22ab94; }
.sd-seas-w { position: relative; padding-bottom: 20px; }
.sd-seas-p { position: relative; }
.sp svg.sd-seas { display: block; width: 100%; height: 118px; overflow: visible; stroke: none; }
.sd-seas .sd-grid { stroke: var(--text-dim); stroke-opacity: .55; stroke-dasharray: 4 4; }
.sd-seas .sd-zero { stroke: var(--text); stroke-opacity: .8; }
.sd-seas-dot { position: absolute; width: 8px; height: 8px; margin: -4px 0 0 -4px; border-radius: 50%; background: #3179f5; }
.sd-seas-ax { position: absolute; left: 0; right: 0; bottom: 0; height: 16px; font-size: 12px; font-weight: 600; color: var(--text); }
.sd-seas-ax span { position: absolute; top: 0; }
.sd-legend { display: flex; justify-content: center; gap: 14px; font-size: 11px; margin-top: 8px; color: var(--text-dim); }
.sd-legend i { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 5px; }
.sd-gauge { display: flex; flex-direction: column; align-items: center; padding-top: 4px; }
.sp .sd-gauge svg { width: 170px; height: 90px; stroke: none; }
.sd-gauge .sd-needle { fill: var(--text-dim); stroke: var(--text-dim); stroke-width: 2; stroke-linejoin: round; }
.sd-gauge b { font-size: 20px; font-weight: 600; margin-top: 2px; color: var(--text-dim); }

/* alerts */
.al-search { padding: 6px 8px; border-bottom: 1px solid var(--border); flex: none; }
.al-search[hidden] { display: none; }
.al-search input { width: 100%; box-sizing: border-box; }
.al-list { flex: 1; overflow-y: auto; min-height: 0; }
.al-row { position: relative; display: flex; gap: 8px; padding: 10px 10px 10px 12px; border-bottom: 1px solid color-mix(in srgb, var(--border) 60%, transparent); cursor: pointer; }
.al-row:hover { background: var(--hover); }
.al-row.off { opacity: .65; }
.al-row .sym-badge { flex: none; margin-top: 1px; }
.al-main { flex: 1; min-width: 0; }
.al-l1 { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.al-l1 span { color: var(--text-dim); font-size: 12px; }
.sp .al-src svg { width: 15px; height: 15px; color: var(--text-dim); }
.al-msg { margin-top: 3px; font-size: 12px; white-space: pre-wrap; }
.al-st { margin-top: 3px; font-size: 11px; color: var(--text-dim); }
.al-st .on { color: #089981; }
.al-acts { display: none; gap: 2px; align-items: flex-start; }
.al-row:hover .al-acts { display: flex; }
.al-acts button { width: 26px; height: 26px; display: grid; place-items: center; border: 0; border-radius: 5px; background: transparent; color: var(--text-dim); cursor: pointer; }
.al-acts button:hover { background: var(--panel); color: var(--text); }
.sp .al-acts svg { width: 16px; height: 16px; }

/* object tree and data window */
.ot-body { flex: 1; overflow-y: auto; min-height: 0; display: flex; flex-direction: column; }
.ot-tools { display: flex; gap: 2px; padding: 4px 6px; border-bottom: 1px solid var(--border); flex: none; }
.ot-list { padding: 4px 0; }
.ot-row { display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 8px 0 12px; cursor: pointer; }
.ot-row:hover { background: var(--hover); }
.ot-row.sel { background: color-mix(in srgb, #2962ff 30%, var(--chart-bg)); }
.ot-row.off > span:not(.ot-acts), .ot-row.off > svg { opacity: .45; }
.ot-row.in { padding-left: 34px; }
.ot-row.main { cursor: default; }
.ot-row.main:hover { background: transparent; }
.ot-row > span:not(.ot-acts):not(.ot-ti) { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ot-row b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ot-ti { width: 20px; height: 20px; display: grid; place-items: center; flex: none; color: var(--text-dim); }
.ot-ti svg { width: 20px; height: 20px; }
.ot-acts { display: none; gap: 2px; margin-left: auto; }
.ot-row:hover .ot-acts { display: flex; }
.ot-acts button { width: 26px; height: 26px; display: grid; place-items: center; border: 0; border-radius: 5px; background: transparent; color: var(--text-dim); cursor: pointer; }
.ot-acts button:hover { color: var(--text); background: var(--panel); }
.sp .ot-acts svg { width: 16px; height: 16px; }
.dw-sec { padding: 8px 12px; border-bottom: 1px solid var(--border); }
.dw-t { display: flex; align-items: center; gap: 8px; font-weight: 600; margin: 4px 0 8px; }
.dw-row { display: flex; justify-content: space-between; height: 22px; align-items: center; font-variant-numeric: tabular-nums; }
.dw-row b { font-weight: 400; }
.sp .grow { flex: 1; }
.sp .sp-blank .btn { background: var(--text); color: var(--chart-bg); border: 0; border-radius: 6px; padding: 6px 14px; font-weight: 500; cursor: pointer; }

/* Pine indicator settings (TradingView layout) */
.pine-set .pst-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 44px; }
.pine-set .pst-row .ps-chk { min-height: 0; flex: 1 1 auto; min-width: 0; }
.pine-set .pst-row .ps-chk span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pine-set .pst-ctl { display: inline-flex; align-items: center; gap: 6px; flex: none; }
.pine-set .pst-type { color: var(--text-dim); padding: 0 6px; }
.pine-set .pst-val { height: 34px; width: 90px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); padding: 0 10px; }
.pine-set .pine-row select, .pine-set .pine-row input[type="number"], .pine-set .pine-row input[type="text"], .pine-set .pine-row input[type="datetime-local"] { height: 34px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); padding: 0 10px; min-width: 110px; }
.pine-set .pine-row textarea { width: 100%; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); padding: 6px 10px; }
.pine-set .pine-row .pl { flex: 1 1 auto; }
.pine-set .pine-row.off, .pine-set .ps-chk.off { opacity: .45; }
.pine-set .info { display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; border: 1px solid var(--text-dim); color: var(--text-dim); font-size: 10px; font-style: normal; cursor: help; }

/* Go to (date / custom range), like TradingView */
.goto-btn { display: grid; place-items: center; width: 30px; height: 26px; border: 0; border-radius: 4px; background: transparent; color: var(--text-dim); cursor: pointer; }
.goto-btn:hover { background: var(--hover); color: var(--text); }
.goto { padding: 0 20px 16px; }
.goto .gt-row { display: grid; grid-template-columns: 1fr 96px; gap: 8px; margin-bottom: 8px; }
.goto .gt-row input { height: 34px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); color: var(--text); padding: 0 8px; color-scheme: dark; }
.goto .gt-row input:focus { outline: none; border-color: var(--accent); }
.goto .gt-mon { display: flex; align-items: center; justify-content: space-between; margin: 8px 0 6px; }
.goto .gt-mon button { width: 28px; height: 28px; border: 0; border-radius: 6px; background: transparent; color: var(--text); font-size: 18px; cursor: pointer; }
.goto .gt-mon button:disabled { opacity: .3; cursor: default; }
.goto .gt-mon b { font-weight: 500; }
.goto .gt-dow, .goto .gt-days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; text-align: center; }
.goto .gt-dow span { font-size: 12px; color: var(--text-dim); padding: 4px 0; }
.goto .gt-days button { height: 32px; border: 0; border-radius: 6px; background: transparent; color: var(--text); cursor: pointer; }
.goto .gt-days button:hover:not(:disabled) { background: var(--hover); }
.goto .gt-days button:disabled { color: var(--text-dim); opacity: .45; cursor: default; }
.goto .gt-days button.today { box-shadow: inset 0 0 0 1px var(--text-dim); }
.goto .gt-days button.inr { background: var(--hover); }
.goto .gt-days button.sel { background: var(--text); color: var(--panel); }

/* Status line background, like TradingView: a square strip of the chart background behind each row, as wide as its text */
.legend.bg { background: none !important; border-radius: 0; padding: 0; }
.sl-bg .legend .row, .sl-bg .legend .ind, .sl-bg .pane-label .ind { background: var(--sl-bg); border-radius: 0; width: fit-content; min-height: 24px; padding: 0 4px 0 1px; margin-top: 0; }
.sl-bg .legend .ind:hover, .sl-bg .pane-label .ind:hover { background: var(--sl-bg); }
.sl-bg .pane-label:hover { background: none; }
/* the strip ends at the text; the eye / gear / remove buttons appear on hover */
.sl-bg .legend .ind:not(:hover):not(.sel) .acts, .sl-bg .pane-label .ind:not(:hover):not(.sel) .acts { display: none; }

/* "Practice risk-free" window (TradingView's, shown when trading without a connected account) */
.practice { padding: 4px 48px 18px; }
.practice h2 { font-size: 20px; font-weight: 600; margin: 8px 0 18px; }
.practice .pr-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 30px; }
.practice .pr-card { display: flex; align-items: center; justify-content: center; gap: 16px; height: 112px; border: 1px solid var(--border); border-radius: 8px; background: transparent; color: var(--text); cursor: pointer; text-align: left; }
.practice .pr-card:hover { background: var(--hover); }
.practice .pr-card b { display: block; font-weight: 400; font-size: 14px; }
.practice .pr-card small { display: block; color: var(--text-dim); font-size: 11px; line-height: 1.3; margin-top: 3px; }
.practice .pr-ic { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 8px; background: #fff; color: #000; }
.practice .pr-head { display: flex; align-items: center; gap: 10px; }
.practice .pr-head h2 { flex: 1; margin: 0 0 14px; }
.practice .pr-q { height: 32px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); color: var(--text); padding: 0 10px; margin-bottom: 14px; }
.practice .pr-search { border: 0; background: transparent; color: var(--text); cursor: pointer; margin-bottom: 14px; }
.practice .pr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.practice .pr-broker { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; height: 150px; border: 1px solid var(--border); border-radius: 8px; background: transparent; color: var(--text); cursor: pointer; font-size: 14px; }
.practice .pr-broker:hover { background: var(--hover); }
.practice .pr-logo { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 8px; color: #fff; font-weight: 700; }
/* TradingView's connect box, over the Practice dialog */
.practice { position: relative; }
.practice .pr-pop-back { position: absolute; inset: -60px -2px -2px; display: grid; place-items: center; background: rgba(0,0,0,0.55); border-radius: 8px; z-index: 5; }
.practice .pr-pop { position: relative; width: min(480px, calc(100% - 32px)); background: var(--panel, #1e222d); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 12px 40px rgba(0,0,0,0.5); padding: 40px 40px 0; overflow: hidden; }
.practice .pr-pop-x { position: absolute; top: 18px; right: 18px; width: 28px; height: 28px; display: grid; place-items: center; border: 0; border-radius: 6px; background: transparent; color: var(--text); cursor: pointer; }
.practice .pr-pop-x:hover { background: var(--hover); }
.practice .pr-pop-x svg { width: 18px; height: 18px; }
.practice .pr-pop-head { display: flex; align-items: center; gap: 16px; margin-bottom: 32px; }
.practice .pr-pop-head b { font-size: 18px; font-weight: 600; }
.practice .pr-pop-go { display: block; width: 100%; height: 48px; border: 0; border-radius: 8px; background: #fff; color: #000; font-size: 15px; cursor: pointer; margin-bottom: 18px; }
.practice .pr-pop-go:hover { background: #e0e3eb; }
.practice .pr-pop p { margin: 0 0 18px; color: var(--text-dim); font-size: 13px; line-height: 1.5; }
.practice .pr-pop-foot { margin: 0 -40px; padding: 12px; text-align: center; font-size: 12px; color: var(--text-dim); background: rgba(127,127,127,0.08); border-top: 1px solid var(--border); }
.practice .pr-pop-foot button { border: 0; background: none; padding: 0; color: #2962ff; font: inherit; cursor: pointer; }
.practice .pr-need { display: flex; align-items: center; gap: 8px; margin: 22px auto 0; border: 0; background: transparent; color: var(--text); font-size: 14px; cursor: pointer; }
.rt-head .rt-disc { height: 26px; padding: 0 10px; font-size: 12px; margin-right: 6px; }

/* Sell / buy buttons, TradingView's: outlined boxes (filled during Bar Replay), price with a raised last digit, spread between */
.legend .rt-btns { display: flex; align-items: center; gap: 8px; margin-top: 4px; width: fit-content; pointer-events: auto; }
.rt-btn { display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 67px; height: 34px; padding: 0 10px 2px; border-radius: 6px; background: var(--chart-bg, #000); font: inherit; cursor: pointer; filter: none; }
.rt-btn b { font-size: 12px; font-weight: 600; line-height: 16px; }
.rt-btn b sup { font-size: 10px; line-height: 0; vertical-align: top; position: relative; top: 1px; }
.rt-btn small { font-size: 11px; line-height: 12px; text-transform: uppercase; letter-spacing: .4px; }
.rt-btn.sell { border: 1px solid #f23645; color: #f23645; border-radius: 6px; background: var(--chart-bg, #000); }
.rt-btn.buy { border: 1px solid #2962ff; color: #2962ff; border-radius: 6px; background: var(--chart-bg, #000); }
.rt-btn:hover { filter: none; }
.rt-btn.sell:hover { background: rgba(242,54,69,.12); }
.rt-btn.buy:hover { background: rgba(41,98,255,.12); }
.rt-btns.solid .rt-btn.sell { background: #f23645; color: #fff; }
.rt-btns.solid .rt-btn.buy { background: #2962ff; color: #fff; }
.legend .rt-spread { font-size: 10px; color: #dbdbdb; min-width: 14px; text-align: center; padding: 0; background: none; align-self: center; }

/* Settings dialog: as tall as the open tab needs, like TradingView (it scrolls only if the window is smaller) */
.cs { height: auto; max-height: calc(100vh - 150px); }

/* indicator settings Inputs tab, like TradingView: inline groups on one row with compact controls, lone inputs in a right column */
.pine-set .pine-row { flex-wrap: nowrap; gap: 8px; min-height: 46px; }
.pine-set .pine-row .pl { flex: none; min-width: 0; font-size: 14px; white-space: nowrap; }
.pine-set .pine-row > .pl:first-child { min-width: 92px; }
.pine-set .pine-row.single > .pl:first-child { width: 200px; }
.pine-set .pine-row select { min-width: 0; width: auto; max-width: 126px; text-overflow: ellipsis; padding: 0 6px; }
.pine-set .pine-row input[type="number"], .pine-set .pine-row input[type="text"] { min-width: 0; width: 96px; }
.pine-set .pine-row.single select { max-width: 160px; }
.pine-set .pine-row .ps-chk { flex: none; white-space: nowrap; min-height: 32px; }
.pine-set .pine-row .info { flex: none; margin-left: 2px; }
.pine-set .pine-row .sw { flex: none; }

/* Pine tables moved to the bottom panel (indicator menu › Move tables to bottom panel) */
.pine-tables-dock { flex: none; display: flex; gap: 16px; overflow-x: auto; max-height: 180px; padding: 6px 10px; border-top: 1px solid var(--border); background: var(--panel); }
.pine-tables-dock[hidden] { display: none; }
.pine-tables.docked { position: static; display: flex; flex-direction: column; gap: 4px; pointer-events: auto; }
.pine-tables.docked .ptd-h { font-size: 12px; color: var(--text-dim); cursor: default; }
.pine-tables.docked .pt-pos.p-docked { position: static; flex-direction: row; }

/* long menu labels end with an ellipsis, like TradingView ("Add alert on VIP Smart Model (0, Automatic, 60, D…") */
.ctx-menu .lbl { max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.pine-set .pine-busy { margin-left: 10px; font-size: 12px; color: var(--text-dim); }
.pine-set .pine-busy[hidden] { display: none; }

/* ---------- accounts: sign-in screen, account button, Admin panel ---------- */
#authGate { --ag-bg: #070a12; --ag-text: #e8ecf4; --ag-dim: #8b93a7; --ag-line: rgba(255,255,255,.08); --ag-blue: #3d7bfd; --ag-cyan: #22d3ee; --ag-up: #16b979; --ag-down: #f0445a;
  position: fixed; inset: 0; z-index: 1000; overflow: auto; display: flex; flex-direction: column; background: var(--ag-bg); color: var(--ag-text);
  font: 15px/1.5 Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Ubuntu, sans-serif; -webkit-font-smoothing: antialiased; }
#authGate .ag-bg { position: fixed; inset: 0; overflow: hidden; pointer-events: none; }
#authGate .ag-grid { position: absolute; inset: 0; background-image: linear-gradient(var(--ag-line) 1px, transparent 1px), linear-gradient(90deg, var(--ag-line) 1px, transparent 1px);
  background-size: 56px 56px; mask-image: radial-gradient(ellipse 80% 70% at 50% 40%, #000 30%, transparent 85%); -webkit-mask-image: radial-gradient(ellipse 80% 70% at 50% 40%, #000 30%, transparent 85%); opacity: .6; }
#authGate .ag-glow { position: absolute; border-radius: 50%; filter: blur(90px); opacity: .45; }
#authGate .ag-glow.g1 { width: 620px; height: 620px; left: -160px; top: -200px; background: radial-gradient(circle, #2a5bff 0%, transparent 70%); }
#authGate .ag-glow.g2 { width: 560px; height: 560px; right: -180px; bottom: -220px; background: radial-gradient(circle, #0fb5c9 0%, transparent 70%); opacity: .3; }
#authGate .ag-chart-wrap { position: absolute; left: 0; right: 0; bottom: 6%; height: 52%; overflow: hidden; opacity: .32;
  mask-image: linear-gradient(90deg, transparent, #000 15%, #000 85%, transparent), linear-gradient(transparent, #000 25%);
  -webkit-mask-image: linear-gradient(to top, transparent 0%, #000 35%, #000 80%, transparent 100%); }
#authGate .ag-chart { position: absolute; left: 0; top: 0; width: 200%; height: 100%; animation: ag-scroll 90s linear infinite; }
#authGate .ag-chart line { stroke-width: 1.4; }
#authGate .ag-chart .u { stroke: var(--ag-up); fill: var(--ag-up); }
#authGate .ag-chart .d { stroke: var(--ag-down); fill: var(--ag-down); }
#authGate .ag-chart .ma { fill: none; stroke: #7aa2ff; stroke-width: 2; opacity: .8; vector-effect: non-scaling-stroke; }
@keyframes ag-scroll { to { transform: translateX(-50%); } }
#authGate .ag-bg::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(7,10,18,.92) 0%, rgba(7,10,18,.75) 38%, rgba(7,10,18,.15) 62%, transparent 75%); }
@media (max-width: 900px) { #authGate .ag-bg::after { background: linear-gradient(180deg, rgba(7,10,18,.2), rgba(7,10,18,.85) 60%); } }
@media (prefers-reduced-motion: reduce) { #authGate .ag-chart { animation: none; } }

#authGate .ag-top { position: relative; display: flex; align-items: center; gap: 10px; padding: 22px 40px; font-weight: 700; font-size: 17px; letter-spacing: .2px; }
#authGate .ag-mark { width: 34px; height: 34px; border-radius: 9px; object-fit: cover; box-shadow: 0 0 0 1px var(--ag-line); }
#authGate .ag-main { position: relative; flex: 1; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(320px, 420px); gap: 64px; align-items: center;
  width: min(1180px, 100%); margin: 0 auto; padding: 24px 40px 40px; box-sizing: border-box; }
#authGate .ag-pill { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px; font-size: 12.5px; font-weight: 600; color: #b9c6ff;
  background: rgba(61,123,253,.12); border: 1px solid rgba(61,123,253,.35); }
#authGate .ag-pill i { width: 7px; height: 7px; border-radius: 50%; background: var(--ag-up); box-shadow: 0 0 0 0 rgba(22,185,121,.6); animation: ag-pulse 2s infinite; }
@keyframes ag-pulse { 70% { box-shadow: 0 0 0 8px rgba(22,185,121,0); } 100% { box-shadow: 0 0 0 0 rgba(22,185,121,0); } }
#authGate h1 { margin: 18px 0 14px; font-size: clamp(34px, 4.6vw, 56px); line-height: 1.06; letter-spacing: -1.4px; font-weight: 800; }
#authGate h1 em { font-style: normal; background: linear-gradient(90deg, #6f9bff, var(--ag-cyan)); -webkit-background-clip: text; background-clip: text; color: transparent; }
#authGate .ag-lead { max-width: 540px; margin: 0 0 30px; color: var(--ag-dim); font-size: 17px; }
#authGate .ag-feats { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 14px 22px; max-width: 640px; }
#authGate .ag-feats li { display: flex; gap: 12px; align-items: flex-start; }
#authGate .ag-feats b { display: block; font-size: 14.5px; font-weight: 650; }
#authGate .ag-feats small { display: block; color: var(--ag-dim); font-size: 13px; line-height: 1.45; margin-top: 2px; }
#authGate .ag-ic { flex: none; width: 38px; height: 38px; display: grid; place-items: center; border-radius: 10px; color: #8fb0ff;
  background: linear-gradient(180deg, rgba(61,123,253,.18), rgba(61,123,253,.06)); border: 1px solid rgba(61,123,253,.25); }
#authGate .ag-ic svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

#authGate .ag-card { position: relative; padding: 36px 32px 28px; border-radius: 20px; text-align: center;
  background: linear-gradient(180deg, rgba(22,27,40,.92), rgba(14,18,28,.92)); border: 1px solid rgba(255,255,255,.09);
  box-shadow: 0 30px 80px rgba(0,0,0,.55), inset 0 1px 0 rgba(255,255,255,.06); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
#authGate .ag-card::before { content: ""; position: absolute; inset: -1px; border-radius: 21px; padding: 1px; pointer-events: none;
  background: linear-gradient(140deg, rgba(111,155,255,.6), transparent 40%, transparent 60%, rgba(34,211,238,.45));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; }
#authGate .ag-logo { width: 64px; height: 64px; border-radius: 16px; object-fit: cover; box-shadow: 0 10px 30px rgba(61,123,253,.35); }
#authGate h2 { margin: 16px 0 6px; font-size: 26px; font-weight: 750; letter-spacing: -.4px; }
#authGate .ag-sub { margin: 0 0 22px; color: var(--ag-dim); }
#authGate .ag-google { display: flex; justify-content: center; min-height: 44px; }
#authGate .ag-load { width: 300px; max-width: 100%; height: 44px; border-radius: 22px; background: linear-gradient(90deg, rgba(255,255,255,.05), rgba(255,255,255,.12), rgba(255,255,255,.05)); background-size: 200% 100%; animation: ag-shine 1.2s infinite; }
@keyframes ag-shine { to { background-position: -200% 0; } }
#authGate .ag-err { margin: 12px 0 0; color: #ff6b7d; font-size: 13.5px; }
#authGate .ag-div { display: flex; align-items: center; gap: 10px; margin: 24px 0 14px; color: var(--ag-dim); font-size: 12px; }
#authGate .ag-div::before, #authGate .ag-div::after { content: ""; flex: 1; height: 1px; background: var(--ag-line); }
#authGate .ag-small { margin: 0; color: #6f778b; font-size: 12px; line-height: 1.5; }
#authGate .ag-status { width: 56px; height: 56px; margin: 0 auto; display: grid; place-items: center; border-radius: 50%; }
#authGate .ag-status svg { width: 28px; height: 28px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
#authGate .ag-status.wait { color: #f5a524; background: rgba(245,165,36,.12); box-shadow: 0 0 0 8px rgba(245,165,36,.06); }
#authGate .ag-status.off { color: var(--ag-down); background: rgba(240,68,90,.12); box-shadow: 0 0 0 8px rgba(240,68,90,.06); }
#authGate .ag-user { display: flex; align-items: center; gap: 12px; margin: 6px 0 22px; padding: 12px 14px; border-radius: 12px; text-align: left; background: rgba(255,255,255,.04); border: 1px solid var(--ag-line); }
#authGate .ag-user img, #authGate .ag-user i { width: 40px; height: 40px; border-radius: 50%; flex: none; }
#authGate .ag-user i { display: grid; place-items: center; font-style: normal; font-weight: 700; background: var(--ag-blue); }
#authGate .ag-user b { display: block; font-size: 14.5px; }
#authGate .ag-user span { display: block; color: var(--ag-dim); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; }
#authGate .ag-row { display: flex; flex-direction: column; gap: 10px; }
#authGate .ag-row button { height: 44px; border-radius: 999px; border: 1px solid rgba(255,255,255,.14); background: transparent; color: var(--ag-text); font: 600 14px inherit; font-family: inherit; cursor: pointer; transition: background .15s, transform .15s; }
#authGate .ag-row button:hover { background: rgba(255,255,255,.06); }
#authGate .ag-row button.pri { border: 0; background: linear-gradient(90deg, #3d7bfd, #2f63e0); box-shadow: 0 8px 24px rgba(61,123,253,.35); }
#authGate .ag-row button.pri:hover { transform: translateY(-1px); }
#authGate .ag-foot { position: relative; padding: 18px 40px 24px; color: #5d6578; font-size: 12px; text-align: center; }
@media (max-width: 900px) {
  #authGate .ag-main { grid-template-columns: 1fr; gap: 32px; padding: 8px 16px 28px; }
  #authGate .ag-top { padding: 16px; }
  #authGate .ag-hero { text-align: center; }
  #authGate .ag-lead { margin-left: auto; margin-right: auto; }
  #authGate .ag-feats { grid-template-columns: 1fr; text-align: left; max-width: 420px; margin: 0 auto; }
  #authGate .ag-card { order: -1; padding: 28px 20px 22px; }
  #authGate .ag-foot { padding: 14px 16px 20px; }
}
.acct-btn { width: 30px; height: 30px; margin: 0 4px 0 6px; padding: 0; border: 0; border-radius: 50%; overflow: hidden; cursor: pointer; background: var(--accent, #2962ff); color: #fff; font: 600 14px system-ui, sans-serif; flex: none; }
.acct-btn[hidden] { display: none; }
.acct-btn img { width: 100%; height: 100%; object-fit: cover; display: block; }
.admin .adm-top { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.admin .adm-top .grow { flex: 1; }
.admin .adm-table { max-height: 60vh; overflow: auto; border: 1px solid var(--border); border-radius: 8px; }
.admin .adm-row { display: grid; grid-template-columns: minmax(200px, 2.2fr) 1fr 1fr .8fr 1.3fr .9fr; gap: 10px; align-items: center; padding: 8px 12px; border-top: 1px solid var(--border); font-size: 13px; }
.admin .adm-row:first-child { border-top: 0; }
.admin .adm-h { position: sticky; top: 0; background: var(--panel); color: var(--text-dim); font-size: 12px; }
.admin .adm-row.wait { background: color-mix(in srgb, #f5a524 10%, transparent); }
.admin .adm-u { display: flex; align-items: center; gap: 10px; min-width: 0; }
.admin .adm-u img, .admin .adm-u i { width: 30px; height: 30px; border-radius: 50%; flex: none; background: var(--hover); }
.admin .adm-u b, .admin .adm-u small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.admin .adm-u small { color: var(--text-dim); }
.admin select { width: 100%; padding: 5px 6px; border-radius: 6px; border: 1px solid var(--border); background: var(--panel); color: var(--text); font: inherit; }
.admin .adm-note { margin-top: 10px; font-size: 12px; }
.admin .adm-acc { display: flex; gap: 6px; align-items: center; }
.admin .adm-ok { flex: none; padding: 4px 10px; border-radius: 6px; border: 0; background: var(--accent, #2962ff); color: #fff; cursor: pointer; font: inherit; }
