/* Kinds of finding (kinds.py, _kind_macros.html as km, DESIGN.md "Kinds of finding"): the Findings switch, the harm chip,
   the generic proof section and the counts per kind. Tokens only: both themes work. */

/* The switch: Queries · Regexes · Transactions. A kind with wrong results under concurrency carries the alert mark. */
.kind-switch > a { gap: 2px; }
.kind-harm-dot { display: inline-flex; margin-left: 4px; color: var(--fail); }
.kind-harm-dot .icon { width: 12px; height: 12px; }

/* Harm: a wrong result under concurrency is its own cause, never a speed-up. Words, an icon and a double rule. */
.chip.is-harm { --c: var(--fail); --cb: var(--fail-bg); border: 3px double var(--fail); }
a.chip.is-harm.is-on { box-shadow: inset 0 0 0 1px var(--fail); }

/* How it ended, on the finding page: the left rule follows the state, never colour alone (the state chip has words). */
.kind-state { border-left: 3px solid var(--line-strong); }
.kind-state.is-fixed { border-left-color: var(--win); }
.kind-state.is-blocked { border-left: 3px dashed var(--warn); }
.kind-state.is-not_judged { border-left: 3px dotted var(--ink-3); }
.kind-why { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--sp-2) var(--sp-4); min-width: 0; padding: var(--sp-4) var(--sp-5); }
.kind-reason { font-weight: 600; min-width: 0; overflow-wrap: anywhere; }

/* The proof: one measure per cell, before and after on one scale, with the runs' range as a whisker. */
.pm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 20rem), 1fr)); gap: var(--sp-5) var(--sp-7); min-width: 0; }
.pm { min-width: 0; }
.pm.is-shown .pm-name { color: var(--ink-2); }
.pm-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px var(--sp-3); margin-bottom: var(--sp-2); min-width: 0; }
.pm-name { font-weight: 600; }
.pm-unit, .pm-of, .pm-note { font-size: var(--fs-1); color: var(--ink-3); }
.pm-note { border: 1px dashed var(--line-strong); border-radius: var(--r-1); padding: 0 4px; }
.pm-change { margin-left: auto; font: 600 var(--fs-2)/1.4 var(--font-mono); color: var(--ink); }
.pm-change.is-gain { color: var(--win); }
.pm-change.is-loss { color: var(--fail); }
.pm-row { display: grid; grid-template-columns: 3.25rem minmax(0, 1fr) minmax(4rem, auto) minmax(0, auto); align-items: center; gap: var(--sp-3); min-height: 20px; }
.pm-lab { font-size: var(--fs-1); color: var(--ink-3); }
.pm-svg { display: block; width: 100%; min-width: 0; overflow: visible; }
.pm-svg.is-thin { height: 8px; }
.pm-track { fill: var(--surface-3); }
.pm-b { fill: var(--ink-3); }
.pm-b.is-before { fill: var(--ink-3); opacity: .6; }
.pm-b.is-after { fill: var(--win); }
.pm-b.is-worse { fill: var(--fail); }
.pm-sp { stroke: var(--ink); stroke-width: 1.25; }
.pm-num { font: 500 var(--fs-2)/1.15 var(--font-mono); text-align: right; white-space: nowrap; }
.pm-rng { font: 400 var(--fs-1)/1.15 var(--font-mono); color: var(--ink-3); white-space: nowrap; }
.proof-facts { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2) var(--sp-4); margin-top: var(--sp-5); padding-top: var(--sp-4);
  border-top: 1px solid var(--line); min-width: 0; }
.proof-facts > .facts { margin-top: 0; }
.series-tbl td.num, .series-tbl th.num { font-family: var(--font-mono); }

