/*
 * CricketHype UI kit (Runbook 29; docs/DESIGN.md; the reference page is /admin/ui-kit). Needs ch-tokens.css first.
 * Mobile-first, no framework, no build step. Every class starts with "ch-"; everything sits inside an element with the class
 * "ch" (it sets the font, colours and focus ring, and shields the kit from site.css, which these pages still load through
 * their layouts). Light by default; data-theme="dark" on the .ch element (or any block inside it) switches to dark.
 * Rules: tap targets >= 44 px; inputs at 16 px (iOS does not zoom); a visible focus ring; no hover-only actions.
 */

/* ---------- Base ---------- */
.ch { font-family: var(--ch-font-body); font-size: var(--ch-fs-16); line-height: 1.5; color: var(--ch-text); overflow-wrap: anywhere; }
.ch *, .ch *::before, .ch *::after { box-sizing: border-box; }
.ch :where(a) { color: var(--ch-accent); text-underline-offset: 2px; }
.ch :where(a):hover { color: var(--ch-accent-hover); }
.ch :focus-visible { outline: 3px solid var(--ch-focus); outline-offset: 2px; }
.ch :where(h1, h2, h3, h4, p, ul, ol, dl, dd, figure) { margin: 0; }
.ch :where(section, footer) { padding-block: 0; }   /* site.css pads every section (56 px): the kit sets its own spacing */
.ch-page { min-height: 100vh; min-height: 100dvh; background: var(--ch-bg); color: var(--ch-text); }
.ch-wrap { max-width: 72rem; margin-inline: auto; padding-inline: var(--ch-s-4); }
.ch-wrap--text { max-width: 52rem; }
.ch-stack > * + * { margin-top: var(--ch-s-4); }
.ch-section { margin-top: var(--ch-s-6); }
.ch-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--ch-s-2); }
.ch-row > form { margin: 0; }
.ch-grid { display: grid; gap: var(--ch-s-4); grid-template-columns: repeat(auto-fill, minmax(min(100%, 14rem), 1fr)); }
.ch-grid .ch-span { grid-column: 1 / -1; }
.ch-muted { color: var(--ch-muted); }
.ch-help, .ch-hint { color: var(--ch-muted); font-size: var(--ch-fs-14); line-height: 1.45; }
.ch-code { font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; font-size: var(--ch-fs-14); overflow-wrap: anywhere; }
.ch-sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

/* ---------- Type ---------- */
.ch-eyebrow { font: 700 var(--ch-fs-13)/1.2 var(--ch-font-display); letter-spacing: .14em; text-transform: uppercase; color: var(--ch-accent); }
.ch-h1 { font: 800 var(--ch-fs-34)/1.05 var(--ch-font-display); letter-spacing: .005em; text-transform: uppercase; text-wrap: balance; }
.ch-h2 { font: 700 var(--ch-fs-26)/1.1 var(--ch-font-display); text-transform: uppercase; letter-spacing: .01em; text-wrap: balance; }
.ch-h3 { font: 700 var(--ch-fs-20)/1.2 var(--ch-font-display); letter-spacing: .01em; }
.ch-num { font-family: var(--ch-font-display); font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.1; }
@media (min-width: 900px) { .ch-h1 { font-size: var(--ch-fs-48); } }

/* ---------- Page header (title, subline, actions) and the masthead band ---------- */
.ch-page-header { display: grid; gap: var(--ch-s-2); padding-block: var(--ch-s-4) var(--ch-s-5); }
.ch-crumbs { color: var(--ch-muted); font-size: var(--ch-fs-14); }
.ch-crumbs a { display: inline-flex; align-items: center; min-height: var(--ch-tap); }
.ch-page-header__row { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--ch-s-3); }
.ch-page-header__title { min-width: 0; display: grid; gap: var(--ch-s-1); }
.ch-subline { color: var(--ch-text-2); font-size: var(--ch-fs-15); }
.ch-page-header__actions { display: flex; flex-wrap: wrap; gap: var(--ch-s-2); }
.ch-masthead { background: var(--ch-navy); color: var(--ch-text); border-bottom: 4px solid var(--ch-orange); }
.ch-masthead .ch-eyebrow { color: var(--ch-gold); }
.ch-masthead .ch-page-header { padding-block: var(--ch-s-8) var(--ch-s-5); }
.ch-masthead .ch-subline a { color: var(--ch-text); }
.ch-banner { margin: 0; padding: var(--ch-s-2) var(--ch-s-4); background: var(--ch-gold); color: var(--ch-navy); font: 700 var(--ch-fs-15)/1.3 var(--ch-font-display); letter-spacing: .08em; text-align: center; text-transform: uppercase; }

