/* RoboRun shared UI — dark control-station design system.
 *
 * One source of truth for the cockpit (arena) + every dashboard. Tokens keep
 * the old dashboard names (--dim, --panel, --line, --accent, --amber, --blue,
 * --red) so existing pages inherit unchanged, and add the layered + tiered
 * tokens the rebuilt components need. The component classes (.kv, .chip, .pill,
 * .donut, .dotrow, .kpi, .nav, .btn, .card, .seclabel) are built once here and
 * reused — that's the point: the components are the product, not the colors.
 */
:root {
  /* surfaces (layered, dark) */
  --bg:        #0a0d0b;
  --bg-2:      #0d110d;
  --panel:     #11150f;
  --panel-2:   #161c14;
  --panel-head:#171f16;
  --line:      #212c22;
  --line-soft: #18211a;
  /* text tiers */
  --fg:        #e6f0e8;   /* primary value text */
  --fg-2:      #a6bcad;   /* secondary */
  --fg-dim:    #6f8a78;   /* labels / muted */
  --dim:       #7aaf90;   /* legacy alias (dashboards) */
  /* brand + status */
  --accent:    #00d47e;
  --accent-dim:#0c3f2a;
  --ok:        #00d47e;
  --warn:      #d4a030;
  --bad:       #e0563f;
  --blue:      #4090e0;
  --amber:     #d4a030;
  --red:       #e0563f;
  /* shape */
  --r:    10px;
  --r-sm: 6px;
  --shadow: 0 6px 24px rgba(0,0,0,.35);
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, monospace;
}

/* ── section label: uppercase dim header above a block ─────────────────── */
.seclabel {
  font-size: 11px; text-transform: uppercase; letter-spacing: .12em;
  color: var(--fg-dim); margin: 0 0 8px;
}

/* ── active-project chip (project-chip.js, every dashboard) ────────────── */
.proj-chip { font-size: 11px; padding: 3px 10px; border: 1px solid var(--line);
  border-radius: 999px; color: var(--fg-dim); text-decoration: none; white-space: nowrap;
  transition: border-color .12s, color .12s; }
