/* TradingView-style chart terminal */

@font-face {
  font-family: 'Inter';
  src: url('assets/font/Inter-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Inter';
  src: url('assets/font/Inter-Medium.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Inter';
  src: url('assets/font/Inter-SemiBold.woff2') format('woff2');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Inter';
  src: url('assets/font/Inter-Bold.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Inter';
  src: url('assets/font/Inter-BoldItalic.woff2') format('woff2');
  font-weight: 700;
  font-style: italic;
  font-display: swap;
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 13px;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body[data-theme="light"] {
  --tv-bg: #f8fafc;
  --tv-header: #f8fafc;
  --tv-toolbar-bg: #eef1f5;
  --tv-border: #e0e3eb;
  --tv-text: #131722;
  --tv-muted: #787b86;
  --tv-hover: #e8ebf2;
  --tv-active-bg: #dde2ed;
  --tv-accent: #2962ff;
  --tv-up: #128040;
  --tv-down: #cc3e58;
  --tv-grid: #e8eaed;
  --tv-chart-bg: #f8fafc;
  --tv-dropdown-title: #848e9c;
  --tv-font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --tv-icon: #434651;
  --tv-icon-active: #131722;
  --tv-hl-up: #128040;
  --tv-hl-down: #cc3e58;
  --tv-frame: #e0e3eb;
  --tv-collapse: #f0b90b;
}

body[data-theme="dark"] {
  --tv-bg: #131722;
  --tv-header: #131722;
  --tv-toolbar-bg: #131722;
  --tv-border: #2a2e39;
  --tv-text: #d1d4dc;
  --tv-muted: #787b86;
  --tv-hover: #1e222d;
  --tv-active-bg: #1e222d;
  --tv-accent: #2962ff;
  --tv-up: #128040;
  --tv-down: #cc3e58;
  --tv-grid: #1e222d;
  --tv-chart-bg: #131722;
  --tv-dropdown-title: #848e9c;
  --tv-font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --tv-icon: #d1d4dc;
  --tv-icon-active: #d1d4dc;
  --tv-hl-up: #128040;
  --tv-hl-down: #cc3e58;
  --tv-frame: #2a2e39;
  --tv-collapse: #f0b90b;
}

body { background: var(--tv-bg); color: var(--tv-text); }
.hidden { display: none !important; }

.tv-terminal {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  max-height: 100dvh;
  background: var(--tv-bg);
  /* Outer frame */
  border: 1px solid var(--tv-frame, var(--tv-border));
  box-sizing: border-box;
}

/* Laravel / iframe embed — fill host, no chrome chrome */
body.tv-embed {
  background: var(--tv-bg);
}

body.tv-embed .tv-terminal {
  border: none;
  height: 100%;
  max-height: none;
}

body.tv-embed .tv-mob-back {
  display: none !important;
}

/* ── Unified header bar ── */
.tv-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 40px;
  padding: 0 10px 0 12px;
  background: var(--tv-header);
  /* Continuous frame line — meets sidebar border at a T-junction */
  border-bottom: 1px solid var(--tv-frame, var(--tv-border));
  flex-shrink: 0;
  /* Above left drawing toolbar (z=25) so symbol picker is never clipped */
  z-index: 40;
  gap: 12px;
  position: relative;
}

.tv-h-left {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  flex-shrink: 0;
  position: relative;
}

.tv-h-right {
  display: flex;
  align-items: center;
  gap: 1px;
  margin-left: auto;
  min-width: 0;
}

.tv-sym-block {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  font-family: inherit;
}

.tv-sym-block:hover .tv-sym-name { color: var(--tv-accent); }

.tv-sym-logo {
  width: 16px;
  height: 16px;
  border-radius: 2px;
  background: #f7931a;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  line-height: 1;
  overflow: hidden;
}

.tv-sym-logo-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 2px;
  display: block;
}

.tv-sym-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--tv-text);
  letter-spacing: 0.01em;
}

.tv-hl-item {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.tv-hl-lbl { color: var(--tv-muted); font-weight: 400; }
.tv-hl-item b { font-weight: 600; font-size: 13px; }
.tv-hl-item:not(.tv-l) b { color: var(--tv-hl-up, var(--tv-up)); }
.tv-hl-item.tv-l b { color: var(--tv-hl-down, var(--tv-down)); }

/* Session H / L / Last — overlay inside chart (not header) */
.tv-session-hl {
  position: absolute;
  top: 8px;
  left: 10px;
  z-index: 12;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  pointer-events: none;
  padding: 0;
  max-width: calc(100% - 56px);
}

.tv-session-hl .tv-crosshair-switch {
  pointer-events: auto;
}

.tv-crosshair-switch {
  width: 24px;
  height: 24px;
  padding: 0;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: #787b86;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.tv-crosshair-switch:hover { background: var(--tv-hover); }

.tv-crosshair-switch.active {
  background: #e3f6fc;
  color: #00bcd4;
}

[data-theme="dark"] .tv-crosshair-switch.active {
  background: #1a3a52;
  color: #5b9cf6;
}

.tv-hl-item.tv-crosshair-val b {
  color: var(--tv-down);
}

.tv-hl-item.tv-crosshair-val b.tv-price-tick-up {
  color: var(--tv-up);
}

.tv-hl-item.tv-crosshair-val b.tv-price-tick-down {
  color: var(--tv-down);
}

.tv-crosshair-scale-root {
  position: fixed;
  inset: 0;
  z-index: 10005;
  pointer-events: none;
  overflow: visible;
}

.tv-crosshair-scale-label {
  position: fixed;
  display: inline-flex;
  align-items: center;
  transform: translateY(-50%);
  pointer-events: auto;
  z-index: 10006;
}

.tv-crosshair-scale-close {
  width: 14px;
  height: 14px;
  margin-right: 2px;
  padding: 0;
  border: none;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.92);
  color: #787b86;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 0 1px rgba(19, 23, 34, 0.08);
}

.tv-crosshair-scale-close:hover {
  color: #131722;
  background: #ffffff;
}

.tv-crosshair-scale-price {
  display: inline-block;
  min-width: 44px;
  padding: 1px 6px;
  border-radius: 2px;
  background: var(--tv-crosshair-label-color, #128040);
  color: #ffffff;
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-align: center;
  white-space: nowrap;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.tv-chev-sm { display: inline-flex; color: var(--tv-muted); margin-left: 2px; }
.tv-chev-sm svg { width: 8px; height: 5px; }

.tv-tb-sep {
  width: 1px;
  height: 20px;
  background: var(--tv-border);
  margin: 0 8px;
  flex-shrink: 0;
}

.tv-tb-text {
  height: 32px;
  min-width: 32px;
  padding: 0 6px;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--tv-text);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
}

.tv-tb-text:hover { background: var(--tv-hover); }

.tv-tb-icon {
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--tv-icon);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.tv-tb-icon svg,
.tv-tb-icon img {
  width: 28px;
  height: 28px;
  display: block;
}

.tv-settings-gear-icon {
  pointer-events: none;
}

.tv-tb-icon:hover { background: var(--tv-hover); color: var(--tv-text); }
.tv-tb-icon.active {
  background: var(--tv-hover);
  color: var(--tv-icon-active);
}

.tv-tb-fx {
  font-family: var(--tv-font);
  font-style: italic;
  font-weight: 700;
  font-size: 13px;
}

.tv-template-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 32px;
  padding: 0 6px;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--tv-text);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
}

.tv-template-btn:hover { background: var(--tv-hover); }

.tv-chev-sm { display: inline-flex; color: var(--tv-muted); margin-left: 2px; }
.tv-chev-sm svg { width: 8px; height: 5px; }

.tv-clock {
  font-size: 13px;
  font-weight: 600;
  color: var(--tv-text);
  font-variant-numeric: tabular-nums;
  padding: 0 4px 0 0;
  white-space: nowrap;
}

.tv-adv-switch-wrap {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-right: 8px;
  padding: 0;
  flex-shrink: 0;
  height: 28px;
}

.tv-adv-logo {
  display: block;
  width: 24px;
  height: 24px;
  color: #131722;
  flex-shrink: 0;
  overflow: visible;
}

[data-theme="dark"] .tv-adv-logo {
  color: #d1d4dc;
}

.tv-adv-switch {
  position: relative;
  display: inline-block;
  width: 38px;
  height: 20px;
  margin: 0;
  cursor: pointer;
  flex-shrink: 0;
}

.tv-adv-switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.tv-adv-slider {
  position: absolute;
  inset: 0;
  background: #b2b5be;
  border-radius: 999px;
  transition: background 0.15s ease;
}

.tv-adv-slider::before {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  left: 2px;
  top: 2px;
  background: #fff;
  border-radius: 50%;
  box-shadow: none;
  transition: transform 0.15s ease;
}

.tv-adv-switch input:checked + .tv-adv-slider {
  background: #6cb6f3;
}

.tv-adv-switch input:checked + .tv-adv-slider::before {
  transform: translateX(18px);
}

.tv-adv-switch input:focus-visible + .tv-adv-slider {
  outline: 2px solid rgba(108, 182, 243, 0.55);
  outline-offset: 2px;
}

/* Normal chart: no left drawing rail. TV switch ON → show toolbar. */
body:not(.tv-advanced-mode) #left-toolbar,
body:not(.tv-advanced-mode) .tv-left-tb {
  display: none !important;
  width: 0 !important;
  border: none !important;
}

body:not(.tv-advanced-mode) .tv-left-tb-flyout {
  display: none !important;
}

body:not(.tv-advanced-mode) #tv-ohlc-inline {
  display: none !important;
}

/* OHLC legend — inside chart (TradingView top-left overlay) */
.tv-ohlc-inline {
  display: none;
  align-items: baseline;
  gap: 10px;
  margin: 0;
  padding: 0;
  font-size: 12px;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
  font-family: -apple-system, BlinkMacSystemFont, "Trebuchet MS", Roboto, Ubuntu, sans-serif;
  color: var(--tv-text);
  white-space: nowrap;
  min-width: 0;
  pointer-events: none;
}

body.tv-advanced-mode .tv-ohlc-inline {
  display: inline-flex;
}

body.tv-advanced-mode .tv-session-hl .tv-session-only {
  display: none !important;
}

.tv-ohlc-pair {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
}

.tv-ohlc-pair i {
  font-style: normal;
  color: #787b86;
  font-weight: 400;
  font-size: 12px;
}

.tv-ohlc-pair b {
  font-weight: 600;
  color: #131722;
  font-size: 12px;
}

[data-theme="dark"] .tv-ohlc-pair b {
  color: #d1d4dc;
}

.tv-ohlc-chg {
  font-weight: 600;
  font-size: 12px;
  margin-left: 0;
}