/* Regex (_kind_regex.html, regexviews.py): the growth curve on its own engine, before dashed grey, after green. */
.rgx-pat { display: flex; align-items: baseline; gap: var(--sp-4); min-width: 0; margin-bottom: var(--sp-4); }
.rgx-code { font-size: var(--fs-2); min-width: 0; overflow-wrap: anywhere; white-space: pre-wrap; background: var(--surface-2); padding: 2px var(--sp-3); border-radius: var(--r-1); }
.rgx-chart { margin: 0; min-width: 0; }
.rgx-chart svg { display: block; width: 100%; height: auto; max-height: 240px; }
.rgx-grid { stroke: var(--line); stroke-width: 1; }
.rgx-axis { stroke: var(--line-strong); stroke-width: 1; }
.rgx-tick { fill: var(--ink-3); font: 400 10px var(--font-mono); }
.rgx-line { fill: none; stroke-width: 2; stroke: var(--ink-3); }
.rgx-line.is-before { stroke-dasharray: 5 3; }
.rgx-line.is-after { stroke: var(--win); }
.rgx-line.is-alt { stroke: var(--accent); stroke-dasharray: 2 2; }
.rgx-dot { fill: var(--surface); stroke: var(--ink-3); stroke-width: 1.5; }
.rgx-dot.is-after { stroke: var(--win); }
.rgx-dot.is-alt { stroke: var(--accent); }
.rgx-legend { display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-5); align-items: center; font-size: var(--fs-1); margin-top: var(--sp-2); }
.rgx-key { display: inline-flex; align-items: center; gap: var(--sp-2); }
.rgx-key i { display: inline-block; width: 16px; border-top: 2px dashed var(--ink-3); }
.rgx-key.is-after i { border-top: 2px solid var(--win); }
.rgx-key.is-alt i { border-top: 2px dotted var(--accent); }
.rgx-fam { min-width: 0; overflow-wrap: anywhere; }
.rgx-kv { min-width: 0; }
.rgx-line.is-alt-after { stroke: var(--win); stroke-dasharray: 2 2; }
.rgx-dot.is-alt-after { stroke: var(--win); }
.rgx-key.is-alt-after i { border-top: 2px dotted var(--win); }
.rgx-kind { margin: 0 0 var(--sp-3); }
.rgx-lits { display: flex; flex-wrap: wrap; gap: var(--sp-2); min-width: 0; }
.rgx-helper { display: flex; flex-direction: column; gap: var(--sp-2); min-width: 0; margin-bottom: var(--sp-4); }
.rgx-pre { margin: 0; font-size: var(--fs-1); max-height: 22rem; overflow-y: auto; overflow-x: hidden; max-width: 100%; white-space: pre-wrap; overflow-wrap: anywhere; background: var(--surface-2);
  padding: var(--sp-3); border-radius: var(--r-1); }

/* The list of one kind */
.kind-head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-3) var(--sp-5); min-width: 0; }
.kind-head > .st { flex: 1 1 14rem; max-width: 28rem; }
.kind-list .kb { display: flex; align-items: baseline; gap: var(--sp-3); min-width: 0; }
.kind-list .kb-name { font-size: var(--fs-2); color: var(--ink-2); min-width: 0; }
.kind-list .kb-change { margin-left: auto; font: 600 var(--fs-2)/1.4 var(--font-mono); }
.kind-list .kb-change.is-gain { color: var(--win); }
.kind-list .kb-bars { display: flex; align-items: center; gap: var(--sp-3); }
.kind-list .kb-bars > .pm-svg { flex: 1 1 3rem; width: auto; }
.kind-list .kb-name { overflow-wrap: anywhere; }

/* Counts per kind (run page, overview) */
.kc { display: grid; gap: 2px; min-width: 0; }
.kc-row { display: grid; grid-template-columns: minmax(6rem, 9rem) 3.5rem minmax(4rem, 14rem) minmax(0, 1fr); align-items: center; gap: var(--sp-4);
  padding: var(--sp-2) var(--sp-3); border-radius: var(--r-1); color: var(--ink); min-width: 0; }
.kc-row:hover { background: var(--surface-3); text-decoration: none; }
.kc-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kc-n { text-align: right; }
.kc-sub { color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.kc-harm { color: var(--fail); font-weight: 600; }
@media (max-width: 640px) { .kc-row { grid-template-columns: minmax(0, 1fr) 3rem; } .kc-row > .st, .kc-sub { grid-column: 1 / -1; } }

/* The transaction panel (_kind_transaction.html): the shape as steps, the schedule as lanes, counters by workers, the
   final-state check. Lane states differ by fill and by outline (dashed on a wait, a heavy rule on a duplicate), and the
   legend names each one. */
.tx-shape { display: grid; gap: var(--sp-2); min-width: 0; }
.tx-steps { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); margin: 0; padding: 0; list-style: none; min-width: 0; }
.tx-step { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 2px var(--sp-2); min-width: 0; max-width: 100%;
  padding: 2px var(--sp-3); border: 1px solid var(--line); border-radius: var(--r-1); background: var(--surface); }
