/* ============================================================
   ГЛОБАЛЬНЫЕ БАЗОВЫЕ СТИЛИ
   ============================================================ */
*, *::before, *::after {
    user-select: none !important;
    -webkit-user-select: none !important;
}
input, textarea, [contenteditable] {
    user-select: text !important;
    -webkit-user-select: text !important;
}
html { background-color: #0f0f0f; }

/* Фон чипа названия индикатора на графике (.study-legend-row) — общий токен для топбара */
:root {
    --study-legend-row-bg: rgba(19, 23, 34, 0.92);
}

/* Dash renderer: hide English "Loading..." before HYDRATED; match #app-loader look */
._dash-loading {
    position: fixed;
    inset: 0;
    z-index: 99998;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #0b0e11;
    color: transparent !important;
    font-size: 0 !important;
    line-height: 0 !important;
    overflow: hidden;
}
._dash-loading::after {
    content: "";
    display: block;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 3px solid #2b3139;
    border-top-color: #848e9c;
    animation: spin 0.8s linear infinite;
}

body {
    margin: 0;
    background: transparent;
    font-family: 'Roboto', sans-serif;
    overflow: hidden;
    color: #eee;
    touch-action: none;
    height: 100dvh;
}
body::before {
    content: "";
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(to top, #001401 65%, #0f0f0f 100%);
    z-index: -1;
    pointer-events: none;
}
/* Нативные скроллбары скрыты везде — кастомный JS-thumb (.oki-custom-thumb) заменяет их глобально */
html { scrollbar-width: none !important; }
::-webkit-scrollbar { width: 0 !important; height: 0 !important; display: none !important; }

/* Скроллбар таблицы ордеров — кастомный, реализован JS-ом в auth.js (.oki-custom-thumb).
   Здесь только базовый overflow. Нативный скроллбар скрыт через JS-инжект. */
#trades-scroll-area {
    overflow-y: auto;
    overflow-x: hidden;
}

/* ============================================================
   LAYOUT
   ============================================================ */
.main-body {
    display: flex;
    flex: 1;
    min-height: 0;
    flex-direction: row;
}
.charts-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
}
#price-container  { width: 100%; position: relative; flex: 72 1 0%; min-height: 0; background: transparent; }
#gd-container     { width: 100%; position: relative; flex: 14 1 0%; min-height: 20px; background: transparent; overflow: hidden; }
#macd-container   { width: 100%; position: relative; flex: 14 1 0%; min-height: 20px; background: transparent; overflow: hidden; }
#rsi-container    { width: 100%; position: relative; flex: 14 1 0%; min-height: 20px; background: transparent; overflow: hidden; }

/* ============================================================
   RESIZER
   ============================================================ */
.resizer {
    height: 1px;
    background-color: rgba(255,255,255,0.15);
    background-clip: content-box;
    cursor: row-resize;
    z-index: 100;
    position: relative;
    padding: 4px 0;
    margin: -4px 0;
}
.resizer:hover, .resizer.dragging { background-color: #0ecb81 !important; }
.resizer-vertical {
    width: 1px;
    background-color: rgba(255,255,255,0.15);
    cursor: col-resize;
    z-index: 100;
    position: relative;
    padding: 0 5px;
    margin: 0 -5px;
    background-clip: content-box;
    transition: background-color 0.1s;
    touch-action: none;
    -webkit-tap-highlight-color: transparent;
}
.resizer-vertical:hover, .resizer-vertical.dragging { background-color: #0ecb81 !important; }

/* ============================================================
   SYMBOL BUTTON & MODAL
   ============================================================ */
#top-bar { border-bottom: 2px solid #2b3139; }
#symbol-btn:hover { background: rgba(255,255,255,0.05); border-radius: 6px; }

.topbar-undo-redo {
    display: flex;
    align-items: center;
    gap: 10px;
    height: 100%;
    padding: 0 6px 0 2px;
    flex-shrink: 0;
    box-sizing: border-box;
}
.topbar-undo-redo-sep {
    width: 1px;
    height: 22px;
    background: rgba(255, 255, 255, 0.14);
    flex-shrink: 0;
}
#undo-btn, #redo-btn {
    flex-shrink: 0;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    transition: filter 0.12s ease;
}
#undo-btn:hover, #redo-btn:hover {
    filter: brightness(1.2);
}

