/* «Вход и выход по ОИ» (oi-entry.js, PLAN.oi-flow.md): the Monitor block under «Айсберги».
   Buy/sell stay green/red as everywhere in Znaq; entry/exit are blue/orange — another pair, so the two
   readings of a cell never share a colour. */
:root {
  --oientry-in-rgb: 77, 141, 255;
  --oientry-out-rgb: 245, 158, 61;
  --oientry-in: #8fb6ff;
  --oientry-out: #ffb870;
  --oientry-strong-text: #ffffff;
  /* Where the price is and which cell the pointer is on (PLAN.oi-scale.md): neutral, never the four colours above. */
  --oientry-mark: rgba(255, 255, 255, .88);
  --oientry-guide: rgba(255, 255, 255, .42);
  --oientry-hover: rgba(255, 255, 255, .7);
  --oientry-hover-row: rgba(255, 255, 255, .2);
}
:root[data-theme="light"] {
  --oientry-in-rgb: 29, 95, 209;
  --oientry-out-rgb: 217, 119, 6;
  --oientry-in: #1d5fd1;
  --oientry-out: #b45309;
  --oientry-strong-text: #101828;
  --oientry-mark: rgba(16, 24, 40, .85);
  --oientry-guide: rgba(16, 24, 40, .38);
  --oientry-hover: rgba(16, 24, 40, .62);
  --oientry-hover-row: rgba(16, 24, 40, .16);
}

.oientry-head-tools { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .75rem; margin-left: auto; }
.oientry-switch { display: inline-flex; padding: 2px; gap: 2px; border: 1px solid var(--border-secondary); border-radius: var(--radius-sm); }
.oientry-switch button {
  min-height: 1.75rem; padding: .1rem .55rem; border: 0; border-radius: calc(var(--radius-sm) - 2px);
  color: var(--text-secondary); background: transparent; font-size: .75rem; cursor: pointer;
}
.oientry-switch button:hover { color: var(--text-primary); background: var(--bg-hover); }
.oientry-switch button[aria-pressed="true"] { color: var(--text-primary); background: var(--bg-tertiary); font-weight: 600; }
#oientry-state.is-off { color: var(--warning); }

.oientry-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; padding: .75rem; }
@media (max-width: 1100px) { .oientry-cards { grid-template-columns: minmax(0, 1fr); } }
.oientry-card {
  display: flex; flex-direction: column; gap: .6rem; min-width: 0; padding: .65rem .75rem;
  border: 1px solid var(--border-secondary); border-radius: var(--radius-md); background: var(--bg-secondary);
}
.oientry-card-head { display: flex; flex-wrap: nowrap; align-items: baseline; gap: .25rem .75rem; min-width: 0; white-space: nowrap; }
.oientry-card-head h3 { margin: 0; font-size: .9375rem; font-weight: 700; color: var(--text-primary); }
.oientry-contract { color: var(--text-tertiary); font-size: .75rem; }
.oientry-price { margin-left: auto; color: var(--text-primary); font-weight: 600; font-variant-numeric: tabular-nums; }
.oientry-oi { color: var(--text-tertiary); font-size: .75rem; font-variant-numeric: tabular-nums; }
.oientry-empty { margin: 0; color: var(--text-tertiary); font-size: .8125rem; }

/* Clusters: price rows × twelve columns, the histogram of the same columns in the footer. */
/* As high as the table, at most 31.5rem (owner, 02.11: «расстояние большое… компактней»); every point of Si
   scrolls inside, with the times, the histogram and the prices kept in view. The two cards' words below sit
   level on the rows the cards share (subgrid): the clusters' row is as high as the taller table. */
.oientry-scroll { max-height: 31.5rem; overflow: auto; }
@supports (grid-template-rows: subgrid) {
  .oientry-cards { row-gap: .6rem; }
  /* Six parts: head, clusters, verdict, chips, «переложили», day and hits (cardNode). */
  .oientry-card { display: grid; grid-row: span 6; grid-template-rows: subgrid; align-content: start; }
  .oientry-card.is-empty { display: flex; }   /* no trades yet: two parts, no gaps of four empty rows (review) */
}
.oientry-table thead th { position: sticky; top: 0; z-index: 2; background: var(--bg-secondary);
  box-shadow: 0 2px 0 var(--bg-secondary), 2px 0 0 var(--bg-secondary), 0 -2px 0 var(--bg-secondary); }
.oientry-table thead th:first-child { left: 0; z-index: 3; }
.oientry-table tfoot td { position: sticky; bottom: 0; z-index: 2; background: var(--bg-secondary);
  box-shadow: 0 -2px 0 var(--bg-secondary), 2px 0 0 var(--bg-secondary), 0 2px 0 var(--bg-secondary); }
