body, html {
  margin: 0; padding: 0;
  width: 100%;
  min-height: 400vh;
  background-color: var(--bg-body);
  color: var(--text-primary);
  font-family: 'Inter', 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);
}
/* === Theme CSS Variables ===
   Light theme (default) in :root, dark overrides in body.dark-theme.
   Used throughout instead of duplicated body.dark-theme / body:not(.dark-theme) selectors. */
:root {
  --bg-body: #f5f5f5;
  --text-primary: black;
  --bg-draggable: rgba(240, 240, 240, 0.9);
  --bg-draggable-opaque: #f1f1f1;
  --border-primary: #ccc;
  --bg-header: rgba(200, 200, 200, 0.7);
  --bg-input: white;
  --border-input: 1px solid #ddd;
  --text-secondary: #333;
  --text-muted: #888;
  --accent-green: #006600;
  --border-table: #ddd;
  --bg-hover: rgba(200, 200, 200, 0.5);
  --bg-tab-hover: rgba(200, 200, 200, 0.3);
  --text-tab: #000000;
  --accent-tab-active: #00ffaa;
  --bg-tab-active: rgba(0, 255, 170, 0.1);
  --bg-button: #f0f0f0;
  --bg-button-hover: #e0e0e0;
  --border-button: rgba(0, 0, 0, 0.14);
  --border-button-hover: rgba(0, 0, 0, 0.22);
  --bg-modal: #ffffff;
  --bg-modal-header: rgba(240, 240, 240, 0.9);
  --border-modal: #ccc;
  --scrollbar-track: #f5f5f5;
  --scrollbar-thumb: #ccc;
  --scrollbar-thumb-hover: #aaa;
  --bg-leverage: #e0e0e0;
  --border-leverage: #ccc;
}

body.dark-theme {
  --bg-body: #000000;
  --text-primary: white;
  --bg-draggable: rgba(13, 17, 23, 0.85);
  --bg-draggable-opaque: #0b0e14;
  --border-primary: #333;
  --bg-header: rgba(30, 35, 45, 0.7);
  --bg-input: rgba(4, 6, 8, 0.85);
  --border-input: none;
  --text-secondary: #aaa;
  --text-muted: #888;
  --accent-green: #00ffaa;
  --border-table: #222;
  --bg-hover: rgba(50, 55, 70, 0.5);
  --bg-tab-hover: rgba(50, 55, 70, 0.3);
  --text-tab: #ffffff;
  --accent-tab-active: #00ffaa;
  --bg-tab-active: rgba(0, 255, 170, 0.1);
  --bg-button: rgba(34, 34, 34, 0.92);
  --bg-button-hover: rgba(51, 51, 51, 0.92);
  --border-button: rgba(255, 255, 255, 0.14);
  --border-button-hover: rgba(255, 255, 255, 0.26);
  --bg-modal: #1a1a2e;
  --bg-modal-header: rgba(30, 35, 45, 0.9);
  --border-modal: #333;
  --scrollbar-track: #0a0e17;
  --scrollbar-thumb: #333;
  --scrollbar-thumb-hover: #555;
  --bg-leverage: rgba(4, 6, 8, 0.85);
  --border-leverage: #444;
}

/* === Global scrollbar styles === */
/* Light theme (default) — applies to ALL scrollbars */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: #f5f5f5; border-radius: 5px; }
::-webkit-scrollbar-thumb { background: #ccc; border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: #aaa; }

/* Dark theme — global override */
body.dark-theme ::-webkit-scrollbar-track { background: #0a0e17; }
body.dark-theme ::-webkit-scrollbar-thumb { background: #333; }
body.dark-theme ::-webkit-scrollbar-thumb:hover { background: #555; }

/* Firefox support */
* { scrollbar-width: thin; scrollbar-color: #ccc #f5f5f5; }
body.dark-theme * { scrollbar-color: #333 #0a0e17; }

/* === Ripple button base class === */
.btn-ripple {
  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);
}
.btn-ripple::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 ease, height 0.6s ease;
  pointer-events: none;
}
.btn-ripple:hover::before { width: 320px; height: 320px; }


/* === 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: linear-gradient(to bottom, transparent 0, transparent 27px, var(--bg-draggable) 27px);
  border: 1px solid rgba(128, 128, 128, 0.15);
  border-radius: 0px;
  box-shadow: 0 0 6px rgba(128, 128, 128, 0.08), 0 4px 12px rgba(0,0,0,0.2);
  /* Выход (затухание) — очень медленный: при снятии 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;
  background: linear-gradient(to bottom, transparent 0, transparent 27px, var(--bg-draggable-opaque) 27px) !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:
    4px 0 14px 0 var(--window-glow-soft-1),
    8px 0 36px 0 var(--window-glow-soft-2),
    12px 0 70px 0 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:
    -4px 0 14px 0 var(--window-glow-soft-1),
    -8px 0 36px 0 var(--window-glow-soft-2),
    -12px 0 70px 0 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 -4px 14px 0 var(--window-glow-soft-1),
    0 -8px 36px 0 var(--window-glow-soft-2),
    0 -12px 70px 0 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 4px 14px 0 var(--window-glow-soft-1),
    0 8px 36px 0 var(--window-glow-soft-2),
    0 12px 70px 0 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:
    4px -4px 14px 0 var(--window-glow-soft-1),
    8px -8px 36px 0 var(--window-glow-soft-2),
    12px -12px 70px 0 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:
    -4px -4px 14px 0 var(--window-glow-soft-1),
    -8px -8px 36px 0 var(--window-glow-soft-2),
    -12px -12px 70px 0 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:
    4px 4px 14px 0 var(--window-glow-soft-1),
    8px 8px 36px 0 var(--window-glow-soft-2),
    12px 12px 70px 0 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:
    -4px 4px 14px 0 var(--window-glow-soft-1),
    -8px 8px 36px 0 var(--window-glow-soft-2),
    -12px 12px 70px 0 var(--window-glow-soft-3),
    0 12px 30px var(--window-glow-lift);
}
.draggable-header {
  /* Единый размер шапок для всех блоков (как у "Настройки" и "Настройки графика") */
  padding: 3px 8px;
  background: var(--bg-header);
  border-bottom: 1px solid #333;
  font-size: 11px;
  height: 26px;
  min-height: 26px;
  box-sizing: border-box;
  overflow: hidden;
  cursor: move;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
/* НЕВИДИМЫЕ РЕСАЙЗ-ЗОНЫ */
.resize-handle {
  position: absolute;
  z-index: 50; /* Всегда поверх контента блока (кнопки имеют z-index до 10) */
  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;
}

.chart-display-settings-section-title {
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid #444;
}

/* График: на мобильных/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: var(--accent-green);
  color: var(--accent-green);
  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: var(--accent-green); z-index: 5; font-family: 'JetBrains Mono', 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: var(--accent-green);
  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: var(--accent-green);
  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;
}

/* ===== Positions table: TP/SL (3 строки: цена / USDT / %) ===== */
#positions-table td.positions-tpsl-cell {
  padding-top: 4px;
  padding-bottom: 4px;
  text-align: right;
  white-space: nowrap;
}

#positions-table td.positions-tpsl-cell .positions-tpsl-stack {
  display: flex;
  flex-direction: column;
  gap: 1px;
  font-size: 10px;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

#positions-table td.positions-tpsl-cell .positions-tpsl-line {
  font-size: inherit;
  font-weight: inherit;
  opacity: 1;
}

#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: rgba(4, 6, 8, 0.85);
  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: linear-gradient(
    to bottom,
    color-mix(in srgb, var(--window-glow-color, #00ffaa) 5%, transparent),
    color-mix(in srgb, var(--window-glow-color, #00ffaa) 20%, transparent) 50%,
    color-mix(in srgb, var(--window-glow-color, #00ffaa) 13%, transparent)
  );
}

/* Стили таблицы монет */
#symbols-list {
  width: 100%;
  table-layout: auto;
  border-collapse: collapse;
}

#symbols-list th,
#symbols-list td {
  padding: 4px 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Ширины колонок: ★ | # | Монета | Цена | 24h */
#symbols-list th:nth-child(1),
#symbols-list td:nth-child(1) {
  width: 14px;
  min-width: 14px;
  max-width: 14px;
  text-align: center;
  padding: 0 1px;
}

#symbols-list th:nth-child(2),
#symbols-list td:nth-child(2) {
  width: 1%;
  text-align: center;
  padding-right: 5px;
}

/* Колонка "Монета" — сжата ~30%, чтобы влезал столбик 24h */
#symbols-list th:nth-child(3),
#symbols-list td:nth-child(3) {
  width: auto;
  max-width: 65px;
}

#symbols-list th:nth-child(4),
#symbols-list td:nth-child(4) {
  width: 65px;
  text-align: left;
}

#symbols-list th:nth-child(5),
#symbols-list td:nth-child(5) {
  width: 60px;
  min-width: 60px;
  text-align: right;
}

/* Звёздочка избранного */
.symbol-star-cell {
  padding: 0 1px !important;
}
.symbol-fav-star {
  cursor: pointer;
  font-size: 15px;
  color: #444;
  padding: 2px;
  transition: color 0.15s;
  user-select: none;
  line-height: 1;
}
.symbol-fav-star:hover {
  color: #ffd700;
}
.symbol-fav-star.active {
  color: #ffd700;
}
.th-star {
  width: 14px !important;
  min-width: 14px;
  max-width: 14px;
}

/* НОВЫЕ БЛОКИ */
/* Заставляем контейнер баланса вести себя как 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: var(--accent-green);
}

#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;
}

/* Кнопка скачивания Android приложения - зелёная */
#settings-toolbar #settings-content #download-android-app-btn,
body.dark-theme #settings-toolbar #settings-content #download-android-app-btn,
body:not(.dark-theme) #settings-toolbar #settings-content #download-android-app-btn {
  color: #3d8b40 !important;
}
#settings-toolbar #settings-content #download-android-app-btn:hover,
body.dark-theme #settings-toolbar #settings-content #download-android-app-btn:hover,
body:not(.dark-theme) #settings-toolbar #settings-content #download-android-app-btn:hover {
  color: #66FF66 !important;
}

/* Колокольчик и “настройки” должны вести себя как остальные вкладки (без провала вниз) */
#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, #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, #fetch-data-btn:hover {
  background: var(--cs-tab-bg-hover);
}

/* Объединенный блок для позиций и сделок с вкладками */
#positions-trades-container {
  width: 1270.38px;
  height: 544px;
  top: 568.8px;
  left: 0px;
  display: flex;
  flex-direction: column;
}

/* Стили для вкладок */
.tabs-container {
  display: flex;
  background: var(--bg-header);
  border-bottom: 1px solid var(--border-primary);
}
.tab-button {
  flex: 1;
  padding: 8px 12px;
  background: transparent;
  border: none;
  color: var(--text-tab);
  cursor: pointer;
  font-size: 12px;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
}
.tab-button:hover {
  background: var(--bg-tab-hover);
  color: var(--text-secondary);
}
.tab-button.active {
  border-bottom-color: var(--accent-tab-active);
  background: var(--bg-tab-active);
}
.tab-content {
  flex: 1;
  overflow: auto;
  display: none;
}
.tab-content.active {
  display: block;
}

