:root {
  --bg-0: #0a0e1a; --bg-1: #0f1523; --bg-2: #151c2e; --bg-3: #1e283d;
  --border: rgba(148, 163, 184, 0.08); --border-hover: rgba(148, 163, 184, 0.18);
  --text-primary: #f1f5f9; --text-secondary: #94a3b8; --text-muted: #64748b;
  --accent: #3b82f6; --green: #10b981; --red: #ef4444; --yellow: #f59e0b;
  --header-h: 50px;
  --sidebar-w: 280px;
  --right-panel-w: 300px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

html, body {
  font-family: 'Inter', -apple-system, sans-serif;
  background: var(--bg-0); color: var(--text-primary);
  height: 100vh; overflow: hidden; font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

.app { 
  display: grid; 
  grid-template-columns: var(--sidebar-w) 1fr var(--right-panel-w); 
  height: calc(100vh - var(--header-h)); 
  position: relative; 
  z-index: 1; 
  margin-top: var(--header-h);
}

/* ВЕРХНЯЯ ПАНЕЛЬ */
.top-bar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  background: rgba(15, 21, 35, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  z-index: 100;
  font-size: 13px;
}
.top-bar-left { font-weight: 700; color: var(--text-primary); display: flex; align-items: center; gap: 8px; }
.top-bar-center { flex: 1; text-align: center; color: var(--text-secondary); font-size: 12px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; padding: 0 20px; }
.top-bar-right { display: flex; gap: 8px; }
.top-btn { background: transparent; border: 1px solid var(--border); color: var(--text-secondary); padding: 6px 12px; border-radius: 6px; cursor: pointer; font-family: inherit; font-size: 12px; font-weight: 600; transition: 0.15s; }
.top-btn:hover { background: var(--bg-3); color: var(--text-primary); border-color: var(--border-hover); }

/* =========================================
   SIDEBAR И ЛЕВАЯ ПАНЕЛЬ
   ========================================= */
.sidebar {
  background: rgba(15, 21, 35, 0.75);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-right: 1px solid var(--border);
  padding: 16px 14px; /* Уменьшили */
  padding-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px; /* Уменьшили */
  height: 100%;
  overflow-y: auto; /* Разрешаем скролл всей панели, если не влезет */
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--bg-3); border-radius: 2px; }

.sidebar-scroll {
  display: flex;
  flex-direction: column;
  gap: 12px;
  /* Убрали flex: 1, чтобы блоки не растягивались */
}

/* Блок логотипа */
.brand { 
  display: flex; 
  flex-direction: row; 
  align-items: center; 
  gap: 12px; 
  flex-shrink: 0; /* Запрещаем сжиматься */
}

.brand-icon {
  width: 40px; 
  height: 40px; 
  min-width: 40px; 
  background: linear-gradient(135deg, #3b82f6, #8b5cf6) !important;
  border-radius: 10px; 
  display: flex; 
  align-items: center; 
  justify-content: center;
  font-size: 20px; 
  color: #ffffff !important;
  box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
}

.brand-title { font-weight: 700; font-size: 15px; color: var(--text-primary); }
.brand-sub { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* Секции */
.section { 
  display: flex; 
  flex-direction: column; 
  gap: 8px; 
}

/* Делаем блок с парами растягивающимся */
.sidebar-scroll > .section:nth-child(2) {
  flex: 1; /* Занимает всё свободное место */
  min-height: 0; /* Важно для работы скролла */
}

/* Запрещаем блокам Таймфрейм и MTF сжиматься */
.sidebar-scroll > .section:nth-child(3),
.sidebar-scroll > .section:nth-child(4) {
  flex-shrink: 0;
}

.label { font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; }

/* Список валютных пар */
.pairs { 
  display: flex; 
  flex-direction: column; 
  gap: 4px; 
  max-height: 250px; /* Ограничили высоту */
  overflow-y: auto; 
  background: rgba(15, 21, 35, 0.4);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px;
}

/* Скроллбар внутри пар */
.pairs::-webkit-scrollbar { width: 6px; }
.pairs::-webkit-scrollbar-track { background: transparent; }
.pairs::-webkit-scrollbar-thumb { background: var(--bg-3); border-radius: 3px; }
.pairs::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* Кнопки валютных пар */
.pair-btn {
  background: transparent; 
  border: 1px solid transparent; 
  color: var(--text-secondary);
  text-align: left; 
  padding: 9px 12px; 
  border-radius: 6px;
  font-family: 'JetBrains Mono', monospace; 
  font-size: 12px; 
  cursor: pointer; 
  transition: 0.15s;
  flex-shrink: 0; /* Кнопки не должны сплющиваться */
}
.pair-btn:hover { background: var(--bg-3); color: var(--text-primary); }
.pair-btn.active { background: rgba(59,130,246,0.15); border-color: rgba(59,130,246,0.4); color: var(--text-primary); }
.pair-btn.active::after { content: ' ✓'; float: right; color: var(--accent); font-weight: bold; }

.row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.field { display: flex; flex-direction: column; gap: 6px; }
select { background: var(--bg-2); border: 1px solid var(--border); color: var(--text-primary); padding: 9px 10px; border-radius: 8px; font-size: 13px; outline: none; }

.toggle { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.toggle input { display: none; }
.toggle-slider { width: 36px; height: 20px; background: var(--bg-3); border-radius: 10px; position: relative; transition: 0.2s; }
.toggle-slider::after { content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; background: #fff; border-radius: 50%; transition: transform 0.2s; }
.toggle input:checked + .toggle-slider { background: var(--accent); }
.toggle input:checked + .toggle-slider::after { transform: translateX(16px); }
.toggle-label { font-size: 13px; color: var(--text-secondary); }

.btn-analyze { background: linear-gradient(135deg, #3b82f6, #8b5cf6); border: none; color: #fff; padding: 13px 16px; border-radius: 10px; font-weight: 600; cursor: pointer; transition: 0.2s; margin-top: auto; margin-bottom: 16px; box-shadow: 0 8px 24px rgba(59,130,246,0.25); }
.btn-analyze:disabled { opacity: 0.5; cursor: not-allowed; }
.status { 
  font-size: 12px; 
  color: var(--text-muted); 
  padding: 8px 12px; 
  background: var(--bg-2); 
  border-radius: 8px; 
  border: 1px solid var(--border); 
  margin-top: 16px; 
  min-height: 52px; /* Фиксируем высоту под две строки */
  display: flex; 
  align-items: center; /* Выравниваем текст по центру */
  line-height: 1.4;
}

/* MAIN */
.main {
  padding: 20px; overflow-y: auto; display: flex; flex-direction: column; align-items: center; scroll-behavior: smooth; position: relative;
  background-image: linear-gradient(to bottom, rgba(10, 14, 26, 0.8), rgba(10, 14, 26, 0.95)), url('/static/bg.jpg');
  background-size: cover; background-position: center; background-attachment: fixed;
}
.main::-webkit-scrollbar { width: 8px; }
.main::-webkit-scrollbar-thumb { background: var(--bg-3); border-radius: 4px; }

.result-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; flex: 1; width: 100%; text-align: center; gap: 16px; color: var(--text-muted); }
.empty-icon { font-size: 56px; color: var(--accent); opacity: 0.6; }
.results-container { display: flex; flex-direction: column; gap: 12px; width: 100%; max-width: 1200px; }

/* КАРТОЧКА РЕЗУЛЬТАТА */
.result-item {
  background: rgba(15, 21, 35, 0.6) !important; backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(148, 163, 184, 0.15); border-radius: 12px; overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s;
  position: relative; /* Для таймера */
}
.result-item.collapsed { cursor: pointer; }
.result-item.collapsed:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.2); border-color: var(--border-hover); }

/* Шапка */
.result-header { display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; cursor: pointer; }
.result-header.buy { border-left: 4px solid var(--green); }
.result-header.sell { border-left: 4px solid var(--red); }
.result-header.skip { border-left: 4px solid var(--yellow); }
.result-header.bad { border-left: 4px solid var(--red); }

.header-left { display: flex; align-items: center; gap: 12px; }
.symbol-title { font-weight: 700; font-size: 15px; color: var(--text-primary); }
.dir-badge { font-family: 'JetBrains Mono', monospace; font-size: 15px; font-weight: 700; }
.result-header.buy .dir-badge { color: var(--green); }
.result-header.sell .dir-badge { color: var(--red); }
.result-header.skip .dir-badge { color: var(--yellow); }
.result-header.bad .dir-badge { color: var(--red); }

.header-right { display: flex; align-items: center; gap: 16px; }
.confidence { display: flex; align-items: center; gap: 10px; }
.conf-value { font-family: 'JetBrains Mono', monospace; font-size: 18px; font-weight: 700; }
.conf-bar { width: 60px; height: 4px; background: var(--bg-3); border-radius: 2px; overflow: hidden; }
.conf-fill { height: 100%; background: var(--accent); transition: width 0.3s; }
/* Динамический цвет уверенности */
.conf-fill.low { background: var(--red); }
.conf-fill.medium { background: var(--yellow); }
.conf-fill.high { background: var(--green); }

.chevron { color: var(--text-muted); font-size: 12px; transition: transform 0.3s ease; }
.expanded .chevron { transform: rotate(180deg); }
.collapsed .short-verdict { display: block; font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.expanded .short-verdict { display: none; }

/* Анимация раскрытия */
.result-body { display: grid; grid-template-rows: 0fr; transition: grid-template-rows 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease; opacity: 0; border-top: 1px solid transparent; }
.result-body > .inner-content { overflow: hidden; display: flex; flex-direction: column; gap: 8px; padding: 0 12px; }
.expanded .result-body { grid-template-rows: 1fr; opacity: 1; border-top: 1px solid var(--border); }
.expanded .result-body > .inner-content { padding: 12px; }

/* ВНУТРЕННИЕ БЛОКИ */
.chart-wrapper { display: flex; flex-direction: column; width: 100%; margin-bottom: 4px; }
.chart-container { width: 100%; height: 380px; background: var(--bg-0); border-radius: 8px 8px 0 0; }
.stoch-container { height: 120px; border-radius: 0 0 8px 8px; }

.info-row { display: flex; flex-direction: row; gap: 8px; align-items: stretch; width: 100%; }
.stake-card { background: rgba(30, 40, 61, 0.5) !important; backdrop-filter: blur(8px); border: 1px solid rgba(148, 163, 184, 0.1); border-radius: 8px; padding: 8px 12px; flex: 0 0 140px; display: flex; flex-direction: column; justify-content: center; }
.verdict-card { background: rgba(30, 40, 61, 0.5) !important; backdrop-filter: blur(8px); border: 1px solid rgba(148, 163, 184, 0.1); border-radius: 8px; padding: 8px 12px; flex: 1; display: flex; flex-direction: column; justify-content: center; }
.card-label { font-size: 9px; color: var(--text-muted); text-transform: uppercase; font-weight: 600; margin-bottom: 2px; }
.verdict { font-size: 13px; line-height: 1.4; color: var(--text-secondary); }
.stake-value { font-family: 'JetBrains Mono', monospace; font-size: 22px; font-weight: 700; color: var(--accent); line-height: 1.1; }

.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); gap: 6px; }
.metric { background: rgba(30, 40, 61, 0.5) !important; backdrop-filter: blur(8px); border: 1px solid rgba(148, 163, 184, 0.1); border-radius: 6px; padding: 6px 10px; display: flex; flex-direction: column; justify-content: center; }
.metric-label { font-size: 9px; color: var(--text-muted); text-transform: uppercase; margin-bottom: 2px; }
.metric-value { font-family: 'JetBrains Mono', monospace; font-size: 13px; font-weight: 600; }
.metric-value .dim { color: var(--text-muted); font-size: 10px; }

.tech { background: rgba(30, 40, 61, 0.5) !important; backdrop-filter: blur(8px); border: 1px solid rgba(148, 163, 184, 0.1); border-radius: 8px; }
.tech summary { padding: 8px 12px; cursor: pointer; font-size: 12px; font-weight: 600; color: var(--text-secondary); list-style: none; }
.tech summary::-webkit-details-marker { display: none; }
.tech-body { padding: 0 12px 10px; font-family: 'JetBrains Mono', monospace; font-size: 11px; color: var(--text-muted); white-space: pre-wrap; line-height: 1.4; }

/* ВИДЖЕТ СТАТИСТИКИ */
.stats-widget { background: var(--bg-2); border: 1px solid var(--border); border-radius: 10px; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.stats-header { font-size: 10px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; }
.stats-main { text-align: center; padding: 4px 0; }
.stats-winrate { font-family: 'JetBrains Mono', monospace; font-size: 28px; font-weight: 700; line-height: 1; color: var(--accent); }
.stats-sub { font-size: 11px; color: var(--text-secondary); margin-top: 4px; }
.stats-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }

.btn-stat { background: var(--bg-3); border: 1px solid transparent; border-radius: 6px; padding: 8px 4px; font-size: 11px; font-weight: 600; cursor: pointer; transition: all 0.15s ease; color: var(--text-primary); white-space: nowrap; display: flex; align-items: center; justify-content: center; }
.btn-stat:hover { filter: brightness(1.2); }
.btn-stat.win { background: rgba(16, 185, 129, 0.15); color: var(--green); border-color: rgba(16, 185, 129, 0.3); }
.btn-stat.win:hover { background: rgba(16, 185, 129, 0.25); }
.btn-stat.loss { background: rgba(239, 68, 68, 0.15); color: var(--red); border-color: rgba(239, 68, 68, 0.3); }
.btn-stat.loss:hover { background: rgba(239, 68, 68, 0.25); }
.stats-footer { display: flex; justify-content: space-between; gap: 6px; margin-top: 2px; }
.btn-undo, .btn-reset { flex: 1; background: transparent; border: 1px solid var(--border); border-radius: 6px; padding: 6px 4px; font-size: 11px; color: var(--text-muted); cursor: pointer; transition: all 0.15s ease; }
.btn-undo:hover, .btn-reset:hover { background: var(--bg-3); color: var(--text-primary); }
.btn-reset:hover { color: var(--red); border-color: rgba(239, 68, 68, 0.3); }

/* ДИСКЛЕЙМЕР */
.disclaimer { position: fixed; bottom: 24px; right: 24px; max-width: 340px; padding: 12px 16px; background: rgba(15, 21, 35, 0.92); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border: 1px solid rgba(239, 68, 68, 0.3); border-radius: 8px; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3); font-size: 11px; line-height: 1.5; color: var(--text-secondary); text-align: center; letter-spacing: 0.02em; z-index: 100; pointer-events: none; }

/* ИСТОРИЯ СИГНАЛОВ */
.btn-history { background: var(--bg-2); border: 1px solid var(--border); color: var(--text-secondary); padding: 11px 14px; border-radius: 8px; font-family: inherit; font-size: 13px; font-weight: 600; cursor: pointer; transition: 0.15s; margin-bottom: 10px; }
.btn-history:hover { background: var(--bg-3); color: var(--text-primary); border-color: var(--border-hover); }
.modal-overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.65); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); display: none; align-items: center; justify-content: center; z-index: 1000; padding: 20px; }
.modal-overlay.active { display: flex; }
.modal-content { width: min(900px, 100%); max-height: 80vh; background: var(--bg-1); border: 1px solid var(--border-hover); border-radius: 14px; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5); display: flex; flex-direction: column; overflow: hidden; }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--border); gap: 12px; }
.modal-header h3 { font-size: 16px; font-weight: 700; }
.modal-header > div { display: flex; gap: 8px; align-items: center; }
.btn-export, .btn-close { background: var(--bg-3); border: 1px solid var(--border); color: var(--text-primary); padding: 7px 10px; border-radius: 7px; font-family: inherit; font-size: 12px; font-weight: 600; cursor: pointer; transition: 0.15s; }
.btn-export:hover, .btn-close:hover { filter: brightness(1.2); }
.btn-close { width: 32px; padding: 7px 0; }
.modal-body { overflow: auto; padding: 12px 18px 18px; }
.history-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.history-table th, .history-table td { padding: 8px 10px; border-bottom: 1px solid var(--border); text-align: left; white-space: nowrap; }
.history-table th { color: var(--text-muted); font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em; position: sticky; top: 0; background: var(--bg-1); }
.history-table tr:hover td { background: rgba(148, 163, 184, 0.04); }

