/* --- Live table layout --- */

.live-head{
  /* reuse arb-head visuals; keep hook for future */
}

.live-top-row{
  display: block;
  margin-bottom: 18px;
}

/* In the top row, cards should not add extra vertical spacing individually. */
.live-top-row > .card{
  margin-bottom: 0;
}

.live-top-col,
.live-top-col-left,
.live-top-col-right{
  width: 100%;
  flex: 1 1 auto;
  min-width: 0;
}

.live-wrap{
  max-height: clamp(360px, 55vh, 720px);
  background: transparent;

  /* Prevent subtle scroll "jitter" on frequent DOM updates.
     - Disable scroll anchoring inside the live table container.
     - Keep gutter reserved so the layout doesn't shift when scrollbars appear/disappear. */
  overflow-anchor: none;
  scrollbar-gutter: stable;
}

.live-top-placeholder{
  height: 100%;
  min-height: 220px;
  border: 1px dashed rgba(255,255,255,0.14);
  border-radius: 12px;
  background: rgba(255,255,255,0.02);
}

/* Pager at the bottom (per-table, not shared) */
.live-footer{
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.live-pages{
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.live-footer .arb-mini:disabled{
  opacity: 0.35;
  cursor: not-allowed;
}

/* Match the modern UI font (like the arbitrage table) */
#liveTable,
#spotTable{
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-variant-numeric: tabular-nums;
  background: transparent;

  /* Column sizing (Live)
     The problem: PRICE column wastes space (mostly empty), while EXCHANGE names
     get ellipsized. We fix it by:
       - making PRICE intentionally tight
       - keeping numeric columns fixed
       - letting EXCHANGE take the remaining width

     IMPORTANT: widths are applied via <colgroup> in index.html,
     so header + body always match. */
  table-layout: fixed;
  width: 100% !important;
  min-width: 100% !important;
}

/* Tight PRICE, keep other numeric columns stable.
   All widths are clamp(min, vw-based, max) so columns reflow on browser
   zoom / narrow windows instead of overflowing the page. */
#liveTable{
  --lt-col-ex: clamp(110px, 12vw, 188px);
  --lt-col-book: clamp(50px, 4.5vw, 80px);
  --lt-col-price: clamp(70px, 7vw, 112px);
  --lt-col-liquidity: clamp(110px, 11vw, 176px);
  --lt-col-funding: clamp(60px, 5.5vw, 96px);
  --lt-col-pay: clamp(90px, 8.5vw, 148px);
  --lt-col-time: clamp(60px, 5.5vw, 98px);
  --lt-col-day: clamp(40px, 3.8vw, 64px);
}

#spotTable{
  --lt-col-book: clamp(54px, 5vw, 84px);
  --lt-col-price: clamp(72px, 7.5vw, 128px);
  --lt-col-funding: clamp(60px, 6vw, 98px);
  --lt-col-pay: clamp(40px, 3.5vw, 54px);
  --lt-col-time: clamp(64px, 6vw, 104px);
}

#liveListFilterPop{
  width: min(920px, 96vw);
}

#liveListFilterPop .arb-filter-pane-head-actions-only{
  justify-content: flex-end;
  margin-bottom: 12px;
}

#liveListFilterPop .arb-filter-advanced-grid-live-thresholds{
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 24px;
}

#liveListFilterPop .arb-filter-advanced-grid-live-thresholds > .arb-filter-field-block{
  position: relative;
  min-width: 0;
}

#liveListFilterPop .arb-filter-pane-advanced .arb-filter-field-head{
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}

#liveListFilterPop .arb-filter-pane-advanced .arb-filter-field-head .arb-alert-field-label{
  white-space: normal;
}

#liveListFilterPop .arb-filter-pane-advanced .arb-filter-field-block input{
  width: min(100%, 148px);
  min-width: 148px;
  max-width: 148px;
}

#liveListFilterPop .arb-filter-pane-advanced .arb-filter-presets{
  justify-content: flex-start;
}

#liveListFilterPop .arb-filter-advanced-grid-live-thresholds > .arb-filter-field-block + .arb-filter-field-block::before{
  content: "";
  position: absolute;
  top: 6px;
  bottom: 6px;
  left: -12px;
  width: 1px;
  background: linear-gradient(180deg, rgba(65,245,240,0.00), rgba(65,245,240,0.34), rgba(65,245,240,0.00));
}

@media (max-width: 980px){
  #liveListFilterPop .arb-filter-advanced-grid-live-thresholds{
    grid-template-columns: minmax(0, 1fr);
  }

  #liveListFilterPop .arb-filter-pane-advanced .arb-filter-field-block input{
    width: 100%;
    min-width: 0;
    max-width: 100%;
  }

  #liveListFilterPop .arb-filter-advanced-grid-live-thresholds > .arb-filter-field-block + .arb-filter-field-block::before{
    top: -7px;
    bottom: auto;
    left: 12px;
    right: 12px;
    width: auto;
    height: 1px;
    background: linear-gradient(90deg, rgba(65,245,240,0.00), rgba(65,245,240,0.34), rgba(65,245,240,0.00));
  }
}

/* Preferred: column widths via <colgroup> */
#liveTable col.lt-col-ex{ width: var(--lt-col-ex); }
#liveTable col.lt-col-book,
#spotTable col.lt-col-book{ width: var(--lt-col-book); }
#liveTable col.lt-col-price,
#spotTable col.lt-col-price{ width: var(--lt-col-price); }
#liveTable col.lt-col-liquidity{ width: var(--lt-col-liquidity); }
#liveTable col.lt-col-funding,
#spotTable col.lt-col-funding{ width: var(--lt-col-funding); }
#liveTable col.lt-col-pay,
#spotTable col.lt-col-pay{ width: var(--lt-col-pay); }
#spotTable col.lt-col-time{ width: var(--lt-col-time); }
#liveTable col.lt-col-day{ width: var(--lt-col-day); }

