/* Tract web app styles. Colour, type, spacing and radius come from tokens.css only. The page itself never scrolls
   sideways: tables scroll in their own box, or become cards below 768 px. Breakpoints: drawer below 1024 px, sheets
   below 768 px. */

*, *::before, *::after { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-sans);
  font-size: var(--text-body);
  line-height: 20px;
  font-weight: var(--weight-regular);
  -webkit-text-size-adjust: 100%;
}

a { color: var(--color-primary); }

h1, h2, h3, p { margin: 0; }

h1 { font-size: var(--text-page); line-height: 28px; font-weight: var(--weight-semibold); }
h2 { font-size: var(--text-section); line-height: 24px; font-weight: var(--weight-semibold); }

.mono, code, kbd { font-family: var(--font-mono); font-size: 13px; line-height: 20px; }
kbd { border: 1px solid var(--color-border); border-radius: var(--radius-input); padding: 0 var(--space-4); }

.muted, .help, .refused, .role-strip { color: var(--color-text-secondary); font-size: var(--text-small); }
.refused { margin-top: var(--space-4); }

.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;
}

.skip-link { position: absolute; left: var(--space-8); top: -40px; }
.skip-link:focus { top: var(--space-8); z-index: 10; background: var(--color-surface-raised); padding: var(--space-4) var(--space-8); }

:focus-visible {
  outline: var(--focus-width) solid var(--color-focus);
  outline-offset: var(--focus-offset);
}

/* Buttons: 32 / 36 / 44 px tall; 44 on touch. Destructive is never the default focus in a modal. */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-8);
  min-height: 36px; min-width: 24px; padding: 0 var(--space-16);
  border-radius: var(--radius-button); border: 1px solid var(--color-border);
  background: var(--color-surface-raised); color: var(--color-text);
  font: inherit; font-weight: var(--weight-semibold); text-decoration: none; cursor: pointer;
  transition: background var(--motion-fast) var(--ease-out);
}
.btn:hover:not([disabled]) { background: var(--color-surface); }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; }
.btn-primary { background: var(--color-primary); color: var(--color-on-primary); border-color: var(--color-primary); }
.btn-primary:hover:not([disabled]) { filter: brightness(0.95); background: var(--color-primary); }
.btn-secondary { background: var(--color-surface-raised); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--color-primary); }
.btn-danger { background: transparent; color: var(--color-danger); border-color: var(--color-danger); }
.btn-wrap { display: inline-flex; flex-direction: column; align-items: flex-start; max-width: 100%; }
.btn-wrap .refused { max-width: 36ch; }

/* Status badges and pills: a word and an icon, never colour alone. */
.status-badge { display: inline-flex; gap: var(--space-4); padding: 0 var(--space-8); border-radius: var(--radius-pill); font-size: var(--text-caption); line-height: 16px; font-weight: var(--weight-semibold); }
.status-na { background: var(--color-surface); color: var(--color-text-secondary); border: 1px solid var(--color-border); }
.pill { display: inline-flex; align-items: center; gap: var(--space-4); max-width: 100%; padding: 0 var(--space-8); border-radius: var(--radius-pill); border: 1px solid var(--color-divider); font-size: var(--text-small); line-height: 20px; overflow-wrap: anywhere; }
.pill-primary { color: var(--color-primary); }
.pill-warning { color: var(--color-warning); }
.pill-success { color: var(--color-success); }
.pill-danger { color: var(--color-danger); }
.pill-secondary, .pill-neutral { color: var(--color-text-secondary); }

