/* ══════════════════════════════════════════════════════════════════════
 * Roboda Engineering Platform — console styles.
 * app/web/platform.css  ·  vanilla CSS, no imports, no external hosts.
 *
 * PLATFORM-CONTRACT.md §8: "No framework, no CDN, light+dark, keyboard
 * accessible."  This file is the platform half; app/web/studio.css is loaded
 * first by platform.html and supplies the shared tokens and the button /
 * field / pill / dialog / toast primitives, so the platform looks like the
 * design console rather than a second product.
 *
 * ⚠ Two deployment facts shaped this file:
 *
 *   1. nginx exposes the console assets as EXACT-match locations
 *      (deploy/nginx-design-studio.conf).  platform.html, platform.js and
 *      platform.css each need one, or they 404 into the WordPress template.
 *      Every rule here therefore degrades: if platform.css never arrives the
 *      page is still legible on studio.css alone plus the inline safety net
 *      in platform.html.  See NOTES-platform-ui.md.
 *
 *   2. The token block below is repeated from studio.css on purpose.  If
 *      studio.css is ever unlinked, or arrives after this file, the platform
 *      still has a palette and never renders black-on-black.
 * ══════════════════════════════════════════════════════════════════════ */

/* ── tokens (mirror of studio.css; harmless when studio.css already set them,
      because these are the same values) ──────────────────────────────────── */
:root {
  --pf-rail: 232px;
  --pf-gap: 12px;
}

/* Platform-only accents. Derived from the shared tokens so a palette change in
   studio.css carries through without editing this file. */
:root {
  --pf-owner:  var(--accent);
  --pf-agent:  var(--info);
  --pf-run:    var(--accent-2);
}

/* ── page shell ─────────────────────────────────────────────────────────
   studio.css sets `body { display:flex; overflow:hidden }` for the fixed
   three-pane console. The platform scrolls instead — on a phone the
   parameter table and the activity feed are both taller than the viewport. */
body.pf {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  height: auto;
  overflow: auto;
  overscroll-behavior-y: none;
}

.pf-main {
  flex: 1 1 auto;
  width: 100%;
  max-width: 1500px;
  margin: 0 auto;
  padding: 14px 14px 56px;
  min-width: 0;
}

/* ── top bar additions ──────────────────────────────────────────────────
   .topbar/.brand/.actions come from studio.css. */
.pf .topbar { position: sticky; top: 0; flex-wrap: wrap; height: auto; min-height: var(--topbar-h); padding: 6px 10px; row-gap: 6px; }
.pf-where { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; flex: 1 1 auto; }
.pf-where .pf-where-name { font-size: 13px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pf-where .pf-where-sub { font-family: var(--mono); font-size: 10px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.pf-switcher { display: flex; align-items: center; gap: 6px; min-width: 0; }
.pf-switcher select { max-width: min(46vw, 240px); }

/* ── generic layout helpers ─────────────────────────────────────────── */
.pf-row      { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.pf-row-tight{ display: flex; gap: 6px; align-items: center; }
.pf-spread   { display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.pf-grow     { flex: 1 1 auto; min-width: 0; }
.pf-mono     { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.pf-num      { font-family: var(--mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
.pf-muted    { color: var(--muted); }
.pf-small    { font-size: 11px; }
.pf-wrap     { overflow-wrap: anywhere; }
.pf-nowrap   { white-space: nowrap; }

.pf-section { margin: 18px 0 0; }
.pf-section:first-child { margin-top: 0; }
.pf-section-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 10px; flex-wrap: wrap; margin: 0 0 8px;
}
.pf-section-head h2, .pf-section-head h3 { margin: 0; }

.pf-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
}
.pf-panel + .pf-panel { margin-top: 10px; }

.pf-empty {
  color: var(--muted); font-size: 12px;
  border: 1px dashed var(--line); border-radius: var(--radius);
  padding: 16px; text-align: center; background: var(--panel);
}

/* ── route views ────────────────────────────────────────────────────── */
.pf-view[hidden] { display: none !important; }

/* ── status vocabulary ──────────────────────────────────────────────────
   One class set drives checklist items, work items and runs, so a status
   never means two different colours in two places. */
.pf-st {
  display: inline-flex; align-items: center; gap: 5px;
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .02em;
  text-transform: uppercase; white-space: nowrap;
  padding: 2px 7px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--panel-2); color: var(--text-2);
}
.pf-st::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%;
  background: currentColor; flex: none;
}
.pf-st-done,
.pf-st-passed   { border-color: color-mix(in srgb, var(--ok) 55%, var(--line)); color: var(--ok); background: var(--ok-bg); }
.pf-st-running,
.pf-st-claimed  { border-color: var(--accent); color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); }
.pf-st-queued,
.pf-st-ready,
.pf-st-pending  { border-color: var(--line); color: var(--muted); }
.pf-st-blocked  { border-color: var(--warn); color: var(--warn); background: var(--warn-bg); }
.pf-st-failed,
.pf-st-error    { border-color: var(--fail); color: var(--fail); background: var(--fail-bg); }
.pf-st-cancelled,
.pf-st-skipped,
.pf-st-archived { border-color: var(--line); color: var(--muted); opacity: .75; text-decoration: line-through; }

.pf-st-running::before { animation: pf-pulse 1.15s ease-in-out infinite; }
@keyframes pf-pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .35; transform: scale(.72); } }
@media (prefers-reduced-motion: reduce) {
  .pf-st-running::before { animation: none; }
}

