body, html {
  margin: 0; padding: 0;
  width: 100%;
  min-height: 300vh; /* Минимальная высота в 3 раза больше viewport */
  background-color: #000000;
  color: white;
  font-family: Arial, sans-serif;
  overflow-x: hidden; /* Запрещаем горизонтальный скролл на десктопе */
  overflow-y: scroll; /* Разрешаем вертикальный скролл, но спрячем его визуально */
  touch-action: pan-y pinch-zoom; /* Разрешаем вертикальную прокрутку и зум на десктопе */
}

/* Временная защита от выделения текста (используется при авто-переходе в fullscreen) */
html.fullscreen-no-select,
html.fullscreen-no-select * {
  user-select: none !important;
  -webkit-user-select: none !important;
  -ms-user-select: none !important;
}

/* Разрешаем горизонтальную прокрутку на мобильных устройствах */
@media screen and (max-width: 1024px) {
  body, html {
    overflow-x: auto; /* Разрешаем горизонтальный скролл на мобильных */
    touch-action: pan-x pan-y pinch-zoom; /* Разрешаем горизонтальную и вертикальную прокрутку и зум */
  }
}

/* Скрываем полосу прокрутки в современных браузерах */
body::-webkit-scrollbar {
  display: none; /* Для Chrome, Safari, Edge */
}
body {
  -ms-overflow-style: none;  /* Для Internet Explorer и Edge */
  scrollbar-width: none;     /* Для Firefox */
}

/* === Window drag/resize glow standard (shared) ===
   1px hard contour via border + soft layered aura via box-shadow.
   Timings: 300ms in (active), 1000ms out (base). */
:root {
  --window-glow-color: #00ffaa;
  --window-glow-edge: rgba(0, 255, 170, 0.75);
  --window-glow-soft-1: rgba(0, 255, 170, 0.30);
  --window-glow-soft-2: rgba(0, 255, 170, 0.16);
  --window-glow-soft-3: rgba(0, 255, 170, 0.10);
  --window-glow-lift: rgba(0, 0, 0, 0.5);
}

/* === Button feedback (palette apply/reset) === */
@keyframes btnActionFeedbackGlow {
  0% { transform: scale(1); filter: brightness(1); box-shadow: none; }
  35% { transform: scale(1.03); filter: brightness(1.15); box-shadow: 0 0 0 1px rgba(0,255,170,0.55), 0 0 14px rgba(0,255,170,0.35); }
  100% { transform: scale(1); filter: brightness(1); box-shadow: none; }
}
@keyframes btnActionFeedbackGlowRed {
  0% { transform: scale(1); filter: brightness(1); box-shadow: none; }
  35% { transform: scale(1.03); filter: brightness(1.1); box-shadow: 0 0 0 1px rgba(255,68,102,0.6), 0 0 14px rgba(255,68,102,0.35); }
  100% { transform: scale(1); filter: brightness(1); box-shadow: none; }
}
.btn-action-feedback {
  animation: btnActionFeedbackGlow 260ms ease-out;
}
.btn-action-feedback--danger {
  animation: btnActionFeedbackGlowRed 260ms ease-out;
}

/* === Palette buttons hover feedback (like trading controls buttons) === */
#palette-modal #apply-color-btn,
#palette-modal #reset-colors-btn {
  position: relative;
  overflow: hidden;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#palette-modal #apply-color-btn::before,
#palette-modal #reset-colors-btn::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
  pointer-events: none;
}

#palette-modal #apply-color-btn:hover::before,
#palette-modal #reset-colors-btn:hover::before {
  width: 320px;
  height: 320px;
}

#palette-modal #apply-color-btn:hover,
#palette-modal #reset-colors-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

#palette-modal #apply-color-btn:active,
#palette-modal #reset-colors-btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Accent glow per button */
#palette-modal #apply-color-btn:hover {
  box-shadow:
    0 0 0 1px rgba(0, 255, 170, 0.35),
    0 0 14px rgba(0, 255, 170, 0.25),
    0 4px 8px rgba(0, 0, 0, 0.3);
}

#palette-modal #reset-colors-btn:hover {
  box-shadow:
    0 0 0 1px rgba(255, 68, 102, 0.35),
    0 0 14px rgba(255, 68, 102, 0.25),
    0 4px 8px rgba(0, 0, 0, 0.3);
}
.draggable {
  position: absolute;
  background: rgba(13, 17, 23, 0.85);
  border: 1px solid #333;
  border-radius: 0px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  /* Выход (затухание) — очень медленный: при снятии dragging/resizing остаёмся в базовом состоянии */
  transition: box-shadow 1000ms ease, border-color 1000ms ease, transform 1000ms ease, opacity 1000ms ease;
  z-index: 10;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  max-width: 100%;
}

/* ===== Seamless docking for draggable blocks ===== */
/* Убираем внутренние границы на стыках */
.draggable.dock-left { border-left-width: 0 !important; }
.draggable.dock-right { border-right-width: 0 !important; }
.draggable.dock-top { border-top-width: 0 !important; }
.draggable.dock-bottom { border-bottom-width: 0 !important; }

/* Если блок состыкован с другими — убираем тень, чтобы не было “шва”.
   ВАЖНО: во время интеракций (drag/resize) НЕ гасим тень, иначе пропадает подсветка. */
.draggable.docked:not(.dragging):not(.resizing) { box-shadow: none !important; }
.draggable.resizing {
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  z-index: 1000 !important; /* чтобы directional glow не перекрывался соседними блоками (особенно у шапки) */
  /* Базовые свойства ресайза (свечение задаём directional-классами) */
  /* Вход (загорание) — быстрее */
  transition: box-shadow 300ms ease, border-color 300ms ease, transform 300ms ease, opacity 300ms ease;
}

/* === Directional glow при ресайзе: светится только активная сторона/угол === */
.draggable.resizing.resizing-dir-e {
  border-right-color: var(--window-glow-color) !important;
  box-shadow:
    3px 0 18px -8px var(--window-glow-soft-1),
    6px 0 30px -14px var(--window-glow-soft-1),
    10px 0 58px -28px var(--window-glow-soft-2),
    16px 0 98px -58px var(--window-glow-soft-3),
    0 12px 30px var(--window-glow-lift);
}
.draggable.resizing.resizing-dir-w {
  border-left-color: var(--window-glow-color) !important;
  box-shadow:
    -3px 0 18px -8px var(--window-glow-soft-1),
    -6px 0 30px -14px var(--window-glow-soft-1),
    -10px 0 58px -28px var(--window-glow-soft-2),
    -16px 0 98px -58px var(--window-glow-soft-3),
    0 12px 30px var(--window-glow-lift);
}
.draggable.resizing.resizing-dir-n {
  border-top-color: var(--window-glow-color) !important;
  box-shadow:
    0 -3px 18px -8px var(--window-glow-soft-1),
    0 -6px 30px -14px var(--window-glow-soft-1),
    0 -10px 58px -28px var(--window-glow-soft-2),
    0 -16px 98px -58px var(--window-glow-soft-3),
    0 12px 30px var(--window-glow-lift);
}
.draggable.resizing.resizing-dir-s {
  border-bottom-color: var(--window-glow-color) !important;
  box-shadow:
    0 3px 18px -8px var(--window-glow-soft-1),
    0 6px 30px -14px var(--window-glow-soft-1),
    0 10px 58px -28px var(--window-glow-soft-2),
    0 16px 98px -58px var(--window-glow-soft-3),
    0 12px 30px var(--window-glow-lift);
}
.draggable.resizing.resizing-dir-ne {
  border-top-color: var(--window-glow-color) !important;
  border-right-color: var(--window-glow-color) !important;
  box-shadow:
    6px -6px 22px -10px var(--window-glow-soft-1),
    10px -10px 34px -18px var(--window-glow-soft-1),
    16px -16px 66px -34px var(--window-glow-soft-2),
    26px -26px 110px -68px var(--window-glow-soft-3),
    0 12px 30px var(--window-glow-lift);
}
.draggable.resizing.resizing-dir-nw {
  border-top-color: var(--window-glow-color) !important;
  border-left-color: var(--window-glow-color) !important;
  box-shadow:
    -6px -6px 22px -10px var(--window-glow-soft-1),
    -10px -10px 34px -18px var(--window-glow-soft-1),
    -16px -16px 66px -34px var(--window-glow-soft-2),
    -26px -26px 110px -68px var(--window-glow-soft-3),
    0 12px 30px var(--window-glow-lift);
}
.draggable.resizing.resizing-dir-se {
  border-bottom-color: var(--window-glow-color) !important;
  border-right-color: var(--window-glow-color) !important;
  box-shadow:
    6px 6px 22px -10px var(--window-glow-soft-1),
    10px 10px 34px -18px var(--window-glow-soft-1),
    16px 16px 66px -34px var(--window-glow-soft-2),
    26px 26px 110px -68px var(--window-glow-soft-3),
    0 12px 30px var(--window-glow-lift);
}
.draggable.resizing.resizing-dir-sw {
  border-bottom-color: var(--window-glow-color) !important;
  border-left-color: var(--window-glow-color) !important;
  box-shadow:
    -6px 6px 22px -10px var(--window-glow-soft-1),
    -10px 10px 34px -18px var(--window-glow-soft-1),
    -16px 16px 66px -34px var(--window-glow-soft-2),
    -26px 26px 110px -68px var(--window-glow-soft-3),
    0 12px 30px var(--window-glow-lift);
}
.draggable-header {
  /* Единый размер шапок для всех блоков (как у "Настройки" и "Настройки графика") */
  padding: 3px 8px;
  background: rgba(30, 35, 45, 0.7);
  border-bottom: 1px solid #333;
  font-size: 11px;
  min-height: 20px;
  height: auto;
  cursor: move;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
/* НЕВИДИМЫЕ РЕСАЙЗ-ЗОНЫ */
.resize-handle {
  position: absolute;
  background: transparent !important;
  border: none !important;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}
/* ВАЖНО: Хэндлы должны быть ВНУТРИ блока, иначе они раздувают scrollWidth на ~5px
   и на десктопе появляется «пустое место справа»/сдвиг при ресайзе. */
.handle-n { top: 0; left: 0; width: 100%; height: 10px; cursor: n-resize; }
.handle-e { top: 0; right: 0; width: 10px; height: 100%; cursor: e-resize; }
.handle-s { bottom: 0; left: 0; width: 100%; height: 10px; cursor: s-resize; }
.handle-w { top: 0; left: 0; width: 10px; height: 100%; cursor: w-resize; }
.handle-ne { top: 0; right: 0; width: 15px; height: 15px; cursor: ne-resize; }
.handle-nw { top: 0; left: 0; width: 15px; height: 15px; cursor: nw-resize; }
.handle-se { bottom: 0; right: 0; width: 15px; height: 15px; cursor: se-resize; }
.handle-sw { bottom: 0; left: 0; width: 15px; height: 15px; cursor: sw-resize; }

#chart-container {
  width: 1270.78px;
  height: 500px;
  position: absolute;
  max-width: 100%;
  box-sizing: border-box;
}

