/* polymarket v3 — проектная вёрстка поверх ядра forge.
 * Компоненты (фильтр, таблица, пагинация) — ядерные, здесь только то, чего
 * ядро не задаёт: наша типографика таблиц, выравнивание числовых колонок,
 * знак числа цветом Yes/No. Палитра — static/css/tokens.css. */

html, body { margin: 0; }
body {
  padding-left: 4px;
  padding-right: 4px;
  font-size: 14px;
}

/* ── Таблицы списков ─────────────────────────────────────────────────── */
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.admin-table th {
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-weight: 500;
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.admin-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--color-border-subtle);
  vertical-align: middle;
}
.admin-table tbody tr:hover { background: var(--color-surface-hover); }
.admin-table td.admin-table__actions { text-align: right; }
.admin-table code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  color: var(--accent);
}

/* Знак числа — цветом исхода (ядерный `money` ставит num-pos / num-neg). */
.num-pos  { color: var(--color-yes); }
.num-neg  { color: var(--color-no); }
.num-zero { color: var(--muted); }

/* ── Кошельки ────────────────────────────────────────────────────────── */
/* Колонки 2–6 (рынков, в плюс, обе стороны, сделок, ордеров на рынок) и 9
   (ROI) — по центру; 7–8 (вложено, PnL) — по правому краю, разряды
   выравниваются. Заголовки ядерного sort_header класса не принимают,
   поэтому по позиции: меняешь порядок колонок — меняй и здесь. */
.wallets-table th:nth-child(n+3):nth-child(-n+9),
.wallets-table td:nth-child(n+3):nth-child(-n+9),
.wallets-table th:nth-child(14),
.wallets-table td:nth-child(14) { text-align: center; }
.wallets-table th:nth-child(n+10):nth-child(-n+13),
.wallets-table td:nth-child(n+10):nth-child(-n+13) { text-align: right; }

/* ── Охват в шапке: чипсы монет и окна рядом с меню (Пётр, 04.09) ───── */
.brand--menu-only { flex-wrap: wrap; row-gap: 8px; }
/* Настройки охвата — пункт в шапке справа, панель выпадает под шапкой
   (Пётр, 04.09: компактно, как меню). */
.brand--menu-only { position: relative; }
.scope { display: flex; align-items: center; gap: 10px; margin-left: auto; min-width: 0; }
.scope__toggle { background: none; border: 0; cursor: pointer; font: inherit; }
.scope__panel { position: absolute; top: 100%; left: var(--gutter); right: var(--gutter); z-index: 30;
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 10px 28px rgba(0, 0, 0, .45); }
.scope__fields { gap: 12px 24px; margin-bottom: 8px; }
.scope__field { min-width: 0; }
.scope__field--wide { flex: 1 1 100%; }
.scope.is-busy { opacity: .5; pointer-events: none; }

/* Рынки: С, По, UD?, wlt, ord (3–7) — по центру; деньги и группа
   «до старта» (8–16) — по правому краю. */
.markets-table th:nth-child(n+3):nth-child(-n+7),
.markets-table td:nth-child(n+3):nth-child(-n+7) { text-align: center; }
.markets-table th:nth-child(n+8):nth-child(-n+16),
.markets-table td:nth-child(n+8):nth-child(-n+16) { text-align: right; }
/* Группа «до старта» отделена от итогов рынка линией слева. */
.markets-table th:nth-child(12), .markets-table td:nth-child(12) { border-left: 1px solid var(--line); }
/* Заголовки U / D — цветом исхода: 8, 12, 14 — Up; 9, 13, 15 — Down. */
.markets-table th:nth-child(8) .ds-th-sort__label,
.markets-table th:nth-child(12) .ds-th-sort__label,
.markets-table th:nth-child(14) .ds-th-sort__label { color: var(--color-yes); }
.markets-table th:nth-child(9) .ds-th-sort__label,
.markets-table th:nth-child(13) .ds-th-sort__label,
.markets-table th:nth-child(15) .ds-th-sort__label { color: var(--color-no); }

/* Наши ордера: сводка — числа по правому краю; список — T, Решение, UD, R
   (4–7), wlt+, UD? (14–15) по центру, деньги (8–13, 16–17) по правому краю.
   Параметры ячейки — в карточке ордера, не в списке (Пётр, 05.09). */