/* ── badges (provenance vocabulary) ─────────────────────────────────── */
.pf-badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10px; text-transform: uppercase; letter-spacing: .06em;
  padding: 2px 6px; border-radius: 3px; white-space: nowrap;
  border: 1px solid var(--line); background: var(--panel-2); color: var(--text-2);
}
.pf-badge-owner    { border-color: var(--pf-owner); color: var(--accent-ink); background: var(--pf-owner); font-weight: 700; }
.pf-badge-agent    { border-color: color-mix(in srgb, var(--pf-agent) 55%, var(--line)); color: var(--pf-agent); }
.pf-badge-solver   { border-color: color-mix(in srgb, var(--ok) 45%, var(--line)); color: var(--ok); background: var(--ok-bg); }
.pf-badge-computed { border-color: color-mix(in srgb, var(--ok) 45%, var(--line)); color: var(--ok); background: var(--ok-bg); }
.pf-badge-proposal { border-color: var(--warn); color: var(--warn); background: var(--warn-bg); font-weight: 650; }
.pf-badge-measured { border-color: color-mix(in srgb, var(--pf-agent) 45%, var(--line)); color: var(--pf-agent); }
.pf-badge-assumed  { border-color: var(--line); color: var(--muted); }
.pf-badge-seed     { border-color: var(--line); color: var(--muted); }
.pf-badge-warn     { border-color: var(--warn); color: var(--warn); background: var(--warn-bg); }

.pf-tag {
  display: inline-block; font-family: var(--mono); font-size: 10px;
  padding: 1px 6px; border-radius: 999px;
  border: 1px solid var(--line); color: var(--text-2); background: var(--panel-2);
  white-space: nowrap;
}
.pf-tag-role { border-color: color-mix(in srgb, var(--pf-agent) 40%, var(--line)); color: var(--pf-agent); }

/* ── progress meter ─────────────────────────────────────────────────── */
.pf-meter {
  height: 6px; border-radius: 3px; background: var(--panel-3);
  overflow: hidden; border: 1px solid var(--line-soft);
}
.pf-meter > span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .25s ease; }
.pf-meter.is-done > span { background: var(--ok); }
@media (prefers-reduced-motion: reduce) { .pf-meter > span { transition: none; } }