/* ---------- Buttons ---------- */
.ch-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: var(--ch-s-2); min-height: var(--ch-tap); margin: 0;
    padding: 0 var(--ch-s-4); border: 2px solid transparent; border-radius: var(--ch-r-control); cursor: pointer;
    font: 700 var(--ch-fs-16)/1.1 var(--ch-font-display); letter-spacing: .05em; text-transform: uppercase; text-decoration: none; text-align: center;
    background: var(--ch-surface); color: var(--ch-text); border-color: var(--ch-border-3);
}
.ch-btn:hover { border-color: var(--ch-accent); color: var(--ch-text); }
.ch-btn--primary { background: var(--ch-accent); border-color: var(--ch-accent); color: var(--ch-on-accent); }
.ch-btn--primary:hover { background: var(--ch-accent-hover); border-color: var(--ch-accent-hover); color: var(--ch-on-accent); }
.ch-btn--secondary { background: var(--ch-surface); border-color: var(--ch-border-3); color: var(--ch-text); }
.ch-btn--ghost { background: transparent; border-color: transparent; color: var(--ch-accent); }
.ch-btn--ghost:hover { background: var(--ch-surface-2); border-color: transparent; color: var(--ch-accent-hover); }
.ch-btn--danger { background: var(--ch-danger); border-color: var(--ch-danger); color: #FFFFFF; }
.ch-btn--danger:hover { background: var(--ch-danger-ink); border-color: var(--ch-danger-ink); color: #FFFFFF; }
.ch-btn--lg { min-height: 52px; padding-inline: var(--ch-s-6); font-size: var(--ch-fs-20); }
.ch-btn--icon { min-width: var(--ch-tap); padding-inline: var(--ch-s-2); }
.ch-btn:disabled, .ch-btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; pointer-events: none; }
.ch-btn[aria-busy="true"] { cursor: progress; pointer-events: none; }
.ch-btn[aria-busy="true"]::before { content: ""; width: 1em; height: 1em; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: ch-spin .8s linear infinite; }
@keyframes ch-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .ch-btn[aria-busy="true"]::before { animation-duration: 2.4s; } }

/* ---------- Form fields ---------- */
.ch-form { display: grid; gap: var(--ch-s-4); }
.ch-form fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
.ch-form legend { padding: 0; }
.ch-field { display: grid; gap: 6px; min-width: 0; align-content: start; }
.ch-label { font: 600 var(--ch-fs-15)/1.3 var(--ch-font-body); color: var(--ch-text); }
.ch-opt { font-weight: 400; color: var(--ch-muted); }
.ch-error { font: 600 var(--ch-fs-14)/1.35 var(--ch-font-body); color: var(--ch-danger-text); }
.ch-input, .ch-select, .ch-textarea {
    width: 100%; min-height: var(--ch-tap); margin: 0; padding: 10px 12px; border: 1px solid var(--ch-control-edge); border-radius: var(--ch-r-control);
    background: var(--ch-surface); color: var(--ch-text); font: 400 var(--ch-fs-16)/1.3 var(--ch-font-body);   /* 16 px: iOS does not zoom */
}
.ch-input::placeholder, .ch-textarea::placeholder { color: var(--ch-muted); opacity: 1; }
.ch-textarea { min-height: 96px; resize: vertical; line-height: 1.45; }
.ch-select { appearance: none; padding-right: 40px; background-image: linear-gradient(45deg, transparent 50%, var(--ch-muted) 50%), linear-gradient(135deg, var(--ch-muted) 50%, transparent 50%);
    background-position: calc(100% - 20px) 50%, calc(100% - 14px) 50%; background-size: 6px 6px, 6px 6px; background-repeat: no-repeat; }