/* Layout: the sidebar sits beside the content from 1024 px; below it, the sidebar is a drawer. */
.app-header { display: flex; align-items: center; gap: var(--space-12); padding: var(--space-8) var(--space-16); border-bottom: 1px solid var(--color-divider); background: var(--color-bg); position: sticky; top: 0; z-index: 2; }
.org-name { font-weight: var(--weight-semibold); }
.spacer { flex: 1; }
.search-disabled { min-width: 0; width: 216px; max-width: 40vw; min-height: 36px; padding: 0 var(--space-8); border: 1px solid var(--color-border); border-radius: var(--radius-input); background: var(--color-surface); color: var(--color-text-secondary); font: inherit; }
.account { border-radius: var(--radius-pill); }
.search-icon { display: none; min-width: 44px; min-height: 44px; font-size: 18px; color: var(--color-text-secondary); }
.menu-button { display: none; min-width: 44px; min-height: 44px; }
.frame { display: flex; min-height: calc(100vh - 56px); }
.sidebar-wrap { width: 240px; flex: 0 0 240px; border-right: 1px solid var(--color-divider); background: var(--color-bg); }
.sidebar { padding: var(--space-16) var(--space-12); }
.nav-group { margin-bottom: var(--space-16); }
.nav-heading { font-size: var(--text-caption); color: var(--color-text-secondary); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: var(--space-4); }
.nav-group ul, .plain-list, .nav-preview { list-style: none; margin: 0; padding: 0; }
/* Notification preference rows: a rule and a gap between one event and the next. */
.pref-row + .pref-row { border-top: 1px solid var(--color-divider); margin-top: var(--space-12); padding-top: var(--space-12); }
/* A stored approval kind can be a long unbroken run (the policy page cuts it at 200 characters). Breaking inside the word keeps the
   list inside its column; the rows and their text inherit the rule. */
.policy-kinds { overflow-wrap: anywhere; }
/* Shell (board p4 and p25): the nav row is the board's 44 px row, and the active item is primary text on a tinted row.
   One line per item: a long label (Repositories and channels) is clipped with an ellipsis, and the full label is the tooltip. */
.nav-link { display: block; padding: var(--space-8) var(--space-8); border-radius: var(--radius-button); color: var(--color-text); text-decoration: none; min-height: var(--row-default); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* The active item is shown by its tint and its accent, at regular weight: bold made the longest label clip at 240 px. */
.nav-link[aria-current="page"] { background: color-mix(in srgb, var(--color-primary) 12%, transparent); color: var(--color-primary); font-weight: var(--weight-regular); }
.nav-link:hover { background: var(--color-surface); }
/* Shell (board p4): the Tract wordmark, the sub-heading of a folded group in More, and the header's setup chip. */
.wordmark { font-size: var(--text-section); font-weight: var(--weight-semibold); color: var(--color-text); }
.nav-subgroup + .nav-subgroup { margin-top: var(--space-8); }
.nav-subheading { font-size: var(--text-caption); color: var(--color-text-secondary); margin: var(--space-4) 0; padding: 0 var(--space-8); }
.setup-chip { min-height: 36px; border: 1px solid var(--color-border); border-radius: var(--radius-pill); font-size: var(--text-small); }
.content { flex: 1; min-width: 0; padding: var(--space-24) var(--space-32); max-width: 1200px; }
.page-header { display: grid; gap: var(--space-8); margin-bottom: var(--space-16); }
.page-title-row { gap: var(--space-12); }
.role-strip { margin-top: 0; }
.page-body { display: grid; gap: var(--space-24); }
.section { display: grid; gap: var(--space-12); }
.section-title { margin-bottom: var(--space-4); }
.row { display: flex; flex-wrap: wrap; gap: var(--space-8); align-items: center; }
.toolbar { justify-content: space-between; flex-wrap: wrap; gap: var(--space-8); margin-bottom: var(--space-12); }
.filter { display: inline-flex; align-items: center; flex-wrap: wrap; gap: var(--space-8); max-width: 100%; min-width: 0; }
.filter select, .filter input { max-width: 100%; min-width: 0; }
.filter-chip { min-height: 36px; padding: 0 var(--space-4) 0 var(--space-12); border: 1px solid var(--color-border); border-radius: var(--radius-pill); }
.filter-chip-label { color: var(--color-text-secondary); white-space: nowrap; }
.filter-chip select { min-height: 34px; padding: 0 var(--space-8) 0 var(--space-4); border: 0; border-radius: var(--radius-pill); background: transparent; }
.setup-meter { display: grid; gap: var(--space-4); }
.setup-progress { width: 100%; height: 8px; accent-color: var(--color-primary); }
.list-layout, .detail-layout, .overview, .overview-values, .picker, .auth-main { display: grid; gap: var(--space-16); }
.overview-status { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-12); }
/* 5.5.3 session detail: tasks, live output and details as three panes at 1440 (1024 px and up), stacked below. */
.session-panes, .approval-panes { display: grid; gap: var(--space-16); align-items: start; }
.pane { display: grid; gap: var(--space-8); align-content: start; min-width: 0; padding: var(--space-12); border: 1px solid var(--color-divider); border-radius: var(--radius-card); }
.approval-list { min-width: 0; }
.approval-row { padding: var(--space-8) 0; border-bottom: 1px solid var(--color-divider); list-style: none; display: grid; gap: var(--space-4); }
/* The approval list links are at least 24 px tall (WCAG 2.2 target size, as the td > a rule below). */
.approval-row > a { display: inline-flex; align-items: center; min-height: 24px; }
/* Row actions: the inline buttons at 1440 (1024 px and up), the "..." menu on touch widths. */
.row-actions-inline { display: none; gap: var(--space-8); }
@media (min-width: 1024px) {
  .session-panes { grid-template-columns: minmax(180px, 240px) minmax(0, 1fr) minmax(200px, 260px); }
  .approval-panes { grid-template-columns: minmax(240px, 320px) minmax(0, 1fr); }
  /* Each button keeps its own height: a button with no reason under it must not stretch to its neighbour's reason. */
  .row-actions-inline { display: inline-flex; flex-wrap: wrap; align-items: flex-start; }
  .row-actions-inline + .row-menu { display: none; }
}
/* In the flow at the end of the page on desktop: a sticky bar floats over the rows that scroll under it, and a short window
   puts a data row under it (5.11.8). The touch widths below make it sticky, as the spec's 360 px layout asks. */