.pf-conf { display: flex; align-items: center; gap: 6px; min-width: 74px; }
.pf-conf .pf-meter { flex: 1 1 auto; min-width: 34px; height: 5px; }
.pf-conf .pf-conf-n { font-family: var(--mono); font-size: 10.5px; color: var(--text-2); }
.pf-conf.low   .pf-meter > span { background: var(--fail); }
.pf-conf.mid   .pf-meter > span { background: var(--warn); }
.pf-conf.high  .pf-meter > span { background: var(--ok); }

/* ── project list ───────────────────────────────────────────────────── */
.pf-projects { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 290px), 1fr)); gap: var(--pf-gap); }
.pf-proj {
  display: flex; flex-direction: column; gap: 8px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--panel); padding: 11px 12px; box-shadow: var(--shadow);
  min-width: 0;
}
.pf-proj.is-current { border-color: var(--accent); }
.pf-proj h3 { font-size: 14px; text-transform: none; letter-spacing: 0; color: var(--text); overflow-wrap: anywhere; }
.pf-proj .pf-proj-slug { font-family: var(--mono); font-size: 10.5px; color: var(--muted); overflow-wrap: anywhere; }
.pf-proj .pf-proj-summary { font-size: 12px; color: var(--text-2); line-height: 1.45; }
.pf-proj .pf-proj-foot { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: auto; }
.pf-proj-progress { display: flex; align-items: center; gap: 8px; }
.pf-proj-progress .pf-meter { flex: 1 1 auto; }
.pf-proj-progress .pf-num { font-size: 11px; color: var(--muted); }

/* ── dashboard ──────────────────────────────────────────────────────── */
.pf-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 132px), 1fr)); gap: 8px; }
.pf-stat {
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--panel); padding: 8px 10px; min-width: 0;
}
.pf-stat .pf-stat-l { font-size: 10px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pf-stat .pf-stat-v { font-family: var(--mono); font-size: 19px; font-weight: 650; line-height: 1.25; }
.pf-stat .pf-stat-s { font-size: 10.5px; color: var(--muted); }
.pf-stat.is-fail { border-color: var(--fail); }
.pf-stat.is-run  { border-color: var(--accent); }

.pf-cols {
  display: grid; gap: var(--pf-gap);
  grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
  align-items: start;
}

/* ── checklist ──────────────────────────────────────────────────────── */
.pf-phase { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); margin-bottom: 8px; }
.pf-phase > summary {
  display: flex; align-items: center; gap: 8px; cursor: pointer;
  padding: 8px 10px; list-style: none;
  font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--text-2); font-weight: 650;
}
.pf-phase > summary::-webkit-details-marker { display: none; }
.pf-phase > summary::before { content: "▸"; color: var(--muted); font-size: 10px; }
.pf-phase[open] > summary::before { content: "▾"; }
.pf-phase > summary .pf-phase-n { margin-left: auto; font-family: var(--mono); font-size: 10px; color: var(--muted); text-transform: none; letter-spacing: 0; }

.pf-item {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  gap: 4px 9px; align-items: center;
  padding: 8px 10px; border-top: 1px solid var(--line-soft);
}
.pf-item .pf-item-ord { font-family: var(--mono); font-size: 11px; color: var(--muted); text-align: right; }
.pf-item .pf-item-main { min-width: 0; }
.pf-item .pf-item-title { font-size: 12.5px; overflow-wrap: anywhere; }
.pf-item .pf-item-meta { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-top: 3px; }
.pf-item .pf-item-act { display: flex; gap: 4px; align-items: center; justify-self: end; }
.pf-item .pf-item-note { grid-column: 2 / -1; font-size: 11px; color: var(--fail); overflow-wrap: anywhere; }
.pf-item.is-running { background: color-mix(in srgb, var(--accent) 7%, transparent); }
.pf-item.is-failed  { background: color-mix(in srgb, var(--fail) 7%, transparent); }