/* Правая полоса: TF | индикаторы | отмена/повтор → авторизация справа */
#topbar-controls {
    flex: 1;
    min-width: 0;
    margin-left: 6px;
    padding-left: 8px;
    border-left: 1px solid rgba(255, 255, 255, 0.16);
    gap: 6px;
    --topbar-pill-bg: #161a1e;
    --topbar-pill-hover: rgba(30, 34, 46, 0.98);
    --topbar-pill-active: rgb(15, 18, 28);
}
#topbar-controls #auth-btn {
    margin-left: auto;
}
/* Кнопка авторизации — тот же размер и фон, что TF / тип графика / индикаторы */
#topbar-controls #auth-btn.auth-top-btn {
    width: 32px;
    height: 32px;
    min-height: 32px;
    box-sizing: border-box;
    border-radius: 4px;
    border: none;
    background-color: var(--topbar-pill-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: background-color 0.15s ease;
}
#topbar-controls #auth-btn.auth-top-btn:hover {
    background-color: var(--topbar-pill-hover);
}
#topbar-controls #auth-btn.auth-top-btn:active {
    background-color: var(--topbar-pill-active);
}
#notif-btn:hover  { background: rgba(255,255,255,0.05) !important; }
#sym-modal-overlay {
    display: none; position: fixed; inset: 0; z-index: 10000;
    background: rgba(0,0,0,0.65); align-items: flex-start;
    justify-content: center; padding-top: 60px;
}
#sym-modal {
    background: #1f1f1f; border-radius: 10px;
    width: min(560px,96vw); max-height: 70vh;
    display: flex; flex-direction: column;
    box-shadow: 0 8px 40px rgba(0,0,0,0.8); overflow: hidden;
}
.sym-modal-header {
    padding: 14px 16px 10px; border-bottom: 1px solid #2a2e39;
    display: flex; align-items: center; gap: 10px;
}
.sym-modal-header svg { flex-shrink: 0; }
#sym-search {
    flex: 1; background: none; border: none; outline: none;
    color: #d1d4dc; font-size: 15px; font-family: inherit;
}
#sym-search::placeholder { color: #4a505e; }
#sym-close {
    background: none; border: none; color: #848e9c; cursor: pointer;
    font-size: 22px; line-height: 1; padding: 0 2px;
}
#sym-list {
    overflow-y: auto; flex: 1;
    scrollbar-width: none !important;
}
#sym-list::-webkit-scrollbar { width: 0 !important; display: none !important; }
.sym-row {
    display: flex; align-items: center; padding: 10px 16px;
    cursor: pointer; border-bottom: 1px solid #1e222d; gap: 12px;
}
.sym-row-active { background: transparent; border-radius: 5px; outline: 1px solid rgba(255,255,255,0.35); outline-offset: -1px; }
.sym-row-active:hover { background: #1e222d; }
.sym-icon-wrap {
    width: 20px; height: 20px; display: inline-flex;
    align-items: center; justify-content: center; flex-shrink: 0;
}
.sym-coin-img { width: 18px; height: 18px; border-radius: 50%; display: none; }
.sym-coin-fallback {
    width: 18px; height: 18px; border-radius: 50%; background: #2b3139;
    color: #d1d4dc; font-size: 10px; font-weight: 700;
    display: none; align-items: center; justify-content: center;
}
.sym-name { font-size: 13px; font-weight: 600; color: #d1d4dc; min-width: 110px; }
.sym-base { font-size: 12px; color: #848e9c; flex: 1; }
.sym-vol  { font-size: 11px; color: #848e9c; min-width: 48px; text-align: right; }
.sym-empty { color: #848e9c; padding: 24px; text-align: center; font-size: 13px; }
#sym-filter-bar {
    display: flex;
    gap: 6px;
    padding: 8px 12px 4px;
    border-bottom: 1px solid #1e2130;
}
.sym-filter-btn {
    padding: 3px 10px;
    border: 1px solid #363a45;
    border-radius: 4px;
    background: transparent;
    color: #aaa;
    cursor: pointer;
    font-size: 11px;
}
.sym-filter-btn.active {
    background: #2962ff;
    border-color: #2962ff;
    color: #fff;
}

/* ============================================================
   STATUS ICONS
   ============================================================ */
.status-icon { width: 18px; height: 18px; border-radius: 4px; margin-right: 8px; }
.status-on  { border: 2.5px solid #00ff88; padding: 1px; }
.status-off { border: 2.5px solid #f6465d; filter: grayscale(1); opacity: 0.5; padding: 1px; }

/* ============================================================
   DASH TABLE
   ============================================================ */
.dash-table-container tr:first-child { display: none; }
.dash-table-container .dash-spreadsheet-container .dash-spreadsheet-inner img {
    height: 16px !important; width: 16px !important; vertical-align: middle; border-radius: 3px;
}
.dash-spreadsheet td, .dash-spreadsheet th { padding: 2px 4px !important; height: auto !important; line-height: 12px !important; }

/* ============================================================
   TOOLBAR
   ============================================================ */
.toolbar {
    order: -1;
    width: 52px;
    min-width: 52px;
    background-color: #0f0f0f;
    border-right: 2px solid #2b3139;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 10px;
    z-index: 50;
}
.tool-btn {
    width: 32px;
    height: 32px;
    border-radius: 4px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    color: #848e9c;
    margin-bottom: 8px;
    transition: all 0.1s ease;
    position: relative;
}
.tool-btn:hover { background-color: #2b3139; color: #fff; }
.tool-btn.active { background-color: #2b3139; color: #d1d4dc; }
/* Один визуальный размер глифа внутри кнопок 32×32 (inline-стили в main.py переопределяются) */
.toolbar img {
    object-fit: contain;
    display: block;
    flex-shrink: 0;
}
.toolbar-separator {
    width: 24px;
    height: 1px;
    margin: 2px 0 10px;
    background: rgba(255, 255, 255, 0.18);
}
.toolbar-trash-group { margin-bottom: 0; }
.toolbar-trash-btn { margin-bottom: 0 !important; color: #848e9c; }
.toolbar-trash-btn:hover,
.toolbar-trash-btn.open {
    background-color: #2b3139;
    color: #fff;
}
.toolbar-trash-submenu { min-width: 280px; }
.toolbar-clear-all-btn:hover .tv-submenu-item-label { color: #ffffff; }

.toolbar-right {
    width: 52px;
    min-width: 52px;
    background-color: #0f0f0f;
    border-left: 2px solid #2b3139;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 10px;
    z-index: 50;
    flex-shrink: 0;
}
#btn-toggle-table img { filter: invert(0.6); transition: filter 0.1s; }
#btn-toggle-table.active img { filter: invert(1) sepia(1) saturate(3) hue-rotate(100deg) brightness(1.1); }
#btn-toggle-table:hover img { filter: invert(1); }
#toolbar .tool-btn img { opacity: 0.5 !important; transition: opacity 0.1s; }
#toolbar .tool-btn.active img,
#toolbar .tool-btn:hover img,
#toolbar .tv-group-btn:hover img { opacity: 1 !important; }

/* ============================================================
   TOOL GROUP & SUBMENU (из chart.js, авторитетная версия)
   ============================================================ */
.tv-tool-group {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    margin-bottom: 4px;
}
.tv-group-btn {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 4px;
    cursor: pointer;
    transition: 0.1s;
    position: relative;
    color: #848e9c;
}
.tv-group-btn:hover, .tv-group-btn.active { background: #2a2e39; color: #fff; }

.tv-submenu-arrow {
    position: absolute;
    right: -10px;
    top: 0;
    width: 10px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
    opacity: 0;
    border-radius: 3px 0 0 3px;
    cursor: pointer;
    transition: opacity 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}
.tv-submenu-arrow::after {
    content: '';
    display: block;
    width: 4px;
    height: 4px;
    border-top: 1.5px solid #848e9c;
    border-right: 1.5px solid #848e9c;
    transform: rotate(45deg);
    transition: transform 0.2s ease, border-color 0.2s ease;
}
.tv-group-btn:hover .tv-submenu-arrow { opacity: 1; }
.tv-submenu-arrow:hover { background: rgba(255,255,255,0.12) !important; opacity: 1 !important; }
.tv-submenu-arrow:hover::after { border-color: #ffffff; }
.tv-submenu-arrow.open { opacity: 1; background: rgba(255,255,255,0.08); box-shadow: inset 0 0 0 1px rgba(255,255,255,0.3); }
.tv-submenu-arrow.open::after,
.tool-btn.menu-open .tv-submenu-arrow::after {
    transform: rotate(-135deg);
    border-color: #ffffff;
}

.tv-submenu {
    display: none;
    position: absolute;
    left: 100%;
    top: 0;
    margin-left: 6px;
    background: #1f1f1f;
    border-radius: 5px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.7);
    padding: 4px 0;
    z-index: 10000;
    flex-direction: column;
    min-width: 240px;
}
.tv-submenu.active { display: flex; }

.tv-submenu-header {
    padding: 8px 12px 4px;
    font-size: 11px;
    font-weight: 600;
    color: #787b86;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    user-select: none;
}

.tv-submenu-separator {
    height: 1px;
    background: #434651;
    margin: 4px 0;
}

.tv-submenu-item {
    display: flex;
    align-items: center;
    padding: 0 8px;
    margin: 0 4px;
    height: 36px;
    cursor: pointer;
    font-size: 13px;
    color: #d1d4dc;
    white-space: nowrap;
    border-radius: 4px;
    transition: background-color 0.1s ease, color 0.1s ease;
}
.tv-submenu-item:hover { background: #2a2e39; color: #ffffff; }
.tv-submenu-item.active {
    background: #e0e3eb;
    color: #131722;
}
.tv-submenu-item.active .tv-submenu-shortcut { color: #434651; }
.tv-submenu-item.active img { filter: brightness(0) !important; }

.tv-submenu-shortcut {
    margin-left: auto;
    padding-left: 20px;
    font-size: 12px;
    color: #6b7280;
    white-space: nowrap;
}

.tv-submenu-item-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.tv-submenu-item-label {
    flex: 1;
    margin-left: 6px;
}

/* ============================================================
   TRENDLINE TOOLBAR (из chart.js)
   ============================================================ */
#trendline-toolbar {
    position: fixed; display: none; z-index: 9999;
    background: #1f1f1f; border-radius: 6px;
    padding: 4px; gap: 2px; align-items: center;
    box-shadow: 0 4px 10px rgba(0,0,0,0.4);
    color: #848e9c; user-select: none;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
#tl-drag-handle:hover { color: #fff; }
#tl-drag-handle:active { cursor: grabbing !important; }

.tv-tool-btn {
    width: 32px; height: 32px;
    display: flex; justify-content: center; align-items: center;
    border-radius: 4px; cursor: pointer; transition: 0.1s;
    position: relative; flex-direction: column; gap: 2px;
}
.tv-tool-btn-row { flex-direction: row; gap: 4px; width: auto; padding: 0 8px; font-size: 13px; font-weight: 500; color: #d1d4dc; }
.tv-tool-btn:hover, .tv-tool-btn.active-btn { background: #2a2e39; color: #fff; }
.tv-divider { width: 1px; height: 24px; background: #434651; margin: 0 4px; }
.tl-color-indicator { width: 16px; height: 3px; border-radius: 1.5px; margin-top: -2px; }
.tl-delete:hover { color: #f6465d; }
#ahl-del:hover { color: #f6465d; }
#tl-lock-btn.tl-locked { background: #ffffff; color: #131722; border-radius: 5px; }
#tl-lock-btn.tl-locked:hover { background: #e0e3eb; color: #131722; border-radius: 5px; }

.tv-popover {
    position: absolute; top: 100%; left: 0; margin-top: 6px;
    background: #1e222d; border: 1px solid #434651; border-radius: 6px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.4);
    display: none; flex-direction: column; padding: 8px;
    z-index: 10000; cursor: default;
}
.tv-popover.active { display: flex; }
#tl-color-popover { width: 190px; }
#tl-style-popover { width: 170px; padding: 4px; }

.tl-colors-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 4px; margin-bottom: 12px; }
.tl-color-item { width: 18px; height: 18px; border-radius: 3px; cursor: pointer; border: 1px solid rgba(255,255,255,0.05); box-sizing: border-box; }
.tl-color-item:hover { border-color: #d1d4dc; }
.tl-color-item.active { border-color: #fff; box-shadow: 0 0 0 1px #2962ff; }

.tl-opacity-container { border-top: 1px solid #434651; padding-top: 8px; }
.tl-op-header { font-size: 12px; margin-bottom: 8px; color: #848e9c; }
.tl-op-slider-row { display: flex; align-items: center; gap: 8px; font-size: 12px; color: #d1d4dc; }
#tl-opacity-slider { flex: 1; -webkit-appearance: none; height: 4px; background: #434651; border-radius: 2px; outline: none; }
#tl-opacity-slider::-webkit-slider-thumb {
    -webkit-appearance: none; appearance: none;
    width: 12px; height: 12px; border-radius: 50%;
    background: #2962ff; border: 2px solid #fff; cursor: pointer;
}
#tl-width-popover { width: 100px; padding: 4px; }
.tl-width-option { display: flex; align-items: center; gap: 4px; padding: 6px 8px; cursor: pointer; border-radius: 4px; font-size: 13px; color: #d1d4dc; }
.tl-width-option:hover { background: #2a2e39; color: #fff; }
.tl-width-option.active { background: #2962ff; color: #fff; }
.tl-w-line { background: currentColor; }

/* ============================================================
   MOBILE TF MODAL (desktop: trigger hidden)
   ============================================================ */
.tf-mobile-trigger {
    display: none;
    align-items: center;
    justify-content: center;
    min-width: 52px;
    height: 32px;
    min-height: 32px;
    padding: 0 10px;
    margin-right: 2px;
    background-color: var(--topbar-pill-bg, var(--study-legend-row-bg));
    border: none;
    border-radius: 4px;
    color: #eaecef;
    font-size: 12px;
    font-weight: 500;
    font-family: 'Roboto', sans-serif;
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    flex-shrink: 0;
    box-sizing: border-box;
}
.tf-mobile-trigger:hover {
    background-color: var(--topbar-pill-hover, rgba(30, 34, 46, 0.98));
}
.tf-mobile-trigger:active {
    background-color: var(--topbar-pill-active, rgb(15, 18, 28));
}
.tf-mobile-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 12000;
    align-items: center;
    justify-content: center;
}
.tf-mobile-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.72);
}
.tf-mobile-modal-dialog {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 1;
    width: min(300px, calc(100vw - 40px));
    max-height: min(420px, calc(100dvh - 80px));
    padding: 18px 16px 14px;
    background: #1f1f1f;
    border: none;
    border-radius: 12px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.65);
}
.tf-mobile-modal-title {
    font-size: 14px;
    font-weight: 600;
    color: #eaecef;
    text-align: center;
    margin-bottom: 14px;
}
.tf-mobile-modal-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}
.tf-mobile-modal-opt {
    height: 36px;
    padding: 0 8px;
    border: 1px solid transparent;
    border-radius: 4px;
    background: transparent;
    color: #d1d4dc;
    font-size: 13px;
    font-weight: 500;
    font-family: 'Roboto', sans-serif;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: background-color 0.1s ease, color 0.1s ease, border-color 0.1s ease;
}
.tf-mobile-modal-opt:hover {
    background: #2a2e39;
    color: #ffffff;
}
.tf-mobile-modal-opt:active {
    background: #2a2e39;
    color: #ffffff;
}
.tf-mobile-modal-opt--active {
    border-color: #e0e3eb;
    background: #e0e3eb;
    color: #131722;
}

/* ============================================================
   CHART TYPE BUTTON + MODAL (как .tv-submenu у инструментов)
   ============================================================ */
.chart-style-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    min-height: 32px;
    flex-shrink: 0;
    margin-right: 2px;
    padding: 0;
    background-color: var(--topbar-pill-bg, var(--study-legend-row-bg));
    border: none;
    border-radius: 4px;
    color: #eaecef;
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    box-sizing: border-box;
    transition: background-color 0.12s ease;
}
.chart-style-btn:hover {
    background-color: var(--topbar-pill-hover, rgba(30, 34, 46, 0.98));
}
.chart-style-btn:active {
    background-color: var(--topbar-pill-active, rgb(15, 18, 28));
}
.chart-style-btn #chart-style-btn-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 0;
}
.chart-style-btn #chart-style-btn-icon svg {
    display: block;
}
.chart-style-modal {
    z-index: 12050;
}
/* Панель — те же токены, что .tv-submenu */
.chart-style-submenu {
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    box-sizing: border-box;
    width: min(300px, calc(100vw - 40px));
    max-width: min(300px, calc(100vw - 40px));
    background: #1f1f1f;
    border-radius: 12px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.65);
    padding: 18px 16px 14px;
}
.chart-style-submenu .tv-submenu-header {
    padding: 0 0 14px;
    margin: 0;
    font-family: 'Roboto', sans-serif;
    font-size: 14px;
    font-weight: 600;
    color: #eaecef;
    text-align: center;
    letter-spacing: normal;
    text-transform: none;
}
.chart-style-submenu-list {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
}
.chart-style-submenu-item.tv-submenu-item {
    width: auto;
    max-width: none;
    align-self: stretch;
    box-sizing: border-box;
    margin: 0;
    height: 36px;
    border: 1px solid transparent;
    border-radius: 4px;
    font-family: 'Roboto', sans-serif;
    font-size: 13px;
    font-weight: 500;
    text-align: left;
    justify-content: flex-start;
    padding: 0 8px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    appearance: none;
    -webkit-appearance: none;
    transition: background-color 0.1s ease, color 0.1s ease, border-color 0.1s ease;
}
.chart-style-submenu-item.tv-submenu-item .tv-submenu-item-label {
    flex: 0 1 auto;
    margin-left: 8px;
    font-weight: 500;
    color: inherit;
}
.chart-style-submenu-item.tv-submenu-item .tv-submenu-item-icon {
    width: 28px;
    height: 28px;
}
/* Сброс UA-фона кнопки только в покое; не трогаем :hover и .active */
.chart-style-submenu-item.tv-submenu-item:not(.active):not(:hover) {
    background-color: transparent;
    color: #d1d4dc;
}
.chart-style-submenu-item.tv-submenu-item:hover {
    background: #2a2e39;
    color: #ffffff;
}
.chart-style-submenu-item.tv-submenu-item.active {
    border-color: #e0e3eb;
    background: #e0e3eb;
    color: #131722;
}
.chart-style-submenu-item.tv-submenu-item.active:hover {
    background: #cacdd6;
    border-color: #cacdd6;
    color: #131722;
}
.chart-style-submenu-item.tv-submenu-item.active .tv-submenu-item-icon {
    color: #131722;
}
.chart-style-submenu-item.tv-submenu-item:focus {
    outline: none;
}
.chart-style-submenu-item.tv-submenu-item:focus-visible {
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.25);
    border-radius: 4px;
}
.chart-style-submenu-item.tv-submenu-item.active:focus-visible {
    box-shadow: inset 0 0 0 1px rgba(19, 23, 34, 0.35);
}
.chart-style-submenu-item.tv-submenu-item .tv-submenu-item-icon svg {
    width: 20px;
    height: 20px;
}

/* ============================================================
   CUSTOM SELECT  (custom-select.js)
   ============================================================ */

.cs-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
}

/* Trigger — таблица/панель (vol-filter) */
.cs-trigger {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    background: #161a1e;
    border: 1px solid #474d57;
    border-radius: 4px;
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
    transition: background 0.12s, border-color 0.12s;
}
.cs-trigger:hover,
.cs-wrap.cs-open .cs-trigger {
    background: #2b3139;
    border-color: #848e9c;
}

/* vol-filter в хедере таблицы — серый фон, высота как у иконок бирж */
#trades-header .cs-trigger {
    background: #161a1e;
    border: none;
    height: 24px;
    box-sizing: border-box;
}
#trades-header .cs-trigger:hover,
#trades-header .cs-wrap.cs-open .cs-trigger {
    background: #2b3139;
    border: none;
}
#topbar-controls .cs-trigger {
    background: #161a1e;
    border: none;
    padding: 4px 8px;
    height: 32px;
    box-sizing: border-box;
}
#topbar-controls .cs-trigger:hover,
#topbar-controls .cs-wrap.cs-open .cs-trigger {
    background: #2b3139;
    border: none;
}

.cs-label {
    color: #eaecef;
    font-family: 'Roboto', sans-serif;
    font-size: 12px;
    font-weight: 500;
    line-height: 1;
}

.cs-arrow {
    width: 0;
    height: 0;
    border-left: 3px solid transparent;
    border-right: 3px solid transparent;
    border-top: 4px solid #848e9c;
    transition: transform 0.15s;
    flex-shrink: 0;
}
.cs-wrap.cs-open .cs-arrow { transform: rotate(180deg); }

/* Dropdown panel */
.cs-dropdown {
    display: none;
    position: absolute;
    left: 0;
    min-width: 100%;
    width: max-content;
    background: #1e2329;
    border: none;
    border-radius: 6px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.7);
    z-index: 5000;
    padding: 4px 0;
}
.cs-wrap.cs-open .cs-dropdown { display: block; }

.cs-item {
    padding: 7px 14px;
    font-size: 12px;
    font-family: 'Roboto', sans-serif;
    color: #848e9c;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.1s, color 0.1s;
}
.cs-item:hover { background: #2b3139; color: #d1d4dc; }
.cs-item.cs-item-active { color: #f0b90b; background: transparent; }

/* ============================================================
   АВТОРИЗАЦИЯ
   ============================================================ */

/* Иконка в топбаре */
#auth-icon {
    display: flex;
    align-items: center;
    justify-content: center;
}
#auth-icon svg,
.auth-pw-toggle svg { display: block; }

/* Оверлей */
#auth-modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background-color: rgba(0,0,0,0.72);
    z-index: 10000;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(5px);
}

/* Контейнер модалки */
.auth-modal-box {
    background-color: #1f1f1f;
    border: none;
    border-radius: 10px;
    width: 320px;
    box-shadow: 0 16px 48px rgba(0,0,0,0.55);
    overflow: hidden;
}

/* Шапка */
.auth-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px 0;
}
#auth-modal-title {
    font-size: 15px;
    font-weight: 600;
    color: #ffffff;
}
#auth-modal-close {
    cursor: pointer;
    color: #848e9c;
    font-size: 18px;
    line-height: 1;
    padding: 4px;
    user-select: none;
}
#auth-modal-close:hover { color: #d1d4dc; }

/* Вкладки */
.auth-modal-tabs {
    display: flex;
    border-bottom: 1px solid #363a45;
    margin: 12px 20px 0;
}
#auth-tab-login { margin-right: 16px; }
.auth-tab {
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: #848e9c;
    padding: 8px 2px;
    border-bottom: 2px solid transparent;
    transition: color 0.15s, border-color 0.15s;
    user-select: none;
}
.auth-tab:hover { color: #d1d4dc; }
.auth-tab-active { color: #ffffff; border-bottom-color: #b2b9c7; }

/* Форма входа / профиль */
#auth-login-form,
#auth-user-info { padding: 16px 20px 20px; }
#auth-user-info { display: none; }

/* Поля формы */
.auth-form-field { margin-bottom: 10px; }
.auth-form-field label {
    display: block;
    color: #848e9c;
    font-size: 11px;
    margin-bottom: 5px;
    font-weight: 500;
}
.auth-input {
    width: 100%;
    padding: 9px 10px;
    background-color: #3d3d3d;
    border: none;
    border-radius: 5px;
    color: #ffffff;
    font-size: 13px;
    box-sizing: border-box;
    outline: none;
}
.auth-input-pw { padding-right: 36px; }
.auth-pw-wrap { position: relative; }
.auth-pw-toggle {
    position: absolute;
    right: 9px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    display: flex;
    align-items: center;
}
#auth-reg-extra { display: none; }
#auth-error-msg {
    display: none;
    color: #d1d4dc;
    font-size: 12px;
    margin-bottom: 8px;
    background-color: #1e222d;
    border: 1px solid #474d57;
    padding: 8px 10px;
    border-radius: 5px;
}
#auth-login-btn {
    width: 100%;
    padding: 10px;
    background-color: #3d3d3d;
    color: #ffffff;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    margin-top: 4px;
}
#auth-login-btn:hover { background-color: #4a5160; }
#auth-email-input:focus, #auth-password-input:focus, #auth-password2-input:focus {
    box-shadow: 0 0 0 2px rgba(255,255,255,0.06);
}
#auth-email-input::placeholder,
#auth-password-input::placeholder,
#auth-password2-input::placeholder {
    color: #5c6370;
    opacity: 1;
}

/* Профиль пользователя */
.auth-user-card {
    text-align: center;
    padding: 12px;
    background-color: #3d3d3d;
    border: none;
    border-radius: 8px;
    margin-bottom: 14px;
}
.auth-user-avatar {
    font-size: 28px;
    margin-bottom: 6px;
    opacity: 0.85;
}
#auth-username-display {
    color: #ffffff;
    font-size: 13px;
    font-weight: 500;
    word-break: break-all;
}
#auth-save-status {
    font-size: 11px;
    color: #848e9c;
    text-align: center;
    margin-bottom: 12px;
    min-height: 16px;
}