.ch-input[type="file"] { padding: 9px 10px; }
.ch-input:disabled, .ch-select:disabled, .ch-textarea:disabled { opacity: .6; cursor: not-allowed; }
.ch-input:focus-visible, .ch-select:focus-visible, .ch-textarea:focus-visible { outline: 3px solid var(--ch-focus); outline-offset: 1px; border-color: var(--ch-accent); }
.ch-field.has-error .ch-input, .ch-field.has-error .ch-select, .ch-field.has-error .ch-textarea, .ch-input[aria-invalid="true"] { border-color: var(--ch-danger); }
.ch-check { display: grid; grid-template-columns: 24px minmax(0, 1fr); gap: 10px; align-items: center; min-height: var(--ch-tap); font-weight: 500; cursor: pointer; }
.ch-check input { width: 22px; height: 22px; margin: 0; accent-color: var(--ch-accent); }
.ch-table .ch-input, .ch-table .ch-select { min-width: 5rem; }
.ch-fields-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--ch-s-3); }
.ch-fields-row > .ch-field { flex: 1 1 12rem; }

/* ---------- Card, stat tile ---------- */
.ch-card { padding: var(--ch-s-4); border: 1px solid var(--ch-border); border-radius: var(--ch-r-card); background: var(--ch-surface); box-shadow: var(--ch-shadow); min-width: 0; }
.ch-card > * + * { margin-top: var(--ch-s-3); }
.ch-card + .ch-card, .ch-card + form, form + .ch-card { margin-top: var(--ch-s-4); }
.ch-card__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--ch-s-2); }
@media (min-width: 640px) { .ch-card { padding: var(--ch-s-5); } }
.ch-stats { display: grid; gap: var(--ch-s-3); grid-template-columns: repeat(auto-fill, minmax(min(100%, 11rem), 1fr)); }
.ch-stat { padding: var(--ch-s-3) var(--ch-s-4); border: 1px solid var(--ch-border); border-radius: var(--ch-r-card); background: var(--ch-surface); min-width: 0; }
.ch-stat__label { font: 700 var(--ch-fs-12)/1.2 var(--ch-font-display); letter-spacing: .12em; text-transform: uppercase; color: var(--ch-muted); }
.ch-stat__value { margin-top: 2px; font: 800 var(--ch-fs-34)/1 var(--ch-font-display); font-variant-numeric: tabular-nums; color: var(--ch-text); overflow-wrap: normal; white-space: nowrap; }   /* a number never breaks */
.ch-stat__sub { margin-top: var(--ch-s-1); font-size: var(--ch-fs-14); color: var(--ch-text-2); }

/* ---------- Table (a sideways-scrolling wrapper on phones) ---------- */
.ch-table-wrap { overflow-x: auto; overscroll-behavior-x: contain; border: 1px solid var(--ch-border); border-radius: var(--ch-r-card); background: var(--ch-surface); }
.ch-table { width: 100%; border-collapse: collapse; font-size: var(--ch-fs-15); }
.ch-table caption { padding: var(--ch-s-3) var(--ch-s-4); text-align: left; font-weight: 600; }
.ch-table th, .ch-table td { padding: 10px 12px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--ch-border); white-space: nowrap; }
.ch-table thead th { background: var(--ch-surface-2); color: var(--ch-text-2); font: 700 var(--ch-fs-13)/1.2 var(--ch-font-display); letter-spacing: .08em; text-transform: uppercase; }
.ch-table tbody th { font-weight: 600; }
.ch-table tbody tr:last-child > * { border-bottom: 0; }
.ch-table .ch-wrap-cell { white-space: normal; overflow-wrap: anywhere; min-width: 8rem; }
.ch-table td > a:not(.ch-btn) { display: inline-flex; align-items: center; min-height: var(--ch-tap); font-weight: 600; }
.ch-table td > form { margin: 4px 0 0; }

/* ---------- Status badge ---------- */
.ch-badge { display: inline-flex; align-items: center; gap: 4px; min-height: 24px; padding: 2px 10px; border-radius: 999px; vertical-align: middle; white-space: nowrap;
    font: 700 var(--ch-fs-13)/1.2 var(--ch-font-display); letter-spacing: .06em; text-transform: uppercase; background: var(--ch-neutral-bg); color: var(--ch-neutral-ink); }
.ch-badge--success { background: var(--ch-success-bg); color: var(--ch-success-ink); }
.ch-badge--warning { background: var(--ch-warning-bg); color: var(--ch-warning-ink); }
.ch-badge--danger { background: var(--ch-danger-bg); color: var(--ch-danger-ink); }
.ch-badge--info { background: var(--ch-info-bg); color: var(--ch-info); }
.ch-badge--accent { background: var(--ch-accent); color: var(--ch-on-accent); }
.ch-badge--gold { background: var(--ch-gold); color: var(--ch-navy); }

