/* Capability workbench pages: shared layout for the research-tool pages; page-specific
   blocks follow the shared wb-* rules. Colours come from the site tokens
   (--fg / --muted / --rule / --accent / --bg in assets/theme.scss), so light and dark sets apply. */

:root {
  --wb-bench: #6f6a60;                 /* benchmark outline (dashed) */
  --wb-fill: hsla(206, 70%, 32%, .10); /* stream polygon fill */
  --wb-warn-fg: #6f4500;
  --wb-warn-bg: rgba(140, 90, 0, .08);
  --wb-panel-bg: rgba(0, 0, 0, .02);
  --wb-grey: #8a8a8a;
}
:root[data-theme="dark"], body.quarto-dark {
  --wb-bench: #b9b3a6;
  --wb-fill: hsla(206, 70%, 60%, .16);
  --wb-warn-fg: #f0c06a;
  --wb-warn-bg: rgba(230, 170, 60, .12);
  --wb-panel-bg: rgba(255, 255, 255, .03);
  --wb-grey: #a8a8a8;
}

/* ---------------------------------------------------------------- title block
   Kicker: the front-matter `subtitle` ("Research Toolkit · …") names the menu entry; it is drawn above the
   unchanged h1 (it stays after the h1 in the DOM, so a screen reader hears the title first). */
#title-block-header .quarto-title { display: flex; flex-direction: column; }
#title-block-header .quarto-title > p.subtitle { order: -1; font-size: 13px; font-weight: 600; line-height: 1.4; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 0 0 .55rem; }
:root[lang^="zh"] #title-block-header .quarto-title > p.subtitle { font-size: 14px; letter-spacing: .02em; text-transform: none; }
/* one neutral status line (no coloured badges in the hero; per-function maturity labels stay further down) */
.wb-status .wb-status-k { font-weight: 600; color: var(--fg); margin-right: .25em; }
.wb-status .wb-si, .wb-status a { white-space: nowrap; }   /* each status item and link stays on one line; the separators wrap */