/* КНОПКИ WIN/LOSS/SKIP */
.trade-actions { display: flex; gap: 4px; }
.btn-res { width: 28px; height: 28px; border-radius: 6px; border: 1px solid var(--border); background: var(--bg-3); color: var(--text-secondary); font-family: inherit; font-weight: 700; cursor: pointer; transition: 0.15s; }
.btn-res:active { transform: scale(0.9); }
.btn-res.win { color: var(--green); border-color: rgba(16,185,129,0.4); }
.btn-res.win:hover { background: rgba(16,185,129,0.2); }
.btn-res.loss { color: var(--red); border-color: rgba(239,68,68,0.4); }
.btn-res.loss:hover { background: rgba(239,68,68,0.2); }
.btn-res.skip { color: var(--text-muted); border-color: var(--border); }
.btn-res.skip:hover { background: var(--bg-2); color: var(--text-primary); }

/* ТАЙМЕР И ПОЛЗУНОК */
.card-timer { position: absolute; top: 0; left: 50%; transform: translateX(-50%); background: var(--bg-3); color: var(--text-secondary); font-family: 'JetBrains Mono', monospace; font-size: 11px; font-weight: 600; padding: 2px 12px; border-radius: 0 0 6px 6px; border: 1px solid var(--border); border-top: none; z-index: 10; box-shadow: 0 2px 4px rgba(0,0,0,0.2); transition: all 0.3s; }
.card-timer.urgent { color: var(--red); border-color: var(--red); animation: pulse-red 1s infinite alternate; }
@keyframes pulse-red { from { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); } to { box-shadow: 0 0 10px 2px rgba(239, 68, 68, 0.6); } }

