/* Failure / stop semantics are red in every theme (uses --ac-red per theme). */
html body .pg-cards>.pg-card.pg-fail{--c:var(--ac-red)!important}
html body .pg-cards>.pg-card.pg-fail .pg-num{color:var(--ac-red)!important}
html body .gv-box[style*="ac-red"] h3,
html body .gv-h3.gv-h3-fail,
html body .gv-stop dt,
html body .gv-stop dd{color:var(--ac-red)!important}
html body .rs-review-result:has(#rs-review-state){border-top-color:var(--ac-red)}
html body:has([data-review="eligible"][aria-pressed="true"]) #rs-review-state{color:var(--accent-success)!important;border-color:var(--accent-success)!important}
html body:has([data-review="eligible"][aria-pressed="true"]) .rs-review-result{border-top-color:var(--accent-success)}
html body .form-feedback[data-state=error]{color:var(--ac-red)!important}

/* ---- Semantic color system (loaded last). Variables live in accents.css; table in BRAND-COLORS.md. ---- */
/* Card colors. Topic cards use the topic map; plain series use the ordered series palette (no red, no rose).
   Red is reserved for fail/stop. See BRAND-COLORS.md. */
html body .pg-cards>.pg-card:nth-child(6n+1),html body .metric-grid>div:nth-child(6n+1){--c:var(--series-1)}
html body .pg-cards>.pg-card:nth-child(6n+2),html body .metric-grid>div:nth-child(6n+2){--c:var(--series-2)}
html body .pg-cards>.pg-card:nth-child(6n+3),html body .metric-grid>div:nth-child(6n+3){--c:var(--series-3)}
html body .pg-cards>.pg-card:nth-child(6n+4),html body .metric-grid>div:nth-child(6n+4){--c:var(--series-4)}
html body .pg-cards>.pg-card:nth-child(6n+5),html body .metric-grid>div:nth-child(6n+5){--c:var(--series-5)}
html body .pg-cards>.pg-card:nth-child(6n+6),html body .metric-grid>div:nth-child(6n+6){--c:var(--series-6)}
html body .tp-setup{--c:var(--topic-setup)!important}
html body .tp-results{--c:var(--topic-results)!important}
html body .tp-evidence{--c:var(--topic-evidence)!important}
html body .tp-authority{--c:var(--topic-authority)!important}
html body .tp-planning{--c:var(--topic-planning)!important}
html body .tp-building{--c:var(--topic-building)!important}
html body .tp-review{--c:var(--topic-review)!important}
html body .tp-cost{--c:var(--topic-cost)!important}
html body .tp-models{--c:var(--topic-models)!important}
html body .tp-tools{--c:var(--topic-tools)!important}
html body .tp-method{--c:var(--topic-method)!important}
/* Semantic inline colors map to the named status variables. */
html body [style*="--c:var(--ac-red)"]{--c:var(--c-fail)!important}
/* Pink (reads close to red/rose) is not used as a decorative link-card hue; it maps to indigo. */
html body [style*="--c:var(--ac-pink)"]{--c:var(--ac-indigo)!important}
/* Status tags */
html body .gv-dem{color:var(--c-demo)}
html body .gv-imp{color:var(--c-built)}
html body .gv-plan{color:var(--c-wait)}
html body .gv-ok2{color:var(--c-pass)}
html body .gv-no{color:var(--c-fail)}
html body .gv-ex{color:var(--ac-teal)}
/* Mission demo: stage columns follow the role that owns the stage. */
html body .mv-col:nth-child(1){--c:var(--role-human)}
html body .mv-col:nth-child(2){--c:var(--role-blueprint)}
html body .mv-col:nth-child(3){--c:var(--role-builder)}
html body .mv-col:nth-child(4){--c:var(--role-reviewer)}
html body .mv-col:nth-child(5){--c:var(--c-pass)}
html body .mv-chip{border-color:var(--c-accent)!important;color:var(--c-accent)!important}
/* Lab: log kinds follow roles, outcomes follow status. */
html body .lab-ll .plan .k{color:var(--role-blueprint)}
html body .lab-ll .build .k{color:var(--role-builder)}
html body .lab-ll .pass .k,html body .lab-ll .pass .t{color:var(--c-pass)}
html body .lab-ll .wait .k,html body .lab-ll .wait .t{color:var(--c-wait)}
html body .lab-ll .fail .k,html body .lab-ll .fail .t{color:var(--c-fail)}
/* Mission demo: Grok is the planner (teal role); final ready state is pass green. */
html body .mv-av.glyph.lane-plan,html body #mvt-dm-planner .mv-av,html body #mvp-dm-planner .mv-av.glyph{--role:var(--role-planner)}
html body .mv-verdict.yes{color:var(--c-pass)!important}
html body .mv-gate:has(.mv-verdict.yes){border-left-color:var(--c-pass)}
/* Threads view: model and effort shown on every agent row, header and message (example values). */
html body .mv-mm{display:block;font-size:11px;line-height:1.35;font-weight:400;letter-spacing:0;text-transform:none;color:var(--t-fg-vmv-muted,var(--mv-muted,var(--muted)));overflow-wrap:anywhere}
html body .mv-who .mv-mm,html body .mv-pane-head .mv-mm{display:inline;margin-left:6px}
html body .mv-bub>.mv-mm{margin-bottom:4px}
html body .mv-tabs small{white-space:normal;text-align:right}
/* Threads sidebar: two-line DM tabs, role + provider, then model · effort. No truncation. */
html body .mv-chat{grid-template-columns:300px minmax(0,1fr)}
html body .mv-tabs [role=tab]{align-items:flex-start;white-space:normal;padding:8px 10px}
html body .mv-tabs [role=tab] .mv-av{flex:0 0 auto;margin-top:1px}
html body .mv-tl{display:flex;flex-direction:column;gap:2px;flex:1 1 auto;min-width:0}
html body .mv-tr{display:flex;align-items:baseline;justify-content:space-between;gap:8px}
html body .mv-tn{overflow-wrap:anywhere}
html body .mv-tabs [role=tab] small{margin-left:0;font-size:11px;line-height:1.35;color:var(--t-fg-vmv-muted,var(--mv-muted,var(--muted)));white-space:nowrap}
html body .mv-tabs [role=tab] .mv-tm{white-space:normal}
@media(max-width:1000px){html body .mv-chat{grid-template-columns:1fr}html body .mv-tabs{display:grid;grid-template-columns:repeat(auto-fill,minmax(230px,1fr));overflow:visible}html body .mv-tabs [role=tab]{white-space:normal}}
html body .mv-tabs [role=tab] .mv-tm{text-align:left;align-self:flex-start}
/* Midnight paper sections: re-derive status, series, topic and role colors from the darker paper spectrum (derived vars resolve where declared). */
html:not([data-theme]) .paper-section{--c-pass:var(--ac-green);--c-fail:var(--ac-red);--c-wait:var(--ac-amber);--c-built:var(--ac-blue);--c-demo:var(--ac-violet); --c-brand:var(--t-fg-vcoral,var(--coral,#ed9b92));--c-accent:var(--c-brand); --series-1:var(--ac-blue);--series-2:var(--ac-violet);--series-3:var(--ac-teal);--series-4:var(--ac-orange);--series-5:var(--ac-indigo);--series-6:var(--ac-green); --topic-setup:var(--ac-blue);--topic-results:var(--ac-green);--topic-evidence:var(--ac-green);--topic-authority:var(--role-human);--topic-planning:var(--role-blueprint);--topic-building:var(--role-builder);--topic-review:var(--role-reviewer);--topic-cost:var(--ac-amber);--topic-models:var(--ac-indigo);--topic-tools:var(--ac-blue);--topic-method:var(--ac-violet);--c-neutral:color-mix(in srgb,currentColor 45%,transparent); --role-strategy:var(--ac-indigo);--role-blueprint:var(--ac-teal);--role-builder:var(--ac-orange);--role-reviewer:var(--ac-pink);--role-ci:var(--ac-green);--role-human:var(--ac-amber);--role-record:var(--c-neutral); --role-planner:var(--role-blueprint);--role-builder-1:var(--role-builder);--role-builder-2:var(--role-builder);--role-builder-3:var(--role-builder);--role-you:var(--role-human)}
/* ...and back to the bright set inside the dark panels that sit in paper sections. */
html:not([data-theme]) .paper-section :is(.rs-experiment,.rs-screen-bar,.rs-review-result,.rs-review-result-top,.rs-chain,.rs-readout-grid,.rs-falsifier,.rs-screen,.rs-flow){--c-pass:var(--ac-green);--c-fail:var(--ac-red);--c-wait:var(--ac-amber);--c-built:var(--ac-blue);--c-demo:var(--ac-violet); --c-brand:var(--t-fg-vcoral,var(--coral,#ed9b92));--c-accent:var(--c-brand); --series-1:var(--ac-blue);--series-2:var(--ac-violet);--series-3:var(--ac-teal);--series-4:var(--ac-orange);--series-5:var(--ac-indigo);--series-6:var(--ac-green); --topic-setup:var(--ac-blue);--topic-results:var(--ac-green);--topic-evidence:var(--ac-green);--topic-authority:var(--role-human);--topic-planning:var(--role-blueprint);--topic-building:var(--role-builder);--topic-review:var(--role-reviewer);--topic-cost:var(--ac-amber);--topic-models:var(--ac-indigo);--topic-tools:var(--ac-blue);--topic-method:var(--ac-violet);--c-neutral:color-mix(in srgb,currentColor 45%,transparent); --role-strategy:var(--ac-indigo);--role-blueprint:var(--ac-teal);--role-builder:var(--ac-orange);--role-reviewer:var(--ac-pink);--role-ci:var(--ac-green);--role-human:var(--ac-amber);--role-record:var(--c-neutral); --role-planner:var(--role-blueprint);--role-builder-1:var(--role-builder);--role-builder-2:var(--role-builder);--role-builder-3:var(--role-builder);--role-you:var(--role-human)}
