/* VC Tools — arbitrage table trading terminal */

.tbl-wrap {
  border-radius: var(--vc-radius-md);
  border: 1px solid var(--vc-border);
  box-shadow: var(--vc-shadow-md);
  overflow-x: hidden;
  overflow-y: auto;
  max-height: calc(100vh - var(--nav-h) - 120px);
}

.tbl-wrap table {
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
  max-width: 100%;
  table-layout: fixed;
}

.tbl-wrap thead th {
  position: sticky;
  top: 0;
  z-index: 12;
  background: color-mix(in srgb, var(--vc-elevated) 88%, transparent);
  backdrop-filter: blur(14px) saturate(1.3);
  -webkit-backdrop-filter: blur(14px) saturate(1.3);
  border-bottom: 1px solid var(--vc-border-hover);
  box-shadow: 0 1px 0 var(--vc-border), 0 4px 16px rgba(0, 0, 0, 0.2);
  font-family: var(--font-display);
  letter-spacing: 0.08em;
}

.tbl-wrap thead th.sorted {
  color: var(--vc-cta-text);
  box-shadow: inset 0 -2px 0 var(--vc-cta);
}

/* ── Rows ──────────────────────────────── */
tbody tr.data-row {
  transition: transform 0.32s cubic-bezier(0.22, 1, 0.36, 1),
    background 0.2s, box-shadow 0.2s, border-color 0.2s;
  border-left: 2px solid transparent;
}

tbody tr.data-row.vc-flip {
  transition: transform 0.38s cubic-bezier(0.22, 1, 0.36, 1);
}

tbody tr.data-row:hover {
  transform: translateY(-1px);
  background: var(--hover-surface);
  box-shadow: inset 2px 0 0 var(--vc-cta), 0 4px 20px var(--vc-cta-bg);
  border-left-color: var(--vc-cta);
}

tbody tr.data-row.open {
  background: var(--vc-cta-bg);
  border-left-color: var(--vc-cta);
}

/* ── Skin cell — simple, без точек активности и рамок редкости ── */
.skin-cell {
  gap: 8px;
}

.skin-img-wrap {
  display: none;
}

.skin-meta-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}

/* ── Prices ────────────────────────────── */
.vc-price-cell {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 6px;
  transition: background 0.4s ease, color 0.2s;
}

.vc-price-dir {
  font-size: 9px;
  line-height: 1;
  opacity: 0.9;
}

.vc-price-dir.up { color: var(--vc-profit); }
.vc-price-dir.down { color: var(--vc-loss); }

.vc-price-cell.flash-up {
  animation: vc-flash-up 0.4s ease;
}

.vc-price-cell.flash-down {
  animation: vc-flash-down 0.4s ease;
}

@keyframes vc-flash-up {
  0% { background: rgba(18, 209, 142, 0.35); }
  100% { background: transparent; }
}

@keyframes vc-flash-down {
  0% { background: rgba(255, 77, 109, 0.35); }
  100% { background: transparent; }
}

td.price .vc-price-cell,
td.td-price {
  font-family: var(--font-mono);
}

/* ── Profit column ─────────────────────── */
td.td-profit {
  min-width: 96px;
}

.vc-profit-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 2px 4px;
}

.vc-profit-cell.empty {
  color: var(--muted);
}

.vc-profit-bar {
  width: 100%;
  max-width: 88px;
  height: 4px;
  border-radius: 99px;
  background: var(--inset-surface);
  overflow: hidden;
}

.vc-profit-bar span {
  display: block;
  height: 100%;
  border-radius: 99px;
  transition: width 0.35s ease;
}

