/* Plans view, agent tasks and changes panels.
   Contrast: every text colour below is at least 4.5:1 on the surface it sits on (checked in tests/test_web_contrast.py).
   Status is never colour alone: each state also has an icon and a word. */
:root {
  --pl-done: #4CC66A; --pl-run: #6CB6FF; --pl-fail: #FF7B93; --pl-block: #E9C341; --pl-skip: #8A95A0;
  --pl-add: #4CC66A; --pl-upd: #E9C341; --pl-del: #FF7B93;
}

.plans .pad { padding: 16px; }
.pl-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 12px; }
.pl-bar label, .pl-dform label { color: var(--fg-2); font-size: 13px; display: block; margin-top: 10px; }
.pl-bar label { margin: 0; }
.pl-bar select { flex: 1 1 220px; min-width: 0; }
.pl-modes { display: flex; gap: 8px; }
.pl-conn { font: 500 13px/1 var(--font-mono); padding: 6px 10px; border: 1px solid var(--line); border-radius: 999px; color: var(--fg-2); }
.pl-conn[data-s="live"] { color: var(--pl-done); border-color: var(--pl-done); }
.pl-conn[data-s="retry"] { color: var(--pl-block); border-color: var(--pl-block); }
.pl-new { margin-bottom: 12px; }
.pl-new > summary { display: inline-flex; align-items: center; cursor: pointer; list-style: none; }
.pl-new > summary::-webkit-details-marker { display: none; }
.pl-new[open] > summary { margin-bottom: 8px; }
.pl-newform { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 8px; align-items: center; max-width: 900px; }
.pl-newform label { margin: 0; color: var(--fg-2); font-size: 13px; }
.pl-status { min-height: 1.5em; margin: 0 0 8px; color: var(--fg-2); overflow-wrap: anywhere; }
.pl-status.bad, .bad { color: var(--pl-fail); }
.pl-summary { color: var(--fg-2); margin: 0 0 12px; font: 13px/1.4 var(--font-mono); }
.pl-empty { padding: 8px 0; }

.plans input, .plans select, .plans textarea {
  width: 100%; min-height: 44px; padding: 8px 10px; font-size: 16px; color: var(--fg);
  background: var(--surface); border: 1px solid var(--line); border-radius: 6px;
}
.plans textarea { resize: vertical; font-family: var(--font-mono); font-size: 14px; }
.plans input[type="checkbox"] { width: 24px; min-height: 24px; height: 24px; flex: none; accent-color: var(--accent); }
.pl-btn { min-height: 44px; min-width: 44px; padding: 8px 16px; }
.pl-danger { color: var(--pl-fail); border-color: var(--pl-fail); }
.pl-check { display: flex !important; align-items: center; gap: 12px; min-height: 44px; margin-top: 4px !important; color: var(--fg) !important; font-size: 14px !important; }
.pl-parents { border: 1px solid var(--line); border-radius: 6px; padding: 8px 12px; margin: 12px 0 0; }
.pl-parents legend { color: var(--fg-2); font-size: 13px; padding: 0 6px; }
.pl-exit { border-top: 1px solid var(--line); margin-top: 8px; padding-top: 4px; }
.pl-exit:first-of-type { border-top: 0; margin-top: 0; }
.plans .help { color: var(--fg-2); font-size: 13px; margin: 6px 0 0; }
.pl-dform .btn { margin-top: 12px; }
.pl-dmeta { color: var(--fg-2); margin: 0 0 4px; font: 13px/1.4 var(--font-mono); }
.pl-fact { margin: 4px 0; color: var(--pl-block); overflow-wrap: anywhere; }
.pl-acts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
details.sec > summary { cursor: pointer; padding: 12px 16px; min-height: 44px; font-weight: 600; }

