/* ============================================================================
 * BETBAZA — визуальная система (v2)
 * Дизайн-принципы, взятые из современных data-dashboards (Owari / Radix Slate / Linear):
 *   • Нейтральная тёмная шкала (никакого warm/cool bias), только яркость меняется.
 *   • Плоские «карточки»: страница = самый тёмный слой, панель = +5% яркости,
 *     шапка таблицы = +8%. Границы почти не видны — иерархию задаёт яркость.
 *   • Один акцент — насыщенный emerald. Используется скупо: активные фильтры,
 *     зашедшие ставки, ключевые метрики. Никаких радиальных градиентов.
 *   • Данные монопространственные, подписи — sans, всё выровнено по сетке.
 * ==========================================================================*/

:root {
  /* Нейтральная шкала — приподнята на пару ступеней (мягче для глаз) */
  /* Светлая палитра */
  --bg:       #f4f6f9;   /* фон страницы */
  --surface:  #ffffff;   /* карточка / таблица */
  --surface-2:#eef1f5;   /* строка заголовков */
  --surface-3:#e2e6ec;   /* hover / поля */
  --filter-bg:#eef1f5;   /* фон строки фильтров */
  --stat-bg:  #e8ecf1;   /* фон рядов статистики */
  --line:     #d8dce3;   /* границы */
  --line-2:   #b8bfc9;   /* акцентные границы */
  --grid:     #dee2e8;   /* линии сетки */

  /* Текст */
  --txt:      #1a1d24;   /* основной — тёмный */
  --txt-dim:  #52585f;   /* подписи */
  --txt-mut:  #8b9199;   /* placeholder / muted */

  /* Единственный акцент — emerald */
  --acc:      #10b981;
  --acc-hi:   #059669;
  --acc-dark: #065f46;
  --acc-txt:  #ffffff;   /* белый текст на зелёной заливке */
  --acc-soft: rgba(16,185,129,.14);
  --acc-line: rgba(16,185,129,.35);

  /* Семантика */
  --pos:      #059669;
  --neg:      #dc2626;
  --warn:     #d97706;

  /* Радиусы / тени */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --shadow: 0 1px 0 rgba(255,255,255,.02);  /* только тонкий тумблер сверху */

  --mono: ui-monospace, "SF Mono", "JetBrains Mono", "Cascadia Mono", Menlo, Consolas, monospace;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--txt);
  font-family: var(--sans);
  font-size: 13px; line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button, input, select { font-family: inherit; color: inherit; }

.app { max-width: 1920px; margin: 0 auto; padding: 20px 20px 60px; }