.tx-step.is-call, .tx-step.is-sleep { border-style: dashed; border-color: var(--warn); }
.tx-sep { color: var(--ink-3); }
.tx-ln { font-size: var(--fs-1); color: var(--ink-3); }
.tx-op { font-weight: 600; font-size: var(--fs-1); }
.tx-tbl { font-size: var(--fs-2); max-width: 18rem; min-width: 0; }
.tx-lanes { display: grid; gap: var(--sp-3); min-width: 0; }
.tx-lanes-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--sp-2) var(--sp-4); }
.tx-side { display: grid; gap: var(--sp-1); min-width: 0; }
.tx-side-head { display: flex; align-items: baseline; gap: var(--sp-3); }
.tx-side-name { font-weight: 600; font-size: var(--fs-2); }
.tx-side-body { display: grid; grid-template-columns: 1.75rem minmax(0, 1fr); gap: var(--sp-2); align-items: start; min-width: 0; }
.tx-lane-labels { display: grid; grid-auto-rows: 14px; font: 400 10px/14px var(--font-mono); color: var(--ink-3); text-align: right; }
.tx-svg { display: block; width: 100%; min-width: 0; }
.tx-track { fill: var(--surface-3); }
.tx-seg, .tx-seg.is-run { fill: var(--ink); }
.tx-seg.is-wait { fill: var(--warn); fill-opacity: .55; stroke: var(--warn); stroke-width: 1; stroke-dasharray: 2 1; }
.tx-seg.is-call { fill: var(--accent); fill-opacity: .3; stroke: var(--accent); stroke-opacity: .6; stroke-width: 1; }
.tx-seg.is-error { fill: var(--fail); }
.tx-seg.is-dup { fill: var(--fail); fill-opacity: .4; stroke: var(--fail); stroke-width: 2; }
.tx-legend { display: flex; flex-wrap: wrap; gap: var(--sp-1) var(--sp-5); margin: 0; padding: 0; list-style: none; font-size: var(--fs-1); color: var(--ink-2); }
.tx-legend li { display: inline-flex; align-items: center; gap: var(--sp-2); }
.tx-legend svg { flex: none; overflow: visible; }
.tx-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr)); gap: var(--sp-5) var(--sp-7); min-width: 0; }
.tx-workers, .tx-check { display: flex; flex-direction: column; align-items: flex-start; gap: var(--sp-2); min-width: 0; }
.tx-workers > .tbl { width: 100%; }
.tx-wtbl th:first-child, .tx-wtbl td:first-child { width: 5rem; }
.tx-wcell { display: grid; grid-template-columns: minmax(2rem, 1fr) 3.5rem; align-items: center; gap: var(--sp-2); min-width: 0; }
.tx-wcell > .mono { text-align: right; }
.tx-inv { margin: 0; overflow-wrap: anywhere; }
.tx-assume { margin: 0; padding-left: 1.1rem; list-style: disc; display: grid; gap: 2px; font-size: var(--fs-2); color: var(--ink-2); }
.tx-check > .label:not(:first-child) { margin-top: var(--sp-3); }

/* Calls (_kind_calls.html, callsviews.py): the mechanism of an outbound call replayed against qopt's stand-in. One mark per
   connection the stand-in saw (as written: muted and outlined; with one client: green); event-loop stalls as solid red
   on the loop's lane above the handlers' spans; a call that never returns as a hatched bar to the deadline. */
