/* ===== PROFESSIONAL CHART STYLES ===== */

/* ── Chart Container ── */
.chart-container-wrap {
  flex: 1;
  position: relative;
  overflow-y: auto;
  overflow-x: hidden;
  background: #0d1117;
  display: flex;
  flex-direction: column;
}

.tv-chart-container {
  width: 100%;
  min-height: 280px;
  flex: 1;
  position: relative;
  touch-action: pan-x pinch-zoom;
}

.chart-container-wrap .tv-chart-container {
  position: relative;
  flex: 1;
  width: 100%;
  margin-top: 40px;
  margin-bottom: 34px;
  z-index: 1;
}

.m-chart .tv-chart-container {
  position: relative;
  flex: 1;
  width: 100%;
  margin-top: 0;
  margin-bottom: 34px;
  z-index: 1;
}

.tv-chart-container table {
  border-collapse: collapse;
}

/* ── Toolbar Enhancements ── */
.chart-toolbar {
  position: absolute;
  top: 6px;
  left: 6px;
  right: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  background: rgba(14, 20, 32, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  z-index: 10;
  height: 34px;
  transition: all 0.3s ease;
}

.toolbar-divider {
  width: 1px;
  height: 20px;
  background: var(--border2);
  margin: 0 4px;
}

.tf-group {
  display: flex;
  gap: 2px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 6px;
  padding: 2px;
  overflow-x: auto;
  scrollbar-width: none;
  max-width: 100%;
}

.tf-group::-webkit-scrollbar {
  display: none;
}

.tf-btn {
  background: none;
  border: none;
  color: var(--text3);
  padding: 5px 10px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: 'Inter', sans-serif;
  letter-spacing: 0.3px;
}

.tf-btn:hover {
  background: rgba(0, 200, 83, 0.1);
  color: var(--green);
}

.tf-btn.active {
  background: rgba(0, 200, 83, 0.2);
  color: var(--green);
  box-shadow: 0 0 8px rgba(0, 200, 83, 0.15);
}

/* ── Chart Type Switcher ── */
.ct-group {
  display: flex;
  gap: 2px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 6px;
  padding: 2px;
}

.ct-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: none;
  border: none;
  color: var(--text3);
  padding: 5px 9px;
  border-radius: 5px;
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.22s ease, color 0.22s ease, box-shadow 0.22s ease, transform 0.15s ease;
  font-family: 'Inter', sans-serif;
  letter-spacing: 0.2px;
}

.ct-btn .ct-icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.ct-btn .ct-label {
  display: none;
}

@media (min-width: 1200px) {
  .ct-btn .ct-label {
    display: inline;
  }
}

.ct-btn:hover {
  background: rgba(56, 189, 248, 0.1);
  color: #38bdf8;
}

.ct-btn.active {
  background: rgba(56, 189, 248, 0.2);
  color: #38bdf8;
  box-shadow: 0 0 8px rgba(56, 189, 248, 0.18);
}

.ct-btn[data-chart-type="candlestick"].active {
  color: #fbbf24;
  background: rgba(251, 191, 36, 0.15);
  box-shadow: 0 0 8px rgba(251, 191, 36, 0.12);
}

.ct-btn[data-chart-type="line"].active {
  color: #38bdf8;
}

.ct-btn[data-chart-type="area"].active {
  color: #22d3ee;
  background: rgba(34, 211, 238, 0.15);
}

.chart-type-badge {
  font-size: 9px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  background: rgba(56, 189, 248, 0.12);
  color: #38bdf8;
  letter-spacing: 0.4px;
  text-transform: uppercase;
}

.chart-container-wrap.chart-type-switching,
.m-chart.chart-type-switching {
  animation: chartTypeFade 0.32s ease;
}

@keyframes chartTypeFade {
  0% {
    opacity: 0.55;
  }

  100% {
    opacity: 1;
  }
}

/* ── Indicator Buttons ── */
.indicator-group {
  display: flex;
  gap: 2px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 6px;
  padding: 2px;
}