/* График: на мобильных/WebView отдаём управление жестами JS (пан/зум внутри canvas),
   чтобы WebView/страница не перехватывали горизонтальный drag и не отправляли touchcancel. */
#chart {
  touch-action: none;
}

/* Кнопка прокрутки к последней свече */
.chart-scroll-to-latest-btn {
  position: absolute;
  bottom: 50px; /* Подняли выше, чтобы не загораживать нижнюю полосу с временем */
  right: 75px; /* Смещаем левее столбца с ценами (MARGIN.right = 70px) */
  width: 32px;
  height: 32px;
  background: rgba(30, 35, 45, 0.9);
  border: 1px solid #555;
  border-radius: 50%;
  color: #ccc;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.chart-scroll-to-latest-btn:hover {
  background: rgba(40, 45, 55, 0.95);
  border-color: #00ff88;
  color: #00ff88;
  transform: scale(1.1);
}

.chart-scroll-to-latest-btn:active {
  transform: scale(0.95);
}

.chart-scroll-to-latest-btn i {
  font-size: 14px;
}

.chart-scroll-to-latest-btn.visible {
  display: flex;
}

canvas {
  display: block;
  flex: 1 1 auto;
  width: 100%;
  max-width: 100%;
  height: calc(100% - 60px);
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  position: relative;
  min-width: 0; /* Важно для flex элементов в Яндекс браузере */
}

#tooltip {
  position: absolute; background: rgba(10,10,10,0.9); border: 1px solid #555;
  border-radius: 4px; padding: 8px; font-size: 12px; pointer-events: none;
  display: none; color: white;
  z-index: 100; /* Важно для отображения поверх блоков */
}
#loading {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  color: #00ffaa; z-index: 5; font-family: monospace;
}

/* Таблицы внутри draggable-блоков */
.draggable table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  background: transparent;
  color: white;
}
.draggable th, .draggable td {
  padding: 8px 6px;
  text-align: left;
  border-bottom: 1px solid #222;
}

/* Стили для перетаскивания колонок */
.draggable th[data-column][draggable="true"] {
  cursor: move;
  user-select: none;
  position: relative;
  transition: background-color 0.2s ease;
}

.draggable th[data-column][draggable="true"]:hover {
  background-color: rgba(50, 55, 70, 0.5);
}

/* Стили для сортируемых заголовков в таблице позиций */
#positions-table th[data-column] {
  cursor: pointer;
  user-select: none;
  position: relative;
  transition: background-color 0.2s ease;
}

#positions-table th[data-column]:hover:not([data-column="number"]):not([data-column="actions"]) {
  background-color: rgba(50, 55, 70, 0.5);
}

#positions-table th[data-column="number"],
#positions-table th[data-column="actions"] {
  cursor: default;
}

#positions-table th[data-column="number"]:hover,
#positions-table th[data-column="actions"]:hover {
  background-color: transparent;
}

/* Индикатор сортировки */
.sort-indicator {
  display: inline-block;
  margin-left: 4px;
  font-size: 0.8em;
  color: #00ff88;
  font-weight: normal;
}

.draggable th[data-column].dragging {
  opacity: 0.5;
  cursor: grabbing;
}

.draggable th[data-column]:not(.dragging):hover {
  background-color: rgba(0, 255, 136, 0.1);
}
.draggable tbody tr:hover {
  background: rgba(50, 55, 70, 0.5);
}

.auto-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #bbbbbb;
}

.auto-badge--active {
  background: rgba(0, 255, 170, 0.18);
  border-color: rgba(0, 255, 170, 0.4);
  color: #00ffaa;
  cursor: help;
  transition: all 0.2s ease;
}

.auto-badge--active:hover {
  background: rgba(0, 255, 170, 0.25);
  border-color: rgba(0, 255, 170, 0.6);
  transform: scale(1.05);
}

.auto-badge--inactive {
  background: rgba(255, 68, 102, 0.15);
  border-color: rgba(255, 68, 102, 0.35);
  color: #ff6f85;
}

#symbols-table {
  width: 260px;
  height: 477px;
  top: 568.8px;
  left: 1270.38px;
  display: flex;
  flex-direction: column;
}

#chart-settings-toolbar {
  width: 775px;
  height: 67.4px;
  top: 0px;
  left: 0px;
}

#settings-toolbar {
  width: 494.175px;
  height: 65.6px;
  top: 0px;
  left: 776.6px;
}
#search-box {
  width: 100%;
  padding: 6px;
  background: #161b22;
  border: none;
  color: white;
  font-size: 13px;
  border-bottom: 1px solid #333;
  box-sizing: border-box;
}
#symbols-table-content {
  flex: 1;
  overflow: auto;
}
#symbols-table tr:hover {
  background: rgba(50, 55, 70, 0.5);
}
#symbols-table tr.active {
  background: rgba(0, 100, 200, 0.3);
}

/* НОВЫЕ БЛОКИ */
/* Заставляем контейнер баланса вести себя как inline-flex элемент */
#balance-container {
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0;
  align-items: flex-start; /* или center, если нужно */
}
#balance-content {
  padding: 10px;
  flex: 1;
  overflow: auto;
  font-size: 14px;
  font-weight: bold;
  color: #00ffaa; /* Зелёный цвет для баланса */
}

#positions-container {
  width: 500px;
  height: 300px;
  top: 120px;
  right: 10px;
  display: flex;
  flex-direction: column;
}
#positions-content {
  flex: 1;
  overflow: auto;
}

#trades-container {
  width: 500px;
  height: 300px;
  top: 430px;
  right: 10px;
  display: flex;
  flex-direction: column;
}
#trades-content {
  flex: 1;
  overflow: auto;
}

.price-line {
  stroke: #ffcc00;
  stroke-width: 1;
  stroke-dasharray: 4,4;
}
.price-label {
  fill: #ffcc00;
  font-size: 12px;
  font-family: Arial, sans-serif;
}

/* =========================================блок туллбар с настройками */
/* Универсальный стиль для кнопок в тулбаре настроек */
#settings-toolbar {
  /* как в "Настройки графика": ничего не обрезаем, вкладки стыкуются с шапкой */
  overflow: visible;
  /* меньше заходим под полупрозрачную шапку, чтобы ничего "не торчало" */
  --cs-tab-raise: 2px;
}

#settings-toolbar > .draggable-header {
  position: relative;
  z-index: 5;
}

/* Tab look как в "Настройки графика" */
#settings-toolbar #settings-content > button,
#settings-toolbar #settings-content button {
  background: var(--cs-tab-bg) !important;
  color: #aaa !important;
  border: 1px solid var(--cs-tab-border) !important;
  padding: 4px 8px;
  font-size: 12px;
  cursor: pointer;
  /* без скругления сверху */
  border-radius: 0 0 4px 4px;
  white-space: nowrap;
  margin: 0;
  box-sizing: border-box;
  position: relative;
  transform: translateY(calc(-1 * var(--cs-tab-raise)));
  z-index: 1;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.18);
  transition: all 0.2s ease;
  min-height: 28px;
  vertical-align: middle;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

#settings-toolbar #settings-content button::after {
  content: '';
  position: absolute;
  left: 1px;
  right: 1px;
  bottom: -1px;
  height: 3px;
  border-bottom-left-radius: 4px;
  border-bottom-right-radius: 4px;
  background: rgba(0, 0, 0, 0.28);
  opacity: 0.75;
  pointer-events: none;
}

#settings-toolbar #settings-content button:hover {
  background: var(--cs-tab-bg-hover) !important;
  border-color: var(--cs-tab-border-hover) !important;
  transform: translateY(calc(-1 * (var(--cs-tab-raise) + 1px)));
  z-index: 10;
}

/* “нажатая клавиша” при клике */
#settings-toolbar #settings-content button:active {
  transform: translateY(calc(-1 * var(--cs-tab-raise) + 2px));
  z-index: 5;
  box-shadow:
    inset 0 2px 0 rgba(0, 0, 0, 0.35),
    inset 0 -1px 0 rgba(255, 255, 255, 0.06),
    0 0 8px rgba(0, 255, 170, 0.25);
}

