.theme-dark:root {
  --tv-color-platform-background: #101010;
  --tv-color-pane-background: #101010;
  --tv-color-toolbar-button-text: #808080;
  --tv-color-toolbar-button-text-hover: #808080;
  --tv-color-toolbar-button-text-active: #ffffff;
  --tv-color-toolbar-button-text-active-hover: #ffffff;
  --trade-body-bg: #101010;
  --background-color: #101010;
}

.theme-light:root {
  --tv-color-platform-background: #fff;
  --tv-color-pane-background: #fff;
  --tv-color-toolbar-button-background-hover: #f8f8f8;
  --tv-color-toolbar-button-text: #666;
  --tv-color-toolbar-button-text-hover: #787b86;
  --tv-color-toolbar-button-text-active: #f4a203;
  --tv-color-toolbar-button-text-active-hover: #f4a203;
  --tv-color-toolbar-toggle-button-background-active: #f4a203;
  --tv-color-toolbar-toggle-button-background-active-hover: #f4a203;
  --trade-body-bg: rgba(255, 255, 255, 0.2);
}

#sub-frame-error,
#sub-frame-error:hover {
  background-color: transparent;
}

.dateRangeWrapper-2yU8ifXU,
.statusesWrapper-G1_Pfvwd,
.container-OUNcvmCJ {
  display: none;
}

.loading-indicator {
  background-color: transparent;
}

.chart-page {
  background-color: transparent;
}

#sub-frame-error {
  background-color: transparent;
}

#drawing-toolbar {
  box-shadow: 2px 0 20px var(--trade-body-bg);
}

/* K 线时间选择（timeframes toolbar）字体：text-xs */
.js-button-text,
.js-button-text div,
.text-uO7HM85b {
  font-size: 12px !important;
  line-height: 14px !important;
}

/* 去掉时间选择按钮的 hover 背景颜色 */
#header-toolbar-intervals [class*="button"]:hover,
#header-toolbar-intervals [class*="button"]:hover::before,
#header-toolbar-intervals [class*="button"]:hover::after {
  background: none !important;
  background-color: transparent !important;
}

/* 时间周期按钮 hover 字体颜色（不包括下拉菜单） */
#header-toolbar-intervals .button-_8r4li9v[data-role="button"]:hover,
#header-toolbar-intervals .button-_8r4li9v[data-role="button"]:hover .js-button-text,
#header-toolbar-intervals .button-_8r4li9v[data-role="button"]:hover .text-uO7HM85b,
#header-toolbar-intervals .button-_8r4li9v[data-role="button"]:hover .value-Os5mxnuv {
  color: #f9f9f9 !important;
}

/* 时间选择下拉按钮的 hover 效果 */
#header-toolbar-intervals .menu-_8r4li9v[data-role="button"]:hover::before,
#header-toolbar-intervals .menu-_8r4li9v[data-role="button"]:hover::after {
  background: #242424 !important;
  background-color: #242424 !important;
  height: 28px !important;
  top: 50% !important;
  transform: translateY(-50%) !important;
  border-radius: 4px !important;
}


.chart-markup-table tr:first-of-type .chart-gui-wrapper canvas {
  /* background-image: url(https://placehold.co/100x32); */
  background-repeat: no-repeat;
  background-position: center bottom 10px;
}
/* 隐藏 daterange 功能 */
/* [class^="dateRangeWrapper"] {
  display: none;
} */

/* 修复 toggle button 太小 */
.layout__area--left:not(:has([class^="toggleButton"]:not([class*="collapsed"]))) {
  width: 10px !important;
}
[class^="toggleButton"]:not([class*="collapsed"]) {
  margin-left: -9px !important;
}
[class^="valueTitle"] {
  color: #ffffff !important;
}
.chart-markup-table.time-axis > div > canvas {
  margin-top: -1px;
}
.chart-markup-table.price-axis-container > div > canvas {
  left: -1px !important;
  top: -1px !important;
}

div[data-name="legend-source-title"] {
  color: #fff !important;
  font-size: 14px !important;
}

/* 日期范围 */
[class^="calendar"] {
  background-color: var(--tv-color-popup-background) !important;
}

/* 隐藏 TradingView 底部「日期范围」入口（用外部日历按钮替代） */
[data-name="date-ranges-menu"] {
  opacity: 0 !important;
  pointer-events: none !important;
  width: 24px !important;
  min-width: 24px !important;
  max-width: 24px !important;
  flex: 0 0 24px !important;
  padding: 0 !important;
  overflow: hidden !important;
}