.vc-profit-cell.pos .vc-profit-bar span {
  background: linear-gradient(90deg, var(--vc-profit), #5ae8b0);
  box-shadow: 0 0 8px var(--vc-profit-glow);
}

.vc-profit-cell.neg .vc-profit-bar span {
  background: linear-gradient(90deg, var(--vc-loss), #ff7a92);
}

.vc-profit-num {
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.vc-profit-cell.pos .vc-profit-num { color: var(--vc-profit); }
.vc-profit-cell.neg .vc-profit-num { color: var(--vc-loss); }

.vc-profit-usd {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* ── Score ring ────────────────────────── */
.vc-score-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 52px;
}

.vc-score-lbl {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--vc-text-muted);
  text-align: center;
  line-height: 1.2;
  max-width: 72px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.vc-score-ring-wrap,
.vc-score-cell .vc-score-ring {
  display: flex;
  align-items: center;
  justify-content: center;
}

.vc-score-ring .vc-ring-num {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  fill: var(--vc-text);
}

.vc-score-ring circle.vc-ring-progress {
  transition: stroke-dashoffset 0.75s cubic-bezier(0.22, 1, 0.36, 1);
}

@media (prefers-reduced-motion: reduce) {
  .vc-score-ring circle.vc-ring-progress {
    transition: none;
  }
}

html[data-motion="simple"] .vc-score-ring circle.vc-ring-progress {
  transition: none;
}

/* ── Sparkline ─────────────────────────── */
.vc-spark {
  display: block;
  opacity: 0.85;
}

.vc-spark-empty {
  display: inline-block;
  width: 56px;
  height: 2px;
  background: var(--vc-border);
  border-radius: 1px;
  opacity: 0.5;
}

/* ── Updated column ────────────────────── */
.vc-upd-cell {
  font-family: var(--font-mono);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  transition: opacity 0.3s, color 0.3s;
}

.vc-upd-cell.stale-fresh { color: var(--vc-profit); opacity: 1; }
.vc-upd-cell.stale-warm { color: var(--vc-text-muted); opacity: 0.9; }
.vc-upd-cell.stale-old { color: var(--vc-text-muted); opacity: 0.82; }
.vc-upd-cell.stale-dead { color: var(--vc-text-muted); opacity: 0.65; }
.vc-upd-cell.stale-unknown { color: var(--vc-text-muted); opacity: 0.7; }

.vc-upd-cell .upd-exact {
  font-size: 9px;
  margin-top: 2px;
  opacity: 0.7;
}

/* ── Price stack (price + sparkline) ───── */
.vc-price-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: auto;
  gap: 0;
}

/* Delivery-time badge (CS.Money/TradeOn): instant (green) vs delayed/trade-lock (amber) */
.vc-delivery-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-top: 3px;
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 600;
  line-height: 1.5;
  white-space: nowrap;
}
.vc-delivery-badge .vc-ic {
  width: 11px; height: 11px;
  min-width: 11px; min-height: 11px;
  stroke: currentColor;
  fill: none;
  vertical-align: -1.5px;
}
.vc-delivery-badge.instant {
  color: var(--green, #2ecc71);
  background: rgba(46, 204, 113, 0.12);
}
.vc-delivery-badge.delay {
  color: var(--vc-gold);
  background: rgba(243, 156, 18, 0.12);
}

html[data-motion="simple"] tbody tr.data-row:hover {
  transform: none;
}

html[data-motion="simple"] .vc-tier-dot.tier-hot {
  animation: none;
}

/* ── Light theme overrides ───────────── */
body.light .tbl-wrap {
  border-color: var(--vc-border);
  box-shadow: var(--vc-shadow-sm);
  background: var(--vc-surface);
}

body.light .tbl-wrap thead th {
  background: color-mix(in srgb, var(--vc-elevated) 92%, #fff);
  color: var(--vc-text-muted);
  border-bottom-color: var(--vc-border-hover);
  box-shadow: 0 1px 0 var(--vc-border), 0 2px 8px rgba(17, 24, 39, 0.06);
}

body.light .tbl-wrap thead th.sorted {
  color: var(--vc-cta-text);
}

body.light tbody tr.data-row:hover {
  background: var(--hover-surface);
  box-shadow: inset 2px 0 0 var(--vc-cta), 0 2px 12px rgba(17, 24, 39, 0.06);
}

body.light tbody tr.data-row.open {
  background: var(--vc-cta-bg);
}

body.light .skin-img-wrap .skin-img {
  background: var(--vc-elevated);
}

body.light .vc-tier-dot {
  border-color: var(--vc-surface);
}

body.light .vc-price-cell.flash-up {
  animation-name: vc-flash-up-light;
}

body.light .vc-price-cell.flash-down {
  animation-name: vc-flash-down-light;
}

@keyframes vc-flash-up-light {
  0% { background: rgba(13, 159, 110, 0.22); }
  100% { background: transparent; }
}

@keyframes vc-flash-down-light {
  0% { background: rgba(225, 29, 72, 0.16); }
  100% { background: transparent; }
}

body.light .vc-profit-bar {
  background: var(--inset-surface);
}

body.light .vc-profit-usd,
body.light .vc-profit-cell.empty {
  color: var(--vc-text-muted);
}

body.light .vc-score-ring .vc-ring-num {
  fill: var(--vc-text);
}

body.light .vc-score-ring .vc-ring-track {
  stroke: var(--vc-border-hover);
}

body.light .vc-spark-empty {
  background: var(--vc-border-hover);
}

body.light .vc-upd-cell.stale-fresh {
  color: var(--vc-profit);
}

body.light .vc-upd-cell.stale-warm,
body.light .vc-upd-cell.stale-old,
body.light .vc-upd-cell.stale-dead,
body.light .vc-upd-cell.stale-unknown {
  color: var(--vc-text-muted);
}

body.light .vc-upd-cell.stale-unknown {
  color: var(--vc-text-muted);
}

body.light .vc-score-lbl {
  color: var(--vc-text-muted);
}

body.light .vc-price-stack .vc-price-cell {
  color: var(--vc-text);
}

body.light tbody tr.data-row {
  background: var(--vc-surface);
}

body.light tbody tr.data-row:nth-child(even) {
  background: color-mix(in srgb, var(--vc-elevated) 40%, var(--vc-surface));
}

body.light .left-panel,
body.light .vc-filters-acc,
body.light .vc-acc-head {
  background: var(--card);
}

body.light .vc-acc-head:hover {
  background: var(--hover-surface);
}

body.light .filterbar,
body.light .filter-panel {
  background: var(--card);
  border-color: var(--border);
}

body.light #settingsOverlay .modal.wide {
  background: var(--card);
  border-color: var(--border);
  box-shadow: 0 24px 64px rgba(17, 24, 39, 0.12);
}

body.light .vc-hotkeys-list {
  color: var(--text2);
}

body.light .vc-hotkeys-list kbd {
  background: var(--inset-surface);
  border-color: var(--border);
  color: var(--text);
}

/* Detail panel + price chart (light) */
body.light .detail-panel .stat-box,
body.light .vc-pchart-root {
  background: var(--card);
  border-color: var(--border);
}

body.light .vc-pchart-tooltip {
  background: var(--card);
  border-color: var(--border);
  color: var(--text2);
  box-shadow: var(--shadow);
}

body.light .vc-pchart-tt-row span {
  color: var(--muted);
}

body.light .vc-pchart-sparse-card {
  background: var(--card2);
  border-color: var(--border);
}