/* Увеличиваем основные кнопки (тема/палитра/фуллскрин) до размера кнопок уведомлений/настроек */
#settings-toolbar #theme-toggle,
#settings-toolbar #palette-btn,
#settings-toolbar #fullscreen-toggle {
  padding: 6px 8px !important;
  font-size: 14px !important;
  min-width: 32px;
}

/* Колокольчик и “настройки” должны вести себя как остальные вкладки (без провала вниз) */
#settings-content {
  padding: 2px 6px 4px 6px; /* 2px сверху, 4px снизу */
  display: flex;
  flex-direction: row;
  gap: 6px; /* Расстояние МЕЖДУ кнопками */
  align-items: center;
  justify-content: space-between;
}

/* Вертикальное сжатие для settings-toolbar */
#settings-toolbar.compact #settings-content {
  padding: 1px 4px 2px 4px;
  gap: 4px;
}

#settings-toolbar.compact button {
  padding: 3px 6px;
  font-size: 10px;
}

#settings-toolbar.very-compact #settings-content {
  padding: 1px 3px 1px 3px;
  gap: 3px;
}

#settings-toolbar.very-compact button {
  padding: 2px 4px;
  font-size: 9px;
}

#settings-toolbar.minimal #settings-content {
  padding: 0px 2px 0px 2px;
  gap: 2px;
}

#settings-toolbar.minimal button {
  padding: 2px 3px;
  font-size: 8px;
}
#theme-toggle, #palette-btn, #fullscreen-toggle, #login-btn, #logs-btn, #fetch-data-btn {
  background: var(--cs-tab-bg);
  color: #aaa;
  border: 1px solid var(--cs-tab-border);
  padding: 4px 8px;
  font-size: 11px;
  cursor: pointer;
  border-radius: 0 0 4px 4px;
  white-space: nowrap;
}
#theme-toggle:hover, #palette-btn:hover, #fullscreen-toggle:hover, #login-btn:hover, #logs-btn:hover, #fetch-data-btn:hover {
  background: var(--cs-tab-bg-hover);
}

.local-env-flag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  color: #bbb;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid #444;
  border-radius: 4px;
  padding: 2px 6px;
  pointer-events: auto;
}

.local-env-flag input[type="checkbox"] {
  margin: 0;
  cursor: pointer;
  accent-color: #00ff88;
}

.local-env-flag span {
  white-space: nowrap;
}

/* Объединенный блок для позиций и сделок с вкладками */
#positions-trades-container {
  width: 1270.38px;
  height: 544px;
  top: 568.8px;
  left: 0px;
  display: flex;
  flex-direction: column;
}

/* Стили для вкладок */
.tabs-container {
  display: flex;
  background: rgba(30, 35, 45, 0.7);
  border-bottom: 1px solid #333;
}

/* Светлая тема для контейнера вкладок */
body:not(.dark-theme) .tabs-container {
  background: rgba(240, 240, 240, 0.9);
  border-bottom: 1px solid #ddd;
}
.tab-button {
  flex: 1;
  padding: 8px 12px;
  background: transparent;
  border: none;
  color: #888;
  cursor: pointer;
  font-size: 12px;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
}
.tab-button:hover {
  background: rgba(50, 55, 70, 0.3);
  color: #aaa;
}
.tab-button.active {
  color: #00ffaa;
  border-bottom-color: #00ffaa;
  background: rgba(0, 255, 170, 0.1);
}
.tab-content {
  flex: 1;
  overflow: auto;
  display: none;
}
.tab-content.active {
  display: block;
}

/* === УНИВЕРСАЛЬНЫЙ СТИЛЬ ДЛЯ КНОПОК В НАСТРОЙКАХ ГРАФИКА === */
/* Заменяет старые стили .tf-btn и .chart-control-btn */
/* ======================= Chart settings: tab-style controls ======================= */
#chart-settings-toolbar {
  /* Нужно, чтобы «вылезающие» вкладки были видимы */
  overflow: visible;
}

/* Шапку НЕ меняем по виду/разметке, но гарантируем что она поверх вкладок,
   чтобы вкладки не мешали drag-области шапки. */
#chart-settings-toolbar > .draggable-header,
#settings-toolbar > .draggable-header {
  position: relative;
  z-index: 5;
}

:root {
  --cs-tab-raise: 7px;           /* насколько вкладки «вылазят» */
  --cs-tab-radius: 6px;
  --cs-tab-border: rgba(255, 255, 255, 0.14);
  --cs-tab-border-hover: rgba(255, 255, 255, 0.26);
  --cs-tab-bg: rgba(34, 34, 34, 0.92);
  --cs-tab-bg-hover: rgba(51, 51, 51, 0.92);
  --cs-tab-bg-active: rgba(20, 26, 32, 0.55);
  --cs-tab-divider: rgba(255, 255, 255, 0.16);
  --cs-tf-overlap: 10px;         /* перекрытие таймфреймов (широкие блоки) */
}

#chart-settings-toolbar.compact { --cs-tab-raise: 6px; --cs-tf-overlap: 8px; }
#chart-settings-toolbar.very-compact { --cs-tab-raise: 5px; --cs-tf-overlap: 7px; }
#chart-settings-toolbar.minimal { --cs-tab-raise: 4px; --cs-tf-overlap: 6px; }
.chart-control-btn,
.tf-timeframe-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  /* tab look */
  background: var(--cs-tab-bg);
  border: 1px solid var(--cs-tab-border);
  color: #aaa;
  font-size: 11px;
  cursor: pointer;
  /* без скругления сверху */
  border-radius: 0 0 4px 4px;
  padding: 4px 8px;
  white-space: nowrap;
  transition: all 0.2s ease;
  margin: 0;
  min-width: 36px;
  height: 28px;
  box-sizing: border-box;
  position: relative;
  /* «вылазим» вверх из зоны контента, визуально сцепляясь с шапкой */
  transform: translateY(calc(-1 * var(--cs-tab-raise)));
  z-index: 1;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.18);
}

/* Небольшая «полка» снизу — создаёт ощущение, что вкладка вылезает из шапки */
.chart-control-btn::after,
.tf-timeframe-btn::after {
  content: '';
  position: absolute;
  left: 1px;
  right: 1px;
  bottom: -1px;
  height: 3px;
  border-bottom-left-radius: 4px;
  border-bottom-right-radius: 4px;
  background: rgba(0, 0, 0, 0.28);
  opacity: 0.75;
  pointer-events: none;
}

.chart-control-btn:hover,
.tf-timeframe-btn:hover {
  background: var(--cs-tab-bg-hover);
  border-color: var(--cs-tab-border-hover);
  transform: translateY(calc(-1 * (var(--cs-tab-raise) + 1px)));
  z-index: 10;
}

/* Активное состояние — неоновое свечение */
.chart-control-btn.active,
.tf-timeframe-btn.active {
  background: var(--cs-tab-bg-active);
  color: #00ffaa;
  border-color: #00ffaa;
  /* “нажатая клавиша”: меньше внешней тени, чуть больше inset */
  box-shadow:
    inset 0 2px 0 rgba(0, 0, 0, 0.35),
    inset 0 -1px 0 rgba(255, 255, 255, 0.06),
    0 0 8px rgba(0, 255, 170, 0.35);
  font-weight: bold;
  /* вместо “вздергивания” — утопляем на пару пикселей ниже остальных */
  transform: translateY(calc(-1 * var(--cs-tab-raise) + 2px));
  z-index: 5;
}

/* Иконки остаются иконками, но форма теперь тоже вкладка (как просили: все кнопки = вкладки) */
#heikin-ashi-btn,
#indicators-btn,
#stats-tables-btn,
#trades-history-btn,
#compress-chart-btn {
  min-width: 32px;
  padding: 0 8px;
  font-size: 13px;
}
/* === КОНЕЦ УНИВЕРСАЛЬНОГО СТИЛЯ === */

/* =============================================================================
 * Strategy Finder: Toggle switches (tt-switch)
 * ============================================================================= */
.tt-switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
  color: #ccc;
  font-size: 11px;
}

.tt-switch input {
  display: none;
}

.tt-switch .tt-slider {
  width: 34px;
  height: 18px;
  background: #333;
  border: 1px solid #555;
  border-radius: 999px;
  position: relative;
  transition: background 0.15s ease, border-color 0.15s ease;
  flex: 0 0 auto;
}

.tt-switch .tt-slider::after {
  content: "";
  position: absolute;
  top: 1px;
  left: 1px;
  width: 14px;
  height: 14px;
  border-radius: 999px;
  background: #aaa;
  transition: transform 0.15s ease, background 0.15s ease;
}

.tt-switch input:checked + .tt-slider {
  background: rgba(0, 255, 136, 0.18);
  border-color: rgba(0, 255, 136, 0.6);
}

.tt-switch input:checked + .tt-slider::after {
  transform: translateX(16px);
  background: #00ff88;
}

.tt-switch .tt-switch-text {
  color: #ccc;
  white-space: nowrap;
}

/* Контейнер для кнопок таймфреймов и управления */
#chart-settings-content {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  padding: 4px 6px;
  /* Скрытие скроллбара с сохранением прокрутки колесиком */
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE и Edge */
}

/* Вертикальное сжатие для chart-settings-toolbar */
#chart-settings-toolbar.compact #chart-settings-content {
  padding: 3px 5px;
  gap: 6px;
}