/* === ПОДСВЕТКА ИЗМЕНЕНИЯ ЦЕНЫ === */
@keyframes priceFlashGreen {
  0%   { background-color: rgba(0,255,136,0.18);
         box-shadow: inset 2px 0 1px -1px rgba(0,255,136,0.85), inset 0 0 18px -4px rgba(0,255,136,0.18);
         text-shadow: 0 0 6px rgba(0,255,136,0.45); }
  12%  { background-color: rgba(0,255,136,0.10);
         box-shadow: inset 2px 0 1px -1px rgba(0,255,136,0.60), inset 0 0 12px -4px rgba(0,255,136,0.10);
         text-shadow: 0 0 3px rgba(0,255,136,0.25); }
  35%  { background-color: rgba(0,255,136,0.04);
         box-shadow: inset 2px 0 1px -1px rgba(0,255,136,0.28), inset 0 0 6px -3px rgba(0,255,136,0.04);
         text-shadow: 0 0 1px rgba(0,255,136,0.08); }
  65%  { background-color: rgba(0,255,136,0.015);
         box-shadow: inset 2px 0 1px -1px rgba(0,255,136,0.10), inset 0 0 0 0 transparent;
         text-shadow: 0 0 0 transparent; }
  100% { background-color: transparent;
         box-shadow: inset 0 0 0 0 transparent, inset 0 0 0 0 transparent;
         text-shadow: 0 0 0 transparent; }
}
@keyframes priceFlashRed {
  0%   { background-color: rgba(255,68,102,0.18);
         box-shadow: inset 2px 0 1px -1px rgba(255,68,102,0.85), inset 0 0 18px -4px rgba(255,68,102,0.18);
         text-shadow: 0 0 6px rgba(255,68,102,0.45); }
  12%  { background-color: rgba(255,68,102,0.10);
         box-shadow: inset 2px 0 1px -1px rgba(255,68,102,0.60), inset 0 0 12px -4px rgba(255,68,102,0.10);
         text-shadow: 0 0 3px rgba(255,68,102,0.25); }
  35%  { background-color: rgba(255,68,102,0.04);
         box-shadow: inset 2px 0 1px -1px rgba(255,68,102,0.28), inset 0 0 6px -3px rgba(255,68,102,0.04);
         text-shadow: 0 0 1px rgba(255,68,102,0.08); }
  65%  { background-color: rgba(255,68,102,0.015);
         box-shadow: inset 2px 0 1px -1px rgba(255,68,102,0.10), inset 0 0 0 0 transparent;
         text-shadow: 0 0 0 transparent; }
  100% { background-color: transparent;
         box-shadow: inset 0 0 0 0 transparent, inset 0 0 0 0 transparent;
         text-shadow: 0 0 0 transparent; }
}
.price-flash-up   { animation: priceFlashGreen 5s ease-out; }
.price-flash-down { animation: priceFlashRed   5s ease-out; }

/* ===== Аналитика доходности ===== */
#analytics-modal .analytics-tab:hover,
#analytics-modal .analytics-src-tab:hover,
#analytics-modal .analytics-trend-btn:hover { color: #fff; border-color: #666; }
#analytics-modal .analytics-tab.active,
#analytics-modal .analytics-src-tab.active { background: #333; color: #fff; border-color: #555; }
#analytics-modal .analytics-trend-btn.active { background: rgba(0, 255, 170, 0.12); color: #00ffaa; border-color: rgba(0, 255, 170, 0.45); }
#analytics-modal .analytics-trend-btn.active:hover { background: rgba(0, 255, 170, 0.20); color: #00ffaa; border-color: #00ffaa; }
#equity-curve-svg .eq-trend-upper-fill { pointer-events: none; }
#equity-curve-svg .eq-trend-lower-fill { pointer-events: none; }
#equity-curve-svg .eq-trend-upper-line { pointer-events: none; }
#equity-curve-svg .eq-trend-mid-line   { pointer-events: none; }
#equity-curve-svg .eq-trend-lower-line { pointer-events: none; }
#equity-curve-svg .eq-line { fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
#equity-curve-svg .eq-line-unrealized {
  fill: none;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 6 4;
  animation: eqDash 1.2s linear infinite;
  cursor: pointer;
}
#equity-curve-svg .eq-area { opacity: 0.12; }
#equity-curve-svg .eq-area-unrealized { opacity: 0.08; pointer-events: none; }
#equity-curve-svg .eq-dot  { r: 3; opacity: 0; transition: opacity 0.15s; cursor: pointer; }
#equity-curve-svg .eq-dot:hover { opacity: 1; }
#equity-curve-svg .eq-live-pulse {
  fill: none;
  stroke-width: 1.5;
  animation: eqPulse 2s cubic-bezier(0.2, 0.8, 0.4, 1) infinite;
  pointer-events: none;
}
#equity-curve-svg .eq-live-dot {
  r: 4.5;
  cursor: pointer;
  transition: r 0.2s ease, filter 0.2s ease;
}
#equity-curve-svg .eq-live-dot:hover {
  r: 6;
}
#equity-curve-svg .eq-zero { stroke: #444; stroke-width: 1; stroke-dasharray: 4 3; }
#equity-curve-svg .eq-label { fill: #666; font-size: 10px; font-family: 'JetBrains Mono', monospace; }

@keyframes eqDash {
  to {
    stroke-dashoffset: -20;
  }
}

@keyframes eqPulse {
  0% {
    r: 4;
    opacity: 0.9;
  }
  60% {
    r: 12;
    opacity: 0;
  }
  100% {
    r: 12;
    opacity: 0;
  }
}

/* Анимация пульсации для выделенной строки */
@keyframes trade-row-pulse {
  0% {
    background-color: rgba(0, 255, 170, 0.4);
  }
  50% {
    background-color: rgba(0, 255, 170, 0.2);
  }
  100% {
    background-color: rgba(0, 255, 170, 0.4);
  }
}

.trade-row-highlighted {
  animation: trade-row-pulse 0.8s ease-in-out 5;
  box-shadow: 0 0 10px rgba(0, 255, 170, 0.5);
  position: relative;
}

.trade-row-highlighted td {
  background-color: rgba(0, 255, 170, 0.15) !important;
}

/* Светлая тема */
body:not(.dark-theme) .trade-row-highlighted td {
  background-color: rgba(0, 200, 130, 0.2) !important;
}

/* === УНИВЕРСАЛЬНЫЙ СТИЛЬ ДЛЯ КНОПОК В НАСТРОЙКАХ ГРАФИКА === */
/* Заменяет старые стили .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 {
  width: 36px;
  max-width: 36px;
  overflow: hidden;
}

/* Единый размер иконок внутри кнопок управления графиком */
.chart-control-btn i {
  width: 14px;
  height: 14px;
  font-size: 14px;
  line-height: 1;
  flex-shrink: 0;
  text-align: center;
}
.chart-control-btn svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

/* Небольшая «полка» снизу — создаёт ощущение, что вкладка вылезает из шапки */
.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: var(--accent-green);
  border-color: var(--accent-green);
  /* “нажатая клавиша”: меньше внешней тени, чуть больше 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: var(--accent-green);
}

.tt-switch .tt-switch-text {
  color: #ccc;
  white-space: nowrap;
}

/* Compact toggle switch for watchlist rows */
.tt-switch.tt-switch-compact {
  gap: 0;
}
.tt-switch.tt-switch-compact .tt-slider {
  width: 28px;
  height: 14px;
}
.tt-switch.tt-switch-compact .tt-slider::after {
  top: 1px;
  left: 1px;
  width: 10px;
  height: 10px;
}
.tt-switch.tt-switch-compact input:checked + .tt-slider::after {
  transform: translateX(13px);
}

/* =============================================================================
 * Signal tags (for watchlist notification rows)
 * ============================================================================= */
.signal-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* Маленькие точки (small dots) - как на графике */
.signal-tag-small {
  font-size: 8px;
  opacity: 0.5;
}

/* Обычные сигналы (buy/sell/exit) */
.signal-tag-normal {
  font-size: 12px;
}

/* Большие сигналы (divergences, gold buy) */
.signal-tag-large {
  font-size: 20px;
}

/* Чуть крупнее large (для тёмных цветов вроде bear div) */
.signal-tag-xlarge {
  font-size: 22.5px;
}

/* Контейнер для активных тегов */
.signal-active-tags {
  min-height: 20px;
}

/* =============================================================================
 * Signal dropdown (multiselect)
 * ============================================================================= */
.signal-dropdown-wrapper {
  position: relative;
  display: inline-block;
}

.signal-dropdown-btn {
  padding: 5px 8px;
  background: #161b22;
  border: 1px solid #444;
  border-radius: 3px;
  color: #fff;
  font-size: 11px;
  cursor: pointer;
  transition: all 0.15s;
  height: 28px;
  line-height: 1;
  box-sizing: border-box;
}

.signal-dropdown-btn:hover {
  background: #1e2530;
  border-color: #555;
  color: #fff;
}

.signal-dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 4px;
  min-width: 180px;
  background: #1a1f2e;
  border: 1px solid #444;
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
  z-index: 1000;
  padding: 6px 0;
}

.signal-dropdown-wrapper.open .signal-dropdown-menu {
  display: block;
}

.signal-dropdown-section {
  padding: 4px 0;
}

.signal-dropdown-divider {
  height: 1px;
  background: #333;
  margin: 4px 8px;
}

.signal-dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  cursor: pointer;
  font-size: 11px;
  color: #ccc;
  transition: background 0.15s;
}

.signal-dropdown-item:hover {
  background: rgba(255,255,255,0.05);
}

.signal-dropdown-item input[type="checkbox"] {
  margin: 0;
  cursor: pointer;
}

.signal-dropdown-item span:last-child {
  flex: 1;
}

/* =============================================================================
 * Notifications: Watchlist drag & drop
 * ============================================================================= */
.notif-drag-handle {
  cursor: grab;
  color: #555;
  font-size: 16px;
  padding: 2px 4px;
  user-select: none;
  transition: color 0.2s;
  flex-shrink: 0;
  min-width: 20px;
  min-height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  touch-action: none;
}
@media (pointer: coarse) {
  .notif-drag-handle {
    min-width: 32px;
    min-height: 32px;
    font-size: 18px;
  }
}
.notif-drag-handle:hover { color: #aaa; }
.notif-drag-handle:active { cursor: grabbing; }

.notif-watchlist-row.dragging {
  opacity: 0.3;
  border: 1px dashed #555 !important;
}

.notif-watchlist-row.drag-over-top {
  border-top: 2px solid #2a7f4a !important;
}
.notif-watchlist-row.drag-over-bottom {
  border-bottom: 2px solid #2a7f4a !important;
}

.notif-drag-ghost {
  position: fixed;
  pointer-events: none;
  z-index: 100000;
  opacity: 0.75;
  box-shadow: 0 4px 12px rgba(0,0,0,0.35);
  border-radius: 4px;
  background: #1a1f2b;
  border: 1px solid #2a7f4a;
  transform-origin: 0 0;
  will-change: transform;
}

/* =============================================================================
 * Notifications: Watchlist details (2nd line)
 * ============================================================================= */
#notifications-watchlist-container .notif-watchlist-details {
  display: none;
  margin-top: 6px;
  padding-left: 2px;
  font-size: 11px;
  line-height: 1.25;
  color: #777;
  word-break: break-word;
}

#notifications-watchlist-container.show-details .notif-watchlist-details {
  display: block;
}

/* Bigger icons for compact watchlist signal legend */
#notifications-watchlist-container .notif-watchlist-details .notif-watchlist-signal-icon {
  font-size: 22px; /* ~2x vs 11px base */
  line-height: 1;
  display: inline-block;
}

/* Dim entire watchlist signal label when unchecked */
#notifications-watchlist-container .notif-watchlist-details label:has(.notif-watchlist-signal:not(:checked)) {
  opacity: 0.2;
  transition: opacity 0.2s ease;
}

#notifications-watchlist-container .notif-watchlist-details label:has(.notif-watchlist-signal:checked) {
  opacity: 1;
  transition: opacity 0.2s ease;
}

/* =============================================================================
 * Notifications: Modal visual hierarchy improvements
 * ============================================================================= */
#notifications-settings-modal .modal-content {
  max-width: 900px;
}
/* Section headers in notifications modal (more prominent) */
#notifications-settings-modal .modal-body > div > div[style*="font-weight: bold"] {
  font-size: 14px !important;
  color: #fff !important;
}