/* ---------- Шапка страницы ---------- */
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: inherit; cursor: pointer; }
.brand:hover .brand__name { color: var(--acc); }
.brand__mark {
  width: 36px; height: 36px; display: inline-flex;
  align-items: center; justify-content: center;
}
.brand__mark svg { display: block; }
.brand:hover .brand__mark svg rect:nth-child(4) { fill: #991b1b; }
.brand__name { font-weight: 700; font-size: 16px; letter-spacing: 1.4px; }
.brand__sub { color: var(--txt-mut); font-size: 11.5px; letter-spacing: .2px; }
.topbar__meta { display: flex; gap: 22px; }
.stat { text-align: right; }
.stat__label { display: block; color: var(--txt-mut); font-size: 10px; text-transform: uppercase; letter-spacing: 1.2px; }
.stat__value { font-family: var(--mono); font-size: 15px; font-weight: 600; color: var(--txt); }

/* ---------- Панель управления выборкой ---------- */
.board {
  background: var(--surface);
  border-radius: var(--r-lg);
  padding: 14px 14px 16px;
  box-shadow: var(--shadow);
}
.board__bar { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.board__left, .board__right { display: flex; align-items: center; gap: 12px; }

.found { font-size: 13px; color: var(--txt-dim); font-weight: 500; }
.found__num { font-family: var(--mono); font-size: 18px; font-weight: 700; color: var(--txt); margin-left: 2px; }
.count__time { color: var(--txt-mut); font-size: 11px; font-family: var(--mono); }

.sel {
  background: var(--surface-2); color: var(--txt);
  border: 1px solid transparent; border-radius: var(--r-sm);
  padding: 7px 10px; font-size: 12.5px; cursor: pointer; outline: none;
}
.sel:hover { background: var(--surface-3); }

.btn {
  font-size: 12.5px; font-weight: 600; border-radius: var(--r-sm); cursor: pointer;
  border: 1px solid transparent; background: var(--surface-2); color: var(--txt);
  padding: 0 14px; height: 34px; transition: background .12s, color .12s, border-color .12s;
  display: inline-flex; align-items: center; gap: 6px;
}
.btn:hover { background: var(--surface-3); }
.btn--primary { background: var(--acc); color: var(--acc-txt); }
.btn--primary:hover { background: var(--acc-hi); }
/* Ссылка на Telegram-канал — фирменный синий, компактная, всегда видна */
.btn--tg {
  background: #229ED9; color: #fff;
  padding: 0 12px; height: 30px;
  text-decoration: none; border-radius: var(--r-sm);
  font-weight: 600; font-size: 12.5px;
  transition: background .12s, transform .1s;
}
.btn--tg:hover { background: #1c8bc0; transform: translateY(-1px); }
.btn--tg svg { display: block; }
.btn--ghost { background: transparent; color: var(--txt-dim); padding: 0 10px; height: 30px; }
/* Полоса над таблицей: справа — «Сбросить фильтры». Ширина ограничена шириной table-wrap. */
.tabletop { display: flex; justify-content: flex-end; align-items: center;
  max-width: 100%; padding: 4px 8px 6px; box-sizing: border-box; }
/* Средние под таблицей — компактно и приглушённо, чтобы не спорили с таблицей */
.avg-stats { padding: 12px 8px 8px; margin-top: 10px; opacity: 0.5; transition: opacity .15s; }
.avg-stats:hover { opacity: 0.9; }
.avg-lead { display: flex; align-items: baseline; gap: 6px; margin-bottom: 4px; padding: 0 2px; }
.avg-lead__title { color: var(--txt-dim); font-size: 10.5px; font-weight: 500; letter-spacing: .3px; text-transform: uppercase; }
.avg-lead__sub { color: var(--txt-mut); font-size: 10.5px; }
.avg-row { display: flex; flex-wrap: wrap; gap: 4px; }
.avg-pill {
  display: inline-flex; align-items: baseline; gap: 5px;
  padding: 3px 8px; background: transparent; border: 0; border-radius: 4px;
}
.avg-pill__k { color: var(--txt-mut); font-size: 10.5px; text-transform: none; letter-spacing: 0; }
.avg-pill__v { color: var(--txt-dim); font-family: var(--mono); font-size: 12px; font-weight: 600; line-height: 1; }
.btn--ghost:hover { color: var(--neg); background: transparent; }
.btn--gold { background: linear-gradient(180deg, #f5cb5c 0%, #d4a017 100%); color: #3b2a00;
  padding: 0 10px; height: 30px; font-weight: 700;
  box-shadow: 0 0 0 1px #b8860b, 0 1px 2px rgba(184,134,11,.35); }
.btn--gold:hover { background: linear-gradient(180deg, #f7d565 0%, #b8860b 100%); }
.btn--gold.is-active { background: #b8860b; color: #fff; box-shadow: 0 0 0 1px #7a5a00 inset; }

/* Плавающая подсказка возле «★ Только золото» */
.gold-hint { position: fixed; z-index: 200; max-width: 320px; padding: 8px 12px;
  background: #3b2a00; color: #fff8dc; border: 1px solid #b8860b; border-radius: 6px;
  font-size: 12.5px; line-height: 1.4; box-shadow: 0 4px 12px rgba(0,0,0,.25);
  opacity: 0; pointer-events: none; transform: translateY(-4px);
  transition: opacity .12s, transform .12s; }
.gold-hint.is-open { opacity: 1; transform: translateY(0); }

/* Вкладки статуса */
.tabs { display: inline-flex; background: var(--bg); border-radius: var(--r-sm); padding: 3px; gap: 2px; }
.tab {
  border: 0; background: transparent; color: var(--txt-dim); cursor: pointer;
  font-size: 12.5px; font-weight: 500; padding: 6px 12px; border-radius: 5px; transition: all .12s;
}
.tab:hover { color: var(--txt); }
.tab.is-active { background: var(--surface-2); color: var(--txt); }

.hint { display: none; }   /* убираем — сама шапка таблицы объясняет ввод */

/* Глобальный «Шаг ±» + шестерёнка выбора колонок */
.stepgroup { display: inline-flex; align-items: center; gap: 6px; }
.step { display: inline-flex; align-items: center; gap: 6px; background: var(--surface-2);
  border-radius: var(--r-sm); padding: 4px 8px 4px 10px; user-select: none; cursor: ns-resize; }
.step:hover { background: var(--surface-3); }
.step__label { color: var(--txt-dim); font-size: 11.5px; font-weight: 500; letter-spacing: .2px; }
.step input {
  width: 46px; height: 26px; background: transparent; border: 0; outline: none;
  color: var(--txt); font-family: var(--mono); font-size: 13px; font-weight: 700; text-align: center;
  -moz-appearance: textfield;
}
.step input::-webkit-outer-spin-button, .step input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* Синий акцент для «Шаг ±» */
.step--accent { background: #2563eb; box-shadow: 0 1px 0 rgba(0,0,0,.03), inset 0 0 0 1px rgba(255,255,255,.12); }
.step--accent:hover { background: #1d4ed8; }
.step--accent .step__label { color: rgba(255,255,255,.9); }
.step--accent input { color: #ffffff; }
.step--accent input::placeholder { color: rgba(255,255,255,.6); }

/* Шестерёнка рядом с шагом */
.stepgear {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; padding: 0; border: 0; border-radius: var(--r-sm);
  background: var(--surface-2); color: var(--txt-dim); cursor: pointer; font-size: 15px;
  transition: background .12s, color .12s;
}
.stepgear:hover { background: #2563eb; color: #fff; }
/* Быстрый выбор шага: 50 / 100 / 200 */
.step-quick { display: inline-flex; gap: 4px; margin-left: 8px; vertical-align: middle; }
.step-quick__btn {
  border: 0; background: transparent; color: var(--txt-mut);
  font-family: var(--mono); font-size: 11px; font-weight: 500;
  padding: 2px 6px; border-radius: 3px; cursor: pointer;
  transition: color .12s, background .12s;
}
.step-quick__btn:hover { background: var(--surface-3); color: var(--txt); }

/* Бейдж шага в конкретной ячейке-фильтре — кликабельный:
   ЛКМ — ввод значения вручную, ПКМ — сбросить индивидуальный шаг.
   Отличается вид: глобальный — приглушённый, индивидуальный — яркий emerald. */
.stepbadge {
  position: absolute; top: -6px; right: -6px; z-index: 2;
  padding: 1px 5px; border: 0; border-radius: 8px;
  background: var(--surface-3); color: var(--txt-dim);
  font-family: var(--mono); font-size: 9px; font-weight: 800; line-height: 1.4;
  cursor: pointer; transition: background .1s, color .1s;
}
.stepbadge:hover { background: var(--surface-2); color: var(--txt); }
.stepbadge.is-own { background: var(--acc); color: var(--acc-txt); }
.stepbadge.is-own:hover { background: var(--acc-hi); color: var(--acc-txt); }

/* ============================================================================
 * ТАБЛИЦА v3 — точная реплика референса
 * Единый тёмный тон, плотные строки ~22px, монохром, никаких групповых тинтов.
 * ==========================================================================*/
.tablewrap {
  margin-top: 8px;
  background: var(--surface);
  border-radius: 4px;
  overflow-x: auto; overflow-y: visible;
  /* всегда резервируем место под скролл, чтобы ширина таблицы не «прыгала»
     между «много строк» (скролл есть) и «мало строк» (скролла нет) */
  scrollbar-gutter: stable;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.tablewrap.loading { pointer-events: none; }
.tablewrap.loading .tbl tbody:not(:has(.skel-row)) { opacity: .55; }
/* Скелетоны — серые пульсирующие плашки, показываются моментально при первой загрузке. */
.skel-row td { height: 22px; padding: 3px 3px; border-bottom: 1px solid var(--grid); background: var(--surface); }
.skel-bar {
  display: block; height: 10px; margin: 0 4px; border-radius: 3px;
  background: linear-gradient(90deg, var(--surface-2) 0%, var(--surface-3) 50%, var(--surface-2) 100%);
  background-size: 200% 100%;
  animation: skelShimmer 1.2s ease-in-out infinite;
}
@keyframes skelShimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
@media (prefers-reduced-motion: reduce) {
  .skel-bar { animation: none; opacity: .55; }
}
.tbl {
  width: auto; border-collapse: separate; border-spacing: 0;
  font-size: 11.5px; table-layout: fixed; color: var(--txt);
}
.tbl th, .tbl td { overflow: hidden; border-right: 1px solid var(--grid); }
.tbl th:last-child, .tbl td:last-child { border-right: 0; }

/* --- Ряды статистики ------------------------------------------------------ */
.tbl thead tr.stat-row td {
  background: var(--stat-bg); padding: 3px 4px; text-align: center; white-space: nowrap;
  border-bottom: 1px solid var(--line);
}
.tbl thead tr.stat-row td.bg-pos { background: #c9f2d9; }   /* светло-зелёная плашка */
.tbl thead tr.stat-row td.bg-neg { background: #f8cccc; }   /* светло-красная плашка */
.stat-v { font-family: var(--mono); font-size: 11.5px; font-weight: 700; letter-spacing: .1px; }
.tbl thead tr.stat-row td.bg-pos .stat-v { color: #0d7f47; }
.tbl thead tr.stat-row td.bg-neg .stat-v { color: #b73a3a; }
.stat-v.muted { color: var(--txt-mut); font-weight: 400; }
.stat-label { color: var(--txt-dim); font-size: 10.5px; font-weight: 500; text-align: right !important;
  padding-right: 10px !important; }
/* Ячейка с вкладками — слева от строк статистики (rowspan=2 в profit-строке) */
.tbl thead tr.stat-row td.stat-tools {
  background: var(--stat-bg); padding: 4px 8px !important;
  text-align: left; vertical-align: middle;
}
.stat-tools .tabs { display: inline-flex; vertical-align: middle; }
.stat-tools .btn { vertical-align: middle; margin-left: 8px; }
.stat-tools [data-step-mount] { margin-left: 32px; vertical-align: middle; }
.stat-info { color: var(--txt-mut); font-size: 11.5px; text-align: left !important;
  padding: 8px 10px !important; background: var(--stat-bg); }
/* Разделитель между статистикой и шапкой — визуальный «отступ» цвета страницы */
.tbl thead tr.spacer-row td {
  background: var(--bg); height: 10px; padding: 0 !important; border: 0 !important;
}

/* --- Ряд групповых заголовков (colspan по группам) ----------------------- */
.tbl thead tr.group-row th {
  background: var(--surface-2); padding: 4px 6px; text-align: center;
  border-bottom: 1px solid var(--line); border-right: 1px solid var(--grid);
  font-size: 10.5px; font-weight: 700; letter-spacing: .3px;
  color: var(--txt-dim); text-transform: uppercase; white-space: nowrap;
}
/* Пустая левая ячейка — того же серого тона, что и группы, чтобы не «висела» */
.tbl thead tr.group-row th.group-cell--none { background: var(--surface-2); }

/* Разноцветные приглушённые пастельные фоны для групп */
.tbl thead tr.group-row th[data-group="ИСХОД МАТЧА"]  { background: #f0ede2; }  /* тёплый бежевый */
.tbl thead tr.group-row th[data-group="ДВОЙНОЙ ШАНС"] { background: #e5eef4; }  /* холодный голубой */
.tbl thead tr.group-row th[data-group="ФОРА (0)"]     { background: #f2e8de; }  /* персиковый */
.tbl thead tr.group-row th[data-group="ОБЕ ЗАБЬЮТ"]   { background: #e6efe4; }  /* мятный */
.tbl thead tr.group-row th[data-group="ТОТАЛ МАТЧА 2.5"]  { background: #ecefdf; }  /* оливковый */
.tbl thead tr.group-row th[data-group="ИСХОД 1Т"]     { background: #ebe6f0; }  /* лавандовый */
.tbl thead tr.group-row th[data-group="ИСХОД 2Т"]     { background: #efe6ea; }  /* пыльно-розовый */

/* --- Ряд подписей + фильтров --------------------------------------------- */
.tbl thead tr.head-row th {
  background: var(--surface-2); padding: 3px 3px 4px; text-align: center; vertical-align: middle;
  border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 6;
}
.th-label {
  display: block; color: var(--txt); font-weight: 700; font-size: 11px;
  padding: 3px 2px 5px; user-select: none;
}
.sortable .th-label { cursor: pointer; }
.sortable:hover .th-label { color: var(--acc); }
.th-label .arrow { color: var(--acc); font-size: 9px; }
.th-vert { display: none; }
.c-league .th-label, .c-team .th-label, .c-date .th-label { text-align: left; padding-left: 6px; }

/* Инпут фильтра — короткий, с видимой рамкой */
.th-filter {
  width: 100%; height: 22px; text-align: center; box-sizing: border-box;
  border: 1px solid var(--line); background: var(--surface); color: var(--txt);
  border-radius: 3px; font-family: var(--mono); font-size: 11.5px; font-weight: 500;
  outline: none; padding: 0 4px;
}
.th-filter::placeholder { color: var(--txt-mut); font-weight: 400; }
.th-filter:hover { border-color: var(--line-2); }
.th-filter:focus { border-color: var(--acc); }
.th-filter.is-active { border-color: var(--acc); color: var(--acc-hi); background: #ecfdf5; font-weight: 700; }
.th-filter.is-invalid { border-color: var(--neg); color: var(--neg); }
.th-filter--text {
  text-align: left; font-family: var(--sans); font-size: 11px; font-weight: 500; padding: 0 6px;
}

.fcell { position: relative; display: block; width: 100%; }
.fcell .th-filter { padding-right: 12px; }
.fcell--text .th-filter { padding-right: 18px; }
.tilde { position: absolute; right: 5px; top: 50%; transform: translateY(-50%);
  color: var(--txt-mut); font-size: 10px; pointer-events: none; }
.fcell__x {
  position: absolute; right: 1px; top: 50%; transform: translateY(-50%);
  width: 14px; height: 14px; padding: 0; line-height: 12px; text-align: center;
  background: transparent; color: var(--txt-mut); border: 0; border-radius: 3px;
  cursor: pointer; font-size: 13px;
}
.fcell__x:hover { color: var(--neg); }
.fcell.has-value .tilde { display: none; }
.stepbadge {
  position: absolute; top: -5px; right: -4px; padding: 0 4px; border-radius: 6px;
  background: var(--surface-3); color: var(--txt-dim); border: 0;
  font-family: var(--mono); font-size: 8.5px; font-weight: 800; line-height: 1.5;
  cursor: pointer;
}
.stepbadge.is-own { background: var(--acc); color: var(--acc-txt); }

/* --- Тело таблицы — плотные строки, светлый фон ------------------------- */
.tbl tbody td {
  background: var(--surface); padding: 3px 3px; border-bottom: 1px solid var(--grid);
  text-align: center; vertical-align: middle; white-space: nowrap;
}
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover td { background: #f5f7fa; }
.tbl tbody tr.row-live td { background: #fff8ec; }

.clickable { cursor: pointer; }

/* Дн */
.td-dow { color: var(--txt-dim); font-size: 11px; font-weight: 600; text-align: center; }
.td-dow.is-up { color: var(--warn); }

/* Лига (страна + лига, 2 строки) */
.td-league { text-align: left !important; padding-left: 6px !important; padding-right: 4px !important; }
.td-league .league { color: var(--txt); font-weight: 500; font-size: 11px; line-height: 1.2;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.td-league .country { color: var(--txt-mut); font-size: 10px; line-height: 1.2;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Дата (дата + время, 2 строки) */
.td-date { text-align: left !important; padding-left: 6px !important;
  color: var(--txt-dim); font-family: var(--mono); font-size: 10.5px; line-height: 1.25; }
.td-date .time { display: block; color: var(--txt-mut); }

/* Счёт / 1т / 2т — визуально сгруппированы более тёмным фоном */
.td-sc { text-align: center; padding: 3px 1px !important; }
.tbl tbody td.td-sc { background: #e2e6ec; }
.tbl thead .head-row .c-sc { background: #dae0e8; }
/* Тот же тон для инпутов-фильтров у 1т/2т/Счёт, чтобы не выделялись белым */
.tbl thead .head-row .c-sc .th-filter { background: #e2e6ec; }
.sc { font-family: var(--mono); font-weight: 700; }
.sc--ft { font-size: 11.5px; color: var(--txt); }
.sc--sub { font-size: 10.5px; color: var(--txt-mut); font-weight: 500; }
.dash { color: #c8ccd2; font-family: var(--mono); font-size: 10.5px; }

/* Команды (2 строки, слева) */
.td-team { text-align: left !important; padding-left: 6px !important; }
.td-team .team-block { display: flex; align-items: center; gap: 4px; min-width: 0; }
.td-team .teams { display: flex; flex-direction: column; gap: 0; min-width: 0; flex: 1; }
/* Звезда «в избранное» — минималистичная, без обводки, выделяется цветом */
.fav-star {
  flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px;
  border: 0; background: transparent; padding: 0; cursor: pointer;
  border-radius: 3px;
  transition: transform .1s, background .15s;
}
.fav-star svg { display: block; fill: none; stroke: var(--txt-mut); stroke-width: 1.6; }
.fav-star:hover { background: var(--surface-3); }
.fav-star:hover svg { stroke: var(--gold, #d4a017); }
.fav-star.is-on svg { fill: var(--gold, #d4a017); stroke: var(--gold, #d4a017); stroke-width: 1; }
.fav-star.is-on:hover svg { fill: #b8860b; stroke: #b8860b; }
:root { --gold: #d4a017; }
/* Вкладка «Избранные» — акцент золотым, чтобы отличать от статусных */
.tab--fav.is-active { color: var(--gold); }
.tab--fav [data-fav-count] { color: var(--gold); font-weight: 700; font-family: var(--mono); font-size: 11px; margin-left: 2px; }
.td-team .team { color: var(--txt); font-weight: 500; font-size: 11px; line-height: 1.2;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.td-team .team.win { color: var(--acc-hi); font-weight: 700; }
.td-dow.clickable:hover, .td-date.clickable:hover { color: var(--acc); }
.league.clickable:hover, .country.clickable:hover, .team.clickable:hover { color: var(--acc); }

/* Кэф — единый монохром на светлом */
.td-odd { padding: 0 !important; }
.odd {
  font-family: var(--mono); font-size: 11.5px; font-weight: 500; color: var(--txt-dim);
  cursor: pointer; user-select: none; display: block; padding: 4px 3px;
}
.odd:hover { background: var(--surface-3); color: var(--acc); }
.odd.lost { color: var(--txt-mut); }
.odd--empty, .odd--empty:hover { color: var(--txt-mut); cursor: default; background: transparent; }
.odd--nofilter, .odd--nofilter:hover { cursor: default; background: transparent; color: var(--txt-dim); }
.line--nofilter, .line--nofilter:hover { cursor: default; background: transparent; color: var(--txt-dim); }
.tbl tbody td.td-odd.won { background: #d5f4e2; }
.tbl tbody td.td-odd.won .odd { color: #047857; font-weight: 700; }
.tbl tbody td.td-odd.won .odd:hover { background: rgba(0,0,0,.05); color: #047857; }
/* Возврат (push) — фора 0 при ничьей: жёлто-серая нейтральная подсветка */
.tbl tbody td.td-odd.push { background: #fdf1c9; }
.tbl tbody td.td-odd.push .odd { color: #92640a; font-weight: 700; }
.tbl tbody td.td-odd.push .odd:hover { background: rgba(0,0,0,.05); color: #92640a; }

.odd.active { background: var(--acc); color: var(--acc-txt); font-weight: 700; }

/* Линии (Осн.тот / Фора) */
.td-line { padding: 0 !important; }
.line-val { font-family: var(--mono); font-size: 11.5px; font-weight: 500; color: var(--txt-dim);
  cursor: pointer; user-select: none; display: block; padding: 4px 3px; }
.line-val:hover { background: var(--surface-3); color: var(--acc); }
.line-val.active { background: var(--acc); color: var(--acc-txt); font-weight: 700; }
.line-val.line--empty, .line-val.line--empty:hover { color: var(--txt-mut); cursor: default; background: transparent; }

/* Маржа */
.td-margin { padding: 0 !important; text-align: center; }
.margin-v { font-family: var(--mono); font-size: 11px; font-weight: 500; color: var(--txt-dim);
  cursor: pointer; user-select: none; display: block; padding: 4px 3px; }
.margin-v:hover { background: var(--surface-3); color: var(--acc); }

/* Кнопка «открыть новую вкладку с фильтром по П1/Х/П2».
   Счётчик матчей рисуется ВНУТРИ кнопки — только для золотых. */
.td-act { padding: 0 !important; text-align: center; }
.row-act {
  display: inline-flex; align-items: center; justify-content: center; gap: 3px;
  min-width: 22px; height: 22px; padding: 0 5px; border: 0;
  background: var(--acc); color: var(--acc-txt); border-radius: 4px;
  cursor: pointer; font-size: 12px; font-weight: 800; line-height: 1;
  transition: background .12s;
}
/* Мини-иконка «→» в шапке — идентична кнопке в строке, чтобы понятно было, что настраиваем. */
.btn__row-act-icon {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; padding: 0 4px;
  background: var(--acc); color: var(--acc-txt); border-radius: 4px;
  font-size: 11px; font-weight: 800; line-height: 1;
  margin-right: 4px;
}
.row-act:hover { background: var(--acc-hi); }
/* Посещённая кнопка «→» — приглушается на любом фоне (зелёная/золотая/красная),
   чтобы визуально отметить строку, куда уже переходили. */
.row-act--visited { filter: brightness(0.55) saturate(1.2); }
.row-act--visited:hover { filter: brightness(0.7) saturate(1.2); }

/* Пользовательские пресеты — кнопки в строках и в шапке */
.td-presets { padding: 0 3px !important; text-align: center; white-space: nowrap; }
.preset-chip {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; margin: 0 1px; border: 0; border-radius: 4px;
  color: #fff; font-size: 11px; font-weight: 800; line-height: 1;
  padding: 0; cursor: pointer; transition: filter .12s;
}
.preset-chip:hover { filter: brightness(1.1); }
/* Красная плашка с числом матчей: в кластере пресета есть 100%-я серия */
.preset-chip { position: relative; overflow: visible; }
.preset-chip--gold[data-count]::after {
  content: attr(data-count);
  position: absolute; top: -6px; right: -6px;
  min-width: 12px; height: 12px; padding: 0 3px;
  border-radius: 6px; background: #dc2626; color: #fff;
  font-size: 9px; font-weight: 700; line-height: 12px; text-align: center;
  box-shadow: 0 0 0 1.5px #fff;
}
/* Золотой цвет цифры — 100% проходимость по колонке, которую фильтрует сам пресет. */
.preset-chip--gold.preset-chip--own[data-count]::after {
  background: #d4a017;
  color: #fff;
}
.preset-chips-host { display: inline-flex; gap: 4px; margin-right: 6px; vertical-align: middle; }
.preset-chip--header { width: 24px; height: 24px; font-size: 12px; }

/* Палитра выбора цвета в модалке */
.preset-palette { display: flex; flex-wrap: wrap; gap: 6px; }
.preset-swatch {
  width: 26px; height: 26px; border: 2px solid transparent; border-radius: 4px;
  cursor: pointer; padding: 0;
}
.preset-swatch.is-active { border-color: var(--txt); box-shadow: 0 0 0 2px var(--surface); }

/* Форма пресета */
.preset-form { display: grid; gap: 10px; padding: 8px 0 16px; border-bottom: 1px solid var(--line); margin-bottom: 12px; }
.preset-form__row { display: grid; grid-template-columns: 90px 1fr; align-items: center; gap: 12px; }
.preset-form__row > span { color: var(--txt-dim); font-size: 13px; }
.preset-form__row input[type="text"] {
  height: 30px; padding: 0 10px; border: 1px solid var(--line); border-radius: 4px;
  background: var(--surface); color: var(--txt); font-size: 13px;
}

/* Отдельная вкладка «История ставок» */
.history { padding: 20px 24px; background: var(--surface); border-radius: 8px; }
.history[hidden] { display: none; }
.history__head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.history__title { margin: 0; font-size: 20px; font-weight: 700; color: var(--txt); }
.history__spacer { flex: 1 1 auto; }
.history__stats { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.hstat { padding: 10px 14px; background: var(--surface-2); border-radius: 6px; min-width: 100px; }
.hstat--big { background: var(--acc-soft); border: 1px solid var(--acc-line); }
.hstat__k { color: var(--txt-dim); font-size: 11px; text-transform: uppercase; letter-spacing: .3px; }
.hstat__v { color: var(--txt); font-size: 20px; font-weight: 700; margin-top: 4px; font-family: var(--mono); }
.hstat__v.pos { color: var(--pos); }
.hstat__v.neg { color: var(--neg); }
.hstat__sub { color: var(--txt-mut); font-size: 12px; font-weight: 500; margin-left: 6px; }
.history__empty { padding: 30px; text-align: center; color: var(--txt-dim); font-size: 13px; line-height: 1.5; }

/* Таблица истории — компактный табличный стиль, как в референсе */
.history__tbl { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.history__tbl thead th {
  text-align: left; padding: 6px 10px; color: var(--txt-dim); font-weight: 500;
  border-bottom: 1px solid var(--line); border-top: 1px solid var(--line);
  background: var(--surface-2); font-size: 11.5px; text-transform: none;
}
.hrow { background: var(--surface); }
.hrow:hover { background: var(--surface-2); }
.hrow:not(:last-child) .hcell { border-bottom: 1px solid var(--grid); }
.hcell { padding: 8px 10px; color: var(--txt); vertical-align: middle; }

.h-col-dot   { width: 10px; padding-left: 8px !important; padding-right: 4px !important; }
.h-col-date  { width: 70px; white-space: nowrap; }
.h-col-league{ width: 130px; font-size: 11.5px; line-height: 1.2; }
.h-col-event { min-width: 240px; }
.h-col-bet   { width: 120px; }
.h-col-stake { width: 50px; text-align: right; font-family: var(--mono); color: var(--txt-dim); }
.h-col-odds  { width: 50px; text-align: right; font-family: var(--mono); font-weight: 700; }
.h-col-profit{ width: 80px; text-align: right; font-family: var(--mono); font-weight: 700; }
.h-col-x     { width: 30px; text-align: right; }

.h-dot { display: inline-block; width: 8px; height: 8px; border-radius: 2px; background: #d8dce3; vertical-align: middle; }
.h-dot--won { background: #10b981; }
.h-dot--lost { background: #dc2626; }
.h-dot--push { background: #f59e0b; }
.h-dot--pending { background: #94a3b8; }

.h-date { display: block; color: var(--txt); }
.h-time { display: block; color: var(--txt-mut); font-size: 11px; }

.h-teams { color: var(--acc-hi); font-weight: 600; }
.h-team { }
.h-score { font-size: 11px; margin-top: 2px; }

.h-bet { display: inline-block; padding: 2px 8px; border-radius: 3px; background: var(--surface-2); color: var(--txt); font-size: 11.5px; font-weight: 600; }

.h-profit--won  { color: var(--pos); }
.h-profit--lost { color: var(--neg); }
.h-profit--push { color: #92640a; }
.h-profit--pending { color: var(--txt-mut); font-weight: 400; }

.saved__x { border: 0; background: transparent; color: var(--txt-mut); font-size: 16px; cursor: pointer; padding: 0 6px; }
.saved__x:hover { color: var(--neg); }
.muted { color: var(--txt-mut); }

/* Страница авторизации */
.auth-page {
  position: relative; min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: var(--bg); padding: 24px; overflow: hidden;
}
.auth-bg {
  position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0;
  pointer-events: none;
  /* Виньетка от краёв к центру — форма читаемее, фон уходит на задний план */
  mask-image: radial-gradient(ellipse 60% 55% at 50% 50%, rgba(0,0,0,0) 40%, rgba(0,0,0,1) 100%);
  -webkit-mask-image: radial-gradient(ellipse 60% 55% at 50% 50%, rgba(0,0,0,0) 40%, rgba(0,0,0,1) 100%);
}
.auth-card {
  position: relative; z-index: 1;
  max-width: 400px; width: 100%; background: var(--surface); border: 1px solid var(--line);
  border-radius: 10px; padding: 30px 32px;
  box-shadow: 0 6px 24px rgba(20, 35, 60, .06), 0 2px 8px rgba(20, 35, 60, .04);
}
.auth-card__brand { display: flex; align-items: center; gap: 10px; margin-bottom: 24px; }
.auth-card__logo { width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center; }
.auth-card__logo svg { display: block; }
.auth-card__name { font-weight: 800; font-size: 15px; letter-spacing: -.02em; color: var(--txt); }
.auth-card__title { font-size: 24px; font-weight: 700; margin-bottom: 6px; letter-spacing: -.02em; color: var(--txt); }
.auth-card__sub { color: var(--txt-dim); font-size: 13.5px; margin-bottom: 20px; }
.auth-form { display: grid; gap: 14px; }
.auth-form__field { display: grid; gap: 5px; }
.auth-form__field span { font-size: 12.5px; color: var(--txt-dim); font-weight: 500; }
.auth-form__field input { padding: 10px 12px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--txt); font-size: 14px; font-family: inherit; }
.auth-form__field input:focus { outline: none; border-color: var(--acc); }
.auth-form__error { color: var(--neg); font-size: 12.5px; min-height: 16px; }
.auth-form__btn { padding: 11px 16px; background: var(--acc); color: #fff; border: 0; border-radius: 6px; font-size: 14px; font-weight: 600; cursor: pointer; }
.auth-form__btn:hover { background: var(--acc-hi); }
.auth-card__foot { margin-top: 20px; text-align: center; font-size: 13px; color: var(--txt-dim); }
.auth-card__foot a { color: var(--acc); text-decoration: none; }
.auth-card__foot a:hover { text-decoration: underline; }

/* Плашка пользователя в шапке */
.user-badge { display: inline-flex; align-items: center; gap: 8px; margin-left: 10px; padding: 4px 4px 4px 10px; background: var(--surface-2); border-radius: 20px; font-size: 12px; }
.user-badge__email { color: var(--txt); font-weight: 500; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-badge__link { color: var(--txt-dim); text-decoration: none; padding: 3px 8px; }
.user-badge__link:hover { color: var(--acc-hi); }
.user-badge__logout { border: 0; background: transparent; color: var(--txt-mut); cursor: pointer; padding: 3px 10px; border-radius: 14px; font-size: 12px; }
.user-badge__logout:hover { background: var(--surface-3); color: var(--neg); }

/* Страница /account */
.account-page { min-height: 100vh; background: var(--bg); padding: 32px 16px; }
.account { max-width: 720px; margin: 0 auto; }
.account__head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 24px; }
.account__back { color: var(--txt-dim); font-size: 13px; text-decoration: none; }
.account__back:hover { color: var(--acc-hi); }
.account__title { margin-top: 6px; font-size: 28px; font-weight: 800; letter-spacing: -.02em; color: var(--txt); }
.account__brand { display: flex; align-items: center; gap: 8px; color: var(--txt); font-weight: 700; }
.account__logo { width: 26px; height: 26px; display: inline-flex; align-items: center; justify-content: center; }
.account__logo svg { display: block; }
.account__section { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 24px; margin-bottom: 16px; }
.account__section-title { font-size: 16px; font-weight: 700; letter-spacing: -.015em; color: var(--txt); margin-bottom: 14px; }
.account__lead { color: var(--txt-dim); font-size: 13.5px; margin-bottom: 14px; }
.account__profile { display: grid; gap: 10px; margin-bottom: 16px; }
.account__profile-row { display: grid; grid-template-columns: 160px 1fr; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.account__profile-row:last-child { border-bottom: 0; }
.account__profile-row span { color: var(--txt-mut); }
.account__profile-row b { color: var(--txt); font-weight: 600; }
.account__btn { padding: 9px 16px; border-radius: 6px; font-size: 13px; font-weight: 600; cursor: pointer; border: 0; font-family: inherit; }
.account__btn--primary { background: var(--acc); color: #fff; }
.account__btn--primary:hover { background: var(--acc-hi); }
.account__btn--primary:disabled { opacity: .6; cursor: not-allowed; }
.account__btn--ghost { background: transparent; color: var(--txt-mut); border: 1px solid var(--line); }
.account__btn--ghost:hover { color: var(--neg); border-color: var(--neg); }

.invites { display: grid; gap: 8px; margin-top: 14px; }
.invites__empty { padding: 20px; text-align: center; color: var(--txt-mut); font-size: 13px; background: var(--surface-2); border-radius: 6px; }
.invite { display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center; padding: 12px 14px; background: var(--surface-2); border-radius: 6px; border-left: 3px solid var(--acc); }
.invite--used { border-left-color: var(--txt-mut); opacity: .7; }
.invite--expired { border-left-color: var(--neg); opacity: .7; }
.invite__code { font-family: var(--mono); font-weight: 700; color: var(--txt); font-size: 13px; letter-spacing: -.02em; }
.invite__status { color: var(--txt-dim); font-size: 12.5px; }
.invite__copy { padding: 6px 12px; background: var(--surface); color: var(--txt); border: 1px solid var(--line); border-radius: 4px; font-size: 12px; cursor: pointer; font-family: inherit; }
.invite__copy:hover { border-color: var(--acc); color: var(--acc-hi); }
.invite__copy:disabled { opacity: .5; cursor: not-allowed; }

/* Форма импорта базы */
.import-form { display: grid; gap: 12px; }
.import-form__url { display: grid; gap: 5px; }
.import-form__url span { font-size: 12.5px; color: var(--txt-dim); }
.import-form__url input { padding: 8px 12px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface); color: var(--txt); font-size: 12.5px; font-family: var(--mono); }
.import-form__actions { display: flex; gap: 8px; flex-wrap: wrap; }
.import-form__status { font-size: 12.5px; color: var(--txt-dim); padding: 8px 0; min-height: 20px; }
.import-form__status.is-progress { color: var(--txt); }
.import-form__status.is-success { color: var(--pos); font-weight: 600; }
.import-form__status.is-error { color: var(--neg); font-weight: 600; }
.import-form code { font-family: var(--mono); background: var(--surface-2); padding: 1px 4px; border-radius: 3px; font-size: 12px; }

/* Кнопка-лупа в строке */
.td-scan { padding: 0 !important; text-align: center; }
.scan-btn { display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 4px; text-decoration: none;
  background: transparent; color: var(--txt-dim); font-size: 13px; transition: background .12s; }
.scan-btn:hover { background: #ea580c; color: #fff; }
/* Раскрашенная лупа после сканирования страницы */
.scan-btn--strong { background: #dc2626; color: #fff; }
.scan-btn--strong:hover { background: #b91c1c; }
.scan-btn--medium { background: #d4a017; color: #fff; }
.scan-btn--medium:hover { background: #b8860b; }
.scan-btn--weak { background: var(--surface-3); color: var(--txt); }
.scan-btn--weak:hover { background: var(--surface-2); }

/* Страница сканирования */
.scan-view { padding: 20px 24px; background: var(--surface); border-radius: 8px; }
.scan-view[hidden] { display: none; }
.scan-head { border-bottom: 1px solid var(--line); padding-bottom: 12px; margin-bottom: 12px; }
.scan-head__top { display: flex; align-items: center; gap: 12px; }
.scan-head__icon { font-size: 22px; }
.scan-head__title { margin: 0; font-size: 18px; font-weight: 700; }
.scan-head__title .scan-match { color: var(--acc-hi); }
.scan-head__title .muted { color: var(--txt-mut); font-weight: 400; font-size: 13px; margin-left: 6px; }
.scan-head__spacer { flex: 1 1 auto; }
.scan-head__refs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.scan-head__refs .refval { display: inline-flex; align-items: baseline; gap: 5px; padding: 4px 10px; background: var(--surface-2); border-radius: 5px; font-size: 12px; }
.scan-head__refs .refval__k { color: var(--txt-dim); }
.scan-head__refs .refval__v { font-family: var(--mono); font-weight: 700; }
.scan-head__progress { margin-top: 8px; padding: 6px 10px; background: var(--surface-2); border-radius: 6px; color: var(--txt-dim); font-size: 12px; }
.scan-head__progress b { color: #ea580c; font-family: var(--mono); font-weight: 700; }

.scan-controls { display: flex; gap: 16px; align-items: center; flex-wrap: wrap;
  padding: 12px 0; margin-bottom: 16px; border-bottom: 1px solid var(--line); font-size: 12.5px; }
.scan-controls label { color: var(--txt-dim); display: inline-flex; align-items: center; gap: 6px; }
.scan-input { width: 55px; padding: 3px 8px; border: 1px solid var(--line); border-radius: 4px;
  background: var(--surface); color: var(--txt); font-family: var(--mono); font-size: 12px; }

.scan-empty { padding: 30px; text-align: center; color: var(--txt-dim); font-size: 13px; }

/* Консенсус */
.consensus { padding: 18px 22px; margin-bottom: 20px; background: var(--surface-2); border-radius: 8px; border-top: 3px solid var(--acc); }
.consensus__title { display: flex; align-items: baseline; gap: 10px; font-size: 13px; text-transform: uppercase; letter-spacing: .4px; color: var(--txt); font-weight: 700; margin-bottom: 4px; }
.consensus__title span { color: var(--txt-mut); font-size: 11px; font-weight: 400; text-transform: none; letter-spacing: 0; }
.consensus__lead { color: var(--txt-dim); font-size: 12px; margin-bottom: 14px; }
.consensus__grid { display: grid; gap: 10px; }
.cons-row { display: grid; grid-template-columns: 130px 1fr auto; gap: 14px; align-items: center; padding: 8px 4px; }
.cons-row + .cons-row { border-top: 1px solid var(--grid); }
.cons-row__market { display: flex; align-items: baseline; gap: 8px; }
.cons-row__name { font-weight: 700; font-size: 14px; color: var(--txt); }
.cons-row__lo { color: var(--txt-mut); font-size: 11px; }
.cons-row__bar { position: relative; height: 22px; background: var(--surface); border-radius: 4px; overflow: hidden; }
.cons-row__bar-fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 4px; background: linear-gradient(90deg, #059669, #10b981); }
.cons-row--strong .cons-row__bar-fill { background: linear-gradient(90deg, #dc2626, #ef4444); }
.cons-row--medium .cons-row__bar-fill { background: linear-gradient(90deg, #d4a017, #f5cb5c); }
.cons-row--weak .cons-row__bar-fill { background: linear-gradient(90deg, #94a3b8, #cbd5e1); }
.cons-row__bar-txt { position: absolute; inset: 0; display: flex; align-items: center; padding: 0 10px; color: #fff; font-family: var(--mono); font-size: 11.5px; font-weight: 700; text-shadow: 0 0 3px rgba(0,0,0,.35); }
.cons-row__badge { padding: 3px 10px; border-radius: 4px; font-size: 11px; font-weight: 700; background: var(--surface-3); color: var(--txt-dim); white-space: nowrap; }
.cons-row--strong .cons-row__badge { background: #fee2e2; color: #dc2626; }
.cons-row--medium .cons-row__badge { background: #fef3c7; color: #d4a017; }

/* Сигналы */
.sig-section { margin-bottom: 24px; }
.sig-section__title { display: flex; align-items: center; gap: 10px; font-size: 13px; text-transform: uppercase; letter-spacing: .3px; color: var(--txt-dim); padding: 0 4px 8px; }
.sig-section__title .badge { padding: 2px 10px; border-radius: 12px; font-size: 11px; font-weight: 600; background: var(--surface-3); color: var(--txt-dim); }
.sig-section--strong .badge { background: #fee2e2; color: #dc2626; }
.sig-section--medium .badge { background: #fef3c7; color: #d4a017; }

.sig-card { background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 16px 18px; margin-bottom: 8px; display: grid; grid-template-columns: 1fr auto; gap: 20px; align-items: center; }
.sig-card--strong { border-left: 3px solid #dc2626; }
.sig-card--medium { border-left: 3px solid #d4a017; }
.sig-card--weak { border-left: 3px solid var(--txt-mut); }
.sig-card__body { min-width: 0; }
.sig-card__filter { color: var(--txt-dim); font-size: 12px; margin-bottom: 8px; }
.sig-chip { display: inline-block; padding: 2px 8px; margin: 0 3px 3px 0; background: var(--surface); border-radius: 4px; font-family: var(--mono); font-size: 11.5px; color: var(--txt); font-weight: 600; }
.sig-card__winners { display: flex; flex-wrap: wrap; gap: 6px; }
.sig-winner { display: inline-flex; align-items: baseline; gap: 6px; padding: 5px 12px; background: var(--acc-soft); border-radius: 6px; font-size: 13px; }
.sig-winner__name { color: var(--acc-hi); font-weight: 700; }
.sig-winner__stat { color: var(--txt-dim); font-family: var(--mono); font-size: 11.5px; }
.sig-card__meta { text-align: right; }
.sig-card__size { display: block; font-family: var(--mono); font-size: 22px; font-weight: 800; color: var(--txt); line-height: 1; }
.sig-card__size-lbl { display: block; font-size: 10px; text-transform: uppercase; letter-spacing: .4px; color: var(--txt-mut); margin-top: 2px; }
.sig-card__open { display: inline-block; margin-top: 12px; padding: 5px 12px; border: 1px solid var(--line); border-radius: 4px; background: var(--surface); color: var(--txt); font-size: 11.5px; text-decoration: none; }
.sig-card__open:hover { background: var(--surface-3); border-color: #ea580c; color: #ea580c; }
.saved__bet { font-weight: 600; }
.saved__odds { font-family: var(--mono); font-weight: 700; }
.saved__date { font-family: var(--mono); color: var(--txt-dim); white-space: nowrap; }
.saved__act { text-align: right; width: 30px; }
.saved__x { border: 0; background: transparent; color: var(--txt-mut); font-size: 15px; cursor: pointer; padding: 0 6px; }
.saved__x:hover { color: var(--neg); }
.saved-row--won  .saved__res { color: var(--pos); font-weight: 700; }
.saved-row--lost .saved__res { color: var(--neg); font-weight: 700; }
.saved-row--push .saved__res { color: #92640a; font-weight: 700; }
.saved-row--pending .saved__res { color: var(--txt-mut); }
.saved__res .delta { margin-left: 4px; font-family: var(--mono); }

/* Отклик «нельзя добавить эту ставку» — короткая тряска ячейки */
@keyframes shakeNo { 0%,100%{transform:translateX(0)} 25%{transform:translateX(-3px)} 75%{transform:translateX(3px)} }
.odd.shake-no { animation: shakeNo .3s; color: var(--neg) !important; }
.row-act__arrow { display: inline-block; }
.row-act__count { display: none; font-family: var(--mono); font-size: 10.5px; letter-spacing: -.2px; }
.row-act--gold { background: linear-gradient(180deg, #f5cb5c 0%, #d4a017 100%); color: #3b2a00;
  box-shadow: 0 0 0 1px #b8860b, 0 1px 2px rgba(184,134,11,.45); }
.row-act--gold:hover { background: linear-gradient(180deg, #f7d565 0%, #b8860b 100%); }
.row-act--gold .row-act__count:not(:empty),
.row-act--hot  .row-act__count:not(:empty) { display: inline-block; }
.row-act--gold .row-act__arrow,
.row-act--hot  .row-act__arrow { display: none; }

/* «Горячая» красная кнопка: 3+ рынков с 100%-й серией */
.row-act--hot { background: linear-gradient(180deg, #ef4444 0%, #b91c1c 100%); color: #fff;
  box-shadow: 0 0 0 1px #7f1d1d, 0 1px 2px rgba(127,29,29,.45); }
.row-act--hot:hover { background: linear-gradient(180deg, #f56060 0%, #991b1b 100%); }

/* ============ Модалка настройки кнопки «→» =============================== */
.modal { position: fixed; inset: 0; z-index: 100; display: flex;
  align-items: center; justify-content: center; }
.modal[hidden] { display: none; }
.modal__backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.45); backdrop-filter: blur(2px); }
.modal__panel {
  position: relative; background: var(--surface); border-radius: 12px;
  width: min(680px, 92vw); max-height: 86vh; display: flex; flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,.35); overflow: hidden;
}
.modal__header { display: flex; align-items: flex-start; gap: 12px; padding: 18px 22px 12px; }
.modal__title { margin: 0; font-size: 16px; font-weight: 700; color: var(--txt); }
.modal__sub { margin-top: 4px; font-size: 12px; color: var(--txt-dim); line-height: 1.4; }
.modal__x {
  margin-left: auto; width: 28px; height: 28px; border: 0; background: transparent;
  color: var(--txt-dim); font-size: 20px; cursor: pointer; border-radius: 6px;
}
.modal__x:hover { background: var(--surface-3); color: var(--txt); }
.modal__body { padding: 8px 22px 4px; overflow-y: auto; }
.modal__footer {
  display: flex; align-items: center; gap: 8px; padding: 12px 18px 16px;
  border-top: 1px solid var(--line);
}
.modal__spacer { flex: 1; }

/* Группы рынков в модалке */
.cfg-group { margin-bottom: 14px; }
.cfg-group__title {
  font-size: 10.5px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase;
  color: var(--txt-mut); padding: 6px 4px; border-bottom: 1px solid var(--line);
  margin-bottom: 4px;
}
.cfg-row {
  display: grid; grid-template-columns: 22px 1fr 90px; align-items: center; gap: 10px;
  padding: 6px 4px; border-radius: 6px;
}
.cfg-row:hover { background: var(--surface-2); }
.cfg-row input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--acc); cursor: pointer; }
.cfg-row__label { font-size: 13px; color: var(--txt); cursor: pointer; user-select: none; }
.cfg-row__step {
  display: flex; align-items: center; gap: 4px;
  background: var(--bg); border: 1px solid var(--line); border-radius: 6px;
  padding: 3px 8px;
}
.cfg-row__step span { color: var(--txt-mut); font-size: 11px; }
.cfg-row__step input {
  width: 42px; height: 22px; border: 0; background: transparent; outline: none;
  color: var(--txt); font-family: var(--mono); font-size: 13px; font-weight: 600; text-align: center;
}
.cfg-row.is-off .cfg-row__label { color: var(--txt-mut); }
.cfg-row.is-off .cfg-row__step { opacity: .4; pointer-events: none; }
/* Текстовые фильтры без шага */
.cfg-row__nostep { color: var(--txt-mut); font-size: 11px; text-align: right; padding-right: 4px; }
.cfg-row.is-off .cfg-row__nostep { opacity: .5; }

/* Групповые тональные подложки отключены — под референс монохром */
.g-1x2, .g-dc, .g-tot, .g-hcap { --gtint: transparent; }
/* Колонки маржи — еле заметный светло-голубой фон */
.g-mar { --gtint: #f4f7fb; }
.tbl tbody td.g-mar { background: var(--gtint); }
.tbl thead .head-row th.g-mar { background: #eef2f7; }
.tbl thead .head-row th.g-mar .th-filter { background: #f4f7fb; }

/* Пустое состояние / пагинация */
.empty { padding: 60px 20px; text-align: center; }
.empty__icon { font-size: 32px; opacity: .35; }
.empty__title { font-size: 15px; font-weight: 600; margin-top: 10px; color: var(--txt); }
.empty__text { color: var(--txt-dim); margin-top: 6px; font-size: 12.5px; }

.pager { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 16px; }
.pager button {
  min-width: 30px; height: 30px; border: 1px solid #262a33; background: transparent;
  color: #a2a7b0; border-radius: 4px; cursor: pointer; font-size: 12px; font-weight: 500; padding: 0 10px;
}
.pager button:hover:not(:disabled) { border-color: var(--acc); color: var(--acc); }
.pager button:disabled { opacity: .3; cursor: not-allowed; }
.pager .cur { background: var(--acc); color: var(--acc-txt); border-color: var(--acc); }
.pager__gap { color: #6d727b; }

@media (max-width: 820px) {
  .app { padding: 14px 10px 60px; }
  .board__left { gap: 10px; }
  .c-league, .td-league { display: none; }
}

/* ============================================================================
 * Оверлей автосканера — блюр страницы + центральный «игровой» лоадер.
 * ==========================================================================*/
.scan-overlay[hidden] { display: none !important; }
.scan-overlay {
  position: fixed; inset: 0; z-index: 9999;
  display: flex; align-items: center; justify-content: center;
  background: rgba(6, 12, 24, 0.55);
  backdrop-filter: blur(6px) saturate(1.1);
  -webkit-backdrop-filter: blur(6px) saturate(1.1);
  animation: scanOverlayIn .18s ease-out;
}
@keyframes scanOverlayIn { from { opacity: 0; } to { opacity: 1; } }
.scan-overlay__box {
  min-width: 320px; max-width: 90vw; padding: 28px 32px;
  background: linear-gradient(180deg, rgba(20,28,44,.96), rgba(12,18,32,.96));
  border: 1px solid rgba(16, 185, 129, .35);
  border-radius: 14px; color: #e6edf7;
  box-shadow: 0 20px 60px rgba(0,0,0,.5), 0 0 0 1px rgba(16, 185, 129, .12) inset;
  text-align: center;
}
.scan-overlay__spinner {
  width: 56px; height: 56px; margin: 0 auto 16px;
  border: 4px solid rgba(255,255,255,.08);
  border-top-color: #10b981;
  border-right-color: #10b981;
  border-radius: 50%;
  animation: scanSpin .9s linear infinite;
}
@keyframes scanSpin { to { transform: rotate(360deg); } }
.scan-overlay__title {
  font-size: 16px; font-weight: 700; letter-spacing: .2px;
  margin-bottom: 4px;
}
.scan-overlay__progress {
  font-family: ui-monospace, "SFMono-Regular", Menlo, monospace;
  font-size: 24px; font-weight: 800; color: #10b981;
  margin: 6px 0 10px; line-height: 1;
}
.scan-overlay__bar {
  width: 100%; height: 6px; background: rgba(255,255,255,.08);
  border-radius: 3px; overflow: hidden; margin-bottom: 12px;
}
.scan-overlay__fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, #10b981, #34d399);
  transition: width .25s ease;
  box-shadow: 0 0 12px rgba(16, 185, 129, .6);
}
.scan-overlay__hint {
  font-size: 12px; color: rgba(230, 237, 247, .6);
}

/* ============================================================================
 * Онбординг-тур: welcome-модалка + backdrop с spotlight + tooltip.
 * ==========================================================================*/
.tour-backdrop {
  position: fixed; inset: 0; z-index: 9998;
  background: rgba(10, 15, 25, .38);
  animation: tourFade .25s ease-out;
}
@keyframes tourFade { from { opacity: 0; } to { opacity: 1; } }

.tour-spotlight {
  position: absolute;
  border-radius: 8px;
  box-shadow: 0 0 0 4px rgba(16, 185, 129, .55),
              0 0 0 9999px rgba(10, 15, 25, .38),
              0 0 40px rgba(16, 185, 129, .35);
  transition: all .35s cubic-bezier(.25, .8, .3, 1);
  pointer-events: none;
  z-index: 9999;
}

.tour-tooltip {
  position: absolute; z-index: 10000;
  max-width: 340px;
  background: var(--surface, #fff);
  border-radius: 12px;
  padding: 20px 22px 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,.25), 0 0 0 1px rgba(0,0,0,.05);
  transition: all .35s cubic-bezier(.25, .8, .3, 1);
  font-family: var(--sans);
}
.tour-tooltip__num {
  display: inline-block;
  font-family: var(--mono);
  font-size: 10.5px; font-weight: 700;
  letter-spacing: 1px;
  color: var(--acc); background: rgba(16, 185, 129, .1);
  padding: 3px 8px; border-radius: 4px;
  margin-bottom: 12px;
}
.tour-tooltip__title {
  font-size: 16px; font-weight: 700; letter-spacing: -0.01em;
  margin: 0 0 8px; color: var(--txt);
  text-wrap: balance;
}
.tour-tooltip__body {
  font-size: 13px; color: var(--txt-dim); line-height: 1.5;
  margin: 0 0 16px;
}
.tour-tooltip__body b { color: var(--txt); font-weight: 600; }
.tour-tooltip__foot {
  display: flex; align-items: center; gap: 10px;
  padding-top: 12px; border-top: 1px solid var(--line);
}
.tour-tooltip__progress {
  color: var(--txt-mut); font-size: 11.5px; font-family: var(--mono);
  margin-right: auto;
}
.tour-tooltip__skip {
  color: var(--txt-mut); font-size: 12px; background: transparent;
  border: 0; cursor: pointer; padding: 5px 8px;
}
.tour-tooltip__skip:hover { color: var(--txt-dim); }
.tour-tooltip__next {
  background: var(--acc); color: #fff; border: 0; border-radius: 6px;
  padding: 8px 16px; font-size: 13px; font-weight: 600; cursor: pointer;
  transition: background .12s;
}
.tour-tooltip__next:hover { background: var(--acc-hi); }
.tour-tooltip::before {
  content: ''; position: absolute; width: 12px; height: 12px;
  background: var(--surface, #fff); transform: rotate(45deg);
}
.tour-tooltip[data-side="bottom"]::before { top: -6px; left: 30px; }
.tour-tooltip[data-side="top"]::before    { bottom: -6px; left: 30px; }
.tour-tooltip[data-side="left"]::before   { right: -6px; top: 24px; }
.tour-tooltip[data-side="right"]::before  { left: -6px; top: 24px; }

.tour-welcome {
  position: fixed; inset: 0; z-index: 10010;
  display: flex; align-items: center; justify-content: center;
  background: rgba(10, 15, 25, .72);
  backdrop-filter: blur(2px);
  animation: tourFade .3s ease-out;
}
.tour-welcome__card {
  background: var(--surface, #fff);
  border-radius: 16px;
  padding: 36px 40px 28px;
  max-width: 460px; text-align: center;
  box-shadow: 0 30px 80px rgba(0,0,0,.35);
  animation: welcomeIn .35s cubic-bezier(.25, .8, .3, 1);
}
@keyframes welcomeIn {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}
.tour-welcome__logo { width: 64px; height: 64px; margin: 0 auto 16px; }
.tour-welcome__title {
  font-size: 22px; font-weight: 700; letter-spacing: -0.02em;
  margin: 0 0 8px; text-wrap: balance;
}
.tour-welcome__body {
  color: var(--txt-dim); font-size: 14px; line-height: 1.55;
  margin: 0 0 24px; text-wrap: pretty;
}
.tour-welcome__actions { display: flex; gap: 10px; justify-content: center; }
.tour-welcome__skip {
  color: var(--txt-mut); font-size: 13px; background: transparent;
  border: 0; cursor: pointer; padding: 10px 16px;
}
.tour-welcome__start {
  background: var(--acc); color: #fff; border: 0; border-radius: 8px;
  padding: 11px 28px; font-size: 14px; font-weight: 600; cursor: pointer;
}
.tour-welcome__start:hover { background: var(--acc-hi); }

/* ============================================================================
 * Админ-страница
 * ==========================================================================*/
.admin-page { min-height: 100vh; background: var(--bg); }
.admin__topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.admin__brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--txt); font-weight: 700; letter-spacing: 1px; }
.admin__topbar-actions { display: flex; gap: 8px; }
.admin__wrap { max-width: 1400px; margin: 0 auto; padding: 24px; }
.admin__section { margin-bottom: 32px; }
.admin__section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 14px; flex-wrap: wrap; }
.admin__section-actions { display: flex; gap: 10px; align-items: center; }
.admin__title { font-size: 18px; font-weight: 700; letter-spacing: -0.01em; margin: 0 0 14px; }

.stat-cards {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}
.stat-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  padding: 14px 16px;
}
.stat-card__label { font-family: var(--mono); font-size: 10.5px; color: var(--txt-mut); text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 6px; }
.stat-card__value { font-family: var(--mono); font-size: 22px; font-weight: 700; color: var(--txt); font-variant-numeric: tabular-nums; line-height: 1.1; }
.stat-card__note { font-size: 11.5px; color: var(--txt-dim); margin-top: 4px; }

.chart { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 16px; }
.chart__empty { color: var(--txt-mut); text-align: center; padding: 40px; font-size: 13px; }

.admin__filter {
  height: 32px; padding: 0 10px;
  border: 1px solid var(--line); border-radius: 6px;
  background: var(--surface); color: var(--txt);
  font-family: var(--sans); font-size: 13px; outline: none;
  min-width: 200px;
}
.admin__filter:focus { border-color: var(--acc); }

.admin__tbl-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; overflow-x: auto; }
.admin__tbl { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 900px; }
.admin__tbl thead th {
  background: var(--surface-2); color: var(--txt-dim);
  padding: 10px 12px; text-align: left; font-weight: 600;
  font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase;
  border-bottom: 1px solid var(--grid); white-space: nowrap; user-select: none;
}
.admin__tbl thead th:hover { color: var(--txt); background: var(--surface-3); }
.admin__tbl tbody td { padding: 10px 12px; border-bottom: 1px solid var(--grid); vertical-align: middle; }
.admin__tbl tbody tr:hover { background: var(--surface-2); }
.admin__tbl tbody tr:last-child td { border-bottom: 0; }
.admin__tbl .mono { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 12.5px; }
.admin__tbl .email a { color: var(--acc); text-decoration: none; }
.admin__tbl .email a:hover { text-decoration: underline; }
.admin__tbl .dt { font-family: var(--mono); font-size: 11.5px; color: var(--txt-dim); }
.admin__tbl .muted { color: var(--txt-mut); font-size: 11px; }
.admin__actions-cell { display: flex; gap: 4px; flex-wrap: wrap; }

.tag {
  display: inline-block; padding: 2px 7px; border-radius: 4px;
  background: var(--surface-3); color: var(--txt-dim);
  font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em;
}
.tag--admin { background: rgba(16, 185, 129, .14); color: var(--acc-hi); }
.tag--banned { background: rgba(220, 38, 38, .14); color: var(--neg); }

.btn--sm { height: 26px; padding: 0 8px; font-size: 11.5px; }
.btn--warn { background: rgba(220, 38, 38, .12); color: var(--neg); }
.btn--warn:hover { background: rgba(220, 38, 38, .18); }

/* --- Modal --- */
.admin-modal { position: fixed; inset: 0; z-index: 200; display: flex; align-items: center; justify-content: center; }
.admin-modal[hidden] { display: none !important; }
.admin-modal__backdrop { position: absolute; inset: 0; background: rgba(10, 15, 25, .55); }
.admin-modal__panel {
  position: relative; z-index: 1;
  background: var(--surface); border-radius: 12px;
  width: 90%; max-width: 640px; max-height: 85vh; overflow-y: auto;
  box-shadow: 0 25px 60px rgba(0, 0, 0, .3);
}
.admin-modal__head { display: flex; justify-content: space-between; align-items: flex-start; padding: 20px 24px 14px; border-bottom: 1px solid var(--line); }
.admin-modal__sub { color: var(--txt-mut); font-size: 11.5px; font-family: var(--mono); letter-spacing: 0.05em; }
.admin-modal__title { font-size: 18px; font-weight: 700; margin: 4px 0 0; word-break: break-all; }
.modal__x { background: transparent; border: 0; font-size: 22px; color: var(--txt-mut); cursor: pointer; }
.modal__x:hover { color: var(--txt); }
.admin-modal__body { padding: 20px 24px 24px; font-size: 13px; }
.admin-modal__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 20px; margin-bottom: 20px; }
.admin-modal__grid > div { padding: 6px 0; color: var(--txt-dim); }
.admin-modal__body h4 { font-size: 12.5px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--txt-mut); margin: 18px 0 8px; }
.admin-modal__list { list-style: none; padding: 0; margin: 0; }
.admin-modal__list li { padding: 6px 0; border-bottom: 1px dashed var(--line); font-size: 12.5px; }
.admin-modal__list li:last-child { border-bottom: 0; }
.admin-modal__list code { background: var(--surface-2); padding: 1px 6px; border-radius: 3px; font-size: 11.5px; }
.admin-modal__loading { padding: 60px; text-align: center; color: var(--txt-mut); }
.admin-modal__err { padding: 24px; color: var(--neg); }
