/* Раздел «Арбитраж» (08.10.2026). Выбор пары повторяет обозреватель бумаг
   (классы inst-*), поэтому здесь только то, чего у него нет: лепестки пар,
   панель кнопок, карточки итогов, графики и диалоги. */
.arb-page { flex: 1; min-height: 0; overflow-y: auto; background: var(--bg); }
.arb-wrap { width: 100%; margin: 0; padding: 12px 14px 40px; }
.arb-head { display: grid; gap: 8px; margin-bottom: 10px; }
.arb-title-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.arb-title { font-size: 20px; font-weight: 700; margin-right: 4px; }
.arb-pair-open { width: auto; min-width: 220px; max-width: 100%; }
.arb-star {
    background: var(--surface-2); border: 1px solid var(--border); color: var(--text-muted);
    border-radius: var(--radius-sm); width: 34px; height: 34px; font-size: 17px; cursor: pointer;
}
.arb-star.is-on { color: #f59e0b; border-color: rgba(245, 158, 11, .5); }
.arb-source { color: var(--text-muted); font-size: 12px; margin-left: auto; }
.arb-chips { padding: 0; }
/* Полоса прокрутки лепестков — тонкая и тёмная: белая системная полоса
   резала тёмную тему (снимок владельца 08.10.2026) */
.arb-petals { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; scrollbar-color: var(--surface-3, #2a2e39) transparent; }
.arb-petals::-webkit-scrollbar { height: 6px; }
.arb-petals::-webkit-scrollbar-track { background: transparent; }
.arb-petals::-webkit-scrollbar-thumb { background: var(--surface-3, #2a2e39); border-radius: 3px; }
.arb-petals::-webkit-scrollbar-thumb:hover { background: var(--border, #3a3f4b); }
.arb-petal {
    flex: none; background: var(--surface); border: 1px solid var(--border); color: var(--text);
    border-radius: 999px; padding: 5px 12px; font-size: 12px; font-family: var(--font-mono); cursor: pointer;
    border-left-width: 3px;
}
.arb-petal.up { border-left-color: #26a69a; }
.arb-petal.dn { border-left-color: #ef5350; }
.arb-petal.on { background: rgba(59, 130, 246, .15); border-color: rgba(59, 130, 246, .6); }
.arb-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 10px; }
.arb-spacer { flex: 1; }
.arb-seg { display: inline-flex; align-items: center; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.arb-seg button { background: none; border: 0; color: var(--text-muted); padding: 6px 10px; font-size: 12px; cursor: pointer; font-family: var(--font-body); }
.arb-seg button.on { background: rgba(59, 130, 246, .18); color: var(--text); }
.arb-seg-label { color: var(--text-faint); font-size: 11px; padding: 0 4px 0 8px; }
.arb-btn {
    background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
    border-radius: var(--radius-sm); padding: 6px 11px; font-size: 12px; cursor: pointer; font-family: var(--font-body);
}
.arb-btn:hover { background: var(--surface-3); }
.arb-btn-main { background: linear-gradient(135deg, #3b82f6 0%, #6366f1 100%); color: #fff; border-color: transparent; }
.arb-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin-bottom: 10px; }
.arb-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 8px 10px; min-width: 0; }
.arb-card-k { color: var(--text-muted); font-size: 11px; }
.arb-card-v { font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; margin: 2px 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.arb-card-s { color: var(--text-faint); font-size: 11px; line-height: 1.3; }
.arb-chart-box { position: relative; }
.arb-legend {
    position: absolute; z-index: 3; left: 8px; top: 6px; right: 70px; font-size: 11px; color: var(--text-muted);
    pointer-events: none; line-height: 1.4; text-shadow: 0 0 3px var(--bg);
}
.arb-chart { width: 100%; border: 1px solid var(--border); border-radius: var(--radius-md); overflow: hidden; min-height: 300px; }
.arb-sub { min-height: 170px; margin-top: 4px; }
.arb-sub-head { margin-top: 8px; }
.arb-note {
    margin-top: 8px; padding: 10px 12px; border-radius: var(--radius-md); font-size: 13px;
    background: rgba(245, 158, 11, .1); border: 1px solid rgba(245, 158, 11, .35);
}
/* 08.10.2026: фандинг и ставки — свёрнутые строки над графиком, таблица раскрывается и прокручивается внутри */
.arb-panels { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 8px; margin-top: 8px; align-items: start; }
.arb-panels:not(:has(.arb-panel:not([hidden]) + .arb-panel:not([hidden]))) { grid-template-columns: minmax(0, 1fr); }
.arb-panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 0; min-width: 0; }
.arb-strip-head {
    display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; width: 100%; padding: 7px 10px;
    background: none; border: 0; color: var(--text-muted); font: inherit; font-size: 12px; text-align: left; cursor: pointer;
    border-radius: var(--radius-md);
}
.arb-strip-head:hover { background: var(--surface-2, rgba(127, 127, 127, .08)); }
.arb-strip-head b { color: var(--text); font-variant-numeric: tabular-nums; }
.arb-strip-caret { width: 10px; color: var(--text-muted); }
.arb-strip-more { margin-left: auto; color: var(--primary, #3b82f6); }
.arb-strip-body { padding: 0 12px 10px; }
.arb-fund-scroll { max-height: 38vh; overflow: auto; }
.arb-fund-scroll thead th { position: sticky; top: 0; background: var(--surface); }
.arb-bad { color: #ef5350; }
.arb-good { color: #26a69a; }
.arb-journalzone { margin-top: 10px; }
.arb-jr-btns { white-space: nowrap; }
.arb-jr-btns .arb-btn { padding: 3px 8px; font-size: 12px; margin-left: 4px; }
.arb-bt-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 8px 12px; }
.arb-bt-cards { flex-wrap: wrap; margin: 10px 0 6px; }
.arb-bt-cards .arb-card { flex: 1 1 140px; }
.arb-equity { width: 100%; height: 120px; display: block; margin: 6px 0; color: var(--text-muted); }
.arb-book-legs { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 10px; }
.arb-book-legs h4 { font-size: 13px; margin-bottom: 4px; }
.arb-book-t td.ask { color: #ef5350; }
.arb-book-t td.bid { color: #26a69a; }
.arb-panel h3 { font-size: 14px; margin-bottom: 8px; }
.arb-fund-top { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--text-muted); margin-bottom: 8px; }
.arb-fund-top b { color: var(--text); font-variant-numeric: tabular-nums; }
.arb-table { width: 100%; border-collapse: collapse; font-size: 12px; font-variant-numeric: tabular-nums; }
.arb-table th { text-align: left; color: var(--text-muted); font-weight: 500; padding: 4px 6px; border-bottom: 1px solid var(--border); }
.arb-table td { padding: 4px 6px; border-bottom: 1px solid var(--border); }
.arb-table tr.arb-partial td { color: var(--text-muted); }
.arb-muted { color: var(--text-muted); font-size: 12px; line-height: 1.45; margin-top: 6px; }
.arb-foot { color: var(--text-faint); font-size: 11px; margin-top: 12px; }
.arb-up { color: #26a69a; }
.arb-dn { color: #ef5350; }
.arb-box-wide { max-width: 680px; }
.arb-dlg-title { font-size: 15px; flex: 1; }
.arb-dlg-body { overflow-y: auto; padding: 4px 14px 16px; }
.arb-form { display: grid; gap: 8px; }
.arb-form h4 { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); margin-top: 8px; }
.arb-field { display: grid; grid-template-columns: minmax(0, 1fr) 170px; align-items: center; gap: 10px; font-size: 13px; }
.arb-field input, .arb-field select, .arb-div input, .arb-div select {
    width: 100%; background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
    border-radius: var(--radius-sm); padding: 6px 8px; font-size: 13px; font-family: var(--font-body);
}
.arb-check { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.arb-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 6px; }
.arb-admin { margin-top: 14px; padding-top: 10px; border-top: 1px dashed var(--border); }
.arb-x { background: none; border: 0; color: var(--text-muted); cursor: pointer; }
.arb-row { gap: 10px; }
.arb-row-nums { display: grid; text-align: right; font-size: 11px; color: var(--text-muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.arb-al-list { display: grid; gap: 6px; }
.arb-al { display: flex; justify-content: space-between; gap: 10px; align-items: center; padding: 8px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 13px; }
.arb-al.off { opacity: .6; }
.arb-al-btns { display: flex; gap: 6px; flex: none; }
.arb-calc-out { display: grid; gap: 4px; margin-top: 8px; padding: 10px; background: var(--surface-2); border-radius: var(--radius-md); }
.arb-calc-row { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; }
.arb-calc-row b { font-variant-numeric: tabular-nums; text-align: right; }
@media (max-width: 700px) {
    .arb-panels { grid-template-columns: minmax(0, 1fr); }
    .arb-book-legs { grid-template-columns: 1fr; }
    .arb-wrap { padding: 10px 8px 30px; }
    .arb-field { grid-template-columns: 1fr; gap: 4px; }
    .arb-source { margin-left: 0; width: 100%; }
    .arb-pair-open { flex: 1; min-width: 0; }
    .arb-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .arb-legend { right: 8px; font-size: 10px; }
    .arb-toolbar .arb-spacer { display: none; }
    .arb-al { flex-direction: column; align-items: stretch; }
}

/* Сетка окон 1/2/4 — как в «Акциях». Высота сетки задаётся скриптом по
   свободной высоте экрана, окна делят её поровну; график внутри окна
   занимает всю площадь (autoSize). */
.arb-title-row .arb-layout, .arb-title-row .arb-link { flex: none; }
.arb-chartzone { min-width: 0; }
.arb-grid { display: grid; gap: 6px; grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); min-height: 260px; }
.arb-grid[data-layout="2"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.arb-grid[data-layout="4"] { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: repeat(2, minmax(0, 1fr)); }
.arb-cell { display: flex; flex-direction: column; min-width: 0; min-height: 0; border: 1px solid var(--border); border-radius: var(--radius-md); overflow: hidden; background: var(--surface); }
.arb-cell.is-active { border-color: rgba(59, 130, 246, .7); box-shadow: 0 0 0 1px rgba(59, 130, 246, .35); }
.arb-cell-head { display: flex; gap: 6px; padding: 4px 6px; border-bottom: 1px solid var(--border); background: var(--surface-2); flex: none; }
/* Общий select в styles.css растянут на 100% ширины — здесь ширину делим
   сами: пара забирает остаток, таймфрейм узкий */
.arb-cell-head select { min-width: 0; background-color: var(--surface); font-size: 12px; padding: 3px 24px 3px 8px; background-position: right 7px center; }
.arb-cell-head .arb-cell-pair { flex: 1 1 auto; width: auto; max-width: 260px; }
.arb-cell-head .arb-cell-tf { flex: none; width: 76px; }
.arb-cell-body { position: relative; flex: 1; min-height: 0; }
.arb-cell-chart { position: absolute; inset: 0; }
.arb-subzone { margin-top: 4px; }
.arb-sub { min-height: 100px; }
.arb-mode { flex: none; }
/* Режим «Таблица» */
.arb-tablezone { min-width: 0; }
.arb-table-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 8px; }
.arb-cols { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 10px; margin-bottom: 8px; }
.arb-cols-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 4px 14px; }
.arb-col-row { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.arb-col-move { display: inline-flex; gap: 2px; flex: none; }
.arb-col-move button:disabled { opacity: .3; cursor: default; }
.arb-table-scroll { overflow: auto; max-width: 100%; }
.arb-tablezone .arb-table-scroll { max-height: calc(100vh - 220px); border: 1px solid var(--border); border-radius: var(--radius-md); }
.arb-screen th { position: sticky; top: 0; z-index: 1; background: var(--surface-2); white-space: nowrap; }
.arb-screen td { white-space: nowrap; }
.arb-screen td:first-child, .arb-screen th:first-child { position: sticky; left: 0; background: var(--surface); z-index: 2; }
.arb-screen th:first-child { background: var(--surface-2); z-index: 3; }
.arb-th-sort { cursor: pointer; user-select: none; }
.arb-th-sort:hover { color: var(--text); }
.arb-screen tbody tr { cursor: pointer; }
.arb-screen tbody tr:hover td { background: var(--surface-2); }
.arb-table-scroll { scrollbar-width: thin; scrollbar-color: var(--surface-3, #2a2e39) transparent; }
/* Исполнение вечного фьючерса в калькуляторе */
.arb-exec-note { font-size: 12px; line-height: 1.45; color: var(--text-muted); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 10px 12px; background: var(--surface-2); }
.arb-exec-note b { color: var(--text); }
.arb-exec-note ul { margin: 6px 0 6px 18px; padding: 0; display: grid; gap: 3px; }
.arb-exec-note a { color: #60a5fa; }
@media (max-width: 860px) {
    /* На узком экране всегда одно окно — кнопки 1/2/4 и скрепка не нужны */
    .arb-title-row .arb-layout, .arb-title-row .arb-link { display: none; }
}
@media (max-width: 700px) {
    .arb-title { font-size: 17px; }
    .arb-mode { order: 5; }
    .arb-tablezone .arb-table-scroll { max-height: none; }
    .arb-cols-list { grid-template-columns: 1fr; }
    /* Карточки на телефоне — одна прокручиваемая лента: столбик из девяти
       карточек уводил график за пределы экрана */
    .arb-cards { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
    .arb-cards::-webkit-scrollbar { display: none; }
    .arb-card { flex: 0 0 auto; min-width: 128px; max-width: 170px; }
    .arb-card-v { font-size: 15px; }
}
.arb-bt-grid .arb-field { display: flex; flex-direction: column; align-items: stretch; gap: 3px; }
.arb-bt-grid .arb-field > span { white-space: normal; font-size: 12px; color: var(--text-muted); }
.arb-bt-grid .arb-field input, .arb-bt-grid .arb-field select { width: 100%; min-width: 0; }
@media (max-width: 700px) {
    .arb-bt-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .arb-bt-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); overflow: visible; }
    .arb-bt-cards .arb-card { min-width: 0; max-width: none; }
}
.arb-dlg-body { min-width: 0; overflow-x: hidden; }
.arb-dlg-body .arb-form, .arb-dlg-body .arb-form > * { min-width: 0; max-width: 100%; }
.arb-dlg-body .arb-table-scroll { max-width: 100%; overflow-x: auto; }
/* 08.10.2026: ненадёжная модель справедливого */
.arb-card-warn { border-color: rgba(245, 158, 11, .6); background: rgba(245, 158, 11, .08); }
.arb-card-warn .arb-card-v { color: #d97706; }
.arb-card-warn .arb-card-s { white-space: normal; }
.arb-unrel { color: #d97706; font-weight: 600; }