.notifications-delivery-card {
  position: relative;
  margin-bottom: 18px;
  padding: 14px;
  border: 1px solid rgba(56, 139, 253, 0.28);
  border-radius: 14px;
  background:
    radial-gradient(circle at top left, rgba(56, 139, 253, 0.18), transparent 34%),
    linear-gradient(135deg, rgba(22, 27, 34, 0.96), rgba(13, 17, 23, 0.98));
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.notifications-delivery-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(90deg, rgba(56, 139, 253, 0.45), rgba(46, 160, 67, 0.22), transparent);
  opacity: 0.28;
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
  -webkit-mask-composite: xor;
  padding: 1px;
}

.notifications-delivery-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(139, 148, 158, 0.18);
}

.notifications-delivery-title {
  font-size: 15px;
  font-weight: 700;
  color: #f0f6fc;
  letter-spacing: 0.2px;
}

.notifications-delivery-subtitle {
  margin-top: 3px;
  font-size: 12px;
  color: #8b949e;
}

.notifications-delivery-layout {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  align-items: stretch;
}

.notifications-delivery-item {
  display: flex;
  flex-direction: column;
  min-height: 125px;
  padding: 12px;
  border: 1px solid rgba(139, 148, 158, 0.18);
  border-radius: 10px;
  background: rgba(13, 17, 23, 0.62);
  box-sizing: border-box;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.notifications-delivery-item:hover {
  border-color: rgba(56, 139, 253, 0.3);
  background: rgba(18, 24, 32, 0.75);
}

.notifications-delivery-item-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(139, 148, 158, 0.14);
}

.notifications-delivery-item-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding-top: 8px;
}

.notifications-delivery-item label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  margin: 0;
}

.notifications-delivery-item label span {
  color: #d0d7de;
  font-weight: 600;
  font-size: 13px;
}

.notifications-delivery-note {
  color: #7d8590;
  font-size: 11.5px;
  line-height: 1.4;
  margin-bottom: 4px;
}

.notifications-delivery-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 6px;
  flex-wrap: wrap;
}

.notifications-delivery-primary-btn,
.notifications-delivery-secondary-btn {
  padding: 4px 10px;
  border: 1px solid rgba(139, 148, 158, 0.22);
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  font-size: 11.5px;
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.notifications-delivery-primary-btn {
  background: rgba(56, 139, 253, 0.13);
  color: #c9e2ff;
  border-color: rgba(56, 139, 253, 0.34);
}

.notifications-delivery-secondary-btn {
  background: rgba(139, 148, 158, 0.12);
  color: #c9d1d9;
}

.notifications-delivery-primary-btn:hover,
.notifications-delivery-secondary-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(139, 148, 158, 0.42);
  background: rgba(139, 148, 158, 0.18);
}

.notifications-delivery-result {
  margin-top: 6px;
}

.notifications-section {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid rgba(139, 148, 158, 0.18);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(22, 27, 34, 0.82), rgba(13, 17, 23, 0.72));
  transition: border-color 0.2s ease, background 0.2s ease;
}

/* Collapsible sections in notifications modal */
.notifications-collapsible-section {
  transition: border-color 0.2s ease, background 0.2s ease;
}

.notifications-collapsible-section:hover {
  border-color: rgba(56, 139, 253, 0.3);
}

.notifications-collapsible-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  user-select: none;
  padding: 2px 0;
}

.notifications-collapsible-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.notifications-collapse-chevron {
  color: #8b949e;
  font-size: 12px;
  transition: transform 0.22s cubic-bezier(0.4, 0, 0.2, 1), color 0.2s ease;
  width: 14px;
  text-align: center;
  flex-shrink: 0;
}

.notifications-collapsible-section.expanded .notifications-collapse-chevron {
  transform: rotate(90deg);
  color: #58a6ff;
}

.notifications-section-summary-badge {
  font-size: 11px;
  font-weight: 500;
  color: #8b949e;
  background: rgba(139, 148, 158, 0.12);
  padding: 3px 9px;
  border-radius: 6px;
  border: 1px solid rgba(139, 148, 158, 0.16);
  white-space: nowrap;
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
  flex-shrink: 0;
}

.notifications-collapsible-body {
  display: none;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid rgba(139, 148, 158, 0.14);
}

.notifications-collapsible-section.expanded .notifications-collapsible-body {
  display: block;
  animation: notifFadeIn 0.2s ease;
}

@keyframes notifFadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.notifications-section-header,
.notifications-watchlist-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.notifications-section-title {
  color: #f0f6fc;
  font-size: 14px;
  font-weight: 700;
}

.notifications-section-subtitle,
.notifications-section-note {
  color: #7d8590;
  font-size: 12px;
  line-height: 1.35;
}

.notifications-section-subtitle {
  margin-top: 3px;
}

.notifications-section-note {
  margin-bottom: 10px;
}

.notifications-sound-row {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}

.notifications-sound-controls {
  display: flex;
  gap: 8px;
  align-items: center;
  flex: 1;
  max-width: 420px;
}

.notifications-modern-check,
.notifications-event-card {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.notifications-modern-check span {
  color: #d0d7de;
  font-weight: 600;
}

.notifications-modern-select {
  width: 100%;
  padding: 9px 10px;
  background: rgba(13, 17, 23, 0.78);
  border: 1px solid rgba(139, 148, 158, 0.28);
  color: #f0f6fc;
  border-radius: 9px;
  cursor: pointer;
}

.notifications-events-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.notifications-event-card {
  padding: 11px;
  border: 1px solid rgba(139, 148, 158, 0.18);
  border-radius: 11px;
  background: rgba(13, 17, 23, 0.52);
}

.notifications-event-card span {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.notifications-event-card strong {
  color: #d0d7de;
  font-size: 13px;
}

.notifications-event-card small {
  color: #7d8590;
  font-size: 11px;
}

.notifications-watchlist-section {
  border-color: rgba(46, 160, 67, 0.22);
  background:
    radial-gradient(circle at top right, rgba(46, 160, 67, 0.10), transparent 30%),
    linear-gradient(180deg, rgba(22, 27, 34, 0.86), rgba(13, 17, 23, 0.74));
}

.notifications-watchlist-title-row,
.notifications-watchlist-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.notifications-watchlist-header-actions {
  flex-shrink: 0;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.notifications-watchlist-count {
  padding: 4px 8px;
  border: 1px solid rgba(46, 160, 67, 0.28);
  border-radius: 999px;
  color: #9be9a8;
  background: rgba(46, 160, 67, 0.12);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.notifications-modal-actions {
  position: sticky;
  bottom: -12px;
  z-index: 5;
  display: flex;
  gap: 10px;
  margin: 16px -12px -12px;
  padding: 12px;
  border-top: 1px solid rgba(139, 148, 158, 0.18);
  background: linear-gradient(180deg, rgba(13, 17, 23, 0.82), rgba(13, 17, 23, 0.98));
  backdrop-filter: blur(10px);
}

.notifications-btn {
  padding: 10px 12px;
  border: 1px solid rgba(139, 148, 158, 0.22);
  border-radius: 10px;
  cursor: pointer;
  font-weight: 700;
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.notifications-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(139, 148, 158, 0.42);
}

.notifications-btn-primary {
  flex: 1;
  color: #e6edf3;
  background: rgba(56, 139, 253, 0.18);
  border-color: rgba(56, 139, 253, 0.34);
}

.notifications-btn-secondary {
  color: #c9d1d9;
  background: rgba(139, 148, 158, 0.12);
}

.notifications-btn-add {
  color: #d7f7df;
  background: rgba(46, 160, 67, 0.15);
  border-color: rgba(46, 160, 67, 0.34);
}

.notifications-btn-add-inline {
  width: auto;
  white-space: nowrap;
}

/* Dim unchecked notification event rows (global settings) */
#notifications-settings-modal label:has(input[type="checkbox"]:not(:checked)) {
  opacity: 0.2;
  transition: opacity 0.2s ease;
}

#notifications-settings-modal label:has(input[type="checkbox"]:checked) {
  opacity: 1;
  transition: opacity 0.2s ease;
}

/* Make row text more gray (not pure white) for better contrast with headers */
#notifications-settings-modal label span {
  color: #999;
}

/* =============================================================================
 * Notifications: Watchlist container centering (desktop)
 * ============================================================================= */
/* Center the watchlist rows and make them fit-content on desktop (wide modal) */
@media screen and (min-width: 1025px) {
  #notifications-watchlist-container {
    max-width: max-content;
    margin-left: auto;
    margin-right: auto;
  }
}

@media screen and (max-width: 820px) {
  .notifications-delivery-card {
    padding: 12px;
    border-radius: 12px;
  }

  .notifications-delivery-layout {
    grid-template-columns: 1fr;
  }

  .notifications-sound-row,
  .notifications-modal-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .notifications-sound-controls {
    max-width: none;
  }

  .notifications-events-grid {
    grid-template-columns: 1fr;
  }
}

/* Контейнер для кнопок таймфреймов и управления */
#chart-settings-content {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  /* padding-top = --cs-tab-raise чтобы кнопки (с transform: translateY(-raise))
     оказались впритык к нижнему краю шапки: raise - raise = 0 */
  padding: var(--cs-tab-raise) 6px 4px 6px;
  /* Скрытие скроллбара с сохранением прокрутки колесиком */
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE и Edge */
}

/* Вертикальное сжатие для chart-settings-toolbar */
#chart-settings-toolbar.compact #chart-settings-content {
  padding: var(--cs-tab-raise) 5px 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: var(--cs-tab-raise) 4px 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: var(--cs-tab-raise) 3px 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: nowrap;
  overflow: hidden;
  /* padding-top даёт место для transform translateY внутри overflow:hidden,
     margin-top компенсирует чтобы контейнер не сдвигался вниз */
  padding-top: var(--cs-tab-raise);
  padding-bottom: 0;
  padding-left: 0;
  padding-right: 0;
  margin-top: calc(-1 * var(--cs-tab-raise));
  /* Скрытие скроллбара с сохранением прокрутки колесиком */
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE и Edge */
  /* Убираем темную подложку у таймфреймов */
  background: transparent;
  border: none;
  border-radius: 0;
  /* Drag-scroll: не выделять текст при перетаскивании */
  user-select: none;
  -webkit-user-select: none;
  cursor: grab;
  /* Плавный скролл при программной прокрутке */
  scroll-behavior: smooth;
}

#timeframe-toolbar-content.dragging {
  cursor: grabbing;
  scroll-behavior: auto; /* Отключаем плавность при drag-скролле */
}

/* Скрытие кнопок таймфреймов, которые не помещаются целиком */
.tf-timeframe-btn.tf-clipped {
  visibility: hidden !important;
  pointer-events: none;
}

#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);
}

/* Стили для темной темы — управляются через CSS-переменные */

/* Draggable blocks — CSS variables */
.draggable {
  border: 1px solid var(--border-primary);
}
.draggable-header {
  background: var(--bg-header);
  border-bottom: 1px solid var(--border-primary);
  color: var(--text-primary);
}
.draggable table {
  color: var(--text-primary);
  background: transparent;
}
.draggable th,
.draggable td {
  border-bottom: 1px solid var(--border-table);
  color: var(--text-primary);
}
.draggable tbody tr:hover {
  background: var(--bg-hover);
}
#search-box {
  background: var(--bg-input);
  border: var(--border-input);
  color: var(--text-primary);
}
#balance-content {
  color: var(--accent-green);
}

#theme-toggle,
#palette-btn,
#fullscreen-toggle,
#login-btn,
#fetch-data-btn {
  background: var(--bg-button);
  color: var(--text-secondary);
  border: 1px solid var(--border-button);
}
#theme-toggle:hover,
#palette-btn:hover,
#fullscreen-toggle:hover,
#login-btn:hover,
#fetch-data-btn:hover {
  background: var(--bg-button-hover);
}

/* Theme-related tab, draggable, toolbar styles now use CSS variables in their base definitions above */

