/* Composer Benchmark: the stage page's pills, mover cards and describe_house fields. Rules sit under .cbr; tokens come
   from composer_benchmark_tokens.css. */

/* Figures: the baseline's shapes, faint and dotted under the prediction */
.cbr .hpfbase { fill: none; stroke: var(--muted); stroke-width: 1.4; stroke-dasharray: 1.5 3; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.cbr .hpfkey.base { border-top: 2px dotted var(--muted); margin-left: 8px; }

/* Pills, glyph text and the stage page's controls */
.cbr .pill { display: inline-flex; align-items: center; gap: 5px; border-radius: 99px; padding: 1px 9px; font-size: 0.76rem; font-weight: 600; white-space: nowrap; }
.cbr .pill.better { background: var(--better-soft); color: var(--better); }
.cbr .pill.worse { background: var(--worse-soft); color: var(--worse); }
.cbr .pill.same { background: var(--same-soft); color: var(--same); }
.cbr .pill.sm { font-size: 0.64rem; padding: 0 6px; margin-left: 4px; }
.cbr .ok { color: var(--better); font-weight: 600; }
.cbr .bad { color: var(--worse); font-weight: 600; }
.cbr .btn.off { color: var(--muted); cursor: default; border-style: dashed; }
.cbr .banner.held { background: var(--gold-soft); }
.cbr .legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 0.76rem; color: var(--muted); align-items: center; }