.ind-btn {
  background: none;
  border: none;
  color: var(--text3);
  padding: 5px 8px;
  border-radius: 5px;
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.25s ease;
  font-family: 'Inter', sans-serif;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.ind-btn:hover {
  background: rgba(0, 149, 255, 0.1);
  color: var(--blue);
}

.ind-btn.active {
  background: rgba(0, 149, 255, 0.2);
  color: var(--blue);
  box-shadow: 0 0 6px rgba(0, 149, 255, 0.15);
}

.ind-btn[data-indicator="ema"].active {
  color: #ffd600;
  background: rgba(255, 214, 0, 0.15);
}

.ind-btn[data-indicator="sma"].active {
  color: #00bcd4;
  background: rgba(0, 188, 212, 0.15);
}

.ind-btn[data-indicator="bb"].active {
  color: #ce93d8;
  background: rgba(206, 147, 216, 0.15);
}

/* ── Live Indicator ── */
.chart-live-indicator {
  position: absolute;
  top: 12px;
  left: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(0, 200, 83, 0.12);
  border: 1px solid rgba(0, 200, 83, 0.25);
  border-radius: 20px;
  padding: 4px 12px 4px 8px;
  font-size: 10px;
  font-weight: 700;
  color: var(--green);
  letter-spacing: 1.2px;
  z-index: 3;
  backdrop-filter: blur(6px);
}

.live-pulse {
  width: 7px;
  height: 7px;
  background: var(--green);
  border-radius: 50%;
  animation: livePulse 1.5s ease-in-out infinite;
  box-shadow: 0 0 6px rgba(0, 200, 83, 0.6);
}

@keyframes livePulse {

  0%,
  100% {
    transform: scale(1);
    opacity: 1;
  }

  50% {
    transform: scale(1.6);
    opacity: 0.5;
  }
}

/* ── Price Tag ── */
.price-tag {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  background: linear-gradient(135deg, #0095ff, #0077cc);
  border-radius: 6px 0 0 6px;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 800;
  color: #fff;
  z-index: 4;
  font-family: 'Inter', monospace;
  letter-spacing: 0.5px;
  box-shadow: 0 2px 12px rgba(0, 149, 255, 0.3);
  display: none;
  /* Hidden — TradingView has its own price scale */
}

/* ── Chart Bottom Bar ── */
.chart-bottom-tools {
  position: absolute;
  bottom: 4px;
  left: 6px;
  right: 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 3px 8px;
  background: rgba(17, 24, 39, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 6px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  z-index: 10;
  height: 28px;
  min-height: 28px;
  transition: all 0.3s ease;
}

.chart-bottom-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.chart-bottom-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

.chart-market-badge {
  background: rgba(0, 149, 255, 0.12);
  border: 1px solid rgba(0, 149, 255, 0.2);
  color: var(--blue);
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.3px;
}

.chart-tf-badge {
  background: rgba(0, 200, 83, 0.12);
  border: 1px solid rgba(0, 200, 83, 0.2);
  color: var(--green);
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 700;
}

/* ── Crosshair Tooltip ── */
.chart-tooltip {
  display: none;
  position: absolute;
  z-index: 100;
  pointer-events: none;
  background: rgba(17, 24, 39, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 12px;
  font-family: 'Inter', monospace;
  color: #e2e8f0;
  min-width: 150px;
  backdrop-filter: blur(16px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.tt-header {
  font-weight: 700;
  font-size: 12px;
  color: #fff;
  margin-bottom: 6px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  letter-spacing: 0.3px;
}

.tt-row {
  display: flex;
  justify-content: space-between;
  padding: 2px 0;
  font-size: 11px;
}

.tt-label {
  color: var(--text3);
  font-weight: 600;
  margin-right: 12px;
}

/* ── Mobile Chart Styles ── */
.m-chart {
  flex: 1;
  position: relative;
  background: #0d1117;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
}

.m-chart-time-info {
  position: absolute;
  top: 40px;
  left: 6px;
  z-index: 15;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  pointer-events: none;
}

.m-chart-time-info > * {
  pointer-events: auto;
}

.m-live-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(0, 200, 83, 0.12);
  border: 1px solid rgba(0, 200, 83, 0.25);
  border-radius: 10px;
  padding: 2px 7px 2px 5px;
  font-size: 8px;
  font-weight: 700;
  color: var(--green);
  letter-spacing: 0.8px;
  backdrop-filter: blur(6px);
}

.m-live-indicator .live-pulse {
  width: 5px;
  height: 5px;
}

.m-price-tag {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  background: linear-gradient(135deg, #0095ff, #0077cc);
  border-radius: 5px 0 0 5px;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 800;
  color: #fff;
  z-index: 4;
  font-family: 'Inter', monospace;
  box-shadow: 0 2px 8px rgba(0, 149, 255, 0.3);
  display: none;
  /* Hidden — TradingView has its own price scale */
}

/* ── Mobile Timeframe & Indicator Bar ── */
.m-tf-bar {
  position: absolute;
  bottom: 3px;
  left: 4px;
  right: 4px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 3px;
  background: rgba(13, 17, 23, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  padding: 2px 4px;
  z-index: 10;
  height: 28px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
}

.m-tf-picker-trigger {
  background: linear-gradient(135deg, rgba(0, 200, 83, 0.15), rgba(0, 229, 255, 0.1));
  border: 1px solid rgba(0, 200, 83, 0.4);
  color: #00e676;
  padding: 2px 5px;
  border-radius: 4px;
  font-size: 8.5px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  box-shadow: 0 0 8px rgba(0, 200, 83, 0.15);
  outline: none;
}

.m-tf-picker-trigger:active {
  transform: scale(0.95);
}

.m-tf-scroll-group {
  display: flex;
  align-items: center;
  gap: 3px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  padding: 1px 0;
  flex: 1;
}

.m-tf-scroll-group::-webkit-scrollbar {
  display: none;
}

.m-tf-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #94a3b8;
  padding: 3px 6px;
  border-radius: 5px;
  font-size: 9.5px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.m-tf-btn.active {
  background: rgba(0, 200, 83, 0.2);
  border-color: rgba(0, 200, 83, 0.5);
  color: #00e676;
  box-shadow: 0 0 8px rgba(0, 200, 83, 0.3);
}

.m-tf-divider {
  width: 1px;
  height: 14px;
  background: rgba(255, 255, 255, 0.12);
  margin: 0 1px;
  flex-shrink: 0;
}

/* ── Mobile Timeframe Modal Sheet ── */
.m-tf-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  align-items: flex-end;
}

.m-tf-modal-overlay.show {
  opacity: 1;
  visibility: visible;
}

.m-tf-sheet {
  width: 100%;
  background: rgba(15, 23, 42, 0.98);
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 24px 24px 0 0;
  padding: 20px 20px 30px;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.8);
}

.m-tf-modal-overlay.show .m-tf-sheet {
  transform: translateY(0);
}

.m-tf-sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 12px;
}

.m-tf-sheet-title {
  font-size: 15px;
  font-weight: 800;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 8px;
}

.m-tf-sheet-close {
  background: rgba(255, 255, 255, 0.08);
  border: none;
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.m-tf-section-lbl {
  font-size: 11px;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 14px 0 8px;
}

.m-tf-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.m-tf-grid-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 12px 6px;
  color: #ffffff;
  font-size: 13px;
  font-weight: 700;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  outline: none;
}

.m-tf-grid-btn:hover,
.m-tf-grid-btn:active {
  background: rgba(0, 200, 83, 0.15);
  border-color: rgba(0, 200, 83, 0.4);
  color: #00e676;
}

.m-tf-grid-btn.active {
  background: linear-gradient(135deg, rgba(0, 200, 83, 0.3), rgba(0, 229, 255, 0.2));
  border: 1.5px solid #00e676;
  color: #00e676;
  box-shadow: 0 4px 15px rgba(0, 200, 83, 0.3);
}

.m-ind-btn {
  background: none;
  border: none;
  color: var(--text3);
  padding: 2px 5px;
  border-radius: 4px;
  font-size: 8.5px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: 'Inter', sans-serif;
  letter-spacing: 0.3px;
}

.m-ind-btn:hover,
.m-ind-btn.active {
  background: rgba(0, 149, 255, 0.15);
  color: var(--blue);
}

.m-ind-btn[data-indicator="ema"].active {
  color: #ffd600;
  background: rgba(255, 214, 0, 0.12);
}

.m-ind-btn[data-indicator="sma"].active {
  color: #00bcd4;
  background: rgba(0, 188, 212, 0.12);
}

.m-ind-btn[data-indicator="bb"].active {
  color: #ce93d8;
  background: rgba(206, 147, 216, 0.12);
}

.m-ct-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--text3);
  width: 22px;
  height: 22px;
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.2s ease;
  padding: 0;
}

.m-ct-btn svg {
  width: 12px;
  height: 12px;
}

.m-ct-btn:hover,
.m-ct-btn.active {
  background: rgba(56, 189, 248, 0.18);
  color: #38bdf8;
}

.m-ct-btn[data-chart-type="candlestick"].active {
  color: #fbbf24;
  background: rgba(251, 191, 36, 0.15);
}

.m-ct-btn[data-chart-type="area"].active {
  color: #22d3ee;
  background: rgba(34, 211, 238, 0.15);
}

/* ── Candle Countdown Timer ── */
.candle-countdown {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(17, 24, 39, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 5px 14px 5px 6px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: border-color 0.4s ease, box-shadow 0.4s ease;
}

.candle-countdown.mobile {
  position: relative;
  top: auto;
  left: auto;
  margin-top: 1px;
  padding: 2px 5px 2px 3px;
  gap: 4px;
  border-radius: 6px;
  background: rgba(13, 17, 23, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

/* Ring Wrapper */
.countdown-ring-wrap {
  position: relative;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
}

.candle-countdown.mobile .countdown-ring-wrap {
  width: 17px;
  height: 17px;
}

.countdown-ring {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.countdown-ring-bg {
  fill: none;
  stroke: rgba(255, 255, 255, 0.06);
  stroke-width: 3;
}

.countdown-ring-progress {
  fill: none;
  stroke: var(--green, #00c853);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-dasharray: 97.39;
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 0.5s ease, stroke 0.5s ease;
  filter: drop-shadow(0 0 4px rgba(0, 200, 83, 0.4));
}

/* Color States */
.countdown-ring-progress.warning {
  stroke: #ffab00;
  filter: drop-shadow(0 0 4px rgba(255, 171, 0, 0.5));
}

.countdown-ring-progress.urgent {
  stroke: #ff1744;
  filter: drop-shadow(0 0 6px rgba(255, 23, 68, 0.6));
  animation: urgentPulseRing 0.6s ease-in-out infinite;
}

@keyframes urgentPulseRing {

  0%,
  100% {
    stroke-width: 3;
  }

  50% {
    stroke-width: 4;
  }
}

/* Ring Center Text */
.countdown-ring-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 11px;
  font-weight: 800;
  font-family: 'Inter', monospace;
  color: #ffffff;
  letter-spacing: -0.3px;
  line-height: 1;
}

.candle-countdown.mobile .countdown-ring-text {
  font-size: 7px;
}

/* Info Section */
.countdown-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.countdown-label {
  font-size: 9px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.4);
  letter-spacing: 0.8px;
  text-transform: uppercase;
  line-height: 1.2;
}

.countdown-time {
  font-size: 14px;
  font-weight: 800;
  font-family: 'Inter', monospace;
  color: var(--green, #00c853);
  letter-spacing: 0.5px;
  line-height: 1.2;
  transition: color 0.4s ease;
}

.candle-countdown.mobile .countdown-label {
  font-size: 6.5px;
  letter-spacing: 0.4px;
}

.candle-countdown.mobile .countdown-time {
  font-size: 9.5px;
}

/* Warning/Urgent Color States for text */
.countdown-time.warning {
  color: #ffab00;
}

.countdown-time.urgent {
  color: #ff1744;
  animation: urgentBlink 0.6s ease-in-out infinite;
}

}

/* ── UTC Clock Overlay & Badges ── */
.countdown-divider {
  width: 1px;
  height: 20px;
  background: rgba(255, 255, 255, 0.14);
  margin: 0 4px;
}

.candle-countdown.mobile .countdown-divider {
  height: 12px;
  margin: 0 2px;
}

.utc-clock-box {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.utc-clock-label {
  font-size: 8px;
  font-weight: 700;
  color: #38bdf8;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  line-height: 1.1;
}

.candle-countdown.mobile .utc-clock-label {
  font-size: 6px;
  letter-spacing: 0.3px;
}

.utc-clock-val {
  font-size: 11.5px;
  font-weight: 800;
  font-family: 'Inter', monospace;
  color: #ffffff;
  letter-spacing: 0.3px;
  line-height: 1.1;
  white-space: nowrap;
}

.candle-countdown.mobile .utc-clock-val {
  font-size: 9px;
  color: #38bdf8;
}

.chart-utc-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 7px;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  font-family: 'Inter', monospace;
  color: #38bdf8;
  margin-left: 6px;
}


/* Candle Complete Flash */
.candle-countdown.flash {
  animation: candleFlash 0.5s ease;
}

@keyframes candleFlash {
  0% {
    border-color: rgba(0, 200, 83, 0.6);
    box-shadow: 0 0 20px rgba(0, 200, 83, 0.3);
  }

  50% {
    border-color: rgba(0, 200, 83, 0.8);
    box-shadow: 0 0 30px rgba(0, 200, 83, 0.5);
  }

  100% {
    border-color: rgba(255, 255, 255, 0.08);
    box-shadow: none;
  }
}

/* ── Light Mode Overrides ── */
body.light-mode {
  --bg: #f5f7fa;
  --bg2: #ffffff;
  --bg3: #f0f2f5;
  --bg4: #e8ebef;
  --text: #1a1a2e;
  --text2: #5a6577;
  --text3: #8b95a5;
  --border: #e0e4ea;
  --border2: #d0d4da;
}

body.light-mode .chart-container-wrap {
  background: #ffffff;
}

body.light-mode .chart-toolbar {
  background: rgba(240, 242, 245, 0.95);
  border-bottom-color: #e0e4ea;
}

body.light-mode .chart-live-indicator {
  background: rgba(0, 180, 83, 0.08);
  border-color: rgba(0, 180, 83, 0.2);
}

body.light-mode .chart-tooltip {
  background: rgba(255, 255, 255, 0.96);
  border-color: rgba(0, 0, 0, 0.1);
  color: #333;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
}

body.light-mode .tt-header {
  color: #1a1a2e;
  border-bottom-color: rgba(0, 0, 0, 0.08);
}

body.light-mode .m-tf-bar {
  background: rgba(255, 255, 255, 0.9);
  border-color: rgba(0, 0, 0, 0.08);
}

body.light-mode .ct-group,
body.light-mode .m-ct-btn {
  background: rgba(0, 0, 0, 0.03);
}

body.light-mode .chart-type-badge {
  background: rgba(2, 136, 209, 0.1);
  color: #0288d1;
}

body.light-mode .m-live-indicator {
  background: rgba(0, 180, 83, 0.08);
  border-color: rgba(0, 180, 83, 0.2);
}

body.light-mode .candle-countdown {
  background: rgba(255, 255, 255, 0.92);
  border-color: rgba(0, 0, 0, 0.08);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

body.light-mode .candle-countdown:hover {
  border-color: rgba(0, 180, 83, 0.3);
  box-shadow: 0 4px 20px rgba(0, 180, 83, 0.1);
}

body.light-mode .countdown-ring-bg {
  stroke: rgba(0, 0, 0, 0.08);
}

body.light-mode .countdown-ring-text {
  color: #1a1a2e;
}

body.light-mode .countdown-label {
  color: rgba(0, 0, 0, 0.4);
}

/* ── Tool Buttons (refined) ── */
.tool-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 6px;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text3);
  font-size: 13px;
  transition: all 0.25s ease;
}

.tool-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.12);
  transform: translateY(-1px);
}

/* ── Responsive Chart Adjustments ── */
@media (max-width: 767px) {
  .chart-toolbar {
    display: none;
    /* Mobile uses the bottom TF bar instead */
  }

  .chart-bottom-tools {
    display: none;
  }

  #desktopCandleCountdown {
    display: none;
  }
}

/* ── Desktop / Laptop compact controls (768px+) ── */
@media (min-width: 768px) {

  /* Compact timeframe buttons */
  .tf-btn {
    padding: 3px 7px;
    font-size: 10px;
    border-radius: 4px;
  }

  /* Compact tool icon buttons */
  .tool-btn {
    width: 26px;
    height: 26px;
    font-size: 12px;
  }

  /* Compact dropdown trigger */
  .tb-dropdown-trigger {
    padding: 3px 8px;
    font-size: 10px;
    height: 26px;
    border-radius: 5px;
    gap: 4px;
  }

  /* Compact toolbar divider */
  .toolbar-divider {
    height: 16px;
    margin: 0 2px;
  }

  /* Compact live indicator inside toolbar */
  .chart-live-indicator {
    padding: 2px 8px 2px 6px;
    font-size: 9px;
    border-radius: 16px;
  }

  .live-pulse {
    width: 5px;
    height: 5px;
  }

  /* Compact pair info */
  .pair-flags-lg {
    font-size: 16px;
  }

  .pair-name-lg {
    font-size: 12px;
  }

  .pair-pct-lg {
    font-size: 12px;
  }

  /* Desktop countdown: compact inline card */
  #desktopCandleCountdown {
    position: absolute;
    top: 46px;
    left: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(17, 24, 39, 0.78);
    border: 1px solid rgba(255, 255, 255, 0.09);
    border-radius: 7px;
    padding: 3px 10px 3px 5px;
    z-index: 10;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.35);
    transition: border-color 0.3s ease;
  }

  #desktopCandleCountdown:hover {
    border-color: rgba(0, 200, 83, 0.3);
  }

  #desktopCandleCountdown .countdown-ring-wrap {
    width: 24px;
    height: 24px;
  }

  #desktopCandleCountdown .countdown-ring-text {
    font-size: 8px;
  }

  #desktopCandleCountdown .countdown-label {
    font-size: 8px;
  }

  #desktopCandleCountdown .countdown-time {
    font-size: 12px;
  }

  /* Desktop bottom tools: compact overlay */
  .chart-bottom-tools {
    bottom: 4px;
    left: 6px;
    right: 6px;
    padding: 3px 8px;
    min-height: 28px;
  }
}