.tv-ohlc-chg.up { color: #089981; }
.tv-ohlc-chg.down { color: #f23645; }

body.tv-advanced-mode .tv-h-right > .tv-draw-wrap,
body.tv-advanced-mode .tv-h-right > #btn-alerts,
body.tv-advanced-mode .tv-h-right > #btn-crosshair,
body.tv-advanced-mode .tv-h-right > #btn-measure,
body.tv-advanced-mode .tv-h-right > .tv-dropdown-wrap:has(#btn-patterns),
body.tv-advanced-mode .tv-h-right > #btn-zoom-out,
body.tv-advanced-mode .tv-h-right > #btn-zoom-in,
body.tv-advanced-mode .tv-h-right > #btn-cloud,
body.tv-advanced-mode .tv-h-right > .tv-tb-sep {
  display: none !important;
}

body.tv-advanced-mode .tv-adv-logo {
  color: #131722;
}

[data-theme="dark"] body.tv-advanced-mode .tv-adv-logo,
body.tv-advanced-mode[data-theme="dark"] .tv-adv-logo {
  color: #d1d4dc;
}

/* Floating line-tools property bar */
.tv-lt-floatbar {
  position: absolute;
  z-index: 45;
  display: flex;
  align-items: center;
  gap: 2px;
  height: 34px;
  padding: 0 6px;
  background: #fff;
  border: 1px solid #e0e3eb;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  pointer-events: auto;
}

.tv-lt-floatbar.hidden { display: none !important; }

[data-theme="dark"] .tv-lt-floatbar {
  background: #1e222d;
  border-color: #2a2e39;
}

.tv-lt-fb-btn {
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: #787b86;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  gap: 1px;
  font-size: 12px;
  font-weight: 600;
}

.tv-lt-fb-btn:hover,
.tv-lt-fb-btn.active {
  background: rgba(41, 98, 255, 0.1);
  color: #2962ff;
}

.tv-lt-fb-width { width: auto; padding: 0 8px; min-width: 40px; }
.tv-lt-fb-px { font-size: 10px; font-weight: 500; opacity: 0.75; }

.tv-lt-fb-color {
  position: relative;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  cursor: pointer;
  color: #787b86;
}

.tv-lt-fb-color:hover { background: rgba(41, 98, 255, 0.1); color: #2962ff; }

.tv-lt-fb-color input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.tv-lt-fb-swatch {
  position: absolute;
  left: 6px;
  right: 6px;
  bottom: 4px;
  height: 3px;
  border-radius: 1px;
  background: #2962ff;
}

.tv-lt-fb-paint { display: inline-flex; }

.tv-dropdown-wrap { position: relative; }

.tv-h-left .tv-picker {
  top: calc(100% + 6px);
  left: 0;
  z-index: 50;
}

#template-menu { right: 0; left: auto; }

/* Layout templates dropdown */
.tv-layout-tpl-wrap { position: relative; }

.tv-template-btn.panel-open {
  background: #e0eaff;
  border-radius: 6px;
  color: #2962ff;
}

[data-theme="dark"] .tv-template-btn.panel-open {
  background: #1a3a6e;
  color: #5b9cf6;
}

.tv-layout-tpl-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  left: auto;
  z-index: 320;
  width: 240px;
  background: #ffffff;
  border: 1px solid #e0e3eb;
  border-radius: 6px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  padding: 8px 0;
  overflow: hidden;
}

[data-theme="dark"] .tv-layout-tpl-menu {
  background: #1e222d;
  border-color: #2a2e39;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
}

.tv-layout-tpl-section { padding: 2px 0; }

.tv-layout-tpl-title {
  padding: 6px 16px 4px;
  font-size: 11px;
  font-weight: 600;
  color: #787b86;
  letter-spacing: 0.02em;
}

.tv-layout-tpl-divider {
  height: 1px;
  margin: 6px 0;
  background: #e0e3eb;
}

[data-theme="dark"] .tv-layout-tpl-divider { background: #363a45; }

.tv-layout-tpl-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 36px;
  padding: 0 16px;
  border: none;
  background: transparent;
  color: #131722;
  font-size: 14px;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
}

.tv-layout-tpl-action:hover,
.tv-layout-tpl-pick:hover { background: #f0f3fa; }

[data-theme="dark"] .tv-layout-tpl-row { color: #d1d4dc; }

[data-theme="dark"] .tv-layout-tpl-action:hover,
[data-theme="dark"] .tv-layout-tpl-pick:hover { background: #2a2e39; }

.tv-layout-tpl-autosave {
  cursor: default;
  padding-right: 12px;
}

.tv-layout-tpl-autosave:hover { background: transparent; }

.tv-layout-tpl-label { flex: 1; }

.tv-layout-tpl-indent { padding-left: 44px; }

.tv-layout-tpl-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #787b86;
}

.tv-layout-tpl-icon svg {
  width: 18px;
  height: 18px;
  display: block;
}

.tv-layout-tpl-check {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.tv-layout-tpl-check svg {
  width: 18px;
  height: 18px;
  display: block;
}

.tv-layout-tpl-pick-name { flex: 1; }

.tv-layout-tpl-action.is-disabled,
.tv-layout-tpl-action:disabled {
  color: #b2b5be;
  cursor: default;
}

.tv-layout-tpl-action.is-disabled:hover,
.tv-layout-tpl-action:disabled:hover {
  background: transparent;
}

.tv-layout-tpl-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}

.tv-layout-tpl-toggle input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.tv-layout-tpl-switch {
  width: 38px;
  height: 22px;
  background: #d1d4dc;
  border-radius: 11px;
  position: relative;
  flex-shrink: 0;
  transition: background 0.2s;
}

.tv-layout-tpl-switch::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.tv-layout-tpl-toggle input:checked + .tv-layout-tpl-switch {
  background: #2962ff;
}

.tv-layout-tpl-toggle input:checked + .tv-layout-tpl-switch::after {
  transform: translateX(16px);
}

.tv-layout-tpl-empty {
  padding: 8px 16px 10px;
  font-size: 13px;
  color: #787b86;
}

.tv-layout-tpl-overlay {
  position: fixed;
  inset: 0;
  z-index: 10001;
  background: rgba(0, 0, 0, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}

.tv-layout-tpl-dialog {
  width: 380px;
  max-width: 100%;
  max-height: calc(100vh - 48px);
  background: #ffffff;
  border: 1px solid #e0e3eb;
  border-radius: 8px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

[data-theme="dark"] .tv-layout-tpl-dialog {
  background: #1e222d;
  border-color: #2a2e39;
}

.tv-layout-tpl-manage-body {
  max-height: 360px;
  overflow-y: auto;
  padding: 8px 0 12px;
}

.tv-layout-tpl-manage-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
}

.tv-layout-tpl-manage-row:hover { background: #f0f3fa; }

[data-theme="dark"] .tv-layout-tpl-manage-row:hover { background: #2a2e39; }

.tv-layout-tpl-manage-name {
  flex: 1;
  border: none;
  background: transparent;
  color: #131722;
  font-size: 14px;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  padding: 0;
}

[data-theme="dark"] .tv-layout-tpl-manage-name { color: #d1d4dc; }

.tv-layout-tpl-manage-actions {
  display: flex;
  gap: 4px;
}

.tv-layout-tpl-manage-btn {
  padding: 4px 10px;
  border: 1px solid #e0e3eb;
  border-radius: 4px;
  background: #fff;
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  color: #131722;
}

.tv-layout-tpl-manage-btn:hover { background: #f0f3fa; }

.tv-layout-tpl-manage-btn:disabled {
  opacity: 0.45;
  cursor: default;
}

.tv-layout-tpl-manage-btn-danger { color: #f7525f; }

.tv-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 200;
  min-width: 140px;
  background: #ffffff;
  border: 1px solid var(--tv-border);
  border-radius: 8px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.12);
  padding: 4px 0;
}

body[data-theme="dark"] .tv-dropdown { background: #1e222d; }

.tv-dropdown-title {
  padding: 10px 12px 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--tv-dropdown-title);
  border-bottom: 1px solid var(--tv-border);
  margin-bottom: 4px;
}

.tv-menu-item,
.tv-dropdown button.tv-menu-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 12px;
  border: none;
  background: transparent;
  color: var(--tv-text);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
}

.tv-menu-item:hover,
.tv-menu-item.active { background: var(--tv-hover); }
.tv-menu-item.active { color: var(--tv-accent); font-weight: 600; }

/* Chart type menu */
.tv-chart-type-menu { min-width: 180px; padding-bottom: 6px; }
.tv-patterns-menu { min-width: 200px; padding-bottom: 6px; }

.tv-type-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 12px;
  border: none;
  background: transparent;
  color: var(--tv-text);
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
}

.tv-type-item:hover { background: #f0f3f8; }
.tv-type-item.active {
  background: #f0f3f8;
  font-weight: 700;
}
.tv-type-item.active .tv-type-icon { color: #00bcd4; }

.tv-type-icon {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--tv-muted);
  flex-shrink: 0;
}

/* Multichart layout menu — TradingView-style */
.tv-layout-wrap .tv-multichart-menu {
  min-width: 292px;
  padding: 0;
  left: 0;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
  overflow: hidden;
}

.tv-multichart-menu .tv-dropdown-title {
  font-size: 14px;
  font-weight: 600;
  color: #131722;
  padding: 12px 16px 10px;
  margin-bottom: 0;
  border-bottom: 1px solid #e0e3eb;
  letter-spacing: 0;
}

[data-theme="dark"] .tv-multichart-menu .tv-dropdown-title {
  color: #d1d4dc;
}

.tv-layout-grid-menu {
  padding: 10px 14px 12px;
}

.tv-layout-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}

.tv-layout-row:last-child {
  margin-bottom: 0;
}

.tv-layout-num {
  width: 14px;
  font-size: 13px;
  font-weight: 700;
  color: #131722;
  flex-shrink: 0;
  text-align: left;
}

[data-theme="dark"] .tv-layout-num {
  color: #d1d4dc;
}

.tv-layout-btn {
  width: 38px;
  height: 38px;
  padding: 5px;
  border: 1px solid transparent;
  border-radius: 4px;
  background: #f0f3fa;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.tv-layout-btn:hover {
  border-color: #c9cdd6;
  background: #e8ebf2;
}

.tv-layout-btn.active {
  border-color: #2962ff;
  background: #e3effd;
}

[data-theme="dark"] .tv-layout-btn {
  background: #2a2e39;
}

[data-theme="dark"] .tv-layout-btn:hover {
  background: #363a45;
  border-color: #434651;
}

[data-theme="dark"] .tv-layout-btn.active {
  border-color: #2962ff;
  background: #1a3a6e;
}

.tv-layout-btn svg {
  width: 28px;
  height: 28px;
  display: block;
}

/* Chart pane multichart grid */
.tv-chart.tv-layout-multi {
  display: grid;
  gap: 1px;
  background: #e0e3eb;
}

.tv-chart.tv-layout-multi .tv-chart-host.tv-layout-slot-main {
  flex: unset;
  width: 100%;
  height: 100%;
  min-height: 0;
}

.tv-layout-cell {
  position: relative;
  background: var(--tv-chart-bg);
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
}

.tv-layout-cell-head {
  position: absolute;
  top: 6px;
  left: 8px;
  z-index: 12;
  pointer-events: none;
}

.tv-layout-cell-sym {
  font-size: 11px;
  font-weight: 600;
  color: #787b86;
  letter-spacing: 0.02em;
}

.tv-mc-host {
  flex: 1;
  min-height: 0;
  width: 100%;
}

/* Drawing tools panel */
.tv-draw-wrap {
  display: inline-flex;
  align-items: center;
  position: relative;
}

.tv-draw-btn.panel-open,
.tv-draw-btn.active {
  background: #dce8fd;
  border-radius: 50%;
  color: #131722;
}

[data-theme="dark"] .tv-draw-btn.panel-open,
[data-theme="dark"] .tv-draw-btn.active {
  background: #1a3a6e;
  color: #d1d4dc;
}

.tv-tb-icon.active.objects-active {
  background: #e3effd;
  color: #131722;
}

[data-theme="dark"] .tv-tb-icon.active.objects-active {
  background: #1a3a6e;
  color: #d1d4dc;
}

/* ── Chart objects panel (TradingView clone) ── */
.tv-objects-wrap { position: relative; }

.tv-objects-panel {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 320;
  width: 360px;
  background: #fff;
  border: 1px solid #e0e3eb;
  border-radius: 8px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.06);
  overflow: hidden;
}

[data-theme="dark"] .tv-objects-panel {
  background: #1e222d;
  border-color: #2a2e39;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
}

.tv-objects-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px 10px 14px;
  border-bottom: 1px solid #e8ebf2;
}

[data-theme="dark"] .tv-objects-head {
  border-color: #2a2e39;
}

.tv-objects-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--tv-text);
}

.tv-objects-close {
  width: 26px;
  height: 26px;
  border: none;
  background: transparent;
  color: #787b86;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  border-radius: 4px;
}

.tv-objects-close:hover {
  background: #f0f3f8;
  color: #131722;
}

[data-theme="dark"] .tv-objects-close:hover {
  background: #2a2e39;
  color: #d1d4dc;
}

.tv-objects-body {
  max-height: 320px;
  overflow-y: auto;
}

.tv-obj-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 4px 10px 4px 12px;
  border-bottom: 1px solid #f0f3f8;
}

.tv-obj-row:last-child {
  border-bottom: none;
}

[data-theme="dark"] .tv-obj-row {
  border-color: #2a2e39;
}

.tv-obj-all {
  background: #fafbfc;
}

[data-theme="dark"] .tv-obj-all {
  background: #181c27;
}

.tv-obj-icon {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #787b86;
}

.tv-obj-icon svg {
  width: 18px;
  height: 18px;
  display: block;
}

.tv-obj-label,
.tv-obj-name {
  flex: 1;
  font-size: 13px;
  color: var(--tv-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tv-obj-label {
  font-weight: 500;
}

.tv-obj-hidden .tv-obj-name {
  color: var(--tv-muted);
  opacity: 0.65;
}

.tv-obj-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

.tv-obj-act {
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  border-radius: 4px;
  background: #f0f3f8;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.tv-obj-act:hover {
  background: #e8ebf2;
}

.tv-obj-act-disabled {
  opacity: 0.35;
  cursor: default;
  pointer-events: none;
}

[data-theme="dark"] .tv-obj-act {
  background: #2a2e39;
}

[data-theme="dark"] .tv-obj-act:hover {
  background: #363a45;
}

.tv-obj-act svg {
  width: 18px;
  height: 18px;
  display: block;
}

.tv-obj-empty {
  padding: 16px 14px;
  font-size: 12px;
  color: var(--tv-muted);
  text-align: center;
}

.tv-draw-panel {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 300;
  width: 668px;
  max-width: calc(100vw - 24px);
  background: #ffffff;
  border: 1px solid #e0e3eb;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  overflow: hidden;
}

[data-theme="dark"] .tv-draw-panel {
  background: #1e222d;
  border-color: #2a2e39;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
}

.tv-draw-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 48px;
  padding: 0 16px 0 20px;
  background: #f0f3fa;
  border-bottom: 1px solid #e0e3eb;
  box-sizing: border-box;
}

[data-theme="dark"] .tv-draw-panel-head {
  background: #2a2e39;
  border-color: #363a45;
}

.tv-draw-panel-title {
  font-size: 16px;
  font-weight: 600;
  color: #131722;
  letter-spacing: 0;
  line-height: 1;
}

[data-theme="dark"] .tv-draw-panel-title {
  color: #d1d4dc;
}

.tv-draw-panel-close {
  width: 28px;
  height: 28px;
  padding: 0;
  margin: 0 -4px 0 0;
  border: none;
  background: transparent;
  color: #787b86;
  font-size: 22px;
  font-weight: 300;
  line-height: 1;
  cursor: pointer;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tv-draw-panel-close:hover {
  color: #131722;
}

[data-theme="dark"] .tv-draw-panel-close {
  color: #787b86;
}

[data-theme="dark"] .tv-draw-panel-close:hover {
  color: #d1d4dc;
}

.tv-draw-panel-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  padding: 20px 0 22px;
  background: #ffffff;
}

[data-theme="dark"] .tv-draw-panel-grid {
  background: #1e222d;
}

.tv-draw-col {
  padding: 0 20px;
  border-right: 1px solid #e0e3eb;
  min-width: 0;
}

.tv-draw-col:last-child {
  border-right: none;
}

[data-theme="dark"] .tv-draw-col {
  border-color: #363a45;
}

.tv-draw-col-title {
  font-size: 11px;
  font-weight: 400;
  color: #b2b5be;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0 0 12px;
  margin: 0;
  line-height: 1.2;
}

[data-theme="dark"] .tv-draw-col-title {
  color: #787b86;
}

.tv-draw-col-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.tv-draw-tool {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  height: 32px;
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  color: #131722;
  font-size: 14px;
  font-weight: 400;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
}

[data-theme="dark"] .tv-draw-tool {
  color: #d1d4dc;
}

.tv-draw-tool:hover {
  color: #131722;
}

[data-theme="dark"] .tv-draw-tool:hover {
  color: #ffffff;
}

.tv-draw-tool.active {
  color: #2962ff;
}

[data-theme="dark"] .tv-draw-tool.active {
  color: #5b9cf6;
}

.tv-draw-tool-icon {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #131722;
}

[data-theme="dark"] .tv-draw-tool-icon {
  color: #d1d4dc;
}

.tv-draw-tool.active .tv-draw-tool-icon {
  color: #2962ff;
}

[data-theme="dark"] .tv-draw-tool.active .tv-draw-tool-icon {
  color: #5b9cf6;
}

.tv-draw-tool-icon svg {
  width: 28px;
  height: 28px;
  display: block;
}

.tv-draw-tool-name {
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 700px) {
  .tv-draw-panel {
    width: min(668px, calc(100vw - 16px));
  }
  .tv-draw-panel-grid {
    grid-template-columns: 1fr;
    padding: 16px 0 18px;
  }
  .tv-draw-col {
    border-right: none;
    border-bottom: 1px solid #e0e3eb;
    padding: 14px 20px;
  }
  .tv-draw-col:last-child {
    border-bottom: none;
  }
}

/* Picker */
.tv-picker {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 200;
  width: 320px;
  max-width: min(320px, calc(100vw - 24px));
  background: var(--tv-header);
  border: 1px solid var(--tv-border);
  border-radius: 10px;
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.28);
  padding: 10px;
  box-sizing: border-box;
}

.tv-picker-head {
  display: none;
}

.tv-picker-body {
  display: block;
  padding: 0;
  overflow: visible;
  background: transparent;
}

.tv-picker input,
.tv-picker #symbol-search {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--tv-border);
  border-radius: 8px;
  background: var(--tv-bg);
  color: var(--tv-text);
  font-size: 13px;
  margin-bottom: 8px;
  font-family: inherit;
  box-sizing: border-box;
  outline: none;
}

.tv-picker #symbol-search:focus {
  border-color: var(--tv-accent, #2962ff);
  box-shadow: 0 0 0 2px rgba(41, 98, 255, 0.18);
}

.tv-picker-list {
  max-height: 320px;
  overflow-y: auto;
  overflow-x: hidden;
  margin: 0 -2px;
  padding: 0 2px;
  scrollbar-width: thin;
  scrollbar-color: rgba(148, 163, 184, 0.45) transparent;
}

.tv-picker-list::-webkit-scrollbar {
  width: 6px;
}
.tv-picker-list::-webkit-scrollbar-track {
  background: transparent;
}
.tv-picker-list::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.4);
  border-radius: 999px;
}

.tv-picker-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  padding: 9px 12px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--tv-text);
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  box-sizing: border-box;
}

.tv-picker-item:hover { background: var(--tv-hover); }
.tv-picker-item.active { background: rgba(41, 98, 255, 0.14); }
.tv-picker-item span {
  font-size: 11px;
  color: var(--tv-muted);
  line-height: 1.3;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tv-picker-item strong {
  font-size: 13px;
  font-weight: 650;
  color: var(--tv-text);
  letter-spacing: 0.01em;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tv-picker-empty {
  padding: 18px 12px;
  text-align: center;
  color: var(--tv-muted);
  font-size: 13px;
}

/* ── Chart ── */
.tv-chart {
  flex: 1;
  min-height: 0;
  position: relative;
  background: var(--tv-chart-bg);
  display: flex;
  flex-direction: column;
}

.tv-chart-host {
  flex: 1;
  min-height: 0;
  width: 100%;
  position: relative;
  touch-action: none;
}

/* TradingView-style symbol watermark */
.tv-chart-watermark {
  position: absolute;
  left: 50%;
  top: 46%;
  transform: translate(-50%, -50%);
  z-index: 5;
  pointer-events: none;
  user-select: none;
  font-family: var(--tv-font);
  font-weight: 700;
  font-size: clamp(48px, 11vw, 92px);
  letter-spacing: -0.02em;
  line-height: 1;
  white-space: nowrap;
  color: rgba(19, 23, 34, 0.07);
  text-align: center;
  max-width: 90%;
  overflow: hidden;
  text-overflow: ellipsis;
}

body[data-theme="dark"] .tv-chart-watermark {
  color: rgba(209, 212, 220, 0.08);
}

.tv-chart-watermark.is-hidden {
  display: none;
}

body.tv-mobile .tv-chart-watermark {
  font-size: clamp(36px, 14vw, 64px);
  top: 42%;
}

.tv-hl-item.tv-live b {
  color: var(--tv-up);
  font-variant-numeric: tabular-nums;
}

.tv-hl-item.tv-live b.tv-price-tick-up { color: var(--tv-up); }
.tv-hl-item.tv-live b.tv-price-tick-down { color: var(--tv-down); }

/* Volume close — bottom-right of volume strip */
.tv-volume-close-btn {
  position: absolute;
  right: 62px;
  bottom: 8px;
  z-index: 40;
  width: 20px;
  height: 20px;
  padding: 0;
  border: 1px solid var(--tv-border);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.95);
  color: var(--tv-muted);
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 2px rgba(19, 23, 34, 0.08);
}

[data-theme="dark"] .tv-volume-close-btn {
  background: rgba(30, 34, 45, 0.95);
  border-color: #363a45;
}

.tv-volume-close-btn:hover {
  color: var(--tv-text);
  background: var(--tv-hover);
}

/* ── Floating drawing settings toolbar (TradingView header pill) ── */
.tv-drawing-toolbar {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 2px;
  height: 34px;
  padding: 0 6px 0 4px;
  width: max-content;
  background: #1e222d;
  border: 1px solid #2a2e39;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
  font-family: var(--tv-font);
  user-select: none;
  pointer-events: auto;
}

body[data-theme="light"] .tv-drawing-toolbar {
  background: #ffffff;
  border-color: #e0e3eb;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.tv-drawing-toolbar.hidden {
  display: none !important;
}

.tv-dt-drag {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 28px;
  color: #787b86;
  cursor: grab;
  flex-shrink: 0;
  opacity: 0.85;
}

.tv-dt-drag:active { cursor: grabbing; }

.tv-dt-btn {
  position: relative;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: #b2b5be;
  border-radius: 4px;
  cursor: pointer;
  flex-shrink: 0;
  padding: 0;
}

.tv-dt-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #d1d4dc;
}

body[data-theme="light"] .tv-dt-btn {
  color: #787b86;
}

body[data-theme="light"] .tv-dt-btn:hover {
  background: rgba(0, 0, 0, 0.05);
  color: #131722;
}

.tv-dt-btn svg {
  display: block;
  pointer-events: none;
}

.tv-dt-paint-wrap,
.tv-dt-more-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.tv-dt-paint {
  flex-direction: column;
  gap: 0;
}

.tv-dt-paint-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
}

.tv-dt-paint-bar {
  position: absolute;
  left: 6px;
  right: 6px;
  bottom: 3px;
  height: 3px;
  border-radius: 1px;
  background: #2962FF;
  pointer-events: none;
}

.tv-dt-paint.active,
.tv-dt-btn[aria-expanded="true"] {
  background: rgba(41, 98, 255, 0.12);
}

.tv-dt-flyout {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 50;
  min-width: 148px;
  padding: 6px;
  background: #1e222d;
  border: 1px solid #2a2e39;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

body[data-theme="light"] .tv-dt-flyout {
  background: #ffffff;
  border-color: #e0e3eb;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.tv-dt-flyout.hidden {
  display: none !important;
}

.tv-dt-more-flyout {
  left: auto;
  right: 0;
  transform: none;
  min-width: 168px;
}

.tv-dt-fly-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 7px 8px;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: #d1d4dc;
  font: 400 12px var(--tv-font);
  cursor: pointer;
  text-align: left;
  box-sizing: border-box;
}

body[data-theme="light"] .tv-dt-fly-row {
  color: #131722;
}

.tv-dt-fly-row:hover {
  background: rgba(255, 255, 255, 0.06);
}

body[data-theme="light"] .tv-dt-fly-row:hover {
  background: rgba(0, 0, 0, 0.04);
}

.tv-dt-fly-label {
  flex: 1;
  min-width: 0;
}

.tv-dt-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  flex-shrink: 0;
  box-sizing: border-box;
}

.tv-dt-dot-fill {
  background: #fce8ec;
  border: 1px solid #f5c6d0;
}

.tv-dt-dot-border {
  background: #e91e63;
  border: 1px solid #e91e63;
}

.tv-dt-color-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  border: none;
  padding: 0;
  margin: 0;
}

.tv-dt-line-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 12px;
  color: #787b86;
}

.tv-dt-weight-val {
  font-size: 12px;
  color: #787b86;
  min-width: 28px;
  text-align: right;
}

.tv-dt-text-row {
  display: flex;
  align-items: center;
  padding: 4px 4px 6px;
}

.tv-dt-text-row.hidden {
  display: none !important;
}

.tv-dt-text-input {
  width: 100%;
  height: 28px;
  border: 1px solid #2a2e39;
  border-radius: 4px;
  background: #131722;
  color: #d1d4dc;
  padding: 0 8px;
  font: 400 12px var(--tv-font);
  outline: none;
}

