/* Theque — design tokens and base styles.
 * Generated from branding/BRAND.md §2–4. Values here must match that document;
 * it is the authority.
 *
 * No framework, no build step. BRAND.md §4 (DESIGN.md §4): reading surfaces ship
 * minimal CSS and zero JS, and must work with JavaScript disabled.
 */

:root,
[data-theme="dark"] {
  color-scheme: dark;
  /* Neutrals — BRAND.md §2.5 */
  --bg: #0D0F12;
  --bg-subtle: #15181D;
  --bg-inset: #1D2126;
  --border: #2A2F36;
  --border-strong: #3A4149;
  --fg-subtle: #8B95A1;
  --fg-muted: #A9B3BE;
  --fg: #F2F4F6;

  /* Semantic — BRAND.md §2.3. Hue names are deliberately absent: one role,
     one meaning, and compatibility aliases all resolve back to these roles. */
  --ready: #3FC97A;
  --blocked: #FF6B70;
  --needs-interaction: #A98BFF;
  --ai-interaction: #79C7FF;
  --in-progress: #E8B54D;
  --accent: #B8C5D6;
  --attention: var(--needs-interaction);
  --success: var(--ready);
  --warn: var(--in-progress);
  --danger: var(--blocked);
  --open: var(--ready);
  --merged: var(--ready);
  --closed: #6E7883;
  --agent: var(--ai-interaction);

  /* Aperture presentation tokens. Saturated color remains semantic; these
     surfaces and contours stay neutral enough to sit behind product state. */
  --aperture-surface: rgb(21 24 29 / 0.88);
  --aperture-surface-raised: rgb(29 33 38 / 0.90);
  --aperture-line: rgb(184 197 214 / 0.16);
  --aperture-glow: rgb(121 199 255 / 0.08);

  /* Syntax — semantic token classes from the server-side grammar engine. */
  --syntax-keyword: #C792EA;
  --syntax-string: #C3E88D;
  --syntax-comment: #8795A3;
  --syntax-number: #F78C6C;
  --syntax-type: #82AAFF;
  --syntax-function: #82D2CE;
  --syntax-attribute: #FFCB6B;
  --syntax-constant: #F07178;
  --syntax-operator: #89DDFF;
  --syntax-punctuation: #A9B3BE;

  /* Diff — never pure red/green */
  --diff-add-bg: #0F2E1B;
  --diff-del-bg: #331416;

  /* Type — BRAND.md §3.1, 14px base */
  --text-xs: 12px; --lh-xs: 16px;
  --text-sm: 13px; --lh-sm: 20px;
  --text-base: 14px; --lh-base: 22px;
  --text-md: 16px; --lh-md: 24px;
  --text-lg: 20px; --lh-lg: 28px;
  --text-xl: 24px; --lh-xl: 32px;

  /* Space — 4px grid, BRAND.md §4 */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s6: 24px; --s8: 32px; --s12: 48px;

  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 10px;

  --shadow-sm: 0 1px 2px rgb(0 0 0 / 0.06);
  --shadow-md: 0 4px 12px rgb(0 0 0 / 0.10);
  --shadow-lg: 0 12px 32px rgb(0 0 0 / 0.16);

  --font-ui: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-code: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

/* Light is an explicit account preference. Dark is the anonymous and account
 * default, independent of device settings, so a phone and desktop do not render
 * the same account differently (issue #99). */
[data-theme="light"] {
  color-scheme: light;
  --bg: #FFFFFF;
  --bg-subtle: #F7F8F9;
  --bg-inset: #EEF0F2;
  --border: #D8DCE0;
  --border-strong: #B9C0C7;
  --fg-subtle: #6B7783;
  --fg-muted: #48525C;
  --fg: #14171A;
  --ready: #136F3B;
  --blocked: #B0242A;
  --needs-interaction: #6B3FCC;
  --ai-interaction: #166C91;
  --in-progress: #8A5B00;
  --accent: #34526F;
  --attention: var(--needs-interaction);
  --success: var(--ready);
  --warn: var(--in-progress);
  --danger: var(--blocked);
  --open: var(--ready);
  --merged: var(--ready);
  --closed: #8A939C;
  --agent: var(--ai-interaction);
  --syntax-keyword: #7C3AED;
  --syntax-string: #286E2C;
  --syntax-comment: #526173;
  --syntax-number: #92400E;
  --syntax-type: #1D4ED8;
  --syntax-function: #0369A1;
  --syntax-attribute: #7A4D00;
  --syntax-constant: #B91C1C;
  --syntax-operator: #0E7490;
  --syntax-punctuation: #48525C;
  --aperture-surface: rgb(247 248 249 / 0.91);
  --aperture-surface-raised: rgb(255 255 255 / 0.94);
  --aperture-line: rgb(52 82 111 / 0.15);
  --aperture-glow: rgb(22 108 145 / 0.07);
  --diff-add-bg: #E6F4EA;
  --diff-del-bg: #FCE9E9;
}

*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0;
  font-family: var(--font-ui);
  font-size: var(--text-base);
  line-height: var(--lh-base);
  color: var(--fg);
  background-color: var(--bg);
  background-image:
    linear-gradient(180deg, color-mix(in srgb, var(--bg-subtle) 44%, transparent), transparent 24rem),
    linear-gradient(90deg, transparent, color-mix(in srgb, var(--aperture-line) 34%, transparent), transparent);
  isolation: isolate;
}
body.landing::before {
  content: "";
  position: fixed;
  z-index: -2;
  inset: -24vh auto auto 50%;
  width: min(72rem, 100vw);
  height: min(92rem, 150vh);
  translate: -50% 0;
  background: url("/assets/aperture-brand-db73fc9695acf96cbd8f3bed86f22f3a.webp?vsn=d") center top / contain no-repeat;
  opacity: 0.075;
  pointer-events: none;
  animation: aperture-atmosphere 28s ease-in-out infinite alternate;
}
body.landing::after {
  content: "";
  position: fixed;
  z-index: -1;
  inset: -18rem auto auto 50%;
  width: min(80rem, 100vw);
  height: 58rem;
  translate: -50% 0;
  border-radius: 0 0 50% 50%;
  background:
    radial-gradient(ellipse at 50% 4%, transparent 0 31%, var(--aperture-line) 31.12% 31.28%, transparent 31.4% 38%, var(--aperture-line) 38.12% 38.28%, transparent 38.4% 45%, var(--aperture-line) 45.12% 45.28%, transparent 45.4%),
    radial-gradient(ellipse at 50% 12%, var(--aperture-glow), transparent 61%);
  pointer-events: none;
}
body:not(.landing)::before {
  content: "";
  position: fixed;
  z-index: -1;
  top: 4rem;
  right: 0;
  width: min(22rem, 40vw);
  height: min(22rem, 40vw);
  background: url("/assets/aperture-accent-ink-174ae76cce014a45d7513a5683d1dc1c.webp?vsn=d") right top / contain no-repeat;
  opacity: 0.026;
  pointer-events: none;
}
@keyframes aperture-atmosphere {
  from { transform: translate3d(-1.25%, -0.8%, 0) rotate(-0.35deg); }
  to { transform: translate3d(1.25%, 0.8%, 0) rotate(0.35deg); }
}
@media (max-width: 760px) {
  body.landing::before { inset: -10vh auto auto 50%; width: 100vw; height: 115vh; opacity: 0.055; }
  body.landing::after { inset: -12rem auto auto 50%; width: 100vw; opacity: 0.72; }
  body:not(.landing)::before { top: 3.5rem; width: min(12rem, 49vw); height: min(12rem, 49vw); opacity: 0.018; }
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* A destination-looking shared action whose operation remains CSRF-protected POST. */
.notification-link-button.btn {
  border: 0;
  padding: 0;
  min-height: 0;
  background: transparent;
  color: var(--accent);
  text-align: left;
}
.notification-link-button.btn:hover, .notification-link-button.btn:focus-visible { text-decoration: underline; }

.markdown-editor { border: 1px solid var(--border); border-radius: var(--radius-md); overflow: hidden; background: var(--bg); }
.markdown-editor.has-reference-picker { overflow: visible; }
.markdown-editor > .field-label { display: block; padding: var(--s2) var(--s3) 0; }
.markdown-editor-tabs { display: flex; gap: var(--s1); padding: var(--s2) var(--s3) 0; border-bottom: 1px solid var(--border); }
.markdown-editor-tab { min-height: 32px; padding: 0 var(--s3); border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--fg-subtle); font: inherit; font-size: var(--text-sm); cursor: pointer; }
.markdown-editor-tab.is-active { border-bottom-color: var(--accent); color: var(--fg); font-weight: 600; }
.markdown-editor-input { border: 0; border-radius: 0; min-height: 132px; }
.markdown-editor-input:focus { box-shadow: inset 0 0 0 1px var(--accent); }
.markdown-editor-write { position: relative; }
.markdown-reference-picker {
  position: absolute; top: calc(100% - 2px); right: var(--s3); left: var(--s3); z-index: 20;
}
.markdown-reference-picker[hidden] { display: none; }
.markdown-reference-results {
  max-height: min(320px, 46vh); margin: 0; padding: var(--s1); overflow-y: auto;
  border: 1px solid var(--border-strong); border-radius: var(--radius-md);
  background: var(--bg); box-shadow: var(--shadow-lg); list-style: none;
}
.markdown-reference-option {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: var(--s3);
  align-items: center; width: 100%; min-height: 48px; padding: var(--s2) var(--s3);
  border: 0; border-radius: var(--radius-sm); color: var(--fg); background: transparent;
  font: inherit; text-align: left; cursor: pointer;
}
.markdown-reference-option:hover,
.markdown-reference-option[aria-selected="true"] { background: var(--bg-inset); }
.markdown-reference-number { color: var(--accent); font-family: var(--font-code); font-size: var(--text-sm); }
.markdown-reference-copy { min-width: 0; }
.markdown-reference-copy strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.markdown-reference-copy small,
.markdown-reference-state { color: var(--fg-subtle); font-size: var(--text-xs); }
.markdown-reference-empty { padding: var(--s3); color: var(--fg-subtle); font-size: var(--text-sm); }
.markdown-editor-preview { min-height: 132px; padding: var(--s3); background: var(--bg-subtle); }
.markdown-editor-preview > :first-child { margin-top: 0; }
.markdown-editor-preview > :last-child { margin-bottom: 0; }
.markdown-editor > .field-help { padding: 0 var(--s3) var(--s2); }
.markdown-editor-upload-help { margin: 0; padding: var(--s2) var(--s3) 0; color: var(--fg-subtle); font-size: var(--text-sm); }
.markdown-editor-upload-status { min-height: 1.25rem; margin: 0; padding: 0 var(--s3) var(--s2); color: var(--fg-subtle); font-size: var(--text-sm); }
.draft-recovery { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); font-size: var(--text-sm); padding: var(--s2) var(--s3); color: var(--fg-muted); }
.draft-recovery:empty, .draft-recovery:not(:has(span:not(:empty))) { display: none; }
.draft-saved-version { width: 100%; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 12rem; overflow: auto; }
.markdown-editor.is-dragging { border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 20%, transparent); }
.markdown-editor.is-uploading .markdown-editor-input { cursor: progress; }

.meta-rail { overflow: hidden; }
.meta-row { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: var(--s3); align-items: start; padding: var(--s3) var(--s4); }
.meta-row + .meta-row { border-top: 1px solid var(--border); }
.meta-row-key { color: var(--fg-subtle); font-size: var(--text-sm); }
.meta-row-value { min-width: 0; display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center; }
.meta-row-value > form { width: 100%; }
.meta-rail-actions { display: grid; gap: var(--s2); padding: var(--s3) var(--s4); border-top: 1px solid var(--border); }
.meta-rail-actions .btn { width: 100%; }

.dashboard-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: var(--s4) 0 var(--s6); border: 1px solid var(--border); border-radius: var(--radius-md); overflow: hidden; }
.dashboard-summary > * { display: flex; flex-direction: column; gap: var(--s1); padding: var(--s3) var(--s4); color: var(--fg); background: var(--bg-subtle); }
.dashboard-summary > * + * { border-left: 1px solid var(--border); }
.dashboard-summary > a { text-decoration: none; }
.dashboard-summary > a:hover { background: var(--bg-inset); }
.dashboard-summary span { color: var(--fg-subtle); font-size: var(--text-xs); }
.dashboard-summary strong { font-size: var(--text-lg); font-variant-numeric: tabular-nums; }
.dashboard-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s6); margin-bottom: var(--s8); }
.dashboard-grid h2 { font-size: var(--text-md); }
.dashboard-activity { margin: 0; }
.onboarding-callout { max-width: 680px; margin-bottom: var(--s6); padding: var(--s4); border-left: 3px solid var(--accent); background: color-mix(in srgb, var(--accent) 7%, var(--bg)); }
.onboarding-callout p { margin-bottom: 0; color: var(--fg-muted); }
.repository-entry-flow { max-width: 1120px; margin: 0 auto; }
.repository-entry-breadcrumb { display: flex; gap: var(--s3); margin-bottom: var(--s4); color: var(--fg-subtle); font-size: var(--text-sm); }
.repository-entry-breadcrumb a { color: inherit; }
.repository-entry-intro { display: flex; justify-content: space-between; gap: var(--s6); align-items: end; margin-bottom: var(--s6); }
.repository-entry-intro h1 { margin: var(--s1) 0 var(--s2); font-size: clamp(2rem, 4vw, 2.75rem); }
.repository-entry-intro p:last-child { margin: 0; color: var(--fg-muted); font-size: var(--text-md); }
.eyebrow { margin: 0; color: var(--accent); font-size: var(--text-xs); font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; }
.step-badge { flex: 0 0 auto; padding: var(--s1) var(--s2); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--fg-muted); background: var(--bg-subtle); font-size: var(--text-xs); }
.repository-path-form fieldset { margin: 0; padding: 0; border: 0; }
.choice-card-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s3); }
.choice-card { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--s3); min-height: 280px; padding: var(--s4); border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--bg-subtle); cursor: pointer; }
.choice-card:hover { border-color: var(--fg-muted); background: var(--bg-inset); }
.choice-card:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.choice-card:has(input:checked) { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 13%, var(--bg-subtle)); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 35%, transparent); }
.choice-card input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.choice-card-icon { display: grid; grid-row: 1; width: 40px; height: 40px; place-items: center; border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--accent); background: var(--bg); font-size: 1.5rem; line-height: 1; }
.choice-card-copy { display: flex; grid-column: 1 / 3; flex-direction: column; gap: var(--s2); }
.choice-card-copy strong { font-size: var(--text-lg); }
.choice-card-copy > span, .choice-card-copy small { color: var(--fg-muted); line-height: 1.45; }
.choice-card-facts { display: grid; gap: var(--s2); margin: auto 0 0; padding: 0; list-style: none; color: var(--fg-muted); font-size: var(--text-sm); }
.choice-card-facts li::before { content: "✓"; margin-right: var(--s2); color: var(--success); }
.choice-card-marker { grid-column: 2; grid-row: 1; width: 19px; height: 19px; border: 1px solid var(--border-strong); border-radius: 50%; box-shadow: inset 0 0 0 4px var(--bg-subtle); }
.choice-card:has(input:checked) .choice-card-marker { background: var(--accent); border-color: var(--accent); box-shadow: inset 0 0 0 4px color-mix(in srgb, var(--accent) 13%, var(--bg-subtle)); }
.repository-path-next { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--s4); align-items: center; margin-top: var(--s3); padding: var(--s4); border: 1px solid color-mix(in srgb, var(--accent) 50%, var(--border)); border-radius: var(--radius-md); background: color-mix(in srgb, var(--accent) 12%, var(--bg-subtle)); }
.repository-path-next-copy { display: none; gap: var(--s1); }
.repository-path-next-copy strong { font-size: var(--text-md); }
.repository-path-next-copy small { color: var(--fg-muted); }
.repository-path-form:has(input[value="import"]:checked) .repository-path-next-import,
.repository-path-form:has(input[value="programmer"]:checked) .repository-path-next-programmer,
.repository-path-form:has(input[value="empty"]:checked) .repository-path-next-empty { display: grid; }
.repository-metering-note { display: flex; gap: var(--s3); align-items: start; margin: var(--s3) 0 0; color: var(--fg-subtle); font-size: var(--text-sm); }
.repository-metering-note > span { display: grid; flex: 0 0 auto; width: 28px; height: 28px; place-items: center; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-subtle); }
.flow-actions { display: flex; justify-content: flex-end; margin-top: var(--s4); }
.repository-details-form { max-width: 560px; }
.onboarding-flow { max-width: 1240px; margin: 0 auto; }
.onboarding-intro { margin: var(--s3) 0 var(--s6); }
.onboarding-intro h1 { margin: var(--s2) 0; font-size: clamp(2rem, 4vw, 2.75rem); }
.onboarding-intro > p:last-child { max-width: 760px; margin: 0; color: var(--fg-muted); font-size: var(--text-md); }
.onboarding-studio { display: grid; grid-template-columns: 220px minmax(0, 1fr) 300px; gap: var(--s6); align-items: start; }
.onboarding-progress { position: sticky; top: var(--s4); padding-top: var(--s3); }
.onboarding-progress ol { display: grid; margin: 0; padding: 0; list-style: none; }
.onboarding-progress li { position: relative; display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: var(--s3); min-height: 68px; color: var(--fg-subtle); }
.onboarding-progress li:not(:last-child)::after { position: absolute; top: 28px; bottom: 0; left: 13px; width: 1px; background: var(--border); content: ""; }
.onboarding-step-marker { z-index: 1; display: grid; width: 28px; height: 28px; place-items: center; border: 1px solid var(--border); border-radius: 50%; background: var(--bg); font-size: var(--text-xs); }
.onboarding-step-copy { display: grid; align-content: start; gap: var(--s1); padding-top: 3px; }
.onboarding-step-copy strong { color: inherit; font-size: var(--text-sm); }
.onboarding-step-copy small { color: var(--fg-subtle); line-height: 1.25; }
.onboarding-current-step { display: none; }
.onboarding-progress li.current { color: var(--fg); }
.onboarding-progress li.current .onboarding-step-marker { border-color: var(--accent); color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, var(--bg)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 10%, transparent); }
.onboarding-progress li.complete { color: var(--fg-muted); }
.onboarding-progress li.complete .onboarding-step-marker { border-color: var(--success); color: var(--success); }
.onboarding-task { min-width: 0; }
.onboarding-surface { overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--bg-subtle); }
.onboarding-surface-header { display: flex; justify-content: space-between; gap: var(--s4); align-items: start; padding: var(--s6); border-bottom: 1px solid var(--border); }
.onboarding-surface-header h2 { margin: 0 0 var(--s1); font-size: var(--text-xl); }
.onboarding-surface-header p { margin: 0; color: var(--fg-muted); }
.onboarding-connect-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: var(--s3); align-items: center; margin: var(--s4); padding: var(--s3); border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-inset); }
.onboarding-connect-row > span:nth-child(2) { display: grid; gap: var(--s1); }
.onboarding-connect-row small { color: var(--fg-muted); }
.source-mark { display: grid; width: 36px; height: 36px; place-items: center; border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--fg-muted); font-size: var(--text-xs); }
.onboarding-plan { position: sticky; top: var(--s4); overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--bg-subtle); }
.onboarding-plan-header { display: grid; gap: var(--s1); padding: var(--s4); border-bottom: 1px solid var(--border); }
.onboarding-plan-header span { color: var(--fg-subtle); font-size: var(--text-xs); }
.onboarding-plan-list { display: grid; margin: 0; padding: 0; list-style: none; }
.onboarding-plan-list li { display: grid; grid-template-columns: 20px minmax(0, 1fr); gap: var(--s3); padding: var(--s3) var(--s4); border-bottom: 1px solid var(--border); }
.onboarding-plan-list li > span:last-child { display: grid; gap: var(--s1); }
.onboarding-plan-list small { color: var(--fg-subtle); }
.onboarding-plan-list [data-plan-state="complete"] > span:first-child { color: var(--success); }
.onboarding-plan-list [data-plan-state="current"] > span:first-child { color: var(--warn); }
.onboarding-plan-note { margin: 0; padding: var(--s3) var(--s4); color: var(--fg-muted); background: color-mix(in srgb, var(--success) 8%, var(--bg-subtle)); font-size: var(--text-sm); }
.onboarding-repository-list { display: grid; gap: 0; margin: 0; padding: 0; border: 0; border-top: 1px solid var(--border); }
.onboarding-repository-list legend { width: 100%; padding: var(--s3) var(--s4); border-bottom: 1px solid var(--border); font-weight: 650; }
.onboarding-repository-choice { padding: var(--s3) var(--s4); border-bottom: 1px solid var(--border); cursor: pointer; }
.onboarding-repository-choice label { display: grid; grid-template-columns: auto 1fr; gap: var(--s3); align-items: start; cursor: pointer; }
.onboarding-repository-choice .field-help { margin: var(--s1) 0 0 calc(1rem + var(--s3)); }
.onboarding-repository-choice:has(input:checked) { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 6%, var(--bg)); }
.onboarding-repository-choice:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.onboarding-action-bar { display: flex; justify-content: space-between; gap: var(--s3); align-items: center; padding: var(--s4); border-top: 1px solid var(--border); background: var(--bg-inset); }
.onboarding-empty-note { margin: 0; padding: var(--s6); text-align: center; }
.flow-actions-split { justify-content: space-between; gap: var(--s3); }
.tour-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s3); margin-top: var(--s5); }
.tour-grid article { display: grid; grid-template-columns: auto 1fr; gap: var(--s2) var(--s3); padding: var(--s4); border: 1px solid var(--border); border-radius: var(--radius-md); }
.tour-grid article > span { grid-row: 1 / 3; color: var(--accent); }
.tour-grid article p { margin: 0; color: var(--fg-muted); }
@media (max-width: 720px) {
  .choice-card-grid { grid-template-columns: 1fr; }
  .choice-card { min-height: 0; }
  .choice-card-facts { margin-top: var(--s3); }
  .flow-actions .btn { width: 100%; }
  .repository-entry-breadcrumb { margin-top: var(--s2); }
  .repository-entry-intro { display: grid; align-items: start; }
  .repository-entry-intro .step-badge { order: 2; }
  .repository-path-next { position: sticky; z-index: 2; bottom: var(--s2); grid-template-columns: 1fr; padding: var(--s3); }
  .repository-path-next .btn { width: 100%; }
  .repository-metering-note { margin-bottom: var(--s6); }
  .onboarding-studio { grid-template-columns: 1fr; gap: var(--s4); }
  .onboarding-intro { margin-bottom: var(--s4); }
  .onboarding-progress, .onboarding-plan { position: static; }
  .onboarding-progress { overflow-x: auto; padding: var(--s3); border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--bg-subtle); }
  .onboarding-progress ol { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: var(--s2); }
  .onboarding-progress li { display: grid; min-height: 0; grid-template-columns: 1fr; gap: 0; }
  .onboarding-progress li::after { display: none; }
  .onboarding-step-marker { margin: 0 auto; }
  .onboarding-step-copy { display: none; }
  .onboarding-current-step { display: grid; gap: var(--s1); margin: var(--s3) 0 0; text-align: center; }
  .onboarding-current-step span { color: var(--fg-muted); font-size: var(--text-sm); }
  .onboarding-plan { order: 3; }
  .onboarding-connect-row { grid-template-columns: auto minmax(0, 1fr); }
  .onboarding-connect-row .btn { grid-column: 1 / 3; width: 100%; }
  .onboarding-action-bar { position: sticky; z-index: 2; bottom: 0; flex-direction: column-reverse; }
  .onboarding-action-bar .btn, .onboarding-action-bar form { width: 100%; }
  .tour-grid { grid-template-columns: 1fr; }
  .flow-actions-split { flex-direction: column-reverse; }
}
.signup-flow { max-width: 560px; }
.signup-form { max-width: 420px; }
.signup-step { margin: 0 0 var(--s2); color: var(--fg-subtle); }
.signup-title { margin-top: 0; }
.signup-help { color: var(--fg-subtle); font-size: var(--text-sm); }
.signup-payment-card { margin-top: var(--s6); padding: var(--s4); }
.signup-alert { margin-top: 0; }
.signup-login { margin-top: var(--s4); }
.signup-signout { margin-top: var(--s6); }
@media (max-width: 760px) {
  .dashboard-summary { grid-template-columns: 1fr 1fr; }
  .dashboard-summary > *:nth-child(3) { border-left: 0; border-top: 1px solid var(--border); }
  .dashboard-summary > *:nth-child(4) { border-top: 1px solid var(--border); }
  .dashboard-grid { grid-template-columns: minmax(0, 1fr); }
}