/* ── work queue ─────────────────────────────────────────────────────── */
.pf-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.pf-table { width: 100%; border-collapse: collapse; font-size: 12px; }
table.pf-table th {
  text-align: left; font-size: 10px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); font-weight: 650; padding: 6px 8px 6px 0; white-space: nowrap;
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; background: var(--panel); z-index: 1;
}
table.pf-table td { padding: 6px 8px 6px 0; border-top: 1px solid var(--line-soft); vertical-align: top; }
table.pf-table tr.is-running > td { background: color-mix(in srgb, var(--accent) 6%, transparent); }
table.pf-table tr.is-failed  > td { background: color-mix(in srgb, var(--fail) 6%, transparent); }
table.pf-table td:last-child, table.pf-table th:last-child { padding-right: 0; }

/* ── running agents ─────────────────────────────────────────────────── */
.pf-runners { display: flex; flex-direction: column; gap: 8px; }
.pf-runner {
  border: 1px solid var(--accent); border-radius: var(--radius);
  background: color-mix(in srgb, var(--accent) 7%, var(--panel));
  padding: 9px 10px;
}
.pf-runner .pf-runner-head { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.pf-runner .pf-runner-role { font-weight: 700; font-size: 12.5px; }
.pf-runner .pf-runner-meta { font-size: 11px; color: var(--text-2); margin-top: 4px; overflow-wrap: anywhere; }
.pf-runner .pf-runner-tool { font-family: var(--mono); font-size: 11px; color: var(--text-2); margin-top: 5px; overflow-wrap: anywhere; }

/* ── parameter table ────────────────────────────────────────────────── */
.pf-params-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.pf-filters { display: flex; gap: 4px; flex-wrap: wrap; }
.pf-filters button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 650; }

table.pf-params { width: 100%; border-collapse: collapse; font-size: 12px; }
table.pf-params th {
  text-align: left; font-size: 10px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); font-weight: 650; padding: 6px 8px; white-space: nowrap;
  border-bottom: 1px solid var(--line); background: var(--panel);
  position: sticky; top: 0; z-index: 1;
}
table.pf-params td { padding: 7px 8px; border-top: 1px solid var(--line-soft); vertical-align: top; }
table.pf-params tbody tr.pf-prow:hover > td { background: var(--panel-2); }
table.pf-params tr.is-override > td { background: color-mix(in srgb, var(--accent) 8%, transparent); }
table.pf-params tr.is-proposal > td { background: color-mix(in srgb, var(--warn) 8%, transparent); }

.pf-pkey { font-family: var(--mono); font-size: 11px; color: var(--text); overflow-wrap: anywhere; }
.pf-plabel { font-size: 11px; color: var(--muted); margin-top: 2px; overflow-wrap: anywhere; }
.pf-pval { font-family: var(--mono); font-size: 13px; font-weight: 650; white-space: nowrap; }
.pf-punit { font-family: var(--mono); font-size: 10.5px; color: var(--muted); }
.pf-psig { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.pf-psolver { font-family: var(--mono); font-size: 10.5px; color: var(--text-2); overflow-wrap: anywhere; }
.pf-pacts { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }

.pf-why {
  background: var(--panel-2);
}
.pf-why > td { padding: 0 8px 10px; border-top: 0; }
.pf-why-box {
  border-left: 3px solid var(--accent); border-radius: 0 var(--radius) var(--radius) 0;
  background: var(--panel); padding: 9px 11px; font-size: 12px; line-height: 1.5;
}
.pf-why-box h4 { font-size: 10px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin: 0 0 3px; }
.pf-why-box p { margin: 0 0 8px; overflow-wrap: anywhere; }
.pf-why-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr)); gap: 8px; }
.pf-why-box pre {
  font-family: var(--mono); font-size: 11px; margin: 0;
  background: var(--panel-2); border: 1px solid var(--line-soft); border-radius: var(--radius);
  padding: 7px 8px; max-height: 260px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere;
}
.pf-sighash { font-family: var(--mono); font-size: 10.5px; color: var(--muted); overflow-wrap: anywhere; }