body[data-theme="light"] .tv-dt-text-input {
  border-color: #e0e3eb;
  background: #f0f3fa;
  color: #131722;
}

.tv-dt-text-input:focus {
  border-color: #2962FF;
}

/* Inline Note editor sitting on the label card */
.tv-note-editor {
  position: absolute;
  z-index: 235;
  margin: 0;
  padding: 6px 10px;
  border: none;
  border-radius: 5px;
  outline: none;
  resize: none;
  overflow: hidden;
  box-sizing: border-box;
  background: #2a2e39;
  color: #ffffff;
  caret-color: #ffffff;
  font: 600 12px Inter, system-ui, sans-serif;
  line-height: 1.3;
  text-align: center;
  pointer-events: auto;
}

.tv-note-editor.hidden {
  display: none !important;
}

.tv-note-editor::placeholder {
  opacity: 0.4;
  color: inherit;
}

/* Inline Pin callout editor */
.tv-pin-editor {
  position: absolute;
  z-index: 235;
  margin: 0;
  padding: 6px 10px;
  border: none;
  border-radius: 5px;
  outline: none;
  resize: none;
  overflow: hidden;
  box-sizing: border-box;
  background: #2a2e39;
  color: #d1d4dc;
  caret-color: #d1d4dc;
  font: 400 12px Inter, system-ui, sans-serif;
  line-height: 1.3;
  text-align: left;
  pointer-events: auto;
}

.tv-pin-editor.hidden {
  display: none !important;
}

.tv-pin-editor::placeholder {
  opacity: 0.45;
  color: inherit;
}

/* Inline Table cell editor */
.tv-table-editor {
  position: absolute;
  z-index: 235;
  margin: 0;
  padding: 4px 6px;
  border: 1px solid #2962FF;
  border-radius: 0;
  outline: none;
  resize: none;
  overflow: hidden;
  box-sizing: border-box;
  background: #131722;
  color: #d1d4dc;
  caret-color: #d1d4dc;
  font: 400 11px Inter, system-ui, sans-serif;
  line-height: 1.25;
  text-align: left;
  pointer-events: auto;
}

.tv-table-editor.hidden {
  display: none !important;
}

/* Inline Callout editor */
.tv-callout-editor {
  position: absolute;
  z-index: 235;
  margin: 0;
  padding: 8px 10px;
  border: 1.5px solid #00BCD4;
  border-radius: 6px;
  outline: none;
  resize: none;
  overflow: hidden;
  box-sizing: border-box;
  background: rgba(0, 188, 212, 0.28);
  color: #b2ebf2;
  caret-color: #b2ebf2;
  font: 400 12px Inter, system-ui, sans-serif;
  line-height: 1.3;
  text-align: left;
  pointer-events: auto;
}

.tv-callout-editor.hidden {
  display: none !important;
}

.tv-callout-editor::placeholder {
  opacity: 0.45;
  color: inherit;
}

/* Inline Comment editor */
.tv-comment-editor {
  position: absolute;
  z-index: 235;
  margin: 0;
  padding: 8px 12px;
  border: none;
  border-radius: 10px;
  outline: none;
  resize: none;
  overflow: hidden;
  box-sizing: border-box;
  background: #2962FF;
  color: #c5d4ff;
  caret-color: #c5d4ff;
  font: 400 12px Inter, system-ui, sans-serif;
  line-height: 1.3;
  text-align: left;
  pointer-events: auto;
}

.tv-comment-editor.hidden {
  display: none !important;
}

.tv-comment-editor::placeholder {
  opacity: 0.5;
  color: inherit;
}

/* Inline Signpost editor on the dark label card */
.tv-signpost-editor {
  position: absolute;
  z-index: 235;
  margin: 0;
  padding: 6px 10px;
  border: none;
  border-radius: 4px;
  outline: none;
  resize: none;
  overflow: hidden;
  box-sizing: border-box;
  background: #131722;
  color: #d1d4dc;
  caret-color: #d1d4dc;
  font: 500 12px Inter, system-ui, sans-serif;
  line-height: 1.25;
  text-align: center;
  pointer-events: auto;
}

.tv-signpost-editor.hidden {
  display: none !important;
}

.tv-signpost-editor::placeholder {
  opacity: 0.45;
  color: inherit;
}

/* Inline Anchored Text editor sitting on the label card */
.tv-anchored-text-editor {
  position: absolute;
  z-index: 235;
  margin: 0;
  padding: 6px 8px;
  border: 1px solid #2962FF;
  border-radius: 4px;
  outline: none;
  resize: none;
  overflow: hidden;
  box-sizing: border-box;
  background: rgba(19, 23, 34, 0.92);
  color: #d1d4dc;
  caret-color: #d1d4dc;
  font: 500 13px Inter, system-ui, sans-serif;
  line-height: 1.35;
  pointer-events: auto;
  box-shadow: 0 0 0 1px rgba(41, 98, 255, 0.35);
}

.tv-anchored-text-editor.hidden {
  display: none !important;
}

.tv-anchored-text-editor::placeholder {
  opacity: 0.45;
  color: inherit;
}

/* Inline text editor sitting on the chart line */
.tv-line-text-editor {
  position: absolute;
  z-index: 230;
  margin: 0;
  border: none;
  outline: none;
  background: transparent;
  box-shadow: none;
  font: italic 600 12px "Trebuchet MS", "Segoe UI", sans-serif;
  text-align: center;
  padding: 2px 6px;
  min-width: 72px;
  width: 72px;
  transform-origin: center center;
  pointer-events: auto;
  white-space: nowrap;
}

.tv-line-text-editor.hidden {
  display: none !important;
}

.tv-line-text-editor::placeholder {
  opacity: 0.45;
  font-style: italic;
  color: inherit;
}

/* Horizontal line mid-line text editor */
.tv-hline-text-editor {
  position: absolute;
  z-index: 230;
  margin: 0;
  border: none;
  outline: none;
  background: transparent;
  box-shadow: none;
  font: italic 600 12px "Trebuchet MS", "Segoe UI", sans-serif;
  text-align: center;
  padding: 2px 6px;
  min-width: 72px;
  width: 72px;
  color: #ffffff;
  transform-origin: center center;
  pointer-events: auto;
  white-space: nowrap;
}

.tv-hline-text-editor.hidden {
  display: none !important;
}

.tv-hline-text-editor::placeholder {
  opacity: 0.45;
  font-style: italic;
  color: #ffffff;
}

/* ── Text annotation toolbar (retired — header drawing pill only) ── */
.tv-text-toolbar {
  display: none !important;
  position: absolute;
  z-index: 260;
  width: 280px;
  background: #ffffff;
  border: 1px solid #9dc8e8;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  font-family: var(--tv-font);
  user-select: none;
  pointer-events: none;
  overflow: hidden;
}

[data-theme="dark"] .tv-text-toolbar {
  background: #1e222d;
  border-color: #3d6a9e;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
}

.tv-tt-head {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px 6px;
}

.tv-tt-drag {
  display: flex;
  cursor: grab;
  flex-shrink: 0;
}

.tv-tt-drag:active { cursor: grabbing; }

.tv-tt-title {
  flex: 1;
  font-size: 13px;
  font-weight: 600;
  color: #787b86;
}

.tv-tt-close {
  width: 20px;
  height: 20px;
  border: none;
  background: transparent;
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
}

.tv-tt-close::before,
.tv-tt-close::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 12px;
  height: 1.5px;
  background: #b2b5be;
}

.tv-tt-close::before { transform: translate(-50%, -50%) rotate(45deg); }
.tv-tt-close::after { transform: translate(-50%, -50%) rotate(-45deg); }

.tv-tt-bar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px 6px;
  border-top: 1px solid #e0e3eb;
  border-bottom: 1px solid #e0e3eb;
  flex-wrap: wrap;
}

[data-theme="dark"] .tv-tt-bar {
  border-color: #363a45;
}

.tv-tt-color-pick {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 11px;
  color: #787b86;
}

.tv-tt-color-pick:hover { background: rgba(0, 0, 0, 0.04); }

.tv-tt-color-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.1);
  flex-shrink: 0;
}

.tv-tt-color-input,
.tv-tt-opt-color {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.tv-tt-font-group {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  margin-left: auto;
}

.tv-tt-font-icon {
  font-size: 13px;
  font-weight: 600;
  color: #787b86;
  padding: 0 2px;
}

.tv-tt-font-size {
  width: 42px;
  height: 24px;
  border: 1px solid #e0e3eb;
  border-radius: 4px;
  font-size: 12px;
  color: #131722;
  background: #fff;
  padding: 0 4px;
}

.tv-tt-toggle {
  width: 24px;
  height: 24px;
  border: none;
  background: transparent;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  color: #787b86;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tv-tt-toggle.active {
  color: #131722;
  background: rgba(41, 98, 255, 0.12);
}

.tv-tt-toggle b,
.tv-tt-toggle i {
  font-style: normal;
  font-weight: 700;
}

.tv-tt-toggle#tt-italic i { font-style: italic; font-weight: 600; }

.tv-tt-action {
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tv-tt-action:hover { background: rgba(0, 0, 0, 0.04); }

.tv-tt-editor {
  padding: 8px 10px 4px;
}

.tv-tt-textarea {
  width: 100%;
  min-height: 72px;
  resize: vertical;
  border: 1px solid #e0e3eb;
  border-radius: 6px;
  padding: 8px 10px;
  font-family: inherit;
  font-size: 13px;
  color: #131722;
  line-height: 1.4;
  box-sizing: border-box;
}

[data-theme="dark"] .tv-tt-textarea {
  background: #2a2e39;
  border-color: #363a45;
  color: #d1d4dc;
}

.tv-tt-textarea:focus {
  outline: none;
  border-color: #2962FF;
}

.tv-tt-counter {
  text-align: right;
  font-size: 11px;
  color: #787b86;
  padding: 4px 2px 0;
}

.tv-tt-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 10px;
  padding: 6px 10px 10px;
  font-size: 12px;
  color: #131722;
}

.tv-tt-opt {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  position: relative;
}

.tv-tt-opt-check {
  grid-column: span 1;
}

.tv-tt-opt-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 1px solid #e0e3eb;
  margin-left: auto;
  cursor: pointer;
}

.tv-tt-opt input[type="checkbox"] {
  width: 14px;
  height: 14px;
  accent-color: #2962FF;
  cursor: pointer;
}

/* Active indicator legend strip */
.tv-ind-legend {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  padding: 5px 12px;
  background: var(--tv-header);
  border-bottom: 1px solid var(--tv-border);
  flex-shrink: 0;
  min-height: 30px;
}

.tv-leg-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px 3px 6px;
  background: #fff;
  border: 1px solid var(--tv-border);
  border-radius: 4px;
  font-size: 12px;
  color: var(--tv-text);
  line-height: 1.3;
}

[data-theme="dark"] .tv-leg-chip {
  background: #2a2e39;
  border-color: #363a45;
}

.tv-leg-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.tv-leg-name { font-weight: 500; white-space: nowrap; }

.tv-leg-close {
  border: none;
  background: transparent;
  color: var(--tv-muted);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 0 2px;
  margin-left: 2px;
}

.tv-leg-close:hover { color: var(--tv-down); }

/* Indicator pane chrome (TradingView sub-pane header) */
.tv-ind-pane-chrome {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
}

.tv-ind-pane-resize-zone {
  position: absolute;
  top: -6px;
  left: 0;
  right: 0;
  height: 12px;
  z-index: 8;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  cursor: ns-resize;
  touch-action: none;
}

.tv-ind-pane-resize-line {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 1px;
  margin-top: -0.5px;
  background: transparent;
  transition: background 0.15s ease, box-shadow 0.15s ease;
}

.tv-ind-pane-resize-zone:hover .tv-ind-pane-resize-line,
.tv-ind-pane-resize-zone.is-dragging .tv-ind-pane-resize-line {
  background: #00bcd4;
  box-shadow: 0 0 0 0.5px #00bcd4;
}

.tv-ind-pane-resize-grip {
  position: relative;
  z-index: 1;
  width: 28px;
  height: 14px;
  padding: 0;
  border: none;
  border-radius: 7px;
  background: #eef1f6;
  color: #00bcd4;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: ns-resize;
  opacity: 0;
  transform: translateY(1px) scale(0.92);
  transition: opacity 0.15s ease, transform 0.15s ease, background 0.15s ease;
  box-shadow: 0 1px 3px rgba(19, 23, 34, 0.08);
  pointer-events: none;
}

[data-theme="dark"] .tv-ind-pane-resize-grip {
  background: #2a2e39;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.28);
}

.tv-ind-pane-resize-zone:hover .tv-ind-pane-resize-grip,
.tv-ind-pane-resize-zone.is-dragging .tv-ind-pane-resize-grip {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.tv-ind-pane-resize-grip svg {
  display: block;
}

body.tv-pane-resizing {
  cursor: ns-resize !important;
  user-select: none;
}

body.tv-pane-resizing * {
  cursor: ns-resize !important;
}

@media (max-width: 768px) {
  body.tv-mobile .tv-ind-pane-resize-grip {
    opacity: 0.85;
    transform: translateY(0) scale(1);
  }

  body.tv-mobile .tv-ind-pane-resize-line {
    background: rgba(0, 188, 212, 0.35);
  }
}

.tv-ind-pane-head {
  position: absolute;
  top: 4px;
  left: 8px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: calc(100% - 80px);
  pointer-events: auto;
  user-select: none;
}

.tv-ind-pane-chevron {
  width: 18px;
  height: 18px;
  padding: 0;
  border: none;
  border-radius: 3px;
  background: transparent;
  color: #787b86;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.tv-ind-pane-chevron:hover { background: rgba(0, 0, 0, 0.04); }

.tv-ind-pane-chevron svg {
  display: block;
  transition: transform 0.15s ease;
}

.tv-ind-pane-chrome.minimized .tv-ind-pane-chevron svg {
  transform: rotate(-90deg);
}

.tv-ind-pane-chrome.minimized .tv-ind-pane-title,
.tv-ind-pane-chrome.minimized .tv-ind-pane-value {
  display: none;
}

.tv-ind-pane-title {
  font-size: 13px;
  font-weight: 400;
  color: #131722;
  white-space: nowrap;
}

[data-theme="dark"] .tv-ind-pane-title { color: #d1d4dc; }

.tv-ind-pane-value {
  font-size: 13px;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.tv-ind-pane-reset,
.tv-ind-pane-close {
  position: absolute;
  bottom: 6px;
  width: 20px;
  height: 20px;
  padding: 0;
  border: 1px solid #e0e3eb;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  color: #787b86;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  box-shadow: 0 1px 2px rgba(19, 23, 34, 0.06);
}

[data-theme="dark"] .tv-ind-pane-reset,
[data-theme="dark"] .tv-ind-pane-close {
  background: rgba(30, 34, 45, 0.92);
  border-color: #363a45;
}

.tv-ind-pane-reset {
  left: 8px;
}

.tv-ind-pane-reset svg {
  display: block;
}

.tv-ind-pane-close {
  right: 58px;
  font-size: 13px;
  line-height: 1;
}

.tv-ind-pane-reset:hover,
.tv-ind-pane-close:hover {
  color: #131722;
  background: #f0f3fa;
}

[data-theme="dark"] .tv-ind-pane-reset:hover,
[data-theme="dark"] .tv-ind-pane-close:hover {
  color: #d1d4dc;
  background: #2a2e39;
}

/* Draw tool split button — legacy removed */
.tv-settings-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
}

.tv-settings-dialog {
  width: 560px;
  max-width: calc(100vw - 32px);
  max-height: calc(100dvh - 48px);
  background: #ffffff;
  border-radius: 8px;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.2);
  overflow: hidden;
  font-family: inherit;
  display: flex;
  flex-direction: column;
}

body[data-theme="dark"] .tv-settings-dialog { background: #1e222d; }

/* Price alerts modal — anchored below header toolbar */
.tv-alerts-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: transparent;
  pointer-events: none;
}

.tv-alerts-overlay:not(.hidden) {
  pointer-events: auto;
}

.tv-alerts-dialog {
  position: fixed;
  top: 42px;
  right: 8px;
  left: auto;
  width: 640px;
  max-width: calc(100vw - 16px);
  max-height: calc(100vh - 52px);
  background: #ffffff;
  border: 1px solid #e0e3eb;
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
  overflow: hidden;
  font-family: var(--tv-font);
  display: flex;
  flex-direction: column;
  pointer-events: auto;
}

body[data-theme="dark"] .tv-alerts-dialog {
  background: #1e222d;
  border-color: #2a2e39;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
}

#btn-alerts.panel-open {
  background: #e3f6fc;
  color: #00bcd4;
  border-radius: 8px;
}

[data-theme="dark"] #btn-alerts.panel-open {
  background: #1a3a52;
  color: #5b9cf6;
}

.tv-alerts-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: #eef1f6;
  border-bottom: 1px solid #e0e3eb;
}

body[data-theme="dark"] .tv-alerts-header {
  background: #2a2e39;
  border-bottom-color: #363a45;
}

.tv-alerts-title {
  flex: 1;
  font-size: 16px;
  font-weight: 600;
  color: #131722;
}