/* Focus ring — BRAND.md §13, always visible, 2px + 2px offset */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

code, pre { font-family: var(--font-code); font-size: var(--text-sm); }
.tabnum { font-variant-numeric: tabular-nums; }

/* Layout — BRAND.md §5. Every page uses the same shell width; individual
 * reading and form surfaces keep their own narrower measures below. */
.wrap { max-width: 1800px; margin: 0 auto; padding: 0 var(--s6); }
.wrap-wide { max-width: none; padding: 0 var(--s6); }
.prose { max-width: 72ch; }
.prose img { max-width: 100%; }
.prose pre { background: var(--bg-subtle); padding: var(--s3); border-radius: var(--radius-md); overflow-x: auto; }
.prose table { border-collapse: collapse; }
.prose th, .prose td { border: 1px solid var(--border); padding: var(--s1) var(--s2); }

/* A resolved @mention (issue #162). It has to be distinguishable from the
   surrounding prose *and* from an ordinary link, and BRAND.md §6.3 forbids
   carrying that on colour alone — so it gets weight and a tinted chip as well as
   the link accent. Only names that resolved to a visible account are rendered as
   anchors at all; an unknown @name stays plain text, which is the difference a
   reader needs most. */
a.mention {
  font-weight: 500;
  padding: 0 3px;
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
}
a.mention:hover, a.mention:focus-visible { text-decoration: underline; }

/* Public docs: a fixed reading rail on desktop and an ordinary compact index on
 * small screens. No client-side navigation or search is required. */
.docs-shell { display: grid; grid-template-columns: 180px minmax(0, 72ch); gap: var(--s12); align-items: start; }
.docs-nav { position: sticky; top: var(--s6); display: grid; gap: var(--s2); font-size: var(--text-sm); }
.docs-nav strong { margin-bottom: var(--s1); color: var(--fg); }
.docs-nav a { color: var(--fg-muted); }
.docs { min-width: 0; padding-bottom: var(--s12); }
.docs-lede { border-bottom: 1px solid var(--border); padding-bottom: var(--s6); margin-bottom: var(--s8); }
.docs-lede h1 { margin: 0 0 var(--s3); font-size: var(--text-xl); }
.docs-lede > p:last-child { color: var(--fg-muted); font-size: var(--text-md); }
.docs .eyebrow { margin: 0 0 var(--s2); color: var(--accent); font-size: var(--text-xs); font-weight: 600; letter-spacing: .12em; text-transform: uppercase; }
.docs section { scroll-margin-top: var(--s6); margin-bottom: var(--s12); }
.docs section h2 { margin: 0 0 var(--s3); }
.docs-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s3); margin: var(--s4) 0 var(--s6); }
.docs-card { padding: var(--s4); }
.docs-card h3 { margin: 0 0 var(--s2); }
.docs-card p:last-child { margin-bottom: 0; }

@media (max-width: 720px) {
  .docs-shell { grid-template-columns: minmax(0, 1fr); gap: var(--s6); }
  .docs-nav { position: static; grid-template-columns: repeat(2, minmax(0, 1fr)); padding-bottom: var(--s4); border-bottom: 1px solid var(--border); }
  .docs-nav strong { grid-column: 1 / -1; }
  .docs-grid { grid-template-columns: minmax(0, 1fr); }
}

header.site {
  position: relative;
  z-index: 30;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  min-height: 48px;
  padding: var(--s2) 0;
  margin-bottom: var(--s6);
}
header.site .wrap { display: flex; align-items: center; gap: var(--s4); }
.brand { display: flex; align-items: center; gap: var(--s2); font-weight: 600; color: var(--fg); }
.brand svg { width: 22px; height: 22px; }
.spacer { flex: 1; }

/* Account identity is one edge-aligned disclosure rather than a loose link
 * between global actions. Native <details> preserves the zero-JavaScript
 * reading-surface contract. */
.account-menu { position: relative; margin-left: 0; }
.account-menu > summary { list-style: none; cursor: pointer; }
.account-menu > summary::-webkit-details-marker { display: none; }
.account-trigger {
  min-width: 142px;
  height: 36px;
  display: flex;
  align-items: center;
  gap: var(--s2);
  padding: 3px var(--s2) 3px 4px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--fg);
}
.account-trigger:hover { background: var(--bg-inset); }
.account-avatar {
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  background: color-mix(in srgb, var(--accent) 28%, var(--bg-inset));
  color: var(--fg);
  font-size: 10px;
  font-weight: 700;
}
.account-copy { min-width: 0; flex: 1; line-height: 14px; }
.account-copy strong,
.account-copy span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-copy strong { font-size: var(--text-xs); }
.account-copy span { color: var(--fg-subtle); font-size: 10px; }
.account-chevron { color: var(--fg-subtle); font-size: 10px; }
.account-popover {
  position: absolute;
  z-index: 20;
  top: calc(100% + var(--s2));
  right: 0;
  width: 224px;
  padding: var(--s2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--bg-subtle);
  box-shadow: var(--shadow-md);
}
.account-identity { padding: var(--s2); margin-bottom: var(--s1); border-bottom: 1px solid var(--border); }
.account-identity strong,
.account-identity span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-identity span { color: var(--fg-subtle); font-size: var(--text-xs); }
.account-popover > a,
.account-popover form button {
  width: 100%;
  min-height: 32px;
  display: flex;
  align-items: center;
  padding: var(--s1) var(--s2);
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--fg-muted);
  font: inherit;
  font-size: var(--text-sm);
  text-align: left;
  cursor: pointer;
}
.account-popover > a:hover,
.account-popover form button:hover { background: var(--bg-inset); color: var(--fg); text-decoration: none; }
.account-popover form { margin: var(--s1) 0 0; padding-top: var(--s1); border-top: 1px solid var(--border); }
.account-popover form button { color: var(--danger); }

/* Repository chrome: identity and global repository action live in a quiet
 * banner; stable section navigation lives beside the page content. */
.repo-shell { min-width: 0; }
.repo-banner {
  min-height: 50px;
  display: flex;
  align-items: center;
  gap: var(--s4);
  padding-bottom: var(--s4);
  border-bottom: 1px solid var(--border);
}
.repo-identity { min-width: 0; display: flex; align-items: center; gap: var(--s2); }
.repo-identity h1 { min-width: 0; margin: 0; font-size: var(--text-md); line-height: var(--lh-md); }
.repo-identity h1 a:first-of-type { color: var(--fg-muted); font-weight: 500; }
.repo-identity h1 a:last-of-type { color: var(--fg); }
.repo-workspace {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  gap: var(--s8);
  align-items: start;
  padding-top: var(--s6);
}
.repo-nav { position: sticky; top: var(--s6); display: grid; gap: 3px; align-content: start; }
.repo-nav-label {
  padding: var(--s1) 9px var(--s2);
  color: var(--fg-subtle);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.repo-nav a {
  min-height: 34px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 9px;
  border-radius: var(--radius-md);
  color: var(--fg-muted);
  font-size: var(--text-sm);
}
.repo-nav a > span { width: 17px; flex: 0 0 17px; color: var(--fg-subtle); text-align: center; }
.repo-nav a:hover { background: var(--bg-subtle); color: var(--fg); text-decoration: none; }
.repo-nav a.active { background: var(--bg-inset); color: var(--fg); box-shadow: inset 2px 0 var(--accent); }
.repo-nav-separator { margin: 7px var(--s2); border-top: 1px solid var(--border); }
.repo-content { min-width: 0; }

@media (max-width: 760px) {
  header.site .wrap { gap: var(--s2); }
  header.site .brand + .spacer + a[href="/docs"] { display: none; }
  .account-trigger { min-width: 0; }
  .account-copy { display: none; }
  .account-popover { position: fixed; top: 58px; right: var(--s3); }
  .repo-workspace { grid-template-columns: minmax(0, 1fr); gap: var(--s4); padding-top: var(--s4); }
  .repo-nav {
    position: static;
    display: flex;
    gap: var(--s1);
    overflow-x: auto;
    padding-bottom: var(--s2);
    border-bottom: 1px solid var(--border);
    scrollbar-width: thin;
  }
  .repo-nav-label,
  .repo-nav-separator { display: none; }
  .repo-nav a { flex: 0 0 auto; white-space: nowrap; }
  .repo-nav a.active { box-shadow: inset 0 -2px var(--accent); }
}

@media (max-width: 460px) {
  header.site a[href="/new"] { width: 32px; overflow: hidden; padding: 0; justify-content: center; font-size: 0; }
  header.site a[href="/request-invite"] { white-space: nowrap; }
  header.site a[href="/new"]::before { content: "+"; font-size: var(--text-md); }
  .repo-identity .badge { display: none; }
}

/* Buttons — BRAND.md §6.1 */
.btn {
  font: inherit; font-weight: 500;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-strong);
  background: var(--bg);
  color: var(--fg);
  padding: 0 var(--s3);
  height: 32px;
  cursor: pointer;
  display: inline-flex; align-items: center; gap: var(--s2);
}
.btn-compact { height: 28px; font-size: var(--text-sm); }
.btn-comfortable { height: 40px; padding: 0 var(--s4); }
.btn:hover { background: var(--bg-inset); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { filter: brightness(0.94); }
.btn-subtle { border-color: transparent; background: transparent; color: var(--accent); }
.btn-danger { border-color: var(--danger); color: var(--danger); }
.btn-success { background: var(--success); border-color: var(--success); color: #07170e; }
.btn-danger-solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-success:hover, .btn-danger-solid:hover { filter: brightness(0.94); }
.btn[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; }
.btn[data-pending-state="true"] {
  opacity: 0.55; filter: grayscale(1); cursor: progress;
}
.icon-btn {
  font: inherit; background: none; border: 1px solid transparent;
  border-radius: var(--radius-sm); cursor: pointer; color: var(--fg-muted);
  padding: var(--s1) var(--s2);
}
.icon-btn:hover { background: var(--bg-inset); }

/* One work-item identity and one mutable-prose interaction system (#270).
 * These primitives are shared by issues and pull requests so title metadata,
 * action placement, viewport behavior, and keyboard semantics cannot drift. */
.work-item-heading { min-width: 0; margin-bottom: var(--s1); }
.work-item-title-display {
  display: flex; align-items: baseline; flex-wrap: wrap; gap: var(--s2); min-width: 0;
}
.work-item-title-display h1 {
  min-width: 0; margin: 0; overflow-wrap: anywhere;
}
.work-item-number {
  flex: 0 0 auto; color: var(--fg-subtle); font-size: var(--text-md);
  font-weight: 400; font-variant-numeric: tabular-nums;
}
.work-item-title-edit { flex: 0 0 auto; align-self: center; text-decoration: none; }
.work-item-title-editor {
  display: none; align-items: center; flex-wrap: wrap; gap: var(--s2); width: 100%;
}
.work-item-title-editor:target,
.work-item-title-editor[data-title-editor-open] { display: flex; scroll-margin-top: var(--s4); }
.work-item-heading:has(.work-item-title-editor:target) .work-item-title-display,
.work-item-heading:has(.work-item-title-editor[data-title-editor-open]) .work-item-title-display { display: none; }
.work-item-title-editor > .field-input { flex: 1 1 28rem; min-width: min(18rem, 100%); }
.work-item-title-actions { display: flex; flex: 0 0 auto; gap: var(--s1); }

.content-block { position: relative; overflow: visible; scroll-margin-top: var(--s6); }
.content-block:has(> .content-block-head .content-actions[open]) {
  overflow: visible;
  z-index: 21;
}
.content-block.agent-authored { border-left: 3px solid var(--agent); }
.content-block-head {
  display: flex; align-items: center; gap: var(--s2); min-height: 40px;
  padding: var(--s2) var(--s3); border-bottom: 1px solid var(--border);
  background: var(--bg-subtle); border-radius: var(--radius-md) var(--radius-md) 0 0;
}
.content-block-meta { display: flex; align-items: center; flex-wrap: wrap; gap: var(--s2); min-width: 0; }
.content-block-body { padding: var(--s4); overflow-wrap: anywhere; }
.content-block-body > :first-child { margin-top: 0; }
.content-block-body > :last-child { margin-bottom: 0; }
.content-block-editor { display: none; padding: var(--s4); }
.content-block-editor:has(:target) { display: block; }
.content-block:has(> .content-block-editor :target) > .content-block-body { display: none; }
.content-edit-actions { display: flex; flex-wrap: wrap; gap: var(--s2); }
.content-block-reply { border: 0; border-radius: 0; }
.content-block-reply .content-block-head { border-radius: 0; background: transparent; }

.content-actions { position: relative; margin-left: auto; flex: 0 0 auto; }
.content-actions > summary { list-style: none; letter-spacing: -0.12em; }
.content-actions > summary::-webkit-details-marker { display: none; }
.content-actions-menu {
  position: absolute; z-index: 20; inset-inline-end: 0; top: calc(100% + var(--s1));
  width: min(12rem, calc(100vw - 32px)); padding: var(--s1);
  border: 1px solid var(--border-strong); border-radius: var(--radius-md);
  background: var(--bg); box-shadow: var(--shadow-md);
}
.content-actions-menu a {
  display: block; padding: var(--s2); border-radius: var(--radius-sm);
  color: var(--fg); text-decoration: none; white-space: nowrap;
}
.content-actions-menu form { margin: 0; }
.content-actions-menu button {
  display: block; width: 100%; padding: var(--s2); border: 0; border-radius: var(--radius-sm);
  background: transparent; color: var(--fg); font: inherit; text-align: left; cursor: pointer;
}
.content-actions-menu a:hover, .content-actions-menu a:focus,
.content-actions-menu button:hover, .content-actions-menu button:focus { background: var(--bg-inset); }
.content-actions-menu .content-action-danger { color: var(--danger); }

.paginator {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s3);
  min-height: 2.25rem;
  margin-top: var(--s4);
}
.paginator > .spacer { flex: 1 1 auto; }
.paginator-page { text-align: center; }
.list-pagination {
  margin: 0 0 0.75rem;
}
.list-pagination:last-child { margin: 0.75rem 0 0; }
.content-block:target, [id^="review-comment-"]:target {
  outline: 2px solid var(--accent); outline-offset: 2px;
}

@media (max-width: 420px) {
  .work-item-title-editor > .field-input { flex-basis: 100%; min-width: 0; width: 100%; }
  .work-item-title-actions { width: 100%; }
  .content-block-body, .content-block-editor { padding: var(--s3); }
}

/* Blame: commit sha and author share one column, so a reader can see who last
 * touched a line without opening the commit. Author is the question people
 * actually ask of blame. */
.blame-meta {
  white-space: nowrap;
  width: 1%;
  padding: 0 var(--s3) !important;
  border-right: 1px solid var(--border);
  font-size: var(--text-xs);
  vertical-align: top;
}
.blame-meta a { text-decoration: none; }
.blame-author {
  color: var(--fg-subtle);
  margin-left: var(--s2);
  /* Long names must not push the code column off screen. */
  display: inline-block;
  max-width: 12ch;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: bottom;
}

/* Settings gear in the site header. Icon-only, so §7.1 requires the tooltip and
 * accessible name the markup provides. */
.gear {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  color: var(--fg-muted);
  transition: background-color 120ms ease-out, color 120ms ease-out;
}
.gear:hover { background: var(--bg-inset); color: var(--fg); text-decoration: none; }
.gear svg { width: 20px; height: 20px; display: block; }

.hint { color: var(--fg-subtle); cursor: help; font-size: var(--text-sm); position: relative; }
.hint-tooltip {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: var(--shadow-md);
  color: var(--fg);
  display: none;
  font-size: var(--text-xs);
  font-weight: 400;
  bottom: calc(100% + var(--s2));
  left: 50%;
  line-height: 1.4;
  max-width: min(360px, calc(100vw - 32px));
  padding: 8px 10px;
  pointer-events: none;
  position: absolute;
  text-align: left;
  transform: translateX(-50%);
  width: max-content;
  z-index: 20;
}
.hint:hover .hint-tooltip,
.hint:focus .hint-tooltip { display: block; }

/* Icon-only controls expose their required tooltip to pointer and keyboard
 * users. The wrapper receives `:focus-within` while its button is focused. */
.icon-button-wrap { display: inline-flex; position: relative; }
.icon-button-tooltip {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: var(--shadow-md);
  color: var(--fg);
  display: none;
  font-size: var(--text-xs);
  line-height: 1.4;
  padding: 6px 8px;
  pointer-events: none;
  position: absolute;
  right: 0;
  top: calc(100% + var(--s2));
  white-space: nowrap;
  z-index: 60;
}
.icon-button-wrap:hover .icon-button-tooltip,
.icon-button-wrap:focus-within .icon-button-tooltip { display: block; }

/* Native disclosures share one explicit affordance. The glyph starts pointed
 * toward the hidden content and turns down when that content is visible. */
.disclosure-summary { list-style: none; cursor: pointer; }
.disclosure-summary::-webkit-details-marker { display: none; }
.disclosure-summary-label { display: inline-flex; align-items: center; gap: var(--s2); }
.disclosure-chevron {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 12px;
  width: 12px;
  height: 12px;
  color: var(--fg-subtle);
  transform: rotate(-90deg);
  transition: transform 120ms ease-out;
}
.disclosure-chevron svg { display: block; width: 12px; height: 12px; }
.disclosure-chevron path {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}
details[open] > .disclosure-summary .disclosure-chevron { transform: rotate(0); }
.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;
}