/* Ползунок уверенности */
input[type=range] {
  -webkit-appearance: none;
  width: 100%;
  background: transparent;
  outline: none;
  margin: 8px 0;
}

/* Дорожка (Chrome, Edge, Safari) */
input[type=range]::-webkit-slider-runnable-track {
  width: 100%;
  height: 6px;
  cursor: pointer;
  background: var(--bg-3);
  border-radius: 3px;
  border: 1px solid var(--border);
}

/* Кружок (Chrome, Edge, Safari) */
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  height: 18px;
  width: 18px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  margin-top: -6px;
  box-shadow: 0 0 6px rgba(59, 130, 246, 0.4);
  transition: transform 0.15s;
}

input[type=range]::-webkit-slider-thumb:hover {
  transform: scale(1.1);
}

/* Дорожка (Firefox) */
input[type=range]::-moz-range-track {
  width: 100%;
  height: 6px;
  cursor: pointer;
  background: var(--bg-3);
  border-radius: 3px;
  border: 1px solid var(--border);
}

/* Кружок (Firefox) */
input[type=range]::-moz-range-thumb {
  height: 18px;
  width: 18px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: none;
  box-shadow: 0 0 6px rgba(59, 130, 246, 0.4);
}

/* Кнопки + и - в модальном окне истории */
.btn-hist-plus, .btn-hist-minus {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  background: transparent;
  border: 1px solid;
  cursor: pointer;
  border-radius: 6px;
  font-weight: bold;
  font-size: 14px;
  line-height: 1;
  margin-left: 4px;
  transition: all 0.2s;
  padding: 0; /* Убираем отступы, чтобы flexbox отцентрировал идеально */
  vertical-align: middle;
}
.btn-hist-plus { border-color: var(--green); color: var(--green); }
.btn-hist-plus:hover { background: rgba(16, 185, 129, 0.2); }
.btn-hist-minus { border-color: var(--red); color: var(--red); }
.btn-hist-minus:hover { background: rgba(239, 68, 68, 0.2); }

