:root {
  --bg: #f6f5f2;
  --panel: #ffffff;
  --line: #e3e0d9;
  --text: #1f1e1b;
  --muted: #6d6a62;
  --accent: #2f5fd0;
  --accent-soft: #e6edfb;
  --ok: #2c7a4b;
  --ok-soft: #e3f3e9;
  --warn: #a35a00;
  --warn-soft: #fbefd9;
  --bad: #b3312b;
  --bad-soft: #fbe6e4;
  --closed: #8a877f;
  --closed-soft: #eceae5;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161614;
    --panel: #1f1f1c;
    --line: #34332e;
    --text: #ecebe6;
    --muted: #a09d94;
    --accent: #8fb0ff;
    --accent-soft: #232c45;
    --ok: #7fd3a0;
    --ok-soft: #1c3226;
    --warn: #f0b765;
    --warn-soft: #3a2c14;
    --bad: #f08a84;
    --bad-soft: #3d1f1d;
    --closed: #8f8c84;
    --closed-soft: #2a2925;
  }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 20px; margin: 0 0 4px; }
h2 { font-size: 14px; margin: 0; }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 12px; }

#nav {
  position: sticky; top: 0; height: 100vh;
  padding: 16px 10px;
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 2px;
}
#nav .brand { font-weight: 700; font-size: 16px; padding: 4px 10px 14px; }
#nav a { padding: 7px 10px; border-radius: 6px; color: var(--text); display: flex; justify-content: space-between; align-items: center; }
#nav a:hover { background: var(--line); text-decoration: none; }
#nav a.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.count { background: var(--accent); color: var(--panel); border-radius: 10px; padding: 0 7px; font-size: 12px; font-weight: 600; }

#main { padding: 24px 28px 60px; max-width: 1100px; width: 100%; }
.page-head { margin-bottom: 18px; }

.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 14px; align-items: start; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.card > header { padding: 11px 14px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.card > header .n { color: var(--muted); font-size: 12px; }
/* A section that is one line until it is asked for. */
details.fold > summary { padding: 11px 14px; display: flex; align-items: baseline; gap: 10px; cursor: pointer; list-style: none; }
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary::before { content: "\25B8"; color: var(--muted); }
details.fold[open] > summary::before { content: "\25BE"; }
details.fold[open] > summary { border-bottom: 1px solid var(--line); }
details.fold > summary .n { color: var(--muted); font-size: 12px; }
.fold-bar { padding: 10px 14px 0; }
.fold-bar.usage-sums { padding-bottom: 10px; border-bottom: 1px solid var(--line); gap: 18px; }
.fold-bar .switch button { padding: 3px 10px; font-size: 12.5px; }
#around svg.graph { height: 520px; }
.card .empty, .card .error { padding: 14px; color: var(--muted); }
.card .error { color: var(--bad); }
.card.wide { grid-column: 1 / -1; }

.rows { list-style: none; margin: 0; padding: 0; }
.rows > li { padding: 9px 14px; border-bottom: 1px solid var(--line); }
.rows > li:last-child { border-bottom: 0; }
.row-top { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.row-sub { margin-top: 3px; color: var(--muted); font-size: 12.5px; }
.grow { flex: 1; min-width: 0; }

.chip { font-size: 11px; padding: 1px 7px; border-radius: 10px; background: var(--closed-soft); color: var(--muted); white-space: nowrap; }
.pill { font-size: 11px; padding: 1px 7px; border-radius: 10px; white-space: nowrap; background: var(--accent-soft); color: var(--accent); }
.pill.closed { background: var(--closed-soft); color: var(--closed); }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }

button, select, input[type="text"], input[type="search"] {
  font: inherit; color: var(--text);
  background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 5px 10px;
}
button { cursor: pointer; }
button:hover { border-color: var(--muted); }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--panel); font-weight: 600; }
button.danger { color: var(--bad); }
button:disabled { opacity: 0.5; cursor: default; }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

dialog.ask { width: min(460px, calc(100vw - 32px)); padding: 0; color: var(--text); background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 30px rgb(0 0 0 / 0.25); }
dialog.ask::backdrop { background: rgb(0 0 0 / 0.35); }
dialog.ask form { display: grid; gap: 10px; padding: 16px; }
dialog.ask .ask-message { color: var(--muted); white-space: pre-wrap; overflow-wrap: anywhere; }
dialog.ask textarea { width: 100%; }
dialog.ask .toolbar { justify-content: flex-end; margin-top: 4px; }

#stale { position: fixed; right: 16px; bottom: 16px; z-index: 5; display: flex; gap: 10px; align-items: center; padding: 8px 8px 8px 14px; background: var(--panel); border: 1px solid var(--accent); border-radius: 10px; box-shadow: 0 4px 14px rgb(0 0 0 / 0.18); }
#stale[hidden] { display: none; }

