/* /lab/consensus/ — builds on css/lab.css (tokens, body, skip-link).
   Component styles only; no token redefinition, so this page cannot drift from
   the rest of the lab. */

.container { max-width: 880px; margin: 0 auto; padding: 52px 24px 96px; }

/* ── Header ─────────────────────────────────────────────── */
.header { margin-bottom: 22px; }
.header > a { font-family: var(--mono); font-size: 13px; color: var(--accent); text-decoration: none; }
.header > a:hover { color: var(--text); }
.header h1 { font-size: clamp(30px, 6vw, 46px); font-weight: 600; margin-top: 14px; letter-spacing: -0.5px; }
.header p { color: var(--text-dim); font-size: 15.5px; margin-top: 13px; max-width: 66ch; }
.header p b, .panel p b, .finding b { color: var(--text); font-weight: 600; }

/* ── The CI gate banner ─────────────────────────────────── */
.gate {
  font-family: var(--mono); font-size: 12px; letter-spacing: .02em;
  padding: 10px 14px; border-radius: 8px; margin: 20px 0;
  border: 1px solid var(--panel-border);
}
.gate.ok  { color: var(--accent); background: rgba(0, 229, 160, .06); border-color: rgba(0, 229, 160, .22); }
.gate.warn-gate { color: var(--accent-orange); background: rgba(255,159,90,.06); border-color: rgba(255,159,90,.30); }
.gate.bad { color: var(--error); background: rgba(255, 107, 107, .08); border-color: rgba(255, 107, 107, .34); }

/* ── Panels ─────────────────────────────────────────────── */
.panel {
  background: var(--panel-bg); border: 1px solid var(--panel-border);
  border-radius: 12px; padding: 22px 24px; margin: 18px 0;
}
.panel h2 { font-size: 17px; font-weight: 600; margin-bottom: 10px; }
.note { font-size: 13.5px; color: var(--text-muted); margin-top: 12px; max-width: 70ch; line-height: 1.65; }
.dim { color: var(--text-dim); }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.label {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .12em;
  text-transform: uppercase; color: var(--text-muted);
}
.ok { color: var(--accent); }
.warn { color: var(--accent-orange); }
code { font-family: var(--mono); font-size: .9em; background: rgba(255,255,255,.055); padding: 1px 6px; border-radius: 4px; color: var(--text); }
a { color: var(--accent); }

/* ── Instrument ─────────────────────────────────────────── */
.instrument { padding-bottom: 18px; }
.inst-head { display: flex; align-items: center; gap: 14px; margin-bottom: 8px; }
.strip { display: flex; gap: 6px; }
.nd {
  font-family: var(--mono); font-size: 11px; width: 22px; height: 22px;
  display: grid; place-items: center; border-radius: 5px;
  background: var(--bg-accent); border: 1px solid var(--panel-border); color: var(--text-dim);
}
.nd-leader { border-color: var(--accent); color: var(--accent); box-shadow: 0 0 0 1px rgba(0,229,160,.28); }
.nd-dead { opacity: .32; text-decoration: line-through; border-style: dashed; }

#graph { display: block; width: 100%; max-width: 460px; height: auto; margin: 4px auto 0; }

/* The six classes graph.mjs creates. */
.ged-l     { stroke: rgba(255,255,255,.10); stroke-width: .6; }
.gfl-l     { stroke: var(--accent); stroke-width: 1.6; stroke-linecap: round; }
.gfu-c     { fill: none; stroke: rgba(255,255,255,.14); stroke-width: 1.2; }
.gmk-p     { fill: var(--text-dim); }
.glogbase  { stroke: rgba(255,255,255,.12); stroke-width: 1; }
.glog      { stroke: var(--accent); stroke-width: 1.4; fill: none; }

.glog-count { text-align: center; font-family: var(--mono); font-size: 12px; color: var(--text-dim); margin-top: 2px; }
.glog-count .label { margin-right: 6px; }

/* ── Quorum ring ────────────────────────────────────────── */
.quorum-row { display: flex; gap: 18px; align-items: center; margin: 20px 0 4px; }
.q-ring {
  width: 54px; height: 54px; border-radius: 50%; flex: 0 0 auto;
  background: var(--bg-accent); border: 1px solid var(--panel-border);
  position: relative; overflow: hidden;
}
/* A majority is more than half the circle. The threshold hairline never moves. */
.q-ring::after {
  content: ''; position: absolute; inset: 0;
  border-top: 1px solid rgba(255,255,255,.34);
  top: 50%;
}
.q-arc {
  position: absolute; inset: 3px; border-radius: 50%;
  background: conic-gradient(var(--accent) calc(var(--frac, 0) * 360deg), rgba(255,255,255,.05) 0);
  opacity: .55;
}
.quorum-row > div:last-child { font-family: var(--mono); font-size: 13px; }

