:root {
  --bg: #14161a;
  --panel: #1c1f26;
  --border: #2c313c;
  --fg: #dfe3ea;
  --muted: #8c94a4;
  --accent: #ff7a29;          /* phoenix ember — links, active controls */
  --accent-soft: rgba(255, 122, 41, 0.15);
  --accent-ink: #180a03;      /* text on a filled accent surface */
  --good: #2ca02c;
  --bad: #d62728;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 12px 16px 32px;
  background: var(--bg);
  color: var(--fg);
  font: 13px/1.45 ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}

a { color: var(--accent); }

h1 {
  font-size: 17px;
  font-weight: 600;
  margin: 0;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

/* ---------------------------------------------------------------- brand */

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
  color: var(--fg);
}
.brand img {
  height: 30px;
  width: auto;
  display: block;
  /* The mark is a glow cut out of black; a touch of bloom keeps it alive
     against the panel grey instead of looking like a flat sticker. */
  filter: drop-shadow(0 0 6px rgba(255, 92, 20, 0.45));
}
.brand-name {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: linear-gradient(100deg, #ffb347 0%, #ff7a29 45%, #e33d1a 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.brand-sub {
  color: var(--muted);
  font-size: 13px;
  border-left: 1px solid var(--border);
  padding-left: 14px;
}

.muted { color: var(--muted); }
.pos { color: var(--good); }
.neg { color: var(--bad); }
.mono { font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; }

.banner {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 12px;
  margin-bottom: 12px;
  display: flex;
  gap: 22px;
  flex-wrap: wrap;
}
.banner b { font-weight: 600; }

/* ---------------------------------------------------------------- layout */

.columns {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  flex-wrap: wrap;
}
.col-charts { flex: 1 1 720px; min-width: 0; }
.col-side { flex: 0 0 300px; display: flex; flex-direction: column; gap: 12px; }

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
  margin-bottom: 12px;
}
.card > h2 {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 0 0 8px;
}

/* ---------------------------------------------------------------- table */

table { border-collapse: collapse; width: 100%; }
th, td {
  text-align: right;
  padding: 4px 8px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
th {
  color: var(--muted);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
/* The leading identity columns (strategy, market, type, mode, status). */
td:first-child, th:first-child,
td:nth-child(2), th:nth-child(2),
td:nth-child(3), th:nth-child(3),
td:nth-child(4), th:nth-child(4),
td:nth-child(5), th:nth-child(5) { text-align: left; }
tbody tr:hover { background: #232833; }

/* ------------------------------------------------------------- markout */

/* Dense matrix in a 300px sidebar: τ buckets down, horizons across. The
   global "first five columns are identity" rule above is for the overview
   table — here everything but the bucket label is a number. */
table.markout { font-size: 11px; }
table.markout th, table.markout td {
  padding: 3px 4px;
  text-align: right;
}
table.markout th:first-child,
table.markout td.bucket { text-align: left; color: var(--muted); }
table.markout td { font-family: ui-monospace, Menlo, Consolas, monospace; }
table.markout tfoot .total td {
  border-bottom: 0;
  border-top: 1px solid var(--border);
  font-weight: 600;
}
.markout-note { font-size: 10px; line-height: 1.35; margin: 6px 0 0; }

/* ---------------------------------------------------------------- controls */

.controls {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

button, select, input[type="text"], input[type="number"] {
  background: #262b35;
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 4px 8px;
  font: inherit;
}
button { cursor: pointer; }
button:hover { border-color: var(--accent); }
button.active { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
button.danger { border-color: var(--bad); color: #ff9a9a; }
button.danger.armed { background: var(--bad); color: #fff; }
button.primary { border-color: var(--accent); }

label.field {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 5px;
}
label.field > span { color: var(--muted); font-size: 12px; }
label.field > input { width: 120px; text-align: right; }
label.field > input[type="checkbox"] { width: auto; margin-right: 2px; }
.group-hint {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
  margin: 0 0 6px;
}
/* Group help is collapsed by default: a maker has five parameter groups and
   the panel is meant to be tuned from, not read cover to cover. */
.group-help > summary {
  color: var(--muted);
  font-size: 11px;
  cursor: pointer;
  margin-bottom: 4px;
  list-style: none;
}
.group-help > summary::before { content: "? "; color: var(--accent); }
.group-help[open] > summary { color: var(--accent); }
label.stack { display: block; margin-bottom: 6px; }
label.stack > span { display: block; color: var(--muted); font-size: 12px; margin-bottom: 2px; }
label.stack > input { width: 100%; }

.group-title {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 10px 0 4px;
}
.status-line { min-height: 18px; color: var(--muted); font-style: italic; }
hr { border: 0; border-top: 1px solid var(--border); margin: 10px 0; }

/* ---------------------------------------------------------------- uPlot */

.uplot { margin-bottom: 6px; }
.u-title { color: var(--fg); font-size: 12px; font-weight: 600; }
.u-legend { font-size: 11px; }
.u-legend .u-marker { width: 10px; height: 10px; }
.u-select { background: var(--accent-soft); }

#tooltip {
  position: fixed;
  z-index: 20;
  display: none;
  pointer-events: none;
  background: #0f1116;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 5px 8px;
  font-size: 11px;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  white-space: pre;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.5);
}