/* ── activity feed ──────────────────────────────────────────────────── */
.pf-feed { display: flex; flex-direction: column; gap: 8px; }
.pf-run {
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel);
}
.pf-run.is-running { border-color: var(--accent); }
.pf-run.is-failed  { border-color: var(--fail); }
.pf-run > summary {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 8px 10px; cursor: pointer; list-style: none;
}
.pf-run > summary::-webkit-details-marker { display: none; }
.pf-run > summary::before { content: "▸"; color: var(--muted); font-size: 10px; flex: none; }
.pf-run[open] > summary::before { content: "▾"; }
.pf-run .pf-run-role { font-weight: 700; font-size: 12.5px; }
.pf-run .pf-run-when { margin-left: auto; font-family: var(--mono); font-size: 10.5px; color: var(--muted); }
.pf-run-body { padding: 0 10px 10px 26px; }
.pf-run-err { color: var(--fail); font-size: 11.5px; margin: 0 0 6px; overflow-wrap: anywhere; }

.pf-calls { display: flex; flex-direction: column; gap: 5px; }
.pf-call { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel-2); font-size: 11.5px; }
.pf-call > summary {
  display: flex; align-items: center; gap: 7px; flex-wrap: wrap;
  padding: 5px 8px; cursor: pointer; list-style: none;
}
.pf-call > summary::-webkit-details-marker { display: none; }
.pf-call .pf-call-name { font-family: var(--mono); font-weight: 700; }
.pf-call .pf-call-solver { font-family: var(--mono); font-size: 10.5px; color: var(--ok); }
.pf-call .pf-call-ms { margin-left: auto; font-family: var(--mono); font-size: 10.5px; color: var(--muted); }
.pf-call.is-bad { border-color: var(--fail); }
.pf-call.is-bad .pf-call-name { color: var(--fail); }
.pf-call pre {
  font-family: var(--mono); font-size: 10.5px; margin: 0 8px 8px;
  background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--radius);
  padding: 6px 7px; max-height: 220px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere;
}
.pf-live {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 10px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted);
}
.pf-live::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.pf-live.on::before { background: var(--ok); animation: pf-pulse 1.6s ease-in-out infinite; }
.pf-live.on { color: var(--ok); }
.pf-live.poll::before { background: var(--warn); }
.pf-live.poll { color: var(--warn); }
@media (prefers-reduced-motion: reduce) { .pf-live.on::before { animation: none; } }

/* ── artifacts ──────────────────────────────────────────────────────── */
.pf-art-cols { display: grid; grid-template-columns: minmax(0, 300px) minmax(0, 1fr); gap: var(--pf-gap); align-items: start; }
.pf-art-list { display: flex; flex-direction: column; gap: 5px; max-height: 62vh; overflow: auto; }
.pf-art {
  display: flex; gap: 8px; align-items: flex-start; text-align: left; width: 100%;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel);
  padding: 7px 9px; font: inherit; color: var(--text); cursor: pointer;
}
.pf-art:hover { background: var(--panel-2); }
.pf-art[aria-current="true"] { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--panel)); }
.pf-art .pf-art-name { font-size: 12px; font-weight: 600; overflow-wrap: anywhere; }
.pf-art .pf-art-meta { font-family: var(--mono); font-size: 10px; color: var(--muted); margin-top: 2px; overflow-wrap: anywhere; }