/* ── Controls ───────────────────────────────────────────── */
.controls { display: flex; flex-wrap: wrap; gap: 12px; margin: 20px 0 4px; }
.run-btn, .ghost-btn {
  font-family: var(--mono); font-size: 13px; font-weight: 600;
  border-radius: 6px; padding: 13px 26px; min-height: 46px; cursor: pointer;
  transition: opacity .2s, transform .2s, border-color .2s, color .2s;
}
.run-btn { background: var(--accent); color: var(--bg); border: none; }
.run-btn:hover:not(:disabled) { opacity: .88; transform: translateY(-1px); }
.ghost-btn { background: transparent; color: var(--text-dim); border: 1px solid var(--panel-border); }
.ghost-btn:hover:not(:disabled) { color: var(--accent); border-color: var(--accent); }
.run-btn:disabled, .ghost-btn:disabled { opacity: .38; cursor: not-allowed; transform: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ── Stat grids ─────────────────────────────────────────── */
.grid-4 { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin: 18px 0; }
.grid-4.tight { margin: 14px 0 0; }
.stat {
  background: var(--bg-accent); border: 1px solid var(--panel-border);
  border-radius: 9px; padding: 13px 15px; display: flex; flex-direction: column; gap: 6px;
}
.stat .v { font-size: 19px; color: var(--text); }

/* ── Recovery ───────────────────────────────────────────── */
.recovery { display: flex; flex-wrap: wrap; gap: 20px; align-items: center; margin-top: 16px; }
.r-big { display: flex; flex-direction: column; gap: 4px; }
.r-big #r-total { font-size: clamp(38px, 8vw, 60px); color: var(--accent); line-height: 1; }
.r-parts { display: flex; gap: 10px; flex-wrap: wrap; }
.r-part {
  background: var(--bg-accent); border: 1px solid var(--panel-border);
  border-radius: 8px; padding: 10px 14px; display: flex; flex-direction: column; gap: 5px;
}
.r-part .mono { font-size: 16px; color: var(--text); }

.finding {
  margin-top: 18px; padding: 14px 16px; border-radius: 9px;
  background: rgba(0,229,160,.05); border: 1px solid rgba(0,229,160,.20);
  font-size: 14.5px; color: var(--text-dim); line-height: 1.6;
}
.finding b { color: var(--accent); }
.cta-line { margin-top: 10px; font-family: var(--mono); font-size: 13px; color: var(--text); }
.cta-line a { text-decoration: none; font-weight: 600; }
.cta-line a:hover { text-decoration: underline; }

/* ── Histogram ──────────────────────────────────────────── */
.hist {
  display: flex; align-items: flex-end; gap: 3px; height: 76px; margin-top: 14px;
  padding: 6px; background: var(--bg-accent);
  border: 1px solid var(--panel-border); border-radius: 8px;
}
.hb { flex: 1; background: linear-gradient(180deg, rgba(0,229,160,.62), rgba(0,229,160,.22)); border-radius: 2px 2px 0 0; min-height: 2px; }
.hist-foot { font-family: var(--mono); font-size: 11px; color: var(--text-muted); margin-top: 6px; text-align: center; }

/* ── Key/value lists ───────────────────────────────────── */
.two-col { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.kv { display: grid; grid-template-columns: 1fr auto; gap: 7px 16px; margin-top: 12px; }
.kv dt { font-size: 13px; color: var(--text-dim); }
.kv dd { font-size: 13px; color: var(--text); text-align: right; }
.kv dt a { text-decoration: none; }

/* ── Event feed ─────────────────────────────────────────── */
.feed {
  margin-top: 12px; max-height: 300px; overflow-y: auto;
  font-family: var(--mono); font-size: 12px; line-height: 1.75;
  background: var(--bg-accent); border: 1px solid var(--panel-border);
  border-radius: 8px; padding: 10px 12px;
}
.ev { display: grid; grid-template-columns: 66px 78px 1fr; gap: 10px; }
.ev-t { color: var(--text-muted); }
.ev-k { color: var(--text-dim); }
.ev-b { color: var(--text-dim); word-break: break-word; }
.ev-recovery  .ev-k, .ev-recovery .ev-b  { color: var(--accent); }
.ev-refused   .ev-k, .ev-refused .ev-b   { color: var(--accent-orange); }
.ev-stalled   .ev-k, .ev-stalled .ev-b   { color: var(--warning); }
.ev-violation .ev-k, .ev-violation .ev-b { color: var(--error); }
.ev-kill      .ev-k { color: var(--accent-coral); }

.footer {
  margin-top: 34px; padding-top: 16px; border-top: 1px solid var(--panel-border);
  font-family: var(--mono); font-size: 12px; color: var(--text-muted);
}
.footer a { color: var(--accent); text-decoration: none; }

@media (prefers-reduced-motion: reduce) {
  .run-btn, .ghost-btn, .hb, .gfl-l { transition: none; animation: none; }
}
@media (max-width: 560px) {
  .container { padding: 34px 16px 72px; }
  .ev { grid-template-columns: 54px 66px 1fr; gap: 8px; }
  .kv { grid-template-columns: 1fr; }
  .kv dd { text-align: left; color: var(--text-dim); }
}