/* Settings buttons: CSS variables */
#settings-toolbar #settings-content button {
  background: var(--bg-button) !important;
  color: var(--text-secondary) !important;
  border-color: var(--border-button) !important;
}
#settings-toolbar #settings-content button:hover {
  background: var(--bg-button-hover) !important;
  border-color: var(--border-button-hover) !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: 6px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

/* ─── Кнопки перезапуска: общие стили ─── */
.admin-panel-buttons .restart-btn {
  position: relative;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
  letter-spacing: 0.3px;
  text-shadow: 0 1px 2px rgba(0,0,0,0.4);
}

/* Анимированный фон (бегущий градиент по рамке) */
.admin-panel-buttons .restart-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 8px;
  padding: 1px;
  background: conic-gradient(from var(--btn-angle, 0deg), transparent 40%, var(--btn-accent) 50%, transparent 60%);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  transition: opacity 0.4s ease;
  animation: restartBtnBorderSpin 3s linear infinite;
}

.admin-panel-buttons .restart-btn:hover::before {
  opacity: 1;
}

@property --btn-angle {
  syntax: '<angle>';
  initial-value: 0deg;
  inherits: false;
}

@keyframes restartBtnBorderSpin {
  to { --btn-angle: 360deg; }
}

/* ─── Полный перезапуск ─── */
#admin-restart-btn {
  --btn-accent: #ff4466;
  flex: 1;
  padding: 8px 12px;
  font-size: 11px;
  color: #fff;
  background: linear-gradient(135deg, #5c1a1a 0%, #8b2232 50%, #5c1a1a 100%);
  background-size: 200% 200%;
  box-shadow: 0 2px 8px rgba(255, 68, 102, 0.15), inset 0 1px 0 rgba(255,255,255,0.05);
}

#admin-restart-btn:hover {
  background-position: 100% 100%;
  box-shadow: 0 4px 20px rgba(255, 68, 102, 0.35), inset 0 1px 0 rgba(255,255,255,0.08);
  transform: translateY(-1px);
}

#admin-restart-btn:active {
  transform: translateY(1px);
  box-shadow: 0 1px 4px rgba(255, 68, 102, 0.2);
}

/* ─── Кнопки отдельных модулей ─── */
#admin-restart-autotrade-btn,
#admin-restart-notifications-btn {
  --btn-accent: #44aaff;
  padding: 6px 10px;
  font-size: 10px;
  color: #c8dff5;
  background: linear-gradient(135deg, #162a45 0%, #1e3a5f 50%, #162a45 100%);
  background-size: 200% 200%;
  box-shadow: 0 2px 6px rgba(68, 170, 255, 0.1), inset 0 1px 0 rgba(255,255,255,0.04);
}

#admin-restart-autotrade-btn:hover,
#admin-restart-notifications-btn:hover {
  background-position: 100% 100%;
  box-shadow: 0 3px 16px rgba(68, 170, 255, 0.25), inset 0 1px 0 rgba(255,255,255,0.06);
  color: #fff;
  transform: translateY(-1px);
}

#admin-restart-autotrade-btn:active,
#admin-restart-notifications-btn:active {
  transform: translateY(1px);
  box-shadow: 0 1px 3px rgba(68, 170, 255, 0.15);
}

/* ─── Состояние disabled (во время перезапуска) ─── */
.admin-panel-buttons .restart-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none !important;
  animation: restartBtnPulse 1.5s ease-in-out infinite;
}

@keyframes restartBtnPulse {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 0.9; }
}

/* ─── Кнопки управления Strategy Finder (стиль как .restart-btn) ─── */
.strategy-action-btn {
  position: relative;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
  letter-spacing: 0.3px;
  text-shadow: 0 1px 2px rgba(0,0,0,0.4);
  padding: 10px 12px;
  font-size: 12px;
}

/* Анимированный бордер (conic-gradient) */
.strategy-action-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 8px;
  padding: 1px;
  background: conic-gradient(from var(--btn-angle, 0deg), transparent 40%, var(--btn-accent) 50%, transparent 60%);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  transition: opacity 0.4s ease;
  animation: restartBtnBorderSpin 3s linear infinite;
}

.strategy-action-btn:hover::before {
  opacity: 1;
}

.strategy-action-btn:active {
  transform: translateY(1px);
}

.strategy-action-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

/* ─── Запустить поиск (зелёная) ─── */
#strategy-finder-start-btn {
  --btn-accent: #00ff88;
  color: #fff;
  background: linear-gradient(to top, #1a4a2a 0%, #2a7f4a 50%, #35955a 100%);
  box-shadow: 0 2px 8px rgba(0, 255, 136, 0.15), inset 0 1px 0 rgba(255,255,255,0.05);
}

#strategy-finder-start-btn:hover {
  box-shadow: 0 4px 20px rgba(0, 255, 136, 0.3), inset 0 1px 0 rgba(255,255,255,0.08);
  transform: translateY(-1px);
}

#strategy-finder-start-btn:active {
  box-shadow: 0 1px 4px rgba(0, 255, 136, 0.2);
}

/* Активный поиск: постоянное свечение бордера + пульсация */
#strategy-finder-start-btn.searching {
  pointer-events: none;
  opacity: 1;
  animation: strategySearchPulse 2s ease-in-out infinite;
}

#strategy-finder-start-btn.searching::before {
  opacity: 1;
}

@keyframes strategySearchPulse {
  0%, 100% { box-shadow: 0 2px 8px rgba(0, 255, 136, 0.2); }
  50% { box-shadow: 0 4px 24px rgba(0, 255, 136, 0.45); }
}

/* ─── Остановить (красная) ─── */
#strategy-finder-stop-btn {
  --btn-accent: #ff4466;
  color: #fff;
  background: linear-gradient(to top, #4a1a1a 0%, #7f2a2a 50%, #953535 100%);
  box-shadow: 0 2px 8px rgba(255, 68, 102, 0.12), inset 0 1px 0 rgba(255,255,255,0.05);
}

#strategy-finder-stop-btn:hover {
  box-shadow: 0 4px 20px rgba(255, 68, 102, 0.3), inset 0 1px 0 rgba(255,255,255,0.08);
  transform: translateY(-1px);
}

#strategy-finder-stop-btn:active {
  box-shadow: 0 1px 4px rgba(255, 68, 102, 0.2);
}

#strategy-finder-stop-btn:disabled {
  opacity: 0.35;
}

/* ─── Сброс (серая/нейтральная) ─── */
#strategy-finder-force-cleanup-btn {
  --btn-accent: #88aacc;
  color: #bbb;
  background: linear-gradient(to top, #252a30 0%, #3a4450 50%, #4a5565 100%);
  box-shadow: 0 2px 6px rgba(136, 170, 204, 0.08), inset 0 1px 0 rgba(255,255,255,0.03);
}

#strategy-finder-force-cleanup-btn:hover {
  box-shadow: 0 3px 16px rgba(136, 170, 204, 0.2), inset 0 1px 0 rgba(255,255,255,0.06);
  color: #fff;
  transform: translateY(-1px);
}

#strategy-finder-force-cleanup-btn:active {
  box-shadow: 0 1px 3px rgba(136, 170, 204, 0.15);
}

.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: 'JetBrains Mono', 'Courier New', monospace;
  font-size: 11px;
  box-sizing: border-box;
}

.admin-timeouts-container h4 {
  margin: 4px 0;
  font-size: 12px;
  color: var(--accent-green);
}

.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 scrollbar: uses .custom-scroll class */

/* 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: 'JetBrains Mono', 'Courier New', monospace;
  font-size: 11px;
  box-sizing: border-box;
  color: #ccc;
  white-space: pre-wrap;
}

/* admin-ws-subs-container scrollbar: uses .custom-scroll class */

/* Light theme tab buttons — via CSS variables above */

/* Chart control buttons: CSS variables */
.chart-control-btn,
.tf-timeframe-btn {
  background: var(--bg-button);
  border: 1px solid var(--border-primary);
  color: var(--text-secondary);
}
.chart-control-btn:hover,
.tf-timeframe-btn:hover {
  background: var(--bg-button-hover);
  border-color: var(--scrollbar-thumb-hover);
}

body:not(.dark-theme) .chart-control-btn.active,
body:not(.dark-theme) .tf-timeframe-btn.active {
  background: transparent;
  color: #000000;
  border-color: var(--accent-green);
  box-shadow: 0 0 8px rgba(0, 255, 170, 0.5), 0 0 16px rgba(0, 255, 170, 0.3);
  font-weight: bold;
}

/* Лейбл суммы сделки — CSS variable */
label[for="trade-amount"] {
  color: var(--text-primary) !important;
}

/* Стили для кликабельных лейблов USDT/% */
#stop-loss-unit, #take-profit-unit {
  transition: color 0.2s ease;
}

#stop-loss-unit:hover, #take-profit-unit:hover {
  color: var(--accent-green) !important;
}

body:not(.dark-theme) #stop-loss-unit:hover,
body:not(.dark-theme) #take-profit-unit:hover {
  color: #009966 !important;
}

/* Поля ввода: суммы сделки, Stop Loss, Take Profit — CSS variables */
#trade-amount {
  background: var(--bg-leverage) !important;
  border: 1px solid var(--border-leverage) !important;
  color: var(--text-primary) !important;
}

#stop-loss-input,
#take-profit-input {
  background: var(--bg-leverage) !important;
  border: 1px solid var(--border-leverage) !important;
  color: var(--text-primary) !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;
}

/* Стили для строки состояния под графиком в светлой теме */
#chart-footer {
  color: var(--text-primary) !important;
  border-top: 1px solid var(--border-table) !important;
}

#stats-bar {
  color: var(--text-primary) !important;
}

/* Стили для выбора плеча */
#trading-controls select {
  height: 35px;
  padding: 8px;
  font-size: 13px;
  line-height: 17px;
}

#leverage-select {
  background: var(--bg-leverage);
  border: 1px solid var(--border-leverage);
  color: var(--text-primary);
}
#leverage-select:hover {
  border-color: var(--scrollbar-thumb-hover);
}
#leverage-select:focus {
  outline: none;
  border-color: var(--accent-green);
  box-shadow: 0 0 5px rgba(0, 255, 170, 0.3);
}

/* Стили для модального окна — CSS variables */
.modal-content {
  background: linear-gradient(to bottom, transparent 0, transparent 50px, var(--bg-modal) 50px);
  border: 1px solid var(--border-modal);
  box-shadow: 0 0 6px rgba(128, 128, 128, 0.08), 0 4px 12px rgba(0, 0, 0, 0.15);
}
.modal-body {
  color: var(--text-primary);
}
.modal-header {
  background: var(--bg-modal-header);
  border-bottom: 1px solid var(--border-modal);
}
.modal-header h3 {
  color: var(--text-primary);
}
.close-modal {
  color: var(--text-muted);
}
.close-modal:hover {
  color: var(--text-primary);
}
.modal-body {
  color: var(--text-primary);
}
.indicator-item {
  border-bottom: 1px solid var(--border-table);
}
.indicator-name {
  color: var(--text-primary);
}
.added-indicator-item {
  border-bottom: 1px solid var(--border-table);
}
.saved-indicator-item {
  border-bottom: 1px solid var(--border-table);
}
.saved-indicator-item .indicator-info,
.indicator-info {
  color: var(--text-primary);
}
.no-indicators-message {
  color: var(--text-muted);
}
.modal-body input[type="text"],
.modal-body input[type="number"],
.modal-body select {
  background-color: var(--bg-modal);
  border: 1px solid var(--border-modal);
  color: var(--text-primary);
}
.modal-body label {
  color: var(--text-primary);
}