#chart-settings-toolbar.compact .chart-control-btn,
#chart-settings-toolbar.compact .tf-timeframe-btn {
  padding: 3px 6px;
  font-size: 10px;
  min-width: 30px;
  height: 24px;
}

#chart-settings-toolbar.very-compact #chart-settings-content {
  padding: 2px 4px;
  gap: 4px;
}

#chart-settings-toolbar.very-compact .chart-control-btn,
#chart-settings-toolbar.very-compact .tf-timeframe-btn {
  padding: 2px 4px;
  font-size: 9px;
  min-width: 26px;
  height: 20px;
}

#chart-settings-toolbar.minimal #chart-settings-content {
  padding: 1px 3px;
  gap: 3px;
}

#chart-settings-toolbar.minimal .chart-control-btn,
#chart-settings-toolbar.minimal .tf-timeframe-btn {
  padding: 2px 3px;
  font-size: 8px;
  min-width: 24px;
  height: 18px;
}

#chart-settings-content::-webkit-scrollbar {
  display: none; /* Скрываем скроллбар в WebKit браузерах (Chrome, Safari, Edge) */
}

#timeframe-toolbar-content {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  max-height: none; /* Убираем ограничение для видимости всех элементов */
  overflow-y: visible; /* Делаем весь контент видимым */
  padding: 2px 0;
  /* Скрытие скроллбара с сохранением прокрутки колесиком */
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE и Edge */
  /* Убираем темную подложку у таймфреймов */
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 2px 0;
}

#timeframe-toolbar-content::-webkit-scrollbar {
  display: none; /* Скрываем скроллбар в WebKit браузерах (Chrome, Safari, Edge) */
}

#chart-controls {
  display: flex;
  gap: 4px;
  align-self: center;
  flex-shrink: 0;
  position: relative;
  padding-left: 10px;
  margin-left: 2px;
}

/* Вертикальный разделитель между группами (таймфреймы | остальные) */
#chart-controls::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 1px;
  height: 26px;
  background: var(--cs-tab-divider);
  opacity: 0.85;
  border-radius: 1px;
  pointer-events: none;
}

/* Светлая тема: у таймфреймов тоже без подложки */
body:not(.dark-theme) #timeframe-toolbar-content {
  background: transparent;
  border: none;
}
body:not(.dark-theme) #chart-controls::before {
  background: rgba(0, 0, 0, 0.16);
}

/* Стили для темной темы */
body.dark-theme {
  background-color: #000000;
  color: white;
}

body.dark-theme .draggable {
  background: rgba(13, 17, 23, 0.85);
  border: 1px solid #333;
}

body.dark-theme .draggable-header {
  background: rgba(30, 35, 45, 0.7);
  border-bottom: 1px solid #333;
  color: white;
}

body.dark-theme .draggable table {
  color: white;
  background: transparent;
}

body.dark-theme .draggable th, 
body.dark-theme .draggable td {
  border-bottom: 1px solid #222;
  color: white;
}

body.dark-theme .draggable tbody tr:hover {
  background: rgba(50, 55, 70, 0.5);
}

body.dark-theme #search-box {
  background: #161b22;
  border: none;
  color: white;
}

body.dark-theme #balance-content {
  color: #00ffaa;
}

body.dark-theme #theme-toggle,
body.dark-theme #palette-btn,
body.dark-theme #fullscreen-toggle,
body.dark-theme #login-btn,
body.dark-theme #logs-btn,
body.dark-theme #fetch-data-btn {
  background: var(--cs-tab-bg);
  color: #aaa;
  border: 1px solid var(--cs-tab-border);
}

body.dark-theme #theme-toggle:hover,
body.dark-theme #palette-btn:hover,
body.dark-theme #fullscreen-toggle:hover,
body.dark-theme #login-btn:hover,
body.dark-theme #logs-btn:hover,
body.dark-theme #fetch-data-btn:hover {
  background: var(--cs-tab-bg-hover);
}

body.dark-theme .tab-button {
  color: #888;
}

body.dark-theme .tab-button:hover {
  background: rgba(50, 55, 70, 0.3);
  color: #aaa;
}

body.dark-theme .tab-button.active {
  color: #00ffaa;
  border-bottom-color: #00ffaa;
  background: rgba(0, 255, 170, 0.1);
}

/* Стили для светлой темы */
body:not(.dark-theme) {
  background-color: #f5f5f5;
  color: black;
}

body:not(.dark-theme) .draggable {
  background: rgba(240, 240, 240, 0.9);
  border-color: #ccc;
}

body:not(.dark-theme) .draggable-header {
  background: rgba(200, 200, 200, 0.7);
  border-color: #ccc;
  color: black;
}

body:not(.dark-theme) .draggable table {
  color: black;
  background: transparent;
}

body:not(.dark-theme) .draggable th, 
body:not(.dark-theme) .draggable td {
  border-bottom: 1px solid #ddd;
  color: black;
}

body:not(.dark-theme) .draggable tbody tr:hover {
  background: rgba(200, 200, 200, 0.5);
}

body:not(.dark-theme) #search-box {
  background: white;
  border: 1px solid #ddd;
  color: black;
}

body:not(.dark-theme) #balance-content {
  color: #006600;
}

body:not(.dark-theme) #theme-toggle,
body:not(.dark-theme) #palette-btn,
body:not(.dark-theme) #fullscreen-toggle,
body:not(.dark-theme) #login-btn,
body:not(.dark-theme) #logs-btn,
body:not(.dark-theme) #fetch-data-btn {
  background: #f0f0f0;
  color: #333;
  border: 1px solid rgba(0, 0, 0, 0.14);
}

body:not(.dark-theme) #theme-toggle:hover,
body:not(.dark-theme) #palette-btn:hover,
body:not(.dark-theme) #fullscreen-toggle:hover,
body:not(.dark-theme) #login-btn:hover,
body:not(.dark-theme) #logs-btn:hover,
body:not(.dark-theme) #fetch-data-btn:hover {
  background: #e0e0e0;
}

/* Светлая тема: таб-стиль для всех кнопок в блоке "Настройки" */
body:not(.dark-theme) #settings-toolbar #settings-content button {
  background: #f0f0f0 !important;
  color: #333 !important;
  border-color: rgba(0, 0, 0, 0.14) !important;
}
body:not(.dark-theme) #settings-toolbar #settings-content button:hover {
  background: #e0e0e0 !important;
  border-color: rgba(0, 0, 0, 0.22) !important;
}

/* Админ-панель */
#admin-panel {
  width: 320px;
  height: 260px;
  /* Позиции top/left управляются JavaScript - не задавать здесь */
  display: flex;
  flex-direction: column;
}

.admin-panel-content {
  padding: 8px 10px;
  font-size: 12px;
  color: #ccc;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.admin-panel-buttons {
  display: flex;
  gap: 8px;
  margin-bottom: 4px;
}

.admin-panel-buttons #logs-btn,
.admin-panel-buttons #admin-refresh-timeouts-btn {
  flex: 1;
}

.admin-timeouts-container {
  width: 100%;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid #333;
  border-radius: 4px;
  padding: 6px 8px;
  font-family: 'Courier New', monospace;
  font-size: 11px;
  box-sizing: border-box;
}

.admin-timeouts-container h4 {
  margin: 4px 0;
  font-size: 12px;
  color: #00ff88;
}

.admin-timeouts-container .timeout-row {
  display: flex;
  justify-content: space-between;
  margin: 2px 0;
  padding: 2px 4px;
  border-radius: 3px;
  transition: background-color 0.15s ease, box-shadow 0.15s ease;
  cursor: default;
}

.admin-timeouts-container .timeout-row:hover {
  background: rgba(0, 255, 136, 0.08);
  box-shadow: inset 0 0 0 1px rgba(0, 255, 136, 0.15);
}

body:not(.dark-theme) .admin-timeouts-container .timeout-row:hover {
  background: rgba(0, 150, 100, 0.10);
  box-shadow: inset 0 0 0 1px rgba(0, 150, 100, 0.25);
}

.admin-timeouts-container .timeout-label {
  color: #888;
  white-space: nowrap;
  margin-right: 8px;
}

.admin-timeouts-container .timeout-value {
  color: #eee;
  white-space: nowrap;
  text-align: right;
}

.admin-timeouts-container .timeout-value .latency {
  color: #00aaff;
}

.admin-timeouts-container .timeout-value .timeout {
  color: #ffaa00;
}

/* Стили скроллбара для админ-панели (темная тема) */
.admin-timeouts-container::-webkit-scrollbar {
  width: 10px; /* Ширина полосы прокрутки */
}

.admin-timeouts-container::-webkit-scrollbar-track {
  background: #0a0e17; /* Цвет "дорожки" */
  border-radius: 5px;
}

.admin-timeouts-container::-webkit-scrollbar-thumb {
  background: #333; /* Цвет самой полосы прокрутки */
  border-radius: 5px;
}

.admin-timeouts-container::-webkit-scrollbar-thumb:hover {
  background: #555; /* Цвет при наведении */
}

/* Для Firefox (темная тема) */
.admin-timeouts-container {
  scrollbar-width: thin; /* 'auto' | 'thin' | 'none' */
  scrollbar-color: #333 #0a0e17; /* thumb и track color */
}

/* Стили скроллбара для админ-панели (светлая тема) */
body:not(.dark-theme) .admin-timeouts-container::-webkit-scrollbar {
  width: 10px;
}

