/* ProofWarden — app-domain compositions only.
 *
 * The console CHROME (dark top-bar + rail + printable readout) is the KIT's
 * `.mgf-console` shell since mgf-brand-web 0.4.0 (console.css + the
 * mgf/console.html template — M1 P4.2 lifted it from here); the state chips /
 * origin badges / honest absence live in the kit's instruments.css. This file
 * keeps only what is genuinely ProofWarden's: the catalog tree rows, the lease
 * run-card, the queue/audit strips, the history grid, the CI rows, the cancel
 * affordance, the outcome-fidelity chips. EVERY colour is an mgf-brand-web
 * token, so it reads identical to the kit and flips in dark mode. Additive:
 * no kit class is touched.
 */

/* Generic flex spacer (panel heads, queue rows). */
.pw-spacer { flex: 1; }

/* Readout lede. */
.pw-lede { max-width: 82ch; margin: var(--space-2) 0 var(--space-5); }

/* Project header strip. */
.pw-phead {
  display: flex; align-items: center; gap: var(--space-4); flex-wrap: wrap;
  background: var(--color-surface-raised); border: 1px solid var(--color-border);
  border-radius: var(--radius-lg); padding: var(--space-4) var(--space-6);
  box-shadow: var(--shadow-sm); margin-bottom: var(--space-2);
}
.pw-phead__name { font-family: var(--font-display); font-size: 1.2rem; font-weight: 600; }
.pw-phead__kind { font-size: 0.72rem; color: var(--color-text-muted); margin-top: 0.15rem; }
.pw-phead__sp { flex: 1; }
.pw-ribbon { margin: var(--space-4) 0 var(--space-2); }
.pw-tabs { margin: var(--space-4) 0 var(--space-6); }

/* ----------------------------------------------------------- catalog tree -- */
.pw-cat { margin-bottom: var(--space-5); }
.pw-cat__h {
  font-size: 0.7rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--color-text-muted); padding: var(--space-2) 0; cursor: pointer;
  border-bottom: 1px solid var(--color-border); list-style: none;
}
.pw-cat__h::-webkit-details-marker { display: none; }
.pw-cat__h::before { content: "▸ "; }
.pw-cat[open] > .pw-cat__h::before { content: "▾ "; }
.pw-grp__h { font-weight: 620; font-size: 0.82rem; color: var(--color-text); margin: var(--space-3) 0 var(--space-2); }
.pw-trowform { margin-bottom: var(--space-2); }
.pw-trow {
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-3); border: 1px solid var(--color-border);
  border-radius: var(--radius-md); background: var(--color-bg);
}
.pw-trow:hover { background: var(--color-bg-soft); }
.pw-trow__id { font-size: 0.74rem; font-weight: 600; min-width: 10rem; word-break: break-all; }
.pw-trow__t { font-weight: 540; flex: 1; min-width: 9rem; }
.pw-runner { font-size: 0.66rem; color: var(--color-text-muted); }
.pw-tags { display: flex; gap: 0.3rem; flex-wrap: wrap; }
.pw-cfgwrap { margin: 0 0 var(--space-2); }
.pw-cfgwrap > summary { list-style: none; display: inline-flex; margin: 0 0 var(--space-2) 10.6rem; }
.pw-cfgwrap > summary::-webkit-details-marker { display: none; }

/* ------------------------------------------------------ running / leases -- */
.pw-ctrlbar {
  display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap;
  padding: var(--space-3) var(--space-4); border: 1px solid var(--color-border);
  border-radius: var(--radius-md); background: var(--color-bg-soft); margin-bottom: var(--space-4);
}
.pw-runcard {
  border: 1px solid color-mix(in srgb, var(--state-busy) 35%, var(--color-border));
  border-radius: var(--radius-lg); background: var(--color-surface-raised);
  overflow: hidden; margin-bottom: var(--space-4);
}
.pw-runcard__h {
  display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap;
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-border);
  background: color-mix(in srgb, var(--state-busy) 6%, var(--color-surface-raised));
}
.pw-runcard__op { font-weight: 600; }
.pw-holder {
  font-size: 0.7rem; color: var(--color-text-muted); background: var(--color-bg);
  border: 1px solid var(--color-border); border-radius: var(--radius-sm); padding: 0.2rem 0.5rem;
}
.pw-runcard__b { padding: var(--space-3) var(--space-4); }
.pw-rmeta {
  display: flex; gap: var(--space-4); flex-wrap: wrap; font-size: 0.72rem;
  color: var(--color-text-muted); margin-bottom: var(--space-2);
}
.pw-console-h {
  display: flex; align-items: center; gap: var(--space-2);
  font-size: 0.66rem; letter-spacing: 0.04em; color: var(--color-text-muted);
  margin: var(--space-4) 0 var(--space-2);
}

/* The origin badge moved INTO the kit (.origin-badge, instruments.css 0.4.0);
 * the macro in macros.html now wraps the kit pack's. */

