@font-face {
  font-family: "IBM Plex Sans";
  src: url("/fonts/ibm-plex-sans-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "IBM Plex Sans";
  src: url("/fonts/ibm-plex-sans-600.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "IBM Plex Mono";
  src: url("/fonts/ibm-plex-mono-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

/* Carbon g100 tokens */
:root {
  color-scheme: dark;
  --background: #161616;
  --layer-01: #262626;
  --layer-02: #393939;
  --layer-hover-01: #333333;
  --layer-hover-02: #474747;
  --layer-selected-01: #393939;
  --field-01: #262626;
  --field-02: #393939;
  --border-subtle: #393939;
  --border-subtle-02: #525252;
  --border-strong: #6f6f6f;
  --border-interactive: #4589ff;
  --text-primary: #f4f4f4;
  --text-secondary: #c6c6c6;
  --text-helper: #a8a8a8;
  --text-placeholder: #6f6f6f;
  --text-disabled: #6f6f6f;
  --link: #78a9ff;
  --link-hover: #a6c8ff;
  --focus: #ffffff;
  --interactive: #4589ff;
  --primary: #0f62fe;
  --primary-hover: #0050e6;
  --primary-active: #002d9c;
  --secondary: #6f6f6f;
  --secondary-hover: #606060;
  --secondary-active: #393939;
  --danger: #da1e28;
  --danger-hover: #b81921;
  --danger-active: #750e13;
  --error: #fa4d56;
  --success: #42be65;
  --warning: #f1c21b;
  --info: #4589ff;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  --ease: cubic-bezier(0.2, 0, 0.38, 0.9);
  --scrollbar-thumb: #525252;
  --scrollbar-thumb-hover: #6f6f6f;
}

* {
  box-sizing: border-box;
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) transparent;
}

/* Firefox uses the standard properties above; WebKit allows a padded thumb. */
@supports selector(::-webkit-scrollbar) {
  * { scrollbar-width: auto; scrollbar-color: auto; }
  ::-webkit-scrollbar { width: 10px; height: 10px; }
  ::-webkit-scrollbar-track { background: transparent; }
  ::-webkit-scrollbar-thumb {
    border: 2px solid transparent;
    border-radius: 8px;
    background: var(--scrollbar-thumb);
    background-clip: padding-box;
  }
  ::-webkit-scrollbar-thumb:hover { background-color: var(--scrollbar-thumb-hover); }
  ::-webkit-scrollbar-corner { background: transparent; }
}

@media (forced-colors: active) {
  * { scrollbar-color: auto; scrollbar-width: auto; }
  ::-webkit-scrollbar-thumb { background-color: ButtonText; }
}

[hidden] { display: none !important; }

html, body {
  margin: 0;
  background: var(--background);
  color: var(--text-primary);
  font-family: "IBM Plex Sans", "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.43;
  letter-spacing: 0.16px;
}

button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }

code, pre, .mono, .event-raw, .cli {
  font-family: var(--mono);
  letter-spacing: 0;
}

code { font-size: 0.92em; }

a, .link { color: var(--link); text-decoration: none; }
a:hover, .link:hover { color: var(--link-hover); text-decoration: underline; }

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: -2px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

h1 { font-size: 28px; line-height: 36px; font-weight: 400; margin: 0; letter-spacing: 0; }
h2 { font-size: 16px; line-height: 24px; font-weight: 600; margin: 0; }
h3 { font-size: 14px; line-height: 20px; font-weight: 600; margin: 16px 0 8px; }

.lede { color: var(--text-secondary); margin: 4px 0 0; max-width: 72ch; }
.helper { color: var(--text-helper); font-size: 12px; line-height: 16px; letter-spacing: 0.32px; margin: 4px 0 0; }
.eyebrow { color: var(--text-secondary); font-size: 12px; margin: 0 0 4px; letter-spacing: 0.32px; }
.ellipsis { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* UI Shell header */
.shell-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: stretch;
  height: 48px;
  background: var(--background);
  border-bottom: 1px solid var(--border-subtle);
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 32px 0 16px;
  color: var(--text-primary);
  white-space: nowrap;
}
.brand:hover { color: var(--text-primary); text-decoration: none; background: var(--layer-hover-01); }
.brand-name { font-weight: 600; }
.brand-sub { font-weight: 400; color: var(--text-secondary); }

.mark {
  width: 16px;
  height: 16px;
  background:
    linear-gradient(var(--primary), var(--primary)) center / 16px 2px no-repeat,
    linear-gradient(var(--primary), var(--primary)) center / 2px 16px no-repeat;
  border: 1px solid var(--border-strong);
}

.shell-nav {
  position: relative;
  display: flex;
  padding-left: 16px;
  flex: 1;
  min-width: 0;
}
.shell-nav::before {
  content: "";
  position: absolute;
  left: 0;
  top: 12px;
  height: 24px;
  border-left: 1px solid var(--border-subtle);
}
.shell-nav a {
  position: relative;
  display: flex;
  align-items: center;
  padding: 0 16px;
  color: var(--text-secondary);
  white-space: nowrap;
}
.shell-nav a:hover { background: var(--layer-hover-01); color: var(--text-primary); text-decoration: none; }
.shell-nav a[aria-current="page"] { color: var(--text-primary); font-weight: 600; }
.shell-nav a[aria-current="page"]::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  border-bottom: 3px solid var(--border-interactive);
}

.shell-tools { display: flex; align-items: center; gap: 0; }
#conn { padding: 0 12px; }
#conn:empty { display: none; }

.mode-pill {
  display: inline-flex;
  margin: 0 16px;
  padding: 2px;
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  background: transparent;
  cursor: pointer;
  font-size: 12px;
  line-height: 16px;
}
.mode-pill:hover { border-color: var(--text-secondary); }
.mode-pill:disabled { opacity: 0.5; cursor: not-allowed; }
.mode-option { padding: 4px 10px; border-radius: 12px; color: var(--text-secondary); }
.mode-pill:not(.is-live) [data-mode="simulator"] { background: #6929c4; color: #e8daff; }
.mode-pill.is-live [data-mode="live"] { background: #0e6027; color: #a7f0ba; }
.run-mode { margin-bottom: 16px; }
.run-mode .mode-pill { margin: 0; }

.header-btn.btn { height: 48px; min-height: 48px; padding: 0 20px; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 0;
  background: var(--primary);
  color: #ffffff;
  cursor: pointer;
  white-space: nowrap;
  text-align: left;
  transition: background 70ms var(--ease), color 70ms var(--ease), border-color 70ms var(--ease);
}
.btn.primary { background: var(--primary); }
.btn.primary:hover { background: var(--primary-hover); }
.btn.primary:active { background: var(--primary-active); }
.btn.secondary { background: var(--secondary); }
.btn.secondary:hover { background: var(--secondary-hover); }
.btn.secondary:active { background: var(--secondary-active); }
.btn.tertiary { background: transparent; border-color: var(--text-primary); color: var(--text-primary); }
.btn.tertiary:hover { background: var(--text-primary); color: var(--background); }
.btn.ghost { background: transparent; color: var(--link); }
.btn.ghost:hover { background: var(--layer-hover-01); color: var(--link-hover); }
.btn.danger { background: var(--danger); }
.btn.danger:hover { background: var(--danger-hover); }
.btn.danger-ghost { background: transparent; color: #ff8389; }
.btn.danger-ghost:hover { background: var(--danger-hover); color: #ffffff; }
.btn.sm { min-height: 32px; padding: 0 12px; }
.btn.xs { min-height: 24px; padding: 0 8px; font-size: 12px; }
.btn:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; box-shadow: inset 0 0 0 3px var(--background); }
.btn:disabled, .btn:disabled:hover {
  background: var(--border-subtle-02);
  border-color: transparent;
  color: var(--text-disabled);
  cursor: not-allowed;
}
.btn.ghost:disabled, .btn.danger-ghost:disabled { background: transparent; }

.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 16px; }

/* Tags */
.tag {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 8px;
  border-radius: 12px;
  font-size: 12px;
  line-height: 16px;
  letter-spacing: 0.32px;
  white-space: nowrap;
  background: #525252;
  color: #e0e0e0;
}
.tag.red { background: #a2191f; color: #ffd7d9; }
.tag.magenta { background: #9f1853; color: #ffd6e8; }
.tag.purple { background: #6929c4; color: #e8daff; }
.tag.blue { background: #0043ce; color: #d0e2ff; }
.tag.cyan { background: #00539a; color: #bae6ff; }
.tag.teal { background: #005d5d; color: #9ef0f0; }
.tag.green { background: #0e6027; color: #a7f0ba; }
.tag.gray { background: #525252; color: #e0e0e0; }
.tag.cool-gray { background: #4d5358; color: #dde1e6; }
.tag.warm-gray { background: #565151; color: #e5e0df; }

/* Master-detail */
.split {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  min-height: calc(100vh - 48px);
}

.rail {
  position: sticky;
  top: 48px;
  height: calc(100vh - 48px);
  min-height: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--layer-01);
  border-right: 1px solid var(--border-subtle);
}
.rail-head { padding: 16px 16px 12px; border-bottom: 1px solid var(--border-subtle); }
.rail-title { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.rail-title h2 { flex: 0 0 auto; }
.rail-title .btn { margin-left: auto; }
.rail-head .task-collection-switcher { margin: 0 0 12px; }
.rail-head .task-collection-switcher .switch { display: flex; align-items: center; justify-content: space-between; gap: 8px; height: 36px; padding: 0 12px; }
.count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  background: var(--layer-02);
  color: var(--text-secondary);
  font-size: 12px;
}
.rail-list { flex: 1; min-height: 0; overflow: auto; overscroll-behavior-y: contain; }
.rail-section { padding: 16px 0 8px; }
.rail-section .rail-title { padding: 0 16px; margin-bottom: 8px; }
.rail-empty { padding: 24px 16px; color: var(--text-secondary); }
.rail-empty p { margin: 0 0 8px; }

.search input {
  width: 100%;
  height: 40px;
  padding: 0 16px 0 40px;
  border: 0;
  border-bottom: 1px solid var(--border-strong);
  background: var(--field-02) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32' fill='%23c6c6c6'%3E%3Cpath d='M29 27.586l-7.552-7.552a11.018 11.018 0 1 0-1.414 1.414L27.586 29zM4 13a9 9 0 1 1 9 9 9.01 9.01 0 0 1-9-9z'/%3E%3C/svg%3E") 12px center / 16px 16px no-repeat;
}
.search input::placeholder { color: var(--text-placeholder); }

.task-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
  padding: 12px 16px;
  border: 0;
  border-bottom: 1px solid var(--border-subtle);
  background: transparent;
  text-align: left;
  cursor: pointer;
}
.task-item:hover { background: var(--layer-hover-01); }
.task-item.is-selected { background: var(--layer-selected-01); box-shadow: inset 3px 0 0 var(--interactive); }
.task-item:focus-visible { outline-offset: -2px; }
.task-item-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.task-item-key { color: var(--text-secondary); font-size: 12px; }
.task-item-title {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.task-item-meta { color: var(--text-helper); font-size: 12px; line-height: 16px; min-width: 0; }

.detail { min-width: 0; padding: 24px 32px 48px; }
.detail > .notice { margin-bottom: 16px; }

/* Task header card */
.task-head {
  background: var(--layer-01);
  padding: 16px 24px 20px;
}
.task-ident { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.task-key { color: var(--text-secondary); }
.task-meta { color: var(--text-helper); font-size: 12px; }
.task-title { margin: 8px 0 20px; }

/* Progress indicator */
.stepper {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.step {
  display: flex;
  gap: 8px;
  min-width: 0;
  padding-top: 8px;
  border-top: 2px solid var(--border-subtle-02);
}
.step-icon {
  position: relative;
  flex: 0 0 16px;
  width: 16px;
  height: 16px;
  margin-top: 2px;
  border: 1px solid var(--text-helper);
  border-radius: 50%;
}
.step-text { display: flex; flex-direction: column; min-width: 0; }
.step-label { font-size: 14px; line-height: 20px; }
.step-sub { color: var(--text-helper); font-size: 12px; line-height: 16px; overflow-wrap: anywhere; }
.step.is-incomplete .step-label { color: var(--text-secondary); }

.step.is-complete, .step.is-active, .step.is-queued, .step.is-pending { border-top-color: var(--interactive); }
.step.is-complete .step-icon { border-color: var(--interactive); background: var(--interactive); }
.step.is-complete .step-icon::after {
  content: "";
  position: absolute;
  left: 4px;
  top: 1px;
  width: 4px;
  height: 8px;
  border: solid var(--background);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.step.is-queued .step-icon, .step.is-pending .step-icon {
  border-color: var(--interactive);
  background: linear-gradient(90deg, transparent 50%, var(--interactive) 50%);
}
.step.is-active .step-icon {
  border: 2px solid var(--interactive);
  border-right-color: transparent;
  animation: spin 900ms linear infinite;
}
.step.is-active .step-sub { color: var(--link); }
.step.is-waiting { border-top-color: #a56eff; }
.step.is-waiting .step-icon { border-color: #be95ff; background: radial-gradient(circle, #be95ff 0 3px, transparent 4px); }
.step.is-waiting .step-sub { color: #d4bbff; }
.step.is-paused { border-top-color: #ee5396; }
.step.is-paused .step-icon { border-color: #ff7eb6; background: linear-gradient(90deg, transparent 4px, #ff7eb6 4px 6px, transparent 6px 8px, #ff7eb6 8px 10px, transparent 10px) center / 14px 6px no-repeat; }
.step.is-paused .step-sub { color: #ffafd2; }
.step.is-error { border-top-color: var(--error); }
.step.is-error .step-icon { border-color: var(--error); background: var(--error); }
.step.is-error .step-icon::after {
  content: "!";
  position: absolute;
  inset: 0;
  color: var(--background);
  font-size: 11px;
  font-weight: 600;
  line-height: 14px;
  text-align: center;
}
.step.is-error .step-sub { color: #ff8389; }
.step.is-cancelled { border-top-color: var(--border-strong); }
.step.is-cancelled .step-icon { border-style: dashed; }

@keyframes spin { to { transform: rotate(360deg); } }

.latest {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 16px 0 0;
  min-width: 0;
  color: var(--text-secondary);
}
.latest-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.pulse {
  flex: 0 0 8px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--interactive);
  animation: pulse 1.4s var(--ease) infinite;
}
@keyframes pulse { 50% { opacity: 0.3; } }

/* Inline notifications */
.notices { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }
.notice {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 12px 16px;
  background: var(--layer-02);
  border-left: 3px solid var(--info);
}
.task-head .notice { background: var(--layer-02); }
.detail > .notice { background: var(--layer-01); }
.notice-info { border-left-color: var(--info); }
.notice-warning { border-left-color: var(--warning); }
.notice-error { border-left-color: var(--error); }
.notice-success { border-left-color: var(--success); }
.notice-text { flex: 1; min-width: 0; }
.notice-text strong { font-weight: 600; margin-right: 4px; }
.notice-action { flex: 0 0 auto; margin: -4px 0; }
.notice-detail {
  max-height: 160px;
  overflow: auto;
  margin: 8px 0 0;
  padding: 8px 12px;
  background: var(--background);
  font-size: 12px;
  line-height: 18px;
  white-space: pre-wrap;
  word-break: break-word;
  user-select: text;
}

.task-actions { margin-top: 20px; }
.switch-group { display: inline-flex; align-items: stretch; }
.compact-select {
  height: 40px;
  padding: 0 32px 0 12px;
  border: 0;
  border-bottom: 1px solid var(--border-strong);
  background: var(--field-02);
}

/* Tabs */
.tabs {
  display: flex;
  margin-top: 24px;
  border-bottom: 1px solid var(--border-subtle);
  overflow-x: auto;
  overflow-y: hidden;
}
.tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 48px;
  padding: 0 16px;
  border: 0;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
}
.tab:hover { color: var(--text-primary); border-bottom-color: var(--border-strong); }
.tab:focus-visible { outline-offset: -2px; }
.tab.is-selected { color: var(--text-primary); font-weight: 600; border-bottom-color: var(--border-interactive); }
.tab-count {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  background: var(--layer-02);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 400;
  line-height: 20px;
  text-align: center;
}

.tab-panel { padding-top: 16px; }

/* Panels */
.panel {
  background: var(--layer-01);
  padding: 16px 24px 24px;
  margin-bottom: 16px;
}
.panel-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-bottom: 4px; }
.panel-head h2 { margin-right: auto; }
.panel > h2 { margin-bottom: 4px; }

.placeholder {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  margin-top: 16px;
  padding: 24px;
  border: 1px dashed var(--border-strong);
  color: var(--text-secondary);
}
.placeholder p { margin: 0; max-width: 72ch; }
.placeholder .actions { margin-top: 12px; }
.placeholder .pulse { margin-bottom: 4px; }

.overview {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 16px;
  align-items: start;
}

.kv { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 8px 12px; margin: 12px 0 0; font-size: 14px; }
.kv dt { color: var(--text-helper); font-size: 12px; line-height: 20px; }
.kv dd { margin: 0; min-width: 0; word-break: break-word; }
.kv-wide { grid-template-columns: 96px minmax(0, 1fr) 96px minmax(0, 1fr); }

.description {
  max-height: 240px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text-secondary);
}

.repo-mini { margin: 0; padding: 0; list-style: none; }
.repo-mini li { display: flex; flex-direction: column; padding: 8px 0; border-bottom: 1px solid var(--border-subtle); }
.repo-mini li:last-child { border-bottom: 0; }

/* Fields */
.field { margin-top: 16px; min-width: 0; }
.field label {
  display: block;
  margin-bottom: 8px;
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 16px;
  letter-spacing: 0.32px;
}
.field input, .field select, .field textarea, textarea.code, .cell-input {
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--border-strong);
  border-radius: 0;
  background: var(--field-01);
  color: var(--text-primary);
}
.panel .field input, .panel .field select, .panel .field textarea, .panel textarea.code,
.modal .field input, .modal .field select, .modal .field textarea,
.advanced .field input { background: var(--field-02); }
.field input, .field select { height: 40px; padding: 0 16px; }
.field select, .compact-select, .cell-input:is(select) {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23f4f4f4'%3E%3Cpath d='M8 11 3 6l.7-.7L8 9.6l4.3-4.3.7.7z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  padding-right: 40px;
  cursor: pointer;
}
.field textarea, textarea.code {
  min-height: 120px;
  padding: 11px 16px;
  resize: vertical;
  line-height: 20px;
}
input::placeholder, textarea::placeholder { color: var(--text-placeholder); }
.field input:hover, .field select:hover, .field textarea:hover, .cell-input:hover { background-color: var(--layer-hover-02); }
.field input:focus, .field select:focus, .field textarea:focus, textarea.code:focus, .cell-input:focus, .search input:focus, .compact-select:focus {
  outline: 2px solid var(--focus);
  outline-offset: -2px;
}
textarea.code { font-family: var(--mono); font-size: 13px; letter-spacing: 0; }
textarea.spec-editor { display: block; min-height: 480px; margin-top: 16px; }
textarea.prompt-editor { display: block; min-height: 520px; }
textarea.pr-body { min-height: 160px; }

.grid-2, .grid-3, .grid-4 { display: grid; gap: 0 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr) minmax(0, 0.8fr); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.spec-read {
  max-height: 560px;
  overflow: auto;
  margin: 16px 0 0;
  padding: 12px 16px;
  background: var(--background);
  font-size: 13px;
  line-height: 20px;
  white-space: pre-wrap;
  word-break: break-word;
}

/* Diffs & PRs */
.repo-grid {
  display: grid;
  grid-template-columns: minmax(280px, 0.8fr) minmax(0, 1.2fr);
  gap: 24px;
  margin-top: 8px;
}
.pr-editor h3, .diff-view h3 { margin-top: 16px; }
.diff-view { min-width: 0; }
.diff-stat, .diff {
  margin: 8px 0 0;
  padding: 12px 0;
  background: var(--background);
  font-size: 12px;
  line-height: 18px;
  overflow: auto;
}
.diff-stat { padding: 8px 12px; max-height: 120px; white-space: pre; color: var(--text-secondary); }
.diff { max-height: 520px; white-space: pre; }
.d-line { display: block; padding: 0 12px; min-width: max-content; }
.d-add { background: rgba(36, 161, 72, 0.18); color: #a7f0ba; }
.d-del { background: rgba(218, 30, 40, 0.2); color: #ffb3b8; }
.d-hunk { color: #a6c8ff; background: rgba(69, 137, 255, 0.12); }
.d-file { color: var(--text-primary); font-weight: 600; }
.commits { margin: 8px 0 0; padding: 0; list-style: none; font-size: 12px; color: var(--text-secondary); }
.commits li { padding: 2px 0; }

.rework-grid { display: grid; grid-template-columns: minmax(0, 1fr) 200px; gap: 0 16px; align-items: start; }

/* Data table */
.table-wrap { overflow-x: auto; background: var(--layer-01); }
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; margin-top: 12px; }
.table-wrap .data-table { margin-top: 0; }
.data-table th, .data-table td {
  padding: 8px 16px;
  text-align: left;
  vertical-align: middle;
  border-bottom: 1px solid var(--border-subtle);
}
.data-table thead th {
  height: 48px;
  background: var(--layer-02);
  color: var(--text-primary);
  font-weight: 600;
  white-space: nowrap;
}
.data-table tbody tr { background: var(--layer-01); }
.data-table tbody tr:hover { background: var(--layer-hover-01); }
.data-table tbody th { font-weight: 400; }

.routing-table td, .routing-table tbody th { padding-top: 6px; padding-bottom: 6px; }
.routing-table tbody th { min-width: 200px; }
.route-name { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.route-key { color: var(--text-helper); font-size: 12px; }
.routing-table .btn.xs { margin: 4px 0 0 -8px; }
.cell-input { height: 32px; padding: 0 12px; background-color: var(--field-02); }
.routing-table td:nth-child(2) { width: 150px; }
.routing-table td:nth-child(3) { width: 220px; }
.routing-table td:nth-child(4) { width: 120px; }
.routing-table td:nth-child(5) { width: 96px; }
.cli-cell { max-width: 0; width: 34%; }
.cli {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-secondary);
  font-size: 12px;
}
.unsaved-tag, .cli-stale { display: none !important; }
tr.is-dirty { box-shadow: inset 3px 0 0 var(--warning); }
tr.is-dirty .unsaved-tag { display: inline-flex !important; }
tr.is-dirty .cli-stale { display: block !important; }
tr.is-dirty .cli { opacity: 0.5; }

/* Toggle */
.toggle {
  appearance: none;
  position: relative;
  flex: 0 0 auto;
  width: 48px;
  height: 24px;
  margin: 0;
  border-radius: 12px;
  background: var(--border-strong);
  cursor: pointer;
  transition: background 110ms var(--ease);
}
.toggle::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--text-primary);
  transition: transform 110ms var(--ease);
}
.toggle:checked { background: #24a148; }
.toggle:checked::after { transform: translateX(24px); }
.toggle:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.toggle:disabled { opacity: 0.5; cursor: not-allowed; }
.toggle-row { display: inline-flex; align-items: center; gap: 12px; cursor: pointer; }

/* Pages */
.page { padding: 24px 32px 48px; max-width: 1600px; }
.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}
.page-head h1 { display: flex; align-items: center; gap: 12px; }
.page-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.detail > .page-head { margin-bottom: 16px; }

.routing-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 16px;
  margin-bottom: 1px;
  background: var(--layer-01);
}
.cli-status { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.cli-status .helper { margin: 0 4px 0 0; }

.advanced { margin-top: 24px; background: var(--layer-01); }
.advanced > summary, .inline-details > summary {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  list-style: none;
}
.advanced > summary { padding: 16px 24px; font-weight: 600; }
.advanced > summary:hover { background: var(--layer-hover-01); }
.advanced > summary::-webkit-details-marker, .inline-details > summary::-webkit-details-marker { display: none; }
.advanced > summary::before, .inline-details > summary::before {
  content: "";
  width: 8px;
  height: 8px;
  border: solid var(--text-primary);
  border-width: 0 2px 2px 0;
  transform: rotate(-45deg);
  transition: transform 110ms var(--ease);
}
.advanced[open] > summary::before, .inline-details[open] > summary::before { transform: rotate(45deg); }
.advanced-body { padding: 0 24px 24px; border-top: 1px solid var(--border-subtle); }
.advanced-body section { padding-top: 8px; }
.advanced-body h3 { margin-top: 16px; }

.inline-details { margin-top: 24px; }
.inline-details > summary { color: var(--link); }

/* Events */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px; }
.toolbar h2 { margin-right: auto; }

.content-switcher { display: flex; width: 100%; margin-top: 4px; }
.content-switcher.sm { width: auto; margin: 0 8px 0 0; }
.content-switcher .switch {
  flex: 1;
  height: 40px;
  padding: 0 16px;
  border: 1px solid var(--border-strong);
  border-left-width: 0;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  text-align: left;
  white-space: nowrap;
}
.content-switcher .switch:first-child { border-left-width: 1px; }
.content-switcher .switch:hover { background: var(--layer-hover-01); color: var(--text-primary); }
.content-switcher .switch.is-selected { background: var(--text-primary); border-color: var(--text-primary); color: var(--background); }
.content-switcher.sm .switch { height: 32px; padding: 0 12px; }

.events, .event, .event-raw, .spec-read, .diff, .diff-stat, .description, .notice-detail {
  user-select: text;
}
.events {
  height: calc(100vh - 360px);
  min-height: 320px;
  overflow: auto;
  background: #000;
}
.event {
  display: flex;
  gap: 8px;
  padding: 8px;
  border-bottom: 1px solid #262626;
  border-left: 2px solid var(--border-strong);
  font-family: var(--mono);
  letter-spacing: 0;
}
.event-main { flex: 1; min-width: 0; }
.event-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0 8px;
  color: #a8a8a8;
  font: 12px/18px var(--mono);
  overflow-wrap: anywhere;
}
.event .body { font: 13px/19px var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; }
.event-raw {
  padding: 2px 8px;
  background: #000;
  font: 12px/18px var(--mono);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.event-item { border-bottom: 1px solid #262626; border-left: 2px solid var(--border-strong); }
.agent-claude { border-left-color: #a56eff; }
.agent-codex { border-left-color: #4589ff; }
.agent-bob { border-left-color: #33b1ff; }
.agent-antigravity { border-left-color: #08bdba; }
.agent-other { border-left-color: #6f6f6f; }
.event-details > summary.event {
  min-height: 44px;
  border: 0;
  cursor: pointer;
  list-style: none;
}
.event-details > summary.event::-webkit-details-marker { display: none; }
.event-details > summary.event:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.event-toggle::before { content: "▸"; color: var(--text-secondary); }
.event-details[open] > summary .event-toggle::before { content: "▾"; }
.event-diagnostics { padding: 0 16px 16px; }
.event-label {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 8px 0;
  color: var(--text-secondary);
  font: 12px/18px var(--mono);
}
.event-label .helper { margin: 0 0 0 auto; }
.event-diagnostics pre {
  margin: 0;
  padding: 8px;
  max-height: 320px;
  overflow: auto;
  background: #161616;
  font: 12px/18px var(--mono);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.event-footer { padding: 16px; }
.event-window { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.event-window .helper { margin: 0; }
.retention-note { color: var(--text-helper); font-size: 12px; line-height: 16px; letter-spacing: 0.32px; margin: 8px 0 0; }
.event-raw { overflow-wrap: anywhere; }
.level-warn { color: var(--warning); }
.level-error { color: #ff8389; }
.level-info { color: var(--link); }

.countdown { font-variant-numeric: tabular-nums; font-weight: 600; }

/* Empty state */
.empty-state { max-width: 640px; padding: 48px 0; }
.empty-state .lede { margin-top: 8px; }
.getting-started { margin: 24px 0 0; padding: 0; list-style: none; counter-reset: step; }
.getting-started li {
  position: relative;
  padding: 12px 0 12px 40px;
  border-top: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  counter-increment: step;
}
.getting-started li strong { color: var(--text-primary); }
.getting-started li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 12px;
  width: 24px;
  height: 24px;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  font-size: 12px;
  line-height: 22px;
  text-align: center;
}
.getting-started li.is-done::before { content: ""; border-color: var(--interactive); background: var(--interactive); }

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background: rgba(0, 0, 0, 0.65);
}
.modal {
  display: flex;
  flex-direction: column;
  width: min(640px, 100%);
  max-height: calc(100vh - 48px);
  background: var(--layer-01);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}
.modal-header { position: relative; padding: 16px 64px 8px 16px; }
.modal-label { margin: 0 0 4px; color: var(--text-secondary); font-size: 12px; }
.modal-header h2 { font-size: 20px; line-height: 28px; font-weight: 400; }
.modal-close {
  position: absolute;
  top: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border: 0;
  background: transparent;
  color: var(--text-primary);
  cursor: pointer;
}
.modal-close:hover { background: var(--layer-hover-01); }
.modal-body { flex: 1; overflow: auto; padding: 8px 16px 32px; }
.modal-body > .helper:first-child { margin-top: 0; }
.modal-body .content-switcher { margin-bottom: 8px; }
.repo-hint { color: var(--warning); }
.modal-footer { display: flex; height: 64px; border-top: 1px solid var(--border-subtle); }
.modal-footer .btn {
  flex: 1;
  height: 64px;
  align-items: flex-start;
  padding: 14px 16px;
}
body.modal-open { overflow: hidden; }

.path-row { display: flex; gap: 0; }
.path-row > input { flex: 1; min-width: 0; }
.file-btn { position: relative; overflow: hidden; margin: 0; }
.field .file-btn { display: inline-flex; margin: 0; color: var(--text-primary); font-size: 14px; letter-spacing: 0.16px; }
.file-btn input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }

/* Toast */
#toast {
  position: fixed;
  right: 16px;
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  z-index: 40;
  max-width: min(480px, calc(100vw - 32px));
  white-space: pre-wrap;
}
#toast.ok, #toast.error {
  padding: 14px 16px;
  background: var(--layer-02);
  color: var(--text-primary);
  border-left: 3px solid var(--success);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}
#toast.error { border-left-color: var(--error); }
#toast:empty { display: none; }

.loading { padding: 24px; color: var(--text-secondary); }

.stage-chat-panel { max-width: 1000px; }
.stage-chat-panel .field select { width: 100%; }
.chat-transcript { max-height: 440px; min-height: 100px; overflow: auto; margin: 16px 0; border: 1px solid var(--border-subtle-02); background: var(--background); }
.chat-transcript > .helper, .chat-pending { padding: 16px; }
.chat-message { padding: 16px; border-bottom: 1px solid var(--border-subtle); border-left: 3px solid var(--border-interactive); }
.chat-message.is-human { border-left-color: var(--border-strong); background: var(--layer-01); }
.chat-message-meta { display: flex; gap: 16px; align-items: baseline; margin-bottom: 8px; }
.chat-message-meta time { color: var(--text-helper); font-size: 12px; }
.chat-message-body { white-space: pre-wrap; overflow-wrap: anywhere; }
.chat-compose { border: 0; margin: 0; padding: 0; min-width: 0; }
.chat-compose textarea { min-height: 100px; }
.chat-compose:disabled { opacity: .6; }
.chat-history { margin-top: 24px; }
.chat-history summary { padding: 8px 0; cursor: pointer; }

@media (prefers-reduced-motion: reduce) {
  .step.is-active .step-icon, .pulse { animation: none; }
}

@media (max-width: 1200px) {
  .overview, .repo-grid { grid-template-columns: minmax(0, 1fr); }
  .stepper { grid-template-columns: repeat(4, minmax(0, 1fr)); row-gap: 12px; }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 860px) {
  .shell-header { height: auto; flex-wrap: wrap; }
  .shell-nav { order: 3; width: 100%; flex: 1 0 100%; padding-left: 0; border-top: 1px solid var(--border-subtle); overflow-x: auto; }
  .shell-nav::before { display: none; }
  .shell-nav a { height: 40px; }
  .shell-tools { margin-left: auto; }
  .split { grid-template-columns: minmax(0, 1fr); }
  .rail { position: static; height: auto; max-height: 320px; }
  .detail, .page { padding: 16px; }
  .stepper { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2, .grid-3, .grid-4, .kv-wide, .rework-grid { grid-template-columns: minmax(0, 1fr); }
}

/* Keep library editors and their scrollable lists in the stacked phone layout. */
@media (max-width: 480px) {
  .view-prompts .split .detail, .view-repositories .split .detail { display: block; }
  .view-prompts .rail, .view-repositories .rail { max-height: 320px; border-right: 1px solid var(--border-subtle); }
  .view-prompts .rail-list, .view-repositories .rail-list { overflow: auto; overscroll-behavior-y: contain; }
}

.spec-feedback-panel { margin-top: 1.5rem; }
.spec-feedback-panel h2 { margin-bottom: 1rem; }
.spec-feedback-panel ul { margin-bottom: 1.5rem; padding-left: 1.5rem; }
.spec-feedback-panel fieldset { border: 0; padding: 0; margin: 0; }

/* Profile master-detail editor, using Carbon g100 tokens. */
.profiles-page { max-width: 1840px; padding: 32px clamp(20px, 3vw, 56px) 64px; }
.profiles-page-head { align-items: center; justify-content: flex-start; gap: 24px; margin-bottom: 24px; }
.profiles-page-head h1 { font-size: 34px; line-height: 44px; }
.profiles-page-head .lede { margin: 0; }
.profiles-layout { display: grid; grid-template-columns: 280px minmax(0,1fr); align-items: start; gap: 24px; }
.profile-sidebar { background: var(--layer-01); padding: 4px 0 16px; position: sticky; top: 72px; }
.profile-list-item { display: block; width: 100%; padding: 18px 16px; min-height: 84px; background: transparent; border: 0; border-bottom: 1px solid var(--border-subtle); border-left: 3px solid transparent; text-align: left; cursor: pointer; }
.profile-list-item:hover { background: var(--layer-hover-01); }
.profile-list-item.is-selected { background: var(--layer-selected-01); border-left-color: var(--interactive); }
.profile-list-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.profile-list-title strong { font-size: 15px; font-weight: 400; overflow-wrap: anywhere; }
.profile-list-item.is-selected strong { font-weight: 600; }
.profile-list-tags { display: flex; gap: 5px; flex-wrap: wrap; justify-content: flex-end; }
.profile-list-tags .tag { font-size: 11px; height: 22px; padding: 0 7px; }
.profile-list-meta { display: block; color: var(--text-helper); font-size: 11px; margin-top: 6px; overflow-wrap: anywhere; }
.profile-list-heading { font-size: 14px; padding: 32px 19px 12px; color: var(--text-secondary); border-bottom: 1px solid var(--border-subtle); }
.profile-list-empty { color: var(--text-helper); padding: 0 19px; font-size: 12px; }
.profile-sidebar > .btn { margin: 20px 3px 0; justify-content: space-between; width: calc(100% - 6px); }
.profile-main { min-width: 0; }
.profile-card { background: var(--layer-01); padding: 24px; }
.profile-card-header { display: flex; justify-content: space-between; align-items: start; gap: 16px; padding-bottom: 18px; border-bottom: 1px solid var(--border-subtle-02); }
.profile-card-heading { min-width: 0; flex: 1; }
.profile-title-line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.profile-title-line h2 { font-size: 22px; line-height: 30px; font-weight: 400; }
.tag.outline { border: 1px solid var(--text-secondary); color: var(--text-secondary); background: transparent; }
.profile-description { font-size: 12px; line-height: 18px; color: var(--text-helper); margin: 6px 0 0; max-width: 70ch; }
.profile-header-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 0; max-width: 50%; }
.profile-header-actions .btn { font-size: 12px; min-height: 30px; padding: 0 8px; }
.profile-role-row { display: grid; grid-template-columns: minmax(170px,1.2fr) minmax(118px,.65fr) minmax(215px,1fr); align-items: center; gap: 20px; min-height: 86px; padding: 14px 0; border-bottom: 1px solid var(--border-subtle-02); }
.profile-role-label strong { font-weight: 600; font-size: 14px; }
.profile-role-label p { margin: 3px 0 0; color: var(--text-helper); font-size: 12px; line-height: 18px; }
.profile-select, .profile-name-input { width: 100%; min-width: 0; height: 38px; border: 0; border-radius: 0; border-bottom: 1px solid var(--border-strong); background: transparent; padding: 0 28px 0 12px; color: var(--text-secondary); }
.profile-select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23c6c6c6'%3E%3Cpath d='M8 11 3 6l.7-.7L8 9.6l4.3-4.3.7.7z'/%3E%3C/svg%3E"); background-position: right 10px center; background-repeat: no-repeat; background-size: 16px; cursor: pointer; }
.profile-select:hover { background-color: var(--layer-hover-01); }
.profile-select:disabled { cursor: not-allowed; border-bottom-style: dashed; color: var(--text-helper); }
.profile-name-input { max-width: 300px; font-size: 20px; background: var(--layer-02); }
.profile-role-row.is-skipped .profile-role-label { color: var(--text-helper); }
.profile-role-row > .tag { justify-self: start; }
.profile-tier { min-width: 0; }
.tier-segments { display: flex; width: 100%; border: 1px solid var(--text-secondary); border-radius: 3px; overflow: hidden; }
.tier-segment { position: relative; flex: 1; min-width: 0; margin: 0; cursor: pointer; }
.tier-segment + .tier-segment { border-left: 1px solid var(--border-subtle-02); }
.tier-segment input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.tier-segment span { display: block; text-align: center; color: var(--text-secondary); padding: 7px 4px; font-size: 13px; }
.tier-segment:hover span { background: var(--layer-hover-02); }
.tier-segment input:checked + span { background: var(--text-primary); color: var(--background); }
.tier-segment input:focus-visible + span { outline: 2px solid var(--interactive); outline-offset: -3px; }
.model-caption { display: block; margin-top: 6px; font-size: 11px; color: var(--text-helper); overflow-wrap: anywhere; }
.managed-model { color: var(--text-helper); font-family: "IBM Plex Sans", sans-serif; font-size: 12px; }
.profile-stages { display: grid; grid-template-columns: minmax(170px,1.2fr) minmax(0,1.65fr); align-items: center; gap: 20px; padding: 18px 0; border-bottom: 1px solid var(--border-subtle); }
.profile-stage-controls { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.profile-stage-toggle { display: flex; flex-direction: column; gap: 4px; color: var(--text-secondary); font-size: 12px; cursor: pointer; }
.profile-toggle-control { display: block; position: relative; width: 36px; height: 19px; }
.profile-toggle-control input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; z-index: 1; }
.profile-toggle-track { display: block; width: 36px; height: 19px; background: var(--secondary); border-radius: 12px; }
.profile-toggle-track::after { content: ""; position: absolute; width: 13px; height: 13px; left: 3px; top: 3px; border-radius: 50%; background: #f4f4f4; transition: transform 100ms var(--ease); }
.profile-toggle-control input:checked + .profile-toggle-track { background: #24a148; }
.profile-toggle-control input:checked + .profile-toggle-track::after { transform: translateX(17px); }
.profile-toggle-control input:focus-visible + .profile-toggle-track { outline: 2px solid var(--focus); outline-offset: 3px; }
.profile-advanced { border-bottom: 1px solid var(--border-subtle); }
.profile-advanced > summary, .resolved-routing > summary { display: flex; align-items: center; gap: 16px; padding: 14px 0; list-style: none; cursor: pointer; color: var(--text-secondary); }
.profile-advanced > summary::before, .resolved-routing > summary::before { content: ""; width: 7px; height: 7px; flex: 0 0 7px; border: solid currentColor; border-width: 0 1px 1px 0; transform: rotate(-45deg); margin: 0 4px; }
.profile-advanced[open] > summary::before, .resolved-routing[open] > summary::before { transform: rotate(45deg); }
.profile-advanced > summary::-webkit-details-marker, .resolved-routing > summary::-webkit-details-marker { display: none; }
.summary-meta { margin-left: auto; color: var(--text-helper); font-size: 12px; font-weight: 400; }
.profile-advanced-body { padding: 0 0 20px; }
.profile-advanced-body > .field { max-width: 320px; }
.profile-extra-lenses { display: flex; gap: 24px; margin-top: 20px; }
.profile-refinements .field { font-size: 12px; }
.profile-card-footer { display: flex; justify-content: flex-end; align-items: center; padding-top: 16px; gap: 0; }
.profile-card-footer .btn { min-width: 120px; height: 48px; align-items: flex-start; padding-top: 12px; }
.profile-save-status { font-size: 12px; color: var(--text-helper); margin-right: 20px; }
.profile-error { color: #ff8389; font-size: 12px; }
.profile-error:empty { display: none; }
.registry-agent { border-top: 1px solid var(--border-subtle-02); padding: 16px 24px; }
.registry-slots { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 16px; margin-bottom: 16px; }
.registry-slots label { display: grid; gap: 8px; margin-top: 12px; }
.registry-agent > .helper { margin-bottom: 8px; }
.routing-tabs { margin-bottom: 24px; overflow-x: auto; }
.routing-tab-panel { min-width: 0; }
.agent-registry { background: transparent; }
.routing-factory-settings { margin-bottom: 24px; }
.routing-factory-settings .toggle-row { margin-top: 16px; }
.saved-stage-assignments { margin-top: 16px; }
.saved-stage-assignments p { font-size: 12px; }
.lens-card { min-width: 0; }
.lens-card h2 { font-size: 22px; line-height: 30px; font-weight: 400; }
.lens-routing-note { margin: 16px 0; }
.lens-card > label.field { display: block; color: var(--text-secondary); margin-bottom: 8px; font-size: 12px; }
.lens-card textarea.prompt-editor { min-height: 420px; width: 100%; resize: vertical; }
.profile-stage-section > h3 { color: var(--text-primary); font-size: 16px; font-weight: 600; padding: 22px 0 10px; }
.profile-stage-section > .helper { margin: 0 0 8px; }
.stage-condition { display: block; font-size: 11px; color: var(--text-helper); margin-top: 5px; }
.profile-role-label .profile-stage-toggle { flex-direction: row; align-items: center; justify-content: flex-start; gap: 12px; margin-top: 8px; }
.profile-lens-row { border-bottom: 1px solid var(--border-subtle-02); }
.profile-lens-row > .profile-role-row { border-bottom: 0; }
.profile-lens-title { display: flex; align-items: center; gap: 12px; }
.profile-lens-title .profile-stage-toggle.is-compact { margin: 0; flex-shrink: 0; }
.profile-lens-row.is-skipped .profile-lens-title > strong { color: var(--text-helper); }
.lens-routing-switcher { margin: 0; }
.lens-routing-switcher .switch { height: 38px; min-width: 0; padding: 0 8px; text-align: center; font-size: 12px; white-space: normal; line-height: 16px; }
.lens-resolved { min-width: 0; color: var(--text-secondary); font-size: 12px; }
.lens-resolved > strong { font-weight: 400; }
.lens-resolved > .helper { display: block; font-size: 11px; margin-top: 4px; }
.lens-routing-intro { margin: 0 0 20px; }
.lens-routing-fields { display: grid; gap: 20px; }
.lens-routing-fields .field { display: grid; gap: 8px; margin: 0; }
.lens-routing-fields .profile-select { background-color: var(--layer-02); }
.lens-routing-save-note { margin-top: 20px; }
.lens-default-routing .profile-role-row { grid-template-columns: minmax(140px,1fr) minmax(190px,1.4fr) 0; }
.full-stage-profile > .profile-card-footer, .lens-card > .profile-card-footer { position: sticky; bottom: 0; z-index: 2; background: var(--layer-01); padding: 16px 0; border-top: 1px solid var(--border-subtle); }
.registry-editor { margin: 0; padding: 0; }
.registry-layout { display: grid; grid-template-columns: 280px minmax(0,1fr); gap: 24px; align-items: start; }
.registry-card { min-width: 0; background: var(--layer-01); padding: 24px; }
.registry-card h2 { font-size: 22px; line-height: 30px; font-weight: 400; }
.registry-column-head, .registry-tier-row { display: grid; grid-template-columns: minmax(140px,1fr) minmax(120px,1fr) minmax(110px,.7fr); gap: 24px; align-items: center; }
.registry-column-head { font-size: 12px; color: var(--text-helper); padding: 4px 0 12px; }
.registry-tier-row { border-bottom: 1px solid var(--border-subtle-02); padding: 22px 0; }
.registry-tier-row input.profile-select { background-image: none; padding-right: 12px; font-size: 14px; }
.registry-adapter-note { margin-top: 16px; }
.registry-managed { padding: 24px 0; color: var(--text-secondary); }
.registry-managed p { color: var(--text-helper); margin-top: 8px; font-size: 14px; }
.registry-footer { border-top: 1px solid var(--border-subtle); margin-top: 24px; }
.routing-table .helper { white-space: normal; }
.switch-group { flex-wrap: wrap; }

/* Compact task creation with a grouped, truthful routing preview. */
.modal[data-action="new-task"] { width: min(820px,100%); }
.modal[data-action="new-task"] .modal-header { padding: 20px 64px 8px 24px; }
.modal[data-action="new-task"] .modal-body { padding: 8px 24px 24px; }
@media (min-width: 481px) {
  .modal[data-action="design-system"] {
    width: min(636px, 100%);
    max-height: min(880px, calc(100dvh - 48px));
  }
}
.modal[data-action="design-system"] .modal-footer { display: none; }
.modal[data-action="design-system"] .modal-body {
  padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px));
}
.design-panel .design-profile, .modal[data-action="design-system"] .design-profile {
  margin: 12px 0;
  padding: 12px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  background: var(--background);
  color: var(--text-primary);
  font-family: var(--mono);
  font-size: 14px;
  line-height: 20px;
}
.design-evidence { list-style: none; margin: 12px 0; padding: 0; display: grid; gap: 8px; }
.design-evidence li {
  display: grid;
  gap: 2px;
  padding: 8px 12px;
  background: var(--background);
  border: 1px solid var(--border-subtle);
  overflow-wrap: anywhere;
}
.design-candidate { font-weight: 600; }
.design-meta { color: var(--text-helper); font-size: 12px; line-height: 16px; }
.design-choices { border: 0; margin: 12px 0; padding: 0; display: grid; gap: 8px; min-width: 0; }
.design-choice {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-height: 44px;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--border-subtle);
  background: var(--background);
  cursor: pointer;
}
.design-choice input { width: 16px; height: 16px; margin-top: 4px; flex: 0 0 auto; }
.design-choice span { min-width: 0; overflow-wrap: anywhere; }
.design-choice .helper { display: block; }
.design-custom, .modal[data-action="design-system"] input[type="text"] {
  width: 100%;
  min-height: 48px;
  font-size: 16px;
  line-height: 24px;
}
textarea.design-custom {
  display: block;
  min-height: 160px;
  margin: 8px 0;
  padding: 12px;
  resize: vertical;
  scroll-margin-bottom: 40vh;
  background: var(--background);
  color: var(--text-primary);
  border: 1px solid var(--border-strong);
}
.design-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.design-actions .btn { min-height: 44px; }
.design-status { margin-bottom: 8px; }
.modal[data-action="design-system"] .form-error { color: var(--error); }
.modal[data-action="new-task"] .modal-header h2 { font-size: 24px; }
.modal[data-action="new-task"] .field input, .modal[data-action="new-task"] .field select { background-color: transparent; }
.new-task-top { column-gap: 32px; align-items: start; }
.new-task-profile { max-width: calc(50% - 16px); margin-top: 20px; }
.new-task-project > .field:first-child { margin-top: 16px; }
.new-task-top .field { margin-bottom: 0; }
.new-task-project > .helper { font-size: 11px; }
.resolved-routing { margin-top: 24px; border-top: 1px solid var(--border-subtle-02); border-bottom: 1px solid var(--border-subtle); }
.resolved-routing-body { padding: 4px 0 20px; }
.resolved-plan-meta { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 10px; }
.resolved-table { font-size: 13px; }
.resolved-table th, .resolved-table td { padding: 9px 14px; }
.resolved-table thead th { background: var(--layer-02); }
.resolved-table tbody tr:hover { background: var(--layer-01); }
.resolved-table tbody th { width: 40%; }
.resolved-table .mono { color: var(--text-helper); font-size: 11px; white-space: normal; }
.resolved-table .is-skipped { color: var(--text-helper); }
.resolved-table .resolved-note { font-size: 12px; color: var(--text-helper); }
.resolved-table .tag { height: 22px; font-size: 11px; font-family: "IBM Plex Sans", sans-serif; }
.resolved-warning { margin-top: 10px; }
.new-task-extras { margin-top: 16px; }
.new-task-extras > summary { font-size: 12px; }
.new-task-extras .actions { margin-top: 12px; }
@media (max-width: 1200px) {
  .profiles-layout, .registry-layout { grid-template-columns: 235px minmax(0,1fr); gap: 20px; }
  .profile-card, .registry-card { padding: 20px; }
  .profile-card-header { flex-direction: column; gap: 10px; }
  .profile-header-actions { max-width: none; justify-content: flex-start; margin-left: -8px; }
  .profile-role-row { grid-template-columns: minmax(150px,1fr) minmax(100px,.65fr) minmax(190px,1fr); gap: 14px; }
  .profile-stages { grid-template-columns: 1fr; gap: 12px; }
  .profile-stage-controls { justify-content: flex-start; gap: 24px; }
}
@media (max-width: 780px) {
  .profiles-page { padding: 24px 20px 48px; }
  .profiles-layout { grid-template-columns: minmax(0,1fr); }
  .profile-sidebar { position: static; display: flex; overflow-x: auto; align-items: stretch; padding: 0; }
  .profile-list-item { min-width: 180px; width: 180px; border-bottom: 3px solid transparent; border-left: 0; padding: 14px; }
  .profile-list-item.is-selected { border-bottom-color: var(--interactive); }
  .profile-list-title { flex-wrap: wrap; justify-content: flex-start; }
  .profile-list-heading, .profile-list-empty { display: none; }
  .profile-sidebar > .btn { min-width: 145px; margin: 0; }
  .profiles-page-head { flex-direction: column; align-items: flex-start; gap: 8px; }
  .registry-layout { grid-template-columns: minmax(0,1fr); gap: 20px; }
  .registry-sidebar { display: flex; overflow-x: auto; }
  .registry-column-head, .registry-tier-row { gap: 12px; grid-template-columns: minmax(110px,1fr) minmax(100px,1fr) minmax(90px,.7fr); }
}
@media (max-width: 1020px) {
  .profile-lens-row > .profile-role-row { grid-template-columns: minmax(0,1fr) minmax(180px,1fr); }
  .lens-resolved { grid-column: 1 / -1; }
}
@media (max-width: 620px) {
  .profile-role-row { grid-template-columns: minmax(0,1fr) minmax(0,1fr); row-gap: 10px; padding: 18px 0; }
  .profile-role-label { grid-column: 1 / -1; }
  .profile-header-actions { gap: 0; }
  .profile-card-footer { flex-wrap: wrap; row-gap: 10px; }
  .profile-save-status { flex: 1 0 100%; }
  .profile-card-footer .btn { flex: 1; min-width: 0; }
  .registry-slots { grid-template-columns: 1fr; }
  .new-task-profile { max-width: none; }
  .resolved-table th, .resolved-table td { padding: 8px; }
  .resolved-table tbody th { width: auto; }
  .registry-card { padding: 16px; }
  .registry-column-head { display: none; }
  .registry-tier-row { grid-template-columns: minmax(0,1fr) minmax(0,1fr); row-gap: 12px; }
  .lens-default-routing .profile-role-row { grid-template-columns: minmax(0,1fr); gap: 12px; }
  .lens-default-routing .profile-role-row > span:empty { display: none; }
  .profile-lens-row > .profile-role-row { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .profile-lens-row .lens-resolved { grid-column: auto; }
}

@media (max-width: 1020px) and (min-width: 861px) {
  .shell-header { height: auto; flex-wrap: wrap; }
  .shell-nav { order: 3; width: 100%; flex: 1 0 100%; padding-left: 0; border-top: 1px solid var(--border-subtle); overflow-x: auto; }
  .shell-nav::before { display: none; }
  .shell-nav a { height: 40px; }
  .shell-tools { margin-left: auto; }
  .profile-sidebar { top: 112px; }
}

.phone-back, .progress-toggle { display: none; }

@media (max-width: 480px) {
  :root { --text-placeholder: #a8a8a8; }
  html { scroll-padding-bottom: calc(160px + env(safe-area-inset-bottom, 0px)); }
  .shell-header { position: static; }
  .brand { min-height: 44px; }
  .shell-tools { flex: 1 0 100%; flex-wrap: wrap; margin: 0; padding: 8px 16px; }
  .shell-tools .header-btn, .shell-nav a { min-height: 44px; height: auto; }
  .shell-nav a { flex-shrink: 0; }
  .split .detail { display: none; }
  .split.is-phone-detail .rail { display: none; }
  .split.is-phone-detail .detail { display: block; }
  .rail { max-height: none; border-right: 0; }
  .rail-list { overflow: visible; overscroll-behavior-y: auto; }
  .phone-back { display: inline-flex; margin-bottom: 8px; }
  .task-head, .panel { padding: 16px; }
  .task-title { font-size: 20px; line-height: 28px; overflow-wrap: anywhere; }
  .task-item-title { display: block; -webkit-line-clamp: unset; overflow: visible; }
  .task-item > span { width: 100%; }
  .task-item-top { flex-wrap: wrap; }
  .task-item, .task-meta, .task-key, .task-item-key, .task-item-meta, .notice, .helper, .lede, .panel, .more-actions, .modal-header { overflow-wrap: anywhere; }
  .btn, .btn.sm, .btn.xs, .tab, .content-switcher .switch,
  .content-switcher.sm .switch, .rail-head .task-collection-switcher .switch,
  .task-item, .search input, summary, .toggle-row, .compact-select, .modal-close,
  .profile-stage-toggle, .tier-segment, .file-btn {
    min-width: 44px;
    min-height: 44px;
    height: auto;
  }
  .btn { white-space: normal; max-width: 100%; padding-top: 8px; padding-bottom: 8px; }
  .content-switcher .switch { white-space: normal; overflow-wrap: anywhere; }
  .tab { flex-shrink: 0; }
  summary { align-content: center; }
  input, select, textarea, textarea.code, .field input, .field select, .field textarea, .compact-select { font-size: 16px; }
  input:not([type=checkbox]):not([type=radio]):not([type=hidden]), select { min-height: 44px; }
  .compact-select, .switch-group, .toolbar, .notice-action { max-width: 100%; }
  .progress-toggle { display: flex; width: 100%; text-align: left; margin-bottom: 8px; }
  .stepper { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .stepper.is-collapsed { display: none; }
  .step { border-left: 2px solid var(--border-subtle-02); border-top-width: 0; padding: 8px; }
  .step.is-incomplete { border-left-color: var(--border-subtle-02); }
  .step.is-complete, .step.is-active, .step.is-queued, .step.is-pending { border-left-color: var(--interactive); }
  .step.is-waiting { border-left-color: #a56eff; }
  .step.is-paused { border-left-color: #ee5396; }
  .step.is-error { border-left-color: var(--error); }
  .step.is-cancelled { border-left-color: var(--border-strong); }
  .phone-action-bar {
    position: sticky;
    bottom: 0;
    z-index: 2;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 16px;
    padding: 8px 16px calc(8px + env(safe-area-inset-bottom, 0px));
    background: var(--layer-01);
    border-top: 1px solid var(--border-subtle);
  }
  .phone-action-bar .btn { flex: 1 1 120px; }
  .spec-panel { padding-bottom: 0; }
  .has-final-actions .spec-panel .phone-action-bar { position: static; }
  .spec-read { max-height: none; overflow-wrap: anywhere; }
  textarea.spec-editor { min-height: 60vh; scroll-margin-bottom: 160px; }
  .more-actions { flex: 1 0 100%; min-width: 0; border-top: 1px solid var(--border-subtle); }
  .more-actions > summary { cursor: pointer; color: var(--link); padding: 8px 0; }
  .more-actions .actions { margin-top: 8px; }
  .notice, .switch-group, .toolbar, .notice-action { flex-wrap: wrap; }
  .notice-action { flex: 1 1 100%; }
  .notice-action .link { display: inline-flex; align-items: center; min-height: 44px; }
  .grid-2, .grid-3, .grid-4, .new-task-top { grid-template-columns: minmax(0, 1fr); }
  .modal-backdrop { padding: 0; align-items: stretch; top: var(--app-top, 0px); }
  .modal, .modal[data-action="new-task"] {
    width: 100%;
    max-height: var(--app-height, 100dvh);
    height: var(--app-height, 100dvh);
    min-width: 0;
    margin: 0;
  }
  .modal-header, .modal-footer { flex-shrink: 0; }
  .modal[data-action="request-final-changes"] .modal-body { scroll-padding-bottom: 16px; }
  .modal-body { min-height: 0; }
  .modal-footer { height: auto; padding-bottom: env(safe-area-inset-bottom, 0px); }
  .modal-footer .btn { height: auto; min-height: 64px; }
  .modal[data-action="new-task"] .modal-header { padding-left: 16px; }
  .modal[data-action="new-task"] .modal-body { padding: 8px 16px 24px; }
  .new-task-profile { max-width: none; }
  .resolved-plan-meta, .resolved-routing > summary { flex-wrap: wrap; }
  .resolved-table thead { display: none; }
  .resolved-table, .resolved-table tbody, .resolved-table tr, .resolved-table th, .resolved-table td { display: block; width: 100%; }
  .resolved-table tbody th { width: 100%; font-weight: 600; }
  .resolved-table th, .resolved-table td { padding: 8px; border: 0; overflow-wrap: anywhere; }
  .resolved-table tr { border-bottom: 1px solid var(--border-subtle); }
  .resolved-table .mono { font-size: 12px; }
  .data-table { display: block; max-width: 100%; overflow-x: auto; }
  .events { height: 70vh; height: 70dvh; min-height: 280px; }
  .activity { padding: 16px 8px; }
  .toolbar .compact-select { min-width: 44px; }
  .profile-extra-lenses { flex-wrap: wrap; }
  .profiles-page, .page, .detail { min-width: 0; padding-left: 16px; padding-right: 16px; }
  .profile-sidebar { flex-wrap: wrap; overflow: visible; }
  .profile-sidebar .profile-list-item, .profile-sidebar > .btn { min-width: 0; width: 100%; }
  .profile-card-header, .profile-role-row, .profile-stages, .profile-extra-lenses, .page-head h1, .profile-title-line { overflow-wrap: anywhere; }
  .profile-lens-row .lens-resolved { grid-column: 1 / -1; }
}

@media (max-height: 480px) {
  .events { height: 70vh; min-height: 200px; }
}

.account-slot { position: relative; display: flex; align-items: center; }
.account-avatar, .account-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  background: var(--layer-02);
  color: var(--text-primary);
  font-weight: 600;
  font-size: 14px;
  line-height: 1;
}
.account-avatar { margin: 2px 12px 2px 4px; padding: 0; border: 0; cursor: pointer; }
.account-avatar:hover { background: var(--layer-hover-02); }
.modal.profile-dialog { border: 1px solid var(--border-subtle); }
.profile-dialog form .field input { background: var(--layer-01); border: 1px solid var(--border-strong); }
.profile-dialog h2 { font-size: 16px; line-height: 24px; font-weight: 600; }
.profile-content { display: flex; flex-direction: column; gap: 24px; }
.profile-content form { margin: 0; }
.profile-content form h2 { margin: 0 0 16px; }
.profile-content .field { margin: 16px 0; }
.account-identity { display: flex; align-items: center; gap: 16px; overflow-wrap: anywhere; }
.account-identity p { margin: 8px 0 0; color: var(--text-secondary); }
.profile-dialog .error-text { color: var(--error); }

.login-card { max-width: 448px; margin: 64px auto; padding: 32px; background: #262626; }
.login-card h1 { font-size: 28px; line-height: 36px; font-weight: 400; margin: 0 0 24px; }
.login-card .field { margin-bottom: 24px; }
.login-card label { display: block; margin-bottom: 8px; }
.login-card input { width: 100%; height: 48px; background: #262626; border: 1px solid #6f6f6f; color: #f4f4f4; }
.login-card .btn { height: 48px; width: 100%; }
.login-card [role="alert"] { color: #fa4d56; }

@media (max-width: 480px) {
  .shell-header { padding-top: env(safe-area-inset-top, 0px); }
  .brand { order: 1; flex: 1 1 auto; min-width: 0; }
  .account-slot { order: 2; margin-left: auto; }
  .shell-nav { order: 3; }
  .shell-tools { order: 4; }
  .view-access { overflow-x: clip; }
  .access-phone, .account-sheet {
    font-size: 14px;
    line-height: 21px;
    overflow-wrap: anywhere;
  }
  .access-phone fieldset {
    border: 0;
    margin: 0;
    padding: 0;
    min-inline-size: 0;
  }
  .access-phone legend { padding: 0; }
  .access-phone {
    padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  }
  .access-phone .page-head .btn { width: auto; }
  .access-phone .access-block,
  .access-phone form > .btn,
  .access-phone .btn.primary,
  .account-sheet .btn {
    width: 100%;
    max-width: 100%;
    justify-content: flex-start;
    min-height: 48px;
  }
  .access-section-picker, .access-back {
    width: 100%;
    min-height: 48px;
    justify-content: flex-start;
    margin: 0 0 16px;
    background: var(--layer-01);
    color: var(--link);
  }
  .access-sections { display: flex; flex-direction: column; gap: 8px; }
  .access-current { margin-left: auto; color: var(--text-secondary); font-size: 12px; line-height: 16px; }
  .access-card { min-width: 0; padding: 16px 0; border-bottom: 1px solid var(--border-subtle); }
  .access-card h2, .access-project-name, .access-identity, .account-identity, .access-json {
    overflow-wrap: anywhere;
    word-break: break-word;
  }
  .access-card h2 { margin: 0 0 4px; }
  .access-username, .access-label, .access-meta { display: block; margin: 4px 0 0; color: var(--text-helper); font-size: 12px; line-height: 16px; }
  .access-status { margin: 4px 0 0; font-weight: 600; }
  .access-status.is-active { color: var(--success); }
  .access-status.is-disabled { color: var(--error); }
  .access-actions-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
  .access-actions-row .btn,
  .access-phone .btn.ghost.access-block,
  .access-phone .btn.danger-ghost.access-block {
    width: 100%;
    justify-content: flex-start;
    min-height: 48px;
    background: var(--layer-01);
  }
  .access-phone .field input,
  .access-phone .field select,
  .access-phone .field textarea,
  .account-sheet .field input,
  .account-sheet .field select {
    background: var(--field-02);
  }
  .access-phone .access-permission,
  .access-phone .toggle-row {
    display: flex;
    width: 100%;
    min-height: 48px;
    align-items: flex-start;
    gap: 12px;
    padding: 12px;
    background: var(--layer-01);
    margin-top: 1px;
  }
  .access-phone .access-permission input,
  .access-phone .toggle-row input {
    width: 20px;
    min-width: 20px;
    height: 20px;
    min-height: 20px;
    margin-top: 2px;
    flex: 0 0 auto;
  }
  .access-json, .access-secret-value {
    display: block;
    font-size: 13px;
    line-height: 20px;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    user-select: text;
    margin: 8px 0;
  }
  .access-json { padding: 12px; background: var(--layer-01); }
  .account-sheet {
    min-height: calc(var(--app-height, 100dvh) - var(--shell-height, 48px));
    padding: 16px 16px calc(24px + env(safe-area-inset-bottom, 0px));
    background: var(--background);
  }
  .account-sheet .error-text { color: var(--error); margin: 8px 0; }
  .account-sheet .btn.danger-ghost { color: #ff8389; }
}

.activity > .toolbar h2 { order: 1; }
.activity > .toolbar > :not(h2):not(.usage-inline) { order: 2; }
.usage-inline {
  display: flex;
  flex: 1 1 100%;
  order: 3;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 12px;
  min-width: 0;
  min-height: 44px;
}
.usage-inline-metric { min-width: 0; overflow-wrap: anywhere; }
.usage-inline .usage-figure { font-size: 14px; line-height: 20px; font-weight: 600; }
.usage-details {
  min-width: 44px;
  min-height: 44px;
  padding: 0 12px;
  border: 0;
  background: transparent;
  color: var(--link);
  cursor: pointer;
}
.usage-details:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.usage-inline .usage-bound { flex: 1 1 100%; margin: 0; }
.usage-inspector-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.usage-kicker { color: var(--text-secondary); font-size: 12px; line-height: 16px; letter-spacing: 0.32px; }
.usage-figure { margin: 0; font-size: 28px; line-height: 36px; font-weight: 400; overflow-wrap: anywhere; }
.usage-meta, .usage-subset, .usage-legacy, .usage-details { color: var(--text-secondary); font-size: 12px; line-height: 16px; letter-spacing: 0.32px; }
.usage-details { color: var(--link); }
.usage-bound {
  display: block;
  margin: 4px 0 0;
  padding-left: 8px;
  border-left: 3px solid var(--warning);
  color: var(--warning);
  overflow-wrap: anywhere;
}
.usage-error { color: var(--error); margin: 8px 0; overflow-wrap: anywhere; }
.usage-legacy { display: block; margin-top: 4px; }
.usage-wrap, .usage-metric, .usage-attempt, .usage-stage, .usage-agent, .usage-observation, .usage-sheet, .usage-inspector { overflow-wrap: anywhere; }
.activity-body { min-width: 0; }
.activity-stream { min-width: 0; }
.activity-body.has-usage-inspector {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 380px);
  gap: 16px;
  align-items: stretch;
}
.activity-body.has-usage-inspector .events { height: min(70dvh, calc(100dvh - 420px)); min-height: 280px; }
.usage-inspector {
  min-width: 0;
  max-height: min(70dvh, calc(100dvh - 420px));
  overflow: auto;
  padding: 16px;
  background: var(--layer-01);
}
.usage-inspector-body, .usage-sheet-body { min-width: 0; }
.usage-metric, .usage-attempt, .usage-block, .usage-close, .usage-back {
  min-height: 44px;
}
.usage-metric {
  margin-top: 8px;
  padding: 12px;
  background: var(--layer-02);
}
.usage-inspector .usage-metric { background: #262626; }
.usage-metric h2, .usage-metric h3, .usage-metric h4, .usage-stage h2, .usage-stage h3, .usage-agent h3, .usage-agent h4 { margin: 0; font-size: 14px; line-height: 20px; font-weight: 600; }
.usage-attempt, .usage-close, .usage-block {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  width: 100%;
  margin-top: 8px;
  padding: 12px;
  border: 0;
  background: var(--layer-02);
  color: inherit;
  text-align: left;
  cursor: pointer;
  white-space: normal;
}
.usage-close {
  width: auto;
  min-width: 44px;
  margin-top: 0;
  padding: 8px 12px;
  background: transparent;
  color: var(--link);
}
.usage-attempt:hover, .usage-close:hover, .usage-block:hover { background: var(--layer-hover-02); }
.usage-close:hover { background: var(--layer-hover-01); }
.usage-attempt-title { font-weight: 600; }
.usage-agent { margin-top: 12px; }
.usage-observation { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border-subtle); }
.usage-sheet {
  position: fixed;
  z-index: 40;
  left: 0;
  right: 0;
  top: var(--shell-height, 48px);
  bottom: 0;
  overflow: auto;
  padding: 16px 16px calc(24px + env(safe-area-inset-bottom, 0px));
  background: var(--background);
}
.usage-sheet h1 { margin: 8px 0 12px; font-size: 24px; line-height: 32px; font-weight: 400; overflow-wrap: anywhere; }
.usage-back { width: 100%; justify-content: flex-start; margin-bottom: 8px; }

@media (max-width: 900px) {
  .activity-body.has-usage-inspector { grid-template-columns: minmax(0, 1fr); }
  .usage-inspector { max-height: none; }
}
@media (max-width: 480px) {
  .activity > .toolbar .usage-inline { order: 2; }
  .activity > .toolbar > :not(h2):not(.usage-inline) { order: 3; }
  .usage-figure { font-size: 24px; line-height: 32px; }
  .usage-inline .usage-figure { font-size: 14px; line-height: 20px; }
  .usage-details, .usage-attempt, .usage-close, .usage-back, .usage-block { min-height: 44px; }
}

/* Access management uses the shared Carbon g100 controls and tokens. */
.access-page { min-width: 0; }
.access-page #access-panel { padding-top: 24px; }
.access-page .panel { padding: 16px; margin-bottom: 24px; min-width: 0; }
.access-page h2 { font-size: 16px; line-height: 24px; font-weight: 600; overflow-wrap: anywhere; }
.access-page fieldset { border: 0; padding: 0; margin: 16px 0 0; min-inline-size: 0; }
.access-page legend { padding: 0; color: var(--text-secondary); }
.access-page .table-toolbar { display: flex; align-items: center; gap: 16px; margin: 16px 0; min-width: 0; }
.access-page .table-toolbar .search { flex: 1; min-width: 0; }
.access-page .table-toolbar .search input { width: 100%; }
.access-page .table-toolbar .compact-select { max-width: 50%; }
.access-page .table-wrap { max-width: 100%; }
.access-page .data-table td, .access-page .data-table tbody th { overflow-wrap: anywhere; }
.access-page .data-table th { border-bottom: 1px solid var(--border-subtle); }
.access-page .data-table td .tag { height: auto; min-height: 24px; white-space: normal; }
.access-page .access-block { display: block; }
.access-page .access-users-table { overflow: visible; }
.access-page .access-menu-cell { position: relative; }
.access-page .overflow-trigger { width: 40px; padding: 0; justify-content: center; color: var(--text-primary); }
.access-page .access-menu { position: absolute; right: 40px; bottom: 0; z-index: 2; min-width: 192px; background: var(--layer-02); border: 1px solid var(--border-strong); }
.access-page .access-menu .btn { display: flex; width: 100%; min-height: 40px; }
.access-page .access-menu .btn:hover { background: var(--layer-hover-02); }
.access-page .access-menu .btn:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.access-page .profile-sidebar { padding: 16px 0; }
.access-page .profile-sidebar > .btn { width: calc(100% - 32px); margin: 0 16px 16px; }
.access-page .profile-list-item { padding: 16px; min-height: 80px; }
.access-page .profile-list-item[aria-current="true"] { background: var(--layer-selected-01); border-left: 3px solid var(--border-interactive); }
.access-page .profile-list-title { flex-wrap: wrap; }
.access-page .accordion-item { border-top: 1px solid var(--border-subtle); }
.access-page .accordion-item:last-of-type { border-bottom: 1px solid var(--border-subtle); }
.access-page .accordion-item summary { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; min-height: 48px; padding: 8px 16px; cursor: pointer; list-style: none; }
.access-page .accordion-item summary::-webkit-details-marker { display: none; }
.access-page .accordion-item summary::before { content: '›'; display: inline-block; transition: transform 110ms cubic-bezier(0.2, 0, 0.38, 0.9); }
.access-page .accordion-item[open] summary::before { transform: rotate(90deg); }
.access-page .accordion-item summary:hover { background: var(--layer-hover-01); }
.access-page .accordion-item summary .helper { margin: 0 0 0 auto; }
.access-page .access-permission { align-items: flex-start; gap: 8px; padding: 8px 16px; min-height: 40px; }
.access-page .access-permission > span { min-width: 0; overflow-wrap: anywhere; }
.access-page .access-permission input { flex: 0 0 auto; accent-color: var(--interactive); }
.access-page .inline-notification { background: var(--layer-01); padding: 16px; margin: 16px 0 24px; overflow-wrap: anywhere; }
.access-page .inline-notification.is-error { border-left: 3px solid var(--error); }
.access-page .inline-notification.is-info { border-left: 3px solid var(--border-interactive); }
.access-page .access-secret-value { display: block; white-space: pre-wrap; overflow-wrap: anywhere; margin: 8px 0; user-select: text; }
.access-page .access-loading { padding: 16px 0; }
.access-page .skeleton { display: block; position: relative; overflow: hidden; height: 16px; margin: 16px 0; background: var(--layer-01); }
.access-page .skeleton::after { content: ''; display: block; width: 32%; height: 100%; background: var(--layer-02); animation: access-shimmer 1.2s cubic-bezier(0.2, 0, 0.38, 0.9) infinite; }
@keyframes access-shimmer { from { transform: translateX(-100%); } to { transform: translateX(320%); } }
.access-page .audit-scroll { max-height: 60vh; overflow: auto; }
.access-page .audit-scroll thead th { position: sticky; top: 0; z-index: 1; }
.access-page .access-json { white-space: pre-wrap; overflow-wrap: anywhere; margin: 0; max-width: 100%; }
.access-page .data-table tr.is-proposed { background: var(--layer-selected-01); }
.access-page .access-grant { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-width: 192px; }
.access-page .access-grant select { width: 100%; }
.access-page .access-binding { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 8px 0; }
.access-page .access-sources { margin: 0; padding-left: 16px; }
.access-page .access-sources li + li { margin-top: 8px; }
.access-page .access-filter-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0; }
.access-page .field input:user-invalid { outline: 2px solid var(--error); outline-offset: -2px; }
@media (max-width: 1056px) {
  .access-page .profiles-layout { grid-template-columns: minmax(0, 1fr); }
  .access-page .profile-sidebar { position: static; display: block; }
}
@media (max-width: 672px) {
  .access-page .grid-2, .access-page .grid-3, .access-page .grid-4 { grid-template-columns: minmax(0, 1fr); }
  .access-page .table-toolbar { flex-wrap: wrap; }
  .access-page .table-toolbar .compact-select { max-width: 100%; }
  .access-page .table-toolbar .search { flex-basis: 100%; }
  .access-page .data-table { min-width: 640px; }
  .access-page .access-users-table { overflow-x: auto; }
  .access-page .access-menu { position: static; }
}
@media (prefers-reduced-motion: reduce) {
  .access-page .skeleton::after { animation: none; }
  .access-page .accordion-item summary::before { transition: none; }
}

.scorecard h1 { font-size: 28px; line-height: 36px; font-weight: 400; }
.scorecard h2 { font-size: 16px; line-height: 24px; font-weight: 600; margin: 24px 0 16px; }
.scorecard-filters { display: flex; flex-wrap: wrap; gap: 16px; align-items: end; margin-bottom: 24px; }
.scorecard-filters .field { margin: 0; }
.scorecard .data-table tbody tr:hover { background: #353535; }
.scorecard .data-table td { white-space: nowrap; }

.github-token-form h2 { font-size: 16px; line-height: 24px; margin: 0 0 16px; }
.github-token-form .field { margin: 16px 0; }
.github-token-form .actions { gap: 8px; flex-wrap: wrap; }
.github-token-form .error-text { color: var(--error); margin: 8px 0; }