/* Status — one semantic glyph; meaning lives in the accessible name and the
   shared hover/focus tooltip (BRAND.md §6.3). Fixed positioning keeps the
   tooltip above table/card/rail overflow rather than clipping it. */
.status {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.25rem;
  font-size: var(--text-sm);
  line-height: 1.25rem;
  cursor: help;
  text-decoration: none;
}
.status-adjacent { margin-left: var(--s1); color: currentColor; font-variant-numeric: tabular-nums; }
.status:focus { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--radius-sm); }
.status-tooltip {
  display: none;
  position: fixed;
  z-index: 100;
  width: max-content;
  max-width: min(22rem, calc(100vw - 2 * var(--s4)));
  margin: calc(1.25rem + var(--s1)) 0 0 calc(-0.625rem);
  padding: var(--s1) var(--s2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--fg);
  color: var(--bg);
  box-shadow: var(--shadow-md);
  font-size: var(--text-xs);
  font-weight: 400;
  line-height: var(--lh-sm);
  text-align: left;
  white-space: normal;
}
.status:hover .status-tooltip,
.status:focus .status-tooltip,
.run-badge:hover .status-tooltip,
.run-badge:focus .status-tooltip { display: block; }
.status-success, .status-open { color: var(--ready); }
.status-failure, .status-blocked { color: var(--blocked); }
.status-agent { color: var(--agent); }
.status-pending, .status-queued, .status-stale { color: var(--in-progress); }
/* Blocked is an explicit stop condition, so it shares the red danger accent rather
   than the yellow used for work that is merely pending or degraded (issue #22). */
.status-attention { color: var(--needs-interaction); }
.status-none { color: var(--fg-subtle); }
.status-merged { color: var(--ready); }
.status-closed { color: var(--closed); }

.status-page-heading { margin-bottom: var(--s4); }
.status-page-heading .flash { display: flex; align-items: center; gap: var(--s2); }
.status-service-list > li, .status-admin-list > li { align-items: flex-start; }
.status-service-copy { flex: 1; min-width: 0; }
.status-service-copy p { margin: var(--s1) 0 0; }
.status-incident-note { color: var(--blocked); }
.status-incident-note .muted { display: block; color: var(--fg-muted); }
.status-uptime { display: grid; justify-items: end; white-space: nowrap; }
.status-service-detail { display: flex; align-items: flex-start; gap: var(--s3); padding: var(--s4); }
.status-service-detail > div:first-child { flex: 1; }
.status-admin-action { min-width: min(20rem, 100%); }
.status-admin-action form { display: flex; align-items: end; gap: var(--s2); }
.status-admin-action .field { flex: 1; margin: 0; }

@media (max-width: 760px) {
  .status-service-list > li, .status-admin-list > li { flex-wrap: wrap; }
  .status-uptime { width: 100%; justify-items: start; padding-left: 1.5rem; }
  .status-admin-action { width: 100%; min-width: 0; }
  .status-admin-action form { align-items: stretch; flex-direction: column; }
}

.error-message {
  padding: var(--s3);
  margin: 0;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}
.error-context-list .row-meta {
  min-width: 0;
  overflow-wrap: anywhere;
  text-align: right;
  white-space: normal;
}
.error-owner-form {
  display: flex;
  gap: var(--s2);
  align-items: end;
  max-width: 32.5rem;
  margin-bottom: var(--s4);
}
.error-owner-form .field { flex: 1; min-width: 0; margin-bottom: 0; }
.error-owner-form select { max-width: 100%; }

@media (max-width: 520px) {
  .error-owner-form { align-items: stretch; flex-direction: column; }
  .error-owner-form .btn { align-self: flex-start; }
}

.agent-badge {
  display: inline-block; font-size: var(--text-xs); font-weight: 500;
  color: var(--agent); border: 1px solid var(--agent);
  border-radius: var(--radius-sm); padding: 0 var(--s1);
}

/* Fields — BRAND.md §6.2 */
.field { margin-bottom: var(--s4); }
.field-inline { display: inline-block; margin: 0; vertical-align: middle; }
.field-inline .field-input { width: auto; min-width: 10rem; }
.pr-branch-selection {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: var(--s4);
  align-items: start;
  margin-bottom: var(--s4);
}
.pr-branch-selection .field-inline { min-width: 0; }
.pr-branch-selection .field-input { width: 100%; min-width: 0; }
.pr-branch-arrow { align-self: start; margin-top: 2.35rem; }
@media (max-width: 520px) {
  .pr-branch-selection { grid-template-columns: minmax(0, 1fr); }
  .pr-branch-arrow { justify-self: center; margin-top: 0; transform: rotate(90deg); }
}
.field-narrow { max-width: 24rem; }
.field-label { display: block; font-weight: 500; margin-bottom: var(--s1); }
.field-required { color: var(--danger); margin-left: 2px; }
.field-input {
  font: inherit; width: 100%; padding: var(--s2) var(--s3);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--bg-inset); color: var(--fg);
}
.field-help { font-size: var(--text-sm); color: var(--fg-subtle); margin: var(--s1) 0 0; }
.field-error { color: var(--danger); font-size: var(--text-sm); margin: var(--s1) 0 0; }
.field-error p { margin: 0; }
.field-input[aria-invalid="true"] { border-color: var(--danger); }
.checkbox-field { margin: var(--s2) 0; }
.checkbox-field > label { display: inline-flex; align-items: center; gap: var(--s2); cursor: pointer; }
.checkbox-field input { inline-size: 1rem; block-size: 1rem; margin: 0; accent-color: var(--accent); }
.color-field-control { display: flex; align-items: center; gap: var(--s3); }
.color-field-input {
  width: 64px; height: 40px; padding: 3px; cursor: pointer;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--bg-inset);
}

/* Invite request — one server-rendered application, composed as a quiet
 * Aperture workspace rather than a marketing funnel or multi-step wizard. */
.invite-request-page {
  display: grid;
  grid-template-columns: minmax(16rem, 0.72fr) minmax(0, 1.45fr);
  gap: clamp(var(--s6), 5vw, 4.5rem);
  align-items: start;
  max-width: 68rem;
  margin: 0 auto;
  padding: var(--s8) 0 var(--s12);
}
.invite-request-intro { position: sticky; top: var(--s6); min-width: 0; }
.invite-request-heading .eyebrow { margin-bottom: var(--s3); }
.invite-request-heading h1 {
  margin: 0 0 var(--s3);
  font-size: clamp(2rem, 5vw, 3.25rem);
  line-height: 1.05;
  letter-spacing: -0.035em;
}
.invite-request-heading > p:last-child { margin: 0; color: var(--fg-muted); font-size: var(--text-md); }
.invite-request-application { min-width: 0; }
.invite-request-application > .flash { margin-top: 0; }
.invite-request-form { overflow: hidden; padding: 0; }
.invite-choice-group {
  display: grid;
  gap: 0;
  min-width: 0;
  margin: 0;
  padding: 0 var(--s6) var(--s6);
  border: 0;
  border-bottom: 1px solid var(--aperture-line);
}
.invite-request-question > .field-label {
  margin: 0;
  font-size: var(--text-md);
  font-weight: 650;
  line-height: var(--lh-md);
}
.invite-choice-group > .field-label {
  width: 100%;
  padding: var(--s6) 0 var(--s3);
}
.invite-choice-group > .field-help { max-width: 64ch; margin: 0; }
.invite-choice-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s2); }
.invite-choice {
  display: flex;
  gap: var(--s2);
  align-items: flex-start;
  min-width: 0;
  padding: 10px var(--s3);
  border: 1px solid var(--aperture-line);
  border-radius: var(--radius-md);
  color: var(--fg-muted);
  background: color-mix(in srgb, var(--bg-inset) 72%, transparent);
  cursor: pointer;
  transition: border-color 120ms ease, background-color 120ms ease, box-shadow 120ms ease, color 120ms ease;
}
.invite-choice:hover {
  color: var(--fg);
  border-color: color-mix(in srgb, var(--accent) 48%, var(--border));
  background: color-mix(in srgb, var(--bg-inset) 88%, var(--accent));
}
.invite-choice:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.invite-choice:has(input:checked) {
  color: var(--fg);
  border-color: color-mix(in srgb, var(--accent) 72%, var(--border));
  background: color-mix(in srgb, var(--accent) 11%, var(--aperture-surface-raised));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 12%, transparent);
}
.invite-choice input {
  flex: 0 0 auto;
  inline-size: 1rem;
  block-size: 1rem;
  margin: 2px 0 0;
  accent-color: var(--accent);
}
.invite-choice span { min-width: 0; }
.invite-choice-group-invalid {
  box-shadow: inset 3px 0 0 color-mix(in srgb, var(--danger) 76%, transparent);
}
.invite-request-details {
  display: grid;
  gap: var(--s6);
  padding: var(--s6);
}
.invite-request-details > .invite-request-question {
  display: grid;
  gap: var(--s2);
  margin: 0;
}
.invite-request-details .field-help,
.invite-request-details .field-error { margin: 0; }
.invite-request-details textarea { resize: vertical; }
.invite-request-details textarea[aria-invalid="true"],
.invite-request-details input[aria-invalid="true"] {
  box-shadow: inset 3px 0 0 color-mix(in srgb, var(--danger) 72%, transparent);
}
.invite-request-actions {
  display: flex;
  gap: var(--s4);
  align-items: center;
  justify-content: space-between;
  padding: var(--s4) var(--s6);
  border-top: 1px solid var(--aperture-line);
  background: color-mix(in srgb, var(--aperture-surface-raised) 72%, transparent);
}
.invite-request-actions .btn { flex: 0 0 auto; }
.invite-request-actions p { margin: 0; text-align: right; font-size: var(--text-sm); }
.invite-request-page-success { display: block; max-width: 42rem; }
.invite-request-success { overflow: hidden; padding: clamp(var(--s6), 5vw, var(--s12)); }
.invite-request-success h1 { margin: var(--s2) 0 var(--s6); font-size: clamp(2rem, 5vw, 3rem); }
.invite-request-success-copy {
  padding-left: var(--s4);
  border-left: 2px solid color-mix(in srgb, var(--success) 70%, var(--aperture-line));
  color: var(--fg-muted);
}
.invite-request-success-copy p:first-child { margin-top: 0; }
.invite-request-success-copy p:last-child { margin-bottom: 0; }
.invite-request-existing { margin: var(--s6) 0 0; }

@media (max-width: 840px) {
  .invite-request-page { grid-template-columns: minmax(0, 1fr); gap: var(--s6); max-width: 43rem; }
  .invite-request-intro { position: static; }
  .invite-request-heading h1 { max-width: 14ch; }
}

@media (max-width: 520px) {
  .invite-request-page { padding-top: var(--s6); }
  .invite-request-heading h1 { font-size: 2.35rem; }
  .invite-choice-group { padding: 0 var(--s4) var(--s4); }
  .invite-choice-group > .field-label { padding-top: var(--s4); }
  .invite-request-details { padding: var(--s4); }
  .invite-choice-list { grid-template-columns: minmax(0, 1fr); }
  .invite-request-actions { align-items: stretch; flex-direction: column; padding: var(--s4); }
  .invite-request-actions .btn { justify-content: center; width: 100%; }
  .invite-request-actions p { text-align: left; }
}

/* Sign in — a quiet Aperture threshold. The open contours establish the brand
 * without turning an interior utility page into a second marketing homepage. */
.sign-in-page {
  display: grid;
  min-height: min(38rem, calc(100vh - 7.5rem));
  padding: clamp(var(--s4), 5vh, var(--s12)) 0 var(--s12);
  place-items: center;
}
.sign-in-shell {
  position: relative;
  display: grid;
  grid-template-columns: minmax(15rem, 0.9fr) minmax(19rem, 1.1fr);
  width: min(52rem, 100%);
  min-height: 31rem;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
}
.sign-in-aperture {
  position: relative;
  min-width: 0;
  overflow: hidden;
  border-right: 1px solid var(--aperture-line);
  background:
    linear-gradient(145deg, color-mix(in srgb, var(--aperture-surface-raised) 92%, transparent), transparent 68%),
    var(--bg-subtle);
  isolation: isolate;
}
.sign-in-aperture::after {
  content: "";
  position: absolute;
  z-index: -1;
  right: -4.5rem;
  bottom: -3.5rem;
  width: 17rem;
  height: 17rem;
  background: url("/assets/aperture-accent-dialog-9dc3e5d0229dc83180073f145476aab3.webp?vsn=d") center / contain no-repeat;
  opacity: 0.12;
  pointer-events: none;
  rotate: -8deg;
}
.sign-in-aperture-mark {
  position: absolute;
  inset: 50% auto auto 50%;
  width: min(29rem, 128%);
  height: auto;
  translate: -50% -48%;
  color: var(--fg-subtle);
  opacity: 0.44;
}
.sign-in-aperture-mark path {
  stroke: currentColor;
  stroke-width: 1.35;
  vector-effect: non-scaling-stroke;
}
.sign-in-aperture-mark path:nth-child(2),
.sign-in-aperture-mark path:nth-child(4) {
  color: color-mix(in srgb, var(--needs-interaction) 42%, var(--fg-subtle));
  opacity: 0.56;
}
.sign-in-panel {
  align-self: center;
  min-width: 0;
  padding: clamp(var(--s6), 5vw, var(--s12));
}
.sign-in-panel h1 {
  margin-bottom: var(--s6);
  font-size: clamp(2rem, 4vw, 2.65rem);
  letter-spacing: -0.035em;
  line-height: 1.05;
}
.sign-in-panel > .flash { margin-top: 0; }
.sign-in-form { max-width: 25rem; }
.sign-in-form .field-input { min-height: 42px; }
.sign-in-form .btn-primary { width: 100%; min-height: 40px; justify-content: center; }
.sign-in-invite-copy {
  max-width: 32ch;
  margin: var(--s4) 0 0;
  font-size: var(--text-sm);
}