/* Fallback: also set header widths (some browsers are picky with sticky thead) */
#liveTable thead th:nth-child(1){ width: var(--lt-col-ex); }
#liveTable thead th:nth-child(2),
#spotTable thead th:nth-child(2){ width: var(--lt-col-book); }
#liveTable thead th:nth-child(3),
#spotTable thead th:nth-child(3){ width: var(--lt-col-price); }
#liveTable thead th:nth-child(4){ width: var(--lt-col-liquidity); }
#liveTable thead th:nth-child(5){ width: var(--lt-col-funding); }
#liveTable thead th:nth-child(6){ width: var(--lt-col-pay); }
#spotTable thead th:nth-child(4){ width: var(--lt-col-funding); }
#spotTable thead th:nth-child(5){ width: var(--lt-col-pay); }
#spotTable thead th:nth-child(6){ width: var(--lt-col-time); }

/* Keep header text from bleeding outside when columns are tightened */
#liveTable thead th,
#spotTable thead th{
  overflow: hidden;
  text-overflow: ellipsis;
}

#liveTable thead th,
#spotTable thead th{
  /* Sticky header: opaque and slightly brighter so it clearly separates from rows */
  background: #111821;
  color: rgba(233, 238, 244, 0.84);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-weight: 800;
  font-size: 13px;
  line-height: 1.15;
  letter-spacing: 0.01em;
  text-transform: none;
  padding: 11px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

#liveTable thead th{
  font-size: clamp(7px, 0.78vw, 9px);
  line-height: 1.08;
  padding: clamp(3px, 0.55vw, 7px) clamp(2px, 0.5vw, 7px);
}

#liveTable tbody td,
#spotTable tbody td{
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.88);
  vertical-align: middle;
}

#liveTable tbody td{
  font-size: clamp(7px, 0.78vw, 9px);
  padding: clamp(3px, 0.55vw, 6px) clamp(2px, 0.5vw, 7px);
}

/* Numeric columns inherit `--table-number-font-size` from vars.css, which
   is itself a clamp(8px, 0.92vw, 11px) — so they auto-shrink on browser
   zoom / narrow viewports together with the regular cells above. */

/* Padding compression at narrow viewports — same idea as in arbitrage
   table.css: when zoom-in shrinks the effective viewport, slim down the
   horizontal padding so columns keep their cushion without merging. */
@media (max-width: 1500px){
  #liveTable thead th, #liveTable tbody td,
  #spotTable thead th, #spotTable tbody td{padding-left:6px;padding-right:6px;}
}
@media (max-width: 1280px){
  #liveTable thead th, #liveTable tbody td,
  #spotTable thead th, #spotTable tbody td{padding-left:4px;padding-right:4px;}
}
@media (max-width: 1100px){
  #liveTable thead th, #liveTable tbody td,
  #spotTable thead th, #spotTable tbody td{padding-left:3px;padding-right:3px;}
}

/* Keep live Book spread digits in the same gold tone as the rest of the UI.
   The generic #liveTable td color above is more specific than .arb-book-spread-val,
   so we restate it here with live-table specificity. */
#liveTable tbody td.lt-book.arb-book-spread-val,
#spotTable tbody td.lt-book.arb-book-spread-val,
#liveTable .lt-best-col-book .arb-book-spread-val,
#spotTable .lt-best-col-book .arb-book-spread-val{
  color: #f2d27a;
  font-weight: 700;
}

/* Make the PAY/FUNDING/To payment section tighter (reduce perceived big gaps) */
#liveTable thead th:nth-child(2),
#liveTable tbody td:nth-child(2),
#spotTable thead th:nth-child(2),
#spotTable tbody td:nth-child(2){
  /* BOOK SPREAD */
  padding-left: 7px;
  padding-right: 7px;
}

#liveTable thead th:nth-child(3),
#liveTable tbody td:nth-child(3),
#spotTable thead th:nth-child(3),
#spotTable tbody td:nth-child(3){
  /* PRICE: keep it tighter so it doesn't look half-empty */
  padding-left: 8px;
  padding-right: 8px;
}

#liveTable thead th:nth-child(4),
#liveTable tbody td:nth-child(4){
  padding-left: 8px;
  padding-right: 8px;
}

#liveTable thead th:nth-child(5),
#liveTable tbody td:nth-child(5){
  padding-left: 8px;
  padding-right: 8px;
}

#liveTable thead th:nth-child(6),
#liveTable tbody td:nth-child(6),
#spotTable thead th:nth-child(4),
#spotTable tbody td:nth-child(4){
  padding-left: 6px;
  padding-right: 6px;
}

#spotTable thead th:nth-child(6),
#spotTable tbody td:nth-child(6){
  padding-left: 8px;
  padding-right: 8px;
}

#spotTable thead th:nth-child(5),
#spotTable tbody td:nth-child(5){
  padding-left: 6px;
  padding-right: 6px;
}

#liveTable thead th:nth-child(2),
#liveTable tbody td:nth-child(2){
  padding-left: 5px;
  padding-right: 5px;
}

#liveTable thead th:nth-child(3),
#liveTable tbody td:nth-child(3){
  padding-left: 5px;
  padding-right: 5px;
}

#liveTable thead th:nth-child(4),
#liveTable tbody td:nth-child(4),
#liveTable thead th:nth-child(5),
#liveTable tbody td:nth-child(5){
  padding-left: 6px;
  padding-right: 6px;
}

#liveTable thead th:nth-child(6),
#liveTable tbody td:nth-child(6){
  padding-left: 5px;
  padding-right: 5px;
}

#liveTable thead th.lt-col-book,
#liveTable tbody td.lt-book{
  padding-left: 5px;
  padding-right: 5px;
}

#liveTable thead th.lt-col-entryexit,
#liveTable tbody td.lt-entryexit{
  padding-left: 5px;
  padding-right: 5px;
}