.pl-main { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
.pl-canvas, .pl-side { min-width: 0; }
.pl-side > .sec { margin-bottom: 12px; }
.pl-graph { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 6px; overflow: auto; max-height: 72vh; }
.pl-svg { display: block; max-width: none; }   /* drawn 1:1: the type is its real size, a wide plan scrolls inside its frame */

/* graph */
.pl-node { cursor: move; outline: none; touch-action: none; }
.pl-node.dragging { cursor: grabbing; opacity: .85; }
.pl-node.ghost { cursor: default; }
.pl-node rect, .pl-node polygon { fill: var(--surface); stroke: var(--fg-2); stroke-width: 1.5; }
.pl-node.st-completed rect, .pl-node.st-completed polygon { stroke: var(--pl-done); }
.pl-node.st-in_progress rect, .pl-node.st-in_progress polygon { stroke: var(--pl-run); }
.pl-node.st-failed rect, .pl-node.st-failed polygon { stroke: var(--pl-fail); }
.pl-node.st-blocked rect, .pl-node.st-blocked polygon { stroke: var(--pl-block); stroke-dasharray: 6 4; }
.pl-node.st-skipped rect, .pl-node.st-skipped polygon { stroke: var(--pl-skip); stroke-dasharray: 2 4; }
.pl-node.st-skipped .pl-t { fill: var(--fg-3); text-decoration: line-through; }
.pl-node.sel rect, .pl-node.sel polygon { stroke-width: 2.5; stroke: var(--accent); }
.pl-node:focus-visible rect, .pl-node:focus-visible polygon { stroke: var(--accent); stroke-width: 2.5; }
.pl-node.hl-added rect, .pl-node.hl-added polygon { stroke: var(--pl-add); stroke-width: 2.5; }
.pl-node.hl-updated rect, .pl-node.hl-updated polygon { stroke: var(--pl-upd); stroke-width: 2.5; }
.pl-node.hl-removed rect, .pl-node.hl-removed polygon { stroke: var(--pl-del); stroke-width: 2.5; stroke-dasharray: 6 3; }
.pl-node.ghost rect, .pl-node.ghost polygon { stroke-dasharray: 8 4; fill-opacity: .6; }
.pl-node.flash rect, .pl-node.flash polygon { animation: plflash 1s ease-in-out 3; }
.pl-t { fill: var(--fg); font: 500 13px var(--font-sans); pointer-events: none; }
.pl-s { fill: var(--fg-2); font: 400 11px var(--font-mono); pointer-events: none; }
.pl-edge { fill: none; stroke: var(--fg-3); stroke-width: 1.5; }
.pl-edge.dead { stroke-dasharray: 3 5; opacity: .6; }
.pl-edge.ghost { stroke: var(--pl-add); stroke-dasharray: 6 4; }
.pl-edge.hl-removed { stroke: var(--pl-del); stroke-dasharray: 6 4; }
.pl-arrowhead { fill: var(--fg-3); }
@keyframes plflash { 50% { stroke-width: 8; } }

/* the list, which is also what narrow screens get first */
.pl-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.pl-li { border: 1px solid var(--line); border-left-width: 6px; border-radius: 8px; background: var(--surface); }
.pl-li.st-completed { border-left-color: var(--pl-done); } .pl-li.st-in_progress { border-left-color: var(--pl-run); }
.pl-li.st-failed { border-left-color: var(--pl-fail); } .pl-li.st-blocked { border-left-color: var(--pl-block); }
.pl-li.st-skipped { border-left-color: var(--pl-skip); } .pl-li.st-pending { border-left-color: var(--fg-2); }
.pl-li.hl-added { outline: 2px solid var(--pl-add); } .pl-li.hl-updated { outline: 2px solid var(--pl-upd); }
.pl-li.hl-removed { outline: 2px dashed var(--pl-del); }
.pl-li.flash { animation: plglow 1s ease-in-out 3; }
@keyframes plglow { 50% { background: var(--raised); } }
.pl-libtn { display: block; width: 100%; min-height: 44px; padding: 10px 14px; text-align: left; color: var(--fg); }
.pl-libtn.sel { background: var(--raised); }
.pl-li-title { display: block; font-weight: 600; overflow-wrap: anywhere; white-space: pre-line; }
.pl-li-meta, .pl-li-deps { display: block; color: var(--fg-2); font: 12.5px/1.5 var(--font-mono); overflow-wrap: anywhere; }

/* proposals, offers, triage */
.pl-plist { list-style: none; margin: 0; display: grid; gap: 12px; }
.pl-prop { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; background: var(--surface); }
.pl-prop.sel { border-color: var(--accent); }
.pl-ptitle { display: block; min-height: 40px; text-align: left; color: var(--fg); overflow-wrap: anywhere; }
.pl-prat { color: var(--fg-2); margin: 4px 0; overflow-wrap: anywhere; }
.pl-waits { font-weight: 600; }
.pl-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.pl-chip { font: 12.5px/1.3 var(--font-mono); padding: 4px 8px; border-radius: 4px; border: 1px solid; overflow-wrap: anywhere; }
.pl-chip.c-added { color: var(--pl-add); } .pl-chip.c-updated { color: var(--pl-upd); } .pl-chip.c-removed { color: var(--pl-del); }
.pl-tout { margin-top: 12px; }
.pl-tverdict { font-weight: 700; margin: 0 0 6px; }
.pl-tverdict.wake { color: var(--pl-fail); } .pl-tverdict.quiet { color: var(--pl-done); }
.pl-treason { color: var(--fg-2); font: 12.5px/1.4 var(--font-mono); overflow-wrap: anywhere; }

/* agent tasks and changes (Monitor view) */
.chg-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.chg-row { border: 1px solid var(--line); border-left-width: 6px; border-radius: 6px; background: var(--surface); padding: 8px 12px; min-width: 0; }
.chg-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; }
.chg-file { font: 600 13px/1.4 var(--font-mono); overflow-wrap: anywhere; min-width: 0; }
.chg-count { font: 12.5px/1.4 var(--font-mono); color: var(--fg-2); }
.chg-added { border-left-color: var(--pl-add); } .chg-modified { border-left-color: var(--pl-upd); } .chg-deleted { border-left-color: var(--pl-del); }
.chg-row summary { cursor: pointer; min-height: 40px; color: var(--fg-2); padding-top: 4px; }
.chg-diff { margin: 6px 0 0; max-height: 220px; overflow: auto; font: 12.5px/1.5 var(--font-mono); white-space: pre-wrap; overflow-wrap: anywhere; background: var(--panel); padding: 8px; border-radius: 4px; }
.dfl-add { color: var(--pl-add); } .dfl-del { color: var(--pl-del); } .dfl-hunk { color: var(--pl-run); }
.chg-empty { margin: 0; padding: 8px 0; }
.chg-state { margin: 4px 0 0; color: var(--fg-2); overflow-wrap: anywhere; }
.chg-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 6px; }
.chg-block { margin-top: 8px; border-top: 1px solid var(--line); padding-top: 6px; }
.chg-blockhead { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; color: var(--fg-2); font: 12.5px/1.4 var(--font-mono); }
.chg-kept { color: var(--pl-done); font: 600 13px/1.4 var(--font-mono); padding: 0 8px; }
.chg-undo.armed { border-color: var(--pl-del); color: var(--pl-del); }
.chg-note { margin: 6px 0 0; color: var(--pl-fail); overflow-wrap: anywhere; }
.chg-st-reverted .chg-file { text-decoration: line-through; }