.oientry-table tfoot td:first-child { left: 0; z-index: 3; }
.oientry-table tbody th { position: sticky; left: 0; z-index: 1; background: var(--bg-secondary);
  box-shadow: 2px 0 0 var(--bg-secondary), -2px 0 0 var(--bg-secondary);
  cursor: ns-resize; user-select: none; touch-action: none; }
.oientry-zoom { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .45rem; margin-bottom: .3rem;
  color: var(--text-tertiary); font-size: .6875rem; }
.oientry-zoom-label { color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.oientry-zoom button { min-width: 1.6rem; min-height: 1.4rem; padding: 0 .35rem; color: var(--text-secondary); cursor: pointer;
  background: transparent; border: 1px solid var(--border-secondary); border-radius: var(--radius-sm); font-size: .75rem; }
.oientry-zoom button:hover:not(:disabled) { color: var(--text-primary); background: var(--bg-hover); }
.oientry-zoom button:disabled { opacity: .45; cursor: default; }
.oientry-zoom-hint { margin-left: auto; }
/* The price out of the rows one sees: a pill on that edge (owner, 03.11). */
.oientry-clusters { position: relative; }
.oientry-to-price { position: absolute; left: 50%; z-index: 4; transform: translateX(-50%); padding: .15rem .65rem;
  color: var(--text-primary); background: var(--bg-primary); border: 1px solid var(--border-secondary); border-radius: 999px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .25); font-size: .75rem; font-weight: 600; font-variant-numeric: tabular-nums; cursor: pointer; }
.oientry-to-price:hover { background: var(--bg-hover); }
.oientry-to-price[hidden] { display: none; }
/* The history slider under the clusters — as the sweeps' one (monitor.css .monitor-ticker-scrub), right — later. */
.oientry-history { display: grid; gap: .25rem; padding-top: .35rem; }
.oientry-history-empty { margin: 0; color: var(--text-tertiary); font-size: .6875rem; }
.oientry-history-line { display: flex; align-items: center; gap: .5rem; }
.oientry-history-label { flex: 0 0 auto; min-width: 5.5rem; color: var(--text-secondary); font-size: .6875rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.oientry-history-live { flex: 0 0 auto; padding: .05rem .5rem; color: var(--text-secondary); background: none; border: 1px solid var(--border-secondary); border-radius: 999px; cursor: pointer; font: inherit; font-size: .6875rem; }
.oientry-history-live:hover { color: var(--text-primary); background: var(--bg-hover); }
.oientry-history-live[hidden] { display: none; }
.oientry-history-range { flex: 1 1 auto; min-width: 0; height: .375rem; min-height: 0; margin: 0; padding: 0; background: var(--bg-tertiary); border: 0; border-radius: 999px; box-shadow: none; outline: none; cursor: ew-resize; appearance: none; -webkit-appearance: none; }
.oientry-history-range:disabled { opacity: .4; cursor: default; }
.oientry-history-range:focus-visible { box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand) 45%, transparent); }
.oientry-history-range::-webkit-slider-thumb { width: 2.5rem; height: .375rem; background: color-mix(in srgb, var(--brand) 75%, transparent); border: 0; border-radius: 999px; -webkit-appearance: none; }
.oientry-history-range::-moz-range-thumb { width: 2.5rem; height: .375rem; background: color-mix(in srgb, var(--brand) 75%, transparent); border: 0; border-radius: 999px; }
.oientry-history-range:hover::-webkit-slider-thumb { background: var(--brand); }
.oientry-table { width: 100%; min-width: 31rem; border-collapse: separate; border-spacing: 2px; table-layout: fixed; font-variant-numeric: tabular-nums; }
.oientry-table col.oientry-price-col { width: 4.25rem; }
.oientry-table th { padding: 0 0 .1rem; color: var(--text-tertiary); font-size: .625rem; font-weight: 500; text-align: center; white-space: nowrap; }
.oientry-table th.is-current { color: var(--text-primary); font-weight: 700; }
.oientry-table th:first-child { text-align: left; }
.oientry-table tbody th { padding: 0 .3rem 0 .35rem; font-size: .6875rem; text-align: left; color: var(--text-secondary); }
/* The level the last price is in — a price tag on the scale: a frame drawn inside the sticky cell, so neither its
   size nor the shadows hiding the cells under the sticky column change. */