.ours-summary th:nth-child(n+3), .ours-summary td:nth-child(n+3) { text-align: right; }
.ours-summary th:nth-child(2), .ours-summary td:nth-child(2) { text-align: center; }
.ours-table th:nth-child(n+4):nth-child(-n+7), .ours-table td:nth-child(n+4):nth-child(-n+7),
.ours-table th:nth-child(14), .ours-table td:nth-child(14),
.ours-table th:nth-child(15), .ours-table td:nth-child(15) { text-align: center; }
.ours-table th:nth-child(n+8):nth-child(-n+13), .ours-table td:nth-child(n+8):nth-child(-n+13),
.ours-table th:nth-child(n+16), .ours-table td:nth-child(n+16) { text-align: right; }
.ours-skip { color: var(--muted, #8a8f98); }
.ours-summary__total td { font-weight: 600; border-top: 1px solid var(--line); }
/* Наши ордера в карточке рынка: T, Решение, UD, R (2–5) и wlt+, UD? (11–12)
   по центру, деньги (6–10, 13–14) по правому краю. */
.our-market-table { margin-top: 16px; }
.our-market-table th:nth-child(n+2):nth-child(-n+5), .our-market-table td:nth-child(n+2):nth-child(-n+5),
.our-market-table th:nth-child(11), .our-market-table td:nth-child(11),
.our-market-table th:nth-child(12), .our-market-table td:nth-child(12) { text-align: center; }
.our-market-table th:nth-child(n+6):nth-child(-n+10), .our-market-table td:nth-child(n+6):nth-child(-n+10),
.our-market-table th:nth-child(n+13), .our-market-table td:nth-child(n+13) { text-align: right; }
/* Карточка ордера: до-ордера при решении — плюсовые обычным, минусовые и без
   истории приглушённо; числа по правому краю. */
.pre-orders-table th:nth-child(1), .pre-orders-table td:nth-child(1),
.pre-orders-table th:nth-child(n+4), .pre-orders-table td:nth-child(n+4) { text-align: right; }
/* Две панели Up | Down и прокрутка — та же разметка, что в карточке рынка. */
.our-card .card-orders { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 1100px) { .our-card .card-orders { grid-template-columns: 1fr; } }
.our-card .table-scroll { max-height: 480px; overflow: auto; border: 1px solid var(--color-border-subtle); border-radius: var(--radius); }
.our-card .table-scroll thead th { position: sticky; top: 0; background: var(--bg); z-index: 1; }
.pre-orders-table tr.pre-m td, .pre-orders-table tr.pre-- td, .pre-orders-table tr[class="pre-?"] td { color: var(--muted); }
.pre-orders-table tr.pre-m td .num-pos, .pre-orders-table tr.pre-m td .num-neg,
.pre-orders-table tr.pre-- td .num-pos, .pre-orders-table tr.pre-- td .num-neg { opacity: .6; }
/* Карточка ордера: три блока пар «название — значение» в ряд. */
.our-card__grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 16px; }
@media (max-width: 1100px) { .our-card__grid { grid-template-columns: 1fr; } }
.our-card__pairs td:first-child { color: var(--muted); width: 60%; }
.our-card__pairs td:last-child { text-align: right; white-space: nowrap; }

/* ── Карточка рынка ─────────────────────────────────────────────────── */
/* Секции — разметка ядерного аккордеона .ds-filter; переключение в market_card.js. */
.market-card .card-section { margin-top: 16px; }
.market-card .card-section .ds-filter__info { font-family: var(--font-mono, monospace); }
.card-chart__box { height: 360px; position: relative; cursor: crosshair; user-select: none; }
.card-chart__box--short { height: 240px; }
/* Жёлтая полоска момента — слой поверх графика, координату даёт шкала lwc. */
.card-cursor { position: absolute; top: 0; bottom: 28px; width: 2px; margin-left: -1px; background: var(--ds-warning, #e0b040); pointer-events: none; z-index: 2; }
.market-card .moment-table { margin-top: 16px; }
.moment-table th:nth-child(n+2), .moment-table td:nth-child(n+2) { text-align: center; }
/* Ордера Up | Down — две панели одной высоты, прокрутка внутри, шапка прилипает. */
.market-card .card-orders { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 1100px) { .market-card .card-orders { grid-template-columns: 1fr; } }
.card-orders__title { font-size: 13px; font-weight: 600; margin: 4px 0 8px; }
.market-card .table-scroll { height: 640px; overflow: auto; border: 1px solid var(--color-border-subtle); border-radius: var(--radius); }
.market-card .table-scroll thead th { position: sticky; top: 0; background: var(--bg); z-index: 1; }
.orders-table th:nth-child(n+7):nth-child(-n+10), .orders-table td:nth-child(n+7):nth-child(-n+10) { text-align: right; }
.orders-table th:nth-child(2), .orders-table td:nth-child(2) { text-align: center; }

/* Шапка — только меню: бренд и действия пользователя сняты (Пётр, 03.09). */
.brand--menu-only { justify-content: flex-start; padding: 12px var(--gutter); }
.brand--menu-only .nav { display: flex; gap: 16px; }

/* ── Фильтр ──────────────────────────────────────────────────────────── */
/* Сброс фильтра уже есть крестиком в шапке блока — второй, рядом с
   «Фильтровать», лишний (Пётр, 03.09). */
.ds-filter__commands [data-filter-clear] { display: none; }

.muted { color: var(--muted); }

/* Легенда графика PnL на «Наших ордерах»: цветной квадрат, имя, итог ряда.
   Клик по кнопке прячет линию — выключенная тускнеет. */
.ours-chart__legend { display: flex; flex-wrap: wrap; gap: 4px 14px; padding: 8px 2px 0; }
.ours-chart__legend-item { display: inline-flex; align-items: center; gap: 5px; background: none;
  border: 0; padding: 2px 4px; font: inherit; color: inherit; cursor: pointer; }
.ours-chart__legend-item--off { opacity: 0.35; }
.ours-chart__swatch { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.ours-chart__empty { display: flex; align-items: center; justify-content: center; height: 120px;
  color: var(--ds-dim, #888); }
