/* Algorithmic Trading Simulation, the team's monitor page.

   Every piece of the page is a shared one: the shell, the sidebar, the
   frames and the tables are participant-shell.css's, the inputs and the
   buttons components.css's, the hold and the dialog's action row
   participant-primitives.css's. This file has only the page's layout,
   which each participant page sets in its own sheet: the columns of
   frames, copied from the Hedge Fund desk (portfolio-sim.css), and the
   order entry rows, copied from the market making desk (mm-sim.css).
   Copied, never linked. */

/* Two columns of frames on the 1px seams of the Hedge Fund desk
   (portfolio-sim.css .pm-grid and .pm-col-market: the gap and the ground
   under it), the last frame of a column taking what is left of it, as
   the market grid does there. */
#pm-workspace .algo-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  background: var(--bg);
}
#pm-workspace .algo-col {
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
  background: var(--bg);
}
#pm-workspace .algo-col > .pm-frame:last-child { flex: 1 1 auto; }
#pm-workspace .algo-wide { grid-column: 1 / -1; }

/* The order entry: the market making desk's (mm-sim.css .mkm-entry,
   .mkm-entry-lit, .mkm-entry-size, .mkm-entry-side). The rows stack one
   gap apart; a row holds its fields, each label beside its field, and its
   buttons at their own width. Fields take the desk's one price width. The
   rows wrap, as the Hedge Fund ticket's fields do in a narrow frame. */
#pm-workspace .algo-ticket {
  --algo-entry-gap: 8px;
  --algo-field-w: calc(8ch + 18px);
  padding: 10px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: var(--algo-entry-gap);
}
#pm-workspace .algo-entry {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--algo-entry-gap);
}
#pm-workspace .algo-entry-field {
  display: flex;
  align-items: center;
  gap: var(--algo-entry-gap);
  flex: 0 0 auto;
}
#pm-workspace .algo-entry-field .sb-label { margin: 0; white-space: nowrap; }
#pm-workspace .algo-entry-field .sidebar-input,
#pm-workspace .algo-entry-field .sidebar-select { flex: 0 1 var(--algo-field-w); }
#pm-workspace .algo-entry-side {
  display: flex;
  gap: var(--algo-entry-gap);
  min-width: 0;
  flex: 1 1 0;
}
#pm-workspace .algo-entry-side .sidebar-input { flex: 1; min-width: 0; }
#pm-workspace .algo-entry .btn { flex-shrink: 0; }

/* The conformance checks lead with a sentence, not a symbol: the first
   column takes its share, as the Hedge Fund positions table resets the
   shared 84px first column in its own sheet (portfolio-sim.css
   #pm-positions .pm-table th:first-child). */
#pm-workspace #algo-checks .pm-table th:first-child,
#pm-workspace #algo-tune-state .pm-table th:first-child,
#pm-workspace #algo-tune-result .pm-table th:first-child { width: auto; }
#pm-workspace #algo-tune-result .pm-table th:last-child { width: 110px; }
#pm-workspace #algo-tune-state .pm-table th:last-child { width: 60%; }
#pm-workspace #algo-checks .pm-table th:last-child { width: 90px; }
/* The keys' action column holds two buttons side by side. */
#pm-workspace #algo-keys .pm-table th:last-child { width: 220px; }
/* The key shown once takes the key's own length, not the frame's. */
#pm-workspace #algo-key-once .algo-entry-side { flex: 0 1 46ch; }
/* The Strategy page's starter select holds a starter's name, longer than
   the ticket's order types: a width of its own, as the key's row above. */
#pm-workspace #algo-tune-starter-field .sidebar-select { flex: 0 1 18ch; }

/* ── The Reference page ─────────────────────────────────────────────────
   The Hedge Fund Reference page's own rules, copied from portfolio-sim.css
   (the block under "The same reading layout the trainer guide uses"),
   which this page does not link. The layout itself (.ref-mech-layout,
   .ref-toc, .ref-mechanics, .ref-section, .doc-part) is
   participant-shell.css's. The class names are the Hedge Fund page's. */