.oientry-table tbody th.is-last { color: var(--text-primary); font-weight: 700; }
.oientry-table tbody th.is-last::after {
  content: ""; position: absolute; inset: 1px 1px 1px 0; box-shadow: inset 0 0 0 1.5px var(--oientry-mark);
  border-radius: 4px; pointer-events: none;
}
/* The price and the time of the cell under the pointer: a dashed frame inside, no size change. */
.oientry-table tbody th.is-hover-price,
.oientry-table thead th.is-hover-time { color: var(--text-primary); outline: 1px dashed var(--oientry-hover); outline-offset: -2px; }
.oientry-cell {
  height: 1.75rem; padding: 0; border-radius: 4px; text-align: center; line-height: 1.1;
  background: rgba(127, 127, 127, .05); overflow: hidden;
}
.oientry-cell.is-empty { background: rgba(127, 127, 127, .03); }
/* The price row — a line across the table (box-shadow); the row under the pointer — a fainter one, the price
   row's stays where they meet; the cell itself — an outline 2px inside, so it never wipes either line (review). */
.oientry-cell.is-last-row { box-shadow: inset 0 1px 0 var(--oientry-guide), inset 0 -1px 0 var(--oientry-guide); }
.oientry-cell.is-hover-row { box-shadow: inset 0 1px 0 var(--oientry-hover-row), inset 0 -1px 0 var(--oientry-hover-row); }
.oientry-cell.is-last-row.is-hover-row { box-shadow: inset 0 1px 0 var(--oientry-guide), inset 0 -1px 0 var(--oientry-guide); }
.oientry-cell.is-hover-cell { outline: 1px solid var(--oientry-hover); outline-offset: -2px; }
.oientry-cell span { display: block; overflow: hidden; white-space: nowrap; text-overflow: clip; }
.oientry-top { font-size: .6875rem; font-weight: 600; color: var(--text-primary); }
.oientry-top.is-buy { color: var(--success); }
.oientry-top.is-sell { color: var(--error); }
.oientry-bottom { font-size: .625rem; font-weight: 600; color: var(--text-tertiary); }
.oientry-bottom.is-in { color: var(--oientry-in); }
.oientry-bottom.is-out { color: var(--oientry-out); }
.oientry-cell.is-strong .oientry-bottom, .oientry-cell.is-strong .oientry-top.is-volume { color: var(--oientry-strong-text); }
.oientry-cell.is-dim { opacity: .55; }
.oientry-table tfoot td { padding: 0; vertical-align: top; }
.oientry-bar { display: flex; flex-direction: column; align-items: center; }
.oientry-bar-half { display: flex; justify-content: center; width: 100%; height: 1.25rem; }
.oientry-bar-half.is-up { align-items: flex-end; }
.oientry-bar-half.is-down { align-items: flex-start; }
.oientry-bar-axis { width: 100%; height: 1px; background: var(--border-secondary); }
.oientry-bar-fill { display: block; width: 70%; }
.oientry-bar-fill.is-in { background: rgb(var(--oientry-in-rgb)); border-radius: 2px 2px 0 0; }
.oientry-bar-fill.is-out { background: rgb(var(--oientry-out-rgb)); border-radius: 0 0 2px 2px; }
.oientry-bar-label { margin-top: .1rem; font-size: .625rem; color: var(--text-tertiary); white-space: nowrap; }
.oientry-bar-label.is-in { color: var(--oientry-in); }
.oientry-bar-label.is-out { color: var(--oientry-out); }
.oientry-foot-label { color: var(--text-tertiary); font-size: .625rem; line-height: 1.2; padding-top: .3rem !important; }

/* The verdict and the rest under the clusters. */
.oientry-verdict {
  display: grid; gap: .3rem; padding: .55rem .7rem; border-radius: var(--radius-sm);
  border: 1px solid var(--border-secondary); background: var(--bg-primary);
}
.oientry-verdict.is-in { border-color: rgba(var(--oientry-in-rgb), .5); background: rgba(var(--oientry-in-rgb), .08); }
.oientry-verdict.is-out { border-color: rgba(var(--oientry-out-rgb), .5); background: rgba(var(--oientry-out-rgb), .08); }
.oientry-verdict-main { display: flex; align-items: baseline; gap: .5rem; }
.oientry-verdict-text { font-size: 1.0625rem; font-weight: 700; color: var(--text-secondary); }
.oientry-verdict.is-in .oientry-verdict-text { color: var(--oientry-in); }
.oientry-verdict.is-out .oientry-verdict-text { color: var(--oientry-out); }
.oientry-verdict-window { margin-left: auto; color: var(--text-tertiary); font-size: .75rem; }
.oientry-figures { display: flex; flex-wrap: wrap; gap: .15rem .9rem; color: var(--text-secondary); font-size: .8125rem; font-variant-numeric: tabular-nums; }
.oientry-figures b.is-in { color: var(--oientry-in); }
.oientry-figures b.is-out { color: var(--oientry-out); }
.oientry-event { color: var(--oientry-out); font-size: .8125rem; }
.oientry-event.is-in { color: var(--oientry-in); }
.oientry-who { color: var(--text-tertiary); font-size: .75rem; }
.oientry-who b { color: var(--text-primary); font-weight: 600; }