/* Queue + audit. */
.pw-panel { padding: 0; margin-bottom: var(--space-5); overflow: hidden; }
.pw-panel__head {
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--color-border);
}
.pw-panel__title { font-weight: 640; font-size: 0.9rem; }
.pw-panel__note { font-size: 0.7rem; }
.pw-panel__body { padding: var(--space-3) var(--space-4); }
.pw-qrow {
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-2) 0; border-bottom: 1px solid var(--color-border);
}
.pw-qrow:last-child { border-bottom: none; }
.pw-qpos {
  font-weight: 700; font-size: 0.72rem; color: var(--color-warning-text);
  background: var(--color-warning-tint); border-radius: var(--radius-sm);
  width: 1.5rem; height: 1.5rem; display: flex; align-items: center; justify-content: center;
}
.pw-audit { padding: var(--space-2) var(--space-3); }
.pw-arow {
  display: flex; align-items: flex-start; gap: var(--space-3);
  padding: var(--space-2) 0; border-bottom: 1px solid var(--color-border); font-size: 0.72rem;
}
.pw-arow:last-child { border-bottom: none; }
.pw-ats { color: var(--color-text-muted); min-width: 3.6rem; }
.pw-ak {
  font-weight: 600; padding: 0.1rem 0.4rem; border-radius: var(--radius-sm);
  min-width: 6rem; text-align: center; color: var(--color-text-muted); background: var(--color-bg-soft);
}
.pw-ak--coalesced { color: var(--state-derived-text); background: var(--state-derived-tint); }
.pw-ak--queued { color: var(--color-warning-text); background: var(--color-warning-tint); }
.pw-ak--lease_reclaimed,
.pw-ak--refused,
.pw-ak--cancelled { color: var(--color-error-text); background: var(--color-error-tint); }
.pw-ak--lease_acquired,
.pw-ak--lease_released { color: var(--color-success-text); background: var(--color-success-tint); }
.pw-atx { flex: 1; color: var(--color-text); }

/* ---------------------------------------------------------------- history -- */
.pw-filters { display: flex; gap: var(--space-2); flex-wrap: wrap; margin-bottom: var(--space-4); }
.pw-fpill {
  padding: 0.35rem 0.8rem; border: 1px solid var(--color-border); background: var(--color-bg);
  border-radius: var(--radius-pill); font-size: 0.75rem; color: var(--color-text-muted); text-decoration: none;
}
.pw-fpill--on { background: var(--mgf-ink); border-color: var(--mgf-ink); color: var(--mgf-mist); }
.pw-grid { width: 100%; border-collapse: collapse; }
.pw-grid th {
  text-align: left; font-size: 0.62rem; font-weight: 600; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--color-text-muted);
  padding: var(--space-3) var(--space-3) var(--space-2); border-bottom: 1px solid var(--color-border);
}
.pw-grid td { padding: var(--space-2) var(--space-3); border-bottom: 1px solid var(--color-border); vertical-align: top; }
.pw-detailrow td { padding-top: 0; }
.pw-detailwrap > summary { cursor: pointer; font-size: 0.7rem; }
.pw-absorbed { color: var(--state-derived-text); }
.pw-audit-list { margin-top: var(--space-2); }

/* -------------------------------------------------------------------- ci --- */
.pw-cirow {
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-3) 0; border-bottom: 1px solid var(--color-border);
}
.pw-cirow:last-child { border-bottom: none; }
.pw-cirow__main { flex: 1; min-width: 0; }
.pw-ciurl { color: var(--color-accent); word-break: break-all; }

/* ------------------------------------------------------------ responsive -- */
/* (The rail/readout narrowing comes from the kit's console.css.) */
@media (max-width: 50rem) {
  .pw-trow__id { min-width: 0; }
  .pw-cfgwrap > summary { margin-left: 0; }
}

/* ----------------------------------------------------------------- print -- */
/* The kit's console.css strips the shell chrome and flattens the readout;
 * this adds only the ProofWarden-specific hides + panel break rules. */
@media print {
  .pw-tabs, .pw-ctrlbar, .config-toggle, .pw-filters {
    display: none !important;
  }
  .pw-panel, .pw-runcard, .pw-phead { break-inside: avoid; box-shadow: none; }
  .console { background: #fff; color: #000; }
  .pw-cancel { display: none; }
}

/* Cancel affordance on a running-lease card (operator action; calm, not gold). */
.pw-cancel {
  display: inline-flex;
}
.pw-cancel__btn {
  color: var(--color-error-text);
  border-color: color-mix(in srgb, var(--mgf-error) 40%, transparent);
  background: var(--color-error-tint);
}
.pw-cancel__btn:hover {
  background: color-mix(in srgb, var(--mgf-error) 18%, transparent);
}

/* Outcome-fidelity chips (M2-P1 §1.6) — the supervisor's full vocabulary rendered
   distinctly instead of flattening to `error`/`skipped`. Brand semantic tokens
   ONLY (no new hexes): hung/crashed are error-class (same red family as
   .status-chip--error, distinguished by their labels); quarantined reads as
   paused/warn-class (amber, like .status-chip--stale). pass/fail/error/skipped/
   running/unknown are already covered by the brand kit's instruments.css. */
.status-chip--hung,
.status-chip--crashed {
  color: var(--color-error-text);
  background: var(--color-error-tint);
  border-color: color-mix(in srgb, var(--mgf-error) 45%, transparent);
}
.status-chip--hung .status-chip__dot,
.status-chip--crashed .status-chip__dot {
  background: var(--mgf-error);
}
.status-chip--quarantined {
  color: var(--color-warning-text);
  background: var(--color-warning-tint);
  border-color: color-mix(in srgb, var(--mgf-warning) 45%, transparent);
}
.status-chip--quarantined .status-chip__dot {
  background: var(--mgf-warning);
}