body:not(.dark-theme) .admin-timeouts-container::-webkit-scrollbar-track {
  background: #f5f5f5;
  border-radius: 5px;
}

body:not(.dark-theme) .admin-timeouts-container::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 5px;
}

body:not(.dark-theme) .admin-timeouts-container::-webkit-scrollbar-thumb:hover {
  background: #aaa;
}

/* Для Firefox (светлая тема) */
body:not(.dark-theme) .admin-timeouts-container {
  scrollbar-width: thin;
  scrollbar-color: #ccc #f5f5f5; /* thumb и track color */
}

/* WS подписки (вкладка Bybit в админ-панели) */
.admin-ws-subs-container {
  width: 100%;
  max-height: 440px;
  overflow-y: auto;
  overflow-x: hidden;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid #333;
  border-radius: 4px;
  padding: 8px 8px;
  font-family: 'Courier New', monospace;
  font-size: 11px;
  box-sizing: border-box;
  color: #ccc;
  white-space: pre-wrap;
}

/* Скроллбар (темная тема) */
.admin-ws-subs-container::-webkit-scrollbar {
  width: 10px;
}
.admin-ws-subs-container::-webkit-scrollbar-track {
  background: #0a0e17;
  border-radius: 5px;
}
.admin-ws-subs-container::-webkit-scrollbar-thumb {
  background: #333;
  border-radius: 5px;
}
.admin-ws-subs-container::-webkit-scrollbar-thumb:hover {
  background: #555;
}
/* Для Firefox (темная тема) */
.admin-ws-subs-container {
  scrollbar-width: thin;
  scrollbar-color: #333 #0a0e17;
}

/* Скроллбар (светлая тема) */
body:not(.dark-theme) .admin-ws-subs-container::-webkit-scrollbar {
  width: 10px;
}
body:not(.dark-theme) .admin-ws-subs-container::-webkit-scrollbar-track {
  background: #f5f5f5;
  border-radius: 5px;
}
body:not(.dark-theme) .admin-ws-subs-container::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 5px;
}
body:not(.dark-theme) .admin-ws-subs-container::-webkit-scrollbar-thumb:hover {
  background: #aaa;
}
/* Для Firefox (светлая тема) */
body:not(.dark-theme) .admin-ws-subs-container {
  scrollbar-width: thin;
  scrollbar-color: #ccc #f5f5f5;
}

body:not(.dark-theme) .tab-button {
  color: #000000;
}

body:not(.dark-theme) .tab-button:hover {
  background: rgba(200, 200, 200, 0.3);
  color: #000000;
}

body:not(.dark-theme) .tab-button.active {
  color: #000000;
  border-bottom-color: #00ffaa;
  background: rgba(0, 255, 170, 0.1);
}

/* Стили для кнопок таймфреймов и управления графиком в светлой теме */
body:not(.dark-theme) .chart-control-btn,
body:not(.dark-theme) .tf-timeframe-btn {
  background: #f0f0f0;
  border: 1px solid #ccc;
  color: #333;
}

body:not(.dark-theme) .chart-control-btn:hover,
body:not(.dark-theme) .tf-timeframe-btn:hover {
  background: #e0e0e0;
  border-color: #999;
}

body:not(.dark-theme) .chart-control-btn.active,
body:not(.dark-theme) .tf-timeframe-btn.active {
  background: transparent;
  color: #000000;
  border-color: #00ffaa;
  box-shadow: 0 0 8px rgba(0, 255, 170, 0.5), 0 0 16px rgba(0, 255, 170, 0.3);
  font-weight: bold;
}

/* Стили для надписей в светлой теме */
body:not(.dark-theme) label[for="trade-amount"] {
  color: #000000 !important;
}

/* Стили для кликабельных лейблов USDT/% */
#stop-loss-unit, #take-profit-unit {
  transition: color 0.2s ease;
}

#stop-loss-unit:hover, #take-profit-unit:hover {
  color: #00ffaa !important;
}

body:not(.dark-theme) #stop-loss-unit:hover,
body:not(.dark-theme) #take-profit-unit:hover {
  color: #009966 !important;
}

/* Стили для поля ввода суммы сделки в светлой теме */
body:not(.dark-theme) #trade-amount {
  background: #e0e0e0 !important;
  border: 1px solid #ccc !important;
  color: #000000 !important;
}

/* Стили для полей Stop Loss и Take Profit в светлой теме */
body:not(.dark-theme) #stop-loss-input,
body:not(.dark-theme) #take-profit-input {
  background: #e0e0e0 !important;
  border: 1px solid #ccc !important;
  color: #000000 !important;
}

/* Стили для кнопок переключения режима */
#usdt-mode-btn, #percent-mode-btn {
  transition: all 0.3s ease;
}

#usdt-mode-btn.active {
  background: #00ff88 !important;
  color: #000 !important;
}

#percent-mode-btn.active {
  background: #00ff88 !important;
  color: #000 !important;
}

body:not(.dark-theme) #usdt-mode-btn:not(.active),
body:not(.dark-theme) #percent-mode-btn:not(.active) {
  background: #e0e0e0 !important;
  color: #666 !important;
  border: 1px solid #ccc !important;
}

/* Стили для строки состояния под графиком в светлой теме */
body:not(.dark-theme) #chart-footer {
  color: #000000 !important;
  border-top: 1px solid #ddd !important;
}

body:not(.dark-theme) #stats-bar {
  color: #000000 !important;
}

/* Стили для выбора плеча */
#leverage-select {
  font-size: 14px;
}

body.dark-theme #leverage-select {
  background: #161b22;
  border: 1px solid #444;
  color: white;
}

body.dark-theme #leverage-select:hover {
  border-color: #666;
}

body.dark-theme #leverage-select:focus {
  outline: none;
  border-color: #00ffaa;
  box-shadow: 0 0 5px rgba(0, 255, 170, 0.3);
}

body:not(.dark-theme) #leverage-select {
  background: #e0e0e0;
  border: 1px solid #ccc;
  color: #000000;
}

body:not(.dark-theme) #leverage-select:hover {
  border-color: #999;
}

body:not(.dark-theme) #leverage-select:focus {
  outline: none;
  border-color: #00ffaa;
  box-shadow: 0 0 5px rgba(0, 255, 170, 0.3);
}

/* Стили для модального окна в светлой теме */
body:not(.dark-theme) .modal-content {
  background-color: #ffffff;
  border: 1px solid #ccc;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

body:not(.dark-theme) .modal-header {
  background: rgba(240, 240, 240, 0.9);
  border-bottom: 1px solid #ccc;
}

body:not(.dark-theme) .modal-header h3 {
  color: #000000;
}

body:not(.dark-theme) .close-modal {
  color: #666;
}

body:not(.dark-theme) .close-modal:hover {
  color: #000000;
}

body:not(.dark-theme) .modal-body {
  background-color: #ffffff;
  color: #000000;
}

/* Стили для элементов внутри модального окна в светлой теме */
body:not(.dark-theme) .indicator-item {
  border-bottom: 1px solid #ddd;
}

body:not(.dark-theme) .indicator-name {
  color: #000000;
}

body:not(.dark-theme) .added-indicator-item {
  border-bottom: 1px solid #ddd;
}

body:not(.dark-theme) .saved-indicator-item {
  border-bottom: 1px solid #ddd;
}

body:not(.dark-theme) .saved-indicator-item .indicator-info,
body:not(.dark-theme) .indicator-info {
  color: #000000;
}

body:not(.dark-theme) .no-indicators-message {
  color: #666;
}

/* Стили для input и других элементов в модальном окне в светлой теме */
body:not(.dark-theme) .modal-body input[type="text"],
body:not(.dark-theme) .modal-body input[type="number"],
body:not(.dark-theme) .modal-body select {
  background-color: #ffffff;
  border: 1px solid #ccc;
  color: #000000;
}

body:not(.dark-theme) .modal-body label {
  color: #000000;
}

/* === СКРЫТЬ ВЕРТИКАЛЬНУЮ ПОЛОСУ ПРОКРУТКИ === */
html::-webkit-scrollbar,
body::-webkit-scrollbar {
  display: none;
}

html {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

body {
  -ms-overflow-style: none;
  scrollbar-width: none;
}
/* === КОНЕЦ СКРЫТИЯ ПОЛОСЫ ПРОКРУТКИ === */

/* ======================= Стили для скроллбара в блоке с монетами (тёмная тема) */
#symbols-table-content::-webkit-scrollbar {
  width: 10px; /* Ширина полосы прокрутки */
}
#symbols-table-content::-webkit-scrollbar-track {
  background: #000000; /* Цвет "дорожки" */
  border-radius: 5px;
}
#symbols-table-content::-webkit-scrollbar-thumb {
  background: #333; /* Цвет самой полосы прокрутки */
  border-radius: 5px;
}
#symbols-table-content::-webkit-scrollbar-thumb:hover {
  background: #555; /* Цвет при наведении */
}

/* Для Firefox */
#symbols-table-content {
  scrollbar-width: thin; /* 'auto' | 'thin' | 'none' */
  scrollbar-color: #333 #0a0e17; /* thumb и track color */
}
/* ======================= Стили для скроллбара в блоке торговли (тёмная тема) */
#trading-panel::-webkit-scrollbar,
#trading-controls::-webkit-scrollbar {
  width: 10px; /* Ширина полосы прокрутки */
}
#trading-panel::-webkit-scrollbar-track,
#trading-controls::-webkit-scrollbar-track {
  background: #000000; /* Цвет "дорожки" */
  border-radius: 5px;
}
#trading-panel::-webkit-scrollbar-thumb,
#trading-controls::-webkit-scrollbar-thumb {
  background: #333; /* Цвет самой полосы прокрутки */
  border-radius: 5px;
}
#trading-panel::-webkit-scrollbar-thumb:hover,
#trading-controls::-webkit-scrollbar-thumb:hover {
  background: #555; /* Цвет при наведении */
}