#liveTable thead th.lt-col-price,
#liveTable tbody td[data-live-metric="price"]{
  padding-left: 5px;
  padding-right: 5px;
}

#liveTable thead th.lt-col-liquidity,
#liveTable tbody td.lt-liquidity-cell,
#liveTable thead th.lt-col-pay,
#liveTable tbody td.lt-paytime-cell{
  padding-left: 6px;
  padding-right: 6px;
}

#liveTable thead th.lt-col-funding,
#liveTable tbody td[data-live-metric="funding"]{
  padding-left: 5px;
  padding-right: 5px;
}

#liveTable tbody tr:hover,
#spotTable tbody tr:hover{
  background: rgba(255, 255, 255, 0.03);
}

#liveTable thead th .th-with-ico,
#spotTable thead th .th-with-ico{
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

#liveTable thead th .th-label,
#spotTable thead th .th-label{
  font: inherit;
}

#liveTable .lt-num,
#spotTable .lt-num{
  text-align: right;
  font-family: var(--table-number-font-family);
  font-size: var(--table-number-font-size);
  font-weight: var(--table-number-font-weight);
  line-height: 1.12;
  font-variant-numeric: tabular-nums;
}

#liveTable td.lt-num.arb-pos,
#liveTable td.lt-num.arb-neg,
#liveTable td.lt-num.arb-muted,
#spotTable td.lt-num.arb-pos,
#spotTable td.lt-num.arb-neg,
#spotTable td.lt-num.arb-muted{
  font-weight: var(--table-number-font-weight);
}

#liveTable .lt-coin-head-price24h-value .arb-two-lines{
  align-items: flex-start;
  min-width: 0;
  overflow: hidden;
}

#liveTable .lt-coin-head-price24h-value .arb-two-lines > div{
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#liveTable .lt-coin-head-price24h-value .arb-price24h-range,
#liveTable .lt-coin-head-price24h-value .arb-price24h-range.arb-muted{
  color: var(--muted);
}

/* Coin separator row */
#liveTable tr.lt-coin-head td,
#spotTable tr.lt-coin-head td{
  text-align: center;
  font-weight: 900;
  letter-spacing: 0.3px;
  background: rgba(255,255,255,0.03);
}

#liveTable tr.lt-coin-head,
#spotTable tr.lt-coin-head{
  cursor: pointer;
}

/* Exchange cell */
#liveTable td.lt-ex,
#spotTable td.lt-ex{
  /* Match the UI pill / filter font (like in the screenshot) */
  font-weight: 700;
  font-size: clamp(8px, 0.92vw, 11px);
  letter-spacing: 0.01em;

  /* Prevent long exchange profile codes from expanding the column */
  overflow: hidden;
}

#liveTable td.lt-ex{
  font-size: clamp(8px, 0.85vw, 10px);
}

/* Freeze the main live columns while the history day columns scroll. */
#liveTable thead th:nth-child(-n+6),
#liveTable tbody tr[data-lt-group-role="exchange"] td:nth-child(-n+6),
#liveTable tbody tr.lt-best-row td.lt-best-cell{
  position: sticky;
  background: var(--bg);
}

#liveTable thead th:nth-child(-n+6){ z-index: 4; }
#liveTable tbody tr[data-lt-group-role="exchange"] td:nth-child(-n+6){ z-index: 2; }
#liveTable tbody tr.lt-best-row td.lt-best-cell{ z-index: 2; }

#liveTable thead th:nth-child(1),
#liveTable tbody tr[data-lt-group-role="exchange"] td:nth-child(1){ left: 0; }

#liveTable thead th:nth-child(2),
#liveTable tbody tr[data-lt-group-role="exchange"] td:nth-child(2){ left: var(--lt-col-ex); }

#liveTable thead th:nth-child(3),
#liveTable tbody tr[data-lt-group-role="exchange"] td:nth-child(3){ left: calc(var(--lt-col-ex) + var(--lt-col-book)); }

#liveTable thead th:nth-child(4),
#liveTable tbody tr[data-lt-group-role="exchange"] td:nth-child(4){ left: calc(var(--lt-col-ex) + var(--lt-col-book) + var(--lt-col-price)); }

#liveTable thead th:nth-child(5),
#liveTable tbody tr[data-lt-group-role="exchange"] td:nth-child(5){ left: calc(var(--lt-col-ex) + var(--lt-col-book) + var(--lt-col-price) + var(--lt-col-liquidity)); }

#liveTable thead th:nth-child(6),
#liveTable tbody tr[data-lt-group-role="exchange"] td:nth-child(6){ left: calc(var(--lt-col-ex) + var(--lt-col-book) + var(--lt-col-price) + var(--lt-col-liquidity) + var(--lt-col-funding)); }

#liveTable tbody tr.lt-best-row td.lt-best-cell{
  left: 0;
  border-right: 0;
  box-shadow: none;
}

#liveTable thead th:nth-child(6),
#liveTable tbody tr[data-lt-group-role="exchange"] td:nth-child(6){
  box-shadow: none;
}

#liveTable tbody tr[data-lt-group-role="exchange"]:hover td:nth-child(-n+6),
#liveTable tbody tr.lt-best-row:hover td.lt-best-cell{
  background: rgba(255,255,255,0.03);
}

/* Click-to-select LONG/SHORT exchange for a coin */
#liveTable td.lt-ex.lt-ex-pair,
#spotTable td.lt-ex.lt-ex-pair{
  cursor: pointer;
}

#liveTable td.lt-ex.lt-ex-pair:hover .ex-pill,
#spotTable td.lt-ex.lt-ex-pair:hover .ex-pill{
  background: rgba(255,255,255,0.06);
}

#liveTable td.lt-ex.lt-ex-pair.is-pair-long .ex-pill,
#spotTable td.lt-ex.lt-ex-pair.is-pair-long .ex-pill{
  /* Requested: LONG leg should be green filled (not gold) */
  background: rgba(34,197,94,0.14);
  border-color: rgba(34,197,94,0.34);
  box-shadow: 0 0 0 2px rgba(34,197,94,0.18);
}