/* === Современные переключатели-чипы фильтров индикаторов === */
.filter-pill-btn {
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1) !important;
}
.filter-pill-btn:hover {
  background: rgba(255, 255, 255, 0.08) !important;
  border-color: rgba(255, 255, 255, 0.2) !important;
  color: #fff !important;
  transform: translateY(-1px);
}
.filter-pill-btn:has(#show-only-my-indicators:checked),
.filter-pill-btn.active-my {
  background: rgba(0, 255, 136, 0.16) !important;
  border-color: rgba(0, 255, 136, 0.5) !important;
  color: #00ff88 !important;
  box-shadow: 0 0 12px rgba(0, 255, 136, 0.25) !important;
}
.filter-pill-btn:has(#show-only-favorites:checked),
.filter-pill-btn.active-fav {
  background: rgba(255, 107, 107, 0.16) !important;
  border-color: rgba(255, 107, 107, 0.5) !important;
  color: #ff8e8e !important;
  box-shadow: 0 0 12px rgba(255, 107, 107, 0.25) !important;
}

/* === Красивые неоновые градиентные разделители блоков === */
.modal-neon-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(0, 255, 136, 0.4), rgba(77, 166, 255, 0.4), transparent);
  border: none;
  margin: 18px 0 14px 0;
  clear: both;
}

/* Удаление лишних двойных линий у последних элементов списков */
.indicator-item[data-indicator="custom-script"],
#basic-indicators-container .indicator-item:last-child,
#python-indicators-list .indicator-item:last-child,
#saved-pine-scripts-list .saved-script-item:last-child,
#added-indicators-list .added-indicator-item:last-child {
  border-bottom: none !important;
}



/* === СКРЫТЬ ВЕРТИКАЛЬНУЮ ПОЛОСУ ПРОКРУТКИ === */
html::-webkit-scrollbar,
body::-webkit-scrollbar {
  display: none;
}

html {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

body {
  -ms-overflow-style: none;
  scrollbar-width: none;
}
/* === КОНЕЦ СКРЫТИЯ ПОЛОСЫ ПРОКРУТКИ === */

/* Стили для панели управления сделками */
#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:not(#trading-page-toggle) {
  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:not(#trading-page-toggle) {
  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:not(#trading-page-toggle) {
  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:not(#trading-page-toggle) {
  flex: 1;
  padding: 12px 16px;
  font-family: 'Jura', sans-serif !important;
  font-size: 18px !important;
  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:not(#trading-page-toggle)::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:not(#trading-page-toggle):hover::before {
  width: 300px;
  height: 300px;
}

#trading-controls button:not(#trading-page-toggle):hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

#trading-controls button:not(#trading-page-toggle):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;
}

/* Стиль для кнопки "Сохранить" при изменении параметров авто-торговли */
#trading-controls #auto-trade-btn.modified {
  background: linear-gradient(135deg, rgba(255, 152, 0, 0.7) 0%, rgba(255, 111, 0, 0.7) 100%) !important;
  color: #000 !important;
  font-weight: 600;
  border: 1px solid rgba(255, 152, 0, 0.8) !important;
  animation: none !important;
}

#trading-controls #auto-trade-btn.modified:hover {
  background: linear-gradient(135deg, rgba(255, 167, 38, 0.85) 0%, rgba(255, 128, 0, 0.85) 100%) !important;
}

/* Состояние загрузки кнопки авто-торговли (оптимистичное обновление) */
#trading-controls #auto-trade-btn.loading {
  opacity: 0.7;
  pointer-events: none;
  position: relative;
}
#trading-controls #auto-trade-btn.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  right: 6px;
  width: 12px;
  height: 12px;
  margin-top: -6px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: autoTradeSpinner 0.6s linear infinite;
}
@keyframes autoTradeSpinner {
  to { transform: rotate(360deg); }
}

/* Анимация пульсации зелёной галочки предзагрузки монет */
@keyframes preload-pulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}

/* Скрытие стрелок спиннера у поля ввода суммы */
#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);
  }
}

/* Trading controls inputs: theme via CSS variables */
#trading-controls input[type="number"] {
  background: var(--bg-input);
  border: var(--border-input);
  color: var(--text-primary);
}

/* Убираем стрелки регулировки в полях ввода чисел */
#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;
}

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;
}


/* Стили для кнопок закрытия позиций */
.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);
}

/* Стили для кнопки закрытия ВСЕХ позиций в суммарной строке */
.close-all-positions-btn {
  background: rgba(255, 68, 68, 0.15);
  border: 1px solid rgba(255, 68, 68, 0.4);
  color: #ff4444;
  cursor: pointer;
  padding: 0;
  border-radius: 4px;
  transition: all 0.2s ease;
  font-size: 13px;
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.close-all-positions-btn:hover {
  background: rgba(255, 68, 68, 0.35);
  border-color: #ff4444;
  color: #ffffff;
  transform: scale(1.08);
}

.close-all-positions-btn:active {
  background: rgba(255, 68, 68, 0.55);
  transform: scale(0.95);
}

body:not(.dark-theme) .close-all-positions-btn {
  background: rgba(204, 0, 0, 0.1);
  border: 1px solid rgba(204, 0, 0, 0.35);
  color: #cc0000;
}

body:not(.dark-theme) .close-all-positions-btn:hover {
  background: rgba(204, 0, 0, 0.25);
  border-color: #cc0000;
  color: #990000;
}

/* Модальное окно индикаторов */
.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: linear-gradient(to bottom, transparent 0, transparent 50px, #1a1f27 50px);
  margin: 5% auto;
  padding: 0;
  border: 1px solid rgba(128, 128, 128, 0.15);
  border-radius: 6px;
  width: 80%;
  max-width: 500px;
  box-shadow: 0 0 6px rgba(128, 128, 128, 0.08), 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: var(--accent-green);
  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 {
  height: 50px;
  box-sizing: border-box;
  padding: 0 20px;
  background: var(--bg-header);
  border-bottom: 1px solid rgba(128, 128, 128, 0.15);
  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;
  overscroll-behavior: contain;
}

/* Header actions inside modal headers (e.g. extra buttons near close "x") */
.modal-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-header-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #ccc;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
  user-select: none;
}

.modal-header-btn:hover {
  background: rgba(255, 255, 255, 0.10);
  border-color: rgba(255, 255, 255, 0.18);
  color: #fff;
}

.modal-header-btn:active {
  transform: scale(0.98);
}

/* Notifications history modal */
#notifications-history-modal {
  z-index: 10001; /* above default .modal (10000) */
}

.notifications-history-table-wrap {
  max-height: 65vh;
  overflow: auto;
  border: 1px solid #333;
  border-radius: 4px;
  background: #0f141c;
}

.notifications-history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  table-layout: auto;
}

.notifications-history-table th,
.notifications-history-table td {
  padding: 8px 10px;
  border-bottom: 1px solid #222a36;
  color: #ccc;
  vertical-align: top;
  white-space: nowrap;
}

/* Колонка "Текст" (4-я) — перенос строк, ограничение ширины */
.notifications-history-table td:nth-child(4) {
  white-space: normal;
  word-break: break-word;
  max-width: 350px;
}

/* Колонка "Заголовок" (3-я) — тоже ограничиваем */
.notifications-history-table td:nth-child(3) {
  white-space: normal;
  word-break: break-word;
  max-width: 200px;
}

.notifications-history-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: rgba(30, 35, 45, 0.95);
  color: #ddd;
  font-weight: bold;
}

.notifications-history-table tbody tr:hover td {
  background: rgba(255, 255, 255, 0.04);
}

.notifications-history-symbol {
  color: var(--accent-green);
  cursor: pointer;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

.notifications-history-row-new td {
  background: rgba(0, 255, 136, 0.06);
}

.notifications-history-delete-btn {
  background: none;
  border: none;
  color: #666;
  font-size: 22px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 3px;
  line-height: 1;
  transition: color 0.15s, background 0.15s;
}
.notifications-history-delete-btn:hover {
  color: #ff4466;
  background: rgba(255, 68, 102, 0.12);
}
.notifications-history-delete-btn:disabled {
  opacity: 0.4;
  cursor: default;
}

/* Modal header buttons and notification table: use CSS variables for theme */
.modal-header-btn {
  background: var(--bg-button);
  border: 1px solid var(--border-button);
  color: var(--text-secondary);
}

.modal-header-btn:hover {
  background: var(--bg-button-hover);
  border-color: var(--border-button-hover);
  color: var(--text-primary);
}

.notifications-history-table-wrap {
  background: var(--bg-modal);
  border-color: var(--border-primary);
}

.notifications-history-table th,
.notifications-history-table td {
  color: var(--text-primary);
  border-bottom-color: var(--border-table);
}

.notifications-history-table thead th {
  background: var(--bg-header);
  color: var(--text-primary);
}

.notifications-history-symbol {
  color: var(--accent-green);
}

.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: var(--accent-green);
  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:not(#trading-page-toggle) {
    padding: 8px;
    font-size: 12px;
  }
  
  /* Адаптируем модальные окна для мобильных устройств */
  .modal-content {
    width: 95%;
    margin: 2% auto;
  }
  /* Модалка уведомлений — шире на телефоне (98% вместо 95%) */
  #notifications-settings-modal .modal-content {
    width: 98%;
    margin: 1% auto;
    max-width: 1500px;
  }
  
  .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: row;
    flex-wrap: nowrap;
    overflow: hidden;
  }
  
  #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 - горизонтальная прокрутка таймфреймов */
@container chart-settings (max-width: 500px) and (min-width: 300px) {
  #timeframe-toolbar-content {
    flex-direction: row;
    flex-wrap: nowrap;
    overflow: hidden;
  }
}

/* В широком режиме включаем «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 для блока настроек графика КОНЕЦ */
}

/* ======================= INDICATOR PRESETS SECTION ======================= */
.indicator-presets-section {
  margin-top: 16px;
  padding: 12px;
  background: rgba(255,255,255,0.03);
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.1);
}

.indicator-presets-section label {
  display: block;
  margin-bottom: 8px;
  color: #aaa;
  font-size: 12px;
}

.indicator-presets-section .preset-controls {
  display: flex;
  gap: 6px;
  align-items: center;
}

.indicator-presets-section select {
  flex: 1;
  padding: 6px 8px;
  background: #161b22;
  border: 1px solid #444;
  color: white;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
}

.indicator-presets-section select:hover {
  border-color: #666;
}

.indicator-presets-section select:focus {
  border-color: #58a6ff;
  outline: none;
}

.indicator-presets-section button {
  padding: 6px 10px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  color: white;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  transition: background 0.15s, opacity 0.15s;
}

.indicator-presets-section button:hover:not(:disabled) {
  filter: brightness(1.2);
}

.indicator-presets-section button:active:not(:disabled) {
  filter: brightness(0.9);
}

.indicator-presets-section button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Save button - blue */
.indicator-presets-section button[title*="Сохранить"] {
  background: #3d4a5a;
}

/* Delete button - red */
.indicator-presets-section button[title*="Удалить"] {
  background: #5a3d3d;
}
/* ======================= INDICATOR PRESETS SECTION END ======================= */

/* ======================= GRID SETTINGS EDITOR ======================= */
/* Иконка настроек рядом с чекбоксом индикатора */
.grid-settings-icon {
  cursor: pointer !important;
  font-size: 18px;
  color: #888;
  margin-left: 6px;
  padding: 4px 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.05);
  transition: color 0.2s, transform 0.2s, background 0.2s;
  user-select: none;
  -webkit-user-select: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.grid-settings-icon:hover {
  color: #4a9eff;
  background: rgba(74, 158, 255, 0.15);
  transform: scale(1.1);
}

/* Модальное окно */
.grid-editor-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.grid-editor-content {
  background: #1a1a2e;
  border: 1px solid #333;
  border-radius: 8px;
  width: 90%;
  max-width: 700px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.grid-editor-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 20px;
  border-bottom: 1px solid #333;
  background: #16213e;
  border-radius: 8px 8px 0 0;
}

.grid-editor-header h3 {
  margin: 0;
  color: #fff;
  font-size: 16px;
}