.pf-art-view { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); min-height: 220px; }
.pf-art-view-head {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 8px 10px; border-bottom: 1px solid var(--line);
}
.pf-art-stage { padding: 10px; background: var(--panel-2); overflow: auto; max-height: 68vh; }
.pf-art-stage svg { display: block; width: 100%; height: auto; max-width: 100%; background: #ffffff; border-radius: 3px; }
.pf-art-stage pre {
  font-family: var(--mono); font-size: 11.5px; margin: 0; white-space: pre-wrap;
  overflow-wrap: anywhere; color: var(--text);
}
.pf-art-stage img { max-width: 100%; height: auto; display: block; }

/* ── dialogs (extend studio.css .dlg) ───────────────────────────────── */
.pf-dlg { width: min(94vw, 560px); }
.pf-dlg .dlg-body { max-height: min(76vh, 640px); overflow: auto; }
.pf-field-row { display: block; margin-bottom: 10px; }
.pf-field-row > span { display: block; font-size: 11px; color: var(--text-2); margin-bottom: 3px; }
.pf-field-row > input, .pf-field-row > select, .pf-field-row > textarea {
  width: 100%; font: inherit; font-size: 13px; padding: 8px 9px; min-height: 40px;
  background: var(--panel-2); color: var(--text);
  border: 1px solid var(--line); border-radius: var(--radius);
}
.pf-field-row > textarea { min-height: 76px; resize: vertical; line-height: 1.45; }
.pf-field-row > input:focus, .pf-field-row > select:focus, .pf-field-row > textarea:focus { border-color: var(--accent-2); }
.pf-field-row > input[aria-invalid="true"], .pf-field-row > textarea[aria-invalid="true"] { border-color: var(--fail); background: var(--fail-bg); }
.pf-field-hint { font-size: 11px; color: var(--muted); margin: -6px 0 10px; }
.pf-dlg-err { color: var(--fail); font-size: 12px; margin: 0 0 10px; }
.pf-dlg-err[hidden] { display: none; }
.pf-note {
  font-size: 11.5px; line-height: 1.5; color: var(--text-2);
  border: 1px solid var(--line); border-left: 3px solid var(--accent);
  background: var(--panel-2); border-radius: var(--radius); padding: 8px 10px; margin: 0 0 12px;
}
.pf-current {
  display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap;
  font-size: 12px; background: var(--panel-2); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 8px 10px; margin: 0 0 12px;
}
.pf-targets { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.pf-target { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 110px) 34px; gap: 6px; align-items: center; }
.pf-target input { width: 100%; font: inherit; font-size: 12px; padding: 6px 8px; min-height: 36px; background: var(--panel-2); color: var(--text); border: 1px solid var(--line); border-radius: var(--radius); }

/* ── banner / gate ──────────────────────────────────────────────────── */
.pf-banner {
  border: 1px solid var(--warn); border-left-width: 3px; background: var(--warn-bg);
  color: var(--warn); border-radius: var(--radius); padding: 9px 11px; font-size: 12px;
  line-height: 1.5; margin: 0 0 12px;
}
.pf-banner[hidden] { display: none; }
.pf-banner strong { display: block; }
.pf-banner code { font-family: var(--mono); font-size: 11px; }

.pf-gate {
  position: fixed; inset: 0; z-index: 90; display: flex; align-items: center; justify-content: center;
  background: var(--bg); padding: 20px;
}
.pf-gate[hidden] { display: none; }
.pf-gate-box {
  width: min(92vw, 400px); background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); text-align: center;
}
.pf-gate-box h2 { font-size: 16px; text-transform: none; letter-spacing: 0; color: var(--text); margin-bottom: 8px; }
.pf-gate-box p { font-size: 12.5px; color: var(--text-2); line-height: 1.5; }
.pf-gate-acts { display: flex; gap: 8px; justify-content: center; margin-top: 14px; flex-wrap: wrap; }

/* ── skeletons ──────────────────────────────────────────────────────── */
.pf-skel { border-radius: 3px; background: var(--panel-3); height: 11px; }
.pf-skel + .pf-skel { margin-top: 7px; }

/* ── responsive ─────────────────────────────────────────────────────── */
@media (max-width: 1080px) {
  .pf-cols     { grid-template-columns: minmax(0, 1fr); }
  .pf-art-cols { grid-template-columns: minmax(0, 1fr); }
  .pf-art-list { max-height: 300px; }
}