@media (max-width: 680px) {
  .sign-in-page { min-height: 0; padding: var(--s4) 0 var(--s8); place-items: start center; }
  .sign-in-shell { grid-template-columns: minmax(0, 1fr); width: min(29rem, 100%); min-height: 0; }
  .sign-in-aperture { min-height: 8.5rem; border-right: 0; border-bottom: 1px solid var(--aperture-line); }
  .sign-in-aperture::after { right: -1.5rem; bottom: -5.5rem; width: 15rem; height: 15rem; opacity: 0.1; }
  .sign-in-aperture-mark { width: 18rem; translate: -50% -27%; }
  .sign-in-panel { padding: var(--s6) var(--s4); }
  .sign-in-panel h1 { margin-bottom: var(--s4); font-size: 2rem; }
  .sign-in-form { max-width: none; }
}

/* Settings — BRAND.md §8 */
.setting { padding: var(--s4) 0; border-bottom: 1px solid var(--border); }
.setting-label { font-weight: 600; font-size: var(--text-md); }
.setting-description { color: var(--fg-muted); margin: var(--s1) 0; }
.setting-consequence { color: var(--fg); background: var(--bg-subtle); padding: var(--s2) var(--s3); border-radius: var(--radius-sm); margin: var(--s2) 0; font-size: var(--text-sm); }
.setting-control { margin: var(--s3) 0; }
.setting-effective { font-size: var(--text-sm); color: var(--fg-subtle); margin: var(--s1) 0 0; }
.setting-learn { font-size: var(--text-sm); }
.repo-rename-control {
  display: grid; grid-template-columns: minmax(0, 1fr) auto;
  align-items: end; gap: var(--s2);
}
.repo-rename-control .field { margin-bottom: 0; }
@media (max-width: 520px) {
  .repo-rename-control { grid-template-columns: minmax(0, 1fr); }
  .repo-rename-control .btn { justify-self: start; }
}
.theme-choice {
  display: flex; align-items: center; gap: var(--s2); padding: var(--s2);
  margin-bottom: var(--s2); border: 1px solid var(--border); border-radius: var(--radius-sm);
  cursor: pointer;
}
.theme-choice:has(input:checked) { border-color: var(--accent); background: var(--bg-subtle); }
.theme-choice:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.theme-swatch {
  width: 32px; height: 24px; border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
}
.theme-swatch-dark { background: #0D0F12; }
.theme-swatch-light { background: #FFFFFF; }
.danger-zone { margin-top: var(--s12); border: 1px solid var(--danger); border-radius: var(--radius-md); padding: var(--s4); }
.danger-zone-title { color: var(--danger); font-size: var(--text-md); margin: 0 0 var(--s2); }

/* Empty states — BRAND.md §6.6 */
.empty-state { padding: var(--s12) var(--s6); text-align: center; border: 1px dashed var(--border); border-radius: var(--radius-md); }
.empty-title { font-weight: 600; font-size: var(--text-md); margin: 0 0 var(--s2); }
.empty-body { color: var(--fg-muted); margin: 0 0 var(--s4); }

/* Tables and file lists */
.card { border: 1px solid var(--border); border-radius: var(--radius-md); overflow: hidden; }
.metric-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: var(--s2); }
.metric { display: flex; flex-direction: column; gap: 2px; padding: var(--s3); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.metric strong { font-size: var(--text-lg); font-variant-numeric: tabular-nums; }
.metric span { color: var(--fg-muted); font-size: var(--text-xs); }
.card-head { background: var(--bg-subtle); padding: var(--s2) var(--s3); border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: var(--s3); font-size: var(--text-sm); }
.rows { list-style: none; margin: 0; padding: 0; }
.rows li { display: flex; align-items: center; gap: var(--s2); padding: var(--s2) var(--s3); border-bottom: 1px solid var(--border); }
.rows li:last-child { border-bottom: none; }
.rows li:hover { background: var(--bg-subtle); }

/* Application data tables. Source-code tables deliberately keep their specialised
 * blob/diff treatments below. */
.data-table-wrap {
  width: 100%; overflow-x: auto; border: 1px solid var(--border);
  border-radius: var(--radius-md); background: var(--bg);
}
.data-table { width: 100%; border-collapse: separate; border-spacing: 0; }
.data-table caption {
  text-align: left; padding: var(--s2) var(--s3); font-weight: 600;
  background: var(--bg-subtle); border-bottom: 1px solid var(--border);
}
.data-table th {
  position: sticky; top: 0; z-index: 1; text-align: left;
  padding: var(--s2) var(--s3); font-size: var(--text-xs); font-weight: 600;
  color: var(--fg-muted); background: var(--bg-inset);
  border-bottom: 1px solid var(--border-strong); white-space: nowrap;
}
.data-table td {
  padding: var(--s2) var(--s3); vertical-align: middle;
  border-bottom: 1px solid var(--border);
}
.data-table tbody tr:nth-child(even) { background: var(--bg-subtle); }
.data-table tbody tr:hover, .data-table tbody tr:focus-within { background: var(--bg-inset); }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table .cell-right { text-align: right; font-variant-numeric: tabular-nums; }
.data-table .cell-center { text-align: center; }

/* Agent activity (#438). A truth table, not a progress dashboard: every cell is
 * backed by a durable workflow record and unknown values stay visibly unknown. */
.agent-flow-page { display: grid; gap: var(--s4); }
.agent-flow-heading { padding: var(--s2) 0; }
.agent-flow-heading h1 { margin: 0; }
.agent-flow-heading p { margin: var(--s1) 0 0; }
.agent-flow-summary {
  display: flex; flex-wrap: wrap; gap: var(--s2);
}
.agent-flow-summary-item {
  appearance: none; display: inline-flex; align-items: center; justify-content: space-between;
  gap: var(--s3); width: auto; min-width: 7.5rem; height: 40px; padding: 0 var(--s3); color: var(--fg-muted);
  border: 1px solid var(--border); border-radius: var(--radius-md);
  background: var(--bg); cursor: pointer; text-align: left;
}
.agent-flow-summary-item:hover,
.agent-flow-summary-item.active { border-color: var(--accent); background: var(--bg-subtle); color: var(--fg); }
.agent-flow-summary-item.active { box-shadow: inset 0 -2px var(--accent); }
.agent-flow-summary-item strong { color: var(--fg); font-size: var(--text-sm); font-variant-numeric: tabular-nums; }
.agent-flow-summary-item span { font-size: var(--text-sm); }
.agent-flow-filter-disclosure {
  border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--bg-subtle);
}
.agent-flow-filter-disclosure > summary {
  min-height: 42px; display: flex; align-items: center; justify-content: space-between;
  gap: var(--s3); padding: 0 var(--s3); cursor: pointer; font-size: var(--text-sm); font-weight: 600;
}
.agent-flow-filter-disclosure > summary::marker { color: var(--fg-subtle); }
.agent-flow-filter-disclosure > summary .muted { font-size: var(--text-xs); font-weight: 400; }
.agent-flow-filters {
  display: grid; grid-template-columns: minmax(14rem, 1fr) minmax(12rem, .75fr) repeat(2, minmax(9rem, 12rem)) auto;
  align-items: end; gap: var(--s3); padding: var(--s3); border-top: 1px solid var(--border);
}
.agent-flow-filters > .field { margin: 0; }
.agent-flow-filters .agent-flow-mine {
  align-self: end; min-height: 42px; display: flex; align-items: center; margin: 0; white-space: nowrap;
}
.agent-flow-panel {
  overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--bg);
}
.agent-flow-panel-attention { border-color: color-mix(in srgb, var(--attention) 70%, var(--border)); box-shadow: inset 3px 0 var(--attention); }
.agent-flow-panel-heading {
  min-height: 48px; display: flex; align-items: center; padding: 0 var(--s3);
  border-bottom: 1px solid var(--border); background: var(--bg-subtle);
}
.agent-flow-panel-heading h2 { margin: 0; font-size: var(--text-sm); }
.agent-flow-panel-heading h2 span { margin-left: var(--s1); color: var(--fg-subtle); font-weight: 400; }
.agent-flow-panel-attention .agent-flow-panel-heading h2::before {
  margin-right: var(--s2); color: var(--attention); content: "●"; font-size: 0.65em;
}
.agent-flow-table-wrap { overflow-x: auto; }
.agent-flow-table { width: 100%; border-collapse: collapse; }
.agent-flow-table th {
  position: sticky; top: 0; z-index: 1;
  padding: var(--s2) var(--s3); color: var(--fg-subtle); background: var(--bg);
  border-bottom: 1px solid var(--border); font-size: 0.6875rem; font-weight: 600;
  letter-spacing: 0.08em; text-align: left; text-transform: uppercase; white-space: nowrap;
}
.agent-flow-table th:first-child,
.agent-flow-table td:first-child { padding-left: var(--s4); }
.agent-flow-table th:last-child,
.agent-flow-table td:last-child { padding-right: var(--s4); }
.agent-flow-table td { padding: var(--s3); border-bottom: 1px solid var(--border); vertical-align: middle; }
.agent-flow-table tbody tr:last-child td { border-bottom: 0; }
.agent-flow-table tbody tr:hover { background: var(--bg-subtle); }
.agent-flow-state { width: 9rem; white-space: nowrap; }
.agent-flow-work { width: 40%; min-width: 18rem; }
.agent-flow-work > a { display: block; color: var(--fg); }
.agent-flow-work > span,
.agent-flow-work > small { display: block; margin-top: 3px; color: var(--fg-muted); font-size: var(--text-xs); }
.agent-flow-work > small { max-width: 52rem; color: var(--danger); }
.agent-flow-work > .agent-flow-queue-position { color: var(--fg-muted); }
.agent-flow-facts { min-width: 12rem; }
.agent-flow-facts > span { display: block; color: var(--fg-muted); font-size: var(--text-xs); line-height: 1.65; }
.agent-flow-cell-label { margin-right: var(--s1); color: var(--fg-subtle); }
.agent-flow-money { font-variant-numeric: tabular-nums; white-space: nowrap; }
.agent-flow-links { min-width: 7rem; }
.agent-flow-links > a,
.agent-flow-links > span { display: block; font-size: var(--text-xs); line-height: 1.75; }
.agent-flow-links > .agent-flow-cell-label { display: none; }
.agent-flow-open { text-align: right; }

/* Shared agent-flow detail shell. Workflow-specific pages remain available for
 * specialized work, while durable lifecycle evidence stays consistent here. */
.agent-flow-detail { display: grid; gap: var(--s4); }
.agent-flow-detail-back { font-size: var(--text-sm); }
.agent-flow-detail-header {
  display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s6);
  padding-bottom: var(--s4); border-bottom: 1px solid var(--border);
}
.agent-flow-detail-title { min-width: 0; }
.agent-flow-detail-title > .status { margin-bottom: var(--s2); }
.agent-flow-detail-title h1 { max-width: 62rem; margin: 0; overflow-wrap: anywhere; }
.agent-flow-detail-title p { margin: var(--s2) 0 0; color: var(--fg-muted); font-size: var(--text-sm); }
.agent-flow-detail-actions,
.agent-flow-programmer-controls { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--s2); }
.agent-flow-detail-notice {
  padding: var(--s3) var(--s4); border: 1px solid color-mix(in srgb, var(--danger) 60%, var(--border));
  border-left: 3px solid var(--danger); border-radius: var(--radius-md);
}
.agent-flow-detail-error { background: color-mix(in srgb, var(--danger) 7%, var(--bg)); }
.agent-flow-detail-error strong { color: var(--danger); }
.agent-flow-detail-attention { border-color: color-mix(in srgb, var(--attention) 60%, var(--border)); border-left-color: var(--attention); background: color-mix(in srgb, var(--attention) 7%, var(--bg)); }
.agent-flow-detail-attention strong { color: var(--attention); }
.agent-flow-detail-notice p { margin: var(--s1) 0 0; }
#queue-controls { border-color: var(--border); border-left-color: var(--in-progress); }
.agent-flow-detail-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(17rem, 21rem); gap: var(--s4); align-items: start; }
.agent-flow-detail-main,
.agent-flow-detail-sidebar { display: grid; gap: var(--s4); min-width: 0; }
.agent-flow-detail-panel { overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--bg); }
.agent-flow-detail-panel > header { display: flex; align-items: center; min-height: 46px; padding: 0 var(--s4); border-bottom: 1px solid var(--border); background: var(--bg-subtle); }
.agent-flow-detail-panel > header h2 { margin: 0; font-size: var(--text-sm); }
.agent-flow-detail-panel > header h2 span { margin-left: var(--s1); color: var(--fg-subtle); font-weight: 400; }
.agent-flow-detail-panel-body { padding: var(--s4); }
.agent-flow-detail-panel-body h3 { margin: 0 0 var(--s1); color: var(--fg-subtle); font-size: var(--text-xs); letter-spacing: .08em; text-transform: uppercase; }
.agent-flow-goal { margin: 0 0 var(--s4); font-size: var(--text-md); }
.agent-flow-detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s3) var(--s6); margin: 0; }
.agent-flow-detail-grid div { min-width: 0; }
.agent-flow-detail-grid dt,
.agent-flow-fact-list dt { color: var(--fg-subtle); font-size: var(--text-xs); }
.agent-flow-detail-grid dd,
.agent-flow-fact-list dd { margin: 2px 0 0; overflow-wrap: anywhere; }
.agent-flow-detail-grid dd small,
.agent-flow-fact-list dd small { display: block; margin-top: 2px; color: var(--fg-subtle); font-size: var(--text-xs); }
.agent-flow-criteria { margin: 0; padding: 0; list-style: none; }
.agent-flow-criteria li { display: grid; grid-template-columns: minmax(11rem, auto) 1fr; gap: var(--s4); align-items: center; padding: var(--s3) var(--s4); border-bottom: 1px solid var(--border); }
.agent-flow-criteria li:last-child { border-bottom: 0; }
.agent-flow-criteria li > span:last-child { color: var(--fg-muted); font-size: var(--text-sm); }
.agent-flow-attempts > article { padding: var(--s4); border-bottom: 1px solid var(--border); }
.agent-flow-attempts > article:last-child { border-bottom: 0; }
.agent-flow-attempt-heading { display: flex; align-items: center; gap: var(--s3); }
.agent-flow-attempt-heading > span:last-child { margin-left: auto; color: var(--fg-subtle); font-size: var(--text-xs); }
.agent-flow-attempt-prompt { margin: var(--s3) 0 0; white-space: pre-wrap; }
.agent-flow-attempt-error { margin: var(--s2) 0 0; color: var(--danger); font-size: var(--text-sm); }
.agent-flow-attempt-time { display: flex; flex-wrap: wrap; gap: var(--s4); margin-top: var(--s2); color: var(--fg-subtle); font-size: var(--text-xs); }
.agent-flow-checkpoint { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); margin-top: var(--s3); padding: var(--s2) var(--s3); border-radius: var(--radius-sm); background: var(--bg-subtle); color: var(--fg-muted); font-size: var(--text-xs); }
.agent-flow-checkpoint > span:first-child { color: var(--fg); font-weight: 600; }
.agent-flow-trace { margin: 0; padding: var(--s2) 0; list-style: none; }
.agent-flow-trace li { position: relative; display: grid; grid-template-columns: 12px minmax(0, 1fr) auto; gap: var(--s2); align-items: center; min-height: 38px; padding: 0 var(--s4); font-size: var(--text-sm); }
.agent-flow-trace li > span:first-child { width: 7px; height: 7px; border-radius: 50%; background: var(--agent); }
.agent-flow-trace li:not(:last-child)::after { position: absolute; top: 24px; bottom: -14px; left: 19px; width: 1px; background: var(--border-strong); content: ""; }
.agent-flow-trace time { color: var(--fg-subtle); font-size: var(--text-xs); }
.agent-flow-steer form { padding: var(--s4); }
.agent-flow-steer .field { margin-top: 0; }
.agent-flow-fact-list { margin: 0; }
.agent-flow-fact-list > div { display: grid; grid-template-columns: 6rem minmax(0, 1fr); gap: var(--s3); padding: var(--s2) var(--s4); border-bottom: 1px solid var(--border); }
.agent-flow-fact-list > div:last-child { border-bottom: 0; }
.agent-flow-artifacts { margin: 0; padding: var(--s2) var(--s4); list-style: none; }
.agent-flow-artifacts li { padding: var(--s1) 0; }
.agent-flow-detail-empty { margin: 0; padding: var(--s3) var(--s4); color: var(--fg-subtle); }
.agent-flow-detail-retention { margin: 0; padding: var(--s2) var(--s4); border-bottom: 1px solid var(--border); color: var(--fg-muted); font-size: var(--text-xs); }

@media (max-width: 760px) {
  .agent-flow-page { gap: var(--s3); }
  .agent-flow-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .agent-flow-summary { display: grid; }
  .agent-flow-summary-item { width: 100%; }
  .agent-flow-filters { grid-template-columns: 1fr 1fr; }
  .agent-flow-filters > .field:first-child { grid-column: 1 / -1; }
  .agent-flow-filters > .field:nth-child(2) { grid-column: 1 / -1; }
  .agent-flow-filters .agent-flow-mine { grid-column: 1 / -1; min-height: 32px; }
  .agent-flow-table, .agent-flow-table tbody { display: block; }
  .agent-flow-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .agent-flow-table tr { display: block; padding: var(--s3); border-bottom: 1px solid var(--border); }
  .agent-flow-table tbody tr:last-child { border-bottom: 0; }
  .agent-flow-table td,
  .agent-flow-table td:first-child,
  .agent-flow-table td:last-child { display: block; width: auto; min-width: 0; padding: 0; border: 0; }
  .agent-flow-state { margin-bottom: var(--s2); }
  .agent-flow-work { margin-bottom: var(--s3); }
  .agent-flow-facts,
  .agent-flow-links { margin-top: var(--s2); }
  .agent-flow-cell-label { display: block; margin: 0 0 2px; font-size: 0.625rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; }
  .agent-flow-links > .agent-flow-cell-label { display: block; }
  .agent-flow-links > a,
  .agent-flow-links > span { line-height: 1.5; }
  .agent-flow-open { margin-top: var(--s3); }
  .agent-flow-open .btn { width: 100%; justify-content: center; }
  .agent-flow-detail-header { display: grid; gap: var(--s3); }
  .agent-flow-detail-actions,
  .agent-flow-programmer-controls { justify-content: flex-start; }
  .agent-flow-detail-actions > a,
  .agent-flow-detail-actions > form,
  .agent-flow-detail-actions > form .btn,
  .agent-flow-programmer-controls,
  .agent-flow-programmer-controls > form,
  .agent-flow-programmer-controls .btn { width: 100%; }
  .agent-flow-detail-layout { grid-template-columns: 1fr; }
  .agent-flow-detail-grid { grid-template-columns: 1fr; }
  .agent-flow-criteria li { grid-template-columns: 1fr; gap: var(--s2); }
  .agent-flow-attempt-heading { flex-wrap: wrap; }
  .agent-flow-attempt-heading > span:last-child { width: 100%; margin-left: 0; }
  .agent-flow-trace li { grid-template-columns: 12px minmax(0, 1fr); padding-top: var(--s2); padding-bottom: var(--s2); }
  .agent-flow-trace time { grid-column: 2; }
}
.row-icon { color: var(--fg-subtle); width: 1em; }
.repository-visibility-icon {
  position: relative;
  display: inline-grid;
  flex: 0 0 1rem;
  width: 1rem;
  height: 1.25rem;
  place-items: center;
  cursor: help;
}
.repository-visibility-icon svg {
  display: block;
  width: 1rem;
  height: 1rem;
}
.repository-visibility-icon path {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.repository-visibility-icon:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}
.repository-visibility-icon:hover .status-tooltip,
.repository-visibility-icon:focus .status-tooltip { display: block; }
.row-meta { margin-left: auto; color: var(--fg-subtle); font-size: var(--text-sm); }