#liveTable td.lt-ex.lt-ex-pair.is-pair-short .ex-pill,
#spotTable td.lt-ex.lt-ex-pair.is-pair-short .ex-pill{
  /* Requested: SHORT leg should be red filled (not gold) */
  background: rgba(239,68,68,0.14);
  border-color: rgba(239,68,68,0.32);
  box-shadow: 0 0 0 2px rgba(239,68,68,0.18);
}

#liveTable td.lt-ex .ex-with-icon,
#spotTable td.lt-ex .ex-with-icon{
  gap: 8px;
}

/* Live table exchange pill should stretch full-width
   (requested: the fill/background must cover the whole Exchange column). */
#liveTable td.lt-ex .ex-pill,
#spotTable td.lt-ex .ex-pill{
  display: flex;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  justify-content: flex-start;
}

/* Ellipsis for long exchange labels like BINANCE@ABC123 */
#liveTable td.lt-ex .ex-pill > span,
#spotTable td.lt-ex .ex-pill > span{
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Click-to-sort funding header */
#liveTable th.lt-sort,
#spotTable th.lt-sort,
#liveTable th.lt-hist-sort{
  cursor: pointer;
  user-select: none;
}

#liveTable th.lt-sort:hover,
#spotTable th.lt-sort:hover,
#liveTable th.lt-hist-sort:hover{
  background: #17202b;
}

.lt-sort-arrow{
  display: inline-block;
  margin-left: 6px;
  opacity: 0.85;
}

/* Active sort arrow (blue/cyan accent) */
#liveTable th.lt-sort.is-active .lt-sort-arrow,
#spotTable th.lt-sort.is-active .lt-sort-arrow,
#liveTable th.lt-hist-sort.is-active .lt-sort-arrow{
  color: var(--accent);
  opacity: 1;
}

#liveTable th.lt-sort.is-active,
#spotTable th.lt-sort.is-active,
#liveTable th.lt-hist-sort.is-active{
  color: rgba(238, 243, 248, 0.90);
}

/* Clickable cells (open charts) */
#liveTable td.lt-click,
#spotTable td.lt-click{
  cursor: pointer;
}

#liveTable td.lt-click:hover,
#spotTable td.lt-click:hover{
  text-decoration: underline;
  text-underline-offset: 3px;
}

#liveTable td.lt-history-click{
  cursor: pointer;
}

#liveTable td.lt-history-click:hover{
  text-decoration: underline;
  text-underline-offset: 3px;
}

#liveTable thead th.lt-col-day,
#liveTable tbody td.lt-history-click{
  padding-left: 6px;
  padding-right: 6px;
}

/* Ensure funding colors override base td color */
#liveTable td.arb-pos,
#spotTable td.arb-pos{ color: var(--success); font-weight: 700; }
#liveTable td.arb-neg,
#spotTable td.arb-neg{ color: var(--danger); font-weight: 700; }
#liveTable td.arb-muted,
#spotTable td.arb-muted{ color: var(--muted); }

/* Coin head hover outline */
#liveTable tr.lt-coin-head:hover td,
#spotTable tr.lt-coin-head:hover td{
  outline: 1px solid rgba(255,255,255,0.10);
  outline-offset: -1px;
}

/* -------------------------------------------------------------
   Per-coin "best spread" row (LONG/SHORT + spreads)
-------------------------------------------------------------- */

#liveTable tr.lt-best-row td,
#spotTable tr.lt-best-row td{
  background: rgba(242, 210, 122, 0.045);
  border-bottom-color: rgba(242, 210, 122, 0.12);
  vertical-align: top;
}

#liveTable tr.lt-best-row:hover td,
#spotTable tr.lt-best-row:hover td{
  background: rgba(242, 210, 122, 0.07);
}

/* Clickable blocks inside the best-spread row (open spread history chart).
   No border/fill — clickability is signalled only by cursor + underline on
   hover so the In/Out, Price, Funding columns blend into the row. */
#liveTable .lt-best-click,
#spotTable .lt-best-click{
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 10px;
  border: 0;
  background: transparent;
}

#liveTable .lt-best-click:hover,
#spotTable .lt-best-click:hover{
  background: transparent;
  border-color: transparent;
}

#liveTable .lt-best-click:hover .lt-best-val,
#spotTable .lt-best-click:hover .lt-best-val{
  text-decoration: underline;
  text-underline-offset: 3px;
}

#liveTable td.lt-best-first,
#spotTable td.lt-best-first{
  min-width: 140px;
}

.lt-best-title{
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  margin-bottom: 0;
}

.lt-best-title-ico{
  display: inline-flex;
  width: 14px;
  height: 14px;
  color: var(--accent);
  opacity: 0.95;
}

.lt-best-title-ico svg{
  width: 14px;
  height: 14px;
  display: block;
}

.lt-best-pair{
  display: flex;
  flex-direction: column;
  gap: 4px;
  line-height: 1.1;
}

.lt-best-grid{
  padding: 8px 12px;
  border-radius: 10px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
}

.lt-best-leg{
  display: inline-flex;
  align-items: center;
  gap: clamp(3px, 0.5vw, 6px);
  padding: clamp(2px, 0.3vw, 3px) clamp(3px, 0.5vw, 6px);
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.10);
  width: fit-content;
  max-width: 100%;
  box-sizing: border-box;
}

/* Make LONG/SHORT pills slightly smaller in the best-spread row */
.lt-best-leg .arb-pill{
  font-size: clamp(5px, 0.55vw, 7px);
  padding: 1px clamp(2px, 0.4vw, 4px);
  border-radius: 6px;
}

.lt-best-leg-long{
  background: rgba(34,197,94,0.10);
  border-color: rgba(34,197,94,0.26);
}

.lt-best-leg-short{
  background: rgba(239,68,68,0.10);
  border-color: rgba(239,68,68,0.24);
}