/* Для Firefox */
#trading-panel,
#trading-controls {
  scrollbar-width: thin; /* 'auto' | 'thin' | 'none' */
  scrollbar-color: #333 #0a0e17; /* thumb и track color */
}
/* ======================= Стили для скроллбара в блоке торговли (тёмная тема) КОНЕЦ */
/* ======================= Стили для скроллбара во вкладках "Открытые сделки" и "История сделок" (тёмная тема) */
#positions-trades-container::-webkit-scrollbar,
#positions-tab::-webkit-scrollbar,
#trades-tab::-webkit-scrollbar,
#positions-table::-webkit-scrollbar,
#trades-table::-webkit-scrollbar {
  width: 10px; /* Ширина полосы прокрутки */
  height: 10px; /* Высота для горизонтального скроллбара */
}
#positions-trades-container::-webkit-scrollbar-track,
#positions-tab::-webkit-scrollbar-track,
#trades-tab::-webkit-scrollbar-track,
#positions-table::-webkit-scrollbar-track,
#trades-table::-webkit-scrollbar-track {
  background: #000000; /* Цвет "дорожки" */
  border-radius: 5px;
}
#positions-trades-container::-webkit-scrollbar-thumb,
#positions-tab::-webkit-scrollbar-thumb,
#trades-tab::-webkit-scrollbar-thumb,
#positions-table::-webkit-scrollbar-thumb,
#trades-table::-webkit-scrollbar-thumb {
  background: #333; /* Цвет самой полосы прокрутки */
  border-radius: 5px;
}
#positions-trades-container::-webkit-scrollbar-thumb:hover,
#positions-tab::-webkit-scrollbar-thumb:hover,
#trades-tab::-webkit-scrollbar-thumb:hover,
#positions-table::-webkit-scrollbar-thumb:hover,
#trades-table::-webkit-scrollbar-thumb:hover {
  background: #555; /* Цвет при наведении */
}

/* Для Firefox */
#positions-trades-container,
#positions-tab,
#trades-tab,
#positions-table,
#trades-table {
  scrollbar-width: thin; /* 'auto' | 'thin' | 'none' */
  scrollbar-color: #333 #0a0e17; /* thumb и track color */
}
/* ======================= Стили для скроллбара во вкладках "Открытые сделки" и "История сделок" (тёмная тема) КОНЕЦ */

/* ======================= Стили для скроллбаров в светлой теме */
/* Скроллбары для таблицы символов */
body:not(.dark-theme) #symbols-table-content::-webkit-scrollbar {
  width: 10px;
}

body:not(.dark-theme) #symbols-table-content::-webkit-scrollbar-track {
  background: #f5f5f5;
  border-radius: 5px;
}

body:not(.dark-theme) #symbols-table-content::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 5px;
}

body:not(.dark-theme) #symbols-table-content::-webkit-scrollbar-thumb:hover {
  background: #aaa;
}

body:not(.dark-theme) #symbols-table-content {
  scrollbar-width: thin;
  scrollbar-color: #ccc #f5f5f5;
}

/* Скроллбары для панели торговли */
body:not(.dark-theme) #trading-panel::-webkit-scrollbar,
body:not(.dark-theme) #trading-controls::-webkit-scrollbar {
  width: 10px;
}

body:not(.dark-theme) #trading-panel::-webkit-scrollbar-track,
body:not(.dark-theme) #trading-controls::-webkit-scrollbar-track {
  background: #f5f5f5;
  border-radius: 5px;
}

body:not(.dark-theme) #trading-panel::-webkit-scrollbar-thumb,
body:not(.dark-theme) #trading-controls::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 5px;
}

body:not(.dark-theme) #trading-panel::-webkit-scrollbar-thumb:hover,
body:not(.dark-theme) #trading-controls::-webkit-scrollbar-thumb:hover {
  background: #aaa;
}

body:not(.dark-theme) #trading-panel,
body:not(.dark-theme) #trading-controls {
  scrollbar-width: thin;
  scrollbar-color: #ccc #f5f5f5;
}

/* Скроллбары для вкладок позиций и сделок */
body:not(.dark-theme) #positions-trades-container::-webkit-scrollbar,
body:not(.dark-theme) #positions-tab::-webkit-scrollbar,
body:not(.dark-theme) #trades-tab::-webkit-scrollbar,
body:not(.dark-theme) #positions-table::-webkit-scrollbar,
body:not(.dark-theme) #trades-table::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

body:not(.dark-theme) #positions-trades-container::-webkit-scrollbar-track,
body:not(.dark-theme) #positions-tab::-webkit-scrollbar-track,
body:not(.dark-theme) #trades-tab::-webkit-scrollbar-track,
body:not(.dark-theme) #positions-table::-webkit-scrollbar-track,
body:not(.dark-theme) #trades-table::-webkit-scrollbar-track {
  background: #f5f5f5;
  border-radius: 5px;
}

body:not(.dark-theme) #positions-trades-container::-webkit-scrollbar-thumb,
body:not(.dark-theme) #positions-tab::-webkit-scrollbar-thumb,
body:not(.dark-theme) #trades-tab::-webkit-scrollbar-thumb,
body:not(.dark-theme) #positions-table::-webkit-scrollbar-thumb,
body:not(.dark-theme) #trades-table::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 5px;
}

body:not(.dark-theme) #positions-trades-container::-webkit-scrollbar-thumb:hover,
body:not(.dark-theme) #positions-tab::-webkit-scrollbar-thumb:hover,
body:not(.dark-theme) #trades-tab::-webkit-scrollbar-thumb:hover,
body:not(.dark-theme) #positions-table::-webkit-scrollbar-thumb:hover,
body:not(.dark-theme) #trades-table::-webkit-scrollbar-thumb:hover {
  background: #aaa;
}

body:not(.dark-theme) #positions-trades-container,
body:not(.dark-theme) #positions-tab,
body:not(.dark-theme) #trades-tab,
body:not(.dark-theme) #positions-table,
body:not(.dark-theme) #trades-table {
  scrollbar-width: thin;
  scrollbar-color: #ccc #f5f5f5;
}
/* ======================= Стили для скроллбаров в светлой теме КОНЕЦ */

/* Стили для панели управления сделками */
#trading-panel {
  width: 259.6px;
  height: 566.6px;
  top: 0px;
  left: 1270.78px;
  display: flex;
  flex-direction: column;
}

/* Вертикальное сжатие через CSS классы (управляется JavaScript) */
/* Компактный режим: 300-400px */
#trading-panel.compact #trading-controls {
  padding: 7px;
  gap: 7px;
}

#trading-panel.compact #trading-controls > div[style*="margin-bottom"] {
  margin-bottom: 10px !important;
}

#trading-panel.compact #trading-controls > div[style*="margin-top"] {
  margin-top: 10px !important;
}

#trading-panel.compact #trading-controls label {
  font-size: 13px;
  margin-bottom: 3px !important;
}

#trading-panel.compact #trading-controls button {
  padding: 10px 14px;
  font-size: 13px;
}

#trading-panel.compact #trading-controls input[type="number"],
#trading-panel.compact #trading-controls select {
  padding: 6px;
  font-size: 13px;
}

/* Очень компактный режим: 200-300px */
#trading-panel.very-compact #trading-controls {
  padding: 5px;
  gap: 5px;
}

#trading-panel.very-compact #trading-controls > div[style*="margin-bottom"] {
  margin-bottom: 5px !important;
}

#trading-panel.very-compact #trading-controls > div[style*="margin-top"] {
  margin-top: 5px !important;
}

#trading-panel.very-compact #trading-controls label {
  font-size: 12px;
  margin-bottom: 2px !important;
}

#trading-panel.very-compact #trading-controls button {
  padding: 6px 10px;
  font-size: 12px;
}

#trading-panel.very-compact #trading-controls input[type="number"],
#trading-panel.very-compact #trading-controls select {
  padding: 4px;
  font-size: 12px;
}

/* Минимальный режим: <200px */
#trading-panel.minimal #trading-controls {
  padding: 3px;
  gap: 3px;
}

#trading-panel.minimal #trading-controls > div[style*="margin-bottom"] {
  margin-bottom: 3px !important;
}

#trading-panel.minimal #trading-controls > div[style*="margin-top"] {
  margin-top: 3px !important;
}

#trading-panel.minimal #trading-controls label {
  font-size: 10px;
  margin-bottom: 1px !important;
}

#trading-panel.minimal #trading-controls button {
  padding: 4px 8px;
  font-size: 10px;
}

#trading-panel.minimal #trading-controls input[type="number"],
#trading-panel.minimal #trading-controls select {
  padding: 3px;
  font-size: 10px;
}

#trading-controls {
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}

#trading-controls input[type="number"] {
  width: 100%;
  padding: 8px;
  background: #161b22;
  border: 1px solid #333;
  color: white;
  border-radius: 3px;
  box-sizing: border-box;
}

/* Убираем стрелки регулировки в полях ввода чисел */
#trading-controls input[type="number"]::-webkit-outer-spin-button,
#trading-controls input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

  #trading-controls input[type="number"] {
    appearance: textfield; /* Стандартное свойство */
    -moz-appearance: textfield; /* Firefox */
  }
  
  #trading-controls .button-group {
  display: flex;
  gap: 5px;
}

