/*
 * The server-trader block.
 *
 * Reads like the alert log on purpose — a timestamped stream of things that happened,
 * newest first — because that is what it is. The one visual difference is that a taken
 * decision is green and a refused one is muted: on a glance from a phone the question is
 * never "what did it think", it is "did it trade".
 */

.trader {
  display: grid;
  align-content: start;
  gap: var(--sp-1);
  padding: var(--sp-2);
  min-block-size: 0;
}

/* The state line carries the whole answer, so it is the only loud thing in the block. */
.trader__state {
  font-weight: var(--fw-bold);
  letter-spacing: 0.04em;
}

.trader__state.is-live {
  color: var(--orange);
}

.trader__state.is-paper {
  color: var(--green);
}

.trader__state.is-off {
  color: var(--ink-faint);
}

.trader__desks {
  display: grid;
  gap: var(--sp-1);
  padding-block: var(--sp-1);
  border-block: var(--border);
}

.trader__desk {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  gap: var(--sp-2);
  align-items: baseline;
  font-size: var(--fs-0);
}

.trader__inst {
  color: var(--ink-strong);
}

.trader__rows {
  display: grid;
  gap: 1px;
  overflow-y: auto;
  min-block-size: 0;
}

.trader__row {
  display: grid;
  grid-template-columns: auto auto auto 1fr;
  gap: var(--sp-2);
  align-items: baseline;
  font-size: var(--fs-0);
  /* Refused decisions are the common case and must not compete with the taken ones. */
  color: var(--ink-muted);
}

.trader__row.is-taken {
  color: var(--green);
}

.trader__time {
  color: var(--ink-faint);
}

.trader__strategy {
  color: var(--ink);
}

.trader__action {
  text-transform: uppercase;
}

/* The venue's refusal. Orange, because it means the desk is not doing what it says. */
.trader__blocked {
  color: var(--orange);
  font-size: var(--fs-0);
}

/*
 * A substitution the loop made for itself. Green rather than orange: nothing is wrong and
 * nothing needs doing — but the desk is trading a pair nobody typed, which is worth a line.
 */
.trader__adopted {
  color: var(--green);
}

/*
 * The breakdown: ring on the left, legend on the right.
 *
 * Two columns rather than a stack, because the ring is only useful next to the labels —
 * an arc nobody can name is decoration.
 */
.trader__split {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--sp-2);
  align-items: center;
  padding-block: var(--sp-1);
  border-block: var(--border);
}

/* Square and modest: this competes with the decision feed for a fixed-height block. */
.trader__donut {
  inline-size: 4.5rem;
  block-size: 4.5rem;
  min-inline-size: 0;
  display: block;
}

.trader__legend {
  display: grid;
  gap: 1px;
  min-inline-size: 0;
}

.trader__slice {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: var(--sp-1);
  align-items: baseline;
  font-size: var(--fs-0);
}

.trader__dot {
  inline-size: 0.5rem;
  block-size: 0.5rem;
  border-radius: 50%;
}

/* Green is taken, orange is a refusal that cost something, muted is a limit doing its job.
   Never a categorical rainbow: on this desk colour already means profit and loss. */
.trader__dot--up { background: var(--green); }
.trader__dot--down { background: var(--orange); }
.trader__dot--muted { background: var(--ink-muted); }

.trader__slice-label { color: var(--ink-muted); }
.trader__slice-pct { color: var(--ink-faint); }