/* Outline the exchange icon itself (same vibe as historical row) */
.lt-best-leg-long img.ex-icon{
  box-shadow: 0 0 0 2px rgba(34,197,94,0.28);
  border-radius: 6px;
}

.lt-best-leg-short img.ex-icon{
  box-shadow: 0 0 0 2px rgba(239,68,68,0.26);
  border-radius: 6px;
}

/* New best-spread row layout (values bottom-aligned; exchanges shown after SPREAD) */
#liveTable tr.lt-best-row td.lt-num,
#spotTable tr.lt-best-row td.lt-num{
  vertical-align: bottom;
}

#liveTable tr.lt-best-row td.lt-best-first,
#spotTable tr.lt-best-row td.lt-best-first{
  vertical-align: top;
}

#liveTable tr.lt-best-row .arb-pill,
#spotTable tr.lt-best-row .arb-pill{
  font-size: clamp(5px, 0.55vw, 7px);
  padding: 1px clamp(2px, 0.4vw, 4px);
  border-radius: 6px;
}

.lt-best-num{
  width: 100%;
  min-height: 64px;
  justify-content: flex-end;
}

.lt-best-line{
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  line-height: 1.1;
}

.lt-best-sub{
  display: flex;
  align-items: baseline;
  justify-content: flex-end;
  gap: 6px;
}

.lt-best-val{
  /* Numbers should match the table body styling (no extra bold override). */
  white-space: nowrap;
}

.lt-best-exwrap{
  display: inline-flex;
  align-items: center;
}

.lt-best-ex{
  gap: 0 !important;
}

.lt-best-ex > span{
  display: none;
}

.lt-best-exwrap.is-long img.ex-icon{
  box-shadow: 0 0 0 2px rgba(34,197,94,0.28);
  border-radius: 6px;
}

.lt-best-exwrap.is-short img.ex-icon{
  box-shadow: 0 0 0 2px rgba(239,68,68,0.26);
  border-radius: 6px;
}

/* -------------------------------------------------------------
   Best spread row (full-width block): Price + Funding (requested)
-------------------------------------------------------------- */

/* Make the SPREAD title visually dominant */
.lt-best-title{
  font-size: clamp(9px, 1vw, 12px);
}

.lt-best-title-big{
  /* Requested: make "SPREAD" about 2x smaller so the row fits */
  font-size: clamp(6px, 0.62vw, 7.5px);
  line-height: 1.05;
}

.lt-best-badge{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  opacity: 0.95;
  font-size: clamp(9px, 0.9vw, 11px);
  line-height: 1;
  margin-left: 2px;
}

#liveTable td.lt-best-cell,
#spotTable td.lt-best-cell{
  padding: 10px 12px;
}