.proj-chip.scoped { color: var(--accent); border-color: var(--accent-dim); background: #0e1a12; }
.proj-chip:hover { border-color: var(--accent); color: var(--fg); }

/* ── nav strip (dashboards) ────────────────────────────────────────────── */
.nav { margin-left: auto; display: flex; gap: 16px; flex-wrap: wrap; }
.nav a { color: var(--fg-2); text-decoration: none; font-size: 12px; padding: 2px 0;
         border-bottom: 1px solid transparent; transition: color .12s, border-color .12s; }
.nav a:hover { color: var(--fg); }
.nav a.on { color: var(--accent); border-bottom-color: var(--accent); }

/* ── button: real click target, hover feedback ─────────────────────────── */
.btn {
  background: var(--panel-2); color: var(--fg-2); border: 1px solid var(--line);
  border-radius: var(--r-sm); font: inherit; font-size: 12.5px;
  padding: 7px 12px; min-height: 30px; cursor: pointer;
  transition: background .12s, color .12s, border-color .12s; }
.btn:hover { background: #1b231a; color: var(--fg); border-color: #2c3b2c; }
.btn.on { color: var(--accent); border-color: var(--accent-dim); background: #0e1a12; }
.btn.accent { color: #06120a; background: var(--accent); border-color: var(--accent); font-weight: 600; }
.btn.accent:hover { background: #1ee08c; color: #06120a; }
.btn.sm { font-size: 11px; padding: 4px 9px; min-height: 26px; }

/* ── chip: small token (tags, params, results) ─────────────────────────── */
.chip {
  display: inline-flex; align-items: baseline; gap: 5px;
  font-size: 11.5px; background: var(--panel-2); border: 1px solid var(--line);
  color: var(--fg-2); border-radius: var(--r-sm); padding: 3px 9px; line-height: 1.5; }
.chip b, .chip .v { color: var(--fg); font-weight: 600; }
.chip .k { color: var(--fg-dim); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }

/* ── pill: outcome badge ───────────────────────────────────────────────── */
.pill { font-size: 11px; font-weight: 600; padding: 2px 9px; border-radius: 999px;
        text-transform: uppercase; letter-spacing: .04em; }
.pill.passed, .pill.ok   { background: rgba(0,212,126,.15);  color: var(--ok); }
.pill.failed, .pill.bad  { background: rgba(224,86,63,.15);  color: var(--bad); }
.pill.warn               { background: rgba(212,160,48,.15); color: var(--warn); }

/* ── key/value readout grid ────────────────────────────────────────────── */
.kv { display: grid; grid-template-columns: auto 1fr; gap: 5px 14px;
      font-size: 13px; align-items: baseline; }
.kv .k { color: var(--fg-dim); white-space: nowrap; }
.kv .v { color: var(--fg); font-variant-numeric: tabular-nums; word-break: break-word; }

/* ── KPI tile ──────────────────────────────────────────────────────────── */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px,1fr)); gap: 10px; }
.kpi { background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--r-sm);
       padding: 12px 14px; }
.kpi .n { font-size: 22px; font-weight: 700; color: var(--fg); line-height: 1.1;
          font-variant-numeric: tabular-nums; }
.kpi .l { font-size: 11px; color: var(--fg-dim); text-transform: uppercase;
          letter-spacing: .06em; margin-top: 4px; }

/* ── pass-rate donut (conic) ───────────────────────────────────────────── */
.donut { --p: 0; --c: var(--ok);
  position: relative; width: 38px; height: 38px; border-radius: 50%; flex: none;
  background: conic-gradient(var(--c) calc(var(--p) * 3.6deg), var(--line) 0); }
.donut::before { content: ""; position: absolute; inset: 5px; border-radius: 50%;
  background: var(--panel); }
.donut span { position: absolute; inset: 0; display: grid; place-items: center;
  font-size: 10px; font-weight: 600; color: var(--fg); }

/* ── dotted pass/fail run timeline ─────────────────────────────────────── */
.dotrow { display: inline-flex; gap: 3px; align-items: center; flex-wrap: wrap; }
.dotrow .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--line); }
.dotrow .dot.pass { background: var(--ok); }
.dotrow .dot.fail { background: var(--bad); }
.dotrow .dot.warn { background: var(--warn); }

/* ── stacked pass-rate history bar ─────────────────────────────────────── */
.histbar { display: flex; flex-direction: column-reverse; width: 100%; height: 56px;
  background: var(--line-soft); border-radius: 4px; overflow: hidden; }
.histbar .pass { background: var(--ok); }
.histbar .fail { background: var(--bad); }
.hist { display: flex; gap: 4px; align-items: flex-end; }
.hist .col { flex: 1; min-width: 0; }
.hist .col .cap { font-size: 9px; color: var(--fg-dim); text-align: center; margin-top: 4px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── generic card ──────────────────────────────────────────────────────── */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r);
        padding: 14px; }

/* ── run-detail component (run-detail.js) ──────────────────────────────── */
.rd-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.rd-title { font-size: 16px; font-weight: 600; color: var(--fg); }
.rd-actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.rd-reason { color: var(--fg-2); font-size: 13px; margin-top: 6px; }
.rd-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; margin-top: 18px; }
@media (max-width: 720px) { .rd-cols { grid-template-columns: 1fr; gap: 18px; } }
.rd-none { color: var(--fg-dim); font-size: 12px; }
.evaltree { display: flex; flex-direction: column; gap: 12px; }
.evalgroup { border-left: 2px solid var(--accent-dim); padding-left: 12px; }
.evalg-h { font-size: 12px; color: var(--fg-2); font-weight: 600; margin-bottom: 4px; }
.evalrow { display: flex; justify-content: space-between; gap: 14px; font-size: 12.5px;
  padding: 2px 0; }
.evalrow .k { color: var(--fg-dim); } .evalrow .v { color: var(--fg); font-variant-numeric: tabular-nums; }
