/* The Flows and Jobs pages (B2, docs/design_infra-v2-phase5b.md §5.3-§5.5): the inspector, the
   flow graph, the Check report, the job tables. No inline styles (CSP style-src 'self'): every
   colour is a class here or in panel.css. */

.crumbs { margin: 0.4rem 0 0; color: var(--dim); font-size: 0.9em; }
.crumbs a { color: var(--dim); }
nav.filters { display: flex; flex-wrap: wrap; gap: 4px; margin: 0 0 10px; }
nav.filters a { padding: 6px 10px; border: 1px solid var(--line); border-radius: 16px; text-decoration: none; min-height: 36px; display: inline-flex; align-items: center; }
nav.filters a.active { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 12px; margin-top: 16px; }
td.msg, p.msg { max-width: 36em; word-break: break-word; }
a.button { display: inline-flex; align-items: center; min-height: 40px; padding: 6px 14px; border-radius: 6px; background: var(--accent); color: var(--on-accent); text-decoration: none; margin: 4px 8px 4px 0; vertical-align: top; }
button.secondary { background: var(--card); color: var(--accent); border-color: var(--line); }
button.mini { min-height: 32px; min-width: 32px; padding: 2px 6px; background: none; color: var(--dim); border: 1px solid var(--line); }
button.mini:hover, button.secondary:hover { border-color: var(--accent); }
.buttons { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 6px 0; }
.actions { margin: 8px 0 12px; }
.steer { display: inline; }
/* The flow page's action bar (§18.7): one row under the facts card, the state's actions first
   (Edit, Enqueue, the steering bar, Continue from a stage), Clone and Delete at its end. An
   action's input sits in its popup (ActionForm); where it renders beside the button instead, it
   is one line with it. */