.lt-best-layout{
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;

  /* If the spread row becomes wider than the table (small screens),
     allow horizontal scroll inside the row instead of wrapping lines. */
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.lt-best-layout::-webkit-scrollbar{
  width: 0;
  height: 0;
  display: none;
}

/* New spread-row grid (not tied to table columns; values stacked in columns) */
.lt-best-grid{
  display: flex;
  align-items: stretch; /* equalise column heights */
  /* Tighter spacing so the SPREAD row doesn't overflow */
  gap: 6px;
  flex-wrap: nowrap;
  width: max-content;
  margin: 0 auto;
}

.lt-best-col{
  display: flex;
  flex-direction: column;
  gap: 6px;
  justify-content: flex-start; /* start from top */
  min-height: 0;
}

/* Column label sitting at the top of every spread-row column. Styled to
   match the table's thead header (same warm-gold colour and uppercase
   typography) so the spread row reads as a normal row, not a free-form
   block. */
.lt-best-col-name{
  padding-bottom: 4px;
  font-size: clamp(8px, 0.85vw, 10px);
  font-family: var(--table-header-font-family);
  font-weight: var(--table-header-font-weight);
  letter-spacing: var(--table-header-letter-spacing);
  text-transform: var(--table-header-text-transform);
  color: rgba(200, 154, 107, 0.96);
  align-self: stretch;
  text-align: inherit;
  display: flex;
  flex-direction: column;
  line-height: 1.05;
  gap: 1px;
}

.lt-best-col-name .th-label{
  color: inherit;
  font: inherit;
  font-weight: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
}

.lt-best-col-name .arb-th-sub{
  color: rgba(200, 154, 107, 0.78);
  font-weight: 500;
  letter-spacing: 0.08em;
  font-size: clamp(7px, 0.7vw, 8.5px);
}

.lt-best-col-title{
  /* Let the title hug its content so LONG/SHORT shifts closer to "SPREAD" */
  flex: 0 0 auto;
  min-width: 0;
  justify-content: flex-start;
}

.lt-best-title-actions{
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.lt-best-tru-link{
  width: clamp(15px, 1.6vw, 20px);
  height: clamp(15px, 1.6vw, 20px);
  border-radius: 8px;
}

.lt-best-tru-link svg{
  width: clamp(10px, 1vw, 13px);
  height: clamp(10px, 1vw, 13px);
}

/* "+ Alert" bell в spread row (.lt-best-title-actions). Стили в CSS, не inline,
   потому что CSP `style-src-attr 'none'` блокирует HTML `style="..."` атрибуты. */
.alert-add-btn{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: clamp(18px, 1.8vw, 22px);
  height: clamp(18px, 1.8vw, 22px);
  border-radius: 8px;
  background: rgba(110, 231, 183, 0.10);
  border: 1px solid rgba(110, 231, 183, 0.35);
  color: #6ee7b7;
  text-decoration: none;
  cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease, transform .12s ease;
  flex: 0 0 auto;
}
.alert-add-btn:hover{
  background: rgba(110, 231, 183, 0.18);
  border-color: rgba(110, 231, 183, 0.55);
}
.alert-add-btn:active{ transform: scale(0.95); }
.alert-add-btn.is-disabled,
.alert-add-btn[aria-disabled="true"] {
  opacity: 0.35;
  cursor: not-allowed;
  background: rgba(180, 180, 180, 0.08);
  border-color: rgba(180, 180, 180, 0.22);
  color: rgba(220, 220, 220, 0.55);
}
.alert-add-btn.is-disabled:hover,
.alert-add-btn[aria-disabled="true"]:hover {
  background: rgba(180, 180, 180, 0.08);
  border-color: rgba(180, 180, 180, 0.22);
  transform: none;
}
.alert-add-btn-ico{
  width: clamp(11px, 1.1vw, 14px);
  height: clamp(11px, 1.1vw, 14px);
  display: block;
}

.lt-best-col-legs{
  flex: 0 0 110px;
  align-items: flex-start;
}

.lt-best-col-book{
  flex: 0 0 auto;
  min-width: 0;
  align-items: flex-end;
  text-align: right;
}

.lt-best-col-entryexit{
  flex: 0 0 auto;
  min-width: 88px;
  align-items: flex-end;
  text-align: right;
}

.lt-best-col-funding{
  /* Right-aligned funding column. Min-width fits 3 short percent values
     (we removed the 4-line APR/Pay alt row, so the wider preset is no
     longer needed). */
  flex: 0 0 auto;
  min-width: 80px;
  align-items: flex-end;
  text-align: right;
  margin-left: 0;
}

.lt-best-col-price{
  /* Fit to content: reduces the perceived gap to FUNDING */
  flex: 0 0 auto;
  min-width: 0;
  align-items: flex-end;
  text-align: right;
}

.lt-best-col-pay{
  /* Keep PAYMENTS + TIME on the SAME row as the spread (no forced newline). */
  flex: 0 0 130px;
  min-width: 120px;
  align-items: flex-start;

  /* Keep payments/time compact: stack LONG/SHORT lines in a column */
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-wrap: nowrap;
}

.lt-best-line{
  display: flex;
  align-items: baseline;
  justify-content: flex-end;
  gap: 6px;
  line-height: 1.1;
}

.lt-best-col-funding .lt-best-line{
  justify-content: flex-end;
}

.lt-best-col-funding .lt-best-line:last-child{
  gap: 4px;
  font-size: clamp(8px, 0.85vw, 10px);
}

.lt-best-k{
  /* Letter styling like UI filter / exchange titles, but uppercase */
  font-size: clamp(8px, 0.9vw, 10.5px);
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.70);
}

.lt-best-subval{
  font-size: clamp(8px, 0.9vw, 10.5px);
  font-weight: 800;
}

.lt-best-payline{
  display: flex;
  /* Payments + countdown should be on ONE line */
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  line-height: 1.1;
  flex-wrap: nowrap;
}

.lt-best-spacer{
  display: none;
}

.lt-best-meta-item{
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-size: clamp(7px, 0.78vw, 9px);
  font-weight: 800;
  white-space: nowrap;
}

.lt-best-meta-txt{
  color: rgba(255, 255, 255, 0.94);
}

.lt-best-meta-ico{
  display: inline-flex;
  width: 13px;
  height: 13px;
  opacity: 0.80;
}

.lt-best-meta-ico svg{
  width: 13px;
  height: 13px;
  display: block;
}

.lt-best-time{
  font-size: clamp(7px, 0.78vw, 9px);
  font-weight: 800;
  color: var(--muted);
}

.lt-best-time .time-ico svg{
  width: 12px;
  height: 12px;
}



/* --- accent coin separators (match the TRU mint split line) --- */
#liveTable tr.lt-coin-head td{
  background:
    linear-gradient(90deg, rgba(110,231,183,0.00) 0%, rgba(110,231,183,0.16) 12%, rgba(110,231,183,0.58) 50%, rgba(110,231,183,0.16) 88%, rgba(110,231,183,0.00) 100%) center / 100% 1px no-repeat,
    transparent;
  border-top: 1px solid rgba(110,231,183,0.16);
  border-bottom: 1px solid rgba(110,231,183,0.12);
  color: rgba(238, 247, 243, 0.96);
  text-shadow: 0 0 10px rgba(110,231,183,0.10);
}

#spotTable tr.lt-coin-head td{
  background: rgba(255,255,255,0.03);
  border-top: 1px solid rgba(255,255,255,0.06);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  color: rgba(238, 247, 243, 0.94);
  text-shadow: none;
}

#liveTable tr.lt-coin-head:hover td{
  outline: none;
  background:
    linear-gradient(90deg, rgba(110,231,183,0.00) 0%, rgba(110,231,183,0.22) 12%, rgba(110,231,183,0.72) 50%, rgba(110,231,183,0.22) 88%, rgba(110,231,183,0.00) 100%) center / 100% 1px no-repeat,
    rgba(110,231,183,0.03);
  box-shadow: inset 0 1px 0 rgba(110,231,183,0.14), inset 0 -1px 0 rgba(110,231,183,0.10);
}

#spotTable tr.lt-coin-head:hover td{
  outline: none;
  background: rgba(255,255,255,0.045);
  box-shadow: none;
}

/* Live header: use the same stacked labels as Arbitrage/TRU for shared columns */
#liveTable thead th.lt-col-book,
#liveTable thead th.lt-col-price,
#liveTable thead th.lt-col-liquidity,
#liveTable thead th.lt-col-funding,
#liveTable thead th.lt-col-pay{
  text-align: right;
}

#liveTable thead th.lt-col-book{ width: var(--lt-col-book); }
#liveTable thead th.lt-col-price{ width: var(--lt-col-price); }
#liveTable thead th.lt-col-liquidity{ width: var(--lt-col-liquidity); }
#liveTable thead th.lt-col-funding{ width: var(--lt-col-funding); }
#liveTable thead th.lt-col-pay{ width: var(--lt-col-pay); }

#liveTable thead th .arb-head-stack{
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  line-height: 1.05;
}