.cl-body { display: grid; gap: var(--sp-2); min-width: 0; }
.cl-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--sp-2) var(--sp-4); min-width: 0; }
.cl-row { display: grid; grid-template-columns: minmax(5rem, 7rem) minmax(0, 1fr) minmax(5rem, auto); align-items: center; gap: var(--sp-3); min-width: 0; min-height: 18px; }
.cl-name { font-size: var(--fs-2); color: var(--ink-2); }
.cl-marks { display: flex; align-items: center; gap: var(--sp-2); min-width: 0; overflow: hidden; }
.cl-dots { display: block; flex: none; max-width: 100%; }
.cl-dot { fill: var(--surface-3); stroke: var(--ink-3); stroke-width: 1; }
.cl-dot.is-after { fill: var(--win); stroke: var(--win); }
.cl-count { text-align: right; white-space: nowrap; }
.cl-count.is-stuck { color: var(--fail); font-weight: 600; }
.cl-note { margin: 0; overflow-wrap: anywhere; }
.cl-tl .tx-lane-labels span:first-child { color: var(--fail); }
.cl-stall { fill: var(--fail); }
.cl-span.is-before { fill: var(--ink-3); }
.cl-span.is-after { fill: var(--win); }
.cl-axis { position: relative; height: 14px; margin-left: calc(1.75rem + var(--sp-2)); font: 400 10px/14px var(--font-mono); color: var(--ink-3); min-width: 0; }
.cl-axis.is-hang { margin-left: calc(7rem + var(--sp-3)); margin-right: calc(10rem + var(--sp-3)); }
.cl-axis > span { position: absolute; top: 0; transform: translateX(-50%); white-space: nowrap; }
.cl-axis > span:first-child { transform: none; }
.cl-axis > span:last-child { transform: translateX(-100%); }
.cl-hang { display: grid; grid-template-columns: 7rem minmax(0, 1fr) 10rem; align-items: center; gap: var(--sp-2) var(--sp-3); min-width: 0; }
.cl-hsvg { display: block; width: 100%; min-width: 0; overflow: visible; }
.cl-wait.is-done { fill: var(--win); fill-opacity: .55; stroke: var(--win); stroke-width: 1; }
.cl-wait.is-stuck { fill: var(--fail); fill-opacity: .35; stroke: var(--fail); stroke-width: 1; stroke-dasharray: 3 2; }
.cl-fix { stroke: var(--accent); stroke-width: 2; stroke-dasharray: 3 2; }
.cl-deadline { stroke: var(--ink); stroke-width: 2; }
.cl-legend { margin-top: var(--sp-2); }
.cl-gate { margin: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--sp-2) var(--sp-3); overflow-wrap: anywhere; min-width: 0; }
@media (max-width: 640px) {
  .cl-row { grid-template-columns: minmax(0, 1fr) auto; } .cl-row > .cl-marks, .cl-row > .pm-svg { grid-column: 1 / -1; grid-row: 2; }
  .cl-hang { grid-template-columns: minmax(0, 1fr); } .cl-axis.is-hang { margin: 0; }
}

/* Heat (heat.py, km.heat_chip / heat_why / heat_panel): how hot the code path is. Words on every chip, and a border per
   level so it never rests on colour: hot solid and heavy, warm solid, rare dotted, not known dashed. */
.tbl col.w-12 { width: 12%; }
.chip.heat { gap: 0; font-weight: 600; }
.chip.heat.is-hot { --c: var(--write); --cb: var(--write-bg); border: 2px solid var(--write); }
.chip.heat.is-warm { --c: var(--warn); --cb: var(--warn-bg); border: 1px solid var(--warn); }
.chip.heat.is-cold { --c: var(--sev-low); --cb: var(--sev-low-bg); border: 1px dotted var(--sev-low); }
.chip.heat.is-unknown { --c: var(--ink-3); --cb: transparent; border: 1px dashed var(--line-strong); font-weight: 500; }
.chip.heat .mono { font-weight: 500; }
/* The list keeps the "why" next to its chip: the table's wrapper lets it out (the columns fit the width, so nothing scrolls). */
.tbl-wrap.is-pop { overflow: visible; }
.tbl.is-list td.heat-cell { position: relative; overflow: visible; }
.heat-cell .l1 { overflow: hidden; }
.heat-why { display: inline-block; max-width: 100%; }
.heat-why > summary { list-style: none; cursor: pointer; display: inline-flex; max-width: 100%; }
.heat-why > summary::-webkit-details-marker { display: none; }
.heat-why > summary .chip { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.heat-pop { position: absolute; z-index: 20; right: 0; top: calc(100% - 4px); width: min(28rem, calc(100vw - 2 * var(--gutter))); max-width: 28rem;
  padding: var(--sp-4) var(--sp-5); background: var(--surface); color: var(--ink); border: 1px solid var(--line-strong); border-radius: var(--r-3);
  box-shadow: var(--shadow-pop); white-space: normal; text-align: left; cursor: default; }
.heat-line { margin: 0 0 var(--sp-2); font-weight: 500; overflow-wrap: anywhere; }
.heat-basis { list-style: none; margin: var(--sp-3) 0 0; padding: 0; display: grid; gap: var(--sp-3); min-width: 0; }
.heat-basis > li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px var(--sp-3); min-width: 0; }
.heat-text { flex: 1 1 14rem; min-width: 0; overflow-wrap: anywhere; font-size: var(--fs-2); }
.heat-ev { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.heat-src.is-measured { border-color: var(--accent); color: var(--accent); }
.heat-src.is-user { border-color: var(--win); color: var(--win); }
.heat-src.is-agent { border-style: dashed; }
.heat-src.is-inferred { border-style: dotted; }
.heat-seg > a { white-space: nowrap; }
.heat-form { display: grid; gap: var(--sp-3); align-items: stretch; }
.heat-form .field { margin: 0; min-width: 0; }
.heat-form .select, .heat-form .input { width: 100%; min-width: 0; }