.grid-editor-close {
  background: none;
  border: none;
  color: #888;
  font-size: 24px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

.grid-editor-close:hover {
  color: #ff4444;
}

.grid-editor-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

.grid-editor-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 15px 20px;
  border-top: 1px solid #333;
  background: #16213e;
  border-radius: 0 0 8px 8px;
}

.grid-editor-btn {
  padding: 8px 16px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  transition: background 0.2s;
}

.grid-editor-btn-save {
  background: #2d5a3d;
  color: #fff;
}

.grid-editor-btn-save:hover {
  background: #3d7a4d;
}

.grid-editor-btn-cancel {
  background: #444;
  color: #ccc;
}

.grid-editor-btn-cancel:hover {
  background: #555;
}

.grid-editor-btn-reset {
  background: #5a3d3d;
  color: #fff;
  margin-right: auto;
}

.grid-editor-btn-reset:hover {
  background: #7a4d4d;
}

/* Таблица параметров */
.grid-param-table {
  width: 100%;
  border-collapse: collapse;
}

.grid-param-table th,
.grid-param-table td {
  padding: 10px;
  text-align: left;
  border-bottom: 1px solid #333;
}

.grid-param-table th {
  color: #888;
  font-size: 11px;
  font-weight: normal;
  text-transform: uppercase;
}

.grid-param-table td {
  color: #ccc;
  font-size: 12px;
}

.grid-param-name {
  font-weight: bold;
  color: #fff;
  min-width: 150px;
}

.grid-param-values {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.grid-param-value {
  background: #2a2a4a;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.grid-param-value-remove {
  cursor: pointer;
  color: #888;
  font-size: 14px;
  line-height: 1;
}

.grid-param-value-remove:hover {
  color: #ff4444;
}

.grid-param-add {
  display: flex;
  gap: 4px;
  align-items: center;
}

.grid-param-add input {
  width: 80px;
  padding: 4px 8px;
  background: #222;
  border: 1px solid #444;
  border-radius: 4px;
  color: #fff;
  font-size: 11px;
}

.grid-param-add input:focus {
  border-color: #4a9eff;
  outline: none;
}

.grid-param-add button {
  padding: 4px 8px;
  background: #2d5a3d;
  border: none;
  border-radius: 4px;
  color: #fff;
  cursor: pointer;
  font-size: 11px;
}

.grid-param-add button:hover {
  background: #3d7a4d;
}

/* Для boolean параметров */
.grid-param-bool {
  display: flex;
  gap: 10px;
}

.grid-param-bool label {
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  font-size: 11px;
}

.grid-param-bool input[type="checkbox"] {
  cursor: pointer;
}

/* Комбинации */
.grid-combinations-info {
  margin-top: 15px;
  padding: 10px;
  background: #16213e;
  border-radius: 4px;
  font-size: 12px;
  color: #888;
}

.grid-combinations-count {
  color: #4a9eff;
  font-weight: bold;
}

.grid-combinations-warning {
  color: #ffaa00;
}

/* Optuna формат - диапазоны параметров */
.grid-param-type {
  color: #888;
  font-size: 10px;
  text-transform: uppercase;
  width: 70px;
}

.grid-param-config {
  min-width: 300px;
}

.grid-param-range {
  display: flex;
  gap: 15px;
  align-items: center;
  flex-wrap: wrap;
}

.grid-param-range label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: #aaa;
}

.grid-param-range input {
  width: 80px;
  padding: 5px 8px;
  background: #222;
  border: 1px solid #444;
  border-radius: 4px;
  color: #fff;
  font-size: 12px;
}

.grid-param-range input:focus {
  border-color: #4a9eff;
  outline: none;
}

/* Categorical choices (Optuna) */
.grid-param-choices {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.grid-param-choice {
  background: #2a2a4a;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.grid-param-choice-remove {
  cursor: pointer;
  color: #888;
  font-size: 14px;
  line-height: 1;
}

.grid-param-choice-remove:hover {
  color: #ff4444;
}

.grid-param-add-choice {
  display: flex;
  gap: 4px;
  align-items: center;
}

.grid-param-add-choice input {
  width: 100px;
  padding: 4px 8px;
  background: #222;
  border: 1px solid #444;
  border-radius: 4px;
  color: #fff;
  font-size: 11px;
}

.grid-param-add-choice input:focus {
  border-color: #4a9eff;
  outline: none;
}

.grid-param-add-choice button {
  padding: 4px 8px;
  background: #2d5a3d;
  border: none;
  border-radius: 4px;
  color: #fff;
  cursor: pointer;
  font-size: 11px;
}

.grid-param-add-choice button:hover {
  background: #3d7a4d;
}

/* Условные параметры */
.grid-param-conditional {
  background: rgba(74, 158, 255, 0.05);
}

.grid-param-conditional td {
  padding-left: 25px;
}
/* ======================= GRID SETTINGS EDITOR END ======================= */

/* ======================= DRAWING TOOLS TOOLBAR ======================= */
#drawing-tools-toolbar {
  z-index: 100;
  min-width: 60px;
  background: transparent;
  border: 1px solid transparent;
  box-shadow: none;
  /* Предотвращаем выделение текста при перетаскивании на мобильных */
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  /* Предотвращаем вызов контекстного меню на мобильных */
  -webkit-touch-callout: none;
  /* Разрешаем touch-события для перетаскивания */
  touch-action: none;
}

#drawing-tools-toolbar .draggable-header {
  /* Дополнительная защита от выделения для шапки */
  user-select: none;
  -webkit-user-select: none;
  cursor: move;
  touch-action: none;
}

.drawing-tools-content {
  display: flex;
  flex-direction: row;
  justify-content: center;
  gap: 4px;
  padding: 6px 8px;
  flex-wrap: wrap;
}

.drawing-tool-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: var(--bg-button);
  border: 1px solid var(--border-button);
  border-radius: 4px;
  color: var(--text-secondary);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.drawing-tool-btn:hover {
  background: var(--bg-button-hover);
  border-color: var(--border-button-hover);
  color: var(--text-primary);
}

.drawing-tool-btn.active {
  background: rgba(0, 255, 170, 0.15);
  border-color: var(--accent-green);
  color: var(--accent-green);
  box-shadow: 0 0 8px rgba(0, 255, 170, 0.3);
}

.drawing-tool-btn.tool-danger {
  color: #ff6666;
}

/* Кастомная иконка луча (точка + линия) */
.ray-icon {
  display: inline-block;
  position: relative;
  width: 18px;
  height: 18px;
}

.ray-icon::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  width: 6px;
  height: 6px;
  background: currentColor;
  border-radius: 50%;
  transform: translateY(-50%);
}

.ray-icon::after {
  content: '';
  position: absolute;
  left: 6px;
  top: 50%;
  width: 12px;
  height: 2px;
  background: currentColor;
  transform: translateY(-50%);
}

/* Кастомная иконка вертикальной линии */
.vertical-line-icon {
  display: inline-block;
  width: 3px;
  height: 16px;
  background: currentColor;
  border-radius: 1px;
}

.drawing-tool-btn.tool-danger:hover {
  background: rgba(255, 68, 102, 0.2);
  border-color: #ff4466;
  color: #ff4466;
}

/* Drawing tool buttons: light theme uses CSS variables for base colors */
/* ======================= DRAWING TOOLS TOOLBAR END ======================= */

/* ======================= MONO FONT FOR NUMBERS ======================= */
#balance-amount,
#trade-amount,
#stop-loss-input,
#take-profit-input,
#leverage-select,
.price-cell,
.pnl-cell,
.size-cell,
.loading-pct,
#equity-curve-svg .eq-label,
.admin-timeouts-container input[type="number"] {
  font-family: 'JetBrains Mono', 'Courier New', monospace;
}

/* ===== Центр управления авто-торговлей ===== */