#liveTable thead th .arb-th-sub{
  font-size: clamp(7px, 0.7vw, 8.5px);
  font-weight: 700;
  letter-spacing: 0.04em;
  color: inherit;
  text-transform: uppercase;
}


/* --- Live History merged day columns + liquidity filters --- */

#liveTable col.lt-col-day{
  width: var(--lt-col-day);
}

#liveTable thead th.lt-col-day,
#liveTable tbody td.lt-history-click,
#liveTable tbody td.lt-best-day{
  width: var(--lt-col-day);
  min-width: var(--lt-col-day);
  max-width: var(--lt-col-day);
  padding-left: 6px;
  padding-right: 6px;
}

#liveTable thead th.lt-col-day{
  font-size: inherit;
}

#liveTable td.lt-history-click,
#liveTable td.lt-best-day{
  text-align: left;
}

#liveTable td.lt-history-click,
#liveTable td.lt-best-day{
  cursor: pointer;
}

#liveTable td.lt-history-click:hover,
#liveTable td.lt-best-day:hover{
  background: rgba(30,35,43,0.96);
}

#liveTable thead th.lt-col-day{
  background: rgba(148,163,184,0.06);
  color: rgba(226,232,240,0.82);
}

#liveTable tbody td.lt-history-click,
#liveTable tbody td.lt-best-day{
  color: rgba(226,232,240,0.82);
}

#liveTable tbody td.lt-history-click.arb-pos,
#liveTable tbody td.lt-best-day .arb-pos{
  color: var(--success);
}

#liveTable tbody td.lt-history-click.arb-neg,
#liveTable tbody td.lt-best-day .arb-neg{
  color: var(--danger);
}

#liveTable tbody td.lt-history-click.arb-muted,
#liveTable tbody td.lt-best-day .arb-muted{
  color: rgba(226,232,240,0.64);
}

#liveTable thead th.lt-col-day .th-label,
#liveTable thead th.lt-col-day .lt-sort-arrow{
  color: rgba(226,232,240,0.78);
}

#liveTable tbody tr.lt-row-spot{
  --lt-spot-fill: rgba(110,231,183,0.085);
  --lt-spot-fill-soft: rgba(110,231,183,0.035);
  --lt-spot-strip: rgba(110,231,183,0.62);
}

#liveTable tbody tr.lt-row-spot td:nth-child(-n+2){
  background: var(--lt-spot-fill);
}

#liveTable tbody tr.lt-row-spot td:nth-child(3){
  background: linear-gradient(90deg,var(--lt-spot-fill) 0%,var(--lt-spot-fill-soft) 64%,rgba(13,17,23,0) 100%);
}

#liveTable tbody tr.lt-row-spot td:first-child{
  box-shadow: inset 5px 0 0 var(--lt-spot-strip);
}

#liveTable tbody tr.lt-row-spot td.lt-ex .ex-pill{
  border-color: rgba(110,231,183,0.30);
  background: rgba(110,231,183,0.12);
}

#liveTable tbody tr.lt-row-spot:hover td:nth-child(-n+2){
  background: rgba(148,163,184,0.16);
}

#liveTable tbody tr.lt-row-spot:hover td:nth-child(3){
  background: linear-gradient(90deg,rgba(148,163,184,0.16) 0%,rgba(148,163,184,0.08) 64%,rgba(13,17,23,0) 100%);
}

#liveTable tbody tr[data-lt-market-type="derivatives"]{
  --lt-futures-fill: rgba(200,154,107,0.085);
  --lt-futures-fill-soft: rgba(200,154,107,0.035);
  --lt-futures-fill-line: rgba(200,154,107,0.34);
  --lt-futures-strip: rgba(200,154,107,0.62);
  background:
    linear-gradient(90deg,rgba(13,17,23,0) 0%,rgba(13,17,23,0) calc(100% - 5px),var(--lt-futures-strip) calc(100% - 5px),var(--lt-futures-strip) 100%),
    linear-gradient(270deg,var(--lt-futures-fill) 0%,var(--lt-futures-fill-soft) 24%,rgba(13,17,23,0) 42%);
}

#liveTable tbody tr[data-lt-market-type="derivatives"] td:nth-child(-n+2){
  background: var(--lt-futures-fill);
}

#liveTable tbody tr[data-lt-market-type="derivatives"] td:nth-child(3){
  background: linear-gradient(90deg,var(--lt-futures-fill) 0%,var(--lt-futures-fill-soft) 64%,rgba(13,17,23,0) 100%);
}

#liveTable tbody tr[data-lt-market-type="derivatives"] td:first-child{
  box-shadow: inset 5px 0 0 var(--lt-futures-strip);
}

#liveTable tbody tr[data-lt-market-type="derivatives"]:hover td:nth-child(-n+2){
  background: rgba(148,163,184,0.16);
}

#liveTable tbody tr[data-lt-market-type="derivatives"]:hover td:nth-child(3){
  background: linear-gradient(90deg,rgba(148,163,184,0.16) 0%,rgba(148,163,184,0.08) 64%,rgba(13,17,23,0) 100%);
}

#liveTable tbody tr[data-lt-market-type="derivatives"] td.lt-history-click{
  background: transparent;
}

#liveTable tbody tr[data-lt-market-type="derivatives"]:hover{
  background:
    linear-gradient(90deg,rgba(13,17,23,0) 0%,rgba(13,17,23,0) calc(100% - 5px),var(--lt-futures-strip) calc(100% - 5px),var(--lt-futures-strip) 100%),
    linear-gradient(270deg,rgba(148,163,184,0.16) 0%,rgba(148,163,184,0.08) 24%,rgba(13,17,23,0) 42%);
}

#liveTable tbody tr[data-lt-market-type="derivatives"]:hover td.lt-history-click{
  background: transparent;
}

#liveTable td.lt-liquidity-cell{
  text-align: right;
}

.lt-liquidity-inline{
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 9px;
  width: 100%;
  white-space: nowrap;
}