/* ---------------------------------------------------------------- hero: question, capability, Inputs / Analysis / Outputs, example */
.wb-hero { margin: .5rem 0 1.75rem; }
.wb-hero .wb-q { font-size: 1.45rem; line-height: 1.3; font-weight: 600; color: var(--fg); margin: 0 0 .5rem; }
.wb-hero .wb-sub { font-size: 1.02rem; line-height: 1.55; color: var(--fg); margin: 0 0 1rem; }
:root[lang^="zh"] .wb-hero .wb-q { font-size: 1.4rem; }
.wb-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 0 0 12px; }
.wb-card { border: 1px solid var(--rule); border-top: 2px solid var(--accent); border-radius: 3px; padding: 9px 12px; font-size: 14.5px; line-height: 1.5; background: var(--wb-panel-bg); }
.wb-card p { margin: 0; }
.wb-hero .wb-k { display: block; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); margin-bottom: 3px; }
:root[lang^="zh"] .wb-hero .wb-k { text-transform: none; letter-spacing: 0; font-size: 13px; }
/* full-width "Historical example & limitations": label / text rows, nothing collapsed */
.wb-example { border: 1px solid var(--rule); border-left: 3px solid var(--wb-bench); border-radius: 3px; padding: 9px 14px 10px; margin: 0 0 1rem; background: var(--wb-panel-bg); font-size: 14px; line-height: 1.5; }
.wb-example > p { margin: 0 0 4px; }
.wb-example dl { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 5px 16px; margin: 0; }
.wb-example dt { font-weight: 600; margin: 0; }
.wb-example dd { margin: 0; }
.wb-cta { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; margin: .25rem 0 .75rem; font-size: 15px; }
.wb-cta a.wb-btn { display: inline-block; padding: 6px 14px; border-radius: 3px; background: var(--accent); color: var(--bg) !important; border-bottom: 0 !important; font-weight: 600; text-decoration: none; }
.wb-cta a.wb-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.wb-date { display: inline-block; font-size: 12.5px; line-height: 1.45; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--rule); color: var(--fg); }  /* data-line chips drawn by a chart partial */
.wb-date strong { font-weight: 600; }
@media (max-width: 639.98px) {
  .wb-cards { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .wb-example dl { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .wb-example dd { margin-bottom: 6px; }
}

/* ---------------------------------------------------------------- functions: Ingest -> ... -> Export */
.wb-steps ol { list-style: none; counter-reset: wbstep; padding: 0; margin: .5rem 0 1.5rem; display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.wb-steps ol > li { counter-increment: wbstep; border: 1px solid var(--rule); border-radius: 3px; padding: 8px 10px 8px 36px; position: relative; font-size: 14px; line-height: 1.5; }
.wb-steps ol > li::before { content: counter(wbstep); position: absolute; left: 10px; top: 8px; width: 18px; height: 18px; border-radius: 50%; background: var(--accent); color: var(--bg); font-size: 11.5px; font-weight: 700; text-align: center; line-height: 18px; }
.wb-steps ol > li strong { display: block; font-weight: 600; }

/* ---------------------------------------------------------------- dependency diagram (Layer 1 -> Layer 2) */
.wb-flow { margin: .75rem 0 1rem; }
.wb-flow ol { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; align-items: stretch; gap: 0; }
.wb-flow li { flex: 1 1 120px; min-width: 0; position: relative; display: flex; }
.wb-flow .wb-node { display: block; flex: 1; min-width: 0; overflow-wrap: break-word; border: 1px solid var(--rule); border-radius: 3px; padding: 8px 9px; font-size: 13.5px; line-height: 1.4; background: var(--bg); margin-right: 22px; }
.wb-flow li:last-child .wb-node { margin-right: 0; }
.wb-flow li:not(:last-child)::after { content: "→"; position: absolute; right: 4px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 16px; }
.wb-flow .wb-node .wb-layer { display: block; font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; margin-bottom: 2px; }
:root[lang^="zh"] .wb-flow .wb-node .wb-layer { text-transform: none; letter-spacing: 0; font-size: 12px; }
.wb-flow .wb-node.wb-up { border-style: dashed; }
.wb-flow .wb-node.wb-here { border: 2px solid var(--accent); background: var(--wb-fill); }
.wb-flow .wb-node .wb-tag { display: block; margin-top: 4px; white-space: normal; max-width: 100%; }  /* the pill wraps inside its box */
.wb-flow-legend { font-size: 13px; color: var(--muted); margin: .4rem 0 0; }
@media (max-width: 639.98px) {
  .wb-flow ol { flex-direction: column; }
  .wb-flow li { min-width: 0; }
  .wb-flow .wb-node { margin: 0 0 22px 0; }
  .wb-flow li:last-child .wb-node { margin-bottom: 0; }
  .wb-flow li:not(:last-child)::after { content: "↓"; right: auto; left: 18px; top: auto; bottom: 1px; transform: none; }
}
.wb-chain ol { margin: .25rem 0 1rem; padding-left: 1.4em; font-size: 15px; }
.wb-chain ol li { margin: 0 0 .3em; }

/* ---------------------------------------------------------------- return-state workbench (rs-*) */
.rs-app { margin: .25rem 0 0; }
.rs-app[hidden] { display: none; }  /* no JavaScript: the <noscript> image and the build-time table stand in */
.rs-warn:empty, .rs-detail:empty, .rs-summary:empty, .rs-app .tbl-note:empty { display: none; }  /* placeholders before the data load or after a failed load */
.rs-controls { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: 8px 14px; margin: 0 0 .6rem; padding: 10px 12px; border: 1px solid var(--rule); border-radius: 3px; background: var(--wb-panel-bg); }
.rs-controls[hidden] { display: none; }
.rs-ctl { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.rs-ctl > label, .rs-ctl > legend, .rs-ctl .rs-lab { font-size: 12.5px !important; font-weight: 600; color: var(--muted) !important; margin: 0; padding: 0; }
.rs-ctl select { font-size: 14px; padding: 5px 6px; border: 1px solid var(--rule); border-radius: 3px; background: var(--bg); color: var(--fg); max-width: 100%; width: 100%; min-height: 36px; text-overflow: ellipsis; }
.rs-ctl select:focus-visible, .rs-mode input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }
fieldset.rs-mode { border: 0; margin: 0; padding: 0; min-width: 0; }
.rs-mode .rs-seg { display: inline-flex; border: 1px solid var(--rule); border-radius: 3px; overflow: hidden; }
.rs-mode label { margin: 0; cursor: pointer; font-size: 14px !important; color: var(--fg) !important; }
.rs-mode input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.rs-mode label span { display: inline-block; padding: 6px 12px; min-height: 34px; line-height: 22px; }
.rs-mode input:checked + span { background: var(--accent); color: var(--bg); font-weight: 600; }
.rs-dataline { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 .6rem; }
.rs-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.rs-chart { min-height: 300px; max-width: 640px; margin: 0 auto; }
.rs-chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.rs-chart svg text { font-family: inherit; fill: var(--fg); }
.rs-ring { fill: none; stroke: var(--rule); stroke-width: 1; }
.rs-axis { stroke: var(--rule); stroke-width: 1; }
.rs-ringlab { font-size: 10.5px; fill: var(--muted) !important; }
.rs-poly-s { fill: var(--wb-fill); stroke: var(--accent); stroke-width: 2.4; }
.rs-poly-b { fill: none; stroke: var(--wb-bench); stroke-width: 2; stroke-dasharray: 7 5; }
.rs-dot-s { fill: var(--accent); }
.rs-dot-b { fill: var(--bg); stroke: var(--wb-bench); stroke-width: 1.8; }
.rs-spoke { cursor: pointer; outline: none; }
.rs-spoke .rs-hit { stroke: transparent; stroke-width: 26; }
.rs-spoke .rs-lab { font-size: 12.5px; }
.rs-spoke .rs-lab-n { font-size: 11px; fill: var(--muted) !important; }
.rs-spoke.rs-small .rs-lab-n { fill: var(--wb-warn-fg) !important; font-weight: 600; }
.rs-spoke:hover .rs-lab, .rs-spoke.rs-active .rs-lab { font-weight: 700; text-decoration: underline; }
.rs-spoke:focus-visible .rs-focus, .rs-spoke.rs-active .rs-focus { stroke: var(--accent); stroke-width: 1.5; fill: none; }
.rs-spoke .rs-focus { stroke: transparent; fill: none; }
.rs-legend { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 13px; margin: .3rem 0 0; }
.rs-legend .rs-sw { display: inline-block; width: 26px; height: 0; vertical-align: middle; margin-right: 6px; }
.rs-legend .rs-sw-s { border-top: 2.4px solid var(--accent); }
.rs-legend .rs-sw-b { border-top: 2px dashed var(--wb-bench); }
/* raw-value view: one row per metric, a track per unit group */
.rs-raw { font-size: 13.5px; }
.rs-raw h4 { font-size: 13px; font-weight: 600; color: var(--muted); margin: .7rem 0 .2rem; text-transform: none; }
.rs-row { display: grid; grid-template-columns: minmax(110px, 38%) minmax(0, 1fr); gap: 8px; align-items: center; padding: 4px 4px; border-radius: 3px; cursor: pointer; }
.rs-row:hover, .rs-row.rs-active { background: var(--wb-panel-bg); outline: 1px solid var(--rule); }
.rs-row:focus-visible { outline: 2px solid var(--accent); }
.rs-row .rs-name { line-height: 1.3; }
.rs-row .rs-name small { display: block; color: var(--muted); font-size: 11.5px; }
.rs-row.rs-small .rs-name small { color: var(--wb-warn-fg); font-weight: 600; }
.rs-track { position: relative; height: 34px; border-bottom: 1px solid var(--rule); }
.rs-track .rs-zero { position: absolute; top: 2px; bottom: 0; border-left: 1px dashed var(--muted); }
.rs-track .rs-link { position: absolute; top: 15px; height: 2px; background: var(--rule); }
.rs-track .rs-mk { position: absolute; top: 9px; width: 14px; height: 14px; margin-left: -7px; }
.rs-track .rs-mk-s { background: var(--accent); border-radius: 50%; }
.rs-track .rs-mk-b { background: var(--bg); border: 2px solid var(--wb-bench); transform: rotate(45deg); width: 12px; height: 12px; margin-left: -6px; top: 10px; }
.rs-track .rs-tick { position: absolute; bottom: -15px; font-size: 10.5px; color: var(--muted); transform: translateX(-50%); white-space: nowrap; }
.rs-group { margin-bottom: 14px; }
/* side panel: warnings + details */
.rs-side { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.rs-warn { margin: 0 0 .6rem; font-size: 13.5px; line-height: 1.5; color: var(--wb-warn-fg); background: var(--wb-warn-bg); border-left: 3px solid var(--wb-warn-fg); padding: 7px 10px; border-radius: 0 3px 3px 0; }
.rs-warn ul { margin: .2rem 0 0; padding-left: 1.1em; }
.rs-warn li { margin: 0 0 .15em; }
.rs-warn p { margin: 0; }
.rs-detail { font-size: 13.5px; line-height: 1.5; border: 1px solid var(--rule); border-radius: 3px; padding: 8px 10px; background: var(--bg); }
.rs-detail h4 { font-size: 15px; font-weight: 600; margin: 0 0 .3rem; text-transform: none; color: var(--fg); }
.rs-detail dl { margin: 0; display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 2px 10px; }
.rs-detail dt { font-weight: 600; color: var(--muted); font-size: 12.5px; }
.rs-detail dd { margin: 0; overflow-wrap: anywhere; }
.rs-detail code { font-size: 12px; white-space: normal; }
.rs-detail .rs-hint { color: var(--muted); font-size: 12.5px; margin: .35rem 0 0; }
.rs-table { margin-top: .4rem; }
.rs-table caption { caption-side: top; font-size: 13px; color: var(--muted); padding: 0 0 .3rem; text-align: left; }
.rs-table tr.rs-active td { background: var(--wb-panel-bg); }
.rs-table td.rs-small-n { color: var(--wb-warn-fg); font-weight: 600; }
.rs-tools { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; font-size: 13.5px; margin: .2rem 0 .4rem; }
.rs-tools button { font-size: 13.5px; padding: 5px 12px; border: 1px solid var(--accent); color: var(--accent); background: var(--bg); border-radius: 3px; cursor: pointer; min-height: 34px; }
.rs-tools button:hover { background: var(--wb-fill); }
.rs-tools button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.rs-status { font-size: 12.5px; color: var(--muted); }
.rs-noscript img { width: 100%; height: auto; border: 1px solid var(--rule); }
.rs-summary { font-size: 13px; line-height: 1.5; color: var(--muted); margin: .6rem 0 .4rem; }
/* clipped / by-construction markers, spoke key, reference rows, keyboard rows */
.rs-mk-clip { fill: var(--bg); stroke-width: 1.8; }
.rs-mk-clip-s { stroke: var(--accent); }
.rs-mk-clip-b { stroke: var(--wb-bench); }
.rs-mk-con { fill: var(--bg); stroke: var(--wb-grey); stroke-width: 1.8; }
.rs-legend .rs-mkl { display: inline-block; width: 10px; height: 10px; vertical-align: middle; margin-right: 6px; background: var(--bg); }
.rs-legend .rs-mkl-clip { border: 1.8px solid var(--fg); }
.rs-legend .rs-mkl-con { border: 1.8px solid var(--wb-grey); transform: rotate(45deg); width: 9px; height: 9px; margin-left: 2px; }
.rs-key { font-size: 12.5px; line-height: 1.5; color: var(--muted); margin: .35rem 0 0; }
.rs-key[hidden] { display: none; }
.rs-table tr[data-i] { cursor: pointer; }
.rs-table tr[data-i]:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.rs-table tr.rs-ref td { color: var(--muted); border-top: 1px dashed var(--rule); }
.rs-table small.rs-con { display: block; font-size: 11px; color: var(--muted); font-weight: 400; }
.rs-detail .rs-hint-inline { display: block; color: var(--muted); font-size: 12px; }
@media (max-width: 599.98px) {
  .rs-controls { grid-template-columns: minmax(0, 1fr); }
  .rs-row { grid-template-columns: minmax(96px, 40%) minmax(0, 1fr); }
  .rs-detail dl { grid-template-columns: minmax(0, 1fr); }
  .rs-detail dt { margin-top: 4px; }
}

/* ================================================================ forecast-evaluation
   Macro Forecast Evaluation & Regime Diagnostics (projects/forecast-evaluation). Only fe-* classes;
   the shared wb-* classes above are reused unchanged. */
.fe-controls { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 8px 16px; margin: .25rem 0 .5rem; padding: 10px 12px; border: 1px solid var(--rule); border-radius: 3px; background: var(--wb-panel-bg); }
.fe-controls form { margin: 0 !important; display: flex !important; flex-direction: column; align-items: stretch !important; gap: 4px; width: auto !important; max-width: 100%; }
.fe-controls form > label { font-size: 12.5px !important; font-weight: 600; color: var(--muted) !important; width: auto !important; padding: 0 !important; text-align: left !important; }
.fe-controls form > div { display: flex; flex-wrap: wrap; gap: 2px 12px; width: auto !important; justify-content: flex-start; margin: 0 !important; }
.fe-controls form > div label { font-size: 14px !important; line-height: 1.35; color: var(--fg) !important; display: inline-flex; align-items: flex-start; gap: 6px; min-height: 30px; padding: 3px 0; cursor: pointer; width: auto !important; }
.fe-controls form > div label input { margin: 3px 0 0 !important; flex: none; }
.fe-controls select { font-size: 14px; padding: 5px 6px; border: 1px solid var(--rule); border-radius: 3px; background: var(--bg); color: var(--fg); max-width: 100%; min-height: 36px; width: 100%; }
.fe-controls input:focus-visible, .fe-controls select:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.fe-state { font-size: 13.5px; color: var(--muted); margin: 0 0 1rem; }
.fe-state strong { color: var(--fg); font-weight: 600; }
.fe-keys { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 12.5px; color: var(--muted); margin: .2rem 0 .3rem; }
.fe-key { display: inline-flex; align-items: center; gap: 6px; }
.fe-chart svg { display: block; max-width: 100%; height: auto; overflow: visible; }
.fe-errors tr.fe-sel td, .fe-sens td.fe-sel { background: var(--wb-fill); font-weight: 600; }
.fe-errors tr.fe-base td { color: var(--muted); }
.fe-sens .fe-sub { color: var(--muted); font-size: 12px; font-weight: 400; white-space: nowrap; }
.fe-dm { margin: .2rem 0 .8rem; }
.fe-dm-table { max-width: 640px; }
.fe-dm-table caption, .fe-sens caption, .fe-split caption { caption-side: top; font-size: 13px; color: var(--muted); padding: 0 0 .3rem; text-align: left; }
.fe-dm-table th { font-weight: 400; text-align: left !important; }
.fe-verdict { font-size: 14px; margin: .4rem 0 0; }
.fe-details { margin: .3rem 0 .8rem; font-size: 13.5px; }
.fe-details summary { cursor: pointer; color: var(--accent); }
.fe-details summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.fe-scroll { max-height: 320px; overflow-y: auto; }
.fe-failed img { border: 1px solid var(--rule); }
@media (max-width: 599.98px) {
  .fe-controls { grid-template-columns: minmax(0, 1fr); }
  .fe-sens .fe-sub { white-space: normal; }
}
/* ================================================================ end forecast-evaluation */
