.left-toolbar {
  width: 40px;
  min-width: 40px;
  background: #1a1e26;
  border-right: 1px solid #2a2e38;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0;
  z-index: 20;
  overflow: visible;
  -webkit-user-select: none;
  user-select: none;
}

.toolbar-top {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 6px 0 0;
  gap: 0;
  flex: 1;
}

.toolbar-bottom {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 0 6px;
  gap: 0;
}

.tool-btn {
  width: 36px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  border-radius: 4px;
  color: #787b86;
  cursor: pointer;
  font-size: 13px;
  transition: background 0.15s, color 0.15s;
  position: relative;
  flex-shrink: 0;
  margin: 0 2px;
}

.tool-btn svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.tool-btn:hover {
  background: #2a2e39;
  color: #d1d4dc;
}

.tool-btn.active {
  background: #2962ff;
  color: #fff;
}

.tool-divider {
  width: 24px;
  border: none;
  border-top: 1px solid #2a2e38;
  margin: 4px 0;
  opacity: 0.7;
}

.tool-group {
  position: relative;
  display: flex;
  align-items: center;
}

.tool-group-arrow {
  position: absolute;
  bottom: 2px;
  right: 3px;
  font-size: 5px;
  color: #787b86;
  line-height: 1;
  pointer-events: none;
  opacity: 0.55;
}

.tool-group:hover .tool-group-arrow {
  opacity: 1;
  color: #d1d4dc;
}

.tool-btn.active ~ .tool-group-arrow {
  color: rgba(255,255,255,0.65);
  opacity: 1;
}

.tool-submenu {
  display: none;
  position: absolute;
  left: 100%;
  top: 0;
  background: #1e222d;
  border: 1px solid #363a45;
  border-radius: 6px;
  padding: 4px 0;
  min-width: 240px;
  max-width: 280px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 4px 24px rgba(0,0,0,0.55);
  z-index: 100;
  white-space: nowrap;
  animation: submenuFadeIn 0.12s ease-out;
}
.tool-submenu::before {
  content: '';
  position: absolute;
  top: 0;
  left: -12px;
  width: 12px;
  height: 100%;
}

.tool-group:hover > .tool-submenu {
  display: block;
}

@keyframes submenuFadeIn {
  from { opacity: 0; transform: translateX(-6px); }
  to   { opacity: 1; transform: translateX(0); }
}

.submenu-section-title {
  padding: 8px 12px 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: #787b86;
  text-transform: uppercase;
  line-height: 1;
}

.submenu-section-title:first-child {
  padding-top: 6px;
}

.submenu-divider,
.tool-sub-divider {
  height: 1px;
  background: #363a45;
  margin: 4px 10px;
}

.tool-sub-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 6px 12px 6px 10px;
  background: none;
  border: none;
  color: #d1d4dc;
  cursor: pointer;
  font-size: 12px;
  font-family: var(--font);
  transition: background 0.1s, color 0.1s;
  text-align: left;
  line-height: 1.3;
}

.tool-sub-btn:hover {
  background: #2a2e39;
  color: #fff;
}

.tool-sub-btn.active {
  color: #2962ff;
}

.tsb-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #787b86;
}

.tool-sub-btn:hover .tsb-icon {
  color: #d1d4dc;
}

.tsb-icon svg {
  width: 14px;
  height: 14px;
}

.tsb-label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tsb-shortcut {
  font-size: 11px;
  color: #787b86;
  margin-left: auto;
  flex-shrink: 0;
  font-family: var(--font);
  opacity: 0.7;
}

.tsb-fav {
  font-size: 18px;
  color: #f0b90b;
  margin-left: auto;
  flex-shrink: 0;
  opacity: 0.75;
  cursor: pointer;
  padding: 2px 6px;
  line-height: 1;
}

.tool-sub-btn:hover .tsb-fav {
  opacity: 1;
}

.tsb-fav.fav-active {
  color: #f0b90b;
  opacity: 1;
  text-shadow: 0 0 6px rgba(240, 185, 11, 0.5);
  font-size: 20px;
}

.tsb-fav:not(.fav-active) {
  color: #787b86;
  opacity: 0.4;
}

.tool-sub-btn:hover .tsb-fav:not(.fav-active) {
  opacity: 0.8;
  color: #f0b90b;
}

.submenu-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px 6px 10px;
  color: #d1d4dc;
  font-size: 12px;
  font-family: var(--font);
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 32px;
  height: 18px;
  flex-shrink: 0;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background: #363a45;
  border-radius: 18px;
  transition: background 0.2s;
}

.toggle-slider::before {
  content: "";
  position: absolute;
  height: 14px;
  width: 14px;
  left: 2px;
  bottom: 2px;
  background: #787b86;
  border-radius: 50%;
  transition: transform 0.2s, background 0.2s;
}

.toggle-switch input:checked + .toggle-slider {
  background: #2962ff;
}

.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(14px);
  background: #fff;
}

.drawing-overlay-canvas {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 5;
}

.candle-countdown {
  position: absolute;
  right: 2px;
  top: 4px;
  z-index: 6;
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 1px 4px;
  border-radius: 2px;
  pointer-events: none;
  white-space: nowrap;
  line-height: 1.4;
  -webkit-user-select: none;
  user-select: none;
}

