/* The front page's board (board.js): five columns on graph paper, cards as design-tool frames,
   wires as SVG. Colours follow the rules: ink = does it alone, accent = waits for your person,
   hatched = never. Never relies on colour alone: every card also says it in words. */
.bd { position: relative; padding: 14px 14px 16px; min-height: 300px; --bd-vertical: 0; }
.bd-wires { position: absolute; inset: 0; pointer-events: none; overflow: visible; z-index: 0; }
.bd-wires path { fill: none; stroke: rgb(22 21 19 / .26); stroke-width: 1; }
.bd:not(.is-run) .bd-wires path { stroke: rgb(22 21 19 / .4); }
.bd-wires path.lit { stroke: var(--ink); stroke-width: 1.6; }
.bd-wires path.w-forbid { stroke: var(--acc-ink); stroke-dasharray: 4 3; }
.bd-wires path.w-approved { stroke: var(--acc); }
.bd-wires path.w-approved.lit { stroke-width: 2; }

.bd-cols { position: relative; z-index: 1; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 22px; align-items: stretch; }
.bd-col { display: flex; flex-direction: column; min-width: 0; }
.bd-colh { margin: 0 0 8px; display: flex; gap: 6px; align-items: baseline; font: 500 11px/1.3 var(--mono); letter-spacing: .07em; text-transform: uppercase; color: var(--ink-2); }
.bd-colh span { color: var(--acc-ink); }
.bd-stack { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 8px; }
.bd-col.is-empty .bd-stack::before { content: "None in this automation"; font: 500 11.5px var(--mono); color: var(--ink-3); border: 1px dashed var(--rule-2); padding: 10px; }

.bd-card { position: relative; display: flex; flex-direction: column; gap: 2px; width: 100%; min-height: 44px; padding: 6px 9px 7px 11px; text-align: left;
  background: var(--card-bg); border: 1px solid var(--rule-2); border-radius: 2px; color: var(--ink); font: inherit; cursor: pointer;
  transition: background-color .25s, border-color .25s, color .25s; }