/* Issues index. The status gets a real column instead of taking the width of its
 * text, so Open and Blocked never shove the title onto different starts. */
.issues-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--s4);
  margin: var(--s5) 0 var(--s4);
}
.issues-header h1, .issues-header p { margin: 0; }
.issues-header p { margin-top: var(--s1); }
.issues-new-action-short { display: none; }
.issues-query-panel { padding: var(--s3) var(--s4); margin-bottom: var(--s3); }
.issues-search {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--s2);
  align-items: end;
}
.issues-search .field { margin: 0; }
.issues-search-help { margin: var(--s2) 0 0; }
.issues-filters {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s4);
  margin-bottom: var(--s3);
  padding: 0 var(--s1);
}
.issues-filter-group { display: flex; align-items: center; gap: var(--s4); }
.issues-filter-group a { color: var(--fg-muted); }
.issues-filter-group a.is-active { color: var(--fg); font-weight: 600; }
.issue-list-row {
  display: grid !important;
  grid-template-columns: 7rem minmax(0, 1fr) auto;
  align-items: center;
}
.issue-list-status { width: 7rem; }
.issue-list-summary { min-width: 0; }
.issue-list-meta { font-size: var(--text-sm); margin-top: 2px; }

/* Pull-request filters belong to the result set they change. Queue navigation is
 * primary; lifecycle state is a compact secondary refinement. Both remain real
 * page links so the complete surface works without JavaScript. */
.pr-list-shell {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.pr-list-filters {
  min-height: 48px;
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: var(--s4);
  border-bottom: 1px solid var(--border);
  background: var(--bg-subtle);
}
.filter-nav-primary {
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  gap: var(--s1);
  padding: 0 var(--s3);
}
.filter-nav-primary a {
  position: relative;
  min-height: 48px;
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: var(--s2);
  padding: 0 var(--s2);
  color: var(--fg-muted);
  font-size: var(--text-sm);
}
.filter-nav-primary a:hover { color: var(--fg); text-decoration: none; }
.filter-nav-primary a[aria-current="page"] { color: var(--fg); font-weight: 600; }
.filter-nav-primary a[aria-current="page"]::after {
  position: absolute;
  right: var(--s2);
  bottom: -1px;
  left: var(--s2);
  height: 2px;
  background: var(--accent);
  content: "";
}
.filter-nav-secondary {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: var(--s1);
  padding: var(--s2) var(--s3);
}
.filter-nav-secondary a {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  padding: 0 var(--s2);
  border-radius: var(--radius-sm);
  color: var(--fg-muted);
  font-size: var(--text-sm);
}
.filter-nav-secondary a:hover { background: var(--bg-inset); color: var(--fg); text-decoration: none; }
.filter-nav-secondary a[aria-current="page"] {
  color: var(--fg);
  background: var(--bg-inset);
  box-shadow: inset 0 0 0 1px var(--border-strong);
  font-weight: 600;
}
.filter-nav-icon { color: var(--fg-subtle); }
.filter-nav-secondary a:first-child .filter-nav-icon { color: var(--open); }
.filter-nav-secondary a:last-child .filter-nav-icon { color: var(--closed); }
.filter-nav-count { color: var(--fg-subtle); font-variant-numeric: tabular-nums; }
.filter-nav-tooltip {
  display: none;
  position: fixed;
  z-index: 100;
  width: max-content;
  max-width: min(22rem, calc(100vw - 2 * var(--s4)));
  margin: calc(1.75rem + var(--s1)) 0 0 -1rem;
  padding: var(--s1) var(--s2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--fg);
  color: var(--bg);
  box-shadow: var(--shadow-md);
  font-size: var(--text-xs);
  font-weight: 400;
  line-height: var(--lh-sm);
  text-align: left;
  white-space: normal;
}
.filter-nav a:hover .filter-nav-tooltip:not(.filter-nav-tooltip-focus-only),
.filter-nav a:focus .filter-nav-tooltip { display: block; }
.pr-filter-summary {
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s3);
  padding: var(--s1) var(--s3);
  border-bottom: 1px solid var(--border);
  color: var(--fg-subtle);
  font-size: var(--text-xs);
}
.pr-filter-summary .btn { flex: 0 0 auto; }
.pr-list-shell .rows.card { border: 0; border-radius: 0; }
.pr-list-shell .empty-state { border: 0; border-radius: 0; }
.pr-list-shell .list-pagination { margin: 0; padding: var(--s2) var(--s3); }

@media (max-width: 760px) {
  .pr-list-filters { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0; }
  .filter-nav-primary { min-height: 46px; }
  .filter-nav-primary a { min-height: 46px; }
  .filter-nav-secondary { border-top: 1px solid var(--border); }
  .filter-nav-secondary a { flex: 1 1 0; justify-content: center; }
  .pr-filter-summary { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 560px) {
  .issues-header { align-items: center; }
  .issues-new-action-long { display: none; }
  .issues-new-action-short { display: inline; }
  .issues-search { grid-template-columns: minmax(0, 1fr); }
  .issues-search .btn { width: 100%; }
  .issues-filters { align-items: flex-start; flex-direction: column; gap: var(--s2); }
  .issues-filter-group { gap: var(--s3); }
  .issue-list-row { grid-template-columns: 6.25rem minmax(0, 1fr); }
  .issue-list-status { width: 6.25rem; }
  .issue-list-row .row-meta { grid-column: 2; justify-self: start; margin-left: 0; }
}

/* Issue detail. The reading column stays comfortably narrow while triage metadata
 * uses the otherwise-empty desktop rail. It collapses without scripting, keeping
 * issue reading inside the zero-JS budget. */
.issue-context {
  justify-content: space-between;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: var(--s6);
}
.work-item-header { margin-bottom: var(--s6); }
.work-item-header h1 { margin-bottom: var(--s2); }
.work-item-byline { display: flex; align-items: center; flex-wrap: wrap; gap: var(--s2); }
.work-item-conversation { margin-top: var(--s6); }
.conversation-thread + .conversation-thread { margin-top: var(--s3); }
.review-discussion-comment { overflow: hidden; }
.review-discussion-head {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s3);
  padding: var(--s3); border-bottom: 1px solid var(--border);
  font-size: var(--text-sm);
}
.review-discussion-head > div { display: flex; align-items: baseline; flex-wrap: wrap; gap: var(--s1); }
.review-discussion-context { border-bottom: 1px solid var(--border); overflow-x: auto; }
.review-discussion-context-head {
  display: flex; gap: var(--s2); padding: var(--s2) var(--s3);
  background: var(--bg-subtle); border-bottom: 1px solid var(--border);
  font-size: var(--text-xs);
}
.review-discussion-context .diff-table { width: 100%; border-collapse: collapse; }
.review-discussion-context .diff-content pre { margin: 0; }
.review-discussion-context .review-comment-marker {
  width: 1%; padding: 0 var(--s1); color: var(--accent); font-weight: 700;
}
.review-discussion-context .is-commented .diff-content { box-shadow: inset 3px 0 var(--accent); }
.review-discussion-body { padding: var(--s3); }
.review-discussion-body :is(p, ul, ol) { margin: var(--s1) 0; }
.review-discussion-comment > .diff-comment-actions,
.review-discussion-comment > .comment-replies,
.review-discussion-comment > .comment-reply-composer { margin: 0 var(--s3) var(--s3); }
.work-item-composer > form { padding: var(--s3); }
.work-item-composer-actions { display: flex; justify-content: flex-end; margin-top: var(--s3); }
.work-item-action-group { display: grid; gap: var(--s2); }
.issue-header { margin-bottom: var(--s6); }
.issue-header h1 { margin-bottom: var(--s2); }
.issue-byline { display: flex; align-items: center; flex-wrap: wrap; gap: var(--s2); }
.issue-edit { margin: calc(-1 * var(--s3)) 0 var(--s6); }
.issue-edit > summary { list-style: none; width: max-content; }
.issue-edit > summary::-webkit-details-marker { display: none; }
.issue-edit-form { max-width: 680px; margin-top: var(--s3); padding: var(--s4); }
.work-item-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 300px);
  gap: var(--s6);
  align-items: start;
}
.work-item-main { min-width: 0; }
.work-item-sidebar { min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--s4);
  position: sticky;
  top: var(--s4);
}
.issue-sidebar .meta-row-wide,
.pr-sidebar .meta-row-wide { grid-template-columns: minmax(0, 1fr); gap: var(--s2); }
.issue-sidebar .issue-meta-control,
.pr-sidebar .issue-meta-control { width: 100%; }
.issue-sidebar .issue-meta-control .field-input,
.pr-sidebar .issue-meta-control .field-input { flex: 1 1 auto; width: auto; }
.issue-sidebar .issue-meta-control .btn,
.pr-sidebar .issue-meta-control .btn { flex: 0 0 auto; }
.issue-relation { padding: var(--s3) var(--s4); margin-bottom: var(--s3); }
.issue-relation > div { font-size: var(--text-sm); }
.issue-relation ul { margin: var(--s2) 0 0; padding-left: var(--s6); }
.issue-relation-blocked { border-left: 3px solid var(--danger); }
.issue-graph-link { margin-left: var(--s2); white-space: nowrap; }
.block-graph { overflow-x: auto; padding: var(--s3); }
.block-graph-legend {
  display: flex; gap: var(--s4); align-items: center; margin-bottom: var(--s2);
  color: var(--fg-muted); font-size: var(--text-xs);
}
.block-graph-legend span { display: inline-flex; align-items: center; gap: var(--s1); }
.block-graph-swatch {
  display: inline-block; width: 12px; height: 12px;
  border: 2px solid currentColor; border-radius: 3px;
}
.block-graph-swatch-open { color: var(--open); }
.block-graph-swatch-closed { color: var(--closed); }
.block-graph svg { display: block; min-width: 860px; max-width: none; }
.block-graph-edge { stroke: var(--border-strong); stroke-width: 2; fill: none; }
.block-graph-arrow { fill: var(--border-strong); }
.block-graph-node { fill: var(--bg); stroke: var(--border-strong); stroke-width: 1.5; }
.block-graph-node-open { fill: var(--open); fill-opacity: 0.08; stroke: var(--open); }
.block-graph-node-closed { fill: var(--closed); fill-opacity: 0.14; stroke: var(--closed); }
.block-graph-node-current { stroke-width: 3; }
.block-graph-node-link:hover .block-graph-node { stroke: var(--accent); }
.block-graph-node-link:focus .block-graph-node { stroke: var(--accent); stroke-width: 3; }
.block-graph-node-meta { fill: var(--fg-subtle); font-size: var(--text-xs); }
.block-graph-node-meta-open { fill: var(--open); }
.block-graph-node-meta-closed { fill: var(--closed); }
.block-graph-node-title { fill: var(--fg); font-size: var(--text-sm); font-weight: 600; }
.block-graph-column-label { fill: var(--fg-subtle); font-size: var(--text-xs); font-weight: 600; }
.issue-body { margin-bottom: var(--s6); }
.issue-body .prose, .issue-comment-body { padding: var(--s4); }
.issue-section > h2 { margin: var(--s6) 0 var(--s3); }
.issue-comment-composer { margin-top: var(--s4); }
.issue-comment-composer .markdown-editor { margin-bottom: 0; }
.issue-main > .issue-section:first-child > h2 { margin-top: 0; }
.issue-comment { margin-bottom: var(--s3); }
.issue-comment .card-head { justify-content: flex-start; }
.issue-empty { margin: 0; padding: var(--s3) 0; }
.issue-timeline li { align-items: flex-start; }
.issue-sign-in { margin-top: var(--s6); }
.issue-meta { overflow: visible; }
.issue-meta-section { padding: var(--s4); }
.issue-meta-section + .issue-meta-section { border-top: 1px solid var(--border); }
.issue-meta h2, .issue-actions h2 {
  font-size: var(--text-sm);
  line-height: var(--lh-sm);
  margin: 0 0 var(--s3);
}
.issue-chips { display: flex; flex-wrap: wrap; gap: var(--s1); }
.issue-chip { display: inline-flex; align-items: center; gap: 6px; padding: 2px var(--s2); }
.issue-chip form { display: inline-flex; margin: 0; }
.chip-remove {
  border: 0;
  background: transparent;
  color: currentColor;
  cursor: pointer;
  font: inherit;
  line-height: 1;
  width: 12px;
  height: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  opacity: 0.72;
}
.chip-remove:hover { opacity: 1; }
.issue-meta-empty { color: var(--fg-subtle); font-size: var(--text-sm); margin: 0; }
.issue-meta-form { margin-top: var(--s3); }
.issue-meta-form .field-label { font-size: var(--text-sm); font-weight: 500; }
.issue-meta-control { display: flex; align-items: stretch; gap: var(--s2); }
.issue-meta-control .field-input { min-width: 0; }
.issue-meta-help { margin-top: var(--s3); }
.issue-actions { padding: var(--s4); }
.issue-actions form + form { margin-top: var(--s2); }
.issue-actions .btn { width: 100%; }

@media (max-width: 900px) {
  .work-item-layout { grid-template-columns: minmax(0, 1fr); }
  .work-item-sidebar { position: static; }
}

/* Code view */
.code { border: 1px solid var(--border); border-radius: var(--radius-md); overflow-x: auto; background: var(--bg-subtle); }
table.blob { border-collapse: collapse; width: 100%; }
table.blob td { padding: 0 var(--s3); vertical-align: top; }
table.blob td.ln {
  text-align: right; color: var(--fg-subtle); user-select: none;
  width: 1%; white-space: nowrap; font-variant-numeric: tabular-nums;
  border-right: 1px solid var(--border);
}
table.blob td.ln a { color: inherit; }
table.blob tr:target { background: color-mix(in srgb, var(--accent) 12%, transparent); }
table.blob pre { margin: 0; white-space: pre; }
.tok-k { color: var(--syntax-keyword); font-weight: 500; }
.tok-s { color: var(--syntax-string); }
.tok-c { color: var(--syntax-comment); font-style: italic; }
.tok-n { color: var(--syntax-number); }
.tok-nt, .tok-nb { color: var(--syntax-type); }
.tok-nf { color: var(--syntax-function); }
.tok-na, .tok-nd { color: var(--syntax-attribute); }
.tok-l, .tok-ntg { color: var(--syntax-constant); }
.tok-o { color: var(--syntax-operator); }
.tok-p, .tok-nn { color: var(--syntax-punctuation); }
.tok-nv { color: var(--fg); }
.tok-gi { color: var(--success); }
.tok-gd { color: var(--danger); }
.tok-gh { color: var(--accent); font-weight: 600; }

/* Diff */
.diff { position: relative; border: 1px solid var(--border); border-radius: var(--radius-md); margin-bottom: var(--s4); overflow: clip; }
.diff-head {
  position: sticky; top: 0; z-index: 2;
  background: var(--bg-subtle); padding: var(--s2) var(--s3);
  border-bottom: 1px solid var(--border);
  font-family: var(--font-code); font-size: var(--text-sm);
}
.diff-head { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; padding-right: 3.25rem; }
.diff-head form { margin-left: auto; font-family: var(--font-sans); }
summary.diff-head { cursor: pointer; }
.diff-file-review-action { position: absolute; z-index: 3; top: var(--s1); right: var(--s2); margin: 0; }
.diff-viewed-status { margin-left: auto; }
.diff-file-review-action .icon-button-wrap { display: block; }
.review-file-toggle { width: 2rem; height: 2rem; color: var(--fg-muted); }
.review-file-toggle.is-viewed { border-color: var(--success); color: var(--success); }
.review-file-toggle.is-changed { border-color: var(--warn); color: var(--warn); }
[data-review-file-error] { display: block; position: absolute; top: 100%; right: 0; width: max-content; max-width: min(24rem, 80vw); color: var(--danger); font-size: var(--text-xs); background: var(--bg); }
[data-review-file-error]:empty { display: none; }
.diff pre { margin: 0; padding: var(--s2) var(--s3); overflow-x: auto; }
.diff .add { background: var(--diff-add-bg); display: block; }
.diff .del { background: var(--diff-del-bg); display: block; }

/* Pull request diff table.
   Every colour below is a theme token. An earlier version hardcoded a light
   fallback on comment rows, which rendered light-on-light and was unreadable in
   dark mode. */
.diff-table { width: 100%; border-collapse: collapse; font-family: var(--font-code); font-size: var(--text-sm); line-height: var(--lh-sm); }
.diff-table td { padding: 0; vertical-align: top; }

.diff-hunk-head td { background: var(--bg-inset); color: var(--fg-subtle); padding: var(--s1) var(--s3); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }

.pr-edit-details[open] { flex: 1 0 100%; min-width: 0; }
.pr-edit-form { width: min(100%, 680px); margin-top: var(--s3); }
.title-edit-details { position: relative; flex: 0 0 auto !important; }
.title-edit-details > summary { list-style: none; }
.title-edit-details > summary::-webkit-details-marker { display: none; }
.title-edit-details .pr-edit-form {
  position: absolute; z-index: 12; top: 100%; left: 0; width: min(680px, calc(100vw - 48px));
  padding: var(--s4); background: var(--bg); box-shadow: var(--shadow-md);
}
.programmer-assignment-form { display: flex; align-items: center; gap: var(--s2); margin-top: var(--s2); }
.programmer-assignment-form .btn { width: 100%; min-width: 0; white-space: normal; }
.pr-tabs { display: flex; gap: 0; margin: var(--s6) 0 var(--s4); border-bottom: 1px solid var(--border-strong); overflow-x: auto; }
.pr-tabs a { display: inline-flex; align-items: center; gap: var(--s2); flex: 0 0 auto; padding: var(--s2) var(--s3); border-bottom: 2px solid transparent; color: var(--fg-muted); font-weight: 500; text-decoration: none; }
.pr-tabs a:hover { color: var(--fg); border-bottom-color: var(--border-strong); }
.pr-tabs a.active { color: var(--fg); border-bottom-color: var(--accent); }
.pr-tabs a span { min-width: 1.5em; padding: 0 var(--s1); border-radius: 999px; background: var(--bg-inset); color: var(--fg-subtle); font-size: var(--text-xs); text-align: center; font-variant-numeric: tabular-nums; }
.pr-panel { min-width: 0; min-height: clamp(20rem, 42vh, 32rem); }
.pr-panel > h2 { margin-top: 0; }
.diff-style-switch { display: flex; justify-content: flex-end; gap: var(--s1); margin: 0 0 var(--s3); }
.diff-style-switch a { padding: var(--s1) var(--s2); border-radius: var(--radius-sm); color: var(--fg-muted); font-size: var(--text-sm); }
.diff-style-switch a[aria-current="page"] { background: var(--bg-inset); color: var(--fg); font-weight: 600; }
.pr-summary { padding: 0; }
.work-item-sidebar-section + .work-item-sidebar-section { border-top: 1px solid var(--border-strong); }
.work-item-sidebar-section-head { padding: var(--s4) var(--s4) 0; }
.work-item-sidebar-section-head h2 { margin: 0; padding: 0; background: transparent; font-size: var(--text-md); }
.work-item-sidebar-section-body { padding: var(--s3) var(--s4) var(--s4); }
.pr-summary-row { display: flex; justify-content: space-between; gap: var(--s3); padding: var(--s2) 0; border-top: 1px solid var(--border); }
.pr-summary-row > span:first-child { color: var(--fg-subtle); }
.pr-summary-section { border-top: 1px solid var(--border); padding-top: var(--s3); margin-top: var(--s2); }
.pr-summary-section h3 { margin: 0 0 var(--s2); font-size: var(--text-sm); }
.pr-reviews { display: grid; gap: var(--s2); }
.pr-review { display: grid; grid-template-columns: minmax(130px, auto) minmax(0, 1fr) auto; align-items: start; gap: var(--s3); padding: var(--s3) var(--s4); }
.pr-review.agent-authored { border-left: 3px solid var(--agent); }
.pr-review-body { min-width: 0; }
.pr-review-body > strong { color: var(--fg-muted); }
.pr-review-content { margin-top: var(--s1); color: var(--fg); font-size: var(--text-sm); }
.pr-review-time { color: var(--fg-subtle); font-size: var(--text-sm); white-space: nowrap; }
.pr-merge p { margin: 0 0 var(--s3); font-size: var(--text-sm); }
.pr-merge form { display: grid; gap: var(--s2); }
.pr-merge .field-input { width: 100%; }
.pr-merge .btn { width: 100%; margin-top: var(--s1); }
.pr-merge-blocker { padding: var(--s2); border-left: 3px solid var(--danger); background: color-mix(in srgb, var(--danger) 12%, var(--bg-subtle)); color: var(--fg); }
.merge-readiness-list { margin: 0; padding: 0; list-style: none; }
.merge-readiness-list li { padding: var(--s3) 0; border-bottom: 1px solid var(--border); }
.merge-readiness-list li:first-child { padding-top: 0; }
.merge-readiness-list li > div { display: flex; align-items: center; gap: var(--s2); }
.merge-readiness-list p { margin: var(--s1) 0 0; color: var(--fg-muted); font-size: var(--text-xs); line-height: var(--lh-sm); }
.merge-readiness-list a { display: inline-block; margin-top: var(--s1); font-size: var(--text-xs); }
.merge-readiness-list form { margin-top: var(--s2); }
.merge-readiness-blocked { background: color-mix(in srgb, var(--danger) 5%, transparent); }
.merge-readiness-empty { margin: 0; color: var(--fg-muted); font-size: var(--text-sm); }
.merge-readiness-ready { display: flex; align-items: center; gap: var(--s3); padding: var(--s3); border: 1px solid color-mix(in srgb, var(--success) 45%, var(--border)); border-radius: var(--radius-md); background: color-mix(in srgb, var(--success) 10%, var(--bg)); }
.merge-readiness-ready-icon { display: inline-grid; width: 1.75rem; height: 1.75rem; flex: 0 0 auto; place-items: center; border-radius: 50%; background: var(--success); color: var(--bg); font-weight: 800; }
.merge-readiness-ready > div { display: grid; gap: 1px; }
.merge-readiness-ready strong { color: var(--success); }
.merge-readiness-ready > div > span { font-size: var(--text-xs); }
.pr-readiness-section #pr-reviewer-picker-trigger { margin-top: var(--s3); }
.pr-ci-summary { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); font-size: var(--text-sm); }
.pr-ci-summary .status { min-width: 0; }
.pr-ci-summary .status-adjacent { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pr-ci-empty { margin: var(--s3) 0 0; font-size: var(--text-sm); }
.pr-ci-checks { margin: var(--s3) 0 0; padding: 0; list-style: none; }
.pr-ci-checks li { padding: var(--s2) 0; border-top: 1px solid var(--border); }
.pr-ci-check-heading { display: flex; align-items: center; gap: var(--s2); min-width: 0; }
.pr-ci-check-heading > a,
.pr-ci-check-heading > strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pr-ci-checks p { margin: var(--s1) 0 0 calc(1em + var(--s2)); font-size: var(--text-xs); line-height: var(--lh-sm); }
.pr-ci-required { margin-left: auto; color: var(--fg-subtle); font-size: var(--text-xs); }
.pr-ci-all-runs { display: inline-block; margin-top: var(--s3); font-size: var(--text-sm); }
.pr-labels-section .label-picker-summary { justify-content: space-between; }
.pr-labels-section .issue-chips { min-width: 0; }
.label-picker-edit-icon { display: inline-block; font-size: 1rem; line-height: 1; transform: translateY(-1px); }
.pr-retarget-form { width: 100%; display: grid; gap: var(--s2); }
.pr-retarget-form .field { margin: 0; }
.pr-retarget-form .btn { justify-self: start; }
.review-progress {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: var(--s3);
  min-height: 44px; margin: 0 0 var(--s4); padding: var(--s2) var(--s3);
  border: 1px solid var(--border); border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--bg) 94%, transparent); box-shadow: var(--shadow-sm);
  backdrop-filter: blur(8px);
}
.review-progress-meter { display: flex; align-items: center; gap: var(--s2); min-width: 0; }
.review-progress-meter strong { white-space: nowrap; font-size: var(--text-sm); font-variant-numeric: tabular-nums; }
.review-progress-meter progress { width: clamp(5rem, 16vw, 11rem); height: .4rem; accent-color: var(--success); }
.review-progress-unresolved { white-space: nowrap; font-size: var(--text-sm); }
.review-progress-navigation { display: flex; gap: var(--s1); margin-left: auto; }
.review-file-list { position: relative; }
.review-file-list-trigger { position: relative; display: inline-grid; place-items: center; width: 32px; height: 32px; padding: 0; list-style: none; border: 1px solid transparent; border-radius: var(--radius-sm); color: var(--fg-muted); cursor: pointer; }
.review-file-list-trigger:hover { border-color: var(--border-strong); color: var(--fg); }
.review-file-list-trigger:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.review-file-list > summary::-webkit-details-marker { display: none; }
.review-file-list > summary:hover .icon-button-tooltip,
.review-file-list > summary:focus .icon-button-tooltip { display: block; }
.review-file-list-popover {
  position: absolute; z-index: 8; top: calc(100% + var(--s2)); right: 0;
  width: min(32rem, calc(100vw - 2 * var(--s4))); max-height: min(65vh, 34rem);
  padding: var(--s3); overflow: auto;
  border: 1px solid var(--border-strong); border-radius: var(--radius-md);
  background: var(--bg); box-shadow: var(--shadow-lg);
}
.review-file-list-popover .field-input { width: 100%; margin-bottom: var(--s2); }
.review-file-list-popover ol { display: grid; gap: 1px; margin: 0; padding: 0; list-style: none; }
.review-file-list-popover li[hidden] { display: none; }
.review-file-list-popover a { display: grid; grid-template-columns: 1.25rem minmax(0, 1fr) auto; align-items: center; gap: var(--s2); padding: var(--s2); border-radius: var(--radius-sm); color: var(--fg); font-size: var(--text-sm); }
.review-file-list-popover a:hover { background: var(--bg-inset); text-decoration: none; }
.review-file-list-popover a > span:nth-child(2) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.review-file-state { color: var(--fg-muted); text-align: center; }
[data-review-file-entry][data-viewed="true"] .review-file-state { color: var(--success); }
#files-panel:has(.review-progress) .diff-head { top: 48px; }
.review-navigation { display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap; margin: 0 0 var(--s4); font-size: var(--text-sm); }
.review-navigation details { margin-left: auto; }
.review-navigation details p { margin: var(--s2) 0 0; color: var(--fg-muted); }
.review-thread-filters { display: flex; gap: var(--s3); margin: 0 0 var(--s3); font-size: var(--text-sm); }
.review-thread-filters a[aria-current="page"] { color: var(--fg); font-weight: 600; text-decoration: underline; text-underline-offset: 4px; }
.review-thread-disclosure, .review-thread-expanded { width: 100%; color: var(--fg); font-family: var(--font-sans); }
.review-thread-disclosure > .disclosure-summary {
  padding: var(--s2) var(--s3); background: color-mix(in srgb, var(--success) 5%, var(--bg-subtle));
}
.review-thread-disclosure[open] > .disclosure-summary { border-bottom: 1px solid var(--border); }
.outdated-review-thread-body { display: flex; align-items: center; gap: var(--s2); }
.change-cycle-summary { padding: var(--s3); border-left: 3px solid var(--attention); background: var(--bg-subtle); }
.draft-review-summary { margin-bottom: var(--s3); padding: var(--s3); border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--bg-subtle); }
.draft-review-summary p { margin: var(--s1) 0; }
.draft-review-summary ul { margin: var(--s2) 0 0; padding-left: var(--s4); }
.diff[id^="file-"] { scroll-margin-top: var(--s4); }

.programmer-event-details { margin: var(--s2) 0 0; }
.programmer-current-activity { margin-bottom: var(--s6); padding: var(--s4); overflow: hidden; }
.programmer-current-activity-attention { border-color: var(--warn); box-shadow: inset 3px 0 0 var(--warn); }
.programmer-activity-header { display: flex; gap: var(--s3); align-items: flex-start; justify-content: space-between; margin-bottom: var(--s4); }
.programmer-activity-header h2 { margin: 0; }
.programmer-activity-eyebrow { margin: 0 0 var(--s1); color: var(--fg-subtle); font-size: var(--text-xs); font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.programmer-activity-warning { margin: 0 0 var(--s4); padding: var(--s3) var(--s4); border: 1px solid color-mix(in srgb, var(--warn) 45%, var(--border)); border-radius: var(--radius-md); background: color-mix(in srgb, var(--warn) 8%, var(--bg)); }
.programmer-activity-warning p { margin: var(--s1) 0 0; }
.programmer-activity-facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; margin: 0 0 var(--s5); overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--border); }
.programmer-activity-facts > div { min-width: 0; padding: var(--s3); background: var(--bg-subtle); }
.programmer-activity-facts dt, .programmer-activity-signals dt { color: var(--fg-subtle); font-size: var(--text-xs); }
.programmer-activity-facts dd { margin: var(--s1) 0 0; overflow-wrap: anywhere; font-weight: 600; }
.programmer-activity-columns { display: grid; grid-template-columns: minmax(0, 2fr) minmax(240px, 1fr); gap: var(--s6); }
.programmer-activity-columns h3 { margin: 0 0 var(--s3); font-size: var(--text-sm); }
.programmer-activity-epochs { margin: 0; padding: 0; list-style: none; }
.programmer-activity-epochs li { display: grid; grid-template-columns: 12px minmax(0, 1fr); gap: var(--s3); padding: var(--s2) 0; }
.programmer-activity-epochs li + li { border-top: 1px solid var(--border); }
.programmer-activity-epochs div { display: grid; grid-template-columns: minmax(110px, auto) minmax(0, 1fr); gap: var(--s2); }
.programmer-activity-epochs span, .programmer-activity-epochs small { color: var(--fg-muted); font-size: var(--text-sm); }
.programmer-activity-epochs small { grid-column: 1 / -1; overflow-wrap: anywhere; }
.programmer-epoch-dot { width: 9px; height: 9px; margin-top: 5px; border: 2px solid var(--fg-subtle); border-radius: 50%; }
.programmer-epoch-progress { border-color: var(--success); background: var(--success); }
.programmer-epoch-unchanged { border-color: var(--warn); }
.programmer-activity-signals { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s3); margin: 0; }
.programmer-activity-signals div { padding: var(--s2); border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-subtle); }
.programmer-activity-signals dd { margin: var(--s1) 0 0; font-variant-numeric: tabular-nums; font-weight: 700; }
.programmer-activity-errors { display: grid; gap: var(--s1); margin: var(--s3) 0 0; padding: 0; color: var(--danger); font-size: var(--text-sm); list-style: none; }
.programmer-steer-panel { margin-bottom: var(--s6); padding: var(--s4); }
.programmer-steer-intro { margin-bottom: var(--s3); }
.programmer-steer-intro h2 { margin: 0 0 var(--s1); font-size: var(--text-md); }
.programmer-steer-intro p { margin: 0; color: var(--fg-muted); font-size: var(--text-sm); }
.programmer-steer-panel form { display: grid; gap: var(--s3); }
.programmer-steer-panel form > .btn { justify-self: start; }
.programmer-technical-log { margin: var(--s6) 0; }
.programmer-technical-log > .disclosure-summary {
  padding: var(--s2) 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
}
.programmer-technical-log > .programmer-timeline,
.programmer-technical-log > .empty-state { margin-top: var(--s3); }
.programmer-event-details > div { display: grid; grid-template-columns: minmax(90px, 140px) minmax(0, 1fr); gap: var(--s3); padding: 2px 0; }
.programmer-event-details dt { color: var(--fg-subtle); }
.programmer-event-details dd { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.programmer-timeline { margin: 0; padding: 0; list-style: none; }
.programmer-timeline-event { position: relative; padding: var(--s3) var(--s4) var(--s3) 36px; }
.programmer-timeline-event + .programmer-timeline-event,
.programmer-timeline-gap + .programmer-timeline-event { border-top: 1px solid var(--border); }
.programmer-timeline-event::before {
  content: ""; position: absolute; left: 17px; top: 19px; width: 7px; height: 7px;
  border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px var(--bg-subtle);
}
.programmer-timeline-event::after {
  content: ""; position: absolute; left: 20px; top: 27px; bottom: -1px;
  width: 1px; background: var(--border-strong);
}
.programmer-timeline-event:last-child::after { display: none; }
.programmer-timeline-gap { padding: var(--s2) var(--s4) var(--s2) 36px; color: var(--fg-subtle); }
.programmer-timeline-event-head { display: flex; gap: var(--s3); align-items: baseline; }
.programmer-timeline-event-head time { margin-left: auto; }
.programmer-timeline-event pre { white-space: pre-wrap; overflow: auto; max-height: 260px; margin: var(--s2) 0 0; }

@media (max-width: 760px) {
  .programmer-activity-facts { grid-template-columns: 1fr 1fr; }
  .programmer-activity-columns { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 480px) {
  .programmer-current-activity { padding: var(--s4); }
  .programmer-activity-facts { grid-template-columns: minmax(0, 1fr); }
}

.label-picker-summary { display: flex; align-items: center; gap: var(--s2); min-width: 0; }
.label-picker-open { flex: 0 0 auto; }
.new-issue-label-field .label-picker-summary {
  justify-content: space-between; min-height: 42px; padding: var(--s2) var(--s3);
  border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--bg-subtle);
}
.new-issue-label-field .issue-chips { min-width: 0; }
.new-issue-label-field [data-label-summary-id][hidden],
.new-issue-label-field [data-label-picker-summary-chips][hidden],
.new-issue-label-field [data-label-picker-summary-empty][hidden] { display: none; }
.theque-dialog-open { overflow: hidden; }
.dialog-frame {
  position: fixed; inset: 0; z-index: 50; padding: var(--s6);
  align-items: center; justify-content: center;
}
.dialog-frame-fragment { display: none; }
.dialog-frame-fragment:target { display: flex; }
.dialog-frame-enhanced { display: flex; }
.dialog-frame-enhanced[hidden] { display: none; }
.dialog-backdrop { position: absolute; inset: 0; background: rgb(0 0 0 / 0.62); }
/* The fragment target receives programmatic focus for accessibility. Its default
 * browser outline cuts across the dialog heading; the close button and form
 * controls retain their ordinary visible focus treatment. */
.dialog-frame:focus { outline: none; }
.dialog-frame:focus .dialog-panel {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 45%, transparent), var(--shadow-lg);
}
.dialog-panel {
  position: relative;
  width: min(440px, 100%); max-height: min(640px, calc(100vh - 48px)); overflow: auto;
  padding: var(--s4); border: 1px solid var(--border-strong); border-radius: var(--radius-lg);
  background: var(--bg); box-shadow: var(--shadow-lg);
}
.modal-panel { width: min(440px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); margin-bottom: var(--s3); }
.dialog-panel > .modal-head { background: transparent; border: 0; box-shadow: none; }
.modal-title { margin: 0; padding: 0; background: transparent; font-size: var(--text-lg); }
.label-picker-options { display: grid; gap: var(--s2); max-height: 22rem; overflow-y: auto; padding: 2px; }
.label-picker-option {
  position: relative; display: grid; grid-template-columns: 40px minmax(0, 1fr) 22px;
  gap: var(--s3); align-items: center; min-height: 58px; padding: var(--s3);
  overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius-md);
  background: var(--bg-subtle); cursor: pointer;
}
.label-picker-option::before {
  content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--label-color);
  opacity: 0.55;
}
.label-picker-option:hover { border-color: var(--border-strong); background: var(--bg-inset); }
.label-picker-option:focus-within { outline: 2px solid var(--accent); outline-offset: 1px; }
.label-picker-option:has(.label-picker-input:checked) {
  border-color: var(--label-color);
  background: color-mix(in srgb, var(--label-color) 9%, var(--bg-subtle));
  box-shadow: inset 3px 0 0 var(--label-color);
}
.label-picker-option:has(.label-picker-input:checked)::before { opacity: 1; }
.label-picker-swatch {
  display: grid; place-items: center; width: 40px; height: 40px;
  border: 1px solid color-mix(in srgb, var(--label-color) 70%, var(--border));
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--label-color) 14%, var(--bg)); color: var(--label-color);
}
.label-picker-swatch svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.label-picker-swatch circle { fill: currentColor; stroke: none; }
.label-picker-copy { display: grid; gap: 2px; min-width: 0; }
.label-picker-copy strong { overflow: hidden; color: var(--fg); text-overflow: ellipsis; white-space: nowrap; }
.label-picker-copy small { overflow: hidden; color: var(--fg-subtle); text-overflow: ellipsis; white-space: nowrap; }
.label-picker-selection {
  display: grid; place-items: center; width: 20px; height: 20px;
  border: 1px solid var(--border-strong); border-radius: 50%; color: var(--label-color);
  background: var(--bg);
}
.label-picker-selection svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; opacity: 0; }
.label-picker-option:has(.label-picker-input:checked) .label-picker-selection { border-color: var(--label-color); }
.label-picker-option:has(.label-picker-input:checked) .label-picker-selection svg { opacity: 1; }
.label-picker-actions { display: flex; justify-content: flex-end; gap: var(--s2); margin-top: var(--s4); }
@media (max-width: 560px) {
  .new-issue-label-field .label-picker-summary { align-items: stretch; flex-direction: column; }
  .new-issue-label-field .label-picker-open { justify-content: center; width: 100%; }
}
.reviewer-picker-form { display: grid; gap: var(--s2); }
.reviewer-picker-form .field-input { width: 100%; }
.reviewer-picker-human { display: grid; gap: var(--s2); }
.reviewer-picker-human > .field-help { margin: calc(-1 * var(--s1)) 0 0; }
.reviewer-candidates { display: grid; max-height: 16rem; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--radius-md); }
.reviewer-candidate { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: var(--s2); padding: var(--s2) var(--s3); cursor: pointer; }
.reviewer-candidate + .reviewer-candidate { border-top: 1px solid var(--border); }
.reviewer-candidate:hover { background: var(--bg-inset); }
.reviewer-candidate .checkbox-field { min-width: 0; margin: 0; }
.reviewer-candidate .checkbox-field > label { width: 100%; }
.reviewer-candidate .field-help { margin: var(--s1) 0 0 calc(1rem + var(--s2)); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reviewer-candidates [data-reviewer-empty] { margin: 0; padding: var(--s3); color: var(--fg-muted); font-size: var(--text-sm); }
.modal-actions { display: flex; justify-content: flex-end; gap: var(--s2); margin-top: var(--s2); }

.lazy-modal-panel {
  width: min(640px, 100%); max-height: min(720px, calc(100vh - 48px));
}
.branch-switcher-modal [data-lazy-modal-content] { display: grid; gap: var(--s4); }
.branch-page { max-width: 720px; }
.branch-page .page-header {
  display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s4);
  margin: 0 0 var(--s4);
}
.branch-page .page-header > div { min-width: 0; }
.branch-filter-form {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--s2);
  align-items: end; padding: var(--s3); border: 1px solid var(--border);
  border-radius: var(--radius-md); background: var(--bg-subtle);
}
.branch-filter-label { grid-column: 1 / -1; margin: 0; }
.branch-filter-input { width: 100%; min-width: 0; }
.branch-options {
  max-height: min(480px, 55vh); overflow-y: auto; list-style: none;
  margin: 0; padding: 0; border: 1px solid var(--border);
  border-radius: var(--radius-md); background: var(--bg);
}
.branch-options > li + li { border-top: 1px solid var(--border); }
.branch-option {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: var(--s2);
  align-items: center; min-height: 40px; padding: var(--s2) var(--s3);
  color: var(--fg); text-decoration: none;
}
.branch-option:hover,
.branch-option:focus-visible { background: var(--bg-inset); text-decoration: none; }
.branch-option:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.branch-option[aria-current="page"] {
  background: color-mix(in srgb, var(--accent) 9%, var(--bg));
}
.branch-option-icon { width: 1em; color: var(--fg-subtle); }
.branch-option-name {
  overflow: hidden; color: inherit; font-family: var(--font-code);
  font-size: var(--text-sm); font-weight: 500; text-overflow: ellipsis;
  white-space: nowrap;
}
.branch-current-marker { color: var(--accent); }
.branch-options-empty { border: 0; margin: 0; }
.branch-page .branch-options { max-height: min(600px, 65vh); margin-top: var(--s3); }