.flow-actions { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 8px; }
.flow-actions .steer { display: contents; }
.flow-actions .bar-end { display: flex; flex-wrap: wrap; gap: 8px; margin-left: auto; }
.flow-actions form.action, .flow-actions a.button { margin: 0; }
.flow-actions form.action > label.pick { display: inline-flex; align-items: center; gap: 6px; margin: 0 6px 0 0; vertical-align: top; }
.flow-actions form.action > label.pick select { width: auto; margin: 0; }
.flow-actions form.action > .status { margin: 4px 0 0; max-width: 24em; }
.buttons .with-tip { display: inline-flex; align-items: center; }
ul.errors { color: var(--err); margin: 6px 0; padding-left: 1.2em; }
ul.warnings { color: var(--warn-fg); margin: 6px 0; padding-left: 1.2em; }
.note { margin: 4px 0; }
.note.warn { color: var(--warn-fg); background: var(--warn-bg); padding: 4px 8px; border-radius: 4px; }
.note.err, .err { color: var(--err); }
.note.ok { color: var(--ok); }
.note.mod-name { font-weight: 700; color: #6a3fb5; margin-top: 10px; }
.tuned { display: inline-block; margin-left: 6px; padding: 0 6px; border-radius: 4px; background: var(--warn-bg); color: var(--warn-fg); font-size: 0.78em; font-weight: 700; letter-spacing: 0.04em; }
.counts { margin-left: 8px; color: var(--dim); font-size: 0.9em; }

/* Facts */
dl { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; margin: 0; }
dt { color: var(--dim); }
dd { margin: 0; min-width: 0; word-break: break-word; }
p.links a { margin-right: 14px; }
p.stateline span + span::before { content: " · "; color: var(--dim); }
p.board-msg { background: var(--card); border-left: 3px solid var(--accent); padding: 6px 10px; margin: 6px 0; }

/* The inspector */
form.inspector { margin: 0; }
.default-submit { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.ins-bar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; }
.ins-bar h1 { margin: 0.6rem 0; }
.banner-unsaved { background: var(--warn-bg); color: var(--warn-fg); padding: 6px 10px; border-radius: 6px; }
.ins-grid { display: grid; grid-template-columns: minmax(260px, 340px) 1fr; gap: 12px; align-items: start; margin-top: 8px; }
.ins-nodes h2, .ins-node h2 { margin-top: 0.2rem; }
ul.nodes { list-style: none; padding: 0; margin: 0 0 10px; }
ul.nodes li { margin: 0 0 4px; }
button.node { width: 100%; text-align: left; background: var(--card); color: var(--fg); border: 1px solid var(--line); }
ul.nodes li.selected button.node { border-color: var(--accent); box-shadow: inset 3px 0 0 var(--accent); font-weight: 600; }
ul.nodes li.k-origin button.node { color: var(--dim); }
.add-stage .fld { margin-bottom: 4px; }
.sec { margin: 10px 0 14px; }
.sec h3 { font-size: 1rem; margin: 0 0 6px; color: var(--dim); text-transform: uppercase; letter-spacing: 0.05em; }
.sec.mods { border-left: 3px solid #6a3fb5; padding-left: 10px; }
details.cat { border: 1px solid var(--line); border-radius: 6px; padding: 4px 10px; margin: 6px 0; background: var(--card); }
details.cat > summary { cursor: pointer; font-weight: 600; min-height: 36px; display: flex; align-items: center; }
.el h4 { margin: 10px 0 0; font-size: 0.95rem; }
.fld { display: grid; grid-template-columns: 1fr auto; gap: 2px 6px; align-items: end; margin: 6px 0; }
.fld label { margin: 0; }
.fld .lab { display: block; font-size: 0.92em; }
.fld.inh .lab, .fld.inh .val { color: var(--dim); }
.fld.inh input, .fld.inh select { color: var(--dim); }
.fld.set .lab { font-weight: 600; color: var(--fg); }
.fld.set input, .fld.set select { border-color: var(--accent); }
.fld small.doc { grid-column: 1 / -1; color: var(--dim); font-size: 0.8em; }
.fld small.doc code { font-size: 0.95em; }
.fld .val { font-family: var(--mono); }
.fld .tag { font-size: 0.78em; color: var(--dim); }
.stage-card .fld { grid-template-columns: minmax(10em, 16em) 1fr; align-items: baseline; margin: 2px 0; }
.stage-card .fld .lab { font-size: 0.9em; }
.stage-card > summary { cursor: pointer; min-height: 36px; }
ol.chips { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; padding: 0; margin: 6px 0; }
ol.chips li { display: inline-flex; align-items: center; gap: 2px; border: 1px solid var(--line); border-radius: 14px; padding: 2px 4px 2px 10px; background: var(--card); }
ol.chips:not(.own) li span { color: var(--dim); }
.add { display: flex; flex-wrap: wrap; gap: 6px; align-items: end; }
.add .fld { flex: 1 1 14em; margin: 0; }
.buttons.apply { border-top: 1px solid var(--line); padding-top: 10px; margin-top: 12px; }
.card.stale pre, .check pre { white-space: pre-wrap; word-break: break-word; max-height: 24em; overflow: auto; }

/* Check */
.check h3 { margin: 8px 0 4px; font-size: 1rem; }
.check-stage { border-top: 1px solid var(--line); padding: 6px 0; }
.check-stage h4 { margin: 4px 0; }
.check-stage p { margin: 2px 0; }
.check .runs-with code { word-break: break-word; }
.check p.total { border-top: 1px solid var(--line); padding-top: 8px; font-weight: 600; }

/* The graph (SVG) */
.graph-box { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; background: var(--card); padding: 4px; }
svg.flowgraph { display: block; max-width: none; }
svg.flowgraph .g-col { fill: var(--dim); font-size: 11px; }
svg.flowgraph .g-edge { fill: none; stroke: var(--dim); stroke-width: 1.5; }
svg.flowgraph .g-node rect { fill: var(--bg); stroke: var(--line); stroke-width: 1.5; }
svg.flowgraph .g-stage rect { stroke: var(--accent); }
svg.flowgraph .g-asm rect { stroke: #6a3fb5; stroke-dasharray: 5 3; }
svg.flowgraph .g-origin rect { stroke: var(--dim); }
svg.flowgraph .g-pass rect { stroke: var(--ok); stroke-width: 2.5; }
svg.flowgraph .g-fail rect { stroke: var(--err); stroke-width: 2.5; }
svg.flowgraph .g-head { fill: var(--fg); font-size: 13px; font-weight: 700; }
svg.flowgraph .g-line { fill: var(--dim); font-size: 11.5px; }
/* A stage that holds carried lineages (D8): an orange inner ring and their count; the outline keeps
   its pass or fail colour, and the ring keeps its own through hover, selection and focus. */
svg.flowgraph .g-node rect.g-carry-ring,
svg.flowgraph a.g-link:is(:hover, :focus-visible) .g-node rect.g-carry-ring,
svg.flowgraph .g-sel rect.g-carry-ring { fill: none; stroke: var(--carry); stroke-width: 2; stroke-dasharray: none; }
svg.flowgraph .g-carry-n { fill: var(--carry); font-size: 11px; font-weight: 700; text-anchor: end; }
/* The flow page's graph selects (§18.7): each stage and assembly box is a link; the selected one is
   tinted with a thick outline (its pass or fail colour kept), the focused one dashed. */
:root { --g-sel: #e3ecfb; --g-hover: #eef2f8; }
@media (prefers-color-scheme: dark) { :root { --g-sel: #1e2c47; --g-hover: #262c36; } }
svg.flowgraph a.g-link { cursor: pointer; }
svg.flowgraph a.g-link:focus { outline: none; }
svg.flowgraph a.g-link:hover rect { fill: var(--g-hover); }
svg.flowgraph .g-sel rect, svg.flowgraph a.g-link:hover .g-sel rect { fill: var(--g-sel); stroke-width: 4; }
svg.flowgraph a.g-link:focus-visible rect { stroke: var(--fg); stroke-width: 3; stroke-dasharray: 6 3; }
p.sel-note { margin: -4px 0 8px; }

/* Jobs: an execution's outcome as a badge (StateBadge slugs: domain_fail → domainfail) */
.badge.k-execution.s-ok { background: #dff3e4; color: #145a2a; }
.badge.k-execution.s-domainfail, .badge.k-execution.s-specrefused { background: #fbe0de; color: #7a1610; }
.badge.k-execution.s-exception, .badge.k-execution.s-lost, .badge.k-execution.s-hung, .badge.k-execution.s-orphaned,
.badge.k-execution.s-input, .badge.k-execution.s-cancelled, .badge.k-execution.s-drained { background: var(--warn-bg); color: var(--warn-fg); }
p.exec-head { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
form.filter { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; margin: 0 0 8px; }
form.filter label { margin: 0; flex: 0 1 26em; }
.card.exec p { margin: 4px 0; }
form.import textarea { font-family: var(--mono); font-size: 0.85em; }

@media (max-width: 720px) {
  .flow-actions form.action { display: inline-block; }
  .ins-grid { grid-template-columns: 1fr; }
  .stage-card .fld { grid-template-columns: 1fr; }
  dl { grid-template-columns: 1fr; }
  dt { margin-top: 4px; }
}
