/* style.css — pacman-dashboard login page
 *
 * Dark, high-contrast, single-column-on-mobile look matching Kraken's
 * own web/app palette (near-black background, violet accent) rather
 * than a generic admin-panel theme, per the original design brief.
 * iPhone-first: no hover-dependent affordances, big tap targets,
 * safe-area padding for the notch/home-indicator.
 */

:root {
  --bg: #0b0d10;
  --panel: #14171c;
  --panel-border: #262b33;
  --text: #e8eaed;
  --text-dim: #8a92a3;
  --accent: #7b61ff;
  --accent-dim: #5c46d1;
  --danger: #ff5c5c;
  --success: #3ddc97;
  /* Armed is its own colour, NOT --danger: that red means "error" on this
     page, and a correctly-armed strategy is live, not faulty. Hotter and
     more saturated than the error red so the two never blur together. */
  --armed: #ff2d4a;
  --armed-deep: #d81b35;
  --armed-glow: rgba(255, 45, 74, 0.28);
}

* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
  margin: 0;
}

body {
  background:
    radial-gradient(680px 420px at 50% -8%, rgba(123, 97, 255, 0.16), transparent 65%),
    var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  min-height: 100vh;
}

.card {
  width: 100%;
  max-width: 380px;
  margin: 24px;
  padding: 32px 24px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  box-shadow: 0 24px 60px -24px rgba(0, 0, 0, 0.6);
}

.logo {
  font-size: 15px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
  text-align: center;
  margin: 0 0 4px;
}

h1 {
  font-size: 22px;
  font-weight: 600;
  text-align: center;
  margin: 0 0 28px;
}

.btn {
  width: 100%;
  padding: 16px;
  border-radius: 12px;
  border: none;
  font-size: 17px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  -webkit-tap-highlight-color: transparent;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:active {
  background: var(--accent-dim);
}

.btn-primary:disabled {
  background: var(--panel-border);
  color: var(--text-dim);
  cursor: default;
}

.btn-secondary {
  margin-top: 10px;
  background: transparent;
  border: 1px solid var(--panel-border);
  color: var(--text-dim);
}
.btn-secondary:active {
  background: var(--panel);
  border-color: var(--text-dim);
}

.status {
  margin-top: 18px;
  text-align: center;
  font-size: 14px;
  color: var(--text-dim);
  min-height: 20px;
}

.status.error {
  color: var(--danger);
}

.status.success {
  color: var(--success);
}

.faceid-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

/* ---------------------------------------------------------------
 * dashboard.html — task #38. Same dark/violet Kraken-inspired
 * palette as the login card above (shared :root tokens), extended
 * with a monospace numeric style for prices/volumes (matching
 * Kraken's own ladder UI) and per-strategy accent dots.
 * --------------------------------------------------------------- */

.dash-body {
  display: block;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

.dash-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  padding-top: calc(14px + env(safe-area-inset-top));
  background: rgba(11, 13, 16, 0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--panel-border);
}

.dash-header .logo {
  margin: 0;
  text-align: left;
  letter-spacing: 0.06em;
}
.dash-header .logo::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 7px;
  border-radius: 2px;
  background: var(--accent);
  vertical-align: middle;
}

.dash-header-right {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text-dim);
}

.dash-header-divider {
  width: 1px;
  height: 16px;
  background: var(--panel-border);
}

.dash-header-status {
  font-variant-numeric: tabular-nums;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.dot-ok { background: var(--success); }
.dot-error { background: var(--danger); }
.dot-dim { background: var(--text-dim); }

.dash-main {
  max-width: 640px;
  margin: 0 auto;
  padding: 16px;
  padding-bottom: calc(32px + env(safe-area-inset-bottom));
}

.empty-state {
  color: var(--text-dim);
  font-size: 14px;
  text-align: center;
  margin-top: 40px;
  line-height: 1.6;
}
.empty-state code {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 13px;
}

.strategies {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 24px;
}

.strategy-card {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  padding: 14px 16px;
}

.strategy-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.color-swatch {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex-shrink: 0;
}

.strategy-name {
  font-weight: 600;
  font-size: 15px;
}

.strategy-host {
  margin-left: auto;
  font-size: 12px;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}

.strategy-pending {
  margin: 8px 0 0;
  font-size: 13px;
  color: var(--text-dim);
}

.strategy-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin-top: 10px;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  color: var(--text-dim);
}
.strategy-stats .pos-long { color: var(--success); }
.strategy-stats .pos-short { color: var(--danger); }
/* "no order data reported yet" is not the same claim as "0 orders sent" --
   kept visually quieter than a real count so the two are never confused. */