[class^="calendar"] [class^="view-month"] [class^="weeks"] [class^="week"] [class*="day"][class*="accent-color"] {
  border: 2px solid var(--brand) !important;
  background-color: var(--brand) !important;
  color: var(--bg-primary) !important;
}

[class^="calendar"] [class*="variant-quiet-primary"][class*="color-gray"][class*="selected"] {
  border: 2px solid var(--bg-tertiary) !important;
  background-color: var(--bg-tertiary) !important;
  color: var(--foreground) !important;
}

[class^="calendar"] [class*="variant-ghost"][class*="color-gray"][class*="selected"] {
  color: var(--brand) !important;
}

/* 时间选择下拉菜单样式 */
html.theme-dark .menuWrap-biWYdsXC,
html.theme-dark .menuBox-biWYdsXC,
html.theme-dark .dropdown-_8r4li9v {
  background-color: #181818 !important;
}

.menuWrap-biWYdsXC .scrollWrap-biWYdsXC {
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE/Edge */
}

.menuWrap-biWYdsXC .scrollWrap-biWYdsXC::-webkit-scrollbar {
  display: none; /* Chrome/Safari */
}

html.theme-dark .item-RhC5uhZw {
  background-color: #181818 !important;
}

html.theme-dark .item-RhC5uhZw:hover {
  background-color: #242424 !important;
}

html.theme-dark .item-RhC5uhZw.isActive-RhC5uhZw,
html.theme-dark .item-RhC5uhZw.isActive-RhC5uhZw:active {
  background-color: #404040 !important;
}

html.theme-dark .summary-WgEIQSbO {
  background-color: #181818 !important;
}

/* 星星激活状态颜色 */
html.theme-dark .favorite-TPXOIXOJ.checked-TPXOIXOJ svg path,
html.theme-dark .favorite-TPXOIXOJ.active-TPXOIXOJ svg path {
  fill: #22fd73 !important;
}

html.theme-dark .favorite-TPXOIXOJ.active-TPXOIXOJ:hover {
  background-color: #404040 !important;
}

/* 工具栏按钮内 svg 图标尺寸：
   - 对有 viewBox 的 svg，可安全缩放到 20px
   - 对没有 viewBox 的 svg（TV 有些 icon 是这种），强行改宽高会导致内容停在左上角看起来“不居中”
*/
.icon-uO7HM85b svg[viewBox] {
  width: 20px !important;
  height: 20px !important;
}

.icon-uO7HM85b svg:not([viewBox]) {
  width: 14px !important;
  height: 14px !important;
}

/* TradingView toolbar icon：确保 svg 在按钮内上下左右居中（避免 baseline 偏移） */
div[data-role="button"] > .icon-uO7HM85b {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  line-height: 0 !important;
}

div[data-role="button"] > .icon-uO7HM85b > svg {
  display: block !important;
}


html.theme-dark [data-role="button"].apply-common-tooltip:hover::before,
html.theme-dark [data-role="button"].apply-common-tooltip:hover::after,
html.theme-dark button.apply-common-tooltip:hover::before,
html.theme-dark button.apply-common-tooltip:hover::after {
  background: #242424 !important;
  background-color: #242424 !important;
  border-radius: 4px !important;
  height: 38px !important;
  top: 50% !important;
  transform: translateY(-50%) !important;
}

/* 工具栏按钮高度 */
#header-toolbar-chart-styles [data-role="button"],
#header-toolbar-indicators [data-role="button"] {
  height: 28px !important;
}

#header-toolbar-chart-styles [data-role="button"]:hover,
#header-toolbar-indicators [data-role="button"]:hover {
  height: 28px !important;
}

html.theme-dark .button-uO7HM85b.isInteractive-uO7HM85b:hover::before {
  height: 38px !important;
  top: 50% !important;
  transform: translateY(-50%) !important;
  background: #242424 !important;
  background-color: #242424 !important;
}

/* 图表样式和指标按钮的 hover 背景高度为 28px */
#header-toolbar-chart-styles [data-role="button"]:hover::before,
#header-toolbar-chart-styles [data-role="button"]:hover::after,
#header-toolbar-indicators [data-role="button"]:hover::before,
#header-toolbar-indicators [data-role="button"]:hover::after {
  height: 28px !important;
}

.group-HlcUjC8J {
  margin-left: 6px;
}

.chart-gui-wrapper[data-name="pane-widget-chart-gui-wrapper"] canvas:nth-child(2) {
  top: -1px !important;
}


[data-role="button"],
[data-role="button"] * {
  cursor: pointer !important;
}