/* ---------- Tabs and pills (one sideways-scrolling line on phones) ---------- */
.ch-tabs { display: flex; gap: var(--ch-s-1); margin: 0 0 var(--ch-s-5); border-bottom: 1px solid var(--ch-border-2); overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: thin; }
.ch-tab { flex: none; display: inline-flex; align-items: center; min-height: var(--ch-tap); padding: 0 var(--ch-s-4); margin-bottom: -1px; border-bottom: 3px solid transparent; white-space: nowrap;
    font: 700 var(--ch-fs-16)/1 var(--ch-font-display); letter-spacing: .05em; text-transform: uppercase; color: var(--ch-text-2); text-decoration: none; }
.ch .ch-tab:hover { color: var(--ch-text); border-bottom-color: var(--ch-border-3); }
.ch .ch-tab[aria-current="page"], .ch .ch-tab[aria-selected="true"] { color: var(--ch-text); border-bottom-color: var(--ch-accent); }
.ch-pills { display: flex; flex-wrap: wrap; gap: var(--ch-s-2); margin: 0; padding: 0; }
.ch-pill { display: inline-flex; align-items: center; min-height: var(--ch-tap); padding: 0 var(--ch-s-4); border: 1px solid var(--ch-border-3); border-radius: 999px; white-space: nowrap;
    font: 600 var(--ch-fs-15)/1.2 var(--ch-font-body); color: var(--ch-text); background: var(--ch-surface); text-decoration: none; }
.ch .ch-pill:hover { border-color: var(--ch-accent); color: var(--ch-text); }
.ch .ch-pill[aria-current="true"], .ch .ch-pill[aria-current="page"], .ch .ch-pill[aria-pressed="true"] { background: var(--ch-accent); border-color: var(--ch-accent); color: var(--ch-on-accent); }
@media (max-width: 640px) { .ch-pills { flex-wrap: nowrap; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: thin; padding-bottom: 6px; } .ch-pill { flex: none; } }

/* ---------- Empty state, alert / note ---------- */
.ch-empty { display: grid; justify-items: center; gap: var(--ch-s-2); padding: var(--ch-s-8) var(--ch-s-4); border: 1px dashed var(--ch-border-3); border-radius: var(--ch-r-card); text-align: center; background: var(--ch-surface); }
.ch-empty__title { font: 700 var(--ch-fs-20)/1.2 var(--ch-font-display); }
.ch-empty__text { color: var(--ch-text-2); max-width: 36rem; }
.ch-alert { --_bg: var(--ch-info-bg); --_ink: var(--ch-info); --_line: var(--ch-info);
    display: grid; gap: var(--ch-s-1); padding: var(--ch-s-3) var(--ch-s-4); border: 1px solid transparent; border-left: 4px solid var(--_line); border-radius: var(--ch-r-control);
    background: var(--_bg); color: var(--_ink); }
.ch-alert--success { --_bg: var(--ch-success-bg); --_ink: var(--ch-success-ink); --_line: var(--ch-success); }
.ch-alert--warning { --_bg: var(--ch-warning-bg); --_ink: var(--ch-warning-ink); --_line: var(--ch-warning); }
.ch-alert--danger { --_bg: var(--ch-danger-bg); --_ink: var(--ch-danger-ink); --_line: var(--ch-danger); }
[data-theme="dark"] .ch-alert, .ch-alert[data-theme="dark"] { --_bg: var(--ch-surface-2); --_ink: var(--ch-text); border-color: var(--ch-border); border-left-color: var(--_line); }
.ch-alert__title { font: 700 var(--ch-fs-16)/1.3 var(--ch-font-body); }
.ch-alert :where(a) { color: inherit; font-weight: 600; }
.ch-alert ul { margin: 0; padding-left: 1.2em; }

/* ---------- Pagination ---------- */
.ch-pagination { display: flex; flex-wrap: wrap; align-items: center; gap: var(--ch-s-1); margin: var(--ch-s-4) 0 0; padding: 0; list-style: none; }
.ch-pagination a, .ch-pagination span { display: inline-flex; align-items: center; justify-content: center; min-width: var(--ch-tap); min-height: var(--ch-tap); padding: 0 var(--ch-s-3);
    border: 1px solid var(--ch-border-2); border-radius: var(--ch-r-control); background: var(--ch-surface); color: var(--ch-text); text-decoration: none; font-weight: 600; }