.action-bar { position: static; background: var(--color-bg); padding: var(--space-12) 0; border-top: 1px solid var(--color-divider); }
/* The single column is minmax(0, 1fr), not auto: an auto track grows to the longest option of a select (a repository name),
   which pushed the start form wider than a 360 px screen. With the track bounded, the select's max-width: 100% applies. */
.field { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-4); margin-bottom: var(--space-12); }
/* A grid item keeps its intrinsic width unless told otherwise: at 360 px the select and textarea ran past the edge. */
.field > * { min-width: 0; }
.field select, .field textarea, .field input { width: 100%; box-sizing: border-box; }
.field-label { font-weight: var(--weight-semibold); }
input, select, textarea { font: inherit; color: var(--color-text); background: var(--color-bg); border: 1px solid var(--color-border); border-radius: var(--radius-input); padding: var(--space-8); min-height: 36px; max-width: 100%; }
textarea { min-height: 72px; }
input[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--color-danger); }
input[disabled], select[disabled], textarea[disabled] { opacity: 0.6; }
.error-inline { color: var(--color-danger); }
.banner { padding: var(--space-12) var(--space-16); border-radius: var(--radius-card); border: 1px solid var(--color-divider); background: var(--color-surface); }
.banner-warning { border-color: var(--color-warning); }
.banner-danger { border-color: var(--color-danger); color: var(--color-danger); }
.banner-offline { border-color: var(--color-warning); display: flex; flex-wrap: wrap; gap: var(--space-8); align-items: center; }
.empty, .error-panel, .forbidden, .not-connected, .not-available, .maintenance, .data-delayed, .integrity, .auth-card { padding: var(--space-24); border-radius: var(--radius-card); border: 1px solid var(--color-divider); background: var(--color-surface); max-width: 480px; }
.empty { text-align: center; margin: 0 auto; }
.empty-title { font-size: var(--text-section); font-weight: var(--weight-semibold); margin-bottom: var(--space-8); }
.error-panel { border-color: var(--color-danger); }
.error-what { color: var(--color-danger); }
.integrity-warning { border-color: var(--color-warning); }
.data-delayed { display: flex; justify-content: space-between; gap: var(--space-12); align-items: center; }

/* Tables: scroll in their own box with a pinned first column. Below 768 px each row reads as a card. */
.table-box { overflow-x: auto; border: 1px solid var(--color-divider); border-radius: var(--radius-card); }
.table-box:focus-visible { outline-offset: 0; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: var(--space-8) var(--space-12); height: var(--row-default); border-bottom: 1px solid var(--color-divider); vertical-align: middle; font-size: var(--text-small); }
th { background: var(--color-surface); font-weight: var(--weight-semibold); color: var(--color-text-secondary); }
tbody tr:last-child td { border-bottom: 0; }
td:first-child, th:first-child { position: sticky; left: 0; background: var(--color-bg); }
.row-actions { display: inline-flex; gap: var(--space-8); flex-wrap: wrap; }
/* The row "..." menu: the panel is fixed to the viewport (placed by components.js) so a table box cannot clip it;
   [hidden] must win over the grid display. */