/* Общая кнопка/ссылка профиля */
.auth-modal-btn {
    display: block;
    width: 100%;
    padding: 8px;
    background-color: #3d3d3d;
    color: #ffffff;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 13px;
    margin-bottom: 8px;
    text-align: center;
    text-decoration: none;
    box-sizing: border-box;
}
.auth-modal-btn:hover { background-color: #363c45; }
#auth-delta-link { background-color: #1a2a3a; color: #58a6ff; border-color: #2d4a6a; }

/* Уведомления */
#notif-profile-section {
    border-top: 1px solid #363a45;
    padding-top: 12px;
    margin-bottom: 8px;
}
.auth-notif-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}
.auth-notif-label { font-size: 12px; color: #848e9c; }
#notif-status-text { font-size: 11px; color: #848e9c; }

/* Кнопка выхода */
#auth-logout-btn {
    width: 100%;
    padding: 10px;
    background-color: #3d3d3d;
    color: #d1d4dc;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
}
#auth-logout-btn:hover { background-color: #4a4a4a; color: #ffffff; }

/* ============================================================
   ИНДИКАТОРЫ (верхняя кнопка + модалка в стиле TradingView)
   ============================================================ */
.indicators-top-btn {
    width: 32px;
    height: 32px;
    min-height: 32px;
    border-radius: 4px;
    background-color: var(--topbar-pill-bg, var(--study-legend-row-bg));
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    box-sizing: border-box;
    transition: background-color 0.2s;
}
.indicators-top-btn:hover {
    background-color: var(--topbar-pill-hover, rgba(30, 34, 46, 0.98));
}
.indicators-top-btn:active {
    background-color: var(--topbar-pill-active, rgb(15, 18, 28));
}
.indicators-top-btn-inner {
    width: 18px;
    height: 18px;
    display: block;
    background-color: #d1d4dc;
    -webkit-mask: url("/assets/indicators.svg") center / contain no-repeat;
    mask: url("/assets/indicators.svg") center / contain no-repeat;
}

.indicators-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 10050;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
    overscroll-behavior: none;
}
.indicators-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.72);
}
.indicators-modal-panel {
    position: relative;
    z-index: 1;
    width: min(720px, 94vw);
    max-height: min(560px, 86vh);
    background: #1f1f1f;
    border-radius: 10px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.55);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    font-family: 'Roboto', sans-serif;
}
.indicators-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px 10px 20px;
    flex-shrink: 0;
}
.indicators-modal-title {
    font-size: 15px;
    font-weight: 600;
    color: #ffffff;
    letter-spacing: 0.02em;
}
.indicators-modal-close {
    cursor: pointer;
    color: #848e9c;
    font-size: 18px;
    line-height: 1;
    padding: 4px 6px;
    user-select: none;
    border-radius: 4px;
}
.indicators-modal-close:hover {
    color: #d1d4dc;
    background: rgba(255, 255, 255, 0.06);
}
.indicators-modal-search-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 20px 12px 20px;
    padding: 0 12px;
    height: 38px;
    background: #1f1f1f;
    border: 1px solid #363a45;
    border-radius: 8px;
    flex-shrink: 0;
}
.indicators-modal-search-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    opacity: 0.55;
    background: #848e9c;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M16.5 16.5L21 21' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M16.5 16.5L21 21' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat;
}
.indicators-modal-search-row input,
.indicators-modal-search {
    flex: 1;
    min-width: 0;
    border: none !important;
    outline: none !important;
    background: transparent !important;
    color: #d1d4dc !important;
    font-size: 13px;
    font-family: inherit;
    height: 100%;
    box-shadow: none !important;
}
.indicators-modal-search-row input::placeholder,
.indicators-modal-search::placeholder {
    color: #5c6370;
}
.indicators-modal-body {
    display: flex;
    min-height: 0;
    flex: 1;
}
.indicators-modal-sidebar {
    width: 168px;
    flex-shrink: 0;
    padding: 12px 0 16px 0;
    background: #1f1f1f;
}
.indicators-modal-side-caption {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.08em;
    color: #5c6370;
    padding: 4px 14px 10px 14px;
    text-transform: uppercase;
}
.indicators-modal-side-item {
    padding: 10px 14px;
    font-size: 13px;
    color: #d1d4dc;
    cursor: pointer;
    user-select: none;
    transition: background 0.12s, color 0.12s;
}
.indicators-modal-side-item:hover {
    background: rgba(255, 255, 255, 0.04);
    color: #ffffff;
}
.indicators-modal-side-active {
    background: #3d3d3d !important;
    color: #ffffff !important;
}
.indicators-modal-side-muted {
    color: #848e9c;
}
.indicators-modal-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    background: #1f1f1f;
}
.indicators-modal-tabs {
    display: flex;
    gap: 6px;
    padding: 12px 16px 10px 16px;
    flex-shrink: 0;
}
.indicators-modal-tab {
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-size: 12px;
    font-weight: 500;
    padding: 6px 14px;
    border-radius: 4px;
    background: #3d3d3d;
    color: #d1d4dc;
    border: 1px solid #363a45;
    transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.indicators-modal-tab:hover {
    background: #363c45;
    color: #ffffff;
}
.indicators-modal-tab-active {
    background: #ffffff !important;
    color: #131722 !important;
    border-color: #ffffff !important;
}
.indicators-modal-table-head {
    display: grid;
    grid-template-columns: 28px 1fr 88px;
    gap: 8px;
    padding: 6px 16px 6px 16px;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #5c6370;
    flex-shrink: 0;
}
.indicators-modal-list {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 4px 8px 12px 8px;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}
.indicators-modal-row {
    display: grid;
    grid-template-columns: 28px 1fr 88px;
    gap: 8px;
    align-items: center;
    padding: 10px 8px;
    margin: 2px 0;
    border-radius: 6px;
    font-size: 13px;
    color: #d1d4dc;
    cursor: pointer;
    transition: background 0.1s;
}
.indicators-modal-row:hover {
    background: rgba(255, 255, 255, 0.05);
}
.indicators-modal-row-on .ind-name {
    color: #ffffff;
}
.ind-fav {
    text-align: center;
    color: #787b86;
    font-size: 15px;
    line-height: 1;
    user-select: none;
}
.indicators-modal-row:hover .ind-fav {
    color: #b2b9c7;
}
.ind-name {
    color: #d1d4dc;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ind-state {
    font-size: 11px;
    color: #5c6370;
    text-align: right;
}
.indicators-modal-row-on .ind-state {
    color: #848e9c;
}
.indicators-modal-row-hidden .ind-name {
    color: #848e9c;
}
.indicators-modal-row-hidden .ind-state {
    color: #f0b429;
}
.indicators-modal-empty {
    padding: 36px 24px;
    text-align: center;
    font-size: 13px;
    color: #848e9c;
    line-height: 1.55;
}
.indicators-modal-empty-sub {
    display: block;
    margin-top: 8px;
    font-size: 12px;
    color: #5c6370;
}

/* ─── Легенда индикаторов на панелях графика (TradingView-style) ─── */
.study-legend-mount {
    position: absolute;
    left: 6px;
    top: 2px;
    z-index: 25;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    max-width: calc(100% - 70px);
    pointer-events: none;
}
.study-legend-row {
    position: relative;
    display: inline-flex;
    align-items: center;
    flex-wrap: nowrap;
    border-radius: 4px;
    border: 1px solid transparent;
    background: var(--study-legend-row-bg);
    pointer-events: auto;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.study-legend-row:hover,
.study-legend-row.is-expanded {
    border-color: rgba(41, 98, 255, 0.55);
    box-shadow: 0 0 0 1px rgba(41, 98, 255, 0.2);
}
.study-legend-row--dim .study-legend-name {
    opacity: 0.45;
}
.study-legend-name {
    margin: 0;
    padding: 1px 8px;
    border: none;
    border-radius: 3px 0 0 3px;
    background: transparent;
    color: #d1d4dc;
    font: 11px/1.22 Roboto, sans-serif;
    cursor: pointer;
    text-align: left;
    transition: background 0.2s ease, color 0.2s ease;
}
.study-legend-row:hover .study-legend-name,
.study-legend-row.is-expanded .study-legend-name {
    background: rgba(255, 255, 255, 0.06);
    color: #ffffff;
}
.study-legend-actions {
    display: flex;
    align-items: center;
    gap: 1px;
    padding: 0 2px 0 0;
    min-height: 0;
    max-width: 0;
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    white-space: nowrap;
    /* size expands instantly so buttons are never clipped when pointer-events turns auto */
    transition: max-width 0s, max-height 0s, opacity 0.2s ease;
    pointer-events: none;
}
.study-legend-row:hover .study-legend-actions,
.study-legend-row.is-expanded .study-legend-actions {
    max-width: 152px;
    max-height: 26px;
    opacity: 1;
    pointer-events: auto;
}
.study-legend-btn {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    padding: 0;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 2px;
    background: transparent;
    color: #b2b9c7;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}
.study-legend-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
}
.study-legend-btn-danger:hover {
    background: rgba(246, 70, 93, 0.15);
    color: #f6465d;
}
.study-legend-btn svg,
.study-legend-btn span {
    pointer-events: none;
}
.study-legend-brace {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: -0.5px;
    color: inherit;
    line-height: 1;
}

/* ─── Модалка алертов индикатора ─── */
.ind-alert-backdrop {
    position: fixed;
    inset: 0;
    pointer-events: all;
}
.iam-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 6px;
    cursor: pointer;
    border: 1px solid transparent;
    transition: background 0.1s, border-color 0.1s;
}
.iam-row:hover {
    background: rgba(255, 255, 255, 0.04);
}
.iam-row input[type="radio"] {
    accent-color: #2962ff;
    cursor: pointer;
    flex-shrink: 0;
    width: 14px;
    height: 14px;
}
.iam-row-checked {
    background: transparent;
    border-color: transparent;
    outline: 1px solid rgba(255,255,255,0.35);
    outline-offset: -1px;
}
.iam-label {
    color: #d1d4dc;
    font-size: 13px;
    line-height: 1.35;
}
.iam-desc {
    color: #848e9c;
    font-size: 11px;
    margin-left: auto;
    padding-left: 8px;
    flex-shrink: 0;
}

/* ─── Модалка настроек индикатора (шестерёнка в легенде) ─── */
.ind-settings-overlay {
    position: fixed;
    inset: 0;
    z-index: 10060;
    display: none;
    align-items: center;
    justify-content: center;
    font-family: 'Roboto', sans-serif;
    pointer-events: none;
    overscroll-behavior: none;
}
.ind-settings-backdrop {
    display: none;
}
.ind-settings-dialog {
    position: relative;
    pointer-events: all;
    z-index: 1;
    outline: none;
    width: min(440px, 94vw);
    max-height: min(580px, 90vh);
    background: #1f1f1f;
    border: none;
    border-radius: 10px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.55);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.ind-settings-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px 10px 18px;
    flex-shrink: 0;
}
.ind-settings-title {
    font-size: 15px;
    font-weight: 600;
    color: #fff;
}
.ind-settings-x {
    border: none;
    background: transparent;
    color: #848e9c;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
}
.ind-settings-x:hover {
    color: #d1d4dc;
    background: rgba(255, 255, 255, 0.06);
}
.ind-settings-tabs {
    display: flex;
    gap: 0;
    padding: 0 12px;
    border-bottom: 1px solid #2a2e39;
    flex-shrink: 0;
}
.ind-settings-tab {
    border: none;
    background: transparent;
    color: #848e9c;
    font-size: 13px;
    padding: 10px 14px 11px;
    cursor: pointer;
    position: relative;
    font-family: inherit;
}
.ind-settings-tab:hover {
    color: #d1d4dc;
}
.ind-settings-tab-active {
    color: #ffffff;
    font-weight: 500;
}
.ind-settings-tab-active::after {
    content: '';
    position: absolute;
    left: 8px;
    right: 8px;
    bottom: 0;
    height: 2px;
    background: #ffffff;
    border-radius: 1px 1px 0 0;
}
.ind-settings-body {
    flex: 1;
    overflow-y: auto;
    padding: 14px 18px 16px;
    color: #d1d4dc;
    font-size: 13px;
}
.ind-settings-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 16px 14px;
    border-top: 1px solid #2a2e39;
    flex-shrink: 0;
    background: #1f1f1f;
}
.ind-settings-foot-right {
    display: flex;
    gap: 8px;
}
.ind-settings-btn-def {
    border: 1px solid #363a45;
    background: #1f1f1f;
    color: #d1d4dc;
    font-size: 12px;
    padding: 7px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-family: inherit;
}
.ind-settings-btn-def:hover {
    background: #2a2a2a;
}
.ind-settings-btn {
    border-radius: 6px;
    font-size: 13px;
    padding: 8px 18px;
    cursor: pointer;
    font-family: inherit;
}
.ind-settings-btn-ghost {
    border: 1px solid #474d57;
    background: transparent;
    color: #d1d4dc;
}
.ind-settings-btn-ghost:hover {
    background: rgba(255, 255, 255, 0.04);
}
.ind-settings-btn-primary {
    border: none;
    background: #fff;
    color: #131722;
    font-weight: 600;
}
.ind-settings-btn-primary:hover {
    filter: brightness(0.95);
}
.ind-set-placeholder {
    color: #848e9c;
    line-height: 1.5;
    padding: 8px 0;
}
.ind-set-hint {
    font-size: 11px;
    color: #787b86;
    margin: -2px 0 10px;
    line-height: 1.45;
}
.ind-set-row--sma-bb .ind-set-label {
    min-width: 0;
    flex: 1 1 120px;
}
.ind-set-info-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 1px solid #5c6370;
    color: #848e9c;
    font-size: 10px;
    font-style: italic;
    font-family: Georgia, "Times New Roman", serif;
    cursor: help;
    flex-shrink: 0;
    line-height: 1;
}
.ind-set-row--sma-plot {
    flex-wrap: nowrap;
    align-items: center;
    gap: 8px;
}
.ind-set-check--sma-plot {
    margin: 0 !important;
    flex-shrink: 0;
}
.ind-set-label--sma-plot {
    min-width: 0;
    flex: 1 1 auto;
    max-width: 200px;
}
.ind-set-num--sma-w {
    width: 52px;
    flex-shrink: 0;
}
.ind-set-cap {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.06em;
    color: #5c6370;
    margin: 14px 0 8px;
}
.ind-set-cap:first-child {
    margin-top: 0;
}
.ind-set-check {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 8px 0;
    cursor: pointer;
    color: #d1d4dc;
}
.ind-set-check input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border: 1.5px solid #ffffff;
    border-radius: 3px;
    background: #ffffff;
    cursor: pointer;
    position: relative;
    flex-shrink: 0;
}
.ind-set-check input[type="checkbox"]:checked {
    background: #ffffff;
    border-color: #ffffff;
}
.ind-set-check input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    left: 4px;
    top: 1px;
    width: 5px;
    height: 9px;
    border: 2px solid #1f1f1f;
    border-top: none;
    border-left: none;
    transform: rotate(45deg);
}
.ind-set-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px 10px;
    margin: 10px 0;
}
.ind-set-row-colors {
    padding-left: 4px;
}
.ind-set-label {
    flex: 0 0 130px;
    color: #b2b5be;
    font-size: 13px;
}
/* Checkbox-only rows: check visually first, label takes remaining space */
.ind-set-row > .ind-set-check { order: -1; }
.ind-set-row:not(.ind-set-level):has(> .ind-set-check) > .ind-set-label { flex: 1; }
/* Style tab rows: grid с тремя столбцами [чекбокс | подпись | кнопка] */
.ind-set-level .ind-set-label        { order: 2; }
.ind-set-level .ind-set-swatch-combo { order: 3; }
.ind-set-sub {
    font-size: 12px;
    color: #787b86;
}
.ind-set-select {
    background: #1f1f1f;
    border: 1px solid #363a45;
    color: #d1d4dc;
    border-radius: 6px;
    padding: 0 24px 0 8px;
    font-size: 12px;
    font-family: inherit;
    cursor: pointer;
    height: 30px;
    box-sizing: border-box;
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='5' viewBox='0 0 8 5'%3E%3Cpath d='M0 0l4 5 4-5z' fill='%23848e9c'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
}
.ind-set-select-wide {
    min-width: 140px;
}
.ind-set-input {
    background: #1f1f1f;
    border: 1px solid #363a45;
    color: #d1d4dc;
    border-radius: 6px;
    padding: 0 8px;
    font-size: 12px;
    font-family: inherit;
    outline: none;
    min-width: 80px;
    height: 30px;
    box-sizing: border-box;
}
.ind-set-input:focus {
    border-color: #2962ff;
}
.ind-set-input::placeholder {
    color: #4a4e5a;
}
.ind-set-input--wide {
    min-width: 140px;
}

