/* Composer Benchmark: the Runs list, the Start a main run sheet and the Run page (RunListComponent, RunRowComponent,
   RunResultComponent, StartSheetComponent, StartPreviewComponent, RunHousesComponent). Every rule sits under .cbr; tokens come from composer_benchmark_tokens.css.
   States pair colour with a sign and a word, never colour alone. */
.cbr .tabular { font-variant-numeric: tabular-nums; }

/* Run type badge, with a tooltip on hover and keyboard focus (text in data-tip) */
.cbr .rbadge { display: inline-flex; align-items: center; gap: 6px; border: 1px solid; border-radius: 4px; padding: 1px 7px; font-size: 0.72rem; font-weight: 700; white-space: nowrap; line-height: 1.5; }
.cbr .rbadge .shape { font-size: 0.62rem; }
.cbr .rbadge.r-main { color: var(--ink); border-color: var(--ink); }
.cbr .rbadge.r-ci { color: var(--accent); border-color: var(--accent); }
.cbr .rbadge.r-agent { color: var(--gold); border-color: var(--gold); }
.cbr .rbadge.r-local { color: var(--muted); border-color: var(--muted); }
.cbr [data-tip] { position: relative; }
.cbr [data-tip]::after { content: attr(data-tip); position: absolute; left: 0; top: calc(100% + 8px); z-index: 30; width: max-content; max-width: min(320px, calc(100vw - 130px)); white-space: normal; text-align: left;
  background: #0b1220; color: var(--ink); border: 1px solid var(--line-strong); border-radius: 8px; padding: 8px 10px; font-size: 0.8rem; font-weight: 400; line-height: 1.45; letter-spacing: 0; text-transform: none;
  box-shadow: var(--shadow); display: none; pointer-events: none; }
.cbr [data-tip]:hover::after, .cbr [data-tip]:focus-visible::after { display: block; }

/* Type filters */
.cbr .runlist-sec { display: flex; flex-direction: column; gap: 36px; }
.cbr .filters { display: flex; gap: 6px; flex-wrap: wrap; }
.cbr .filters a { border: 1px solid var(--line-strong); color: var(--muted); border-radius: 99px; padding: 3px 11px; font-size: 0.78rem; font-weight: 600; text-decoration: none; }
.cbr .filters a[aria-pressed="true"] { background: var(--accent-soft); color: var(--ink); border-color: var(--accent-soft); }
.cbr .filters .count { font-family: var(--mono); font-weight: 500; opacity: 0.7; margin-left: 4px; font-variant-numeric: tabular-nums; }