@media (max-width: 640px) {
  .pl-newform { grid-template-columns: minmax(0, 1fr); }
  .pl-modes { margin-left: 0; width: 100%; }
  .pl-modes .btn { flex: 1; }
  .plans .pad { padding: 12px; }
}
.pl-modes .btn[aria-pressed="true"] { background: var(--raised); color: var(--fg); }
@media (prefers-reduced-motion: reduce) {
  .pl-node.flash rect, .pl-node.flash polygon, .pl-li.flash { animation: none; }
  .pl-node, .pl-node.dragging { transition: none; }
}

/* history of a plan, and archiving */
.pl-hist { list-style: none; margin: 0; padding: 8px 16px 12px; display: grid; gap: 8px; }
.pl-hist li { display: grid; grid-template-columns: auto auto minmax(0, 1fr); gap: 4px 10px; align-items: baseline; color: var(--fg-2); font-size: 13px; overflow-wrap: anywhere; }
.pl-hist time { font-family: var(--font-mono); font-size: 12px; color: var(--fg-3); }
.pl-actor { font-weight: 600; color: var(--fg); border: 1px solid var(--line); border-radius: 999px; padding: 2px 8px; font-size: 12px; }
.pl-actor.a-chat { color: var(--pl-run); border-color: var(--pl-run); }
.pl-actor.a-planner { color: var(--pl-block); border-color: var(--pl-block); }
.pl-archive-zone { border-top: 1px solid var(--line); }
.pl-archived .pl-prop { margin-top: 8px; }
@media (max-width: 720px) { .pl-hist li { grid-template-columns: minmax(0, 1fr); } }
.pl-manage form { max-width: 760px; }
.pl-horizon form { max-width: 760px; }
.pl-allist { list-style: none; margin: 0 0 10px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.pl-al { padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; overflow-wrap: anywhere; line-height: 1.5; }
.pl-al.conflict { border-color: var(--pl-block); }
.pl-al b { margin-right: 4px; }
.pl-due { margin: 0 0 8px; font-weight: 600; overflow-wrap: anywhere; }
.pl-align .pad .btn, .pl-horizon .btn { min-height: var(--btn-h); }

/* what would stay done if a step is rewound: shown above the step's form until the person confirms or cancels */
.pl-rewind { border: 1px solid var(--pl-block); border-left-width: 6px; border-radius: 6px; padding: 8px 12px; margin-bottom: 12px; background: var(--surface); }
.pl-rw-h { margin: 0 0 4px; color: var(--pl-block); font-weight: 600; overflow-wrap: anywhere; }
.pl-rw-list { margin: 4px 0 8px; padding-left: 20px; overflow-wrap: anywhere; }

/* the page: the column of plans at the left, the open plan at the right in four parts */
#view-plans { display: flex; overflow: hidden; }
.plrow { flex: 1; min-width: 0; min-height: 0; }
.plmain { flex: 1; min-width: 0; min-height: 0; overflow: auto; align-self: stretch; }
.plmain > .sh { gap: 12px; }
.pl-tabs { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 16px 0; }
.plmain > .pl-status, .plmain > .pl-empty { margin: 8px 16px 0; }
.pl-panel { display: flex; flex-direction: column; gap: 12px; padding: 12px 16px 16px; }
.plcol .pl-new { margin: 6px 4px 8px; }
.plcol .pl-newform { grid-template-columns: minmax(0, 1fr); }
.plcol .pl-btn { min-height: var(--btn-h); }
.cv-act { flex: none; min-width: 24px; min-height: 24px; border-radius: 5px; color: var(--fg-3); font: 400 14px/1 var(--font-sans); }
.cv-act:hover { background: var(--raised); color: var(--fg); }
.cv-act.sure { padding: 0 6px; color: #FF8A8A; font-size: 11px; font-weight: 600; }
.pl-bar { align-items: center; margin-bottom: 0; }
.pl-bar .btn, .pl-modes .btn { min-height: var(--btn-h); }
.pl-bar .btn[aria-expanded="true"] { background: var(--raised); color: var(--fg); }

/* the list: a step's row has its own up and down */
.pl-li { display: flex; align-items: stretch; }
.pl-libtn { flex: 1; min-width: 0; width: auto; }
.pl-rowmove { flex: none; display: flex; flex-direction: column; justify-content: center; gap: 4px; padding: 4px 8px; }
.pl-rowbtn { min-height: 28px; min-width: 36px; padding: 2px 8px; }
.pl-rowbtn:disabled { opacity: .4; }

/* the graph: the round ends a link is drawn from, a picked link and the cross that removes it */
.pl-port { fill: var(--panel); stroke: var(--fg-2); stroke-width: 2; cursor: crosshair; }
.pl-port:hover { fill: var(--accent); stroke: var(--accent); }
.pl-node.linktarget rect, .pl-node.linktarget polygon { stroke: var(--accent); stroke-width: 2.5; }
.pl-linking { pointer-events: none; }
.pl-edgehit { fill: none; stroke: transparent; stroke-width: 16; pointer-events: stroke; cursor: pointer; outline: none; }
.pl-edgehit:focus-visible { stroke: var(--accent); stroke-opacity: .35; }
.pl-edgeg:hover .pl-edge, .pl-edge.sel { stroke: var(--accent); stroke-width: 3; }
.pl-x { cursor: pointer; outline: none; }
.pl-x circle { fill: var(--panel); stroke: var(--pl-fail); stroke-width: 2; }
.pl-x text { fill: var(--pl-fail); font: 700 16px var(--font-sans); pointer-events: none; }
.pl-x:focus-visible circle { stroke-width: 2.5; }

/* the kinds of step: the palette, the thing being dragged, the fields of a kind, and how the kinds look on the plan */
.pk { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 6px; }
.pk-fam { margin: 0; min-width: 0; padding: 0 6px 5px; border: 1px solid var(--line); border-radius: 8px; }
.pk-famname { padding: 0 4px; font-size: 10px; line-height: 1; color: var(--fg-2); }
.pk-list { list-style: none; margin: 0; padding: 0; display: flex; gap: 4px; }
.pk-item { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; width: 54px; min-height: 44px; height: 54px; padding: 3px 2px; text-align: center; color: var(--fg); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; cursor: grab; touch-action: manipulation; }
.pk-item:hover { border-color: var(--accent); }
.pk-item:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.pk-icon { flex: none; color: var(--accent); }
.pk-name { max-width: 100%; font-size: 9px; line-height: 1.05; overflow: hidden; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.pk-ghost { position: fixed; left: 0; top: 0; z-index: 1000; display: flex; align-items: center; gap: 6px; padding: 6px 10px; color: var(--fg); background: var(--raised); border: 1px solid var(--accent); border-radius: 8px; pointer-events: none; box-shadow: 0 4px 16px rgba(0, 0, 0, .35); }
.pl-graph.pk-over { outline: 2px dashed var(--accent); outline-offset: -2px; }
.pk-spec { display: grid; gap: 8px; }
.pk-row { display: grid; gap: 4px; }
.pk-row input, .pk-row select, .pk-row textarea { width: 100%; min-height: 40px; padding: 8px 10px; color: var(--fg); background: var(--surface); border: 1px solid var(--line); border-radius: 6px; font-size: 15px; }
.pk-dur { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.pk-row .pk-unit { width: auto; }
.pl-specbox .help { margin: 4px 0; }
.pk-glyph { color: var(--fg-2); }
.pl-node.t-wait_duration rect, .pl-node.t-wait_until rect, .pl-node.t-wait_condition rect { fill: var(--raised); }
.pl-node.t-loop rect { stroke-width: 2; }
.pl-node.t-set_var rect, .pl-node.t-get_var rect, .pl-node.t-output rect, .pl-node.t-log rect, .pl-node.t-input rect { fill: var(--raised); }
@media (max-width: 480px) { .pk-list { flex-wrap: wrap; } }

/* the define tab: the graph holds the properties of the picked step; the kinds and the instruction box are fixed at the bottom, the kinds just above the box */
.pl-canvas { display: flex; align-items: flex-start; gap: 8px; }
.pl-stage { position: relative; flex: 1 1 auto; min-width: 0; }
.pl-detail { flex: 0 0 270px; max-height: 72vh; overflow: auto; font-size: 12px; }
.pl-detail .sh { padding: 4px 8px; min-height: 0; font-size: 12px; }
.pl-detail .pad { padding: 6px 8px; }
.pl-detail .pl-dform label { margin-top: 5px; font-size: 11px; }
.pl-detail input, .pl-detail select, .pl-detail textarea { min-height: 28px; padding: 3px 6px; font-size: 12px; }
.pl-detail .help, .pl-detail .pl-fact, .pl-detail .pl-dmeta { margin: 3px 0; font-size: 11px; line-height: 1.25; }
.pl-detail .btn { min-height: 28px; padding: 2px 8px; font-size: 12px; }
.pl-detail .pl-acts { gap: 4px; margin-top: 6px; }
.pl-detail .pk-row { gap: 2px; }
.pl-detail .pk-row input, .pl-detail .pk-row select, .pl-detail .pk-row textarea { min-height: 28px; padding: 3px 6px; font-size: 12px; }
@media (pointer: coarse) { .pl-detail input, .pl-detail select, .pl-detail textarea, .pl-detail .btn, .pl-detail .pk-row input, .pl-detail .pk-row select { min-height: 44px; } }
@media (max-width: 800px) { .pl-canvas { flex-direction: column; align-items: stretch; } .pl-stage { flex: 0 0 auto; width: 100%; } .pl-detail { flex-basis: auto; width: 100%; max-height: none; } }
.pl-node.draft rect, .pl-node.draft polygon { stroke-dasharray: 5 3; }
.pl-dock { position: sticky; bottom: 0; z-index: 6; margin: 0 -16px -16px; padding: 5px 16px 6px; display: grid; gap: 4px; background: var(--panel); border-top: 1px solid var(--line); }
.pl-dock .pl-instr { margin: 0; padding: 0; border: 0; background: transparent; }
.pl-dock .pl-instr .sh { min-height: 0; padding: 0 2px; font-size: 11px; line-height: 1.1; }
.pl-dock .sc-empty { display: none; }
.pl-dock .sc-note { min-height: 0; font-size: 11px; line-height: 1.1; }
.pl-dock .sc-log { max-height: 96px; }
.pl-dock .sc-form { gap: 6px; }
.pl-dock .sc-form textarea { min-height: 34px; padding: 4px 8px; font-size: 13px; }
.pl-dock .sc-send { min-height: 34px; min-width: 72px; }
@media (pointer: coarse) { .pl-dock .sc-form textarea, .pl-dock .sc-send { min-height: 44px; } }
/* the layout of the whole plan: an icon at the corner of the graph, and the small box it opens */
.pl-autobtn { position: absolute; top: 6px; right: 6px; z-index: 3; display: grid; place-items: center; width: 32px; height: 32px; padding: 0; color: var(--fg-2); background: var(--raised); border: 1px solid var(--line); border-radius: 6px; cursor: pointer; }
.pl-autobtn:hover, .pl-autobtn[aria-expanded="true"] { color: var(--fg); border-color: var(--accent); }
.pl-autobtn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.pl-autobox { position: absolute; top: 44px; right: 6px; z-index: 4; display: grid; gap: 4px; width: min(250px, calc(100% - 12px)); padding: 8px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 6px 20px rgba(0, 0, 0, .35); }
.pl-autobox[hidden] { display: none; }
.pl-autoh { font-size: 12px; }
.pl-autoopt { display: grid; gap: 0; justify-items: start; min-height: 40px; padding: 3px 8px; text-align: left; }
.pl-autoopt.sel { border-color: var(--accent); }
.pl-autoname { font-size: 12px; font-weight: 600; }
.pl-autod { font-size: 10px; color: var(--fg-2); }
.pl-autoacts { display: flex; gap: 6px; margin-top: 4px; }
@media (pointer: coarse) { .pl-autobtn { width: 44px; height: 44px; } .pl-autobox { top: 56px; } .pl-autoopt { min-height: 44px; } }

/* the graph, quiet: titles about 13px, port and branch labels about 11px, connectors 11px dots whose touch area is a larger one that draws nothing */
.pl-t { font: 500 13px var(--font-sans); }
.pl-s { font: 400 11px var(--font-mono); }
.pl-br { fill: var(--fg-2); font: 400 11px var(--font-sans); pointer-events: none; }
.pl-port { stroke-width: 1.5; }
.pl-hit { fill: transparent; stroke: none; pointer-events: all; cursor: crosshair; }
.pl-pg:focus-visible .pl-port { stroke: var(--accent); stroke-width: 3; }
.pl-pg:hover .pl-port { fill: var(--accent); stroke: var(--accent); }
.pl-port.data { fill: var(--surface); stroke: var(--accent); }
.pl-node.t-decision rect { stroke-width: 1.5; }
.pl-node.t-rag rect { fill: var(--raised); stroke-dasharray: 3 3; }
.pl-edge.feed { stroke-dasharray: 4 4; }
.pl-arrowhead.feed { fill: var(--accent); }
@media (prefers-reduced-motion: reduce) { .pl-pg .pl-port { transition: none; } }

/* the editor of the branches of a decision, and the connections list of a step */
.pk-lab { font-weight: 600; font-size: 12px; color: var(--fg-2); }
.pk-brlist { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.pk-branch { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 4px 6px; padding: 6px; border: 1px solid var(--line-soft); border-radius: 8px; align-items: center; }
.pk-brelse { grid-column: 1 / -1; font-size: 12px; color: var(--fg-2); }
.pk-brbtns { grid-column: 1 / -1; display: flex; gap: 6px; justify-content: flex-end; }
.pk-brbtn, .pk-bradd { min-height: 44px; min-width: 44px; }
.pk-brbar { display: flex; flex-wrap: wrap; gap: 6px; }
.pk-brhint { color: var(--fg-2); }
.pl-conn { display: grid; gap: 8px; }
.pl-connrow { display: grid; gap: 4px; padding: 6px 0; border-top: 1px solid var(--line-soft); }
.pl-connlabel { font-size: 12px; font-weight: 600; overflow-wrap: anywhere; }
.pl-connlist { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.pl-connlist li { display: flex; align-items: center; justify-content: space-between; gap: 6px; font-size: 12px; overflow-wrap: anywhere; }
.pl-connx { min-width: 44px; min-height: 44px; }
.pl-connadd { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px; }
.pl-connadd select, .pl-connadd .btn { min-height: 44px; }
.pk-branch > input:first-child { grid-column: 1 / -1; }   /* the label has its own row: the inspector is a narrow column on every screen */

/* a comparison of three terms: each term a source and what it needs, one under the other */
.pk-term { display: grid; gap: 4px; grid-column: 1 / -1; padding: 4px 0; border-top: 1px dashed var(--line-soft); }
.pk-termlab { font-size: 12px; font-weight: 600; color: var(--fg-2); }
.pk-term select, .pk-term input, .pk-term textarea { width: 100%; min-height: 40px; }
@media (pointer: coarse) { .pk-term select, .pk-term input { min-height: 44px; } }

.pl-port.value { fill: var(--surface); stroke: var(--fg-2); }
.pl-edge.feed.dead { opacity: .5; }
.pl-detail .pl-dform select { min-height: 44px; }

/* zoom and pan of the diagram (serve/web/planzoom.js): an open hand over the empty background, a closed one while the middle button (or two fingers) moves it; a finger on the
   frame pans or pinches by itself, so the browser does not scroll the page from there */
.pl-graph { cursor: grab; touch-action: none; overscroll-behavior: contain; }
.pl-graph.pl-panning, .pl-graph.pl-panning * { cursor: grabbing !important; }
.pl-edgehit, .pl-x { cursor: pointer; }
.pl-zoom { display: flex; justify-content: flex-end; gap: 4px; margin-top: 4px; }
.pl-zoom[hidden] { display: none; }
.pl-zb { min-width: 44px; min-height: 44px; padding: 0 10px; color: var(--fg); background: var(--raised); border: 1px solid var(--line); border-radius: 8px; font-size: 16px; font-variant-numeric: tabular-nums; }
.pl-zb:hover:not(:disabled) { border-color: var(--accent); }
.pl-zb:disabled { color: var(--fg-3); cursor: default; }
.pl-zreset { min-width: 64px; }

.pl-selbar { display: contents; }
.pl-zdel { color: var(--err); }
.pl-zoom { flex-wrap: wrap; }

/* ---- the Plans page as a fixed layout: the bar and the tabs at the top never scroll away; the diagram and the inspector are a fixed pane, a third of the window high by default and set with
   the divider under it; everything else is one lower part that scrolls. Space is tight on purpose: a mouse needs less room than a finger (the 44 px targets stay on touch screens). ---- */
body[data-view="plans"] { height: 100vh; height: 100dvh; overflow: hidden; }
body[data-view="plans"] main { padding: 0 8px 6px; }
body[data-view="plans"] .plrow { height: 100%; gap: 8px; }
.plrow > .convs { overflow-y: auto; align-self: stretch; }
.plmain { display: flex; flex-direction: column; overflow: hidden; }
.plmain > .sh { min-height: 34px; padding: 0 12px; }
.pl-tabs { gap: 4px; padding: 6px 10px 0; flex: none; }
.plmain > .pl-status, .plmain > .pl-empty { margin: 4px 12px 0; flex: none; }
.plmain > .pl-status:empty { display: none; }
.pl-panel { flex: 1; min-height: 0; overflow-y: auto; gap: 6px; padding: 6px 10px 8px; }
#pl-panel-define { overflow: hidden; }
#pl-panel-define > .pl-bar { flex: none; gap: 6px 10px; }
#pl-panel-define > .pl-summary { flex: none; margin: 0; font-size: 12px; line-height: 1.3; }
#pl-panel-define > .plinfhost { flex: none; max-height: 40vh; overflow-y: auto; margin: 0; }
.pl-main { display: flex; flex-direction: column; flex: 1; min-height: 0; gap: 0; }
.pl-canvas { flex: none; height: calc(var(--pl-f, 0.3333) * 100vh); height: calc(var(--pl-f, 0.3333) * 100dvh); min-height: 120px; align-items: stretch; }
.pl-stage { display: flex; flex-direction: column; min-height: 0; height: 100%; }
.pl-stage > .pl-graph { flex: 1 1 0; min-height: 0; max-height: none; }
.pl-stage > .pl-list { flex: 1 1 0; min-height: 0; overflow-y: auto; margin: 0; }
.pl-stage > .pl-zoom { flex: none; margin-top: 2px; }
.pl-detail { flex: 0 0 270px; position: static; align-self: stretch; height: 100%; max-height: none; overflow-y: auto; overscroll-behavior: contain; }
.pl-split { flex: none; position: relative; height: 12px; margin: 2px 0; cursor: row-resize; touch-action: none; display: grid; place-items: center; border-radius: 6px; }
.pl-split:hover, .pl-split.dragging, .pl-split:focus-visible { background: var(--raised); }
.pl-grip { width: 56px; height: 4px; border-radius: 2px; background: var(--fg-3); }
.pl-lower { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; display: flex; flex-direction: column; gap: 6px; }
.pl-lower > .pl-dock { margin: auto -10px -8px; position: sticky; bottom: 0; }
.pl-side { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 6px; align-items: start; }
.pl-side > .sec { margin: 0; min-width: 0; }
.pl-side > .sec .sh { min-height: 28px; padding: 0 10px; }
.pl-side > .pl-nothing { grid-column: auto; }
.pl-nothing .sh { min-height: 26px; }
.pl-none { margin-inline-start: 8px; font: 400 12px/1.3 var(--font-sans); color: var(--fg-3); }
.pl-side .pad, .pl-lower .pad { padding: 4px 10px; }
.pl-lower p, .pl-lower ul { margin-block: 2px; }
.pl-panel textarea, .pl-lower textarea { min-height: 0; max-height: 40vh; resize: vertical; line-height: 1.35; padding-block: 4px; }
/* the log lines: left aligned, one line each, close together */
.pl-lower .rl-log, .pl-lower .pl-hist { text-align: left; padding: 2px 8px; min-height: 0; max-height: 220px; }
.pl-lower .rl-card, .pl-lower .rl-entry, .pl-lower .chg-row { margin: 0; padding: 1px 0; border: 0; border-radius: 0; background: transparent; text-align: left; justify-content: flex-start; font: 400 12px/1.35 var(--font-mono); }
.pl-lower .rl-card *, .pl-lower .rl-entry *, .pl-lower .chg-row * { text-align: left; margin-block: 0; }
.pl-lower .rl-card > *, .pl-lower .rl-entry > * { display: inline; margin-inline: 0 8px; }
.pl-lower .rl-tools, .pl-lower .rl-status { padding: 2px 8px; gap: 4px 8px; }
@media (min-width: 801px) and (pointer: coarse) { .pl-split { height: 24px; } }
@media (max-width: 800px) {
  .pl-canvas { flex-direction: column; }
  .pl-detail { flex: none; height: auto; max-height: none; overflow-y: visible; width: 100%; }
  .pl-split { height: 44px; }
  .pl-grip { width: 72px; height: 5px; }
  .pl-side { grid-template-columns: minmax(0, 1fr); }
}
@media (pointer: coarse) { .pl-split { min-height: 44px; } }

/* tighter still where there is a mouse; a phone keeps its tabs on one row that scrolls */
.plcol .cv-body > * { flex: none; }
.plcol .pl-btn { min-height: var(--btn-h); }
.pl-bar .plinf-l { flex-direction: row; align-items: center; margin: 0; }
.pl-bar .plinf-l select { min-width: 0; flex: 0 1 220px; }
@media (pointer: fine) {
  .pl-zb { min-width: 32px; min-height: 28px; padding: 0 8px; font-size: 14px; }
  .pl-zreset { min-width: 52px; }
  .pl-bar .btn, .pl-modes .btn, .pl-bar .plinf-l, .pl-bar select { min-height: 28px; }
  .pl-bar .plinf-l select { min-height: 28px; padding-block: 2px; }
  .plmain .subtab { min-height: 28px; padding: 3px 10px; }
  .pl-lower .btn, .pl-side .btn { min-height: 26px; padding: 2px 10px; }
}
@media (max-width: 800px) {
  .pl-tabs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; }
  .pl-tabs .subtab { font-size: 13px; padding-inline: 8px; white-space: normal; line-height: 1.2; text-align: center; }
  .pl-bar .plinf-l { display: flex; align-items: center; gap: 8px; flex: 1 1 100%; margin: 0; }
  .pl-bar .plinf-l > span { flex: none; font-size: 12.5px; max-width: 42%; }
  .pl-bar .plinf-l select { flex: 1 1 0; min-width: 0; }
  body[data-view="plans"] .plrow { flex-direction: column; }
  body[data-view="plans"] .plrow > .plcol { flex: none; max-height: 40vh; }
  body[data-view="plans"] .plrow > .plcol.shut { max-height: none; }
  #pl-panel-define > .pl-bar { flex-wrap: wrap; gap: 4px 8px; }
  #pl-panel-define > .pl-bar > .grow { display: none; }
}

/* the kinds of step, close above the instruction line */
.pl-dock { padding: 3px 10px 4px; gap: 2px; }
.pl-dock .pk { flex-wrap: wrap; padding-bottom: 2px; }
.pl-dock .pk-fam { flex: none; padding-bottom: 2px; }
@media (pointer: fine) { .pl-dock .pk-item { width: 46px; height: 42px; min-height: 0; } .pl-dock .pk-name { font-size: 8.5px; } }

.plcol .cv-body { display: flex; flex-direction: column; gap: 6px; padding: 4px 8px 8px; align-content: flex-start; }
.plcol .cv-head { min-height: 32px; }
@media (max-width: 800px) {
  body[data-view="plans"] .bar .pal-open, body[data-view="plans"] .bar .model, body[data-view="plans"] .bar .answers { display: none; }
  #pl-panel-define > .pl-summary { display: none; }
}

.pl-lower, .pl-canvas { position: relative; }

/* the history and the run log: one line for each entry, left aligned, close together, the text cut with an ellipsis (the whole line is its tooltip) */
.pl-lower .pl-hist { padding: 2px 8px; gap: 0; text-align: left; max-height: 240px; overflow-y: auto; }
.pl-lower .pl-hist li { display: flex; flex-wrap: nowrap; align-items: baseline; gap: 8px; justify-content: flex-start; text-align: left; font: 400 12px/1.4 var(--font-mono); white-space: nowrap; overflow: hidden; }
.pl-lower .pl-hist li > * { flex: none; min-width: 0; margin: 0; }
.pl-lower .pl-hist li > :last-child { flex: 1 1 0; overflow: hidden; text-overflow: ellipsis; }
.pl-lower .rl-row { flex-wrap: nowrap; justify-content: flex-start; text-align: left; margin: 0; padding: 1px 8px; gap: 8px; font: 400 12px/1.4 var(--font-mono); white-space: nowrap; overflow: hidden; border-left-width: 2px; }
.pl-lower .rl-row > * { flex: none; min-width: 0; margin: 0; text-align: left; }
.pl-lower .rl-row .rl-unit, .pl-lower .rl-row .rl-text { flex: 1 1 0; overflow: hidden; text-overflow: ellipsis; }

/* on and off, and Start plan / Stop plan, at the right of the plan's title */
.plmain > .sh { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.pl-runctl { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.pl-runctl[hidden] { display: none; }
.pl-onoff { font: 600 12px/1 var(--font-mono); padding: 6px 10px; border: 1px solid var(--line); border-radius: 999px; color: var(--fg-2); }
.pl-onoff[data-on="1"] { color: var(--pl-done); border-color: var(--pl-done); }

/* the Parameters tab: a readable column, the groups under their headings, each parameter a label, its explanation, its field and its default */
.pl-params { max-width: 760px; padding-bottom: 8px; }
.pl-par-list { padding: 0 16px; }
.pl-par-group { margin: 14px 0 4px; font: 600 14px/1.3 var(--font-sans); color: var(--fg); border-bottom: 1px solid var(--line); padding-bottom: 4px; }
.pl-par { padding: 8px 0 6px; border-bottom: 1px solid var(--line); }
.pl-par-q { display: block; font: 500 15px/1.4 var(--font-sans); color: var(--fg); }
.pl-par-help { margin: 2px 0 6px; font-size: 13px; line-height: 1.45; color: var(--fg-2); overflow-wrap: anywhere; }
.pl-par input[type="text"], .pl-par input[type="number"], .pl-par textarea, .pl-par select { width: 100%; max-width: 100%; box-sizing: border-box; }
.pl-par textarea { min-height: 44px; resize: vertical; }
.pl-par-two { display: flex; flex-wrap: wrap; gap: 8px; }
.pl-par-two .btn[aria-pressed="true"] { border-color: var(--pl-run); color: var(--fg); background: var(--raised); box-shadow: inset 0 0 0 1px var(--pl-run); }
.pl-par-choice { display: grid; gap: 6px; }
.pl-par-def { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin: 4px 0 0; font-size: 12.5px; color: var(--fg-3); overflow-wrap: anywhere; }
.pl-par-foot { position: sticky; bottom: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; padding: 8px 16px; background: var(--surface); border-top: 1px solid var(--line); }
.pl-par-count { color: var(--fg-2); font-size: 13px; }
.pl-par-msg { margin: 0; font-size: 13px; color: var(--pl-done); }
.pl-par-msg.bad { color: var(--pl-fail); }
@media (pointer: fine) { .pl-par-def .btn { min-height: 28px; padding: 2px 10px; } .pl-par-two .btn { min-height: 32px; } }
