/* Imitor app styles. Tokens are copied from design/tokens.css (Signal identity); components follow design/paper-kit.mjs. */

/* ---------- Tokens (from design/tokens.css) ---------- */
:root {
  --color-bg: #0B0B0C; /* App ground */
  --color-side: #0B0B0C; /* Sidebar ground */
  --color-panel: #141415; /* Inputs, code blocks, chips */
  --color-raised: #1B1B1D; /* Disabled fills, neutral avatars */
  --color-line: #222224; /* Hairlines; selected row and nav fill */
  --color-line-2: #303033; /* Control borders; selected segment; switch off */
  --color-t-1: #F5F5F2; /* Primary text */
  --color-t-2: #A8A8A3; /* Secondary text */
  --color-t-3: #85857F; /* Meta text only (never essential) */
  --color-acc: #FFD60A; /* Accent text and strokes */
  --color-acc-bg: #FFD60A; /* Accent fill: primary button, switch on */
  --color-on-acc: #0B0B0C; /* Text and icons on accent fill */
  --color-acc-tint: #262105; /* Accent pill fill */
  --color-acc-line: #5C4E0A; /* Accent pill border */
  --color-warn: #FFD60A; /* Stand-in text and dashed strokes */
  --color-ok: #4CB782; /* Genuine, passed */
  --color-bad: #FF5C5C; /* Failed */
  --color-in-device: #B58900; /* Stand-in outline drawn over the app */
  --color-ghost: #FFD60A; /* Dashed ghost copy behind the device */

  --font-sans: "Geist", system-ui, sans-serif;
  --font-mono: "Geist Mono", ui-monospace, monospace;
  --font-wordmark: "Instrument Serif", serif; /* The "Imitor" wordmark only, italic */
  --text-28: 28px; --leading-28: 34px; /* Onboarding title */
  --text-20: 20px; --leading-20: 26px; /* Large title */
  --text-16: 16px; --leading-16: 22px; /* Section title */
  --text-14: 14px; --leading-14: 20px; /* Page title, emphasis */
  --text-13: 13px; --leading-13: 18px; /* Body and controls */
  --text-12: 12px; --leading-12: 16px; /* Secondary */
  --text-11: 11px; --leading-11: 16px; /* Meta, code, numbers */
  --radius-chip: 5px; /* Commit chips, key chips */
  --radius-control: 6px; /* Buttons, rows, nav items, fields */
  --radius-segment: 7px; /* Segmented control shell */
  --radius-block: 8px; /* Code blocks, tables, panels */
  --radius-pill: 10px; /* Status pills */
  --radius-device: 50px; /* Device frame at 330px wide */
  --spacing-2: 2px;   --spacing-4: 4px;   --spacing-6: 6px;   --spacing-8: 8px;   --spacing-10: 10px;   --spacing-12: 12px;   --spacing-16: 16px;   --spacing-24: 24px;   --spacing-32: 32px;   --spacing-48: 48px;
  --container-sidebar: 220px; --container-inspector: 320px; --container-rail: 232px; --container-onboarding: 560px;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --color-bg: #FFFFFF; /* App ground */
    --color-side: #FAFAF8; /* Sidebar ground */
    --color-panel: #F4F4F1; /* Inputs, code blocks, chips */
    --color-raised: #ECECE8; /* Disabled fills, neutral avatars */
    --color-line: #E6E6E1; /* Hairlines; selected row and nav fill */
    --color-line-2: #D2D2CC; /* Control borders; selected segment; switch off */
    --color-t-1: #0B0B0C; /* Primary text */
    --color-t-2: #55554F; /* Secondary text */
    --color-t-3: #6F6F68; /* Meta text only (never essential) */
    --color-acc: #8F6B00; /* Accent text and strokes */
    --color-acc-bg: #FFD60A; /* Accent fill: primary button, switch on */
    --color-on-acc: #0B0B0C; /* Text and icons on accent fill */
    --color-acc-tint: #FFF8D6; /* Accent pill fill */
    --color-acc-line: #EAD27A; /* Accent pill border */
    --color-warn: #8F6B00; /* Stand-in text and dashed strokes */
    --color-ok: #178A52; /* Genuine, passed */
    --color-bad: #D92D20; /* Failed */
    --color-in-device: #B58900; /* Stand-in outline drawn over the app */
    --color-ghost: #C9A400; /* Dashed ghost copy behind the device */
  }
}
:root[data-theme="light"] {
  --color-bg: #FFFFFF; /* App ground */
  --color-side: #FAFAF8; /* Sidebar ground */
  --color-panel: #F4F4F1; /* Inputs, code blocks, chips */
  --color-raised: #ECECE8; /* Disabled fills, neutral avatars */
  --color-line: #E6E6E1; /* Hairlines; selected row and nav fill */
  --color-line-2: #D2D2CC; /* Control borders; selected segment; switch off */
  --color-t-1: #0B0B0C; /* Primary text */
  --color-t-2: #55554F; /* Secondary text */
  --color-t-3: #6F6F68; /* Meta text only (never essential) */
  --color-acc: #8F6B00; /* Accent text and strokes */
  --color-acc-bg: #FFD60A; /* Accent fill: primary button, switch on */
  --color-on-acc: #0B0B0C; /* Text and icons on accent fill */
  --color-acc-tint: #FFF8D6; /* Accent pill fill */
  --color-acc-line: #EAD27A; /* Accent pill border */
  --color-warn: #8F6B00; /* Stand-in text and dashed strokes */
  --color-ok: #178A52; /* Genuine, passed */
  --color-bad: #D92D20; /* Failed */
  --color-in-device: #B58900; /* Stand-in outline drawn over the app */
  --color-ghost: #C9A400; /* Dashed ghost copy behind the device */
}