.ch .ch-pagination [aria-current="page"] { background: var(--ch-accent); border-color: var(--ch-accent); color: var(--ch-on-accent); }
.ch-pagination [aria-disabled="true"] { color: var(--ch-muted); background: transparent; }

/* ---------- Confirm page (no modal: a page of its own, as the app does) ---------- */
.ch-confirm { max-width: 40rem; }
.ch-confirm__facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: var(--ch-s-2) var(--ch-s-4); }
.ch-confirm__facts dt { color: var(--ch-muted); font-weight: 600; }
.ch-confirm__actions { display: flex; flex-wrap: wrap; gap: var(--ch-s-2); }
@media (max-width: 480px) { .ch-confirm__actions .ch-btn { flex: 1 1 100%; } }

/* ---------- Numbered list (a rulebook: number, optional title, text) ---------- */
.ch-numlist { margin: 0; padding: 0; list-style: none; }
.ch-numlist__item { display: grid; grid-template-columns: minmax(2.75rem, max-content) minmax(0, 1fr); gap: var(--ch-s-3); align-items: start; padding: var(--ch-s-3) 0; border-bottom: 1px solid var(--ch-border); }
.ch-numlist__item:last-child { border-bottom: 0; }
/* The rule number: a small badge in a fixed-width column (1 / 12 / E1 / A1 / 10.12 line up; a longer number, up to the
   12 characters allowed, widens only its own row and never breaks). White on orange-ink (light) and navy on orange (dark)
   are both AA (DesignTokensContrastTest: on-accent / accent). */
.ch-numlist__no { justify-self: start; min-width: 2.25rem; max-width: 100%; margin-top: 1px; padding: 2px var(--ch-s-1); border-radius: var(--ch-r-6);
    background: var(--ch-accent); color: var(--ch-on-accent); font: 700 var(--ch-fs-14)/1.5 var(--ch-font-display); letter-spacing: .04em;
    text-align: center; white-space: nowrap; }
/* A numbered list that is itself the card (the rules page and its preview): room inside the card on both sides. */
.ch-card.ch-numlist { padding-inline: var(--ch-s-4); }
.ch-card.ch-numlist > * + * { margin-top: 0; }   /* the rows' own padding spaces them evenly around each line */
.ch-numlist__text { min-width: 0; }
.ch-numlist__title { font-weight: 700; }
.ch-numlist__body { margin-top: 2px; line-height: 1.55; }

/* ---------- Disclosure (an edit form under a summary line) ---------- */
.ch-details > summary { display: flex; align-items: center; min-height: var(--ch-tap); cursor: pointer; color: var(--ch-accent); font-weight: 600; }
.ch-details[open] > summary { margin-bottom: var(--ch-s-2); }

/* ---------- Admin pages on the kit, inside the (unchanged) admin layout ---------- */
.ch-admin { padding-bottom: var(--ch-s-8); }
.ch-admin .ch-page-header { padding-top: 0; }

/* ---------- The UI kit page (/admin/ui-kit): a themed panel and colour swatches ---------- */
.ch-panel { margin-top: var(--ch-s-6); padding: var(--ch-s-4); border: 1px solid var(--ch-border); border-radius: var(--ch-r-20); background: var(--ch-bg); color: var(--ch-text); }
@media (min-width: 640px) { .ch-panel { padding: var(--ch-s-6); } }
.ch-swatches { display: grid; gap: var(--ch-s-2); grid-template-columns: repeat(auto-fill, minmax(min(100%, 13rem), 1fr)); margin: var(--ch-s-3) 0 0; padding: 0; list-style: none; font-size: var(--ch-fs-14); }
.ch-swatches li { display: flex; flex-wrap: wrap; align-items: center; gap: var(--ch-s-2); }
.ch-swatch { width: 32px; height: 32px; flex: none; border-radius: var(--ch-r-6); border: 1px solid var(--ch-border-3); }