.row-menu { display: inline-block; }
.row-menu-panel { position: fixed; z-index: 20; min-width: 12rem; display: grid; gap: var(--space-8); padding: var(--space-8); border: 1px solid var(--color-divider); border-radius: var(--radius-card); background: var(--color-surface-raised); }
.row-menu-panel[hidden] { display: none; }
.row-menu-entry { display: grid; gap: var(--space-4); }
.row-menu-item { width: 100%; justify-content: flex-start; }
.picker-row { padding: var(--space-12); border: 1px solid var(--color-divider); border-radius: var(--radius-card); list-style: none; display: grid; gap: var(--space-4); }
.picker-row[aria-disabled="true"] { opacity: 0.8; }
/* The widget picker links (li.widget-row > div.row > a) are at least 24 px tall (WCAG 2.2 target size, as the td > a rule below). */
.widget-row a { display: inline-flex; align-items: center; min-height: 24px; }
.picker-list { display: grid; gap: var(--space-8); padding: 0; margin: 0; }
.card, .template-grid > section, .card-list > section { border: 1px solid var(--color-divider); border-radius: var(--radius-card); padding: var(--space-16); background: var(--color-surface-raised); }
.card-list { display: grid; gap: var(--space-12); list-style: none; padding: 0; margin: 0; }
.template-grid, .card-list { display: grid; gap: var(--space-12); grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
/* Overview "Running now" and "Recent failures" cards: the title on its own line, the pill and the button in one row below. */
.run-card { display: grid; gap: var(--space-8); align-content: start; }
.run-card .run-title { margin: 0; overflow-wrap: anywhere; }
.tiles { display: grid; gap: var(--space-12); grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.tiles .widget-wide { grid-column: 1 / -1; }
.tile { border: 1px solid var(--color-divider); border-radius: var(--radius-card); padding: var(--space-16); background: var(--color-surface); display: grid; gap: var(--space-4); }
.tile-label { color: var(--color-text-secondary); font-size: var(--text-small); }
.tile-value { font-size: var(--text-page); line-height: 28px; font-weight: var(--weight-semibold); }
.trend-wrap { margin-top: var(--space-8); }
.trend { list-style: none; margin: var(--space-4) 0 var(--space-8); padding: 0; display: grid; gap: var(--space-4); }
.trend-row { display: grid; grid-template-columns: minmax(72px, auto) minmax(40px, 1fr) minmax(64px, auto); align-items: center; gap: var(--space-8); font-size: var(--text-small); }
.trend-bar { width: 100%; height: 8px; accent-color: var(--color-primary); }
.trend-value { text-align: right; font-variant-numeric: tabular-nums; }
/* 5.10.1 billing: the main column with the banner and meters, and an aside with the plan card and the NOT AVAILABLE YET tiles. */
.billing-layout, .billing-main, .billing-aside { display: grid; gap: var(--space-16); align-content: start; }
.billing-main .tiles { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.billing-aside > .card { display: grid; gap: var(--space-8); align-content: start; }
.billing-blocked { display: grid; gap: var(--space-8); border-width: 1px; }
.banner-title { margin: 0; font-weight: var(--weight-semibold); }
.meter-tile { align-content: start; }
.meter { display: block; width: 100%; height: 8px; margin: var(--space-4) 0; appearance: none; -webkit-appearance: none; border: 0; border-radius: var(--radius-pill); background: var(--color-divider); }
.meter::-webkit-progress-bar { background: var(--color-divider); border-radius: var(--radius-pill); }
.meter::-webkit-progress-value { background: var(--color-primary); border-radius: var(--radius-pill); }
.meter::-moz-progress-bar { background: var(--color-primary); border-radius: var(--radius-pill); }
.meter-full::-webkit-progress-value { background: var(--color-warning); }
.meter-full::-moz-progress-bar { background: var(--color-warning); }
@media (min-width: 1024px) {
  .billing-layout { grid-template-columns: minmax(0, 2fr) minmax(240px, 1fr); align-items: start; }
}
.facts { display: grid; grid-template-columns: max-content 1fr; gap: var(--space-4) var(--space-16); margin: 0; }
.facts dt { color: var(--color-text-secondary); }
.facts dd { margin: 0; }
/* The Command Center outcome figures (overview card): label on the left, figure on the right, one row per figure at every width. */
.outcome-figures { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--space-4) var(--space-16); margin: 0; }
.outcome-figures dt { color: var(--color-text-secondary); overflow-wrap: anywhere; }
.outcome-figures dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.log { font-family: var(--font-mono); font-size: 12px; line-height: 18px; border: 1px solid var(--color-divider); border-radius: var(--radius-card); padding: var(--space-12); overflow: auto; max-height: 60vh; white-space: pre-wrap; background: var(--color-surface); }
/* The session output pane: each stream is a scrollable block with a height cap; long lines wrap inside the block. */
.output-run { margin-bottom: var(--space-12); min-width: 0; }
.output-run pre { font-family: var(--font-mono); font-size: 12px; line-height: 18px; border: 1px solid var(--color-divider); border-radius: var(--radius-card); padding: var(--space-12); margin: 0; max-height: 240px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; background: var(--color-surface); color: var(--color-text); }
.integrity { display: inline-flex; gap: var(--space-8); align-items: center; padding: var(--space-4) var(--space-8); border: 0; background: transparent; max-width: none; }
.vendor-mark { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: var(--radius-input); border: 1px solid var(--color-border); font-size: var(--text-caption); font-weight: var(--weight-semibold); }
.step-row { display: grid; gap: var(--space-4); padding: var(--space-12) 0; border-bottom: 1px solid var(--color-divider); }
.step { color: var(--color-text-secondary); }
.summary { font-weight: var(--weight-semibold); }
.tour-line { font-size: var(--text-body-large); line-height: 24px; }
.id-panel { display: inline-flex; gap: var(--space-8); align-items: center; margin-left: var(--space-8); }
.skeleton { display: grid; gap: var(--space-8); }
.skeleton-row { height: var(--row-default); border-radius: var(--radius-input); background: var(--color-surface); }

/* Modals: centred dialogs; full-height sheets below 768 px. Shadow on light, a border on dark. */
.modal-backdrop { position: fixed; inset: 0; background: rgba(20, 23, 28, 0.36); display: flex; align-items: center; justify-content: center; padding: var(--space-16); z-index: 5; }
.modal { width: min(560px, 100%); max-height: 90vh; overflow: auto; background: var(--color-surface-raised); color: var(--color-text); border-radius: var(--radius-card); padding: var(--space-24); box-shadow: var(--shadow-overlay); border: 1px solid var(--color-divider); display: grid; gap: var(--space-12); }
.modal-title { font-size: var(--text-section); font-weight: var(--weight-semibold); }
.modal-actions { justify-content: flex-end; }
.toasts { position: fixed; right: var(--space-16); bottom: var(--space-16); display: grid; gap: var(--space-8); z-index: 6; max-width: min(360px, calc(100vw - 32px)); }
.toast { display: flex; gap: var(--space-8); align-items: center; justify-content: space-between; padding: var(--space-12) var(--space-16); border-radius: var(--radius-card); background: var(--color-surface-raised); border: 1px solid var(--color-border); box-shadow: var(--shadow-overlay); }
.toast-error { border-color: var(--color-danger); color: var(--color-danger); }

/* 5.1.1 and 5.1.2: the column is full width on phones (the button too). From 768 px the 400 px column is centred (spec 5.1.1). */
.auth-shell { min-height: 100vh; display: flex; align-items: center; justify-content: flex-start; padding: var(--space-16); }
.auth-shell .auth-main { width: min(400px, 100%); }
@media (min-width: 768px) {
  .auth-shell { padding: var(--space-48); justify-content: center; }
}
.auth-single { width: 100%; display: grid; gap: var(--space-16); text-align: left; }
/*
 * F-2 (2026-11-23): #main and the sign-in column take focus from a script on load and on each route change (WCAG 2.4.3).
 * They are containers, not controls, so they never draw a ring. The old :focus:not(:focus-visible) guard did not stop the
 * 2 px frame: Chrome treats a script focus with no prior pointer or key input as :focus-visible. Keyboard focus on the
 * controls inside keeps the design's ring from the global :focus-visible rule.
 */
#main:focus { outline: none; }
.auth-main:focus { outline: none; }
.auth-foot { display: grid; gap: var(--space-8); justify-items: start; }
.auth-help { display: inline-flex; align-items: center; min-height: 44px; }
.auth-action { display: grid; justify-items: start; }
.auth-action .btn { width: auto; min-width: 240px; min-height: 48px; }
@media (max-width: 767px) {
  .auth-action .btn { width: 100%; min-width: 0; }
}
.auth-title { font-size: var(--text-onboarding); line-height: 36px; font-weight: var(--weight-semibold); }
.boot-note { padding: var(--space-24); }

/* 5.1 and 5.2 pages are the canvas frame itself: a centred bordered card, the shell pieces, and the help sheet. */
.frame-card { max-width: 480px; margin: var(--space-24) auto 0; padding: var(--space-24); border: 1px solid var(--color-divider); border-radius: var(--radius-card); background: var(--color-surface-raised); display: grid; gap: var(--space-12); justify-items: center; text-align: center; }
.frame-title { font-size: var(--text-section); line-height: 28px; font-weight: var(--weight-semibold); }
.frame-actions { justify-content: center; }
.shell-frame { min-height: 240px; }
.skeleton-cell { display: block; width: 60%; height: 12px; border-radius: var(--radius-input); background: var(--color-surface); }
.account-page { display: grid; gap: var(--space-24); }
.account-menu { width: min(280px, 100%); margin: 0 0 0 auto; list-style: none; padding: 0; border: 1px solid var(--color-divider); border-radius: var(--radius-card); background: var(--color-surface-raised); box-shadow: var(--shadow-overlay); overflow: hidden; }
.menu-row { display: block; width: 100%; min-height: 44px; box-sizing: border-box; padding: var(--space-12) var(--space-16); border: 0; border-top: 1px solid var(--color-divider); background: transparent; color: var(--color-text); font: inherit; text-align: left; text-decoration: none; }
.account-menu li:first-child .menu-row { border-top: 0; }
a.menu-row:hover, button.menu-row:hover { background: var(--color-surface); }
.menu-name { font-weight: var(--weight-semibold); }
.account-privacy { max-width: 640px; display: grid; gap: var(--space-12); }
.search-frame { display: grid; gap: var(--space-12); }
.search-toolbar { flex-wrap: nowrap; }
.search-field { flex: 1; min-width: 0; }
.help-scrim { padding: var(--space-32) var(--space-16); border-radius: var(--radius-card); background: rgba(20, 23, 28, 0.36); }
.help-sheet { max-width: 420px; margin: 0 auto; padding: var(--space-24); border: 1px solid var(--color-divider); border-radius: var(--radius-card); background: var(--color-surface-raised); box-shadow: var(--shadow-overlay); display: grid; gap: var(--space-12); }
.help-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-8); }
.help-support { color: var(--color-text-secondary); }
.checklist-frame { display: grid; grid-template-columns: minmax(120px, 1fr) 2fr; gap: var(--space-16); padding: var(--space-16); border: 1px solid var(--color-divider); border-radius: var(--radius-card); background: var(--color-bg); }
.checklist-main { display: grid; gap: var(--space-12); align-content: start; }
.checklist-aside { padding-top: var(--space-8); }
ol.steps { list-style: decimal; padding-left: var(--space-24); }
ol.steps > li.step-row { display: list-item; }
.help-icon { display: none; }

