/* Test Design Lab — scoped to the tools view so the study pages stay intact. */
.qa-lab {
  --lab-canvas: #152126;
  --lab-paper: #1d2b30;
  --lab-soft: #25363c;
  --lab-line: #3d5156;
  --lab-ink: #edf5f0;
  --lab-muted: #b4c6c4;
  --lab-accent: #a9e7cb;
  --lab-accent-ink: #143629;
  --lab-alert: #ffb49a;
  background: var(--lab-canvas);
  color: var(--lab-ink);
  border-radius: 3px;
  padding: 0 0 2.5rem;
  overflow: clip;
  font-size: 0.96rem;
}
[data-theme="light"] .qa-lab {
  --lab-canvas: #f0f1ea;
  --lab-paper: #fffefa;
  --lab-soft: #f3f4ee;
  --lab-line: #d6ddd5;
  --lab-ink: #172d30;
  --lab-muted: #536967;
  --lab-accent: #167963;
  --lab-accent-ink: #ffffff;
  --lab-alert: #a13720;
}
.qa-lab * { box-sizing: border-box; }
.qa-lab button, .qa-lab input, .qa-lab select { font: inherit; }
.qa-lab :is(button, a, input, select, summary):focus-visible { outline: 3px solid #e3a15e; outline-offset: 3px; }
.qa-lab .sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.lab-hero {
  background: #132d33;
  color: #f2f8ef;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 290px;
  min-height: 350px;
  position: relative;
  border-bottom: 6px solid #94dec2;
}
.lab-hero::before { content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .17; background: repeating-linear-gradient(90deg, transparent 0 71px, #95b8b2 72px, transparent 73px); }
.lab-hero-copy { position: relative; padding: clamp(2rem, 5vw, 4rem); max-width: 740px; }
.lab-eyebrow, .lab-chapter, .lab-pane-label, .lab-aside-index, .lab-aside-footer, .lab-endmark { font-size: .68rem; font-weight: 800; letter-spacing: .13em; }
.lab-eyebrow { display: flex; align-items: center; gap: .85rem; color: #afe7d4; margin-bottom: 2rem; }
.lab-mark { width: 39px; height: 39px; display: inline-grid; place-items: center; border: 1px solid #a4d3c7; color: #e9f7ee; font-size: .7rem; letter-spacing: -.04em; }
.lab-hero h2 { font: normal clamp(2.75rem, 5.5vw, 5.1rem)/.98 Georgia, Cambria, serif; letter-spacing: -.058em; margin: 0 0 1.2rem; }
.lab-hero h2 em { color: #a9e7cb; font-weight: 400; }
.lab-hero-copy > p:not(.lab-eyebrow) { max-width: 590px; color: #d2e2dd; line-height: 1.65; }
.lab-hero-link { display: inline-flex; align-items: center; gap: 1.3rem; color: #b9f2d8; background: transparent; border: 0; border-bottom: 1px solid #b9f2d8; padding: .25rem 0 .6rem; margin-top: 1.4rem; font-weight: 700; cursor: pointer; }
.lab-hero-link:hover { color: white; border-color: white; }
.lab-hero-aside { position: relative; border-left: 1px solid #4a7173; padding: 3rem 2rem; display: flex; flex-direction: column; justify-content: space-between; }
.lab-aside-index, .lab-aside-footer { color: #b4d8cc; }
.lab-aside-rule { width: 58px; height: 2px; background: #c2ecce; }
.lab-hero-aside > p { font: 1.85rem/1.55 Georgia, Cambria, serif; letter-spacing: -.035em; }
.lab-index { padding: 0 clamp(1.3rem, 4vw, 3.5rem); display: flex; border-bottom: 1px solid var(--lab-line); overflow-x: auto; }
.lab-index button { min-width: 190px; flex: 1; display: flex; align-items: center; gap: .7rem; padding: 1rem .45rem; background: transparent; color: var(--lab-ink); border: 0; border-bottom: 2px solid transparent; font-weight: 650; text-align: left; cursor: pointer; white-space: nowrap; }
.lab-index button:not(:last-child) { border-right: 1px solid var(--lab-line); margin-right: 1rem; }
.lab-index button > span:first-child { color: var(--lab-accent); font-size: .75rem; letter-spacing: .06em; }
.lab-index button > span:last-child { margin-left: auto; color: var(--lab-muted); }
.lab-index button:hover { border-bottom-color: var(--lab-accent); }
.lab-brief { display: grid; grid-template-columns: minmax(190px,.65fr) minmax(0,1.35fr); gap: 1.5rem 3rem; margin: 2.5rem clamp(1.25rem,4vw,3.5rem); padding: clamp(1.2rem,2.5vw,2rem); background: var(--lab-paper); border-left: 4px solid var(--lab-accent); }
.lab-brief h3 { font: normal clamp(1.65rem,3vw,2.6rem)/1.08 Georgia,Cambria,serif; letter-spacing: -.05em; margin: .35rem 0 .8rem; }
.lab-brief > div > p, .lab-brief-caveat { color: var(--lab-muted); line-height: 1.6; }
.lab-requirements { list-style: none; counter-reset: none; display: grid; gap: .65rem; }
.lab-requirements li { padding: .6rem .8rem; border: 1px solid var(--lab-line); background: var(--lab-soft); line-height: 1.5; }
.lab-brief-caveat { grid-column: 1 / -1; padding-top: .85rem; border-top: 1px solid var(--lab-line); font-size: .84rem; }
.lab-brief-caveat strong { color: var(--lab-ink); }
.lab-tool { margin: clamp(1.5rem, 3vw, 3rem) clamp(1.25rem, 4vw, 3.5rem) 0; scroll-margin-top: 1.25rem; }
.lab-tool-heading { display: flex; justify-content: space-between; align-items: end; gap: 2rem; margin-bottom: 1.25rem; }
.lab-tool-heading > p { max-width: 390px; color: var(--lab-muted); line-height: 1.55; }
.lab-chapter { color: var(--lab-accent); }
.lab-tool h3 { margin-top: .35rem; font: normal clamp(2rem, 3.5vw, 3.3rem)/1.1 Georgia, Cambria, serif; letter-spacing: -.05em; }
.lab-workspace { background: var(--lab-paper); border: 1px solid var(--lab-line); display: grid; grid-template-columns: minmax(290px, .87fr) minmax(0, 1.45fr); }
.lab-input-pane, .lab-output-pane, .lab-code-pane, .lab-mini-tool { padding: clamp(1.25rem, 2.7vw, 2rem); min-width: 0; }
.lab-input-pane, .lab-code-pane { border-right: 1px solid var(--lab-line); }
.lab-pane-label { color: var(--lab-muted); display: flex; align-items: center; gap: .8rem; margin-bottom: 1.35rem; }
.lab-pane-label > span:first-child { width: 25px; height: 25px; display: inline-grid; place-items: center; background: var(--lab-accent); color: var(--lab-accent-ink); letter-spacing: 0; font-size: .72rem; }
.lab-field-intro, .lab-mini-tool > p:first-of-type { color: var(--lab-muted); line-height: 1.6; margin-bottom: 1rem; }
.lab-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .8rem; }
.qa-lab .calc-input-group { margin-bottom: 1.1rem; }
.qa-lab .calc-label { color: var(--lab-ink); font-size: .83rem; font-weight: 650; margin-bottom: .42rem; }
.qa-lab .calc-input { width: 100%; background: var(--lab-soft); color: var(--lab-ink); border: 1px solid var(--lab-line); border-radius: 3px; min-height: 43px; padding: .55rem .7rem; font-size: .92rem; font-weight: 550; }
.qa-lab .calc-input:focus { border-color: var(--lab-accent); box-shadow: 0 0 0 2px var(--lab-accent); outline: none; }
.lab-presets { display: flex; flex-wrap: wrap; gap: .5rem; margin: .9rem 0 1.2rem; }
.lab-preset { background: transparent; color: var(--lab-muted); border: 1px solid var(--lab-line); border-radius: 99px; padding: .36rem .7rem; font-size: .78rem !important; cursor: pointer; }
.lab-preset:hover, .lab-preset:focus-visible { color: var(--lab-ink); border-color: var(--lab-accent); }
.lab-error { color: var(--lab-alert); padding: .65rem .75rem; background: var(--lab-soft); border-left: 3px solid var(--lab-alert); margin-bottom: 1rem; font-weight: 600; }
.lab-error[hidden] { display: none; }
.lab-note { border-top: 1px solid var(--lab-line); padding-top: 1rem; color: var(--lab-muted); font-size: .83rem; }
.lab-note summary { cursor: pointer; color: var(--lab-ink); font-weight: 700; }
.lab-note p { padding-top: .65rem; line-height: 1.6; }
.lab-follow-up { margin-top: 1.2rem; }
.lab-follow-up ul { padding: .7rem 0 0 1.15rem; line-height: 1.6; }
.lab-follow-up li + li { margin-top: .4rem; }
.lab-output-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; border-bottom: 1px solid var(--lab-line); padding-bottom: 1.2rem; margin-bottom: 1.2rem; }
.lab-output-head strong { display: block; font: 1.75rem/1 Georgia, Cambria, serif; }
.lab-output-head span { color: var(--lab-muted); font-size: .81rem; }
.lab-action { flex: none; border: 1px solid var(--lab-accent); background: var(--lab-accent); color: var(--lab-accent-ink); border-radius: 3px; padding: .6rem .8rem; font-weight: 750 !important; cursor: pointer; font-size: .84rem !important; }
.lab-action span { color: inherit; }
.lab-action:hover { filter: brightness(.91); }
.lab-action:disabled { opacity: .45; cursor: not-allowed; }
.lab-actions { display: flex; flex-wrap: wrap; gap: .55rem; align-items: center; }
.lab-quiet-action { background: transparent; color: var(--lab-ink); border: 1px solid var(--lab-line); border-radius: 2px; padding: .6rem .8rem; cursor: pointer; font-size: .83rem !important; font-weight: 700 !important; }
.lab-quiet-action:hover { border-color: var(--lab-accent); }
.lab-partitions { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.lab-partitions > div { background: var(--lab-soft); padding: .8rem 1rem; border-left: 3px solid var(--lab-accent); min-width: 0; }
.lab-partitions > div + div { border-left-color: #e9a681; }
.lab-partitions small, .lab-metric-pair small { display: block; font-size: .65rem; letter-spacing: .08em; font-weight: 800; color: var(--lab-muted); margin-bottom: .35rem; }
.lab-partitions strong { font-size: .91rem; line-height: 1.4; overflow-wrap: anywhere; }
.lab-values-label { margin: 1.2rem 0 .5rem; display: flex; align-items: baseline; flex-wrap: wrap; gap: .5rem; font-size: .81rem; color: var(--lab-muted); }
.lab-values-label span { color: var(--lab-ink); font-weight: 750; font-variant-numeric: tabular-nums; }
.lab-table-scroll { overflow-x: auto; }
.qa-lab .tool-table { margin: 0; width: 100%; border-collapse: collapse; font-size: .81rem; min-width: 500px; }
.qa-lab .tool-table th { background: var(--lab-soft); color: var(--lab-muted); font-size: .68rem; letter-spacing: .08em; text-transform: uppercase; }
.qa-lab .tool-table th, .qa-lab .tool-table td { padding: .75rem .65rem; border: 0; border-bottom: 1px solid var(--lab-line); text-align: left; }
.qa-lab .tool-table tr:hover td { background: var(--lab-soft); }
.qa-lab .tool-table td:first-child, .qa-lab .tool-table td:nth-child(2) { font-variant-numeric: tabular-nums; font-weight: 700; white-space: nowrap; }
.qa-lab .badge-valid, .qa-lab .badge-invalid { border-radius: 2px; font-size: .73rem; letter-spacing: .01em; }
.qa-lab .badge-valid { color: var(--lab-accent); background: transparent; border: 1px solid var(--lab-accent); }
.qa-lab .badge-invalid { color: var(--lab-alert); background: transparent; border: 1px solid var(--lab-alert); }
.lab-footnote { color: var(--lab-muted); font-size: .77rem; line-height: 1.55; margin-top: 1rem; }
.lab-section-card { background: var(--lab-paper); border: 1px solid var(--lab-line); padding: clamp(1.25rem,2.7vw,2rem); }
.lab-two-col-intro { display: grid; grid-template-columns: 1.2fr .8fr; align-items: start; gap: 1.25rem; margin-bottom: 1.4rem; }
.lab-two-col-intro p { line-height: 1.6; color: var(--lab-muted); }
.lab-two-col-intro .lab-insight { margin: 0; }
.qa-lab .lab-decision-table { min-width: 730px; }
.qa-lab .lab-decision-table tbody tr[data-selected="true"] td { background: var(--lab-soft); }
.lab-rule-select { background: transparent; border: 0; color: var(--lab-accent); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; font-weight: 800 !important; }
.lab-rule-check { width: 18px; height: 18px; accent-color: var(--lab-accent); cursor: pointer; }
.lab-rule-detail { margin-top: 1.2rem; border-left: 3px solid var(--lab-accent); padding: 1rem 1.25rem; background: var(--lab-soft); line-height: 1.55; }
.lab-rule-detail h4 { font: normal 1.35rem/1.2 Georgia,Cambria,serif; margin-bottom: .45rem; }
.lab-rule-detail p + p { margin-top: .35rem; }
.lab-rule-detail small { display: block; margin-top: .5rem; color: var(--lab-muted); }
.lab-state-track { display: flex; flex-wrap: wrap; gap: .55rem; margin: .4rem 0 1.25rem; }
.lab-state { border: 1px solid var(--lab-line); padding: .45rem .7rem; color: var(--lab-muted); font-size: .8rem; font-weight: 700; }
.lab-state[data-status="current"] { border-color: var(--lab-accent); color: var(--lab-ink); background: var(--lab-soft); }
.lab-state[data-status="visited"] { border-color: var(--lab-accent); color: var(--lab-accent); }
.lab-workflow-grid { grid-template-columns: minmax(270px,.9fr) minmax(0,1.1fr); }
.lab-event-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: .5rem; margin: .8rem 0 1.1rem; }
.lab-event-grid button { background: var(--lab-soft); color: var(--lab-ink); border: 1px solid var(--lab-line); padding: .65rem .7rem; text-align: left; cursor: pointer; font-size: .87rem !important; }
.lab-event-grid button:hover { border-color: var(--lab-accent); }
.lab-event-grid button span { float: right; color: var(--lab-muted); }
.lab-history { max-height: 220px; overflow-y: auto; padding-left: 1.25rem; color: var(--lab-muted); font-size: .85rem; line-height: 1.55; }
.lab-history li + li { margin-top: .42rem; }
.lab-history li strong { color: var(--lab-ink); }
.lab-method-note { margin: 2.7rem clamp(1.25rem,4vw,3.5rem) 0; border-top: 1px solid var(--lab-line); padding-top: 1rem; color: var(--lab-muted); font-size: .83rem; line-height: 1.6; }
.lab-method-note a { color: var(--lab-accent); font-weight: 700; }
.lab-duo { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--lab-line); border: 1px solid var(--lab-line); }
.lab-mini-tool { background: var(--lab-paper); }
.lab-mini-tool h4 { font: normal 1.7rem/1.15 Georgia, Cambria, serif; letter-spacing: -.04em; margin-bottom: .6rem; }
.lab-mini-tool > p:first-of-type { min-height: 4.75rem; }
.lab-metric-pair { display: grid; grid-template-columns: 1fr 1fr; margin-top: .7rem; }
.lab-metric-pair > div { border-top: 1px solid var(--lab-line); padding: 1rem 0; }
.lab-metric-pair strong { font: 2.5rem/1 Georgia, Cambria, serif; font-variant-numeric: tabular-nums; }
.lab-split-bar { height: 10px; background: #d39077; overflow: hidden; }
.lab-split-bar span { display: block; height: 100%; background: #47af8a; transition: width .25s ease; }
.lab-insight { margin-top: 1rem; background: var(--lab-soft); border-left: 3px solid var(--lab-accent); color: var(--lab-ink); padding: .85rem 1rem; line-height: 1.5; font-size: .88rem; }
.lab-risk-result { display: flex; align-items: center; gap: .7rem; margin: .65rem 0 1rem; }
.lab-risk-result span:first-child { font: 2.2rem/1 Georgia, Cambria, serif; white-space: nowrap; }
.lab-risk-result span:last-child { color: var(--lab-muted); font-size: .84rem; line-height: 1.4; }
.lab-risk-matrix { display: grid; grid-template-columns: 28px repeat(5, minmax(0,1fr)); gap: 4px; max-width: 440px; }
.lab-risk-matrix .lab-axis-cell { display: grid; place-items: center; color: var(--lab-muted); font-size: .71rem; font-weight: 750; }
.lab-risk-matrix button { aspect-ratio: 1.6; min-height: 29px; border: 1px solid transparent; color: #14312d; cursor: pointer; font-weight: 750 !important; font-size: .75rem !important; border-radius: 2px; }
.lab-risk-matrix button[data-band="low"] { background: #abdcc7; }
.lab-risk-matrix button[data-band="medium"] { background: #f3d49a; }
.lab-risk-matrix button[data-band="high"] { background: #e7a88f; }
.lab-risk-matrix button[aria-pressed="true"] { outline: 2px solid var(--lab-ink); outline-offset: 1px; z-index: 1; }
.lab-matrix-axis { margin-top: .5rem; color: var(--lab-muted); font-size: .74rem; }
.lab-code-pane { background: #16272d; color: #e4f5ed; }
.lab-code-pane .lab-pane-label { color: #b5d8ce; }
.lab-code-tag { margin-left: auto; font-size: .72rem; font-weight: 500; letter-spacing: 0; }
.lab-code { margin: 0; overflow: auto; padding: .8rem .3rem; background: transparent; color: #dbeae4; font: .85rem/1.95 ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace; }
.lab-code .code-flow-line { display: block; border-radius: 2px; padding: 0 .5rem; white-space: pre; min-width: max-content; }
.lab-code .code-flow-line.executed { background: #285544; color: #defce7; font-weight: 650; }
.lab-code-legend { display: flex; justify-content: space-between; flex-wrap: wrap; gap: .5rem; border-top: 1px solid #496264; padding-top: 1rem; color: #c3d9d3; font-size: .74rem; }
.lab-code-legend i { display: inline-block; width: .62rem; height: .62rem; background: #58b88b; margin-right: .3rem; }
.lab-code-pane .lab-footnote { color: #bed0cb; }
.qa-lab .coverage-toggle-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .55rem; }
.qa-lab .coverage-toggle-card { display: flex; justify-content: space-between; text-align: left; align-items: center; background: var(--lab-soft); border: 1px solid var(--lab-line); color: var(--lab-ink); border-radius: 2px; padding: .7rem .75rem; cursor: pointer; min-height: 69px; }
.qa-lab .coverage-toggle-card.active { background: var(--lab-soft); border-color: var(--lab-accent); box-shadow: inset 3px 0 0 var(--lab-accent); }
.qa-lab .coverage-toggle-card:hover { border-color: var(--lab-accent); }
.qa-lab .coverage-toggle-card strong, .qa-lab .coverage-toggle-card small { display: block; }
.qa-lab .coverage-toggle-card strong { font-size: .82rem; }
.qa-lab .coverage-toggle-card small { color: var(--lab-muted); font-size: .74rem; margin-top: .2rem; }
.lab-case-outcomes { color: var(--lab-muted); font: 700 .78rem ui-monospace, monospace; white-space: nowrap; margin-left: .4rem; }
.lab-coverage-results { border-top: 1px solid var(--lab-line); margin-top: 1.2rem; padding-top: .3rem; }
.lab-coverage-row { margin-top: .8rem; }
.lab-coverage-row > div:first-child { display: flex; justify-content: space-between; gap: 1rem; font-size: .83rem; }
.lab-coverage-row strong { font-variant-numeric: tabular-nums; }
.lab-progress { height: 8px; background: var(--lab-soft); margin-top: .4rem; }
.lab-progress span { display: block; height: 100%; width: 0; background: var(--lab-accent); transition: width .2s ease; }
.lab-endmark { display: flex; justify-content: space-between; margin: 2.5rem clamp(1.25rem, 4vw, 3.5rem) 0; padding-top: .8rem; border-top: 1px solid var(--lab-line); color: var(--lab-muted); }
@media (max-width: 970px) {
  .lab-hero { grid-template-columns: 1fr 220px; }
  .lab-workspace { grid-template-columns: 1fr; }
  .lab-workflow-grid { grid-template-columns: 1fr; }
  .lab-input-pane, .lab-code-pane { border-right: 0; border-bottom: 1px solid var(--lab-line); }
}
@media (max-width: 700px) {
  .lab-hero { grid-template-columns: 1fr; min-height: 0; }
  .lab-hero-aside { display: none; }
  .lab-tool-heading { display: block; }
  .lab-tool-heading > p { margin-top: .7rem; }
  .lab-duo { grid-template-columns: 1fr; }
  .lab-brief, .lab-two-col-intro { grid-template-columns: 1fr; }
  .lab-brief-caveat { grid-column: auto; }
  .lab-mini-tool > p:first-of-type { min-height: 0; }
  .lab-index { padding: 0 1rem; }
  .lab-index button { min-width: 145px; }
}
@media (max-width: 490px) {
  .lab-hero-copy { padding: 2rem 1.3rem; }
  .lab-hero h2 { font-size: 2.8rem; }
  .lab-form-grid, .lab-partitions, .qa-lab .coverage-toggle-grid { grid-template-columns: 1fr; }
  .lab-output-head { align-items: start; }
  .lab-output-head:has(.lab-actions) { flex-direction: column; }
  .lab-output-head strong { font-size: 1.45rem; }
  .lab-action { font-size: .75rem !important; }
  .lab-input-pane, .lab-output-pane, .lab-code-pane, .lab-mini-tool { padding: 1.15rem; }
}
@media (prefers-reduced-motion: reduce) {
  .qa-lab *, .qa-lab *::before, .qa-lab *::after { scroll-behavior: auto !important; transition-duration: 0.01ms !important; }
}