.lt-liquidity-item{
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.lt-liquidity-k{
  color: #f0b90b;
  font-size: clamp(7px, 0.72vw, 8.5px);
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.lt-transfer-status{
  gap: 3px;
}

.lt-transfer-k,
.lt-transfer-val{
  font-weight: 900;
}

.lt-transfer-k{
  font-size: clamp(7px, 0.7vw, 8.5px);
  letter-spacing: 0.02em;
}

.lt-transfer-status.is-open .lt-transfer-k,
.lt-transfer-val.is-open{
  color: #00d08a;
}

.lt-transfer-status.is-closed .lt-transfer-k,
.lt-transfer-val.is-closed{
  color: #ff4d6d;
}

.lt-transfer-status.is-unknown .lt-transfer-k,
.lt-transfer-val.is-unknown{
  color: var(--muted);
}

#liveTable td.lt-paytime-cell{
  text-align: right;
}

.lt-pay-inline{
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  width: 100%;
  white-space: nowrap;
}

.lt-pay-item{
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.lt-pay-k{
  color: #f0b90b;
  font-size: clamp(7px, 0.72vw, 8.5px);
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.lt-pay-val{
  color: rgba(255, 255, 255, 0.94);
  font-weight: 700;
}

.lt-pay-time{
  color: var(--muted);
}

.lt-pay-time .time-ico{
  opacity: 0.82;
}

.lt-pay-time .time-with-icon,
.lt-paytime-cell .time-with-icon{
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.lt-best-hist-cell{
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  line-height: 1.1;
}

.lt-best-hist-leg{
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 4px;
  border-radius: 7px;
  border: 1px solid rgba(255,255,255,0.10);
  width: fit-content;
  max-width: 100%;
  box-sizing: border-box;
}

.lt-best-hist-leg .arb-pill{
  font-size: clamp(6px, 0.65vw, 7.5px);
  padding: 1px 4px;
  border-radius: 6px;
}

.lt-best-hist-leg-long{
  background: rgba(34,197,94,0.10);
  border-color: rgba(34,197,94,0.26);
}

.lt-best-hist-leg-short{
  background: rgba(239,68,68,0.10);
  border-color: rgba(239,68,68,0.24);
}

.lt-best-hist-spread{
  font-size: clamp(7px, 0.78vw, 9px);
  color: rgba(255,255,255,0.78);
  font-weight: 800;
  margin-top: 2px;
}

.lt-ex-ico-wrap{
  display: inline-flex;
  align-items: center;
}

.lt-ex-ico{
  gap: 0 !important;
}

.lt-ex-ico > span{
  display: none;
}


/* --- Live table v4 refinements: stacked thresholds, right-aligned history, tighter compare charts --- */

#liveListFilterPop .arb-filter-advanced-grid-live-thresholds{
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
}

#liveListFilterPop .arb-filter-advanced-grid-live-thresholds > .arb-filter-field-block{
  padding-top: 12px;
}

#liveListFilterPop .arb-filter-advanced-grid-live-thresholds > .arb-filter-field-block:first-child{
  padding-top: 0;
}

#liveListFilterPop .arb-filter-advanced-grid-live-thresholds > .arb-filter-field-block + .arb-filter-field-block::before{
  top: -8px;
  bottom: auto;
  left: 12px;
  right: 12px;
  width: auto;
  height: 1px;
  background: linear-gradient(90deg, rgba(65,245,240,0.00), rgba(65,245,240,0.34), rgba(65,245,240,0.00));
}

#liveListFilterPop .arb-filter-pane-advanced .arb-filter-presets{
  flex-wrap: wrap;
}

#liveTable td.lt-history-click,
#liveTable td.lt-best-day{
  text-align: right;
}

.lt-best-hist-cell{
  align-items: flex-end;
}

.lt-best-hist-leg{
  margin-left: auto;
}

#liveTable tr.lt-coin-head td,
#spotTable tr.lt-coin-head td{
  background: rgba(148,163,184,0.08);
}

#liveTable tr.lt-coin-head{
  height: 142px;
}

#liveTable tr.lt-coin-head td{
  padding-top: 12px !important;
  padding-bottom: 12px !important;
  line-height: 1.08;
}

#liveTable tr.lt-coin-head td .coin-with-icon{
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  gap: 24px;
  padding: 8px 18px;
  border-radius: 16px;
  background: rgba(148,163,184,0.18);
  font-size: 96px;
  font-weight: 900;
  letter-spacing: 0.03em;
  line-height: 1;
}

#liveTable tr.lt-coin-head td .coin-txt{
  font-size: 96px !important;
  line-height: 0.95;
}

#spotTable tr.lt-coin-head td .coin-with-icon{
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 7px 14px;
  border-radius: 12px;
  background: rgba(148,163,184,0.18);
  font-size: 18px;
  font-weight: 900;
  letter-spacing: 0.03em;
  line-height: 1.05;
}

#liveTable tr.lt-coin-head td .coin-ico-wrap.is-xl,
#liveTable tr.lt-coin-head td .coin-icon.is-xl{
  width: 76px;
  height: 76px;
}

@media (max-width: 820px){
  #liveTable tr.lt-coin-head{
    height: 92px;
  }

  #liveTable tr.lt-coin-head td{
    padding-top: 12px !important;
    padding-bottom: 12px !important;
  }

  #liveTable tr.lt-coin-head td .coin-with-icon{
    gap: 12px;
    padding: 6px 12px;
    border-radius: 14px;
    font-size: 58px;
  }

  #liveTable tr.lt-coin-head td .coin-txt{
    font-size: 58px !important;
  }

  #liveTable tr.lt-coin-head td .coin-ico-wrap.is-xl,
  #liveTable tr.lt-coin-head td .coin-icon.is-xl{
    width: 44px;
    height: 44px;
  }
}

#spotTable tr.lt-coin-head td .coin-icon.is-xl{
  width: 24px;
  height: 24px;
}