/* Narrow: the drawer. Below 1024 px the sidebar leaves the flow and slides over the page (fades only with reduced motion). */
@media (max-width: 1023px) {
  .menu-button { display: inline-flex; }
  .sidebar-wrap { position: fixed; top: 56px; bottom: 0; left: 0; width: min(280px, 85vw); transform: translateX(-100%); visibility: hidden; transition: transform var(--motion-medium) var(--ease-out), visibility 0s linear var(--motion-medium); z-index: 4; box-shadow: none; background: var(--color-bg); }
  /* Opening shows the drawer at once (so focus can move into it); closing hides it only after the slide has finished. */
  body.drawer-open .sidebar-wrap { transform: translateX(0); visibility: visible; box-shadow: var(--shadow-overlay); transition: transform var(--motion-medium) var(--ease-out), visibility 0s; }
  .content { padding: var(--space-16); }
  .search-disabled { display: none; }
  .search-icon { display: inline-flex; }
}

/* Phones and small tablets: tables become cards, modals become sheets, toasts sit at the top. */
@media (max-width: 767px) {
  .content { padding: var(--space-16); }
  .hide-narrow { display: none; }
  .help-icon { display: inline; }
  .checklist-frame { grid-template-columns: 1fr; }
  .checklist-aside { display: none; }
  .search-toolbar { flex-wrap: wrap; }
  .table-box { overflow: visible; border: 0; }
  table, tbody, tr, td { display: block; width: 100%; }
  thead { display: none; }
  tr { border: 1px solid var(--color-divider); border-radius: var(--radius-card); margin-bottom: var(--space-12); padding: var(--space-8) var(--space-12); background: var(--color-surface-raised); }
  td { height: auto; border: 0; padding: var(--space-4) 0; display: grid; grid-template-columns: minmax(88px, 36%) 1fr; gap: var(--space-8); align-items: center; }
  td::before { content: attr(data-label); color: var(--color-text-secondary); font-size: var(--text-caption); }
  td > * { min-width: 0; justify-self: start; }
  td:first-child { position: static; background: transparent; }
  .btn { min-height: 44px; }
  .check { min-height: 44px; }
  td > a { min-height: 44px; }
  .org-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .modal-backdrop { align-items: stretch; padding: 0; }
  .modal { width: 100%; max-height: none; height: 100%; border-radius: 0; }
  /* The sticky header is 61 px (8 px padding, a 44 px control row, a 1 px rule), so the toasts start 8 px below it and never cover the header controls. */
  .toasts { left: var(--space-16); right: var(--space-16); top: 69px; bottom: auto; max-width: none; }
  .action-bar { position: sticky; bottom: 0; }
  /* A row brought into view (scrollIntoView, block end) lands above the sticky bar, not under it. */
  html:has(.action-bar) { scroll-padding-bottom: 6rem; }
  .tile, .card { min-width: 0; }
}