/* Roadmap */
.tree { list-style: none; margin: 0; padding: 0; }
.tree .tree { margin-left: 26px; border-left: 2px solid var(--line); }
.tree > li { border-bottom: 1px solid var(--line); }
.tree > li:last-child { border-bottom: 0; }
.tree > li.active > details > summary { box-shadow: inset 3px 0 0 var(--warn); }
.tree summary { display: flex; gap: 10px; align-items: center; padding: 9px 14px; cursor: pointer; list-style: none; }
.tree summary::-webkit-details-marker { display: none; }
.tree summary::before { content: "▸"; color: var(--muted); width: 10px; }
.tree details[open] > summary::before { content: "▾"; }
.tree .place { min-width: 18px; text-align: right; font-variant-numeric: tabular-nums; }
.tree .moves { display: flex; gap: 2px; }
.tree .moves button { padding: 1px 7px; }
.tree .work { margin-left: 26px; border-left: 2px solid var(--line); }
.tree details > .empty { padding: 8px 14px 12px 40px; font-size: 12.5px; }
.rows > li.finished a { color: var(--muted); }
.rows > li.row-top > select { flex: none; width: 170px; }
.rows > li.row-top > .grow { flex-basis: 220px; }
.progress { display: inline-flex; gap: 6px; align-items: center; white-space: nowrap; }
.progress .bar { width: 90px; height: 6px; border-radius: 3px; background: var(--closed-soft); overflow: hidden; }
.progress .bar > span { display: block; height: 100%; background: var(--ok); }

.switch { display: inline-flex; }
.switch button { border-radius: 0; margin-left: -1px; }
.switch button:first-child { border-radius: 6px 0 0 6px; margin-left: 0; }
.switch button:last-child { border-radius: 0 6px 6px 0; }
.switch button.on { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); position: relative; font-weight: 600; }
.roadmap-graph { overflow: auto; scrollbar-color: var(--line) transparent; }
.roadmap-graph svg { display: block; }
.rm-link { fill: none; stroke: var(--edge); stroke-width: 1.5; }
.rm-dep { fill: none; stroke: var(--edge-strong); stroke-width: 1.7; }
.rm-dep.waiting { stroke: var(--g-blocked); }
.rm-dep.lifted { stroke-dasharray: 5 4; }
.rm-arrowhead { fill: var(--edge-strong); }
.rm-arrowhead.wait { fill: var(--g-blocked); }
.rm-node { cursor: pointer; }
.rm-node text { fill: var(--text); font-size: 12.5px; }
.rm-node text.small { fill: var(--muted); font-size: 11px; }
.rm-node .box { fill: var(--panel); stroke: var(--line); stroke-width: 1.2; }
.rm-node:hover .box { stroke: var(--muted); }
.rm-node.root .box { fill: var(--accent-soft); stroke: var(--accent); }
.rm-node.closed .box { fill: var(--ok-soft); stroke: var(--ok); }
.rm-node.active .box { stroke: var(--warn); stroke-width: 2.5; }
.rm-node .track { fill: var(--closed-soft); }
.rm-node .fill { fill: var(--ok); }
.rm-node .flag { fill: var(--g-blocked); }
/* The one graph. */
.graph-view.full { position: fixed; inset: 0; z-index: 40; background: var(--panel); display: flex; flex-direction: column; }
.graph-view.full > .fold-bar { padding: 12px 16px; border-bottom: 1px solid var(--line); align-items: center; }
.graph-view.full .graph-title { font-size: 15px; margin-right: 6px; }
.graph-view.full > .graph-body { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.graph-view.full .graph-scroll { flex: 1; max-height: none; }
.graph-scroll { overflow: auto; max-height: 620px; scrollbar-color: var(--line) transparent; }
.graph-scroll svg { display: block; touch-action: none; user-select: none; }
.rm-link.other { stroke-dasharray: 2 4; }
.g-node { cursor: grab; }
.g-node .stripe { fill: var(--g-system); }
.g-node.group-people .stripe { fill: var(--g-people); } .g-node.group-work .stripe { fill: var(--g-work); }
.g-node.group-knowledge .stripe { fill: var(--g-knowledge); } .g-node.group-problems .stripe { fill: var(--g-problems); }
.g-node.group-time .stripe { fill: var(--g-time); } .g-node.group-resources .stripe { fill: var(--g-resources); }
.g-node.root .box { stroke-width: 2; }
/* Under the pointer a box is a little brighter; nothing else changes. */
.g-node:hover { filter: brightness(1.2); }
.g-node:hover .box { stroke: var(--text); }
/* On the scale of tokens. One colour for one meaning, and none used twice: green is used, amber is over the
   estimate, blue is being worked on, red is blocked or waiting, grey is still to come. Nothing is dashed. */
.g-axis line { stroke: var(--line); stroke-width: 1; }
.g-axis text { fill: var(--muted); font-size: 11px; }
.g-node.bar { cursor: pointer; }
.g-node.bar .box, .g-node.bar.root .box, .g-node.bar.closed .box { fill: var(--panel); stroke: var(--muted); stroke-width: 1; }
.g-node.bar.root text:not(.small) { font-weight: 600; }
.g-node.bar .used { fill: var(--ok); opacity: 0.7; pointer-events: none; }
.g-node.bar .over { fill: var(--warn); opacity: 0.9; pointer-events: none; }
.g-node.bar.guess .box { stroke: var(--line); }
.g-node.bar.guess .used { opacity: 0.35; }
.g-node.bar.active .box { stroke: var(--accent); stroke-width: 2.5; }
.g-node.bar.loose .box { fill: none; }
.g-node.bar:not(.loose):not(.gate) .box { fill: color-mix(in srgb, var(--muted) 16%, var(--panel)); }
.rm-dep.step { stroke-width: 1.2; opacity: 0.85; }
.g-node.bar.gate .box { fill: var(--muted); stroke: none; }
.g-node.bar.gate.closed .box { fill: var(--ok); }
.g-node.bar.gate.blocked .box { fill: var(--g-blocked); }
.g-node.bar.gate text:not(.small) { fill: var(--muted); }
.legend .swatch.g-gate { background: var(--muted); border-radius: 0; width: 8px; height: 8px; transform: rotate(45deg); }
.legend .swatch.g-est { border: 1px solid var(--muted); border-radius: 3px; width: 16px; }
.legend .swatch.g-used { background: var(--ok); opacity: 0.7; border-radius: 3px; width: 16px; }
.legend .swatch.g-over { background: var(--warn); border-radius: 3px; width: 16px; }
.legend .swatch.g-guess { background: var(--ok); opacity: 0.3; border: 1px solid var(--line); border-radius: 3px; width: 16px; }
.legend .swatch.g-active { border: 2.5px solid var(--accent); border-radius: 3px; width: 16px; }
/* A line to what is not on the scale is there to be found, not to be read past. */
.rm-link.faint { opacity: 0.22; }
.legend .stroke.dotted { border-top: 1.5px dotted var(--edge); }
.rm-node.work circle { fill: var(--muted); }
.rm-node.work.closed circle { fill: var(--ok); }
.rm-node.work.closed text { fill: var(--muted); }
.rm-node.work.active circle { fill: var(--warn); stroke: var(--warn); stroke-width: 3; stroke-opacity: 0.35; }
.rm-node.work.blocked circle { fill: var(--g-blocked); }

/* Questions */
.rows > li.question { padding: 14px; display: grid; gap: 8px; }
.question .row-sub { margin-top: 0; }
.question-body { color: var(--muted); white-space: pre-wrap; overflow-wrap: anywhere; max-width: 80ch; }
.question .options button.on { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); font-weight: 600; }
.question .option-new { width: 150px; border-style: dashed; }