@media (max-width: 1100px) and (min-width: 768px) {
  .indicator-group {
    display: none;
    /* Hide on small desktop to save space */
  }
}

/* Override the old canvas style */
canvas#mainChart,
canvas#mobileChart {
  display: none !important;
}

/* ══════════════════════════════════════════════════════
   ── Professional Trade Marking System ──
   ══════════════════════════════════════════════════════ */

.tm-wrapper {
  position: absolute;
  display: flex;
  align-items: center;
  z-index: 10;
  pointer-events: none;
  transform: translateX(-100%) translateY(-50%);
  animation: tmAppear 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.25));
}

@keyframes tmAppear {
  0% {
    opacity: 0;
    transform: translateX(-100%) translateY(-50%) scale(0.5);
  }

  60% {
    opacity: 1;
    transform: translateX(-100%) translateY(-50%) scale(1.05);
  }

  100% {
    opacity: 1;
    transform: translateX(-100%) translateY(-50%) scale(1);
  }
}

/* ── Badge (pill) ── */
.tm-badge {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px 3px 3px;
  border-radius: 16px;
  font-family: 'Inter', sans-serif;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.18);
}

/* Up = Blue */
.tm-wrapper.up .tm-badge {
  background: linear-gradient(135deg, rgba(33, 150, 243, 0.92), rgba(21, 101, 192, 0.96));
  box-shadow: 0 4px 18px rgba(33, 150, 243, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

/* Down = Red */
.tm-wrapper.down .tm-badge {
  background: linear-gradient(135deg, rgba(244, 67, 54, 0.92), rgba(183, 28, 28, 0.96));
  box-shadow: 0 4px 18px rgba(244, 67, 54, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

/* ── Direction icon circle ── */
.tm-icon-circle {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 900;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.22);
  color: #fff;
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.2);
}

/* ── Text ── */
.tm-amount {
  font-weight: 800;
  letter-spacing: 0.3px;
  font-size: 10px;
}

.tm-timer {
  opacity: 0.8;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.3px;
  font-family: 'Inter', monospace;
}

/* ── Connector line ── */
.tm-connector {
  height: 1.5px;
  width: 12px;
  flex-shrink: 0;
  position: relative;
}

.tm-wrapper.up .tm-connector {
  background: linear-gradient(90deg, rgba(33, 150, 243, 0.7), rgba(33, 150, 243, 0.35));
}

.tm-wrapper.down .tm-connector {
  background: linear-gradient(90deg, rgba(244, 67, 54, 0.7), rgba(244, 67, 54, 0.35));
}

/* ── Entry dot ── */
.tm-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
  box-sizing: border-box;
  border: 1.5px solid rgba(255, 255, 255, 0.6);
  position: relative;
}

.tm-wrapper.up .tm-dot {
  background: #2196F3;
  box-shadow: 0 0 8px rgba(33, 150, 243, 0.7), 0 0 20px rgba(33, 150, 243, 0.3);
}

.tm-wrapper.down .tm-dot {
  background: #F44336;
  box-shadow: 0 0 8px rgba(244, 67, 54, 0.7), 0 0 20px rgba(244, 67, 54, 0.3);
}

/* Pulse ring on dot */
.tm-dot::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 1px solid;
  transform: translate(-50%, -50%) scale(1);
  animation: tmDotPulse 2s ease-in-out infinite;
}