/* 5.7 and 5.8 cards: a card title line, two columns on wide screens, and the secret-once box. */
.card-heading { font-size: var(--text-body); line-height: 20px; font-weight: var(--weight-semibold); margin: 0; }
.card-list.two-up { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 767px) {
  .card-list.two-up { grid-template-columns: 1fr; }
}
.secret-box { overflow-wrap: anywhere; padding: var(--space-12); border: 1px solid var(--color-border); border-radius: var(--radius-input); background: var(--color-surface); }

/* Reduced motion: no shimmer, no slides (fades only, 0 to 80 ms), the running state is static. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0ms !important; animation-duration: 0ms !important; }
  .sidebar-wrap { transition: none; }
}

/* W2 (5.3 and 5.4 match the canvas): the hidden attribute always hides, card titles, card grids, the agent profile
   head, the two-pane conversation and the row count. */
[hidden] { display: none !important; }
.card-title { font-size: var(--text-section); line-height: 24px; font-weight: var(--weight-semibold); margin: 0; }
/* Pills wrap inside a narrow card cell. nowrap ran "Failed: the GitHub repository moved" 26 px past a 390 px screen (5.9.1). */
.pill { white-space: normal; }
.card-grid { display: grid; gap: var(--space-12); grid-template-columns: 1fr; }
.card-grid > .card, .form-card { display: grid; gap: var(--space-8); align-content: start; }
.choice-card { cursor: pointer; }
.choice-card input { justify-self: start; margin: 0; }
.publish-row { justify-content: space-between; margin-bottom: var(--space-4); }
.profile-head { justify-content: space-between; }
.profile-name { margin: 0; font-weight: var(--weight-semibold); }
.profile-layout, .automation { display: grid; gap: var(--space-16); }
.automation .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.table-footer { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-8) var(--space-16); margin-top: var(--space-8); font-size: var(--text-small); }
.table-count { font-size: var(--text-small); }
.two-pane { display: grid; gap: var(--space-16); grid-template-columns: 1fr; }
.two-pane > .card { display: grid; gap: var(--space-12); align-content: start; }
.pane-section { display: grid; gap: var(--space-4); }
.check { display: inline-flex; align-items: center; gap: var(--space-8); }
.check input { margin: 0; }
/* Links that sit alone in a table cell are at least 24 px tall at every width (44 px on phones, see the phone block). */
td > a { display: inline-flex; align-items: center; min-height: 24px; }
/* The checkbox itself is 24 px (the 13 px native box with the 36 px input height was an under-24 target); the label row is the touch target on phones. */
.check input[type="checkbox"] { flex: 0 0 24px; width: 24px; height: 24px; min-height: 24px; }
@media (min-width: 768px) {
  .card-grid { grid-template-columns: 1fr 1fr; }
  .two-pane { grid-template-columns: minmax(200px, 1fr) minmax(0, 2fr); align-items: start; }
  /* A state or role pill in a table stays on one line from 768 px. At 768 the narrow columns broke "Completed" mid-word
     and stacked "Last delivery failed" three lines high. A table too wide for its box scrolls inside the box. */
  td .pill { white-space: nowrap; }
}
/* Pair a device (5.3.8). The code field is large and monospace, the one value a person copies across from the computer.
   Its height is 44 px at every width, the touch target size on phones. The review and the done states stack on every width. */