.strategy-orders.orders-empty { opacity: 0.55; font-style: italic; }
.pnl-up { color: var(--success); }
.pnl-down { color: var(--danger); }

.attempts {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--panel-border);
}
.attempts-title {
  margin: 0 0 6px;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.attempt-row {
  display: grid;
  grid-template-columns: 44px 1fr 1fr 56px;
  gap: 8px;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  padding: 3px 0;
}
.side-buy { color: var(--success); font-weight: 600; }
.side-sell { color: var(--danger); font-weight: 600; }
.traded-yes { color: var(--success); }
.traded-no { color: var(--text-dim); }

.instruments {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.tob-grid {
  display: grid;
  grid-template-columns: auto auto 1fr 1fr auto;
  gap: 4px 18px;
  align-items: baseline;
}
.tob-head {
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.tob-instrument { font-weight: 600; }
.tob-name { color: var(--text-dim); font-size: 0.82rem; }
.tob-bid, .tob-ask, .tob-spread {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.tob-bid { color: var(--success); }
.tob-ask { color: var(--danger); }
.tob-spread { color: var(--text-dim); }

.book-panel {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  padding: 14px 16px;
}

.book-title {
  margin: 0 0 10px;
  font-weight: 600;
  font-size: 15px;
}

.book-table {
  display: flex;
  flex-direction: column;
}

.book-side {
  display: flex;
  flex-direction: column;
}

.book-row {
  display: grid;
  grid-template-columns: auto 1fr 1fr;
  align-items: center;
  gap: 10px;
  padding: 3px 0;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.book-spread-row {
  display: flex;
  justify-content: center;
  padding: 6px 0;
  margin: 2px 0;
  border-top: 1px dashed var(--panel-border);
  border-bottom: 1px dashed var(--panel-border);
  font-size: 11px;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

.book-side-ask .book-price { color: var(--danger); }
.book-side-bid .book-price { color: var(--success); }
.book-price { font-weight: 600; text-align: left; }
.book-volume { color: var(--text-dim); text-align: right; }

.resting-dots {
  display: flex;
  gap: 3px;
  min-width: 10px;
}
.resting-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ---- task #136: aggregate PnL, agent cards, on/off switch ---- */

.pnl-bar {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--panel-border);
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  overflow: hidden;
  margin-bottom: 16px;
}
.pnl-cell {
  background: var(--panel);
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: center;
}
.pnl-label {
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.pnl-value {
  font-size: 18px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.pnl-up { color: var(--success); }
.pnl-down { color: var(--danger); }

.pnl-cell-total .pnl-label {
  display: flex;
  align-items: center;
  gap: 5px;
}
.pnl-reset-btn {
  padding: 1px 6px;
  border-radius: 6px;
  border: 1px solid var(--panel-border);
  background: transparent;
  color: var(--text-dim);
  font-size: 10px;
  letter-spacing: normal;
  text-transform: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.pnl-reset-btn:active { background: var(--panel-border); }
.pnl-reset-btn:disabled { cursor: default; opacity: 0.6; }

.agent-venue {
  font-size: 12px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.card-offline { opacity: 0.6; }

.strategy-controls {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Big enough to hit with a thumb without aiming — this is the control that
   stops a strategy trading, so it must never need a precise tap. */
.toggle {
  width: 52px;
  height: 32px;
  flex-shrink: 0;
  border-radius: 16px;
  border: 1px solid var(--panel-border);
  background: #22262e;
  padding: 3px;
  display: flex;
  align-items: center;
  cursor: pointer;
  transition: background 140ms ease;
  -webkit-tap-highlight-color: transparent;
}
.toggle-knob {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--text-dim);
  transition: transform 140ms ease, background 140ms ease;
}
.toggle-on { background: var(--accent-dim); border-color: var(--accent); }
.toggle-on .toggle-knob { transform: translateX(20px); background: #fff; }
.toggle:disabled { cursor: default; }
/* Still queued for the box: the operator's intent is recorded, the strategy
   has not necessarily seen it yet. */
.toggle-pending .toggle-knob { animation: toggle-pulse 900ms ease-in-out infinite; }
@keyframes toggle-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

/* The header's master autopilot switch -- same on/off visual language as
   the per-strategy toggle, scaled down to sit among header text instead
   of dominating it. This is a global kill switch, not a per-strategy
   control, so it lives outside the strategy cards entirely. */
.ap-global-label {
  color: var(--text-dim);
}
.toggle-header {
  width: 36px;
  height: 22px;
  border-radius: 11px;
  margin-left: 0;
  padding: 2px;
}
.toggle-header .toggle-knob {
  width: 16px;
  height: 16px;
}
.toggle-header.toggle-on .toggle-knob {
  transform: translateX(14px);
}

/* Per-strategy autopilot opt-in -- deliberately NOT shaped like the
   trading on/off switch (.toggle above), so the two can never be
   confused: this one only says "autopilot is watching this strategy",
   never "this strategy is trading". */
.ap-toggle {
  padding: 3px 8px;
  border-radius: 10px;
  border: 1px solid var(--panel-border);
  background: transparent;
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.ap-toggle.ap-on {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
}
.ap-toggle:disabled { cursor: default; }

/* The arm control.
 *
 * Colour strategy, and why it is not --danger: that red is this page's
 * ERROR colour (.dot-error, .status.error). An armed strategy is not
 * broken, it is live, and painting it in the error colour would teach the
 * eye to read a correctly-armed card as a fault. So armed gets its own
 * hotter, more saturated red -- the "on air" convention -- kept visually
 * distinct from both the error red and the accent violet the AP chip uses.
 *
 * The two states are deliberately asymmetric in weight:
 *
 *   UNARMED is the safe resting state and nearly every card will sit in it,
 *   so it recedes -- a dim outline chip, no fill, no colour. Shouting about
 *   the safe state would spend the operator's attention on nothing and
 *   leave nothing left over for the state that matters.
 *
 *   ARMED is loud and redundant: solid fill, white bold text, a pulsing
 *   live dot, AND the whole card outlined and tinted. Real money is moving,
 *   and that must survive a glance at a phone in sunlight without reading
 *   a single word.
 */
.arm-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 10px;
  border: 1px solid var(--panel-border);
  background: transparent;
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
}
/* Hint at what pressing it would make true, without claiming to be there. */
.arm-toggle:hover:not(.arm-on),
.arm-toggle:focus-visible:not(.arm-on) {
  border-color: var(--armed);
  color: var(--armed);
}
.arm-toggle.arm-on {
  background: var(--armed);
  border-color: var(--armed);
  color: #fff;
  box-shadow: 0 0 0 3px var(--armed-glow);
}
/* The live dot, shown only when armed. */
.arm-toggle.arm-on::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #fff;
  animation: arm-pulse 1.6s ease-in-out infinite;
}
.arm-toggle:disabled { cursor: default; opacity: 0.6; }

@keyframes arm-pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.25; }
}
@media (prefers-reduced-motion: reduce) {
  .arm-toggle.arm-on::before { animation: none; }
}

/* A self-declared feed fault. Uses the ERROR red (--danger), deliberately not
   the armed red: this is something being WRONG, which is exactly what that
   colour means everywhere else on this page. */
.fault-banner {
  margin: 10px 0 0;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--danger);
  background: rgba(255, 92, 92, 0.12);
  color: var(--danger);
  font-size: 12px;
  line-height: 1.45;
  font-weight: 600;
}
.card-faulted {
  border-color: var(--danger);
}

/* An armed strategy is marked on the CARD too, so "this one is trading real
   money" is legible while scanning a list, without reading any button. */
.card-armed {
  border-color: var(--armed);
  box-shadow: inset 3px 0 0 var(--armed), 0 0 18px -6px var(--armed-glow);
}

/* ---- modal ---- */

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(4, 5, 7, 0.72);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

.modal {
  width: 100%;
  max-width: 380px;
  padding: 20px;
  border-radius: 14px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  box-shadow: 0 24px 60px -12px rgba(0, 0, 0, 0.7);
}
/* The arming dialog wears the armed colour on its edge, so the dialog and
   the state it is about to produce are unmistakably the same subject. */
.arm-modal {
  border-color: var(--armed);
  box-shadow: 0 0 0 1px var(--armed-glow), 0 24px 60px -12px rgba(0, 0, 0, 0.7);
}

.modal-title {
  margin: 0 0 10px;
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
}
.modal-body {
  margin: 0 0 8px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text);
}
.modal-dim { color: var(--text-dim); }
.modal-note {
  margin: 12px 0 0;
  font-size: 12px;
  color: var(--text-dim);
}
.modal-actions {
  margin-top: 18px;
  display: flex;
  gap: 10px;
}
.modal-actions .btn {
  flex: 1;
  margin-top: 0;
}
/* The confirming action carries the armed colour; Cancel stays neutral and
   holds initial focus (see confirmArm() in dashboard.js). */
.btn-arm {
  background: var(--armed);
  color: #fff;
  font-weight: 600;
}
.btn-arm:active { background: var(--armed-deep); }

.autopilot-status {
  margin: 8px 0 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.autopilot-badge {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 9px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.autopilot-badge::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}
.autopilot-watching .autopilot-badge {
  color: var(--text-dim);
  background: rgba(138, 146, 163, 0.12);
}
.autopilot-disabled .autopilot-badge {
  color: var(--danger);
  background: rgba(255, 92, 92, 0.12);
}
.autopilot-needs_human .autopilot-badge {
  color: var(--danger);
  background: rgba(255, 92, 92, 0.16);
}
.autopilot-reason {
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.4;
}

.ap-ack-btn {
  margin: 4px 0 0;
  padding: 3px 10px;
  border-radius: 8px;
  border: 1px solid var(--danger);
  background: transparent;
  color: var(--danger);
  font-size: 11px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.ap-ack-btn:disabled { cursor: default; opacity: 0.6; }

.quote-ladder {
  margin-top: 10px;
  border-top: 1px solid var(--panel-border);
  padding-top: 8px;
}
.quote-row {
  display: grid;
  grid-template-columns: 44px 1fr 1fr;
  gap: 10px;
  padding: 3px 0;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.quote-side { font-weight: 600; font-size: 11px; letter-spacing: 0.06em; }
.quote-row.side-sell .quote-price { color: var(--danger); }
.quote-row.side-buy .quote-price { color: var(--success); }
.quote-volume { color: var(--text-dim); text-align: right; }

/* ---------------------------------------------------------------
 * Operator event feed
 *
 * Strategy boxes have no working alert path of their own, so this
 * panel is where a crashed or disconnected strategy becomes visible
 * without SSHing anywhere. Severity is carried by a left border, not
 * by text colour alone: the three states have to separate at a glance
 * on a phone, and a coloured rule reads faster than a coloured word.
 * Colours come from the existing :root tokens so the feed stays in
 * the same visual language as the rest of the dashboard.
 * --------------------------------------------------------------- */

.events { margin-top: 1.5rem; }

.events-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  margin: 0 0 0.5rem;
}

.events-list { list-style: none; margin: 0; padding: 0; max-height: 20rem; overflow-y: auto; }

.events-empty {
  color: var(--text-dim);
  font-size: 0.85rem;
  margin: 0;
}

.event {
  display: grid;
  grid-template-columns: auto auto 1fr;
  gap: 0.5rem;
  align-items: baseline;
  padding: 0.4rem 0.6rem;
  margin-bottom: 2px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-left: 3px solid var(--text-dim);
  border-radius: 0 6px 6px 0;
  font-size: 0.8rem;
}

/* Timestamps stack in a column, so tabular figures stop the rows
   jittering as the digits change. */
.event-time {
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.event-source { font-weight: 600; white-space: nowrap; }

.event-message { color: var(--text); overflow-wrap: anywhere; }

.event-info  { border-left-color: var(--success); }
.event-warn  { border-left-color: #d9a441; }
.event-error { border-left-color: var(--danger); }

/* Phones: three columns is too tight at this width, so stack the row
   and let the border keep carrying the severity. */
@media (max-width: 30rem) {
  .event { grid-template-columns: 1fr; gap: 0.15rem; }
}

/* ---------------------------------------------------------------
 * Trade blotter
 *
 * A table, not cards: the operator scans a column (what did this
 * strategy fill at?) far more often than they read one row. Numeric
 * columns are tabular and right-aligned so magnitudes line up by eye.
 * Side is carried by colour, matching the book's bid/ask convention.
 * --------------------------------------------------------------- */

.trades { margin-top: 1.5rem; }

.trades-head {
  display: flex;
  align-items: end;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}

.section-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  margin: 0;
  flex: 1 1 auto;
}

.filter { display: flex; flex-direction: column; gap: 0.15rem; }
.filter > span {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
}
.filter select {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  padding: 0.25rem 0.4rem;
  font: inherit;
  font-size: 0.8rem;
}

/* The table can exceed the viewport on a phone; it scrolls inside its own
   container so the page body never scrolls sideways. */
.trades-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
  display: block;
  overflow-x: auto;
  overflow-y: auto;
  max-height: 24rem;   /* the last hour scrolls inside the box, the page does not grow */
  white-space: nowrap;
}
.trades-table thead th { position: sticky; top: 0; background: var(--bg, #fff); }
.trades-table th {
  text-align: left;
  font-weight: 600;
  color: var(--text-dim);
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.3rem 0.6rem 0.3rem 0;
  border-bottom: 1px solid var(--panel-border);
}
.trades-table td {
  padding: 0.3rem 0.6rem 0.3rem 0;
  border-bottom: 1px solid var(--panel-border);
}
.trades-table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  /* Right-aligned numbers meet the next column's left edge, so the gap has
     to live on THIS side: 2026-09-17 price and volume read as one number. */
  padding-left: 1.75rem;
  padding-right: 0.6rem;
}
.trades-table th.num:last-child,
.trades-table td.num:last-child { padding-right: 0; }
.trade-buy  .trade-side { color: var(--success); }
.trade-sell .trade-side { color: var(--danger); }

.trades-empty { color: var(--text-dim); font-size: 0.85rem; margin: 0.5rem 0 0; }

/* ---------------------------------------------------------------
 * Per-strategy parameter editor
 *
 * <details>, collapsed by default — seven inputs open at all times
 * would bury the PnL and state the card exists to show.
 * --------------------------------------------------------------- */

.params {
  margin-top: 0.6rem;
  border-top: 1px solid var(--panel-border);
  padding-top: 0.5rem;
}
.params > summary {
  cursor: pointer;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  list-style: none;
}
.params > summary::-webkit-details-marker { display: none; }
.params > summary::before { content: "▸ "; }
.params[open] > summary::before { content: "▾ "; }

.param-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  margin-top: 0.4rem;
  font-size: 0.78rem;
}
.param-input {
  width: 7.5rem;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  padding: 0.25rem 0.4rem;
  font: inherit;
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.param-apply { margin-top: 0.6rem; width: 100%; }

/* Keyboard focus must stay visible on every new control. */
.filter select:focus-visible,
.param-input:focus-visible,
.param-apply:focus-visible,
.params > summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Trade-sound mute. An icon button, deliberately unlike the autopilot
   switch beside it — that one arms live trading, and the two must never
   be confusable at a glance. */
.waka-toggle {
  background: none;
  border: none;
  padding: 0 0.15rem;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0.75;
  transition: opacity 0.15s ease;
}
.waka-toggle:hover { opacity: 1; }
.waka-toggle[aria-pressed="false"] { opacity: 0.4; }
.waka-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* The `hidden` attribute must actually hide things.
 *
 * The UA default is `[hidden] { display: none }`, which is a single
 * attribute selector and therefore loses to any class rule that sets
 * display -- and `.btn` sets `display: flex`. So `<button class="btn"
 * hidden>` rendered completely normally, and the enrolment button showed
 * on a dashboard that already has a device enrolled.
 *
 * This is the whole stylesheet's problem, not that one button's: several
 * elements here are toggled via .hidden in JS (#pnl-bar, #empty-state,
 * #trades-empty, #events-empty) and any of them would silently stop
 * hiding the moment a display rule was added to their class. Fixing it
 * once, globally, rather than per-element.
 */
[hidden] { display: none !important; }

/* Holdings across strategies. Same table idiom as the blotter. */
.holdings { margin-top: 1.5rem; }
.holdings-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  display: block;
  overflow-x: auto;
}
.holdings-table th {
  text-align: left;
  font-weight: 600;
  color: var(--text-dim);
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.3rem 0.6rem 0.3rem 0;
  border-bottom: 1px solid var(--panel-border);
}
.holdings-table td {
  padding: 0.35rem 0.6rem 0.35rem 0;
  border-bottom: 1px solid var(--panel-border);
}
.holdings-table .num { text-align: right; font-variant-numeric: tabular-nums; padding-right: 0; }
.holding-ccy { font-weight: 600; }
.holding-from { color: var(--text-dim); font-size: 0.75rem; }
/* Stale = the strategy is offline and this is its last reported figure.
   Dimmed and dashed rather than hidden: still counted, visibly not live. */
.holding-stale {
  opacity: 0.6;
  border-bottom: 1px dashed var(--text-dim);
}