/* ---------- Public pages: the rulebook (/t/<slug>/rules), the page foot ---------- */
.ch-rules { padding-bottom: var(--ch-s-4); }
.ch-rules-toc { margin-top: var(--ch-s-5); }
.ch-rules-toc ol { margin: var(--ch-s-2) 0 0; padding-left: 1.4em; }
.ch-rules-toc li { padding: 4px 0; }
.ch-rules-toc a { display: inline-flex; align-items: center; min-height: 36px; font-weight: 600; }
.ch-rules-section { margin-top: var(--ch-s-8); scroll-margin-top: var(--ch-s-4); }
.ch-rules-section > .ch-numlist { margin-top: var(--ch-s-3); padding-block: var(--ch-s-1); }
.ch-foot { margin: var(--ch-s-8) 0 var(--ch-s-10); color: var(--ch-muted); font-size: var(--ch-fs-14); text-align: center; }

/* ---------- Admin → Rulebook ---------- */
.ch-rb-section { margin-top: var(--ch-s-4); scroll-margin-top: var(--ch-s-4); }
.ch-rb-row { display: flex; flex-wrap: wrap; align-items: flex-start; gap: var(--ch-s-2); }
.ch-rb-row > form { margin: 0; }
.ch-rb-h { flex: 1 1 14rem; align-self: center; }
.ch-rb-text { flex: 1 1 16rem; min-width: 0; }
.ch-list { margin: 0; padding: 0; list-style: none; }
.ch-list > li { padding: var(--ch-s-2) 0; border-bottom: 1px solid var(--ch-border); }
.ch-list > li:last-child { border-bottom: 0; }
.ch-card.ch-list > * + * { margin-top: 0; }
.ch-legend { float: left; width: 100%; margin-bottom: var(--ch-s-3); }   /* a legend as the card's heading */
.ch-legend + * { clear: both; }

/* ---------- Runbook 31 (design 05): the stage bar, tiles, the checklist, the tool card, the queue list ---------- */
/* The stage bar: one column per stage, a 5 px bar (done green, current orange, upcoming grey), the label and a date line. */
.ch-stagebar { margin: 0; padding: var(--ch-s-4) var(--ch-s-5); list-style: none; display: grid; gap: var(--ch-s-3) var(--ch-s-2);
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 8.5rem), 1fr)); border: 1px solid var(--ch-border); border-radius: var(--ch-r-14); background: var(--ch-surface); }
.ch-stagebar__stage { min-width: 0; display: grid; gap: 2px; align-content: start; }
.ch-stagebar__stage::before { content: ""; height: 5px; margin-bottom: var(--ch-s-2); border-radius: 3px; background: var(--ch-border); }
.ch-stagebar__stage.is-done::before { background: var(--ch-success); }
.ch-stagebar__stage.is-current::before { background: var(--ch-orange); }
.ch-stagebar__label { font: 700 var(--ch-fs-15)/1.25 var(--ch-font-body); color: var(--ch-text); }
.ch-stagebar__stage.is-current .ch-stagebar__label { color: var(--ch-accent); }
.ch-stagebar__stage.is-upcoming .ch-stagebar__label { font-weight: 600; color: var(--ch-text-2); }
.ch-stagebar__note { font-size: var(--ch-fs-13); line-height: 1.3; color: var(--ch-muted); }

/* A tile: a mixed-case label, a big figure, a sub line (--alert: orange, bold, e.g. "3 waiting for you"). */
.ch-tiles { display: grid; gap: var(--ch-s-3); grid-template-columns: repeat(auto-fit, minmax(min(100%, 10rem), 1fr)); }
@media (min-width: 640px) { .ch-tiles { gap: var(--ch-s-4); } }
.ch-tile { min-width: 0; padding: var(--ch-s-4) var(--ch-s-5); border: 1px solid var(--ch-border); border-radius: var(--ch-r-14); background: var(--ch-surface); color: var(--ch-text);
    display: grid; gap: 2px; align-content: start; text-decoration: none; }
a.ch-tile:hover { border-color: var(--ch-border-3); color: var(--ch-text); }
.ch-tile__label { font-size: var(--ch-fs-14); color: var(--ch-muted); }
.ch-tile__value { margin-top: 2px; font: 800 2.5rem/1 var(--ch-font-display); font-variant-numeric: tabular-nums; color: var(--ch-text); }
.ch-tile__sub { font-size: var(--ch-fs-13); color: var(--ch-muted); }
.ch-tile__sub--alert { font-weight: 700; color: var(--ch-accent); }