body[data-theme="dark"] .tv-alerts-title { color: #d1d4dc; }

.tv-alerts-close {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: #787b86;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tv-alerts-close:hover { background: rgba(0, 0, 0, 0.05); }

.tv-alerts-body {
  display: flex;
  min-height: 360px;
}

.tv-alerts-nav {
  width: 148px;
  flex-shrink: 0;
  background: #f8f9fd;
  border-right: 1px solid #e0e3eb;
  padding: 8px 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

body[data-theme="dark"] .tv-alerts-nav {
  background: #131722;
  border-right-color: #363a45;
}

.tv-alerts-tab {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border: none;
  background: transparent;
  color: #131722;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
}

body[data-theme="dark"] .tv-alerts-tab { color: #d1d4dc; }

.tv-alerts-tab.active {
  background: #e3f6fc;
  color: #131722;
  font-weight: 500;
}

body[data-theme="dark"] .tv-alerts-tab.active {
  background: #1a3a52;
  color: #d1d4dc;
}

.tv-alerts-tab span { display: inline-flex; }

.tv-alerts-content {
  flex: 1;
  min-width: 0;
  background: #ffffff;
  position: relative;
}

body[data-theme="dark"] .tv-alerts-content { background: #1e222d; }

.tv-alerts-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 48px 32px;
  min-height: 360px;
}

.tv-alerts-empty-icon {
  margin-bottom: 16px;
}

.tv-alerts-empty h3 {
  margin: 0 0 8px;
  font-size: 16px;
  font-weight: 600;
  color: #131722;
}

body[data-theme="dark"] .tv-alerts-empty h3 { color: #d1d4dc; }

.tv-alerts-empty p {
  margin: 0;
  max-width: 320px;
  font-size: 13px;
  line-height: 1.5;
  color: #787b86;
}

.tv-alerts-list {
  padding: 8px 0;
  max-height: 360px;
  overflow-y: auto;
}

.tv-alerts-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  border-bottom: 1px solid #eef1f6;
}

body[data-theme="dark"] .tv-alerts-row { border-bottom-color: #2a2e39; }

.tv-alerts-row-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.tv-alerts-row-symbol {
  font-size: 14px;
  font-weight: 600;
  color: #131722;
}

body[data-theme="dark"] .tv-alerts-row-symbol { color: #d1d4dc; }

.tv-alerts-row-desc {
  font-size: 13px;
  color: #787b86;
}

.tv-alerts-row-meta {
  font-size: 12px;
  color: #b2b5be;
}

.tv-alerts-row-delete {
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: #787b86;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
}

.tv-alerts-row-delete:hover {
  background: #f0f3fa;
  color: #f7525f;
}

.tv-alerts-history-empty {
  padding: 48px 20px;
  text-align: center;
  color: #787b86;
  font-size: 13px;
}

.tv-alerts-add-form {
  padding: 24px 28px;
}

.tv-alerts-add-form h3 {
  margin: 0 0 16px;
  font-size: 15px;
  font-weight: 600;
  color: #131722;
}

body[data-theme="dark"] .tv-alerts-add-form h3 { color: #d1d4dc; }

.tv-alerts-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.tv-alerts-field span {
  font-size: 12px;
  font-weight: 500;
  color: #787b86;
}

.tv-alerts-field input,
.tv-alerts-field select {
  height: 36px;
  padding: 0 10px;
  border: 1px solid #e0e3eb;
  border-radius: 6px;
  background: #ffffff;
  color: #131722;
  font-size: 14px;
  font-family: inherit;
}

body[data-theme="dark"] .tv-alerts-field input,
body[data-theme="dark"] .tv-alerts-field select {
  background: #2a2e39;
  border-color: #363a45;
  color: #d1d4dc;
}

.tv-alerts-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 8px;
}

.tv-alerts-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-top: 1px solid #e0e3eb;
  background: #ffffff;
}

body[data-theme="dark"] .tv-alerts-footer {
  background: #1e222d;
  border-top-color: #363a45;
}

.tv-alerts-count {
  font-size: 13px;
  color: #787b86;
}

.tv-alerts-add-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 16px;
  border: none;
  border-radius: 18px;
  background: #00bcd4;
  color: #ffffff;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
}

.tv-alerts-add-btn:hover { background: #00acc1; }

.tv-alerts-add-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.tv-alerts-add-btn span { display: inline-flex; }

.tv-alert-toast {
  position: fixed;
  top: 72px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10060;
  max-width: calc(100vw - 32px);
  padding: 10px 16px;
  border-radius: 8px;
  background: #131722;
  color: #ffffff;
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  pointer-events: none;
}

.tv-alert-toast.hidden { display: none !important; }

.tv-settings-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--tv-border);
  flex-shrink: 0;
}

.tv-drag-handle { display: flex; color: #b2b5be; }
.tv-settings-title { flex: 1; font-size: 16px; font-weight: 600; color: var(--tv-text); }

.tv-settings-close {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--tv-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tv-settings-close:hover { background: var(--tv-hover); }

.tv-settings-body {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
}

.tv-settings-nav {
  width: 140px;
  background: #f8f9fd;
  border-right: 1px solid var(--tv-border);
  padding: 8px 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

body[data-theme="dark"] .tv-settings-nav { background: #131722; }

.tv-settings-tab {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border: none;
  background: transparent;
  color: var(--tv-text);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
}

.tv-settings-tab:hover { background: var(--tv-hover); }
.tv-settings-tab.active {
  background: var(--tv-active-bg);
  color: var(--tv-accent);
  font-weight: 600;
}

.tv-settings-content {
  flex: 1;
  min-height: 0;
  min-width: 0;
  padding: 16px 20px;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.tv-settings-panel { display: none; }
.tv-settings-panel.active { display: block; }

.tv-settings-panel h3 {
  margin: 0 0 12px;
  font-size: 14px;
  font-weight: 600;
  color: var(--tv-text);
}

.tv-settings-panel h3:not(:first-child) { margin-top: 20px; }

.tv-toggle-row,
.tv-color-row {
  display: flex;
  align-items: center;
  padding: 8px 0;
  font-size: 14px;
  color: var(--tv-text);
  cursor: pointer;
  gap: 8px;
}

.tv-toggle-row span:first-child { flex: 1; }

.tv-badge-new {
  font-size: 10px;
  font-weight: 700;
  color: var(--tv-accent);
  background: var(--tv-active-bg);
  padding: 1px 5px;
  border-radius: 3px;
}

.tv-toggle-extra { color: var(--tv-muted); display: flex; }

.tv-toggle-row input,
.tv-color-row input[type="color"] { display: none; }

.tv-switch {
  width: 38px;
  height: 22px;
  background: #d1d4dc;
  border-radius: 11px;
  position: relative;
  flex-shrink: 0;
  transition: background 0.2s;
}

.tv-switch::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.tv-toggle-row input:checked + .tv-switch {
  background: var(--tv-accent);
}

.tv-toggle-row input:checked + .tv-switch::after {
  transform: translateX(16px);
}

.tv-color-row input[type="color"] {
  display: block;
  width: 32px;
  height: 24px;
  border: 1px solid var(--tv-border);
  border-radius: 4px;
  padding: 0;
  cursor: pointer;
}

.tv-settings-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-top: 1px solid var(--tv-border);
  flex-shrink: 0;
  gap: 8px;
  flex-wrap: wrap;
}

.tv-reset-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: none;
  background: transparent;
  color: var(--tv-muted);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  padding: 6px 0;
}

.tv-reset-btn:hover { color: var(--tv-text); }

.tv-settings-actions { display: flex; gap: 8px; }

.tv-btn-ghost,
.tv-btn-ok {
  height: 34px;
  padding: 0 20px;
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  border: none;
}

.tv-btn-ghost {
  background: #f0f3fa;
  color: #131722;
}

.tv-btn-ok {
  background: #f0f3fa;
  color: #131722;
  font-weight: 600;
}

.tv-btn-ghost:hover,
.tv-btn-ok:hover { background: #e0e3eb; }

body[data-theme="dark"] .tv-btn-ghost,
body[data-theme="dark"] .tv-btn-ok {
  background: #2a2e39;
  color: #d1d4dc;
}

body[data-theme="dark"] .tv-btn-ghost:hover,
body[data-theme="dark"] .tv-btn-ok:hover {
  background: #363a45;
}

body[data-theme="dark"] .tv-settings-footer .tv-btn-ok {
  background: #2962ff;
  color: #ffffff;
}

body[data-theme="dark"] .tv-settings-footer .tv-btn-ok:hover {
  background: #1e53e5;
}

/* Confirmation dialog (delete all chart objects) */
.tv-confirm-overlay {
  position: fixed;
  inset: 0;
  z-index: 10001;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
}

.tv-confirm-dialog {
  width: 440px;
  max-width: calc(100vw - 32px);
  background: #ffffff;
  border-radius: 10px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
  overflow: hidden;
}

body[data-theme="dark"] .tv-confirm-dialog {
  background: #1e222d;
}

.tv-confirm-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px 12px;
  border-bottom: 1px solid var(--tv-border);
}

.tv-confirm-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--tv-text);
}

.tv-confirm-close {
  border: none;
  background: transparent;
  color: var(--tv-muted);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
}

.tv-confirm-close:hover {
  background: #f0f3fa;
  color: var(--tv-text);
}

body[data-theme="dark"] .tv-confirm-close:hover {
  background: #2a2e39;
}

.tv-confirm-body {
  padding: 16px 18px;
  font-size: 14px;
  color: var(--tv-text);
  line-height: 1.5;
}

.tv-confirm-actions {
  display: flex;
  gap: 10px;
  padding: 4px 18px 16px;
}

.tv-confirm-actions .tv-btn-ghost,
.tv-confirm-actions .tv-btn-danger {
  flex: 1;
  height: 38px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  border: none;
  cursor: pointer;
}

.tv-btn-danger {
  background: #d93b4f;
  color: #ffffff;
}

.tv-btn-danger:hover {
  background: #c22f43;
}

/* API key modal */
.tv-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
}

.tv-modal-card {
  background: var(--tv-header);
  color: var(--tv-text);
  border-radius: 8px;
  padding: 2rem;
  width: 360px;
  text-align: center;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
}

.tv-modal-card h2 { margin: 0 0 0.5rem; font-size: 1.2rem; }
.tv-modal-card p { color: var(--tv-muted); font-size: 0.875rem; margin-bottom: 1rem; }

.tv-modal-card input {
  width: 100%;
  padding: 0.65rem;
  border: 1px solid var(--tv-border);
  border-radius: 6px;
  background: var(--tv-bg);
  color: var(--tv-text);
  margin-bottom: 0.75rem;
  font-family: inherit;
}

.tv-btn-primary {
  width: 100%;
  padding: 0.65rem;
  background: var(--tv-accent);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  font-size: 0.9rem;
  font-family: inherit;
}

.tv-modal-card a {
  display: block;
  margin-top: 1rem;
  font-size: 0.8rem;
  color: var(--tv-accent);
  text-decoration: none;
}

.tv-draw-hint {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--tv-accent);
  color: #fff;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  z-index: 30;
  pointer-events: none;
  box-shadow: 0 4px 16px rgba(41, 98, 255, 0.35);
}

/* fx indicators dropdown */
.tv-fx-wrap { position: relative; }

.tv-tb-fx.panel-open {
  background: #e0eaff;
  border-radius: 6px;
  color: #2962ff;
}

.tv-layout-wrap .tv-tb-icon.panel-open {
  background: #e0eaff;
  border-radius: 6px;
  color: #2962ff;
}

[data-theme="dark"] .tv-layout-wrap .tv-tb-icon.panel-open {
  background: #1a3a6e;
  color: #5b9cf6;
}

[data-theme="dark"] .tv-tb-fx.panel-open {
  background: #1a3a6e;
  color: #5b9cf6;
}

.tv-fx-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 320;
  width: 220px;
  background: #ffffff;
  border: 1px solid #e0e3eb;
  border-radius: 6px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  padding: 8px 0;
  overflow: hidden;
}

[data-theme="dark"] .tv-fx-menu {
  background: #1e222d;
  border-color: #2a2e39;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
}

.tv-fx-section { padding: 4px 0; }

.tv-fx-section-title {
  padding: 6px 16px 4px;
  font-size: 11px;
  font-weight: 600;
  color: #787b86;
  letter-spacing: 0.02em;
}

.tv-fx-divider {
  height: 1px;
  margin: 6px 0;
  background: #e0e3eb;
}

[data-theme="dark"] .tv-fx-divider { background: #363a45; }

.tv-fx-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 36px;
  padding: 0 16px;
  border: none;
  background: transparent;
  color: #131722;
  font-size: 14px;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
}

.tv-fx-item:hover { background: #f0f3fa; }

[data-theme="dark"] .tv-fx-item {
  color: #d1d4dc;
}

[data-theme="dark"] .tv-fx-item:hover { background: #2a2e39; }

.tv-fx-item-indent { padding-left: 44px; }

.tv-fx-item-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #787b86;
}

.tv-fx-item-icon svg {
  width: 18px;
  height: 18px;
  display: block;
}

/* Add indicator dialog */
.tv-add-ind-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(0, 0, 0, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}

.tv-add-ind-dialog {
  width: 400px;
  max-width: 100%;
  max-height: calc(100vh - 48px);
  background: #ffffff;
  border: 1px solid #e0e3eb;
  border-radius: 8px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

[data-theme="dark"] .tv-add-ind-dialog {
  background: #1e222d;
  border-color: #2a2e39;
}

.tv-add-ind-header {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 12px 0 14px;
  border-bottom: 1px solid #e0e3eb;
  background: #f0f3fa;
  flex-shrink: 0;
}

[data-theme="dark"] .tv-add-ind-header {
  border-color: #363a45;
  background: #2a2e39;
}

.tv-add-ind-title {
  flex: 1;
  font-size: 16px;
  font-weight: 600;
  color: #131722;
}

[data-theme="dark"] .tv-add-ind-title { color: #d1d4dc; }

.tv-add-ind-close {
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  border-radius: 4px;
  background: transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #787b86;
}

.tv-add-ind-close:hover { background: #f0f3fa; }

.tv-add-ind-search {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 16px 16px 10px;
  padding: 0 12px;
  height: 38px;
  border: 1px solid #e0e3eb;
  border-radius: 8px;
  background: #ffffff;
  flex-shrink: 0;
}

[data-theme="dark"] .tv-add-ind-search {
  background: #131722;
  border-color: #363a45;
}

.tv-add-ind-search-icon {
  display: inline-flex;
  color: #b2b5be;
  flex-shrink: 0;
}

.tv-add-ind-search-icon svg {
  width: 16px;
  height: 16px;
  display: block;
}

.tv-add-ind-search input {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  font-size: 14px;
  font-family: inherit;
  color: #131722;
  outline: none;
}

[data-theme="dark"] .tv-add-ind-search input { color: #d1d4dc; }

.tv-add-ind-search input::placeholder { color: #b2b5be; }

.tv-add-ind-search-clear {
  width: 20px;
  height: 20px;
  padding: 0;
  border: none;
  background: transparent;
  color: #b2b5be;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
}

.tv-add-ind-search-clear:hover { color: #787b86; }

.tv-add-ind-label {
  padding: 8px 16px 10px;
  font-size: 13px;
  font-weight: 500;
  color: #787b86;
  letter-spacing: 0;
  text-transform: none;
  flex-shrink: 0;
  border-bottom: 1px solid #e0e3eb;
  margin: 0 8px;
}

.tv-add-ind-list {
  flex: 1;
  min-height: 0;
  max-height: 380px;
  overflow-y: auto;
  padding: 4px 8px 8px;
}

.tv-add-ind-row {
  display: block;
  width: 100%;
  padding: 12px 12px;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: #4a5568;
  font-size: 14px;
  font-weight: 400;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  line-height: 1.4;
}

.tv-add-ind-row:hover { background: #f0f3fa; }

.tv-add-ind-row.selected {
  background: #e3effd;
  color: #131722;
}

[data-theme="dark"] .tv-add-ind-row {
  color: #d1d4dc;
}

[data-theme="dark"] .tv-add-ind-row:hover { background: #2a2e39; }

[data-theme="dark"] .tv-add-ind-row.selected {
  background: #1a3a6e;
  color: #d1d4dc;
}

.tv-add-ind-row.is-active::after {
  content: ' · on chart';
  color: #787b86;
  font-size: 12px;
}

.tv-add-ind-empty {
  padding: 24px 16px;
  text-align: center;
  color: #787b86;
  font-size: 13px;
}

.tv-add-ind-footer {
  display: flex;
  justify-content: flex-end;
  padding: 12px 16px 14px;
  border-top: 1px solid #e0e3eb;
  flex-shrink: 0;
}

[data-theme="dark"] .tv-add-ind-footer { border-color: #363a45; }

.tv-add-ind-continue {
  min-width: 96px;
  height: 34px;
  padding: 0 18px;
  border: none;
  border-radius: 6px;
  background: #2962ff;
  color: #ffffff;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
}

.tv-add-ind-continue:disabled {
  background: #e0e3eb;
  color: #ffffff;
  cursor: default;
}

[data-theme="dark"] .tv-add-ind-continue:disabled {
  background: #363a45;
  color: #787b86;
}

.tv-add-ind-step {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
}

.tv-add-ind-subhead {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 12px;
  border-bottom: 1px solid #e0e3eb;
  flex-shrink: 0;
}

[data-theme="dark"] .tv-add-ind-subhead { border-color: #363a45; }

.tv-add-ind-back {
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  border-radius: 4px;
  background: transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #787b86;
  flex-shrink: 0;
}

.tv-add-ind-back:hover { background: #f0f3fa; }

[data-theme="dark"] .tv-add-ind-back:hover { background: #2a2e39; }

.tv-add-ind-subhead-name {
  font-size: 15px;
  font-weight: 600;
  color: #131722;
  line-height: 1.3;
}

[data-theme="dark"] .tv-add-ind-subhead-name { color: #d1d4dc; }

.tv-add-ind-settings-body {
  padding: 16px 16px 24px;
  flex: 1;
  min-height: 200px;
  overflow-y: auto;
}

.tv-add-ind-params-section {
  margin-bottom: 20px;
}

.tv-add-ind-params-fields {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.tv-add-ind-param-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tv-add-ind-param-input {
  width: 100%;
  height: 36px;
  padding: 0 10px;
  border: 1px solid #e0e3eb;
  border-radius: 6px;
  background: #ffffff;
  color: #131722;
  font-size: 13px;
  font-family: inherit;
}

.tv-add-ind-param-input:focus {
  outline: none;
  border-color: #2962ff;
}

[data-theme="dark"] .tv-add-ind-param-input {
  background: #131722;
  border-color: #363a45;
  color: #d1d4dc;
}

.tv-add-ind-styles-section.hidden,
.tv-add-ind-params-section.hidden {
  display: none;
}

.tv-add-ind-style-weight.hidden,
.tv-ind-weight-sep.hidden {
  display: none;
}

/* Hide header indicator legend — chart objects panel only */
.tv-ind-legend {
  display: none !important;
}

.tv-add-ind-section-title {
  font-size: 14px;
  font-weight: 600;
  color: #131722;
  margin-bottom: 12px;
}

[data-theme="dark"] .tv-add-ind-section-title { color: #d1d4dc; }

.tv-add-ind-field-label {
  font-size: 12px;
  color: #787b86;
  margin-bottom: 8px;
}

.tv-add-ind-style-row {
  display: flex;
  align-items: center;
  height: 40px;
  border: 1px solid #e0e3eb;
  border-radius: 6px;
  background: #ffffff;
  overflow: hidden;
}

[data-theme="dark"] .tv-add-ind-style-row {
  background: #131722;
  border-color: #363a45;
}

.tv-add-ind-style-color,
.tv-add-ind-style-weight {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 100%;
  padding: 0 12px;
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 13px;
  color: #131722;
  cursor: pointer;
}

.tv-add-ind-style-color {
  flex: 1;
  min-width: 0;
  position: relative;
}

.tv-add-ind-style-color:hover,
.tv-add-ind-style-weight:hover {
  background: #f8f9fd;
}

[data-theme="dark"] .tv-add-ind-style-color,
[data-theme="dark"] .tv-add-ind-style-weight {
  color: #d1d4dc;
}

[data-theme="dark"] .tv-add-ind-style-color:hover,
[data-theme="dark"] .tv-add-ind-style-weight:hover {
  background: #2a2e39;
}

.tv-add-ind-color-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1px solid transparent;
  flex-shrink: 0;
}

.tv-add-ind-color-hex {
  font-size: 13px;
  color: #131722;
  letter-spacing: 0.01em;
}

[data-theme="dark"] .tv-add-ind-color-hex { color: #d1d4dc; }

.tv-add-ind-color-input {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  opacity: 0;
  cursor: pointer;
  border: none;
  padding: 0;
}

.tv-add-ind-style-sep {
  width: 1px;
  height: 24px;
  background: #e0e3eb;
  flex-shrink: 0;
}

[data-theme="dark"] .tv-add-ind-style-sep { background: #363a45; }

.tv-add-ind-style-weight {
  flex-shrink: 0;
  color: #787b86;
}

.tv-add-ind-line-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 12px;
}

.tv-add-ind-line-icon svg {
  display: block;
}

.tv-add-ind-footer-split {
  justify-content: flex-end;
  gap: 8px;
}

.tv-add-ind-cancel {
  min-width: 80px;
  height: 34px;
  padding: 0 16px;
  border: none;
  border-radius: 6px;
  background: #f0f3fa;
  color: #131722;
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
}

.tv-add-ind-cancel:hover { background: #e0e3eb; }

[data-theme="dark"] .tv-add-ind-cancel {
  background: #2a2e39;
  color: #d1d4dc;
}

.tv-add-ind-submit {
  min-width: 130px;
  height: 34px;
  padding: 0 16px;
  border: none;
  border-radius: 6px;
  background: #3fd1c2;
  color: #ffffff;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
}

.tv-add-ind-submit:hover { background: #36bfb1; }

/* Indicator templates dialog */
.tv-ind-tpl-overlay {
  position: fixed;
  inset: 0;
  z-index: 10001;
  background: rgba(0, 0, 0, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}

.tv-ind-tpl-dialog {
  width: 360px;
  max-width: 100%;
  max-height: calc(100vh - 48px);
  background: #ffffff;
  border: 1px solid #e0e3eb;
  border-radius: 8px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

[data-theme="dark"] .tv-ind-tpl-dialog {
  background: #1e222d;
  border-color: #2a2e39;
}

.tv-ind-tpl-body {
  max-height: 360px;
  overflow-y: auto;
  padding: 8px 0 12px;
}

.tv-ind-tpl-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
}

.tv-ind-tpl-row:hover { background: #f0f3fa; }

.tv-ind-tpl-name {
  flex: 1;
  font-size: 14px;
  color: #131722;
  cursor: pointer;
}

.tv-ind-tpl-actions {
  display: flex;
  gap: 4px;
}

.tv-ind-tpl-btn {
  padding: 4px 10px;
  border: 1px solid #e0e3eb;
  border-radius: 4px;
  background: #fff;
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  color: #131722;
}

.tv-ind-tpl-btn:hover { background: #f0f3fa; }

.tv-ind-tpl-btn.danger { color: #f23645; border-color: #f23645; }

.tv-ind-tpl-empty {
  padding: 24px 16px;
  text-align: center;
  color: #787b86;
  font-size: 13px;
}

/* ── Mobile layout (TradingView phone UI) ── */
.tv-mob-only { display: none !important; }

@media (max-width: 768px) {
  .tv-mob-only { display: flex !important; }
  .tv-desktop-only { display: none !important; }

  body[data-theme="light"].tv-mobile {
    --tv-header: #ffffff;
    --tv-toolbar-bg: #ffffff;
  }

  body.tv-mobile .tv-terminal {
    padding-bottom: calc(44px + env(safe-area-inset-bottom, 0px));
    height: 100%;
    max-height: 100dvh;
  }

  body.tv-mobile .tv-workspace {
    display: flex;
    flex: 1;
    min-height: 0;
    width: 100%;
  }

  body.tv-mobile .tv-workspace .tv-chart {
    flex: 1;
    min-height: 0;
    width: 100%;
  }

  body.tv-mobile .tv-header-bar {
    height: 48px;
    padding: 0 12px;
    background: var(--tv-header);
    border-bottom: none;
    gap: 8px;
  }

  [data-theme="dark"].tv-mobile .tv-header-bar {
    background: var(--tv-header);
  }

  body.tv-mobile .tv-h-left {
    flex: 1;
    min-width: 0;
    gap: 8px;
  }

  body.tv-mobile .tv-desktop-toolbar {
    display: none !important;
  }

  body.tv-mobile .tv-sym-name {
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -0.01em;
  }

  body.tv-mobile .tv-sym-logo {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    font-size: 11px;
    line-height: 20px;
    background: transparent;
    color: inherit;
  }

  body.tv-mobile .tv-sym-logo:not(.tv-sym-flag) {
    background: #f7931a;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
  }

  body.tv-mobile .tv-mob-back {
    width: 32px;
    height: 32px;
    padding: 0;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--tv-text);
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    cursor: pointer;
  }

  body.tv-mobile .tv-mob-back svg {
    width: 18px;
    height: 18px;
    display: block;
  }

  body.tv-mobile .tv-mob-header-actions {
    display: inline-flex !important;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
    flex-shrink: 0;
    margin-left: auto;
  }

  /* TradingView switch — mobile header, beside settings */
  body.tv-mobile .tv-adv-switch-wrap--mob {
    display: inline-flex !important;
    align-items: center;
    gap: 5px;
    height: 36px;
    margin: 0;
    padding: 0 2px;
    flex-shrink: 0;
  }

  body.tv-mobile .tv-adv-switch-wrap--mob .tv-adv-logo {
    width: 18px;
    height: 18px;
    color: #131722;
  }

  [data-theme="dark"].tv-mobile .tv-adv-switch-wrap--mob .tv-adv-logo {
    color: #d1d4dc;
  }

  body.tv-mobile.tv-advanced-mode .tv-adv-switch-wrap--mob .tv-adv-logo {
    color: #131722;
  }

  [data-theme="dark"].tv-mobile.tv-advanced-mode .tv-adv-switch-wrap--mob .tv-adv-logo {
    color: #d1d4dc;
  }

  body.tv-mobile .tv-adv-switch-wrap--mob .tv-adv-switch {
    width: 34px;
    height: 18px;
  }

  body.tv-mobile .tv-adv-switch-wrap--mob .tv-adv-slider::before {
    width: 14px;
    height: 14px;
    left: 2px;
    top: 2px;
  }

  body.tv-mobile .tv-adv-switch-wrap--mob .tv-adv-switch input:checked + .tv-adv-slider::before {
    transform: translateX(16px);
  }

  body.tv-mobile .tv-mob-icon-btn {
    width: 36px;
    height: 36px;
    padding: 0;
    border: none;
    border-radius: 8px;
    background: #eef1f7;
    color: #434651;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
  }

  [data-theme="dark"].tv-mobile .tv-mob-icon-btn {
    background: #2a2e39;
    color: #d1d4dc;
  }

  body.tv-mobile .tv-mob-icon-btn svg {
    width: 18px;
    height: 18px;
    display: block;
  }

  body.tv-mobile .tv-chart {
    flex: 1;
    min-height: 0;
  }

  body.tv-mobile .tv-session-hl {
    position: absolute;
    top: 8px;
    left: 10px;
    z-index: 12;
    display: inline-flex !important;
    align-items: center;
    gap: 10px;
    pointer-events: none;
    padding: 0;
  }

  body.tv-mobile .tv-session-hl .tv-hl-item {
    font-size: 13px;
    font-weight: 500;
  }

  body.tv-mobile .tv-session-hl .tv-hl-lbl {
    color: #787b86;
    font-weight: 500;
  }

  body.tv-mobile .tv-session-hl .tv-hl-item:not(.tv-l) b {
    color: var(--tv-hl-up, var(--tv-up));
    font-weight: 600;
  }

  body.tv-mobile .tv-session-hl .tv-hl-item.tv-l b {
    color: var(--tv-hl-down, var(--tv-down));
    font-weight: 600;
  }

  /* OHLC in-chart legend on mobile TV mode */
  body.tv-mobile.tv-advanced-mode #tv-ohlc-inline {
    display: inline-flex !important;
    align-items: baseline;
    gap: 7px;
    max-width: calc(100vw - 64px);
    overflow: hidden;
  }

  body.tv-mobile.tv-advanced-mode .tv-ohlc-pair {
    gap: 3px;
  }

  body.tv-mobile.tv-advanced-mode .tv-ohlc-pair i,
  body.tv-mobile.tv-advanced-mode .tv-ohlc-pair b,
  body.tv-mobile.tv-advanced-mode .tv-ohlc-chg {
    font-size: 11px;
    line-height: 1.2;
  }

  body.tv-mobile.tv-advanced-mode .tv-session-hl .tv-session-only {
    display: none !important;
  }

  /* Hide bottom-bar tools covered by left rail in TV mode */
  body.tv-mobile.tv-advanced-mode .tv-mob-toolbar-carousel .tv-draw-wrap,
  body.tv-mobile.tv-advanced-mode .tv-mob-toolbar-carousel #btn-alerts,
  body.tv-mobile.tv-advanced-mode .tv-mob-toolbar-carousel #btn-crosshair,
  body.tv-mobile.tv-advanced-mode .tv-mob-toolbar-carousel #btn-measure,
  body.tv-mobile.tv-advanced-mode .tv-mob-toolbar-carousel [data-mob-order="10"],
  body.tv-mobile.tv-advanced-mode .tv-mob-toolbar-carousel #btn-zoom-out,
  body.tv-mobile.tv-advanced-mode .tv-mob-toolbar-carousel #btn-zoom-in,
  body.tv-mobile.tv-advanced-mode .tv-mob-toolbar-carousel #btn-cloud {
    display: none !important;
  }

  body.tv-mobile .tv-mob-toolbar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 320;
    display: block !important;
    background: var(--tv-toolbar-bg);
    border-top: 1px solid var(--tv-border);
    height: 44px;
    padding: 0;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    box-shadow: 0 -1px 8px rgba(0, 0, 0, 0.04);
    overflow: hidden;
  }

  [data-theme="dark"].tv-mobile .tv-mob-toolbar {
    background: var(--tv-toolbar-bg);
    border-top-color: var(--tv-border);
  }

  body.tv-mobile .tv-mob-toolbar-carousel {
    display: flex;
    align-items: center;
    gap: 0;
    width: 100%;
    height: 100%;
    min-width: 0;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    padding: 0 4px 0 6px;
    padding-right: var(--tv-mob-toolbar-end-w, 132px);
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
    mask-image: linear-gradient(to right, transparent 0, #000 6px, #000 100%);
  }

  body.tv-mobile .tv-mob-toolbar-carousel::-webkit-scrollbar { display: none; }

  body.tv-mobile .tv-mob-toolbar-carousel > .tv-mob-bar-item {
    scroll-snap-align: start;
    flex-shrink: 0;
  }

  body.tv-mobile .tv-mob-toolbar-end {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    z-index: 3;
    display: flex;
    align-items: center;
    flex-shrink: 0;
    padding: 0 10px 0 8px;
    background: var(--tv-toolbar-bg);
    border-left: 1px solid var(--tv-border);
    box-shadow: -10px 0 14px -8px rgba(0, 0, 0, 0.12);
    pointer-events: auto;
  }

  [data-theme="dark"].tv-mobile .tv-mob-toolbar-end {
    background: var(--tv-toolbar-bg);
    border-left-color: var(--tv-border);
    box-shadow: -10px 0 14px -8px rgba(0, 0, 0, 0.4);
  }

  body.tv-mobile .tv-mob-end-sep {
    display: none;
  }

  /* Mobile popups — portaled to body, fixed above toolbar */
  .tv-mob-backdrop {
    position: fixed;
    inset: 0;
    z-index: 340;
    background: rgba(0, 0, 0, 0.28);
  }

  .tv-mob-backdrop.hidden { display: none !important; }

  .tv-mob-popup-root {
    position: fixed;
    inset: 0;
    z-index: 350;
    pointer-events: none;
  }

  body.tv-mobile .tv-mob-popup-root .tv-dropdown:not(.hidden),
  body.tv-mobile .tv-mob-popup-root .tv-fx-menu:not(.hidden),
  body.tv-mobile .tv-mob-popup-root .tv-layout-tpl-menu:not(.hidden),
  body.tv-mobile .tv-mob-popup-root .tv-draw-panel:not(.hidden),
  body.tv-mobile .tv-mob-popup-root .tv-objects-panel:not(.hidden),
  body.tv-mobile .tv-mob-popup-root .tv-picker:not(.hidden),
  body.tv-mobile .tv-mob-popup-root .tv-mob-sheet:not(.hidden) {
    position: fixed !important;
    left: 0 !important;
    right: 0 !important;
    top: 48px !important;
    bottom: auto !important;
    width: auto !important;
    max-width: none !important;
    max-height: calc(100dvh - 48px - 56px - env(safe-area-inset-bottom, 0px)) !important;
    height: auto !important;
    overflow: hidden;
    pointer-events: auto;
    z-index: 360 !important;
    border-radius: 0 0 12px 12px;
    border: 1px solid var(--tv-border);
    border-top: none;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.22);
    padding: 0;
    display: flex;
    flex-direction: column;
    background: var(--tv-bg);
    color: var(--tv-text);
  }

  /* Mobile sheet chrome — theme tokens only */
  body.tv-mobile .tv-mob-sheet-head,
  body.tv-mobile .tv-draw-panel-head.tv-mob-sheet-head,
  body.tv-mobile .tv-mob-popup-root .tv-objects-head,
  body.tv-mobile .tv-mob-popup-root .tv-layout-tpl-menu > .tv-layout-tpl-section:first-child .tv-layout-tpl-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 48px;
    padding: 0 16px;
    background: var(--tv-header);
    border-bottom: 1px solid var(--tv-border);
    flex-shrink: 0;
    border-radius: 0;
    color: var(--tv-text);
  }

  body.tv-mobile .tv-mob-sheet-title,
  body.tv-mobile .tv-draw-panel-title.tv-mob-sheet-title,
  body.tv-mobile .tv-mob-popup-root .tv-objects-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--tv-text);
    letter-spacing: -0.01em;
  }

  body.tv-mobile .tv-mob-sheet-close,
  body.tv-mobile .tv-draw-panel-close.tv-mob-sheet-close,
  body.tv-mobile .tv-mob-popup-root .tv-objects-close {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: var(--tv-muted);
    font-size: 22px;
    font-weight: 300;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    margin: 0 -6px 0 0;
  }

  body.tv-mobile .tv-mob-sheet-close:hover,
  body.tv-mobile .tv-mob-popup-root .tv-objects-close:hover {
    background: var(--tv-hover);
    color: var(--tv-text);
  }

  body.tv-mobile .tv-mob-sheet-body,
  body.tv-mobile .tv-mob-popup-root .tv-objects-body {
    overflow-y: auto;
    flex: 1;
    min-height: 0;
    background: var(--tv-bg);
    color: var(--tv-text);
    padding: 12px 16px 16px;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }

  body.tv-mobile .tv-mob-section-label,
  body.tv-mobile .tv-draw-col-title {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--tv-muted);
    margin: 0 0 10px;
    padding: 0;
  }

  /* ── Timeframe popup ── */
  body.tv-mobile .tv-mob-popup-root .tv-interval-menu.tv-mob-sheet:not(.hidden),
  body.tv-mobile .tv-mob-popup-root .tv-dropdown.tv-interval-menu:not(.hidden) {
    background: var(--tv-bg) !important;
    color: var(--tv-text);
    border-color: var(--tv-border);
  }

  body.tv-mobile .tv-mob-interval-section {
    padding: 10px 0 14px;
    border-bottom: 1px solid var(--tv-border);
  }

  body.tv-mobile .tv-mob-interval-section:last-child {
    border-bottom: none;
    padding-bottom: 4px;
  }

  body.tv-mobile .tv-mob-pill-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }

  body.tv-mobile .tv-mob-pill-btn {
    flex: 1 1 calc(25% - 6px);
    min-width: 62px;
    min-height: 44px;
    padding: 0 10px;
    border: 1px solid var(--tv-border);
    border-radius: 8px;
    background: var(--tv-hover);
    color: var(--tv-text);
    font-size: 14px;
    font-weight: 500;
    font-family: var(--tv-font);
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }

  body.tv-mobile .tv-mob-pill-btn:hover {
    background: var(--tv-active-bg);
  }

  body.tv-mobile .tv-mob-pill-btn.active {
    background: rgba(41, 98, 255, 0.16);
    border-color: var(--tv-accent);
    color: var(--tv-accent);
    font-weight: 700;
  }

  /* ── Default chart / layout templates popup ── */
  body.tv-mobile .tv-mob-popup-root .tv-layout-tpl-menu:not(.hidden) {
    background: var(--tv-bg) !important;
    color: var(--tv-text);
    border-color: var(--tv-border);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
  }

  body.tv-mobile .tv-mob-popup-root .tv-layout-tpl-menu .tv-layout-tpl-section {
    padding: 8px 0;
    border-bottom: 1px solid var(--tv-border);
  }

  body.tv-mobile .tv-mob-popup-root .tv-layout-tpl-menu .tv-layout-tpl-section:last-child {
    border-bottom: none;
  }

  body.tv-mobile .tv-mob-popup-root .tv-layout-tpl-title {
    display: block;
    padding: 12px 16px 8px;
    margin: 0;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--tv-muted);
    background: transparent;
    border: none;
    min-height: 0;
  }

  body.tv-mobile .tv-mob-popup-root .tv-layout-tpl-row,
  body.tv-mobile .tv-mob-popup-root .tv-layout-tpl-action,
  body.tv-mobile .tv-mob-popup-root .tv-layout-tpl-pick {
    color: var(--tv-text) !important;
    background: transparent;
  }

  body.tv-mobile .tv-mob-popup-root .tv-layout-tpl-action:hover,
  body.tv-mobile .tv-mob-popup-root .tv-layout-tpl-pick:hover,
  body.tv-mobile .tv-mob-popup-root .tv-layout-tpl-row:hover {
    background: var(--tv-hover) !important;
  }

  body.tv-mobile .tv-mob-popup-root .tv-layout-tpl-label,
  body.tv-mobile .tv-mob-popup-root .tv-layout-tpl-pick-name {
    color: var(--tv-text);
  }

  body.tv-mobile .tv-mob-popup-root .tv-layout-tpl-divider {
    background: var(--tv-border);
  }

  body.tv-mobile .tv-mob-popup-root .tv-layout-tpl-icon,
  body.tv-mobile .tv-mob-popup-root .tv-layout-tpl-icon svg {
    color: var(--tv-muted);
    fill: currentColor;
  }

  body.tv-mobile .tv-mob-popup-root .tv-layout-tpl-empty {
    color: var(--tv-muted);
  }

  /* ── Chart objects popup ── */
  body.tv-mobile .tv-mob-popup-root .tv-objects-panel:not(.hidden) {
    display: flex;
    flex-direction: column;
    background: var(--tv-bg) !important;
    color: var(--tv-text);
    border-color: var(--tv-border);
  }

  body.tv-mobile .tv-mob-popup-root .tv-objects-head {
    background: var(--tv-header);
    border-bottom: 1px solid var(--tv-border);
  }

  body.tv-mobile .tv-mob-popup-root .tv-obj-row {
    border-bottom-color: var(--tv-border);
    color: var(--tv-text);
    min-height: 48px;
    padding: 8px 14px;
  }

  body.tv-mobile .tv-mob-popup-root .tv-obj-row:hover,
  body.tv-mobile .tv-mob-popup-root .tv-obj-row:active {
    background: var(--tv-hover);
  }

  body.tv-mobile .tv-mob-popup-root .tv-obj-all {
    background: var(--tv-hover);
  }

  body.tv-mobile .tv-mob-popup-root .tv-obj-icon {
    color: var(--tv-muted);
  }

  body.tv-mobile .tv-mob-popup-root .tv-obj-name,
  body.tv-mobile .tv-mob-popup-root .tv-obj-label {
    color: var(--tv-text);
  }

  body.tv-mobile .tv-mob-popup-root .tv-obj-act {
    color: var(--tv-muted);
  }

  body.tv-mobile .tv-mob-popup-root .tv-obj-act:hover {
    background: var(--tv-active-bg);
    color: var(--tv-text);
  }

  /* Chart type sheet (candles/bars/…) */
  body.tv-mobile .tv-mob-popup-root .tv-chart-type-menu:not(.hidden) {
    background: var(--tv-bg) !important;
    color: var(--tv-text);
    border-color: var(--tv-border);
  }

  body.tv-mobile .tv-mob-popup-root .tv-type-item.tv-mob-grid-btn,
  body.tv-mobile .tv-mob-popup-root .tv-type-item {
    background: var(--tv-hover);
    color: var(--tv-text);
    border: 1px solid var(--tv-border);
  }

  body.tv-mobile .tv-mob-popup-root .tv-type-item:hover {
    background: var(--tv-active-bg);
  }

  body.tv-mobile .tv-mob-popup-root .tv-type-item.active {
    background: rgba(41, 98, 255, 0.16);
    border-color: var(--tv-accent);
    color: var(--tv-accent);
  }

  body.tv-mobile .tv-mob-popup-root .tv-type-item.active .tv-type-icon {
    color: var(--tv-accent);
  }

  body.tv-mobile .tv-mob-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding: 12px 16px 16px;
    background: var(--tv-bg);
  }

  body.tv-mobile .tv-mob-grid-btn,
  body.tv-mobile .tv-mob-draw-list .tv-draw-tool {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 52px;
    padding: 10px 12px;
    border: 1px solid var(--tv-border);
    border-radius: 10px;
    background: var(--tv-hover);
    color: var(--tv-text);
    font-size: 14px;
    font-weight: 500;
    font-family: var(--tv-font);
    text-align: left;
    cursor: pointer;
  }

  body.tv-mobile .tv-mob-grid-btn.active,
  body.tv-mobile .tv-mob-draw-list .tv-draw-tool.active {
    background: rgba(41, 98, 255, 0.16);
    border-color: var(--tv-accent);
    color: var(--tv-accent);
    font-weight: 600;
  }

  body.tv-mobile .tv-mob-grid-btn .tv-type-icon,
  body.tv-mobile .tv-mob-draw-list .tv-draw-tool-icon {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    color: var(--tv-muted);
  }

  body.tv-mobile .tv-mob-grid-btn.active .tv-type-icon,
  body.tv-mobile .tv-mob-draw-list .tv-draw-tool.active .tv-draw-tool-icon {
    color: var(--tv-accent);
  }

  body.tv-mobile .tv-mob-popup-root .tv-draw-panel:not(.hidden) .tv-draw-panel-grid {
    overflow-y: auto;
    grid-template-columns: 1fr;
    flex: 1;
    min-height: 0;
    padding: 0;
    background: transparent;
  }

  body.tv-mobile .tv-mob-popup-root .tv-draw-col {
    border: none;
    border-bottom: 1px solid var(--tv-border);
    padding: 12px 16px;
  }

  body.tv-mobile .tv-mob-popup-root .tv-draw-col:last-child {
    border-bottom: none;
  }

  body.tv-mobile .tv-mob-draw-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  body.tv-mobile .tv-mob-draw-list .tv-draw-tool-name {
    font-size: 13px;
    line-height: 1.2;
  }

  body.tv-mobile .tv-desktop-only {
    display: none !important;
  }

  /* Left drawing toolbar — mobile TV mode */
  body.tv-mobile.tv-advanced-mode .tv-left-tb:not([hidden]) {
    display: flex !important;
    width: 44px;
    z-index: 28;
  }

  body.tv-mobile.tv-advanced-mode .tv-left-tb.is-collapsed:not([hidden]) {
    display: flex !important;
    width: 0;
  }

  body.tv-mobile .tv-left-tb-btn {
    width: 34px;
    height: 34px;
  }

  body.tv-mobile .tv-left-tb-rail {
    padding: 4px 0 48px;
    gap: 0;
  }

  body.tv-mobile .tv-left-tb-collapse {
    bottom: 8px;
    width: 16px;
    height: 32px;
  }

  body.tv-mobile.tv-advanced-mode .tv-left-tb-flyout,
  body.tv-mobile.tv-advanced-mode .tv-icons-popup {
    position: fixed !important;
    top: 48px !important;
    left: 44px !important;
    right: auto !important;
    bottom: auto !important;
    margin: 0 !important;
    width: min(292px, calc(100vw - 52px)) !important;
    max-width: calc(100vw - 52px) !important;
    max-height: calc(100dvh - 48px - 56px - env(safe-area-inset-bottom, 0px) - 8px) !important;
    z-index: 370 !important;
    border-radius: 0 0 10px 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.16);
  }

  body.tv-mobile.tv-advanced-mode .tv-left-tb-flyout.tv-left-tb-flyout-cursor {
    width: min(220px, calc(100vw - 52px)) !important;
  }

  body.tv-mobile .tv-mob-popup-root .tv-objects-panel:not(.hidden) {
    display: flex;
    flex-direction: column;
  }

  body.tv-mobile .tv-mob-toolbar-carousel .tv-tb-icon.active,
  body.tv-mobile .tv-mob-toolbar-carousel .tv-tb-icon.panel-open,
  body.tv-mobile .tv-mob-toolbar-carousel .tv-draw-btn.panel-open,
  body.tv-mobile .tv-mob-toolbar-end .tv-tb-icon.active,
  body.tv-mobile .tv-mob-toolbar-end .tv-tb-icon.panel-open {
    background: rgba(0, 188, 212, 0.14);
    color: #00bcd4;
    border-radius: 8px;
  }

  body.tv-mobile .tv-mob-toolbar-carousel .tv-tb-text:active,
  body.tv-mobile .tv-mob-toolbar-end .tv-tb-text:active {
    background: var(--tv-hover);
    border-radius: 8px;
  }

  body.tv-mobile .tv-mob-toolbar-carousel .tv-tb-text,
  body.tv-mobile .tv-mob-toolbar-end .tv-tb-text {
    height: 36px;
    min-width: 36px;
    padding: 0 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--tv-text);
    flex-shrink: 0;
  }

  body.tv-mobile .tv-mob-toolbar-carousel .tv-tb-icon,
  body.tv-mobile .tv-mob-toolbar-end .tv-tb-icon {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
  }

  body.tv-mobile .tv-mob-toolbar-carousel .tv-tb-icon svg,
  body.tv-mobile .tv-mob-toolbar-carousel .tv-tb-icon img,
  body.tv-mobile .tv-mob-toolbar-end .tv-tb-icon svg,
  body.tv-mobile .tv-mob-toolbar-end .tv-tb-icon img {
    width: 24px;
    height: 24px;
  }

  body.tv-mobile .tv-mob-toolbar-carousel .tv-tb-fx {
    font-family: var(--tv-font);
    font-style: italic;
    font-weight: 700;
    font-size: 15px;
    letter-spacing: -0.02em;
    color: #4c525e;
    line-height: 1;
  }

  [data-theme="dark"].tv-mobile .tv-mob-toolbar-carousel .tv-tb-fx {
    color: #b2b5be;
  }

  body.tv-mobile .tv-mob-toolbar-carousel .tv-tb-fx svg {
    width: 26px;
    height: 26px;
  }

  body.tv-mobile .tv-mob-toolbar-carousel .tv-tb-sep {
    height: 22px;
    margin: 0 6px;
    flex-shrink: 0;
  }

  body.tv-mobile .tv-mob-toolbar-end .tv-template-btn {
    height: 36px;
    padding: 0 2px 0 4px;
    font-size: 13px;
    font-weight: 600;
    color: var(--tv-text);
    white-space: nowrap;
    flex-shrink: 0;
  }

  body.tv-mobile .tv-mob-toolbar-end .tv-chev-sm {
    color: var(--tv-muted);
  }

  body.tv-mobile .tv-mob-toolbar-end .tv-layout-tpl-wrap {
    flex-shrink: 0;
  }

  body.tv-mobile .tv-chart-host.tv-mob-draw-active {
    touch-action: none;
  }

  body.tv-mobile .tv-drawing-toolbar,
  body.tv-mobile .tv-text-toolbar {
    z-index: 380;
    max-width: calc(100vw - 16px);
  }

  body.tv-mobile .tv-draw-hint {
    bottom: calc(56px + env(safe-area-inset-bottom, 0px));
    z-index: 370;
  }

  body.tv-mobile .tv-mob-percent {
    position: absolute;
    right: 10px;
    bottom: 10px;
    z-index: 14;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid #e0e3eb;
    background: rgba(255, 255, 255, 0.92);
    color: #787b86;
    font-size: 12px;
    font-weight: 600;
    font-family: var(--tv-font);
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
  }

  [data-theme="dark"].tv-mobile .tv-mob-percent {
    background: rgba(30, 34, 45, 0.92);
    border-color: #2a2e39;
    color: #787b86;
  }

  /* ── Symbol search popup ── */
  body.tv-mobile .tv-mob-popup-root .tv-picker:not(.hidden) {
    background: var(--tv-bg) !important;
    color: var(--tv-text);
    border-color: var(--tv-border);
  }

  body.tv-mobile .tv-mob-popup-root .tv-picker .tv-picker-head {
    display: flex;
  }

  body.tv-mobile .tv-mob-popup-root .tv-picker .tv-picker-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
    padding: 12px 16px 16px;
    background: var(--tv-bg);
  }

  body.tv-mobile .tv-mob-popup-root .tv-picker #symbol-search {
    flex-shrink: 0;
    height: 44px;
    padding: 0 14px;
    margin: 0 0 10px;
    border: 1px solid var(--tv-border);
    border-radius: 10px;
    background: var(--tv-hover);
    color: var(--tv-text);
    font-size: 15px;
    font-weight: 500;
    box-shadow: none;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
  }

  body.tv-mobile .tv-mob-popup-root .tv-picker #symbol-search::placeholder {
    color: var(--tv-muted);
    font-weight: 400;
  }

  body.tv-mobile .tv-mob-popup-root .tv-picker #symbol-search:focus {
    border-color: var(--tv-accent);
    background: var(--tv-bg);
  }

  body.tv-mobile .tv-mob-popup-root .tv-picker .tv-picker-list {
    flex: 1;
    min-height: 0;
    max-height: none;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    margin: 0 -4px;
    padding: 0 4px;
  }

  body.tv-mobile .tv-mob-popup-root .tv-picker .tv-picker-item {
    min-height: 52px;
    padding: 10px 12px;
    border-radius: 10px;
    gap: 2px;
    touch-action: manipulation;
  }

  body.tv-mobile .tv-mob-popup-root .tv-picker .tv-picker-item:hover,
  body.tv-mobile .tv-mob-popup-root .tv-picker .tv-picker-item:active {
    background: var(--tv-hover);
  }

  body.tv-mobile .tv-mob-popup-root .tv-picker .tv-picker-item strong {
    font-size: 15px;
    font-weight: 600;
    color: var(--tv-text);
  }

  body.tv-mobile .tv-mob-popup-root .tv-picker .tv-picker-item span {
    font-size: 12px;
    color: var(--tv-muted);
  }

  body.tv-mobile .tv-mob-popup-root .tv-picker .tv-picker-empty {
    padding: 28px 12px;
    color: var(--tv-muted);
  }

  body.tv-mobile .tv-alerts-overlay {
    z-index: 10050;
    background: rgba(0, 0, 0, 0.28);
    padding: 0;
    padding-top: 48px;
    display: flex;
    align-items: flex-start;
    justify-content: stretch;
  }

  body.tv-mobile .tv-alerts-dialog {
    position: relative;
    top: auto;
    right: auto;
    left: auto;
    width: 100%;
    max-width: 100%;
    max-height: calc(100dvh - 48px - 56px - env(safe-area-inset-bottom, 0px));
    border-radius: 0 0 12px 12px;
    border-left: none;
    border-right: none;
    border-top: none;
  }

  body.tv-mobile .tv-add-ind-overlay,
  body.tv-mobile .tv-settings-overlay,
  body.tv-mobile .tv-layout-tpl-overlay,
  body.tv-mobile .tv-ind-tpl-overlay,
  body.tv-mobile .tv-confirm-overlay {
    z-index: 10050;
    align-items: flex-start;
    justify-content: stretch;
    padding: 0;
    padding-top: 48px;
    background: rgba(0, 0, 0, 0.45);
  }

  body.tv-mobile .tv-add-ind-dialog,
  body.tv-mobile .tv-layout-tpl-dialog,
  body.tv-mobile .tv-ind-tpl-dialog {
    width: 100%;
    max-width: none;
    margin: 0;
    max-height: calc(100dvh - 48px - env(safe-area-inset-bottom, 0px));
    border-radius: 0 0 12px 12px;
  }

  /* Chart settings — top sheet, scrollable body */
  body.tv-mobile .tv-settings-dialog {
    width: 100%;
    max-width: none;
    max-height: calc(100dvh - 48px - env(safe-area-inset-bottom, 0px));
    height: auto;
    border-radius: 0 0 12px 12px;
    margin: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  body.tv-mobile .tv-settings-header {
    flex-shrink: 0;
  }

  body.tv-mobile .tv-settings-body {
    flex: 1 1 auto;
    min-height: 0;
    flex-direction: column;
  }

  body.tv-mobile .tv-settings-nav {
    width: 100%;
    flex-direction: row;
    flex-shrink: 0;
    border-right: none;
    border-bottom: 1px solid var(--tv-border);
    padding: 6px 8px;
    gap: 4px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  body.tv-mobile .tv-settings-tab {
    flex: 1 0 auto;
    justify-content: center;
    padding: 10px 12px;
    border-radius: 8px;
    white-space: nowrap;
  }

  body.tv-mobile .tv-settings-content {
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
    padding: 12px 16px 8px;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    touch-action: pan-y;
  }

  body.tv-mobile .tv-settings-panel.active {
    display: block;
    padding-bottom: 8px;
  }

  body.tv-mobile .tv-settings-footer {
    flex-shrink: 0;
    padding: 10px 16px calc(12px + env(safe-area-inset-bottom, 0px));
    background: inherit;
  }

  /* Hide rarely used bottom-bar tools on narrow phones — less crowding */
  body.tv-mobile .tv-mob-toolbar-carousel [data-mob-order="11"],
  body.tv-mobile .tv-mob-toolbar-carousel [data-mob-order="12"],
  body.tv-mobile .tv-mob-toolbar-carousel [data-mob-order="13"],
  body.tv-mobile .tv-mob-toolbar-carousel [data-mob-order="14"],
  body.tv-mobile .tv-mob-toolbar-carousel [data-mob-order="15"] {
    display: none !important;
  }

  /* Floating drawing settings — pin near top, scroll if needed */
  body.tv-mobile .tv-drawing-toolbar,
  body.tv-mobile .tv-text-toolbar {
    top: 8px !important;
    left: 50% !important;
    bottom: auto !important;
    transform: translateX(-50%) !important;
    max-width: calc(100vw - 12px);
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  body.tv-mobile .tv-drawing-toolbar::-webkit-scrollbar,
  body.tv-mobile .tv-text-toolbar::-webkit-scrollbar {
    display: none;
  }

  /* Drawing properties — top sheet on phones */
  body.tv-mobile .tv-dp-overlay {
    align-items: flex-start;
    justify-content: stretch;
    padding: 0;
    padding-top: 48px;
    background: rgba(0, 0, 0, 0.35);
  }

  body.tv-mobile .tv-dp-dialog {
    width: 100%;
    max-width: none;
    max-height: calc(100dvh - 48px - 56px - env(safe-area-inset-bottom, 0px));
    border-radius: 0 0 12px 12px;
    margin: 0;
  }

  body.tv-mobile .tv-dp-footer {
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  }

  body.tv-mobile .tv-session-hl {
    top: 6px;
    left: 8px;
    gap: 8px;
    max-width: calc(100% - 16px);
    overflow: hidden;
    flex-wrap: nowrap;
  }

  body.tv-mobile .tv-session-hl .tv-hl-item {
    font-size: 12px;
  }

  body.tv-mobile.tv-advanced-mode .tv-session-hl {
    max-width: calc(100% - 12px);
  }

  body.tv-mobile .tv-mob-percent {
    bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  }

  /* Template chip — keep end rail compact */
  body.tv-mobile .tv-mob-toolbar-end .tv-template-btn {
    max-width: 110px;
  }

  body.tv-mobile #template-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 88px;
    display: inline-block;
  }
}

/* Desktop: hide mobile sheet chrome, keep classic dropdowns */
@media (min-width: 769px) {
  .tv-mob-sheet-head { display: none !important; }
  .tv-mob-grid-2 {
    display: block;
    padding: 0;
  }
  .tv-mob-grid-2 .tv-mob-grid-btn {
    display: flex;
    width: 100%;
    min-height: auto;
    padding: 8px 12px;
    border-radius: 0;
    background: transparent;
    color: var(--tv-text);
    font-weight: inherit;
  }
  .tv-mob-grid-2 .tv-mob-grid-btn:hover { background: #f0f3f8; }
  .tv-mob-grid-2 .tv-mob-grid-btn.active {
    background: #f0f3f8;
    font-weight: 700;
  }
  .tv-mob-draw-list {
    display: block;
  }
  .tv-mob-draw-list .tv-draw-tool {
    display: flex;
    width: 100%;
    min-height: auto;
    padding: 8px 0;
    border-radius: 0;
    background: transparent;
  }
}

/* ── TradingView left drawing toolbar — flush frame ── */
.tv-workspace {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: row;
  position: relative;
  background: var(--tv-chart-bg);
  padding: 0;
  gap: 0;
  margin: 0;
}

.tv-workspace .tv-chart {
  flex: 1;
  min-width: 0;
  border-radius: 0;
  overflow: hidden;
  background: var(--tv-chart-bg);
  position: relative;
}

.tv-left-tb {
  position: relative;
  flex-shrink: 0;
  width: 52px;
  margin: 0;
  padding: 0;
  background: var(--tv-toolbar-bg);
  /* Single vertical frame line — joins header bottom border at 90° */
  border: none;
  border-right: 1px solid var(--tv-frame, var(--tv-border));
  border-radius: 0;
  z-index: 25;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  box-sizing: border-box;
}

.tv-left-tb.is-collapsed {
  width: 0;
  margin: 0;
  padding: 0;
  border: none;
  overflow: visible;
  background: transparent;
}

.tv-left-tb.is-collapsed .tv-left-tb-rail {
  display: none;
}

.tv-left-tb-rail {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 0 52px;
  overflow-y: auto;
  overflow-x: hidden;
  flex: 1;
  scrollbar-width: none;
}

.tv-left-tb-rail::-webkit-scrollbar { display: none; }

.tv-left-tb-btn {
  position: relative;
  width: 38px;
  height: 38px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--tv-icon);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  flex-shrink: 0;
}

.tv-left-tb-btn:hover {
  background: var(--tv-hover);
  color: var(--tv-icon-active);
}

.tv-left-tb-btn.active {
  background: var(--tv-active-bg);
  color: var(--tv-accent);
}

.tv-left-tb-btn[data-group="cursor"].active {
  color: #f0b90b;
  background: rgba(240, 185, 11, 0.12);
}

[data-theme="dark"] .tv-left-tb-btn.active {
  color: #d1d4dc;
  background: #1e222d;
}

[data-theme="dark"] .tv-left-tb-btn[data-group="cursor"].active {
  color: #f0b90b;
  background: rgba(240, 185, 11, 0.14);
}

.tv-left-tb-btn.panel-open {
  background: var(--tv-hover);
}

.tv-left-tb-ico {
  display: inline-flex;
  width: 28px;
  height: 28px;
  align-items: center;
  justify-content: center;
  line-height: 0;
}

.tv-left-tb-ico svg {
  width: 28px;
  height: 28px;
  display: block;
}

.tv-left-tb-has-menu .tv-left-tb-caret {
  position: absolute;
  right: 3px;
  bottom: 3px;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 0 0 5px 5px;
  border-color: transparent transparent currentColor transparent;
  opacity: 0.55;
  pointer-events: none;
}

/* Inset separators inside the rail */
.tv-left-tb-sep {
  width: 26px;
  height: 1px;
  margin: 6px 0;
  background: var(--tv-frame, var(--tv-border));
  flex-shrink: 0;
}

/* Yellow collapse tab — bottom of sidebar, on the frame line */
.tv-left-tb-collapse {
  position: absolute;
  bottom: 28px;
  top: auto;
  right: 0;
  transform: translateX(50%);
  width: 16px;
  height: 40px;
  border: none;
  border-radius: 8px;
  background: var(--tv-collapse, #f0b90b);
  color: #131722;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  z-index: 30;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}

.tv-left-tb.is-collapsed .tv-left-tb-collapse {
  right: auto;
  left: 0;
  bottom: 28px;
  transform: none;
  border-radius: 0 8px 8px 0;
}

.tv-left-tb-collapse:hover {
  background: #ffc933;
  color: #131722;
}

.tv-left-tb-collapse:active {
  background: #e5a800;
}

.tv-left-tb-flyout {
  position: absolute;
  left: 100%;
  top: 8px;
  margin-left: 4px;
  width: 292px;
  max-width: min(292px, calc(100vw - 72px));
  max-height: min(72vh, 560px);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: #fff;
  border: 1px solid var(--tv-border);
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12), 0 8px 28px rgba(0, 0, 0, 0.14);
  z-index: 40;
  padding: 6px 0;
  /* Firefox thin ghost scrollbar */
  scrollbar-width: thin;
  scrollbar-color: #b2b5be transparent;
}

.tv-left-tb-flyout.tv-left-tb-flyout-cursor {
  width: 220px;
  max-width: min(220px, calc(100vw - 72px));
  padding: 4px 0 0;
}

[data-theme="dark"] .tv-left-tb-flyout {
  background: #2a2e39;
  border-color: #363a45;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.28), 0 12px 32px rgba(0, 0, 0, 0.45);
  scrollbar-color: #4c525e transparent;
}

/* WebKit thin ghost scrollbar (matches TV flyout) */
.tv-left-tb-flyout::-webkit-scrollbar {
  width: 5px;
}
.tv-left-tb-flyout::-webkit-scrollbar-track {
  background: transparent;
  margin: 4px 0;
}
.tv-left-tb-flyout::-webkit-scrollbar-thumb {
  background: #b2b5be;
  border-radius: 8px;
  border: 1px solid transparent;
  background-clip: padding-box;
}
.tv-left-tb-flyout::-webkit-scrollbar-thumb:hover {
  background: #9598a1;
  background-clip: padding-box;
}
[data-theme="dark"] .tv-left-tb-flyout::-webkit-scrollbar-thumb {
  background: #4c525e;
  background-clip: padding-box;
}
[data-theme="dark"] .tv-left-tb-flyout::-webkit-scrollbar-thumb:hover {
  background: #6a7380;
  background-clip: padding-box;
}
.tv-left-tb-flyout::-webkit-scrollbar-corner {
  background: transparent;
}

.tv-left-tb-flyout-section + .tv-left-tb-flyout-section {
  border-top: 1px solid var(--tv-border);
  margin-top: 2px;
  padding-top: 2px;
}

[data-theme="dark"] .tv-left-tb-flyout-section + .tv-left-tb-flyout-section {
  border-top-color: #363a45;
}

.tv-left-tb-flyout-section-title {
  padding: 10px 16px 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #787b86;
  line-height: 1.2;
  user-select: none;
}

.tv-left-tb-flyout-shortcut {
  margin-left: auto;
  padding-left: 16px;
  font-size: 12px;
  font-weight: 400;
  color: #787b86;
  white-space: nowrap;
  flex-shrink: 0;
}

.tv-left-tb-flyout-title {
  padding: 8px 16px 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #787b86;
}

.tv-left-tb-flyout-sep {
  height: 1px;
  margin: 6px 0;
  background: var(--tv-border);
}

[data-theme="dark"] .tv-left-tb-flyout-sep {
  background: #363a45;
}

.tv-left-tb-flyout-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px 12px;
  cursor: pointer;
  user-select: none;
}

.tv-left-tb-flyout-toggle-label {
  flex: 1;
  font-size: 13px;
  line-height: 1.35;
  color: var(--tv-text, #d1d4dc);
}

.tv-left-tb-switch {
  position: relative;
  flex-shrink: 0;
  width: 34px;
  height: 18px;
  border-radius: 999px;
  background: #787b86;
  transition: background 0.15s ease;
}

.tv-left-tb-switch::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  transition: transform 0.15s ease;
}

.tv-left-tb-switch.on {
  background: #2962ff;
}

.tv-left-tb-switch.on::after {
  transform: translateX(16px);
}

[data-theme="dark"] .tv-left-tb-switch:not(.on) {
  background: #4c525e;
}

.tv-cursor-marker {
  position: absolute;
  z-index: 35;
  pointer-events: none;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  display: none;
}

.tv-cursor-marker.is-dot {
  width: 8px;
  height: 8px;
  background: #d1d4dc;
  box-shadow: 0 0 0 1px rgba(19, 23, 34, 0.45);
}

.tv-cursor-marker.is-demo {
  width: 22px;
  height: 22px;
  background: rgba(255, 64, 129, 0.35);
  border: 2px solid #ff4081;
  box-shadow: 0 0 10px rgba(255, 64, 129, 0.45);
}

.tv-cursor-marker.visible {
  display: block;
}

.tv-chart-host.tv-cursor-mode-arrow,
.tv-chart-host.tv-cursor-mode-arrow * {
  cursor: default !important;
}

.tv-chart-host.tv-cursor-mode-demo,
.tv-chart-host.tv-cursor-mode-demo * {
  cursor: none !important;
}

.tv-chart-host.tv-cursor-mode-eraser,
.tv-chart-host.tv-cursor-mode-eraser * {
  cursor: cell !important;
}

.tv-values-lp-tip {
  position: absolute;
  z-index: 50;
  min-width: 120px;
  padding: 8px 10px;
  border-radius: 6px;
  background: #1e222d;
  border: 1px solid #363a45;
  color: #d1d4dc;
  font-size: 12px;
  line-height: 1.45;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
  pointer-events: none;
  transform: translate(12px, 12px);
}

.tv-values-lp-tip.hidden {
  display: none;
}

body[data-theme="light"] .tv-values-lp-tip {
  background: #fff;
  border-color: var(--tv-border);
  color: #131722;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.tv-left-tb-flyout-list {
  display: flex;
  flex-direction: column;
}

.tv-left-tb-flyout-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  border: none;
  background: transparent;
  color: var(--tv-text);
  padding: 7px 16px;
  min-height: 40px;
  cursor: pointer;
  text-align: left;
  font-size: 14px;
  font-weight: 400;
  font-family: var(--tv-font);
  line-height: 1.25;
}

.tv-left-tb-flyout-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tv-left-tb-flyout-item:hover {
  background: #f0f3fa;
}

[data-theme="dark"] .tv-left-tb-flyout-item:hover {
  background: #363a45;
}

.tv-left-tb-flyout-item.active {
  background: var(--tv-active-bg, rgba(41, 98, 255, 0.12));
  color: var(--tv-accent, #2962ff);
}

[data-theme="dark"] .tv-left-tb-flyout-item.active {
  background: rgba(91, 156, 255, 0.16);
  color: #5b9cff;
}

.tv-left-tb-flyout-item.active .tv-left-tb-flyout-ico {
  color: inherit;
  opacity: 1;
}

.tv-left-tb-flyout-ico {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: inherit;
  flex-shrink: 0;
  opacity: 0.92;
}

.tv-left-tb-flyout-ico svg {
  width: 28px;
  height: 28px;
}

.tv-left-tb-emoji-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  padding: 4px 10px 8px;
}

.tv-left-tb-emoji {
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 6px;
  background: transparent;
  font-size: 20px;
  cursor: pointer;
  line-height: 1;
}

.tv-left-tb-emoji:hover {
  background: var(--tv-hover);
}

/* —— Icons popup (Emojis / Stickers / Icons) —— */
.tv-icons-popup {
  position: absolute;
  left: calc(100% + 4px);
  top: 8px;
  z-index: 45;
  display: flex;
  flex-direction: column;
  width: 320px;
  max-width: min(320px, calc(100vw - 72px));
  height: min(72vh, 460px);
  max-height: min(72vh, 460px);
  background: #1e222d;
  border: 1px solid #363a45;
  border-radius: 6px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.28), 0 12px 32px rgba(0, 0, 0, 0.45);
  overflow: hidden;
  color: #d1d4dc;
}

body[data-theme="light"] .tv-icons-popup {
  background: #fff;
  border-color: var(--tv-border);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12), 0 8px 28px rgba(0, 0, 0, 0.14);
  color: #131722;
}

.tv-icons-popup.hidden {
  display: none;
}

.tv-icons-popup-cats {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2px;
  flex-shrink: 0;
  padding: 8px 10px 6px;
  border-bottom: 1px solid #2a2e39;
}

body[data-theme="light"] .tv-icons-popup-cats {
  border-bottom-color: var(--tv-border);
}

.tv-icons-cat-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 32px;
  min-width: 0;
  padding: 0;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: #787b86;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
}

.tv-icons-cat-btn svg {
  width: 18px;
  height: 18px;
  display: block;
}

.tv-icons-cat-btn:hover {
  color: #d1d4dc;
  background: rgba(255, 255, 255, 0.06);
}

body[data-theme="light"] .tv-icons-cat-btn {
  color: #787b86;
}

body[data-theme="light"] .tv-icons-cat-btn:hover {
  color: #131722;
  background: var(--tv-hover);
}

.tv-icons-cat-btn.active {
  color: #f0b90b;
}

body[data-theme="light"] .tv-icons-cat-btn.active {
  color: #f0b90b;
}

.tv-icons-popup-section {
  flex-shrink: 0;
  padding: 10px 14px 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #787b86;
}

.tv-icons-popup-grid {
  flex: 1;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  align-content: start;
  gap: 2px;
  padding: 4px 8px 10px;
  scrollbar-width: thin;
  scrollbar-color: #4c525e transparent;
}

body[data-theme="light"] .tv-icons-popup-grid {
  scrollbar-color: #b2b5be transparent;
}

.tv-icons-popup-grid::-webkit-scrollbar {
  width: 5px;
}
.tv-icons-popup-grid::-webkit-scrollbar-thumb {
  background: #4c525e;
  border-radius: 4px;
}

.tv-icons-grid-item {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 4px;
  background: transparent;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  color: inherit;
}

.tv-icons-grid-item.is-icon {
  font-size: 18px;
  color: #d1d4dc;
}

body[data-theme="light"] .tv-icons-grid-item.is-icon {
  color: #131722;
}

.tv-icons-grid-item:hover {
  background: rgba(255, 255, 255, 0.08);
}

body[data-theme="light"] .tv-icons-grid-item:hover {
  background: var(--tv-hover);
}

.tv-icons-popup-tabs {
  display: flex;
  flex-shrink: 0;
  align-items: stretch;
  border-top: 1px solid #2a2e39;
  background: #1e222d;
}

body[data-theme="light"] .tv-icons-popup-tabs {
  border-top-color: var(--tv-border);
  background: #fff;
}

.tv-icons-popup-tab {
  flex: 1;
  height: 40px;
  border: none;
  background: transparent;
  color: #787b86;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  position: relative;
}

.tv-icons-popup-tab:hover {
  color: #d1d4dc;
}

body[data-theme="light"] .tv-icons-popup-tab:hover {
  color: #131722;
}

.tv-icons-popup-tab.active {
  color: #d1d4dc;
}

body[data-theme="light"] .tv-icons-popup-tab.active {
  color: #131722;
}

.tv-icons-popup-tab.active::after {
  content: '';
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 0;
  height: 2px;
  background: #2962ff;
  border-radius: 2px 2px 0 0;
}

@media (max-width: 900px) {
  /* Keep flex so .tv-chart { flex:1 } still fills height on phones/tablets */
  .tv-workspace {
    display: flex;
    flex-direction: row;
    flex: 1;
    min-height: 0;
    width: 100%;
  }
  .tv-workspace .tv-chart {
    flex: 1;
    min-width: 0;
    min-height: 0;
    height: auto;
  }
}

/* —— Drawing properties modal (TradingView-style) —— */
.tv-dp-overlay {
  position: fixed;
  inset: 0;
  z-index: 10001;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
}

.tv-dp-dialog {
  width: 420px;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 48px);
  background: #ffffff;
  border-radius: 6px;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.28);
  overflow: hidden;
  font-family: var(--tv-font);
  display: flex;
  flex-direction: column;
  color: var(--tv-text);
}

body[data-theme="dark"] .tv-dp-dialog {
  background: #1e222d;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.55);
}

.tv-dp-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 16px 10px;
}

.tv-dp-title {
  flex: 1;
  font-size: 16px;
  font-weight: 600;
  color: var(--tv-text);
  line-height: 1.3;
}

.tv-dp-close {
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--tv-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  flex-shrink: 0;
}

.tv-dp-close:hover {
  background: var(--tv-hover);
}

.tv-dp-close::before,
.tv-dp-close::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 12px;
  height: 1.5px;
  background: var(--tv-muted);
}

