/* /demos/fix-lab page chrome (PF-S445).
 *
 * Loaded only by this page, through Tags.PageCSS; the ?v= in PageCSSHref is the
 * whole cache-busting story. Colors come from the shared sheet's custom
 * properties (--ink, --ink-muted, --hairline, --surface, --surface-alt,
 * --accent), so this page follows the system preference and the theme toggle
 * without a palette of its own. The state colors are the one exception,
 * declared with the same three-way discipline websocket-lab.css uses.
 */

.fx-stage {
  --fx-ok: #1a7f37;
  --fx-bad: #b42318;
  --fx-warn: #9a6700;
  margin: 1.5rem 0 2.5rem;
}

@media (prefers-color-scheme: dark) {
  .fx-stage {
    --fx-ok: #3fb950;
    --fx-bad: #f85149;
    --fx-warn: #d29922;
  }
}

[data-theme="dark"] .fx-stage {
  --fx-ok: #3fb950;
  --fx-bad: #f85149;
  --fx-warn: #d29922;
}

[data-theme="light"] .fx-stage {
  --fx-ok: #1a7f37;
  --fx-bad: #b42318;
  --fx-warn: #9a6700;
}

.fx-fictional {
  color: var(--ink-muted);
  font-size: 0.95rem;
}

.fx-status {
  margin: 0 0 1rem;
  padding: 0.75rem 1rem;
  border-left: 4px solid var(--accent);
  border-radius: 0 6px 6px 0;
  background: var(--surface-alt);
  overflow-wrap: anywhere;
}

.fx-status[data-state="on"] {
  border-left-color: var(--fx-ok);
}

.fx-status[data-state="ended"],
.fx-status[data-state="down"] {
  border-left-color: var(--fx-bad);
}

.fx-note {
  min-height: 1.5em;
  overflow-wrap: anywhere;
}

.fx-note[data-kind="err"] {
  color: var(--fx-bad);
}

.fx-stage section {
  margin: 1.5rem 0;
  padding: 1rem;
  border: 1px solid var(--hairline);
  border-radius: 8px;
  background: var(--surface);
}

.fx-stage h2 {
  font-size: 1.15rem;
  margin: 0 0 0.75rem;
}

.fx-stage .btn {
  margin: 0.25rem 0.5rem 0.25rem 0;
}

.fx-stage caption,
.fx-bench-table caption {
  caption-side: top;
  color: var(--ink-muted);
  font-size: 0.9rem;
}

/* The row labels name both engines ("The exchange (QuickFIX/Go acceptor)");
   at 380px they would get 128px. The table scrolls inside .fx-scroll, so the
   labels keep a readable width and the numbers scroll instead. */
.fx-seq th[scope="row"] {
  min-width: 10rem;
}

.fx-seq td,
.fx-book td,
.fx-orders td,
.fx-fills td,
.fx-bench-table td {
  font-variant-numeric: tabular-nums;
}

.fx-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  align-items: flex-end;
}

.fx-form label {
  display: flex;
  flex-direction: column;
  font-weight: 600;
}

.fx-form input,
.fx-form select {
  max-width: 10rem;
}

.fx-side {
  display: flex;
  gap: 0.75rem;
  margin: 0;
}

.fx-side legend {
  font-size: 1rem;
  font-weight: 600;
  margin: 0;
  width: 100%;
}

.fx-side label {
  flex-direction: row;
  gap: 0.25rem;
  font-weight: normal;
}

.fx-instruments {
  margin-top: 0.75rem;
  color: var(--ink-muted);
  font-size: 0.9rem;
}

.fx-book-grid {
  display: grid;
  /* min() so a book never asks for more than the column it is in: at 292px
     the content box is narrower than 16rem. */
  grid-template-columns: repeat(auto-fit, minmax(min(16rem, 100%), 1fr));
  gap: 1rem;
}

.fx-bid {
  color: var(--fx-ok);
}

.fx-ask {
  color: var(--fx-bad);
}

.fx-log {
  list-style: none;
  padding: 0;
  margin: 0;
  max-height: 32rem;
  overflow-y: auto;
}

.fx-frame {
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--hairline);
}

.fx-frame[data-dropped="true"] {
  border-left: 4px solid var(--fx-bad);
  padding-left: 0.5rem;
}

.fx-frame[data-type="2"],
.fx-frame[data-type="4"],
.fx-frame[data-type="1"] {
  border-left: 4px solid var(--fx-warn);
  padding-left: 0.5rem;
}

.fx-frame__head {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.75rem;
  align-items: baseline;
}

.fx-frame__head time,
.fx-dir,
.fx-seqno {
  color: var(--ink-muted);
  font-size: 0.85rem;
}

.fx-badge {
  font-size: 0.8rem;
  padding: 0 0.4rem;
  border-radius: 4px;
  border: 1px solid currentcolor;
}

.fx-badge--drop {
  color: var(--fx-bad);
}

.fx-badge--dup {
  color: var(--fx-warn);
}

.fx-pipe {
  display: block;
  margin: 0.25rem 0;
  font-size: 0.8rem;
  overflow-wrap: anywhere;
  word-break: break-all;
}

.fx-fields {
  font-size: 0.85rem;
  margin: 0.25rem 0 0;
}

.fx-fields th {
  font-weight: 600;
}

.fx-fields td,
.fx-fields th {
  overflow-wrap: anywhere;
}

/* The benchmark notes name engine functions (stateMachine.SendAppMessages)
   that are wider than a phone; let them break rather than widen the page. */
.fx-bench {
  overflow-wrap: anywhere;
}

.fx-cap-note {
  color: var(--ink-muted);
  font-size: 0.9rem;
}

/* Wide tables scroll inside their own box rather than pushing the page
   sideways on a phone. Each is a keyboard-reachable region (tabindex, role,
   label in the markup), so a focused one shows the shared anchor ring. */
.fx-scroll {
  overflow-x: auto;
  max-width: 100%;
}

.fx-scroll:focus-visible {
  outline: 3px solid var(--focus-ring-anchor);
  outline-offset: 1px;
}

.fx-bench-table,
.fx-orders,
.fx-fills {
  white-space: nowrap;
}

@media (max-width: 767.98px) {
  .fx-stage section {
    padding: 0.75rem;
  }

  .fx-form input,
  .fx-form select {
    max-width: 100%;
  }
}