.bd-card::before { content: ""; position: absolute; left: -1px; top: -1px; bottom: -1px; width: 4px; background: transparent; }
.bd-card:hover { border-color: var(--ink); }
.bd-card:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; }
.bd-card[aria-expanded=true] { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.bd-card.t-ok::before { background: var(--ink); }
.bd-card.t-wait::before { background: var(--acc); }
.bd-card.t-no::before { background: repeating-linear-gradient(180deg, var(--ink) 0 2px, transparent 2px 5px); }
.bd-card.t-gap { border-style: dashed; background: transparent; }
.bd-kind { display: flex; align-items: center; gap: 5px; font: 500 10.5px/1.3 var(--mono); letter-spacing: .05em; text-transform: uppercase; color: var(--ink-3); }
.bd-ai { padding: 0 3px; border: 1px dashed var(--ink); color: var(--ink); font-weight: 600; letter-spacing: 0; }
.bd-title { font-size: 13px; line-height: 1.28; font-weight: 550; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.bd-sub { font-size: 12px; color: var(--ink-3); }
.bd-rules { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 3px; }
.bd-rules span { padding: 1px 5px; font: 500 10.5px/1.5 var(--mono); border: 1px solid var(--ink); }
.bd-rules .r-ok { background: var(--ink); color: var(--paper); }
.bd-rules .r-wait { background: var(--acc-soft); border-color: var(--acc-ink); color: #7a2207; }
.bd-rules .r-no { background: repeating-linear-gradient(135deg, rgb(22 21 19 / .14) 0 1.5px, transparent 1.5px 5px); color: var(--ink); }
.bd-state { font: 500 11px/1.3 var(--mono); color: var(--ink-2); }
.bd-state:empty { display: none; }
#heroBoard .bd-state { display: block; min-height: 1.3em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* the selection box, as in a design tool */
.bd-sel { position: absolute; inset: -6px; border: 1px solid var(--acc); pointer-events: none; display: none; }
.bd-sel i { position: absolute; width: 7px; height: 7px; background: #fff; border: 1px solid var(--acc); }
.bd-sel i:nth-child(1) { left: -4px; top: -4px; } .bd-sel i:nth-child(2) { right: -4px; top: -4px; }
.bd-sel i:nth-child(3) { left: -4px; bottom: -4px; } .bd-sel i:nth-child(4) { right: -4px; bottom: -4px; }
.bd-sel b { position: absolute; right: 5px; top: 5px; padding: 1px 5px; background: var(--acc-ink); color: #fff; font: 500 10.5px/1.4 var(--mono); white-space: nowrap; }
.bd-sel b:empty { display: none; }
.bd-card.is-sel .bd-sel { display: block; }

/* run states (the hero) */
.bd.is-run .bd-card:not([class*=" s-"]), .bd-card.s-off { background: transparent; border-style: dashed; color: var(--ink-3); }
.bd.is-run .bd-card:not([class*=" s-"]) .bd-ai, .bd-card.s-off .bd-ai { border-color: var(--ink-3); color: var(--ink-3); }
.bd.is-run .bd-card:not([class*=" s-"]) .bd-rules span, .bd-card.s-off .bd-rules span { background: transparent; border-color: var(--ink-3); color: var(--ink-3); }
.bd-card.s-on { border-color: var(--ink); }
.bd-card.s-done .bd-state::before { content: "✓ "; }
.bd-card.s-held { border: 1px dashed var(--acc-ink); }
.bd-card.s-wait { background: var(--acc-soft); border-color: var(--acc-ink); }
.bd-card.s-approved { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.bd-card.s-approved .bd-kind, .bd-card.s-approved .bd-sub, .bd-card.s-approved .bd-state { color: #d9d4c9; }
.bd-card.s-sent { border: 1.5px solid var(--ink); }
.bd-card.s-sent .bd-state::before { content: "→ "; }

/* a step's details */
.bd-detail { position: absolute; z-index: 8; top: 12px; right: 12px; width: min(360px, calc(100% - 24px)); max-height: calc(100% - 24px); overflow: auto;
  background: var(--card-bg); border: 1px solid var(--ink); padding: 12px 14px 14px; box-shadow: 0 18px 40px -28px rgb(22 21 19 / .7); }
.bd.detail-left .bd-detail { right: auto; left: 12px; }
.bd-detail[hidden] { display: none; }
.bd-dh { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.bd-dk { margin: 10px 0 0; font: 500 11px/1.3 var(--mono); letter-spacing: .07em; text-transform: uppercase; color: var(--ink-3); }
.bd-dh .bd-dk { margin: 0; }
.bd-x { width: 44px; height: 44px; margin: -8px -10px -8px 0; display: grid; place-items: center; border: 0; background: transparent; color: var(--ink); cursor: pointer; }
.bd-x .ic { width: 18px; height: 18px; }
.bd-detail h4 { margin: 2px 0 0; font: 600 16px/1.3 var(--sans); }
.bd-detail p { margin: 8px 0 0; font-size: 14px; line-height: 1.5; color: var(--ink-2); }
.bd-facts { margin: 10px 0 0; display: grid; gap: 4px; font-size: 13.5px; }
.bd-facts div { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 8px; }
.bd-facts dt { font: 500 11.5px/1.6 var(--mono); color: var(--ink-3); }
.bd-facts dd { margin: 0; }
.bd-dl { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 6px; font-size: 13.5px; line-height: 1.45; }
.bd-dl li { padding-left: 10px; border-left: 3px solid var(--ink); }
.bd-dl li.wait { border-left-color: var(--acc); }
.bd-dl li.no { border-left: 3px solid transparent; border-image: repeating-linear-gradient(180deg, var(--ink) 0 2px, transparent 2px 5px) 3; }
.bd-dl li.if { border-left-color: var(--rule-2); }
.bd-dl li span { color: var(--ink-3); }
.bd-q { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 6px; font-size: 13.5px; line-height: 1.45; }
.bd-q .mono { color: var(--acc-ink); font-size: 11.5px; margin-right: 4px; }
.bd-src { margin-top: 12px !important; font-size: 11px !important; color: var(--ink-3) !important; overflow-wrap: anywhere; }

/* phones: the graph becomes a vertical list of its five stages */
@media (max-width: 760px) {
  .bd { --bd-vertical: 1; padding: 14px 10px 16px; min-height: 0; }
  .bd-wires { display: none; }
  .bd-cols { grid-template-columns: 1fr; gap: 0; }
  .bd-col { padding: 10px 0 14px 14px; border-left: 1px solid var(--ink); position: relative; }
  .bd-col::before { content: ""; position: absolute; left: -5px; top: 12px; width: 9px; height: 9px; background: var(--paper); border: 1px solid var(--ink); }
  .bd-col:last-child { border-left-color: transparent; }
  .bd-colh { margin-bottom: 8px; }
  .bd-stack { gap: 8px; }
  .bd-title { -webkit-line-clamp: 4; font-size: 14px; }
  .bd.detail-left .bd-detail { left: 0; }
  .bd-detail { position: fixed; top: auto; left: 0; right: 0; bottom: 0; width: auto; max-height: 62vh; border-width: 1px 0 0; z-index: 40; }
}
@media (prefers-reduced-motion: reduce) {
  .bd-card { transition: none; }
}