#pm-workspace.pm-briefing-active .params-sidebar.visible {
  width: 0;
  min-width: 0;
  overflow: hidden;
}
#pm-workspace.pm-briefing-active .sidebar-toggle-btn { display: none; }
#pm-workspace.pm-briefing-active .tab-content-area { padding-top: 48px; }
#pm-workspace .ref-mechanics .data-table-wrap.data-table-wide {
  max-width: none;
  width: 100%;
}
#pm-workspace .ref-toc-group {
  font-size: 0.96rem;
  font-weight: 700;
  color: var(--text-secondary);
  padding: 6px 10px 4px 6px;
  margin-top: 14px;
}
#pm-workspace .ref-toc-group:first-child { margin-top: 0; padding-top: 2px; }
#pm-workspace .doc-param { padding: 14px 0; border-top: 1px solid var(--border); }
#pm-workspace .doc-param-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
#pm-workspace .doc-param-name { font-weight: 600; color: var(--text); }
#pm-workspace .doc-param-body { margin-top: 6px; }
#pm-workspace .doc-param-body p {
  margin: 0 0 8px;
  color: var(--text-secondary);
}
#pm-workspace .doc-param-body p:last-child { margin-bottom: 0; }
/* A command's copy row takes the width of the key's copy row on the
   Monitor page (#algo-key-once above), not the column's. */
#pm-workspace .algo-copy-row { margin: 0 0 8px; }
#pm-workspace .algo-copy-row .algo-entry-side { flex: 0 1 46ch; }

/* ── The Session overview window ────────────────────────────────────────
   The Hedge Fund window's rules, copied from portfolio-sim.css (the block
   "Session overview dialog"), which this page does not link. The title,
   the subtitle, the footer, the section heads and the two columns are
   participant-shell.css's. The dialog mounts on <body>, outside
   #pm-workspace, so these rules are not scoped to the workspace. */
.iro-dialog.pm-overview {
  width: min(1100px, 94vw);
  height: 85vh;
  max-height: none;
  border: 0;
  border-radius: 0;
}
.pm-overview .iro-dialog-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: end;
  gap: 0 32px;
  padding: 22px 28px 0;
  border-bottom: 1px solid var(--border);
}
.pm-ov-heading {
  min-width: 0;
  padding-bottom: 14px;
}
.pm-ov-eyebrow {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}
.pm-overview .pm-ov-nav {
  margin: 0;
  border-bottom: 0;
  flex-wrap: nowrap;
}
.pm-overview .iro-dialog-close {
  align-self: start;
  margin-top: -6px;
}
.pm-overview .iro-dialog-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 20px 28px 24px;
}
.pm-overview .num {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}
.pm-ov-rows {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content;
  column-gap: 24px;
  margin-bottom: 16px;
}
.pm-ov-row { display: contents; }
.pm-ov-row > * {
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.95rem;
}
.pm-ov-label { color: var(--text-muted); }
.pm-ov-value {
  color: var(--text);
  font-weight: 600;
  text-align: right;
}
.pm-backdrop-body .data-table-wrap {
  border: 0;
  border-radius: 0;
  margin-bottom: 12px;
}

/* A code example on the Reference page: the guide's code block of the Code
   page every sim shares (code-page.css .code-guide-code), copied because
   that sheet loads only with the Code page. */
#pm-workspace .code-guide-code {
  margin: 0 0 12px;
  padding: 14px 16px;
  background: var(--bg-input);
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
  color: var(--text);
  white-space: pre-wrap;
}
/* The tuned starter's numbers line up under one another: the labels share
   one column, as the market making order entry's labels do (mm-sim.css
   .mkm-entry-size > .sb-label, min-width). */
#pm-workspace #algo-tune .algo-entry-field > .sb-label { min-width: 260px; }