@media (max-width: 760px) {
  .pf-main { padding: 10px 10px 64px; }
  .pf .topbar { gap: 8px; }
  .pf-switcher select { max-width: 100%; }

  /* The parameter and queue tables reflow into stacked cards: a 9-column
     table cannot be read on a phone, and a horizontal scroller hides the
     override state, which is the one thing that must never be missed. */
  table.pf-params, table.pf-params tbody, table.pf-params tr, table.pf-params td,
  table.pf-table,  table.pf-table  tbody, table.pf-table  tr, table.pf-table  td { display: block; width: 100%; }
  table.pf-params thead, table.pf-table thead { display: none; }
  table.pf-params tr.pf-prow, table.pf-table tbody tr {
    border: 1px solid var(--line); border-radius: var(--radius);
    background: var(--panel); margin-bottom: 8px; padding: 4px 2px;
  }
  table.pf-params tr.is-override { border-color: var(--accent); }
  table.pf-params td, table.pf-table td {
    display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 8px;
    border-top: 0; padding: 4px 9px;
  }
  table.pf-params td::before, table.pf-table td::before {
    content: attr(data-label);
    font-size: 10px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted);
    padding-top: 2px;
  }
  table.pf-params td:empty, table.pf-table td:empty { display: none; }
  table.pf-params tr.pf-why > td { display: block; padding: 0 9px 9px; }
  table.pf-params tr.pf-why > td::before { content: none; }
  .pf-pacts { justify-content: flex-start; }
  .pf-item { grid-template-columns: 26px minmax(0, 1fr); }
  .pf-item .pf-item-act { grid-column: 2 / -1; justify-self: start; margin-top: 4px; }
  .pf-run-body { padding-left: 12px; }
  .pf-target { grid-template-columns: minmax(0, 1fr) minmax(0, 90px) 32px; }
}

@media (max-width: 520px) {
  .pf-dlg { width: 100vw; max-width: 100vw; border-radius: 0; margin: 0; height: 100%; max-height: 100%; }
  .pf-dlg .dlg-body { max-height: calc(100vh - 118px); }
  .pf-stats { grid-template-columns: repeat(auto-fill, minmax(min(100%, 108px), 1fr)); }
}

/* Touch targets: the console is dense by design, but the platform is used on a
   phone (owner requirement), and every control here is a real decision. */
@media (pointer: coarse) {
  .pf .btn { min-height: 38px; }
  .pf .btn-sm { min-height: 34px; }
  .pf-art { min-height: 46px; }
}

/* ── print (a checklist review on paper) ────────────────────────────── */
@media print {
  .pf .topbar, .pf-tabs, .pf-pacts, .pf-filters, .btn, .pf-gate { display: none !important; }
  .pf-main { max-width: none; padding: 0; }
  .pf-panel, .pf-proj, .pf-phase { break-inside: avoid; box-shadow: none; }
}


/* ── capabilities (PLATFORM-ADDENDUM §4) ───────────────────────────────
   "every role stays reachable and the UI shows it greyed with the reason."
   Greyed, never hidden, and never removed from the DOM: a screen reader and
   a Ctrl-F both have to find it.                                          */
.pf-cap-group { margin: 14px 0 18px; }
.pf-cap-group > h4 { margin: 0 0 6px; font-size: .95rem; }
.pf-cap-list {
  display: grid; gap: 6px;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
}
.pf-cap {
  border: 1px solid var(--line, #d8dde3); border-radius: 6px;
  padding: 7px 9px; background: var(--card, transparent);
}
.pf-cap b { font-weight: 600; }
.pf-cap .pf-cap-sub { display: block; font-size: .78rem; opacity: .75; }
.pf-cap.is-irrelevant { opacity: .45; border-style: dashed; }
.pf-cap.is-irrelevant b::after {
  content: " · not relevant"; font-weight: 400; font-size: .78rem;
}
.pf-cap .pf-cap-why { display: block; font-size: .78rem; font-style: italic; }
@media (prefers-contrast: more) {
  .pf-cap.is-irrelevant { opacity: .8; }
}