/* ПРАВАЯ ПАНЕЛЬ */
.right-panel {
  background: rgba(15, 21, 35, 0.75);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}
.right-panel-header {
  padding: 14px 16px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--border);
}
.signal-feed {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.signal-feed::-webkit-scrollbar { width: 4px; }
.signal-feed::-webkit-scrollbar-thumb { background: var(--bg-3); border-radius: 2px; }

.feed-item {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  transition: 0.15s;
}
.feed-item:hover { border-color: var(--border-hover); }
.feed-item.my-signal {
  border-color: var(--yellow);
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.2);
}
.feed-item-header { display: flex; justify-content: space-between; font-weight: 700; }
.feed-item-symbol { color: var(--text-primary); }
.feed-item-result { 
  font-size: 14px; 
  font-weight: 800; 
  letter-spacing: 0.5px;
}
.feed-item-result.win { color: var(--green); }
.feed-item-result.loss { color: var(--red); }
.feed-item-details { 
  display: flex; 
  justify-content: space-between; 
  align-items: center; /* Выравниваем по центру по вертикали */
  color: var(--text-muted); 
  font-family: 'JetBrains Mono', monospace; 
  font-size: 11px; 
  margin-top: 4px; /* Чуть отодвинули от заголовка */
}
/* Рамки для сигналов */
.feed-item.my-signal { border-color: var(--yellow); box-shadow: 0 0 8px rgba(245, 158, 11, 0.2); }
.feed-item.feed-signal-win { border-color: var(--green); }
.feed-item.feed-signal-loss { border-color: var(--red); }