.oientry-chips { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .4rem; }
@media (max-width: 560px) { .oientry-chips { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.oientry-chip { display: grid; gap: .15rem; min-width: 0; padding: .35rem .5rem; border: 1px solid var(--border-secondary); border-radius: var(--radius-sm); }
.oientry-chip-label { overflow: hidden; color: var(--text-tertiary); font-size: .6875rem; white-space: nowrap; text-overflow: ellipsis; }
.oientry-chip-value { color: var(--text-primary); font-size: .8125rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.oientry-chip-track { display: block; height: 3px; border-radius: 2px; background: var(--bg-tertiary); }
.oientry-chip-fill { display: block; height: 3px; border-radius: 2px; }
.oientry-chip-fill.is-in { background: rgb(var(--oientry-in-rgb)); }
.oientry-chip-fill.is-out { background: rgb(var(--oientry-out-rgb)); }
.oientry-moved { color: var(--text-tertiary); font-size: .75rem; }

.oientry-lower { display: grid; grid-template-columns: minmax(0, 16.5rem) minmax(0, 1fr); gap: .75rem; padding-top: .5rem; border-top: 1px solid var(--border-secondary); }
@media (max-width: 560px) { .oientry-lower { grid-template-columns: minmax(0, 1fr); } }
.oientry-day { display: grid; gap: .2rem; min-width: 0; }
.oientry-day svg { display: block; width: 100%; height: 4.5rem; }
.oientry-day-caption, .oientry-day-axis { display: flex; justify-content: space-between; color: var(--text-tertiary); font-size: .6875rem; }
.oientry-day-shade { fill: var(--text-primary); fill-opacity: .06; }
.oientry-day-zero { stroke: var(--border-primary); stroke-dasharray: 3 3; stroke-width: 1; }
.oientry-day-price { fill: none; stroke: var(--text-tertiary); stroke-width: 1; }
.oientry-day-cum { fill: none; stroke-width: 2; }
.oientry-day-cum.is-in { stroke: rgb(var(--oientry-in-rgb)); }
.oientry-day-cum.is-out { stroke: rgb(var(--oientry-out-rgb)); }
.oientry-hits { display: grid; align-content: start; gap: .15rem; min-width: 0; font-size: .75rem; font-variant-numeric: tabular-nums; }
.oientry-hits-title { color: var(--text-tertiary); font-size: .6875rem; }
.oientry-hit { display: grid; grid-template-columns: 3.9rem 3.4rem 3rem minmax(0, 1fr); gap: .35rem; align-items: baseline; }
.oientry-hit > span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.oientry-hit-time { color: var(--text-tertiary); }
.oientry-hit-side.is-buy { color: var(--success); font-weight: 600; }
.oientry-hit-side.is-sell { color: var(--error); font-weight: 600; }
.oientry-hit-qty { text-align: right; }
.oientry-hit-kind.is-in { color: var(--oientry-in); }
.oientry-hit-kind.is-out { color: var(--oientry-out); }
.oientry-hit-kind { color: var(--text-tertiary); }
.oientry-legend { margin: 0; padding: 0 .75rem .65rem; color: var(--text-tertiary); font-size: .6875rem; line-height: 1.45; }

/* The «ОИ» column of «Активные роботы». */
.monitor-robots-table td.oientry-robot.is-in { color: var(--oientry-in); }
.monitor-robots-table td.oientry-robot.is-out { color: var(--oientry-out); }
.monitor-robots-table td.oientry-robot.is-flat { color: var(--text-tertiary); }
.oientry-quiet { padding: 0 .4rem; border-radius: var(--radius-sm); color: var(--warning); border: 1px solid var(--warning); font-size: .6875rem; }
/* Without the flag the column is not there at all (ревью-5). */
body.oientry-off .monitor-robots-table col:nth-child(11),
body.oientry-off .monitor-robots-table th:nth-child(11),
body.oientry-off .monitor-robots-table td[data-monitor-cell="oientry"] { display: none; }
/* The verdict's window switch (owner, 02.11): in place of «за 15 мин». */
.oientry-window { display: inline-flex; gap: 2px; margin-left: auto; padding: 2px; border: 1px solid var(--border-secondary);
  border-radius: var(--radius-sm); }
.oientry-window button { min-height: 1.4rem; padding: 0 .4rem; border: 0; border-radius: calc(var(--radius-sm) - 2px);
  color: var(--text-tertiary); background: transparent; font-size: .6875rem; cursor: pointer; }
.oientry-window button:hover { color: var(--text-primary); background: var(--bg-hover); }
.oientry-window button[aria-pressed="true"] { color: var(--text-primary); background: var(--bg-tertiary); font-weight: 600; }