#trading-controls button {
  flex: 1;
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 500;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  color: white;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

#trading-controls button::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

#trading-controls button:hover::before {
  width: 300px;
  height: 300px;
}

#trading-controls button:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

#trading-controls button:active {
  transform: translateY(0);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

#trading-controls #new-long-btn {
  background: linear-gradient(135deg, rgba(0, 255, 136, 0.5) 0%, rgba(0, 204, 106, 0.5) 100%);
  color: #fff;
  font-weight: 600;
}

#trading-controls #new-long-btn:hover {
  background: linear-gradient(135deg, rgba(0, 255, 136, 0.7) 0%, rgba(0, 204, 106, 0.7) 100%);
}

#trading-controls #new-short-btn {
  background: linear-gradient(135deg, rgba(255, 68, 102, 0.5) 0%, rgba(220, 38, 70, 0.5) 100%);
  color: #fff;
  font-weight: 600;
}

#trading-controls #new-short-btn:hover {
  background: linear-gradient(135deg, rgba(255, 68, 102, 0.7) 0%, rgba(220, 38, 70, 0.7) 100%);
}

#trading-controls #new-close-btn {
  background: linear-gradient(135deg, rgba(46, 46, 46, 0.5) 0%, rgba(32, 32, 32, 0.5) 100%);
  color: #fff;
}

#trading-controls #new-close-btn:hover {
  background: linear-gradient(135deg, rgba(53, 53, 53, 0.7) 0%, rgba(37, 37, 37, 0.7) 100%);
}

#trading-controls #auto-trade-btn {
  background: linear-gradient(135deg, rgba(46, 46, 46, 0.5) 0%, rgba(32, 32, 32, 0.5) 100%);
  color: #fff;
}

#trading-controls #auto-trade-btn:hover {
  background: linear-gradient(135deg, rgba(53, 53, 53, 0.7) 0%, rgba(37, 37, 37, 0.7) 100%);
}

#trading-controls #auto-trade-btn.active {
  background: linear-gradient(135deg, rgba(0, 255, 136, 0.5) 0%, rgba(0, 204, 106, 0.5) 100%);
  color: #fff;
  font-weight: 600;
  border: 1px solid rgba(0, 255, 170, 0.6);
  animation: pulseGlow 2s ease-in-out infinite;
}

/* Скрытие стрелок спиннера у поля ввода суммы */
#trade-amount::-webkit-inner-spin-button,
#trade-amount::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

#trade-amount {
  appearance: textfield; /* Стандартное свойство */
  -moz-appearance: textfield; /* Firefox */
}

@keyframes pulseGlow {
  0%, 100% {
    box-shadow: 0 0 7.5px rgba(0, 255, 136, 0.4), 0 0 15px rgba(0, 255, 136, 0.2), 0 2px 4px rgba(0, 0, 0, 0.2);
  }
  50% {
    box-shadow: 0 0 12.5px rgba(0, 255, 136, 0.6), 0 0 25px rgba(0, 255, 136, 0.3), 0 4px 8px rgba(0, 0, 0, 0.3);
  }
}

/* Стили для светлой темы */
body:not(.dark-theme) #trading-controls input[type="number"] {
  background: white;
  border: 1px solid #ccc;
  color: black;
}

/* Убираем стрелки регулировки в полях ввода чисел для светлой темы */
body:not(.dark-theme) #trading-controls input[type="number"]::-webkit-outer-spin-button,
body:not(.dark-theme) #trading-controls input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

body:not(.dark-theme) #trading-controls input[type="number"] {
  appearance: textfield; /* Стандартное свойство */
  -moz-appearance: textfield; /* Firefox */
}

body:not(.dark-theme) #trading-controls #new-long-btn {
  background-color: #2a7f4a;
  color: white;
}

body:not(.dark-theme) #trading-controls #new-short-btn {
  background-color: #8f3a3a;
  color: white;
}

body:not(.dark-theme) #trading-controls #new-close-btn {
  background-color: #555;
  color: white;
}
/* ======================= Стили для скроллбара в блоке с монетами (тёмная тема) КОНЕЦ */

/* ======================= Стили для скроллбара в модальном окне индикаторов (тёмная тема) */
body.dark-theme .modal-body::-webkit-scrollbar {
  width: 10px; /* Ширина полосы прокрутки */
}

body.dark-theme .modal-body::-webkit-scrollbar-track {
  background: #000000; /* Цвет "дорожки" */
  border-radius: 5px;
}

body.dark-theme .modal-body::-webkit-scrollbar-thumb {
  background: #333; /* Цвет самой полосы прокрутки */
  border-radius: 5px;
}

body.dark-theme .modal-body::-webkit-scrollbar-thumb:hover {
  background: #555; /* Цвет при наведении */
}

/* Для Firefox */
body.dark-theme .modal-body {
  scrollbar-width: thin; /* 'auto' | 'thin' | 'none' */
  scrollbar-color: #333 #0a0e17; /* thumb и track color */
}
/* ======================= Стили для скроллбара в модальном окне индикаторов (тёмная тема) КОНЕЦ */

/* ======================= Стили для скроллбара в модальном окне индикаторов (светлая тема) */
body:not(.dark-theme) .modal-body::-webkit-scrollbar {
  width: 10px; /* Ширина полосы прокрутки */
}

body:not(.dark-theme) .modal-body::-webkit-scrollbar-track {
  background: #f5f5f5; /* Цвет "дорожки" */
  border-radius: 5px;
}

body:not(.dark-theme) .modal-body::-webkit-scrollbar-thumb {
  background: #ccc; /* Цвет самой полосы прокрутки */
  border-radius: 5px;
}

body:not(.dark-theme) .modal-body::-webkit-scrollbar-thumb:hover {
  background: #aaa; /* Цвет при наведении */
}

/* Для Firefox */
body:not(.dark-theme) .modal-body {
  scrollbar-width: thin; /* 'auto' | 'thin' | 'none' */
  scrollbar-color: #ccc #f5f5f5; /* thumb и track color */
}
/* ======================= Стили для скроллбара в модальном окне индикаторов (светлая тема) КОНЕЦ */

/* Стили для кнопок закрытия позиций */
.close-position-btn {
  background: none;
  border: none;
  color: #ff4444;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 3px;
  transition: all 0.2s ease;
  font-size: 14px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.close-position-btn:hover {
  background: rgba(255, 68, 68, 0.2);
  color: #ff6666;
}

.close-position-btn:active {
  background: rgba(255, 68, 68, 0.3);
  transform: scale(0.95);
}

/* Стили для светлой темы */
body:not(.dark-theme) .close-position-btn {
  color: #cc0000;
}

body:not(.dark-theme) .close-position-btn:hover {
  background: rgba(204, 0, 0, 0.1);
  color: #ff0000;
}

body:not(.dark-theme) .close-position-btn:active {
  background: rgba(204, 0, 0, 0.2);
}

/* Модальное окно индикаторов */
.modal {
  display: none;
  position: fixed;
  z-index: 10000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
  background-color: #1a1f27;
  margin: 5% auto;
  padding: 0;
  border: 1px solid #333;
  border-radius: 6px;
  width: 80%;
  max-width: 500px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  /* Добавляем отступ снизу */
  margin-bottom: 5%;
  /* Плавные переходы для визуальной обратной связи */
  /* Выход (затухание) — очень медленный */
  transition: box-shadow 1000ms ease, border-color 1000ms ease;
}

/* Визуальная обратная связь при долгом нажатии (long press) на мобильных */
.modal-content.long-press {
  border-color: #00ff88;
  box-shadow: 0 0 15px rgba(0, 255, 136, 0.4), 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* Визуальная обратная связь при перетаскивании */
.modal-content.dragging {
  border-color: var(--window-glow-color);
  /* Контурное свечение + тень приподнятия */
  box-shadow: 
    0 0 18px var(--window-glow-soft-1),
    0 0 48px var(--window-glow-soft-2),
    0 0 92px var(--window-glow-soft-3),
    0 12px 30px rgba(0, 0, 0, 0.4);
  opacity: 0.95;
  /* Вход (загорание) — быстрее */
  transition: box-shadow 300ms ease, border-color 300ms ease;
}

.modal-header {
  padding: 15px 20px;
  background: rgba(30, 35, 45, 0.7);
  border-bottom: 1px solid #333;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  margin: 0;
  font-size: 16px;
}

.close-modal {
  color: #aaa;
  font-size: 24px;
  font-weight: bold;
  cursor: pointer;
}

.close-modal:hover {
  color: #fff;
}

.modal-body {
  padding: 20px;
  overflow: auto;
  max-height: 70vh;
}

.indicator-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid #333;
}

.indicator-item:last-child {
  border-bottom: none;
}

.indicator-name {
  font-size: 14px;
  color: #e0e0e0;
}

.add-indicator-btn {
  background: #2a7f4a;
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 3px;
  cursor: pointer;
  font-size: 12px;
}

.add-indicator-btn:hover {
  background: #3a9f5a;
}

.custom-indicator-type-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-top: 15px;
}