/* Сводка авто-торговли — мини-карточки */
.atc-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}
.atc-mini-card {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--bg-panel, #161b22);
  border: 1px solid var(--border-modal, #333);
  border-radius: 6px;
  flex: 1;
  min-width: 100px;
  transition: border-color 0.2s;
}
.atc-mini-card.green { border-left: 3px solid #00e68a; }
.atc-mini-card.red { border-left: 3px solid #ff4466; }
.atc-mini-card.blue { border-left: 3px solid #5b9fff; }
.atc-mini-card.gray { border-left: 3px solid #555; }
.atc-mini-card.muted { border-left: 3px solid #444; }
.atc-mini-icon {
  font-size: 16px;
  opacity: 0.5;
}
.atc-mini-card.green .atc-mini-icon { color: #00e68a; opacity: 0.8; }
.atc-mini-card.red .atc-mini-icon { color: #ff4466; opacity: 0.8; }
.atc-mini-card.blue .atc-mini-icon { color: #5b9fff; opacity: 0.8; }
.atc-mini-card.gray .atc-mini-icon { color: #888; opacity: 0.6; }
.atc-mini-card.muted .atc-mini-icon { color: #888; opacity: 0.5; }
.atc-mini-content {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}
.atc-summary-value {
  font-size: 18px;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
}
.atc-summary-value.green { color: #00e68a; }
.atc-summary-value.red { color: #ff4466; }
.atc-summary-value.blue { color: #5b9fff; }
.atc-summary-value.yellow { color: #ffcc44; }
.atc-summary-value.muted { color: #888; }
.atc-summary-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted, #888);
  margin-top: 2px;
  white-space: nowrap;
}
.atc-summary-pulse {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-right: 4px;
  animation: atcPulse 2s ease-in-out infinite;
  vertical-align: middle;
}
.atc-summary-pulse.green { background: #00e68a; box-shadow: 0 0 6px #00e68a; }
.atc-summary-pulse.red { background: #ff4466; box-shadow: 0 0 6px #ff4466; }
.atc-summary-pulse.gray { background: #555; }
@keyframes atcPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}
.atc-sub-items {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  margin-top: 6px;
}
.atc-sub-item {
  display: flex;
  align-items: center;
  gap: 5px;
}
.atc-sub-icon {
  font-size: 11px;
  opacity: 0.7;
}
.atc-sub-icon.green { color: #00e68a; }
.atc-sub-icon.blue { color: #5b9fff; }
.atc-sub-icon.muted { color: #888; }
.atc-sub-value {
  font-size: 15px;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
}
.atc-sub-value.green { color: #00e68a; }
.atc-sub-value.blue { color: #5b9fff; }
.atc-sub-value.muted { color: #888; }
.atc-sub-label {
  font-size: 10px;
  color: var(--text-muted, #888);
  white-space: nowrap;
}
.atc-summary-main {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: linear-gradient(135deg, rgba(0,255,170,0.08), rgba(91,159,255,0.06));
  border: 1px solid rgba(0,255,170,0.25);
  border-radius: 8px;
  flex: 1;
  box-shadow: 0 0 12px rgba(0,255,170,0.08);
}
.atc-summary-main-icon {
  font-size: 20px;
  color: #00e68a;
  opacity: 0.9;
  filter: drop-shadow(0 0 4px rgba(0,255,170,0.4));
}
.atc-summary-main-title {
  font-size: 15px;
  font-weight: 700;
  color: #00e68a;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.atc-loading {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted, #888);
  font-size: 14px;
}
.atc-loading i {
  margin-right: 6px;
}

.atc-empty {
  text-align: center;
  padding: 50px 20px;
  color: var(--text-muted, #888);
}
.atc-empty i {
  display: block;
  font-size: 40px;
  margin-bottom: 14px;
  opacity: 0.3;
}
.atc-empty p {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
}

.atc-card {
  background: var(--bg-panel, #161b22);
  border: 1px solid var(--border-modal, #333);
  border-radius: 6px;
  margin-bottom: 8px;
  overflow: hidden;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.atc-card:last-child {
  margin-bottom: 0;
}
.atc-card:hover {
  border-color: #555;
}
.atc-card.active {
  border-left: 3px solid #00e68a;
}
.atc-card.paused {
  border-left: 3px solid #ffaa00;
}
.atc-card.saved {
  border-left: 3px solid #555;
}

.atc-card-header {
  display: flex;
  align-items: center;
  padding: 6px 12px;
  gap: 8px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  cursor: pointer;
  user-select: none;
}
.atc-chevron {
  font-size: 10px;
  color: #666;
  transition: transform 0.2s;
  flex-shrink: 0;
}
.atc-chevron.open {
  transform: rotate(90deg);
}

.atc-symbol {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary, #e0e0e0);
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  letter-spacing: 0.3px;
}

.atc-status-badge {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 3px 8px;
  border-radius: 4px;
  line-height: 1;
}
.atc-status-badge.active {
  background: rgba(0, 230, 138, 0.15);
  color: #00e68a;
  border: 1px solid rgba(0, 230, 138, 0.3);
}
.atc-status-badge.paused {
  background: rgba(255, 170, 0, 0.15);
  color: #ffaa00;
  border: 1px solid rgba(255, 170, 0, 0.35);
}
.atc-status-badge.saved {
  background: rgba(150, 150, 150, 0.12);
  color: #999;
  border: 1px solid rgba(150, 150, 150, 0.25);
}

.atc-actions {
  margin-left: auto;
  display: flex;
  gap: 6px;
}

.atc-btn {
  padding: 5px 12px;
  font-size: 11px;
  font-weight: 500;
  border: 1px solid #444;
  border-radius: 4px;
  background: rgba(255,255,255,0.04);
  color: #ccc;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.atc-btn:hover {
  background: rgba(255,255,255,0.1);
  border-color: #666;
  color: #fff;
}
.atc-btn.danger {
  border-color: rgba(255, 80, 80, 0.4);
  color: #ff6b6b;
}
.atc-btn.danger:hover {
  background: rgba(255, 80, 80, 0.15);
  border-color: #ff6b6b;
}
.atc-btn.warning {
  border-color: rgba(255, 170, 0, 0.4);
  color: #ffaa00;
}
.atc-btn.warning:hover {
  background: rgba(255, 170, 0, 0.15);
  border-color: #ffaa00;
}
.atc-btn.success {
  border-color: rgba(0, 230, 138, 0.4);
  color: #00e68a;
}
.atc-btn.success:hover {
  background: rgba(0, 230, 138, 0.12);
  border-color: #00e68a;
}
.atc-btn.primary {
  border-color: rgba(80, 160, 255, 0.4);
  color: #5af;
}
.atc-btn.primary:hover {
  background: rgba(80, 160, 255, 0.12);
  border-color: #5af;
}
.atc-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.atc-card-body {
  padding: 6px 12px 8px;
}

.atc-params-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 3px 12px;
}

.atc-param {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.atc-param-label {
  font-size: 10px;
  color: var(--text-muted, #777);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.atc-param-value {
  font-size: 13px;
  color: var(--text-primary, #e0e0e0);
  font-weight: 500;
  font-family: 'JetBrains Mono', 'Courier New', monospace;
}
.atc-param-value.on {
  color: #00e68a;
}
.atc-param-value.off {
  color: #666;
}

/* Вкладки индикаторов в центре авто-торговли */
.atc-indicator-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.atc-indicator-tab {
  background: rgba(0,0,0,0.3);
  border: 1px solid #444;
  border-radius: 4px;
  color: #999;
  padding: 6px 12px;
  font-size: 11px;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.atc-indicator-tab:hover {
  border-color: #666;
  color: #ccc;
}
.atc-indicator-tab.active {
  border-color: #5af;
  color: #e0e0e0;
  background: rgba(90, 160, 255, 0.1);
}
.atc-indicator-tab-contents {
  position: relative;
}
.atc-indicator-tab-content {
  display: none;
}
.atc-indicator-tab-content.active {
  display: block;
}

.atc-indicator-section {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid rgba(255,255,255,0.06);
}
.atc-indicator-name {
  font-size: 12px;
  color: var(--text-primary, #ccc);
  font-weight: 600;
  margin-bottom: 3px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.atc-indicator-name i {
  opacity: 0.5;
  font-size: 11px;
}

.atc-preset-section {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}
.atc-preset-label {
  font-size: 11px;
  color: #888;
  white-space: nowrap;
}
.atc-preset-label i {
  margin-right: 4px;
  opacity: 0.6;
}
.atc-preset-select {
  background: rgba(0,0,0,0.3);
  border: 1px solid #444;
  border-radius: 4px;
  color: #e0e0e0;
  padding: 4px 8px;
  font-size: 11px;
  outline: none;
  cursor: pointer;
  transition: border-color 0.15s;
  max-width: 200px;
}
.atc-preset-select:hover {
  border-color: #666;
}
.atc-preset-select:focus {
  border-color: #5af;
}

.atc-indicator-settings {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.atc-ind-param {
  font-size: 11px;
  color: #999;
}
.atc-ind-param span {
  color: #ccc;
  font-family: 'JetBrains Mono', 'Courier New', monospace;
}

.atc-session-time {
  margin-top: 4px;
  font-size: 11px;
  color: #666;
}
.atc-session-time i {
  margin-right: 4px;
}

/* Инлайн-редактирование */
.atc-edit-panel {
  padding: 14px 16px;
  border-top: 1px solid rgba(80, 160, 255, 0.2);
  background: rgba(80, 160, 255, 0.03);
}

.atc-edit-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.atc-edit-field {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.atc-edit-field label {
  font-size: 10px;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.atc-edit-field input,
.atc-edit-field select {
  background: rgba(0,0,0,0.3);
  border: 1px solid #444;
  border-radius: 4px;
  color: #e0e0e0;
  padding: 6px 8px;
  font-size: 12px;
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  outline: none;
  transition: border-color 0.15s;
}
.atc-edit-field input:focus,
.atc-edit-field select:focus {
  border-color: #5af;
}

.atc-edit-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 6px;
}

.atc-edit-checkbox {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #ccc;
  cursor: pointer;
}
.atc-edit-checkbox input[type="checkbox"] {
  accent-color: #00e68a;
  width: 14px;
  height: 14px;
}

.atc-edit-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  justify-content: flex-end;
}

.atc-edit-indicators-section {
  margin-top: 10px;
  padding: 8px 10px;
  border: 1px solid rgba(80, 160, 255, 0.15);
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.2);
}
.atc-edit-indicators-label {
  font-size: 11px;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}
.atc-edit-indicators-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 8px;
}
.atc-edit-indicator-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 6px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 4px;
}
.atc-edit-indicator-name {
  font-size: 12px;
  color: #ccc;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.atc-edit-indicator-item .atc-btn.small {
  padding: 2px 6px;
  font-size: 10px;
  min-width: 0;
}
.atc-edit-add-indicator {
  display: flex;
  gap: 6px;
  align-items: center;
}
.atc-edit-add-indicator select {
  flex: 1;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background: #1e1e2f url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23aaa' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E") no-repeat right 10px center;
  background-size: 14px;
  border: 1px solid #3a3a55;
  border-radius: 6px;
  color: #ffffff;
  padding: 8px 34px 8px 12px;
  font-size: 13px;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  outline: none;
  cursor: pointer;
  transition: border-color 0.15s, background-color 0.15s, box-shadow 0.15s;
  color-scheme: dark;
}
.atc-edit-add-indicator select:focus {
  border-color: #5af;
  background-color: #252542;
  box-shadow: 0 0 0 2px rgba(80, 160, 255, 0.15);
}
.atc-edit-add-indicator select option {
  background: #1e1e2f;
  color: #ffffff;
  font-size: 13px;
  padding: 6px 10px;
}
.atc-edit-add-indicator select option:hover,
.atc-edit-add-indicator select option:focus {
  background: #2d2d4a;
}

.atc-edit-sl-tp {
  display: flex;
  gap: 6px;
  align-items: center;
}
.atc-edit-sl-tp input {
  flex: 1;
  min-width: 0;
}
.atc-edit-sl-tp select {
  width: 65px;
  flex-shrink: 0;
}

/* ==================== ATC GLOBAL CONTROL CARD ==================== */
.atc-global-card {
  background: linear-gradient(135deg, rgba(20, 26, 36, 0.95) 0%, rgba(15, 18, 25, 0.98) 100%);
  border: 1px solid rgba(80, 160, 255, 0.35);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4), 0 0 15px rgba(80, 160, 255, 0.08);
  border-radius: 8px;
  margin-bottom: 14px;
  overflow: hidden;
  transition: all 0.25s ease;
}
.atc-global-card.collapsed .atc-global-body {
  display: none;
}
.atc-global-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: rgba(80, 160, 255, 0.08);
  border-bottom: 1px solid rgba(80, 160, 255, 0.15);
  cursor: pointer;
  user-select: none;
  transition: background 0.15s;
}
.atc-global-header:hover {
  background: rgba(80, 160, 255, 0.12);
}
.atc-global-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}
.atc-global-icon {
  color: #5af;
  font-size: 15px;
}
.atc-global-title {
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.3px;
}
.atc-global-badge {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 4px;
  background: rgba(80, 160, 255, 0.18);
  color: #7ab8ff;
  border: 1px solid rgba(80, 160, 255, 0.35);
  letter-spacing: 0.6px;
}
.atc-global-toggle-btn {
  background: none;
  border: none;
  color: #8892b0;
  font-size: 12px;
  cursor: pointer;
  transition: transform 0.2s, color 0.2s;
  padding: 4px;
}
.atc-global-card.collapsed .atc-global-toggle-btn {
  transform: rotate(-90deg);
}
.atc-global-body {
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.atc-global-section {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 6px;
  padding: 10px 12px;
}
.atc-global-section-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: #8892b0;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.atc-global-actions-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.atc-global-action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 10px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
.atc-global-params-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 8px;
}
.atc-global-param-box {
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.05);
  padding: 8px;
  border-radius: 5px;
}
.atc-global-param-box label {
  font-size: 11px;
  color: #999;
}
.atc-global-input-group {
  display: flex;
  gap: 5px;
  align-items: center;
}
.atc-global-input-group input,
.atc-global-input-group select {
  flex: 1;
  min-width: 0;
  height: 28px;
  background: #11151c;
  border: 1px solid #333;
  color: #eee;
  padding: 0 8px;
  border-radius: 4px;
  font-size: 12px;
}
.atc-global-input-group select.atc-mode-select {
  flex: 0 0 65px;
}
.atc-global-apply-btn {
  height: 28px;
  padding: 0 10px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 4px;
  border: 1px solid rgba(80, 160, 255, 0.4);
  background: rgba(80, 160, 255, 0.12);
  color: #7ab8ff;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
}
.atc-global-apply-btn:hover {
  background: rgba(80, 160, 255, 0.25);
  border-color: #5af;
  color: #fff;
}
.atc-global-toggles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px;
}
.atc-global-toggle-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.05);
  padding: 6px 10px;
  border-radius: 5px;
}
.atc-global-toggle-label {
  font-size: 12px;
  color: #ccc;
}
.atc-global-toggle-actions {
  display: flex;
  gap: 4px;
}
.atc-global-toggle-btn-on {
  padding: 3px 8px;
  font-size: 10px;
  font-weight: 600;
  border: 1px solid rgba(0, 230, 138, 0.4);
  background: rgba(0, 230, 138, 0.1);
  color: #00e68a;
  border-radius: 3px;
  cursor: pointer;
}
.atc-global-toggle-btn-on:hover {
  background: rgba(0, 230, 138, 0.25);
}
.atc-global-toggle-btn-off {
  padding: 3px 8px;
  font-size: 10px;
  font-weight: 600;
  border: 1px solid rgba(255, 80, 80, 0.4);
  background: rgba(255, 80, 80, 0.1);
  color: #ff6b6b;
  border-radius: 3px;
  cursor: pointer;
}
.atc-global-toggle-btn-off:hover {
  background: rgba(255, 80, 80, 0.25);
}
.atc-global-ind-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.atc-global-ind-row select {
  flex: 1;
  min-width: 160px;
  height: 32px;
  background: #11151c;
  border: 1px solid #333;
  color: #eee;
  padding: 0 10px;
  border-radius: 4px;
  font-size: 12px;
}
.atc-global-progress {
  padding: 8px 12px;
  border-radius: 4px;
  background: rgba(80, 160, 255, 0.15);
  border: 1px solid rgba(80, 160, 255, 0.3);
  color: #7ab8ff;
  font-size: 12px;
  display: none;
  align-items: center;
  gap: 8px;
}

@media (max-width: 600px) {
  .atc-params-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .atc-edit-grid {
    grid-template-columns: 1fr;
  }
  .atc-card-header {
    flex-wrap: wrap;
  }
}

/* ======================= BALANCE LOADING ANIMATION ======================= */
.balance-loading-shimmer {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 14px;
  font-weight: bold;
}

.balance-loading-shimmer .shimmer-dollar {
  color: rgba(0, 255, 170, 0.4);
}

.balance-loading-shimmer .shimmer-bar {
  display: inline-block;
  width: 60px;
  height: 14px;
  border-radius: 4px;
  background: linear-gradient(
    90deg,
    rgba(0, 255, 170, 0.08) 0%,
    rgba(0, 255, 170, 0.25) 40%,
    rgba(0, 255, 170, 0.08) 80%
  );
  background-size: 200% 100%;
  animation: balance-shimmer 1.4s ease-in-out infinite;
}

@keyframes balance-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.balance-loading-dots {
  display: inline-flex;
  gap: 3px;
  margin-left: 2px;
}

.balance-loading-dots span {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #00ffaa;
  opacity: 0.3;
  animation: balance-dot-pulse 1.2s ease-in-out infinite;
}

.balance-loading-dots span:nth-child(2) { animation-delay: 0.15s; }
.balance-loading-dots span:nth-child(3) { animation-delay: 0.3s; }

@keyframes balance-dot-pulse {
  0%, 80%, 100% { opacity: 0.15; transform: scale(0.8); }
  40% { opacity: 1; transform: scale(1.2); }
}
/* ======================= BALANCE LOADING ANIMATION END ======================= */

/* ======================= STRATEGY FINDER RECORDS ======================= */
@property --sf-record-angle {
  syntax: '<angle>';
  initial-value: 0deg;
  inherits: true;
}

@keyframes sfRecordSpin {
  from { --sf-record-angle: 0deg; }
  to { --sf-record-angle: 360deg; }
}

#strategy-finder-results-body,
#strategy-finder-worst-body,
#strategy-combined-body {
  animation: sfRecordSpin 2.5s linear infinite;
}

.sf-record-best, .sf-record-worst {
  position: relative;
  border: none !important;
}

.sf-record-best::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 4px;
  padding: 0.8px;
  background: conic-gradient(from var(--sf-record-angle, 0deg), transparent 30%, #ffd700 50%, transparent 70%);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

.sf-record-worst::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 4px;
  padding: 0.8px;
  background: conic-gradient(from var(--sf-record-angle, 0deg), transparent 30%, #ff4466 50%, transparent 70%);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}
/* ======================= STRATEGY FINDER RECORDS END ======================= */

/* ======================= TRADING PANEL TWO-PAGE ======================= */
#trading-controls {
  padding: 15px;
  display: flex;
  flex-direction: column;
}

/* Страницы торговой панели — скрыты по умолчанию */
.trading-page {
  display: none;
  animation: tradingPageIn 0.22s ease;
}

/* Активная страница */
.trading-page--active {
  display: block;
}

@keyframes tradingPageIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Кнопка переключения — жёсткие !important чтобы перебить #trading-controls button:not(#trading-page-toggle) */
#trading-page-toggle.trading-page-toggle-btn {
  display: flex !important;
  flex: none !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 6px !important;
  width: 100% !important;
  margin-top: 12px !important;
  padding: 7px 10px !important;
  background: rgba(255, 255, 255, 0.04) !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  border-radius: 4px !important;
  color: #888 !important;
  font-size: 12px !important;
  font-family: 'Inter', Arial, sans-serif !important;
  font-weight: 500 !important;
  cursor: pointer !important;
  transition: background 0.18s, border-color 0.18s, color 0.18s !important;
  letter-spacing: 0.3px !important;
  box-shadow: none !important;
  transform: none !important;
  position: static !important;
  overflow: visible !important;
}

#trading-page-toggle.trading-page-toggle-btn::before {
  display: none !important;
}

#trading-page-toggle.trading-page-toggle-btn:hover {
  background: rgba(255, 255, 255, 0.09) !important;
  border-color: rgba(255, 255, 255, 0.22) !important;
  color: #ccc !important;
  transform: none !important;
  box-shadow: none !important;
}

/* Вид кнопки «← Назад» */
#trading-page-toggle.trading-page-toggle-btn.trading-page-toggle-btn--back {
  background: rgba(0, 230, 138, 0.06) !important;
  border-color: rgba(0, 230, 138, 0.22) !important;
  color: #00e68a !important;
}

#trading-page-toggle.trading-page-toggle-btn.trading-page-toggle-btn--back:hover {
  background: rgba(0, 230, 138, 0.13) !important;
  border-color: rgba(0, 230, 138, 0.45) !important;
  color: #00ff99 !important;
}
/* ======================= TRADING PANEL TWO-PAGE END ======================= */

/* ======================= НЕОНОВЫЕ ФОНЫ ======================= */

/* Неон Синий — медленный сине-фиолетовый перелив */
body.bg-neon-blue {
  background: linear-gradient(135deg, #1a1a3a, #2a2a5a, #3a2a6a, #2a2a5a, #1a1a3a) !important;
  background-size: 400% 400% !important;
  animation: bg-neon-blue-shift 45s ease-in-out infinite;
}
@keyframes bg-neon-blue-shift {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* Неон Зелёный — медленный зелёно-бирюзовый перелив */
body.bg-neon-green {
  background: linear-gradient(135deg, #1a2a1f, #2a3f2f, #2a4a3a, #2a3f2f, #1a2a1f) !important;
  background-size: 400% 400% !important;
  animation: bg-neon-green-shift 50s ease-in-out infinite;
}
@keyframes bg-neon-green-shift {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* Неон Закат — медленный розово-оранжевый перелив */
body.bg-neon-sunset {
  background: linear-gradient(135deg, #2a1a1f, #3a2a2a, #4a2a2a, #3a2a2a, #2a1a1f) !important;
  background-size: 400% 400% !important;
  animation: bg-neon-sunset-shift 55s ease-in-out infinite;
}
@keyframes bg-neon-sunset-shift {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* Неон Радуга — очень медленная смена всех цветов спектра */
body.bg-neon-rainbow {
  background: linear-gradient(135deg, #1a1a2a, #2a1a3a, #1a2a3a, #1a3a2a, #2a3a1a, #3a2a1a, #3a1a2a, #1a1a2a) !important;
  background-size: 400% 400% !important;
  animation: bg-neon-rainbow-shift 90s ease-in-out infinite;
}
@keyframes bg-neon-rainbow-shift {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* Своя картинка как фон */
body.bg-custom {
  background-size: cover !important;
  background-position: center !important;
  background-repeat: no-repeat !important;
  background-attachment: fixed !important;
}

/* Подсветка активной кнопки пресета фона */
.bg-preset-btn.active-bg {
  border-color: #00ffaa !important;
  box-shadow: 0 0 8px rgba(0, 255, 170, 0.4) !important;
}

/* Trailing Stop choice modal */
#ts-choice-indicator-label:has(input:checked),
#ts-choice-exchange-label:has(input:checked) {
  border-color: #4a9eff !important;
  background: #1a2845 !important;
}

/* ======================= EXTRA SETTINGS MODAL BUTTONS ======================= */
#fullscreen-auto-settings-modal .modal-header .close-modal {
  cursor: pointer;
  color: #888;
  font-size: 20px;
  line-height: 1;
  transition: color 0.15s ease, transform 0.15s ease;
}

#fullscreen-auto-settings-modal .modal-header .close-modal:hover {
  color: #fff;
  transform: scale(1.15);
}

#fullscreen-auto-settings-modal .modal-header .close-modal:active {
  transform: scale(0.9);
}

.extra-settings-select {
  width: 100%;
  padding: 8px 10px;
  background: #161b22;
  color: #fff;
  border: 1px solid #444;
  border-radius: 4px;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.extra-settings-select:focus {
  border-color: #2f6994;
  box-shadow: 0 0 6px rgba(47, 105, 148, 0.4);
}

.extra-settings-btn {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 4px;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease, border-color 0.15s ease, filter 0.15s ease;
}

.extra-settings-btn:hover {
  filter: brightness(1.18);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.extra-settings-btn:active {
  transform: scale(0.96) translateY(1px);
  filter: brightness(0.92);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.extra-settings-btn-warning {
  background: #7f5a2a;
  border-color: #9c6e33;
  color: #fff;
  font-weight: 600;
  padding: 10px 14px;
}
.extra-settings-btn-warning:hover {
  background: #8e6530;
  border-color: #b5803d;
  box-shadow: 0 0 10px rgba(181, 128, 61, 0.35);
}

.extra-settings-btn-primary {
  background: #2a5a7f;
  border-color: #3b7ba8;
}
.extra-settings-btn-primary:hover {
  border-color: #4a94c9;
  box-shadow: 0 0 10px rgba(59, 123, 168, 0.4);
}

.extra-settings-btn-success {
  background: #2a7f4a;
  border-color: #38a863;
}
.extra-settings-btn-success:hover {
  border-color: #45c475;
  box-shadow: 0 0 10px rgba(56, 168, 99, 0.4);
}

.extra-settings-btn-secondary {
  background: #50565e;
  border-color: #656c75;
}
.extra-settings-btn-secondary:hover {
  border-color: #7b848f;
  box-shadow: 0 0 8px rgba(100, 110, 120, 0.3);
}

.extra-settings-btn-danger {
  background: #7f2a2a;
  border-color: #a83838;
}
.extra-settings-btn-danger:hover {
  border-color: #c94444;
  box-shadow: 0 0 10px rgba(168, 56, 56, 0.4);
}

.extra-settings-btn-toggle {
  background: #444b54;
  border-color: #555d67;
  color: #ddd;
}
.extra-settings-btn-toggle.is-active {
  background: #257849;
  border-color: #38a863;
  color: #fff;
  box-shadow: 0 0 8px rgba(56, 168, 99, 0.35);
}
.extra-settings-btn-toggle.is-active:hover {
  background: #2d8d57;
  border-color: #45c475;
  box-shadow: 0 0 12px rgba(56, 168, 99, 0.5);
}

.extra-settings-btn-close {
  background: #3e444c;
  border-color: #505863;
  color: #ccc;
  padding: 10px;
}
.extra-settings-btn-close:hover {
  background: #4a515a;
  color: #fff;
  border-color: #646d7a;
}

/* Анимация кратковременного отклика на клик */
.extra-settings-btn-flash {
  animation: extraBtnSuccessFlash 0.9s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes extraBtnSuccessFlash {
  0% {
    transform: scale(0.95);
    filter: brightness(1.4);
    box-shadow: 0 0 14px rgba(0, 255, 170, 0.8), inset 0 0 8px rgba(0, 255, 170, 0.4);
    border-color: #00ffaa;
  }
  40% {
    transform: scale(1.02);
    filter: brightness(1.25);
    box-shadow: 0 0 10px rgba(0, 255, 170, 0.5);
    border-color: #00ffaa;
  }
  100% {
    transform: scale(1);
    filter: brightness(1);
  }
}
/* ======================= EXTRA SETTINGS MODAL BUTTONS END ======================= */