/* ── Time Range Picker ── */
.ind-timepicker-range {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.ind-timepicker {
    position: relative;
    display: inline-flex;
}
.ind-timepicker-input {
    background: #1f1f1f;
    border: 1px solid #363a45;
    color: #d1d4dc;
    border-radius: 6px;
    padding: 0 24px 0 8px;
    font-size: 12px;
    font-family: inherit;
    outline: none;
    width: 72px;
    height: 30px;
    box-sizing: border-box;
    cursor: pointer;
    caret-color: transparent;
    user-select: none;
}
.ind-timepicker-input.open,
.ind-timepicker-input:focus {
    border-color: #2962ff;
}
.ind-timepicker-icon {
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    padding: 0;
    color: #787b86;
    display: flex;
    align-items: center;
    pointer-events: none;
}
.ind-timepicker-sep {
    color: #787b86;
    font-size: 13px;
    flex-shrink: 0;
    line-height: 1;
}
.ind-timepicker-drop {
    position: absolute;
    top: calc(100% + 3px);
    left: 0;
    z-index: 9999;
    background: #1f1f1f;
    border: none;
    border-radius: 6px;
    min-width: 80px;
    max-height: 180px;
    overflow-y: auto;
    display: none;
    box-shadow: 0 4px 20px rgba(0,0,0,0.6);
}
.ind-timepicker-drop.open { display: block; }
.ind-timepicker-opt {
    padding: 5px 12px;
    font-size: 12px;
    font-family: inherit;
    color: #d1d4dc;
    cursor: pointer;
    white-space: nowrap;
}
.ind-timepicker-opt:hover { background: #2a2e3a; }
.ind-timepicker-opt.active {
    background: #2962ff;
    color: #fff;
}

.ind-set-num {
    width: 48px;
    background: #1f1f1f;
    border: 1px solid #363a45;
    color: #d1d4dc;
    border-radius: 6px;
    padding: 0 6px;
    font-size: 12px;
    font-family: inherit;
    height: 30px;
    box-sizing: border-box;
}
.ind-set-spin {
    display: flex;
    align-items: stretch;
    border: 1px solid #474d57;
    border-radius: 4px;
    overflow: hidden;
    background: #1f1f1f;
    height: 30px;
    box-sizing: border-box;
}
.ind-set-spin .ind-set-num {
    width: 4em;
    min-width: 3em;
    border: none;
    border-radius: 0;
    background: transparent;
    padding: 0 4px 0 8px;
    height: 100%;
    box-sizing: border-box;
    -moz-appearance: textfield;
    appearance: textfield;
    text-align: left;
}
.ind-set-spin .ind-set-num::-webkit-outer-spin-button,
.ind-set-spin .ind-set-num::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.ind-set-spin-btns {
    display: flex;
    flex-direction: column;
}
.ind-set-spin-btn {
    flex: 1;
    width: 18px;
    background: none;
    border: none;
    color: transparent;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    transition: color 0.1s;
}
.ind-set-spin:hover .ind-set-spin-btn {
    color: rgba(120,123,134,0.6);
}
.ind-set-spin:hover .ind-set-spin-btn:hover {
    background: rgba(242,242,242,0.08);
    color: #d1d4dc;
}
.ind-set-spin-up::before {
    content: '';
    display: block;
    width: 5px;
    height: 5px;
    border-top: 1.5px solid currentColor;
    border-right: 1.5px solid currentColor;
    transform: rotate(-45deg) translate(0, 1px);
}
.ind-set-spin-dn::before {
    content: '';
    display: block;
    width: 5px;
    height: 5px;
    border-bottom: 1.5px solid currentColor;
    border-right: 1.5px solid currentColor;
    transform: rotate(45deg) translate(0, -1px);
}
.ind-set-sep {
    height: 1px;
    background: #2a2e39;
    margin: 12px 0;
}
.ind-set-level {
    display: grid;
    grid-template-columns: 24px 140px auto 1fr;
    column-gap: 8px;
    align-items: center;
}
.ind-set-level > .ind-set-check        { grid-column: 1; }
.ind-set-level > .ind-set-label        { grid-column: 2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ind-set-level > .ind-set-swatch-combo { grid-column: 3; }
.ind-set-level > .ind-set-spin         { grid-column: 3; }
.ind-set-swatch-combo {
    display: flex;
    align-items: center;
    border: 1px solid #474d57;
    border-radius: 4px;
    overflow: hidden;
    flex-shrink: 0;
    cursor: pointer;
}
.ind-set-swatch-combo:hover {
    outline: 1px solid #2962ff;
    outline-offset: 1px;
}
.ind-set-swatch-combo .ind-set-swatch {
    width: 28px;
    height: 22px;
    border-radius: 4px;
    outline: none;
    margin: 3px 4px;
    flex-shrink: 0;
}
.ind-set-swatch-combo .ind-set-swatch:hover {
    outline: none;
}
.ind-set-line-prev {
    display: inline-block;
    width: 26px;
    height: 0;
    flex-shrink: 0;
    margin: 0 8px;
    align-self: center;
    pointer-events: none;
}

.ind-set-swatch {
    width: 32px;
    height: 24px;
    padding: 0;
    border: 1px solid #474d57;
    border-radius: 4px;
    cursor: pointer;
    box-sizing: border-box;
    flex-shrink: 0;
}
.ind-set-swatch:hover {
    outline: 1px solid #2962ff;
    outline-offset: 1px;
}
.ind-set-swatch-sm {
    width: 28px;
    height: 22px;
}

/* ─── Вкладка «Видимость»: на каких ТФ показывать индикатор ─── */
.ind-tf-vis-list {
    margin-bottom: 6px;
}
.ind-tf-vis-row {
    display: grid;
    grid-template-columns: 22px minmax(72px, 1fr) 66px minmax(72px, 1.2fr) 66px;
    align-items: center;
    gap: 6px 8px;
    margin: 8px 0;
    min-height: 28px;
}
.ind-tf-vis-row--simple {
    grid-template-columns: 22px 1fr;
}
.ind-tf-vis-check {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    cursor: pointer;
}
.ind-tf-vis-check input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border: 1.5px solid #ffffff;
    border-radius: 3px;
    background: #ffffff;
    cursor: pointer;
    position: relative;
    flex-shrink: 0;
}
.ind-tf-vis-check input[type="checkbox"]:checked {
    background: #ffffff;
    border-color: #ffffff;
}
.ind-tf-vis-check input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    left: 4px;
    top: 1px;
    width: 5px;
    height: 9px;
    border: 2px solid #1f1f1f;
    border-top: none;
    border-left: none;
    transform: rotate(45deg);
}
.ind-tf-vis-label {
    color: #d1d4dc;
    font-size: 13px;
}
.ind-tf-vis-num {
    max-width: 100%;
    box-sizing: border-box;
}
.ind-set-spin .ind-tf-vis-num {
    width: auto;
    flex: 1;
    min-width: 0;
}
.ind-tf-dual-wrap {
    position: relative;
    height: 22px;
    min-width: 72px;
    align-self: center;
}
.ind-tf-dual-wrap::before {
    content: '';
    position: absolute;
    left: 7px;
    right: 7px;
    top: 50%;
    height: 4px;
    margin-top: -2px;
    background: #363a45;
    border-radius: 2px;
    pointer-events: none;
    z-index: 0;
}
.ind-tf-dual-wrap input[type="range"] {
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 100%;
    margin: 0;
    height: 22px;
    background: none;
    -webkit-appearance: none;
    appearance: none;
    pointer-events: none;
    z-index: 1;
}
.ind-tf-dual-wrap input[type="range"]::-webkit-slider-runnable-track {
    height: 4px;
    background: transparent;
    border: none;
}
.ind-tf-dual-wrap input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    pointer-events: auto;
    width: 12px;
    height: 12px;
    margin-top: -4px;
    border-radius: 50%;
    background: #1f1f1f;
    border: 2px solid #d1d4dc;
    box-shadow: 0 0 0 1px #000;
    cursor: grab;
}
.ind-tf-dual-wrap input[type="range"]::-moz-range-track {
    height: 4px;
    background: transparent;
    border: none;
}
.ind-tf-dual-wrap input[type="range"]::-moz-range-thumb {
    pointer-events: auto;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #1f1f1f
    border: 2px solid #d1d4dc;
    box-shadow: 0 0 0 1px #000;
    cursor: grab;
}
.ind-tf-range-lo {
    z-index: 3 !important;
}
.ind-tf-range-hi {
    z-index: 2 !important;
}

