/* Composer Benchmark: the Runs, Run and Compare pages. Every rule sits under .cb.cbr; tokens come from
   composer_benchmark_tokens.css, and the look follows composer_benchmark_manager.css. */
.cb.cbr { background: var(--bg); color: var(--ink); font-family: var(--body); font-size: 14px; line-height: 1.5; padding: 20px; -webkit-font-smoothing: antialiased; }
.cbm .cb.cbr { padding: 0; }
.cbr *, .cbr *::before, .cbr *::after { box-sizing: border-box; }
.cbr h1, .cbr h2, .cbr h3, .cbr p, .cbr dl, .cbr dd, .cbr ol { margin: 0; }
.cbr :focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.cbr [hidden] { display: none !important; }
.cbr a { color: var(--accent); }
.cbr .mono { font-family: var(--mono); }
.cbr .small { font-size: 0.75rem; color: var(--muted); }
.cbr .sub { color: var(--muted); font-size: 0.88rem; }
.cbr .row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.cbr .row.spread { justify-content: space-between; }
.cbr .nowrap { white-space: nowrap; }
.cbr .lowt { color: var(--warn); font-weight: 600; }
.cbr .bignote { font-size: 1.05rem; font-style: italic; }

/* Page */
.cbr .page { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.cbr .pagehead { display: flex; flex-direction: column; gap: 6px; }
.cbr .pagehead h1 { font-size: 1.6rem; font-weight: 600; letter-spacing: -0.02em; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.cbr .card { background: var(--paper); border: 1px solid var(--line); border-radius: 16px; padding: 20px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.cbr .card h2 { font-size: 1.05rem; font-weight: 600; letter-spacing: -0.01em; }
.cbr .h3 { font-size: 0.72rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.cbr .cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; }
.cbr .stack2 { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.cbr .heldout { font-size: 0.84rem; color: var(--ink); background: var(--gold-soft); border-radius: 10px; padding: 10px 14px; }
.cbr .banner { font-size: 0.84rem; color: var(--ink); background: var(--warn-soft); border-radius: 10px; padding: 10px 14px; }
.cbr .meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 6px 18px; font-size: 0.84rem; }
.cbr .meta dt { font-size: 0.7rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.cbr .counts { font-size: 0.88rem; color: var(--muted); }

/* Headlines: Front and Plan are scores; Cost and Time are limits beside them */
.cbr .kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.cbr .kpi { background: var(--paper); border: 1px solid var(--line); border-radius: 14px; padding: 16px; display: flex; flex-direction: column; gap: 4px; box-shadow: var(--shadow); min-width: 0; }
.cbr .kpi.limit { background: transparent; box-shadow: none; border-style: dashed; }
.cbr .kl { font-size: 0.76rem; color: var(--muted); }
.cbr .kv2 { font-family: var(--mono); font-size: 1.5rem; font-weight: 500; font-variant-numeric: tabular-nums; }
.cbr .ks { font-size: 0.74rem; color: var(--muted); }

/* Buttons and fields */
.cbr .btn { display: inline-block; border: 1px solid var(--line-strong); background: var(--paper); color: var(--ink); padding: 8px 14px; border-radius: 10px; cursor: pointer; font: inherit; font-weight: 600; font-size: 0.85rem; text-decoration: none; transition: background 0.15s, border-color 0.15s; }
.cbr .btn:hover { background: var(--sunk); }
.cbr .btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.cbr .btn.primary:hover { filter: brightness(1.1); }
.cbr .btn:disabled { opacity: 0.4; cursor: not-allowed; }
.cbr .actions form { display: inline; margin: 0; }
.cbr .linkbtn { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; font-size: 0.85rem; }
.cbr .field { display: flex; flex-direction: column; gap: 5px; font-size: 0.82rem; font-weight: 500; min-width: 0; }
.cbr .input { font: inherit; font-weight: 400; font-size: 0.84rem; padding: 8px 10px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--sunk); color: var(--ink); width: 100%; }
.cbr .pick { align-items: flex-end; }
.cbr .pick .field { flex: 1 1 260px; }

/* Tables */
.cbr .tablewrap { overflow-x: auto; }
.cbr .board { width: 100%; border-collapse: collapse; font-size: 0.85rem; font-variant-numeric: tabular-nums; }
.cbr .board th { text-align: left; font-size: 0.7rem; font-weight: 500; color: var(--muted); padding: 4px 6px; border-bottom: 1px solid var(--line); }
.cbr .board td { padding: 7px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.cbr .board td.n, .cbr .board th.n { text-align: right; font-family: var(--mono); }
.cbr .board td.n .small { display: block; font-family: var(--body); }
.cbr .board tr.differs td { color: var(--warn); }
.cbr .status { min-width: 120px; }
.cbr .bar { display: block; height: 6px; margin: 4px 0; border-radius: 99px; background: var(--sunk); overflow: hidden; }
.cbr .bar span { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.cbr .trials { margin-top: 16px; }
.cbr .trials summary { cursor: pointer; padding: 6px 0; }

/* Verdicts and marks */
.cbr .verdict { font-size: 0.74rem; font-weight: 600; border-radius: 4px; padding: 1px 6px; border: 1px solid var(--line-strong); color: var(--muted); white-space: nowrap; }
.cbr .verdict.clear.up { color: var(--good); border-color: var(--good); background: var(--good-soft); }
.cbr .verdict.clear.down { color: var(--warn); border-color: var(--warn); background: var(--warn-soft); }
.cbr .mark.right { color: var(--good); }
.cbr .mark.wrong { color: var(--warn); }
.cbr .mark.part { color: var(--gold); }

/* Tags */
.cbr .tag { display: inline-block; width: fit-content; font-size: 0.68rem; font-weight: 600; border-radius: 4px; padding: 0 5px; border: 1px solid var(--line-strong); color: var(--muted); letter-spacing: 0; vertical-align: middle; }
.cbr .tag.unsure { color: var(--gold); border-color: var(--gold); }
.cbr .tag.note { color: var(--accent); border-color: var(--accent); }

/* Worst houses and the house panel */
.cbr .worstgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.cbr .worst ol { padding-left: 20px; font-size: 0.84rem; display: flex; flex-direction: column; gap: 2px; }
.cbr .worst li { display: list-item; }
.cbr .worst li > * { margin-right: 6px; }
.cbr .hpgrid { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 18px; align-items: start; }
.cbr .hpthumb img { width: 100%; height: auto; border-radius: 10px; display: block; background: var(--sunk); }
.cbr .hpstage { display: flex; flex-direction: column; gap: 6px; }
.cbr .rawout summary { color: var(--accent); cursor: pointer; font-size: 0.8rem; }
.cbr .rawout pre { margin: 6px 0 0; max-height: 360px; overflow: auto; font-family: var(--mono); font-size: 0.72rem; background: var(--sunk); border-radius: 8px; padding: 10px; white-space: pre-wrap; word-break: break-word; }

/* House panel figures: gold solid, the prediction dashed, on the plan or photo they were scored on */
.cbr .hpfigs { --fig-gold: #f0a020; --fig-pred: #2f7df6; display: flex; flex-direction: column; gap: 6px; }
.cbr .hpflegend { display: flex; align-items: center; gap: 6px; }
.cbr .hpfkey { display: inline-block; width: 22px; height: 0; border-top: 3px solid var(--fig-gold); }
.cbr .hpfkey.pred { border-top: 3px dashed var(--fig-pred); margin-left: 8px; }
.cbr .hpfrow { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-start; }
.cbr .hpfig { margin: 0; display: flex; flex-direction: column; gap: 4px; width: min(100%, 480px); }
.cbr .hpfig.metres { width: auto; max-width: 100%; }
.cbr .hpfig svg { display: block; width: 100%; height: auto; max-width: 100%; border-radius: 8px; background: var(--plate); }
.cbr .hpfbg { fill: var(--plate); }
.cbr .hpfgrid { stroke: #d5dbe3; stroke-width: 1; vector-effect: non-scaling-stroke; }
.cbr .hpfgold, .cbr .hpfpred { fill: none; stroke-width: 2.5; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.cbr .hpfgold { stroke: var(--fig-gold); }
.cbr .hpfpred { stroke: var(--fig-pred); stroke-dasharray: 7 5; }
.cbr .hpflabel { fill: var(--fig-gold); font-family: var(--body); font-weight: 600; paint-order: stroke; stroke: #ffffff; stroke-width: 3; vector-effect: non-scaling-stroke; }
.cbr polyline.hpfgold { stroke-linecap: round; }
.cbr .hpfgold.miss, .cbr .hpfpred.extra { stroke-width: 5; }
.cbr .hpfmark { font-family: var(--mono); font-weight: 700; paint-order: stroke; stroke: #ffffff; stroke-width: 3; vector-effect: non-scaling-stroke; }
.cbr .hpfmark.gold { fill: var(--fig-gold); }
.cbr .hpfmark.pred { fill: var(--fig-pred); }
.cbr .hpftypes { display: flex; flex-wrap: wrap; gap: 2px 12px; color: var(--muted); margin: 0; }
.cbr .hpftypes b { color: var(--ink); }
.cbr .optbl { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.cbr .opsum { margin: 0; font-size: 0.95rem; }
.cbr .optable { table-layout: fixed; max-width: 560px; }
.cbr .optable th:first-child { width: 26%; }

/* House evidence: listing photos and plans, satellite, model */
.cbr .hpev { display: flex; flex-direction: column; gap: 12px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.cbr .hpetitle { font-size: 0.95rem; font-weight: 600; }
.cbr .hpev h4 { margin: 0 0 6px; }
.cbr .hpeempty { font-size: 0.84rem; color: var(--muted); }
.cbr .hpestrip { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
.cbr .hpethumb { display: flex; flex-direction: column; gap: 4px; text-decoration: none; color: var(--ink); border: 1px solid var(--line); background: var(--paper); border-radius: 10px; padding: 5px; }
.cbr .hpethumb:hover { border-color: var(--line-strong); }
.cbr .hpethumb img { width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 6px; display: block; background: var(--sunk); }
.cbr .hpethumb.floor_plan img { object-fit: contain; background: #ffffff; }
.cbr .hpethumb.missing { aspect-ratio: 4 / 3; justify-content: flex-end; background: var(--sunk); }
.cbr .hpecols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.cbr .hpesat { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.cbr .hpesat img { width: 100%; max-width: 600px; height: auto; aspect-ratio: 3 / 2; border-radius: 10px; display: block; background: var(--sunk); }
.cbr .hpeattr { font-size: 0.7rem; color: var(--muted); }
.cbr .hpeattr a { color: var(--muted); }
.cbr .hpeviewer { aspect-ratio: 4 / 3; border-radius: 8px; overflow: hidden; background: #ffffff; border: 1px solid var(--line); margin-bottom: 8px; }
.cbr .hpeviewer canvas { width: 100%; height: 100%; display: block; }

/* Tabs (Notes, house page, stage page) */
.cbr .tabs { display: flex; flex-wrap: wrap; gap: 2px; border-bottom: 1px solid var(--line); }
.cbr .tabs a { padding: 8px 14px; margin-bottom: -1px; border-bottom: 2px solid transparent; color: var(--muted); text-decoration: none; font-weight: 600; font-size: 0.9rem; }
.cbr .tabs a:hover { color: var(--ink); }
.cbr .tabs a[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }

/* Set links (house page) */
.cbr .num { font-weight: 500; font-size: 0.72rem; color: var(--muted); margin-left: 6px; }
.cbr .toolbar { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: space-between; }
.cbr .seg-ctl { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 8px; overflow: hidden; }
.cbr .seg-ctl a { font-size: 0.8rem; padding: 4px 10px; color: var(--muted); text-decoration: none; }
.cbr .seg-ctl a[aria-current="true"] { background: var(--accent-soft); color: var(--ink); font-weight: 600; }

/* Verdict pills: the base .pill and the tabs come from composer_benchmark_run_stage.css; glyph colours and --better, --worse, --same from composer_benchmark_tokens.css */
.cbr .muted { color: var(--muted); }
.cbr .pill.nc { background: transparent; color: var(--muted); border: 1px dashed var(--line-strong); }
.cbr .vline .mono { font-size: 0.78rem; }
.cbr .legend .sw { display: inline-block; width: 12px; height: 10px; border-radius: 2px; vertical-align: -1px; margin-right: 4px; background: var(--same-soft); border: 1px dashed var(--same); }

/* Run report: the verdict sentence, baseline picker, stage rows and the collapsed stage details */
.cbr .runverdict { font-size: 1.35rem; font-weight: 600; letter-spacing: -0.01em; line-height: 1.3; text-wrap: balance; }
.cbr .runverdict .seg { white-space: nowrap; }
.cbr .basepick { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; font-size: 0.84rem; }
.cbr .basepick select { font: inherit; font-size: 0.84rem; padding: 5px 8px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--sunk); color: var(--ink); max-width: 100%; }
.cbr .stagetab { width: 100%; border-collapse: collapse; font-size: 0.84rem; }
.cbr .stagetab.compact { width: auto; }
.cbr .stagetab th { text-align: left; font-size: 0.68rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); padding: 6px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; vertical-align: bottom; }
.cbr .stagetab td { padding: 9px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.cbr .stagetab tr:last-child td { border-bottom: 0; }
.cbr .stagetab svg { display: block; }
.cbr .stagetab .r { text-align: right; }
.cbr .stagecell { white-space: nowrap; }
.cbr .stagecell .k { font-family: var(--mono); font-size: 0.72rem; color: var(--muted); }
.cbr .nowrapcell { flex-wrap: nowrap; }
.cbr .splitlab { font-family: var(--mono); font-size: 0.7rem; color: var(--muted); margin-top: 2px; white-space: nowrap; }
.cbr .stagedetails > summary { list-style: none; width: fit-content; }
.cbr .stagedetails > summary::-webkit-details-marker { display: none; }
.cbr .stagedetails[open] > summary { margin-bottom: 12px; }

/* Provenance (v7) */
.cbr .prov { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 12px; font-size: 0.76rem; color: var(--muted); }
.cbr .badge { display: inline-flex; align-items: center; font-size: 0.68rem; font-weight: 700; border-radius: 4px; padding: 1px 6px; border: 1px solid var(--line-strong); color: var(--muted); line-height: 1.5; white-space: nowrap; }
.cbr .badge.origin.local { color: var(--accent); border-color: var(--accent); }
.cbr .badge.origin.agent { color: var(--gold); border-color: var(--gold); }
.cbr .badge.origin.ci { color: var(--better); border-color: var(--better); }
.cbr .banner.exp { background: var(--accent-soft); }
.cbr .diffdetails > summary { cursor: pointer; }
.cbr .diffdetails pre { max-height: 420px; overflow: auto; font-family: var(--mono); font-size: 0.74rem; background: var(--sunk); border-radius: 8px; padding: 10px 12px; margin-top: 8px; }
.cbr .cmd { font-family: var(--mono); font-size: 0.8rem; }

@media (max-width: 1100px) {
  .cbr .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cbr .cols, .cbr .hpgrid, .cbr .hpecols { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  .cb.cbr { padding: 16px; }
}
@media (max-width: 640px) {
  .cbr .runverdict { font-size: 1.12rem; }
}
@media (prefers-reduced-motion: reduce) { .cbr * { transition: none !important; } }
.cbr .hpepics { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; align-items: start; margin: 8px 0; }
.cbr .hpepics figure { margin: 0; display: flex; flex-direction: column; gap: 4px; }
.cbr .hpepics img { width: 100%; height: auto; border-radius: 8px; display: block; background: #ffffff; border: 1px solid var(--line); }

.cbr .rhg-sort { display: flex; gap: 4px; }
.cbr .rhg-sort a { font-size: 0.75rem; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; text-decoration: none; }
.cbr .rhg-sort a[aria-current="true"] { color: var(--ink); background: var(--accent-soft); border-color: var(--accent); }
.cbr .rhg-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 32px 24px; padding: 20px; }
.cbr .rhg-house { display: grid; gap: 8px; min-width: 0; align-content: start; }
.cbr .rhg-row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.cbr .rhg-score { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 0.8rem; }
.cbr .rhg-score.low { color: var(--warn); }
.cbr .rhg-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.cbr .rhg-thumb { display: grid; gap: 3px; min-width: 0; margin: 0; align-content: start; color: inherit; text-decoration: none; }
.cbr a.rhg-thumb { cursor: zoom-in; }
.cbr a.rhg-thumb:focus-visible .rhg-img { outline: 2px solid var(--accent); outline-offset: 2px; }
.cbr .rhg-img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 4px; background: var(--sunk); }
.cbr .rhg-missing, .cbr .rhg-failed { display: grid; place-items: center; text-align: center; padding: 6px; font-size: 0.7rem; line-height: 1.35; border: 1px dashed var(--line); color: var(--muted); }
.cbr .rhg-failed { border-color: var(--warn); background: var(--warn-soft); color: var(--warn); }
.cbr .rhg-cap { font-size: 0.7rem; color: var(--muted); }
.cbr .rhg-stopped { margin: 0; font-size: 0.7rem; color: var(--warn); }
.cbr dialog.rhg-dialog { position: relative; background: var(--page); color: var(--ink); border: 1px solid var(--line); border-radius: 10px; padding: 12px; width: min(960px, 94vw); margin: auto; }
.cbr dialog.rhg-dialog::backdrop { background: rgba(5, 10, 20, 0.75); }
.cbr .rhg-close { position: absolute; top: 10px; right: 12px; }
.cbr .rhg-big { display: none; gap: 10px; }
.cbr .rhg-big:target { display: grid; }
.cbr .rhg-big h2 { font-size: 1.05rem; padding-right: 90px; }
.cbr .rhg-big .rhg-pair { gap: 8px; }
@media (max-width: 860px) { .cbr .rhg-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 420px) { .cbr .rhg-grid { grid-template-columns: 1fr; } }