/* Review */
.proposal { margin-bottom: 18px; }
.proposal .meta { padding: 12px 14px; border-bottom: 1px solid var(--line); display: grid; gap: 4px; }
.proposal .warning { color: var(--warn); }
.proposal .actions { padding: 12px 14px; border-top: 1px solid var(--line); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.ops { width: 100%; border-collapse: collapse; }
.ops th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); padding: 7px 8px; border-bottom: 1px solid var(--line); background: var(--bg); }
.ops td { padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.ops tr.off td { opacity: 0.4; }
.ops tr.off input[type="text"] { text-decoration: line-through; }
.ops td.check { width: 28px; }
.ops td.kind { width: 150px; white-space: nowrap; }
.ops td.status { width: 170px; }
.ops input[type="text"] { width: 100%; border-color: transparent; background: transparent; padding: 2px 4px; font-weight: 500; }
.ops input[type="text"]:hover, .ops input[type="text"]:focus { border-color: var(--line); background: var(--panel); }
.ops select { padding: 2px 4px; max-width: 160px; }
.ops .edited { box-shadow: inset 2px 0 0 var(--warn); }
.ops .detail { color: var(--muted); font-size: 12.5px; margin-top: 2px; white-space: pre-wrap; }
.ops details.more { margin-top: 2px; }
.ops details.more > summary { cursor: pointer; list-style: none; color: var(--muted); font-size: 12.5px; }
.ops details.more > summary::-webkit-details-marker { display: none; }
.ops details.more > summary::before { content: "▸ "; }
.ops details.more[open] > summary::before { content: "▾ Hide"; }
.ops details.more[open] .preview { display: none; }
.group-head td { background: var(--bg); font-weight: 600; font-size: 12px; }
.arrow { color: var(--muted); }

/* Entity */
.fields { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 6px 14px; padding: 14px; }
.fields dt { color: var(--muted); }
.fields dd { margin: 0; overflow-wrap: anywhere; min-width: 0; max-width: 72ch; }
.fields details.long > summary { cursor: pointer; list-style: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fields details.long > summary::-webkit-details-marker { display: none; }
.fields details.long > summary::after { content: " \2026"; color: var(--muted); }
.fields details.long[open] > summary { display: none; }
.body-text { padding: 14px; white-space: pre-wrap; border-top: 1px solid var(--line); }

table.list { width: 100%; border-collapse: collapse; }
table.list td, table.list th { padding: 7px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
table.list th { font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
table.list tr:last-child td { border-bottom: 0; }
table.list td.act { width: 1%; white-space: nowrap; text-align: right; }
.add-relation { border-top: 1px solid var(--line); }
.add-relation > .toolbar { padding: 12px 14px; }
.add-relation input[type="search"] { flex: 1; min-width: 180px; }
.add-relation .rows { border-top: 1px solid var(--line); }
.add-relation .rows > li { align-items: center; }
.nowrap { white-space: nowrap; }
/* Activity is many small tables; fixed columns keep them aligned. */
table.events { table-layout: fixed; }
table.events td { overflow: hidden; text-overflow: ellipsis; }
table.events td:nth-child(1) { width: 84px; }
table.events td:nth-child(2) { width: 110px; }
table.events td:nth-child(3) { width: 96px; }
table.events td:last-child { white-space: nowrap; }

details.group > summary { padding: 9px 14px; cursor: pointer; border-bottom: 1px solid var(--line); list-style: none; display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
details.group > summary::-webkit-details-marker { display: none; }
details.group > summary::before { content: "▸"; color: var(--muted); }
details.group[open] > summary::before { content: "▾"; }
details.group .inner { background: var(--bg); }

/* One change, one line: who, the point, what it did, on whose word, when. Nothing wraps; what is cut is in the tooltip and in the opened row. */
details.change > summary, .change.line { flex-wrap: nowrap; align-items: center; gap: 10px; }
.change.line { display: flex; padding: 9px 14px; border-bottom: 1px solid var(--line); }
.change.line.quiet { opacity: 0.6; }
.change.line > .gist strong { font-weight: 600; }
details.change > summary > *, .change.line > * { flex: none; white-space: nowrap; }
details.change > summary > .gist, .change.line > .gist { flex: 1 1 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
details.change > summary > .gist strong { font-weight: 600; }
details.change.quiet > summary { opacity: 0.6; }
/* What an agent did since the owner last looked. */
.change.line.fresh { box-shadow: inset 3px 0 0 var(--accent); }
/* A change the owner has been told about, until it is opened. */
details.change.attn > summary, .change.line.attn { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
details.change .reason { margin: 0; padding: 10px 14px 0; max-width: 72ch; line-height: 1.5; }
details.change .reason + table, details.change .reason + .reason { margin-top: 0; }
details.change .inner > table { margin-top: 8px; }
details.folded > summary { padding: 9px 14px; cursor: pointer; color: var(--muted); font-size: 12.5px; list-style: none; }
details.folded > summary::-webkit-details-marker { display: none; }
details.folded > summary::before { content: "\25B8  "; }
details.folded[open] > summary::before { content: "\25BE  "; }
.who { font-weight: 600; min-width: 64px; }
.who::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 7px; background: var(--g-system); }
.who-human::before { background: var(--ok); }
.who-github::before { background: var(--muted); }
.ago { color: var(--muted); font-size: 12px; min-width: 56px; text-align: right; }
.mark { font-size: 11px; padding: 1px 7px; border-radius: 10px; border: 1px solid var(--line); color: var(--muted); }
.mark-human { border-color: var(--ok); color: var(--ok); }
.mark-none { border-style: dashed; }
.effect { font-size: 12px; }
button.quiet-button { padding: 2px 9px; font-size: 12px; }

@media (max-width: 720px) {
  body { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  #nav { align-items: center; position: static; height: auto; flex-direction: row; flex-wrap: wrap; border-right: 0; border-bottom: 1px solid var(--line); }
  #nav .brand { padding: 4px 10px; }
  #main { padding: 16px; }
  .ops td.kind { width: auto; }
}

/* Forms */
.form .fields { grid-template-columns: 150px minmax(0, 1fr); align-items: start; }
.form .fields dt { padding-top: 6px; }
.form input[type="text"], .form input[type="number"], .form input[type="date"], .form textarea { width: 100%; }
.form select { min-width: 180px; }
textarea, input[type="number"], input[type="date"] { font: inherit; color: var(--text); background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 5px 10px; }
textarea { resize: vertical; }
.form .actions { padding: 12px 14px; border-top: 1px solid var(--line); display: flex; gap: 8px; }
.row-sub.error { color: var(--bad); }

/* Graph. Group colours are the dataviz reference palette, slots 1-7, validated
   for colour-blind separation on these surfaces in each theme. */
:root {
  --g-people: #2a78d6; --g-work: #eb6834; --g-knowledge: #1baf7a; --g-problems: #eda100;
  --g-time: #e87ba4; --g-resources: #008300; --g-system: #4a3aa7; --g-blocked: #d03b3b;
  --edge: #b9b5aa; --edge-strong: #5f5c55;
}
@media (prefers-color-scheme: dark) {
  :root {
    --g-people: #3987e5; --g-work: #d95926; --g-knowledge: #199e70; --g-problems: #c98500;
    --g-time: #d55181; --g-resources: #008300; --g-system: #9085e9; --g-blocked: #d03b3b;
    --edge: #55534c; --edge-strong: #b5b2a8;
  }
}
.graph-card { position: relative; }
svg.graph { display: block; width: 100%; height: calc(100vh - 215px); min-height: 380px; touch-action: none; cursor: grab; user-select: none; }
svg.graph .edge { stroke: var(--edge); stroke-width: 1.25; }
svg.graph .edge.blocking { stroke: var(--edge-strong); stroke-width: 1.75; }
svg.graph .edge-hit { stroke: transparent; stroke-width: 12; }
svg.graph .arrowhead { fill: context-stroke; }
svg.graph .node { cursor: pointer; }
svg.graph .dot { stroke: var(--panel); stroke-width: 2; }
svg.graph .closed .dot { fill: var(--panel) !important; stroke-width: 2.5; }
svg.graph .blocked-ring { fill: none; stroke: var(--g-blocked); stroke-width: 2; stroke-dasharray: 3 2; }
svg.graph .focus .dot { stroke: var(--text); stroke-width: 2.5; }
svg.graph .label { font-size: calc(12.5px / var(--k, 1)); fill: var(--text); paint-order: stroke; stroke: var(--panel); stroke-width: calc(3px / var(--k, 1)); pointer-events: none; }
svg.graph .label.quiet { display: none; }
svg.graph .node.near .label.quiet { display: block; }
svg.graph .dim { opacity: 0.18; }
.group-people .dot, .swatch.group-people { fill: var(--g-people); background: var(--g-people); }
.group-work .dot, .swatch.group-work { fill: var(--g-work); background: var(--g-work); }
.group-knowledge .dot, .swatch.group-knowledge { fill: var(--g-knowledge); background: var(--g-knowledge); }
.group-problems .dot, .swatch.group-problems { fill: var(--g-problems); background: var(--g-problems); }
.group-time .dot, .swatch.group-time { fill: var(--g-time); background: var(--g-time); }
.group-resources .dot, .swatch.group-resources { fill: var(--g-resources); background: var(--g-resources); }
.group-system .dot, .swatch.group-system { fill: var(--g-system); background: var(--g-system); }
.closed.group-people .dot { stroke: var(--g-people); } .closed.group-work .dot { stroke: var(--g-work); }
.closed.group-knowledge .dot { stroke: var(--g-knowledge); } .closed.group-problems .dot { stroke: var(--g-problems); }
.closed.group-time .dot { stroke: var(--g-time); } .closed.group-resources .dot { stroke: var(--g-resources); }
.closed.group-system .dot { stroke: var(--g-system); }
.graph-tip { position: absolute; max-width: 250px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; box-shadow: 0 4px 14px rgb(0 0 0 / 0.18); pointer-events: none; display: grid; gap: 4px; z-index: 2; }
.graph-tip[hidden] { display: none; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; padding: 10px 14px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); }
.legend .key { display: inline-flex; align-items: center; gap: 6px; }
.legend .swatch { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.legend .swatch.hollow { border: 2px solid var(--muted); }
.legend .swatch.ringed { border: 2px dashed var(--g-blocked); }
.legend .stroke { width: 18px; border-top: 1.5px solid var(--edge); display: inline-block; }
.legend .stroke.blocking { border-top: 2px solid var(--edge-strong); }

#listening { margin-top: auto; padding: 4px 10px 0; color: var(--ok); font-size: 12.5px; }
#listening::before { content: "● "; }
#listening[hidden] { display: none; }
#listening:not([hidden]) + #follow { margin-top: 0; }
#follow { margin-top: auto; padding: 8px 10px; display: flex; gap: 6px; align-items: center; color: var(--muted); font-size: 12.5px; cursor: pointer; }
#follow + #whoami { margin-top: 0; }
#followed { position: fixed; left: 50%; transform: translateX(-50%); bottom: 16px; z-index: 6; display: flex; gap: 10px; align-items: center; max-width: min(720px, calc(100vw - 32px)); padding: 8px 8px 8px 14px; background: var(--panel); border: 1px solid var(--warn); border-radius: 10px; box-shadow: 0 4px 14px rgb(0 0 0 / 0.18); }
#followed[hidden] { display: none; }
#followed > * { flex: none; white-space: nowrap; }
#followed > .grow { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; color: var(--muted); }
#nav .brand .workspace-name { font-weight: 600; font-size: 12.5px; color: var(--accent); margin-top: 2px; overflow-wrap: anywhere; }
#whoami select { width: 100%; padding: 3px 6px; margin: 2px 0; }
#whoami { margin-top: auto; padding: 10px; border-top: 1px solid var(--line); display: grid; gap: 2px; }
#whoami:empty { display: none; }

.secret { margin: 0 0 14px; padding: 12px 14px; border: 1px solid var(--warn); background: var(--warn-soft); border-radius: 10px; display: grid; gap: 8px; }
.secret code { font: 13px/1.4 ui-monospace, Consolas, monospace; overflow-wrap: anywhere; user-select: all; }
.legend .swatch.rm-active { border: 2.5px solid var(--warn); border-radius: 3px; }
.legend .swatch.rm-closed { background: var(--ok-soft); border: 1.5px solid var(--ok); border-radius: 3px; }
.legend .swatch.rm-blocked { background: var(--g-blocked); }
.legend .stroke.waits { border-top: 2px solid var(--g-blocked); }
.legend .stroke.lifted { border-top: 2px dashed var(--edge-strong); }

/* Today: one column of what needs the owner, then counts for the rest. */
.inbox { display: grid; gap: 14px; max-width: 980px; }
.drawer { max-width: 980px; }
.project > header { gap: 12px; flex-wrap: wrap; justify-content: flex-start; }
.project > header h2 { margin-right: auto; }
.project > header > a { font-weight: 400; font-size: 13px; }
.project .now { padding: 8px 14px 0; margin: 0; }
.sub { padding: 10px 14px 2px; font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.strip { margin: 18px 0 12px; flex-wrap: wrap; }
.strip button:disabled { opacity: 0.5; cursor: default; }
.page-head { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.page-head > h1, .page-head > p { margin: 0; }
.question-more { display: grid; gap: 8px; }
.question-more[hidden], .question .row-sub[hidden] { display: none; }
.rows > li.question { padding: 9px 14px; gap: 6px; }
.project-body { padding: 12px 14px; display: grid; gap: 8px; }

/* Home's cards: a name, a bar, and short plain lists. */
.project > header { border-bottom: 0; padding-bottom: 6px; }
.project .rows > li { border-bottom: 0; padding: 4px 14px; }
.project .rows > li.question { padding: 4px 14px; }
.project .rows > li.more { padding: 0 14px 6px; }
.project .rows { padding-bottom: 6px; }
.project .sub { padding-top: 8px; }
.project .sub a { color: inherit; }
button.quiet { border: 0; background: none; padding: 0; color: var(--muted); font-size: 12.5px; cursor: pointer; }
button.quiet:hover { color: var(--accent); text-decoration: underline; }
.project .question > .row-top > button { padding: 1px 9px; font-size: 12px; }
.project .rows > li > .row-top > button { padding: 1px 9px; font-size: 12px; }

/* The item page: facts to glance at in one row, the note as a page at a readable width, rare actions in a menu. */
.toolbar.facts { margin-bottom: 14px; gap: 10px; }
.fact { font-size: 12.5px; white-space: nowrap; }
.mark-old { border-color: var(--warn); color: var(--warn); }
details.menu { position: relative; }
details.menu > summary { list-style: none; cursor: pointer; padding: 5px 11px; border: 1px solid var(--line); border-radius: 7px; background: var(--panel); }
details.menu > summary::-webkit-details-marker { display: none; }
details.menu > .menu-items { position: absolute; right: 0; top: calc(100% + 4px); z-index: 5; display: grid; min-width: 230px; padding: 5px; background: var(--panel); border: 1px solid var(--line); border-radius: 9px; box-shadow: 0 6px 18px rgb(0 0 0 / 0.22); }
details.menu > .menu-items > button { text-align: left; border: 0; background: none; padding: 7px 10px; border-radius: 6px; white-space: nowrap; }
details.menu > .menu-items > button:hover { background: var(--accent-soft); }
.body-text { white-space: normal; max-width: 72ch; line-height: 1.55; border-top: 0; }
.body-text p { margin: 0 0 10px; }
.body-text ul { margin: 0 0 10px; padding-left: 4px; list-style: none; }
.body-text li { margin: 3px 0; }
.body-text details.section { border-top: 1px solid var(--line); padding: 8px 0 2px; }
.body-text details.section > summary { cursor: pointer; font-weight: 600; list-style: none; margin-bottom: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.body-text details.section > summary::-webkit-details-marker { display: none; }
.body-text details.section > summary::before { content: "\25B8  "; color: var(--muted); }
.body-text details.section[open] > summary::before { content: "\25BE  "; }

/* Home: what needs the owner as one short list, then each project as a tile that says where it stands. */
.page-head { display: flex; align-items: center; gap: 12px; }
.part[hidden] { display: none; }
.part + .part:not([hidden]) { margin-top: 30px; padding-top: 22px; border-top: 1px solid var(--line); }
/* One thing at a time under the search box, and a section under a page has a section's heading. */
.part[data-part="map"] ~ .part:not([hidden]) { margin-top: 16px; padding-top: 0; border-top: 0; }
#roadmap:not(:empty) { margin-bottom: 14px; }
.part[data-part="item"]:not([hidden]) ~ .part[data-part="graph"] .page-head h1 { font-size: 16px; }
.part[data-part="automations"] .page-head h1 { font-size: 16px; }
.projects-top { margin-bottom: 14px; }
.projects > li { padding: 0; }
.project-row { display: flex; gap: 14px; align-items: center; padding: 11px 14px; color: inherit; text-decoration: none; white-space: nowrap; }
.project-row:hover { background: var(--accent-soft); }
.project-row.resting { opacity: 0.65; }
.project-row > strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; font-size: 15px; }
.project-row > :not(strong) { flex: none; }
.project-row .count-of { width: 78px; text-align: right; font-size: 12px; color: var(--muted); }
@media (max-width: 720px) { .project-row { gap: 10px; } .project-row .count-of { width: auto; } .project-row .count-of.none, .project-row .progress .bar { display: none; } .project-row .progress { width: auto; } }
.project-row .progress { width: 132px; justify-content: flex-end; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.tile { min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "head ring" "counts ring"; gap: 8px 12px; align-items: center; text-align: left; padding: 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); cursor: pointer; }
.tile:hover, .tile.on { border-color: var(--accent); }
.tile.on { background: var(--accent-soft); }
.tile.resting { opacity: 0.65; }
.tile.add { display: block; text-align: center; color: var(--muted); border-style: dashed; background: none; }
.tile-head { grid-area: head; display: flex; gap: 8px; align-items: baseline; min-width: 0; }
.tile-head strong { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile-counts { grid-area: counts; display: flex; gap: 12px; font-size: 12px; color: var(--muted); white-space: nowrap; }
.count-of strong { font-size: 15px; color: var(--text); }
.count-of.warn strong { color: var(--warn); }
.count-of.bad strong { color: var(--bad); }
.count-of.none, .count-of.none strong { color: var(--closed); font-weight: 400; }
.ring { grid-area: ring; width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--ok) calc(var(--pct) * 1%), var(--closed-soft) 0); }
.ring > span { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--panel); font-size: 11.5px; color: var(--muted); }
.tile.on .ring > span { background: var(--accent-soft); }
.needs .rows > li { padding: 8px 14px; }
/* One line per row at any width: a question's name is cut, never wrapped under its buttons. */
.needs .rows > li > .row-top, .needs .question > .row-top { flex-wrap: nowrap; }
.needs .rows > li > .row-top > .grow, .needs .question > .row-top > .grow { flex: 1 1 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.needs .rows > li > .row-top > :not(.grow) { flex: none; }
/* A count that opens, on a line of changes, is no taller than the line. */
.change.line details.menu > summary { padding: 1px 8px; font-size: 12px; }
.needs .rows > li.question { padding: 8px 14px; gap: 4px; }
.nowrap-row { flex-wrap: nowrap; align-items: center; }
.nowrap-row > * { flex: none; white-space: nowrap; }
.nowrap-row > .gist { flex: 1 1 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
details.menu > .menu-items > button { max-width: 420px; overflow: hidden; text-overflow: ellipsis; }

/* Roadmap: the graph is the page; it shrinks to the window before it scrolls, and the list keeps its controls out of sight until wanted. */
.roadmap-graph svg { max-width: 100%; min-width: min(100%, 720px); height: auto; }
.nowline { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 18px; padding: 9px 14px; border-bottom: 1px solid var(--line); }
.tree .moves { opacity: 0; transition: opacity 0.1s; }
.tree li:hover > details > summary .moves, .tree .moves:focus-within { opacity: 1; }

/* An item's neighbourhood, drawn: what it reaches for, itself, what reaches for it. */
.around { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 0 26px; align-items: center; padding: 16px 14px; }
.around-self { display: grid; gap: 4px; justify-items: center; text-align: center; max-width: 220px; padding: 10px 14px; border: 1.5px solid var(--accent); border-radius: 10px; background: var(--accent-soft); }
.around-side { display: grid; gap: 12px; min-width: 0; }
.around-side.out { justify-items: end; text-align: right; }
.around-group { display: grid; gap: 4px; position: relative; min-width: 0; max-width: 100%; }
.around-side.out .around-group { justify-items: end; }
.around-phrase { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.around-items { display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; max-width: 100%; }
.around-side.out .around-items { justify-content: flex-end; }
.around-item { max-width: min(260px, 100%); box-sizing: border-box; padding: 3px 9px; border: 1px solid var(--line); border-radius: 8px; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); text-decoration: none; }
.around-item:hover { border-color: var(--accent); }
.around-item.closed { color: var(--closed); border-style: dashed; }
.around-side.out .around-group::after, .around-side.in .around-group::before { content: ""; position: absolute; top: 50%; width: 18px; border-top: 1px solid var(--edge); }
.around-side.out .around-group::after { right: -22px; }
.around-side.in .around-group::before { left: -22px; }
@media (max-width: 900px) { .around { grid-template-columns: 1fr; gap: 12px; } .around-side.out, .around-side.out .around-group { justify-items: start; text-align: left; } .around-side.out .around-items { justify-content: flex-start; } .around-group::after, .around-group::before { display: none; } .around-self { justify-self: start; } }

/* Questions: one line each until opened. */
.rows > li.question { padding: 9px 14px; gap: 6px; }
.question-more .body-text { padding: 4px 0; }

/* Search at rest: each kind of thing as a small tile with how many there are. */
.tiles.kinds { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; }
.tile.kind { display: flex; gap: 8px; align-items: baseline; padding: 10px 12px; }
.tile.kind strong { font-size: 17px; }
.tile.kind span { color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Narrow windows: a title takes the row to itself and its marks sit under it, so it is never squeezed into a column. */
@media (max-width: 560px) {
  .row-top:not(.nowrap-row) > .grow { flex-basis: 100%; }
  table.list td { overflow-wrap: anywhere; }
  .toolbar.facts > .grow { display: none; }
}

/* What a thing is for: asked for, not printed. A dotted line under a heading, or a small ? beside a control. */
.hinted { cursor: help; text-decoration: underline dotted var(--muted); text-underline-offset: 4px; }
.hint { display: inline-grid; place-items: center; width: 16px; height: 16px; margin-left: 6px; border: 1px solid var(--line); border-radius: 50%; font-size: 10.5px; color: var(--muted); cursor: help; vertical-align: middle; }

/* An item's neighbourhood as a drawing: boxes in rows, joined to the item by curves. */
.around-graph { padding: 6px 0 2px; display: grid; justify-items: center; }
.nb-head { fill: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; }
.rm-node.nb.more .box { stroke-dasharray: 4 3; }
.rm-node.nb.more text { fill: var(--muted); }
.rm-node.nb.closed text { fill: var(--muted); }
.rm-node.nb-self { cursor: default; }
.rm-node.nb-self:hover .box { stroke: var(--accent); }

/* A card's header that carries the controls for what is in the card. */
.card > header.bar { align-items: center; justify-content: flex-start; gap: 8px; flex-wrap: wrap; }
.card > header.bar .switch button { padding: 3px 10px; font-size: 12.5px; }
a.button { padding: 5px 11px; border: 1px solid var(--line); border-radius: 7px; background: var(--panel); color: var(--text); text-decoration: none; }
a.button:hover { border-color: var(--muted); text-decoration: none; }
.page-head .progress { margin-left: 4px; }

/* A count that opens the names behind it. */
details.menu.ok > summary { padding: 2px 9px; font-size: 12px; border-color: var(--warn); color: var(--warn); border-radius: 10px; }
.card > header.bar details.menu > .menu-items { font-weight: 400; }

/* An event's gate: every row is one line, at any width. */
.gated .rows > li.row-top, .gated .tree summary { flex-wrap: nowrap; }
.gated .rows > li.row-top > .grow, .gated .tree summary > .grow { flex: 1 1 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gated .rows > li.row-top > :not(.grow), .gated .tree summary > :not(.grow) { flex: none; }
.gated .rows > li.row-top { align-items: center; }
.gated .rows button, .gated .tree summary button { padding: 2px 9px; font-size: 12.5px; }
.gated .chip.stream { max-width: 180px; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 640px) { .gated .chip.stream, .gated .rows > li.row-top > .chip:first-of-type { display: none; } }

/* How we know: a question is one line; its tests are pictures. */
.proofs .tree summary { flex-wrap: nowrap; }
.proofs .tree summary > .grow { flex: 1 1 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.proofs .tree summary > :not(.grow) { flex: none; }
.proofs .ptiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; padding: 4px 14px 14px 40px; }
.proofs .ptile { display: grid; gap: 4px; justify-items: start; color: var(--text); text-decoration: none; min-width: 0; }
.proofs .ptile img, .proofs .ptile .shot { width: 100%; aspect-ratio: 16 / 10; border-radius: 7px; border: 1px solid var(--line); background: var(--closed-soft); object-fit: cover; display: flex; align-items: center; justify-content: center; }
.proofs .ptile .cap { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12.5px; }
.proofs .ptile:hover .cap { text-decoration: underline; }
@media (max-width: 640px) { .proofs .ptiles { padding-left: 14px; } }

/* Costs and the changelog: one line a row. */
.rows.costs > li.row-top, .proofs .rows > li.row-top { flex-wrap: nowrap; }
.rows.costs > li.row-top > .grow, .proofs .rows > li.row-top > .grow { flex: 1 1 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rows.costs > li.row-top > :not(.grow), .proofs .rows > li.row-top > :not(.grow) { flex: none; }