/* Run table: one card per day under its heading; every row is two lines */
.cbr .card.flush { padding: 0; gap: 0; overflow: visible; }
.cbr .rt-days { display: flex; flex-direction: column; gap: 44px; }
.cbr .rt-group { display: flex; flex-direction: column; gap: 8px; }
.cbr .rt-day { font-size: 0.9rem; font-weight: 600; color: var(--ink); padding-left: 2px; }
.cbr .rt-day .muted { font-weight: 400; font-size: 0.85rem; }
.cbr .trials > summary { cursor: pointer; }
.cbr .trials[open] > summary { margin-bottom: 8px; }
.cbr .runtable { display: flex; flex-direction: column; }
.cbr .rt-head, .cbr .rt-row { display: grid; grid-template-columns: 40px 100px minmax(0, 1fr) 96px 92px 48px; column-gap: 16px; align-items: start; padding: 0 20px; }
.cbr .rt-head { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); font-weight: 600; padding-block: 12px 10px; border-bottom: 1px solid var(--line); }
.cbr .rt-head .r { text-align: right; }
.cbr .rt-row { position: relative; padding-block: 12px 13px; border-bottom: 1px solid var(--line); }
.cbr .rt-row:last-child { border-bottom: 0; }
.cbr .rt-row:hover { background: rgba(255, 255, 255, 0.03); }
.cbr .rt-id { font-family: var(--mono); font-size: 0.88rem; line-height: 24px; color: var(--muted); text-decoration: none; font-variant-numeric: tabular-nums; }
.cbr .rt-link::after { content: ""; position: absolute; inset: 0; }
.cbr .rt-link:focus-visible { outline: none; }
.cbr .rt-row:has(.rt-link:focus-visible) { outline: 2px solid var(--accent); outline-offset: -2px; }
.cbr .rt-type .rbadge, .cbr .rt-ref, .cbr .rt-result a, .cbr .rt-type .tag { position: relative; z-index: 1; }
.cbr .rt-type { display: flex; flex-direction: column; align-items: flex-start; gap: 5px; padding-top: 2px; }
.cbr .rt-ref { font-family: var(--mono); font-size: 0.78rem; font-weight: 500; color: var(--muted); text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 3px; }
.cbr .rt-ref:hover { color: var(--ink); text-decoration-color: currentColor; }
.cbr .rt-result { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.cbr .rt-set, .cbr .rt-mode { font-size: 0.86rem; line-height: 24px; color: var(--muted); display: flex; flex-direction: column; }
.cbr .rt-set .n { font-size: 0.8rem; line-height: 1.45; opacity: 0.8; font-variant-numeric: tabular-nums; }
.cbr .rt-time { font-family: var(--mono); font-size: 0.8rem; line-height: 24px; color: var(--muted); font-variant-numeric: tabular-nums; text-align: right; }
.cbr .rt-meta { display: none; }

/* Result: line 1 the verdict, line 2 its evidence */
.cbr .res-1 { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; min-height: 24px; font-size: 0.92rem; }
.cbr .res-1 .pill { font-size: 0.86rem; padding: 2px 10px; font-variant-numeric: tabular-nums; }
.cbr .res-2 { font-size: 0.82rem; color: var(--muted); line-height: 1.45; }
.cbr .res-2 a, .cbr .v-line a { color: inherit; text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 3px; }
.cbr .res-2 a:hover { color: var(--ink); }
.cbr .caveat { color: var(--warn); }
.cbr .res-plain { color: var(--ink); font-variant-numeric: tabular-nums; }
.cbr .res-quiet { color: var(--muted); }
.cbr .flag { font-size: 0.76rem; font-weight: 600; border-radius: 4px; padding: 1px 7px; white-space: nowrap; }
.cbr .flag.warn { color: var(--warn); background: var(--warn-soft); }
.cbr .flag.worse { color: var(--worse); background: var(--worse-soft); }
.cbr .flag.same { color: var(--same); background: var(--same-soft); }
.cbr .flag.live { color: var(--accent); background: var(--accent-soft); }
.cbr .flag.live::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: currentColor; margin-right: 6px; vertical-align: 1px; animation: cbr-pulse 1.6s ease-in-out infinite; }
@keyframes cbr-pulse { 50% { opacity: 0.3; } }
.cbr .progress { display: block; width: 160px; max-width: 100%; height: 4px; border-radius: 99px; background: var(--sunk); overflow: hidden; margin-top: 2px; }
.cbr .progress span { display: block; height: 100%; background: var(--accent); }

/* Run page */
.cbr .runpage { gap: 40px; }
.cbr .rp-head { display: flex; flex-direction: column; gap: 8px; }
.cbr .rp-title { font-size: 1.6rem; font-weight: 600; letter-spacing: -0.02em; display: flex; align-items: center; gap: 10px; font-variant-numeric: tabular-nums; }
.cbr .rp-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 18px; color: var(--muted); font-size: 0.88rem; }
.cbr .rt-type-inline { display: inline-flex; align-items: center; gap: 10px; }
.cbr .rp-verdict { display: flex; flex-direction: column; gap: 8px; }
.cbr .rp-verdict .res-1 { font-size: 1.15rem; gap: 8px 12px; }
.cbr .rp-verdict .res-1 .flag { font-size: 0.85rem; padding: 3px 9px; }
.cbr .rp-verdict .res-2 { font-size: 0.95rem; }
.cbr .rp-verdict .progress { width: 280px; height: 6px; }
.cbr .v-line { font-size: 1rem; color: var(--ink); }
.cbr .v-caveat { font-size: 0.88rem; color: var(--muted); }
.cbr .rp-sec { display: flex; flex-direction: column; gap: 10px; }
.cbr .sec-h { font-size: 0.9rem; font-weight: 600; color: var(--ink); display: flex; gap: 8px; align-items: baseline; }
.cbr .sec-h .muted { font-weight: 400; font-size: 0.85rem; font-variant-numeric: tabular-nums; }
.cbr details.fold > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px; }
.cbr details.fold > summary::-webkit-details-marker { display: none; }
.cbr details.fold > summary::before { content: "▸"; color: var(--muted); font-size: 0.8rem; transition: transform 0.15s; }
.cbr details.fold[open] > summary::before { transform: rotate(90deg); }
.cbr details.fold > summary:hover .sec-h { color: var(--accent); }
.cbr details.fold[open] { gap: 14px; }
.cbr .rp-details { display: flex; flex-direction: column; gap: 20px; padding: 6px 0 0 18px; min-width: 0; }
.cbr .rp-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); gap: 12px; }
.cbr .failedlist { gap: 6px; }
.cbr .kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 4px 16px; margin-top: 6px; font-size: 0.85rem; }
.cbr .kv dt { color: var(--muted); }
.cbr .kv dd { min-width: 0; overflow-wrap: anywhere; }
.cbr .cli { background: var(--sunk); border: 1px solid var(--line); border-radius: 10px; padding: 12px; overflow-x: auto; font-family: var(--mono); font-size: 0.78rem; line-height: 1.5; margin: 6px 0 0; }