@media (max-width: 520px) {
  .branch-filter-form { grid-template-columns: minmax(0, 1fr); }
  .branch-filter-label { grid-column: auto; }
}

.comment-replies { margin: var(--s3) 0 0 var(--s4); border-left: 2px solid var(--border); }
.comment-replies.is-empty { display: none; }
.comment-reply { padding: var(--s3); background: color-mix(in srgb, var(--bg-inset) 55%, transparent); }
.comment-reply + .comment-reply { border-top: 1px solid var(--border); }
.comment-reply header { display: flex; align-items: center; gap: var(--s2); }
.comment-reply-composer { color: var(--fg-muted); }
.content-block > .comment-reply-composer { margin: var(--s2) var(--s4) 0; }
.diff-comment-body > .comment-reply-composer { margin: var(--s2) 0 0; }
.comment-reply-composer > summary { cursor: pointer; width: max-content; }
.comment-reply-composer form { margin-top: var(--s2); color: var(--fg); }
.pr-commit-list { overflow: hidden; }
.pr-commit-row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--s4);
  align-items: center; padding: var(--s3) var(--s4);
}
.pr-commit-row > div { min-width: 0; }
.pr-commit-row + .pr-commit-row { border-top: 1px solid var(--border); }
.comment-edit-form { display: none; margin: var(--s2) var(--s4) var(--s4); }
.comment-edit-form:target { display: block; }

@media (max-width: 900px) {
  .pr-review { grid-template-columns: minmax(120px, auto) minmax(0, 1fr); }
  .pr-review-time { grid-column: 2; }
}

@media (max-width: 640px) {
  .review-progress { gap: var(--s2); }
  .review-progress-meter progress { width: clamp(3rem, 18vw, 6rem); }
  .review-progress-unresolved,
  .review-progress-navigation .icon-btn[aria-label="Previous unviewed file"] { display: none; }
  .review-file-list-popover { position: fixed; top: 3.5rem; right: var(--s3); left: var(--s3); width: auto; }
}

/* Line numbers: fixed, narrow, non-selectable so copying a diff yields code. */
.diff-lineno { width: 1%; min-width: 3rem; text-align: right; padding: 0 var(--s2) !important; color: var(--fg-subtle); user-select: none; white-space: nowrap; }
.diff-lineno a { display: block; color: inherit; text-decoration: none; }
.diff-lineno a:hover { color: var(--accent); text-decoration: underline; }
.diff-lineno:target {
  scroll-margin-top: 2.5rem;
  color: var(--fg);
  background: color-mix(in srgb, var(--accent) 24%, transparent);
}
.diff-row:has(.diff-lineno:target) { box-shadow: inset 3px 0 0 var(--accent); }
.diff-marker { width: 1ch; text-align: center; color: var(--fg-subtle); user-select: none; }
.diff-content { width: 100%; }
.diff-content pre { padding: 0 var(--s2) !important; white-space: pre-wrap; word-break: break-word; }

.diff-row.diff-add > :is(.diff-lineno, .diff-gutter, .diff-marker) { background: var(--diff-add-bg); }
.diff-row.diff-del > :is(.diff-lineno, .diff-gutter, .diff-marker) { background: var(--diff-del-bg); }
.diff-table-split { table-layout: auto; }
.diff-table-split .diff-content { width: 50%; }
.diff-table-split .diff-split-old { border-right: 1px solid var(--border-strong); }
.diff-table-split :is(.diff-lineno, .diff-gutter, .diff-marker).diff-add { background: var(--diff-add-bg); }
.diff-table-split :is(.diff-lineno, .diff-gutter, .diff-marker).diff-del { background: var(--diff-del-bg); }
.diff-table-split .diff-empty { background: var(--bg-subtle); }

/* The comment affordance. Hidden until the row is hovered or something inside it
   takes focus — :focus-within is what keeps it keyboard-reachable, since BRAND.md
   §7 requires these not be hover-only. */
.diff-gutter { width: 1%; padding: 0 !important; }
.diff-comment-add {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; margin: 1px 2px;
  border-radius: var(--radius-sm);
  background: var(--accent); color: #fff;
  font-weight: 600; line-height: 1; text-decoration: none;
  opacity: 0; transition: opacity 80ms ease-in;
}
.diff-row:hover .diff-comment-add,
.diff-row:focus-within .diff-comment-add,
.diff-split-row:hover .diff-comment-add,
.diff-split-row:focus-within .diff-comment-add { opacity: 1; }
.diff-comment-add:focus { opacity: 1; outline: 2px solid var(--accent); outline-offset: 1px; }

/* Comment rows read as prose, not code: proportional type at body size. */
.diff-comment > td, .diff-comment-form > td { width: 100%; background: var(--bg-subtle); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.diff-comment-body { font-family: var(--font-sans); font-size: var(--text-sm); line-height: var(--lh-sm); color: var(--fg); padding: var(--s3); }
.diff-comment-head { display: flex; align-items: center; gap: var(--s2); margin-bottom: var(--s1); color: var(--fg); }
.diff-comment-text { color: var(--fg); }
.diff-comment-text :is(p, ul, ol) { margin: var(--s1) 0; }
.diff-comment-text code { background: var(--bg-inset); border-radius: var(--radius-sm); padding: 0 var(--s1); }
.diff-comment-actions { display: flex; gap: var(--s2); margin-top: var(--s2); }

.suggestion { border: 1px solid var(--border); border-radius: var(--radius-md); margin-top: var(--s2); overflow: hidden; }
.suggestion-head { background: var(--bg-inset); color: var(--fg-muted); font-size: var(--text-xs); padding: var(--s1) var(--s2); border-bottom: 1px solid var(--border); }
.suggestion-body { margin: 0; padding: var(--s2); font-family: var(--font-code); font-size: var(--text-sm); color: var(--fg); background: var(--diff-add-bg); overflow-x: auto; }

/* The form is revealed by the gutter link via :target — no JavaScript. */
.diff-comment-form { display: none; }
.diff-comment-form:target { display: table-row; }

/* Edit and delete, on your own comments only. Pushed to the right of the header
   so they do not compete with the author's name. */
.diff-comment-tools { margin-left: auto; display: flex; align-items: center; gap: var(--s2); font-size: var(--text-xs); }
.diff-comment-tools a, .diff-comment-tools .linklike { color: var(--fg-subtle); text-decoration: none; }
.diff-comment-tools a:hover, .diff-comment-tools .linklike:hover { color: var(--accent); text-decoration: underline; }

/* A button that reads as a link: deleting must be a POST for CSRF, but it should
   not look like a primary action sitting next to Edit. */
.linklike { background: none; border: none; padding: 0; font: inherit; cursor: pointer; }

.diff-comment-edit { display: none; margin-top: var(--s2); }
.diff-comment-edit:target { display: block; }

.badge { font-size: var(--text-xs); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 0 var(--s1); color: var(--fg-muted); }
/* An unscoped secret is readable by every branch build. Marked rather than left
   neutral, since that is the permissive case and the one worth noticing. */
.badge-warn { border-color: var(--warn); color: var(--warn); }

/* Branch selector (issue #14). A normal link defers the expensive ref walk to a
   dedicated server-rendered page and still works with JavaScript disabled. */
.branch-select {
  display: inline-flex;
  align-items: center;
  gap: var(--s1);
  padding: var(--s1) var(--s2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--fg);
  text-decoration: none;
}
.branch-select:hover { border-color: var(--accent); }
.branch-select-menu a.current::before { content: "✓ "; }
.flash { padding: var(--s3); border-radius: var(--radius-md); margin-bottom: var(--s4); }
.flash-info { background: var(--bg-subtle); border: 1px solid var(--border); }
.flash-error { background: var(--diff-del-bg); border: 1px solid var(--danger); }
/* A decision that stopped something on purpose, which is neither an error nor
   neutral information — a declined run is a working outcome. */
.flash-warn { background: var(--bg-subtle); border: 1px solid var(--warn); }
.muted { color: var(--fg-subtle); }
.timestamp { color: var(--fg-subtle); }
h1 { font-size: var(--text-xl); line-height: var(--lh-xl); margin: 0 0 var(--s3); }
h2 { font-size: var(--text-lg); line-height: var(--lh-lg); margin: var(--s6) 0 var(--s3); }
.breadcrumb { font-family: var(--font-code); font-size: var(--text-sm); }
.code-tree-head { min-width: 0; border: 1px solid var(--border); border-radius: 6px 6px 0 0; }
.code-tree-head .breadcrumb { flex: 0 1 auto; min-width: 0; }
.code-tree-head .code-tree-ref { flex-shrink: 0; }
.code-latest-commit-wrap { display: block; min-width: 4rem; max-width: min(42vw, 48ch); position: relative; }
.code-latest-commit { display: block; overflow: hidden; color: var(--fg-muted); text-overflow: ellipsis; white-space: nowrap; }
.code-latest-commit:hover { color: var(--fg); }
.code-latest-commit-wrap:hover .status-tooltip,
.code-latest-commit-wrap:focus-within .status-tooltip { display: block; }
.code-tree-head-spacer { flex: 1 1 auto; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* Drag-selected diff rows (issue #17). A left border rather than a background,
   so the add/delete colours underneath stay readable. */
.diff-row.diff-selected { box-shadow: inset 3px 0 0 var(--accent); }
.diff-gutter { cursor: pointer; user-select: none; }
/* Find-file modal (issue #16). Hidden until the enhancement script reveals it;
   `[hidden]` keeps it out of the layout and out of the accessibility tree for a
   reader with scripting off, who gets the full-page finder instead. */
.finder { align-items: flex-start; }
.finder-panel {
  width: min(640px, 100%);
  margin-top: 10vh;
}
.finder-input { font-family: var(--font-code); }
.finder-results { list-style: none; margin: var(--s2) 0 0; padding: 0; max-height: 50vh; overflow-y: auto; }
.finder-results li { border-radius: var(--radius-sm); }
.finder-results a {
  display: block;
  padding: var(--s1) var(--s2);
  font-family: var(--font-code);
  font-size: var(--text-sm);
  color: var(--fg);
  text-decoration: none;
  /* Long paths truncate at the front, so the file name stays visible. */
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  direction: rtl;
  text-align: left;
}
.finder-results a:hover, .finder-results a:focus { background: var(--bg-inset); }
.finder-results li:first-child a { background: var(--bg-subtle); }
.finder-empty { padding: var(--s2); color: var(--fg-subtle); font-size: var(--text-sm); }
.finder-hint { font-size: var(--text-xs); margin: var(--s2) 0 0; }
/* Volume capacity bar (issue #13). A percentage read as a number is easy to
   dismiss; a bar that is visibly nearly full is not. */
.capacity-bar { height: 10px; background: var(--bg-inset); border-radius: var(--radius-sm); overflow: hidden; }
.capacity-fill { height: 100%; transition: width 120ms ease-out; }
.capacity-success { background: var(--success); }
.capacity-stale { background: var(--warn); }
.capacity-failure { background: var(--danger); }

/* Agentic Programmer repository dashboard. These are actual grid columns rather than
   flex children whose start position changes with labels such as Running,
   Awaiting you, and Budget reached. */
.programmer-launcher { width: 100%; margin-bottom: var(--s8); overflow: hidden; border: 1px solid var(--border-strong); border-radius: var(--radius-lg); background: var(--bg); }
.programmer-policy-note { display: flex; justify-content: space-between; gap: var(--s3); align-items: center; padding: var(--s3) var(--s6); border-bottom: 1px solid var(--border); background: var(--bg-subtle); color: var(--fg-subtle); font-size: var(--text-xs); }
.programmer-policy-note a { color: var(--fg-muted); font-weight: 650; }
.programmer-goal-wrap { padding: var(--s6) var(--s6) var(--s4); }
.programmer-goal-label { display: flex; gap: var(--s2); align-items: baseline; margin-bottom: var(--s2); }
.programmer-goal-label span { color: var(--fg-subtle); font-size: var(--text-sm); }
.programmer-goal, .programmer-steer {
  display: block;
  min-height: 8rem;
  line-height: var(--lh-base);
  resize: vertical;
}
.programmer-goal { min-height: 104px; padding: var(--s3); font-size: var(--text-md); background: var(--bg-subtle); }
.programmer-steer { min-height: 5.5rem; }
.programmer-context-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s3); margin: 0; padding: 0 var(--s6) var(--s4); }
.programmer-context-label,
.programmer-context-strip .field-label { color: var(--fg-subtle); font-size: var(--text-xs); }
.programmer-context-strip > div > div { font-size: var(--text-sm); }
.programmer-context-strip .field { margin: 0; }
.programmer-context-strip .field:has([data-branch-suggestions-url]) { position: relative; }
.programmer-branch-suspense { position: absolute; top: 2rem; right: var(--s2); display: inline-flex; align-items: center; }
.programmer-branch-suspense[hidden] { display: none; }
.suspense-spinner { display: block; width: 14px; height: 14px; border: 1.5px solid var(--border); border-top-color: var(--fg-muted); border-radius: 50%; animation: deferred-git-read-spin 700ms linear infinite; }
.programmer-context-strip select { font-size: var(--text-sm); }
.programmer-primary-params { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s3); padding: var(--s4) var(--s6); border-top: 1px solid var(--border); background: var(--bg-subtle); }
.programmer-primary-params .field { margin: 0; }
.programmer-advanced { border-top: 1px solid var(--border); background: var(--bg-subtle); }
.programmer-advanced .disclosure-summary { display: flex; gap: var(--s3); align-items: center; padding: var(--s3) var(--s6); color: var(--fg-muted); font-size: var(--text-sm); }
.programmer-advanced .disclosure-summary-meta { margin-left: auto; color: var(--fg-subtle); font-size: var(--text-xs); font-variant-numeric: tabular-nums; }
.programmer-launch-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--s3);
  padding: 0 var(--s6) var(--s4);
}
.programmer-cost-strip { display: flex; gap: var(--s6); align-items: flex-start; padding: var(--s4) var(--s6); border-top: 1px solid var(--border); }
.programmer-cost-strip > div { min-width: 144px; }
.programmer-cost-strip span, .programmer-cost-strip strong { display: block; }
.programmer-cost-strip span { color: var(--fg-subtle); font-size: var(--text-xs); }
.programmer-cost-strip strong { font-size: var(--text-lg); font-variant-numeric: tabular-nums; }
.programmer-cost-strip p { max-width: 58ch; margin: 0; color: var(--fg-muted); font-size: var(--text-sm); }
.programmer-action-bar { position: sticky; bottom: 0; display: flex; gap: var(--s3); align-items: center; padding: var(--s3) var(--s6); border-top: 1px solid var(--border-strong); background: var(--bg-inset); color: var(--fg-muted); font-size: var(--text-sm); }
.programmer-action-bar .btn { margin-left: auto; }
.programmer-action-bar kbd { padding: 2px 4px; border: 1px solid currentColor; border-radius: 3px; font: 11px var(--font-code); }
.agent-block { border-left: 3px solid var(--agent) !important; }
.programmer-session-list { margin: 0 0 var(--s6); }
.programmer-session-row {
  display: grid !important;
  grid-template-columns: 8.5rem minmax(0, 1fr) 8rem;
  align-items: center;
  gap: var(--s3) !important;
}
.programmer-session-state { width: 8.5rem; }
.programmer-session-summary { min-width: 0; }
.programmer-session-meta {
  justify-self: end;
  margin-left: 0;
  min-width: 8rem;
  text-align: right;
}
.programmer-credentials-card { max-width: 640px; margin-top: 24px; padding: 18px; }
.programmer-credential-list { margin: 0 0 18px; }
.programmer-credential-row {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) 8rem auto;
  align-items: center;
  gap: var(--s3) !important;
}
.programmer-credential-provider { text-transform: capitalize; }
.programmer-credential-delete { justify-self: end; margin: 0; }
.programmer-credential-fields {
  display: grid;
  grid-template-columns: 1fr 1fr 2fr;
  gap: var(--s3);
  align-items: start;
  margin-bottom: var(--s4);
}
.programmer-credential-fields .field { margin-bottom: 0; }
.programmer-policy-settings { max-width: 880px; margin-top: var(--s6); padding: 0; overflow: hidden; }
.programmer-policy-heading { display: flex; justify-content: space-between; gap: var(--s4); align-items: flex-start; padding: var(--s5) var(--s6); border-bottom: 1px solid var(--border); }
.programmer-policy-heading h2 { margin: 0 0 var(--s1); }
.programmer-policy-heading p { max-width: 62ch; margin: 0; color: var(--fg-muted); font-size: var(--text-sm); }
.programmer-policy-effective { flex: none; padding: var(--s1) var(--s2); border: 1px solid var(--border); border-radius: 999px; color: var(--fg-muted); font-size: var(--text-xs); }
.programmer-policy-mode { display: flex; gap: var(--s5); margin: 0; padding: var(--s4) var(--s6); border: 0; border-bottom: 1px solid var(--border); background: var(--bg-subtle); }
.programmer-policy-mode legend { float: left; margin-right: var(--s5); font-weight: 600; }
.programmer-policy-mode label { display: flex; gap: var(--s2); align-items: center; }
.programmer-policy-section { display: grid; grid-template-columns: minmax(180px, .8fr) minmax(0, 1.7fr); gap: var(--s6); padding: var(--s6); border-bottom: 1px solid var(--border); }
.programmer-policy-section h3 { margin: 0 0 var(--s1); font-size: var(--text-md); }
.programmer-policy-section > div:first-child p { margin: 0; color: var(--fg-muted); font-size: var(--text-sm); }
.programmer-model-choices { display: grid; gap: var(--s2); margin-bottom: var(--s4); }
.programmer-model-choices label { display: flex; gap: var(--s2); align-items: center; padding: var(--s2) var(--s3); border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg); }
.programmer-policy-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s3); }
.programmer-policy-grid .field { margin: 0; }
.programmer-policy-grid .checkbox-setting { align-self: end; min-height: 42px; display: flex; gap: var(--s2); align-items: center; }
.programmer-policy-advanced { margin-top: var(--s3); }
.programmer-policy-advanced .disclosure-summary { color: var(--fg-muted); font-size: var(--text-sm); }
.programmer-policy-advanced[open] .field { margin-top: var(--s3); }
.programmer-policy-advanced textarea { font-family: var(--font-code); font-size: var(--text-xs); }
.programmer-policy-actions { display: flex; gap: var(--s3); align-items: center; justify-content: flex-end; padding: var(--s4) var(--s6); background: var(--bg-inset); }
.programmer-policy-actions span { margin-right: auto; color: var(--fg-muted); font-size: var(--text-sm); }
.repo-nav-logo { width: 1.1rem; height: 1.1rem; display: block; flex: none; }