/* ─── TV-style color picker popover (компактный) ─── */
.color-picker-popover {
    position: fixed;
    z-index: 10070;
    width: 205px;
    max-width: calc(100vw - 16px);
    background: #1f1f1f;
    border: none;
    border-radius: 6px;
    box-shadow: 0 10px 32px rgba(0, 0, 0, 0.6);
    padding: 8px 9px 9px;
    font-family: 'Roboto', sans-serif;
    font-size: 11px;
    color: #d1d4dc;
}
.color-pop-main-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
}
.color-pop-main-label {
    font-size: 10px;
    color: #787b86;
}
.color-pop-cur-swatch {
    width: 30px;
    height: 18px;
    border-radius: 3px;
    border: 1px solid #474d57;
    flex-shrink: 0;
}
.color-pop-cell-sel {
    outline: 2px solid #fff;
    outline-offset: 0;
    z-index: 2;
}
.color-pop-rgb-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}
.color-pop-rgb-back {
    border: none;
    background: #2a2e39;
    color: #d1d4dc;
    width: 28px;
    height: 28px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    padding: 0;
}
.color-pop-rgb-back:hover {
    background: #363a45;
}
.color-pop-rgb-title {
    font-size: 12px;
    font-weight: 600;
    color: #fff;
}
.color-pop-rgb-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
}
.color-pop-rgb-bar .color-pop-rgb-add {
    flex-shrink: 0;
    margin-left: auto;
}
.color-pop-rgb-hsv {
    display: flex;
    gap: 6px;
    align-items: stretch;
    margin-bottom: 8px;
}
.color-pop-rgb-sv-wrap {
    position: relative;
    flex: 1;
    min-width: 0;
    border-radius: 3px;
    overflow: hidden;
    border: 1px solid #363a45;
}
.color-pop-rgb-sv {
    display: block;
    width: 100%;
    height: 132px;
    cursor: crosshair;
    vertical-align: top;
}
.color-pop-rgb-sv-marker {
    position: absolute;
    width: 10px;
    height: 10px;
    border: 2px solid #fff;
    border-radius: 50%;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.55);
    pointer-events: none;
    transform: translate(-50%, -50%);
    left: 50%;
    top: 50%;
}
.color-pop-rgb-hue-wrap {
    position: relative;
    width: 12px;
    flex-shrink: 0;
    border-radius: 2px;
    border: 1px solid #363a45;
}
.color-pop-rgb-hue {
    display: block;
    width: 12px;
    height: 132px;
    cursor: ns-resize;
    border-radius: 2px;
}
.color-pop-rgb-hue-marker {
    position: absolute;
    left: -2px;
    right: -2px;
    height: 4px;
    margin-top: -2px;
    background: rgba(255,255,255,0.15);
    border: 1.5px solid #fff;
    border-radius: 3px;
    box-shadow: 0 0 3px rgba(0,0,0,0.6);
    pointer-events: none;
    top: 50%;
}
.color-pop-preview {
    width: 24px;
    height: 24px;
    border-radius: 3px;
    border: 1px solid #474d57;
    flex-shrink: 0;
}
.color-pop-hex {
    field-sizing: content;
    min-width: 3ch;
    flex-shrink: 0;
    background: #1f1f1f;
    border: 1px solid #2962ff;
    color: #fff;
    border-radius: 3px;
    padding: 5px 6px;
    font-size: 11px;
    font-family: ui-monospace, monospace;
}
.color-pop-rgb-actions {
    display: flex;
    justify-content: flex-end;
    gap: 6px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #363a45;
}
.color-pop-rgb-cancel {
    border: 1px solid #474d57;
    background: transparent;
    color: #d1d4dc;
    font-size: 11px;
    padding: 5px 10px;
    border-radius: 5px;
    cursor: pointer;
    font-family: inherit;
}
.color-pop-rgb-cancel:hover {
    background: rgba(255, 255, 255, 0.04);
}
.color-pop-rgb-add {
    border: none;
    background: #fff;
    color: #131722;
    font-weight: 600;
    font-size: 11px;
    padding: 5px 12px;
    border-radius: 5px;
    cursor: pointer;
    font-family: inherit;
}
.color-pop-rgb-add:hover {
    filter: brightness(0.95);
}
.color-pop-grid {
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    gap: 3px;
    margin-bottom: 6px;
}
.color-pop-cell {
    width: 100%;
    aspect-ratio: 1;
    border: none;
    border-radius: 2px;
    padding: 0;
    cursor: pointer;
    box-sizing: border-box;
}
.color-pop-cell:hover {
    outline: 1px solid #fff;
    outline-offset: 1px;
    z-index: 1;
}
.color-pop-sep {
    height: 1px;
    background: #363a45;
    margin: 6px 0 7px;
}
/* Та же сетка 10×… и тот же размер ячейки, что у пресетов */
.color-pop-custom-row {
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    gap: 3px;
    margin-bottom: 6px;
}
.color-pop-plus {
    width: 100%;
    aspect-ratio: 1;
    border: 1px dashed #5c6370;
    background: #1f1f1f;
    color: #fff;
    font-size: 13px;
    font-weight: 300;
    line-height: 1;
    cursor: pointer;
    border-radius: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    box-sizing: border-box;
}
.color-pop-plus:hover {
    border-color: #2962ff;
    color: #2962ff;
}
.color-pop-alpha-block {
    margin-top: 2px;
}
.color-pop-alpha-label {
    color: #787b86;
    font-size: 10px;
    margin-bottom: 4px;
}
.color-pop-alpha-row {
    display: flex;
    align-items: center;
    gap: 6px;
}
.color-pop-alpha-track {
    position: relative;
    flex: 1;
    height: 8px;
    border-radius: 4px;
    border: 1px solid #363a45;
    background-color: #2a2e39;
    background-image: linear-gradient(45deg, #444 25%, transparent 25%),
        linear-gradient(-45deg, #444 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #444 75%),
        linear-gradient(-45deg, transparent 75%, #444 75%);
    background-size: 6px 6px;
    background-position: 0 0, 0 3px, 3px -3px, -3px 0;
}
.color-pop-alpha-grad {
    position: absolute;
    inset: 0;
    pointer-events: none;
}
.color-pop-alpha-range {
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 100%;
    height: 20px;
    margin: 0;
    padding: 0;
    cursor: pointer;
    background: transparent;
    -webkit-appearance: none;
    appearance: none;
    outline: none;
}
.color-pop-alpha-range::-webkit-slider-runnable-track {
    background: transparent;
    height: 8px;
    border-radius: 4px;
}
.color-pop-alpha-range::-moz-range-track {
    background: transparent;
    height: 8px;
    border-radius: 4px;
}
.color-pop-alpha-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #1a1a1a;
    border: 1.5px solid rgba(255,255,255,0.6);
    box-shadow: none;
    cursor: pointer;
    margin-top: -2px;
}
.color-pop-alpha-range::-moz-range-thumb {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #1a1a1a;
    border: 1.5px solid rgba(255,255,255,0.6);
    box-shadow: none;
    cursor: pointer;
    box-sizing: border-box;
}
.color-pop-alpha-val {
    min-width: 34px;
    text-align: right;
    font-size: 10px;
    color: #d1d4dc;
    border: 1px solid #474d57;
    border-radius: 4px;
    padding: 1px 4px;
    margin-top: -5px;
    background: #1f1f1f;
}
.color-pop-width-block {
    margin-top: 8px;
}
.color-pop-width-row {
    display: flex;
    gap: 0;
    margin-top: 4px;
}
.color-pop-width-btn {
    flex: 1;
    height: 30px;
    background: none;
    border: 0.5px solid rgba(242,242,242,0.55);
    border-right: none;
    border-radius: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
}
.color-pop-width-btn:first-child {
    border-radius: 3px 0 0 3px;
}
.color-pop-width-btn:last-child {
    border-right: 0.5px solid rgba(242,242,242,0.55);
    border-radius: 0 3px 3px 0;
}
.color-pop-width-active {
    background: #f2f2f2;
}
.color-pop-width-btn.color-pop-width-active span {
    background: #1f1f1f;
}
.color-pop-width-btn span {
    display: block;
    width: 70%;
    background: #f2f2f2;
    border-radius: 1px;
}
.color-pop-width-btn[data-w="1"] span { height: 1px; }
.color-pop-width-btn[data-w="2"] span { height: 2px; }
.color-pop-width-btn[data-w="3"] span { height: 3px; }
.color-pop-width-btn[data-w="4"] span { height: 4px; }
.color-pop-ls-block {
    margin-top: 8px;
}
.color-pop-ls-row {
    display: flex;
    gap: 0;
    margin-top: 4px;
}
.color-pop-ls-btn {
    flex: 1;
    height: 30px;
    background: none;
    border: 0.5px solid rgba(242,242,242,0.55);
    border-right: none;
    border-radius: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
}
.color-pop-ls-btn:first-child { border-radius: 3px 0 0 3px; }
.color-pop-ls-btn:last-child {
    border-right: 0.5px solid rgba(242,242,242,0.55);
    border-radius: 0 3px 3px 0;
}
.color-pop-ls-active { background: #f2f2f2; }
.color-pop-ls-solid {
    display: block;
    width: 70%;
    height: 2px;
    background: #f2f2f2;
}
.color-pop-ls-btn.color-pop-ls-active .color-pop-ls-solid {
    background: #1f1f1f;
}
.color-pop-ls-dashed {
    display: block;
    width: 70%;
    height: 2px;
    background: repeating-linear-gradient(90deg, #f2f2f2 0, #f2f2f2 5px, transparent 5px, transparent 8px);
}
.color-pop-ls-btn.color-pop-ls-active .color-pop-ls-dashed {
    background: repeating-linear-gradient(90deg, #1f1f1f 0, #1f1f1f 5px, transparent 5px, transparent 8px);
}
.color-pop-ls-dotted {
    display: block;
    width: 70%;
    height: 2px;
    background: repeating-linear-gradient(90deg, #f2f2f2 0, #f2f2f2 2px, transparent 2px, transparent 5px);
}
.color-pop-ls-btn.color-pop-ls-active .color-pop-ls-dotted {
    background: repeating-linear-gradient(90deg, #1f1f1f 0, #1f1f1f 2px, transparent 2px, transparent 5px);
}

@media (max-width: 768px) {
    .indicators-modal-overlay {
        padding: max(10px, env(safe-area-inset-top, 0px)) 12px max(10px, env(safe-area-inset-bottom, 0px)) 12px;
        align-items: center;
        justify-content: center;
    }
    .indicators-modal-panel {
        width: min(100%, calc(100vw - 24px));
        max-height: min(85vh, 640px);
        margin: 0;
        border-radius: 10px;
    }
    .indicators-modal-body {
        flex-direction: column;
    }
    .indicators-modal-sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid #2a2e39;
        display: flex;
        flex-wrap: wrap;
        gap: 4px;
        padding: 10px 12px;
    }
    .indicators-modal-side-caption {
        width: 100%;
        padding-bottom: 4px;
    }
    .indicators-modal-side-item {
        padding: 8px 12px;
        border-radius: 6px;
        background: #3d3d3d;
        border: none;
    }
    .indicators-modal-tab {
        border: none;
    }
    .indicators-modal-tab-active {
        border-color: transparent !important;
    }
    .indicators-modal-side-item.indicators-modal-side-muted {
        color: #d1d4dc;
    }
    .indicators-modal-table-head,
    .indicators-modal-row {
        grid-template-columns: 22px 1fr 72px;
    }
}

/* ============================================================
   TABLE COLLAPSE
   ============================================================ */
/* Resizer has padding:0 5px → padding-box = 11px wide,
   the actual 1px line sits at offset 5–6px inside that box.
   Button on TABLE side: left: 6px  (starts right at the line's right edge)
   Button on CHART side: right: 6px (ends right at the line's left edge) */
.table-collapse-tab {
    position: absolute;
    bottom: 80px;
    left: 6px;
    right: auto;
    width: 10px;
    height: 26px;
    background: #2b3139;
    border: 1px solid #474d57;
    border-radius: 0 4px 4px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer !important;
    font-size: 11px;
    line-height: 1;
    color: #848e9c;
    z-index: 500;
    pointer-events: all !important;
    transition: background 0.15s, color 0.15s;
}
.table-collapse-tab:hover { background: #3c4150; color: #c9d1dc; }
/* Collapsed: button flips to chart/scale side, resizer becomes non-interactive */
.resizer-vertical.table-collapsed { cursor: default !important; pointer-events: none; }
.resizer-vertical.table-collapsed .table-collapse-tab {
    display: none !important;
    left: auto;
    right: 6px;
    border-radius: 3px 0 0 3px;
    pointer-events: all !important;
    cursor: pointer !important;
}
.table-wrapper.table-collapsed { width: 0 !important; overflow: hidden; }

/* ============================================================
   МОБИЛЬНАЯ ВЕРСИЯ (≤768px)
   ============================================================ */
@media (max-width: 768px) {
    * { box-sizing: border-box; }
    body { overflow-y: auto !important; overflow-x: hidden !important; touch-action: pan-y !important; height: auto !important; }
    html { overflow-x: hidden !important; }
    .main-container { display: flex !important; flex-direction: column !important; height: auto !important; overflow-x: hidden !important; }
    .main-body { flex-direction: column !important; }
    .dom-content { --dom-price-w: calc(50vw - calc(var(--dom-pnl-w) / 2)) !important; }
    .dom-content::before {
        content: '';
        position: absolute;
        top: 29px; bottom: 0;
        right: calc(var(--dom-price-w) / 2 - 2px);
        width: 5px;
        background: rgba(255,255,255,0.18);
        pointer-events: none;
        z-index: 0;
        opacity: 0;
        transition: opacity 0.15s;
    }
    .dom-content.dom-armed::before { opacity: 1; }
    .dom-trade-ovl {
        position: absolute;
        top: 29px; bottom: 0;
        z-index: 6;
        background: transparent;
        transition: background 0.15s;
        pointer-events: none;
    }
    .dom-trade-buy {
        right: calc(var(--dom-price-w) / 2 + 3px);
        width: calc(var(--dom-price-w) / 2 - 3px);
    }
    .dom-trade-sell {
        right: 0;
        width: calc(var(--dom-price-w) / 2 - 2px);
    }
    .dom-trade-price-col {
        right: 0;
        width: var(--dom-price-w);
        z-index: 8;
        pointer-events: auto;
    }
    .dom-content.dom-armed {
        background:
            linear-gradient(to bottom, #0f0f0f 29px, transparent 29px),
            linear-gradient(to right,
                #0f0f0f calc(100% - var(--dom-price-w)),
                rgba(14,203,129,0.08) calc(100% - var(--dom-price-w)),
                rgba(14,203,129,0.08) calc(100% - var(--dom-price-w) / 2 - 3px),
                #0f0f0f calc(100% - var(--dom-price-w) / 2 - 3px),
                #0f0f0f calc(100% - var(--dom-price-w) / 2 + 2px),
                rgba(246,70,93,0.08) calc(100% - var(--dom-price-w) / 2 + 2px)
            ),
            #0f0f0f;
    }
    .dom-trade-lbl {
        display: none;
        position: absolute;
        transform: translateY(-50%);
        color: #fff;
        font-size: 11px;
        font-weight: 400;
        pointer-events: none;
        white-space: nowrap;
    }
    .dom-content.dom-armed .dom-trade-lbl { display: block; }
    .dom-trade-lbl-buy  { right: calc(50% + 8px); text-align: right; }
    .dom-trade-lbl-sell { left: calc(50% + 8px);  text-align: left; }
    .toolbar-right {
        display: flex !important;
        position: static !important;
        order: 2 !important;
        width: 100vw !important;
        height: auto !important;
        flex-direction: row !important;
        flex-wrap: wrap !important;
        border-left: none !important;
        border-top: 1px solid #2b3139 !important;
        border-bottom: 1px solid #2b3139 !important;
        justify-content: center !important;
        align-items: center !important;
        padding: 12px 0 10px !important;
        background-color: #0f0f0f !important;
        flex-shrink: 0 !important;
    }
    .table-wrapper { order: 3 !important; }
    /* 40px top-bar + ~56px компактный тулбар — иначе таблица «вылезает» в первый экран (раньше заложили 80px тулбара) */
    .charts-wrapper {
        width: 100vw !important;
        height: calc(100dvh - 96px) !important;
        max-height: calc(100dvh - 96px) !important;
        flex: none !important;
    }
    /* В Safari вкладке не трогаем safe-area снизу (иначе ~34px «воздуха») и не держим лишнюю высоту 80px */
    .toolbar {
        order: 0;
        width: 100vw !important;
        height: auto !important;
        min-height: 0 !important;
        flex-direction: row !important;
        border-right: none !important;
        border-top: 1px solid #2b3139 !important;
        justify-content: center !important;
        align-items: flex-start !important;
        padding-top: 12px !important;
        padding-bottom: 10px !important;
        background-color: #0f0f0f !important;
        flex: none !important;
        box-sizing: border-box !important;
        z-index: 2001 !important;
    }
    .tool-btn { margin-bottom: 0 !important; margin-right: 10px !important; height: 32px !important; width: 32px !important; }
    .tv-tool-group { margin-bottom: 0 !important; margin-right: 10px !important; }
    .tv-tool-group .tv-group-btn { margin: 0 !important; }
    .tv-submenu-shortcut { display: none !important; }
    .toolbar-separator {
        width: 1px;
        height: 24px;
        margin: 4px 8px 0 2px;
    }
    .toolbar-trash-group { margin-right: 8px !important; }
    .toolbar-trash-submenu {
        top: auto !important;
        bottom: 100% !important;
        left: 50% !important;
        transform: translateX(-50%) !important;
        margin: 0 0 8px !important;
        min-width: 260px !important;
    }
    .table-wrapper {
        width: 100vw !important;
        border-left: none !important;
        display: block !important;
        height: auto !important;
        flex: none !important;
    }
    /* В обычном Safari нижний safe-area на таблице, не на тулбаре (контент не под home indicator) */
    html:not(.oki-pwa) .table-wrapper {
        padding-bottom: env(safe-area-inset-bottom, 0px);
    }
    .table-collapse-tab { display: none !important; }
    #price-container { flex: 72 1 0%; min-height: 0; }
    #gd-container    { flex: 14 1 0%; min-height: 20px; }
    #macd-container  { flex: 14 1 0%; min-height: 20px; }
    #rsi-container   { flex: 14 1 0%; min-height: 20px; }
    #time-area { flex: 0 0 24px !important; height: 24px !important; }

    #top-bar {
        justify-content: flex-start !important;
        border-bottom: 1px solid #2b3139 !important;
    }
    #tf-selector { display: none !important; }
    #tf-bar { display: none !important; }
    #tf-bar + .topbar-undo-redo-sep { display: none !important; }
    #topbar-controls .cs-wrap { display: none !important; }
    #topbar-controls {
        padding-right: 10px !important;
    }
    .tf-mobile-trigger {
        display: flex !important;
        position: relative;
        left: 0;
    }

    .tv-submenu-arrow {
        opacity: 1 !important;
        left: 50% !important;
        right: auto !important;
        top: -8px !important;
        bottom: auto !important;
        transform: translateX(-50%) !important;
        width: 32px !important;
        height: 8px !important;
        border-radius: 0 0 3px 3px !important;
    }
    .tv-submenu-arrow::after {
        transform: rotate(-45deg) !important;
    }
    .tv-submenu-arrow.open::after,
    .tool-btn.menu-open .tv-submenu-arrow::after {
        transform: rotate(135deg) !important;
    }
    /* Только подменю у тулбара — не трогать #footprint-mode-dialog.tv-submenu */
    .toolbar .tv-submenu {
        top: auto !important;
        bottom: 100% !important;
        left: 50% !important;
        transform: translateX(-50%) !important;
        margin-left: 0 !important;
        margin-bottom: 8px !important;
    }
    .resizer {
        display: block !important; height: 24px !important; background: transparent !important;
        z-index: 1000; position: relative; cursor: row-resize; margin: -12px 0 !important;
        touch-action: none; -webkit-tap-highlight-color: transparent;
        outline: none !important; border: none !important;
    }
    .resizer:hover,
    .resizer:active,
    .resizer:focus,
    .resizer:focus-visible {
        background: transparent !important;
    }
    .resizer::after {
        content: ""; display: block; position: absolute; top: 50%; left: 0;
        width: 100%; height: 1px; background-color: rgba(255,255,255,0.15);
        transform: translateY(-50%); transition: background-color 0.1s; pointer-events: none;
    }
    .resizer.dragging::after { background-color: #0ecb81 !important; height: 1px !important; }
    .resizer-vertical { display: none !important; }
}

/* Большой нижний отступ и запас под home indicator — только PWA (manifest + старый navigator.standalone) */
@media (max-width: 768px) and (display-mode: standalone),
       (max-width: 768px) and (display-mode: fullscreen) {
    .toolbar {
        min-height: 80px !important;
        height: auto !important;
        padding-bottom: max(40px, env(safe-area-inset-bottom, 0px)) !important;
    }
    /* PWA: прежняя высота графика под высокий тулбар */
    .charts-wrapper {
        height: calc(100dvh - 120px) !important;
        max-height: calc(100dvh - 120px) !important;
    }
}
@media (max-width: 768px) {
    html.oki-pwa .toolbar {
        min-height: 80px !important;
        height: auto !important;
        padding-bottom: max(40px, env(safe-area-inset-bottom, 0px)) !important;
    }
    html.oki-pwa .charts-wrapper {
        height: calc(100dvh - 120px) !important;
        max-height: calc(100dvh - 120px) !important;
    }
    html.oki-pwa .table-wrapper {
        padding-bottom: 0;
    }
}

/* Модалка режима футпринта — те же токены, что у .tv-submenu */
.footprint-mode-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 10050;
    align-items: center;
    justify-content: center;
    background-color: rgba(0, 0, 0, 0.45);
}
.footprint-mode-dialog.tv-submenu {
    position: fixed !important;
    left: 0;
    top: 0;
    margin-left: 0 !important;
    display: none !important;
    flex-direction: column;
    align-items: stretch;
    box-sizing: border-box;
    width: max-content;
    min-width: 260px;
    max-width: min(360px, calc(100vw - 24px));
    padding: 8px 0 10px;
    z-index: 10051;
}
.footprint-mode-dialog.tv-submenu.fp-submenu-open {
    display: flex !important;
}
/* Центр экрана при fp-dialog-centered (не конфликтует с .toolbar .tv-submenu после фикса выше) */
#footprint-mode-dialog.footprint-mode-dialog.tv-submenu.fp-submenu-open.fp-dialog-centered {
    top: 50% !important;
    bottom: auto !important;
    left: 50% !important;
    right: auto !important;
    transform: translate(-50%, -50%) !important;
    margin: 0 !important;
    width: max-content;
    max-width: calc(100vw - 32px);
}
@media (max-width: 768px) {
    #footprint-mode-dialog.footprint-mode-dialog.tv-submenu.fp-submenu-open.fp-dialog-centered {
        max-height: min(420px, calc(100dvh - 48px));
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    .watchlist-list { padding-bottom: 100px; }
    .wl-row:hover { background: transparent; }
    .wl-row:hover .wl-remove-btn { display: none; }
    .alerts-log-scroll { padding-bottom: 100px; }
}
/* Единые горизонтальные поля: заголовок и строки по одной линии */
#footprint-mode-dialog .fp-footprint-header.tv-submenu-header {
    padding: 10px 14px 8px;
    margin: 0;
    box-sizing: border-box;
    align-self: stretch;
}
#footprint-mode-dialog .tv-submenu-item.fp-footprint-row {
    height: auto;
    min-height: 40px;
    margin: 0 0 4px;
    padding: 10px 14px;
    align-items: flex-start;
    align-self: stretch;
    width: auto;
    max-width: none;
    box-sizing: border-box;
}
#footprint-mode-dialog .tv-submenu-item.fp-footprint-row:last-of-type {
    margin-bottom: 0;
}
#footprint-mode-dialog .fp-footprint-item-label-wrap {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    margin: 0;
    min-width: 0;
    justify-content: center;
    line-height: 1.3;
}
#footprint-mode-dialog .fp-footprint-primary.tv-submenu-item-label {
    margin-left: 0 !important;
    flex: none !important;
    white-space: normal;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.35;
}
#footprint-mode-dialog .fp-footprint-secondary {
    font-size: 11px;
    color: #787b86;
    margin-top: 4px;
    line-height: 1.35;
}
#footprint-mode-dialog .tv-submenu-item.active .fp-footprint-secondary {
    color: #434651;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   WATCHLIST (mode внутри table-wrapper)
   ============================================================ */
