.topbar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 24px; padding: 12px 24px;
  background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.logo { color: var(--ink); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .logo { filter: invert(1); } }
.tabs { display: flex; gap: 2px; padding: 3px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; }
.tabs button { border: 0; background: none; padding: 5px 14px; border-radius: 7px; cursor: pointer; color: var(--ink-2); font-weight: 550; }
.tabs button[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.live { margin-left: auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 40vw; display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }
.live .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.live.on .dot { background: var(--act); box-shadow: 0 0 0 3px color-mix(in srgb, var(--act) 20%, transparent); }
.live.off .dot { background: var(--stop); }

.kpis { display: flex; flex-wrap: wrap; gap: 0; padding: 14px 24px 0; max-width: 1440px; margin: 0 auto; }
.kpi { display: flex; align-items: baseline; gap: 8px; padding: 4px 18px 4px 0; margin-right: 18px; border-right: 1px solid var(--line); }
.kpi:last-child { border-right: 0; }
.kpi .value { font: 650 22px/1 var(--mono); font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.kpi .label { color: var(--muted); font-size: 13px; }
@media (max-width: 560px) { .kpis { padding: 12px 16px 0; } .kpi { margin: 0 12px 6px 0; padding-right: 12px; } }
.offline main { opacity: .6; }

.cases-view { display: grid; grid-template-columns: 380px minmax(0, 1fr); gap: 16px; padding: 14px 24px 24px; max-width: 1440px; margin: 0 auto;
  height: calc(100dvh - 158px); min-height: 520px; }
@media (max-width: 900px) { .cases-view { grid-template-columns: 1fr; height: auto; padding: 16px; } }

.list { display: flex; flex-direction: column; overflow: hidden; }
.list-tools { padding: 12px; border-bottom: 1px solid var(--line); display: grid; gap: 10px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 3px 10px; font-size: 12px; font-weight: 550; cursor: pointer; color: var(--ink-2); }
.chip[aria-checked="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chip .n { opacity: .6; margin-left: 4px; font-variant-numeric: tabular-nums; }
#search { width: 100%; padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); color: var(--ink); font: inherit; }
.case-list { list-style: none; margin: 0; padding: 6px; overflow: auto; flex: 1; }
.case-row { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 10px; border-radius: 10px; cursor: pointer; border: 1px solid transparent; }
.case-row:hover { background: var(--surface-2); }
.case-row[aria-current="true"] { background: var(--surface-2); border-color: var(--line-strong); }
.case-row .glyph { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: var(--yard-soft); color: var(--yard); font-size: 13px; }
.case-row .t { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.case-row .s { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.case-row .when { color: var(--muted); font-size: 12px; text-align: right; display: grid; gap: 4px; justify-items: end; }
.mini-track { display: flex; gap: 3px; }
.mini-track i { width: 10px; height: 4px; border-radius: 2px; background: var(--line-strong); }
.mini-track i.done { background: var(--act); } .mini-track i.current { background: var(--person); } .mini-track i.current.agent { background: var(--agent); }
.mini-track i.skipped { background: var(--line); } .mini-track i.stopped { background: var(--stop); }

.detail { overflow: auto; padding: 24px 28px; }
.empty-state { height: 100%; display: grid; place-content: center; text-align: center; color: var(--muted); max-width: 380px; margin: auto; gap: 6px; }
.empty-state img { margin: 0 auto 8px; opacity: .35; }
.empty-state h2 { color: var(--ink); font-size: 16px; margin: 0; }
.empty-state p { margin: 0; }

.d-head { display: flex; gap: 16px; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; }
.d-head h1 { font-size: 22px; letter-spacing: -.02em; margin: 0 0 6px; line-height: 1.25; }
.meta { display: flex; gap: 8px; flex-wrap: wrap; color: var(--muted); font-size: 12px; align-items: center; }
.meta .sep { opacity: .5; }

/* The case's track: each flow step is a station. */
.track { margin: 26px 0 8px; display: flex; align-items: flex-start; overflow-x: auto; padding-bottom: 6px; }
.station { flex: 1 1 0; min-width: 72px; position: relative; text-align: center; }
.station::before { content: ""; position: absolute; top: 15px; left: -50%; right: 50%; height: 3px; background: var(--line-strong); z-index: 0; }
.station:first-child::before { display: none; }
.station.done::before, .station.skipped::before, .station.current::before, .station.stopped::before { background: var(--act); }
.station .node { position: relative; z-index: 1; width: 32px; height: 32px; margin: 0 auto; border-radius: 50%; display: grid; place-items: center;
  background: var(--surface); border: 2px solid var(--line-strong); color: var(--muted); font-size: 13px; }
.station.done .node { background: var(--act); border-color: var(--act); color: var(--on-act); }
.station.skipped .node { border-style: dashed; }
.station.current .node { border-color: var(--person); color: var(--person); box-shadow: 0 0 0 5px var(--person-soft); }
.station.current.agent .node { border-color: var(--agent); color: var(--agent); box-shadow: 0 0 0 5px var(--agent-soft); }
.station.stopped .node { border-color: var(--stop); color: var(--stop); background: var(--stop-soft); }
.station .name { margin-top: 8px; font-weight: 600; font-size: 12.5px; line-height: 1.25; padding: 0 2px; }
.station .who { color: var(--muted); font-size: 11.5px; }

.grid2 { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 20px; margin-top: 20px; }
@media (max-width: 1150px) { .grid2 { grid-template-columns: 1fr; } }
.panel h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0 0 10px; font-weight: 650; }

.timeline { list-style: none; margin: 0; padding: 0; }
.ev { display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 12px; position: relative; padding-bottom: 14px; }
.ev:not(:last-child)::after { content: ""; position: absolute; left: 14px; top: 30px; bottom: 0; width: 2px; background: var(--line); }
.avatar { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 700; background: var(--yard-soft); color: var(--yard); }
.avatar.agent { background: var(--agent-soft); color: var(--agent); }
.avatar.person { background: var(--person-soft); color: var(--person); }
.avatar.act { background: var(--act-soft); color: var(--act); }
.avatar.stop { background: var(--stop-soft); color: var(--stop); }
.ev .line1 { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.ev .actor { font-weight: 650; }
.ev time { margin-left: auto; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.ev .body { color: var(--ink-2); }
.result { margin-top: 6px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); padding: 8px 10px; font-size: 12.5px; }
.result dl { margin: 0; display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 3px 12px; }
.result dt { color: var(--muted); font-family: var(--mono); font-size: 11.5px; }
.result dd { margin: 0; }
.result ul { margin: 0; padding-left: 16px; }

.receipt { border: 1px solid color-mix(in srgb, var(--act) 35%, var(--line)); background: linear-gradient(180deg, var(--act-soft), transparent 70%); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
.receipt.bad { border-color: color-mix(in srgb, var(--stop) 40%, var(--line)); background: linear-gradient(180deg, var(--stop-soft), transparent 70%); }
.receipt h4 { margin: 0 0 4px; font-size: 14px; display: flex; gap: 8px; align-items: center; }
.receipt .where { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr)); gap: 8px 16px; margin: 10px 0 12px; padding: 10px 12px; border-radius: var(--radius); background: var(--surface); border: 1px dashed var(--line); }
.receipt .where code { font-size: 13px; overflow-wrap: anywhere; }
.receipt .where .fine { grid-column: 1 / -1; margin: 0; }
.receipt p { margin: 0 0 12px; color: var(--ink-2); font-size: 13px; }
.hashes { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: center; }
.hash { border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 8px 10px; }
.hash .k { font-size: 11px; color: var(--muted); }
.hash code { font-size: 13px; font-weight: 600; letter-spacing: .02em; }
.eq { font-size: 18px; color: var(--act); font-weight: 700; }
.receipt.bad .eq { color: var(--stop); }

.quarantine { border: 1px dashed var(--line-strong); border-radius: var(--radius); padding: 14px; background: repeating-linear-gradient(-45deg, transparent 0 10px, color-mix(in srgb, var(--line) 35%, transparent) 10px 11px); }
.quarantine .q-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; gap: 8px; flex-wrap: wrap; }
.quarantine dl { margin: 0; display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }
.quarantine dt { color: var(--muted); font-family: var(--mono); font-size: 11.5px; }
.quarantine dd { margin: 0; white-space: pre-wrap; word-break: break-word; }

.flows-view { padding: 16px 24px 40px; max-width: 1440px; margin: 0 auto; }
.flow-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; }
@media (max-width: 560px) { .flows-view { padding: 16px; } .flow-grid { grid-template-columns: 1fr; } }
.flow-card { padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.flow-card h2 { margin: 0; font-size: 16px; letter-spacing: -.01em; }
.flow-card .room { color: var(--muted); font-size: 12px; }
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.steps li { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 8px; align-items: center; font-size: 13px; }
.steps .k { width: 22px; height: 22px; border-radius: 6px; display: grid; place-items: center; font-size: 11px; }
.steps .k.agent { background: var(--agent-soft); color: var(--agent); }
.steps .k.gate { background: var(--person-soft); color: var(--person); }
.steps .k.outlet { background: var(--act-soft); color: var(--act); }
.steps .note { color: var(--muted); font-size: 11.5px; }
.inlets { display: flex; gap: 6px; flex-wrap: wrap; }
.flow-card .links { display: flex; gap: 8px; flex-wrap: wrap; margin-top: auto; }
.flow-card .links a { font-size: 12.5px; font-weight: 600; text-decoration: none; padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; }
.flow-card .links a:hover { background: var(--surface-2); }

.receipts { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 12px; margin-top: 18px;  align-items: start; }
.receipts .receipt { margin: 0; }
.d-head > .pill { margin-top: 4px; }
.flags { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; font-size: 12px; font-weight: 600; color: var(--stop); margin-bottom: 8px; }
.fc-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.flow-card.off { opacity: .72; border-style: dashed; box-shadow: none; }
.setup { margin-top: auto; display: grid; gap: 8px; justify-items: start; }
.setup code { font-size: 11.5px; padding: 6px 8px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2); }

/* First paint, before the first refresh lands. */
.skeleton { border-radius: 8px; background: linear-gradient(90deg, var(--surface-2), var(--line), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.2s infinite linear; }
@keyframes shimmer { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .skeleton { animation: none; } }
.steps .k.wait { background: var(--yard-soft); color: var(--yard); }

/* Rows and stations */
.case-row .glyph .ico { width: 15px; height: 15px; }
.row-main { min-width: 0; display: grid; }
.case-row .t .ico { width: 13px; height: 13px; margin-right: 4px; }
.mini-track i.k-parallel.done, .mini-track i.k-agent.done { background: var(--act); }
.station .node .ico { width: 15px; height: 15px; }
.station.done .node .ico { stroke-width: 3; }
.station.current.k-agent .node, .station.current.k-parallel .node { border-color: var(--agent); color: var(--agent); box-shadow: 0 0 0 5px var(--agent-soft); }
.station.current.k-wait .node { border-color: var(--yard); color: var(--yard); box-shadow: 0 0 0 5px var(--yard-soft); }
.empty-state.small { padding: 40px 12px; }
.empty-state code { font-size: 12px; }

/* The case head */
.excerpt { margin: 12px 0 0; padding: 10px 14px; border-left: 3px solid var(--stop); background: var(--stop-soft); color: var(--ink-2); border-radius: 0 8px 8px 0;
  font-style: italic; max-height: 4.5em; overflow: hidden; }
.banner { display: flex; gap: 10px; align-items: flex-start; margin-top: 10px; padding: 10px 12px; border-radius: 8px; font-size: 13px; border: 1px solid; }
.banner .ico { margin-top: 1px; }
.banner.stop { background: var(--stop-soft); border-color: color-mix(in srgb, var(--stop) 30%, transparent); color: var(--ink); }
.banner.stop > .ico { color: var(--stop); }
.banner.person { background: var(--person-soft); border-color: color-mix(in srgb, var(--person) 30%, transparent); }
.banner.person > .ico { color: var(--person); }
.banner.agent { background: var(--agent-soft); border-color: color-mix(in srgb, var(--agent) 30%, transparent); }
.banner.agent > .ico { color: var(--agent); }

/* Who is who */
.vendor { display: inline-block; font: 600 10.5px/1 var(--mono); padding: 3px 5px; border-radius: 4px; vertical-align: 1px; letter-spacing: .02em;
  background: var(--yard-soft); color: var(--yard); text-transform: lowercase; }
.vendor.v-anthropic { background: #f4e4d6; color: #8a3f12; }
.vendor.v-google { background: #e2e8ef; color: #1f3f66; }
.vendor.v-fixture { background: var(--yard-soft); color: var(--yard); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .vendor.v-anthropic { background: #3a2417; color: #f2b48d; } :root:not([data-theme="light"]) .vendor.v-google { background: #172840; color: #9cc1ff; } }
.as { color: var(--muted); font-weight: 500; font-size: 12px; }
.avatar .ico { width: 14px; height: 14px; }

/* Agent results */
.result dd .text { white-space: pre-wrap; }
.num { font-variant-numeric: tabular-nums; text-align: right; }
table.mini { border-collapse: collapse; width: 100%; font-size: 12.5px; margin: 2px 0; }
table.mini th { text-align: left; color: var(--muted); font-weight: 600; font-size: 11.5px; border-bottom: 1px solid var(--line); padding: 3px 8px 3px 0; }
table.mini td { border-bottom: 1px solid var(--line); padding: 4px 8px 4px 0; }
table.mini th.num, table.mini td.num { text-align: right; }
.ev code { font-size: 11.5px; background: var(--surface-2); padding: 1px 4px; border-radius: 4px; }

/* Receipts */
.receipt h4 .ico { color: var(--act); }
.receipt.bad h4 .ico { color: var(--stop); }
.receipt.neutral { border-color: var(--line); background: var(--surface-2); }
.receipt.neutral h4 .ico { color: var(--person); }
.receipt .eq .ico { width: 20px; height: 20px; }
.hash .k { display: flex; gap: 4px; flex-wrap: wrap; align-items: baseline; }
code.rule { font-size: 11.5px; white-space: normal; }
.fine { color: var(--muted); font-size: 12px; margin: 8px 0 0; }
.flags .ico { width: 14px; height: 14px; }

/* Flows */
.inlet { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink-2); }
.steps .k .ico { width: 13px; height: 13px; }
.steps .k.parallel { background: var(--agent-soft); color: var(--agent); }
.steps .k.wait { background: var(--yard-soft); color: var(--yard); }

@media (max-width: 900px) {
  .cases-view { height: auto; }
  .list { max-height: 60vh; }
  .detail { scroll-margin-top: 64px; }
}
.steps .k.verify { background: var(--act-soft); color: var(--act); }
.station.done.k-verify .node { background: var(--act); }
.docrefs { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.docref { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; color: var(--muted); }
.docref .ico { width: 12px; height: 12px; }

/* Intro and legend: what the page is, and what its colours mean. */
.intro { max-width: 1440px; margin: 0 auto; padding: 12px 24px 0; display: flex; gap: 8px 24px; align-items: baseline; flex-wrap: wrap; }
.intro p { margin: 0; color: var(--ink-2); font-size: 13px; flex: 1 1 100%; }
.intro p b { color: var(--ink); }
.legend { list-style: none; margin: 0; padding: 0; display: flex; gap: 4px 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.legend li { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 50%; }
.sw.agent { background: var(--agent); } .sw.person { background: var(--person); } .sw.act { background: var(--act); } .sw.stop { background: var(--stop); }
.sw.code { border-radius: 3px; background: var(--yard); }
.sw.cond { width: 8px; height: 8px; border-radius: 1px; transform: rotate(45deg); background: var(--surface); border: 1.5px solid var(--muted); }
.sw.arc { width: 22px; height: 8px; border-radius: 12px 12px 0 0; border: 1.5px dashed var(--person); border-bottom: 0; }
@media (max-width: 560px) { .intro { padding: 12px 16px 0; } .legend { display: none; } }

/* The interlocking diagram */
.diagram { margin: 18px 0 6px; overflow-x: auto; padding-bottom: 4px; }
.dg { display: block; width: 100%; max-width: calc(var(--w) * 1.2); min-width: calc(var(--w) * .8); height: auto; overflow: visible; }
.dg text { font: 11px var(--font); fill: var(--ink-2); font-variant-ligatures: none; }
.dg .lbl { font-weight: 650; font-size: 12px; fill: var(--ink); }
.dg .sub { font: 10.5px var(--mono); fill: var(--muted); }
.dg .cond { font: italic 10.5px var(--mono); fill: var(--muted); }
.dg .struck { text-decoration: line-through; }
.dg .tm { font-size: 11px; font-weight: 600; fill: var(--ink-2); }
.dg .tm.ok { fill: var(--act); } .dg .tm.bad, .dg .tm.late { fill: var(--stop); }
.dg .vt { font: 600 10px var(--mono); fill: var(--yard); }
.dg .vt.v-anthropic { fill: #a2521f; } .dg .vt.v-google { fill: #1d5fc4; }
.dg .hashtext { font: 600 10.5px var(--mono); fill: var(--ink); letter-spacing: .02em; }
.dg .edge { fill: none; stroke: var(--line-strong); stroke-width: 2.5; stroke-dasharray: 5 4; }
.dg .edge.on { stroke: var(--yard); stroke-dasharray: none; }
.dg .siding { fill: none; stroke: var(--line-strong); stroke-width: 2; stroke-dasharray: 3 4; }
.dg .siding.lit { stroke: var(--agent); stroke-width: 2.5; stroke-dasharray: none; }
.dg .cond-mark rect { fill: var(--surface); stroke: var(--muted); stroke-width: 1.5; }
.dg .cond-mark.false rect { fill: var(--line); stroke: var(--line-strong); }

.dg .n { --k: var(--yard); --ks: var(--yard-soft); }
.dg .n.k-agent, .dg .n.k-parallel { --k: var(--agent); --ks: var(--agent-soft); }
.dg .n.k-gate { --k: var(--person); --ks: var(--person-soft); }
.dg .n.k-outlet { --k: var(--act); --ks: var(--act-soft); }
.dg .n .shape { fill: var(--surface); stroke: var(--line-strong); stroke-width: 2; }
.dg .n .g { color: var(--muted); }
.dg .n.plan .shape { fill: var(--ks); stroke: var(--k); }
.dg .n.plan .g { color: var(--k); }
.dg .n.done .shape { fill: var(--k); stroke: var(--k); }
.dg .n.done .g { color: var(--surface); }
.dg .n.current .shape { fill: var(--ks); stroke: var(--k); stroke-width: 2.5; }
.dg .n.current .g { color: var(--k); }
.dg .n .halo { fill: none; stroke: var(--k); stroke-width: 6; opacity: .18; }
.dg .n.skipped { opacity: .5; } .dg .n.skipped .shape { stroke-dasharray: 3 3; }
.dg .n.bad .shape { fill: var(--stop); stroke: var(--stop); }
.dg .n.bad .g { color: var(--surface); }
.dg .n.bad.current .shape, .dg .n.stopped .shape { fill: var(--stop-soft); stroke: var(--stop); }
.dg .n.bad.current .g, .dg .n.stopped .g { color: var(--stop); }
.dg .n.idle .shape { fill: var(--surface); stroke: var(--line-strong); stroke-dasharray: 3 3; }
.dg .n.inlet.done .shape { fill: var(--yard); stroke: var(--yard); }
.dg .n.inlet.plan .shape { fill: var(--yard-soft); stroke: var(--yard); }
.dg .n.inlet.plan .g { color: var(--yard); }

.dg .clock .ring-track { fill: none; stroke: var(--line); stroke-width: 3.5; }
.dg .clock .ring { fill: none; stroke: var(--k); stroke-width: 3.5; stroke-linecap: round; }
.dg .clock.late .ring { stroke: var(--stop); }
.dg .clock .ring-tick { stroke: var(--ink-2); stroke-width: 2; }

.dg .junction rect { fill: var(--surface); stroke: var(--line-strong); stroke-width: 2; }
.dg .junction.plan rect { fill: var(--agent-soft); stroke: var(--agent); }
.dg .junction.ok rect { fill: var(--act); stroke: var(--act); }
.dg .junction.bad rect { fill: var(--stop); stroke: var(--stop); }
.dg .buffer { stroke: var(--line-strong); stroke-width: 4; stroke-linecap: round; }
.dg .buffer.act { stroke: var(--act); } .dg .buffer.stop { stroke: var(--stop); } .dg .buffer.neutral { stroke: var(--yard); }

.dg .bind .arc { fill: none; stroke: var(--person); stroke-width: 1.75; stroke-dasharray: 5 4; }
.dg .bind.ok .arc { stroke: var(--act); stroke-dasharray: none; stroke-width: 2; }
.dg .bind.bad .arc { stroke: var(--stop); stroke-dasharray: none; }
.dg .bind.declined .arc, .dg .bind.idle .arc { stroke: var(--line-strong); }
.dg .arrowhead { fill: var(--muted); }
.dg .arc-label { font: 600 10.5px var(--mono); fill: var(--person); paint-order: stroke; stroke: var(--surface); stroke-width: 4px; stroke-linejoin: round; }
.dg .bind.ok .arc-label, .dg .bind.ok .g { fill: var(--act); color: var(--act); }
.dg .bind.held .g { color: var(--person); }
.dg .bind.bad .arc-label { fill: var(--stop); }
.dg .bind.declined .arc-label, .dg .bind.idle .arc-label { fill: var(--muted); }
.dg .doc-chip rect { fill: var(--surface-2); stroke: var(--line-strong); }
.dg .doc-chip .g { color: var(--muted); }
.dg .doc-link { stroke: var(--line-strong); stroke-width: 1.5; stroke-dasharray: 2 3; }
.dg .lane-h { fill: var(--ink-2); }
.dg title { pointer-events: none; }

/* Detail tabs and the raw log */
.dtabs { display: flex; gap: 2px; margin-top: 22px; border-bottom: 1px solid var(--line); }
.dtabs button { border: 0; background: none; padding: 7px 12px; cursor: pointer; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.dtabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--ink); }
.dtabs .n { font: 600 11px var(--mono); color: var(--muted); margin-left: 4px; }
.raw { margin-top: 14px; }
.raw-head { display: flex; gap: 12px; justify-content: space-between; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.raw-head p { margin: 0; color: var(--muted); font-size: 12.5px; }
.btn.small { height: 30px; padding: 0 12px; font-size: 12.5px; }
.btn.small .ico { width: 14px; height: 14px; }
.raw-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; }
.rawtable { border-collapse: collapse; width: 100%; font-size: 12px; }
.rawtable th { text-align: left; font-weight: 600; color: var(--muted); background: var(--surface-2); padding: 6px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.rawtable td { padding: 5px 10px; border-bottom: 1px solid var(--line); vertical-align: top; white-space: nowrap; }
.rawtable tr:last-child td { border-bottom: 0; }
.rawtable td.raw-body { white-space: normal; min-width: 280px; }
.rawtable code { font-size: 11.5px; word-break: break-all; }
.rawtable pre { margin: 6px 0 0; font: 11.5px/1.45 var(--mono); white-space: pre-wrap; word-break: break-all; }
.rawtable summary { cursor: pointer; }
.evt { font: 600 11px var(--mono); padding: 1px 6px; border-radius: 4px; background: var(--yard-soft); color: var(--yard); }
.evt.t-executed, .evt.t-done { background: var(--act-soft); color: var(--act); }
.evt.t-gate_opened, .evt.t-gate_answered, .evt.t-reminded, .evt.t-escalated { background: var(--person-soft); color: var(--person); }
.evt.t-asked, .evt.t-answered, .evt.t-partial, .evt.t-fanned_out, .evt.t-failed_over { background: var(--agent-soft); color: var(--agent); }
.evt.t-failed, .evt.t-cancelled, .evt.t-in_doubt, .evt.t-reply_rejected, .evt.t-card_reopened { background: var(--stop-soft); color: var(--stop); }

/* Flows: one row per flow, each with its diagram */
.flow-grid { grid-template-columns: 1fr; }
.flow-card .diagram { margin: 4px 0 0; }
.step-list summary { cursor: pointer; color: var(--muted); font-size: 12.5px; }
.step-list .steps { margin-top: 8px; }

code, .mono, .rawtable, .dg .sub, .dg .cond, .dg .vt, .dg .hashtext, .dg .arc-label, .dg .tm, .dg .lbl { font-variant-ligatures: none; }
.dg .tm.muted { fill: var(--muted); font-weight: 500; font-style: italic; }
.dg .n.absent { opacity: .38; }
.dg.plan .edge { stroke-dasharray: none; }
.flow-card { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 12px 28px; align-items: center; }
.fc-meta { display: flex; flex-direction: column; gap: 10px; align-self: stretch; }
.flow-card .diagram { margin: 0; }
@media (max-width: 1100px) { .flow-card { grid-template-columns: 1fr; } }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .dg .vt.v-anthropic { fill: #f2b48d; } :root:not([data-theme="light"]) .dg .vt.v-google { fill: #9cc1ff; } }
/* Receipts may carry two or three hash plates: approved, sent, read back. */
.hashes { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.hashes .hash { flex: 1 1 170px; min-width: 0; }
.hashes .hash code { word-break: break-all; }
/* Phones: receipts never wider than the panel, and a tighter panel padding. */
.receipts { grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr));  align-items: start; }
@media (max-width: 560px) { .detail { padding: 18px 16px; } .receipt { padding: 12px; } }

.linked { border: 1px solid color-mix(in srgb, var(--stop) 35%, var(--line)); background: linear-gradient(180deg, var(--stop-soft), transparent 80%); border-radius: var(--radius); padding: 12px 16px; margin: 12px 0; }
.linked h4 { margin: 0 0 6px; font-size: 14px; display: flex; gap: 8px; align-items: center; }
.linked ul { margin: 0; padding-left: 18px; display: grid; gap: 6px; }
.linked code { overflow-wrap: anywhere; }
.caselink { color: inherit; text-decoration: underline; text-decoration-color: color-mix(in srgb, currentColor 40%, transparent); }

/* ---------- investigations ---------- */
.ig-view { padding: 14px 24px 40px; max-width: 1440px; margin: 0 auto; }
.ig-head .ig-totals { padding: 0; }
.ig-head .fine { margin: 8px 0 14px; }
.ig-layout { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 16px; align-items: start; }
.ig-list { padding: 12px; }
.ig-list h3, .ig-main h3 { margin: 18px 0 8px; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); display: flex; gap: 6px; align-items: center; }
.ig-list h3 { margin-top: 0; }
.ig-list ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.ig-pick { all: unset; box-sizing: border-box; width: 100%; display: flex; gap: 10px; align-items: flex-start; padding: 10px; border-radius: var(--radius-sm); border: 1px solid var(--line); cursor: pointer; font-size: 13px; }
.ig-pick:hover { background: var(--surface-2); }
.ig-pick[aria-current="true"] { border-color: color-mix(in srgb, var(--stop) 45%, var(--line)); background: var(--stop-soft); }
.ig-pick:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.ig-pick .ico { color: var(--stop); flex: none; margin-top: 2px; }
.ig-pick .meta { display: block; color: var(--muted); font-size: 12px; margin-top: 3px; }
.ig-main { padding: 18px 22px; min-width: 0; }
.ig-main h2 { margin: 0; font-size: 18px; }
.ig-graph-wrap { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2); padding: 8px; overflow-x: auto; }
.ig-graph { width: 100%; min-width: 620px; height: auto; display: block; font-family: var(--font); }
.ig-graph .colhead { font-size: 11px; fill: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.ig-node rect { fill: var(--surface); stroke: var(--line-strong); stroke-width: 1; }
.ig-node text { fill: var(--ink); font-size: 12px; font-family: var(--font); text-decoration: none; }
.ig-node .t2, .ig-node .mono { font-family: var(--mono); }
.ig-node .t1 { font-weight: 600; }
.ig-node .t2 { fill: var(--muted); font-size: 11px; font-family: var(--mono); }
.ig-node .mono { font-family: var(--mono); }
.ig-node.ig-case:hover rect, .ig-node.ig-case:focus rect { stroke: var(--focus); stroke-width: 2; }
.ig-node.ig-acct.flagged rect { fill: var(--stop-soft); stroke: var(--stop); stroke-width: 1.5; }
.ig-node.ig-vnd rect { fill: var(--surface-2); }
.ig-node .tone-stop { fill: var(--stop); } .ig-node .tone-act { fill: var(--act); } .ig-node .tone-person { fill: var(--person); } .ig-node .tone-agent { fill: var(--agent); } .ig-node .tone-neutral { fill: var(--muted); }
.ig-edge { cursor: pointer; outline: none; }
.ig-edge .hit { fill: none; stroke: transparent; stroke-width: 14; }
.ig-edge .line { fill: none; stroke-width: 1.75; }
.ig-edge text { font-size: 11px; paint-order: stroke; stroke: var(--surface-2); stroke-width: 4px; stroke-linejoin: round; }
.ig-edge.t-stop .line { stroke: var(--stop); } .ig-edge.t-stop text { fill: var(--stop); }
.ig-edge.t-act .line { stroke: var(--act); } .ig-edge.t-act text { fill: var(--act); }
.ig-edge.t-person .line { stroke: var(--person); } .ig-edge.t-person text { fill: var(--person); }
.ig-edge.t-muted .line { stroke: var(--line-strong); } .ig-edge.t-muted text { fill: var(--muted); }
.ig-edge:hover .line, .ig-edge:focus-visible .line, .ig-edge.sel .line { stroke-width: 3.5; }
.ig-edge.sel text, .ig-edge:focus-visible text { font-weight: 700; }
.ig-edge-detail { margin-top: 10px; }
.ig-impact { display: flex; flex-wrap: wrap; gap: 6px 0; }
.ig-paid, .ig-waiting { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 6px; font-size: 13px; }
.ig-paid li, .ig-waiting li { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.ig-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.ig-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.ig-table th { text-align: left; font-weight: 600; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); background: var(--surface-2); white-space: nowrap; }
.ig-table td { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.ig-table tr:last-child td { border-bottom: 0; }
.ig-table tr[data-ev] { cursor: pointer; }
.ig-table tr.sel td { background: var(--person-soft); }
.ig-table code { font-size: 11.5px; }
.ig-table .nowrap { white-space: nowrap; }
.ig-timeline { list-style: none; padding: 0; margin: 0; border-left: 2px solid var(--line); }
.ig-timeline li { position: relative; padding: 4px 0 8px 16px; font-size: 13px; }
.ig-timeline li::before { content: ""; position: absolute; left: -6px; top: 9px; width: 10px; height: 10px; border-radius: 50%; background: var(--muted); border: 2px solid var(--surface); }
.ig-timeline li.t-stop::before { background: var(--stop); } .ig-timeline li.t-act::before { background: var(--act); } .ig-timeline li.t-person::before { background: var(--person); }
.ig-timeline .when { color: var(--muted); font: 12px var(--mono); margin-right: 8px; }
.ig-empty { padding: 40px; text-align: center; }
.ig-empty .ico { width: 32px; height: 32px; color: var(--muted); }
@media (max-width: 900px) { .ig-layout { grid-template-columns: 1fr; } }
@media (max-width: 560px) { .ig-view { padding: 12px 16px 32px; } .ig-main { padding: 14px; } }
.tabs .n { font: 600 11px var(--mono); background: var(--stop); color: #fff; border-radius: 999px; padding: 1px 6px; margin-left: 4px; }
@media (max-width: 560px) {
  .topbar { flex-wrap: wrap; gap: 8px 12px; padding: 10px 16px; }
  .tabs { order: 3; width: 100%; }
  .tabs button { flex: 1; padding: 5px 6px; }
}