/* Раскрытие карточки */
.feed-item-extra {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
  opacity: 0;
}
.feed-item.expanded .feed-item-extra {
  max-height: 100px;
  opacity: 1;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--border);
}
.feed-price-row {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.feed-price-row strong { color: var(--text-primary); font-family: 'JetBrains Mono', monospace; }

.feed-empty { color: var(--text-muted); text-align: center; margin-top: 20px; font-size: 12px; }

/* ИНЛАЙН ДИСКЛЕЙМЕР (внизу правой панели) */
.disclaimer-inline {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  font-size: 10px;
  line-height: 1.4;
  color: var(--text-muted);
  text-align: center;
  background: rgba(0, 0, 0, 0.2);
}

/* --- ТИКЕР (Бегущая строка) --- */
#market-ticker {
  flex: 1;
  overflow: hidden;
  position: relative;
  display: flex;
  align-items: center;
  mask-image: linear-gradient(to right, transparent, black 10%, black 90%, transparent);
  -webkit-mask-image: linear-gradient(to right, transparent, black 10%, black 90%, transparent);
}

.ticker-track {
  display: flex;
  gap: 0; /* Убираем gap, чтобы не ломать 50% */
  white-space: nowrap;
  animation: tickerScroll 40s linear infinite;
  width: max-content;
}
.ticker-track:hover {
  animation-play-state: paused;
}