/* A pending Git read is transient system activity, never an empty state or a
   decision. Hold stable space, suppress sub-150ms flashes, and expose only a
   familiar suspense glyph. */
.deferred-git-read {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.deferred-git-read-spinner {
  display: block;
  flex: none;
  width: 22px;
  height: 22px;
  border: 2px solid var(--border);
  border-top-color: var(--fg-muted);
  border-radius: 50%;
  opacity: 0;
  animation:
    deferred-git-read-reveal 0s linear 150ms forwards,
    deferred-git-read-spin 700ms linear infinite;
}
.deferred-git-read-spinner-inline {
  width: 12px;
  height: 12px;
  border-width: 1.5px;
}
.pr-tabs a .deferred-git-read-spinner-inline {
  min-width: 12px;
  padding: 0;
  background: transparent;
}
@keyframes deferred-git-read-reveal { to { opacity: 1; } }
@keyframes deferred-git-read-spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  .deferred-git-read-spinner, .suspense-spinner {
    animation: deferred-git-read-reveal 0s linear 150ms forwards;
  }
}

@media (max-width: 700px) {
  .programmer-context-strip, .programmer-primary-params, .programmer-launch-grid { grid-template-columns: minmax(0, 1fr); }
  .programmer-context-strip { padding: 0 var(--s4) var(--s4); }
  .programmer-goal-wrap, .programmer-primary-params, .programmer-cost-strip, .programmer-action-bar { padding-left: var(--s4); padding-right: var(--s4); }
  .programmer-cost-strip, .programmer-action-bar { align-items: stretch; flex-direction: column; }
  .programmer-action-bar .btn { width: 100%; margin-left: 0; }
  .programmer-policy-heading, .programmer-policy-mode, .programmer-policy-actions { align-items: stretch; flex-direction: column; }
  .programmer-policy-effective { align-self: flex-start; }
  .programmer-policy-mode legend { float: none; margin: 0 0 var(--s2); }
  .programmer-policy-section { grid-template-columns: minmax(0, 1fr); gap: var(--s3); padding: var(--s4); }
  .programmer-policy-grid { grid-template-columns: minmax(0, 1fr); }
  .programmer-policy-actions .btn { width: 100%; }
  .programmer-session-row { grid-template-columns: 7.5rem minmax(0, 1fr); }
  .programmer-session-state { width: 7.5rem; }
  .programmer-session-meta {
    grid-column: 2;
    justify-self: start;
    min-width: 0;
    text-align: left;
  }
  .programmer-credential-row { grid-template-columns: minmax(0, 1fr) auto; }
  .programmer-credential-provider { grid-column: 1; }
  .programmer-credential-delete { grid-column: 2; grid-row: 1 / span 2; }
  .programmer-credential-fields { grid-template-columns: minmax(0, 1fr); }
}

/* Latest-run badge in the repository header (#163): one non-animated glyph.
   The link's accessible name and tooltip carry the complete state. */
.run-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  line-height: 1.6;
  text-decoration: none;
  white-space: nowrap;
}
/* Background on hover, NOT an underline. The badge is a pill with its own border
   and colour, so an underline adds no affordance — and it decorated the rotating
   spinner glyph too, so the underline spun with it. */
.run-badge:hover {
  text-decoration: none;
  background: var(--bg-inset);
}
.run-badge-success { color: var(--success); }
.run-badge-failure { color: var(--danger); }
.run-badge-running { color: var(--warn); }
.run-badge .status-icon { font-size: 1.05em; }


/* Stripe Elements mount point.
   The iframe styles only its own text (see billing.js); the field's border,
   padding, and background are ours, or the input has no visible edges at all. */
.card-field {
  margin: 12px 0;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

/* Text for assistive technology only.
   Not `display:none` and not `visibility:hidden` — both remove the element from
   the accessibility tree, which is exactly the audience it exists for. This is
   the clip-rect idiom: present and announced, occupying no visual space. */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* The notification bell. Sized and aligned to match `.gear`, which sits beside
   it — two icon links of different optical weight read as a mistake. */
.bell {
  position: relative;
  display: inline-flex;
  align-items: center;
  color: var(--text);
}

.bell svg {
  width: 20px;
  height: 20px;
}

/* The unread marker. Deliberately paired with a count in the accessible name
   and the tooltip: a green dot alone is state encoded by colour (BRAND.md §6.3),
   which a colourblind reader or a screen reader gets nothing from. */
.bell-dot {
  position: absolute;
  top: -1px;
  right: -2px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success, #2e7d32);
  border: 1.5px solid var(--bg);
}

.agent-run-card {
  border: 1px solid var(--border); border-radius: 8px; padding: 1rem;
  background: var(--bg-subtle); margin-top: 1rem; overflow-wrap: anywhere;
}
.agent-run-card header, .agent-run-card-actions {
  display: flex; flex-wrap: wrap; align-items: center; gap: .75rem;
}
.agent-run-card p { margin: .65rem 0; }
.agent-run-connection { display: none; color: var(--muted); }
.pr-clank-status ul { list-style: none; padding: 0; margin: 0; }
.pr-clank-status li + li { border-top: 1px solid var(--border); padding-top: .75rem; margin-top: .75rem; }
.clank-status-heading { display: flex; align-items: center; gap: .45rem; }
.clank-goal { overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin: .35rem 0; }
.clank-status-error { color: var(--danger); font-size: .85rem; overflow-wrap: anywhere; }
.clank-request-badge { display: inline-flex; align-items: center; gap: .35rem; border: 1px solid var(--border); border-radius: 1rem; padding: .12rem .5rem; font-size: .75rem; white-space: nowrap; }
.clank-status-spinner { display: inline-block; width: .8rem; height: .8rem; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: clank-spin 1s linear infinite; }
@keyframes clank-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .clank-status-spinner { animation: none; } }
html[data-live-socket="disconnected"] .clank-status-spinner { animation-play-state: paused; }
html[data-live-socket="disconnected"] .agent-run-connection { display: block; }
.agent-flow-detail-panel > summary { cursor: pointer; padding: 1rem; font-weight: 600; }

/* Aperture component skin */
/*
 * This section is deliberately presentation-only. It may color, texture, and
 * elevate existing surfaces, but it must never alter their box geometry or
 * responsive flow. See BRAND.md §2.4 and the architecture regression test. */
header.site {
  background-color: color-mix(in srgb, var(--aperture-surface-raised) 92%, transparent);
  background-image: linear-gradient(90deg, transparent, var(--aperture-glow), transparent);
  border-color: var(--aperture-line);
  box-shadow: 0 1px 0 rgb(255 255 255 / 0.03), 0 10px 32px rgb(0 0 0 / 0.08);
  backdrop-filter: blur(18px) saturate(112%);
}

.card,
.content-block,
.meta-rail,
.dashboard-summary,
.list-table,
.issue-sidebar,
.pr-sidebar,
.repo-sidebar,
.onboarding-surface,
.programmer-launcher,
.programmer-steer-panel,
.programmer-assignment-form,
.settings-section,
.diff,
.review-progress,
.repository-path-next {
  background-color: var(--aperture-surface);
  background-image:
    linear-gradient(135deg, rgb(255 255 255 / 0.025), transparent 32%),
    radial-gradient(circle at 96% 0, var(--aperture-glow), transparent 26%);
  border-color: var(--aperture-line);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.025), 0 12px 36px rgb(0 0 0 / 0.055);
  backdrop-filter: blur(13px) saturate(108%);
}

.content-block-header,
.diff-head,
.list-row:first-child,
.meta-rail-heading,
.programmer-context-strip,
.programmer-cost-strip,
.programmer-action-bar {
  background-color: color-mix(in srgb, var(--aperture-surface-raised) 94%, transparent);
  background-image: linear-gradient(90deg, var(--aperture-line), transparent 38%);
  border-color: var(--aperture-line);
}

input,
select,
textarea,
.field-input,
.markdown-editor,
.card-field,
pre,
code,
.review-file-list-popover {
  background-color: color-mix(in srgb, var(--bg-inset) 93%, transparent);
  border-color: var(--aperture-line);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.02);
}

.btn {
  background-image: linear-gradient(180deg, rgb(255 255 255 / 0.055), transparent);
  border-color: color-mix(in srgb, var(--border-strong) 84%, var(--aperture-line));
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.055), 0 1px 2px rgb(0 0 0 / 0.16);
  transition: background-color 120ms ease, border-color 120ms ease, box-shadow 120ms ease, transform 120ms ease;
}
.btn:hover {
  background-color: color-mix(in srgb, var(--bg-inset) 86%, var(--accent));
  border-color: color-mix(in srgb, var(--accent) 48%, var(--border-strong));
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.08), 0 3px 10px rgb(0 0 0 / 0.14);
}
.btn-primary {
  color: var(--bg);
  background-color: var(--fg);
  border-color: color-mix(in srgb, var(--fg) 80%, var(--border-strong));
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.18), 0 4px 14px rgb(0 0 0 / 0.18);
}
.btn-danger {
  color: var(--blocked);
  border-color: color-mix(in srgb, var(--blocked) 58%, var(--border));
}

.dialog-backdrop {
  background-color: rgb(4 5 7 / 0.74);
  backdrop-filter: blur(10px) saturate(78%);
}
.dialog-panel,
.lazy-modal-panel,
.finder-panel {
  background-color: var(--aperture-surface-raised);
  background-image:
    linear-gradient(color-mix(in srgb, var(--aperture-surface-raised) 64%, transparent), color-mix(in srgb, var(--aperture-surface-raised) 64%, transparent)),
    url("/assets/aperture-accent-dialog-9dc3e5d0229dc83180073f145476aab3.webp?vsn=d"),
    radial-gradient(ellipse at 50% -18%, var(--aperture-glow), transparent 38%),
    linear-gradient(145deg, rgb(255 255 255 / 0.04), transparent 34%);
  background-position: center, right top, center, center;
  background-repeat: no-repeat;
  background-size: auto, min(11rem, 44%) auto, auto, auto;
  border-color: color-mix(in srgb, var(--border-strong) 76%, var(--aperture-line));
  box-shadow: 0 0 0 1px rgb(255 255 255 / 0.025), 0 28px 80px rgb(0 0 0 / 0.42);
  backdrop-filter: blur(22px) saturate(112%);
}
.modal-title {
  color: var(--fg);
  background: transparent;
  box-shadow: none;
}
.label-picker-option {
  background-color: color-mix(in srgb, var(--aperture-surface) 92%, transparent);
  background-image: linear-gradient(110deg, color-mix(in srgb, var(--label-color) 7%, transparent), transparent 34%);
  border-color: var(--aperture-line);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.025);
}

.agent-badge {
  color: var(--ai-interaction);
  background-color: color-mix(in srgb, var(--ai-interaction) 9%, transparent);
  border-color: color-mix(in srgb, var(--ai-interaction) 62%, var(--border));
  box-shadow: 0 0 14px color-mix(in srgb, var(--ai-interaction) 11%, transparent);
}
.agent-block,
.programmer-launcher,
.programmer-steer-panel,
.programmer-assignment-form {
  background-image:
    linear-gradient(color-mix(in srgb, var(--aperture-surface) 68%, transparent), color-mix(in srgb, var(--aperture-surface) 68%, transparent)),
    url("/assets/aperture-accent-ai-f65b1a8cb285d01df7ad47a5faf739f8.webp?vsn=d"),
    linear-gradient(135deg, rgb(255 255 255 / 0.02), transparent 34%);
  background-position: center, right top, center;
  background-repeat: no-repeat;
  background-size: auto, min(15rem, 36%) auto, auto;
  border-color: color-mix(in srgb, var(--ai-interaction) 42%, var(--border));
  box-shadow: inset 2px 0 0 color-mix(in srgb, var(--ai-interaction) 68%, transparent), 0 12px 36px rgb(0 0 0 / 0.055);
}
.agent-block > li:is(:hover, :focus-within, [aria-current="true"]) {
  background-color: color-mix(in srgb, var(--bg-subtle) 72%, transparent);
}
.programmer-launcher .btn-primary,
.programmer-steer-panel .btn-primary,
.programmer-assignment-form .btn-primary {
  color: var(--bg);
  background-color: var(--ai-interaction);
  border-color: color-mix(in srgb, var(--ai-interaction) 78%, white);
  box-shadow: 0 0 18px color-mix(in srgb, var(--ai-interaction) 14%, transparent);
}
@media (max-width: 760px) {
  .agent-block,
  .programmer-launcher,
  .programmer-steer-panel,
  .programmer-assignment-form {
    background-image:
      linear-gradient(color-mix(in srgb, var(--aperture-surface) 68%, transparent), color-mix(in srgb, var(--aperture-surface) 68%, transparent)),
      linear-gradient(135deg, rgb(255 255 255 / 0.02), transparent 34%);
    background-size: auto;
  }
}

.status-success,
.status-open,
.status-merged,
.merge-readiness-ready {
  color: var(--ready);
  text-shadow: 0 0 12px color-mix(in srgb, var(--ready) 16%, transparent);
}
.status-failure,
.status-blocked,
.merge-readiness-blocked {
  color: var(--blocked);
  text-shadow: 0 0 12px color-mix(in srgb, var(--blocked) 14%, transparent);
}
.status-attention,
.onboarding-progress li.current {
  color: var(--needs-interaction);
  text-shadow: 0 0 12px color-mix(in srgb, var(--needs-interaction) 14%, transparent);
}
.status-agent {
  color: var(--agent);
  text-shadow: 0 0 12px color-mix(in srgb, var(--agent) 14%, transparent);
}
.status-pending,
.status-queued,
.status-stale,
.run-badge-running {
  color: var(--in-progress);
  text-shadow: 0 0 12px color-mix(in srgb, var(--in-progress) 14%, transparent);
}
