:root {
  color-scheme: dark;
  --tv-bg: #0f1117;
  --tv-panel: #161a22;
  --tv-panel-2: #1c2029;
  --tv-border: #2a2e39;
  --tv-text: #d1d4dc;
  --tv-muted: #787b86;
  --tv-blue: #2962ff;
  --tv-buy: #26a69a;
  --tv-sell: #ef5350;
}

html,
body,
#react-entry-point,
#_dash-app-content {
  min-height: 100%;
  margin: 0;
  background: var(--tv-bg);
}

body {
  overflow-x: hidden;
}

* {
  box-sizing: border-box;
}

.tv-shell {
  min-height: 100vh;
  color: var(--tv-text);
  background: var(--tv-bg);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.tv-topbar {
  height: 52px;
  padding: 0 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid var(--tv-border);
  background: #101218;
}

.tv-brand,
.tv-market-status,
.tv-statbar,
.tv-flow-key {
  display: flex;
  align-items: center;
}

.tv-brand {
  gap: 10px;
  min-width: 0;
}

.tv-brand-mark {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  color: white;
  font-size: 13px;
  font-weight: 800;
  border-radius: 50%;
  background: linear-gradient(145deg, #2962ff, #7b4dff);
  box-shadow: 0 0 0 1px rgba(255,255,255,.08), 0 0 20px rgba(41,98,255,.18);
}

.tv-brand-title {
  font-size: 14px;
  line-height: 1.1;
  font-weight: 650;
  letter-spacing: .01em;
  white-space: nowrap;
}

.tv-brand-subtitle {
  margin-top: 3px;
  color: var(--tv-muted);
  font-size: 10px;
  white-space: nowrap;
}

.tv-symbol-pill,
.tv-timeframe-pill {
  padding: 4px 7px;
  color: #b8bcc7;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .06em;
  border: 1px solid var(--tv-border);
  border-radius: 4px;
  background: #171a22;
}

.tv-timeframe-pill {
  color: #8fa9ff;
  border-color: rgba(41,98,255,.45);
  background: rgba(41,98,255,.12);
}

.tv-market-status {
  min-width: 0;
  gap: 7px;
  color: var(--tv-muted);
  font-size: 10px;
  white-space: nowrap;
}

.tv-live-dot {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--tv-buy);
  box-shadow: 0 0 0 3px rgba(38,166,154,.12), 0 0 10px rgba(38,166,154,.45);
}

.tv-live-label {
  color: #9ea2ad;
  font-weight: 700;
  letter-spacing: .08em;
}

.tv-build-status {
  max-width: 380px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tv-toolbar {
  position: relative;
  z-index: 100;
  min-height: 62px;
  padding: 7px 10px;
  display: flex;
  align-items: stretch;
  gap: 6px;
  overflow: visible;
  border-bottom: 1px solid var(--tv-border);
  background: #12151c;
}

.tv-control {
  position: relative;
  min-width: 96px;
  flex: 1 1 124px;
}

.tv-control-session {
  min-width: 148px;
  flex-basis: 148px;
}

.tv-control-metric,
.tv-control-ranking {
  min-width: 176px;
  flex-basis: 176px;
}

.tv-control-label {
  height: 16px;
  padding-left: 2px;
  color: #6f7480;
  font-size: 9px;
  font-weight: 700;
  line-height: 14px;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.tv-dropdown .Select-control {
  height: 34px;
  color: var(--tv-text);
  border: 1px solid var(--tv-border) !important;
  border-radius: 4px;
  background: var(--tv-panel) !important;
  box-shadow: none !important;
}

.tv-dropdown .Select-control:hover,
.tv-dropdown.is-focused .Select-control {
  border-color: #4b5263 !important;
}

.tv-dropdown .Select-placeholder,
.tv-dropdown .Select-value,
.tv-dropdown .Select-value-label,
.tv-dropdown .Select-input,
.tv-dropdown .Select-input > input {
  color: var(--tv-text) !important;
  font-size: 12px;
  line-height: 32px !important;
}

.tv-dropdown .Select-arrow {
  border-top-color: #858a96;
}

.tv-dropdown .Select-menu-outer {
  z-index: 1100;
  margin-top: 3px;
  color: var(--tv-text);
  border: 1px solid var(--tv-border);
  border-radius: 4px;
  background: #1b1f28;
  box-shadow: 0 12px 32px rgba(0,0,0,.42);
}

.tv-dropdown .VirtualizedSelectOption {
  color: #b9bdc8;
  background: #1b1f28;
  font-size: 12px;
}

.tv-dropdown .VirtualizedSelectFocusedOption {
  color: white;
  background: #292e3a;
}

.tv-statbar {
  min-height: 44px;
  padding: 0 14px;
  gap: 0;
  overflow-x: auto;
  border-bottom: 1px solid var(--tv-border);
  background: #101218;
}

.tv-stat {
  min-width: 112px;
  height: 26px;
  padding: 0 15px;
  display: flex;
  align-items: baseline;
  gap: 7px;
  border-right: 1px solid var(--tv-border);
  white-space: nowrap;
}

.tv-stat:first-child {
  padding-left: 0;
}

.tv-stat-label,
.tv-stat-side {
  color: var(--tv-muted);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .08em;
}

.tv-stat-value {
  color: #d9dce4;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 13px;
  font-weight: 700;
}

.tv-stat-buy .tv-stat-value {
  color: var(--tv-buy);
}

.tv-stat-sell .tv-stat-value {
  color: var(--tv-sell);
}

.tv-stat-side {
  font-size: 8px;
}

.tv-flow-key {
  margin-left: auto;
  padding-left: 18px;
  gap: 6px;
  color: #8d919c;
  font-size: 10px;
  white-space: nowrap;
}

.tv-heat-swatch {
  width: 12px;
  height: 5px;
  margin-left: 8px;
  border-radius: 1px;
}

.tv-heat-buy {
  background: linear-gradient(90deg, #246983, #26a69a, #efde41);
}

.tv-heat-sell {
  background: linear-gradient(90deg, #5c237e, #b13779, #ef5350);
}

.tv-heat-note {
  margin-left: 8px;
  color: #5f6470;
}

.tv-chart-panel {
  position: relative;
  z-index: 1;
  background: var(--tv-bg);
}

.tv-chart,
.tv-chart .js-plotly-plot,
.tv-chart .plot-container,
.tv-chart .svg-container {
  width: 100% !important;
}

.tv-chart-panel .modebar {
  top: 64px !important;
  right: auto !important;
  left: 9px !important;
  padding: 4px 3px !important;
  display: flex !important;
  flex-direction: column !important;
  opacity: 1 !important;
  border: 1px solid rgba(42,46,57,.88);
  border-radius: 5px;
  background: rgba(17,20,27,.88) !important;
  backdrop-filter: blur(8px);
}

.tv-chart-panel .modebar-group {
  display: flex !important;
  flex-direction: column !important;
}

.tv-chart-panel .modebar-btn {
  padding: 6px !important;
}

.tv-chart-panel .modebar-btn path {
  fill: #777c89 !important;
}

.tv-chart-panel .modebar-btn:hover path,
.tv-chart-panel .modebar-btn.active path {
  fill: #d6d9e0 !important;
}

@media (max-width: 760px) {
  .tv-topbar {
    padding: 0 10px;
  }

  .tv-brand-subtitle,
  .tv-symbol-pill,
  .tv-build-status,
  .tv-live-label,
  .tv-heat-note {
    display: none;
  }

  .tv-toolbar {
    padding-left: 8px;
    padding-right: 8px;
    flex-wrap: wrap;
  }

  .tv-control,
  .tv-control-session,
  .tv-control-metric,
  .tv-control-ranking {
    min-width: calc(50% - 3px);
    flex: 1 1 calc(50% - 3px);
  }

  .tv-statbar {
    padding: 0 10px;
  }

  .tv-flow-key {
    padding-right: 10px;
  }

  .tv-chart {
    min-height: 720px !important;
  }
}