.tm-wrapper.up .tm-dot::after {
  border-color: rgba(33, 150, 243, 0.5);
}

.tm-wrapper.down .tm-dot::after {
  border-color: rgba(244, 67, 54, 0.5);
}

@keyframes tmDotPulse {

  0%,
  100% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 0.6;
  }

  50% {
    transform: translate(-50%, -50%) scale(1.8);
    opacity: 0;
  }
}

/* ── Expired / exit animation ── */
.tm-wrapper.tm-expired {
  animation: tmDisappear 0.6s ease forwards !important;
  pointer-events: none;
}

@keyframes tmDisappear {
  0% {
    opacity: 1;
    transform: translateX(-100%) translateY(-50%) scale(1);
  }

  100% {
    opacity: 0;
    transform: translateX(-100%) translateY(-70%) scale(0.6);
  }
}

/* ── Light Mode ── */
body.light-mode .tm-wrapper {
  filter: drop-shadow(0 2px 10px rgba(0, 0, 0, 0.12));
}

body.light-mode .tm-wrapper.up .tm-badge {
  background: linear-gradient(135deg, rgba(33, 150, 243, 0.95), rgba(21, 101, 192, 0.98));
}

body.light-mode .tm-wrapper.down .tm-badge {
  background: linear-gradient(135deg, rgba(244, 67, 54, 0.95), rgba(183, 28, 28, 0.98));
}