/* Переключение режимов: видим только то, что соответствует mode */
.table-wrapper.mode-table    #watchlist-content  { display: none !important; }
.table-wrapper.mode-table    #alerts-log-content { display: none !important; }
.table-wrapper.mode-table    #dom-content        { display: none !important; }
.table-wrapper.mode-watchlist #trades-header,
.table-wrapper.mode-watchlist #trades-scroll-area,
.table-wrapper.mode-watchlist #alerts-log-content,
.table-wrapper.mode-watchlist #dom-content        { display: none !important; }
.table-wrapper.mode-alerts-log #trades-header,
.table-wrapper.mode-alerts-log #trades-scroll-area,
.table-wrapper.mode-alerts-log #watchlist-content,
.table-wrapper.mode-alerts-log #dom-content       { display: none !important; }
.table-wrapper.mode-dom #trades-header,
.table-wrapper.mode-dom #trades-scroll-area,
.table-wrapper.mode-dom #watchlist-content,
.table-wrapper.mode-dom #alerts-log-content       { display: none !important; }
/* default: dom-content hidden unless mode-dom */
#dom-content { display: none; }

/* ── Alerts Log panel ─────────────────────────────────── */
.alerts-log-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
    background: #0f0f0f;
}
.alerts-log-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px 8px;
    border-bottom: 1px solid rgba(255,255,255,0.07);
    flex-shrink: 0;
}
.alerts-log-title {
    font-size: 12px;
    font-weight: 700;
    color: #d1d4dc;
    letter-spacing: 0.02em;
}
.al-del-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: #848e9c;
    padding: 4px;
    display: flex;
    align-items: center;
    flex-shrink: 0;
    opacity: 0;
    transition: color 0.12s, opacity 0.12s;
}
.al-item:hover .al-del-btn { opacity: 1; }
.al-del-btn:hover { color: #f6465d; }
#btn-toggle-alerts-log { position: relative; }
.alerts-log-badge {
    display: none;
    position: absolute;
    top: 0;
    right: 0;
    min-width: 15px;
    height: 15px;
    padding: 0 3px;
    background: #f6465d;
    color: #fff;
    font-size: 9px;
    font-weight: 700;
    border-radius: 8px;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    line-height: 1;
    box-sizing: border-box;
}
.alerts-log-badge.visible { display: flex; }

.al-clear-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: #848e9c;
    padding: 2px;
    display: flex;
    align-items: center;
    transition: color 0.12s;
}
.al-clear-btn:hover { color: #f6465d; }
.alerts-log-scroll {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
}
.al-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 8px 12px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    cursor: default;
    transition: background 0.1s;
}
.al-item:hover { background: #0d1117; }
.al-icon {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    font-weight: 700;
    color: #fff;
    background: #2b3139;
    overflow: hidden;
    margin-top: 1px;
}
.al-icon img { width: 22px; height: 22px; object-fit: contain; }
.al-body { flex: 1; min-width: 0; }
.al-name {
    font-size: 12px;
    font-weight: 600;
    color: #d1d4dc;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.4;
}
.al-meta {
    font-size: 11px;
    color: #848e9c;
    display: flex;
    gap: 6px;
    align-items: center;
    margin-top: 2px;
    flex-wrap: wrap;
}
.al-sym { color: #d1d4dc; }
.al-dot { opacity: 0.4; }
.al-fired     { color: #848e9c; font-size: 10px; }
.al-active    { color: #0ecb81; font-size: 10px; }
.al-stopped   { color: #848e9c; font-size: 10px; }
.al-dash      { color: #848e9c; font-size: 10px; }
.al-fired-lbl { color: #f0b90b; font-size: 10px; }
.al-empty {
    padding: 32px 16px;
    text-align: center;
    font-size: 12px;
    color: #848e9c;
}

.watchlist-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
    background: #0f0f0f;
}
.watchlist-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px 8px;
    border-bottom: 1px solid rgba(255,255,255,0.07);
    flex-shrink: 0;
}
.watchlist-title {
    font-size: 12px;
    font-weight: 700;
    color: #d1d4dc;
    letter-spacing: 0.02em;
    white-space: nowrap;
}
.watchlist-header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}
.watchlist-add-btn {
    width: 22px;
    height: 22px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    line-height: 1;
    color: #848e9c;
    cursor: pointer;
    transition: background 0.12s, color 0.12s;
    flex-shrink: 0;
}
.watchlist-add-btn:hover { background: #2b3139; color: #fff; }
.watchlist-add-btn.active { color: #0ecb81; }

/* ── Watchlist search modal rows ── */
.wl-sr {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    gap: 10px;
    border-bottom: 1px solid #1e222d;
    cursor: pointer;
    transition: background 0.1s;
}

.wl-sa {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border: none;
    background: none;
    cursor: pointer;
    line-height: 1;
    flex-shrink: 0;
    color: #848e9c;
    padding: 0;
    transition: color 0.12s;
}
.wl-sa-add { font-size: 22px; font-weight: 300; width: 28px; height: 28px; }
.wl-sa-remove { font-size: 17px; }
.wl-sa-go:hover { color: #d1d4dc; }
.wl-sa-add:hover  { color: #d1d4dc; }
.wl-sa-remove:hover { color: #f6465d; }

/* ── Watchlist search modal ── */
#wl-search-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(0,0,0,0.65);
    align-items: flex-start;
    justify-content: center;
    padding-top: 60px;
}
.wl-search-box {
    background: #1f1f1f;
    border-radius: 10px;
    width: min(560px, 96vw);
    max-height: 70vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 40px rgba(0,0,0,0.8);
    overflow: hidden;
}
.wl-search-header {
    padding: 14px 16px 10px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.wl-market-tabs {
    display: flex;
    gap: 6px;
    padding: 8px 16px;
    border-bottom: 1px solid #2a2e39;
}
.wl-search-header svg { flex-shrink: 0; }
#wl-search-input {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    color: #d1d4dc;
    font-size: 15px;
    font-family: inherit;
}
#wl-search-close {
    background: none;
    border: none;
    color: #848e9c;
    cursor: pointer;
    font-size: 22px;
    line-height: 1;
    padding: 0 2px;
}
#wl-search-list {
    overflow-y: auto;
    flex: 1;
}
.wl-search-empty {
    color: #848e9c;
    padding: 24px;
    text-align: center;
    font-size: 13px;
}
.wl-sr-icon {
    width: 22px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.wl-sr-icon .sym-coin-img {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: none;
}
.wl-sr-icon .sym-coin-fallback {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #2b3139;
    color: #d1d4dc;
    font-size: 10px;
    font-weight: 700;
    display: none;
    align-items: center;
    justify-content: center;
}
.wl-sr-sym {
    font-size: 13px;
    font-weight: 600;
    color: #d1d4dc;
    min-width: 120px;
}
.wl-sr-base {
    font-size: 12px;
    color: #848e9c;
    flex: 1;
}
.wl-sr-vol {
    font-size: 11px;
    color: #848e9c;
    min-width: 44px;
    text-align: right;
    margin-right: 8px;
}

/* legacy (kept for reference, unused) */
.watchlist-search-item {
    padding: 7px 12px;
    font-size: 12px;
    color: #d1d4dc;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: background 0.1s;
}
.watchlist-search-item:hover { background: #2b3139; color: #fff; }
.watchlist-search-item-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    min-width: 0;
}

.watchlist-cols-header {
    display: flex;
    align-items: center;
    padding: 5px 8px;
    border-bottom: 1px solid rgba(255,255,255,0.07);
    flex-shrink: 0;
}
.wl-col {
    font-size: 12px;
    font-weight: 500;
    color: #787b86;
    letter-spacing: 0.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.wl-col-name  { flex: 1 1 0; min-width: 0; }
.wl-col-price { width: 72px; text-align: right; flex-shrink: 0; }
.wl-col-chg   { width: 52px; text-align: right; flex-shrink: 0; }
.wl-col-vol   { width: 48px; text-align: right; flex-shrink: 0; }

.watchlist-list {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
}
.wl-row {
    display: flex;
    align-items: center;
    padding: 6px 8px;
    touch-action: manipulation;
    cursor: pointer;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    transition: background 0.1s;
    position: relative;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}
.wl-row * {
    -webkit-touch-callout: none;
    pointer-events: none;
}
.wl-row .wl-remove-btn {
    pointer-events: auto;
}
.wl-row:hover { background: rgba(255,255,255,0.04); }
.wl-row.active {
    background: rgba(255,255,255,0.05);
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.55);
    border-radius: 6px;
}
.wl-row.wl-dragging { opacity: 0.4; }
.wl-row.wl-drag-over-top { box-shadow: inset 0 2px 0 #848e9c; }
.wl-row.wl-drag-over-bot { box-shadow: inset 0 -2px 0 #848e9c; }
.wl-row-icon {
    width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-right: 8px;
}
.wl-row-icon .sym-coin-img {
    width: 16px;
    height: 16px;
    border-radius: 50%;
}
.wl-row-icon .sym-coin-fallback {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #2b3139;
    color: #d1d4dc;
    font-size: 9px;
    font-weight: 700;
    align-items: center;
    justify-content: center;
    line-height: 1;
}
.wl-row-name {
    flex: 1 1 0;
    min-width: 0;
    font-size: 12px;
    font-weight: 500;
    color: #d1d4dc;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.wl-row-sym {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #d1d4dc;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.wl-row-price {
    width: 72px;
    text-align: right;
    font-size: 12px;
    font-weight: 500;
    color: #d1d4dc;
    flex-shrink: 0;
    white-space: nowrap;
}
.wl-row-chg {
    width: 52px;
    text-align: right;
    font-size: 12px;
    font-weight: 500;
    flex-shrink: 0;
    white-space: nowrap;
}
.wl-row-vol {
    width: 48px;
    text-align: right;
    font-size: 11px;
    color: #848e9c;
    flex-shrink: 0;
    white-space: nowrap;
}
.wl-chg-up   { color: #0ecb81; }
.wl-chg-down { color: #f6465d; }
.wl-chg-flat { color: #848e9c; }

.wl-price-up   { color: #0ecb81; }
.wl-price-down { color: #f6465d; }

.wl-remove-btn {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    width: 22px;
    height: 22px;
    border-radius: 3px;
    display: none;
    align-items: center;
    justify-content: center;
    color: #848e9c;
    cursor: pointer;
    background: #1e222d;
}
.wl-row:hover .wl-remove-btn { display: flex; }
.wl-remove-btn:hover { color: #f6465d; background: #2b1a1e; }

/* Кнопки правого тулбара — SVG с currentColor */
#btn-toggle-watchlist.active,
#btn-toggle-alerts-log.active { color: #ffffff; }
#btn-toggle-watchlist img { filter: invert(0.5); transition: filter 0.1s; }
#btn-toggle-watchlist.active img { filter: invert(1) sepia(1) saturate(3) hue-rotate(100deg) brightness(1.1); }
#btn-toggle-watchlist:hover img { filter: invert(1); }

/* ── Favorites floating toolbar ─────────────────────────────────────────── */
#fav-toolbar {
    position: fixed;
    z-index: 9998;
    background: #1f1f1f;
    border-radius: 5px;
    padding: 3px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.55);
    user-select: none;
    touch-action: none;
}
#fav-toolbar.fav-h {
    flex-direction: row;
    align-items: center;
}
.fav-drag-handle {
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: grab;
    color: #4a4f5a;
    border-radius: 3px;
    flex-shrink: 0;
    width: 18px;
    height: 26px;
    transition: color 0.1s;
}
#fav-toolbar.fav-h .fav-drag-handle {
    width: 18px;
    height: 26px;
}
.fav-drag-handle:hover { color: #848e9c; }
.fav-drag-handle:active { cursor: grabbing; }
body.fav-dragging, body.fav-dragging * { cursor: grabbing !important; }
.fav-btn {
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.1s;
    flex-shrink: 0;
}
.fav-btn img { opacity: 0.5; transition: opacity 0.1s; }
.fav-btn:hover { background: #2a2e39; }
.fav-btn:hover img { opacity: 1; }
.fav-btn.fav-btn-active { background: transparent; }

/* Star buttons in submenu rows */
.fav-star-btn {
    display: none;
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    border-radius: 3px;
    margin-left: 6px;
    color: #848e9c;
    cursor: pointer;
    transition: color 0.1s;
}
.tv-submenu-item:hover .fav-star-btn { display: flex; }
.fav-star-btn.fav-star-active { display: flex; color: #ffffff; }
.fav-star-btn:hover { color: #ffffff; }
@media (max-width: 768px) {
    .fav-star-btn { display: flex; }
    #fav-toolbar { position: absolute; padding: 4px; gap: 2px; }
    .fav-btn { width: 30px; height: 30px; }
    .fav-drag-handle { width: 18px; height: 30px; }
}
.main-container { position: relative; }

/* Toggle button — прижат к низу тулбара */
#fav-toggle-btn {
    color: #848e9c;
    margin-top: auto;
    margin-bottom: 8px;
    background: #2b3139;
}
#fav-toggle-btn:hover { background: #2b3139; }
#fav-toggle-btn.active { background: #ffffff; }
#fav-toggle-btn.active svg { stroke: #131722; }
#fav-toggle-btn svg { transition: fill 0.15s, stroke 0.15s; }
@media (max-width: 768px) {
    #fav-toggle-btn { display: none !important; }
}

/* ── DOM (Depth of Market) ─────────────────────────────── */
.dom-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    min-height: 0;
    overflow: hidden;
    background: #0f0f0f;
    font-size: 12px;
    font-family: 'Roboto', sans-serif;
    position: relative;
    --dom-price-w: 82px;
    --dom-pnl-w: 18px;
}
.table-wrapper.mode-dom #dom-content { display: flex !important; }

.dom-status {
    padding: 8px 12px;
    color: #848e9c;
    font-size: 11px;
    text-align: center;
    flex-shrink: 0;
}

/* Tick input inside header */
.dom-tick-input {
    box-sizing: border-box;
    width: 82px;
    flex-shrink: 0;
    background: rgba(255,255,255,0.07);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 3px;
    color: #d1d4dc;
    font-size: 11px;
    font-family: inherit;
    padding: 2px 6px;
    height: 20px;
    outline: none;
    text-align: right;
    -moz-appearance: textfield;
}
.dom-tick-input::-webkit-outer-spin-button,
.dom-tick-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.dom-tick-input:focus {
    border-color: rgba(255,255,255,0.3);
    background: rgba(255,255,255,0.1);
}
.dom-tick-input-price { grid-column: 3; margin-left: auto; margin-right: 4px; width: calc(var(--dom-price-w) - 22px); min-width: 0; background: transparent; }
.dom-tick-input-price:focus { background: transparent; }
.dom-vol-filter-hdr { margin-left: auto; margin-right: 4px; width: 41px; max-width: 41px; min-width: 0; flex-shrink: 0; background: transparent; }
.dom-vol-filter-hdr:focus { background: transparent; }

/* Column header */
.dom-header {
    display: grid;
    grid-template-columns: 1fr var(--dom-pnl-w) var(--dom-price-w);
    align-items: center;
    padding: 4px 0 4px 0;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    color: #848e9c;
    font-size: 10px;
    flex-shrink: 0;
}
.dom-header-vol {
    display: flex;
    align-items: center;
    min-width: 0;
    overflow: hidden;
}

/* Scrollable body */
.dom-body {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
    scrollbar-width: thin;
    scrollbar-color: #2b3139 transparent;
    position: relative;
}
#dom-imbalance {
    position: absolute;
    top: 8px;
    left: 8px;
    right: calc(var(--dom-price-w) + var(--dom-pnl-w) + 8px);
    height: 14px;
    display: none;
    z-index: 4;
    overflow: hidden;
    border-radius: 2px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.5);
}
.dom-imb-bid {
    background: #0ecb81;
    color: #fff;
    font-size: 10px;
    font-weight: 600;
    padding: 0 4px;
    display: flex;
    align-items: center;
    white-space: nowrap;
}
.dom-imb-ask {
    background: #f6465d;
    color: #fff;
    font-size: 10px;
    font-weight: 600;
    padding: 0 4px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    white-space: nowrap;
    flex: 1;
}

.dom-body::before {
    content: '';
    position: absolute;
    top: 0; bottom: 0;
    width: 1px;
    background: rgba(255,255,255,0.06);
    pointer-events: none;
    z-index: 2;
    right: calc(var(--dom-price-w) + var(--dom-pnl-w));
}

/* right edge of pnl column */
.dom-body::after {
    content: '';
    position: absolute;
    top: 0; bottom: 0;
    right: var(--dom-price-w);
    width: 1px;
    background: rgba(255,255,255,0.06);
    pointer-events: none;
    z-index: 2;
    transition: background 0.15s;
}
.dom-body.dom-resizing::after,
.dom-body.dom-resize-hover::after { background: rgba(255,255,255,0.22); width: 2px; }
.dom-body.dom-resize-hover, .dom-body.dom-resize-hover * { cursor: col-resize !important; }
.dom-body.dom-resizing, .dom-body.dom-resizing * { cursor: col-resize !important; }
#dom-pnl-resizer { display: none; }
.dom-body::-webkit-scrollbar { width: 0; }
.dom-body { scrollbar-width: none; }

.dom-spread-divider {
    height: 1px;
    background: rgba(255,255,255,0.06);
    flex-shrink: 0;
}

.dom-row {
    position: relative;
    display: flex;
    align-items: center;
    height: 17px;
    cursor: default;
    margin-bottom: 2px;
}

.dom-row:hover { background: rgba(255,255,255,0.035); }

.dom-qty {
    flex: 1;
    text-align: right;
    padding-right: 8px;
    font-size: 11.5px;
    position: relative;
    z-index: 1;
    white-space: nowrap;
    color: #ffffff;
}

.dom-pnl {
    width: var(--dom-pnl-w);
    flex-shrink: 0;
    position: relative;
    height: 100%;
}

.dom-price {
    width: var(--dom-price-w);
    box-sizing: border-box;
    flex-shrink: 0;
    text-align: right;
    padding-right: 10px;
    font-size: 12px;
    font-weight: 500;
    position: relative;
    z-index: 1;
    white-space: nowrap;
    color: #d1d4dc;
    cursor: pointer;
}

.dom-mid-row .dom-price { color: #ffffff; font-weight: 700; }
.dom-equilibrium .dom-price { color: #f0b90b; font-weight: 600; }

.dom-bar {
    position: absolute;
    top: 0; left: 0;
    right: calc(var(--dom-price-w) + var(--dom-pnl-w) + 2px);
    height: 100%;
    pointer-events: none;
    transform-origin: right center;
    will-change: transform;
}
.dom-bar-ask { background: #f6465d; border-radius: 3px 0 0 3px; }
.dom-bar-bid { background: #0ecb81; border-radius: 3px 0 0 3px; }
.dom-bar-spot-ask { background: #c43a4f; border-radius: 3px 0 0 3px; }
.dom-bar-spot-bid { background: #0a9e65; border-radius: 3px 0 0 3px; }
.dom-near.dom-ask .dom-price,
.dom-near.dom-bid .dom-price { align-self: stretch; display: flex; align-items: center; justify-content: flex-end; }
.dom-near.dom-ask .dom-price { background: #f6465d; border-radius: 3px; color: #fff; }
.dom-near.dom-bid .dom-price { background: #0ecb81; border-radius: 3px; color: #fff; }

.dom-row-order-buy::after,
.dom-row-order-sell::after {
    content: '';
    position: absolute;
    top: 0; bottom: 0; right: 0;
    width: calc(var(--dom-price-w) - 2px);
    border-radius: 3px;
    pointer-events: none;
    z-index: 2;
}
.dom-row-order-buy::after  { box-shadow: inset 0 0 0 1px #0ecb81; }
.dom-row-order-sell::after { box-shadow: inset 0 0 0 1px #f6465d; }

.dom-row-order-sl::after,
.dom-row-order-tp::after {
    content: '';
    position: absolute;
    top: 0; bottom: 0; right: 0;
    width: calc(var(--dom-price-w) - 2px);
    border-radius: 3px;
    pointer-events: none;
    z-index: 2;
}
.dom-row-order-sl::after { box-shadow: inset 0 0 0 1px #f6465d; }
.dom-row-order-tp::after { box-shadow: inset 0 0 0 1px #0ecb81; }



.dom-cancel-btn {
    position: absolute;
    left: calc(100% - var(--dom-price-w) + 4px);
    transform: translateY(-50%);
    font-size: 14px;
    line-height: 1;
    color: #848e9c;
    cursor: pointer;
    padding: 0 3px;
    z-index: 10;
    pointer-events: auto;
}
.dom-cancel-btn:hover { color: #f6465d; }
.dom-row-armed::before {
    content: '';
    position: absolute;
    top: 0; bottom: 0; left: 0; right: 0;
    pointer-events: none;
    z-index: 0;
    background: linear-gradient(to right,
        transparent calc(100% - var(--dom-price-w) + 2px),
        #0ecb81 calc(100% - var(--dom-price-w) + 2px),
        #0ecb81 calc(100% - var(--dom-price-w) / 2 - 3px),
        transparent calc(100% - var(--dom-price-w) / 2 - 3px),
        transparent calc(100% - var(--dom-price-w) / 2 + 2px),
        #f6465d calc(100% - var(--dom-price-w) / 2 + 2px)
    );
}
.dom-row-armed::after {
    content: '';
    position: absolute;
    top: -1px; bottom: -1px; right: 0;
    width: calc(var(--dom-price-w) - 2px);
    border: 1px solid #fff;
    border-radius: 3px;
    pointer-events: none;
    z-index: 1;
}

/* Spread row */
.dom-spread-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 20px;
    flex-shrink: 0;
    border-top: 1px solid rgba(255,255,255,0.05);
    border-bottom: 1px solid rgba(255,255,255,0.05);
    background: rgba(255,255,255,0.02);
}
.dom-spread-val {
    font-size: 11px;
    color: #d1d4dc;
}
.dom-spread-pct {
    font-size: 10px;
    color: #848e9c;
}

.dom-settings-btn {
    background: none;
    border: none;
    color: #848e9c;
    cursor: pointer;
    padding: 0 4px;
    display: flex;
    align-items: center;
    flex-shrink: 0;
    margin-right: 2px;
}
.dom-settings-btn:hover { color: #d1d4dc; }

.dom-recenter-btn {
    position: absolute;
    bottom: 8px;
    left: 8px;
    background: none;
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 4px;
    color: #848e9c;
    font-size: 13px;
    padding: 0 6px;
    height: 20px;
    cursor: pointer;
    z-index: 5;
}
.dom-recenter-btn:hover { color: #d1d4dc; border-color: rgba(255,255,255,0.3); }

/* ── DOM Preset Panel ─────────────────────────────── */
.dom-preset-panel {
    position: absolute;
    bottom: 30px;
    left: 16px;
    z-index: 7;
    background: rgba(15,15,15,0.85);
    border: 1px solid rgba(255,255,255,0.10);
    border-radius: 5px;
    padding: 3px 0;
    pointer-events: auto;
}
.dom-preset-label { font-size: 12px; font-weight: 700; color: #848e9c; padding: 3px 12px 2px; }
.dom-preset-list { display: flex; flex-direction: column; }
.dom-preset-item {
    padding: 2px 12px; font-size: 11px; color: #848e9c; cursor: pointer; white-space: nowrap;
}
.dom-preset-item:hover { background: rgba(255,255,255,0.07); color: #d1d4dc; }
.dom-preset-active { background: rgba(255,255,255,0.10); color: #d1d4dc !important; }

/* ── DOM Toast ─────────────────────────────────────── */
.dom-toast {
    position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
    background: #1a1d26; border-radius: 8px; padding: 8px 18px;
    font-size: 13px; font-weight: 500; z-index: 12200;
    box-shadow: 0 4px 16px rgba(0,0,0,0.5); pointer-events: none;
}
.dom-toast-ok  { border: 1px solid #0ecb81; color: #0ecb81; }
.dom-toast-err { border: 1px solid #f6465d; color: #f6465d; }

/* ── User Settings Modal ──────────────────────────────── */
.user-panel-overlay {
    position: fixed; inset: 0; z-index: 12100;
    background: rgba(0,0,0,0.65);
    display: flex; align-items: center; justify-content: center;
}
.user-panel-modal {
    background: #1f1f1f; border-radius: 12px;
    width: 360px; max-width: calc(100vw - 32px);
    box-shadow: 0 16px 48px rgba(0,0,0,0.7);
    display: flex; flex-direction: column; overflow: hidden;
}
.user-panel-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 20px 0; color: #d1d4dc; font-size: 15px; font-weight: 600;
}
.user-panel-close {
    background: none; border: none; color: #848e9c;
    font-size: 18px; cursor: pointer; padding: 0 4px;
}
.user-panel-close:hover { color: #d1d4dc; }
.user-panel-tabs {
    display: flex; gap: 4px; padding: 12px 20px 0;
    border-bottom: 1px solid rgba(255,255,255,0.07);
}
.user-panel-tab {
    background: none; border: none; color: #848e9c;
    font-size: 13px; padding: 6px 12px; cursor: pointer;
    border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.user-panel-tab.active { color: #fff; border-bottom-color: #fff; }
.user-panel-body { padding: 20px; }
.user-tab-content { display: flex; flex-direction: column; gap: 14px; }
.user-panel-field { display: flex; flex-direction: column; gap: 5px; }
.user-panel-field label { font-size: 11px; color: #848e9c; }
.user-panel-field input {
    background: rgba(255,255,255,0.07); border: 1px solid rgba(255,255,255,0.1);
    border-radius: 6px; color: #d1d4dc; font-size: 13px;
    padding: 8px 10px; outline: none; width: 100%; box-sizing: border-box;
}
.user-panel-field input:focus { border-color: rgba(255,255,255,0.3); }
.up-api-status { font-size: 12px; min-height: 16px; }
.up-status-ok  { color: #0ecb81; }
.up-status-err { color: #f6465d; }
.user-panel-actions { display: flex; gap: 8px; margin-top: 4px; }
.up-btn {
    flex: 1; padding: 9px; border: none; border-radius: 6px;
    font-size: 13px; font-weight: 600; cursor: pointer;
}
.up-btn-primary  { background: #3d3d3d; color: #d1d4dc; }
.up-btn-secondary { background: #3d3d3d; color: #d1d4dc; }
.up-btn-primary:hover  { background: #4a4a4a; }
.up-btn-secondary:hover { background: #4a4a4a; }
.up-sizes-grid { display: flex; flex-direction: column; gap: 10px; }
.user-panel-field .ind-set-spin { width: 100%; }
.user-panel-field .ind-set-spin .ind-set-num { flex: 1; width: 0; min-width: 0; }
.up-size-active label { color: #fff !important; }
.up-size-active input { border-color: rgba(255,255,255,0.5) !important; }
.up-section-label { font-size: 10px; font-weight: 600; color: #848e9c; text-transform: uppercase; letter-spacing: 0.05em; }
.up-section-label-gap { margin-top: 8px; }
#user-tab-styles .ind-set-row { margin: 6px 0; }
#user-tab-styles .ind-set-check { font-size: 13px; margin: 2px 0; }
#user-tab-api .ind-set-check { font-size: 13px; margin: 2px 0; }

/* ── Leverage Button ───────────────────────────────────── */
.dom-leverage-btn {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 3px;
    color: #d1d4dc;
    font-size: 11px;
    font-weight: 700;
    font-family: 'Roboto Mono', monospace;
    padding: 2px 5px;
    cursor: pointer;
    line-height: 1;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    -webkit-appearance: none;
    appearance: none;
    transition: border-color 0.15s, color 0.15s;
}
.dom-leverage-btn:hover { border-color: rgba(255,255,255,0.5); color: #fff; }
.dom-spot-btn.active { border-color: rgba(255,255,255,0.6); color: #fff; background: rgba(255,255,255,0.08); }

/* ── Leverage Modal ────────────────────────────────────── */
.lev-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 19000;
    display: flex;
    align-items: center;
    justify-content: center;
}
.lev-modal {
    background: #1f1f1f;
    border-radius: 8px;
    padding: 20px;
    width: min(320px, 90vw);
    display: flex;
    flex-direction: column;
    gap: 14px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}
.lev-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 14px;
    font-weight: 600;
    color: #d1d4dc;
}
.lev-close {
    background: transparent;
    border: none;
    color: #848e9c;
    font-size: 16px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}
.lev-close:hover { color: #d1d4dc; }
.lev-margin-row {
    display: flex;
    gap: 8px;
}
.lev-mode-btn {
    flex: 1;
    padding: 8px 0;
    border: none;
    border-radius: 4px;
    background: #3d3d3d;
    color: #848e9c;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.lev-mode-btn:hover { background: #4a4a4a; color: #d1d4dc; }
.lev-mode-btn.active { background: #fff; color: #0b0e11; font-weight: 600; }
.lev-lever-row {
    display: flex;
    align-items: center;
    background: #2b3139;
    border: none;
    border-radius: 4px;
    overflow: hidden;
}
.lev-pm-btn {
    background: transparent;
    border: none;
    color: #848e9c;
    font-size: 20px;
    line-height: 1;
    padding: 8px 14px;
    cursor: pointer;
    transition: color 0.15s, background 0.15s;
    user-select: none;
    flex-shrink: 0;
}
.lev-pm-btn:hover { color: #fff; background: rgba(255,255,255,0.08); }
.lev-value-display {
    flex: 1;
    text-align: center;
    font-size: 16px;
    font-weight: 700;
    color: #d1d4dc;
    background: transparent;
    border: none;
    outline: none;
    width: 0;
    min-width: 0;
}
.lev-slider-wrap {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.lev-slider {
    width: 100%;
    -webkit-appearance: none;
    appearance: none;
    height: 3px;
    border-radius: 2px;
    background: #474d57;
    outline: none;
    cursor: pointer;
    margin: 6px 0 0;
}
.lev-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
    box-shadow: 0 0 0 3px rgba(255,255,255,0.2);
}
.lev-slider::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #fff;
    border: none;
    cursor: pointer;
    box-shadow: 0 0 0 3px rgba(255,255,255,0.2);
}
.lev-ticks {
    display: flex;
    justify-content: space-between;
    font-size: 10px;
    color: #848e9c;
    padding: 0 1px;
}
.lev-error {
    font-size: 12px;
    color: #f6465d;
    text-align: center;
}
.lev-confirm-btn {
    width: 100%;
    padding: 10px;
    background: rgb(61,61,61);
    color: #d1d4dc;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}
.lev-confirm-btn:hover { background: rgb(80,80,80); }
.lev-confirm-btn:disabled { background: rgb(45,45,45); color: #848e9c; cursor: not-allowed; }

/* ── DOM touch overlay styles для планшетов (pointer: coarse) ── */
@media (pointer: coarse) {
    .dom-content::before {
        content: '';
        position: absolute;
        top: 29px; bottom: 0;
        right: calc(var(--dom-price-w) / 2 - 2px);
        width: 5px;
        background: rgba(255,255,255,0.18);
        pointer-events: none;
        z-index: 0;
        opacity: 0;
        transition: opacity 0.15s;
    }
    .dom-content.dom-armed::before { opacity: 1; }
    .dom-trade-ovl {
        position: absolute;
        top: 29px; bottom: 0;
        z-index: 6;
        background: transparent;
        transition: background 0.15s;
        pointer-events: none;
    }
    .dom-trade-buy {
        right: calc(var(--dom-price-w) / 2 + 3px);
        width: calc(var(--dom-price-w) / 2 - 3px);
    }
    .dom-trade-sell {
        right: 0;
        width: calc(var(--dom-price-w) / 2 - 2px);
    }
    .dom-trade-price-col {
        right: 0;
        width: var(--dom-price-w);
        z-index: 8;
        pointer-events: auto;
    }
    .dom-content.dom-armed {
        background:
            linear-gradient(to bottom, #0f0f0f 29px, transparent 29px),
            linear-gradient(to right,
                #0f0f0f calc(100% - var(--dom-price-w)),
                rgba(14,203,129,0.08) calc(100% - var(--dom-price-w)),
                rgba(14,203,129,0.08) calc(100% - var(--dom-price-w) / 2 - 3px),
                #0f0f0f calc(100% - var(--dom-price-w) / 2 - 3px),
                #0f0f0f calc(100% - var(--dom-price-w) / 2 + 2px),
                rgba(246,70,93,0.08) calc(100% - var(--dom-price-w) / 2 + 2px)
            ),
            #0f0f0f;
    }
    .dom-trade-lbl {
        display: none;
        position: absolute;
        transform: translateY(-50%);
        color: #fff;
        font-size: 11px;
        font-weight: 400;
        pointer-events: none;
        white-space: nowrap;
    }
    .dom-content.dom-armed .dom-trade-lbl { display: block; }
    .dom-trade-lbl-buy  { right: calc(50% + 8px); text-align: right; }
    .dom-trade-lbl-sell { left: calc(50% + 8px);  text-align: left; }
}

/* ============================================================
   TF BAR (desktop)
============================================================ */
#tf-selector { display: none !important; }

#tf-bar {
    display: flex;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
    position: relative;
    margin-right: 2px;
}

.tf-bar-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 32px;
    padding: 0 7px;
    border: none;
    border-radius: 4px;
    background: transparent;
    color: #848e9c;
    font-size: 12px;
    font-weight: 500;
    font-family: 'Roboto', sans-serif;
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
    flex-shrink: 0;
}
.tf-bar-btn:hover {
    background: var(--topbar-pill-hover, rgba(30, 34, 46, 0.98));
}
.tf-bar-btn--active {
    background: var(--topbar-pill-bg, #161a1e) !important;
    color: #eaecef !important;
}
/* --temp uses identical styles to --active; no extra CSS needed */

.tf-bar-arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 32px;
    width: 20px;
    padding: 0;
    border: none;
    border-radius: 4px;
    background: transparent;
    color: #848e9c;
    cursor: pointer;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
}
.tf-bar-arrow:hover {
    background: var(--topbar-pill-hover, rgba(30, 34, 46, 0.98));
    color: #eaecef;
}
.tf-bar-arrow--open {
    color: #eaecef;
}

.tf-bar-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    left: auto;
    right: 0;
    background: #1f1f1f;
    border: none;
    border-radius: 6px;
    padding: 4px 0;
    z-index: 10001;
    min-width: 110px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.tf-bar-dropdown-item {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 5px 10px 5px 8px;
    font-size: 13px;
    color: #d1d4dc;
    cursor: pointer;
    gap: 10px;
    user-select: none;
}
.tf-bar-dropdown-item:hover {
    background: #2b3139;
}
.tf-bar-dropdown-item--active {
    color: #e0e3eb;
    font-weight: 500;
}

.tf-bar-star {
    background: none;
    border: none;
    color: #848e9c;
    cursor: pointer;
    padding: 2px;
    line-height: 1;
    display: flex;
    align-items: center;
    flex-shrink: 0;
    border-radius: 3px;
}
.tf-bar-star:hover {
    color: #eaecef;
}
.tf-bar-star--active {
    color: #ffffff;
}