.devices-page { display: grid; gap: var(--space-16); }
.pairing-card, .computers-card { display: grid; gap: var(--space-12); align-content: start; }
.pairing-form { display: grid; gap: var(--space-8); max-width: 28rem; }
.pairing-form .btn-wrap { justify-self: start; }
.pairing-input { font-family: var(--font-mono); font-size: 20px; line-height: 28px; letter-spacing: 0.12em; text-transform: uppercase; min-height: 44px; width: min(100%, 18rem); }
.pairing-review, .pairing-done { display: grid; gap: var(--space-12); }
.pairing-countdown { font-variant-numeric: tabular-nums; font-weight: var(--weight-semibold); margin: 0; }
.pairing-ack { display: flex; align-items: center; gap: var(--space-8); min-height: 44px; }
.pairing-ack input[type="checkbox"] { flex: 0 0 24px; width: 24px; height: 24px; min-height: 24px; margin: 0; }
.pairing-review .row, .pairing-done .row { align-items: center; }
.computers-box { display: grid; gap: var(--space-12); }

/* ---- Page composition for the boards (conf-compose, 2026-11-24). Page-scoped selectors only: the shell rules above are
   untouched. Each block below names the page it serves. ---- */

/* 5.13.1 Command Center: one row of tiles, then the cards in three columns (a table spans the row). */
.overview-tiles { display: grid; gap: var(--space-12); grid-template-columns: repeat(2, minmax(0, 1fr)); }
.overview-cards { display: grid; gap: var(--space-12); grid-template-columns: minmax(0, 1fr); }
.overview-cards > .widget-wide { grid-column: 1 / -1; }
.overview-cards > .card { align-content: start; }
.overview-cards > .card > * { align-self: start; }
@media (min-width: 1024px) {
  .overview-tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .overview-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* 5.10.1 Plan and entitlements: the three meter tiles share one row; the block wrappers add no box of their own. */
.billing-tiles > .tile-block { display: contents; }
.billing-tiles > .tile-block:not(:has(.tile)) { grid-column: 1 / -1; }
.billing-main .billing-tiles { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }

/* 5.11.2 Policy: two bordered cards; each kind is a row with a read-only box and its pill. */
.policy-cards { grid-template-columns: minmax(0, 1fr); }
.policy-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-8); padding: var(--space-8) 0; border-bottom: 1px solid var(--color-divider); list-style: none; }
.policy-row:last-child { border-bottom: 0; }
.policy-box { display: inline-grid; place-items: center; flex: 0 0 20px; width: 20px; height: 20px; border: 1px solid var(--color-border); border-radius: var(--radius-input); font-size: var(--text-small); line-height: 1; }
.policy-box-on { border-color: var(--color-primary); color: var(--color-primary); }
.policy-box-on::after { content: "✓"; }
.policy-name { overflow-wrap: anywhere; }
.policy-limit { display: grid; gap: var(--space-4); }
.policy-budget:empty { display: none; }
@media (min-width: 1024px) {
  .policy-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* 5.2.1 Setup: start card, numbered steps and the progress column (three columns on wide screens). */
.checklist-steps { list-style: none; padding-left: 0; margin: 0; }
.checklist-steps > li.step-row { display: grid; gap: var(--space-4); }
.step-head { align-items: center; }
.step-marker { display: inline-grid; place-items: center; flex: 0 0 28px; width: 28px; height: 28px; border-radius: var(--radius-pill); border: 1px solid var(--color-divider); font-size: var(--text-small); font-weight: var(--weight-semibold); color: var(--color-text-secondary); }
.step-marker-done { background: var(--color-success); border-color: var(--color-success); color: var(--color-bg); }
.step-marker-current { border: 2px solid var(--color-primary); color: var(--color-primary); }
.step-skip { padding-left: 36px; }
.checklist-progress { display: grid; gap: var(--space-12); align-content: start; }
@media (min-width: 1024px) {
  .checklist-frame { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr) minmax(0, 1fr); }
  .checklist-aside { display: block; }
}

/* 5.7.1 Integrations: a single column of provider rows, each with its connect or disconnect button on the right. */
.provider-rows { grid-template-columns: minmax(0, 1fr); }
.provider-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-12); }
.provider-row > .row { flex-wrap: wrap; }
.provider-row a { display: inline-flex; align-items: center; min-height: 24px; }
