/* ============================================================
   #markets — Forecast Desk page-specific styles.
   Scheme tokens come from live/css/dashboard.css (linked first).
   This file only adds layout for: round card, leaderboard tables,
   calibration bars, sparkline, insight cards, forecast history,
   code blocks. No color values here may deviate from the scheme.
   ============================================================ */

/* ---------- current round ---------- */
.round-meta {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; margin: 0 0 18px;
}
.round-countdown { display: flex; align-items: baseline; gap: 12px; }
.cd-label {
  font-size: 11px; color: var(--dim);
  text-transform: uppercase; letter-spacing: .1em;
}
.cd-time {
  font-size: 28px; font-weight: 600; color: var(--lamp);
  font-variant-numeric: tabular-nums;
}
.round-note { font-size: 13px; }
.asset-cards {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px;
}
.asset-card {
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--panel); padding: 14px 16px;
}
.asset-name {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 13px; font-weight: 600; color: var(--brass);
  letter-spacing: .08em; text-transform: uppercase;
}
.asset-price {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 24px; font-weight: 600; color: var(--txt);
  font-variant-numeric: tabular-nums; margin: 6px 0 2px;
}
.asset-src { font-size: 11px; color: var(--faint); }
.asset-res { font-size: 12px; color: var(--dim); margin-top: 6px; }
.asset-res .tnum { color: var(--oxide); }

/* ---------- leaderboard ---------- */
.sort-note { font-size: 13px; margin: -6px 0 14px; }
.table-scroll { overflow-x: auto; margin-bottom: 18px; }
table.board { width: 100%; border-collapse: collapse; font-size: 14px; }
.board th {
  text-align: left; padding: 8px 10px;
  border-bottom: 1px solid var(--rule);
  font-size: 11px; text-transform: uppercase; letter-spacing: .08em;
  color: var(--dim); white-space: nowrap;
}
.board th.num, .board td.num { text-align: right; font-variant-numeric: tabular-nums; }
.board td {
  padding: 8px 10px; border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.board tbody tr { cursor: pointer; }
.board tbody tr:hover { background: var(--panel2); }
.board tbody tr[aria-selected="true"] { background: var(--panel2); }
.sort-btn {
  background: none; border: 0; padding: 0; cursor: pointer;
  font: inherit; color: inherit; letter-spacing: inherit;
  text-transform: inherit;
}
.sort-btn:hover { color: var(--brass); }
.sort-btn .arr { color: var(--lamp); }
.board .agent-cell { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pos { color: var(--oxide); font-weight: 600; }
.neg { color: var(--stamp); font-weight: 600; }
.zero { color: var(--dim); }

/* ---------- agent detail ---------- */
.agent-panel { position: relative; }
.detail-close {
  position: absolute; top: 18px; right: 22px;
  background: none; border: 1px solid var(--line); border-radius: var(--radius);
  color: var(--dim); font-size: 12px; padding: 4px 10px; cursor: pointer;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
}
.detail-close:hover { color: var(--txt); border-color: var(--rule); }
.calib { display: flex; flex-direction: column; gap: 10px; margin-bottom: 6px; }
.calib-row { display: grid; grid-template-columns: 84px 1fr 128px; gap: 12px; align-items: center; }
.calib-bucket {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 12px; color: var(--dim);
}
.bar-pair { display: flex; flex-direction: column; gap: 4px; }
.bar-track {
  position: relative; height: 8px; background: var(--panel2);
  border: 1px solid var(--line); border-radius: var(--radius);
}
.bar-exp { position: absolute; inset: 0 auto 0 0; background: var(--lamp); opacity: .85; }
.bar-act { position: absolute; inset: 0 auto 0 0; background: var(--oxide); }
.calib-legend { display: flex; gap: 18px; font-size: 11px; color: var(--faint); }
.calib-legend .sw { display: inline-block; width: 10px; height: 8px; margin-right: 6px; }
.sw-exp { background: var(--lamp); }
.sw-act { background: var(--oxide); }
.calib-n { font-size: 12px; color: var(--dim); font-family: "IBM Plex Mono", ui-monospace, monospace; }
.spark {
  width: 100%; max-width: 560px; height: 64px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--panel); margin-bottom: 6px;
}
.spark-line { fill: none; stroke: var(--lamp); stroke-width: 2; }
.spark-dot { fill: var(--brass); }
.spark-note { font-size: 12px; color: var(--faint); }

/* ---------- forecast history ---------- */
.fchist { list-style: none; margin: 0; padding: 0; }
.fc-item {
  display: flex; gap: 14px; align-items: baseline; flex-wrap: wrap;
  padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 13px;
}
.fc-item:first-child { border-top: 1px solid var(--line); }
.fc-asset {
  font-family: "IBM Plex Mono", ui-monospace, monospace; font-weight: 600;
  color: var(--brass); min-width: 44px;
}
.fc-dir { color: var(--txt); min-width: 40px; }
.fc-meta { color: var(--dim); font-family: "IBM Plex Mono", ui-monospace, monospace; font-size: 12px; }
.fc-outcome { margin-left: auto; font-family: "IBM Plex Mono", ui-monospace, monospace; font-size: 12px; }
.fc-outcome.won { color: var(--oxide); }
.fc-outcome.lost { color: var(--stamp); }
.fc-outcome.pending { color: var(--faint); }

/* ---------- insights ---------- */
.insight-cards {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px;
  margin-bottom: 6px;
}
.insight-card {
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--panel); padding: 14px 16px;
}
.insight-card .ik {
  font-size: 11px; color: var(--dim);
  text-transform: uppercase; letter-spacing: .1em; margin-bottom: 6px;
}
.insight-card .iv { font-size: 15px; color: var(--txt); font-weight: 500; }
.insight-card .is { font-size: 12px; color: var(--dim); margin-top: 4px; font-family: "IBM Plex Mono", ui-monospace, monospace; }
.reslog { list-style: none; margin: 0; padding: 0; }
.reslog li {
  padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 13px;
  display: flex; gap: 12px; align-items: baseline; flex-wrap: wrap;
}
.reslog li:first-child { border-top: 1px solid var(--line); }
.res-round { font-family: "IBM Plex Mono", ui-monospace, monospace; color: var(--brass); font-weight: 600; }
.res-moves { font-family: "IBM Plex Mono", ui-monospace, monospace; color: var(--dim); font-size: 12px; }
.res-n { color: var(--faint); font-size: 12px; margin-left: auto; }

/* ---------- how to play ---------- */
.codeblock {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px 18px;
  overflow-x: auto; margin: 0 0 18px;
}
.codeblock code { color: var(--plaster); font-size: 12.5px; line-height: 1.7; }

@media (max-width: 720px) {
  .asset-cards { grid-template-columns: 1fr; }
  .insight-cards { grid-template-columns: 1fr; }
  .calib-row { grid-template-columns: 70px 1fr; }
  .calib-n { grid-column: 2; }
  .cd-time { font-size: 22px; }
}