/* Pill tints, from the THEMES table in design/paper-kit.mjs (not in tokens.css). */
:root {
  --color-ok-tint: #0F2219; --color-ok-line: #1C4030;
  --color-bad-tint: #2A1213; --color-bad-line: #4A2022;
  --color-backdrop: rgba(0, 0, 0, 0.78);
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --color-ok-tint: #E8F5EE; --color-ok-line: #BCE0CC;
    --color-bad-tint: #FDECEA; --color-bad-line: #F3BFB9;
    --color-backdrop: rgba(11, 11, 12, 0.6);
    color-scheme: light;
  }
}
:root[data-theme="light"] {
  --color-ok-tint: #E8F5EE; --color-ok-line: #BCE0CC;
  --color-bad-tint: #FDECEA; --color-bad-line: #F3BFB9;
  --color-backdrop: rgba(11, 11, 12, 0.6);
  color-scheme: light;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--color-bg); color: var(--color-t-1);
  font-family: var(--font-sans); font-size: var(--text-13); line-height: var(--leading-13);
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
}
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, p { margin: 0; font: inherit; }
svg { display: block; flex-shrink: 0; }
.mono { font-family: var(--font-mono); font-size: var(--text-11); line-height: var(--leading-11); }
.t2 { color: var(--color-t-2); }
.t3 { color: var(--color-t-3); }
.bad { color: var(--color-bad); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

:focus { outline: none; }
:focus-visible { outline: 2px solid var(--color-acc); outline-offset: 2px; border-radius: var(--radius-control); }
.row-link:focus-visible, .problem-row:focus-visible { outline-offset: -2px; border-radius: 0; }

/* ---------- Shell ---------- */
.app { display: flex; height: 100vh; min-width: 0; }
.side {
  width: var(--container-sidebar); flex-shrink: 0; background: var(--color-side); border-right: 1px solid var(--color-line);
  padding: 12px 8px; display: flex; flex-direction: column; gap: 1px; overflow-y: auto;
}
.side-brand { display: flex; align-items: center; gap: 9px; height: 32px; padding: 0 8px; margin-bottom: 10px; }
.wordmark { font-family: var(--font-wordmark); font-style: italic; font-weight: 400; font-size: 20px; line-height: 22px; letter-spacing: -0.02em; color: var(--color-t-1); white-space: nowrap; }
.project { position: relative; margin-bottom: 8px; }
.project-button {
  display: flex; align-items: center; gap: 8px; width: 100%; height: 30px; padding: 0 8px;
  background: var(--color-panel); border: 1px solid var(--color-line); border-radius: var(--radius-control); text-align: left;
}
.project-button > svg { color: var(--color-t-3); }
.project-swatch { width: 14px; height: 14px; border-radius: 4px; background: #2F6B45; flex-shrink: 0; }
.project-name { flex: 1; min-width: 0; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.project-pop {
  position: absolute; left: 0; right: 0; top: 34px; z-index: 20; padding: 10px 12px; display: grid; gap: 6px;
  background: var(--color-panel); border: 1px solid var(--color-line-2); border-radius: var(--radius-block);
  box-shadow: 0 12px 30px -12px rgba(0, 0, 0, 0.5); font-size: var(--text-12); line-height: var(--leading-12); color: var(--color-t-2);
}
.project-pop[hidden] { display: none; }
.project-pop dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; }
.project-pop dt { color: var(--color-t-3); }
.project-pop dd { margin: 0; color: var(--color-t-1); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.side-nav { display: flex; flex-direction: column; gap: 1px; }
.nav-item {
  display: flex; align-items: center; gap: 9px; height: 30px; padding: 0 8px; border-radius: var(--radius-control);
  color: var(--color-t-2); font-size: var(--text-13); background: none; border: 0; width: 100%; text-align: left;
}
.nav-item:hover { color: var(--color-t-1); }
.nav-item.is-active { background: var(--color-line); color: var(--color-t-1); font-weight: 500; }
.nav-label { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-count { font-family: var(--font-mono); font-size: var(--text-11); color: var(--color-t-3); font-weight: 400; }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 1px; padding-top: 12px; }
.side-foot-row { display: flex; align-items: center; gap: 2px; }
.theme-toggle {
  width: 26px; height: 26px; flex-shrink: 0; display: grid; place-items: center; border: 0; border-radius: var(--radius-control);
  background: none; color: var(--color-t-3);
}
.theme-toggle:hover { color: var(--color-t-1); background: var(--color-line); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.page-header {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; height: 48px; padding: 0 24px;
  border-bottom: 1px solid var(--color-line); flex-shrink: 0;
}
.page-title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.page-title h1 { font-size: var(--text-14); line-height: var(--leading-14); font-weight: 600; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.page-title .crumb { color: var(--color-t-2); font-weight: 400; }
.page-title .crumb:hover { color: var(--color-t-1); }
.page-title .sep { color: var(--color-t-3); margin: 0 -4px 0 0; font-weight: 400; }
.page-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.content { flex: 1; min-height: 0; overflow: auto; display: flex; flex-direction: column; }

.toolbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 40px; padding: 4px 24px;
  border-bottom: 1px solid var(--color-line); flex-shrink: 0;
}
.toolbar-group { display: flex; align-items: center; gap: 8px; }
.toolbar-group .select-ghost + .select-ghost { margin-left: 12px; }

/* Narrow windows: the sidebar collapses to icons. */
@media (max-width: 900px) {
  .side { width: 56px; padding: 12px 8px; }
  .side-brand { padding: 0 8px; justify-content: center; }
  .side-brand .wordmark, .nav-label, .nav-count, .project-name, .project-button > svg { display: none; }
  .project-button { justify-content: center; padding: 0; }
  .project-pop { width: 220px; }
  .nav-item { justify-content: center; padding: 0; }
  .side-foot-row { flex-direction: column; }
}

/* ---------- Components ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 30px; padding: 0 12px;
  border-radius: var(--radius-control); border: 1px solid transparent; background: none;
  font-size: var(--text-13); line-height: var(--leading-13); font-weight: 500; white-space: nowrap; flex-shrink: 0;
}
.btn-primary { background: var(--color-acc-bg); color: var(--color-on-acc); }
.btn-primary:hover { filter: brightness(1.06); }
.btn-secondary { background: var(--color-panel); border-color: var(--color-line-2); color: var(--color-t-1); padding: 0 11px; }
.btn-secondary:hover { background: var(--color-raised); }
.btn-secondary svg, .btn-ghost svg { color: var(--color-t-2); }
.btn-ghost { color: var(--color-t-2); }
.btn-ghost:hover { color: var(--color-t-1); }
.btn:disabled, .btn[aria-disabled="true"] { background: var(--color-raised); color: var(--color-t-3); border-color: transparent; cursor: default; filter: none; }
.btn-ghost:disabled { background: none; }

.mark { width: 14px; height: 14px; display: inline-block; flex-shrink: 0; }

.pill {
  display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: var(--radius-pill); border: 1px solid;
  font-size: var(--text-11); line-height: 14px; font-weight: 500; white-space: nowrap; flex-shrink: 0;
}
.pill-neutral { color: var(--color-t-2); background: var(--color-panel); border-color: var(--color-line-2); }
.pill-ok { color: var(--color-ok); background: var(--color-ok-tint); border-color: var(--color-ok-line); }
.pill-warn, .pill-acc { color: var(--color-warn); background: var(--color-acc-tint); border-color: var(--color-acc-line); }
.pill-bad { color: var(--color-bad); background: var(--color-bad-tint); border-color: var(--color-bad-line); }

.chip {
  display: inline-flex; align-items: center; font-family: var(--font-mono); font-size: var(--text-11); line-height: 14px; color: var(--color-t-2);
  padding: 2px 6px; background: var(--color-panel); border: 1px solid var(--color-line); border-radius: var(--radius-chip); white-space: nowrap; flex-shrink: 0;
}

.seg { display: inline-flex; gap: 2px; padding: 2px; background: var(--color-panel); border: 1px solid var(--color-line); border-radius: var(--radius-segment); flex-shrink: 0; }
.seg button {
  border: 0; background: none; padding: 4px 12px; border-radius: 5px; font-size: var(--text-12); line-height: var(--leading-12); font-weight: 500; color: var(--color-t-2);
}
.seg button:hover { color: var(--color-t-1); }
.seg button[aria-pressed="true"] { background: var(--color-line-2); color: var(--color-t-1); }
.seg button:focus-visible { outline-offset: 0; border-radius: 5px; }

.switch { width: 30px; height: 18px; border-radius: 9px; border: 0; padding: 2px; background: var(--color-line-2); display: inline-flex; align-items: center; flex-shrink: 0; }
.switch::after { content: ""; width: 14px; height: 14px; border-radius: 7px; background: var(--color-t-3); transition: transform 0.12s ease; }
.switch[aria-checked="true"] { background: var(--color-acc-bg); }
.switch[aria-checked="true"]::after { background: var(--color-on-acc); transform: translateX(12px); }
.switch:focus-visible { border-radius: 9px; }

.field {
  height: 30px; padding: 0 10px; background: var(--color-panel); border: 1px solid var(--color-line); border-radius: var(--radius-control);
  font-size: var(--text-13); color: var(--color-t-1); min-width: 0;
}
.field::placeholder { color: var(--color-t-3); }
select.field {
  appearance: none; padding-right: 28px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 16 16' fill='none' stroke='%2385857F' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
}
/* Quiet select used in toolbars ("Kind Any"). */
.select-ghost { display: inline-flex; align-items: center; gap: 4px; font-size: var(--text-12); color: var(--color-t-3); }
.select-ghost select {
  appearance: none; border: 0; background: none; color: var(--color-t-2); font-size: var(--text-12); padding: 4px 16px 4px 0; cursor: pointer; field-sizing: content; border-radius: 4px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 16 16' fill='none' stroke='%2385857F' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right center;
}
.select-ghost select option { background: var(--color-panel); color: var(--color-t-1); }

.code {
  position: relative; background: var(--color-panel); border: 1px solid var(--color-line); border-radius: var(--radius-block);
  padding: 12px 44px 12px 14px; font-family: var(--font-mono); font-size: var(--text-12); line-height: 20px; color: var(--color-t-1);
  white-space: pre-wrap; word-break: break-word; margin: 0;
}
.code .c-dim { color: var(--color-t-3); }
.code .c-bad { color: var(--color-bad); }
.code .c-key { color: var(--color-t-1); }
.code .c-str { color: var(--color-t-2); }
.copy-btn {
  position: absolute; top: 8px; right: 8px; width: 26px; height: 26px; display: grid; place-items: center;
  border: 0; border-radius: var(--radius-control); background: none; color: var(--color-t-3);
}
.copy-btn:hover { color: var(--color-t-1); background: var(--color-raised); }
.copy-btn.is-done { color: var(--color-ok); }

.avatar {
  width: 16px; height: 16px; border-radius: 4px; background: var(--color-raised); box-shadow: inset 0 0 0 1px var(--color-line-2);
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; overflow: hidden;
  font-size: 10px; line-height: 16px; font-weight: 600; color: var(--color-t-1);
}
.avatar img { width: 64%; height: 64%; display: block; }
.avatar .glyph-mask { width: 64%; height: 64%; background: var(--color-t-1); -webkit-mask: var(--glyph) center / contain no-repeat; mask: var(--glyph) center / contain no-repeat; }
.avatar.lg { width: 24px; height: 24px; border-radius: 6px; font-size: 15px; line-height: 24px; }
.who { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.who span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Screen thumbnail */
.thumb {
  position: relative; display: block; width: 132px; height: 286px; border-radius: 14px; overflow: hidden; flex-shrink: 0; padding: 0; border: 0;
  background: var(--color-panel); box-shadow: 0 0 0 1px var(--color-line-2);
}
.thumb img { width: 100%; height: 100%; object-fit: cover; object-position: top; display: block; }
button.thumb { cursor: zoom-in; }
button.thumb:hover { box-shadow: 0 0 0 1px var(--color-t-3); }
.thumb.is-failed, .thumb.is-failed:hover { box-shadow: 0 0 0 1.5px var(--color-bad); }
.thumb.is-missing {
  box-shadow: none; background: none; border: 1px dashed var(--color-line-2); display: grid; place-items: center; text-align: center;
  font-size: var(--text-12); line-height: var(--leading-12); color: var(--color-t-3); padding: 0 12px;
}
.thumb.sm { width: 96px; height: 208px; border-radius: 11px; }
.thumb:focus-visible { outline-offset: 3px; border-radius: 14px; }

/* ---------- States ---------- */
.state { padding: 32px 24px; display: flex; flex-direction: column; align-items: flex-start; gap: 12px; max-width: 560px; color: var(--color-t-2); }
.state h2 { font-size: var(--text-14); line-height: var(--leading-14); font-weight: 600; color: var(--color-t-1); }
.state .code { min-width: 280px; }
.state-error h2 { display: flex; align-items: center; gap: 8px; }
.loading-line { padding: 20px 24px; color: var(--color-t-3); font-size: var(--text-12); }
.skeleton { display: flex; flex-direction: column; }
.skeleton-row { height: 44px; display: flex; align-items: center; gap: 16px; padding: 0 24px; border-bottom: 1px solid var(--color-line); }
.skeleton-bar { height: 10px; border-radius: 5px; background: var(--color-panel); animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.5; } }
@media (prefers-reduced-motion: reduce) { .skeleton-bar { animation: none; } }
.placeholder-page { padding: 24px; color: var(--color-t-2); }

.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 50;
  background: var(--color-panel); border: 1px solid var(--color-line-2); color: var(--color-t-1); border-radius: var(--radius-block);
  padding: 8px 14px; font-size: var(--text-12); box-shadow: 0 12px 30px -12px rgba(0, 0, 0, 0.5);
}

/* ---------- Runs ---------- */
.runs-grid {
  display: grid; align-items: center; padding: 0 24px;
  grid-template-columns: 30px 44px minmax(0, 1fr) 226px 178px 40px 80px 96px 76px;
}
.runs-head { height: 32px; color: var(--color-t-3); font-size: var(--text-12); border-bottom: 1px solid var(--color-line); flex-shrink: 0; }
.runs-head > :nth-child(1) { grid-column: 1 / 4; padding-left: 30px; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.col-commit { padding-left: 16px; }
.runs-group { height: 32px; display: flex; align-items: center; gap: 6px; padding: 0 24px; border-bottom: 1px solid var(--color-line); font-size: var(--text-12); color: var(--color-t-2); }
.row-link { height: 44px; border-bottom: 1px solid var(--color-line); }
.row-link:hover { background: var(--color-panel); }
.row-link > span:first-child { display: flex; align-items: center; }
.row-link .pr { color: var(--color-t-3); }
.row-link .title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding-right: 16px; }
.branch { display: inline-flex; align-items: center; gap: 6px; color: var(--color-t-2); min-width: 0; padding-right: 12px; }
.branch span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.branch svg { color: var(--color-t-3); }
.row-link .who { color: var(--color-t-2); padding-right: 12px; }
.row-link .shots { color: var(--color-t-2); }
.row-link .problems { font-family: var(--font-mono); font-size: var(--text-12); color: var(--color-t-3); }
.row-link .problems.has { color: var(--color-bad); }
.row-link .updated { text-align: right; color: var(--color-t-3); font-size: var(--text-12); white-space: nowrap; }
@media (max-width: 1360px) {
  .runs-grid { grid-template-columns: 30px 44px minmax(0, 1fr) 170px 150px 40px 72px 92px 64px; }
}
@media (max-width: 1180px) {
  .runs-grid { grid-template-columns: 30px 44px minmax(0, 1fr) 150px 130px 40px 64px 90px 56px; }
}

/* ---------- Run ---------- */
.tabs { display: flex; align-items: center; gap: 4px; }
.tab { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; border-radius: var(--radius-control); color: var(--color-t-2); font-weight: 500; }
.tab:hover { color: var(--color-t-1); }
.tab[aria-current="page"] { background: var(--color-line); color: var(--color-t-1); }
.tab .count { font-family: var(--font-mono); font-size: var(--text-11); color: var(--color-t-3); font-weight: 400; }
.tab .count.bad { color: var(--color-bad); }
.run-tabs { min-height: 44px; padding: 6px 24px 6px 16px; }
.flows { padding: 20px 24px 32px; display: flex; flex-direction: column; gap: 28px; }
.flow-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 24px; margin-bottom: 12px; }
.flow-title { display: flex; align-items: center; gap: 10px; }
.flow-title h2 { font-size: var(--text-14); line-height: var(--leading-14); font-weight: 600; letter-spacing: -0.01em; }
.tiles { display: flex; flex-wrap: wrap; gap: 20px 16px; }
.tile { width: 132px; display: flex; flex-direction: column; gap: 8px; }
.tile-label { display: flex; align-items: baseline; gap: 8px; font-size: var(--text-12); line-height: var(--leading-12); margin-top: 2px; }
.tile-label .mono { color: var(--color-t-3); }
.tile-label .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile.is-missing .tile-label .name { color: var(--color-t-3); }
.tile-note { display: flex; align-items: center; gap: 5px; font-size: var(--text-12); line-height: var(--leading-12); color: var(--color-bad); }
.tile-pill { align-self: flex-start; display: inline-flex; }
.tile-marks { align-self: flex-start; display: inline-flex; flex-wrap: wrap; gap: 4px; }
.made-mark { display: inline-flex; min-width: 0; }
.made-mark .pill { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.lightbox {
  position: fixed; inset: 0; z-index: 40; background: var(--color-backdrop); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 24px;
}
.lightbox img { max-height: calc(100vh - 110px); max-width: calc(100vw - 48px); border-radius: 20px; box-shadow: 0 0 0 1px var(--color-line-2); background: var(--color-panel); }
.lightbox-bar { display: flex; align-items: center; gap: 12px; color: #F5F5F2; font-size: var(--text-12); }
.lightbox-bar .btn-secondary { background: #141415; border-color: #303033; color: #F5F5F2; }

.run-problem-list { display: flex; flex-direction: column; }

/* ---------- Problems ---------- */
.split { flex: 1; min-height: 0; display: flex; }
.problem-list { width: 560px; flex-shrink: 0; border-right: 1px solid var(--color-line); overflow-y: auto; }
@media (max-width: 1360px) { .problem-list { width: 440px; } }
@media (max-width: 1100px) { .problem-list { width: 360px; } }
.problem-row {
  display: grid; grid-template-columns: 14px minmax(0, 1fr) auto; column-gap: 12px; align-items: start; height: 56px;
  padding: 11px 24px 0 24px; border-bottom: 1px solid var(--color-line);
}
.problem-row:hover { background: var(--color-panel); }
.problem-row.is-active { background: var(--color-line); }
.problem-row .mark { margin-top: 2px; }
.problem-row .title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.problem-row .sub { display: flex; align-items: center; gap: 6px; margin-top: 2px; color: var(--color-t-2); font-size: var(--text-12); line-height: var(--leading-12); white-space: nowrap; overflow: hidden; }
.problem-row .sub .mono { color: var(--color-t-2); }
.problem-row .side-col { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; color: var(--color-t-3); }
.unseen-dot { width: 6px; height: 6px; border-radius: 3px; background: var(--color-t-1); margin-right: 3px; }
.problem-detail { flex: 1; min-width: 0; overflow-y: auto; padding: 24px 32px 32px 32px; }
.detail-title { display: flex; align-items: center; gap: 10px; }
.detail-title h2 { font-size: var(--text-16); line-height: var(--leading-16); font-weight: 600; letter-spacing: -0.01em; }
.detail-meta a { display: inline-flex; align-items: center; gap: 6px; color: var(--color-t-2); }
.detail-meta a:hover { color: var(--color-t-1); }
.detail-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 4px 0 0 24px; color: var(--color-t-2); font-size: var(--text-12); line-height: 20px; }
.detail-body { margin-left: 24px; }
.detail-shots { display: flex; flex-wrap: wrap; gap: 24px 48px; margin-top: 28px; }
.detail-shot { display: flex; flex-direction: column; gap: 6px; }
.detail-shot .label { font-size: var(--text-12); line-height: var(--leading-12); color: var(--color-t-2); display: flex; gap: 8px; }
.detail-shot .label .t3 { color: var(--color-t-3); }
.detail-shot.is-failed .label { color: var(--color-bad); }
.detail-section { margin-top: 28px; }
.detail-section h3 { font-size: var(--text-13); font-weight: 600; margin-bottom: 8px; }
.detail-section p { color: var(--color-t-2); line-height: 20px; max-width: 72ch; white-space: pre-wrap; }
.detail-section .code { margin-top: 24px; }
.detail-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 24px; }
.detail-empty { padding: 32px; color: var(--color-t-3); }

/* --- captures, agents, settings --- */

/* Bordered filter select ("Device Any"), from the Captures design. */
.select-box {
  display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 0 0 10px; position: relative;
  border: 1px solid var(--color-line); border-radius: var(--radius-control); font-size: var(--text-12); color: var(--color-t-3);
}
.select-box:hover { border-color: var(--color-line-2); }
.select-box:focus-within { border-color: var(--color-t-3); }
.select-box select {
  appearance: none; border: 0; background: none; color: var(--color-t-1); font-size: var(--text-12); font-weight: 500;
  height: 26px; padding: 0 26px 0 0; margin-right: 1px; cursor: pointer; field-sizing: content; max-width: 180px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 16 16' fill='none' stroke='%2385857F' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 9px center;
}
.select-box select:focus-visible { outline: none; }
.select-box select option { background: var(--color-panel); color: var(--color-t-1); }

/* Captures */
.cap-groups { padding: 8px 24px 40px; display: flex; flex-direction: column; gap: 12px; }
.cap-group-head { display: flex; align-items: baseline; gap: 8px; height: 40px; padding-top: 12px; font-size: var(--text-13); line-height: var(--leading-13); font-weight: 500; color: var(--color-t-1); }
.cap-grid { display: grid; grid-template-columns: repeat(auto-fill, 132px); column-gap: 40px; row-gap: 28px; justify-content: start; }
.cap-tile { margin: 0; width: 132px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.cap-media { position: relative; width: 132px; height: 286px; }
.cap-thumb video { width: 100%; height: 100%; object-fit: cover; object-position: top; display: block; pointer-events: none; background: var(--color-panel); }
.cap-duration {
  position: absolute; left: 8px; bottom: 8px; display: inline-flex; align-items: center; gap: 4px; height: 18px; padding: 0 6px;
  border-radius: var(--radius-chip); background: rgba(11, 11, 12, 0.86); color: #F5F5F2;
  font-family: var(--font-mono); font-size: var(--text-11); line-height: 18px;
}
.cap-duration svg { fill: currentColor; stroke: none; }
.cap-standin { position: absolute; top: 8px; right: 8px; display: inline-flex; gap: 4px; pointer-events: none; }
.cap-tile figcaption { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cap-title { font-size: var(--text-13); line-height: var(--leading-13); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cap-title.mono { font-size: var(--text-12); line-height: var(--leading-13); font-weight: 400; }
.cap-meta { width: calc(100% + 28px); display: flex; align-items: center; gap: 4px; min-width: 0; font-size: var(--text-12); line-height: var(--leading-12); color: var(--color-t-3); white-space: nowrap; }
.cap-meta .avatar { margin-right: 1px; }
.cap-who { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.cap-meta time { flex-shrink: 0; font-variant-numeric: tabular-nums; }
.lightbox video { max-height: calc(100vh - 110px); max-width: calc(100vw - 48px); border-radius: 20px; box-shadow: 0 0 0 1px var(--color-line-2); background: #000; }

/* Agents */
.agents-page { flex-direction: row; overflow: hidden; }
.agents-main { flex: 1; min-width: 0; overflow-y: auto; padding: 24px 24px 40px; display: flex; flex-direction: column; gap: 36px; }
.agents-side { width: 520px; flex-shrink: 0; overflow-y: auto; border-left: 1px solid var(--color-line); padding: 24px 24px 40px; display: flex; flex-direction: column; gap: 36px; }
@media (max-width: 1280px) { .agents-side { width: 420px; } }
@media (max-width: 1080px) { .agents-page { flex-direction: column; overflow-y: auto; } .agents-main, .agents-side { overflow: visible; width: auto; } .agents-side { border-left: 0; border-top: 1px solid var(--color-line); } }
.sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.sec-head h2 { font-size: var(--text-14); line-height: var(--leading-14); font-weight: 600; letter-spacing: -0.01em; }
.sec-note { font-size: var(--text-12); line-height: var(--leading-12); text-align: right; }
.client-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 12px; flex-wrap: wrap; }
.client-seg button { display: inline-flex; align-items: center; gap: 7px; padding: 5px 12px 5px 10px; font-size: var(--text-13); line-height: var(--leading-13); }
.client-seg .avatar { width: 14px; height: 14px; border-radius: 4px; font-size: 9px; line-height: 14px; }
.code.cmd { padding: 13px 44px 13px 14px; white-space: pre-wrap; }
.code.cmd .copy-btn { top: 50%; transform: translateY(-50%); }
.ci-head { display: flex; align-items: baseline; gap: 10px; margin: 18px 0 10px; font-size: var(--text-12); line-height: var(--leading-12); }
.ci-label { font-size: var(--text-13); font-weight: 500; color: var(--color-t-1); }
.tool-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--color-line); }
.tool-list li { display: grid; grid-template-columns: 192px minmax(0, 1fr); gap: 16px; align-items: baseline; padding: 9px 0; border-bottom: 1px solid var(--color-line); }
.tool-name { font-size: var(--text-12); line-height: var(--leading-13); color: var(--color-t-1); overflow-wrap: anywhere; }
.tool-desc { color: var(--color-t-2); line-height: var(--leading-13); }
.tool-desc code { color: var(--color-t-1); }
.conn-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--color-line); }
.conn { display: grid; grid-template-columns: 24px minmax(0, 1fr) auto 84px; align-items: center; gap: 12px; min-height: 52px; padding: 8px 0; border-bottom: 1px solid var(--color-line); }
.conn-title { display: flex; align-items: center; gap: 8px; font-weight: 500; min-width: 0; }
.conn-title > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conn-sub { font-size: var(--text-12); line-height: var(--leading-12); margin-top: 2px; }
.conn-calls { display: inline-flex; align-items: baseline; gap: 6px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.conn-last { text-align: right; font-size: var(--text-12); white-space: nowrap; }
.agents-empty { display: flex; flex-direction: column; gap: 12px; color: var(--color-t-2); line-height: 20px; }
.agents-empty strong { color: var(--color-t-1); font-weight: 500; }
.act-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.act { display: grid; grid-template-columns: 48px minmax(0, 1fr); align-items: baseline; }
.act time { font-variant-numeric: tabular-nums; }
.act p { line-height: 20px; }
.act-who { color: var(--color-t-1); font-weight: 500; }
.act-text { color: var(--color-t-2); overflow-wrap: anywhere; }
.act-tool { color: var(--color-t-3); }
.act-failed { color: var(--color-bad); }
.act.is-failed time { color: var(--color-bad); }

/* Settings */
.settings { display: grid; grid-template-columns: 200px minmax(0, 1fr); align-items: start; }
.set-nav { position: sticky; top: 0; display: flex; flex-direction: column; gap: 1px; padding: 24px 16px; }
.set-nav a { display: flex; align-items: center; height: 28px; padding: 0 8px; border-radius: var(--radius-control); color: var(--color-t-2); }
.set-nav a:hover { color: var(--color-t-1); }
.set-nav a[aria-current="true"] { background: var(--color-line); color: var(--color-t-1); font-weight: 500; }
.set-body { max-width: 744px; padding: 28px 32px 96px; border-left: 1px solid var(--color-line); min-height: 100%; }
.set-section { padding-bottom: 28px; margin-bottom: 28px; border-bottom: 1px solid var(--color-line); scroll-margin-top: 20px; }
.set-section:last-child { border-bottom: 0; }
.set-section h2 { font-size: var(--text-14); line-height: var(--leading-14); font-weight: 600; letter-spacing: -0.01em; }
.set-section h2:focus { outline: none; }
.set-note { margin: 4px 0 12px; font-size: var(--text-12); line-height: 18px; color: var(--color-t-3); max-width: 64ch; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 24px; min-height: 44px; padding: 6px 0; }
.set-row-top { align-items: flex-start; }
.set-label { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.set-sub { font-size: var(--text-12); line-height: var(--leading-12); color: var(--color-t-3); }
.set-sub .mono { font-size: var(--text-11); }
.set-value { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-shrink: 0; text-align: right; }
.set-chips { display: inline-flex; gap: 6px; }
.set-empty { color: var(--color-t-3); padding: 8px 0; }
.set-list { margin: 0; padding: 0 0 0 16px; max-width: 360px; color: var(--color-t-2); font-size: var(--text-12); line-height: 18px; }
.set-value form { margin: 0; }

/* Imitor Cloud: access keys, and the dialog that shows a new key once. */
.key-create { display: flex; gap: 8px; margin: 4px 0 8px; }
.key-create .field { flex: 1; }
.key-dialog-backdrop { position: fixed; inset: 0; z-index: 40; background: var(--color-backdrop); display: grid; place-items: center; padding: 16px; }
.key-dialog {
  width: 100%; max-width: 560px; display: flex; flex-direction: column; gap: 12px; padding: 20px;
  background: var(--color-bg); border: 1px solid var(--color-line-2); border-radius: var(--radius-block); box-shadow: 0 24px 60px -20px rgba(0, 0, 0, 0.6);
}
.key-dialog h2 { margin: 0; font-size: var(--text-16); line-height: var(--leading-16); font-weight: 600; letter-spacing: -0.01em; }
.key-dialog p { margin: 0; color: var(--color-t-2); }
.key-dialog-actions { display: flex; justify-content: flex-end; }
.project-all { padding-top: 8px; border-top: 1px solid var(--color-line); color: var(--color-t-1); text-decoration: none; }
.project-all:hover { text-decoration: underline; }
@media (max-width: 699px) { .key-create { flex-direction: column; } .set-value form + form { margin-left: 0; } }

/* Run shots: one row per flow that scrolls sideways instead of wrapping a lone tile. */
.flows .tiles {
  flex-wrap: nowrap; overflow-x: auto; overscroll-behavior-x: contain; margin: 0 -24px; padding: 2px 24px 12px;
  scrollbar-width: thin; scrollbar-color: var(--color-line-2) transparent; scroll-padding: 0 24px;
}
.flows .tiles::-webkit-scrollbar { height: 6px; }
.flows .tiles::-webkit-scrollbar-thumb { background: var(--color-line-2); border-radius: 3px; }
.flows .tiles:focus-visible { outline-offset: -2px; border-radius: var(--radius-block); }
.flows .tile { flex-shrink: 0; }
.flows .tiles.more-right { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 72px), transparent calc(100% - 4px)); mask-image: linear-gradient(to right, #000 calc(100% - 72px), transparent calc(100% - 4px)); }
.flows .tiles.more-left { -webkit-mask-image: linear-gradient(to right, transparent 4px, #000 72px); mask-image: linear-gradient(to right, transparent 4px, #000 72px); }
.flows .tiles.more-left.more-right { -webkit-mask-image: linear-gradient(to right, transparent 4px, #000 72px, #000 calc(100% - 72px), transparent calc(100% - 4px)); mask-image: linear-gradient(to right, transparent 4px, #000 72px, #000 calc(100% - 72px), transparent calc(100% - 4px)); }

/* Problems: a meta line built from optional parts (stand-in problems have no device or scheme). */
.problem-row .sub-part { display: inline-flex; align-items: center; gap: 6px; }

/* --- live preview, onboarding --- */
/* Full-width pages without the sidebar. Stage ground and device shadow from the THEMES table in design/paper-kit.mjs. */
:root { --stage-bg: #0B0B0C; --dev-shadow: 0 40px 70px -20px rgba(0, 0, 0, 0.8), 0 0 0 1px #303033; }
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) { --stage-bg: #F7F7F4; --dev-shadow: 0 30px 50px -24px rgba(11, 11, 12, 0.35), 0 6px 14px -6px rgba(11, 11, 12, 0.12); }
}
:root[data-theme="light"] { --stage-bg: #F7F7F4; --dev-shadow: 0 30px 50px -24px rgba(11, 11, 12, 0.35), 0 6px 14px -6px rgba(11, 11, 12, 0.12); }

.app.is-bare .main { overflow: hidden; }

/* Live preview: 48px bar, 232px rail, stage, 320px inspector */
.live-main { height: 100vh; }
.live-bar {
  display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 16px;
  height: 48px; padding: 0 16px; border-bottom: 1px solid var(--color-line); flex-shrink: 0;
}
.live-crumbs { display: flex; align-items: center; gap: 10px; min-width: 0; }
.live-crumbs .sep { color: var(--color-t-3); }
.live-brand { display: flex; align-items: center; gap: 9px; flex-shrink: 0; }
.crumb-project { font-weight: 500; white-space: nowrap; }
.crumb-run { color: var(--color-t-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
a.crumb-run:hover, .crumb-project:hover { color: var(--color-t-1); }
.live-tabs { justify-self: center; }
.live-actions { justify-self: end; display: flex; align-items: center; gap: 12px; }
.built { display: inline-flex; align-items: center; gap: 6px; font-size: var(--text-12); color: var(--color-t-2); white-space: nowrap; }
.built .dot { width: 6px; height: 6px; border-radius: 3px; background: var(--color-ok); }

.live-body { flex: 1; min-height: 0; display: flex; }
.live-body > .loading-line, .live-body > .state { flex: 1; }
.live-rail { width: var(--container-rail); flex-shrink: 0; border-right: 1px solid var(--color-line); overflow-y: auto; padding: 10px 8px 16px; }
.rail-flow + .rail-flow { margin-top: 14px; }
.rail-head { display: flex; align-items: center; justify-content: space-between; height: 28px; padding: 0 8px; color: var(--color-t-2); }
.rail-step {
  display: flex; align-items: center; width: 100%; height: 28px; padding: 0 8px; border: 0; background: none; border-radius: var(--radius-control);
  text-align: left; color: var(--color-t-1); gap: 0;
}
.rail-step:hover { background: var(--color-panel); }
.rail-step .num { width: 26px; flex-shrink: 0; text-align: left; color: var(--color-t-3); }
.rail-step .label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rail-step.is-current { background: var(--color-line); font-weight: 500; }
.rail-step.is-current .num { color: var(--color-acc); }
.rail-step.is-failed .label, .rail-step.is-failed .num { color: var(--color-bad); }
.rail-step.is-missing .label { color: var(--color-t-3); }
.standin-dot { width: 6px; height: 6px; border-radius: 1px; background: var(--color-warn); flex-shrink: 0; margin-right: 4px; }
.rail-note { display: flex; gap: 8px; align-items: flex-start; margin: 16px 8px 0; font-size: var(--text-12); line-height: var(--leading-12); color: var(--color-t-3); }
.rail-note .mark { margin-top: 1px; }
.rail-empty { padding: 8px; color: var(--color-t-3); }

.live-stage { position: relative; flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; padding: 40px 24px 16px; background: var(--stage-bg); overflow: hidden; }
.stage-fit { flex-shrink: 0; }
.stage-state { padding: 24px 0; }
.device-wrap { position: relative; width: calc(var(--sw) + 20px); height: calc(var(--sh) + 20px); }
.device-wrap .ghost {
  position: absolute; inset: 0; transform: translate(16px, 22px); border: 1.5px dashed var(--color-ghost); border-radius: var(--radius); opacity: 0.85;
}
.device {
  position: absolute; inset: 0; padding: 10px; border-radius: var(--radius); background: #0B0B0C; box-shadow: var(--dev-shadow);
  display: flex; flex-direction: column;
}
.statusbar {
  height: var(--strip); flex-shrink: 0; display: flex; align-items: center; justify-content: space-between; position: relative;
  padding: 0 calc(var(--sw) * 0.09); background: #000; color: #F5F5F2; border-radius: calc(var(--radius) - 10px) calc(var(--radius) - 10px) 0 0;
  font-size: calc(15px * var(--k)); font-weight: 600; letter-spacing: -0.01em;
}
.statusbar .island { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: calc(var(--sw) * 0.3); height: calc(var(--strip) * 0.66); border-radius: 999px; background: #000; box-shadow: 0 0 0 1px #26262A; }
.statusbar .cam { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: calc(12px * var(--k)); height: calc(12px * var(--k)); border-radius: 50%; background: #000; box-shadow: 0 0 0 1px #26262A; }
.statusbar .batt { width: calc(24px * var(--k)); height: calc(12px * var(--k)); border: 1px solid rgba(245, 245, 242, 0.6); border-radius: 3px; padding: 1px; }
.statusbar .batt span { display: block; height: 100%; width: 80%; background: #F5F5F2; border-radius: 1px; }
.device-wrap.android .statusbar { font-size: calc(13px * var(--k)); font-weight: 500; }
.screen {
  position: relative; width: var(--sw); flex: 1; overflow: hidden; background: #FFFFFF;
  border-radius: 0 0 calc(var(--radius) - 10px) calc(var(--radius) - 10px);
}
.screen iframe { position: absolute; top: 0; left: 0; border: 0; display: block; transform-origin: 0 0; background: #FFFFFF; }
.stage-status { position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); width: max-content; max-width: min(560px, calc(100% - 48px)); z-index: 2; box-shadow: 0 12px 30px -12px rgba(0, 0, 0, 0.5); border-radius: var(--radius-block); }
.stage-status:empty { display: none; }
.replay {
  display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 10px; min-height: 32px; border: 1px solid var(--color-line); border-radius: var(--radius-block);
  background: var(--color-panel); font-size: var(--text-12); line-height: var(--leading-12); color: var(--color-t-2);
}
.replay .bar { width: 72px; height: 3px; border-radius: 2px; background: var(--color-line-2); overflow: hidden; flex-shrink: 0; margin-right: 4px; }
.replay .bar span { display: block; height: 100%; background: var(--color-acc); transition: width 0.2s ease; }
.replay.is-error { border-color: var(--color-bad-line); background: var(--color-bad-tint); color: var(--color-t-1); }
.replay.is-error .btn { height: 24px; padding: 0 8px; font-size: var(--text-12); }
.stage-caption { margin-top: 26px; display: flex; gap: 8px; color: var(--color-t-3); }
.stage-caption .dim { opacity: 0.6; }
@media (prefers-reduced-motion: reduce) { .replay .bar span { transition: none; } }

.live-inspector { width: var(--container-inspector); flex-shrink: 0; border-left: 1px solid var(--color-line); overflow-y: auto; }
.insp-section { padding: 16px; border-bottom: 1px solid var(--color-line); }
.insp-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.insp-head h2 { color: var(--color-t-2); }
.fidelity { list-style: none; margin: 0; padding: 0; }
.fidelity li { display: grid; grid-template-columns: 14px minmax(0, 1fr) auto; align-items: start; column-gap: 10px; padding: 6px 0; }
.fidelity li .mark { margin-top: 2px; }
.fidelity .what { min-width: 0; }
.fidelity .what.mono { font-size: var(--text-12); line-height: var(--leading-13); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fidelity .how { font-size: var(--text-12); line-height: var(--leading-13); white-space: nowrap; text-align: right; }
.fidelity .how.warn { color: var(--color-warn); }
.on-screen { color: var(--color-t-1); }
.on-screen-line { margin-top: 8px; font-size: var(--text-12); line-height: var(--leading-12); color: var(--color-t-2); }
.controls .control + .control, .controls .control-note + .control { margin-top: 16px; }
.control-label { display: flex; align-items: center; justify-content: space-between; color: var(--color-t-2); }
.control.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.control.row .control-label { display: block; }
.control-sub { display: block; font-size: var(--text-11); line-height: var(--leading-11); }
.control select.field { width: 100%; margin-top: 8px; }
.control-note { margin-top: 12px; padding: 8px 10px; border-radius: var(--radius-control); background: var(--color-panel); border: 1px solid var(--color-line); font-size: var(--text-12); line-height: var(--leading-12); color: var(--color-t-2); }
.seg button:disabled, .switch:disabled { opacity: 0.45; cursor: default; }
.seg button:disabled:hover { color: var(--color-t-2); }

@media (max-width: 1180px) {
  .live-rail { width: 200px; }
  .live-inspector { width: 280px; }
}
@media (max-width: 900px) {
  .live-rail { display: none; }
  .live-bar .wordmark, .live-actions .built { display: none; }
}

/* Onboarding: 56px bar with the three steps, a centred column */
.onb-main { overflow-y: auto; }
.onb-bar { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; height: 56px; padding: 0 24px; flex-shrink: 0; }
.onb-brand { display: flex; align-items: center; gap: 9px; justify-self: start; }
.onb-steps { list-style: none; margin: 0; padding: 0; display: flex; align-items: center; gap: 10px; }
.onb-step a { display: flex; align-items: center; gap: 7px; white-space: nowrap; }
.onb-step.is-now a { font-weight: 500; }
.onb-step.is-next a { color: var(--color-t-3); }
.onb-num { width: 18px; height: 18px; border-radius: 9px; display: grid; place-items: center; font-family: var(--font-mono); font-size: var(--text-11); line-height: 1; }
.onb-step.is-done .onb-num { background: var(--color-ok); color: var(--color-bg); }
.onb-step.is-done .onb-num svg { stroke-width: 2; }
.onb-step.is-now .onb-num { background: var(--color-t-1); color: var(--color-bg); }
.onb-step.is-next .onb-num { border: 1px solid var(--color-line-2); color: var(--color-t-3); }
.onb-line { width: 28px; height: 1px; background: var(--color-line-2); }
.onb-skip { justify-self: end; color: var(--color-t-2); }
.onb-skip:hover { color: var(--color-t-1); }
.onb-centre { display: flex; justify-content: center; padding: 72px 24px 64px; }
.onb-col { width: var(--container-onboarding); max-width: 100%; display: flex; flex-direction: column; }
.onb-col.w720 { width: 720px; }
.onb-col.w760 { width: 760px; }
.onb-title { font-size: var(--text-28); line-height: var(--leading-28); font-weight: 600; letter-spacing: -0.03em; }
.onb-lede { margin-top: 12px; font-size: 15px; line-height: 23px; color: var(--color-t-2); }
.onb-lede .mono { font-size: 13px; color: var(--color-t-1); }
.onb-mode { margin-top: 36px; }
.onb-paste { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 14px; margin: 20px 0 10px; }
.onb-paste-label { font-weight: 500; }
.onb-agent { display: inline-flex; align-items: center; gap: 6px; }
.onb-paste-hint { margin-left: auto; font-size: var(--text-12); }
.onb-h2 { margin: 30px 0 6px; font-weight: 500; }
.onb-list { list-style: none; margin: 0; padding: 0; }
.onb-list li { display: flex; align-items: center; gap: 14px; min-height: 30px; }
.onb-hand { list-style: none; margin: 24px 0 0; padding: 0; display: flex; flex-direction: column; gap: 18px; }
.onb-hand-title { display: flex; align-items: baseline; gap: 14px; margin-bottom: 8px; }
.onb-more { margin-top: 14px; font-size: var(--text-12); }
.onb-more a { text-decoration: underline; }
.onb-status { margin-top: 44px; }
.onb-status-row { display: flex; align-items: center; gap: 10px; min-height: 36px; padding: 0 12px; border: 1px solid var(--color-line); border-radius: var(--radius-control); color: var(--color-t-2); }
.onb-status-row > span:nth-of-type(1) { flex: 1; min-width: 0; padding: 8px 0; }
.onb-status-row.is-ok { color: var(--color-t-1); }
.onb-status-row.is-bad { border-color: var(--color-bad-line); }
.onb-foot { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--color-line); }
.onb-foot-note { font-size: var(--text-12); color: var(--color-t-3); }
.onb-foot-note .btn-ghost { margin-left: -12px; }
.onb-foot-actions { display: flex; align-items: center; gap: 8px; }
.onb-table { margin-top: 36px; border: 1px solid var(--color-line); border-radius: var(--radius-block); }
.onb-tr { display: grid; grid-template-columns: minmax(0, 250px) minmax(0, 1fr) 120px 110px; align-items: center; column-gap: 16px; min-height: 44px; padding: 0 16px; border-top: 1px solid var(--color-line); }
.onb-tr > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.onb-tr .mono { font-size: var(--text-12); }
.onb-th { min-height: 32px; border-top: 0; font-size: var(--text-12); color: var(--color-t-3); }
.onb-tr .right { justify-self: end; }
.onb-empty { margin-top: 28px; padding: 14px 16px; border: 1px dashed var(--color-line-2); border-radius: var(--radius-block); line-height: 20px; }
.onb-footnote { display: flex; align-items: center; gap: 10px; margin-top: 16px; color: var(--color-t-2); }
.onb-col.w760 .onb-foot { margin-top: 48px; }
.onb-run-line { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: 44px; }
.onb-run-line .t1 { font-weight: 500; }
.onb-shots { display: flex; flex-wrap: wrap; gap: 24px; margin-top: 18px; }
.onb-shot { margin: 0; display: flex; flex-direction: column; gap: 10px; }
.onb-shot figcaption { display: flex; gap: 8px; font-size: var(--text-12); line-height: var(--leading-12); max-width: 96px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.onb-counts { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin-top: 32px; color: var(--color-t-2); }
.onb-counts b { color: var(--color-t-1); font-weight: 500; margin-right: 4px; }
.onb-counts .bad b { color: var(--color-bad); }
.onb-counts .dot { color: var(--color-t-3); font-size: 10px; }
.onb-limits { display: flex; align-items: flex-start; gap: 10px; margin-top: 14px; color: var(--color-t-2); line-height: 20px; }
.onb-limits .mark { margin-top: 3px; }
.onb-limits b { color: var(--color-t-1); font-weight: 500; }
.onb-col.w720 .onb-foot { margin-top: 44px; }
.t1 { color: var(--color-t-1); }
.device-wrap.ios .statusbar .cam, .device-wrap.android .statusbar .island { display: none; }

/* --- static export --- */
.demo-pill { margin-left: auto; display: inline-flex; }
@media (max-width: 900px) { .side-brand .demo-pill { display: none; } }

/* --- phone layouts --- */
/* Below 700px wide: no sidebar, a 52px top bar and a 56px bottom tab bar (app.js), one column everywhere, 16px side
   padding, 44px touch targets, nothing to read under 12px (11px only for mono meta). From design/HANDOFF.md, Mobile,
   and the r-signal-mruns / r-signal-mlive screens. The elements below exist at every width; only phones show them. */
.m-icon-btn {
  width: 44px; height: 44px; flex-shrink: 0; display: grid; place-items: center; padding: 0; border: 0; border-radius: var(--radius-control);
  background: none; color: var(--color-t-2);
}
.m-icon-btn:disabled { color: var(--color-t-3); opacity: 0.45; cursor: default; }
.m-top, .m-tabs, .m-sheet, .m-sub, .m-back, .live-phone, .live-sheet-backdrop, .live-sheet-close { display: none; }
.code-text { display: block; font: inherit; }
/* The onboarding page scrolls (the bare-page rule above would otherwise clip it). */
.app.is-bare .main.onb-main { overflow-y: auto; }

@media (max-width: 700px) {
  /* ---------- Shell ---------- */
  .app { flex-direction: column; height: 100vh; height: 100dvh; }
  .side { display: none; }
  .main { order: 0; flex: 1; min-height: 0; }
  .m-top {
    order: -1; display: flex; align-items: center; gap: 10px; height: 52px; padding: 0 4px 0 6px; flex-shrink: 0;
    border-bottom: 1px solid var(--color-line); background: var(--color-bg);
  }
  .m-brand { width: 44px; height: 44px; display: grid; place-items: center; flex-shrink: 0; border-radius: var(--radius-control); }
  .m-top .wordmark { margin-left: -6px; }
  .m-divider { width: 1px; height: 20px; background: var(--color-line-2); flex-shrink: 0; }
  .m-project {
    display: inline-flex; align-items: center; gap: 6px; min-width: 0; height: 44px; padding: 0 6px; margin-left: -6px;
    border: 0; background: none; font-size: var(--text-14); font-weight: 500; color: var(--color-t-1);
  }
  .m-project span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .m-project svg { color: var(--color-t-3); }
  .m-title { flex: 1; min-width: 0; font-size: var(--text-14); line-height: var(--leading-14); font-weight: 600; letter-spacing: -0.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .m-more { width: 44px; height: 44px; margin-left: auto; flex-shrink: 0; display: grid; place-items: center; border: 0; border-radius: var(--radius-control); background: none; color: var(--color-t-2); }
  .m-top .demo-pill { margin-left: auto; }
  .m-top .demo-pill + .m-more { margin-left: 0; }

  .m-tabs {
    order: 1; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); flex-shrink: 0;
    height: calc(56px + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
    border-top: 1px solid var(--color-line); background: var(--color-bg);
  }
  .m-tab { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-width: 0; color: var(--color-t-2); }
  .m-tab.is-active { color: var(--color-t-1); }
  .m-tab-icon { position: relative; display: block; }
  .m-tab-label { font-size: var(--text-11); line-height: 14px; font-weight: 500; white-space: nowrap; }
  .m-count {
    position: absolute; left: 14px; top: -6px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px;
    background: var(--color-line-2); color: var(--color-t-1); font-family: var(--font-mono); font-size: var(--text-11); line-height: 16px; text-align: center;
  }
  .m-tab:focus-visible { outline-offset: -4px; }

  /* The "more" sheet: project, Settings, Docs and the theme. */
  .m-sheet:not([hidden]) { display: block; position: fixed; inset: 0; z-index: 45; }
  .m-sheet-backdrop { position: absolute; inset: 0; background: var(--color-backdrop); }
  .m-sheet-panel {
    position: absolute; left: 0; right: 0; bottom: 0; padding: 4px 16px calc(12px + env(safe-area-inset-bottom));
    background: var(--color-bg); border-top: 1px solid var(--color-line-2); border-radius: 14px 14px 0 0;
    box-shadow: 0 -20px 40px -20px rgba(0, 0, 0, 0.5);
  }
  .m-sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 52px; margin-right: -10px; }
  .m-sheet-project { display: flex; align-items: center; gap: 10px; min-width: 0; font-size: var(--text-14); font-weight: 600; }
  .m-sheet-project > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .m-sheet-facts { margin: 0 0 12px; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 12px; font-size: var(--text-12); line-height: var(--leading-12); }
  .m-sheet-facts dt { color: var(--color-t-3); }
  .m-sheet-facts dd { margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .m-sheet-facts dd.mono { font-size: var(--text-12); }
  .m-sheet-nav { display: flex; flex-direction: column; border-top: 1px solid var(--color-line); }
  .m-sheet-item { display: flex; align-items: center; gap: 12px; height: 48px; border-bottom: 1px solid var(--color-line); color: var(--color-t-1); }
  .m-sheet-item > span { flex: 1; }
  .m-sheet-item > svg { color: var(--color-t-2); }
  .m-sheet-item > svg:last-child { color: var(--color-t-3); }
  .m-sheet-theme { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 60px; }

  /* ---------- Shared pieces at phone size ---------- */
  .page-header { height: auto; padding: 8px 16px; gap: 8px; }
  .page-header .page-title { display: none; }
  .page-header:has(> .page-actions:empty) { display: none; }
  .page-actions { flex: 1; min-width: 0; }
  .page-actions .btn { flex: 1 1 0; min-width: 0; }
  [data-page="/"] .page-header, [data-page="/runs"] .page-header, [data-page="/agents"] .page-header { display: none; }
  .toolbar { padding: 8px 16px; min-height: 0; }
  .btn { height: 44px; padding: 0 14px; }
  .btn-secondary { padding: 0 13px; }
  .seg { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
  .seg::-webkit-scrollbar { display: none; }
  .seg button { min-height: 44px; padding: 0 14px; font-size: var(--text-13); white-space: nowrap; flex-shrink: 0; }
  .field { height: 44px; }
  .select-ghost select { min-height: 44px; font-size: var(--text-13); }
  .select-box { height: 44px; font-size: var(--text-13); }
  .select-box select { height: 42px; font-size: var(--text-13); max-width: 150px; }
  .tab { height: 44px; padding: 0 12px; }
  .pill { height: 22px; font-size: var(--text-12); }
  .control-sub { font-size: var(--text-12); line-height: var(--leading-12); }
  .copy-btn { top: 0; right: 0; width: 44px; height: 44px; }
  .code.cmd .copy-btn { top: 50%; }
  /* Code scrolls sideways inside its block; the copy button stays at the right. */
  .code, .code.cmd { padding: 0; }
  .code-text { overflow-x: auto; white-space: pre; padding: 12px 48px 12px 14px; scrollbar-width: thin; }
  .code.cmd .code-text { padding: 13px 48px 13px 14px; }
  .onb-paste + .code .code-text { white-space: pre-wrap; } /* the agent prompt is prose: it wraps */
  .state { padding: 24px 16px; }
  .state .code { min-width: 0; width: 100%; }
  .loading-line, .placeholder-page { padding-left: 16px; padding-right: 16px; }
  .skeleton-row { padding: 0 16px; height: 64px; }
  .toast { bottom: calc(68px + env(safe-area-inset-bottom)); max-width: calc(100vw - 32px); }

  /* ---------- Runs: two-line rows ---------- */
  .runs-head { display: none; }
  [data-page="/"] .content > .toolbar, [data-page="/runs"] .content > .toolbar { border-bottom: 0; }
  [data-page="/"] .content > .toolbar > .t3, [data-page="/runs"] .content > .toolbar > .t3 { display: none; }
  [data-page="/"] .content > .toolbar .seg, [data-page="/runs"] .content > .toolbar .seg { flex: 1; }
  [data-page="/"] .content > .toolbar .seg button, [data-page="/runs"] .content > .toolbar .seg button { flex: 1 1 0; }
  .runs-group { padding: 0 16px; }
  .row-link {
    display: grid; grid-template-columns: 26px 44px minmax(0, 1fr) auto; grid-template-areas: "mark pr title title" "mark . sub time";
    align-content: center; row-gap: 3px; height: 64px; padding: 0 16px;
  }
  .row-link > span:first-child { grid-area: mark; }
  .row-link .pr { grid-area: pr; font-family: var(--font-mono); font-size: var(--text-12); line-height: 20px; color: var(--color-t-3); }
  .row-link .title { grid-area: title; padding-right: 0; font-size: var(--text-14); line-height: 20px; font-weight: 500; }
  .row-link .m-sub { display: block; grid-area: sub; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--text-12); line-height: var(--leading-12); color: var(--color-t-2); }
  .row-link .updated { grid-area: time; padding-left: 12px; line-height: var(--leading-12); }
  .row-link .branch, .row-link .who, .row-link .shots, .row-link .problems, .row-link .col-commit { display: none; }

  /* ---------- Run: shots ---------- */
  .run-tabs { flex-wrap: wrap; gap: 8px; padding: 4px 16px 10px; }
  .run-tabs .tabs { width: calc(100% + 32px); margin: 0 -16px; padding: 0 12px; overflow-x: auto; scrollbar-width: none; }
  .run-tabs .tabs::-webkit-scrollbar { display: none; }
  .run-tabs .tab { flex-shrink: 0; }
  .run-tabs .toolbar-group { width: 100%; flex-wrap: wrap; gap: 8px; }
  .run-tabs .toolbar-group .seg { flex: 1 1 auto; }
  .run-tabs .toolbar-group .seg button { flex: 1 0 auto; }
  .flows { padding: 16px 16px 32px; gap: 28px; }
  .flow-head { height: auto; min-height: 24px; flex-wrap: wrap; gap: 4px 12px; }
  .flows .tiles { margin: 0 -16px; padding: 2px 16px 12px; scroll-padding: 0 16px; scroll-snap-type: x proximity; gap: 16px 12px; }
  .flows .tile { width: 156px; scroll-snap-align: start; }
  .flows .tile .thumb { width: 156px; height: 338px; border-radius: 16px; }
  .run-problem-list .problem-row { padding-left: 16px; padding-right: 16px; }

  /* ---------- Problems: the list, then the detail as its own step ---------- */
  .split { flex-direction: column; }
  .problem-list { width: auto; flex: 1; border-right: 0; }
  .split:not(.has-selection) .problem-detail { display: none; }
  .split.has-selection .problem-list { display: none; }
  .main:has(.split.has-selection) > .toolbar, .main:has(.split.has-selection) > .page-header { display: none; }
  .problem-row { height: auto; min-height: 60px; padding: 11px 16px 10px; }
  .split:not(.has-selection) .problem-row.is-active:not(:hover) { background: none; } /* nothing is open while the list shows */
  .problem-detail { padding: 4px 16px 32px; }
  .m-back {
    display: inline-flex; align-items: center; gap: 4px; height: 44px; margin: 0 0 4px -10px; padding: 0 10px 0 6px;
    border: 0; border-radius: var(--radius-control); background: none; color: var(--color-t-2); font-weight: 500;
  }
  .detail-title { align-items: flex-start; }
  .detail-title .mark { margin-top: 4px; }
  .detail-meta, .detail-body { margin-left: 0; }
  .detail-meta { margin-top: 8px; }
  .detail-meta > a[href] { display: block !important; width: 100%; } /* the run's title wraps under its number, not beside it */
  .detail-meta > a[href] > .mono { margin-right: 6px; }
  .detail-shots { gap: 16px; margin-top: 20px; }
  .detail-section .code { margin-top: 16px; }
  .detail-actions .btn { flex: 1 1 auto; }
  .main:has(.split) > .toolbar { flex-wrap: wrap; }
  .main:has(.split) > .toolbar .toolbar-group { flex-wrap: wrap; gap: 0 16px; }
  .toolbar-group .select-ghost + .select-ghost { margin-left: 0; }

  /* ---------- Captures: two columns, filters scroll sideways ---------- */
  [data-page="/captures"] .toolbar { flex-wrap: nowrap; justify-content: flex-start; overflow-x: auto; scrollbar-width: none; }
  [data-page="/captures"] .toolbar::-webkit-scrollbar { display: none; }
  [data-page="/captures"] .toolbar > *, [data-page="/captures"] .toolbar .select-box { flex-shrink: 0; }
  .cap-groups { padding: 4px 16px 32px; gap: 8px; }
  .cap-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 14px; row-gap: 24px; }
  .cap-tile { width: auto; }
  .cap-media { width: auto; height: auto; aspect-ratio: 393 / 852; }
  .cap-media > .thumb { width: 100%; height: 100%; border-radius: 16px; }
  .cap-meta { width: 100%; }

  /* The lightbox and the video player fill the screen; the buttons sit at the bottom, in reach of a thumb. */
  .lightbox { padding: env(safe-area-inset-top) 0 0; gap: 0; justify-content: flex-start; }
  .lightbox img, .lightbox video {
    flex: 1; min-height: 0; width: 100%; max-width: 100%; max-height: none; object-fit: contain; padding: 12px 12px 0;
    border-radius: 0; box-shadow: none; background: transparent;
  }
  .lightbox-bar {
    width: 100%; flex-wrap: wrap; gap: 8px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
    background: #0B0B0C; border-top: 1px solid #303033;
  }
  .lightbox-bar > span { width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .lightbox-bar .btn { flex: 1 1 0; min-width: 0; padding: 0 8px; }

  /* ---------- Agents, Settings: one column ---------- */
  .agents-main, .agents-side { padding: 20px 16px 32px; gap: 32px; }
  .sec-head { flex-wrap: wrap; gap: 2px 16px; }
  .sec-note { text-align: left; }
  .client-row { gap: 8px; }
  .ci-head { flex-wrap: wrap; row-gap: 2px; }
  .ci-label { flex-shrink: 0; }
  .client-seg { width: 100%; }
  .client-seg button { flex: 1 0 auto; justify-content: center; padding: 0 9px; gap: 6px; }
  .tool-list li { grid-template-columns: minmax(0, 1fr); gap: 2px; padding: 10px 0; }
  .conn { grid-template-columns: 24px minmax(0, 1fr) auto; grid-template-areas: "av name last" "av calls calls"; row-gap: 4px; padding: 10px 0; }
  .conn > .avatar { grid-area: av; align-self: start; margin-top: 2px; }
  .conn-name { grid-area: name; min-width: 0; }
  .conn-calls { grid-area: calls; }
  .conn-last { grid-area: last; align-self: start; }
  .act { grid-template-columns: 44px minmax(0, 1fr); }

  .settings { display: block; }
  .set-nav {
    position: sticky; top: 0; z-index: 1; flex-direction: row; gap: 4px; padding: 4px 12px; overflow-x: auto; scrollbar-width: none;
    background: var(--color-bg); border-bottom: 1px solid var(--color-line);
  }
  .set-nav::-webkit-scrollbar { display: none; }
  .set-nav a { height: 44px; padding: 0 12px; flex-shrink: 0; white-space: nowrap; }
  .set-body { max-width: none; padding: 20px 16px 48px; border-left: 0; }
  .set-section { scroll-margin-top: 64px; }
  .set-row { flex-wrap: wrap; gap: 6px 16px; }
  .set-value { flex-shrink: 1; min-width: 0; flex-wrap: wrap; }

  /* ---------- Onboarding ---------- */
  .onb-bar { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "brand skip" "steps steps"; height: auto; padding: 4px 6px 8px 16px; row-gap: 2px; }
  .onb-brand { grid-area: brand; height: 44px; }
  .onb-skip { grid-area: skip; display: inline-flex; align-items: center; height: 44px; padding: 0 10px; }
  .onb-steps { grid-area: steps; gap: 8px; margin-right: 10px; }
  .onb-step a { height: 44px; }
  .onb-step:not(.is-now) a { font-size: 0; gap: 0; } /* only the current step is named; the others keep their number */
  .onb-step:not(.is-now) a .onb-num { width: 28px; height: 28px; border-radius: 14px; }
  .onb-line { flex: 1; width: auto; min-width: 12px; }
  .onb-centre { padding: 20px 16px 40px; }
  .onb-title { font-size: 24px; line-height: 30px; }
  .onb-lede { font-size: 14px; line-height: 21px; }
  .onb-mode .seg { width: 100%; }
  .onb-mode .seg button { flex: 1 1 0; }
  .onb-paste-hint { margin-left: 0; width: 100%; }
  .onb-status-row { padding: 0 12px; flex-wrap: wrap; }
  .onb-foot { flex-wrap: wrap; }
  .onb-foot-note { flex: 1 1 auto; }
  .onb-foot-note .btn-ghost { margin-left: -14px; }
  .onb-foot-actions { flex: 1 1 auto; }
  .onb-foot-actions .btn { flex: 1 1 0; }
  .onb-table { margin-top: 24px; }
  .onb-th { display: none; }
  .onb-tr { grid-template-columns: minmax(0, 1fr) auto; row-gap: 4px; padding: 10px 12px; border-top: 0; }
  .onb-tr + .onb-tr { border-top: 1px solid var(--color-line); }
  .onb-tr > :nth-child(1) { grid-column: 1; grid-row: 1; }
  .onb-tr > :nth-child(2) { grid-column: 1; grid-row: 2; font-size: var(--text-12); white-space: normal; }
  .onb-tr > :nth-child(3) { grid-column: 2; grid-row: 1; justify-self: end; }
  .onb-tr > :nth-child(4) { grid-column: 2; grid-row: 2; }
  .onb-shots { gap: 14px; }
  .onb-counts .dot { font-size: var(--text-12); }

  /* ---------- Live preview (r-signal-mlive) ---------- */
  .live-main { height: 100%; }
  .live-bar {
    grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "crumbs actions" "tabs tabs";
    height: auto; padding: 4px 4px 8px 6px; row-gap: 4px; column-gap: 4px; border-bottom: 0;
  }
  .live-crumbs { grid-area: crumbs; gap: 6px; }
  .live-crumbs .sep, .live-crumbs .crumb-project, .live-crumbs .chip, .live-brand .wordmark { display: none; }
  .live-brand { width: 44px; height: 44px; justify-content: center; }
  .crumb-run { display: flex; align-items: center; height: 44px; color: var(--color-t-1); font-size: var(--text-14); line-height: var(--leading-14); font-weight: 600; letter-spacing: -0.01em; }
  span.crumb-run { display: block; height: auto; }
  a.crumb-run { display: block; line-height: 44px; }
  .live-actions { grid-area: actions; gap: 4px; }
  .live-actions .built { display: none; }
  .live-actions [data-live-copy] { width: 44px; padding: 0; gap: 0; font-size: 0; border-color: transparent; background: none; }
  .live-actions [data-live-copy] svg { width: 18px; height: 18px; color: var(--color-t-1); }
  .live-tabs {
    grid-area: tabs; justify-self: stretch; display: flex; gap: 2px; margin: 0 12px 0 10px; padding: 2px;
    background: var(--color-panel); border: 1px solid var(--color-line); border-radius: var(--radius-segment);
  }
  .live-tabs .tab { flex: 1 1 0; justify-content: center; border-radius: 5px; }
  .live-tabs .tab[aria-current="page"] { background: var(--color-line-2); }
  .live-body { flex-direction: column; }
  .live-stage { flex: 1; min-height: 0; padding: 0 16px; background: var(--color-bg); }
  .device-wrap { width: var(--sw); height: var(--sh); }
  .device-wrap .ghost, .device-wrap .statusbar { display: none; }
  .device { padding: 0; border-radius: 22px; background: var(--color-panel); box-shadow: 0 0 0 1px var(--color-line-2); overflow: hidden; }
  .screen { border-radius: 22px; }
  .stage-caption { margin-top: 10px; height: 24px; max-width: 100%; align-items: center; white-space: nowrap; overflow: hidden; }
  .stage-caption .route { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  .stage-caption > span { flex-shrink: 0; }
  .stage-caption > .route { flex-shrink: 1; }
  .stage-status { bottom: 44px; max-width: calc(100% - 32px); }
  .replay { flex-wrap: wrap; }
  .replay.is-error .btn { height: 44px; }

  .live-phone { display: block; flex-shrink: 0; padding-bottom: env(safe-area-inset-bottom); }
  .m-steps { display: flex; align-items: center; height: 52px; padding: 0 4px; border-bottom: 1px solid var(--color-line); }
  .m-step { flex: 1; min-width: 0; display: flex; align-items: center; justify-content: center; gap: 8px; white-space: nowrap; overflow: hidden; }
  .m-step-num { color: var(--color-acc); font-size: var(--text-12); }
  .m-step-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; font-size: var(--text-14); font-weight: 500; }
  .m-step-of { flex-shrink: 0; font-size: var(--text-12); color: var(--color-t-3); }
  .m-step .standin-dot { margin-right: 0; }
  .m-fidelity {
    display: flex; align-items: center; gap: 10px; width: 100%; height: 48px; padding: 0 12px 0 16px; border: 0; border-bottom: 1px solid var(--color-line);
    background: none; text-align: left; color: var(--color-t-1);
  }
  .m-fid-title { font-weight: 500; }
  .m-fid-sum { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--color-t-2); font-size: var(--text-12); }
  .m-fidelity > svg:last-child { color: var(--color-t-3); }
  .m-fidelity:focus-visible { outline-offset: -2px; border-radius: 0; }
  .m-live-bar { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; padding: 12px 16px; }
  .m-live-bar .btn { width: 100%; height: 48px; gap: 8px; }
  .m-live-bar .btn svg { color: var(--color-t-2); }
  .m-device { position: relative; min-width: 0; }
  .m-device > span { overflow: hidden; text-overflow: ellipsis; }
  .m-device select { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; font-size: 16px; } /* 16px: no zoom on focus in iOS Safari */
  .m-device:focus-within { outline: 2px solid var(--color-acc); outline-offset: 2px; }

  /* The inspector becomes a sheet that the fidelity row opens. */
  .live-inspector {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 46; width: auto; max-height: 82dvh; overflow-y: auto;
    padding-bottom: env(safe-area-inset-bottom); border-left: 0; border-top: 1px solid var(--color-line-2); border-radius: 14px 14px 0 0;
    background: var(--color-bg); box-shadow: 0 -20px 40px -20px rgba(0, 0, 0, 0.5);
    transform: translateY(100%); visibility: hidden; transition: transform 0.2s ease, visibility 0s linear 0.2s;
  }
  .live-inspector.is-open { transform: none; visibility: visible; transition: transform 0.2s ease; }
  .live-sheet-backdrop:not([hidden]) { display: block; position: fixed; inset: 0; z-index: 45; background: var(--color-backdrop); }
  .live-inspector .insp-section { padding: 12px 16px 16px; }
  .live-inspector .insp-head { gap: 10px; margin: -4px -10px 6px 0; }
  .live-inspector .insp-head h2 { color: var(--color-t-1); font-size: var(--text-14); font-weight: 600; }
  .live-inspector .insp-head .pill { margin-left: auto; }
  .live-sheet-close { display: grid; }
  .live-inspector .control-device, .live-inspector .control-appearance { display: none; }
  .live-inspector .controls .control-appearance + .control { margin-top: 0; }
  .fidelity li { padding: 8px 0; }
  .switch { position: relative; width: 52px; height: 44px; padding: 0 0 0 13px; background: none; border-radius: var(--radius-control); }
  .switch::before { content: ""; position: absolute; left: 11px; top: 13px; width: 30px; height: 18px; border-radius: 9px; background: var(--color-line-2); }
  .switch[aria-checked="true"] { background: none; }
  .switch[aria-checked="true"]::before { background: var(--color-acc-bg); }
  .switch::after { position: relative; }
}
/* Between the phone and 900px (sidebar collapsed to icons) the runs table drops Branch and Commit so titles keep room. */
@media (min-width: 701px) and (max-width: 900px) {
  .runs-grid { grid-template-columns: 30px 44px minmax(0, 1fr) 130px 40px 64px 56px; }
  .runs-head > :nth-child(2), .runs-head > :nth-child(6), .row-link .branch, .row-link .col-commit { display: none; }
}
@media (max-width: 700px) and (prefers-reduced-motion: reduce) {
  .live-inspector, .live-inspector.is-open { transition: none; }
}