/* Runs page header and the links below the list */
.cbr .pagehead.runs-head { flex-direction: row; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.cbr .runs-head > div:first-child { display: flex; flex-direction: column; gap: 6px; }
.cbr .runs-links { display: flex; flex-wrap: wrap; gap: 4px 18px; padding-top: 18px; border-top: 1px solid var(--line); font-size: 0.85rem; }
.cbr .runs-links a { color: var(--muted); text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 3px; }
.cbr .runs-links a:hover { color: var(--ink); }

/* Start a main run: a modal side sheet, ~460px on a desktop and the whole screen on a phone */
body:has(.cbr dialog.sheet[open]) { overflow: hidden; }
.cbr .sheet { position: fixed; inset: 0 0 0 auto; margin: 0; width: min(460px, 100vw); max-width: 100vw; height: 100dvh; max-height: 100dvh; padding: 0; border: 0; border-left: 1px solid var(--line-strong); background: var(--paper); color: var(--ink); box-shadow: var(--shadow); overflow: hidden; }
.cbr .sheet::backdrop { background: rgba(5, 10, 20, 0.6); }
.cbr .sheet-form { display: flex; flex-direction: column; height: 100%; }
.cbr .sheet-body { flex: 1; overflow-y: auto; overscroll-behavior: contain; display: flex; flex-direction: column; gap: 18px; padding: max(22px, env(safe-area-inset-top)) 24px 22px; }
.cbr .sheet-foot { padding: 16px 24px max(18px, env(safe-area-inset-bottom)); background: var(--paper); border-top: 1px solid var(--line); }
.cbr .sheet-foot turbo-frame { display: flex; flex-direction: column; gap: 12px; }
.cbr .sheet-foot .summary { display: flex; flex-direction: column; gap: 4px; font-size: 0.88rem; }
.cbr .sheet-foot .btn { display: flex; align-items: center; justify-content: center; width: 100%; min-height: 44px; font-size: 0.9rem; }
.cbr .warn-t { color: var(--warn); }
.cbr .sheet-head { display: flex; justify-content: space-between; align-items: center; }
.cbr .sheet-head h2 { font-size: 1.15rem; font-weight: 600; }
.cbr .sheet .x { width: 44px; height: 44px; margin: -10px -12px -10px 0; background: none; border: 0; border-radius: 8px; color: var(--muted); font-size: 1.5rem; line-height: 1; cursor: pointer; }
.cbr .sheet .x:hover { color: var(--ink); background: var(--sunk); }
.cbr .sheet fieldset { border: 0; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.cbr .sheet legend, .cbr .sheet .legend { font-size: 0.9rem; font-weight: 600; padding: 0; margin-bottom: 8px; }
.cbr .sheet .legend { margin-bottom: 0; }
.cbr .sheet .legend .muted { font-weight: 400; font-size: 0.8rem; }
.cbr .formerrors { font-size: 0.84rem; background: var(--warn-soft); border-radius: 10px; padding: 10px 14px; }
.cbr .formerrors ul { margin: 4px 0 0; padding-left: 18px; }
.cbr .chips { display: flex; flex-wrap: wrap; gap: 6px; }
.cbr .chk { position: relative; cursor: pointer; }
.cbr .chk input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.cbr .chk > span { display: inline-flex; align-items: center; border: 1px solid var(--line-strong); border-radius: 99px; padding: 4px 12px; font-size: 0.84rem; color: var(--muted); }
.cbr .chk input:checked + span { background: var(--accent-soft); border-color: var(--accent); color: var(--ink); }
.cbr .chk input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.cbr .chk.off > span { opacity: 0.45; border-style: dashed; }
.cbr .chk.off, .cbr .chk.off input { cursor: not-allowed; }
.cbr .num-i { font-family: var(--mono); font-size: 0.72rem; opacity: 0.6; margin-right: 6px; }
.cbr .unsc { font-size: 0.74rem; opacity: 0.75; white-space: pre; }
.cbr .row-actions { display: flex; gap: 14px; }
.cbr .sheet .linkbtn { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; font-size: 0.8rem; font-weight: 500; text-decoration: none; cursor: pointer; }
.cbr .opt { display: flex; gap: 10px; align-items: flex-start; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
.cbr .opt:has(input:checked) { border-color: var(--accent); background: rgba(140, 180, 230, 0.06); }
.cbr .opt input, .cbr .trial input { margin-top: 3px; accent-color: var(--accent); }
.cbr .opt > span, .cbr .trial > span { display: flex; flex-direction: column; gap: 1px; font-size: 0.88rem; }
.cbr .opt b, .cbr .trial b { font-weight: 600; }
.cbr .opt .muted, .cbr .trial .muted { font-size: 0.8rem; }
.cbr .trial { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.cbr .idsfield, .cbr .notefield { display: flex; flex-direction: column; gap: 6px; }
.cbr .txt { width: 100%; background: var(--sunk); border: 1px solid var(--line-strong); border-radius: 8px; color: var(--ink); padding: 8px 10px; font: inherit; font-size: 0.88rem; }
.cbr .txt:focus { outline: 2px solid var(--accent); outline-offset: 0; }
.cbr .txt.sm { padding: 6px 8px; font-size: 0.82rem; }
.cbr .sheet details.adv { display: flex; flex-direction: column; gap: 8px; }
.cbr .sheet details.adv > summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; gap: 6px; list-style: none; }
.cbr .sheet details.adv > summary::-webkit-details-marker { display: none; }
.cbr .sheet details.adv > summary::before { content: "▸"; color: var(--muted); font-size: 0.8rem; transition: transform 0.15s; }
.cbr .sheet details.adv[open] > summary::before { transform: rotate(90deg); }
.cbr .sheet details.adv[open] > summary { margin-bottom: 4px; }
.cbr .adv-row { display: flex; flex-direction: column; gap: 8px; padding: 12px 0 4px; border-top: 1px solid var(--line); }
.cbr .adv-name { font-size: 0.86rem; }
.cbr .ctl { display: grid; grid-template-columns: 84px minmax(0, 1fr); align-items: center; gap: 10px; }
.cbr .ctl > span { font-size: 0.8rem; color: var(--muted); }

@media (max-width: 720px) {
  .cbr .filters a, .cbr .runs-links a, .cbr .chk > span, .cbr .sheet .linkbtn, .cbr .opt, .cbr .trial, .cbr .txt { min-height: 44px; }
  .cbr .filters a, .cbr .runs-links a, .cbr .sheet .linkbtn { display: inline-flex; align-items: center; }
  .cbr .filters a { padding-inline: 14px; }
  .cbr .rt-ref { padding-block: 10px; margin-block: -10px; }
  .cbr .runs-head .btn { min-height: 44px; }
  .cbr .sheet { width: 100vw; border-left: 0; }
  .cbr .sheet-body, .cbr .sheet-foot { padding-inline: 16px; }
  .cbr .txt { font-size: 16px; }
  .cbr .rt-head { display: none; }
  .cbr .rt-day { padding-inline: 14px; }
  .cbr .rt-row { grid-template-columns: 40px minmax(0, 1fr); row-gap: 6px; column-gap: 10px; padding: 12px 14px 12px 11px; }
  .cbr .rt-id { grid-row: 1 / span 3; }
  .cbr .rt-type { grid-column: 2; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px; }
  .cbr .rt-result, .cbr .rt-meta { grid-column: 2; }
  .cbr .rt-set, .cbr .rt-mode, .cbr .rt-time { display: none; }
  .cbr .rt-meta { display: block; font-size: 0.8rem; color: var(--muted); }
  .cbr .flag { white-space: normal; }
  .cbr .rp-verdict .res-1 { font-size: 1.05rem; }
  .cbr .rp-details { padding-left: 0; }
}
@media (prefers-reduced-motion: reduce) { .cbr .flag.live::before { animation: none; } }