.theme-dark .candle-countdown {
  color: #8b949e;
  background: rgba(13, 17, 23, 0.8);
}

.chart-light .candle-countdown {
  color: #5c6370;
  background: rgba(240, 241, 243, 0.85);
}

#btn-lock-drawings.active {
  color: #f0b90b;
  background: rgba(240, 185, 11, 0.12);
}

#btn-toggle-drawings.hidden-state {
  color: #787b86;
  opacity: 0.4;
}

#btn-toggle-drawings.hidden-state:hover {
  opacity: 0.7;
}

.saved-drawings-panel {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 9999;
  background: #1e222d;
  border: 1px solid #363a45;
  border-radius: 8px;
  min-width: 320px;
  max-width: 420px;
  max-height: 70vh;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  display: none;
}

.sdp-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid #363a45;
  font-size: 13px;
  font-weight: 600;
  color: #d1d4dc;
}

.sdp-close {
  background: none;
  border: none;
  color: #787b86;
  font-size: 18px;
  cursor: pointer;
  padding: 0 4px;
}

.sdp-close:hover {
  color: #ff4444;
}

.sdp-list {
  overflow-y: auto;
  max-height: calc(70vh - 44px);
  padding: 6px 0;
}

.sdp-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  font-size: 12px;
  color: #9598a1;
  transition: background 0.15s;
}

.sdp-row:hover {
  background: var(--film-040);
}

.sdp-symbol {
  font-weight: 600;
  color: #d1d4dc;
  min-width: 100px;
}

.sdp-count {
  color: #787b86;
  min-width: 40px;
}

.sdp-date {
  color: #5d606b;
  flex: 1;
  font-size: 11px;
}

.sdp-load, .sdp-delete {
  background: none;
  border: 1px solid transparent;
  color: #787b86;
  font-size: 14px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  transition: all 0.15s;
}

.sdp-load:hover {
  color: #2962ff;
  border-color: #2962ff;
  background: rgba(41,98,255,0.1);
}

.sdp-delete:hover {
  color: #ff4444;
  border-color: #ff4444;
  background: rgba(255,68,68,0.1);
}

.sdp-empty {
  padding: 24px 14px;
  text-align: center;
  color: #5d606b;
  font-size: 13px;
}

#btn-saved-drawings.has-data {
  color: #2962ff;
}

body.chart-light .left-toolbar {
  background: #ffffff;
  border-right-color: #e0e3eb;
}

body.chart-light .tool-btn {
  color: #787b86;
}

body.chart-light .tool-btn:hover {
  background: #f0f3fa;
  color: #131722;
}

body.chart-light .tool-btn.active {
  background: #2962ff;
  color: #fff;
}

body.chart-light .tool-divider {
  border-top-color: #e0e3eb;
}

body.chart-light .tool-group-arrow {
  color: #787b86;
}

body.chart-light .tool-submenu {
  background: #ffffff;
  border-color: #e0e3eb;
  box-shadow: 0 4px 24px rgba(0,0,0,0.12);
}

body.chart-light .submenu-section-title {
  color: #9598a1;
}

body.chart-light .submenu-divider,
body.chart-light .tool-sub-divider {
  background: #e0e3eb;
}

body.chart-light .tool-sub-btn {
  color: #131722;
}

body.chart-light .tool-sub-btn:hover {
  background: #f0f3fa;
}

body.chart-light .tsb-icon {
  color: #787b86;
}

body.chart-light .tsb-shortcut {
  color: #9598a1;
}

body.chart-light .submenu-toggle-row {
  color: #131722;
}

body.chart-light .toggle-slider {
  background: #e0e3eb;
}

body.chart-light .toggle-slider::before {
  background: #9598a1;
}

body.chart-light #btn-lock-drawings.active {
  color: #f0b90b;
  background: rgba(240, 185, 11, 0.08);
}

body.chart-light .saved-drawings-panel {
  background: #ffffff;
  border-color: #e0e3eb;
}

body.chart-light .sdp-header {
  border-bottom-color: #e0e3eb;
  color: #131722;
}

body.chart-light .sdp-row {
  color: #787b86;
}

body.chart-light .sdp-symbol {
  color: #131722;
}

.tf-btn-indicators,
#btn-grid-select,
#btn-simulator,
#btn-top-assets {
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  padding: 0 6px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 2px;
  align-self: center;
  height: 20px;
  box-sizing: border-box;
}
.tf-btn-indicators svg,
#btn-grid-select svg,
#btn-simulator svg,
#btn-top-assets svg { display: inline-block; flex-shrink: 0; }

.grid-toggle-tf { display: inline-flex; align-items: center; align-self: center; }
.grid-toggle-tf .grid-selector { position: fixed; top: auto; left: auto; right: auto; }

.ema-pop-gear {
  background: none;
  border: 1px solid #2a2d35;
  color: #787b86;
  border-radius: 3px;
  padding: 1px 4px;
  cursor: pointer;
  font-size: 11px;
  line-height: 1.4;
  margin-right: 2px;
  transition: background 0.15s, color 0.15s;
}
.ema-pop-gear:hover { background: #2a2d35; color: #d1d4dc; }