body.light-mode .tm-dot {
  border-color: rgba(255, 255, 255, 0.8);
}

/* ── Mobile adjustments ── */
.m-chart .tm-wrapper .tm-badge {
  padding: 5px 10px 5px 5px;
  gap: 6px;
  font-size: 11px;
  border-radius: 18px;
}

.m-chart .tm-wrapper .tm-icon-circle {
  width: 20px;
  height: 20px;
  font-size: 11px;
}

.m-chart .tm-wrapper .tm-amount {
  font-size: 11px;
}

.m-chart .tm-wrapper .tm-timer {
  font-size: 10px;
}

.m-chart .tm-wrapper .tm-connector {
  width: 18px;
}

.m-chart .tm-wrapper .tm-dot {
  width: 10px;
  height: 10px;
}

/* ── Chart Background Image Overlay ── */
.chart-bg-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
  pointer-events: none;
  z-index: 0;
  opacity: 0;
  transition: opacity 0.25s ease, background-image 0.25s ease;
}

.chart-container-wrap .tv-chart-container,
.m-chart .tv-chart-container {
  position: relative;
  z-index: 1;
}

/* ============================================================
   REAL-TIME TRADER SENTIMENT BAR (LIQUID / FLUID ANIMATED)
   ============================================================ */
.trader-sentiment-bar {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 12;
  height: 220px;
  width: 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  background: rgba(11, 16, 28, 0.82);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  padding: 8px 3px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  user-select: none;
  pointer-events: auto;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.trader-sentiment-bar:hover {
  border-color: rgba(0, 230, 118, 0.4);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.7), 0 0 24px rgba(0, 230, 118, 0.25);
  transform: translateY(-50%) scale(1.03);
}