.tv-dp-close::before { transform: translate(-50%, -50%) rotate(45deg); }
.tv-dp-close::after { transform: translate(-50%, -50%) rotate(-45deg); }

/* Horizontal tabs — white/dark underline on active (not left nav) */
.tv-dp-tabs {
  display: flex;
  align-items: stretch;
  gap: 0;
  padding: 0 12px;
  border-bottom: 1px solid var(--tv-border);
  flex-shrink: 0;
}

.tv-dp-tab {
  position: relative;
  height: 36px;
  padding: 0 14px;
  border: none;
  background: transparent;
  color: var(--tv-muted);
  font-size: 13px;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
}

.tv-dp-tab:hover {
  color: var(--tv-text);
}

.tv-dp-tab.active {
  color: var(--tv-text);
}

.tv-dp-tab.active::after {
  content: '';
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 0;
  height: 2px;
  background: #131722;
  border-radius: 2px 2px 0 0;
}

body[data-theme="dark"] .tv-dp-tab.active::after {
  background: #ffffff;
}

.tv-dp-body {
  flex: 1;
  min-height: 220px;
  max-height: min(52vh, 420px);
  overflow-y: auto;
  padding: 8px 0 12px;
}

.tv-dp-panel {
  display: none;
  padding: 4px 16px;
}