.indicator-type-option {
  background: #1f2632;
  border: 1px solid #2f3644;
  border-radius: 6px;
  padding: 14px;
  text-align: left;
  color: #e0e0e0;
  cursor: pointer;
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.indicator-type-option:hover {
  border-color: #00ff88;
  transform: translateY(-2px);
}

.indicator-type-option .option-title {
  display: block;
  font-weight: 600;
  margin-bottom: 4px;
}

.indicator-type-option .option-subtitle {
  display: block;
  font-size: 12px;
  color: #a0aec0;
}

.js-indicator-hint {
  font-size: 12px;
  color: #a0aec0;
  margin: 0 0 15px;
  line-height: 1.4;
}

/* Стили для списка добавленных индикаторов */
.added-indicator-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid #333;
}

.added-indicator-item:last-child {
  border-bottom: none;
}

.indicator-info {
  color: #e0e0e0;
}

.remove-indicator-btn {
  background: #8f3a3a;
  color: white;
  border: none;
  padding: 4px 8px;
  border-radius: 3px;
  cursor: pointer;
  font-size: 12px;
}

.remove-indicator-btn:hover {
  background: #a04a4a;
}

.no-indicators-message {
  color: #888;
  font-style: italic;
  padding: 10px 0;
}

/* Стили для сохраненных индикаторов */
.saved-indicator-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid #333;
}

.saved-indicator-item:last-child {
  border-bottom: none;
}

.saved-indicator-item .indicator-info {
  color: #e0e0e0;
}

.add-saved-indicator-btn,
.remove-saved-indicator-btn {
  background: #2a7f4a;
  color: white;
  border: none;
  padding: 4px 8px;
  border-radius: 3px;
  cursor: pointer;
  font-size: 12px;
  margin-left: 5px;
}

.remove-saved-indicator-btn {
  background: #8f3a3a;
}

.add-saved-indicator-btn:hover {
  background: #3a9f5a;
}

.remove-saved-indicator-btn:hover {
  background: #a04a4a;
/* Адаптация для мобильных устройств */
@media screen and (max-width: 1024px) {
  /* Устанавливаем минимальную ширину страницы 900px на мобильных, чтобы можно было растягивать блоки */
  /* ВАЖНО: убираем width: 100%, чтобы body/html могли быть шире viewport */
  /* Разрешаем странице расти шире вьюпорта */
  html,
  body {
    width: auto !important;          /* Убираем ограничение 100% от viewport */
    min-width: 900px !important;     /* Минимальная ширина страницы */
    max-width: none !important;      /* Не ограничиваем сверху */
    overflow-x: auto !important;     /* Разрешаем горизонтальный скролл */
    position: relative !important;   /* Для корректной абсолютной позиции блоков */
  }
  
  /* УБИРАЕМ ограничение max-width: 100% для draggable блоков на мобильных */
  /* Это позволяет блокам быть шире viewport и растягивать страницу */
  .draggable {
    max-width: none !important; /* Убираем ограничение 100% от viewport */
  }
  
  /* Изменяем размеры и позиционирование блоков для мобильных устройств */
  #chart-container {
    /* Убираем принудительные ограничения - позволяем пользователю перемещать и изменять размер */
    /* На мобильных не устанавливаем фиксированную ширину, позволяем растягиваться */
    max-width: none !important; /* ВАЖНО: убираем ограничение max-width: 100% из базового стиля */
    width: auto !important; /* Убираем фиксированную ширину 1270.78px */
    box-sizing: border-box;
    overflow: hidden;
    /* Минимальные размеры для мобильных */
    min-width: 200px;
    min-height: 200px;
  }
  
  #chart-container canvas {
    /* Canvas должен оставаться 100% от контейнера, но контейнер может быть шире */
    max-width: 100% !important;
    width: 100% !important;
    box-sizing: border-box;
  }
  
  /* Убираем принудительные размеры и позиции для всех блоков на мобильных */
  /* Позволяем пользователю свободно перемещать и изменять размеры блоков */
  #trading-panel {
    /* На мобильных не устанавливаем фиксированную ширину, позволяем растягиваться */
    max-width: none !important; /* Убираем ограничение, чтобы блок мог растягивать страницу */
    width: auto !important;     /* Сбрасываем базовую фиксированную ширину */
    box-sizing: border-box;
  }
  
  #chart-settings-toolbar,
  #settings-toolbar {
    /* На мобильных не устанавливаем фиксированную ширину, позволяем растягиваться */
    max-width: none !important; /* Убираем ограничение, чтобы блок мог растягивать страницу */
    width: auto !important;     /* Сбрасываем базовую фиксированную ширину */
    box-sizing: border-box;
  }
  
  
  #symbols-table,
  #positions-trades-container {
    /* Минимальные размеры для удобства использования */
    min-width: 200px;
    min-height: 150px;
  }
  
  /* Админ-панель для мобильных устройств */
  #admin-panel {
    width: 95% !important;
    max-width: 95% !important;
    height: 300px !important;
    left: 2.5% !important;
    top: 10px !important;
    box-sizing: border-box;
  }
  
  /* Адаптируем таблицы для мобильных устройств */
  .draggable table {
    font-size: 12px;
  }
  
  .draggable th, .draggable td {
    padding: 6px 4px;
  }
  
  /* Адаптируем вкладки для мобильных устройств */
  .tab-button {
    padding: 6px 8px;
    font-size: 11px;
  }
  
  /* Адаптируем кнопки для мобильных устройств */
  .chart-control-btn,
  .tf-timeframe-btn {
    padding: 3px 6px;
    font-size: 10px;
    min-width: 30px;
    height: 24px;
  }
  
  #heikin-ashi-btn,
  #indicators-btn {
    width: 24px;
    height: 24px;
    font-size: 12px;
  }
  
  /* Адаптируем элементы управления торговлей для мобильных устройств */
  #trading-controls button {
    padding: 8px;
    font-size: 12px;
  }
  
  /* Адаптируем модальные окна для мобильных устройств */
  .modal-content {
    width: 95%;
    margin: 2% auto;
  }
  
  .modal-body {
    padding: 15px;
  }
  
  .indicator-item {
    padding: 10px 0;
  }
  
  .indicator-name {
    font-size: 13px;
  }
  
  .add-indicator-btn {
    padding: 4px 8px;
    font-size: 11px;
  }
}

/* Адаптация для очень маленьких экранов */
@media screen and (max-width: 480px) {
  #chart-container {
    height: 300px;
  }
  
  #symbols-table {
    height: 250px;
    top: 320px;
  }
  
  #trading-panel {
    top: 580px;
  }
  
  #positions-trades-container {
    top: 770px;
  }
  
  #chart-settings-toolbar {
    top: 1080px;
  }
  
  #settings-toolbar {
    top: 1150px;
  }
  
  .draggable table {
    font-size: 11px;
  }
  
  .tab-button {
    padding: 5px 6px;
    font-size: 10px;
  }
  
  #timeframe-toolbar-content {
    max-height: none; /* Убираем ограничение для видимости всех элементов */
    overflow-y: visible; /* Делаем весь контент видимым */
  }
}

/* Стили для визуальной обратной связи при перетаскивании */
.draggable.dragging {
  opacity: 0.8;
  transform: none;
  /* Контурное свечение + тень приподнятия */
  box-shadow:
    0 0 18px var(--window-glow-soft-1),
    0 0 48px var(--window-glow-soft-2),
    0 0 92px var(--window-glow-soft-3),
    0 12px 30px var(--window-glow-lift) !important;
  /* 1px жёсткий контур (основа свечения) */
  border: 1px solid var(--window-glow-color) !important;
  z-index: 1000 !important;
  /* Вход (загорание) — быстрее */
  transition: box-shadow 300ms ease, border-color 300ms ease, opacity 300ms ease;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  pointer-events: none; /* Предотвращаем взаимодействие с элементами внутри блока во время перетаскивания */
}

/* Стили для визуальной обратной связи при долгом нажатии */
.draggable.long-press {
  transform: scale(0.98);
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ======================= Адаптивный layout для блока настроек графика */
/* Включаем поддержку Container Queries для блока настроек графика */
#chart-settings-toolbar {
  container-type: inline-size;
  container-name: chart-settings;
}

/* При ширине блока меньше 500px - переключаемся на вертикальный layout */
@container chart-settings (max-width: 500px) {
  #chart-settings-content {
    flex-direction: column !important;
    align-items: stretch;
  }
  
  #timeframe-toolbar-content {
    flex-direction: column;
    align-items: stretch;
  }
  
  #chart-controls {
    flex-direction: column;
    align-items: stretch;
    padding-left: 0;
    margin-left: 0;
  }

  /* В узком/вертикальном режиме разделитель не нужен */
  #chart-controls::before {
    display: none;
  }
  
  .tf-timeframe-btn,
  .chart-control-btn {
    width: 100%;
    justify-content: center;
  }

  /* В узком режиме отключаем наслоение (если включено в широком) */
  #timeframe-toolbar-content .tf-timeframe-btn + .tf-timeframe-btn {
    margin-left: 0;
  }
}

/* При ширине 300-500px - промежуточный вариант с wrap */
@container chart-settings (max-width: 500px) and (min-width: 300px) {
  #timeframe-toolbar-content {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
  }
}

/* В широком режиме включаем «stacked tabs» для неактивных таймфреймов */
@container chart-settings (min-width: 500px) {
  #timeframe-toolbar-content {
    gap: 0;
    padding-right: 4px; /* чуть воздуха справа, чтобы последняя вкладка не прилипала */
  }

  #timeframe-toolbar-content .tf-timeframe-btn + .tf-timeframe-btn {
    margin-left: calc(-1 * var(--cs-tf-overlap));
  }
}
/* ======================= Адаптивный layout для блока настроек графика КОНЕЦ */
}