.ticker-track:hover {
  animation-play-state: paused;
}

.ticker-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  margin-right: 24px; /* Добавили отступ сюда */
}

.ticker-symbol { color: var(--text-secondary); font-weight: 600; }
.ticker-price { color: var(--text-primary); }
.ticker-change { font-weight: 600; }
.ticker-up { color: var(--green); }
.ticker-down { color: var(--red); }

@keyframes tickerScroll {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

/* --- ЭКСКУРСИЯ --- */
.tour-content {
  width: min(500px, 90%);
  padding: 30px;
  text-align: center;
  position: relative;
  overflow: hidden;
  background: var(--bg-1);
}
.tour-slide { display: none; }
.tour-slide.active { display: block; animation: fadeIn 0.3s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.tour-icon { font-size: 48px; margin-bottom: 16px; }
.tour-content h2 { font-size: 22px; margin-bottom: 12px; color: var(--text-primary); }
.tour-content p { font-size: 14px; color: var(--text-secondary); line-height: 1.5; margin-bottom: 24px; }
.btn-tour-next {
  background: var(--accent); color: #fff; border: none; padding: 12px 24px;
  border-radius: 8px; font-size: 14px; font-weight: 600; cursor: pointer; transition: 0.2s;
}
.btn-tour-next:hover { filter: brightness(1.1); }

/* Оверлей подсветки */
.tour-highlight-overlay {
  position: fixed; inset: 0; z-index: 2000;
  background: rgba(0, 0, 0, 0.7);
  pointer-events: auto; /* <--- БЛОКИРУЕМ КЛИКИ НА ФОНЕ */
  transition: clip-path 0.3s ease;
}
.tour-highlight-box {
  position: absolute;
  border: 2px solid var(--accent);
  border-radius: 8px;
  box-shadow: 0 0 15px rgba(59, 130, 246, 0.5); /* Красивое свечение вокруг */
  pointer-events: none;
  z-index: 2001;
  transition: all 0.3s ease;
  background: transparent;
  pointer-events: none; /* <--- Клики проходят сквозь рамку */
}
.tour-tooltip {
  position: absolute;
  background: var(--bg-1);
  border: 1px solid var(--accent);
  border-radius: 8px;
  padding: 16px;
  width: 300px;
  z-index: 2002;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  pointer-events: auto;
  transition: all 0.3s ease;
}
.tour-tooltip-text { font-size: 13px; color: var(--text-primary); line-height: 1.4; margin-bottom: 12px; }
.tour-tooltip-actions { display: flex; justify-content: space-between; align-items: center; }
.tour-btn-skip { background: transparent; border: none; color: var(--text-muted); font-size: 12px; cursor: pointer; }
.tour-btn-skip:hover { color: var(--text-primary); }
.tour-btn-next { background: var(--accent); color: #fff; border: none; padding: 6px 12px; border-radius: 6px; font-size: 12px; font-weight: 600; cursor: pointer; }
.tour-btn-next:hover { filter: brightness(1.1); }

/* --- СТАТУС РЫНКОВ --- */
.market-status-widget {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.market-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
}
.market-name { color: var(--text-secondary); font-weight: 600; display: flex; align-items: center; gap: 6px; }
.market-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.market-dot.open { background: var(--green); box-shadow: 0 0 6px var(--green); }
.market-dot.closed { background: var(--red); box-shadow: 0 0 6px var(--red); }
.market-time { color: var(--text-muted); font-family: 'JetBrains Mono', monospace; font-size: 10px; text-align: right; }
.market-status-text { font-weight: 600; }
.market-status-text.open { color: var(--green); }
.market-status-text.closed { color: var(--red); }

/* АДАПТИВНОСТЬ */
@media (max-width: 1024px) {
  .app { grid-template-columns: var(--sidebar-w) 1fr; }
  .right-panel { display: none; }
}
@media (max-width: 768px) {
  .app { grid-template-columns: 1fr; height: auto; }
  .sidebar { height: auto; overflow: visible; }
  .top-bar-center { display: none; } /* Прячем тикер на мобилках */
  .chart-container { height: 280px; }
  .main { background-attachment: scroll; padding: 12px; }
}
@media (max-width: 1024px) {
  .app { grid-template-columns: 260px 1fr; } /* Чуть уже для планшетов */
  .right-panel { display: none; }
}

/* =========================================
   АНИМАЦИЯ КНОПОК АВТО-ПОИСКА
   ========================================= */
.auto-btn-group {
  display: flex;
  gap: 0; 
  width: 100%;
  margin-bottom: 16px;
  transition: gap 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.auto-btn-group:has(.btn-stop.visible) {
  gap: 8px; 
}

/* Принудительно задаем красивые стили для главной кнопки */
/* Принудительно задаем красивые стили для главной кнопки */
.auto-btn-group .btn-auto {
  flex: 1;
  margin-bottom: 0; 
  width: auto;
  border: none !important; /* Убираем стандартную рамку браузера */
  border-radius: 10px !important;
  color: #ffffff !important; /* Всегда белый текст */
  font-family: 'Inter', -apple-system, sans-serif !important;
  font-weight: 600 !important;
  font-size: 14px !important;
  padding: 13px 16px !important;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  
  /* ВОТ ЭТА СТРОКА СДЕЛАЕТ ЕЕ ЗЕЛЕНОЙ ПРИ ЗАГРУЗКЕ */
  background: linear-gradient(135deg, #10b981, #059669) !important;
}

.auto-btn-group .btn-auto:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.auto-btn-group .btn-auto:active {
  transform: translateY(1px);
}

/* Кнопка Стоп */
.btn-stop {
  width: 0;
  opacity: 0;
  overflow: hidden;
  background: linear-gradient(135deg, #ef4444, #dc2626) !important;
  color: #ffffff !important;
  border: none !important;
  border-radius: 10px !important;
  font-family: 'Inter', -apple-system, sans-serif !important;
  font-weight: 600 !important;
  font-size: 14px !important;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.2);
}

.btn-stop.visible {
  width: 75px;
  opacity: 1;
}

.btn-stop:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.btn-stop:active {
  transform: translateY(1px);
}

@keyframes pulse-orange {
  0% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.4); }
  70% { box-shadow: 0 0 0 10px rgba(245, 158, 11, 0); }
  100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0); }
}
.btn-auto.paused {
  animation: pulse-orange 2s infinite;
}

/* Панель админа */
#admin-panel {
  transition: all 0.3s ease;
}

#admin-panel-body {
  display: none;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 16px;
  align-items: flex-end;
  padding: 20px;
}

/* Когда панель открыта — показываем тело */
#admin-panel.open #admin-panel-body {
  display: flex;
}

/* Крутим стрелочку */
#admin-panel.open #admin-panel-arrow {
  transform: rotate(180deg);
}

#auth-id-input:focus {
  border-color: var(--accent);
}