.tv-dp-panel.active {
  display: block;
}

/* Style rows: label left, controls right */
.tv-dp-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 36px;
  padding: 6px 0;
  font-size: 13px;
  color: var(--tv-text);
}

.tv-dp-row-label {
  flex: 1;
  min-width: 0;
  color: var(--tv-text);
  line-height: 1.3;
}

.tv-dp-row-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  flex-shrink: 0;
}

.tv-dp-section-title {
  margin: 12px 0 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--tv-muted);
  text-transform: none;
}

.tv-dp-section-title:first-child {
  margin-top: 4px;
}

/* Color swatch button */
.tv-dp-swatch {
  position: relative;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--tv-border);
  border-radius: 4px;
  background: transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}

.tv-dp-swatch:hover {
  background: var(--tv-hover);
}

.tv-dp-swatch-checkered {
  background-image:
    linear-gradient(45deg, #555 25%, transparent 25%),
    linear-gradient(-45deg, #555 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #555 75%),
    linear-gradient(-45deg, transparent 75%, #555 75%);
  background-size: 8px 8px;
  background-position: 0 0, 0 4px, 4px -4px, -4px 0;
}

.tv-dp-swatch input[type="color"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  border: none;
  padding: 0;
}

.tv-dp-toggle {
  width: 28px;
  height: 28px;
  border: 1px solid var(--tv-border);
  border-radius: 4px;
  background: transparent;
  color: var(--tv-muted);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.tv-dp-toggle:hover {
  background: var(--tv-hover);
  color: var(--tv-text);
}

.tv-dp-toggle.active {
  background: rgba(41, 98, 255, 0.14);
  color: var(--tv-text);
  border-color: var(--tv-accent);
}

.tv-dp-line-preview {
  display: inline-block;
  width: 36px;
  height: 0;
  border-bottom: 2px solid #2962ff;
  margin: 0 4px;
}

.tv-dp-coord-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--tv-border);
}

.tv-dp-coord-idx {
  width: 28px;
  font-size: 12px;
  font-weight: 600;
  color: var(--tv-muted);
}

.tv-dp-coord-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  font-size: 11px;
  color: var(--tv-muted);
}

.tv-dp-coord-field input {
  height: 28px;
  padding: 0 8px;
  border: 1px solid var(--tv-border);
  border-radius: 4px;
  background: var(--tv-bg, #2a2e39);
  color: var(--tv-text);
  font-size: 12px;
  font-family: inherit;
}

.tv-dp-empty {
  padding: 24px 8px;
  text-align: center;
  font-size: 13px;
  color: var(--tv-muted);
}

.tv-dp-swatch-dot {
  width: 16px;
  height: 16px;
  border-radius: 3px;
  border: 1px solid rgba(0, 0, 0, 0.15);
  box-sizing: border-box;
}

/* Select / dropdown */
.tv-dp-select {
  height: 28px;
  min-width: 72px;
  max-width: 140px;
  padding: 0 24px 0 8px;
  border: 1px solid var(--tv-border);
  border-radius: 4px;
  background: var(--tv-bg);
  color: var(--tv-text);
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23787b86' stroke-width='1.4' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
}

body[data-theme="dark"] .tv-dp-select {
  background-color: #2a2e39;
  border-color: #363a45;
}

.tv-dp-select:focus {
  outline: none;
  border-color: var(--tv-accent);
}

.tv-dp-input {
  height: 28px;
  width: 96px;
  padding: 0 8px;
  border: 1px solid var(--tv-border);
  border-radius: 4px;
  background: var(--tv-bg);
  color: var(--tv-text);
  font-size: 12px;
  font-family: inherit;
  box-sizing: border-box;
}

body[data-theme="dark"] .tv-dp-input {
  background: #2a2e39;
  border-color: #363a45;
}

.tv-dp-input:focus {
  outline: none;
  border-color: var(--tv-accent);
}

/* Bold / Italic toggles */
.tv-dp-bi {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.tv-dp-bi-btn {
  width: 28px;
  height: 28px;
  border: 1px solid var(--tv-border);
  border-radius: 4px;
  background: transparent;
  color: var(--tv-muted);
  font-size: 13px;
  font-family: inherit;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.tv-dp-bi-btn i {
  font-style: italic;
  font-weight: 600;
}

.tv-dp-bi-btn:hover {
  background: var(--tv-hover);
  color: var(--tv-text);
}

.tv-dp-bi-btn.active {
  background: rgba(41, 98, 255, 0.14);
  color: var(--tv-text);
  border-color: var(--tv-accent);
}

/* Checkbox + swatch (e.g. background) */
.tv-dp-check-swatch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.tv-dp-check {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--tv-accent);
  cursor: pointer;
  flex-shrink: 0;
}

.tv-dp-check-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 13px;
  color: var(--tv-text);
  user-select: none;
}

/* Visibility / coordinates helpers */
.tv-dp-toggle-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 6px 0;
  font-size: 13px;
  color: var(--tv-text);
  cursor: pointer;
}

.tv-dp-toggle-row span:first-of-type {
  flex: 1;
}

.tv-dp-coord-grid {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 12px;
  align-items: center;
  padding: 4px 0;
}

.tv-dp-coord-grid .tv-dp-row-label {
  flex: none;
}

/* Footer: Template left, Cancel + Ok right */
.tv-dp-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-top: 1px solid var(--tv-border);
  flex-shrink: 0;
  position: relative;
}