/* A checklist: rows that tick themselves (no checkbox to click: the box is a picture of the fact). */
.ch-checklist { margin: var(--ch-s-4) 0 0; padding: 0; list-style: none; border-top: 1px solid var(--ch-border); }
.ch-checklist__row { display: grid; grid-template-columns: 24px minmax(0, 1fr) auto; align-items: center; gap: var(--ch-s-2) var(--ch-s-4);
    padding: var(--ch-s-3) 0; border-bottom: 1px solid var(--ch-border); }
.ch-checklist__row:last-child { border-bottom: 0; }
.ch-checklist__box { width: 22px; height: 22px; border: 2px solid var(--ch-control-edge); border-radius: 5px; display: grid; place-items: center; }
.ch-checklist__row.is-done .ch-checklist__box { border-color: var(--ch-success); background: var(--ch-success); }
.ch-checklist__row.is-done .ch-checklist__box::after { content: ""; width: 6px; height: 11px; margin-top: -2px; border: solid #FFFFFF; border-width: 0 2.5px 2.5px 0; transform: rotate(45deg); }
.ch-checklist__title { font: 700 1.0625rem/1.3 var(--ch-font-body); color: var(--ch-text); }
.ch-checklist__row.is-done .ch-checklist__title { color: var(--ch-text-2); }
.ch-checklist__detail { font-size: var(--ch-fs-14); color: var(--ch-muted); }
.ch-checklist__state { font: 700 var(--ch-fs-13)/1.2 var(--ch-font-body); color: var(--ch-success-ink); }
@media (max-width: 480px) { .ch-checklist__row { grid-template-columns: 24px minmax(0, 1fr); } .ch-checklist__row > :last-child { grid-column: 2; justify-self: start; } }

/* The tool card (design 05 "Live tools"): always dark, an orange eyebrow, full-width buttons. */
.ch-toolcard { padding: var(--ch-s-5); border-radius: var(--ch-r-14); background: #0B1426; color: #FFFFFF; display: grid; gap: var(--ch-s-3); }
.ch-toolcard__eyebrow { font: 700 var(--ch-fs-13)/1.2 var(--ch-font-body); letter-spacing: .12em; text-transform: uppercase; color: var(--ch-orange); }
.ch-toolcard__title { margin-top: -6px; font: 800 1.75rem/1.1 var(--ch-font-display); color: #FFFFFF; }
.ch-toolcard__btn { display: flex; align-items: center; justify-content: space-between; gap: var(--ch-s-2); min-height: 48px; padding: 8px 16px;
    border: 1px solid #2E3C5C; border-radius: var(--ch-r-10); color: #FFFFFF; font: 700 1.0625rem/1.2 var(--ch-font-body); text-decoration: none; }
.ch-toolcard__btn:hover { background: #1A2742; color: #FFFFFF; }
.ch-toolcard__btn--primary { border-color: var(--ch-orange); background: var(--ch-orange); color: #0B1426; }
.ch-toolcard__btn--primary:hover { border-color: #FF8A3D; background: #FF8A3D; color: #0B1426; }
.ch-toolcard__btn small { font: 500 var(--ch-fs-13)/1.2 var(--ch-font-body); color: #C2CADB; }
.ch-toolcard__btn--primary small { color: #0B1426; }
.ch-toolcard__note { font-size: var(--ch-fs-14); color: #C2CADB; }
.ch-toolcard :focus-visible { outline: 3px solid var(--ch-gold); outline-offset: 2px; }

/* A queue list: a label and a count on one line. */
.ch-queue { margin: var(--ch-s-2) 0 0; padding: 0; list-style: none; }
.ch-queue li { display: flex; align-items: center; justify-content: space-between; gap: var(--ch-s-3); min-height: 40px; }
.ch-queue a { display: inline-flex; align-items: center; min-height: 40px; color: var(--ch-text); text-decoration: none; }
.ch-queue a:hover { color: var(--ch-accent); text-decoration: underline; }
.ch-queue__n { font: 700 var(--ch-fs-16)/1 var(--ch-font-body); font-variant-numeric: tabular-nums; }
.ch-queue__n.is-due { color: var(--ch-accent); }

/* Runbook 32 §3b: "Powered by" + the CricketHype logo (x-ch.powered / x-ch.logo); the logo keeps its ratio */
.ch-powered { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; vertical-align: middle; }
img.ch-logo { display: inline-block; max-width: none; height: auto; }   /* the width attribute sets the size, the ratio the height */