/* Movers */
.cbr .mcard { border: 1px solid var(--line); border-left: 3px solid var(--line-strong); border-radius: 10px; padding: 10px 12px; background: var(--sunk); display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.cbr .mcard.better { border-left-color: var(--better); }
.cbr .mcard.worse { border-left-color: var(--worse); }
.cbr .mcard .hd { display: flex; flex-wrap: wrap; gap: 2px 10px; align-items: baseline; }
.cbr .mcard .hd .k, .cbr .regrows .k { font-family: var(--mono); font-size: 0.7rem; color: var(--muted); }
.cbr .mcard .hd .sc { margin-left: auto; font-family: var(--mono); font-size: 0.8rem; white-space: nowrap; }
.cbr .mcard .hpfig { width: min(100%, 360px); }
.cbr .mcard table { border-collapse: collapse; width: 100%; }
.cbr .mcard td, .cbr .mcard th { padding: 4px 6px; text-align: left; vertical-align: top; }
.cbr .regrows { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px; font-size: 0.8rem; }
.cbr .tagrow { display: flex; flex-wrap: wrap; gap: 10px; }
.cbr .tagpick { margin: 0; display: flex; flex-direction: column; gap: 4px; width: 140px; }
.cbr .tagpick img, .cbr .tagpick .tagnone { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 8px; background: var(--paper); outline: 2px dashed var(--worse); outline-offset: -1px; display: flex; align-items: center; justify-content: center; font-size: 0.72rem; color: var(--muted); }
.cbr .swatch { display: inline-block; width: 12px; height: 12px; border-radius: 3px; border: 1px solid var(--line-strong); vertical-align: -2px; margin-right: 4px; }

/* Describe house's fields (Runs::FieldsDiffComponent): one table in fixed columns, each row a card under 640px */
.cbr .fieldsdiff { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.cbr table.dfields { border-collapse: collapse; width: 100%; table-layout: fixed; font-size: 0.85rem; }
.cbr table.dfields .c-fd, .cbr table.dfields .c-df { width: 28%; }
.cbr table.dfields .c-out, .cbr table.dfields .c-go { width: 22%; }
.cbr table.dfields thead th { text-align: left; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); font-weight: 600; padding: 6px 8px; border-bottom: 1px solid var(--line); }
.cbr table.dfields tbody th, .cbr table.dfields td { text-align: left; font-weight: 400; padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: top; overflow-wrap: anywhere; }
.cbr table.dfields tbody tr:last-child > * { border-bottom: 0; }
.cbr table.dfields .mono, .cbr table.dfields .df { font-variant-numeric: tabular-nums; }
.cbr table.dfields .dline { display: block; }
.cbr details.matched summary { font-size: 0.78rem; color: var(--muted); cursor: pointer; }
.cbr details.matched[open] { margin-top: 18px; }
.cbr details.matched[open] summary { margin-bottom: 6px; }
@media (max-width: 640px) {
  .cbr table.dfields, .cbr table.dfields tbody { display: block; }
  .cbr table.dfields colgroup, .cbr table.dfields thead { display: none; }
  .cbr table.dfields tbody tr { display: grid; grid-template-columns: minmax(0, max-content) minmax(0, 1fr); grid-template-areas: "fd fd" "out go" "df df"; align-items: center; gap: 4px 8px; padding: 10px 12px; margin-bottom: 8px; border: 1px solid var(--line); border-radius: 10px; background: var(--sunk); }
  .cbr table.dfields tbody th, .cbr table.dfields td { display: block; padding: 0; border: 0; }
  .cbr table.dfields tbody th { grid-area: fd; font-weight: 600; }
  .cbr table.dfields .out { grid-area: out; }
  .cbr table.dfields .go { grid-area: go; }
  .cbr table.dfields .go::before { content: "→ "; content: "→ " / ""; color: var(--muted); }
  .cbr table.dfields .df { grid-area: df; }
  .cbr details.matched summary { padding-block: 13px; }
}
.cbr .cbadge.fl { font-size: 0.66rem; font-weight: 600; border-radius: 99px; padding: 0 7px; border: 1px solid var(--warn); color: var(--warn); white-space: nowrap; cursor: help; }
.cbr .stats .statlines { list-style: none; margin: 0 0 6px; padding: 0; font-size: 0.82rem; }
.cbr .stats details summary { font-size: 0.78rem; color: var(--muted); cursor: pointer; }
.cbr .stats details ul { margin: 6px 0 0; padding-left: 18px; }

/* The Run page and the Stage page (RL-2317): header chips, the cards, the shared table, the stage chart, dialogs. Under .cbr; tokens from composer_benchmark_tokens.css. */
.cbr .sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.cbr .eyebrow { font-size: 0.72rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.cbr .runchips { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 6px; }
.cbr .runchip { font-size: 0.78rem; border: 1px solid var(--line-strong); border-radius: 8px; padding: 4px 10px; }
.cbr .runchip .muted { margin-right: 2px; }
.cbr .cardhead { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.cbr .cardhead > :last-child:not(h2):not(.muted) { margin-left: auto; }
.cbr .cardhead.pad { padding: 18px 20px 12px; }
.cbr .cardfoot { padding: 10px 16px 14px; border-top: 1px solid var(--line); }
.cbr .card.flush { padding: 0; gap: 0; overflow: hidden; }
.cbr .stagetitle { font-variant-numeric: tabular-nums; }
.cbr .stagetitle .runlink { color: var(--ink); text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 5px; }
.cbr .kindpill { display: inline-block; font-size: 0.76rem; font-weight: 600; border-radius: 6px; padding: 2px 8px; color: var(--accent); background: var(--accent-soft); white-space: nowrap; }
.cbr .kindpill.pattern { color: var(--ink); background: var(--same-soft); }
.cbr .pill.nc { white-space: nowrap; }
.cbr kbd { font-family: var(--mono); font-size: 0.7rem; color: var(--muted); border: 1px solid var(--line-strong); border-radius: 4px; padding: 0 5px; }

/* Change run, Compare with, the Actions menu */
.cbr details.changerun, .cbr details.menu { position: relative; display: inline-block; font-size: 0.8rem; font-weight: 500; }
.cbr details.changerun > summary, .cbr details.menu > summary { list-style: none; cursor: pointer; color: var(--accent); }
.cbr details.changerun > summary::-webkit-details-marker, .cbr details.menu > summary::-webkit-details-marker { display: none; }
.cbr details.menu > summary { color: var(--ink); }
.cbr details.changerun > ul, .cbr details.menu > .menulist { position: absolute; z-index: 10; margin: 6px 0 0; padding: 6px; list-style: none; min-width: 220px; max-height: 320px; overflow-y: auto; background: var(--paper); border: 1px solid var(--line-strong); border-radius: 10px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 2px; }
.cbr details.menu > .menulist { right: 0; }
.cbr details.changerun a, .cbr details.menu .menulist a, .cbr details.menu .menulist button { display: block; width: 100%; text-align: left; padding: 7px 10px; border-radius: 6px; color: var(--ink); text-decoration: none; background: none; border: 0; font: inherit; font-size: 0.85rem; cursor: pointer; }
.cbr details.changerun a:hover, .cbr details.menu .menulist a:hover, .cbr details.menu .menulist button:hover { background: var(--sunk); }
.cbr details.changerun a[aria-current], .cbr details.changerun a[aria-current]:hover { background: var(--accent-soft); }
.cbr .menulist form { margin: 0; }
.cbr .comparepick { display: flex; align-items: center; gap: 6px; margin-left: auto; font-size: 0.82rem; color: var(--muted); }
.cbr .comparepick select { font: inherit; font-size: 0.82rem; color: var(--ink); background: var(--sunk); border: 1px solid var(--line-strong); border-radius: 8px; padding: 4px 8px; max-width: 100%; }

/* Hypothesis tested */
.cbr .hypo { display: flex; flex-direction: column; gap: 10px; }
.cbr .hypo + .hypo { padding-top: 12px; border-top: 1px solid var(--line); }
.cbr .hypo-note { display: flex; gap: 12px; align-items: flex-start; }
.cbr .hypo-text { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.cbr .hypo-body { color: var(--muted); overflow-wrap: anywhere; }
.cbr .hypo-outcome { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding-top: 10px; border-top: 1px solid var(--line); font-size: 0.84rem; }
.cbr .hypo-record { margin-left: auto; }
.cbr dialog.outcomedialog { margin: 10vh auto auto; max-height: calc(90vh - 16px); overflow-y: auto; width: 640px; max-width: calc(100% - 32px); padding: 18px 20px; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--paper); color: var(--ink); box-shadow: var(--shadow); font-size: 0.84rem; }
.cbr dialog.outcomedialog::backdrop { background: rgba(5, 10, 20, 0.6); }
.cbr dialog.outcomedialog h2 { font-size: 1.05rem; font-weight: 600; margin-bottom: 14px; }
.cbr .outcomeform { display: flex; flex-direction: column; gap: 14px; }
.cbr .outcomeform fieldset.finding { border: 0; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; min-width: 0; }
.cbr .outcomeform fieldset.finding legend { padding: 0; margin-bottom: 6px; color: var(--muted); }
.cbr .outcomeform fieldset.finding textarea { flex: 1 1 100%; }
.cbr .outcomeform .field { color: var(--muted); font-weight: 400; font-size: 0.84rem; }
.cbr .dialog-actions { justify-content: flex-end; }
body:has(.cbr dialog.outcomedialog[open]) { overflow: hidden; }

/* The shared table: header row, fixed columns, no wrapping in score columns */
.cbr .ctable { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 0.85rem; }
.cbr .ctable th { text-align: left; font-size: 0.7rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); padding: 8px 8px; border-top: 1px solid var(--line); white-space: nowrap; }
.cbr .ctable thead th:first-child, .cbr .ctable td:first-child, .cbr .ctable tbody th:first-child { padding-left: 20px; }
.cbr .ctable td, .cbr .ctable tbody th { padding: 9px 8px; border-top: 1px solid var(--line); vertical-align: middle; text-align: left; font-weight: 400; text-transform: none; letter-spacing: 0; font-size: 0.85rem; color: var(--ink); }
.cbr .ctable td:last-child { padding-right: 20px; }
.cbr .ctable .n { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
.cbr .ctable th.n { font-family: var(--body); }
.cbr .ctable .c-stage { width: 190px; } .cbr .ctable .c-n { width: 62px; } .cbr .ctable .c-chg { width: 78px; } .cbr .ctable .c-verdict { width: 124px; }
.cbr .ctable .c-houses { width: 100px; } .cbr .ctable .c-hn { width: 78px; } .cbr .ctable .c-chev { width: 36px; } .cbr .ctable .c-ans { width: 180px; } .cbr .ctable .c-bar { width: 150px; }
.cbr .ctable .c-hs { width: 104px; } .cbr .ctable .c-hyp { width: 132px; } .cbr .ctable .c-house { width: 84px; } .cbr .ctable .c-sc { width: 56px; } .cbr .ctable .c-open { width: 72px; }
.cbr .ctable .nowrap { white-space: nowrap; }
.cbr .ctable td.bad { color: var(--warn); }
.cbr .ctable .tone-warn { color: var(--gold); } .cbr .ctable .tone-worse { color: var(--warn); } .cbr .ctable .tone-ok { color: var(--ink); }
.cbr .ctable .chev { text-align: right; color: var(--muted); }
.cbr .stagetable tbody tr { position: relative; }
.cbr .stagetable tbody tr:hover { background: rgba(255, 255, 255, 0.03); }
.cbr .stagetable a.rowlink { color: var(--ink); text-decoration: none; font-weight: 500; }
.cbr .stagetable a.rowlink::after { content: ""; position: absolute; inset: 0; }
.cbr .stagetable .stagename .k { display: inline-block; min-width: 18px; text-align: right; margin-right: 10px; color: var(--muted); font-size: 0.75rem; }
.cbr .stagetable .score { font-weight: 500; }
.cbr .stagetable tr.helper, .cbr .stagetable tr.quiet { opacity: 0.55; }
.cbr .stagetable .weakest { color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cbr .stagetable .weakest .tone-warn { color: var(--gold); } .cbr .stagetable .weakest .tone-worse { color: var(--warn); }
.cbr .casetable tbody.case.open { background: rgba(255, 255, 255, 0.03); }
.cbr .casetable .answer { font-weight: 500; }
.cbr .casetable .barcell { white-space: nowrap; }
.cbr .casetable .barcell .mono { display: inline-block; width: 36px; }
.cbr .casetable .meter { display: inline-block; vertical-align: middle; width: calc(100% - 46px); height: 6px; border-radius: 3px; background: var(--same-soft); }
.cbr .casetable .meter span { display: block; height: 100%; border-radius: 3px; background: var(--accent); }
.cbr .casetable .meter span.tone-warn { background: var(--gold); } .cbr .casetable .meter span.tone-worse { background: var(--warn); }
.cbr .casetable .wide { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cbr .casetable .wide .linkbtn { background: none; border: 0; padding: 0; cursor: pointer; font-size: 0.78rem; }
.cbr .casetable tr.wrongrow > td { padding: 4px 20px 16px 210px; border-top: 0; }
.cbr .btn.xs { font-size: 0.74rem; padding: 3px 8px; border-radius: 8px; white-space: nowrap; }
.cbr .wrongtable { max-width: 760px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--sunk); }
.cbr .wrongtable th, .cbr .wrongtable td { padding: 7px 14px; }
.cbr .wrongtable thead th:first-child, .cbr .wrongtable td:first-child { padding-left: 14px; }
.cbr .wrongtable td:last-child { padding-right: 14px; }
.cbr .wrongtable th { border-top: 0; border-bottom: 1px solid var(--line-strong); }
.cbr .movertable td.wide { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cbr .segtabs { margin-left: auto; display: inline-flex; gap: 2px; background: var(--sunk); border: 1px solid var(--line); border-radius: 8px; padding: 2px; }
.cbr .segtabs a { font-size: 0.78rem; border-radius: 6px; padding: 3px 9px; color: var(--muted); text-decoration: none; }
.cbr .segtabs a[aria-current] { background: var(--accent-soft); color: var(--ink); }

/* Stage page: figures, the chart over the runs on the same houses, notes */
.cbr .figures { display: flex; flex-wrap: wrap; gap: 8px 40px; padding: 4px 0 2px; }
.cbr .figures > div { display: flex; flex-direction: column; gap: 2px; }
.cbr .figures .big { font-size: 1.1rem; white-space: nowrap; }
.cbr .figures .pill { font-family: var(--body); font-size: 0.76rem; padding: 2px 8px; }
.cbr .legend .gold { color: var(--gold); }
.cbr .hschart { display: block; width: 100%; height: 230px; overflow: visible; }
.cbr .hschart .hsgrid { stroke: var(--line); stroke-width: 1; }
.cbr .hschart .hstick, .cbr .hschart .hsrun { font-family: var(--mono); font-size: 11px; fill: var(--muted); }
.cbr .hschart .hsrun { fill: var(--ink); font-size: 12px; }
.cbr .hschart .hshumans line { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 2 4; }
.cbr .hschart .hshumans text { font-size: 12px; fill: var(--muted); }
.cbr .hschart .hsline { fill: none; stroke: var(--gold); stroke-width: 1.5; stroke-dasharray: 4 4; }
.cbr .hschart .hsrange { fill: var(--gold-soft); opacity: 0.7; }
.cbr .hschart .hit { fill: transparent; }
.cbr .hschart .hsdot { fill: var(--accent); stroke: var(--accent); stroke-width: 2.5; }
.cbr .hschart .hsdiamond { fill: var(--paper); stroke: var(--gold); stroke-width: 2.5; }
.cbr .hschart .hsdiamond.sel { fill: var(--gold); }
.cbr .hschart .hsring { fill: none; stroke: var(--ink); stroke-width: 1.5; }
.cbr .hschart a:focus-visible { outline: none; }
.cbr .hschart a:focus-visible .hsring { stroke: var(--accent); stroke-width: 2.5; }
.cbr .noteline { display: grid; grid-template-columns: 96px 48px minmax(0, 1fr) 240px; gap: 12px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); font-size: 0.84rem; }
.cbr .noteline .notebody { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cbr .addnote { display: inline-flex; align-items: center; gap: 8px; }
.cbr turbo-frame.modalframe:not(:empty) { position: fixed; inset: 0; z-index: 20; display: flex; align-items: flex-start; justify-content: center; padding: 12vh 16px 0; background: rgba(5, 10, 20, 0.6); overflow-y: auto; }
.cbr turbo-frame.modalframe .notecomposer { width: 640px; max-width: 100%; margin: 0; padding: 18px 20px; border-radius: 12px; box-shadow: var(--shadow); }
.cbr turbo-frame.modalframe .notecomposer .nums { grid-template-columns: repeat(2, minmax(0, 1fr)); }

/* Under ~900px: the page's tables stack, each row a card with its column names as labels */
@media (max-width: 900px) {
  .cbr .stagepage .ctable, .cbr .runpage .ctable { display: block; }
  .cbr .ctable colgroup, .cbr .ctable thead { display: none; }
  .cbr .ctable tbody { display: block; }
  .cbr .ctable tbody tr:not(.wrongrow) { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 12px; padding: 12px 16px; border-top: 1px solid var(--line); }
  .cbr .ctable tbody td, .cbr .ctable tbody th { display: flex; justify-content: space-between; gap: 8px; padding: 0 !important; border: 0; text-align: left; }
  .cbr .ctable td[data-label]::before { content: attr(data-label); color: var(--muted); font-family: var(--body); font-size: 0.72rem; }
  .cbr .ctable td.wide, .cbr .ctable td.stagename, .cbr .ctable th.answer { grid-column: 1 / -1; white-space: normal; }
  .cbr .ctable .chev { display: none; }
  .cbr .casetable tbody.case { display: block; border-top: 1px solid var(--line); }
  .cbr .casetable tr.wrongrow { display: block; }
  .cbr .casetable tr.wrongrow[hidden] { display: none; }
  .cbr .casetable tr.wrongrow > td { display: block; padding: 4px 16px 14px !important; }
  .cbr .casetable tbody.case > tr.casemain { border-top: 0; }
  .cbr .noteline { grid-template-columns: auto auto minmax(0, 1fr); }
  .cbr .noteline > :last-child { grid-column: 1 / -1; }
  .cbr .comparepick { margin-left: 0; width: 100%; }
  .cbr .figures { gap: 12px 28px; }
}
.cbr .actions details.menu, .cbr details.menu.actions { margin-left: auto; }
.cbr details.menu.actions > summary { display: inline-block; }
.cbr .rp-title .changerun { font-size: 0.8rem; font-weight: 500; letter-spacing: 0; }

/* Gable ends review (Runs::GableReviewComponent): one row per house, photo, satellite, then each floor's plan */
.cbr .grlegend { padding: 0 20px 12px; }
.cbr .grkey { display: inline-block; width: 22px; height: 0; border-top: 4px solid var(--muted); margin-right: 6px; vertical-align: middle; }
.cbr .grkey.matched { border-color: #2f7a5a; } .cbr .grkey.missed { border-color: #c0392b; } .cbr .grkey.extra { border-color: #d97706; } .cbr .grkey.partial { border-color: #7a3fa0; }
.cbr .grkey.run { border-top-style: dashed; }
.cbr .grrow { border-top: 1px solid var(--line); padding: 14px 20px; display: flex; flex-direction: column; gap: 10px; }
.cbr .grhead { display: flex; gap: 12px; align-items: baseline; }
.cbr .grhead .nowrap { margin-left: auto; }
.cbr .grbody { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; }
.cbr .grfig { margin: 0; width: 280px; display: flex; flex-direction: column; gap: 4px; }
.cbr .grphoto { position: relative; width: 100%; background: var(--sunk); border-radius: 8px; overflow: hidden; }
.cbr .grphoto img, .cbr .grphoto svg { display: block; width: 100%; height: 100%; }
.cbr .grphoto svg { position: absolute; inset: 0; }
.cbr .grbox { fill: rgba(35, 75, 117, 0.08); stroke: #2c6cb0; stroke-width: 3; stroke-dasharray: 10 6; vector-effect: non-scaling-stroke; }
.cbr .hpesat.grsat { width: 256px; }
.cbr .hpesat.grsat img { width: 256px; height: 256px; aspect-ratio: 1; }
.cbr .grfloors { display: flex; flex-wrap: wrap; gap: 16px; flex: 1 1 320px; min-width: 0; }
.cbr .grfloor { flex: 1 1 320px; max-width: 560px; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.cbr .grplan { min-height: 240px; background: #fff; border-radius: 8px; overflow: hidden; }
.cbr .grplan svg { display: block; width: 100%; height: auto; max-height: 420px; }
.cbr .grperfect { padding: 10px 20px 14px; }
.cbr .grperfect summary { cursor: pointer; }
@media (max-width: 640px) {
  .cbr .grfig, .cbr .hpesat.grsat { width: 100%; }
  .cbr .hpesat.grsat img { width: 100%; height: auto; }
}