.sentiment-val {
  font-family: 'JetBrains Mono', 'Inter', monospace;
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
  text-align: center;
  transition: color 0.3s ease;
}

.sentiment-val-up {
  color: #00e676;
  text-shadow: 0 0 8px rgba(0, 230, 118, 0.6);
}

.sentiment-val-down {
  color: #ff2a6d;
  text-shadow: 0 0 8px rgba(255, 42, 109, 0.6);
}

.sentiment-track-wrap {
  position: relative;
  width: 6px;
  flex: 1;
  margin: 6px 0;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 6px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.sentiment-fill-up {
  width: 100%;
  background: linear-gradient(180deg, #00e676 0%, #00c853 100%);
  box-shadow: 0 0 12px rgba(0, 230, 118, 0.6);
  transition: height 0.45s cubic-bezier(0.25, 1, 0.5, 1);
}

.sentiment-fill-down {
  width: 100%;
  background: linear-gradient(180deg, #d50000 0%, #ff2a6d 100%);
  box-shadow: 0 0 12px rgba(255, 42, 109, 0.6);
  transition: height 0.45s cubic-bezier(0.25, 1, 0.5, 1);
}

.sentiment-divider {
  position: absolute;
  left: -3px;
  right: -3px;
  height: 3px;
  background: #ffffff;
  box-shadow: 0 0 10px #ffffff, 0 0 16px rgba(0, 229, 255, 0.9);
  border-radius: 3px;
  transition: bottom 0.45s cubic-bezier(0.25, 1, 0.5, 1);
  z-index: 2;
}

/* Mobile Chart Sentiment Bar */
.m-chart .trader-sentiment-bar {
  left: 6px;
  top: 50%;
  height: 160px;
  width: 26px;
  padding: 6px 2px;
  border-radius: 12px;
}

.m-chart .sentiment-val {
  font-size: 9px;
}

.m-chart .sentiment-track-wrap {
  width: 4px;
  margin: 4px 0;
}

/* ══════════════════════════════════════════════════════
   ── Vertical Expiration Target Line ──
   ══════════════════════════════════════════════════════ */
.tm-vertical-exp-line {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255, 215, 0, 0.95),
    rgba(255, 215, 0, 0.95) 6px,
    transparent 6px,
    transparent 12px
  );
  z-index: 9;
  pointer-events: none;
  transform: translateX(-50%);
  box-shadow: 0 0 10px rgba(255, 215, 0, 0.6);
  transition: opacity 0.2s ease;
}

.tm-vertical-exp-line.up {
  background: repeating-linear-gradient(
    to bottom,
    rgba(0, 229, 255, 0.95),
    rgba(0, 229, 255, 0.95) 6px,
    transparent 6px,
    transparent 12px
  );
  box-shadow: 0 0 10px rgba(0, 229, 255, 0.6);
}

.tm-vertical-exp-line.down {
  background: repeating-linear-gradient(
    to bottom,
    rgba(255, 23, 68, 0.95),
    rgba(255, 23, 68, 0.95) 6px,
    transparent 6px,
    transparent 12px
  );
  box-shadow: 0 0 10px rgba(255, 23, 68, 0.6);
}

.tm-exp-badge-top {
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.92);
  border: 1px solid rgba(255, 215, 0, 0.5);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
  font-size: 10px;
  font-weight: 800;
  color: #ffd700;
  white-space: nowrap;
  backdrop-filter: blur(8px);
}

.tm-vertical-exp-line.up .tm-exp-badge-top {
  border-color: rgba(0, 229, 255, 0.6);
  color: #00e5ff;
}

.tm-vertical-exp-line.down .tm-exp-badge-top {
  border-color: rgba(255, 23, 68, 0.6);
  color: #ff5252;
}

.tm-exp-timer-pill {
  font-family: 'JetBrains Mono', 'Inter', monospace;
  font-size: 9.5px;
  font-weight: 800;
  padding: 1px 5px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}