.tv-dp-tpl-wrap {
  position: relative;
}

.tv-dp-template {
  height: 34px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--tv-text);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.tv-dp-template:hover,
.tv-dp-template[aria-expanded="true"] {
  background: var(--tv-hover);
  border-color: var(--tv-border);
}

.tv-dp-template-chev {
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid currentColor;
  opacity: 0.7;
}

.tv-dp-tpl-menu {
  position: absolute;
  left: 0;
  bottom: calc(100% + 6px);
  min-width: 220px;
  max-width: 280px;
  max-height: 280px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid var(--tv-border);
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  z-index: 5;
  padding: 4px 0;
}

body[data-theme="dark"] .tv-dp-tpl-menu {
  background: #2a2e39;
  border-color: #363a45;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}

.tv-dp-tpl-menu.hidden {
  display: none;
}

.tv-dp-tpl-item {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 34px;
  padding: 0 14px;
  border: none;
  background: transparent;
  color: var(--tv-text);
  font-size: 13px;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  gap: 8px;
  box-sizing: border-box;
}

.tv-dp-tpl-item:hover {
  background: var(--tv-hover);
}

.tv-dp-tpl-item.active {
  color: #2962ff;
}

.tv-dp-tpl-item .tv-dp-tpl-check {
  width: 14px;
  color: #2962ff;
  flex-shrink: 0;
}

.tv-dp-tpl-item .tv-dp-tpl-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tv-dp-tpl-item .tv-dp-tpl-del {
  opacity: 0;
  border: none;
  background: transparent;
  color: var(--tv-muted);
  cursor: pointer;
  font-size: 14px;
  padding: 0 2px;
  line-height: 1;
}

.tv-dp-tpl-item:hover .tv-dp-tpl-del {
  opacity: 1;
}

.tv-dp-tpl-item .tv-dp-tpl-del:hover {
  color: #f7525f;
}

.tv-dp-tpl-sep {
  height: 1px;
  margin: 4px 0;
  background: var(--tv-border);
}

.tv-dp-tpl-empty {
  padding: 10px 14px;
  font-size: 12px;
  color: var(--tv-muted);
}

.tv-dp-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tv-dp-cancel,
.tv-dp-ok {
  height: 34px;
  padding: 0 18px;
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  border: none;
}

.tv-dp-cancel {
  background: #f0f3fa;
  color: #131722;
}

.tv-dp-cancel:hover {
  background: #e0e3eb;
}

.tv-dp-ok {
  background: #131722;
  color: #ffffff;
  font-weight: 600;
}

.tv-dp-ok:hover {
  background: #2a2e39;
}

body[data-theme="dark"] .tv-dp-cancel {
  background: #2a2e39;
  color: #d1d4dc;
}

body[data-theme="dark"] .tv-dp-cancel:hover {
  background: #363a45;
}

body[data-theme="dark"] .tv-dp-ok {
  background: #ffffff;
  color: #131722;
}

body[data-theme="dark"] .tv-dp-ok:hover {
  background: #e0e3eb;
}

/* ─── Trade lines (TP / SL / entry) ─── */
.tv-trade-lines-root {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 45;
  overflow: hidden;
}
.tv-trade-row {
  position: absolute;
  left: 0;
  right: 0;
  height: 0;
  transform: translateY(-50%);
  pointer-events: none;
  z-index: 1;
}
.tv-trade-row--offscreen { display: none; }
.tv-trade-row--dragging { z-index: 5; }
.tv-trade-row__line {
  position: absolute;
  left: 0;
  right: var(--tv-trade-axis-w, 56px);
  top: 0;
  height: 0;
  border-top: 1px dashed #26a69a;
  opacity: 0.95;
}
.tv-trade-row--sl .tv-trade-row__line { border-top-color: #ef5350; }
.tv-trade-row--tp .tv-trade-row__line { border-top-color: #26a69a; }
.tv-trade-row--entry .tv-trade-row__line,
.tv-trade-row__line--entry {
  border-top-style: solid;
  border-top-width: 1px;
}
.tv-trade-row--entry.tv-trade-row--sell .tv-trade-row__line { border-top-color: #ef5350; }
.tv-trade-row--entry.tv-trade-row--buy .tv-trade-row__line { border-top-color: #26a69a; }
.tv-trade-row__hit {
  position: absolute;
  left: 0;
  right: var(--tv-trade-axis-w, 56px);
  top: -10px;
  height: 20px;
  pointer-events: auto;
  cursor: ns-resize;
}
.tv-trade-row--entry .tv-trade-row__hit { pointer-events: none; cursor: default; }
.tv-trade-row__chrome {
  position: absolute;
  left: 56px; /* clear left drawing toolbar */
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  pointer-events: auto;
  z-index: 2;
}
.tv-trade-row__merged {
  display: inline-flex;
  align-items: stretch;
  height: 22px;
  gap: 3px;
  pointer-events: auto;
}
.tv-trade-row__chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  padding: 0 7px;
  margin: 0;
  border: 1px dashed rgba(255, 255, 255, 0.45);
  border-radius: 3px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
  line-height: 1;
  cursor: ns-resize;
  pointer-events: auto;
  touch-action: none;
  box-sizing: border-box;
  flex-shrink: 0;
  color: #fff;
}
.tv-trade-row__chip--tp {
  background: #1a3d32;
  color: #5eecc8;
  border-color: rgba(94, 236, 200, 0.5);
}
.tv-trade-row__chip--sl {
  background: #3d3018;
  color: #f5c542;
  border-color: rgba(245, 197, 66, 0.5);
}
.tv-trade-row__chip:hover { filter: brightness(1.12); }
.tv-trade-row__lot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 8px;
  border-radius: 3px;
  background: var(--tv-trade-axis-color, #26a69a);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  flex-shrink: 0;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.15);
}
.tv-trade-row--sell .tv-trade-row__lot { background: #ef5350; }
.tv-trade-row__pnl {
  display: inline-flex;
  align-items: stretch;
  border: 1px solid var(--tv-trade-axis-color, #26a69a);
  border-radius: 3px;
  overflow: hidden;
  background: rgba(19, 23, 34, 0.94);
  flex-shrink: 0;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.28);
}
.tv-trade-row--sell .tv-trade-row__pnl { border-color: #ef5350; }
.tv-trade-row__pnl-text {
  display: inline-flex;
  align-items: center;
  padding: 0 8px;
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: #d1d4dc;
  white-space: nowrap;
}
.tv-trade-row__pnl.is-profit .tv-trade-row__pnl-text { color: #4caf50; }
.tv-trade-row__pnl.is-loss .tv-trade-row__pnl-text { color: #ff5252; }
.tv-trade-row__close {
  flex-shrink: 0;
  width: 20px;
  border: none;
  border-left: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 0;
  background: rgba(0, 0, 0, 0.35);
  color: rgba(255, 255, 255, 0.9);
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  pointer-events: auto;
}
.tv-trade-row__close:hover { background: rgba(239, 83, 80, 0.85); color: #fff; }
.tv-trade-row__badge {
  position: absolute;
  left: 56px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #fff;
  background: #26a69a;
}
.tv-trade-row--sl .tv-trade-row__badge { background: #ef5350; }
.tv-trade-axis {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  min-width: 52px;
  pointer-events: none;
  z-index: 2;
}
.tv-trade-axis-price {
  display: block;
  padding: 2px 6px;
  text-align: right;
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #131722;
  background: var(--tv-trade-axis-color, #26a69a);
  border-radius: 2px 0 0 2px;
  line-height: 1.25;
}
.tv-trade-row--invalid .tv-trade-axis-price,
.tv-trade-row--invalid .tv-trade-row__line {
  filter: saturate(0.4);
  box-shadow: 0 0 0 1px rgba(239, 83, 80, 0.8);
}
.tv-trade-row--dragging .tv-trade-row__line {
  border-top-width: 2px;
  opacity: 1;
}
body.tv-trade-dragging { cursor: ns-resize !important; }
body.tv-trade-dragging iframe { pointer-events: none; }

body[data-theme="light"] .tv-trade-row__pnl {
  background: rgba(255, 255, 255, 0.96);
}
body[data-theme="light"] .tv-trade-row__pnl-text { color: #131722; }
body[data-theme="light"] .tv-trade-row__pnl.is-profit .tv-trade-row__pnl-text { color: #2e7d32; }
body[data-theme="light"] .tv-trade-row__pnl.is-loss .tv-trade-row__pnl-text { color: #c62828; }
body[data-theme="light"] .tv-trade-row__close {
  background: rgba(15, 23, 42, 0.08);
  color: #131722;
  border-left-color: rgba(15, 23, 42, 0.12);
}
body[data-theme="light"] .tv-trade-row__chip--tp {
  background: #e8f7f2;
  color: #0d7a5f;
}
body[data-theme="light"] .tv-trade-row__chip--sl {
  background: #fff6e0;
  color: #9a6b00;
}

/* ─── Chart activity toasts (Match-Trader style) ─── */
.tv-chart-activity {
  position: absolute;
  top: 52px;
  right: 72px;
  z-index: 60;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  pointer-events: none;
  max-width: min(320px, 70vw);
}
.tv-chart-activity__toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 180px;
  max-width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(19, 23, 34, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-left: 3px solid rgba(255, 255, 255, 0.18);
  box-shadow:
    0 10px 28px rgba(0, 0, 0, 0.35),
    0 0 0 1px rgba(255, 255, 255, 0.03) inset;
  color: #d1d4dc;
  backdrop-filter: blur(10px);
  opacity: 0;
  transform: translateX(18px) translateY(-4px) scale(0.98);
  transition: opacity 0.22s ease, transform 0.32s cubic-bezier(0.22, 1, 0.36, 1);
}
.tv-chart-activity__toast.is-in {
  opacity: 1;
  transform: translateX(0) translateY(0) scale(1);
}
.tv-chart-activity__toast.is-out {
  opacity: 0;
  transform: translateX(12px) translateY(-4px) scale(0.98);
}
.tv-chart-activity__toast--buy,
.tv-chart-activity__toast--open.tv-chart-activity__toast--buy,
.tv-chart-activity__toast--tp,
.tv-chart-activity__toast.is-profit {
  border-left-color: #26a69a;
}
.tv-chart-activity__toast--sell,
.tv-chart-activity__toast--open.tv-chart-activity__toast--sell,
.tv-chart-activity__toast--sl,
.tv-chart-activity__toast.is-loss {
  border-left-color: #ef5350;
}
.tv-chart-activity__toast--close,
.tv-chart-activity__toast--closed,
.tv-chart-activity__toast--partial,
.tv-chart-activity__toast--partial_close {
  border-left-color: #787b86;
}
.tv-chart-activity__toast--order,
.tv-chart-activity__toast--pending {
  border-left-color: #2962ff;
}
.tv-chart-activity__icon {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  background: rgba(255, 255, 255, 0.08);
  color: #d1d4dc;
}
.tv-chart-activity__toast--buy .tv-chart-activity__icon,
.tv-chart-activity__toast--open.tv-chart-activity__toast--buy .tv-chart-activity__icon {
  background: rgba(38, 166, 154, 0.2);
  color: #26a69a;
}
.tv-chart-activity__toast--sell .tv-chart-activity__icon,
.tv-chart-activity__toast--open.tv-chart-activity__toast--sell .tv-chart-activity__icon {
  background: rgba(239, 83, 80, 0.18);
  color: #ef5350;
}
.tv-chart-activity__toast--tp .tv-chart-activity__icon,
.tv-chart-activity__toast.is-profit .tv-chart-activity__icon {
  background: rgba(38, 166, 154, 0.2);
  color: #26a69a;
}
.tv-chart-activity__toast--sl .tv-chart-activity__icon,
.tv-chart-activity__toast.is-loss .tv-chart-activity__icon {
  background: rgba(239, 83, 80, 0.18);
  color: #ef5350;
}
.tv-chart-activity__body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.tv-chart-activity__title {
  font-size: 12px;
  font-weight: 700;
  line-height: 1.3;
  color: #f0f3fa;
}
.tv-chart-activity__meta {
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: #8b919e;
}
.tv-chart-activity__toast.is-profit .tv-chart-activity__meta { color: #26a69a; }
.tv-chart-activity__toast.is-loss .tv-chart-activity__meta { color: #ef5350; }

body[data-theme="light"] .tv-chart-activity__toast {
  background: rgba(255, 255, 255, 0.94);
  border-color: rgba(15, 23, 42, 0.08);
  color: #131722;
}
body[data-theme="light"] .tv-chart-activity__title { color: #131722; }
